You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
144 lines
746 KiB
144 lines
746 KiB
(window.webpackJsonp=window.webpackJsonp||[]).push([[46,5,6,7],{"+NIl":function(ot,We,ee){(function(ne){ne(ee("VrN/"))})(function(ne){"use strict";ne.defineMode("stex",function(V,_){"use strict";function G(C,E){C.cmdState.push(E)}function U(C){return C.cmdState.length>0?C.cmdState[C.cmdState.length-1]:null}function R(C){var E=C.cmdState.pop();E&&E.closeBracket()}function B(C){for(var E=C.cmdState,b=E.length-1;b>=0;b--){var d=E[b];if(d.name=="DEFAULT")continue;return d}return{styleIdentifier:function(){return null}}}function I(C,E,b){return function(){this.name=C,this.bracketNo=0,this.style=E,this.styles=b,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var D={};D.importmodule=I("importmodule","tag",["string","builtin"]),D.documentclass=I("documentclass","tag",["","atom"]),D.usepackage=I("usepackage","tag",["atom"]),D.begin=I("begin","tag",["atom"]),D.end=I("end","tag",["atom"]),D.label=I("label","tag",["atom"]),D.ref=I("ref","tag",["atom"]),D.eqref=I("eqref","tag",["atom"]),D.cite=I("cite","tag",["atom"]),D.bibitem=I("bibitem","tag",["atom"]),D.Bibitem=I("Bibitem","tag",["atom"]),D.RBibitem=I("RBibitem","tag",["atom"]),D.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function L(C,E){C.f=E}function x(C,E){var b;if(C.match(/^\\[a-zA-Z@]+/)){var d=C.current().slice(1);return b=D.hasOwnProperty(d)?D[d]:D.DEFAULT,b=new b,G(E,b),L(E,k),b.style}if(C.match(/^\\[$&%#{}_]/))return"tag";if(C.match(/^\\[,;!\/\\]/))return"tag";if(C.match("\\["))return L(E,function(s,u){return A(s,u,"\\]")}),"keyword";if(C.match("\\("))return L(E,function(s,u){return A(s,u,"\\)")}),"keyword";if(C.match("$$"))return L(E,function(s,u){return A(s,u,"$$")}),"keyword";if(C.match("$"))return L(E,function(s,u){return A(s,u,"$")}),"keyword";var o=C.next();if(o=="%")return C.skipToEnd(),"comment";if(o=="}"||o=="]"){if(b=U(E),b)b.closeBracket(o),L(E,k);else return"error";return"bracket"}else return o=="{"||o=="["?(b=D.DEFAULT,b=new b,G(E,b),"bracket"):/\d/.test(o)?(C.eatWhile(/[\w.%]/),"atom"):(C.eatWhile(/[\w\-_]/),b=B(E),b.name=="begin"&&(b.argument=C.current()),b.styleIdentifier())}function A(C,E,b){if(C.eatSpace())return null;if(b&&C.match(b))return L(E,x),"keyword";if(C.match(/^\\[a-zA-Z@]+/))return"tag";if(C.match(/^[a-zA-Z]+/))return"variable-2";if(C.match(/^\\[$&%#{}_]/))return"tag";if(C.match(/^\\[,;!\/]/))return"tag";if(C.match(/^[\^_&]/))return"tag";if(C.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(C.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var d=C.next();return d=="{"||d=="}"||d=="["||d=="]"||d=="("||d==")"?"bracket":d=="%"?(C.skipToEnd(),"comment"):"error"}function k(C,E){var b=C.peek(),d;return b=="{"||b=="["?(d=U(E),d.openBracket(b),C.eat(b),L(E,x),"bracket"):/[ \t\r]/.test(b)?(C.eat(b),null):(L(E,x),R(E),x(C,E))}return{startState:function(){var C=_.inMathMode?function(E,b){return A(E,b)}:x;return{cmdState:[],f:C}},copyState:function(C){return{cmdState:C.cmdState.slice(),f:C.f}},token:function(C,E){return E.f(C,E)},blankLine:function(C){C.f=x,C.cmdState.length=0},lineComment:"%"}}),ne.defineMIME("text/x-stex","stex"),ne.defineMIME("text/x-latex","stex")})},"19Vz":function(ot,We,ee){(function(ne){ne(ee("VrN/"))})(function(ne){ne.defineOption("placeholder","",function(I,D,L){var x=L&&L!=ne.Init;if(D&&!x)I.on("blur",U),I.on("change",R),I.on("swapDoc",R),ne.on(I.getInputField(),"compositionupdate",I.state.placeholderCompose=function(){G(I)}),R(I);else if(!D&&x){I.off("blur",U),I.off("change",R),I.off("swapDoc",R),ne.off(I.getInputField(),"compositionupdate",I.state.placeholderCompose),V(I);var A=I.getWrapperElement();A.className=A.className.replace(" CodeMirror-empty","")}D&&!I.hasFocus()&&U(I)});function V(I){I.state.placeholder&&(I.state.placeholder.parentNode.removeChild(I.state.placeholder),I.state.placeholder=null)}function _(I){V(I);var D=I.state.placeholder=document.createElement("pre");D.style.cssText="height: 0; overflow: visible",D.style.direction=I.getOption("direction"),D.className="CodeMirror-placeholder CodeMirror-line-like";var L=I.getOption("placeholder");typeof L=="string"&&(L=document.createTextNode(L)),D.appendChild(L),I.display.lineSpace.insertBefore(D,I.display.lineSpace.firstChild)}function G(I){setTimeout(function(){var D=!1,L=I.getInputField();L.nodeName=="TEXTAREA"?D=!L.value:I.lineCount()==1&&(D=!/[^\u200b]/.test(L.querySelector(".CodeMirror-line").textContent)),D?_(I):V(I)},20)}function U(I){B(I)&&_(I)}function R(I){var D=I.getWrapperElement(),L=B(I);D.className=D.className.replace(" CodeMirror-empty","")+(L?" CodeMirror-empty":""),L?_(I):V(I)}function B(I){return I.lineCount()===1&&I.getLine(0)===""}})},"1eCo":function(ot,We,ee){(function(ne){ne(ee("VrN/"))})(function(ne){"use strict";var V={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},_={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};ne.defineMode("xml",function(G,U){var R=G.indentUnit,B={},I=U.htmlMode?V:_;for(var D in I)B[D]=I[D];for(var D in U)B[D]=U[D];var L,x;function A(a,g){function p(F){return g.tokenize=F,F(a,g)}var y=a.next();if(y=="<")return a.eat("!")?a.eat("[")?a.match("CDATA[")?p(E("atom","]]>")):null:a.match("--")?p(E("comment","-->")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),p(b(1))):null:a.eat("?")?(a.eatWhile(/[\w\._\-]/),g.tokenize=E("meta","?>"),"meta"):(L=a.eat("/")?"closeTag":"openTag",g.tokenize=k,"tag bracket");if(y=="&"){var M;return a.eat("#")?a.eat("x")?M=a.eatWhile(/[a-fA-F\d]/)&&a.eat(";"):M=a.eatWhile(/[\d]/)&&a.eat(";"):M=a.eatWhile(/[\w\.\-:]/)&&a.eat(";"),M?"atom":"error"}else return a.eatWhile(/[^&<]/),null}A.isInText=!0;function k(a,g){var p=a.next();if(p==">"||p=="/"&&a.eat(">"))return g.tokenize=A,L=p==">"?"endTag":"selfcloseTag","tag bracket";if(p=="=")return L="equals",null;if(p=="<"){g.tokenize=A,g.state=u,g.tagName=g.tagStart=null;var y=g.tokenize(a,g);return y?y+" tag error":"tag error"}else return/[\'\"]/.test(p)?(g.tokenize=C(p),g.stringStartCol=a.column(),g.tokenize(a,g)):(a.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function C(a){var g=function(p,y){for(;!p.eol();)if(p.next()==a){y.tokenize=k;break}return"string"};return g.isInAttribute=!0,g}function E(a,g){return function(p,y){for(;!p.eol();){if(p.match(g)){y.tokenize=A;break}p.next()}return a}}function b(a){return function(g,p){for(var y;(y=g.next())!=null;){if(y=="<")return p.tokenize=b(a+1),p.tokenize(g,p);if(y==">")if(a==1){p.tokenize=A;break}else return p.tokenize=b(a-1),p.tokenize(g,p)}return"meta"}}function d(a,g,p){this.prev=a.context,this.tagName=g,this.indent=a.indented,this.startOfLine=p,(B.doNotIndent.hasOwnProperty(g)||a.context&&a.context.noIndent)&&(this.noIndent=!0)}function o(a){a.context&&(a.context=a.context.prev)}function s(a,g){for(var p;;){if(!a.context)return;if(p=a.context.tagName,!B.contextGrabbers.hasOwnProperty(p)||!B.contextGrabbers[p].hasOwnProperty(g))return;o(a)}}function u(a,g,p){return a=="openTag"?(p.tagStart=g.column(),S):a=="closeTag"?f:u}function S(a,g,p){return a=="word"?(p.tagName=g.current(),x="tag",v):B.allowMissingTagName&&a=="endTag"?(x="tag bracket",v(a,g,p)):(x="error",S)}function f(a,g,p){if(a=="word"){var y=g.current();return p.context&&p.context.tagName!=y&&B.implicitlyClosed.hasOwnProperty(p.context.tagName)&&o(p),p.context&&p.context.tagName==y||B.matchClosing===!1?(x="tag",m):(x="tag error",w)}else return B.allowMissingTagName&&a=="endTag"?(x="tag bracket",m(a,g,p)):(x="error",w)}function m(a,g,p){return a!="endTag"?(x="error",m):(o(p),u)}function w(a,g,p){return x="error",m(a,g,p)}function v(a,g,p){if(a=="word")return x="attribute",h;if(a=="endTag"||a=="selfcloseTag"){var y=p.tagName,M=p.tagStart;return p.tagName=p.tagStart=null,a=="selfcloseTag"||B.autoSelfClosers.hasOwnProperty(y)?s(p,y):(s(p,y),p.context=new d(p,y,M==p.indented)),u}return x="error",v}function h(a,g,p){return a=="equals"?c:(B.allowMissing||(x="error"),v(a,g,p))}function c(a,g,p){return a=="string"?l:a=="word"&&B.allowUnquoted?(x="string",v):(x="error",v(a,g,p))}function l(a,g,p){return a=="string"?l:v(a,g,p)}return{startState:function(a){var g={tokenize:A,state:u,indented:a||0,tagName:null,tagStart:null,context:null};return a!=null&&(g.baseIndent=a),g},token:function(a,g){if(!g.tagName&&a.sol()&&(g.indented=a.indentation()),a.eatSpace())return null;L=null;var p=g.tokenize(a,g);return(p||L)&&p!="comment"&&(x=null,g.state=g.state(L||p,a,g),x&&(p=x=="error"?p+" error":x)),p},indent:function(a,g,p){var y=a.context;if(a.tokenize.isInAttribute)return a.tagStart==a.indented?a.stringStartCol+1:a.indented+R;if(y&&y.noIndent)return ne.Pass;if(a.tokenize!=k&&a.tokenize!=A)return p?p.match(/^(\s*)/)[0].length:0;if(a.tagName)return B.multilineTagIndentPastTag!==!1?a.tagStart+a.tagName.length+2:a.tagStart+R*(B.multilineTagIndentFactor||1);if(B.alignCDATA&&/<!\[CDATA\[/.test(g))return 0;var M=g&&/^<(\/)?([\w_:\.-]*)/.exec(g);if(M&&M[1])for(;y;)if(y.tagName==M[2]){y=y.prev;break}else if(B.implicitlyClosed.hasOwnProperty(y.tagName))y=y.prev;else break;else if(M)for(;y;){var F=B.contextGrabbers[y.tagName];if(F&&F.hasOwnProperty(M[2]))y=y.prev;else break}for(;y&&y.prev&&!y.startOfLine;)y=y.prev;return y?y.indent+R:a.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:B.htmlMode?"html":"xml",helperType:B.htmlMode?"html":"xml",skipAttribute:function(a){a.state==c&&(a.state=v)},xmlCurrentTag:function(a){return a.tagName?{name:a.tagName,close:a.type=="closeTag"}:null},xmlCurrentContext:function(a){for(var g=[],p=a.context;p;p=p.prev)p.tagName&&g.push(p.tagName);return g.reverse()}}}),ne.defineMIME("text/xml","xml"),ne.defineMIME("application/xml","xml"),ne.mimeModes.hasOwnProperty("text/html")||ne.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"500L":function(ot,We,ee){"use strict";ee.d(We,"a",function(){return f});var ne=ee("+L6B"),V=ee("2/Rp"),_=ee("2qtc"),G=ee("kLXV"),U=ee("9og8"),R=ee("k1fw"),B=ee("miYZ"),I=ee("tsqr"),D=ee("oBTY"),L=ee("tJVT"),x=ee("DZo9"),A=ee("8z0m"),k=ee("WmNS"),C=ee.n(k),E=ee("q1tI"),b=ee.n(E),d=ee("m3rI"),o=ee("wzkS"),s=ee("y5JW"),u=ee("LtfV"),S=A.a.Dragger;function f(m){var w=[];return m&&m.length>0&&(w=m.map(function(v){return{uid:v.id,id:v.id,name:v.title+s.c+v.filesize,url:v.url,filesize:v.filesize,status:"done",response:{id:v.id}}})),w}We.b=function(m){var w=m.value,v=m.onChange,h=m.action,c=m.className,l=m.maxSize,a=l===void 0?150:l,g=m.title,p=g===void 0?"\u4E0A\u4F20\u9644\u4EF6":g,y=m.showRemoveModal,M=y===void 0?!1:y,F=m.accept,j=F===void 0?"":F,W=m.additionalText,O=m.isDragger,P=m.number,H=P===void 0?1e3:P,X=m.aloneClear,q=X===void 0?!1:X,re=m.restrict,Ee=re===void 0?!0:re,he=Object(E.useState)(!1),xe=Object(L.a)(he,2),pe=xe[0],ve=xe[1],ce=Object(E.useState)(w||[]),fe=Object(L.a)(ce,2),$=fe[0],ae=fe[1];Object(E.useEffect)(function(){w&&(ae(Object(D.a)(w)),H===(w==null?void 0:w.length)&&ve(!0))},[w]);var Z=function(){setTimeout(function(){$.pop(),ae(Object(D.a)($))},500)},ge={multiple:!0,disabled:pe,accept:j,withCredentials:!0,fileList:$,beforeUpload:function(we,De){var Oe=we.size/1024/1024;return $.concat(De).length>H?($.pop(),ae(Object(D.a)($)),I.b.error("\u6700\u591A\u53EA\u80FD\u4E0A\u4F20".concat(H,"\u4E2A\u6587\u4EF6")),q?Promise.reject():(Z(),!1)):Oe<a?!0:(I.b.error("\u8BE5\u6587\u4EF6\u65E0\u6CD5\u4E0A\u4F20\u3002\u8D85\u8FC7\u6587\u4EF6\u5927\u5C0F\u9650\u5236(".concat(a,"MB).")),q?Promise.reject():(Z(),!1))},action:h||"".concat(d.a.API_SERVER,"/api/attachments.json"),onChange:function(we){var De=Object(D.a)(we.fileList);De.length>=H?ve(!0):ve(!1),ae(Object(D.a)(De)),De=De.map(function(Oe){var ke;if(Oe!=null&&(ke=Oe.response)!==null&&ke!==void 0&&ke.id){var Le;Oe.url="/api/attachments/".concat(Oe==null||((Le=Oe.response)===null||Le===void 0)?void 0:Le.id)}return Oe.name.indexOf(s.c)===-1&&(Oe.name="".concat(Oe.name).concat(s.c).concat(Object(s.a)(Oe.size))),Object(R.a)({},Oe)}),console.log("info:",we),v(De)},onRemove:function(){var me=Object(U.a)(C.a.mark(function De(Oe){var ke;return C.a.wrap(function(_e){for(;;)switch(_e.prev=_e.next){case 0:if(ke=function(){var ze=Object(U.a)(C.a.mark(function Xe(){var Ve,je;return C.a.wrap(function(He){for(;;)switch(He.prev=He.next){case 0:if(Ve=Oe.response?Oe.response.id:Oe.id,!Ve){He.next=8;break}return He.next=4,Object(o.d)(Oe.response?Oe.response.id:Oe.uid);case 4:return je=He.sent,He.abrupt("return",je);case 8:return He.abrupt("return",!0);case 9:case"end":return He.stop()}},Xe)}));return function(){return ze.apply(this,arguments)}}(),!M){_e.next=5;break}return _e.abrupt("return",new Promise(function(ze,Xe){G.a.confirm({centered:!0,width:530,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u63D0\u793A",content:b.a.createElement("div",{className:"tc font16"},"\u662F\u5426\u786E\u8BA4\u5220\u9664?"),onOk:function(){var Ve=Object(U.a)(C.a.mark(function qe(){var He;return C.a.wrap(function(Ae){for(;;)switch(Ae.prev=Ae.next){case 0:return Ae.next=2,ke();case 2:He=Ae.sent,I.b.success("\u5220\u9664\u6210\u529F"),ze(!0);case 5:case"end":return Ae.stop()}},qe)}));function je(){return Ve.apply(this,arguments)}return je}(),onCancel:function(){return ze(!1)}})}));case 5:return _e.next=7,ke();case 7:return _e.abrupt("return",_e.sent);case 8:case"end":return _e.stop()}},De)}));function we(De){return me.apply(this,arguments)}return we}()};function Se(me){me.preventDefault(),me.stopPropagation()}return b.a.createElement("div",{className:"multi-upload ".concat(c||"")},O&&b.a.createElement(S,ge,b.a.createElement("p",{className:"ant-upload-drag-icon"},b.a.createElement(u.a,null)),b.a.createElement("p",{className:"ant-upload-text"},"\u70B9\u51FB\u4E0A\u4F20\u56FE\u6807\uFF0C\u9009\u62E9\u8981\u4E0A\u4F20\u7684\u6587\u4EF6\u6216\u5C06\u6587\u4EF6\u62D6\u62FD\u5230\u6B64",b.a.createElement("br",null),b.a.createElement("span",{style:{display:Ee?"block":"none"}},"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927\u9650\u5236\u4E3A",a,"MB) ")),W),!O&&b.a.createElement(A.a,ge,b.a.createElement(V.a,{disabled:pe},p),b.a.createElement("span",{onClick:Se,style:{marginLeft:10,color:"#FA6400",display:Ee?"block":"none"}},"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927",a,"MB) ")))}},"55Ip":function(ot,We,ee){"use strict";ee.d(We,"a",function(){return s}),ee.d(We,"b",function(){return v});var ne=ee("Ty5D"),V=ee("dI71"),_=ee("q1tI"),G=ee.n(_),U=ee("YS25"),R=ee("17x9"),B=ee.n(R),I=ee("wx14"),D=ee("zLVn"),L=ee("9R94"),x=function(c){Object(V.a)(l,c);function l(){for(var g,p=arguments.length,y=new Array(p),M=0;M<p;M++)y[M]=arguments[M];return g=c.call.apply(c,[this].concat(y))||this,g.history=Object(U.a)(g.props),g}var a=l.prototype;return a.render=function(){return G.a.createElement(ne.c,{history:this.history,children:this.props.children})},l}(G.a.Component),A=function(c){Object(V.a)(l,c);function l(){for(var g,p=arguments.length,y=new Array(p),M=0;M<p;M++)y[M]=arguments[M];return g=c.call.apply(c,[this].concat(y))||this,g.history=Object(U.b)(g.props),g}var a=l.prototype;return a.render=function(){return G.a.createElement(ne.c,{history:this.history,children:this.props.children})},l}(G.a.Component),k=function(l,a){return typeof l=="function"?l(a):l},C=function(l,a){return typeof l=="string"?Object(U.c)(l,null,null,a):l},E=function(l){return l},b=G.a.forwardRef;typeof b=="undefined"&&(b=E);function d(c){return!!(c.metaKey||c.altKey||c.ctrlKey||c.shiftKey)}var o=b(function(c,l){var a=c.innerRef,g=c.navigate,p=c.onClick,y=Object(D.a)(c,["innerRef","navigate","onClick"]),M=y.target,F=Object(I.a)({},y,{onClick:function(W){try{p&&p(W)}catch(O){throw W.preventDefault(),O}!W.defaultPrevented&&W.button===0&&(!M||M==="_self")&&!d(W)&&(W.preventDefault(),g())}});return E!==b?F.ref=l||a:F.ref=a,G.a.createElement("a",F)}),s=b(function(c,l){var a=c.component,g=a===void 0?o:a,p=c.replace,y=c.to,M=c.innerRef,F=Object(D.a)(c,["component","replace","to","innerRef"]);return G.a.createElement(ne.e.Consumer,null,function(j){j||Object(L.a)(!1);var W=j.history,O=C(k(y,j.location),j.location),P=O?W.createHref(O):"",H=Object(I.a)({},F,{href:P,navigate:function(){var q=k(y,j.location),re=p?W.replace:W.push;re(q)}});return E!==b?H.ref=l||M:H.innerRef=M,G.a.createElement(g,H)})});if(!1)var u,S;var f=function(l){return l},m=G.a.forwardRef;typeof m=="undefined"&&(m=f);function w(){for(var c=arguments.length,l=new Array(c),a=0;a<c;a++)l[a]=arguments[a];return l.filter(function(g){return g}).join(" ")}var v=m(function(c,l){var a=c["aria-current"],g=a===void 0?"page":a,p=c.activeClassName,y=p===void 0?"active":p,M=c.activeStyle,F=c.className,j=c.exact,W=c.isActive,O=c.location,P=c.sensitive,H=c.strict,X=c.style,q=c.to,re=c.innerRef,Ee=Object(D.a)(c,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return G.a.createElement(ne.e.Consumer,null,function(he){he||Object(L.a)(!1);var xe=O||he.location,pe=C(k(q,xe),xe),ve=pe.pathname,ce=ve&&ve.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),fe=ce?Object(ne.f)(xe.pathname,{path:ce,exact:j,sensitive:P,strict:H}):null,$=!!(W?W(fe,xe):fe),ae=$?w(F,y):F,Z=$?Object(I.a)({},X,{},M):X,ge=Object(I.a)({"aria-current":$&&g||null,className:ae,style:Z,to:pe},Ee);return f!==m?ge.ref=l||re:ge.innerRef=re,G.a.createElement(s,ge)})});if(!1)var h},"7ahc":function(ot,We,ee){"use strict";ee.d(We,"a",function(){return S});var ne=ee("k1fw"),V=ee("0Owb"),_=ee("+L6B"),G=ee("2/Rp"),U=ee("y8nQ"),R=ee("Vl3Y"),B=ee("tJVT"),I=ee("OaEy"),D=ee("2fM7"),L=ee("q1tI"),x=ee.n(L),A=ee("VrN/"),k=ee.n(A),C=ee("p77/"),E=ee.n(C),b=ee("c5Ni"),d=ee.n(b),o=D.a.Option,s={labelCol:{span:4},wrapperCol:{span:20}},u={asp:["ASP","vbscript"],actionscript:["ActionScript(3.0)/Flash/Flex","clike"],bash:["Bash/Bat","shell"],css:["CSS","css"],c:["C","clike"],cpp:["C++","clike"],csharp:["C#","clike"],coffeescript:["CoffeeScript","coffeescript"],d:["D","d"],dart:["Dart","dart"],delphi:["Delphi/Pascal","pascal"],erlang:["Erlang","erlang"],go:["Golang","go"],groovy:["Groovy","groovy"],html:["HTML","text/html"],java:["Java","clike"],json:["JSON","text/json"],javascript:["Javascript","javascript"],lua:["Lua","lua"],less:["LESS","css"],markdown:["Markdown","gfm"],"objective-c":["Objective-C","clike"],php:["PHP","php"],perl:["Perl","perl"],python:["Python","python"],r:["R","r"],rst:["reStructedText","rst"],ruby:["Ruby","ruby"],sql:["SQL","sql"],sass:["SASS/SCSS","sass"],shell:["Shell","shell"],scala:["Scala","clike"],swift:["Swift","clike"],vb:["VB/VBScript","vb"],xml:["XML","text/xml"],yaml:["YAML","yaml"]};We.b=function(f){var m=f.callback,w=f.onCancel,v=Object(L.useState)("python"),h=Object(B.a)(v,2),c=h[0],l=h[1];function a(p){l(u[p][1])}function g(p){m(p)}return x.a.createElement(R.a,Object(V.a)({},s,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:g}),x.a.createElement(R.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},x.a.createElement(D.a,{onChange:a},Object.keys(u).map(function(p){return x.a.createElement(o,{key:p,value:p},u[p][0])}))),x.a.createElement(R.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},x.a.createElement(S,{mode:c})),x.a.createElement("div",{className:"flex-container flex-end"},x.a.createElement(G.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),x.a.createElement(G.a,{type:"ghost",onClick:w},"\u53D6\u6D88")))};function S(f){var m=f.value,w=f.onChange,v=f.mode,h=f.options,c=h===void 0?{}:h,l=Object(L.useRef)(),a=Object(L.useState)(),g=Object(B.a)(a,2),p=g[0],y=g[1];return Object(L.useEffect)(function(){if(p){function M(F){var j=F.getValue();w&&w(j)}return p.on("change",M),function(){p.off("change",M)}}},[p,w]),Object(L.useEffect)(function(){p&&p.setOption("mode",v)},[p,v]),Object(L.useEffect)(function(){p&&((m!==p.getValue()||m==="")&&setTimeout(function(){p.setValue(m||" ")},300))},[p,m]),Object(L.useEffect)(function(){if(l.current&&!p){var M=k.a.fromTextArea(l.current,Object(ne.a)({mode:v,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},c));y(M)}},[l.current,p]),x.a.createElement("div",{className:"my-codemirror-container"},x.a.createElement("textarea",{ref:l}))}},"8EBN":function(ot,We,ee){(function(ne){ne(ee("VrN/"))})(function(ne){"use strict";ne.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded Javascript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var V=0;V<ne.modeInfo.length;V++){var _=ne.modeInfo[V];_.mimes&&(_.mime=_.mimes[0])}ne.findModeByMIME=function(G){G=G.toLowerCase();for(var U=0;U<ne.modeInfo.length;U++){var R=ne.modeInfo[U];if(R.mime==G)return R;if(R.mimes){for(var B=0;B<R.mimes.length;B++)if(R.mimes[B]==G)return R}}if(/\+xml$/.test(G))return ne.findModeByMIME("application/xml");if(/\+json$/.test(G))return ne.findModeByMIME("application/json")},ne.findModeByExtension=function(G){G=G.toLowerCase();for(var U=0;U<ne.modeInfo.length;U++){var R=ne.modeInfo[U];if(R.ext){for(var B=0;B<R.ext.length;B++)if(R.ext[B]==G)return R}}},ne.findModeByFileName=function(G){for(var U=0;U<ne.modeInfo.length;U++){var R=ne.modeInfo[U];if(R.file&&R.file.test(G))return R}var B=G.lastIndexOf("."),I=B>-1&&G.substring(B+1,G.length);if(I)return ne.findModeByExtension(I)},ne.findModeByName=function(G){G=G.toLowerCase();for(var U=0;U<ne.modeInfo.length;U++){var R=ne.modeInfo[U];if(R.name.toLowerCase()==G)return R;if(R.alias){for(var B=0;B<R.alias.length;B++)if(R.alias[B].toLowerCase()==G)return R}}}})},"9Bee":function(ot,We,ee){"use strict";var ne=ee("k1fw"),V=ee("tJVT"),_=ee("q1tI"),G=ee.n(_),U=ee("vg9a"),R=ee("DlQD"),B=ee.n(R),I=ee("rUJ1");function D(H,X){var q=H.match(/^(\s+)(?:```)/);if(q===null)return X;var re=q[1];return X.split(`
|
|
`).map(function(Ee){var he=Ee.match(/^\s+/);if(he===null)return Ee;var xe=Object(V.a)(he,1),pe=xe[0];return pe.length>=re.length?Ee.slice(re.length):Ee}).join(`
|
|
`)}var L=[],x=["<ul>"],A=new B.a.Renderer,k=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function C(){L.length=0,x=["<ul>"]}var E={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function b(H,X,q,re){if(X>=H.length||H[X].level<=q)return X;var Ee=H[X];re.push("<li><a href='#"+Ee.anchor+"'>"+Ee.text+"</a>"),X++;var he=[];return X=b(H,X,Ee.level,he),he.length>0&&(re.push("<ul>"),he.forEach(function(xe){re.push(xe)}),re.push("</ul>")),re.push("</li>"),X=b(H,X,q,re),X}function d(){return b(L,0,0,x),x.push("</ul>"),x.join("")}var o={heading:function(X){var q=k.exec(X);if(q)return{type:"heading",raw:q[0],depth:q[1].length,text:q[2]}},fences:function(X){var q=this.rules.block.fences.exec(X);if(q){var re=q[0],Ee=D(re,q[3]||""),he=q[2]?q[2].trim():q[2];if(["latex","katex","math"].indexOf(he)>=0){var xe=S(),pe=Ee;Ee=xe,f[xe]={type:"block",expression:pe}}return{type:"code",raw:re,lang:he,text:Ee}}}},s=/(?:\${2})([^\n`]+?)(?:\${2})/gi,u=0,S=function(){return"__special_katext_id_".concat(u++,"__")},f={};function m(){return f}function w(){u=0,f={}}function v(H){return H=H.replace(s,function(X,q){var re=S();return f[re]={type:"inline",expression:q},re}),H}var h=A.listitem;A.listitem=function(H){return h(v(H))};var c=A.paragraph;A.paragraph=function(H){return c(v(H))};var l=A.tablecell;A.tablecell=function(H,X){return l(v(H),X)},A.code=function(H,X,q){var re=(X||"").match(/\S*/)[0];return re?["latex","katex","math"].indexOf(re)>=0?"<p class='editormd-tex'>".concat(H,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(X,'">').concat(q?H:Object(I.escape)(H,!0),`</code></pre>
|
|
`):'<pre class="prettyprint linenums"><code>'+(q?H:Object(I.escape)(H,!0))+"</code></pre>"},A.heading=function(H,X,q){var re=this.options.headerPrefix+q.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return L.push({anchor:re,level:X,text:H}),"<h"+X+' id="'+re+'">'+H+"</h"+X+">"},B.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),B.a.use({tokenizer:o,renderer:A});var a=B.a,g=ee("SJMd"),p=ee("ulZh"),y=ee.n(p),M=ee("m3rI"),F=ee("Oy/b"),j=ee("p5ED"),W=/<pre[^>]*>/g;function O(H){var X=document.createElement("div");return X.innerHTML=H,X.childNodes.length===0?"":X.childNodes[0].nodeValue}var P=We.a=function(H){var X=H.value,q=X===void 0?"":X,re=H.className,Ee=H.showTextOnly,he=H.showLines,xe=H.style,pe=xe===void 0?{}:xe,ve=H.stylesPrev,ce=ve===void 0?{}:ve,fe=String(q),$=Object(_.useState)(""),ae=Object(V.a)($,2),Z=ae[0],ge=ae[1],Se=Object(_.useMemo)(function(){try{var Oe=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,ke=/\"\/api\/attachments\/|\"\/attachments\/download\//g,Le=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;fe=fe.replace(Oe,"("+M.a.API_SERVER+"/api/attachments/").replace(ke,'"'+M.a.API_SERVER+"/api/attachments/").replace(Le,'"'+M.a.API_SERVER+"/files/uploads/").replaceAll("http://video.educoder","https://video.educoder").replaceAll("http://www.educoder.net/api","https://data.educoder.net/api").replaceAll("https://www.educoder.net/api","https://data.educoder.net/api").replace(/\r\n/g,`
|
|
`),fe=fe.replace(new RegExp("(?<!\\n)\\n(?!\\n)","g"),`
|
|
`)}catch(Ve){}var _e=a(fe),ze=m();if(fe.match(/\[TOC\]/)&&(_e=_e.replace("<p>[TOC]</p>",d()),C()),_e=_e.replace(/(__special_katext_id_\d+__)/g,function(Ve,je){var qe=ze[je],He=qe.type,$e=qe.expression;return Object(F.renderToString)(O($e)||"",{displayMode:He==="block",throwOnError:!1,output:"html"})}),_e=_e.replace(/▁/g,"\u2581\u2581\u2581"),w(),Ee){var Xe=document.createElement("div");return Xe.innerHTML=_e,Xe.innerText}return setTimeout(function(){return De()},500),_e},[fe]),me=Object(_.useRef)();E.WebkitLineClamp=he,he&&(pe=Object(ne.a)(Object(ne.a)({},pe),E));function we(Oe){var ke=Oe.target;if(ke.tagName.toUpperCase()==="A"){var Le=ke.getAttribute("href");if(Le.indexOf("office")>-1)Oe.preventDefault(),ge(Le);else if(Le.startsWith("#")){Oe.preventDefault();var _e=document.getElementById(Le.replace("#",""));_e&&_e.scrollIntoView(!0)}}}var De=function(){var ke,Le=(ke=me.current)===null||ke===void 0?void 0:ke.querySelectorAll("video");Le==null||Le.forEach(function(_e){if(_e.oncontextmenu=function(){return!1},_e.src.indexOf(".m3u8")>-1&&!_e.canPlayType("application/vnd.apple.mpegurl")){if(y.a.isSupported()){var ze=new y.a;ze.loadSource(_e.src),ze.attachMedia(_e)}}})};return Object(_.useEffect)(function(){if(me.current&&Se&&(Se.match(W)&&window.PR.prettyPrint()),me.current)return me.current.addEventListener("click",we),function(){me.current.removeEventListener("click",we),w(),C()}},[Se,me.current,we]),G.a.createElement(G.a.Fragment,null,G.a.createElement("div",{ref:me,style:Object(ne.a)({},pe),className:"".concat(re||""," markdown-body "),dangerouslySetInnerHTML:{__html:Se}}),G.a.createElement(j.a,{close:!0,data:Z,type:Z!=null&&Z.length?"office":"",style:Object(ne.a)({},ce),onClose:function(){return ge("")}}))}},"9VGf":function(ot,We,ee){"use strict";ee.d(We,"a",function(){return _});var ne=ee("q1tI"),V=ee.n(ne);function _(G,U){var R=Object(ne.useRef)();Object(ne.useEffect)(function(){R.current=G}),Object(ne.useEffect)(function(){function B(){R.current()}if(U!==null){var I=setInterval(B,U);return function(){return clearInterval(I)}}},[U])}},BU3w:function(ot,We,ee){"use strict";ee.d(We,"a",function(){return R});var ne=ee("MNnm"),V="rc-util-key";function _(B){if(B.attachTo)return B.attachTo;var I=document.querySelector("head");return I||document.body}function G(B){var I,D=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(ne.a)())return null;var L=document.createElement("style");if((I=D.csp)===null||I===void 0?void 0:I.nonce){var x;L.nonce=(x=D.csp)===null||x===void 0?void 0:x.nonce}L.innerHTML=B;var A=_(D),k=A.firstChild;return D.prepend&&A.prepend?A.prepend(L):D.prepend&&k?A.insertBefore(L,k):A.appendChild(L),L}var U=new Map;function R(B,I){var D=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},L=_(D);if(!U.has(L)){var x=G("",D),A=x.parentNode;U.set(L,A),A.removeChild(x)}var k=Array.from(U.get(L).children).find(function(o){return o.tagName==="STYLE"&&o[V]===I});if(k){var C,E;if(((C=D.csp)===null||C===void 0?void 0:C.nonce)&&k.nonce!==((E=D.csp)===null||E===void 0?void 0:E.nonce)){var b;k.nonce=(b=D.csp)===null||b===void 0?void 0:b.nonce}return k.innerHTML!==B&&(k.innerHTML=B),k}var d=G(B,D);return d[V]=I,d}},Bd2K:function(ot,We,ee){(function(ne){ne(ee("VrN/"),ee("osHv"))})(function(ne){ne.defineOption("autoCloseTags",!1,function(D,L,x){if(x!=ne.Init&&x&&D.removeKeyMap("autoCloseTags"),!L)return;var A={name:"autoCloseTags"};(typeof L!="object"||L.whenClosing!==!1)&&(A["'/'"]=function(k){return R(k)}),(typeof L!="object"||L.whenOpening!==!1)&&(A["'>'"]=function(k){return G(k)}),D.addKeyMap(A)});var V=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],_=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];function G(D){if(D.getOption("disableInput"))return ne.Pass;for(var L=D.listSelections(),x=[],A=D.getOption("autoCloseTags"),k=0;k<L.length;k++){if(!L[k].empty())return ne.Pass;var C=L[k].head,E=D.getTokenAt(C),b=ne.innerMode(D.getMode(),E.state),d=b.state,o=b.mode.xmlCurrentTag&&b.mode.xmlCurrentTag(d),s=o&&o.name;if(!s)return ne.Pass;var u=b.mode.configuration=="html",S=typeof A=="object"&&A.dontCloseTags||u&&V,f=typeof A=="object"&&A.indentTags||u&&_;E.end>C.ch&&(s=s.slice(0,s.length-E.end+C.ch));var m=s.toLowerCase();if(!s||E.type=="string"&&(E.end!=C.ch||!/[\"\']/.test(E.string.charAt(E.string.length-1))||E.string.length==1)||E.type=="tag"&&o.close||E.string.indexOf("/")==C.ch-E.start-1||S&&B(S,m)>-1||I(D,b.mode.xmlCurrentContext&&b.mode.xmlCurrentContext(d)||[],s,C,!0))return ne.Pass;var w=typeof A=="object"&&A.emptyTags;if(w&&B(w,s)>-1){x[k]={text:"/>",newPos:ne.Pos(C.line,C.ch+2)};continue}var v=f&&B(f,m)>-1;x[k]={indent:v,text:">"+(v?`
|
|
|
|
`:"")+"</"+s+">",newPos:v?ne.Pos(C.line+1,0):ne.Pos(C.line,C.ch+1)}}for(var h=typeof A=="object"&&A.dontIndentOnAutoClose,k=L.length-1;k>=0;k--){var c=x[k];D.replaceRange(c.text,L[k].head,L[k].anchor,"+insert");var l=D.listSelections().slice(0);l[k]={head:c.newPos,anchor:c.newPos},D.setSelections(l),!h&&c.indent&&(D.indentLine(c.newPos.line,null,!0),D.indentLine(c.newPos.line+1,null,!0))}}function U(D,L){for(var x=D.listSelections(),A=[],k=L?"/":"</",C=D.getOption("autoCloseTags"),E=typeof C=="object"&&C.dontIndentOnSlash,b=0;b<x.length;b++){if(!x[b].empty())return ne.Pass;var d=x[b].head,o=D.getTokenAt(d),s=ne.innerMode(D.getMode(),o.state),u=s.state;if(L&&(o.type=="string"||o.string.charAt(0)!="<"||o.start!=d.ch-1))return ne.Pass;var S,f=s.mode.name!="xml"&&D.getMode().name=="htmlmixed";if(f&&s.mode.name=="javascript")S=k+"script";else if(f&&s.mode.name=="css")S=k+"style";else{var m=s.mode.xmlCurrentContext&&s.mode.xmlCurrentContext(u);if(!m||m.length&&I(D,m,m[m.length-1],d))return ne.Pass;S=k+m[m.length-1]}D.getLine(d.line).charAt(o.end)!=">"&&(S+=">"),A[b]=S}if(D.replaceSelections(A),x=D.listSelections(),!E)for(var b=0;b<x.length;b++)(b==x.length-1||x[b].head.line<x[b+1].head.line)&&D.indentLine(x[b].head.line)}function R(D){return D.getOption("disableInput")?ne.Pass:U(D,!0)}ne.commands.closeTag=function(D){return U(D)};function B(D,L){if(D.indexOf)return D.indexOf(L);for(var x=0,A=D.length;x<A;++x)if(D[x]==L)return x;return-1}function I(D,L,x,A,k){if(!ne.scanForClosingTag)return!1;var C=Math.min(D.lastLine()+1,A.line+500),E=ne.scanForClosingTag(D,A,null,C);if(!E||E.tag!=x)return!1;for(var b=k?1:0,d=L.length-1;d>=0&&L[d]==x;d--)++b;A=E.to;for(var d=1;d<b;d++){var o=ne.scanForClosingTag(D,A,null,C);if(!o||o.tag!=x)return!1;A=o.to}return!0}})},BjJ7:function(ot,We,ee){"use strict";ee.d(We,"d",function(){return V}),ee.d(We,"c",function(){return _}),ee.d(We,"e",function(){return G}),ee.d(We,"b",function(){return U}),ee.d(We,"a",function(){return B});var ne=ee("m3rI");function V(I){var D=!0;if(I.length>0){for(var L=0;L<I.length;L++)if(I[L].compile_success==0||!I[L].compile_success){D=!1;break}}else D=!1;return D}function _(I){for(var D=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",L=[],x=0;x<I.length;x++){var A=I[x],k=D?"".concat(D,"/").concat(A.name):"".concat(A.name);L.push({title:A.name,isLeaf:!(A.type==="tree"),key:k})}return L}function G(I,D,L){for(var x=0;x<I.length;x++){var A=I[x];if(A.key===D){A.children=L;break}A.children&&G(A.children,D,L)}return I}function U(I,D,L){var x;return function(){var A=this,k=arguments,C=function(){x=null,L||I.apply(A,k)},E=L&&!x;clearTimeout(x),x=setTimeout(C,D),E&&I.apply(A,k)}}var R=!0,B=ne.a.API_SERVER},"C+DQ":function(ot,We,ee){},DlQD:function(ot,We,ee){(function(ne,V){ot.exports=V()})(this,function(){"use strict";function ne(se,le){for(var ue=0;ue<le.length;ue++){var J=le[ue];J.enumerable=J.enumerable||!1,J.configurable=!0,"value"in J&&(J.writable=!0),Object.defineProperty(se,J.key,J)}}function V(se,le,ue){return le&&ne(se.prototype,le),ue&&ne(se,ue),se}function _(se,le){if(!se)return;if(typeof se=="string")return G(se,le);var ue=Object.prototype.toString.call(se).slice(8,-1);if(ue==="Object"&&se.constructor&&(ue=se.constructor.name),ue==="Map"||ue==="Set")return Array.from(se);if(ue==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(ue))return G(se,le)}function G(se,le){(le==null||le>se.length)&&(le=se.length);for(var ue=0,J=new Array(le);ue<le;ue++)J[ue]=se[ue];return J}function U(se,le){var ue;if(typeof Symbol=="undefined"||se[Symbol.iterator]==null){if(Array.isArray(se)||(ue=_(se))||le&&se&&typeof se.length=="number"){ue&&(se=ue);var J=0;return function(){return J>=se.length?{done:!0}:{done:!1,value:se[J++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}return ue=se[Symbol.iterator](),ue.next.bind(ue)}function R(se,le){return le={exports:{}},se(le,le.exports),le.exports}var B=R(function(se){function le(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}function ue(J){se.exports.defaults=J}se.exports={defaults:le(),getDefaults:le,changeDefaults:ue}}),I=B.defaults,D=B.getDefaults,L=B.changeDefaults,x=/[&<>"']/,A=/[&<>"']/g,k=/[<>"']|&(?!#?\w+;)/,C=/[<>"']|&(?!#?\w+;)/g,E={"&":"&","<":"<",">":">",'"':""","'":"'"},b=function(le){return E[le]};function d(se,le){if(le){if(x.test(se))return se.replace(A,b)}else if(k.test(se))return se.replace(C,b);return se}var o=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function s(se){return se.replace(o,function(le,ue){return ue=ue.toLowerCase(),ue==="colon"?":":ue.charAt(0)==="#"?ue.charAt(1)==="x"?String.fromCharCode(parseInt(ue.substring(2),16)):String.fromCharCode(+ue.substring(1)):""})}var u=/(^|[^\[])\^/g;function S(se,le){se=se.source||se,le=le||"";var ue={replace:function(Q,te){return te=te.source||te,te=te.replace(u,"$1"),se=se.replace(Q,te),ue},getRegex:function(){return new RegExp(se,le)}};return ue}var f=/[^\w:]/g,m=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function w(se,le,ue){if(se){var J;try{J=decodeURIComponent(s(ue)).replace(f,"").toLowerCase()}catch(Q){return null}if(J.indexOf("javascript:")===0||J.indexOf("vbscript:")===0||J.indexOf("data:")===0)return null}le&&!m.test(ue)&&(ue=a(le,ue));try{ue=encodeURI(ue).replace(/%25/g,"%")}catch(Q){return null}return ue}var v={},h=/^[^:]+:\/*[^/]*$/,c=/^([^:]+:)[\s\S]*$/,l=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(se,le){v[" "+se]||(h.test(se)?v[" "+se]=se+"/":v[" "+se]=M(se,"/",!0)),se=v[" "+se];var ue=se.indexOf(":")===-1;return le.substring(0,2)==="//"?ue?le:se.replace(c,"$1")+le:le.charAt(0)==="/"?ue?le:se.replace(l,"$1")+le:se+le}var g={exec:function(){}};function p(se){for(var le=1,ue,J;le<arguments.length;le++){ue=arguments[le];for(J in ue)Object.prototype.hasOwnProperty.call(ue,J)&&(se[J]=ue[J])}return se}function y(se,le){var ue=se.replace(/\|/g,function(te,ie,be){for(var Ce=!1,Ie=ie;--Ie>=0&&be[Ie]==="\\";)Ce=!Ce;return Ce?"|":" |"}),J=ue.split(/ \|/),Q=0;if(J.length>le)J.splice(le);else for(;J.length<le;)J.push("");for(;Q<J.length;Q++)J[Q]=J[Q].trim().replace(/\\\|/g,"|");return J}function M(se,le,ue){var J=se.length;if(J===0)return"";for(var Q=0;Q<J;){var te=se.charAt(J-Q-1);if(te===le&&!ue)Q++;else if(te!==le&&ue)Q++;else break}return se.substr(0,J-Q)}function F(se,le){if(se.indexOf(le[1])===-1)return-1;for(var ue=se.length,J=0,Q=0;Q<ue;Q++)if(se[Q]==="\\")Q++;else if(se[Q]===le[0])J++;else if(se[Q]===le[1]&&(J--,J<0))return Q;return-1}function j(se){se&&se.sanitize&&!se.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}var W={escape:d,unescape:s,edit:S,cleanUrl:w,resolveUrl:a,noopTest:g,merge:p,splitCells:y,rtrim:M,findClosingBracket:F,checkSanitizeDeprecation:j},O=B.defaults,P=W.rtrim,H=W.splitCells,X=W.escape,q=W.findClosingBracket;function re(se,le,ue){var J=le.href,Q=le.title?X(le.title):null,te=se[1].replace(/\\([\[\]])/g,"$1");return se[0].charAt(0)!=="!"?{type:"link",raw:ue,href:J,title:Q,text:te}:{type:"image",raw:ue,href:J,title:Q,text:X(te)}}function Ee(se,le){var ue=se.match(/^(\s+)(?:```)/);if(ue===null)return le;var J=ue[1];return le.split(`
|
|
`).map(function(Q){var te=Q.match(/^\s+/);if(te===null)return Q;var ie=te[0];return ie.length>=J.length?Q.slice(J.length):Q}).join(`
|
|
`)}var he=function(){function se(ue){this.options=ue||O}var le=se.prototype;return le.space=function(J){var Q=this.rules.block.newline.exec(J);if(Q)return Q[0].length>1?{type:"space",raw:Q[0]}:{raw:`
|
|
`}},le.code=function(J,Q){var te=this.rules.block.code.exec(J);if(te){var ie=Q[Q.length-1];if(ie&&ie.type==="paragraph")return{raw:te[0],text:te[0].trimRight()};var be=te[0].replace(/^ {4}/gm,"");return{type:"code",raw:te[0],codeBlockStyle:"indented",text:this.options.pedantic?be:P(be,`
|
|
`)}}},le.fences=function(J){var Q=this.rules.block.fences.exec(J);if(Q){var te=Q[0],ie=Ee(te,Q[3]||"");return{type:"code",raw:te,lang:Q[2]?Q[2].trim():Q[2],text:ie}}},le.heading=function(J){var Q=this.rules.block.heading.exec(J);if(Q)return{type:"heading",raw:Q[0],depth:Q[1].length,text:Q[2]}},le.nptable=function(J){var Q=this.rules.block.nptable.exec(J);if(Q){var te={type:"table",header:H(Q[1].replace(/^ *| *\| *$/g,"")),align:Q[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:Q[3]?Q[3].replace(/\n$/,"").split(`
|
|
`):[],raw:Q[0]};if(te.header.length===te.align.length){var ie=te.align.length,be;for(be=0;be<ie;be++)/^ *-+: *$/.test(te.align[be])?te.align[be]="right":/^ *:-+: *$/.test(te.align[be])?te.align[be]="center":/^ *:-+ *$/.test(te.align[be])?te.align[be]="left":te.align[be]=null;for(ie=te.cells.length,be=0;be<ie;be++)te.cells[be]=H(te.cells[be],te.header.length);return te}}},le.hr=function(J){var Q=this.rules.block.hr.exec(J);if(Q)return{type:"hr",raw:Q[0]}},le.blockquote=function(J){var Q=this.rules.block.blockquote.exec(J);if(Q){var te=Q[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:Q[0],text:te}}},le.list=function(J){var Q=this.rules.block.list.exec(J);if(Q){for(var te=Q[0],ie=Q[2],be=ie.length>1,Ce=ie[ie.length-1]===")",Ie={type:"list",raw:te,ordered:be,start:be?+ie.slice(0,-1):"",loose:!1,items:[]},tt=Q[0].match(this.rules.block.item),dt=!1,it,Lt,mt,st,It,yt,Yt,Wt=tt.length,pt=0;pt<Wt;pt++)it=tt[pt],te=it,Lt=it.length,it=it.replace(/^ *([*+-]|\d+[.)]) */,""),~it.indexOf(`
|
|
`)&&(Lt-=it.length,it=this.options.pedantic?it.replace(/^ {1,4}/gm,""):it.replace(new RegExp("^ {1,"+Lt+"}","gm"),"")),pt!==Wt-1&&(mt=this.rules.block.bullet.exec(tt[pt+1])[0],(be?mt.length===1||!Ce&&mt[mt.length-1]===")":mt.length>1||this.options.smartLists&&mt!==ie)&&(st=tt.slice(pt+1).join(`
|
|
`),Ie.raw=Ie.raw.substring(0,Ie.raw.length-st.length),pt=Wt-1)),It=dt||/\n\n(?!\s*$)/.test(it),pt!==Wt-1&&(dt=it.charAt(it.length-1)===`
|
|
`,It||(It=dt)),It&&(Ie.loose=!0),yt=/^\[[ xX]\] /.test(it),Yt=void 0,yt&&(Yt=it[1]!==" ",it=it.replace(/^\[[ xX]\] +/,"")),Ie.items.push({type:"list_item",raw:te,task:yt,checked:Yt,loose:It,text:it});return Ie}},le.html=function(J){var Q=this.rules.block.html.exec(J);if(Q)return{type:this.options.sanitize?"paragraph":"html",raw:Q[0],pre:!this.options.sanitizer&&(Q[1]==="pre"||Q[1]==="script"||Q[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(Q[0]):X(Q[0]):Q[0]}},le.def=function(J){var Q=this.rules.block.def.exec(J);if(Q){Q[3]&&(Q[3]=Q[3].substring(1,Q[3].length-1));var te=Q[1].toLowerCase().replace(/\s+/g," ");return{tag:te,raw:Q[0],href:Q[2],title:Q[3]}}},le.table=function(J){var Q=this.rules.block.table.exec(J);if(Q){var te={type:"table",header:H(Q[1].replace(/^ *| *\| *$/g,"")),align:Q[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:Q[3]?Q[3].replace(/\n$/,"").split(`
|
|
`):[]};if(te.header.length===te.align.length){te.raw=Q[0];var ie=te.align.length,be;for(be=0;be<ie;be++)/^ *-+: *$/.test(te.align[be])?te.align[be]="right":/^ *:-+: *$/.test(te.align[be])?te.align[be]="center":/^ *:-+ *$/.test(te.align[be])?te.align[be]="left":te.align[be]=null;for(ie=te.cells.length,be=0;be<ie;be++)te.cells[be]=H(te.cells[be].replace(/^ *\| *| *\| *$/g,""),te.header.length);return te}}},le.lheading=function(J){var Q=this.rules.block.lheading.exec(J);if(Q)return{type:"heading",raw:Q[0],depth:Q[2].charAt(0)==="="?1:2,text:Q[1]}},le.paragraph=function(J){var Q=this.rules.block.paragraph.exec(J);if(Q)return{type:"paragraph",raw:Q[0],text:Q[1].charAt(Q[1].length-1)===`
|
|
`?Q[1].slice(0,-1):Q[1]}},le.text=function(J,Q){var te=this.rules.block.text.exec(J);if(te){var ie=Q[Q.length-1];return ie&&ie.type==="text"?{raw:te[0],text:te[0]}:{type:"text",raw:te[0],text:te[0]}}},le.escape=function(J){var Q=this.rules.inline.escape.exec(J);if(Q)return{type:"escape",raw:Q[0],text:X(Q[1])}},le.tag=function(J,Q,te){var ie=this.rules.inline.tag.exec(J);if(ie)return!Q&&/^<a /i.test(ie[0])?Q=!0:Q&&/^<\/a>/i.test(ie[0])&&(Q=!1),!te&&/^<(pre|code|kbd|script)(\s|>)/i.test(ie[0])?te=!0:te&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(ie[0])&&(te=!1),{type:this.options.sanitize?"text":"html",raw:ie[0],inLink:Q,inRawBlock:te,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ie[0]):X(ie[0]):ie[0]}},le.link=function(J){var Q=this.rules.inline.link.exec(J);if(Q){var te=q(Q[2],"()");if(te>-1){var ie=Q[0].indexOf("!")===0?5:4,be=ie+Q[1].length+te;Q[2]=Q[2].substring(0,te),Q[0]=Q[0].substring(0,be).trim(),Q[3]=""}var Ce=Q[2],Ie="";if(this.options.pedantic){var tt=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Ce);tt?(Ce=tt[1],Ie=tt[3]):Ie=""}else Ie=Q[3]?Q[3].slice(1,-1):"";Ce=Ce.trim().replace(/^<([\s\S]*)>$/,"$1");var dt=re(Q,{href:Ce&&Ce.replace(this.rules.inline._escapes,"$1"),title:Ie&&Ie.replace(this.rules.inline._escapes,"$1")},Q[0]);return dt}},le.reflink=function(J,Q){var te;if((te=this.rules.inline.reflink.exec(J))||(te=this.rules.inline.nolink.exec(J))){var ie=(te[2]||te[1]).replace(/\s+/g," ");if(ie=Q[ie.toLowerCase()],!ie||!ie.href){var be=te[0].charAt(0);return{type:"text",raw:be,text:be}}var Ce=re(te,ie,te[0]);return Ce}},le.strong=function(J,Q,te){te===void 0&&(te="");var ie=this.rules.inline.strong.start.exec(J);if(ie&&(!ie[1]||ie[1]&&(te===""||this.rules.inline.punctuation.exec(te)))){Q=Q.slice(-1*J.length);var be=ie[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;be.lastIndex=0;for(var Ce;(ie=be.exec(Q))!=null;)if(Ce=this.rules.inline.strong.middle.exec(Q.slice(0,ie.index+3)),Ce)return{type:"strong",raw:J.slice(0,Ce[0].length),text:J.slice(2,Ce[0].length-2)}}},le.em=function(J,Q,te){te===void 0&&(te="");var ie=this.rules.inline.em.start.exec(J);if(ie&&(!ie[1]||ie[1]&&(te===""||this.rules.inline.punctuation.exec(te)))){Q=Q.slice(-1*J.length);var be=ie[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;be.lastIndex=0;for(var Ce;(ie=be.exec(Q))!=null;)if(Ce=this.rules.inline.em.middle.exec(Q.slice(0,ie.index+2)),Ce)return{type:"em",raw:J.slice(0,Ce[0].length),text:J.slice(1,Ce[0].length-1)}}},le.codespan=function(J){var Q=this.rules.inline.code.exec(J);if(Q){var te=Q[2].replace(/\n/g," "),ie=/[^ ]/.test(te),be=te.startsWith(" ")&&te.endsWith(" ");return ie&&be&&(te=te.substring(1,te.length-1)),te=X(te,!0),{type:"codespan",raw:Q[0],text:te}}},le.br=function(J){var Q=this.rules.inline.br.exec(J);if(Q)return{type:"br",raw:Q[0]}},le.del=function(J){var Q=this.rules.inline.del.exec(J);if(Q)return{type:"del",raw:Q[0],text:Q[1]}},le.autolink=function(J,Q){var te=this.rules.inline.autolink.exec(J);if(te){var ie,be;return te[2]==="@"?(ie=X(this.options.mangle?Q(te[1]):te[1]),be="mailto:"+ie):(ie=X(te[1]),be=ie),{type:"link",raw:te[0],text:ie,href:be,tokens:[{type:"text",raw:ie,text:ie}]}}},le.url=function(J,Q){var te;if(te=this.rules.inline.url.exec(J)){var ie,be;if(te[2]==="@")ie=X(this.options.mangle?Q(te[0]):te[0]),be="mailto:"+ie;else{var Ce;do Ce=te[0],te[0]=this.rules.inline._backpedal.exec(te[0])[0];while(Ce!==te[0]);ie=X(te[0]),te[1]==="www."?be="http://"+ie:be=ie}return{type:"link",raw:te[0],text:ie,href:be,tokens:[{type:"text",raw:ie,text:ie}]}}},le.inlineText=function(J,Q,te){var ie=this.rules.inline.text.exec(J);if(ie){var be;return Q?be=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ie[0]):X(ie[0]):ie[0]:be=X(this.options.smartypants?te(ie[0]):ie[0]),{type:"text",raw:ie[0],text:be}}},se}(),xe=W.noopTest,pe=W.edit,ve=W.merge,ce={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6}) +([^\n]*?)(?: +#+)? *(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|<![A-Z][\\s\\S]*?>\\n*|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>\\n*|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:xe,table:xe,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};ce._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,ce._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,ce.def=pe(ce.def).replace("label",ce._label).replace("title",ce._title).getRegex(),ce.bullet=/(?:[*+-]|\d{1,9}[.)])/,ce.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,ce.item=pe(ce.item,"gm").replace(/bull/g,ce.bullet).getRegex(),ce.list=pe(ce.list).replace(/bull/g,ce.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+ce.def.source+")").getRegex(),ce._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",ce._comment=/<!--(?!-?>)[\s\S]*?-->/,ce.html=pe(ce.html,"i").replace("comment",ce._comment).replace("tag",ce._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ce.paragraph=pe(ce._paragraph).replace("hr",ce.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",ce._tag).getRegex(),ce.blockquote=pe(ce.blockquote).replace("paragraph",ce.paragraph).getRegex(),ce.normal=ve({},ce),ce.gfm=ve({},ce.normal,{nptable:"^ *([^|\\n ].*\\|.*)\\n *([-:]+ *\\|[-| :]*)(?:\\n((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)",table:"^ *\\|(.+)\\n *\\|?( *[-:]+[-| :]*)(?:\\n *((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),ce.gfm.nptable=pe(ce.gfm.nptable).replace("hr",ce.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",ce._tag).getRegex(),ce.gfm.table=pe(ce.gfm.table).replace("hr",ce.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",ce._tag).getRegex(),ce.pedantic=ve({},ce.normal,{html:pe(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ce._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,fences:xe,paragraph:pe(ce.normal._paragraph).replace("hr",ce.hr).replace("heading",` *#{1,6} *[^
|
|
]`).replace("lheading",ce.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var fe={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:xe,tag:"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",strong:{start:/^(?:(\*\*(?=[*punctuation]))|\*\*)(?![\s])|__/,middle:/^\*\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*\*$|^__(?![\s])((?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?)__$/,endAst:/[^punctuation\s]\*\*(?!\*)|[punctuation]\*\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]__(?!_)(?:(?=[punctuation\s])|$)/},em:{start:/^(?:(\*(?=[punctuation]))|\*)(?![*\s])|_/,middle:/^\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*$|^_(?![_\s])(?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?_$/,endAst:/[^punctuation\s]\*(?!\*)|[punctuation]\*(?!\*)(?:(?=[punctuation\s]|$))/,endUnd:/[^\s]_(?!_)(?:(?=[punctuation\s])|$)/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:xe,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};fe._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",fe.punctuation=pe(fe.punctuation).replace(/punctuation/g,fe._punctuation).getRegex(),fe._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",fe._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",fe.em.start=pe(fe.em.start).replace(/punctuation/g,fe._punctuation).getRegex(),fe.em.middle=pe(fe.em.middle).replace(/punctuation/g,fe._punctuation).replace(/overlapSkip/g,fe._overlapSkip).getRegex(),fe.em.endAst=pe(fe.em.endAst,"g").replace(/punctuation/g,fe._punctuation).getRegex(),fe.em.endUnd=pe(fe.em.endUnd,"g").replace(/punctuation/g,fe._punctuation).getRegex(),fe.strong.start=pe(fe.strong.start).replace(/punctuation/g,fe._punctuation).getRegex(),fe.strong.middle=pe(fe.strong.middle).replace(/punctuation/g,fe._punctuation).replace(/blockSkip/g,fe._blockSkip).getRegex(),fe.strong.endAst=pe(fe.strong.endAst,"g").replace(/punctuation/g,fe._punctuation).getRegex(),fe.strong.endUnd=pe(fe.strong.endUnd,"g").replace(/punctuation/g,fe._punctuation).getRegex(),fe.blockSkip=pe(fe._blockSkip,"g").getRegex(),fe.overlapSkip=pe(fe._overlapSkip,"g").getRegex(),fe._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,fe._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,fe._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,fe.autolink=pe(fe.autolink).replace("scheme",fe._scheme).replace("email",fe._email).getRegex(),fe._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,fe.tag=pe(fe.tag).replace("comment",ce._comment).replace("attribute",fe._attribute).getRegex(),fe._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,fe._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,fe._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,fe.link=pe(fe.link).replace("label",fe._label).replace("href",fe._href).replace("title",fe._title).getRegex(),fe.reflink=pe(fe.reflink).replace("label",fe._label).getRegex(),fe.reflinkSearch=pe(fe.reflinkSearch,"g").replace("reflink",fe.reflink).replace("nolink",fe.nolink).getRegex(),fe.normal=ve({},fe),fe.pedantic=ve({},fe.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:pe(/^!?\[(label)\]\((.*?)\)/).replace("label",fe._label).getRegex(),reflink:pe(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",fe._label).getRegex()}),fe.gfm=ve({},fe.normal,{escape:pe(fe.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^~+(?=\S)([\s\S]*?\S)~+/,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*~]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))|(?= {2,}\n|[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))/}),fe.gfm.url=pe(fe.gfm.url,"i").replace("email",fe.gfm._extended_email).getRegex(),fe.breaks=ve({},fe.gfm,{br:pe(fe.br).replace("{2,}","*").getRegex(),text:pe(fe.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var $={block:ce,inline:fe},ae=B.defaults,Z=$.block,ge=$.inline;function Se(se){return se.replace(/---/g,"\u2014").replace(/--/g,"\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1\u201C").replace(/"/g,"\u201D").replace(/\.{3}/g,"\u2026")}function me(se){var le="",ue,J,Q=se.length;for(ue=0;ue<Q;ue++)J=se.charCodeAt(ue),Math.random()>.5&&(J="x"+J.toString(16)),le+="&#"+J+";";return le}var we=function(){function se(ue){this.tokens=[],this.tokens.links=Object.create(null),this.options=ue||ae,this.options.tokenizer=this.options.tokenizer||new he,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var J={block:Z.normal,inline:ge.normal};this.options.pedantic?(J.block=Z.pedantic,J.inline=ge.pedantic):this.options.gfm&&(J.block=Z.gfm,this.options.breaks?J.inline=ge.breaks:J.inline=ge.gfm),this.tokenizer.rules=J}se.lex=function(J,Q){var te=new se(Q);return te.lex(J)};var le=se.prototype;return le.lex=function(J){return J=J.replace(/\r\n|\r/g,`
|
|
`).replace(/\t/g," "),this.blockTokens(J,this.tokens,!0),this.inline(this.tokens),this.tokens},le.blockTokens=function(J,Q,te){Q===void 0&&(Q=[]),te===void 0&&(te=!0),J=J.replace(/^ +$/gm,"");for(var ie,be,Ce,Ie;J;){if(ie=this.tokenizer.space(J)){J=J.substring(ie.raw.length),ie.type&&Q.push(ie);continue}if(ie=this.tokenizer.code(J,Q)){J=J.substring(ie.raw.length),ie.type?Q.push(ie):(Ie=Q[Q.length-1],Ie.raw+=`
|
|
`+ie.raw,Ie.text+=`
|
|
`+ie.text);continue}if(ie=this.tokenizer.fences(J)){J=J.substring(ie.raw.length),Q.push(ie);continue}if(ie=this.tokenizer.heading(J)){J=J.substring(ie.raw.length),Q.push(ie);continue}if(ie=this.tokenizer.nptable(J)){J=J.substring(ie.raw.length),Q.push(ie);continue}if(ie=this.tokenizer.hr(J)){J=J.substring(ie.raw.length),Q.push(ie);continue}if(ie=this.tokenizer.blockquote(J)){J=J.substring(ie.raw.length),ie.tokens=this.blockTokens(ie.text,[],te),Q.push(ie);continue}if(ie=this.tokenizer.list(J)){for(J=J.substring(ie.raw.length),Ce=ie.items.length,be=0;be<Ce;be++)ie.items[be].tokens=this.blockTokens(ie.items[be].text,[],!1);Q.push(ie);continue}if(ie=this.tokenizer.html(J)){J=J.substring(ie.raw.length),Q.push(ie);continue}if(te&&(ie=this.tokenizer.def(J))){J=J.substring(ie.raw.length),this.tokens.links[ie.tag]||(this.tokens.links[ie.tag]={href:ie.href,title:ie.title});continue}if(ie=this.tokenizer.table(J)){J=J.substring(ie.raw.length),Q.push(ie);continue}if(ie=this.tokenizer.lheading(J)){J=J.substring(ie.raw.length),Q.push(ie);continue}if(te&&(ie=this.tokenizer.paragraph(J))){J=J.substring(ie.raw.length),Q.push(ie);continue}if(ie=this.tokenizer.text(J,Q)){J=J.substring(ie.raw.length),ie.type?Q.push(ie):(Ie=Q[Q.length-1],Ie.raw+=`
|
|
`+ie.raw,Ie.text+=`
|
|
`+ie.text);continue}if(J){var tt="Infinite loop on byte: "+J.charCodeAt(0);if(this.options.silent){console.error(tt);break}else throw new Error(tt)}}return Q},le.inline=function(J){var Q,te,ie,be,Ce,Ie,tt=J.length;for(Q=0;Q<tt;Q++){Ie=J[Q];switch(Ie.type){case"paragraph":case"text":case"heading":{Ie.tokens=[],this.inlineTokens(Ie.text,Ie.tokens);break}case"table":{for(Ie.tokens={header:[],cells:[]},be=Ie.header.length,te=0;te<be;te++)Ie.tokens.header[te]=[],this.inlineTokens(Ie.header[te],Ie.tokens.header[te]);for(be=Ie.cells.length,te=0;te<be;te++)for(Ce=Ie.cells[te],Ie.tokens.cells[te]=[],ie=0;ie<Ce.length;ie++)Ie.tokens.cells[te][ie]=[],this.inlineTokens(Ce[ie],Ie.tokens.cells[te][ie]);break}case"blockquote":{this.inline(Ie.tokens);break}case"list":{for(be=Ie.items.length,te=0;te<be;te++)this.inline(Ie.items[te].tokens);break}}}return J},le.inlineTokens=function(J,Q,te,ie,be){Q===void 0&&(Q=[]),te===void 0&&(te=!1),ie===void 0&&(ie=!1),be===void 0&&(be="");var Ce,Ie=J,tt;if(this.tokens.links){var dt=Object.keys(this.tokens.links);if(dt.length>0)for(;(tt=this.tokenizer.rules.inline.reflinkSearch.exec(Ie))!=null;)dt.includes(tt[0].slice(tt[0].lastIndexOf("[")+1,-1))&&(Ie=Ie.slice(0,tt.index)+"["+"a".repeat(tt[0].length-2)+"]"+Ie.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(tt=this.tokenizer.rules.inline.blockSkip.exec(Ie))!=null;)Ie=Ie.slice(0,tt.index)+"["+"a".repeat(tt[0].length-2)+"]"+Ie.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;J;){if(Ce=this.tokenizer.escape(J)){J=J.substring(Ce.raw.length),Q.push(Ce);continue}if(Ce=this.tokenizer.tag(J,te,ie)){J=J.substring(Ce.raw.length),te=Ce.inLink,ie=Ce.inRawBlock,Q.push(Ce);continue}if(Ce=this.tokenizer.link(J)){J=J.substring(Ce.raw.length),Ce.type==="link"&&(Ce.tokens=this.inlineTokens(Ce.text,[],!0,ie)),Q.push(Ce);continue}if(Ce=this.tokenizer.reflink(J,this.tokens.links)){J=J.substring(Ce.raw.length),Ce.type==="link"&&(Ce.tokens=this.inlineTokens(Ce.text,[],!0,ie)),Q.push(Ce);continue}if(Ce=this.tokenizer.strong(J,Ie,be)){J=J.substring(Ce.raw.length),Ce.tokens=this.inlineTokens(Ce.text,[],te,ie),Q.push(Ce);continue}if(Ce=this.tokenizer.em(J,Ie,be)){J=J.substring(Ce.raw.length),Ce.tokens=this.inlineTokens(Ce.text,[],te,ie),Q.push(Ce);continue}if(Ce=this.tokenizer.codespan(J)){J=J.substring(Ce.raw.length),Q.push(Ce);continue}if(Ce=this.tokenizer.br(J)){J=J.substring(Ce.raw.length),Q.push(Ce);continue}if(Ce=this.tokenizer.del(J)){J=J.substring(Ce.raw.length),Ce.tokens=this.inlineTokens(Ce.text,[],te,ie),Q.push(Ce);continue}if(Ce=this.tokenizer.autolink(J,me)){J=J.substring(Ce.raw.length),Q.push(Ce);continue}if(!te&&(Ce=this.tokenizer.url(J,me))){J=J.substring(Ce.raw.length),Q.push(Ce);continue}if(Ce=this.tokenizer.inlineText(J,ie,Se)){J=J.substring(Ce.raw.length),be=Ce.raw.slice(-1),Q.push(Ce);continue}if(J){var it="Infinite loop on byte: "+J.charCodeAt(0);if(this.options.silent){console.error(it);break}else throw new Error(it)}}return Q},V(se,null,[{key:"rules",get:function(){return{block:Z,inline:ge}}}]),se}(),De=B.defaults,Oe=W.cleanUrl,ke=W.escape,Le=function(){function se(ue){this.options=ue||De}var le=se.prototype;return le.code=function(J,Q,te){var ie=(Q||"").match(/\S*/)[0];if(this.options.highlight){var be=this.options.highlight(J,ie);be!=null&&be!==J&&(te=!0,J=be)}return ie?'<pre><code class="'+this.options.langPrefix+ke(ie,!0)+'">'+(te?J:ke(J,!0))+`</code></pre>
|
|
`:"<pre><code>"+(te?J:ke(J,!0))+`</code></pre>
|
|
`},le.blockquote=function(J){return`<blockquote>
|
|
`+J+`</blockquote>
|
|
`},le.html=function(J){return J},le.heading=function(J,Q,te,ie){return this.options.headerIds?"<h"+Q+' id="'+this.options.headerPrefix+ie.slug(te)+'">'+J+"</h"+Q+`>
|
|
`:"<h"+Q+">"+J+"</h"+Q+`>
|
|
`},le.hr=function(){return this.options.xhtml?`<hr/>
|
|
`:`<hr>
|
|
`},le.list=function(J,Q,te){var ie=Q?"ol":"ul",be=Q&&te!==1?' start="'+te+'"':"";return"<"+ie+be+`>
|
|
`+J+"</"+ie+`>
|
|
`},le.listitem=function(J){return"<li>"+J+`</li>
|
|
`},le.checkbox=function(J){return"<input "+(J?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},le.paragraph=function(J){return"<p>"+J+`</p>
|
|
`},le.table=function(J,Q){return Q&&(Q="<tbody>"+Q+"</tbody>"),`<table>
|
|
<thead>
|
|
`+J+`</thead>
|
|
`+Q+`</table>
|
|
`},le.tablerow=function(J){return`<tr>
|
|
`+J+`</tr>
|
|
`},le.tablecell=function(J,Q){var te=Q.header?"th":"td",ie=Q.align?"<"+te+' align="'+Q.align+'">':"<"+te+">";return ie+J+"</"+te+`>
|
|
`},le.strong=function(J){return"<strong>"+J+"</strong>"},le.em=function(J){return"<em>"+J+"</em>"},le.codespan=function(J){return"<code>"+J+"</code>"},le.br=function(){return this.options.xhtml?"<br/>":"<br>"},le.del=function(J){return"<del>"+J+"</del>"},le.link=function(J,Q,te){if(J=Oe(this.options.sanitize,this.options.baseUrl,J),J===null)return te;var ie='<a href="'+ke(J)+'"';return Q&&(ie+=' title="'+Q+'"'),ie+=">"+te+"</a>",ie},le.image=function(J,Q,te){if(J=Oe(this.options.sanitize,this.options.baseUrl,J),J===null)return te;var ie='<img src="'+J+'" alt="'+te+'"';return Q&&(ie+=' title="'+Q+'"'),ie+=this.options.xhtml?"/>":">",ie},le.text=function(J){return J},se}(),_e=function(){function se(){}var le=se.prototype;return le.strong=function(J){return J},le.em=function(J){return J},le.codespan=function(J){return J},le.del=function(J){return J},le.html=function(J){return J},le.text=function(J){return J},le.link=function(J,Q,te){return""+te},le.image=function(J,Q,te){return""+te},le.br=function(){return""},se}(),ze=function(){function se(){this.seen={}}var le=se.prototype;return le.slug=function(J){var Q=J.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(Q)){var te=Q;do this.seen[te]++,Q=te+"-"+this.seen[te];while(this.seen.hasOwnProperty(Q))}return this.seen[Q]=0,Q},se}(),Xe=B.defaults,Ve=W.unescape,je=function(){function se(ue){this.options=ue||Xe,this.options.renderer=this.options.renderer||new Le,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new _e,this.slugger=new ze}se.parse=function(J,Q){var te=new se(Q);return te.parse(J)};var le=se.prototype;return le.parse=function(J,Q){Q===void 0&&(Q=!0);var te="",ie,be,Ce,Ie,tt,dt,it,Lt,mt,st,It,yt,Yt,Wt,pt,Tr,zr,lr,Sr=J.length;for(ie=0;ie<Sr;ie++){st=J[ie];switch(st.type){case"space":continue;case"hr":{te+=this.renderer.hr();continue}case"heading":{te+=this.renderer.heading(this.parseInline(st.tokens),st.depth,Ve(this.parseInline(st.tokens,this.textRenderer)),this.slugger);continue}case"code":{te+=this.renderer.code(st.text,st.lang,st.escaped);continue}case"table":{for(Lt="",it="",Ie=st.header.length,be=0;be<Ie;be++)it+=this.renderer.tablecell(this.parseInline(st.tokens.header[be]),{header:!0,align:st.align[be]});for(Lt+=this.renderer.tablerow(it),mt="",Ie=st.cells.length,be=0;be<Ie;be++){for(dt=st.tokens.cells[be],it="",tt=dt.length,Ce=0;Ce<tt;Ce++)it+=this.renderer.tablecell(this.parseInline(dt[Ce]),{header:!1,align:st.align[Ce]});mt+=this.renderer.tablerow(it)}te+=this.renderer.table(Lt,mt);continue}case"blockquote":{mt=this.parse(st.tokens),te+=this.renderer.blockquote(mt);continue}case"list":{for(It=st.ordered,yt=st.start,Yt=st.loose,Ie=st.items.length,mt="",be=0;be<Ie;be++)pt=st.items[be],Tr=pt.checked,zr=pt.task,Wt="",pt.task&&(lr=this.renderer.checkbox(Tr),Yt?pt.tokens.length>0&&pt.tokens[0].type==="text"?(pt.tokens[0].text=lr+" "+pt.tokens[0].text,pt.tokens[0].tokens&&pt.tokens[0].tokens.length>0&&pt.tokens[0].tokens[0].type==="text"&&(pt.tokens[0].tokens[0].text=lr+" "+pt.tokens[0].tokens[0].text)):pt.tokens.unshift({type:"text",text:lr}):Wt+=lr),Wt+=this.parse(pt.tokens,Yt),mt+=this.renderer.listitem(Wt,zr,Tr);te+=this.renderer.list(mt,It,yt);continue}case"html":{te+=this.renderer.html(st.text);continue}case"paragraph":{te+=this.renderer.paragraph(this.parseInline(st.tokens));continue}case"text":{for(mt=st.tokens?this.parseInline(st.tokens):st.text;ie+1<Sr&&J[ie+1].type==="text";)st=J[++ie],mt+=`
|
|
`+(st.tokens?this.parseInline(st.tokens):st.text);te+=Q?this.renderer.paragraph(mt):mt;continue}default:{var hr='Token with "'+st.type+'" type was not found.';if(this.options.silent){console.error(hr);return}else throw new Error(hr)}}}return te},le.parseInline=function(J,Q){Q=Q||this.renderer;var te="",ie,be,Ce=J.length;for(ie=0;ie<Ce;ie++){be=J[ie];switch(be.type){case"escape":{te+=Q.text(be.text);break}case"html":{te+=Q.html(be.text);break}case"link":{te+=Q.link(be.href,be.title,this.parseInline(be.tokens,Q));break}case"image":{te+=Q.image(be.href,be.title,be.text);break}case"strong":{te+=Q.strong(this.parseInline(be.tokens,Q));break}case"em":{te+=Q.em(this.parseInline(be.tokens,Q));break}case"codespan":{te+=Q.codespan(be.text);break}case"br":{te+=Q.br();break}case"del":{te+=Q.del(this.parseInline(be.tokens,Q));break}case"text":{te+=Q.text(be.text);break}default:{var Ie='Token with "'+be.type+'" type was not found.';if(this.options.silent){console.error(Ie);return}else throw new Error(Ie)}}}return te},se}(),qe=W.merge,He=W.checkSanitizeDeprecation,$e=W.escape,Ae=B.getDefaults,Ze=B.changeDefaults,Je=B.defaults;function Re(se,le,ue){if(typeof se=="undefined"||se===null)throw new Error("marked(): input parameter is undefined or null");if(typeof se!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(se)+", string expected");if(typeof le=="function"&&(ue=le,le=null),le=qe({},Re.defaults,le||{}),He(le),ue){var J=le.highlight,Q;try{Q=we.lex(se,le)}catch(Ce){return ue(Ce)}var te=function(Ie){var tt;if(!Ie)try{tt=je.parse(Q,le)}catch(dt){Ie=dt}return le.highlight=J,Ie?ue(Ie):ue(null,tt)};if(!J||J.length<3)return te();if(delete le.highlight,!Q.length)return te();var ie=0;Re.walkTokens(Q,function(Ce){Ce.type==="code"&&(ie++,setTimeout(function(){J(Ce.text,Ce.lang,function(Ie,tt){if(Ie)return te(Ie);tt!=null&&tt!==Ce.text&&(Ce.text=tt,Ce.escaped=!0),ie--,ie===0&&te()})},0))}),ie===0&&te();return}try{var be=we.lex(se,le);return le.walkTokens&&Re.walkTokens(be,le.walkTokens),je.parse(be,le)}catch(Ce){if(Ce.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,le.silent)return"<p>An error occurred:</p><pre>"+$e(Ce.message+"",!0)+"</pre>";throw Ce}}Re.options=Re.setOptions=function(se){return qe(Re.defaults,se),Ze(Re.defaults),Re},Re.getDefaults=Ae,Re.defaults=Je,Re.use=function(se){var le=qe({},se);if(se.renderer&&function(){var J=Re.defaults.renderer||new Le,Q=function(be){var Ce=J[be];J[be]=function(){for(var Ie=arguments.length,tt=new Array(Ie),dt=0;dt<Ie;dt++)tt[dt]=arguments[dt];var it=se.renderer[be].apply(J,tt);return it===!1&&(it=Ce.apply(J,tt)),it}};for(var te in se.renderer)Q(te);le.renderer=J}(),se.tokenizer&&function(){var J=Re.defaults.tokenizer||new he,Q=function(be){var Ce=J[be];J[be]=function(){for(var Ie=arguments.length,tt=new Array(Ie),dt=0;dt<Ie;dt++)tt[dt]=arguments[dt];var it=se.tokenizer[be].apply(J,tt);return it===!1&&(it=Ce.apply(J,tt)),it}};for(var te in se.tokenizer)Q(te);le.tokenizer=J}(),se.walkTokens){var ue=Re.defaults.walkTokens;le.walkTokens=function(J){se.walkTokens(J),ue&&ue(J)}}Re.setOptions(le)},Re.walkTokens=function(se,le){for(var ue=U(se),J;!(J=ue()).done;){var Q=J.value;le(Q);switch(Q.type){case"table":{for(var te=U(Q.tokens.header),ie;!(ie=te()).done;){var be=ie.value;Re.walkTokens(be,le)}for(var Ce=U(Q.tokens.cells),Ie;!(Ie=Ce()).done;)for(var tt=Ie.value,dt=U(tt),it;!(it=dt()).done;){var Lt=it.value;Re.walkTokens(Lt,le)}break}case"list":{Re.walkTokens(Q.items,le);break}default:Q.tokens&&Re.walkTokens(Q.tokens,le)}}},Re.Parser=je,Re.parser=je.parse,Re.Renderer=Le,Re.TextRenderer=_e,Re.Lexer=we,Re.lexer=we.lex,Re.Tokenizer=he,Re.Slugger=ze,Re.parse=Re;var Fe=Re;return Fe})},ELLl:function(ot,We,ee){(function(ne){ne(ee("VrN/"))})(function(ne){var V={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},_=ne.Pos;ne.defineOption("autoCloseBrackets",!1,function(E,b,d){d&&d!=ne.Init&&(E.removeKeyMap(U),E.state.closeBrackets=null),b&&(R(G(b,"pairs")),E.state.closeBrackets=b,E.addKeyMap(U))});function G(E,b){return b=="pairs"&&typeof E=="string"?E:typeof E=="object"&&E[b]!=null?E[b]:V[b]}var U={Backspace:D,Enter:L};function R(E){for(var b=0;b<E.length;b++){var d=E.charAt(b),o="'"+d+"'";U[o]||(U[o]=B(d))}}R(V.pairs+"`");function B(E){return function(b){return A(b,E)}}function I(E){var b=E.state.closeBrackets;if(!b||b.override)return b;var d=E.getModeAt(E.getCursor());return d.closeBrackets||b}function D(E){var b=I(E);if(!b||E.getOption("disableInput"))return ne.Pass;for(var d=G(b,"pairs"),o=E.listSelections(),s=0;s<o.length;s++){if(!o[s].empty())return ne.Pass;var u=k(E,o[s].head);if(!u||d.indexOf(u)%2!=0)return ne.Pass}for(var s=o.length-1;s>=0;s--){var S=o[s].head;E.replaceRange("",_(S.line,S.ch-1),_(S.line,S.ch+1),"+delete")}}function L(E){var b=I(E),d=b&&G(b,"explode");if(!d||E.getOption("disableInput"))return ne.Pass;for(var o=E.listSelections(),s=0;s<o.length;s++){if(!o[s].empty())return ne.Pass;var u=k(E,o[s].head);if(!u||d.indexOf(u)%2!=0)return ne.Pass}E.operation(function(){var S=E.lineSeparator()||`
|
|
`;E.replaceSelection(S+S,null),E.execCommand("goCharLeft"),o=E.listSelections();for(var f=0;f<o.length;f++){var m=o[f].head.line;E.indentLine(m,null,!0),E.indentLine(m+1,null,!0)}})}function x(E){var b=ne.cmpPos(E.anchor,E.head)>0;return{anchor:new _(E.anchor.line,E.anchor.ch+(b?-1:1)),head:new _(E.head.line,E.head.ch+(b?1:-1))}}function A(E,b){var d=I(E);if(!d||E.getOption("disableInput"))return ne.Pass;var o=G(d,"pairs"),s=o.indexOf(b);if(s==-1)return ne.Pass;for(var u=G(d,"closeBefore"),S=G(d,"triples"),f=o.charAt(s+1)==b,m=E.listSelections(),w=s%2==0,v,h=0;h<m.length;h++){var c=m[h],l=c.head,a,g=E.getRange(l,_(l.line,l.ch+1));if(w&&!c.empty())a="surround";else if((f||!w)&&g==b)f&&C(E,l)?a="both":S.indexOf(b)>=0&&E.getRange(l,_(l.line,l.ch+3))==b+b+b?a="skipThree":a="skip";else if(f&&l.ch>1&&S.indexOf(b)>=0&&E.getRange(_(l.line,l.ch-2),l)==b+b){if(l.ch>2&&/\bstring/.test(E.getTokenTypeAt(_(l.line,l.ch-2))))return ne.Pass;a="addFour"}else if(f){var p=l.ch==0?" ":E.getRange(_(l.line,l.ch-1),l);if(!ne.isWordChar(g)&&p!=b&&!ne.isWordChar(p))a="both";else return ne.Pass}else if(w&&(g.length===0||/\s/.test(g)||u.indexOf(g)>-1))a="both";else return ne.Pass;if(!v)v=a;else if(v!=a)return ne.Pass}var y=s%2?o.charAt(s-1):b,M=s%2?b:o.charAt(s+1);E.operation(function(){if(v=="skip")E.execCommand("goCharRight");else if(v=="skipThree")for(var F=0;F<3;F++)E.execCommand("goCharRight");else if(v=="surround"){for(var j=E.getSelections(),F=0;F<j.length;F++)j[F]=y+j[F]+M;E.replaceSelections(j,"around"),j=E.listSelections().slice();for(var F=0;F<j.length;F++)j[F]=x(j[F]);E.setSelections(j)}else v=="both"?(E.replaceSelection(y+M,null),E.triggerElectric(y+M),E.execCommand("goCharLeft")):v=="addFour"&&(E.replaceSelection(y+y+y+y,"before"),E.execCommand("goCharRight"))})}function k(E,b){var d=E.getRange(_(b.line,b.ch-1),_(b.line,b.ch+1));return d.length==2?d:null}function C(E,b){var d=E.getTokenAt(_(b.line,b.ch+1));return/\bstring/.test(d.type)&&d.start==b.ch&&(b.ch==0||!/\bstring/.test(E.getTokenTypeAt(b)))}})},GfqC:function(ot,We,ee){"use strict";var ne=ee("q1tI"),V=ee.n(ne),_=ee("TSYQ"),G=ee.n(_);function U(W,O){var P="cannot "+W.method+" "+W.action+" "+O.status+"'",H=new Error(P);return H.status=O.status,H.method=W.method,H.url=W.action,H}function R(W){var O=W.responseText||W.response;if(!O)return O;try{return JSON.parse(O)}catch(P){return O}}function B(W){var O=new XMLHttpRequest;W.onProgress&&O.upload&&(O.upload.onprogress=function(q){q.total>0&&(q.percent=q.loaded/q.total*100),W.onProgress(q)});var P=new FormData;W.data&&Object.keys(W.data).forEach(function(X){var q=W.data[X];if(Array.isArray(q)){q.forEach(function(re){P.append(X+"[]",re)});return}P.append(X,W.data[X])}),W.file instanceof Blob?P.append(W.filename,W.file,W.file.name):P.append(W.filename,W.file),O.onerror=function(q){W.onError(q)},O.onload=function(){return O.status<200||O.status>=300?W.onError(U(W,O),R(O)):W.onSuccess(R(O),O)},O.open(W.method,W.action,!0),W.withCredentials&&"withCredentials"in O&&(O.withCredentials=!0);var H=W.headers||{};return H["X-Requested-With"]!==null&&O.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(H).forEach(function(X){H[X]!==null&&O.setRequestHeader(X,H[X])}),O.send(P),{abort:function(){O.abort()}}}var I=+new Date,D=0;function L(){return"rc-upload-"+I+"-"+ ++D}function x(W,O){return W.indexOf(O,W.length-O.length)!==-1}var A=function(W,O){if(W&&O){var P=Array.isArray(O)?O:O.split(","),H=W.name||"",X=W.type||"",q=X.replace(/\/.*$/,"");return P.some(function(re){var Ee=re.trim();return Ee.charAt(0)==="."?x(H.toLowerCase(),Ee.toLowerCase()):/\/\*$/.test(Ee)?q===Ee.replace(/\/.*$/,""):X===Ee})}return!0};function k(W,O){var P=W.createReader(),H=[];function X(){P.readEntries(function(q){var re=Array.prototype.slice.apply(q);H=H.concat(re);var Ee=!re.length;Ee?O(H):X()})}X()}var C=function(O,P,H){var X=function q(re,Ee){Ee=Ee||"",re.isFile?re.file(function(he){H(he)&&(re.fullPath&&!he.webkitRelativePath&&(Object.defineProperties(he,{webkitRelativePath:{writable:!0}}),he.webkitRelativePath=re.fullPath.replace(/^\//,""),Object.defineProperties(he,{webkitRelativePath:{writable:!1}})),P([he]))}):re.isDirectory&&k(re,function(he){he.forEach(function(xe){q(xe,""+Ee+re.name+"/")})})};O.forEach(function(q){X(q.webkitGetAsEntry())})},E=C,b=Object.assign||function(W){for(var O=1;O<arguments.length;O++){var P=arguments[O];for(var H in P)Object.prototype.hasOwnProperty.call(P,H)&&(W[H]=P[H])}return W},d=function(){function W(O,P){var H=[],X=!0,q=!1,re=void 0;try{for(var Ee=O[Symbol.iterator](),he;!(X=(he=Ee.next()).done)&&!(H.push(he.value),P&&H.length===P);X=!0);}catch(xe){q=!0,re=xe}finally{try{!X&&Ee.return&&Ee.return()}finally{if(q)throw re}}return H}return function(O,P){if(Array.isArray(O))return O;if(Symbol.iterator in Object(O))return W(O,P);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),o=function(){function W(O,P){for(var H=0;H<P.length;H++){var X=P[H];X.enumerable=X.enumerable||!1,X.configurable=!0,"value"in X&&(X.writable=!0),Object.defineProperty(O,X.key,X)}}return function(O,P,H){return P&&W(O.prototype,P),H&&W(O,H),O}}();function s(W,O,P){return O in W?Object.defineProperty(W,O,{value:P,enumerable:!0,configurable:!0,writable:!0}):W[O]=P,W}function u(W,O){var P={};for(var H in W){if(O.indexOf(H)>=0)continue;if(!Object.prototype.hasOwnProperty.call(W,H))continue;P[H]=W[H]}return P}function S(W,O){if(!(W instanceof O))throw new TypeError("Cannot call a class as a function")}function f(W,O){if(!W)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return O&&(typeof O=="object"||typeof O=="function")?O:W}function m(W,O){if(typeof O!="function"&&O!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof O);W.prototype=Object.create(O&&O.prototype,{constructor:{value:W,enumerable:!1,writable:!0,configurable:!0}}),O&&(Object.setPrototypeOf?Object.setPrototypeOf(W,O):W.__proto__=O)}var w=function(O){return Object.keys(O).reduce(function(P,H){return(H.substr(0,5)==="data-"||H.substr(0,5)==="aria-"||H==="role")&&(P[H]=O[H]),P},{})},v=function(W){m(O,W);function O(){var P,H,X,q;S(this,O);for(var re=arguments.length,Ee=Array(re),he=0;he<re;he++)Ee[he]=arguments[he];return q=(H=(X=f(this,(P=O.__proto__||Object.getPrototypeOf(O)).call.apply(P,[this].concat(Ee))),X),X.state={uid:L()},X.reqs={},X.onChange=function(xe){var pe=xe.target.files;X.uploadFiles(pe),X.reset()},X.onClick=function(xe){var pe=X.fileInput;if(!pe)return;var ve=X.props,ce=ve.children,fe=ve.onClick;ce&&ce.type==="button"&&(pe.parentNode.focus(),pe.parentNode.querySelector("button").blur()),pe.click(),fe&&fe(xe)},X.onKeyDown=function(xe){xe.key==="Enter"&&X.onClick()},X.onFileDrop=function(xe){var pe=X.props.multiple;if(xe.preventDefault(),xe.type==="dragover")return;if(X.props.directory)E(Array.prototype.slice.call(xe.dataTransfer.items),X.uploadFiles,function(ce){return A(ce,X.props.accept)});else{var ve=Array.prototype.slice.call(xe.dataTransfer.files).filter(function(ce){return A(ce,X.props.accept)});pe===!1&&(ve=ve.slice(0,1)),X.uploadFiles(ve)}},X.uploadFiles=function(xe){var pe=Array.prototype.slice.call(xe);pe.map(function(ve){return ve.uid=L(),ve}).forEach(function(ve){X.upload(ve,pe)})},X.saveFileInput=function(xe){X.fileInput=xe},H),f(X,q)}return o(O,[{key:"componentDidMount",value:function(){this._isMounted=!0}},{key:"componentWillUnmount",value:function(){this._isMounted=!1,this.abort()}},{key:"upload",value:function(H,X){var q=this,re=this.props;if(!re.beforeUpload)return setTimeout(function(){return q.post(H)},0);var Ee=re.beforeUpload(H,X);Ee&&Ee.then?Ee.then(function(he){var xe=Object.prototype.toString.call(he);return xe==="[object File]"||xe==="[object Blob]"?q.post(he):q.post(H)}).catch(function(he){console.log(he)}):Ee!==!1&&setTimeout(function(){return q.post(H)},0);return}},{key:"post",value:function(H){var X=this;if(!this._isMounted)return;var q=this.props,re=q.onStart,Ee=q.onProgress,he=q.transformFile,xe=he===void 0?function(pe){return pe}:he;new Promise(function(pe){var ve=q.action;return typeof ve=="function"&&(ve=ve(H)),pe(ve)}).then(function(pe){var ve=H.uid,ce=q.customRequest||B,fe=Promise.resolve(xe(H)).then(function($){var ae=q.data;return typeof ae=="function"&&(ae=ae($)),Promise.all([$,ae])}).catch(function($){console.error($)});fe.then(function($){var ae=d($,2),Z=ae[0],ge=ae[1],Se={action:pe,filename:q.name,data:ge,file:Z,headers:q.headers,withCredentials:q.withCredentials,method:q.method||"post",onProgress:Ee?function(me){Ee(me,H)}:null,onSuccess:function(we,De){delete X.reqs[ve],q.onSuccess(we,H,De)},onError:function(we,De){delete X.reqs[ve],q.onError(we,De,H)}};re(H),X.reqs[ve]=ce(Se)})})}},{key:"reset",value:function(){this.setState({uid:L()})}},{key:"abort",value:function(H){var X=this.reqs;if(H){var q=H;H&&H.uid&&(q=H.uid),X[q]&&X[q].abort&&X[q].abort(),delete X[q]}else Object.keys(X).forEach(function(re){X[re]&&X[re].abort&&X[re].abort(),delete X[re]})}},{key:"render",value:function(){var H,X=this.props,q=X.component,re=X.prefixCls,Ee=X.className,he=X.disabled,xe=X.id,pe=X.style,ve=X.multiple,ce=X.accept,fe=X.children,$=X.directory,ae=X.openFileDialogOnClick,Z=X.onMouseEnter,ge=X.onMouseLeave,Se=u(X,["component","prefixCls","className","disabled","id","style","multiple","accept","children","directory","openFileDialogOnClick","onMouseEnter","onMouseLeave"]),me=G()((H={},s(H,re,!0),s(H,re+"-disabled",he),s(H,Ee,Ee),H)),we=he?{}:{onClick:ae?this.onClick:function(){},onKeyDown:ae?this.onKeyDown:function(){},onMouseEnter:Z,onMouseLeave:ge,onDrop:this.onFileDrop,onDragOver:this.onFileDrop,tabIndex:"0"};return V.a.createElement(q,b({},we,{className:me,role:"button",style:pe}),V.a.createElement("input",b({},w(Se),{id:xe,type:"file",ref:this.saveFileInput,onClick:function(Oe){return Oe.stopPropagation()},key:this.state.uid,style:{display:"none"},accept:ce,directory:$?"directory":null,webkitdirectory:$?"webkitdirectory":null,multiple:ve,onChange:this.onChange})),fe)}}]),O}(ne.Component),h=v,c=Object.assign||function(W){for(var O=1;O<arguments.length;O++){var P=arguments[O];for(var H in P)Object.prototype.hasOwnProperty.call(P,H)&&(W[H]=P[H])}return W},l=function(){function W(O,P){for(var H=0;H<P.length;H++){var X=P[H];X.enumerable=X.enumerable||!1,X.configurable=!0,"value"in X&&(X.writable=!0),Object.defineProperty(O,X.key,X)}}return function(O,P,H){return P&&W(O.prototype,P),H&&W(O,H),O}}();function a(W,O){if(!(W instanceof O))throw new TypeError("Cannot call a class as a function")}function g(W,O){if(!W)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return O&&(typeof O=="object"||typeof O=="function")?O:W}function p(W,O){if(typeof O!="function"&&O!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof O);W.prototype=Object.create(O&&O.prototype,{constructor:{value:W,enumerable:!1,writable:!0,configurable:!0}}),O&&(Object.setPrototypeOf?Object.setPrototypeOf(W,O):W.__proto__=O)}function y(){}var M=function(W){p(O,W);function O(){var P,H,X,q;a(this,O);for(var re=arguments.length,Ee=Array(re),he=0;he<re;he++)Ee[he]=arguments[he];return q=(H=(X=g(this,(P=O.__proto__||Object.getPrototypeOf(O)).call.apply(P,[this].concat(Ee))),X),X.saveUploader=function(xe){X.uploader=xe},H),g(X,q)}return l(O,[{key:"abort",value:function(H){this.uploader.abort(H)}},{key:"render",value:function(){return V.a.createElement(h,c({},this.props,{ref:this.saveUploader}))}}]),O}(ne.Component);M.defaultProps={component:"span",prefixCls:"rc-upload",data:{},headers:{},name:"file",multipart:!1,onStart:y,onError:y,onSuccess:y,multiple:!1,beforeUpload:null,customRequest:null,withCredentials:!1,openFileDialogOnClick:!0};var F=M,j=We.a=F},HmJG:function(ot,We,ee){},LdHM:function(ot,We,ee){"use strict";ee.d(We,"b",function(){return u}),ee.d(We,"a",function(){return f});var ne=ee("1OyB"),V=ee("vuIU"),_=ee("Ji7U"),G=ee("LK+K"),U=ee("q1tI"),R=ee("rePB"),B=ee("Ff2n"),I=ee("ODXe"),D=ee("4IlW"),L=ee("bX4T"),x=ee("YrtM"),A=ee("TSYQ"),k=ee.n(A),C=ee("+nKL"),E=ee("8OUc"),b=function(H,X){var q=H.prefixCls,re=H.id,Ee=H.flattenOptions,he=H.childrenAsData,xe=H.values,pe=H.searchValue,ve=H.multiple,ce=H.defaultActiveFirstOption,fe=H.height,$=H.itemHeight,ae=H.notFoundContent,Z=H.open,ge=H.menuItemSelectedIcon,Se=H.virtual,me=H.onSelect,we=H.onToggleOpen,De=H.onActiveValue,Oe=H.onScroll,ke=H.onMouseEnter,Le="".concat(q,"-item"),_e=Object(x.a)(function(){return Ee},[Z,Ee],function(Fe,se){return se[0]&&Fe[1]!==se[1]}),ze=U.useRef(null),Xe=function(se){se.preventDefault()},Ve=function(se){ze.current&&ze.current.scrollTo({index:se})},je=function(se){for(var le=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,ue=_e.length,J=0;J<ue;J+=1){var Q=(se+J*le+ue)%ue,te=_e[Q],ie=te.group,be=te.data;if(!ie&&!be.disabled)return Q}return-1},qe=U.useState(function(){return je(0)}),He=Object(I.a)(qe,2),$e=He[0],Ae=He[1],Ze=function(se){Ae(se);var le=_e[se];if(!le){De(null,-1);return}De(le.data.value,se)};U.useEffect(function(){Ze(ce!==!1?je(0):-1)},[_e.length,pe]),U.useEffect(function(){var Fe=setTimeout(function(){if(!ve&&Z&&xe.size===1){var se=Array.from(xe)[0],le=_e.findIndex(function(ue){var J=ue.data;return J.value===se});Ze(le),Ve(le)}});return function(){return clearTimeout(Fe)}},[Z]);var Je=function(se){se!==void 0&&me(se,{selected:!xe.has(se)}),ve||we(!1)};if(U.useImperativeHandle(X,function(){return{onKeyDown:function(se){var le=se.which;switch(le){case D.a.UP:case D.a.DOWN:{var ue=0;if(le===D.a.UP?ue=-1:le===D.a.DOWN&&(ue=1),ue!==0){var J=je($e+ue,ue);Ve(J),Ze(J)}break}case D.a.ENTER:{var Q=_e[$e];Q&&!Q.data.disabled?Je(Q.data.value):Je(void 0),Z&&se.preventDefault();break}case D.a.ESC:we(!1)}},onKeyUp:function(){},scrollTo:function(se){Ve(se)}}}),_e.length===0)return U.createElement("div",{role:"listbox",id:"".concat(re,"_list"),className:"".concat(Le,"-empty"),onMouseDown:Xe},ae);function Re(Fe){var se=_e[Fe];if(!se)return null;var le=se.data||{},ue=le.value,J=le.label,Q=le.children,te=Object(L.a)(le,!0),ie=he?Q:J;return se?U.createElement("div",Object.assign({"aria-label":typeof ie=="string"?ie:null},te,{key:Fe,role:"option",id:"".concat(re,"_list_").concat(Fe),"aria-selected":xe.has(ue)}),ue):null}return U.createElement(U.Fragment,null,U.createElement("div",{role:"listbox",id:"".concat(re,"_list"),style:{height:0,width:0,overflow:"hidden"}},Re($e-1),Re($e),Re($e+1)),U.createElement(C.a,{itemKey:"key",ref:ze,data:_e,height:fe,itemHeight:$,fullHeight:!1,onMouseDown:Xe,onScroll:Oe,virtual:Se,onMouseEnter:ke},function(Fe,se){var le,ue=Fe.group,J=Fe.groupOption,Q=Fe.data,te=Q.label,ie=Q.key;if(ue)return U.createElement("div",{className:k()(Le,"".concat(Le,"-group"))},te!==void 0?te:ie);var be=Q.disabled,Ce=Q.value,Ie=Q.title,tt=Q.children,dt=Q.style,it=Q.className,Lt=Object(B.a)(Q,["disabled","value","title","children","style","className"]),mt=xe.has(Ce),st="".concat(Le,"-option"),It=k()(Le,st,it,(le={},Object(R.a)(le,"".concat(st,"-grouped"),J),Object(R.a)(le,"".concat(st,"-active"),$e===se&&!be),Object(R.a)(le,"".concat(st,"-disabled"),be),Object(R.a)(le,"".concat(st,"-selected"),mt),le)),yt=he?tt:te,Yt=!ge||typeof ge=="function"||mt;return U.createElement("div",Object.assign({},Lt,{"aria-selected":mt,className:It,title:Ie,onMouseMove:function(){if($e===se||be)return;Ze(se)},onClick:function(){be||Je(Ce)},style:dt}),U.createElement("div",{className:"".concat(st,"-content")},yt||Ce),U.isValidElement(ge)||mt,Yt&&U.createElement(E.a,{className:"".concat(Le,"-option-state"),customizeIcon:ge,customizeIconProps:{isSelected:mt}},mt?"\u2713":null))}))},d=U.forwardRef(b);d.displayName="OptionList";var o=d,s=function(){return null};s.isSelectOption=!0;var u=s,S=function(){return null};S.isSelectOptGroup=!0;var f=S,m=ee("VTBJ"),w=ee("Zm9Q");function v(P){var H=P.key,X=P.props,q=X.children,re=X.value,Ee=Object(B.a)(X,["children","value"]);return Object(m.a)({key:H,value:re!==void 0?re:H,children:q},Ee)}function h(P){var H=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(w.a)(P).map(function(X,q){if(!U.isValidElement(X)||!X.type)return null;var re=X.type.isSelectOptGroup,Ee=X.key,he=X.props,xe=he.children,pe=Object(B.a)(he,["children"]);return H||!re?v(X):Object(m.a)(Object(m.a)({key:"__RC_SELECT_GRP__".concat(Ee===null?q:Ee,"__"),label:Ee},pe),{},{options:h(xe)})}).filter(function(X){return X})}var c=ee("2Qr1"),l=ee("qNPg"),a=ee("U8pU"),g=ee("Kwbf"),p=ee("WKfj");function y(P){var H=P.mode,X=P.options,q=P.children,re=P.backfill,Ee=P.allowClear,he=P.placeholder,xe=P.getInputElement,pe=P.showSearch,ve=P.onSearch,ce=P.defaultOpen,fe=P.autoFocus,$=P.labelInValue,ae=P.value,Z=P.inputValue,ge=P.optionLabelProp,Se=H==="multiple"||H==="tags",me=pe!==void 0?pe:Se||H==="combobox",we=X||h(q);if(Object(g.a)(H!=="tags"||we.every(function(Le){return!Le.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),H==="tags"||H==="combobox"){var De=we.some(function(Le){return Le.options?Le.options.some(function(_e){return typeof("value"in _e?_e.value:_e.key)=="number"}):typeof("value"in Le?Le.value:Le.key)=="number"});Object(g.a)(!De,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(g.a)(H!=="combobox"||!ge,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(g.a)(H==="combobox"||!re,"`backfill` only works with `combobox` mode."),Object(g.a)(H==="combobox"||!xe,"`getInputElement` only work with `combobox` mode."),Object(g.b)(H!=="combobox"||!xe||!Ee||!he,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),ve&&!me&&H!=="combobox"&&H!=="tags"&&Object(g.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(g.b)(!ce||fe,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),ae!=null){var Oe=Object(p.d)(ae);Object(g.a)(!$||Oe.every(function(Le){return Object(a.a)(Le)==="object"&&("key"in Le||"value"in Le)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(g.a)(!Se||Array.isArray(ae),"`value` should be array when `mode` is `multiple` or `tags`")}if(q){var ke=null;Object(w.a)(q).some(function(Le){if(!U.isValidElement(Le)||!Le.type)return!1;var _e=Le.type;if(_e.isSelectOption)return!1;if(_e.isSelectOptGroup){var ze=Object(w.a)(Le.props.children).every(function(Xe){return!U.isValidElement(Xe)||!Le.type||Xe.type.isSelectOption?!0:(ke=Xe.type,!1)});return!ze}return ke=_e,!0}),ke&&Object(g.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(ke.displayName||ke.name||ke,"`.")),Object(g.a)(Z===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var M=y,F=Object(l.a)({prefixCls:"rc-select",components:{optionList:o},convertChildrenToData:h,flattenOptions:c.d,getLabeledValue:c.e,filterOptions:c.b,isValueDisabled:c.g,findValueOption:c.c,warningProps:M,fillOptionsWithMissingValue:c.a}),j=function(P){Object(_.a)(X,P);var H=Object(G.a)(X);function X(){var q;return Object(ne.a)(this,X),q=H.apply(this,arguments),q.selectRef=U.createRef(),q.focus=function(){q.selectRef.current.focus()},q.blur=function(){q.selectRef.current.blur()},q}return Object(V.a)(X,[{key:"render",value:function(){return U.createElement(F,Object.assign({ref:this.selectRef},this.props))}}]),X}(U.Component);j.Option=u,j.OptGroup=f;var W=j,O=We.c=W},M8RZ:function(ot,We,ee){"use strict";ee.d(We,"a",function(){return D});var ne=ee("fWQN"),V=ee("mtLc"),_=ee("yKVA"),G=ee("879j"),U=ee("q1tI"),R=ee.n(U),B=ee("i8i4"),I=ee.n(B),D=function(L){Object(_.a)(A,L);var x=Object(G.a)(A);function A(k){var C;Object(ne.a)(this,A),C=x.call(this,k);var E=window.document;return C.node=E.createElement("div"),E.body.appendChild(C.node),C}return Object(V.a)(A,[{key:"render",value:function(){var C=this.props.children;return Object(B.createPortal)(C,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),A}(R.a.Component)},Ot1p:function(ot,We,ee){"use strict";var ne=ee("2qtc"),V=ee("kLXV"),_=ee("rAM+"),G=ee("miYZ"),U=ee("tsqr"),R=ee("tJVT"),B=ee("jrin"),I=ee("q1tI"),D=ee.n(I),L=ee("VrN/"),x=ee.n(L),A=ee("bdgK"),k=ee("p77/"),C=ee("Bd2K"),E=ee("ELLl"),b=ee("19Vz"),d=ee("lZu9"),o=ee("+NIl"),s=ee("kSUc"),u=ee("9Bee"),S=function(se){var le=se.value,ue=le===void 0?"":le,J=se.className,Q=se.showTextOnly,te=se.showLines,ie=se.style,be=ie===void 0?{}:ie,Ce=Object(I.useMemo)(function(){return""},[ue]);return D.a.createElement(D.a.Fragment,null,D.a.createElement("div",{dangerouslySetInnerHTML:{__html:Ce}}))},f=ee("0Owb"),m=ee("dejd"),w=ee("C+DQ"),v=[{title:"\u7C97\u4F53",icon:"icon-bold",actionName:"bold"},{title:"\u659C\u4F53",icon:"icon-italic",actionName:"italic"},"|",{title:"\u65E0\u5E8F\u5217\u8868",icon:"icon-unorder-list",actionName:"list-ul"},{title:"\u6709\u5E8F\u5217\u8868",icon:"icon-order-list",actionName:"list-ol"},"|",{title:"\u884C\u5185\u4EE3\u7801",icon:"icon-code",actionName:"code"},{title:"\u4EE3\u7801\u5757\uFF08\u591A\u8BED\u8A00\u98CE\u683C\uFF09",icon:"icon-file-code",actionName:"code-block"},{title:"\u94FE\u63A5",icon:"icon-link",actionName:"link"},"|",{title:"\u884C\u5185\u516C\u5F0F",icon:"icon-sum",actionName:"inline-latex"},{title:"\u591A\u884C\u516C\u5F0F",icon:"icon-formula",actionName:"latex"},"|",{title:"\u6DFB\u52A0\u56FE\u7247",icon:"icon-picture",actionName:"upload-image"},{title:"\u8868\u683C",icon:"icon-table",actionName:"add-table"},"|",{title:"\u6362\u884C",icon:"icon-minus",actionName:"line-break"},{title:"\u6E05\u7A7A",icon:"icon-eraser",actionName:"eraser"}];function h(se){var le=se.onActionCallback,ue=se.title,J=se.icon,Q=se.actionName,te=se.className,ie=te===void 0?"":te,be=se.children;function Ce(){le(Q)}return D.a.createElement("a",{title:ue,className:ie,onClick:Ce},D.a.createElement("i",{className:"md-iconfont ".concat(J)}),be)}var c=function(se){var le=se.watch,ue=se.showNullButton,J=se.onActionCallback,Q=se.fullScreen,te=se.insertTemp,ie=se.hidetoolBar,be=[].concat(v,[{title:"".concat(le?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(le?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return D.a.createElement("ul",{className:"markdown-toolbar-container"},!ie&&be.map(function(Ce,Ie){return D.a.createElement("li",{key:Ie},Ce.actionName?D.a.createElement(h,Object(f.a)({},Ce,{onActionCallback:J})):D.a.createElement("span",{className:"v-line"}))}),ue?D.a.createElement("li",null,D.a.createElement(h,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:J},D.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,te&&D.a.createElement("li",null,D.a.createElement(h,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(te),onActionCallback:J},D.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),D.a.createElement("li",{className:"btn-full-screen"},D.a.createElement(h,{icon:"".concat(Q?"icon-shrink":"icon-enlarge"),title:Q?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:J})))},l=ee("M8RZ"),a=ee("+L6B"),g=ee("2/Rp"),p=ee("y8nQ"),y=ee("Vl3Y"),M=ee("5NDa"),F=ee("5rEg"),j={labelCol:{span:4},wrapperCol:{span:20}},W=function(se){var le=se.callback,ue=se.onCancel;function J(Q){le(Q)}return D.a.createElement(y.a,Object(f.a)({},j,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:J}),D.a.createElement(y.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},D.a.createElement(F.a,null)),D.a.createElement(y.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},D.a.createElement(F.a,null)),D.a.createElement("div",{className:"flex-container flex-end"},D.a.createElement(g.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),D.a.createElement(g.a,{type:"ghost",onClick:ue},"\u53D6\u6D88")))},O=ee("7ahc"),P=ee("HmJG"),H=ee("BjJ7"),X=y.a.useForm,q={width:280,marginRight:10},re={labelCol:{span:5},wrapperCol:{span:19}},Ee=function(se){var le=se.callback,ue=se.onCancel,J=X(),Q=Object(R.a)(J,1),te=Q[0];function ie(Ie){le(Ie)}function be(Ie,tt){te.setFieldsValue({src:"/api/attachments/".concat(Ie.id),type:tt.type})}function Ce(Ie){var tt=Ie.target.files[0];xe(tt,be)}return D.a.createElement(y.a,Object(f.a)({form:te},re,{className:"upload-image-panel",onFinish:ie}),D.a.createElement(y.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},D.a.createElement("div",{className:"flex-container"},D.a.createElement(y.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},D.a.createElement(F.a,{style:q})),D.a.createElement(he,{onFileChange:Ce}))),D.a.createElement(y.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u63CF\u8FF0"}]},D.a.createElement(F.a,{style:{width:264}})),D.a.createElement(y.a.Item,{style:{textAlign:"right"}},D.a.createElement(g.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),D.a.createElement(g.a,{type:"ghost",onClick:ue},"\u53D6\u6D88")))};function he(se){var le=se.onFileChange;return D.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",D.a.createElement("input",{type:"file",onChange:le}))}function xe(se,le){if(!se)throw new String("\u6CA1\u6709\u6587\u4EF6");var ue=new FormData;ue.append("editormd-image-file",se),ue.append("file_param_name","editormd-image-file"),ue.append("byxhr","true");var J=new window.XMLHttpRequest;J.withCredentials=!0,J.addEventListener("load",function(Q){le(JSON.parse(Q.target.responseText),se)},!1),J.addEventListener("error",function(Q){console.error(Q)},!1),J.open("POST","".concat(H.a,"/api/attachments.json")),J.send(ue)}var pe=ee("giR+"),ve=ee("fyUT"),ce=ee("7Kak"),fe=ee("9yH6"),$=fe.a.Group,ae={margin:"0 8px"},Z=function(se){var le=se.callback,ue=se.onCancel;function J(Q){le(Q)}return D.a.createElement(y.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:J},D.a.createElement("div",{className:"flex-container"},D.a.createElement("span",{style:ae},"\u5355\u5143\u683C\u6570\uFF1A"),D.a.createElement("span",{style:ae},"\u884C\u6570"),D.a.createElement(y.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},D.a.createElement(ve.a,null)),D.a.createElement("span",{style:ae},"\u5217\u6570"),D.a.createElement(y.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},D.a.createElement(ve.a,null))),D.a.createElement("div",{className:"flex-container",style:{marginTop:12}},D.a.createElement("span",{style:ae},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),D.a.createElement(y.a.Item,{name:"align"},D.a.createElement($,null,D.a.createElement(fe.a,{value:"default"},D.a.createElement("i",{className:"fa fa-align-justify"})),D.a.createElement(fe.a,{value:"left"},D.a.createElement("i",{className:"fa fa-align-left"})),D.a.createElement(fe.a,{value:"center"},D.a.createElement("i",{className:"fa fa-align-center"})),D.a.createElement(fe.a,{value:"right"},D.a.createElement("i",{className:"fa fa-align-right"}))))),D.a.createElement("div",{className:"flex-container flex-end"},D.a.createElement(g.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),D.a.createElement(g.a,{type:"ghost",onClick:ue},"\u53D6\u6D88")))},ge=ee("m3rI"),Se="link",me="upload-image",we="code-block",De="add-table",Oe="------------",ke={default:Oe,left:":".concat(Oe),center:":".concat(Oe,":"),right:"".concat(Oe,":")},Le=ee("9VGf"),_e,ze;function Xe(){}var Ve=0,je=1e4,qe="\u2581",He=`
|
|
**\u6A21\u677F\u6807\u9898**
|
|
\u6A21\u677F\u6B63\u6587\u5185\u5BB9\uFF0C\u53EF\u8F93\u5165\u6587\u672C\u5185\u5BB9\u548C\u7C98\u8D34\u56FE\u7247\u7B49\u64CD\u4F5C`;function $e(se){return/^\d+$/.test(se)?"".concat(se,"px"):se}var Ae=navigator.platform.toUpperCase().indexOf("MAC")>=0,Ze=Ae?"Cmd":"Ctrl",Je=(_e={},Object(B.a)(_e,Ze+"-B","bold"),Object(B.a)(_e,Ze+"-I","italic"),_e),Re=(ze={},Object(B.a)(ze,Se,"\u6DFB\u52A0\u94FE\u63A5"),Object(B.a)(ze,we,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(B.a)(ze,me,"\u6DFB\u52A0\u56FE\u7247"),Object(B.a)(ze,De,"\u6DFB\u52A0\u8868\u683C"),ze),Fe=We.a=function(se){var le=se.defaultValue,ue=le===void 0?"":le,J=se.onChange,Q=se.width,te=Q===void 0?"100%":Q,ie=se.height,be=ie===void 0?400:ie,Ce=se.miniToolbar,Ie=Ce===void 0?!1:Ce,tt=se.isFocus,dt=tt===void 0?!1:tt,it=se.watch,Lt=se.insertTemp,mt=se.mode,st=mt===void 0?"markdown":mt,It=se.id,yt=It===void 0?"markdown-editor-id":It,Yt=se.showResizeBar,Wt=Yt===void 0?!1:Yt,pt=se.noStorage,Tr=pt===void 0?!1:pt,zr=se.showNullButton,lr=zr===void 0?!1:zr,Sr=se.hidetoolBar,hr=Sr===void 0?!1:Sr,yi=se.fullScreen,ur=yi===void 0?!1:yi,Vr=se.onBlur,cn=se.onCMBeforeChange,Ct=se.onFullScreen,et=se.className,wr=et===void 0?"":et,fn=se.disablePaste,dr=fn===void 0?!1:fn,gt=se.placeholder,Cr=gt===void 0?"":gt,Rr=se.values,Xr=Rr===void 0?"":Rr,Ue=Object(I.useState)(null),ut=Object(R.a)(Ue,2),Be=ut[0],Fn=ut[1],hn=Object(I.useState)(ue),Yr=Object(R.a)(hn,2),$r=Yr[0],lt=Yr[1],Qi=Object(I.useState)(it),Nn=Object(R.a)(Qi,2),cr=Nn[0],ar=Nn[1],bi=Object(I.useState)(ur),Bn=Object(R.a)(bi,2),rr=Bn[0],mn=Bn[1],Ei=Object(I.useState)(""),pn=Object(R.a)(Ei,2),Ar=pn[0],_r=pn[1],xi=Object(I.useState)(0),jn=Object(R.a)(xi,2),Jr=jn[0],Wn=jn[1],Ti=Object(I.useState)(be),fr=Object(R.a)(Ti,2),Si=fr[0],wi=fr[1],gn=Object(I.useState)(!1),Pr=Object(R.a)(gn,2),Fa=Pr[0],Hn=Pr[1],Qr=Object(I.useRef)(),Kn=Object(I.useRef)(),kr=Object(I.useRef)(),Zr=Object(I.useRef)();Object(I.useEffect)(function(){lt(Xr),Be==null||Be.setValue(Xr)},[Xr]),Object(I.useEffect)(function(){Ct==null||Ct(rr)},[rr]),Object(I.useEffect)(function(){if(Qr.current){var rt=x.a.fromTextArea(Qr.current,{mode:st,lineNumbers:!Ie,lineWrapping:!0,value:ue,autoCloseTags:!0,autoCloseBrackets:!0});dt&&rt.focus();function ct(ft,Et){if(dr){Et.preventDefault();return}var xt=Et.clipboardData;if(xt){var St=xt.types.toString(),Rt=xt.items,At=["pptm","pptx","ppt","pot","pps","ppa","potx","ppsx","ppam","pptm","potm","ppsm","doc","docx","dot","dotx","docm","dotm","xls","xlsx","csv","xlt","xla","xltx","xlsm","xltm","xlam","xlsb"];if(St==="Files"||xt.types.indexOf("Files")>-1){if(Et.preventDefault(),st=="stex")return;try{var Gt,mr=Rt[1];((Gt=Rt[0])===null||Gt===void 0?void 0:Gt.kind)==="file"&&(mr=Rt[0]);var wt=mr.getAsFile(),Mr=wt.name.split(".").pop();xe(wt,function(zt){if(zt.id){var Ir,Ur,yn;(wt==null||((Ir=wt.type)===null||Ir===void 0)?void 0:Ir.indexOf("image"))>-1?rt.replaceSelection(".concat(zt.content_type,")")):(wt==null||((Ur=wt.type)===null||Ur===void 0)?void 0:Ur.indexOf("video"))>-1?rt.replaceSelection('<video width="100%" controls src="'.concat(ge.a.API_SERVER,"/api/attachments/").concat(zt.id,'"></video>')):(wt==null||((yn=wt.type)===null||yn===void 0)?void 0:yn.indexOf("pdf"))>-1?rt.replaceSelection('<a href="'.concat(ge.a.API_SERVER,"/api/attachments/").concat(zt.id,"?type=").concat(wt.type,'&disposition=inline" target="_blank">').concat(wt.name,"</a>")):At.includes(Mr)?rt.replaceSelection('<a href="'.concat(ge.a.API_SERVER,"/api/attachments/").concat(zt.id,'?type=office&disposition=inline" target="_blank">').concat(wt.name,"</a>")):rt.replaceSelection("[".concat(wt.name,"](").concat(ge.a.API_SERVER,"/api/attachments/").concat(zt.id,"?type=").concat(zt.content_type,")"))}else(zt==null?void 0:zt.status)===401&&(document.location.href="/user/login")})}catch(zt){U.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return rt.on("paste",ct),Fn(rt),function(){rt.off("paste",ct)}}},[]);var Ci=Object(I.useCallback)(function(){if(Kn.current)try{}catch(rt){console.log(rt,"---- to set md editor body height")}},[Si,Kn,rr]);Object(I.useEffect)(function(){function rt(){var ft=new A.default(function(Et){var xt=Object(_.a)(Et),St;try{for(xt.s();!(St=xt.n()).done;){var Rt=St.value;(Rt.target.offsetHeight>0||Rt.target.offsetWidth>0)&&(Ci(),Be.setSize("100%","100%"),Be.refresh())}}catch(At){xt.e(At)}finally{xt.f()}});return ft.observe(Qr.current.parentElement),ft}if(Be){var ct=rt();return function(){ct.unobserve(Qr.current.parentElement)}}},[Be,Ci]),Object(I.useEffect)(function(){if(Be){for(var rt=[],ct=function(){var Rt=Et[ft];xt=Object(R.a)(Rt,2);var At=xt[0],Gt=xt[1],mr=Object(B.a)({},At,function(){Gn(Gt)});rt.push(mr),Be.addKeyMap(mr)},ft=0,Et=Object.entries(Je);ft<Et.length;ft++){var xt;ct()}return function(){var St=Object(_.a)(rt),Rt;try{for(St.s();!(Rt=St.n()).done;){var At=Rt.value;Be.removeKeyMap(At)}}catch(Gt){St.e(Gt)}finally{St.f()}}}},[Be]),Object(I.useEffect)(function(){ur!==rr&&mn(ur)},[ur]),Object(Le.a)(function(){if(!Tr&&Jr>0){var rt=new Date().getTime(),ct=window.sessionStorage.getItem(yt);rt>=Jr+je&&(!ct||ct!==$r)&&(window.sessionStorage.setItem(yt,$r),Hn(!0))}},je),Object(I.useEffect)(function(){ar(it)},[Be,it]),Object(I.useEffect)(function(){Be&&(dt&&Be.focus())},[Be,dt]),Object(I.useEffect)(function(){if(cr&&Be){var rt=Be.getScrollerElement();function ct(ft){var Et=ft.target;if(Zr.current){var xt=Et.scrollTop/Et.scrollHeight;Zr.current.scrollTop=Zr.current.scrollHeight*xt}}return rt.addEventListener("scroll",ct),function(){rt.removeEventListener("scroll",ct)}}},[Be,cr]),Object(I.useEffect)(function(){if(Be&&cn){function rt(ct,ft){cn(ct,ft)}return Be.on("beforeChange",rt),function(){Be.off("beforeChange",rt)}}},[Be,cn]),Object(I.useEffect)(function(){if(Be&&Vr){function rt(){Vr(Be.getValue())}return Be.on("blur",rt),function(){Be.off("blur",rt)}}},[Be,Vr]),Object(I.useEffect)(function(){if(Be){function rt(ct){var ft=ct.getValue();lt(ft),Wn(new Date().getTime()),ct.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),J&&J(ft)}return Be.on("change",rt),function(){Be.off("change",rt)}}},[Be,J]),Object(I.useEffect)(function(){Be&&(ue==null?(Be.setValue(""),lt("")):ue!==Be.getValue()&&(Be.setValue(ue),lt(ue),Be.setCursor(Be.lineCount(),0)))},[Be,ue]);var Gn=Object(I.useCallback)(function(rt){var ct=Be.getCursor(),ft=Be.getSelection(),Et=ft.split(`
|
|
`);switch(rt){case"bold":return Be.replaceSelection("**"+ft+"**"),ft===""&&Be.setCursor(ct.line,ct.ch+2),Be.focus();case"italic":return Be.replaceSelection("*"+ft+"*"),ft===""&&Be.setCursor(ct.line,ct.ch+1),Be.focus();case"code":return Be.replaceSelection("`"+ft+"`"),ft===""&&Be.setCursor(ct.line,ct.ch+1),Be.focus();case"inline-latex":return Be.replaceSelection("`$$"+ft+"$$`"),ft===""&&Be.setCursor(ct.line,ct.ch+3),Be.focus();case"latex":return Be.replaceSelection("```latex\n"+ft+"\n```"),Be.setCursor(ct.line+1,ft.length+1),Be.focus();case"line-break":return Be.replaceSelection(`<br/>
|
|
`),Be.focus();case"list-ul":return ft===""?Be.replaceSelection("- "+ft):Be.replaceSelection(Et.map(function(xt){return xt===""?"":"- ".concat(xt)}).join(`
|
|
`)),Be.focus();case"list-ol":return ft===""?Be.replaceSelection("1. "+ft):Be.replaceSelection(Et.map(function(xt,St){return xt===""?"":"".concat(St+1,". ").concat(xt)}).join(`
|
|
`)),Be.focus();case"add-null-ch":return ft===""&&Be.setCursor(ct.line,ct.ch+1),Be.replaceSelection(qe),Be.focus();case"inster-template-1":return ft===""&&Be.setCursor(ct.line,ct.ch),Be.replaceSelection(He),Be.focus();case"eraser":return Be.setValue(""),Be.focus();case"trigger-watch":return ar(!cr),Be.focus();case"trigger-full-screen":return mn(!rr),Be.focus();case Se:_r(Se);return;case we:_r(we);return;case me:_r(me);return;case De:_r(De);return;default:throw new Error}},[Be,cr,rr]),qr=Object(I.useCallback)(function(rt){_r("");switch(Ar){case Se:var ct=rt.title,ft=rt.link;return Be.replaceSelection("[".concat(ct,"](").concat(ft,")")),Be.focus();case we:var Et=rt.language,xt=rt.content;return Be.replaceSelection(["```"+Et,xt,"```"].join(`
|
|
`)),Be.focus();case me:var St=rt.src,Rt=rt.alt;return Be.replaceSelection(".concat(St,' "').concat(Rt,'" )')),Be.focus();case De:for(var At=rt.row,Gt=rt.col,mr=rt.align,wt=`
|
|
`,Mr=0;Mr<At;Mr++){for(var zt=[],Ir=[],Ur=0;Ur<Gt;Ur++)Mr===1&&Ir.push(ke[mr]),zt.push(" ");Mr===1&&(wt+="| ".concat(Ir.join(" | "),` |
|
|
`)),wt+="| ".concat(zt.join(Gt===1?"":" | "),` |
|
|
`)}return Be.replaceSelection(wt+`
|
|
`),Be.focus();default:throw new Error}},[Be,Ar]),vn=Object(I.useMemo)(function(){switch(Ar){case Se:return D.a.createElement(W,{callback:qr,onCancel:yr});case we:return D.a.createElement(O.b,{callback:qr,onCancel:yr});case me:return D.a.createElement(Ee,{callback:qr,onCancel:yr});case De:return D.a.createElement(Z,{callback:qr,onCancel:yr});default:return null}},[Ar]);function yr(){_r("")}Object(I.useEffect)(function(){if(kr.current){var rt=kr.current,ct=!1,ft=0;function Et(Rt){ct=!0,ft=Rt.pageY}function xt(){ct=!1}function St(Rt){if(ct){var At=Rt.pageY-ft;At<0&&(At=0),At>300&&(At=300);var Gt=be+At+"px";wi(Gt)}}return rt.addEventListener("mousedown",Et),document.addEventListener("mousemove",St),document.addEventListener("mouseup",xt),function(){rt.removeEventListener("mousedown",Et),document.removeEventListener("mousemove",St),document.removeEventListener("mouseup",xt)}}},[Be,kr]),Object(I.useEffect)(function(){wi(be)},[be]);var zn=$e(te),Ai=$e(Si),_i={width:zn,height:Ai},Vn=Object(I.useMemo)(function(){if(Jr){var rt=new Date(Jr),ct=rt.getHours(),ft=rt.getMinutes(),Et=rt.getSeconds();return ct=ct<10?"0"+ct:ct,ft=ft<10?"0"+ft:ft,Et=Et<10?"0"+Et:Et,"".concat(ct,":").concat(ft,":").concat(Et)}return 0},[Jr]);function Na(){window.sessionStorage.removeItem(yt),Hn(!1),Wn(0)}function Zi(){Hn(!1),Wn(0),Be.setValue(window.sessionStorage.getItem(yt))}return D.a.createElement(I.Fragment,null,D.a.createElement("div",{className:"markdown-editor-wrapper",ref:Kn},D.a.createElement("div",{className:"markdown-editor-container ".concat(wr," ").concat(cr?"on-preview":""," ").concat(Ie?"mini":""," ").concat(rr?"full-screen":""),style:_i},D.a.createElement(c,{insertTemp:Lt,watch:cr,fullScreen:rr,showNullButton:lr,onActionCallback:Gn,hidetoolBar:hr}),D.a.createElement("div",{className:"markdown-editor-body"},D.a.createElement("div",{className:"codemirror-container"},D.a.createElement("textarea",{ref:Qr,placeholder:Cr})),cr?D.a.createElement("div",{ref:Zr,className:"preview-container"},st==="stex"&&D.a.createElement(S,{value:$r}),st!=="stex"&&D.a.createElement(u.a,{value:$r})):null))),Wt?D.a.createElement("a",{ref:kr,className:"editor-resize"}):null,D.a.createElement(l.a,null,Re[Ar]?D.a.createElement(V.a,{centered:!0,title:Re[Ar],visible:!0,onCancel:yr,footer:null},vn):null))}},SJMd:function(ot,We){/**
|
|
* @license
|
|
* Copyright (C) 2006 Google Inc.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/var ee,ne,V,_=!1,G,U;window.PR_SHOULD_USE_CONTINUATION=!0;var R,B;(function(){var I=window,D=["break,continue,do,else,for,if,return,while"],L=[D,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,restrict,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],x=[L,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],A=[x,"alignas,alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,noexcept,noreturn,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],k=[x,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],C=[x,"abstract,add,alias,as,ascending,async,await,base,bool,by,byte,checked,decimal,delegate,descending,dynamic,event,finally,fixed,foreach,from,get,global,group,implicit,in,interface,internal,into,is,join,let,lock,null,object,out,override,orderby,params,partial,readonly,ref,remove,sbyte,sealed,select,set,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,value,var,virtual,where,yield"],E="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes",b=[x,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],d="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",o=[D,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],s=[D,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],u=[D,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],S=[A,C,k,b,d,o,s,u],f=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,m="str",w="kwd",v="com",h="typ",c="lit",l="pun",a="pln",g="tag",p="dec",y="src",M="atn",F="atv",j="nocode",W="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function O(me){for(var we=0,De=!1,Oe=!1,ke=0,Le=me.length;ke<Le;++ke){var _e=me[ke];if(_e.ignoreCase)Oe=!0;else if(/[a-z]/i.test(_e.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){De=!0,Oe=!1;break}}var ze={b:8,t:9,n:10,v:11,f:12,r:13};function Xe($e){var Ae=$e.charCodeAt(0);if(Ae!==92)return Ae;var Ze=$e.charAt(1);return Ae=ze[Ze],Ae||("0"<=Ze&&Ze<="7"?parseInt($e.substring(1),8):Ze==="u"||Ze==="x"?parseInt($e.substring(2),16):$e.charCodeAt(1))}function Ve($e){if($e<32)return($e<16?"\\x0":"\\x")+$e.toString(16);var Ae=String.fromCharCode($e);return Ae==="\\"||Ae==="-"||Ae==="]"||Ae==="^"?"\\"+Ae:Ae}function je($e){var Ae=$e.substring(1,$e.length-1).match(new RegExp("\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]","g")),Ze=[],Je=Ae[0]==="^",Re=["["];Je&&Re.push("^");for(var Fe=Je?1:0,se=Ae.length;Fe<se;++Fe){var le=Ae[Fe];if(/\\[bdsw]/i.test(le))Re.push(le);else{var ue=Xe(le),J;Fe+2<se&&Ae[Fe+1]==="-"?(J=Xe(Ae[Fe+2]),Fe+=2):J=ue,Ze.push([ue,J]),J<65||ue>122||(J<65||ue>90||Ze.push([Math.max(65,ue)|32,Math.min(J,90)|32]),J<97||ue>122||Ze.push([Math.max(97,ue)&~32,Math.min(J,122)&~32]))}}Ze.sort(function(be,Ce){return be[0]-Ce[0]||Ce[1]-be[1]});for(var Q=[],te=[],Fe=0;Fe<Ze.length;++Fe){var ie=Ze[Fe];ie[0]<=te[1]+1?te[1]=Math.max(te[1],ie[1]):Q.push(te=ie)}for(var Fe=0;Fe<Q.length;++Fe){var ie=Q[Fe];Re.push(Ve(ie[0])),ie[1]>ie[0]&&(ie[1]+1>ie[0]&&Re.push("-"),Re.push(Ve(ie[1])))}return Re.push("]"),Re.join("")}function qe($e){for(var Ae=$e.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g")),Ze=Ae.length,Je=[],Re=0,Fe=0;Re<Ze;++Re){var se=Ae[Re];if(se==="(")++Fe;else if(se.charAt(0)==="\\"){var le=+se.substring(1);le&&(le<=Fe?Je[le]=-1:Ae[Re]=Ve(le))}}for(var Re=1;Re<Je.length;++Re)Je[Re]===-1&&(Je[Re]=++we);for(var Re=0,Fe=0;Re<Ze;++Re){var se=Ae[Re];if(se==="(")++Fe,Je[Fe]||(Ae[Re]="(?:");else if(se.charAt(0)==="\\"){var le=+se.substring(1);le&&le<=Fe&&(Ae[Re]="\\"+Je[le])}}for(var Re=0;Re<Ze;++Re)Ae[Re]==="^"&&Ae[Re+1]!=="^"&&(Ae[Re]="");if($e.ignoreCase&&De)for(var Re=0;Re<Ze;++Re){var se=Ae[Re],ue=se.charAt(0);se.length>=2&&ue==="["?Ae[Re]=je(se):ue!=="\\"&&(Ae[Re]=se.replace(/[a-zA-Z]/g,function(te){var ie=te.charCodeAt(0);return"["+String.fromCharCode(ie&~32,ie|32)+"]"}))}return Ae.join("")}for(var He=[],ke=0,Le=me.length;ke<Le;++ke){var _e=me[ke];if(_e.global||_e.multiline)throw new Error(""+_e);He.push("(?:"+qe(_e)+")")}return new RegExp(He.join("|"),Oe?"gi":"g")}function P(me,we){var De=/(?:^|\s)nocode(?:\s|$)/,Oe=[],ke=0,Le=[],_e=0;function ze(Xe){var Ve=Xe.nodeType;if(Ve==1){if(De.test(Xe.className))return;for(var je=Xe.firstChild;je;je=je.nextSibling)ze(je);var qe=Xe.nodeName.toLowerCase();(qe==="br"||qe==="li")&&(Oe[_e]=`
|
|
`,Le[_e<<1]=ke++,Le[_e++<<1|1]=Xe)}else if(Ve==3||Ve==4){var He=Xe.nodeValue;He.length&&(we?He=He.replace(/\r\n?/g,`
|
|
`):He=He.replace(/[ \t\r\n]+/g," "),Oe[_e]=He,Le[_e<<1]=ke,ke+=He.length,Le[_e++<<1|1]=Xe)}}return ze(me),{sourceCode:Oe.join("").replace(/\n$/,""),spans:Le}}function H(me,we,De,Oe,ke){if(!De)return;var Le={sourceNode:me,pre:1,langExtension:null,numberLines:null,sourceCode:De,spans:null,basePos:we,decorations:null};Oe(Le),ke.push.apply(ke,Le.decorations)}var X=/\S/;function q(me){for(var we=void 0,De=me.firstChild;De;De=De.nextSibling){var Oe=De.nodeType;we=Oe===1?we?me:De:Oe===3&&X.test(De.nodeValue)?me:we}return we===me?void 0:we}function re(me,we){var De={},Oe;(function(){for(var _e=me.concat(we),ze=[],Xe={},Ve=0,je=_e.length;Ve<je;++Ve){var qe=_e[Ve],He=qe[3];if(He)for(var $e=He.length;--$e>=0;)De[He.charAt($e)]=qe;var Ae=qe[1],Ze=""+Ae;Xe.hasOwnProperty(Ze)||(ze.push(Ae),Xe[Ze]=null)}ze.push(/[\0-\uffff]/),Oe=O(ze)})();var ke=we.length,Le=function(_e){for(var ze=_e.sourceCode,Xe=_e.basePos,Ve=_e.sourceNode,je=[Xe,a],qe=0,He=ze.match(Oe)||[],$e={},Ae=0,Ze=He.length;Ae<Ze;++Ae){var Je=He[Ae],Re=$e[Je],Fe=void 0,se;if(typeof Re=="string")se=!1;else{var le=De[Je.charAt(0)];if(le)Fe=Je.match(le[1]),Re=le[0];else{for(var ue=0;ue<ke;++ue)if(le=we[ue],Fe=Je.match(le[1]),Fe){Re=le[0];break}Fe||(Re=a)}se=Re.length>=5&&Re.substring(0,5)==="lang-",se&&!(Fe&&typeof Fe[1]=="string")&&(se=!1,Re=y),se||($e[Je]=Re)}var J=qe;if(qe+=Je.length,!se)je.push(Xe+J,Re);else{var Q=Fe[1],te=Je.indexOf(Q),ie=te+Q.length;Fe[2]&&(ie=Je.length-Fe[2].length,te=ie-Q.length);var be=Re.substring(5);H(Ve,Xe+J,Je.substring(0,te),Le,je),H(Ve,Xe+J+te,Q,fe(be,Q),je),H(Ve,Xe+J+ie,Je.substring(ie),Le,je)}}_e.decorations=je};return Le}function Ee(me){var we=[],De=[];me.tripleQuotedStrings?we.push([m,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):me.multiLineStrings?we.push([m,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):we.push([m,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),me.verbatimStrings&&De.push([m,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Oe=me.hashComments;Oe&&(me.cStyleComments?(Oe>1?we.push([v,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):we.push([v,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),De.push([m,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):we.push([v,/^#[^\r\n]*/,null,"#"])),me.cStyleComments&&(De.push([v,/^\/\/[^\r\n]*/,null]),De.push([v,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var ke=me.regexLiterals;if(ke){var Le=ke>1?"":`
|
|
\r`,_e=Le?".":"[\\S\\s]",ze="/(?=[^/*"+Le+"])(?:[^/\\x5B\\x5C"+Le+"]|\\x5C"+_e+"|\\x5B(?:[^\\x5C\\x5D"+Le+"]|\\x5C"+_e+")*(?:\\x5D|$))+/";De.push(["lang-regex",RegExp("^"+W+"("+ze+")")])}var Xe=me.types;Xe&&De.push([h,Xe]);var Ve=(""+me.keywords).replace(/^ | $/g,"");Ve.length&&De.push([w,new RegExp("^(?:"+Ve.replace(/[\s,]+/g,"|")+")\\b"),null]),we.push([a,/^\s+/,null,` \r
|
|
\xA0`]);var je="^.[^\\s\\w.$@'\"`/\\\\]*";return me.regexLiterals&&(je+="(?!s*/)"),De.push([c,/^@[a-z_$][a-z_$@0-9]*/i,null],[h,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[a,/^[a-z_$][a-z_$@0-9]*/i,null],[c,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[a,/^\\[\s\S]?/,null],[l,new RegExp(je),null]),re(we,De)}var he=Ee({keywords:S,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function xe(me,we,De){for(var Oe=/(?:^|\s)nocode(?:\s|$)/,ke=/\r\n?|\n/,Le=me.ownerDocument,_e=Le.createElement("li");me.firstChild;)_e.appendChild(me.firstChild);var ze=[_e];function Xe(Ae){var Ze=Ae.nodeType;if(Ze==1&&!Oe.test(Ae.className))if(Ae.nodeName==="br")Ve(Ae),Ae.parentNode&&Ae.parentNode.removeChild(Ae);else for(var Je=Ae.firstChild;Je;Je=Je.nextSibling)Xe(Je);else if((Ze==3||Ze==4)&&De){var Re=Ae.nodeValue,Fe=Re.match(ke);if(Fe){var se=Re.substring(0,Fe.index);Ae.nodeValue=se;var le=Re.substring(Fe.index+Fe[0].length);if(le){var ue=Ae.parentNode;ue.insertBefore(Le.createTextNode(le),Ae.nextSibling)}Ve(Ae),se||Ae.parentNode.removeChild(Ae)}}}function Ve(Ae){for(;!Ae.nextSibling;)if(Ae=Ae.parentNode,!Ae)return;function Ze(Fe,se){var le=se?Fe.cloneNode(!1):Fe,ue=Fe.parentNode;if(ue){var J=Ze(ue,1),Q=Fe.nextSibling;J.appendChild(le);for(var te=Q;te;te=Q)Q=te.nextSibling,J.appendChild(te)}return le}for(var Je=Ze(Ae.nextSibling,0),Re;(Re=Je.parentNode)&&Re.nodeType===1;)Je=Re;ze.push(Je)}for(var je=0;je<ze.length;++je)Xe(ze[je]);we===(we|0)&&ze[0].setAttribute("value",we);var qe=Le.createElement("ol");qe.className="linenums";for(var He=Math.max(0,we-1|0)||0,je=0,$e=ze.length;je<$e;++je)_e=ze[je],_e.className="L"+(je+He)%10,_e.firstChild||_e.appendChild(Le.createTextNode("\xA0")),qe.appendChild(_e);me.appendChild(qe)}function pe(me){var we=/\bMSIE\s(\d+)/.exec(navigator.userAgent);we=we&&+we[1]<=8;var De=/\n/g,Oe=me.sourceCode,ke=Oe.length,Le=0,_e=me.spans,ze=_e.length,Xe=0,Ve=me.decorations,je=Ve.length,qe=0;Ve[je]=ke;var He,$e;for($e=He=0;$e<je;)Ve[$e]!==Ve[$e+2]?(Ve[He++]=Ve[$e++],Ve[He++]=Ve[$e++]):$e+=2;for(je=He,$e=He=0;$e<je;){for(var Ae=Ve[$e],Ze=Ve[$e+1],Je=$e+2;Je+2<=je&&Ve[Je+1]===Ze;)Je+=2;Ve[He++]=Ae,Ve[He++]=Ze,$e=Je}je=Ve.length=He;var Re=me.sourceNode,Fe="";Re&&(Fe=Re.style.display,Re.style.display="none");try{for(var se=null;Xe<ze;){var le=_e[Xe],ue=_e[Xe+2]||ke,J=Ve[qe+2]||ke,Je=Math.min(ue,J),Q=_e[Xe+1],te;if(Q.nodeType!==1&&(te=Oe.substring(Le,Je))){we&&(te=te.replace(De,"\r")),Q.nodeValue=te;var ie=Q.ownerDocument,be=ie.createElement("span");be.className=Ve[qe+1];var Ce=Q.parentNode;Ce.replaceChild(be,Q),be.appendChild(Q),Le<ue&&(_e[Xe+1]=Q=ie.createTextNode(Oe.substring(Je,ue)),Ce.insertBefore(Q,be.nextSibling))}Le=Je,Le>=ue&&(Xe+=2),Le>=J&&(qe+=2)}}finally{Re&&(Re.style.display=Fe)}}var ve={};function ce(me,we){for(var De=we.length;--De>=0;){var Oe=we[De];ve.hasOwnProperty(Oe)?I.console&&console.warn("cannot override language handler %s",Oe):ve[Oe]=me}}function fe(me,we){return me&&ve.hasOwnProperty(me)||(me=/^\s*</.test(we)?"default-markup":"default-code"),ve[me]}ce(he,["default-code"]),ce(re([],[[a,/^[^<?]+/],[p,/^<!\w[^>]*(?:>|$)/],[v,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[l,/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),ce(re([[a,/^[\s]+/,null,` \r
|
|
`],[F,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[g,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[M,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[l,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]),ce(re([],[[F,/^[\s\S]+/]]),["uq.val"]),ce(Ee({keywords:A,hashComments:!0,cStyleComments:!0,types:f}),["c","cc","cpp","cxx","cyc","m"]),ce(Ee({keywords:"null,true,false"}),["json"]),ce(Ee({keywords:C,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:f}),["cs"]),ce(Ee({keywords:k,cStyleComments:!0}),["java"]),ce(Ee({keywords:u,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),ce(Ee({keywords:o,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),ce(Ee({keywords:d,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),ce(Ee({keywords:s,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),ce(Ee({keywords:b,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),ce(Ee({keywords:E,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),ce(re([],[[m,/^[\s\S]+/]]),["regex"]);function $(me){var we=me.langExtension;try{var De=P(me.sourceNode,me.pre),Oe=De.sourceCode;me.sourceCode=Oe,me.spans=De.spans,me.basePos=0,fe(we,Oe)(me),pe(me)}catch(ke){I.console&&console.log(ke&&ke.stack||ke)}}function ae(me,we,De){var Oe=De||!1,ke=we||null,Le=document.createElement("div");Le.innerHTML="<pre>"+me+"</pre>",Le=Le.firstChild,Oe&&xe(Le,Oe,!0);var _e={langExtension:ke,numberLines:Oe,sourceNode:Le,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return $(_e),Le.innerHTML}function Z(me,we){var De=we||document.body,Oe=De.ownerDocument||document;function ke(le){return De.getElementsByTagName(le)}for(var Le=[ke("pre"),ke("code"),ke("xmp")],_e=[],ze=0;ze<Le.length;++ze)for(var Xe=0,Ve=Le[ze].length;Xe<Ve;++Xe)_e.push(Le[ze][Xe]);Le=null;var je=Date;je.now||(je={now:function(){return+new Date}});var qe=0,He=/\blang(?:uage)?-([\w.]+)(?!\S)/,$e=/\bprettyprint\b/,Ae=/\bprettyprinted\b/,Ze=/pre|xmp/i,Je=/^code$/i,Re=/^(?:pre|code|xmp)$/i,Fe={};function se(){for(var le=I.PR_SHOULD_USE_CONTINUATION?je.now()+250:Infinity;qe<_e.length&&je.now()<le;qe++){for(var ue=_e[qe],J=Fe,Q=ue;Q=Q.previousSibling;){var te=Q.nodeType,ie=(te===7||te===8)&&Q.nodeValue;if(ie?!/^\??prettify\b/.test(ie):te!==3||/\S/.test(Q.nodeValue))break;if(ie){J={},ie.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Wt,pt,Tr){J[pt]=Tr});break}}var be=ue.className;if((J!==Fe||$e.test(be))&&!Ae.test(be)){for(var Ce=!1,Ie=ue.parentNode;Ie;Ie=Ie.parentNode){var tt=Ie.tagName;if(Re.test(tt)&&Ie.className&&$e.test(Ie.className)){Ce=!0;break}}if(!Ce){ue.className+=" prettyprinted";var dt=J.lang;if(!dt){dt=be.match(He);var it;!dt&&(it=q(ue))&&Je.test(it.tagName)&&(dt=it.className.match(He)),dt&&(dt=dt[1])}var Lt;if(Ze.test(ue.tagName))Lt=1;else{var mt=ue.currentStyle,st=Oe.defaultView,It=mt?mt.whiteSpace:st&&st.getComputedStyle?st.getComputedStyle(ue,null).getPropertyValue("white-space"):0;Lt=It&&It.substring(0,3)==="pre"}var yt=J.linenums;(yt=yt==="true"||+yt)||(yt=be.match(/\blinenums\b(?::(\d+))?/),yt=yt?yt[1]&&yt[1].length?+yt[1]:!0:!1),yt&&xe(ue,yt,Lt);var Yt={langExtension:dt,sourceNode:ue,numberLines:yt,pre:Lt,sourceCode:null,basePos:null,spans:null,decorations:null};$(Yt)}}}qe<_e.length?I.setTimeout(se,250):typeof me=="function"&&me()}se()}var ge=I.PR={createSimpleLexer:re,registerLangHandler:ce,sourceDecorator:Ee,PR_ATTRIB_NAME:M,PR_ATTRIB_VALUE:F,PR_COMMENT:v,PR_DECLARATION:p,PR_KEYWORD:w,PR_LITERAL:c,PR_NOCODE:j,PR_PLAIN:a,PR_PUNCTUATION:l,PR_SOURCE:y,PR_STRING:m,PR_TAG:g,PR_TYPE:h,prettyPrintOne:_?I.prettyPrintOne=ae:R=ae,prettyPrint:B=_?I.prettyPrint=Z:B=Z},Se=I.define;typeof Se=="function"&&Se.amd&&Se("google-code-prettify",[],function(){return ge})})()},"VrN/":function(ot,We,ee){(function(ne,V){ot.exports=V()})(this,function(){"use strict";var ne=navigator.userAgent,V=navigator.platform,_=/gecko\/\d/i.test(ne),G=/MSIE \d/.test(ne),U=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ne),R=/Edge\/(\d+)/.exec(ne),B=G||U||R,I=B&&(G?document.documentMode||6:+(R||U)[1]),D=!R&&/WebKit\//.test(ne),L=D&&/Qt\/\d+\.\d+/.test(ne),x=!R&&/Chrome\//.test(ne),A=/Opera\//.test(ne),k=/Apple Computer/.test(navigator.vendor),C=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(ne),E=/PhantomJS/.test(ne),b=!R&&/AppleWebKit/.test(ne)&&/Mobile\/\w+/.test(ne),d=/Android/.test(ne),o=b||d||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(ne),s=b||/Mac/.test(V),u=/\bCrOS\b/.test(ne),S=/win/i.test(V),f=A&&ne.match(/Version\/(\d*\.\d*)/);f&&(f=Number(f[1])),f&&f>=15&&(A=!1,D=!0);var m=s&&(L||A&&(f==null||f<12.11)),w=_||B&&I>=9;function v(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var h=function(e,t){var n=e.className,r=v(t).exec(n);if(r){var i=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(i?r[1]+i:"")}};function c(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function l(e,t){return c(e).appendChild(t)}function a(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),typeof t=="string")i.appendChild(document.createTextNode(t));else if(t)for(var T=0;T<t.length;++T)i.appendChild(t[T]);return i}function g(e,t,n,r){var i=a(e,t,n,r);return i.setAttribute("role","presentation"),i}var p;document.createRange?p=function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:p=function(e,t,n){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch(i){return r}return r.collapse(!0),r.moveEnd("character",n),r.moveStart("character",t),r};function y(e,t){if(t.nodeType==3&&(t=t.parentNode),e.contains)return e.contains(t);do if(t.nodeType==11&&(t=t.host),t==e)return!0;while(t=t.parentNode)}function M(){var e;try{e=document.activeElement}catch(t){e=document.body||null}for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e}function F(e,t){var n=e.className;v(t).test(n)||(e.className+=(n?" ":"")+t)}function j(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!v(n[r]).test(t)&&(t+=" "+n[r]);return t}var W=function(e){e.select()};b?W=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:B&&(W=function(e){try{e.select()}catch(t){}});function O(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function P(e,t,n){t||(t={});for(var r in e)e.hasOwnProperty(r)&&(n!==!1||!t.hasOwnProperty(r))&&(t[r]=e[r]);return t}function H(e,t,n,r,i){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var T=r||0,N=i||0;;){var K=e.indexOf(" ",T);if(K<0||K>=t)return N+(t-T);N+=K-T,N+=n-N%n,T=K+1}}var X=function(){this.id=null,this.f=null,this.time=0,this.handler=O(this.onTimeout,this)};X.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},X.prototype.set=function(e,t){this.f=t;var n=+new Date+e;(!this.id||n<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=n)};function q(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}var re=50,Ee={toString:function(){return"CodeMirror.Pass"}},he={scroll:!1},xe={origin:"*mouse"},pe={origin:"+move"};function ve(e,t,n){for(var r=0,i=0;;){var T=e.indexOf(" ",r);T==-1&&(T=e.length);var N=T-r;if(T==e.length||i+N>=t)return r+Math.min(N,t-i);if(i+=T-r,i+=n-i%n,r=T+1,i>=t)return r}}var ce=[""];function fe(e){for(;ce.length<=e;)ce.push($(ce)+" ");return ce[e]}function $(e){return e[e.length-1]}function ae(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function Z(e,t,n){for(var r=0,i=n(t);r<e.length&&n(e[r])<=i;)r++;e.splice(r,0,t)}function ge(){}function Se(e,t){var n;return Object.create?n=Object.create(e):(ge.prototype=e,n=new ge),t&&P(t,n),n}var me=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function we(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||me.test(e))}function De(e,t){return t?t.source.indexOf("\\w")>-1&&we(e)?!0:t.test(e):we(e)}function Oe(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var ke=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function Le(e){return e.charCodeAt(0)>=768&&ke.test(e)}function _e(e,t,n){for(;(n<0?t>0:t<e.length)&&Le(e.charAt(t));)t+=n;return t}function ze(e,t,n){for(var r=t>n?-1:1;;){if(t==n)return t;var i=(t+n)/2,T=r<0?Math.ceil(i):Math.floor(i);if(T==t)return e(T)?t:n;e(T)?n=T:t=T+r}}function Xe(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var i=!1,T=0;T<e.length;++T){var N=e[T];(N.from<n&&N.to>t||t==n&&N.to==t)&&(r(Math.max(N.from,t),Math.min(N.to,n),N.level==1?"rtl":"ltr",T),i=!0)}i||r(t,n,"ltr")}var Ve=null;function je(e,t,n){var r;Ve=null;for(var i=0;i<e.length;++i){var T=e[i];if(T.from<t&&T.to>t)return i;T.to==t&&(T.from!=T.to&&n=="before"?r=i:Ve=i),T.from==t&&(T.from!=T.to&&n!="before"?r=i:Ve=i)}return r!=null?r:Ve}var qe=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n(Y){return Y<=247?e.charAt(Y):1424<=Y&&Y<=1524?"R":1536<=Y&&Y<=1785?t.charAt(Y-1536):1774<=Y&&Y<=2220?"r":8192<=Y&&Y<=8203?"w":Y==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,T=/[LRr]/,N=/[Lb1n]/,K=/[1n]/;function z(Y,oe,de){this.level=Y,this.from=oe,this.to=de}return function(Y,oe){var de=oe=="ltr"?"L":"R";if(Y.length==0||oe=="ltr"&&!r.test(Y))return!1;for(var Te=Y.length,ye=[],Pe=0;Pe<Te;++Pe)ye.push(n(Y.charCodeAt(Pe)));for(var Me=0,Ne=de;Me<Te;++Me){var Ke=ye[Me];Ke=="m"?ye[Me]=Ne:Ne=Ke}for(var Ye=0,Ge=de;Ye<Te;++Ye){var Qe=ye[Ye];Qe=="1"&&Ge=="r"?ye[Ye]="n":T.test(Qe)&&(Ge=Qe,Qe=="r"&&(ye[Ye]="R"))}for(var at=1,nt=ye[0];at<Te-1;++at){var ht=ye[at];ht=="+"&&nt=="1"&&ye[at+1]=="1"?ye[at]="1":ht==","&&nt==ye[at+1]&&(nt=="1"||nt=="n")&&(ye[at]=nt),nt=ht}for(var Tt=0;Tt<Te;++Tt){var Bt=ye[Tt];if(Bt==",")ye[Tt]="N";else if(Bt=="%"){var Dt=void 0;for(Dt=Tt+1;Dt<Te&&ye[Dt]=="%";++Dt);for(var ir=Tt&&ye[Tt-1]=="!"||Dt<Te&&ye[Dt]=="1"?"1":"N",qt=Tt;qt<Dt;++qt)ye[qt]=ir;Tt=Dt-1}}for(var kt=0,er=de;kt<Te;++kt){var Kt=ye[kt];er=="L"&&Kt=="1"?ye[kt]="L":T.test(Kt)&&(er=Kt)}for(var Ut=0;Ut<Te;++Ut)if(i.test(ye[Ut])){var Mt=void 0;for(Mt=Ut+1;Mt<Te&&i.test(ye[Mt]);++Mt);for(var Ot=(Ut?ye[Ut-1]:de)=="L",tr=(Mt<Te?ye[Mt]:de)=="L",In=Ot==tr?Ot?"L":"R":de,Gr=Ut;Gr<Mt;++Gr)ye[Gr]=In;Ut=Mt-1}for(var Xt=[],xr,jt=0;jt<Te;)if(N.test(ye[jt])){var Ia=jt;for(++jt;jt<Te&&N.test(ye[jt]);++jt);Xt.push(new z(0,Ia,jt))}else{var Or=jt,un=Xt.length,dn=oe=="rtl"?1:0;for(++jt;jt<Te&&ye[jt]!="L";++jt);for(var Jt=Or;Jt<jt;)if(K.test(ye[Jt])){Or<Jt&&(Xt.splice(un,0,new z(1,Or,Jt)),un+=dn);var Un=Jt;for(++Jt;Jt<jt&&K.test(ye[Jt]);++Jt);Xt.splice(un,0,new z(2,Un,Jt)),un+=dn,Or=Jt}else++Jt;Or<jt&&Xt.splice(un,0,new z(1,Or,jt))}return oe=="ltr"&&(Xt[0].level==1&&(xr=Y.match(/^\s+/))&&(Xt[0].from=xr[0].length,Xt.unshift(new z(0,0,xr[0].length))),$(Xt).level==1&&(xr=Y.match(/\s+$/))&&($(Xt).to-=xr[0].length,Xt.push(new z(0,Te-xr[0].length,Te)))),oe=="rtl"?Xt.reverse():Xt}}();function He(e,t){var n=e.order;return n==null&&(n=e.order=qe(e.text,t)),n}var $e=[],Ae=function(e,t,n){if(e.addEventListener)e.addEventListener(t,n,!1);else if(e.attachEvent)e.attachEvent("on"+t,n);else{var r=e._handlers||(e._handlers={});r[t]=(r[t]||$e).concat(n)}};function Ze(e,t){return e._handlers&&e._handlers[t]||$e}function Je(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,!1);else if(e.detachEvent)e.detachEvent("on"+t,n);else{var r=e._handlers,i=r&&r[t];if(i){var T=q(i,n);T>-1&&(r[t]=i.slice(0,T).concat(i.slice(T+1)))}}}function Re(e,t){var n=Ze(e,t);if(!n.length)return;for(var r=Array.prototype.slice.call(arguments,2),i=0;i<n.length;++i)n[i].apply(null,r)}function Fe(e,t,n){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Re(e,n||t.type,e,t),te(t)||t.codemirrorIgnore}function se(e){var t=e._handlers&&e._handlers.cursorActivity;if(!t)return;for(var n=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),r=0;r<t.length;++r)q(n,t[r])==-1&&n.push(t[r])}function le(e,t){return Ze(e,t).length>0}function ue(e){e.prototype.on=function(t,n){Ae(this,t,n)},e.prototype.off=function(t,n){Je(this,t,n)}}function J(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Q(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function te(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function ie(e){J(e),Q(e)}function be(e){return e.target||e.srcElement}function Ce(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),s&&e.ctrlKey&&t==1&&(t=3),t}var Ie=function(){if(B&&I<9)return!1;var e=a("div");return"draggable"in e||"dragDrop"in e}(),tt;function dt(e){if(tt==null){var t=a("span","\u200B");l(e,a("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(tt=t.offsetWidth<=1&&t.offsetHeight>2&&!(B&&I<8))}var n=tt?a("span","\u200B"):a("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var it;function Lt(e){if(it!=null)return it;var t=l(e,document.createTextNode("A\u062EA")),n=p(t,0,1).getBoundingClientRect(),r=p(t,1,2).getBoundingClientRect();return c(e),!n||n.left==n.right?!1:it=r.right-n.right<3}var mt=`
|
|
|
|
b`.split(/\n/).length!=3?function(e){for(var t=0,n=[],r=e.length;t<=r;){var i=e.indexOf(`
|
|
`,t);i==-1&&(i=e.length);var T=e.slice(t,e.charAt(i-1)=="\r"?i-1:i),N=T.indexOf("\r");N!=-1?(n.push(T.slice(0,N)),t+=N+1):(n.push(T),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},st=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(n){}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},It=function(){var e=a("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),yt=null;function Yt(e){if(yt!=null)return yt;var t=l(e,a("span","x")),n=t.getBoundingClientRect(),r=p(t,0,1).getBoundingClientRect();return yt=Math.abs(n.left-r.left)>1}var Wt={},pt={};function Tr(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Wt[e]=t}function zr(e,t){pt[e]=t}function lr(e){if(typeof e=="string"&&pt.hasOwnProperty(e))e=pt[e];else if(e&&typeof e.name=="string"&&pt.hasOwnProperty(e.name)){var t=pt[e.name];typeof t=="string"&&(t={name:t}),e=Se(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return lr("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return lr("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function Sr(e,t){t=lr(t);var n=Wt[t.name];if(!n)return Sr(e,"text/plain");var r=n(e,t);if(hr.hasOwnProperty(t.name)){var i=hr[t.name];for(var T in i){if(!i.hasOwnProperty(T))continue;r.hasOwnProperty(T)&&(r["_"+T]=r[T]),r[T]=i[T]}}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var N in t.modeProps)r[N]=t.modeProps[N];return r}var hr={};function yi(e,t){var n=hr.hasOwnProperty(e)?hr[e]:hr[e]={};P(t,n)}function ur(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var i=t[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n}function Vr(e,t){for(var n;e.innerMode&&!(n=e.innerMode(t),!n||n.mode==e);)t=n.state,e=n.mode;return n||{mode:e,state:t}}function cn(e,t,n){return e.startState?e.startState(t,n):!0}var Ct=function(e,t,n){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n};Ct.prototype.eol=function(){return this.pos>=this.string.length},Ct.prototype.sol=function(){return this.pos==this.lineStart},Ct.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Ct.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Ct.prototype.eat=function(e){var t=this.string.charAt(this.pos),n;if(typeof e=="string"?n=t==e:n=t&&(e.test?e.test(t):e(t)),n)return++this.pos,t},Ct.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Ct.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Ct.prototype.skipToEnd=function(){this.pos=this.string.length},Ct.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Ct.prototype.backUp=function(e){this.pos-=e},Ct.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=H(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?H(this.string,this.lineStart,this.tabSize):0)},Ct.prototype.indentation=function(){return H(this.string,null,this.tabSize)-(this.lineStart?H(this.string,this.lineStart,this.tabSize):0)},Ct.prototype.match=function(e,t,n){if(typeof e=="string"){var r=function(N){return n?N.toLowerCase():N},i=this.string.substr(this.pos,e.length);if(r(i)==r(e))return t!==!1&&(this.pos+=e.length),!0}else{var T=this.string.slice(this.pos).match(e);return T&&T.index>0?null:(T&&t!==!1&&(this.pos+=T[0].length),T)}},Ct.prototype.current=function(){return this.string.slice(this.start,this.pos)},Ct.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Ct.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Ct.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function et(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var n=e;!n.lines;)for(var r=0;;++r){var i=n.children[r],T=i.chunkSize();if(t<T){n=i;break}t-=T}return n.lines[t]}function wr(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,function(T){var N=T.text;i==n.line&&(N=N.slice(0,n.ch)),i==t.line&&(N=N.slice(t.ch)),r.push(N),++i}),r}function fn(e,t,n){var r=[];return e.iter(t,n,function(i){r.push(i.text)}),r}function dr(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function gt(e){if(e.parent==null)return null;for(var t=e.parent,n=q(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var i=0;!(r.children[i]==t);++i)n+=r.children[i].chunkSize();return n+t.first}function Cr(e,t){var n=e.first;e:do{for(var r=0;r<e.children.length;++r){var i=e.children[r],T=i.height;if(t<T){e=i;continue e}t-=T,n+=i.chunkSize()}return n}while(!e.lines);for(var N=0;N<e.lines.length;++N){var K=e.lines[N],z=K.height;if(t<z)break;t-=z}return n+N}function Rr(e,t){return t>=e.first&&t<e.first+e.size}function Xr(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function Ue(e,t,n){if(n===void 0&&(n=null),!(this instanceof Ue))return new Ue(e,t,n);this.line=e,this.ch=t,this.sticky=n}function ut(e,t){return e.line-t.line||e.ch-t.ch}function Be(e,t){return e.sticky==t.sticky&&ut(e,t)==0}function Fn(e){return Ue(e.line,e.ch)}function hn(e,t){return ut(e,t)<0?t:e}function Yr(e,t){return ut(e,t)<0?e:t}function $r(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function lt(e,t){if(t.line<e.first)return Ue(e.first,0);var n=e.first+e.size-1;return t.line>n?Ue(n,et(e,n).text.length):Qi(t,et(e,t.line).text.length)}function Qi(e,t){var n=e.ch;return n==null||n>t?Ue(e.line,t):n<0?Ue(e.line,0):e}function Nn(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=lt(e,t[r]);return n}var cr=function(e,t){this.state=e,this.lookAhead=t},ar=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};ar.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},ar.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},ar.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},ar.fromSaved=function(e,t,n){return t instanceof cr?new ar(e,ur(e.mode,t.state),n,t.lookAhead):new ar(e,ur(e.mode,t),n)},ar.prototype.save=function(e){var t=e!==!1?ur(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new cr(t,this.maxLookAhead):t};function bi(e,t,n,r){var i=[e.state.modeGen],T={};jn(e,t.text,e.doc.mode,n,function(Y,oe){return i.push(Y,oe)},T,r);for(var N=n.state,K=function(Y){n.baseTokens=i;var oe=e.state.overlays[Y],de=1,Te=0;n.state=!0,jn(e,t.text,oe.mode,n,function(ye,Pe){for(var Me=de;Te<ye;){var Ne=i[de];Ne>ye&&i.splice(de,1,ye,i[de+1],Ne),de+=2,Te=Math.min(ye,Ne)}if(!Pe)return;if(oe.opaque)i.splice(Me,de-Me,ye,"overlay "+Pe),de=Me+2;else for(;Me<de;Me+=2){var Ke=i[Me+1];i[Me+1]=(Ke?Ke+" ":"")+"overlay "+Pe}},T),n.state=N,n.baseTokens=null,n.baseTokenPos=1},z=0;z<e.state.overlays.length;++z)K(z);return{styles:i,classes:T.bgClass||T.textClass?T:null}}function Bn(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=rr(e,gt(t)),i=t.text.length>e.options.maxHighlightLength&&ur(e.doc.mode,r.state),T=bi(e,t,r);i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=T.styles,T.classes?t.styleClasses=T.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function rr(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new ar(r,!0,t);var T=Jr(e,t,n),N=T>r.first&&et(r,T-1).stateAfter,K=N?ar.fromSaved(r,N,T):new ar(r,cn(r.mode),T);return r.iter(T,t,function(z){mn(e,z.text,K);var Y=K.line;z.stateAfter=Y==t-1||Y%5==0||Y>=i.viewFrom&&Y<i.viewTo?K.save():null,K.nextLine()}),n&&(r.modeFrontier=K.line),K}function mn(e,t,n,r){var i=e.doc.mode,T=new Ct(t,e.options.tabSize,n);for(T.start=T.pos=r||0,t==""&&Ei(i,n.state);!T.eol();)pn(i,T,n.state),T.start=T.pos}function Ei(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var n=Vr(e,t);if(n.mode.blankLine)return n.mode.blankLine(n.state)}function pn(e,t,n,r){for(var i=0;i<10;i++){r&&(r[0]=Vr(e,n).mode);var T=e.token(t,n);if(t.pos>t.start)return T}throw new Error("Mode "+e.name+" failed to advance stream.")}var Ar=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function _r(e,t,n,r){var i=e.doc,T=i.mode,N;t=lt(i,t);var K=et(i,t.line),z=rr(e,t.line,n),Y=new Ct(K.text,e.options.tabSize,z),oe;for(r&&(oe=[]);(r||Y.pos<t.ch)&&!Y.eol();)Y.start=Y.pos,N=pn(T,Y,z.state),r&&oe.push(new Ar(Y,N,ur(i.mode,z.state)));return r?oe:new Ar(Y,N,z.state)}function xi(e,t){if(e)for(;;){var n=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!n)break;e=e.slice(0,n.index)+e.slice(n.index+n[0].length);var r=n[1]?"bgClass":"textClass";t[r]==null?t[r]=n[2]:new RegExp("(?:^|\\s)"+n[2]+"(?:$|\\s)").test(t[r])||(t[r]+=" "+n[2])}return e}function jn(e,t,n,r,i,T,N){var K=n.flattenSpans;K==null&&(K=e.options.flattenSpans);var z=0,Y=null,oe=new Ct(t,e.options.tabSize,r),de,Te=e.options.addModeClass&&[null];for(t==""&&xi(Ei(n,r.state),T);!oe.eol();){if(oe.pos>e.options.maxHighlightLength?(K=!1,N&&mn(e,t,r,oe.pos),oe.pos=t.length,de=null):de=xi(pn(n,oe,r.state,Te),T),Te){var ye=Te[0].name;ye&&(de="m-"+(de?ye+" "+de:ye))}if(!K||Y!=de){for(;z<oe.start;)z=Math.min(oe.start,z+5e3),i(z,Y);Y=de}oe.start=oe.pos}for(;z<oe.pos;){var Pe=Math.min(oe.pos,z+5e3);i(Pe,Y),z=Pe}}function Jr(e,t,n){for(var r,i,T=e.doc,N=n?-1:t-(e.doc.mode.innerMode?1e3:100),K=t;K>N;--K){if(K<=T.first)return T.first;var z=et(T,K-1),Y=z.stateAfter;if(Y&&(!n||K+(Y instanceof cr?Y.lookAhead:0)<=T.modeFrontier))return K;var oe=H(z.text,null,e.options.tabSize);(i==null||r>oe)&&(i=K-1,r=oe)}return i}function Wn(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),e.highlightFrontier<t-10)return;for(var n=e.first,r=t-1;r>n;r--){var i=et(e,r).stateAfter;if(i&&(!(i instanceof cr)||r+i.lookAhead<t)){n=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}var Ti=!1,fr=!1;function Si(){Ti=!0}function wi(){fr=!0}function gn(e,t,n){this.marker=e,this.from=t,this.to=n}function Pr(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function Fa(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n||(n=[])).push(e[r]);return n}function Hn(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function Qr(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var T=e[i],N=T.marker,K=T.from==null||(N.inclusiveLeft?T.from<=t:T.from<t);if(K||T.from==t&&N.type=="bookmark"&&(!n||!T.marker.insertLeft)){var z=T.to==null||(N.inclusiveRight?T.to>=t:T.to>t);(r||(r=[])).push(new gn(N,T.from,z?null:T.to))}}return r}function Kn(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var T=e[i],N=T.marker,K=T.to==null||(N.inclusiveRight?T.to>=t:T.to>t);if(K||T.from==t&&N.type=="bookmark"&&(!n||T.marker.insertLeft)){var z=T.from==null||(N.inclusiveLeft?T.from<=t:T.from<t);(r||(r=[])).push(new gn(N,z?null:T.from-t,T.to==null?null:T.to-t))}}return r}function kr(e,t){if(t.full)return null;var n=Rr(e,t.from.line)&&et(e,t.from.line).markedSpans,r=Rr(e,t.to.line)&&et(e,t.to.line).markedSpans;if(!n&&!r)return null;var i=t.from.ch,T=t.to.ch,N=ut(t.from,t.to)==0,K=Qr(n,i,N),z=Kn(r,T,N),Y=t.text.length==1,oe=$(t.text).length+(Y?i:0);if(K)for(var de=0;de<K.length;++de){var Te=K[de];if(Te.to==null){var ye=Pr(z,Te.marker);ye?Y&&(Te.to=ye.to==null?null:ye.to+oe):Te.to=i}}if(z)for(var Pe=0;Pe<z.length;++Pe){var Me=z[Pe];if(Me.to!=null&&(Me.to+=oe),Me.from==null){var Ne=Pr(K,Me.marker);Ne||(Me.from=oe,Y&&(K||(K=[])).push(Me))}else Me.from+=oe,Y&&(K||(K=[])).push(Me)}K&&(K=Zr(K)),z&&z!=K&&(z=Zr(z));var Ke=[K];if(!Y){var Ye=t.text.length-2,Ge;if(Ye>0&&K)for(var Qe=0;Qe<K.length;++Qe)K[Qe].to==null&&(Ge||(Ge=[])).push(new gn(K[Qe].marker,null,null));for(var at=0;at<Ye;++at)Ke.push(Ge);Ke.push(z)}return Ke}function Zr(e){for(var t=0;t<e.length;++t){var n=e[t];n.from!=null&&n.from==n.to&&n.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function Ci(e,t,n){var r=null;if(e.iter(t.line,n.line+1,function(ye){if(ye.markedSpans)for(var Pe=0;Pe<ye.markedSpans.length;++Pe){var Me=ye.markedSpans[Pe].marker;Me.readOnly&&(!r||q(r,Me)==-1)&&(r||(r=[])).push(Me)}}),!r)return null;for(var i=[{from:t,to:n}],T=0;T<r.length;++T)for(var N=r[T],K=N.find(0),z=0;z<i.length;++z){var Y=i[z];if(ut(Y.to,K.from)<0||ut(Y.from,K.to)>0)continue;var oe=[z,1],de=ut(Y.from,K.from),Te=ut(Y.to,K.to);(de<0||!N.inclusiveLeft&&!de)&&oe.push({from:Y.from,to:K.from}),(Te>0||!N.inclusiveRight&&!Te)&&oe.push({from:K.to,to:Y.to}),i.splice.apply(i,oe),z+=oe.length-3}return i}function Gn(e){var t=e.markedSpans;if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.detachLine(e);e.markedSpans=null}function qr(e,t){if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}function vn(e){return e.inclusiveLeft?-1:0}function yr(e){return e.inclusiveRight?1:0}function zn(e,t){var n=e.lines.length-t.lines.length;if(n!=0)return n;var r=e.find(),i=t.find(),T=ut(r.from,i.from)||vn(e)-vn(t);if(T)return-T;var N=ut(r.to,i.to)||yr(e)-yr(t);return N||t.id-e.id}function Ai(e,t){var n=fr&&e.markedSpans,r;if(n)for(var i=void 0,T=0;T<n.length;++T)i=n[T],i.marker.collapsed&&(t?i.from:i.to)==null&&(!r||zn(r,i.marker)<0)&&(r=i.marker);return r}function _i(e){return Ai(e,!0)}function Vn(e){return Ai(e,!1)}function Na(e,t){var n=fr&&e.markedSpans,r;if(n)for(var i=0;i<n.length;++i){var T=n[i];T.marker.collapsed&&(T.from==null||T.from<t)&&(T.to==null||T.to>t)&&(!r||zn(r,T.marker)<0)&&(r=T.marker)}return r}function Zi(e,t,n,r,i){var T=et(e,t),N=fr&&T.markedSpans;if(N)for(var K=0;K<N.length;++K){var z=N[K];if(!z.marker.collapsed)continue;var Y=z.marker.find(0),oe=ut(Y.from,n)||vn(z.marker)-vn(i),de=ut(Y.to,r)||yr(z.marker)-yr(i);if(oe>=0&&de<=0||oe<=0&&de>=0)continue;if(oe<=0&&(z.marker.inclusiveRight&&i.inclusiveLeft?ut(Y.to,n)>=0:ut(Y.to,n)>0)||oe>=0&&(z.marker.inclusiveRight&&i.inclusiveLeft?ut(Y.from,r)<=0:ut(Y.from,r)<0))return!0}}function rt(e){for(var t;t=_i(e);)e=t.find(-1,!0).line;return e}function ct(e){for(var t;t=Vn(e);)e=t.find(1,!0).line;return e}function ft(e){for(var t,n;t=Vn(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function Et(e,t){var n=et(e,t),r=rt(n);return n==r?t:gt(r)}function xt(e,t){if(t>e.lastLine())return t;var n=et(e,t),r;if(!St(e,n))return t;for(;r=Vn(n);)n=r.find(1,!0).line;return gt(n)+1}function St(e,t){var n=fr&&t.markedSpans;if(n)for(var r=void 0,i=0;i<n.length;++i){if(r=n[i],!r.marker.collapsed)continue;if(r.from==null)return!0;if(r.marker.widgetNode)continue;if(r.from==0&&r.marker.inclusiveLeft&&Rt(e,t,r))return!0}}function Rt(e,t,n){if(n.to==null){var r=n.marker.find(1,!0);return Rt(e,r.line,Pr(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var i=void 0,T=0;T<t.markedSpans.length;++T)if(i=t.markedSpans[T],i.marker.collapsed&&!i.marker.widgetNode&&i.from==n.to&&(i.to==null||i.to!=n.from)&&(i.marker.inclusiveLeft||n.marker.inclusiveRight)&&Rt(e,t,i))return!0}function At(e){e=rt(e);for(var t=0,n=e.parent,r=0;r<n.lines.length;++r){var i=n.lines[r];if(i==e)break;t+=i.height}for(var T=n.parent;T;n=T,T=n.parent)for(var N=0;N<T.children.length;++N){var K=T.children[N];if(K==n)break;t+=K.height}return t}function Gt(e){if(e.height==0)return 0;for(var t=e.text.length,n,r=e;n=_i(r);){var i=n.find(0,!0);r=i.from.line,t+=i.from.ch-i.to.ch}for(r=e;n=Vn(r);){var T=n.find(0,!0);t-=r.text.length-T.from.ch,r=T.to.line,t+=r.text.length-T.to.ch}return t}function mr(e){var t=e.display,n=e.doc;t.maxLine=et(n,n.first),t.maxLineLength=Gt(t.maxLine),t.maxLineChanged=!0,n.iter(function(r){var i=Gt(r);i>t.maxLineLength&&(t.maxLineLength=i,t.maxLine=r)})}var wt=function(e,t,n){this.text=e,qr(this,t),this.height=n?n(this):1};wt.prototype.lineNo=function(){return gt(this)},ue(wt);function Mr(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),Gn(e),qr(e,n);var i=r?r(e):1;i!=e.height&&dr(e,i)}function zt(e){e.parent=null,Gn(e)}var Ir={},Ur={};function yn(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?Ur:Ir;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Ba(e,t){var n=g("span",null,null,D?"padding-right: .1px":null),r={pre:g("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var T=i?t.rest[i-1]:t.line,N=void 0;r.pos=0,r.addToken=Cs,Lt(e.display.measure)&&(N=He(T,e.doc.direction))&&(r.addToken=_s(r.addToken,N)),r.map=[];var K=t!=e.display.externalMeasured&>(T);Ls(T,r,Bn(e,T,K)),T.styleClasses&&(T.styleClasses.bgClass&&(r.bgClass=j(T.styleClasses.bgClass,r.bgClass||"")),T.styleClasses.textClass&&(r.textClass=j(T.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(dt(e.display.measure))),i==0?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(D){var z=r.content.lastChild;(/\bcm-tab\b/.test(z.className)||z.querySelector&&z.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return Re(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=j(r.pre.className,r.textClass||"")),r}function ws(e){var t=a("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Cs(e,t,n,r,i,T,N){if(!t)return;var K=e.splitSpaces?As(t,e.trailingSpace):t,z=e.cm.state.specialChars,Y=!1,oe;if(!z.test(t))e.col+=t.length,oe=document.createTextNode(K),e.map.push(e.pos,e.pos+t.length,oe),B&&I<9&&(Y=!0),e.pos+=t.length;else{oe=document.createDocumentFragment();for(var de=0;;){z.lastIndex=de;var Te=z.exec(t),ye=Te?Te.index-de:t.length-de;if(ye){var Pe=document.createTextNode(K.slice(de,de+ye));B&&I<9?oe.appendChild(a("span",[Pe])):oe.appendChild(Pe),e.map.push(e.pos,e.pos+ye,Pe),e.col+=ye,e.pos+=ye}if(!Te)break;de+=ye+1;var Me=void 0;if(Te[0]==" "){var Ne=e.cm.options.tabSize,Ke=Ne-e.col%Ne;Me=oe.appendChild(a("span",fe(Ke),"cm-tab")),Me.setAttribute("role","presentation"),Me.setAttribute("cm-text"," "),e.col+=Ke}else Te[0]=="\r"||Te[0]==`
|
|
`?(Me=oe.appendChild(a("span",Te[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Me.setAttribute("cm-text",Te[0]),e.col+=1):(Me=e.cm.options.specialCharPlaceholder(Te[0]),Me.setAttribute("cm-text",Te[0]),B&&I<9?oe.appendChild(a("span",[Me])):oe.appendChild(Me),e.col+=1);e.map.push(e.pos,e.pos+1,Me),e.pos++}}if(e.trailingSpace=K.charCodeAt(t.length-1)==32,n||r||i||Y||T||N){var Ye=n||"";r&&(Ye+=r),i&&(Ye+=i);var Ge=a("span",[oe],Ye,T);if(N)for(var Qe in N)N.hasOwnProperty(Qe)&&Qe!="style"&&Qe!="class"&&Ge.setAttribute(Qe,N[Qe]);return e.content.appendChild(Ge)}e.content.appendChild(oe)}function As(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",i=0;i<e.length;i++){var T=e.charAt(i);T==" "&&n&&(i==e.length-1||e.charCodeAt(i+1)==32)&&(T="\xA0"),r+=T,n=T==" "}return r}function _s(e,t){return function(n,r,i,T,N,K,z){i=i?i+" cm-force-border":"cm-force-border";for(var Y=n.pos,oe=Y+r.length;;){for(var de=void 0,Te=0;Te<t.length&&!(de=t[Te],de.to>Y&&de.from<=Y);Te++);if(de.to>=oe)return e(n,r,i,T,N,K,z);e(n,r.slice(0,de.to-Y),i,T,null,K,z),T=null,r=r.slice(de.to-Y),Y=de.to}}}function ja(e,t,n,r){var i=!r&&n.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!r&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",n.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function Ls(e,t,n){var r=e.markedSpans,i=e.text,T=0;if(!r){for(var N=1;N<n.length;N+=2)t.addToken(t,i.slice(T,T=n[N]),yn(n[N+1],t.cm.options));return}for(var K=i.length,z=0,Y=1,oe="",de,Te,ye=0,Pe,Me,Ne,Ke,Ye;;){if(ye==z){Pe=Me=Ne=Te="",Ye=null,Ke=null,ye=Infinity;for(var Ge=[],Qe=void 0,at=0;at<r.length;++at){var nt=r[at],ht=nt.marker;if(ht.type=="bookmark"&&nt.from==z&&ht.widgetNode)Ge.push(ht);else if(nt.from<=z&&(nt.to==null||nt.to>z||ht.collapsed&&nt.to==z&&nt.from==z)){if(nt.to!=null&&nt.to!=z&&ye>nt.to&&(ye=nt.to,Me=""),ht.className&&(Pe+=" "+ht.className),ht.css&&(Te=(Te?Te+";":"")+ht.css),ht.startStyle&&nt.from==z&&(Ne+=" "+ht.startStyle),ht.endStyle&&nt.to==ye&&(Qe||(Qe=[])).push(ht.endStyle,nt.to),ht.title&&((Ye||(Ye={})).title=ht.title),ht.attributes)for(var Tt in ht.attributes)(Ye||(Ye={}))[Tt]=ht.attributes[Tt];ht.collapsed&&(!Ke||zn(Ke.marker,ht)<0)&&(Ke=nt)}else nt.from>z&&ye>nt.from&&(ye=nt.from)}if(Qe)for(var Bt=0;Bt<Qe.length;Bt+=2)Qe[Bt+1]==ye&&(Me+=" "+Qe[Bt]);if(!Ke||Ke.from==z)for(var Dt=0;Dt<Ge.length;++Dt)ja(t,0,Ge[Dt]);if(Ke&&(Ke.from||0)==z){if(ja(t,(Ke.to==null?K+1:Ke.to)-z,Ke.marker,Ke.from==null),Ke.to==null)return;Ke.to==z&&(Ke=!1)}}if(z>=K)break;for(var ir=Math.min(K,ye);;){if(oe){var qt=z+oe.length;if(!Ke){var kt=qt>ir?oe.slice(0,ir-z):oe;t.addToken(t,kt,de?de+Pe:Pe,Ne,z+kt.length==ye?Me:"",Te,Ye)}if(qt>=ir){oe=oe.slice(ir-z),z=ir;break}z=qt,Ne=""}oe=i.slice(T,T=n[Y++]),de=yn(n[Y++],t.cm.options)}}}function Wa(e,t,n){this.line=t,this.rest=ft(t),this.size=this.rest?gt($(this.rest))-n+1:1,this.node=this.text=null,this.hidden=St(e,t)}function Li(e,t,n){for(var r=[],i,T=t;T<n;T=i){var N=new Wa(e.doc,et(e.doc,T),T);i=T+N.size,r.push(N)}return r}var bn=null;function Ds(e){bn?bn.ops.push(e):e.ownsGroup=bn={ops:[e],delayedCallbacks:[]}}function Os(e){var t=e.delayedCallbacks,n=0;do{for(;n<t.length;n++)t[n].call(null);for(var r=0;r<e.ops.length;r++){var i=e.ops[r];if(i.cursorActivityHandlers)for(;i.cursorActivityCalled<i.cursorActivityHandlers.length;)i.cursorActivityHandlers[i.cursorActivityCalled++].call(null,i.cm)}}while(n<t.length)}function Rs(e,t){var n=e.ownsGroup;if(!n)return;try{Os(n)}finally{bn=null,t(n)}}var Xn=null;function Ht(e,t){var n=Ze(e,t);if(!n.length)return;var r=Array.prototype.slice.call(arguments,2),i;bn?i=bn.delayedCallbacks:Xn?i=Xn:(i=Xn=[],setTimeout(Ps,0));for(var T=function(K){i.push(function(){return n[K].apply(null,r)})},N=0;N<n.length;++N)T(N)}function Ps(){var e=Xn;Xn=null;for(var t=0;t<e.length;++t)e[t]()}function Ha(e,t,n,r){for(var i=0;i<t.changes.length;i++){var T=t.changes[i];T=="text"?Ms(e,t):T=="gutter"?Ga(e,t,n,r):T=="class"?qi(e,t):T=="widget"&&Is(e,t,r)}t.changes=null}function Yn(e){return e.node==e.text&&(e.node=a("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),B&&I<8&&(e.node.style.zIndex=2)),e.node}function ks(e,t){var n=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(n&&(n+=" CodeMirror-linebackground"),t.background)n?t.background.className=n:(t.background.parentNode.removeChild(t.background),t.background=null);else if(n){var r=Yn(t);t.background=r.insertBefore(a("div",null,n),r.firstChild),e.display.input.setUneditable(t.background)}}function Ka(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):Ba(e,t)}function Ms(e,t){var n=t.text.className,r=Ka(e,t);t.text==t.node&&(t.node=r.pre),t.text.parentNode.replaceChild(r.pre,t.text),t.text=r.pre,r.bgClass!=t.bgClass||r.textClass!=t.textClass?(t.bgClass=r.bgClass,t.textClass=r.textClass,qi(e,t)):n&&(t.text.className=n)}function qi(e,t){ks(e,t),t.line.wrapClass?Yn(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var n=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=n||""}function Ga(e,t,n,r){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var i=Yn(t);t.gutterBackground=a("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),i.insertBefore(t.gutterBackground,t.text)}var T=t.line.gutterMarkers;if(e.options.lineNumbers||T){var N=Yn(t),K=t.gutter=a("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(K),N.insertBefore(K,t.text),t.line.gutterClass&&(K.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!T||!T["CodeMirror-linenumbers"])&&(t.lineNumber=K.appendChild(a("div",Xr(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),T)for(var z=0;z<e.display.gutterSpecs.length;++z){var Y=e.display.gutterSpecs[z].className,oe=T.hasOwnProperty(Y)&&T[Y];oe&&K.appendChild(a("div",[oe],"CodeMirror-gutter-elt","left: "+r.gutterLeft[Y]+"px; width: "+r.gutterWidth[Y]+"px"))}}}function Is(e,t,n){t.alignable&&(t.alignable=null);for(var r=v("CodeMirror-linewidget"),i=t.node.firstChild,T=void 0;i;i=T)T=i.nextSibling,r.test(i.className)&&t.node.removeChild(i);za(e,t,n)}function Us(e,t,n,r){var i=Ka(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),qi(e,t),Ga(e,t,n,r),za(e,t,r),t.node}function za(e,t,n){if(Va(e,t.line,t,n,!0),t.rest)for(var r=0;r<t.rest.length;r++)Va(e,t.rest[r],t,n,!1)}function Va(e,t,n,r,i){if(!t.widgets)return;for(var T=Yn(n),N=0,K=t.widgets;N<K.length;++N){var z=K[N],Y=a("div",[z.node],"CodeMirror-linewidget"+(z.className?" "+z.className:""));z.handleMouseEvents||Y.setAttribute("cm-ignore-events","true"),Fs(z,Y,n,r),e.display.input.setUneditable(Y),i&&z.above?T.insertBefore(Y,n.gutter||n.text):T.appendChild(Y),Ht(z,"redraw")}}function Fs(e,t,n,r){if(e.noHScroll){(n.alignable||(n.alignable=[])).push(t);var i=r.wrapperWidth;t.style.left=r.fixedPos+"px",e.coverGutter||(i-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function $n(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!y(document.body,e.node)){var n="position: relative;";e.coverGutter&&(n+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(n+="width: "+t.display.wrapper.clientWidth+"px;"),l(t.display.measure,a("div",[e.node],null,n))}return e.height=e.node.parentNode.offsetHeight}function Lr(e,t){for(var n=be(t);n!=e.wrapper;n=n.parentNode)if(!n||n.nodeType==1&&n.getAttribute("cm-ignore-events")=="true"||n.parentNode==e.sizer&&n!=e.mover)return!0}function Di(e){return e.lineSpace.offsetTop}function ea(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function Xa(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=l(e.measure,a("pre","x","CodeMirror-line-like")),n=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r={left:parseInt(n.paddingLeft),right:parseInt(n.paddingRight)};return!isNaN(r.left)&&!isNaN(r.right)&&(e.cachedPaddingH=r),r}function br(e){return re-e.display.nativeBarWidth}function en(e){return e.display.scroller.clientWidth-br(e)-e.display.barWidth}function ta(e){return e.display.scroller.clientHeight-br(e)-e.display.barHeight}function Ns(e,t,n){var r=e.options.lineWrapping,i=r&&en(e);if(!t.measure.heights||r&&t.measure.width!=i){var T=t.measure.heights=[];if(r){t.measure.width=i;for(var N=t.text.firstChild.getClientRects(),K=0;K<N.length-1;K++){var z=N[K],Y=N[K+1];Math.abs(z.bottom-Y.bottom)>2&&T.push((z.bottom+Y.top)/2-n.top)}}T.push(n.bottom-n.top)}}function Ya(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var r=0;r<e.rest.length;r++)if(e.rest[r]==t)return{map:e.measure.maps[r],cache:e.measure.caches[r]};for(var i=0;i<e.rest.length;i++)if(gt(e.rest[i])>n)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Bs(e,t){t=rt(t);var n=gt(t),r=e.display.externalMeasured=new Wa(e.doc,t,n);r.lineN=n;var i=r.built=Ba(e,r);return r.text=i.pre,l(e.display.lineMeasure,i.pre),r}function $a(e,t,n,r){return Er(e,En(e,t),n,r)}function ra(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[nn(e,t)];var n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size)return n}function En(e,t){var n=gt(t),r=ra(e,n);r&&!r.text?r=null:r&&r.changes&&(Ha(e,r,n,la(e)),e.curOp.forceUpdate=!0),r||(r=Bs(e,t));var i=Ya(r,t,n);return{line:t,view:r,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function Er(e,t,n,r,i){t.before&&(n=-1);var T=n+(r||""),N;return t.cache.hasOwnProperty(T)?N=t.cache[T]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Ns(e,t.view,t.rect),t.hasHeights=!0),N=Ws(e,t,n,r),N.bogus||(t.cache[T]=N)),{left:N.left,right:N.right,top:i?N.rtop:N.top,bottom:i?N.rbottom:N.bottom}}var Ja={left:0,right:0,top:0,bottom:0};function Qa(e,t,n){for(var r,i,T,N,K,z,Y=0;Y<e.length;Y+=3)if(K=e[Y],z=e[Y+1],t<K?(i=0,T=1,N="left"):t<z?(i=t-K,T=i+1):(Y==e.length-3||t==z&&e[Y+3]>t)&&(T=z-K,i=T-1,t>=z&&(N="right")),i!=null){if(r=e[Y+2],K==z&&n==(r.insertLeft?"left":"right")&&(N=n),n=="left"&&i==0)for(;Y&&e[Y-2]==e[Y-3]&&e[Y-1].insertLeft;)r=e[(Y-=3)+2],N="left";if(n=="right"&&i==z-K)for(;Y<e.length-3&&e[Y+3]==e[Y+4]&&!e[Y+5].insertLeft;)r=e[(Y+=3)+2],N="right";break}return{node:r,start:i,end:T,collapse:N,coverStart:K,coverEnd:z}}function js(e,t){var n=Ja;if(t=="left")for(var r=0;r<e.length&&!((n=e[r]).left!=n.right);r++);else for(var i=e.length-1;i>=0&&!((n=e[i]).left!=n.right);i--);return n}function Ws(e,t,n,r){var i=Qa(t.map,n,r),T=i.node,N=i.start,K=i.end,z=i.collapse,Y;if(T.nodeType==3){for(var oe=0;oe<4;oe++){for(;N&&Le(t.line.text.charAt(i.coverStart+N));)--N;for(;i.coverStart+K<i.coverEnd&&Le(t.line.text.charAt(i.coverStart+K));)++K;if(B&&I<9&&N==0&&K==i.coverEnd-i.coverStart?Y=T.parentNode.getBoundingClientRect():Y=js(p(T,N,K).getClientRects(),r),Y.left||Y.right||N==0)break;K=N,N=N-1,z="right"}B&&I<11&&(Y=Hs(e.display.measure,Y))}else{N>0&&(z=r="right");var de;e.options.lineWrapping&&(de=T.getClientRects()).length>1?Y=de[r=="right"?de.length-1:0]:Y=T.getBoundingClientRect()}if(B&&I<9&&!N&&(!Y||!Y.left&&!Y.right)){var Te=T.parentNode.getClientRects()[0];Te?Y={left:Te.left,right:Te.left+Tn(e.display),top:Te.top,bottom:Te.bottom}:Y=Ja}for(var ye=Y.top-t.rect.top,Pe=Y.bottom-t.rect.top,Me=(ye+Pe)/2,Ne=t.view.measure.heights,Ke=0;Ke<Ne.length-1&&!(Me<Ne[Ke]);Ke++);var Ye=Ke?Ne[Ke-1]:0,Ge=Ne[Ke],Qe={left:(z=="right"?Y.right:Y.left)-t.rect.left,right:(z=="left"?Y.left:Y.right)-t.rect.left,top:Ye,bottom:Ge};return!Y.left&&!Y.right&&(Qe.bogus=!0),e.options.singleCursorHeightPerLine||(Qe.rtop=ye,Qe.rbottom=Pe),Qe}function Hs(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!Yt(e))return t;var n=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*n,right:t.right*n,top:t.top*r,bottom:t.bottom*r}}function Za(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function qa(e){e.display.externalMeasure=null,c(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)Za(e.display.view[t])}function Jn(e){qa(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function eo(){return x&&d?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function to(){return x&&d?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function na(e){var t=0;if(e.widgets)for(var n=0;n<e.widgets.length;++n)e.widgets[n].above&&(t+=$n(e.widgets[n]));return t}function Oi(e,t,n,r,i){if(!i){var T=na(t);n.top+=T,n.bottom+=T}if(r=="line")return n;r||(r="local");var N=At(t);if(r=="local"?N+=Di(e.display):N-=e.display.viewOffset,r=="page"||r=="window"){var K=e.display.lineSpace.getBoundingClientRect();N+=K.top+(r=="window"?0:to());var z=K.left+(r=="window"?0:eo());n.left+=z,n.right+=z}return n.top+=N,n.bottom+=N,n}function ro(e,t,n){if(n=="div")return t;var r=t.left,i=t.top;if(n=="page")r-=eo(),i-=to();else if(n=="local"||!n){var T=e.display.sizer.getBoundingClientRect();r+=T.left,i+=T.top}var N=e.display.lineSpace.getBoundingClientRect();return{left:r-N.left,top:i-N.top}}function ia(e,t,n,r,i){return r||(r=et(e.doc,t.line)),Oi(e,r,$a(e,r,t.ch,i),n)}function pr(e,t,n,r,i,T){r=r||et(e.doc,t.line),i||(i=En(e,r));function N(Pe,Me){var Ne=Er(e,i,Pe,Me?"right":"left",T);return Me?Ne.left=Ne.right:Ne.right=Ne.left,Oi(e,r,Ne,n)}var K=He(r,e.doc.direction),z=t.ch,Y=t.sticky;if(z>=r.text.length?(z=r.text.length,Y="before"):z<=0&&(z=0,Y="after"),!K)return N(Y=="before"?z-1:z,Y=="before");function oe(Pe,Me,Ne){var Ke=K[Me],Ye=Ke.level==1;return N(Ne?Pe-1:Pe,Ye!=Ne)}var de=je(K,z,Y),Te=Ve,ye=oe(z,de,Y=="before");return Te!=null&&(ye.other=oe(z,Te,Y!="before")),ye}function no(e,t){var n=0;t=lt(e.doc,t),e.options.lineWrapping||(n=Tn(e.display)*t.ch);var r=et(e.doc,t.line),i=At(r)+Di(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function aa(e,t,n,r,i){var T=Ue(e,t,n);return T.xRel=i,r&&(T.outside=r),T}function oa(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return aa(r.first,0,null,-1,-1);var i=Cr(r,n),T=r.first+r.size-1;if(i>T)return aa(r.first+r.size-1,et(r,T).text.length,null,1,1);t<0&&(t=0);for(var N=et(r,i);;){var K=Ks(e,N,i,t,n),z=Na(N,K.ch+(K.xRel>0||K.outside>0?1:0));if(!z)return K;var Y=z.find(1);if(Y.line==i)return Y;N=et(r,i=Y.line)}}function io(e,t,n,r){r-=na(t);var i=t.text.length,T=ze(function(N){return Er(e,n,N-1).bottom<=r},i,0);return i=ze(function(N){return Er(e,n,N).top>r},T,i),{begin:T,end:i}}function ao(e,t,n,r){n||(n=En(e,t));var i=Oi(e,t,Er(e,n,r),"line").top;return io(e,t,n,i)}function sa(e,t,n,r){return e.bottom<=n?!1:e.top>n?!0:(r?e.left:e.right)>t}function Ks(e,t,n,r,i){i-=At(t);var T=En(e,t),N=na(t),K=0,z=t.text.length,Y=!0,oe=He(t,e.doc.direction);if(oe){var de=(e.options.lineWrapping?zs:Gs)(e,t,n,T,oe,r,i);Y=de.level!=1,K=Y?de.from:de.to-1,z=Y?de.to:de.from-1}var Te=null,ye=null,Pe=ze(function(at){var nt=Er(e,T,at);return nt.top+=N,nt.bottom+=N,sa(nt,r,i,!1)?(nt.top<=i&&nt.left<=r&&(Te=at,ye=nt),!0):!1},K,z),Me,Ne,Ke=!1;if(ye){var Ye=r-ye.left<ye.right-r,Ge=Ye==Y;Pe=Te+(Ge?0:1),Ne=Ge?"after":"before",Me=Ye?ye.left:ye.right}else{!Y&&(Pe==z||Pe==K)&&Pe++,Ne=Pe==0?"after":Pe==t.text.length?"before":Er(e,T,Pe-(Y?1:0)).bottom+N<=i==Y?"after":"before";var Qe=pr(e,Ue(n,Pe,Ne),"line",t,T);Me=Qe.left,Ke=i<Qe.top?-1:i>=Qe.bottom?1:0}return Pe=_e(t.text,Pe,1),aa(n,Pe,Ne,Ke,r-Me)}function Gs(e,t,n,r,i,T,N){var K=ze(function(de){var Te=i[de],ye=Te.level!=1;return sa(pr(e,Ue(n,ye?Te.to:Te.from,ye?"before":"after"),"line",t,r),T,N,!0)},0,i.length-1),z=i[K];if(K>0){var Y=z.level!=1,oe=pr(e,Ue(n,Y?z.from:z.to,Y?"after":"before"),"line",t,r);sa(oe,T,N,!0)&&oe.top>N&&(z=i[K-1])}return z}function zs(e,t,n,r,i,T,N){var K=io(e,t,r,N),z=K.begin,Y=K.end;/\s/.test(t.text.charAt(Y-1))&&Y--;for(var oe=null,de=null,Te=0;Te<i.length;Te++){var ye=i[Te];if(ye.from>=Y||ye.to<=z)continue;var Pe=ye.level!=1,Me=Er(e,r,Pe?Math.min(Y,ye.to)-1:Math.max(z,ye.from)).right,Ne=Me<T?T-Me+1e9:Me-T;(!oe||de>Ne)&&(oe=ye,de=Ne)}return oe||(oe=i[i.length-1]),oe.from<z&&(oe={from:z,to:oe.to,level:oe.level}),oe.to>Y&&(oe={from:oe.from,to:Y,level:oe.level}),oe}var tn;function xn(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(tn==null){tn=a("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)tn.appendChild(document.createTextNode("x")),tn.appendChild(a("br"));tn.appendChild(document.createTextNode("x"))}l(e.measure,tn);var n=tn.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),c(e.measure),n||1}function Tn(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=a("span","xxxxxxxxxx"),n=a("pre",[t],"CodeMirror-line-like");l(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function la(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,T=t.gutters.firstChild,N=0;T;T=T.nextSibling,++N){var K=e.display.gutterSpecs[N].className;n[K]=T.offsetLeft+T.clientLeft+i,r[K]=T.clientWidth}return{fixedPos:ua(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function ua(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function oo(e){var t=xn(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/Tn(e.display)-3);return function(i){if(St(e.doc,i))return 0;var T=0;if(i.widgets)for(var N=0;N<i.widgets.length;N++)i.widgets[N].height&&(T+=i.widgets[N].height);return n?T+(Math.ceil(i.text.length/r)||1)*t:T+t}}function da(e){var t=e.doc,n=oo(e);t.iter(function(r){var i=n(r);i!=r.height&&dr(r,i)})}function rn(e,t,n,r){var i=e.display;if(!n&&be(t).getAttribute("cm-not-content")=="true")return null;var T,N,K=i.lineSpace.getBoundingClientRect();try{T=t.clientX-K.left,N=t.clientY-K.top}catch(de){return null}var z=oa(e,T,N),Y;if(r&&z.xRel>0&&(Y=et(e.doc,z.line).text).length==z.ch){var oe=H(Y,Y.length,e.options.tabSize)-Y.length;z=Ue(z.line,Math.max(0,Math.round((T-Xa(e.display).left)/Tn(e.display))-oe))}return z}function nn(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var n=e.display.view,r=0;r<n.length;r++)if(t-=n[r].size,t<0)return r}function Qt(e,t,n,r){t==null&&(t=e.doc.first),n==null&&(n=e.doc.first+e.doc.size),r||(r=0);var i=e.display;if(r&&n<i.viewTo&&(i.updateLineNumbers==null||i.updateLineNumbers>t)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)fr&&Et(e.doc,t)<i.viewTo&&Nr(e);else if(n<=i.viewFrom)fr&&xt(e.doc,n+r)>i.viewFrom?Nr(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)Nr(e);else if(t<=i.viewFrom){var T=Ri(e,n,n+r,1);T?(i.view=i.view.slice(T.index),i.viewFrom=T.lineN,i.viewTo+=r):Nr(e)}else if(n>=i.viewTo){var N=Ri(e,t,t,-1);N?(i.view=i.view.slice(0,N.index),i.viewTo=N.lineN):Nr(e)}else{var K=Ri(e,t,t,-1),z=Ri(e,n,n+r,1);K&&z?(i.view=i.view.slice(0,K.index).concat(Li(e,K.lineN,z.lineN)).concat(i.view.slice(z.index)),i.viewTo+=r):Nr(e)}var Y=i.externalMeasured;Y&&(n<Y.lineN?Y.lineN+=r:t<Y.lineN+Y.size&&(i.externalMeasured=null))}function Fr(e,t,n){e.curOp.viewChanged=!0;var r=e.display,i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size&&(r.externalMeasured=null),t<r.viewFrom||t>=r.viewTo)return;var T=r.view[nn(e,t)];if(T.node==null)return;var N=T.changes||(T.changes=[]);q(N,n)==-1&&N.push(n)}function Nr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Ri(e,t,n,r){var i=nn(e,t),T,N=e.display.view;if(!fr||n==e.doc.first+e.doc.size)return{index:i,lineN:n};for(var K=e.display.viewFrom,z=0;z<i;z++)K+=N[z].size;if(K!=t){if(r>0){if(i==N.length-1)return null;T=K+N[i].size-t,i++}else T=K-t;t+=T,n+=T}for(;Et(e.doc,n)!=n;){if(i==(r<0?0:N.length-1))return null;n+=r*N[i-(r<0?1:0)].size,i+=r}return{index:i,lineN:n}}function Vs(e,t,n){var r=e.display,i=r.view;i.length==0||t>=r.viewTo||n<=r.viewFrom?(r.view=Li(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=Li(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(nn(e,t))),r.viewFrom=t,r.viewTo<n?r.view=r.view.concat(Li(e,r.viewTo,n)):r.viewTo>n&&(r.view=r.view.slice(0,nn(e,n)))),r.viewTo=n}function so(e){for(var t=e.display.view,n=0,r=0;r<t.length;r++){var i=t[r];!i.hidden&&(!i.node||i.changes)&&++n}return n}function Qn(e){e.display.input.showSelection(e.display.input.prepareSelection())}function lo(e,t){t===void 0&&(t=!0);for(var n=e.doc,r={},i=r.cursors=document.createDocumentFragment(),T=r.selection=document.createDocumentFragment(),N=0;N<n.sel.ranges.length;N++){if(!t&&N==n.sel.primIndex)continue;var K=n.sel.ranges[N];if(K.from().line>=e.display.viewTo||K.to().line<e.display.viewFrom)continue;var z=K.empty();(z||e.options.showCursorWhenSelecting)&&uo(e,K.head,i),z||Xs(e,K,T)}return r}function uo(e,t,n){var r=pr(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),i=n.appendChild(a("div","\xA0","CodeMirror-cursor"));if(i.style.left=r.left+"px",i.style.top=r.top+"px",i.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px",r.other){var T=n.appendChild(a("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));T.style.display="",T.style.left=r.other.left+"px",T.style.top=r.other.top+"px",T.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function Pi(e,t){return e.top-t.top||e.left-t.left}function Xs(e,t,n){var r=e.display,i=e.doc,T=document.createDocumentFragment(),N=Xa(e.display),K=N.left,z=Math.max(r.sizerWidth,en(e)-r.sizer.offsetLeft)-N.right,Y=i.direction=="ltr";function oe(Ge,Qe,at,nt){Qe<0&&(Qe=0),Qe=Math.round(Qe),nt=Math.round(nt),T.appendChild(a("div",null,"CodeMirror-selected","position: absolute; left: "+Ge+`px;
|
|
top: `+Qe+"px; width: "+(at==null?z-Ge:at)+`px;
|
|
height: `+(nt-Qe)+"px"))}function de(Ge,Qe,at){var nt=et(i,Ge),ht=nt.text.length,Tt,Bt;function Dt(kt,er){return ia(e,Ue(Ge,kt),"div",nt,er)}function ir(kt,er,Kt){var Ut=ao(e,nt,null,kt),Mt=er=="ltr"==(Kt=="after")?"left":"right",Ot=Kt=="after"?Ut.begin:Ut.end-(/\s/.test(nt.text.charAt(Ut.end-1))?2:1);return Dt(Ot,Mt)[Mt]}var qt=He(nt,i.direction);return Xe(qt,Qe||0,at==null?ht:at,function(kt,er,Kt,Ut){var Mt=Kt=="ltr",Ot=Dt(kt,Mt?"left":"right"),tr=Dt(er-1,Mt?"right":"left"),In=Qe==null&&kt==0,Gr=at==null&&er==ht,Xt=Ut==0,xr=!qt||Ut==qt.length-1;if(tr.top-Ot.top<=3){var jt=(Y?In:Gr)&&Xt,Ia=(Y?Gr:In)&&xr,Or=jt?K:(Mt?Ot:tr).left,un=Ia?z:(Mt?tr:Ot).right;oe(Or,Ot.top,un-Or,Ot.bottom)}else{var dn,Jt,Un,Ua;Mt?(dn=Y&&In&&Xt?K:Ot.left,Jt=Y?z:ir(kt,Kt,"before"),Un=Y?K:ir(er,Kt,"after"),Ua=Y&&Gr&&xr?z:tr.right):(dn=Y?ir(kt,Kt,"before"):K,Jt=!Y&&In&&Xt?z:Ot.right,Un=!Y&&Gr&&xr?K:tr.left,Ua=Y?ir(er,Kt,"after"):z),oe(dn,Ot.top,Jt-dn,Ot.bottom),Ot.bottom<tr.top&&oe(K,Ot.bottom,null,tr.top),oe(Un,tr.top,Ua-Un,tr.bottom)}(!Tt||Pi(Ot,Tt)<0)&&(Tt=Ot),Pi(tr,Tt)<0&&(Tt=tr),(!Bt||Pi(Ot,Bt)<0)&&(Bt=Ot),Pi(tr,Bt)<0&&(Bt=tr)}),{start:Tt,end:Bt}}var Te=t.from(),ye=t.to();if(Te.line==ye.line)de(Te.line,Te.ch,ye.ch);else{var Pe=et(i,Te.line),Me=et(i,ye.line),Ne=rt(Pe)==rt(Me),Ke=de(Te.line,Te.ch,Ne?Pe.text.length+1:null).end,Ye=de(ye.line,Ne?0:null,ye.ch).start;Ne&&(Ke.top<Ye.top-2?(oe(Ke.right,Ke.top,null,Ke.bottom),oe(K,Ye.top,Ye.left,Ye.bottom)):oe(Ke.right,Ke.top,Ye.left-Ke.right,Ke.bottom)),Ke.bottom<Ye.top&&oe(K,Ke.bottom,null,Ye.top)}n.appendChild(T)}function ca(e){if(!e.state.focused)return;var t=e.display;clearInterval(t.blinker);var n=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){e.hasFocus()||Sn(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function co(e){e.state.focused||(e.display.input.focus(),fa(e))}function fo(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Sn(e))},100)}function fa(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(Re(e,"focus",e,t),e.state.focused=!0,F(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),D&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),ca(e)}function Sn(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(Re(e,"blur",e,t),e.state.focused=!1,h(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function ki(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var i=t.view[r],T=e.options.lineWrapping,N=void 0,K=0;if(i.hidden)continue;if(B&&I<8){var z=i.node.offsetTop+i.node.offsetHeight;N=z-n,n=z}else{var Y=i.node.getBoundingClientRect();N=Y.bottom-Y.top,!T&&i.text.firstChild&&(K=i.text.firstChild.getBoundingClientRect().right-Y.left-1)}var oe=i.line.height-N;if((oe>.005||oe<-.005)&&(dr(i.line,N),ho(i.line),i.rest))for(var de=0;de<i.rest.length;de++)ho(i.rest[de]);if(K>e.display.sizerWidth){var Te=Math.ceil(K/Tn(e.display));Te>e.display.maxLineLength&&(e.display.maxLineLength=Te,e.display.maxLine=i.line,e.display.maxLineChanged=!0)}}}function ho(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var n=e.widgets[t],r=n.node.parentNode;r&&(n.height=r.offsetHeight)}}function Mi(e,t,n){var r=n&&n.top!=null?Math.max(0,n.top):e.scroller.scrollTop;r=Math.floor(r-Di(e));var i=n&&n.bottom!=null?n.bottom:r+e.wrapper.clientHeight,T=Cr(t,r),N=Cr(t,i);if(n&&n.ensure){var K=n.ensure.from.line,z=n.ensure.to.line;K<T?(T=K,N=Cr(t,At(et(t,K))+e.wrapper.clientHeight)):Math.min(z,t.lastLine())>=N&&(T=Cr(t,At(et(t,z))-e.wrapper.clientHeight),N=z)}return{from:T,to:Math.max(N,T+1)}}function Ys(e,t){if(Fe(e,"scrollCursorIntoView"))return;var n=e.display,r=n.sizer.getBoundingClientRect(),i=null;if(t.top+r.top<0?i=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),i!=null&&!E){var T=a("div","\u200B",null,`position: absolute;
|
|
top: `+(t.top-n.viewOffset-Di(e.display))+`px;
|
|
height: `+(t.bottom-t.top+br(e)+n.barHeight)+`px;
|
|
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(T),T.scrollIntoView(i),e.display.lineSpace.removeChild(T)}}function $s(e,t,n,r){r==null&&(r=0);var i;!e.options.lineWrapping&&t==n&&(t=t.ch?Ue(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,n=t.sticky=="before"?Ue(t.line,t.ch+1,"before"):t);for(var T=0;T<5;T++){var N=!1,K=pr(e,t),z=!n||n==t?K:pr(e,n);i={left:Math.min(K.left,z.left),top:Math.min(K.top,z.top)-r,right:Math.max(K.left,z.left),bottom:Math.max(K.bottom,z.bottom)+r};var Y=ha(e,i),oe=e.doc.scrollTop,de=e.doc.scrollLeft;if(Y.scrollTop!=null&&(qn(e,Y.scrollTop),Math.abs(e.doc.scrollTop-oe)>1&&(N=!0)),Y.scrollLeft!=null&&(an(e,Y.scrollLeft),Math.abs(e.doc.scrollLeft-de)>1&&(N=!0)),!N)break}return i}function Js(e,t){var n=ha(e,t);n.scrollTop!=null&&qn(e,n.scrollTop),n.scrollLeft!=null&&an(e,n.scrollLeft)}function ha(e,t){var n=e.display,r=xn(e.display);t.top<0&&(t.top=0);var i=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop,T=ta(e),N={};t.bottom-t.top>T&&(t.bottom=t.top+T);var K=e.doc.height+ea(n),z=t.top<r,Y=t.bottom>K-r;if(t.top<i)N.scrollTop=z?0:t.top;else if(t.bottom>i+T){var oe=Math.min(t.top,(Y?K:t.bottom)-T);oe!=i&&(N.scrollTop=oe)}var de=e.options.fixedGutter?0:n.gutters.offsetWidth,Te=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-de,ye=en(e)-n.gutters.offsetWidth,Pe=t.right-t.left>ye;return Pe&&(t.right=t.left+ye),t.left<10?N.scrollLeft=0:t.left<Te?N.scrollLeft=Math.max(0,t.left+de-(Pe?0:10)):t.right>ye+Te-3&&(N.scrollLeft=t.right+(Pe?0:10)-ye),N}function ma(e,t){if(t==null)return;Ii(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function wn(e){Ii(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Zn(e,t,n){(t!=null||n!=null)&&Ii(e),t!=null&&(e.curOp.scrollLeft=t),n!=null&&(e.curOp.scrollTop=n)}function Qs(e,t){Ii(e),e.curOp.scrollToPos=t}function Ii(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=no(e,t.from),r=no(e,t.to);mo(e,n,r,t.margin)}}function mo(e,t,n,r){var i=ha(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-r,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+r});Zn(e,i.scrollLeft,i.scrollTop)}function qn(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;_||ga(e,{top:t}),po(e,t,!0),_&&ga(e),ri(e,100)}function po(e,t,n){if(t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),e.display.scroller.scrollTop==t&&!n)return;e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t)}function an(e,t,n,r){if(t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r)return;e.doc.scrollLeft=t,Eo(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function ei(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+ea(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:r,scrollHeight:r+br(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var on=function(e,t,n){this.cm=n;var r=this.vert=a("div",[a("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=a("div",[a("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=i.tabIndex=-1,e(r),e(i),Ae(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),Ae(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,B&&I<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};on.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var i=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var T=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+T)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(r==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?r:0,bottom:t?r:0}},on.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},on.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},on.prototype.zeroWidthHack=function(){var e=s&&!C?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new X,this.disableVert=new X},on.prototype.enableZeroWidthBar=function(e,t,n){e.style.pointerEvents="auto";function r(){var i=e.getBoundingClientRect(),T=n=="vert"?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1);T!=e?e.style.pointerEvents="none":t.set(1e3,r)}t.set(1e3,r)},on.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var ti=function(){};ti.prototype.update=function(){return{bottom:0,right:0}},ti.prototype.setScrollLeft=function(){},ti.prototype.setScrollTop=function(){},ti.prototype.clear=function(){};function Cn(e,t){t||(t=ei(e));var n=e.display.barWidth,r=e.display.barHeight;go(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&ki(e),go(e,ei(e)),n=e.display.barWidth,r=e.display.barHeight}function go(e,t){var n=e.display,r=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",n.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}var vo={native:on,null:ti};function yo(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&h(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new vo[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Ae(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,n){n=="horizontal"?an(e,t):qn(e,t)},e),e.display.scrollbars.addClass&&F(e.display.wrapper,e.display.scrollbars.addClass)}var Zs=0;function sn(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Zs},Ds(e.curOp)}function ln(e){var t=e.curOp;t&&Rs(t,function(n){for(var r=0;r<n.ops.length;r++)n.ops[r].cm.curOp=null;qs(n)})}function qs(e){for(var t=e.ops,n=0;n<t.length;n++)el(t[n]);for(var r=0;r<t.length;r++)tl(t[r]);for(var i=0;i<t.length;i++)rl(t[i]);for(var T=0;T<t.length;T++)nl(t[T]);for(var N=0;N<t.length;N++)il(t[N])}function el(e){var t=e.cm,n=t.display;ol(t),e.updateMaxLine&&mr(t),e.mustUpdate=e.viewChanged||e.forceUpdate||e.scrollTop!=null||e.scrollToPos&&(e.scrollToPos.from.line<n.viewFrom||e.scrollToPos.to.line>=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new Ui(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&pa(e.cm,e.update)}function rl(e){var t=e.cm,n=t.display;e.updatedDisplay&&ki(t),e.barMeasure=ei(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=$a(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+br(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-en(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function nl(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&an(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var n=e.focus&&e.focus==M();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,n),(e.updatedDisplay||e.startHeight!=t.doc.height)&&Cn(t,e.barMeasure),e.updatedDisplay&&ya(t,e.barMeasure),e.selectionChanged&&ca(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),n&&co(e.cm)}function il(e){var t=e.cm,n=t.display,r=t.doc;if(e.updatedDisplay&&bo(t,e.update),n.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(n.wheelStartX=n.wheelStartY=null),e.scrollTop!=null&&po(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&an(t,e.scrollLeft,!0,!0),e.scrollToPos){var i=$s(t,lt(r,e.scrollToPos.from),lt(r,e.scrollToPos.to),e.scrollToPos.margin);Ys(t,i)}var T=e.maybeHiddenMarkers,N=e.maybeUnhiddenMarkers;if(T)for(var K=0;K<T.length;++K)T[K].lines.length||Re(T[K],"hide");if(N)for(var z=0;z<N.length;++z)N[z].lines.length&&Re(N[z],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Re(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function nr(e,t){if(e.curOp)return t();sn(e);try{return t()}finally{ln(e)}}function Ft(e,t){return function(){if(e.curOp)return t.apply(e,arguments);sn(e);try{return t.apply(e,arguments)}finally{ln(e)}}}function $t(e){return function(){if(this.curOp)return e.apply(this,arguments);sn(this);try{return e.apply(this,arguments)}finally{ln(this)}}}function Nt(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);sn(t);try{return e.apply(this,arguments)}finally{ln(t)}}}function ri(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,O(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var n=+new Date+e.options.workTime,r=rr(e,t.highlightFrontier),i=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(T){if(r.line>=e.display.viewFrom){var N=T.styles,K=T.text.length>e.options.maxHighlightLength?ur(t.mode,r.state):null,z=bi(e,T,r,!0);K&&(r.state=K),T.styles=z.styles;var Y=T.styleClasses,oe=z.classes;oe?T.styleClasses=oe:Y&&(T.styleClasses=null);for(var de=!N||N.length!=T.styles.length||Y!=oe&&(!Y||!oe||Y.bgClass!=oe.bgClass||Y.textClass!=oe.textClass),Te=0;!de&&Te<N.length;++Te)de=N[Te]!=T.styles[Te];de&&i.push(r.line),T.stateAfter=r.save(),r.nextLine()}else T.text.length<=e.options.maxHighlightLength&&mn(e,T.text,r),T.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>n)return ri(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&nr(e,function(){for(var T=0;T<i.length;T++)Fr(e,i[T],"text")})}var Ui=function(e,t,n){var r=e.display;this.viewport=t,this.visible=Mi(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=en(e),this.force=n,this.dims=la(e),this.events=[]};Ui.prototype.signal=function(e,t){le(e,t)&&this.events.push(arguments)},Ui.prototype.finish=function(){for(var e=0;e<this.events.length;e++)Re.apply(null,this.events[e])};function ol(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=br(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=br(e)+"px",t.scrollbarsClipped=!0)}function sl(e){if(e.hasFocus())return null;var t=M();if(!t||!y(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&y(e.display.lineDiv,r.anchorNode)&&(n.anchorNode=r.anchorNode,n.anchorOffset=r.anchorOffset,n.focusNode=r.focusNode,n.focusOffset=r.focusOffset)}return n}function ll(e){if(!e||!e.activeElt||e.activeElt==M())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&y(document.body,e.anchorNode)&&y(document.body,e.focusNode)){var t=window.getSelection(),n=document.createRange();n.setEnd(e.anchorNode,e.anchorOffset),n.collapse(!1),t.removeAllRanges(),t.addRange(n),t.extend(e.focusNode,e.focusOffset)}}function pa(e,t){var n=e.display,r=e.doc;if(t.editorIsHidden)return Nr(e),!1;if(!t.force&&t.visible.from>=n.viewFrom&&t.visible.to<=n.viewTo&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&so(e)==0)return!1;xo(e)&&(Nr(e),t.dims=la(e));var i=r.first+r.size,T=Math.max(t.visible.from-e.options.viewportMargin,r.first),N=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFrom<T&&T-n.viewFrom<20&&(T=Math.max(r.first,n.viewFrom)),n.viewTo>N&&n.viewTo-N<20&&(N=Math.min(i,n.viewTo)),fr&&(T=Et(e.doc,T),N=xt(e.doc,N));var K=T!=n.viewFrom||N!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Vs(e,T,N),n.viewOffset=At(et(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var z=so(e);if(!K&&z==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var Y=sl(e);return z>4&&(n.lineDiv.style.display="none"),ul(e,n.updateLineNumbers,t.dims),z>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,ll(Y),c(n.cursorDiv),c(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,K&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,ri(e,400)),n.updateLineNumbers=null,!0}function bo(e,t){for(var n=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==en(e)){if(n&&n.top!=null&&(n={top:Math.min(e.doc.height+ea(e.display)-ta(e),n.top)}),t.visible=Mi(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=Mi(e.display,e.doc,n));if(!pa(e,t))break;ki(e);var i=ei(e);Qn(e),Cn(e,i),ya(e,i),t.force=!1}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function ga(e,t){var n=new Ui(e,t);if(pa(e,n)){ki(e),bo(e,n);var r=ei(e);Qn(e),Cn(e,r),ya(e,r),n.finish()}}function ul(e,t,n){var r=e.display,i=e.options.lineNumbers,T=r.lineDiv,N=T.firstChild;function K(Pe){var Me=Pe.nextSibling;return D&&s&&e.display.currentWheelTarget==Pe?Pe.style.display="none":Pe.parentNode.removeChild(Pe),Me}for(var z=r.view,Y=r.viewFrom,oe=0;oe<z.length;oe++){var de=z[oe];if(!de.hidden)if(!de.node||de.node.parentNode!=T){var Te=Us(e,de,Y,n);T.insertBefore(Te,N)}else{for(;N!=de.node;)N=K(N);var ye=i&&t!=null&&t<=Y&&de.lineNumber;de.changes&&(q(de.changes,"gutter")>-1&&(ye=!1),Ha(e,de,Y,n)),ye&&(c(de.lineNumber),de.lineNumber.appendChild(document.createTextNode(Xr(e.options,Y)))),N=de.node.nextSibling}Y+=de.size}for(;N;)N=K(N)}function va(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function ya(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+br(e)+"px"}function Eo(e){var t=e.display,n=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var r=ua(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,T=r+"px",N=0;N<n.length;N++)if(!n[N].hidden){e.options.fixedGutter&&(n[N].gutter&&(n[N].gutter.style.left=T),n[N].gutterBackground&&(n[N].gutterBackground.style.left=T));var K=n[N].alignable;if(K)for(var z=0;z<K.length;z++)K[z].style.left=T}e.options.fixedGutter&&(t.gutters.style.left=r+i+"px")}function xo(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=Xr(e.options,t.first+t.size-1),r=e.display;if(n.length!=r.lineNumChars){var i=r.measure.appendChild(a("div",[a("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),T=i.firstChild.offsetWidth,N=i.offsetWidth-T;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(T,r.lineGutter.offsetWidth-N)+1,r.lineNumWidth=r.lineNumInnerWidth+N,r.lineNumChars=r.lineNumInnerWidth?n.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",va(e.display),!0}return!1}function ba(e,t){for(var n=[],r=!1,i=0;i<e.length;i++){var T=e[i],N=null;if(typeof T!="string"&&(N=T.style,T=T.className),T=="CodeMirror-linenumbers")if(t)r=!0;else continue;n.push({className:T,style:N})}return t&&!r&&n.push({className:"CodeMirror-linenumbers",style:null}),n}function To(e){var t=e.gutters,n=e.gutterSpecs;c(t),e.lineGutter=null;for(var r=0;r<n.length;++r){var i=n[r],T=i.className,N=i.style,K=t.appendChild(a("div",null,"CodeMirror-gutter "+T));N&&(K.style.cssText=N),T=="CodeMirror-linenumbers"&&(e.lineGutter=K,K.style.width=(e.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",va(e)}function ni(e){To(e.display),Qt(e),Eo(e)}function dl(e,t,n,r){var i=this;this.input=n,i.scrollbarFiller=a("div",null,"CodeMirror-scrollbar-filler"),i.scrollbarFiller.setAttribute("cm-not-content","true"),i.gutterFiller=a("div",null,"CodeMirror-gutter-filler"),i.gutterFiller.setAttribute("cm-not-content","true"),i.lineDiv=g("div",null,"CodeMirror-code"),i.selectionDiv=a("div",null,null,"position: relative; z-index: 1"),i.cursorDiv=a("div",null,"CodeMirror-cursors"),i.measure=a("div",null,"CodeMirror-measure"),i.lineMeasure=a("div",null,"CodeMirror-measure"),i.lineSpace=g("div",[i.measure,i.lineMeasure,i.selectionDiv,i.cursorDiv,i.lineDiv],null,"position: relative; outline: none");var T=g("div",[i.lineSpace],"CodeMirror-lines");i.mover=a("div",[T],null,"position: relative"),i.sizer=a("div",[i.mover],"CodeMirror-sizer"),i.sizerWidth=null,i.heightForcer=a("div",null,null,"position: absolute; height: "+re+"px; width: 1px;"),i.gutters=a("div",null,"CodeMirror-gutters"),i.lineGutter=null,i.scroller=a("div",[i.sizer,i.heightForcer,i.gutters],"CodeMirror-scroll"),i.scroller.setAttribute("tabIndex","-1"),i.wrapper=a("div",[i.scrollbarFiller,i.gutterFiller,i.scroller],"CodeMirror"),B&&I<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),!D&&!(_&&o)&&(i.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(i.wrapper):e(i.wrapper)),i.viewFrom=i.viewTo=t.first,i.reportedViewFrom=i.reportedViewTo=t.first,i.view=[],i.renderedView=null,i.externalMeasured=null,i.viewOffset=0,i.lastWrapHeight=i.lastWrapWidth=0,i.updateLineNumbers=null,i.nativeBarWidth=i.barHeight=i.barWidth=0,i.scrollbarsClipped=!1,i.lineNumWidth=i.lineNumInnerWidth=i.lineNumChars=null,i.alignWidgets=!1,i.cachedCharWidth=i.cachedTextHeight=i.cachedPaddingH=null,i.maxLine=null,i.maxLineLength=0,i.maxLineChanged=!1,i.wheelDX=i.wheelDY=i.wheelStartX=i.wheelStartY=null,i.shift=!1,i.selForContextMenu=null,i.activeTouch=null,i.gutterSpecs=ba(r.gutters,r.lineNumbers),To(i),n.init(i)}var Fi=0,or=null;B?or=-.53:_?or=15:x?or=-.7:k&&(or=-1/3);function So(e){var t=e.wheelDeltaX,n=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),n==null&&e.detail&&e.axis==e.VERTICAL_AXIS?n=e.detail:n==null&&(n=e.wheelDelta),{x:t,y:n}}function cl(e){var t=So(e);return t.x*=or,t.y*=or,t}function wo(e,t){var n=So(t),r=n.x,i=n.y,T=e.display,N=T.scroller,K=N.scrollWidth>N.clientWidth,z=N.scrollHeight>N.clientHeight;if(!(r&&K||i&&z))return;if(i&&s&&D){e:for(var Y=t.target,oe=T.view;Y!=N;Y=Y.parentNode)for(var de=0;de<oe.length;de++)if(oe[de].node==Y){e.display.currentWheelTarget=Y;break e}}if(r&&!_&&!A&&or!=null){i&&z&&qn(e,Math.max(0,N.scrollTop+i*or)),an(e,Math.max(0,N.scrollLeft+r*or)),(!i||i&&z)&&J(t),T.wheelStartX=null;return}if(i&&or!=null){var Te=i*or,ye=e.doc.scrollTop,Pe=ye+T.wrapper.clientHeight;Te<0?ye=Math.max(0,ye+Te-50):Pe=Math.min(e.doc.height,Pe+Te+50),ga(e,{top:ye,bottom:Pe})}Fi<20&&(T.wheelStartX==null?(T.wheelStartX=N.scrollLeft,T.wheelStartY=N.scrollTop,T.wheelDX=r,T.wheelDY=i,setTimeout(function(){if(T.wheelStartX==null)return;var Me=N.scrollLeft-T.wheelStartX,Ne=N.scrollTop-T.wheelStartY,Ke=Ne&&T.wheelDY&&Ne/T.wheelDY||Me&&T.wheelDX&&Me/T.wheelDX;if(T.wheelStartX=T.wheelStartY=null,!Ke)return;or=(or*Fi+Ke)/(Fi+1),++Fi},200)):(T.wheelDX+=r,T.wheelDY+=i))}var sr=function(e,t){this.ranges=e,this.primIndex=t};sr.prototype.primary=function(){return this.ranges[this.primIndex]},sr.prototype.equals=function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var n=this.ranges[t],r=e.ranges[t];if(!Be(n.anchor,r.anchor)||!Be(n.head,r.head))return!1}return!0},sr.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new vt(Fn(this.ranges[t].anchor),Fn(this.ranges[t].head));return new sr(e,this.primIndex)},sr.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},sr.prototype.contains=function(e,t){t||(t=e);for(var n=0;n<this.ranges.length;n++){var r=this.ranges[n];if(ut(t,r.from())>=0&&ut(e,r.to())<=0)return n}return-1};var vt=function(e,t){this.anchor=e,this.head=t};vt.prototype.from=function(){return Yr(this.anchor,this.head)},vt.prototype.to=function(){return hn(this.anchor,this.head)},vt.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function gr(e,t,n){var r=e&&e.options.selectionsMayTouch,i=t[n];t.sort(function(Te,ye){return ut(Te.from(),ye.from())}),n=q(t,i);for(var T=1;T<t.length;T++){var N=t[T],K=t[T-1],z=ut(K.to(),N.from());if(r&&!N.empty()?z>0:z>=0){var Y=Yr(K.from(),N.from()),oe=hn(K.to(),N.to()),de=K.empty()?N.from()==N.head:K.from()==K.head;T<=n&&--n,t.splice(--T,2,new vt(de?oe:Y,de?Y:oe))}}return new sr(t,n)}function Br(e,t){return new sr([new vt(e,t||e)],0)}function jr(e){return e.text?Ue(e.from.line+e.text.length-1,$(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Co(e,t){if(ut(e,t.from)<0)return e;if(ut(e,t.to)<=0)return jr(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=jr(t).ch-t.to.ch),Ue(n,r)}function Ea(e,t){for(var n=[],r=0;r<e.sel.ranges.length;r++){var i=e.sel.ranges[r];n.push(new vt(Co(i.anchor,t),Co(i.head,t)))}return gr(e.cm,n,e.sel.primIndex)}function Ao(e,t,n){return e.line==t.line?Ue(n.line,e.ch-t.ch+n.ch):Ue(n.line+(e.line-t.line),e.ch)}function fl(e,t,n){for(var r=[],i=Ue(e.first,0),T=i,N=0;N<t.length;N++){var K=t[N],z=Ao(K.from,i,T),Y=Ao(jr(K),i,T);if(i=K.to,T=Y,n=="around"){var oe=e.sel.ranges[N],de=ut(oe.head,oe.anchor)<0;r[N]=new vt(de?Y:z,de?z:Y)}else r[N]=new vt(z,z)}return new sr(r,e.sel.primIndex)}function xa(e){e.doc.mode=Sr(e.options,e.doc.modeOption),ii(e)}function ii(e){e.doc.iter(function(t){t.stateAfter&&(t.stateAfter=null),t.styles&&(t.styles=null)}),e.doc.modeFrontier=e.doc.highlightFrontier=e.doc.first,ri(e,100),e.state.modeGen++,e.curOp&&Qt(e)}function _o(e,t){return t.from.ch==0&&t.to.ch==0&&$(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Ta(e,t,n,r){function i(Ye){return n?n[Ye]:null}function T(Ye,Ge,Qe){Mr(Ye,Ge,Qe,r),Ht(Ye,"change",Ye,t)}function N(Ye,Ge){for(var Qe=[],at=Ye;at<Ge;++at)Qe.push(new wt(Y[at],i(at),r));return Qe}var K=t.from,z=t.to,Y=t.text,oe=et(e,K.line),de=et(e,z.line),Te=$(Y),ye=i(Y.length-1),Pe=z.line-K.line;if(t.full)e.insert(0,N(0,Y.length)),e.remove(Y.length,e.size-Y.length);else if(_o(e,t)){var Me=N(0,Y.length-1);T(de,de.text,ye),Pe&&e.remove(K.line,Pe),Me.length&&e.insert(K.line,Me)}else if(oe==de)if(Y.length==1)T(oe,oe.text.slice(0,K.ch)+Te+oe.text.slice(z.ch),ye);else{var Ne=N(1,Y.length-1);Ne.push(new wt(Te+oe.text.slice(z.ch),ye,r)),T(oe,oe.text.slice(0,K.ch)+Y[0],i(0)),e.insert(K.line+1,Ne)}else if(Y.length==1)T(oe,oe.text.slice(0,K.ch)+Y[0]+de.text.slice(z.ch),i(0)),e.remove(K.line+1,Pe);else{T(oe,oe.text.slice(0,K.ch)+Y[0],i(0)),T(de,Te+de.text.slice(z.ch),ye);var Ke=N(1,Y.length-1);Pe>1&&e.remove(K.line+1,Pe-1),e.insert(K.line+1,Ke)}Ht(e,"change",e,t)}function Wr(e,t,n){function r(i,T,N){if(i.linked)for(var K=0;K<i.linked.length;++K){var z=i.linked[K];if(z.doc==T)continue;var Y=N&&z.sharedHist;if(n&&!Y)continue;t(z.doc,Y),r(z.doc,i,Y)}}r(e,null,!0)}function Lo(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,da(e),xa(e),Do(e),e.options.lineWrapping||mr(e),e.options.mode=t.modeOption,Qt(e)}function Do(e){(e.doc.direction=="rtl"?F:h)(e.display.lineDiv,"CodeMirror-rtl")}function hl(e){nr(e,function(){Do(e),Qt(e)})}function Ni(e){this.done=[],this.undone=[],this.undoDepth=Infinity,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function Sa(e,t){var n={from:Fn(t.from),to:jr(t),text:wr(e,t.from,t.to)};return Po(e,n,t.from.line,t.to.line+1),Wr(e,function(r){return Po(r,n,t.from.line,t.to.line+1)},!0),n}function Oo(e){for(;e.length;){var t=$(e);if(t.ranges)e.pop();else break}}function ml(e,t){if(t)return Oo(e.done),$(e.done);if(e.done.length&&!$(e.done).ranges)return $(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),$(e.done)}function Ro(e,t,n,r){var i=e.history;i.undone.length=0;var T=+new Date,N,K;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&i.lastModTime>T-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(N=ml(i,i.lastOp==r)))K=$(N.changes),ut(t.from,t.to)==0&&ut(t.from,K.to)==0?K.to=jr(t):N.changes.push(Sa(e,t));else{var z=$(i.done);for((!z||!z.ranges)&&Bi(e.sel,i.done),N={changes:[Sa(e,t)],generation:i.generation},i.done.push(N);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(n),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=T,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,K||Re(e,"historyAdded")}function pl(e,t,n,r){var i=t.charAt(0);return i=="*"||i=="+"&&n.ranges.length==r.ranges.length&&n.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function gl(e,t,n,r){var i=e.history,T=r&&r.origin;n==i.lastSelOp||T&&i.lastSelOrigin==T&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==T||pl(e,T,$(i.done),t))?i.done[i.done.length-1]=t:Bi(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=T,i.lastSelOp=n,r&&r.clearRedo!==!1&&Oo(i.undone)}function Bi(e,t){var n=$(t);n&&n.ranges&&n.equals(e)||t.push(e)}function Po(e,t,n,r){var i=t["spans_"+e.id],T=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(N){N.markedSpans&&((i||(i=t["spans_"+e.id]={}))[T]=N.markedSpans),++T})}function vl(e){if(!e)return null;for(var t,n=0;n<e.length;++n)e[n].marker.explicitlyCleared?t||(t=e.slice(0,n)):t&&t.push(e[n]);return t?t.length?t:null:e}function yl(e,t){var n=t["spans_"+e.id];if(!n)return null;for(var r=[],i=0;i<t.text.length;++i)r.push(vl(n[i]));return r}function ko(e,t){var n=yl(e,t),r=kr(e,t);if(!n)return r;if(!r)return n;for(var i=0;i<n.length;++i){var T=n[i],N=r[i];if(T&&N){e:for(var K=0;K<N.length;++K){for(var z=N[K],Y=0;Y<T.length;++Y)if(T[Y].marker==z.marker)continue e;T.push(z)}}else N&&(n[i]=N)}return n}function An(e,t,n){for(var r=[],i=0;i<e.length;++i){var T=e[i];if(T.ranges){r.push(n?sr.prototype.deepCopy.call(T):T);continue}var N=T.changes,K=[];r.push({changes:K});for(var z=0;z<N.length;++z){var Y=N[z],oe=void 0;if(K.push({from:Y.from,to:Y.to,text:Y.text}),t)for(var de in Y)(oe=de.match(/^spans_(\d+)$/))&&(q(t,Number(oe[1]))>-1&&($(K)[de]=Y[de],delete Y[de]))}}return r}function wa(e,t,n,r){if(r){var i=e.anchor;if(n){var T=ut(t,i)<0;T!=ut(n,i)<0?(i=t,t=n):T!=ut(t,n)<0&&(t=n)}return new vt(i,t)}else return new vt(n||t,t)}function ji(e,t,n,r,i){i==null&&(i=e.cm&&(e.cm.display.shift||e.extend)),Vt(e,new sr([wa(e.sel.primary(),t,n,i)],0),r)}function Mo(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),T=0;T<e.sel.ranges.length;T++)r[T]=wa(e.sel.ranges[T],t[T],null,i);var N=gr(e.cm,r,e.sel.primIndex);Vt(e,N,n)}function Ca(e,t,n,r){var i=e.sel.ranges.slice(0);i[t]=n,Vt(e,gr(e.cm,i,e.sel.primIndex),r)}function Io(e,t,n,r){Vt(e,Br(t,n),r)}function bl(e,t,n){var r={ranges:t.ranges,update:function(i){this.ranges=[];for(var T=0;T<i.length;T++)this.ranges[T]=new vt(lt(e,i[T].anchor),lt(e,i[T].head))},origin:n&&n.origin};return Re(e,"beforeSelectionChange",e,r),e.cm&&Re(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?gr(e.cm,r.ranges,r.ranges.length-1):t}function Uo(e,t,n){var r=e.history.done,i=$(r);i&&i.ranges?(r[r.length-1]=t,Wi(e,t,n)):Vt(e,t,n)}function Vt(e,t,n){Wi(e,t,n),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function Wi(e,t,n){(le(e,"beforeSelectionChange")||e.cm&&le(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,n));var r=n&&n.bias||(ut(t.primary().head,e.sel.primary().head)<0?-1:1);Fo(e,Bo(e,t,r,!0)),!(n&&n.scroll===!1)&&e.cm&&wn(e.cm)}function Fo(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,se(e.cm)),Ht(e,"cursorActivity",e)}function No(e){Fo(e,Bo(e,e.sel,null,!1))}function Bo(e,t,n,r){for(var i,T=0;T<t.ranges.length;T++){var N=t.ranges[T],K=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[T],z=Hi(e,N.anchor,K&&K.anchor,n,r),Y=Hi(e,N.head,K&&K.head,n,r);(i||z!=N.anchor||Y!=N.head)&&(i||(i=t.ranges.slice(0,T)),i[T]=new vt(z,Y))}return i?gr(e.cm,i,t.primIndex):t}function _n(e,t,n,r,i){var T=et(e,t.line);if(T.markedSpans)for(var N=0;N<T.markedSpans.length;++N){var K=T.markedSpans[N],z=K.marker,Y="selectLeft"in z?!z.selectLeft:z.inclusiveLeft,oe="selectRight"in z?!z.selectRight:z.inclusiveRight;if((K.from==null||(Y?K.from<=t.ch:K.from<t.ch))&&(K.to==null||(oe?K.to>=t.ch:K.to>t.ch))){if(i&&(Re(z,"beforeCursorEnter"),z.explicitlyCleared))if(T.markedSpans){--N;continue}else break;if(!z.atomic)continue;if(n){var de=z.find(r<0?1:-1),Te=void 0;if((r<0?oe:Y)&&(de=jo(e,de,-r,de&&de.line==t.line?T:null)),de&&de.line==t.line&&(Te=ut(de,n))&&(r<0?Te<0:Te>0))return _n(e,de,t,r,i)}var ye=z.find(r<0?-1:1);return(r<0?Y:oe)&&(ye=jo(e,ye,r,ye.line==t.line?T:null)),ye?_n(e,ye,t,r,i):null}}return t}function Hi(e,t,n,r,i){var T=r||1,N=_n(e,t,n,T,i)||!i&&_n(e,t,n,T,!0)||_n(e,t,n,-T,i)||!i&&_n(e,t,n,-T,!0);return N||(e.cantEdit=!0,Ue(e.first,0))}function jo(e,t,n,r){return n<0&&t.ch==0?t.line>e.first?lt(e,Ue(t.line-1)):null:n>0&&t.ch==(r||et(e,t.line)).text.length?t.line<e.first+e.size-1?Ue(t.line+1,0):null:new Ue(t.line,t.ch+n)}function Wo(e){e.setSelection(Ue(e.firstLine(),0),Ue(e.lastLine()),he)}function Ho(e,t,n){var r={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return r.canceled=!0}};return n&&(r.update=function(i,T,N,K){i&&(r.from=lt(e,i)),T&&(r.to=lt(e,T)),N&&(r.text=N),K!==void 0&&(r.origin=K)}),Re(e,"beforeChange",e,r),e.cm&&Re(e.cm,"beforeChange",e.cm,r),r.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:r.from,to:r.to,text:r.text,origin:r.origin}}function Ln(e,t,n){if(e.cm){if(!e.cm.curOp)return Ft(e.cm,Ln)(e,t,n);if(e.cm.state.suppressEdits)return}if((le(e,"beforeChange")||e.cm&&le(e.cm,"beforeChange"))&&(t=Ho(e,t,!0),!t))return;var r=Ti&&!n&&Ci(e,t.from,t.to);if(r)for(var i=r.length-1;i>=0;--i)Ko(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else Ko(e,t)}function Ko(e,t){if(t.text.length==1&&t.text[0]==""&&ut(t.from,t.to)==0)return;var n=Ea(e,t);Ro(e,t,n,e.cm?e.cm.curOp.id:NaN),ai(e,t,n,kr(e,t));var r=[];Wr(e,function(i,T){!T&&q(r,i.history)==-1&&(Xo(i.history,t),r.push(i.history)),ai(i,t,null,kr(i,t))})}function Ki(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(r&&!n)return;for(var i=e.history,T,N=e.sel,K=t=="undo"?i.done:i.undone,z=t=="undo"?i.undone:i.done,Y=0;Y<K.length&&!(T=K[Y],n?T.ranges&&!T.equals(e.sel):!T.ranges);Y++);if(Y==K.length)return;for(i.lastOrigin=i.lastSelOrigin=null;;)if(T=K.pop(),T.ranges){if(Bi(T,z),n&&!T.equals(e.sel)){Vt(e,T,{clearRedo:!1});return}N=T}else if(r){K.push(T);return}else break;var oe=[];Bi(N,z),z.push({changes:oe,generation:i.generation}),i.generation=T.generation||++i.maxGeneration;for(var de=le(e,"beforeChange")||e.cm&&le(e.cm,"beforeChange"),Te=function(Me){var Ne=T.changes[Me];if(Ne.origin=t,de&&!Ho(e,Ne,!1))return K.length=0,{};oe.push(Sa(e,Ne));var Ke=Me?Ea(e,Ne):$(K);ai(e,Ne,Ke,ko(e,Ne)),!Me&&e.cm&&e.cm.scrollIntoView({from:Ne.from,to:jr(Ne)});var Ye=[];Wr(e,function(Ge,Qe){!Qe&&q(Ye,Ge.history)==-1&&(Xo(Ge.history,Ne),Ye.push(Ge.history)),ai(Ge,Ne,null,ko(Ge,Ne))})},ye=T.changes.length-1;ye>=0;--ye){var Pe=Te(ye);if(Pe)return Pe.v}}function Go(e,t){if(t==0)return;if(e.first+=t,e.sel=new sr(ae(e.sel.ranges,function(i){return new vt(Ue(i.anchor.line+t,i.anchor.ch),Ue(i.head.line+t,i.head.ch))}),e.sel.primIndex),e.cm){Qt(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;r<n.viewTo;r++)Fr(e.cm,r,"gutter")}}function ai(e,t,n,r){if(e.cm&&!e.cm.curOp)return Ft(e.cm,ai)(e,t,n,r);if(t.to.line<e.first){Go(e,t.text.length-1-(t.to.line-t.from.line));return}if(t.from.line>e.lastLine())return;if(t.from.line<e.first){var i=t.text.length-1-(e.first-t.from.line);Go(e,i),t={from:Ue(e.first,0),to:Ue(t.to.line+i,t.to.ch),text:[$(t.text)],origin:t.origin}}var T=e.lastLine();t.to.line>T&&(t={from:t.from,to:Ue(T,et(e,T).text.length),text:[t.text[0]],origin:t.origin}),t.removed=wr(e,t.from,t.to),n||(n=Ea(e,t)),e.cm?El(e.cm,t,r):Ta(e,t,r),Wi(e,n,he),e.cantEdit&&Hi(e,Ue(e.firstLine(),0))&&(e.cantEdit=!1)}function El(e,t,n){var r=e.doc,i=e.display,T=t.from,N=t.to,K=!1,z=T.line;e.options.lineWrapping||(z=gt(rt(et(r,T.line))),r.iter(z,N.line+1,function(ye){if(ye==i.maxLine)return K=!0,!0})),r.sel.contains(t.from,t.to)>-1&&se(e),Ta(r,t,n,oo(e)),e.options.lineWrapping||(r.iter(z,T.line+t.text.length,function(ye){var Pe=Gt(ye);Pe>i.maxLineLength&&(i.maxLine=ye,i.maxLineLength=Pe,i.maxLineChanged=!0,K=!1)}),K&&(e.curOp.updateMaxLine=!0)),Wn(r,T.line),ri(e,400);var Y=t.text.length-(N.line-T.line)-1;t.full?Qt(e):T.line==N.line&&t.text.length==1&&!_o(e.doc,t)?Fr(e,T.line,"text"):Qt(e,T.line,N.line+1,Y);var oe=le(e,"changes"),de=le(e,"change");if(de||oe){var Te={from:T,to:N,text:t.text,removed:t.removed,origin:t.origin};de&&Ht(e,"change",e,Te),oe&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(Te)}e.display.selForContextMenu=null}function Dn(e,t,n,r,i){var T;r||(r=n),ut(r,n)<0&&(T=[r,n],n=T[0],r=T[1]),typeof t=="string"&&(t=e.splitLines(t)),Ln(e,{from:n,to:r,text:t,origin:i})}function zo(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function Vo(e,t,n,r){for(var i=0;i<e.length;++i){var T=e[i],N=!0;if(T.ranges){T.copied||(T=e[i]=T.deepCopy(),T.copied=!0);for(var K=0;K<T.ranges.length;K++)zo(T.ranges[K].anchor,t,n,r),zo(T.ranges[K].head,t,n,r);continue}for(var z=0;z<T.changes.length;++z){var Y=T.changes[z];if(n<Y.from.line)Y.from=Ue(Y.from.line+r,Y.from.ch),Y.to=Ue(Y.to.line+r,Y.to.ch);else if(t<=Y.to.line){N=!1;break}}N||(e.splice(0,i+1),i=0)}}function Xo(e,t){var n=t.from.line,r=t.to.line,i=t.text.length-(r-n)-1;Vo(e.done,n,r,i),Vo(e.undone,n,r,i)}function oi(e,t,n,r){var i=t,T=t;return typeof t=="number"?T=et(e,$r(e,t)):i=gt(t),i==null?null:(r(T,i)&&e.cm&&Fr(e.cm,i,n),T)}function si(e){this.lines=e,this.parent=null;for(var t=0,n=0;n<e.length;++n)e[n].parent=this,t+=e[n].height;this.height=t}si.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var n=e,r=e+t;n<r;++n){var i=this.lines[n];this.height-=i.height,zt(i),Ht(i,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,n){this.height+=n,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var r=0;r<t.length;++r)t[r].parent=this},iterN:function(e,t,n){for(var r=e+t;e<r;++e)if(n(this.lines[e]))return!0}};function li(e){this.children=e;for(var t=0,n=0,r=0;r<e.length;++r){var i=e[r];t+=i.chunkSize(),n+=i.height,i.parent=this}this.size=t,this.height=n,this.parent=null}li.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var n=0;n<this.children.length;++n){var r=this.children[n],i=r.chunkSize();if(e<i){var T=Math.min(t,i-e),N=r.height;if(r.removeInner(e,T),this.height-=N-r.height,i==T&&(this.children.splice(n--,1),r.parent=null),(t-=T)==0)break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof si))){var K=[];this.collapse(K),this.children=[new si(K)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,n){this.size+=t.length,this.height+=n;for(var r=0;r<this.children.length;++r){var i=this.children[r],T=i.chunkSize();if(e<=T){if(i.insertInner(e,t,n),i.lines&&i.lines.length>50){for(var N=i.lines.length%25+25,K=N;K<i.lines.length;){var z=new si(i.lines.slice(K,K+=25));i.height-=z.height,this.children.splice(++r,0,z),z.parent=this}i.lines=i.lines.slice(0,N),this.maybeSpill()}break}e-=T}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),n=new li(t);if(e.parent){e.size-=n.size,e.height-=n.height;var i=q(e.parent.children,e);e.parent.children.splice(i+1,0,n)}else{var r=new li(e.children);r.parent=e,e.children=[r,n],e=r}n.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN:function(e,t,n){for(var r=0;r<this.children.length;++r){var i=this.children[r],T=i.chunkSize();if(e<T){var N=Math.min(t,T-e);if(i.iterN(e,N,n))return!0;if((t-=N)==0)break;e=0}else e-=T}}};var ui=function(e,t,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.doc=e,this.node=t};ui.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,r=gt(n);if(r==null||!t)return;for(var i=0;i<t.length;++i)t[i]==this&&t.splice(i--,1);t.length||(n.widgets=null);var T=$n(this);dr(n,Math.max(0,n.height-T)),e&&(nr(e,function(){Yo(e,n,-T),Fr(e,r,"widget")}),Ht(e,"lineWidgetCleared",e,this,r))},ui.prototype.changed=function(){var e=this,t=this.height,n=this.doc.cm,r=this.line;this.height=null;var i=$n(this)-t;if(!i)return;St(this.doc,r)||dr(r,r.height+i),n&&nr(n,function(){n.curOp.forceUpdate=!0,Yo(n,r,i),Ht(n,"lineWidgetChanged",n,e,gt(r))})},ue(ui);function Yo(e,t,n){At(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&ma(e,n)}function xl(e,t,n,r){var i=new ui(e,n,r),T=e.cm;return T&&i.noHScroll&&(T.display.alignWidgets=!0),oi(e,t,"widget",function(N){var K=N.widgets||(N.widgets=[]);if(i.insertAt==null?K.push(i):K.splice(Math.min(K.length-1,Math.max(0,i.insertAt)),0,i),i.line=N,T&&!St(e,N)){var z=At(N)<e.scrollTop;dr(N,N.height+$n(i)),z&&ma(T,i.height),T.curOp.forceUpdate=!0}return!0}),T&&Ht(T,"lineWidgetAdded",T,i,typeof t=="number"?t:gt(t)),i}var $o=0,Hr=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++$o};Hr.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&sn(e),le(this,"clear")){var n=this.find();n&&Ht(this,"clear",n.from,n.to)}for(var r=null,i=null,T=0;T<this.lines.length;++T){var N=this.lines[T],K=Pr(N.markedSpans,this);e&&!this.collapsed?Fr(e,gt(N),"text"):e&&(K.to!=null&&(i=gt(N)),K.from!=null&&(r=gt(N))),N.markedSpans=Fa(N.markedSpans,K),K.from==null&&this.collapsed&&!St(this.doc,N)&&e&&dr(N,xn(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var z=0;z<this.lines.length;++z){var Y=rt(this.lines[z]),oe=Gt(Y);oe>e.display.maxLineLength&&(e.display.maxLine=Y,e.display.maxLineLength=oe,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&Qt(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&No(e.doc)),e&&Ht(e,"markerCleared",e,this,r,i),t&&ln(e),this.parent&&this.parent.clear()},Hr.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var n,r,i=0;i<this.lines.length;++i){var T=this.lines[i],N=Pr(T.markedSpans,this);if(N.from!=null&&(n=Ue(t?T:gt(T),N.from),e==-1))return n;if(N.to!=null&&(r=Ue(t?T:gt(T),N.to),e==1))return r}return n&&{from:n,to:r}},Hr.prototype.changed=function(){var e=this,t=this.find(-1,!0),n=this,r=this.doc.cm;if(!t||!r)return;nr(r,function(){var i=t.line,T=gt(t.line),N=ra(r,T);if(N&&(Za(N),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!St(n.doc,i)&&n.height!=null){var K=n.height;n.height=null;var z=$n(n)-K;z&&dr(i,i.height+z)}Ht(r,"markerChanged",r,e)})},Hr.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||q(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Hr.prototype.detachLine=function(e){if(this.lines.splice(q(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},ue(Hr);function On(e,t,n,r,i){if(r&&r.shared)return Tl(e,t,n,r,i);if(e.cm&&!e.cm.curOp)return Ft(e.cm,On)(e,t,n,r,i);var T=new Hr(e,i),N=ut(t,n);if(r&&P(r,T,!1),N>0||N==0&&T.clearWhenEmpty!==!1)return T;if(T.replacedWith&&(T.collapsed=!0,T.widgetNode=g("span",[T.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||T.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(T.widgetNode.insertLeft=!0)),T.collapsed){if(Zi(e,t.line,t,n,T)||t.line!=n.line&&Zi(e,n.line,t,n,T))throw new Error("Inserting collapsed marker partially overlapping an existing one");wi()}T.addToHistory&&Ro(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var K=t.line,z=e.cm,Y;if(e.iter(K,n.line+1,function(de){z&&T.collapsed&&!z.options.lineWrapping&&rt(de)==z.display.maxLine&&(Y=!0),T.collapsed&&K!=t.line&&dr(de,0),Hn(de,new gn(T,K==t.line?t.ch:null,K==n.line?n.ch:null)),++K}),T.collapsed&&e.iter(t.line,n.line+1,function(de){St(e,de)&&dr(de,0)}),T.clearOnEnter&&Ae(T,"beforeCursorEnter",function(){return T.clear()}),T.readOnly&&(Si(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),T.collapsed&&(T.id=++$o,T.atomic=!0),z){if(Y&&(z.curOp.updateMaxLine=!0),T.collapsed)Qt(z,t.line,n.line+1);else if(T.className||T.startStyle||T.endStyle||T.css||T.attributes||T.title)for(var oe=t.line;oe<=n.line;oe++)Fr(z,oe,"text");T.atomic&&No(z.doc),Ht(z,"markerAdded",z,T)}return T}var di=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};di.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();Ht(this,"clear")},di.prototype.find=function(e,t){return this.primary.find(e,t)},ue(di);function Tl(e,t,n,r,i){r=P(r),r.shared=!1;var T=[On(e,t,n,r,i)],N=T[0],K=r.widgetNode;return Wr(e,function(z){K&&(r.widgetNode=K.cloneNode(!0)),T.push(On(z,lt(z,t),lt(z,n),r,i));for(var Y=0;Y<z.linked.length;++Y)if(z.linked[Y].isParent)return;N=$(T)}),new di(T,N)}function Jo(e){return e.findMarks(Ue(e.first,0),e.clipPos(Ue(e.lastLine())),function(t){return t.parent})}function Sl(e,t){for(var n=0;n<t.length;n++){var r=t[n],i=r.find(),T=e.clipPos(i.from),N=e.clipPos(i.to);if(ut(T,N)){var K=On(e,T,N,r.primary,r.primary.type);r.markers.push(K),K.parent=r}}}function wl(e){for(var t=function(r){var i=e[r],T=[i.primary.doc];Wr(i.primary.doc,function(z){return T.push(z)});for(var N=0;N<i.markers.length;N++){var K=i.markers[N];q(T,K.doc)==-1&&(K.parent=null,i.markers.splice(N--,1))}},n=0;n<e.length;n++)t(n)}var Cl=0,Zt=function(e,t,n,r,i){if(!(this instanceof Zt))return new Zt(e,t,n,r,i);n==null&&(n=0),li.call(this,[new si([new wt("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var T=Ue(n,0);this.sel=Br(T),this.history=new Ni(null),this.id=++Cl,this.modeOption=t,this.lineSep=r,this.direction=i=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),Ta(this,{from:T,to:T,text:e}),Vt(this,Br(T),he)};Zt.prototype=Se(li.prototype,{constructor:Zt,iter:function(e,t,n){n?this.iterN(e-this.first,t-e,n):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var n=0,r=0;r<t.length;++r)n+=t[r].height;this.insertInner(e-this.first,t,n)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=fn(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:Nt(function(e){var t=Ue(this.first,0),n=this.first+this.size-1;Ln(this,{from:t,to:Ue(n,et(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&Zn(this.cm,0,0),Vt(this,Br(t),he)}),replaceRange:function(e,t,n,r){t=lt(this,t),n=n?lt(this,n):t,Dn(this,e,t,n,r)},getRange:function(e,t,n){var r=wr(this,lt(this,e),lt(this,t));return n===!1?r:r.join(n||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(Rr(this,e))return et(this,e)},getLineNumber:function(e){return gt(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=et(this,e)),rt(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return lt(this,e)},getCursor:function(e){var t=this.sel.primary(),n;return e==null||e=="head"?n=t.head:e=="anchor"?n=t.anchor:e=="end"||e=="to"||e===!1?n=t.to():n=t.from(),n},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:Nt(function(e,t,n){Io(this,lt(this,typeof e=="number"?Ue(e,t||0):e),null,n)}),setSelection:Nt(function(e,t,n){Io(this,lt(this,e),lt(this,t||e),n)}),extendSelection:Nt(function(e,t,n){ji(this,lt(this,e),t&<(this,t),n)}),extendSelections:Nt(function(e,t){Mo(this,Nn(this,e),t)}),extendSelectionsBy:Nt(function(e,t){var n=ae(this.sel.ranges,e);Mo(this,Nn(this,n),t)}),setSelections:Nt(function(e,t,n){if(!e.length)return;for(var r=[],i=0;i<e.length;i++)r[i]=new vt(lt(this,e[i].anchor),lt(this,e[i].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),Vt(this,gr(this.cm,r,t),n)}),addSelection:Nt(function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new vt(lt(this,e),lt(this,t||e))),Vt(this,gr(this.cm,r,r.length-1),n)}),getSelection:function(e){for(var t=this.sel.ranges,n,r=0;r<t.length;r++){var i=wr(this,t[r].from(),t[r].to());n=n?n.concat(i):i}return e===!1?n:n.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],n=this.sel.ranges,r=0;r<n.length;r++){var i=wr(this,n[r].from(),n[r].to());e!==!1&&(i=i.join(e||this.lineSeparator())),t[r]=i}return t},replaceSelection:function(e,t,n){for(var r=[],i=0;i<this.sel.ranges.length;i++)r[i]=e;this.replaceSelections(r,t,n||"+input")},replaceSelections:Nt(function(e,t,n){for(var r=[],i=this.sel,T=0;T<i.ranges.length;T++){var N=i.ranges[T];r[T]={from:N.from(),to:N.to(),text:this.splitLines(e[T]),origin:n}}for(var K=t&&t!="end"&&fl(this,r,t),z=r.length-1;z>=0;z--)Ln(this,r[z]);K?Uo(this,K):this.cm&&wn(this.cm)}),undo:Nt(function(){Ki(this,"undo")}),redo:Nt(function(){Ki(this,"redo")}),undoSelection:Nt(function(){Ki(this,"undo",!0)}),redoSelection:Nt(function(){Ki(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,r=0;r<e.done.length;r++)e.done[r].ranges||++t;for(var i=0;i<e.undone.length;i++)e.undone[i].ranges||++n;return{undo:t,redo:n}},clearHistory:function(){var e=this;this.history=new Ni(this.history.maxGeneration),Wr(this,function(t){return t.history=e.history},!0)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:An(this.history.done),undone:An(this.history.undone)}},setHistory:function(e){var t=this.history=new Ni(this.history.maxGeneration);t.done=An(e.done.slice(0),null,!0),t.undone=An(e.undone.slice(0),null,!0)},setGutterMarker:Nt(function(e,t,n){return oi(this,e,"gutter",function(r){var i=r.gutterMarkers||(r.gutterMarkers={});return i[t]=n,!n&&Oe(i)&&(r.gutterMarkers=null),!0})}),clearGutter:Nt(function(e){var t=this;this.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&oi(t,n,"gutter",function(){return n.gutterMarkers[e]=null,Oe(n.gutterMarkers)&&(n.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!Rr(this,e))return null;if(t=e,e=et(this,e),!e)return null}else if(t=gt(e),t==null)return null;return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},addLineClass:Nt(function(e,t,n){return oi(this,e,t=="gutter"?"gutter":"class",function(r){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!r[i])r[i]=n;else{if(v(n).test(r[i]))return!1;r[i]+=" "+n}return!0})}),removeLineClass:Nt(function(e,t,n){return oi(this,e,t=="gutter"?"gutter":"class",function(r){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",T=r[i];if(T)if(n==null)r[i]=null;else{var N=T.match(v(n));if(!N)return!1;var K=N.index+N[0].length;r[i]=T.slice(0,N.index)+(!N.index||K==T.length?"":" ")+T.slice(K)||null}else return!1;return!0})}),addLineWidget:Nt(function(e,t,n){return xl(this,e,t,n)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return On(this,lt(this,e),lt(this,t),n,n&&n.type||"range")},setBookmark:function(e,t){var n={replacedWith:t&&(t.nodeType==null?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=lt(this,e),On(this,e,e,n,"bookmark")},findMarksAt:function(e){e=lt(this,e);var t=[],n=et(this,e.line).markedSpans;if(n)for(var r=0;r<n.length;++r){var i=n[r];(i.from==null||i.from<=e.ch)&&(i.to==null||i.to>=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,n){e=lt(this,e),t=lt(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,function(T){var N=T.markedSpans;if(N)for(var K=0;K<N.length;K++){var z=N[K];!(z.to!=null&&i==e.line&&e.ch>=z.to||z.from==null&&i!=e.line||z.from!=null&&i==t.line&&z.from>=t.ch)&&(!n||n(z.marker))&&r.push(z.marker.parent||z.marker)}++i}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var r=0;r<n.length;++r)n[r].from!=null&&e.push(n[r].marker)}),e},posFromIndex:function(e){var t,n=this.first,r=this.lineSeparator().length;return this.iter(function(i){var T=i.text.length+r;if(T>e)return t=e,!0;e-=T,++n}),lt(this,Ue(n,t))},indexFromPos:function(e){e=lt(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var n=this.lineSeparator().length;return this.iter(this.first,e.line,function(r){t+=r.text.length+n}),t},copy:function(e){var t=new Zt(fn(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,n=this.first+this.size;e.from!=null&&e.from>t&&(t=e.from),e.to!=null&&e.to<n&&(n=e.to);var r=new Zt(fn(this,t,n),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(r.history=this.history),(this.linked||(this.linked=[])).push({doc:r,sharedHist:e.sharedHist}),r.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],Sl(r,Jo(this)),r},unlinkDoc:function(e){if(e instanceof _t&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){var n=this.linked[t];if(n.doc!=e)continue;this.linked.splice(t,1),e.unlinkDoc(this),wl(Jo(this));break}if(e.history==this.history){var r=[e.id];Wr(e,function(i){return r.push(i.id)},!0),e.history=new Ni(null),e.history.done=An(this.history.done,r),e.history.undone=An(this.history.undone,r)}},iterLinkedDocs:function(e){Wr(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):mt(e)},lineSeparator:function(){return this.lineSep||`
|
|
`},setDirection:Nt(function(e){if(e!="rtl"&&(e="ltr"),e==this.direction)return;this.direction=e,this.iter(function(t){return t.order=null}),this.cm&&hl(this.cm)})}),Zt.prototype.eachLine=Zt.prototype.iter;var Qo=0;function Al(e){var t=this;if(Zo(t),Fe(t,e)||Lr(t.display,e))return;J(e),B&&(Qo=+new Date);var n=rn(t,e,!0),r=e.dataTransfer.files;if(!n||t.isReadOnly())return;if(r&&r.length&&window.FileReader&&window.File)for(var i=r.length,T=Array(i),N=0,K=function(){++N==i&&Ft(t,function(){n=lt(t.doc,n);var ye={from:n,to:n,text:t.doc.splitLines(T.filter(function(Pe){return Pe!=null}).join(t.doc.lineSeparator())),origin:"paste"};Ln(t.doc,ye),Uo(t.doc,Br(lt(t.doc,n),lt(t.doc,jr(ye))))})()},z=function(ye,Pe){if(t.options.allowDropFileTypes&&q(t.options.allowDropFileTypes,ye.type)==-1){K();return}var Me=new FileReader;Me.onerror=function(){return K()},Me.onload=function(){var Ne=Me.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(Ne)){K();return}T[Pe]=Ne,K()},Me.readAsText(ye)},Y=0;Y<r.length;Y++)z(r[Y],Y);else{if(t.state.draggingText&&t.doc.sel.contains(n)>-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var oe=e.dataTransfer.getData("Text");if(oe){var de;if(t.state.draggingText&&!t.state.draggingText.copy&&(de=t.listSelections()),Wi(t.doc,Br(n,n)),de)for(var Te=0;Te<de.length;++Te)Dn(t.doc,"",de[Te].anchor,de[Te].head,"drag");t.replaceSelection(oe,"around","paste"),t.display.input.focus()}}catch(ye){}}}function _l(e,t){if(B&&(!e.state.draggingText||+new Date-Qo<100)){ie(t);return}if(Fe(e,t)||Lr(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!k){var n=a("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",A&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),A&&n.parentNode.removeChild(n)}}function Ll(e,t){var n=rn(e,t);if(!n)return;var r=document.createDocumentFragment();uo(e,n,r),e.display.dragCursor||(e.display.dragCursor=a("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),l(e.display.dragCursor,r)}function Zo(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function qo(e){if(!document.getElementsByClassName)return;for(var t=document.getElementsByClassName("CodeMirror"),n=[],r=0;r<t.length;r++){var i=t[r].CodeMirror;i&&n.push(i)}n.length&&n[0].operation(function(){for(var T=0;T<n.length;T++)e(n[T])})}var es=!1;function Dl(){if(es)return;Ol(),es=!0}function Ol(){var e;Ae(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,qo(Rl)},100))}),Ae(window,"blur",function(){return qo(Sn)})}function Rl(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var Kr={3:"Pause",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",224:"Mod",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},ci=0;ci<10;ci++)Kr[ci+48]=Kr[ci+96]=String(ci);for(var Gi=65;Gi<=90;Gi++)Kr[Gi]=String.fromCharCode(Gi);for(var fi=1;fi<=12;fi++)Kr[fi+111]=Kr[fi+63235]="F"+fi;var Dr={};Dr.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},Dr.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},Dr.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},Dr.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},Dr.default=s?Dr.macDefault:Dr.pcDefault;function Pl(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var n,r,i,T,N=0;N<t.length-1;N++){var K=t[N];if(/^(cmd|meta|m)$/i.test(K))T=!0;else if(/^a(lt)?$/i.test(K))n=!0;else if(/^(c|ctrl|control)$/i.test(K))r=!0;else if(/^s(hift)?$/i.test(K))i=!0;else throw new Error("Unrecognized modifier name: "+K)}return n&&(e="Alt-"+e),r&&(e="Ctrl-"+e),T&&(e="Cmd-"+e),i&&(e="Shift-"+e),e}function kl(e){var t={};for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];if(/^(name|fallthrough|(de|at)tach)$/.test(n))continue;if(r=="..."){delete e[n];continue}for(var i=ae(n.split(" "),Pl),T=0;T<i.length;T++){var N=void 0,K=void 0;T==i.length-1?(K=i.join(" "),N=r):(K=i.slice(0,T+1).join(" "),N="...");var z=t[K];if(!z)t[K]=N;else if(z!=N)throw new Error("Inconsistent bindings for "+K)}delete e[n]}for(var Y in t)e[Y]=t[Y];return e}function Rn(e,t,n,r){t=zi(t);var i=t.call?t.call(e,r):t[e];if(i===!1)return"nothing";if(i==="...")return"multi";if(i!=null&&n(i))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return Rn(e,t.fallthrough,n,r);for(var T=0;T<t.fallthrough.length;T++){var N=Rn(e,t.fallthrough[T],n,r);if(N)return N}}}function ts(e){var t=typeof e=="string"?e:Kr[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function rs(e,t,n){var r=e;return t.altKey&&r!="Alt"&&(e="Alt-"+e),(m?t.metaKey:t.ctrlKey)&&r!="Ctrl"&&(e="Ctrl-"+e),(m?t.ctrlKey:t.metaKey)&&r!="Mod"&&(e="Cmd-"+e),!n&&t.shiftKey&&r!="Shift"&&(e="Shift-"+e),e}function ns(e,t){if(A&&e.keyCode==34&&e.char)return!1;var n=Kr[e.keyCode];return n==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(n=e.code),rs(n,e,t))}function zi(e){return typeof e=="string"?Dr[e]:e}function Pn(e,t){for(var n=e.doc.sel.ranges,r=[],i=0;i<n.length;i++){for(var T=t(n[i]);r.length&&ut(T.from,$(r).to)<=0;){var N=r.pop();if(ut(N.from,T.from)<0){T.from=N.from;break}}r.push(T)}nr(e,function(){for(var K=r.length-1;K>=0;K--)Dn(e.doc,"",r[K].from,r[K].to,"+delete");wn(e)})}function Aa(e,t,n){var r=_e(e.text,t+n,n);return r<0||r>e.text.length?null:r}function _a(e,t,n){var r=Aa(e,t.ch,n);return r==null?null:new Ue(t.line,r,n<0?"after":"before")}function La(e,t,n,r,i){if(e){t.doc.direction=="rtl"&&(i=-i);var T=He(n,t.doc.direction);if(T){var N=i<0?$(T):T[0],K=i<0==(N.level==1),z=K?"after":"before",Y;if(N.level>0||t.doc.direction=="rtl"){var oe=En(t,n);Y=i<0?n.text.length-1:0;var de=Er(t,oe,Y).top;Y=ze(function(Te){return Er(t,oe,Te).top==de},i<0==(N.level==1)?N.from:N.to-1,Y),z=="before"&&(Y=Aa(n,Y,1))}else Y=i<0?N.to:N.from;return new Ue(r,Y,z)}}return new Ue(r,i<0?n.text.length:0,i<0?"before":"after")}function Ml(e,t,n,r){var i=He(t,e.doc.direction);if(!i)return _a(t,n,r);n.ch>=t.text.length?(n.ch=t.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var T=je(i,n.ch,n.sticky),N=i[T];if(e.doc.direction=="ltr"&&N.level%2==0&&(r>0?N.to>n.ch:N.from<n.ch))return _a(t,n,r);var K=function(Ke,Ye){return Aa(t,Ke instanceof Ue?Ke.ch:Ke,Ye)},z,Y=function(Ke){return e.options.lineWrapping?(z=z||En(e,t),ao(e,t,z,Ke)):{begin:0,end:t.text.length}},oe=Y(n.sticky=="before"?K(n,-1):n.ch);if(e.doc.direction=="rtl"||N.level==1){var de=N.level==1==r<0,Te=K(n,de?1:-1);if(Te!=null&&(de?Te<=N.to&&Te<=oe.end:Te>=N.from&&Te>=oe.begin)){var ye=de?"before":"after";return new Ue(n.line,Te,ye)}}var Pe=function(Ke,Ye,Ge){for(var Qe=function(Tt,Bt){return Bt?new Ue(n.line,K(Tt,1),"before"):new Ue(n.line,Tt,"after")};Ke>=0&&Ke<i.length;Ke+=Ye){var at=i[Ke],nt=Ye>0==(at.level!=1),ht=nt?Ge.begin:K(Ge.end,-1);if(at.from<=ht&&ht<at.to)return Qe(ht,nt);if(ht=nt?at.from:K(at.to,-1),Ge.begin<=ht&&ht<Ge.end)return Qe(ht,nt)}},Me=Pe(T+r,r,oe);if(Me)return Me;var Ne=r>0?oe.end:K(oe.begin,-1);return Ne!=null&&!(r>0&&Ne==t.text.length)&&(Me=Pe(r>0?0:i.length-1,r,Y(Ne)),Me)?Me:null}var hi={selectAll:Wo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),he)},killLine:function(e){return Pn(e,function(t){if(t.empty()){var n=et(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line<e.lastLine()?{from:t.head,to:Ue(t.head.line+1,0)}:{from:t.head,to:Ue(t.head.line,n)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return Pn(e,function(t){return{from:Ue(t.from().line,0),to:lt(e.doc,Ue(t.to().line+1,0))}})},delLineLeft:function(e){return Pn(e,function(t){return{from:Ue(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return Pn(e,function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return{from:r,to:t.from()}})},delWrappedLineRight:function(e){return Pn(e,function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div");return{from:t.from(),to:r}})},undo:function(e){return e.undo()},redo:function(e){return e.redo()},undoSelection:function(e){return e.undoSelection()},redoSelection:function(e){return e.redoSelection()},goDocStart:function(e){return e.extendSelection(Ue(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(Ue(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return is(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return as(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return Il(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div")},pe)},goLineLeft:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:n},"div")},pe)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return r.ch<e.getLine(r.line).search(/\S/)?as(e,t.head):r},pe)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"codepoint")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection(" ")},insertSoftTab:function(e){for(var t=[],n=e.listSelections(),r=e.options.tabSize,i=0;i<n.length;i++){var T=n[i].from(),N=H(e.getLine(T.line),T.ch,r);t.push(fe(r-N%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return nr(e,function(){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++){if(!t[r].empty())continue;var i=t[r].head,T=et(e.doc,i.line).text;if(T){if(i.ch==T.length&&(i=new Ue(i.line,i.ch-1)),i.ch>0)i=new Ue(i.line,i.ch+1),e.replaceRange(T.charAt(i.ch-1)+T.charAt(i.ch-2),Ue(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var N=et(e.doc,i.line-1).text;N&&(i=new Ue(i.line,1),e.replaceRange(T.charAt(0)+e.doc.lineSeparator()+N.charAt(N.length-1),Ue(i.line-1,N.length-1),i,"+transpose"))}}n.push(new vt(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){return nr(e,function(){for(var t=e.listSelections(),n=t.length-1;n>=0;n--)e.replaceRange(e.doc.lineSeparator(),t[n].anchor,t[n].head,"+input");t=e.listSelections();for(var r=0;r<t.length;r++)e.indentLine(t[r].from().line,null,!0);wn(e)})},openLine:function(e){return e.replaceSelection(`
|
|
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function is(e,t){var n=et(e.doc,t),r=rt(n);return r!=n&&(t=gt(r)),La(!0,e,r,t,1)}function Il(e,t){var n=et(e.doc,t),r=ct(n);return r!=n&&(t=gt(r)),La(!0,e,n,t,-1)}function as(e,t){var n=is(e,t.line),r=et(e.doc,n.line),i=He(r,e.doc.direction);if(!i||i[0].level==0){var T=Math.max(n.ch,r.text.search(/\S/)),N=t.line==n.line&&t.ch<=T&&t.ch;return Ue(n.line,N?0:T,n.sticky)}return n}function Vi(e,t,n){if(typeof t=="string"&&(t=hi[t],!t))return!1;e.display.input.ensurePolled();var r=e.display.shift,i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),i=t(e)!=Ee}finally{e.display.shift=r,e.state.suppressEdits=!1}return i}function Ul(e,t,n){for(var r=0;r<e.state.keyMaps.length;r++){var i=Rn(t,e.state.keyMaps[r],n,e);if(i)return i}return e.options.extraKeys&&Rn(t,e.options.extraKeys,n,e)||Rn(t,e.options.keyMap,n,e)}var Fl=new X;function mi(e,t,n,r){var i=e.state.keySeq;if(i){if(ts(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Fl.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),os(e,i+" "+t,n,r))return!0}return os(e,t,n,r)}function os(e,t,n,r){var i=Ul(e,t,r);return i=="multi"&&(e.state.keySeq=t),i=="handled"&&Ht(e,"keyHandled",e,t,n),(i=="handled"||i=="multi")&&(J(n),ca(e)),!!i}function ss(e,t){var n=ns(t,!0);return n?t.shiftKey&&!e.state.keySeq?mi(e,"Shift-"+n,t,function(r){return Vi(e,r,!0)})||mi(e,n,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return Vi(e,r)}):mi(e,n,t,function(r){return Vi(e,r)}):!1}function Nl(e,t,n){return mi(e,"'"+n+"'",t,function(r){return Vi(e,r,!0)})}var Da=null;function ls(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=M(),Fe(t,e))return;B&&I<11&&e.keyCode==27&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=n==16||e.shiftKey;var r=ss(t,e);A&&(Da=r?n:null,!r&&n==88&&!It&&(s?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),_&&!s&&!r&&n==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),n==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Bl(t)}function Bl(e){var t=e.display.lineDiv;F(t,"CodeMirror-crosshair");function n(r){(r.keyCode==18||!r.altKey)&&(h(t,"CodeMirror-crosshair"),Je(document,"keyup",n),Je(document,"mouseover",n))}Ae(document,"keyup",n),Ae(document,"mouseover",n)}function us(e){e.keyCode==16&&(this.doc.sel.shift=!1),Fe(this,e)}function ds(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(Lr(t.display,e)||Fe(t,e)||e.ctrlKey&&!e.altKey||s&&e.metaKey)return;var n=e.keyCode,r=e.charCode;if(A&&n==Da){Da=null,J(e);return}if(A&&(!e.which||e.which<10)&&ss(t,e))return;var i=String.fromCharCode(r==null?n:r);if(i=="\b")return;if(Nl(t,e,i))return;t.display.input.onKeyPress(e)}var jl=400,Oa=function(e,t,n){this.time=e,this.pos=t,this.button=n};Oa.prototype.compare=function(e,t,n){return this.time+jl>e&&ut(t,this.pos)==0&&n==this.button};var pi,gi;function Wl(e,t){var n=+new Date;return gi&&gi.compare(n,e,t)?(pi=gi=null,"triple"):pi&&pi.compare(n,e,t)?(gi=new Oa(n,e,t),pi=null,"double"):(pi=new Oa(n,e,t),gi=null,"single")}function cs(e){var t=this,n=t.display;if(Fe(t,e)||n.activeTouch&&n.input.supportsTouch())return;if(n.input.ensurePolled(),n.shift=e.shiftKey,Lr(n,e)){D||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(Ra(t,e))return;var r=rn(t,e),i=Ce(e),T=r?Wl(r,i):"single";if(window.focus(),i==1&&t.state.selectingText&&t.state.selectingText(e),r&&Hl(t,i,r,T,e))return;i==1?r?Gl(t,r,T,e):be(e)==n.scroller&&J(e):i==2?(r&&ji(t.doc,r),setTimeout(function(){return n.input.focus()},20)):i==3&&(w?t.display.input.onContextMenu(e):fo(t))}function Hl(e,t,n,r,i){var T="Click";return r=="double"?T="Double"+T:r=="triple"&&(T="Triple"+T),T=(t==1?"Left":t==2?"Middle":"Right")+T,mi(e,rs(T,i),i,function(N){if(typeof N=="string"&&(N=hi[N]),!N)return!1;var K=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),K=N(e,n)!=Ee}finally{e.state.suppressEdits=!1}return K})}function Kl(e,t,n){var r=e.getOption("configureMouse"),i=r?r(e,t,n):{};if(i.unit==null){var T=u?n.shiftKey&&n.metaKey:n.altKey;i.unit=T?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(i.extend==null||e.doc.extend)&&(i.extend=e.doc.extend||n.shiftKey),i.addNew==null&&(i.addNew=s?n.metaKey:n.ctrlKey),i.moveOnDrag==null&&(i.moveOnDrag=!(s?n.altKey:n.ctrlKey)),i}function Gl(e,t,n,r){B?setTimeout(O(co,e),0):e.curOp.focus=M();var i=Kl(e,n,r),T=e.doc.sel,N;e.options.dragDrop&&Ie&&!e.isReadOnly()&&n=="single"&&(N=T.contains(t))>-1&&(ut((N=T.ranges[N]).from(),t)<0||t.xRel>0)&&(ut(N.to(),t)>0||t.xRel<0)?zl(e,r,t,i):Vl(e,r,t,i)}function zl(e,t,n,r){var i=e.display,T=!1,N=Ft(e,function(Y){D&&(i.scroller.draggable=!1),e.state.draggingText=!1,Je(i.wrapper.ownerDocument,"mouseup",N),Je(i.wrapper.ownerDocument,"mousemove",K),Je(i.scroller,"dragstart",z),Je(i.scroller,"drop",N),T||(J(Y),r.addNew||ji(e.doc,n,null,null,r.extend),D&&!k||B&&I==9?setTimeout(function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()},20):i.input.focus())}),K=function(Y){T=T||Math.abs(t.clientX-Y.clientX)+Math.abs(t.clientY-Y.clientY)>=10},z=function(){return T=!0};D&&(i.scroller.draggable=!0),e.state.draggingText=N,N.copy=!r.moveOnDrag,i.scroller.dragDrop&&i.scroller.dragDrop(),Ae(i.wrapper.ownerDocument,"mouseup",N),Ae(i.wrapper.ownerDocument,"mousemove",K),Ae(i.scroller,"dragstart",z),Ae(i.scroller,"drop",N),fo(e),setTimeout(function(){return i.input.focus()},20)}function fs(e,t,n){if(n=="char")return new vt(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new vt(Ue(t.line,0),lt(e.doc,Ue(t.line+1,0)));var r=n(e,t);return new vt(r.from,r.to)}function Vl(e,t,n,r){var i=e.display,T=e.doc;J(t);var N,K,z=T.sel,Y=z.ranges;if(r.addNew&&!r.extend?(K=T.sel.contains(n),K>-1?N=Y[K]:N=new vt(n,n)):(N=T.sel.primary(),K=T.sel.primIndex),r.unit=="rectangle")r.addNew||(N=new vt(n,n)),n=rn(e,t,!0,!0),K=-1;else{var oe=fs(e,n,r.unit);r.extend?N=wa(N,oe.anchor,oe.head,r.extend):N=oe}r.addNew?K==-1?(K=Y.length,Vt(T,gr(e,Y.concat([N]),K),{scroll:!1,origin:"*mouse"})):Y.length>1&&Y[K].empty()&&r.unit=="char"&&!r.extend?(Vt(T,gr(e,Y.slice(0,K).concat(Y.slice(K+1)),0),{scroll:!1,origin:"*mouse"}),z=T.sel):Ca(T,K,N,xe):(K=0,Vt(T,new sr([N],0),xe),z=T.sel);var de=n;function Te(Ge){if(ut(de,Ge)==0)return;if(de=Ge,r.unit=="rectangle"){for(var Qe=[],at=e.options.tabSize,nt=H(et(T,n.line).text,n.ch,at),ht=H(et(T,Ge.line).text,Ge.ch,at),Tt=Math.min(nt,ht),Bt=Math.max(nt,ht),Dt=Math.min(n.line,Ge.line),ir=Math.min(e.lastLine(),Math.max(n.line,Ge.line));Dt<=ir;Dt++){var qt=et(T,Dt).text,kt=ve(qt,Tt,at);Tt==Bt?Qe.push(new vt(Ue(Dt,kt),Ue(Dt,kt))):qt.length>kt&&Qe.push(new vt(Ue(Dt,kt),Ue(Dt,ve(qt,Bt,at))))}Qe.length||Qe.push(new vt(n,n)),Vt(T,gr(e,z.ranges.slice(0,K).concat(Qe),K),{origin:"*mouse",scroll:!1}),e.scrollIntoView(Ge)}else{var er=N,Kt=fs(e,Ge,r.unit),Ut=er.anchor,Mt;ut(Kt.anchor,Ut)>0?(Mt=Kt.head,Ut=Yr(er.from(),Kt.anchor)):(Mt=Kt.anchor,Ut=hn(er.to(),Kt.head));var Ot=z.ranges.slice(0);Ot[K]=Xl(e,new vt(lt(T,Ut),Mt)),Vt(T,gr(e,Ot,K),xe)}}var ye=i.wrapper.getBoundingClientRect(),Pe=0;function Me(Ge){var Qe=++Pe,at=rn(e,Ge,!0,r.unit=="rectangle");if(!at)return;if(ut(at,de)!=0){e.curOp.focus=M(),Te(at);var nt=Mi(i,T);(at.line>=nt.to||at.line<nt.from)&&setTimeout(Ft(e,function(){Pe==Qe&&Me(Ge)}),150)}else{var ht=Ge.clientY<ye.top?-20:Ge.clientY>ye.bottom?20:0;ht&&setTimeout(Ft(e,function(){if(Pe!=Qe)return;i.scroller.scrollTop+=ht,Me(Ge)}),50)}}function Ne(Ge){e.state.selectingText=!1,Pe=Infinity,Ge&&(J(Ge),i.input.focus()),Je(i.wrapper.ownerDocument,"mousemove",Ke),Je(i.wrapper.ownerDocument,"mouseup",Ye),T.history.lastSelOrigin=null}var Ke=Ft(e,function(Ge){Ge.buttons===0||!Ce(Ge)?Ne(Ge):Me(Ge)}),Ye=Ft(e,Ne);e.state.selectingText=Ye,Ae(i.wrapper.ownerDocument,"mousemove",Ke),Ae(i.wrapper.ownerDocument,"mouseup",Ye)}function Xl(e,t){var n=t.anchor,r=t.head,i=et(e.doc,n.line);if(ut(n,r)==0&&n.sticky==r.sticky)return t;var T=He(i);if(!T)return t;var N=je(T,n.ch,n.sticky),K=T[N];if(K.from!=n.ch&&K.to!=n.ch)return t;var z=N+(K.from==n.ch==(K.level!=1)?0:1);if(z==0||z==T.length)return t;var Y;if(r.line!=n.line)Y=(r.line-n.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var oe=je(T,r.ch,r.sticky),de=oe-N||(r.ch-n.ch)*(K.level==1?-1:1);oe==z-1||oe==z?Y=de<0:Y=de>0}var Te=T[z+(Y?-1:0)],ye=Y==(Te.level==1),Pe=ye?Te.from:Te.to,Me=ye?"after":"before";return n.ch==Pe&&n.sticky==Me?t:new vt(new Ue(n.line,Pe,Me),r)}function hs(e,t,n,r){var i,T;if(t.touches)i=t.touches[0].clientX,T=t.touches[0].clientY;else try{i=t.clientX,T=t.clientY}catch(Te){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&J(t);var N=e.display,K=N.lineDiv.getBoundingClientRect();if(T>K.bottom||!le(e,n))return te(t);T-=K.top-N.viewOffset;for(var z=0;z<e.display.gutterSpecs.length;++z){var Y=N.gutters.childNodes[z];if(Y&&Y.getBoundingClientRect().right>=i){var oe=Cr(e.doc,T),de=e.display.gutterSpecs[z];return Re(e,n,e,oe,de.className,t),te(t)}}}function Ra(e,t){return hs(e,t,"gutterClick",!0)}function ms(e,t){if(Lr(e.display,t)||Yl(e,t))return;if(Fe(e,t,"contextmenu"))return;w||e.display.input.onContextMenu(t)}function Yl(e,t){return le(e,"gutterContextMenu")?hs(e,t,"gutterContextMenu",!1):!1}function ps(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),Jn(e)}var kn={toString:function(){return"CodeMirror.Init"}},gs={},Xi={};function $l(e){var t=e.optionHandlers;function n(r,i,T,N){e.defaults[r]=i,T&&(t[r]=N?function(K,z,Y){Y!=kn&&T(K,z,Y)}:T)}e.defineOption=n,e.Init=kn,n("value","",function(r,i){return r.setValue(i)},!0),n("mode",null,function(r,i){r.doc.modeOption=i,xa(r)},!0),n("indentUnit",2,xa,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(r){ii(r),Jn(r),Qt(r)},!0),n("lineSeparator",null,function(r,i){if(r.doc.lineSep=i,!i)return;var T=[],N=r.doc.first;r.doc.iter(function(z){for(var Y=0;;){var oe=z.text.indexOf(i,Y);if(oe==-1)break;Y=oe+i.length,T.push(Ue(N,oe))}N++});for(var K=T.length-1;K>=0;K--)Dn(r.doc,i,T[K],Ue(T[K].line,T[K].ch+i.length))}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(r,i,T){r.state.specialChars=new RegExp(i.source+(i.test(" ")?"":"| "),"g"),T!=kn&&r.refresh()}),n("specialCharPlaceholder",ws,function(r){return r.refresh()},!0),n("electricChars",!0),n("inputStyle",o?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),n("spellcheck",!1,function(r,i){return r.getInputField().spellcheck=i},!0),n("autocorrect",!1,function(r,i){return r.getInputField().autocorrect=i},!0),n("autocapitalize",!1,function(r,i){return r.getInputField().autocapitalize=i},!0),n("rtlMoveVisually",!S),n("wholeLineUpdateBefore",!0),n("theme","default",function(r){ps(r),ni(r)},!0),n("keyMap","default",function(r,i,T){var N=zi(i),K=T!=kn&&zi(T);K&&K.detach&&K.detach(r,N),N.attach&&N.attach(r,K||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Ql,!0),n("gutters",[],function(r,i){r.display.gutterSpecs=ba(i,r.options.lineNumbers),ni(r)},!0),n("fixedGutter",!0,function(r,i){r.display.gutters.style.left=i?ua(r.display)+"px":"0",r.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(r){return Cn(r)},!0),n("scrollbarStyle","native",function(r){yo(r),Cn(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)},!0),n("lineNumbers",!1,function(r,i){r.display.gutterSpecs=ba(r.options.gutters,i),ni(r)},!0),n("firstLineNumber",1,ni,!0),n("lineNumberFormatter",function(r){return r},ni,!0),n("showCursorWhenSelecting",!1,Qn,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,function(r,i){i=="nocursor"&&(Sn(r),r.display.input.blur()),r.display.input.readOnlyChanged(i)}),n("screenReaderLabel",null,function(r,i){i=i===""?null:i,r.display.input.screenReaderLabelChanged(i)}),n("disableInput",!1,function(r,i){i||r.display.input.reset()},!0),n("dragDrop",!0,Jl),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,Qn,!0),n("singleCursorHeightPerLine",!0,Qn,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,ii,!0),n("addModeClass",!1,ii,!0),n("pollInterval",100),n("undoDepth",200,function(r,i){return r.doc.history.undoDepth=i}),n("historyEventDelay",1250),n("viewportMargin",10,function(r){return r.refresh()},!0),n("maxHighlightLength",1e4,ii,!0),n("moveInputWithCursor",!0,function(r,i){i||r.display.input.resetPosition()}),n("tabindex",null,function(r,i){return r.display.input.getField().tabIndex=i||""}),n("autofocus",null),n("direction","ltr",function(r,i){return r.doc.setDirection(i)},!0),n("phrases",null)}function Jl(e,t,n){var r=n&&n!=kn;if(!t!=!r){var i=e.display.dragFunctions,T=t?Ae:Je;T(e.display.scroller,"dragstart",i.start),T(e.display.scroller,"dragenter",i.enter),T(e.display.scroller,"dragover",i.over),T(e.display.scroller,"dragleave",i.leave),T(e.display.scroller,"drop",i.drop)}}function Ql(e){e.options.lineWrapping?(F(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(h(e.display.wrapper,"CodeMirror-wrap"),mr(e)),da(e),Qt(e),Jn(e),setTimeout(function(){return Cn(e)},100)}function _t(e,t){var n=this;if(!(this instanceof _t))return new _t(e,t);this.options=t=t?P(t):{},P(gs,t,!1);var r=t.value;typeof r=="string"?r=new Zt(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var i=new _t.inputStyles[t.inputStyle](this),T=this.display=new dl(e,r,i,t);T.wrapper.CodeMirror=this,ps(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),yo(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new X,keySeq:null,specialChars:null},t.autofocus&&!o&&T.input.focus(),B&&I<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Zl(this),Dl(),sn(this),this.curOp.forceUpdate=!0,Lo(this,r),t.autofocus&&!o||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&fa(n)},20):Sn(this);for(var N in Xi)Xi.hasOwnProperty(N)&&Xi[N](this,t[N],kn);xo(this),t.finishInit&&t.finishInit(this);for(var K=0;K<Pa.length;++K)Pa[K](this);ln(this),D&&t.lineWrapping&&getComputedStyle(T.lineDiv).textRendering=="optimizelegibility"&&(T.lineDiv.style.textRendering="auto")}_t.defaults=gs,_t.optionHandlers=Xi;function Zl(e){var t=e.display;Ae(t.scroller,"mousedown",Ft(e,cs)),B&&I<11?Ae(t.scroller,"dblclick",Ft(e,function(z){if(Fe(e,z))return;var Y=rn(e,z);if(!Y||Ra(e,z)||Lr(e.display,z))return;J(z);var oe=e.findWordAt(Y);ji(e.doc,oe.anchor,oe.head)})):Ae(t.scroller,"dblclick",function(z){return Fe(e,z)||J(z)}),Ae(t.scroller,"contextmenu",function(z){return ms(e,z)}),Ae(t.input.getField(),"contextmenu",function(z){t.scroller.contains(z.target)||ms(e,z)});var n,r={end:0};function i(){t.activeTouch&&(n=setTimeout(function(){return t.activeTouch=null},1e3),r=t.activeTouch,r.end=+new Date)}function T(z){if(z.touches.length!=1)return!1;var Y=z.touches[0];return Y.radiusX<=1&&Y.radiusY<=1}function N(z,Y){if(Y.left==null)return!0;var oe=Y.left-z.left,de=Y.top-z.top;return oe*oe+de*de>20*20}Ae(t.scroller,"touchstart",function(z){if(!Fe(e,z)&&!T(z)&&!Ra(e,z)){t.input.ensurePolled(),clearTimeout(n);var Y=+new Date;t.activeTouch={start:Y,moved:!1,prev:Y-r.end<=300?r:null},z.touches.length==1&&(t.activeTouch.left=z.touches[0].pageX,t.activeTouch.top=z.touches[0].pageY)}}),Ae(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Ae(t.scroller,"touchend",function(z){var Y=t.activeTouch;if(Y&&!Lr(t,z)&&Y.left!=null&&!Y.moved&&new Date-Y.start<300){var oe=e.coordsChar(t.activeTouch,"page"),de;!Y.prev||N(Y,Y.prev)?de=new vt(oe,oe):!Y.prev.prev||N(Y,Y.prev.prev)?de=e.findWordAt(oe):de=new vt(Ue(oe.line,0),lt(e.doc,Ue(oe.line+1,0))),e.setSelection(de.anchor,de.head),e.focus(),J(z)}i()}),Ae(t.scroller,"touchcancel",i),Ae(t.scroller,"scroll",function(){t.scroller.clientHeight&&(qn(e,t.scroller.scrollTop),an(e,t.scroller.scrollLeft,!0),Re(e,"scroll",e))}),Ae(t.scroller,"mousewheel",function(z){return wo(e,z)}),Ae(t.scroller,"DOMMouseScroll",function(z){return wo(e,z)}),Ae(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(z){Fe(e,z)||ie(z)},over:function(z){Fe(e,z)||(Ll(e,z),ie(z))},start:function(z){return _l(e,z)},drop:Ft(e,Al),leave:function(z){Fe(e,z)||Zo(e)}};var K=t.input.getField();Ae(K,"keyup",function(z){return us.call(e,z)}),Ae(K,"keydown",Ft(e,ls)),Ae(K,"keypress",Ft(e,ds)),Ae(K,"focus",function(z){return fa(e,z)}),Ae(K,"blur",function(z){return Sn(e,z)})}var Pa=[];_t.defineInitHook=function(e){return Pa.push(e)};function vi(e,t,n,r){var i=e.doc,T;n==null&&(n="add"),n=="smart"&&(i.mode.indent?T=rr(e,t).state:n="prev");var N=e.options.tabSize,K=et(i,t),z=H(K.text,null,N);K.stateAfter&&(K.stateAfter=null);var Y=K.text.match(/^\s*/)[0],oe;if(!r&&!/\S/.test(K.text))oe=0,n="not";else if(n=="smart"&&(oe=i.mode.indent(T,K.text.slice(Y.length),K.text),oe==Ee||oe>150)){if(!r)return;n="prev"}n=="prev"?t>i.first?oe=H(et(i,t-1).text,null,N):oe=0:n=="add"?oe=z+e.options.indentUnit:n=="subtract"?oe=z-e.options.indentUnit:typeof n=="number"&&(oe=z+n),oe=Math.max(0,oe);var de="",Te=0;if(e.options.indentWithTabs)for(var ye=Math.floor(oe/N);ye;--ye)Te+=N,de+=" ";if(Te<oe&&(de+=fe(oe-Te)),de!=Y)return Dn(i,de,Ue(t,0),Ue(t,Y.length),"+input"),K.stateAfter=null,!0;for(var Pe=0;Pe<i.sel.ranges.length;Pe++){var Me=i.sel.ranges[Pe];if(Me.head.line==t&&Me.head.ch<Y.length){var Ne=Ue(t,Y.length);Ca(i,Pe,new vt(Ne,Ne));break}}}var vr=null;function Yi(e){vr=e}function ka(e,t,n,r,i){var T=e.doc;e.display.shift=!1,r||(r=T.sel);var N=+new Date-200,K=i=="paste"||e.state.pasteIncoming>N,z=mt(t),Y=null;if(K&&r.ranges.length>1)if(vr&&vr.text.join(`
|
|
`)==t){if(r.ranges.length%vr.text.length==0){Y=[];for(var oe=0;oe<vr.text.length;oe++)Y.push(T.splitLines(vr.text[oe]))}}else z.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(Y=ae(z,function(Ke){return[Ke]}));for(var de=e.curOp.updateInput,Te=r.ranges.length-1;Te>=0;Te--){var ye=r.ranges[Te],Pe=ye.from(),Me=ye.to();ye.empty()&&(n&&n>0?Pe=Ue(Pe.line,Pe.ch-n):e.state.overwrite&&!K?Me=Ue(Me.line,Math.min(et(T,Me.line).text.length,Me.ch+$(z).length)):K&&vr&&vr.lineWise&&vr.text.join(`
|
|
`)==z.join(`
|
|
`)&&(Pe=Me=Ue(Pe.line,0)));var Ne={from:Pe,to:Me,text:Y?Y[Te%Y.length]:z,origin:i||(K?"paste":e.state.cutIncoming>N?"cut":"+input")};Ln(e.doc,Ne),Ht(e,"inputRead",e,Ne)}t&&!K&&ys(e,t),wn(e),e.curOp.updateInput<2&&(e.curOp.updateInput=de),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function vs(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&nr(t,function(){return ka(t,n,0,null,"paste")}),!0}function ys(e,t){if(!e.options.electricChars||!e.options.smartIndent)return;for(var n=e.doc.sel,r=n.ranges.length-1;r>=0;r--){var i=n.ranges[r];if(i.head.ch>100||r&&n.ranges[r-1].head.line==i.head.line)continue;var T=e.getModeAt(i.head),N=!1;if(T.electricChars){for(var K=0;K<T.electricChars.length;K++)if(t.indexOf(T.electricChars.charAt(K))>-1){N=vi(e,i.head.line,"smart");break}}else T.electricInput&&(T.electricInput.test(et(e.doc,i.head.line).text.slice(0,i.head.ch))&&(N=vi(e,i.head.line,"smart")));N&&Ht(e,"electricInput",e,i.head.line)}}function bs(e){for(var t=[],n=[],r=0;r<e.doc.sel.ranges.length;r++){var i=e.doc.sel.ranges[r].head.line,T={anchor:Ue(i,0),head:Ue(i+1,0)};n.push(T),t.push(e.getRange(T.anchor,T.head))}return{text:t,ranges:n}}function Es(e,t,n,r){e.setAttribute("autocorrect",n?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function xs(){var e=a("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=a("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return D?e.style.width="1000px":e.setAttribute("wrap","off"),b&&(e.style.border="1px solid black"),Es(e),t}function ql(e){var t=e.optionHandlers,n=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(r,i){var T=this.options,N=T[r];if(T[r]==i&&r!="mode")return;T[r]=i,t.hasOwnProperty(r)&&Ft(this,t[r])(this,i,N),Re(this,"optionChange",this,r)},getOption:function(r){return this.options[r]},getDoc:function(){return this.doc},addKeyMap:function(r,i){this.state.keyMaps[i?"push":"unshift"](zi(r))},removeKeyMap:function(r){for(var i=this.state.keyMaps,T=0;T<i.length;++T)if(i[T]==r||i[T].name==r)return i.splice(T,1),!0},addOverlay:$t(function(r,i){var T=r.token?r:e.getMode(this.options,r);if(T.startState)throw new Error("Overlays may not be stateful.");Z(this.state.overlays,{mode:T,modeSpec:r,opaque:i&&i.opaque,priority:i&&i.priority||0},function(N){return N.priority}),this.state.modeGen++,Qt(this)}),removeOverlay:$t(function(r){for(var i=this.state.overlays,T=0;T<i.length;++T){var N=i[T].modeSpec;if(N==r||typeof r=="string"&&N.name==r){i.splice(T,1),this.state.modeGen++,Qt(this);return}}}),indentLine:$t(function(r,i,T){typeof i!="string"&&typeof i!="number"&&(i==null?i=this.options.smartIndent?"smart":"prev":i=i?"add":"subtract"),Rr(this.doc,r)&&vi(this,r,i,T)}),indentSelection:$t(function(r){for(var i=this.doc.sel.ranges,T=-1,N=0;N<i.length;N++){var K=i[N];if(K.empty())K.head.line>T&&(vi(this,K.head.line,r,!0),T=K.head.line,N==this.doc.sel.primIndex&&wn(this));else{var z=K.from(),Y=K.to(),oe=Math.max(T,z.line);T=Math.min(this.lastLine(),Y.line-(Y.ch?0:1))+1;for(var de=oe;de<T;++de)vi(this,de,r);var Te=this.doc.sel.ranges;z.ch==0&&i.length==Te.length&&Te[N].from().ch>0&&Ca(this.doc,N,new vt(z,Te[N].to()),he)}}}),getTokenAt:function(r,i){return _r(this,r,i)},getLineTokens:function(r,i){return _r(this,Ue(r),i,!0)},getTokenTypeAt:function(r){r=lt(this.doc,r);var i=Bn(this,et(this.doc,r.line)),T=0,N=(i.length-1)/2,K=r.ch,z;if(K==0)z=i[2];else for(;;){var Y=T+N>>1;if((Y?i[Y*2-1]:0)>=K)N=Y;else if(i[Y*2+1]<K)T=Y+1;else{z=i[Y*2+2];break}}var oe=z?z.indexOf("overlay "):-1;return oe<0?z:oe==0?null:z.slice(0,oe-1)},getModeAt:function(r){var i=this.doc.mode;return i.innerMode?e.innerMode(i,this.getTokenAt(r).state).mode:i},getHelper:function(r,i){return this.getHelpers(r,i)[0]},getHelpers:function(r,i){var T=[];if(!n.hasOwnProperty(i))return T;var N=n[i],K=this.getModeAt(r);if(typeof K[i]=="string")N[K[i]]&&T.push(N[K[i]]);else if(K[i])for(var z=0;z<K[i].length;z++){var Y=N[K[i][z]];Y&&T.push(Y)}else K.helperType&&N[K.helperType]?T.push(N[K.helperType]):N[K.name]&&T.push(N[K.name]);for(var oe=0;oe<N._global.length;oe++){var de=N._global[oe];de.pred(K,this)&&q(T,de.val)==-1&&T.push(de.val)}return T},getStateAfter:function(r,i){var T=this.doc;return r=$r(T,r==null?T.first+T.size-1:r),rr(this,r+1,i).state},cursorCoords:function(r,i){var T,N=this.doc.sel.primary();return r==null?T=N.head:typeof r=="object"?T=lt(this.doc,r):T=r?N.from():N.to(),pr(this,T,i||"page")},charCoords:function(r,i){return ia(this,lt(this.doc,r),i||"page")},coordsChar:function(r,i){return r=ro(this,r,i||"page"),oa(this,r.left,r.top)},lineAtHeight:function(r,i){return r=ro(this,{top:r,left:0},i||"page").top,Cr(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,i,T){var N=!1,K;if(typeof r=="number"){var z=this.doc.first+this.doc.size-1;r<this.doc.first?r=this.doc.first:r>z&&(r=z,N=!0),K=et(this.doc,r)}else K=r;return Oi(this,K,{top:0,left:0},i||"page",T||N).top+(N?this.doc.height-At(K):0)},defaultTextHeight:function(){return xn(this.display)},defaultCharWidth:function(){return Tn(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,i,T,N,K){var z=this.display;r=pr(this,lt(this.doc,r));var Y=r.bottom,oe=r.left;if(i.style.position="absolute",i.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(i),z.sizer.appendChild(i),N=="over")Y=r.top;else if(N=="above"||N=="near"){var de=Math.max(z.wrapper.clientHeight,this.doc.height),Te=Math.max(z.sizer.clientWidth,z.lineSpace.clientWidth);(N=="above"||r.bottom+i.offsetHeight>de)&&r.top>i.offsetHeight?Y=r.top-i.offsetHeight:r.bottom+i.offsetHeight<=de&&(Y=r.bottom),oe+i.offsetWidth>Te&&(oe=Te-i.offsetWidth)}i.style.top=Y+"px",i.style.left=i.style.right="",K=="right"?(oe=z.sizer.clientWidth-i.offsetWidth,i.style.right="0px"):(K=="left"?oe=0:K=="middle"&&(oe=(z.sizer.clientWidth-i.offsetWidth)/2),i.style.left=oe+"px"),T&&Js(this,{left:oe,top:Y,right:oe+i.offsetWidth,bottom:Y+i.offsetHeight})},triggerOnKeyDown:$t(ls),triggerOnKeyPress:$t(ds),triggerOnKeyUp:us,triggerOnMouseDown:$t(cs),execCommand:function(r){if(hi.hasOwnProperty(r))return hi[r].call(null,this)},triggerElectric:$t(function(r){ys(this,r)}),findPosH:function(r,i,T,N){var K=1;i<0&&(K=-1,i=-i);for(var z=lt(this.doc,r),Y=0;Y<i&&!(z=Ma(this.doc,z,K,T,N),z.hitSide);++Y);return z},moveH:$t(function(r,i){var T=this;this.extendSelectionsBy(function(N){return T.display.shift||T.doc.extend||N.empty()?Ma(T.doc,N.head,r,i,T.options.rtlMoveVisually):r<0?N.from():N.to()},pe)}),deleteH:$t(function(r,i){var T=this.doc.sel,N=this.doc;T.somethingSelected()?N.replaceSelection("",null,"+delete"):Pn(this,function(K){var z=Ma(N,K.head,r,i,!1);return r<0?{from:z,to:K.head}:{from:K.head,to:z}})}),findPosV:function(r,i,T,N){var K=1,z=N;i<0&&(K=-1,i=-i);for(var Y=lt(this.doc,r),oe=0;oe<i;++oe){var de=pr(this,Y,"div");if(z==null?z=de.left:de.left=z,Y=Ts(this,de,K,T),Y.hitSide)break}return Y},moveV:$t(function(r,i){var T=this,N=this.doc,K=[],z=!this.display.shift&&!N.extend&&N.sel.somethingSelected();if(N.extendSelectionsBy(function(oe){if(z)return r<0?oe.from():oe.to();var de=pr(T,oe.head,"div");oe.goalColumn!=null&&(de.left=oe.goalColumn),K.push(de.left);var Te=Ts(T,de,r,i);return i=="page"&&oe==N.sel.primary()&&ma(T,ia(T,Te,"div").top-de.top),Te},pe),K.length)for(var Y=0;Y<N.sel.ranges.length;Y++)N.sel.ranges[Y].goalColumn=K[Y]}),findWordAt:function(r){var i=this.doc,T=et(i,r.line).text,N=r.ch,K=r.ch;if(T){var z=this.getHelper(r,"wordChars");(r.sticky=="before"||K==T.length)&&N?--N:++K;for(var Y=T.charAt(N),oe=De(Y,z)?function(de){return De(de,z)}:/\s/.test(Y)?function(de){return/\s/.test(de)}:function(de){return!/\s/.test(de)&&!De(de)};N>0&&oe(T.charAt(N-1));)--N;for(;K<T.length&&oe(T.charAt(K));)++K}return new vt(Ue(r.line,N),Ue(r.line,K))},toggleOverwrite:function(r){if(r!=null&&r==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?F(this.display.cursorDiv,"CodeMirror-overwrite"):h(this.display.cursorDiv,"CodeMirror-overwrite"),Re(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==M()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:$t(function(r,i){Zn(this,r,i)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-br(this)-this.display.barHeight,width:r.scrollWidth-br(this)-this.display.barWidth,clientHeight:ta(this),clientWidth:en(this)}},scrollIntoView:$t(function(r,i){r==null?(r={from:this.doc.sel.primary().head,to:null},i==null&&(i=this.options.cursorScrollMargin)):typeof r=="number"?r={from:Ue(r,0),to:null}:r.from==null&&(r={from:r,to:null}),r.to||(r.to=r.from),r.margin=i||0,r.from.line!=null?Qs(this,r):mo(this,r.from,r.to,r.margin)}),setSize:$t(function(r,i){var T=this,N=function(z){return typeof z=="number"||/^\d+$/.test(String(z))?z+"px":z};r!=null&&(this.display.wrapper.style.width=N(r)),i!=null&&(this.display.wrapper.style.height=N(i)),this.options.lineWrapping&&qa(this);var K=this.display.viewFrom;this.doc.iter(K,this.display.viewTo,function(z){if(z.widgets){for(var Y=0;Y<z.widgets.length;Y++)if(z.widgets[Y].noHScroll){Fr(T,K,"widget");break}}++K}),this.curOp.forceUpdate=!0,Re(this,"refresh",this)}),operation:function(r){return nr(this,r)},startOperation:function(){return sn(this)},endOperation:function(){return ln(this)},refresh:$t(function(){var r=this.display.cachedTextHeight;Qt(this),this.curOp.forceUpdate=!0,Jn(this),Zn(this,this.doc.scrollLeft,this.doc.scrollTop),va(this.display),(r==null||Math.abs(r-xn(this.display))>.5||this.options.lineWrapping)&&da(this),Re(this,"refresh",this)}),swapDoc:$t(function(r){var i=this.doc;return i.cm=null,this.state.selectingText&&this.state.selectingText(),Lo(this,r),Jn(this),this.display.input.reset(),Zn(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,Ht(this,"swapDoc",this,i),i}),phrase:function(r){var i=this.options.phrases;return i&&Object.prototype.hasOwnProperty.call(i,r)?i[r]:r},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},ue(e),e.registerHelper=function(r,i,T){n.hasOwnProperty(r)||(n[r]=e[r]={_global:[]}),n[r][i]=T},e.registerGlobalHelper=function(r,i,T,N){e.registerHelper(r,i,N),n[r]._global.push({pred:T,val:N})}}function Ma(e,t,n,r,i){var T=t,N=n,K=et(e,t.line),z=i&&e.direction=="rtl"?-n:n;function Y(){var Ye=t.line+z;return Ye<e.first||Ye>=e.first+e.size?!1:(t=new Ue(Ye,t.ch,t.sticky),K=et(e,Ye))}function oe(Ye){var Ge;if(r=="codepoint"){var Qe=K.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(Qe)?Ge=null:Ge=new Ue(t.line,Math.max(0,Math.min(K.text.length,t.ch+n*(Qe>=55296&&Qe<56320?2:1))),-n)}else i?Ge=Ml(e.cm,K,t,n):Ge=_a(K,t,n);if(Ge==null)if(!Ye&&Y())t=La(i,e.cm,K,t.line,z);else return!1;else t=Ge;return!0}if(r=="char"||r=="codepoint")oe();else if(r=="column")oe(!0);else if(r=="word"||r=="group")for(var de=null,Te=r=="group",ye=e.cm&&e.cm.getHelper(t,"wordChars"),Pe=!0;!(n<0&&!oe(!Pe));Pe=!1){var Me=K.text.charAt(t.ch)||`
|
|
`,Ne=De(Me,ye)?"w":Te&&Me==`
|
|
`?"n":!Te||/\s/.test(Me)?null:"p";if(Te&&!Pe&&!Ne&&(Ne="s"),de&&de!=Ne){n<0&&(n=1,oe(),t.sticky="after");break}if(Ne&&(de=Ne),n>0&&!oe(!Pe))break}var Ke=Hi(e,t,T,N,!0);return Be(T,Ke)&&(Ke.hitSide=!0),Ke}function Ts(e,t,n,r){var i=e.doc,T=t.left,N;if(r=="page"){var K=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),z=Math.max(K-.5*xn(e.display),3);N=(n>0?t.bottom:t.top)+n*z}else r=="line"&&(N=n>0?t.bottom+3:t.top-3);for(var Y;!(Y=oa(e,T,N),!Y.outside);){if(n<0?N<=0:N>=i.height){Y.hitSide=!0;break}N+=n*5}return Y}var bt=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new X,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};bt.prototype.init=function(e){var t=this,n=this,r=n.cm,i=n.div=e.lineDiv;Es(i,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function T(K){for(var z=K.target;z;z=z.parentNode){if(z==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(z.className))break}return!1}Ae(i,"paste",function(K){if(!T(K)||Fe(r,K)||vs(K,r))return;I<=11&&setTimeout(Ft(r,function(){return t.updateFromDOM()}),20)}),Ae(i,"compositionstart",function(K){t.composing={data:K.data,done:!1}}),Ae(i,"compositionupdate",function(K){t.composing||(t.composing={data:K.data,done:!1})}),Ae(i,"compositionend",function(K){t.composing&&(K.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Ae(i,"touchstart",function(){return n.forceCompositionEnd()}),Ae(i,"input",function(){t.composing||t.readFromDOMSoon()});function N(K){if(!T(K)||Fe(r,K))return;if(r.somethingSelected())Yi({lineWise:!1,text:r.getSelections()}),K.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var z=bs(r);Yi({lineWise:!0,text:z.text}),K.type=="cut"&&r.operation(function(){r.setSelections(z.ranges,0,he),r.replaceSelection("",null,"cut")})}else return;if(K.clipboardData){K.clipboardData.clearData();var Y=vr.text.join(`
|
|
`);if(K.clipboardData.setData("Text",Y),K.clipboardData.getData("Text")==Y){K.preventDefault();return}}var oe=xs(),de=oe.firstChild;r.display.lineSpace.insertBefore(oe,r.display.lineSpace.firstChild),de.value=vr.text.join(`
|
|
`);var Te=document.activeElement;W(de),setTimeout(function(){r.display.lineSpace.removeChild(oe),Te.focus(),Te==i&&n.showPrimarySelection()},50)}Ae(i,"copy",N),Ae(i,"cut",N)},bt.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},bt.prototype.prepareSelection=function(){var e=lo(this.cm,!1);return e.focus=document.activeElement==this.div,e},bt.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},bt.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},bt.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,n=t.doc.sel.primary(),r=n.from(),i=n.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||i.line<t.display.viewFrom){e.removeAllRanges();return}var T=$i(t,e.anchorNode,e.anchorOffset),N=$i(t,e.focusNode,e.focusOffset);if(T&&!T.bad&&N&&!N.bad&&ut(Yr(T,N),r)==0&&ut(hn(T,N),i)==0)return;var K=t.display.view,z=r.line>=t.display.viewFrom&&Ss(t,r)||{node:K[0].measure.map[2],offset:0},Y=i.line<t.display.viewTo&&Ss(t,i);if(!Y){var oe=K[K.length-1].measure,de=oe.maps?oe.maps[oe.maps.length-1]:oe.map;Y={node:de[de.length-1],offset:de[de.length-2]-de[de.length-3]}}if(!z||!Y){e.removeAllRanges();return}var Te=e.rangeCount&&e.getRangeAt(0),ye;try{ye=p(z.node,z.offset,Y.offset,Y.node)}catch(Pe){}ye&&(!_&&t.state.focused?(e.collapse(z.node,z.offset),ye.collapsed||(e.removeAllRanges(),e.addRange(ye))):(e.removeAllRanges(),e.addRange(ye)),Te&&e.anchorNode==null?e.addRange(Te):_&&this.startGracePeriod()),this.rememberSelection()},bt.prototype.startGracePeriod=function(){var e=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation(function(){return e.cm.curOp.selectionChanged=!0})},20)},bt.prototype.showMultipleSelections=function(e){l(this.cm.display.cursorDiv,e.cursors),l(this.cm.display.selectionDiv,e.selection)},bt.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},bt.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return y(this.div,t)},bt.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},bt.prototype.blur=function(){this.div.blur()},bt.prototype.getField=function(){return this.div},bt.prototype.supportsTouch=function(){return!0},bt.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():nr(this.cm,function(){return e.cm.curOp.selectionChanged=!0});function t(){e.cm.state.focused&&(e.pollSelection(),e.polling.set(e.cm.options.pollInterval,t))}this.polling.set(this.cm.options.pollInterval,t)},bt.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},bt.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(d&&x&&this.cm.display.gutterSpecs.length&&eu(e.anchorNode)){this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();return}if(this.composing)return;this.rememberSelection();var n=$i(t,e.anchorNode,e.anchorOffset),r=$i(t,e.focusNode,e.focusOffset);n&&r&&nr(t,function(){Vt(t.doc,Br(n,r),he),(n.bad||r.bad)&&(t.curOp.selectionChanged=!0)})},bt.prototype.pollContent=function(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,n=e.doc.sel.primary(),r=n.from(),i=n.to();if(r.ch==0&&r.line>e.firstLine()&&(r=Ue(r.line-1,et(e.doc,r.line-1).length)),i.ch==et(e.doc,i.line).text.length&&i.line<e.lastLine()&&(i=Ue(i.line+1,0)),r.line<t.viewFrom||i.line>t.viewTo-1)return!1;var T,N,K;r.line==t.viewFrom||(T=nn(e,r.line))==0?(N=gt(t.view[0].line),K=t.view[0].node):(N=gt(t.view[T].line),K=t.view[T-1].node.nextSibling);var z=nn(e,i.line),Y,oe;if(z==t.view.length-1?(Y=t.viewTo-1,oe=t.lineDiv.lastChild):(Y=gt(t.view[z+1].line)-1,oe=t.view[z+1].node.previousSibling),!K)return!1;for(var de=e.doc.splitLines(tu(e,K,oe,N,Y)),Te=wr(e.doc,Ue(N,0),Ue(Y,et(e.doc,Y).text.length));de.length>1&&Te.length>1;)if($(de)==$(Te))de.pop(),Te.pop(),Y--;else if(de[0]==Te[0])de.shift(),Te.shift(),N++;else break;for(var ye=0,Pe=0,Me=de[0],Ne=Te[0],Ke=Math.min(Me.length,Ne.length);ye<Ke&&Me.charCodeAt(ye)==Ne.charCodeAt(ye);)++ye;for(var Ye=$(de),Ge=$(Te),Qe=Math.min(Ye.length-(de.length==1?ye:0),Ge.length-(Te.length==1?ye:0));Pe<Qe&&Ye.charCodeAt(Ye.length-Pe-1)==Ge.charCodeAt(Ge.length-Pe-1);)++Pe;if(de.length==1&&Te.length==1&&N==r.line)for(;ye&&ye>r.ch&&Ye.charCodeAt(Ye.length-Pe-1)==Ge.charCodeAt(Ge.length-Pe-1);)ye--,Pe++;de[de.length-1]=Ye.slice(0,Ye.length-Pe).replace(/^\u200b+/,""),de[0]=de[0].slice(ye).replace(/\u200b+$/,"");var at=Ue(N,ye),nt=Ue(Y,Te.length?$(Te).length-Pe:0);if(de.length>1||de[0]||ut(at,nt))return Dn(e.doc,de,at,nt,"+input"),!0},bt.prototype.ensurePolled=function(){this.forceCompositionEnd()},bt.prototype.reset=function(){this.forceCompositionEnd()},bt.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},bt.prototype.readFromDOMSoon=function(){var e=this;if(this.readDOMTimeout!=null)return;this.readDOMTimeout=setTimeout(function(){if(e.readDOMTimeout=null,e.composing)if(e.composing.done)e.composing=null;else return;e.updateFromDOM()},80)},bt.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&nr(this.cm,function(){return Qt(e.cm)})},bt.prototype.setUneditable=function(e){e.contentEditable="false"},bt.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||Ft(this.cm,ka)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},bt.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},bt.prototype.onContextMenu=function(){},bt.prototype.resetPosition=function(){},bt.prototype.needsContentAttribute=!0;function Ss(e,t){var n=ra(e,t.line);if(!n||n.hidden)return null;var r=et(e.doc,t.line),i=Ya(n,r,t.line),T=He(r,e.doc.direction),N="left";if(T){var K=je(T,t.ch);N=K%2?"right":"left"}var z=Qa(i.map,t.ch,N);return z.offset=z.collapse=="right"?z.end:z.start,z}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function Mn(e,t){return t&&(e.bad=!0),e}function tu(e,t,n,r,i){var T="",N=!1,K=e.doc.lineSeparator(),z=!1;function Y(ye){return function(Pe){return Pe.id==ye}}function oe(){N&&(T+=K,z&&(T+=K),N=z=!1)}function de(ye){ye&&(oe(),T+=ye)}function Te(ye){if(ye.nodeType==1){var Pe=ye.getAttribute("cm-text");if(Pe){de(Pe);return}var Me=ye.getAttribute("cm-marker"),Ne;if(Me){var Ke=e.findMarks(Ue(r,0),Ue(i+1,0),Y(+Me));Ke.length&&(Ne=Ke[0].find(0))&&de(wr(e.doc,Ne.from,Ne.to).join(K));return}if(ye.getAttribute("contenteditable")=="false")return;var Ye=/^(pre|div|p|li|table|br)$/i.test(ye.nodeName);if(!/^br$/i.test(ye.nodeName)&&ye.textContent.length==0)return;Ye&&oe();for(var Ge=0;Ge<ye.childNodes.length;Ge++)Te(ye.childNodes[Ge]);/^(pre|p)$/i.test(ye.nodeName)&&(z=!0),Ye&&(N=!0)}else ye.nodeType==3&&de(ye.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(Te(t),t==n);)t=t.nextSibling,z=!1;return T}function $i(e,t,n){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[n],!r)return Mn(e.clipPos(Ue(e.display.viewTo-1)),!0);t=null,n=0}else for(r=t;;r=r.parentNode){if(!r||r==e.display.lineDiv)return null;if(r.parentNode&&r.parentNode==e.display.lineDiv)break}for(var i=0;i<e.display.view.length;i++){var T=e.display.view[i];if(T.node==r)return ru(T,t,n)}}function ru(e,t,n){var r=e.text.firstChild,i=!1;if(!t||!y(r,t))return Mn(Ue(gt(e.line),0),!0);if(t==r&&(i=!0,t=r.childNodes[n],n=0,!t)){var T=e.rest?$(e.rest):e.line;return Mn(Ue(gt(T),T.text.length),i)}var N=t.nodeType==3?t:null,K=t;for(!N&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(N=t.firstChild,n&&(n=N.nodeValue.length));K.parentNode!=r;)K=K.parentNode;var z=e.measure,Y=z.maps;function oe(Ne,Ke,Ye){for(var Ge=-1;Ge<(Y?Y.length:0);Ge++)for(var Qe=Ge<0?z.map:Y[Ge],at=0;at<Qe.length;at+=3){var nt=Qe[at+2];if(nt==Ne||nt==Ke){var ht=gt(Ge<0?e.line:e.rest[Ge]),Tt=Qe[at]+Ye;return(Ye<0||nt!=Ne)&&(Tt=Qe[at+(Ye?1:0)]),Ue(ht,Tt)}}}var de=oe(N,K,n);if(de)return Mn(de,i);for(var Te=K.nextSibling,ye=N?N.nodeValue.length-n:0;Te;Te=Te.nextSibling){if(de=oe(Te,Te.firstChild,0),de)return Mn(Ue(de.line,de.ch-ye),i);ye+=Te.textContent.length}for(var Pe=K.previousSibling,Me=n;Pe;Pe=Pe.previousSibling){if(de=oe(Pe,Pe.firstChild,-1),de)return Mn(Ue(de.line,de.ch+Me),i);Me+=Pe.textContent.length}}var Pt=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new X,this.hasSelection=!1,this.composing=null};Pt.prototype.init=function(e){var t=this,n=this,r=this.cm;this.createField(e);var i=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),b&&(i.style.width="0px"),Ae(i,"input",function(){B&&I>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),Ae(i,"paste",function(N){if(Fe(r,N)||vs(N,r))return;r.state.pasteIncoming=+new Date,n.fastPoll()});function T(N){if(Fe(r,N))return;if(r.somethingSelected())Yi({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var K=bs(r);Yi({lineWise:!0,text:K.text}),N.type=="cut"?r.setSelections(K.ranges,null,he):(n.prevInput="",i.value=K.text.join(`
|
|
`),W(i))}else return;N.type=="cut"&&(r.state.cutIncoming=+new Date)}Ae(i,"cut",T),Ae(i,"copy",T),Ae(e.scroller,"paste",function(N){if(Lr(e,N)||Fe(r,N))return;if(!i.dispatchEvent){r.state.pasteIncoming=+new Date,n.focus();return}var K=new Event("paste");K.clipboardData=N.clipboardData,i.dispatchEvent(K)}),Ae(e.lineSpace,"selectstart",function(N){Lr(e,N)||J(N)}),Ae(i,"compositionstart",function(){var N=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:N,range:r.markText(N,r.getCursor("to"),{className:"CodeMirror-composing"})}}),Ae(i,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},Pt.prototype.createField=function(e){this.wrapper=xs(),this.textarea=this.wrapper.firstChild},Pt.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},Pt.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=lo(e);if(e.options.moveInputWithCursor){var i=pr(e,n.sel.primary().head,"div"),T=t.wrapper.getBoundingClientRect(),N=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+N.top-T.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+N.left-T.left))}return r},Pt.prototype.showSelection=function(e){var t=this.cm,n=t.display;l(n.cursorDiv,e.cursors),l(n.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Pt.prototype.reset=function(e){if(this.contextMenuPending||this.composing)return;var t=this.cm;if(t.somethingSelected()){this.prevInput="";var n=t.getSelection();this.textarea.value=n,t.state.focused&&W(this.textarea),B&&I>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",B&&I>=9&&(this.hasSelection=null))},Pt.prototype.getField=function(){return this.textarea},Pt.prototype.supportsTouch=function(){return!1},Pt.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!o||M()!=this.textarea))try{this.textarea.focus()}catch(e){}},Pt.prototype.blur=function(){this.textarea.blur()},Pt.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Pt.prototype.receivedFocus=function(){this.slowPoll()},Pt.prototype.slowPoll=function(){var e=this;if(this.pollingFast)return;this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},Pt.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function n(){var r=t.poll();!r&&!e?(e=!0,t.polling.set(60,n)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,n)},Pt.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||st(n)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=n.value;if(i==r&&!t.somethingSelected())return!1;if(B&&I>=9&&this.hasSelection===i||s&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var T=i.charCodeAt(0);if(T==8203&&!r&&(r="\u200B"),T==8666)return this.reset(),this.cm.execCommand("undo")}for(var N=0,K=Math.min(r.length,i.length);N<K&&r.charCodeAt(N)==i.charCodeAt(N);)++N;return nr(t,function(){ka(t,i.slice(N),r.length-N,null,e.composing?"*compose":null),i.length>1e3||i.indexOf(`
|
|
`)>-1?n.value=e.prevInput="":e.prevInput=i,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},Pt.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Pt.prototype.onKeyPress=function(){B&&I>=9&&(this.hasSelection=null),this.fastPoll()},Pt.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var T=rn(n,e),N=r.scroller.scrollTop;if(!T||A)return;var K=n.options.resetSelectionOnContextMenu;K&&n.doc.sel.contains(T)==-1&&Ft(n,Vt)(n.doc,Br(T),he);var z=i.style.cssText,Y=t.wrapper.style.cssText,oe=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",i.style.cssText=`position: absolute; width: 30px; height: 30px;
|
|
top: `+(e.clientY-oe.top-5)+"px; left: "+(e.clientX-oe.left-5)+`px;
|
|
z-index: 1000; background: `+(B?"rgba(255, 255, 255, .05)":"transparent")+`;
|
|
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var de;D&&(de=window.scrollY),r.input.focus(),D&&window.scrollTo(null,de),r.input.reset(),n.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=ye,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll);function Te(){if(i.selectionStart!=null){var Me=n.somethingSelected(),Ne="\u200B"+(Me?i.value:"");i.value="\u21DA",i.value=Ne,t.prevInput=Me?"":"\u200B",i.selectionStart=1,i.selectionEnd=Ne.length,r.selForContextMenu=n.doc.sel}}function ye(){if(t.contextMenuPending!=ye)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=Y,i.style.cssText=z,B&&I<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=N),i.selectionStart!=null){(!B||B&&I<9)&&Te();var Me=0,Ne=function(){r.selForContextMenu==n.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&t.prevInput=="\u200B"?Ft(n,Wo)(n):Me++<10?r.detectingSelectAll=setTimeout(Ne,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(Ne,200)}}if(B&&I>=9&&Te(),w){ie(e);var Pe=function(){Je(window,"mouseup",Pe),setTimeout(ye,20)};Ae(window,"mouseup",Pe)}else setTimeout(ye,50)},Pt.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},Pt.prototype.setUneditable=function(){},Pt.prototype.needsContentAttribute=!1;function nu(e,t){if(t=t?P(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),t.autofocus==null){var n=M();t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function r(){e.value=K.getValue()}var i;if(e.form&&(Ae(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var T=e.form;i=T.submit;try{var N=T.submit=function(){r(),T.submit=i,T.submit(),T.submit=N}}catch(z){}}t.finishInit=function(z){z.save=r,z.getTextArea=function(){return e},z.toTextArea=function(){z.toTextArea=isNaN,r(),e.parentNode.removeChild(z.getWrapperElement()),e.style.display="",e.form&&(Je(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=i))}},e.style.display="none";var K=_t(function(z){return e.parentNode.insertBefore(z,e.nextSibling)},t);return K}function iu(e){e.off=Je,e.on=Ae,e.wheelEventPixels=cl,e.Doc=Zt,e.splitLines=mt,e.countColumn=H,e.findColumn=ve,e.isWordChar=we,e.Pass=Ee,e.signal=Re,e.Line=wt,e.changeEnd=jr,e.scrollbarModel=vo,e.Pos=Ue,e.cmpPos=ut,e.modes=Wt,e.mimeModes=pt,e.resolveMode=lr,e.getMode=Sr,e.modeExtensions=hr,e.extendMode=yi,e.copyState=ur,e.startState=cn,e.innerMode=Vr,e.commands=hi,e.keyMap=Dr,e.keyName=ns,e.isModifierKey=ts,e.lookupKey=Rn,e.normalizeKeyMap=kl,e.StringStream=Ct,e.SharedTextMarker=di,e.TextMarker=Hr,e.LineWidget=ui,e.e_preventDefault=J,e.e_stopPropagation=Q,e.e_stop=ie,e.addClass=F,e.contains=y,e.rmClass=h,e.keyNames=Kr}$l(_t),ql(_t);var au="iter insert remove copy getEditor constructor".split(" ");for(var Ji in Zt.prototype)Zt.prototype.hasOwnProperty(Ji)&&q(au,Ji)<0&&(_t.prototype[Ji]=function(e){return function(){return e.apply(this.doc,arguments)}}(Zt.prototype[Ji]));return ue(Zt),_t.inputStyles={textarea:Pt,contenteditable:bt},_t.defineMode=function(e){!_t.defaults.mode&&e!="null"&&(_t.defaults.mode=e),Tr.apply(this,arguments)},_t.defineMIME=zr,_t.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),_t.defineMIME("text/plain","null"),_t.defineExtension=function(e,t){_t.prototype[e]=t},_t.defineDocExtension=function(e,t){Zt.prototype[e]=t},_t.fromTextArea=nu,iu(_t),_t.version="5.58.2",_t})},Y1PL:function(ot,We,ee){"use strict";ee.r(We),ee.d(We,"ResizableTextArea",function(){return q});var ne=ee("wx14"),V=ee("1OyB"),_=ee("vuIU"),G=ee("Ji7U"),U=ee("LK+K"),R=ee("q1tI"),B=ee("VTBJ"),I=ee("rePB"),D=ee("Zm9Q"),L=ee("Kwbf"),x=ee("c+Xe"),A=ee("m+aA"),k=ee("bdgK"),C=new Map;function E(he){he.forEach(function(xe){var pe,ve=xe.target;(pe=C.get(ve))===null||pe===void 0||pe.forEach(function(ce){return ce(ve)})})}var b=new k.default(E),d=null,o=null;function s(he,xe){C.has(he)||(C.set(he,new Set),b.observe(he)),C.get(he).add(xe)}function u(he,xe){C.has(he)&&(C.get(he).delete(xe),C.get(he).size||(b.unobserve(he),C.delete(he)))}var S=function(he){Object(G.a)(pe,he);var xe=Object(U.a)(pe);function pe(){return Object(V.a)(this,pe),xe.apply(this,arguments)}return Object(_.a)(pe,[{key:"render",value:function(){return this.props.children}}]),pe}(R.Component),f=R.createContext(null);function m(he){var xe=he.children,pe=he.onBatchResize,ve=R.useRef(0),ce=R.useRef([]),fe=R.useContext(f),$=R.useCallback(function(ae,Z,ge){ve.current+=1;var Se=ve.current;ce.current.push({size:ae,element:Z,data:ge}),Promise.resolve().then(function(){Se===ve.current&&(pe==null||pe(ce.current),ce.current=[])}),fe==null||fe(ae,Z,ge)},[pe,fe]);return R.createElement(f.Provider,{value:$},xe)}function w(he){var xe=he.children,pe=he.disabled,ve=R.useRef(null),ce=R.useRef(null),fe=R.useContext(f),$=R.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),ae=R.isValidElement(xe)&&Object(x.c)(xe),Z=ae?xe.ref:null,ge=R.useMemo(function(){return Object(x.a)(Z,ve)},[Z,ve]),Se=R.useRef(he);Se.current=he;var me=R.useCallback(function(we){var De=Se.current,Oe=De.onResize,ke=De.data,Le=we.getBoundingClientRect(),_e=Le.width,ze=Le.height,Xe=we.offsetWidth,Ve=we.offsetHeight,je=Math.floor(_e),qe=Math.floor(ze);if($.current.width!==je||$.current.height!==qe||$.current.offsetWidth!==Xe||$.current.offsetHeight!==Ve){var He={width:je,height:qe,offsetWidth:Xe,offsetHeight:Ve};$.current=He;var $e=Xe===Math.round(_e)?_e:Xe,Ae=Ve===Math.round(ze)?ze:Ve,Ze=Object(B.a)(Object(B.a)({},He),{},{offsetWidth:$e,offsetHeight:Ae});fe==null||fe(Ze,we,ke),Oe&&Promise.resolve().then(function(){Oe(Ze,we)})}},[]);return R.useEffect(function(){var we=Object(A.a)(ve.current)||Object(A.a)(ce.current);return we&&!pe&&s(we,me),function(){return u(we,me)}},[ve.current,pe]),R.createElement(S,{ref:ce},ae?R.cloneElement(xe,{ref:ge}):xe)}var v="rc-observer-key";function h(he){var xe=he.children,pe=Object(D.a)(xe);return pe.map(function(ve,ce){var fe=(ve==null?void 0:ve.key)||"".concat(v,"-").concat(ce);return R.createElement(w,Object(ne.a)({},he,{key:fe}),ve)})}h.Collection=m;var c=h,l=ee("bT9E"),a=ee("TSYQ"),g=ee.n(a),p=`
|
|
min-height:0 !important;
|
|
max-height:none !important;
|
|
height:0 !important;
|
|
visibility:hidden !important;
|
|
overflow:hidden !important;
|
|
position:absolute !important;
|
|
z-index:-1000 !important;
|
|
top:0 !important;
|
|
right:0 !important
|
|
`,y=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break"],M={},F;function j(he){var xe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,pe=he.getAttribute("id")||he.getAttribute("data-reactid")||he.getAttribute("name");if(xe&&M[pe])return M[pe];var ve=window.getComputedStyle(he),ce=ve.getPropertyValue("box-sizing")||ve.getPropertyValue("-moz-box-sizing")||ve.getPropertyValue("-webkit-box-sizing"),fe=parseFloat(ve.getPropertyValue("padding-bottom"))+parseFloat(ve.getPropertyValue("padding-top")),$=parseFloat(ve.getPropertyValue("border-bottom-width"))+parseFloat(ve.getPropertyValue("border-top-width")),ae=y.map(function(ge){return"".concat(ge,":").concat(ve.getPropertyValue(ge))}).join(";"),Z={sizingStyle:ae,paddingSize:fe,borderSize:$,boxSizing:ce};return xe&&pe&&(M[pe]=Z),Z}function W(he){var xe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,pe=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,ve=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;F||(F=document.createElement("textarea"),F.setAttribute("tab-index","-1"),F.setAttribute("aria-hidden","true"),document.body.appendChild(F)),he.getAttribute("wrap")?F.setAttribute("wrap",he.getAttribute("wrap")):F.removeAttribute("wrap");var ce=j(he,xe),fe=ce.paddingSize,$=ce.borderSize,ae=ce.boxSizing,Z=ce.sizingStyle;F.setAttribute("style","".concat(Z,";").concat(p)),F.value=he.value||he.placeholder||"";var ge=Number.MIN_SAFE_INTEGER,Se=Number.MAX_SAFE_INTEGER,me=F.scrollHeight,we;if(ae==="border-box"?me+=$:ae==="content-box"&&(me-=fe),pe!==null||ve!==null){F.value=" ";var De=F.scrollHeight-fe;pe!==null&&(ge=De*pe,ae==="border-box"&&(ge=ge+fe+$),me=Math.max(ge,me)),ve!==null&&(Se=De*ve,ae==="border-box"&&(Se=Se+fe+$),we=me>Se?"":"hidden",me=Math.min(Se,me))}return{height:me,minHeight:ge,maxHeight:Se,overflowY:we,resize:"none"}}var O=ee("Gytx"),P=ee.n(O),H;(function(he){he[he.NONE=0]="NONE",he[he.RESIZING=1]="RESIZING",he[he.RESIZED=2]="RESIZED"})(H||(H={}));var X=function(he){Object(G.a)(pe,he);var xe=Object(U.a)(pe);function pe(ve){var ce;return Object(V.a)(this,pe),ce=xe.call(this,ve),ce.nextFrameActionId=void 0,ce.resizeFrameId=void 0,ce.textArea=void 0,ce.saveTextArea=function(fe){ce.textArea=fe},ce.handleResize=function(fe){var $=ce.state.resizeStatus,ae=ce.props,Z=ae.autoSize,ge=ae.onResize;if($!==H.NONE)return;typeof ge=="function"&&ge(fe),Z&&ce.resizeOnNextFrame()},ce.resizeOnNextFrame=function(){cancelAnimationFrame(ce.nextFrameActionId),ce.nextFrameActionId=requestAnimationFrame(ce.resizeTextarea)},ce.resizeTextarea=function(){var fe=ce.props.autoSize;if(!fe||!ce.textArea)return;var $=fe.minRows,ae=fe.maxRows,Z=W(ce.textArea,!1,$,ae);ce.setState({textareaStyles:Z,resizeStatus:H.RESIZING},function(){cancelAnimationFrame(ce.resizeFrameId),ce.resizeFrameId=requestAnimationFrame(function(){ce.setState({resizeStatus:H.RESIZED},function(){ce.resizeFrameId=requestAnimationFrame(function(){ce.setState({resizeStatus:H.NONE}),ce.fixFirefoxAutoScroll()})})})})},ce.renderTextArea=function(){var fe=ce.props,$=fe.prefixCls,ae=$===void 0?"rc-textarea":$,Z=fe.autoSize,ge=fe.onResize,Se=fe.className,me=fe.disabled,we=ce.state,De=we.textareaStyles,Oe=we.resizeStatus,ke=Object(l.a)(ce.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Le=g()(ae,Se,Object(I.a)({},"".concat(ae,"-disabled"),me));"value"in ke&&(ke.value=ke.value||"");var _e=Object(B.a)(Object(B.a)(Object(B.a)({},ce.props.style),De),Oe===H.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return R.createElement(c,{onResize:ce.handleResize,disabled:!(Z||ge)},R.createElement("textarea",Object(ne.a)({},ke,{className:Le,style:_e,ref:ce.saveTextArea})))},ce.state={textareaStyles:{},resizeStatus:H.NONE},ce}return Object(_.a)(pe,[{key:"componentDidUpdate",value:function(ce){(ce.value!==this.props.value||!P()(ce.autoSize,this.props.autoSize))&&this.resizeTextarea()}},{key:"componentWillUnmount",value:function(){cancelAnimationFrame(this.nextFrameActionId),cancelAnimationFrame(this.resizeFrameId)}},{key:"fixFirefoxAutoScroll",value:function(){try{if(document.activeElement===this.textArea){var ce=this.textArea.selectionStart,fe=this.textArea.selectionEnd;this.textArea.setSelectionRange(ce,fe)}}catch($){}}},{key:"render",value:function(){return this.renderTextArea()}}]),pe}(R.Component),q=X,re=function(he){Object(G.a)(pe,he);var xe=Object(U.a)(pe);function pe(ve){var ce;Object(V.a)(this,pe),ce=xe.call(this,ve),ce.resizableTextArea=void 0,ce.focus=function(){ce.resizableTextArea.textArea.focus()},ce.saveTextArea=function($){ce.resizableTextArea=$},ce.handleChange=function($){var ae=ce.props.onChange;ce.setValue($.target.value,function(){ce.resizableTextArea.resizeTextarea()}),ae&&ae($)},ce.handleKeyDown=function($){var ae=ce.props,Z=ae.onPressEnter,ge=ae.onKeyDown;$.keyCode===13&&Z&&Z($),ge&&ge($)};var fe=typeof ve.value=="undefined"||ve.value===null?ve.defaultValue:ve.value;return ce.state={value:fe},ce}return Object(_.a)(pe,[{key:"setValue",value:function(ce,fe){"value"in this.props||this.setState({value:ce},fe)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return R.createElement(q,Object(ne.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(ce){return"value"in ce?{value:ce.value}:null}}]),pe}(R.Component),Ee=We.default=re},ZW9T:function(ot,We,ee){"use strict";ee.d(We,"a",function(){return S});var ne=ee("k1fw"),V=ee("miYZ"),_=ee("tsqr"),G=ee("rAM+"),U=ee("tJVT"),R=ee("PpiC"),B=ee("q1tI"),I=ee.n(B),D=ee("bdgK");function L(f,m,w,v,h){var c=m.getWordUntilPosition(w),l={startLineNumber:w.lineNumber,endLineNumber:w.lineNumber,startColumn:c.startColumn,endColumn:c.endColumn},a=v.map(function(g){return{label:g,kind:f.languages.CompletionItemKind.Keyword,insertText:g,insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:l}});return h.map(function(g){a.push(Object(ne.a)(Object(ne.a)({},g),{},{range:l}))}),a}var x=function(f){var m={label:"ifelse",kind:f.languages.CompletionItemKind.Method,insertText:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
|
|
`),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet},w=["auto","break","case","char","const","continue","default","do","double","else","enum","extern","float","for","goto","if","int","long","register","return","short","signed","sizeof","static","struct","switch","typedef","union","unsigned","void","volatile","while","inline","restrict","_Bool","_Complex","_Imaginary","_Alignas","_Alignof","_Atomic","_Static_assert","_Noreturn","_Thread_local","_Generic"];f.languages.registerCompletionItemProvider("cpp",{provideCompletionItems:function(l,a){var g=L(f,l,a,w,[m]);return{suggestions:g}}});var v=["False","None","True","and","as","assert","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","nonlocal","not","or","pass","raise","return","try","while","with","yield"];f.languages.registerCompletionItemProvider("python",{provideCompletionItems:function(l,a){var g=[{label:"print",kind:f.languages.CompletionItemKind.Snippet,insertText:["print($0)"].join(`
|
|
`),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet}],p=L(f,l,a,v,g);return{suggestions:p}}});var h=["abstract","assert","boolean","break","byte","case","catch","char","class","const","continue","default","do","double","else","enum","extends","final","finally","float","for","goto","if","implements","import","instance of","int","interface","long","native","new","package","private","protected","public","return","strictfp","short","static","super","switch","synchronized","this","throw","throws","transient","try","void","volatile","while"];f.languages.registerCompletionItemProvider("java",{provideCompletionItems:function(l,a){var g=[m,{label:"main",kind:f.languages.CompletionItemKind.Snippet,insertText:["public static void main(String[] args) {"," $0","}"].join(`
|
|
`),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"System.out.print",kind:f.languages.CompletionItemKind.Snippet,insertText:["System.out.print($0)"].join(`
|
|
`),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet}],p=L(f,l,a,h,g);return{suggestions:p}}})},A="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",k=ee("LvDl");function C(f){return/^\d+$/.test(f)?"".concat(f,"px"):f}function E(){}var b=!1,d={"Python3.6":"python","Python2.7":"python",Dynamips:"cpp",Java:"java",Web:"php",Html:"html",Hive:"sql",Hadoop:"java",SDL:"cpp",PHP:"php",Matlab:"python",Git:"python",Python:"python","C/C++":"cpp","C++":"cpp",C:"cpp",Ruby:"ruby",Shell:"shell",JavaScript:"javascript",Perl6:"perl",Kotlin:"kotlin",Elixir:"elixir",Android:"java",JavaWeb:"java",Go:"go",Spark:"sql",MachineLearning:"python",Verilog:"xml","Verilog/VNC":"xml",Docker:"dockerfile","C#":"csharp",SQLite3:"sql",Oracle:"sql",Vhdl:"vhdl",R:"r",Swift:"swift",SQLServer:"mysql",MySQL:"mysql",Mongo:"sql",PostgreSql:"pgsql",Hbase:"powershell",Sqoop:"sql",Nasm:"cpp",Kafka:"java",Flink:"java",Sml:"javascript",OpenGL:"cpp",Perl5:"perl",Orange:"python"};function o(){var f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],m=f;if(Array.isArray(f)){for(var w=0;w<f.length;w++){var v=d[f[w]];if(v)return v}return m[0]}return d[m]||m}var s=null,u=We.b=function(f){var m=f.width,w=m===void 0?"100%":m,v=f.height,h=v===void 0?"100%":v,c=f.value,l=f.language,a=l===void 0?"javascript":l,g=f.style,p=g===void 0?{}:g,y=f.options,M=y===void 0?{}:y,F=f.overrideServices,j=F===void 0?{}:F,W=f.theme,O=W===void 0?"vs-dark":W,P=f.onEditBlur,H=f.onSave,X=f.autoHeight,q=X===void 0?!1:X,re=f.forbidCopy,Ee=re===void 0?!1:re,he=f.onChange,xe=he===void 0?E:he,pe=f.editorDidMount,ve=pe===void 0?E:pe,ce=f.onFocus,fe=ce===void 0?E:ce,$=f.filename,ae=$===void 0?"educoder.txt":$,Z=Object(R.a)(f,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename"]),ge=Object(B.useRef)(),Se=Object(B.useRef)({}),me=Object(B.useRef)(),we=Object(B.useRef)(!1),De=Object(B.useRef)(),Oe=Object(B.useState)(!1),ke=Object(U.a)(Oe,2),Le=ke[0],_e=ke[1];function ze(){var te;return ge.current&&(te=new D.default(function(ie){var be=Object(G.a)(ie),Ce;try{for(be.s();!(Ce=be.n()).done;){var Ie=Ce.value;(Ie.target.offsetHeight>0||Ie.target.offsetWidth>0)&&Se.current.instance.layout()}}catch(tt){be.e(tt)}finally{be.f()}}),te.observe(ge.current)),te}function Xe(){_.b.warn(decodeURIComponent(A))}var Ve=function(){var ie=Se.current.instance;if(c!=null&&ie&&Le){var be=ie.getModel();be&&c!==be.getValue()&&(b=!0,be.setValue(c),ie.layout(),b=!1)}};Object(B.useEffect)(function(){me.current&&clearTimeout(me.current),me.current=setTimeout(function(){Ve()},500)},[c,Le,Se.current]);function je(){var te=Se.current.instance;if(te){var ie=te.getSelection(),be=Se.current.pastePos||{},Ce=new s.Range(be.startLineNumber||ie.endLineNumber,be.startColumn||ie.endColumn,be.endLineNumber||ie.endLineNumber,be.endColumn||ie.endColumn);setTimeout(function(){te.executeEdits("",[{range:Ce,text:""}])},300)}}function qe(te){(window.navigator.platform.match("Mac")?te.metaKey:te.ctrlKey)&&te.keyCode==83&&(te.preventDefault(),H())}var He=function(){if(q&&Se.current.instance){var ie=Se.current.instance.getContentHeight();J(ie<h?h:ie)}else J(h)};function $e(te){var ie=document.createEvent("MouseEvents");ie.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),te.dispatchEvent(ie)}function Ae(te,ie){var be=window.URL||window.webkitURL||window,Ce=new Blob([ie]),Ie=document.createElementNS("http://www.w3.org/1999/xhtml","a");Ie.href=be.createObjectURL(Ce),Ie.download=te,$e(Ie)}Object(B.useEffect)(function(){He()},[He]),Object(B.useEffect)(function(){ge.current&&!Le&&ee.e(26).then(ee.t.bind(null,"M/lh",7)).then(function(te){try{s=te,Se.current.instance=s.editor.create(ge.current,{value:c,language:o(a),theme:O,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0},j);var ie=Se.current.instance;if(ve(ie,s),setTimeout(function(){He(),Se.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){Ae(ae||"educoder.txt",ie.getValue())}})},500),Se.current.subscription=ie.onDidChangeModelContent(function(Ce){we.current?clearTimeout(De.current):(He(),xe(ie.getValue(),Ce)),De.current=setTimeout(function(){we.current=!1},500)}),window.Monaco||x(s),Ee&&(ie.addCommand(s.KeyMod.CtrlCmd|s.KeyMod.Shift|s.KeyCode.KEY_V,function(){return Xe(),null}),ie.addCommand(s.KeyMod.CtrlCmd|s.KeyCode.KEY_C,function(){return Xe(),null})),window.Monaco=s,P&&ie.onDidBlurEditorWidget(function(){P(ie.getValue())}),fe&&ie.onDidFocusEditorText(function(){fe(ie.getValue())}),Ee){ie.addCommand(s.KeyMod.CtrlCmd|s.KeyCode.KEY_V,function(){return Xe(),null}),ie.onDidPaste(function(Ce){Se.current.pastePos=Ce});try{window.addEventListener("paste",je)}catch(Ce){}}var be=ze();return _e(!0),function(){var Ce=Se.current.instance;Ce.dispose();var Ie=Ce.getModel();Ie&&Ie.dispose(),Se.current.subscription&&Se.current.subscription.dispose(),Ee&&window.removeEventListener("paste",je),be.unobserve(ge.current)}}catch(Ce){}})},[]),Object(B.useEffect)(function(){var te=Se.current.instance;if(te&&Le)return document.addEventListener("keydown",qe,!1),function(){document.removeEventListener("keydown",qe)}},[H,Le]),Object(B.useEffect)(function(){var te=Se.current.instance;if(te&&Le){var ie=o(a);s.editor.setModelLanguage(te.getModel(),ie),console.log("language:",a,te.getModel(),ie)}},[a,Le]),Object(B.useEffect)(function(){var te=Se.current.instance;te&&Le&&s.editor.setTheme(O)},[O,Le]),Object(B.useEffect)(function(){var te=Se.current.instance;te&&Le&&(te.updateOptions(Object(ne.a)({},M)),setTimeout(function(){te.getModel().updateOptions(Object(ne.a)({},M))},200))},[JSON.stringify(M),Le]),Object(B.useEffect)(function(){var te=Se.current.instance;te&&Le&&te.layout()},[w,h,Le]);var Ze=Object(B.useState)(C(w)),Je=Object(U.a)(Ze,2),Re=Je[0],Fe=Je[1],se=Object(B.useState)(C(h)),le=Object(U.a)(se,2),ue=le[0],J=le[1],Q=Object(ne.a)(Object(ne.a)({},p),{},{width:Re,height:ue});return I.a.createElement("div",{className:"my-monaco-editor",ref:ge,style:Q})};function S(f){var m=f.width,w=m===void 0?"100%":m,v=f.height,h=v===void 0?"100%":v,c=f.original,l=f.modified,a=f.language,g=f.options,p=g===void 0?{}:g,y=Object(B.useRef)(),M=Object(B.useState)(null),F=Object(U.a)(M,2),j=F[0],W=F[1];function O(q){var re;return y.current&&(re=new D.default(function(Ee){var he=Object(G.a)(Ee),xe;try{for(he.s();!(xe=he.n()).done;){var pe=xe.value;(pe.target.offsetHeight>0||pe.target.offsetWidth>0)&&q.layout()}}catch(ve){he.e(ve)}finally{he.f()}}),re.observe(y.current)),re}Object(B.useEffect)(function(){y.current&&ee.e(26).then(ee.t.bind(null,"M/lh",7)).then(function(q){s=q;var re=s.editor.createDiffEditor(y.current,Object(ne.a)(Object(ne.a)({enableSplitViewResizing:!1,scrollBeyondLastLine:!1,roundedSelection:!1,renderIndicators:!1,useShadows:!1,horizontal:"hidden",lineNumbers:"off",ignoreTrimWhitespace:!1,followsCaret:!0,ignoreCharChanges:!0,minimap:{enabled:!1},readOnly:!0},p),{},{wordWrap:!0}));W(re);var Ee=O(re);return function(){re.dispose();var he=re.getModel();he&&he.dispose(),Ee.unobserve(y.current)}})},[]),Object(B.useEffect)(function(){j&&j.setModel({original:s.editor.createModel(c,a),modified:s.editor.createModel(l,a)})},[c,l,a,j]);var P=C(w),H=C(h),X={width:P,height:H};return I.a.createElement("div",{className:"my-diff-editor",ref:y,style:X})}},ZpRC:function(ot,We,ee){"use strict";function ne(x){return typeof x=="object"&&x!=null&&x.nodeType===1}function V(x,A){return(!A||x!=="hidden")&&x!=="visible"&&x!=="clip"}function _(x,A){if(x.clientHeight<x.scrollHeight||x.clientWidth<x.scrollWidth){var k=getComputedStyle(x,null);return V(k.overflowY,A)||V(k.overflowX,A)||function(C){var E=function(b){if(!b.ownerDocument||!b.ownerDocument.defaultView)return null;try{return b.ownerDocument.defaultView.frameElement}catch(d){return null}}(C);return!!E&&(E.clientHeight<C.scrollHeight||E.clientWidth<C.scrollWidth)}(x)}return!1}function G(x,A,k,C,E,b,d,o){return b<x&&d>A||b>x&&d<A?0:b<=x&&o<=k||d>=A&&o>=k?b-x-C:d>A&&o<k||b<x&&o>k?d-A+E:0}var U=function(x,A){var k=window,C=A.scrollMode,E=A.block,b=A.inline,d=A.boundary,o=A.skipOverflowHiddenElements,s=typeof d=="function"?d:function(De){return De!==d};if(!ne(x))throw new TypeError("Invalid target");for(var u=document.scrollingElement||document.documentElement,S=[],f=x;ne(f)&&s(f);){if((f=f.parentElement)===u){S.push(f);break}f!=null&&f===document.body&&_(f)&&!_(document.documentElement)||f!=null&&_(f,o)&&S.push(f)}for(var m=k.visualViewport?k.visualViewport.width:innerWidth,w=k.visualViewport?k.visualViewport.height:innerHeight,v=window.scrollX||pageXOffset,h=window.scrollY||pageYOffset,c=x.getBoundingClientRect(),l=c.height,a=c.width,g=c.top,p=c.right,y=c.bottom,M=c.left,F=E==="start"||E==="nearest"?g:E==="end"?y:g+l/2,j=b==="center"?M+a/2:b==="end"?p:M,W=[],O=0;O<S.length;O++){var P=S[O],H=P.getBoundingClientRect(),X=H.height,q=H.width,re=H.top,Ee=H.right,he=H.bottom,xe=H.left;if(C==="if-needed"&&g>=0&&M>=0&&y<=w&&p<=m&&g>=re&&y<=he&&M>=xe&&p<=Ee)return W;var pe=getComputedStyle(P),ve=parseInt(pe.borderLeftWidth,10),ce=parseInt(pe.borderTopWidth,10),fe=parseInt(pe.borderRightWidth,10),$=parseInt(pe.borderBottomWidth,10),ae=0,Z=0,ge="offsetWidth"in P?P.offsetWidth-P.clientWidth-ve-fe:0,Se="offsetHeight"in P?P.offsetHeight-P.clientHeight-ce-$:0;if(u===P)ae=E==="start"?F:E==="end"?F-w:E==="nearest"?G(h,h+w,w,ce,$,h+F,h+F+l,l):F-w/2,Z=b==="start"?j:b==="center"?j-m/2:b==="end"?j-m:G(v,v+m,m,ve,fe,v+j,v+j+a,a),ae=Math.max(0,ae+h),Z=Math.max(0,Z+v);else{ae=E==="start"?F-re-ce:E==="end"?F-he+$+Se:E==="nearest"?G(re,he,X,ce,$+Se,F,F+l,l):F-(re+X/2)+Se/2,Z=b==="start"?j-xe-ve:b==="center"?j-(xe+q/2)+ge/2:b==="end"?j-Ee+fe+ge:G(xe,Ee,q,ve,fe+ge,j,j+a,a);var me=P.scrollLeft,we=P.scrollTop;F+=we-(ae=Math.max(0,Math.min(we+ae,P.scrollHeight-X+Se))),j+=me-(Z=Math.max(0,Math.min(me+Z,P.scrollWidth-q+ge)))}W.push({el:P,top:ae,left:Z})}return W};function R(x){return x===Object(x)&&Object.keys(x).length!==0}function B(x,A){A===void 0&&(A="auto");var k="scrollBehavior"in document.body.style;x.forEach(function(C){var E=C.el,b=C.top,d=C.left;E.scroll&&k?E.scroll({top:b,left:d,behavior:A}):(E.scrollTop=b,E.scrollLeft=d)})}function I(x){return x===!1?{block:"end",inline:"nearest"}:R(x)?x:{block:"start",inline:"nearest"}}function D(x,A){var k=!x.ownerDocument.documentElement.contains(x);if(R(A)&&typeof A.behavior=="function")return A.behavior(k?[]:U(x,A));if(k)return;var C=I(A);return B(U(x,C),C.behavior)}var L=We.a=D},Zss7:function(ot,We,ee){var ne;(function(V){var _=/^\s+/,G=/\s+$/,U=0,R=V.round,B=V.min,I=V.max,D=V.random;function L($,ae){if($=$||"",ae=ae||{},$ instanceof L)return $;if(!(this instanceof L))return new L($,ae);var Z=x($);this._originalInput=$,this._r=Z.r,this._g=Z.g,this._b=Z.b,this._a=Z.a,this._roundA=R(100*this._a)/100,this._format=ae.format||Z.format,this._gradientType=ae.gradientType,this._r<1&&(this._r=R(this._r)),this._g<1&&(this._g=R(this._g)),this._b<1&&(this._b=R(this._b)),this._ok=Z.ok,this._tc_id=U++}L.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var $=this.toRgb();return($.r*299+$.g*587+$.b*114)/1e3},getLuminance:function(){var $=this.toRgb(),ae,Z,ge,Se,me,we;return ae=$.r/255,Z=$.g/255,ge=$.b/255,ae<=.03928?Se=ae/12.92:Se=V.pow((ae+.055)/1.055,2.4),Z<=.03928?me=Z/12.92:me=V.pow((Z+.055)/1.055,2.4),ge<=.03928?we=ge/12.92:we=V.pow((ge+.055)/1.055,2.4),.2126*Se+.7152*me+.0722*we},setAlpha:function($){return this._a=W($),this._roundA=R(100*this._a)/100,this},toHsv:function(){var $=E(this._r,this._g,this._b);return{h:$.h*360,s:$.s,v:$.v,a:this._a}},toHsvString:function(){var $=E(this._r,this._g,this._b),ae=R($.h*360),Z=R($.s*100),ge=R($.v*100);return this._a==1?"hsv("+ae+", "+Z+"%, "+ge+"%)":"hsva("+ae+", "+Z+"%, "+ge+"%, "+this._roundA+")"},toHsl:function(){var $=k(this._r,this._g,this._b);return{h:$.h*360,s:$.s,l:$.l,a:this._a}},toHslString:function(){var $=k(this._r,this._g,this._b),ae=R($.h*360),Z=R($.s*100),ge=R($.l*100);return this._a==1?"hsl("+ae+", "+Z+"%, "+ge+"%)":"hsla("+ae+", "+Z+"%, "+ge+"%, "+this._roundA+")"},toHex:function($){return d(this._r,this._g,this._b,$)},toHexString:function($){return"#"+this.toHex($)},toHex8:function($){return o(this._r,this._g,this._b,this._a,$)},toHex8String:function($){return"#"+this.toHex8($)},toRgb:function(){return{r:R(this._r),g:R(this._g),b:R(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+R(this._r)+", "+R(this._g)+", "+R(this._b)+")":"rgba("+R(this._r)+", "+R(this._g)+", "+R(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:R(O(this._r,255)*100)+"%",g:R(O(this._g,255)*100)+"%",b:R(O(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+R(O(this._r,255)*100)+"%, "+R(O(this._g,255)*100)+"%, "+R(O(this._b,255)*100)+"%)":"rgba("+R(O(this._r,255)*100)+"%, "+R(O(this._g,255)*100)+"%, "+R(O(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:F[d(this._r,this._g,this._b,!0)]||!1},toFilter:function($){var ae="#"+s(this._r,this._g,this._b,this._a),Z=ae,ge=this._gradientType?"GradientType = 1, ":"";if($){var Se=L($);Z="#"+s(Se._r,Se._g,Se._b,Se._a)}return"progid:DXImageTransform.Microsoft.gradient("+ge+"startColorstr="+ae+",endColorstr="+Z+")"},toString:function($){var ae=!!$;$=$||this._format;var Z=!1,ge=this._a<1&&this._a>=0,Se=!ae&&ge&&($==="hex"||$==="hex6"||$==="hex3"||$==="hex4"||$==="hex8"||$==="name");return Se?$==="name"&&this._a===0?this.toName():this.toRgbString():($==="rgb"&&(Z=this.toRgbString()),$==="prgb"&&(Z=this.toPercentageRgbString()),($==="hex"||$==="hex6")&&(Z=this.toHexString()),$==="hex3"&&(Z=this.toHexString(!0)),$==="hex4"&&(Z=this.toHex8String(!0)),$==="hex8"&&(Z=this.toHex8String()),$==="name"&&(Z=this.toName()),$==="hsl"&&(Z=this.toHslString()),$==="hsv"&&(Z=this.toHsvString()),Z||this.toHexString())},clone:function(){return L(this.toString())},_applyModification:function($,ae){var Z=$.apply(null,[this].concat([].slice.call(ae)));return this._r=Z._r,this._g=Z._g,this._b=Z._b,this.setAlpha(Z._a),this},lighten:function(){return this._applyModification(m,arguments)},brighten:function(){return this._applyModification(w,arguments)},darken:function(){return this._applyModification(v,arguments)},desaturate:function(){return this._applyModification(u,arguments)},saturate:function(){return this._applyModification(S,arguments)},greyscale:function(){return this._applyModification(f,arguments)},spin:function(){return this._applyModification(h,arguments)},_applyCombination:function($,ae){return $.apply(null,[this].concat([].slice.call(ae)))},analogous:function(){return this._applyCombination(p,arguments)},complement:function(){return this._applyCombination(c,arguments)},monochromatic:function(){return this._applyCombination(y,arguments)},splitcomplement:function(){return this._applyCombination(g,arguments)},triad:function(){return this._applyCombination(l,arguments)},tetrad:function(){return this._applyCombination(a,arguments)}},L.fromRatio=function($,ae){if(typeof $=="object"){var Z={};for(var ge in $)$.hasOwnProperty(ge)&&(ge==="a"?Z[ge]=$[ge]:Z[ge]=Ee($[ge]));$=Z}return L($,ae)};function x($){var ae={r:0,g:0,b:0},Z=1,ge=null,Se=null,me=null,we=!1,De=!1;return typeof $=="string"&&($=ce($)),typeof $=="object"&&(ve($.r)&&ve($.g)&&ve($.b)?(ae=A($.r,$.g,$.b),we=!0,De=String($.r).substr(-1)==="%"?"prgb":"rgb"):ve($.h)&&ve($.s)&&ve($.v)?(ge=Ee($.s),Se=Ee($.v),ae=b($.h,ge,Se),we=!0,De="hsv"):ve($.h)&&ve($.s)&&ve($.l)&&(ge=Ee($.s),me=Ee($.l),ae=C($.h,ge,me),we=!0,De="hsl"),$.hasOwnProperty("a")&&(Z=$.a)),Z=W(Z),{ok:we,format:$.format||De,r:B(255,I(ae.r,0)),g:B(255,I(ae.g,0)),b:B(255,I(ae.b,0)),a:Z}}function A($,ae,Z){return{r:O($,255)*255,g:O(ae,255)*255,b:O(Z,255)*255}}function k($,ae,Z){$=O($,255),ae=O(ae,255),Z=O(Z,255);var ge=I($,ae,Z),Se=B($,ae,Z),me,we,De=(ge+Se)/2;if(ge==Se)me=we=0;else{var Oe=ge-Se;we=De>.5?Oe/(2-ge-Se):Oe/(ge+Se);switch(ge){case $:me=(ae-Z)/Oe+(ae<Z?6:0);break;case ae:me=(Z-$)/Oe+2;break;case Z:me=($-ae)/Oe+4;break}me/=6}return{h:me,s:we,l:De}}function C($,ae,Z){var ge,Se,me;$=O($,360),ae=O(ae,100),Z=O(Z,100);function we(ke,Le,_e){return _e<0&&(_e+=1),_e>1&&(_e-=1),_e<1/6?ke+(Le-ke)*6*_e:_e<1/2?Le:_e<2/3?ke+(Le-ke)*(2/3-_e)*6:ke}if(ae===0)ge=Se=me=Z;else{var De=Z<.5?Z*(1+ae):Z+ae-Z*ae,Oe=2*Z-De;ge=we(Oe,De,$+1/3),Se=we(Oe,De,$),me=we(Oe,De,$-1/3)}return{r:ge*255,g:Se*255,b:me*255}}function E($,ae,Z){$=O($,255),ae=O(ae,255),Z=O(Z,255);var ge=I($,ae,Z),Se=B($,ae,Z),me,we,De=ge,Oe=ge-Se;if(we=ge===0?0:Oe/ge,ge==Se)me=0;else{switch(ge){case $:me=(ae-Z)/Oe+(ae<Z?6:0);break;case ae:me=(Z-$)/Oe+2;break;case Z:me=($-ae)/Oe+4;break}me/=6}return{h:me,s:we,v:De}}function b($,ae,Z){$=O($,360)*6,ae=O(ae,100),Z=O(Z,100);var ge=V.floor($),Se=$-ge,me=Z*(1-ae),we=Z*(1-Se*ae),De=Z*(1-(1-Se)*ae),Oe=ge%6,ke=[Z,we,me,me,De,Z][Oe],Le=[De,Z,Z,we,me,me][Oe],_e=[me,me,De,Z,Z,we][Oe];return{r:ke*255,g:Le*255,b:_e*255}}function d($,ae,Z,ge){var Se=[re(R($).toString(16)),re(R(ae).toString(16)),re(R(Z).toString(16))];return ge&&Se[0].charAt(0)==Se[0].charAt(1)&&Se[1].charAt(0)==Se[1].charAt(1)&&Se[2].charAt(0)==Se[2].charAt(1)?Se[0].charAt(0)+Se[1].charAt(0)+Se[2].charAt(0):Se.join("")}function o($,ae,Z,ge,Se){var me=[re(R($).toString(16)),re(R(ae).toString(16)),re(R(Z).toString(16)),re(he(ge))];return Se&&me[0].charAt(0)==me[0].charAt(1)&&me[1].charAt(0)==me[1].charAt(1)&&me[2].charAt(0)==me[2].charAt(1)&&me[3].charAt(0)==me[3].charAt(1)?me[0].charAt(0)+me[1].charAt(0)+me[2].charAt(0)+me[3].charAt(0):me.join("")}function s($,ae,Z,ge){var Se=[re(he(ge)),re(R($).toString(16)),re(R(ae).toString(16)),re(R(Z).toString(16))];return Se.join("")}L.equals=function($,ae){return!$||!ae?!1:L($).toRgbString()==L(ae).toRgbString()},L.random=function(){return L.fromRatio({r:D(),g:D(),b:D()})};function u($,ae){ae=ae===0?0:ae||10;var Z=L($).toHsl();return Z.s-=ae/100,Z.s=P(Z.s),L(Z)}function S($,ae){ae=ae===0?0:ae||10;var Z=L($).toHsl();return Z.s+=ae/100,Z.s=P(Z.s),L(Z)}function f($){return L($).desaturate(100)}function m($,ae){ae=ae===0?0:ae||10;var Z=L($).toHsl();return Z.l+=ae/100,Z.l=P(Z.l),L(Z)}function w($,ae){ae=ae===0?0:ae||10;var Z=L($).toRgb();return Z.r=I(0,B(255,Z.r-R(255*-(ae/100)))),Z.g=I(0,B(255,Z.g-R(255*-(ae/100)))),Z.b=I(0,B(255,Z.b-R(255*-(ae/100)))),L(Z)}function v($,ae){ae=ae===0?0:ae||10;var Z=L($).toHsl();return Z.l-=ae/100,Z.l=P(Z.l),L(Z)}function h($,ae){var Z=L($).toHsl(),ge=(Z.h+ae)%360;return Z.h=ge<0?360+ge:ge,L(Z)}function c($){var ae=L($).toHsl();return ae.h=(ae.h+180)%360,L(ae)}function l($){var ae=L($).toHsl(),Z=ae.h;return[L($),L({h:(Z+120)%360,s:ae.s,l:ae.l}),L({h:(Z+240)%360,s:ae.s,l:ae.l})]}function a($){var ae=L($).toHsl(),Z=ae.h;return[L($),L({h:(Z+90)%360,s:ae.s,l:ae.l}),L({h:(Z+180)%360,s:ae.s,l:ae.l}),L({h:(Z+270)%360,s:ae.s,l:ae.l})]}function g($){var ae=L($).toHsl(),Z=ae.h;return[L($),L({h:(Z+72)%360,s:ae.s,l:ae.l}),L({h:(Z+216)%360,s:ae.s,l:ae.l})]}function p($,ae,Z){ae=ae||6,Z=Z||30;var ge=L($).toHsl(),Se=360/Z,me=[L($)];for(ge.h=(ge.h-(Se*ae>>1)+720)%360;--ae;)ge.h=(ge.h+Se)%360,me.push(L(ge));return me}function y($,ae){ae=ae||6;for(var Z=L($).toHsv(),ge=Z.h,Se=Z.s,me=Z.v,we=[],De=1/ae;ae--;)we.push(L({h:ge,s:Se,v:me})),me=(me+De)%1;return we}L.mix=function($,ae,Z){Z=Z===0?0:Z||50;var ge=L($).toRgb(),Se=L(ae).toRgb(),me=Z/100,we={r:(Se.r-ge.r)*me+ge.r,g:(Se.g-ge.g)*me+ge.g,b:(Se.b-ge.b)*me+ge.b,a:(Se.a-ge.a)*me+ge.a};return L(we)},L.readability=function($,ae){var Z=L($),ge=L(ae);return(V.max(Z.getLuminance(),ge.getLuminance())+.05)/(V.min(Z.getLuminance(),ge.getLuminance())+.05)},L.isReadable=function($,ae,Z){var ge=L.readability($,ae),Se,me;me=!1,Se=fe(Z);switch(Se.level+Se.size){case"AAsmall":case"AAAlarge":me=ge>=4.5;break;case"AAlarge":me=ge>=3;break;case"AAAsmall":me=ge>=7;break}return me},L.mostReadable=function($,ae,Z){var ge=null,Se=0,me,we,De,Oe;Z=Z||{},we=Z.includeFallbackColors,De=Z.level,Oe=Z.size;for(var ke=0;ke<ae.length;ke++)me=L.readability($,ae[ke]),me>Se&&(Se=me,ge=L(ae[ke]));return L.isReadable($,ge,{level:De,size:Oe})||!we?ge:(Z.includeFallbackColors=!1,L.mostReadable($,["#fff","#000"],Z))};var M=L.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},F=L.hexNames=j(M);function j($){var ae={};for(var Z in $)$.hasOwnProperty(Z)&&(ae[$[Z]]=Z);return ae}function W($){return $=parseFloat($),(isNaN($)||$<0||$>1)&&($=1),$}function O($,ae){X($)&&($="100%");var Z=q($);return $=B(ae,I(0,parseFloat($))),Z&&($=parseInt($*ae,10)/100),V.abs($-ae)<1e-6?1:$%ae/parseFloat(ae)}function P($){return B(1,I(0,$))}function H($){return parseInt($,16)}function X($){return typeof $=="string"&&$.indexOf(".")!=-1&&parseFloat($)===1}function q($){return typeof $=="string"&&$.indexOf("%")!=-1}function re($){return $.length==1?"0"+$:""+$}function Ee($){return $<=1&&($=$*100+"%"),$}function he($){return V.round(parseFloat($)*255).toString(16)}function xe($){return H($)/255}var pe=function(){var $="[-\\+]?\\d+%?",ae="[-\\+]?\\d*\\.\\d+%?",Z="(?:"+ae+")|(?:"+$+")",ge="[\\s|\\(]+("+Z+")[,|\\s]+("+Z+")[,|\\s]+("+Z+")\\s*\\)?",Se="[\\s|\\(]+("+Z+")[,|\\s]+("+Z+")[,|\\s]+("+Z+")[,|\\s]+("+Z+")\\s*\\)?";return{CSS_UNIT:new RegExp(Z),rgb:new RegExp("rgb"+ge),rgba:new RegExp("rgba"+Se),hsl:new RegExp("hsl"+ge),hsla:new RegExp("hsla"+Se),hsv:new RegExp("hsv"+ge),hsva:new RegExp("hsva"+Se),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function ve($){return!!pe.CSS_UNIT.exec($)}function ce($){$=$.replace(_,"").replace(G,"").toLowerCase();var ae=!1;if(M[$])$=M[$],ae=!0;else if($=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var Z;return(Z=pe.rgb.exec($))?{r:Z[1],g:Z[2],b:Z[3]}:(Z=pe.rgba.exec($))?{r:Z[1],g:Z[2],b:Z[3],a:Z[4]}:(Z=pe.hsl.exec($))?{h:Z[1],s:Z[2],l:Z[3]}:(Z=pe.hsla.exec($))?{h:Z[1],s:Z[2],l:Z[3],a:Z[4]}:(Z=pe.hsv.exec($))?{h:Z[1],s:Z[2],v:Z[3]}:(Z=pe.hsva.exec($))?{h:Z[1],s:Z[2],v:Z[3],a:Z[4]}:(Z=pe.hex8.exec($))?{r:H(Z[1]),g:H(Z[2]),b:H(Z[3]),a:xe(Z[4]),format:ae?"name":"hex8"}:(Z=pe.hex6.exec($))?{r:H(Z[1]),g:H(Z[2]),b:H(Z[3]),format:ae?"name":"hex"}:(Z=pe.hex4.exec($))?{r:H(Z[1]+""+Z[1]),g:H(Z[2]+""+Z[2]),b:H(Z[3]+""+Z[3]),a:xe(Z[4]+""+Z[4]),format:ae?"name":"hex8"}:(Z=pe.hex3.exec($))?{r:H(Z[1]+""+Z[1]),g:H(Z[2]+""+Z[2]),b:H(Z[3]+""+Z[3]),format:ae?"name":"hex"}:!1}function fe($){var ae,Z;return $=$||{level:"AA",size:"small"},ae=($.level||"AA").toUpperCase(),Z=($.size||"small").toLowerCase(),ae!=="AA"&&ae!=="AAA"&&(ae="AA"),Z!=="small"&&Z!=="large"&&(Z="small"),{level:ae,size:Z}}ot.exports?ot.exports=L:!(ne=function(){return L}.call(We,ee,We,ot),ne!==void 0&&(ot.exports=ne))})(Math)},bT9E:function(ot,We,ee){"use strict";ee.d(We,"a",function(){return V});var ne=ee("VTBJ");function V(_,G){var U=Object(ne.a)({},_);return Array.isArray(G)&&G.forEach(function(R){delete U[R]}),U}},c5Ni:function(ot,We,ee){},dejd:function(ot,We,ee){},dmUQ:function(ot,We,ee){"use strict";var ne=ee("Ff2n"),V=ee("rePB"),_=ee("1OyB"),G=ee("vuIU"),U=ee("Ji7U"),R=ee("md7G"),B=ee("foSv"),I=ee("q1tI"),D=ee.n(I),L=ee("TSYQ"),x=ee.n(L),A=ee("4IlW");function k(l,a){var g=Object.keys(l);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(l);a&&(p=p.filter(function(y){return Object.getOwnPropertyDescriptor(l,y).enumerable})),g.push.apply(g,p)}return g}function C(l){for(var a=1;a<arguments.length;a++){var g=arguments[a]!=null?arguments[a]:{};a%2?k(Object(g),!0).forEach(function(p){Object(V.a)(l,p,g[p])}):Object.getOwnPropertyDescriptors?Object.defineProperties(l,Object.getOwnPropertyDescriptors(g)):k(Object(g)).forEach(function(p){Object.defineProperty(l,p,Object.getOwnPropertyDescriptor(g,p))})}return l}function E(l){var a=b();return function(){var p=Object(B.a)(l),y;if(a){var M=Object(B.a)(this).constructor;y=Reflect.construct(p,arguments,M)}else y=p.apply(this,arguments);return Object(R.a)(this,y)}}function b(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(l){return!1}}function d(){}function o(l){l.preventDefault()}var s=function(a){return a.replace(/[^\w.-]+/g,"")},u=200,S=600,f=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,m=function(a){return a!=null},w=function(a,g){return g===a||typeof g=="number"&&typeof a=="number"&&isNaN(g)&&isNaN(a)},v=function(l){Object(U.a)(g,l);var a=E(g);function g(p){var y;Object(_.a)(this,g),y=a.call(this,p),y.onKeyDown=function(j){var W=y.props,O=W.onKeyDown,P=W.onPressEnter;if(j.keyCode===A.a.UP){var H=y.getRatio(j);y.up(j,H,null),y.stop()}else if(j.keyCode===A.a.DOWN){var X=y.getRatio(j);y.down(j,X,null),y.stop()}else j.keyCode===A.a.ENTER&&P&&P(j);if(y.recordCursorPosition(),y.lastKeyCode=j.keyCode,O){for(var q=arguments.length,re=new Array(q>1?q-1:0),Ee=1;Ee<q;Ee++)re[Ee-1]=arguments[Ee];O.apply(void 0,[j].concat(re))}},y.onKeyUp=function(j){var W=y.props.onKeyUp;if(y.stop(),y.recordCursorPosition(),W){for(var O=arguments.length,P=new Array(O>1?O-1:0),H=1;H<O;H++)P[H-1]=arguments[H];W.apply(void 0,[j].concat(P))}},y.onChange=function(j){var W=y.props.onChange;y.state.focused&&(y.inputting=!0),y.rawInput=y.props.parser(y.getValueFromEvent(j)),y.setState({inputValue:y.rawInput}),W(y.toNumber(y.rawInput))},y.onMouseUp=function(){var j=y.props.onMouseUp;y.recordCursorPosition(),j&&j.apply(void 0,arguments)},y.onFocus=function(){var j;y.setState({focused:!0}),(j=y.props).onFocus.apply(j,arguments)},y.onBlur=function(){var j=y.props.onBlur;y.inputting=!1,y.setState({focused:!1});var W=y.getCurrentValidValue(y.state.inputValue),O=y.setValue(W,d);if(j){var P=y.input.value,H=y.getInputDisplayValue({focus:!1,value:O});y.input.value=H&&Number(H),j.apply(void 0,arguments),y.input.value=P}},y.getRatio=function(j){var W=1;return j.metaKey||j.ctrlKey?W=.1:j.shiftKey&&(W=10),W},y.getFullNum=function(j){return isNaN(j)?j:/e/i.test(String(j))?Number(j).toFixed(18).replace(/\.?0+$/,""):j},y.getPrecision=function(j){if(m(y.props.precision))return y.props.precision;var W=String(j);if(W.indexOf("e-")>=0)return parseInt(W.slice(W.indexOf("e-")+2),10);var O=0;return W.indexOf(".")>=0&&(O=W.length-W.indexOf(".")-1),O},y.getInputDisplayValue=function(j){var W=j||y.state,O=W.focused,P=W.inputValue,H=W.value,X;O?X=P:X=y.toPrecisionAsStep(H),X==null&&(X="");var q=y.formatWrapper(X);return m(y.props.decimalSeparator)&&(q=q.toString().replace(".",y.props.decimalSeparator)),q},y.recordCursorPosition=function(){try{y.cursorStart=y.input.selectionStart,y.cursorEnd=y.input.selectionEnd,y.currentValue=y.input.value,y.cursorBefore=y.input.value.substring(0,y.cursorStart),y.cursorAfter=y.input.value.substring(y.cursorEnd)}catch(j){}},y.restoreByAfter=function(j){if(j===void 0)return!1;var W=y.input.value,O=W.lastIndexOf(j);if(O===-1)return!1;var P=y.cursorBefore.length;return y.lastKeyCode===A.a.DELETE&&y.cursorBefore.charAt(P-1)===j[0]?(y.fixCaret(P,P),!0):O+j.length===W.length?(y.fixCaret(O,O),!0):!1},y.partRestoreByAfter=function(j){return j===void 0?!1:Array.prototype.some.call(j,function(W,O){var P=j.substring(O);return y.restoreByAfter(P)})},y.isNotCompleteNumber=function(j){return isNaN(j)||j===""||j===null||j&&j.toString().indexOf(".")===j.toString().length-1},y.stop=function(){y.autoStepTimer&&clearTimeout(y.autoStepTimer)},y.down=function(j,W,O){y.pressingUpOrDown=!0,y.step("down",j,W,O)},y.up=function(j,W,O){y.pressingUpOrDown=!0,y.step("up",j,W,O)},y.saveInput=function(j){y.input=j};var M=p.value;M===void 0&&(M=p.defaultValue),y.state={focused:p.autoFocus};var F=y.getValidValue(y.toNumber(M));return y.state=C(C({},y.state),{},{inputValue:y.toPrecisionAsStep(F),value:F}),y}return Object(G.a)(g,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(y){var M=this.props,F=M.value,j=M.onChange,W=M.max,O=M.min,P=this.state.focused;if(y){if(!w(y.value,F)||!w(y.max,W)||!w(y.min,O)){var H=P?F:this.getValidValue(F),X;this.pressingUpOrDown?X=H:this.inputting?X=this.rawInput:X=this.toPrecisionAsStep(H),this.setState({value:H,inputValue:X})}var q="value"in this.props?F:this.state.value;"max"in this.props&&y.max!==W&&typeof q=="number"&&q>W&&j&&j(W),"min"in this.props&&y.min!==O&&typeof q=="number"&&q<O&&j&&j(O)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var re=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===A.a.BACKSPACE?re=this.cursorStart-1:this.lastKeyCode===A.a.DELETE&&(re=this.cursorStart):re=this.input.value.length,this.fixCaret(re,re)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case A.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case A.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(Ee){}if(this.lastKeyCode=null,!this.pressingUpOrDown)return;this.props.focusOnUpDown&&this.state.focused&&(document.activeElement!==this.input&&this.focus())}},{key:"componentWillUnmount",value:function(){this.stop()}},{key:"getCurrentValidValue",value:function(y){var M=y;return M===""?M="":this.isNotCompleteNumber(parseFloat(M))?M=this.state.value:M=this.getValidValue(M),this.toNumber(M)}},{key:"getValueFromEvent",value:function(y){var M=y.target.value.trim().replace(/。/g,".");return m(this.props.decimalSeparator)&&(M=M.replace(this.props.decimalSeparator,".")),M}},{key:"getValidValue",value:function(y){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,j=parseFloat(y);return isNaN(j)?y:(j<M&&(j=M),j>F&&(j=F),j)}},{key:"setValue",value:function(y,M){var F=this.props.precision,j=this.isNotCompleteNumber(parseFloat(y))?null:parseFloat(y),W=this.state.value,O=W===void 0?null:W,P=this.state.inputValue,H=P===void 0?null:P,X=typeof j=="number"?j.toFixed(F):"".concat(j),q=j!==O||X!=="".concat(H);return"value"in this.props?(H=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:H},M)):this.setState({value:j,inputValue:this.toPrecisionAsStep(y)},M),q&&this.props.onChange(j),j}},{key:"getMaxPrecision",value:function(y){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,F=this.props,j=F.precision,W=F.step;if(m(j))return j;var O=this.getPrecision(M),P=this.getPrecision(W),H=this.getPrecision(y);return y?Math.max(H,O+P):O+P}},{key:"getPrecisionFactor",value:function(y){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,F=this.getMaxPrecision(y,M);return Math.pow(10,F)}},{key:"focus",value:function(){this.input.focus(),this.recordCursorPosition()}},{key:"blur",value:function(){this.input.blur()}},{key:"select",value:function(){this.input.select()}},{key:"formatWrapper",value:function(y){return this.props.formatter?this.props.formatter(y):y}},{key:"toPrecisionAsStep",value:function(y){if(this.isNotCompleteNumber(y)||y==="")return y;var M=Math.abs(this.getMaxPrecision(y));return isNaN(M)?y.toString():Number(y).toFixed(M)}},{key:"toNumber",value:function(y){var M=this.props.precision,F=this.state.focused,j=y&&y.length>16&&F;return this.isNotCompleteNumber(y)||j?y:m(M)?Math.round(y*Math.pow(10,M))/Math.pow(10,M):Number(y)}},{key:"upStep",value:function(y,M){var F=this.props.step,j=this.getPrecisionFactor(y,M),W=Math.abs(this.getMaxPrecision(y,M)),O=((j*y+j*F*M)/j).toFixed(W);return this.toNumber(O)}},{key:"downStep",value:function(y,M){var F=this.props.step,j=this.getPrecisionFactor(y,M),W=Math.abs(this.getMaxPrecision(y,M)),O=((j*y-j*F*M)/j).toFixed(W);return this.toNumber(O)}},{key:"step",value:function(y,M){var F=this,j=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,W=arguments.length>3?arguments[3]:void 0;this.stop(),M&&(M.persist(),M.preventDefault());var O=this.props;if(O.disabled)return;var P=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(P))return;var H=this["".concat(y,"Step")](P,j),X=H>O.max||H<O.min;if(H>O.max?H=O.max:H<O.min&&(H=O.min),this.setValue(H,null),this.setState({focused:!0},function(){F.pressingUpOrDown=!1}),X)return;this.autoStepTimer=setTimeout(function(){F[y](M,j,!0)},W?u:S)}},{key:"fixCaret",value:function(y,M){if(y===void 0||M===void 0||!this.input||!this.input.value)return;try{var F=this.input.selectionStart,j=this.input.selectionEnd;(y!==F||M!==j)&&this.input.setSelectionRange(y,M)}catch(W){}}},{key:"render",value:function(){var y,M=this.props,F=M.prefixCls,j=M.disabled,W=M.readOnly,O=M.useTouch,P=M.autoComplete,H=M.upHandler,X=M.downHandler,q=M.className,re=M.max,Ee=M.min,he=M.style,xe=M.title,pe=M.onMouseEnter,ve=M.onMouseLeave,ce=M.onMouseOver,fe=M.onMouseOut,$=M.required,ae=M.onClick,Z=M.tabIndex,ge=M.type,Se=M.placeholder,me=M.id,we=M.inputMode,De=M.pattern,Oe=M.step,ke=M.maxLength,Le=M.autoFocus,_e=M.name,ze=M.onPaste,Xe=M.onInput,Ve=Object(ne.a)(M,["prefixCls","disabled","readOnly","useTouch","autoComplete","upHandler","downHandler","className","max","min","style","title","onMouseEnter","onMouseLeave","onMouseOver","onMouseOut","required","onClick","tabIndex","type","placeholder","id","inputMode","pattern","step","maxLength","autoFocus","name","onPaste","onInput"]),je=this.state,qe=je.value,He=je.focused,$e=x()(F,(y={},Object(V.a)(y,q,!!q),Object(V.a)(y,"".concat(F,"-disabled"),j),Object(V.a)(y,"".concat(F,"-focused"),He),y)),Ae={};Object.keys(Ve).forEach(function(ie){(ie.substr(0,5)==="data-"||ie.substr(0,5)==="aria-"||ie==="role")&&(Ae[ie]=Ve[ie])});var Ze=!W&&!j,Je=this.getInputDisplayValue(null),Re=(qe||qe===0)&&(isNaN(qe)||Number(qe)>=re),Fe=(qe||qe===0)&&(isNaN(qe)||Number(qe)<=Ee),se=Re||j||W,le=Fe||j||W,ue=x()("".concat(F,"-handler"),"".concat(F,"-handler-up"),Object(V.a)({},"".concat(F,"-handler-up-disabled"),se)),J=x()("".concat(F,"-handler"),"".concat(F,"-handler-down"),Object(V.a)({},"".concat(F,"-handler-down-disabled"),le)),Q=O?{onTouchStart:se?d:this.up,onTouchEnd:this.stop}:{onMouseDown:se?d:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},te=O?{onTouchStart:le?d:this.down,onTouchEnd:this.stop}:{onMouseDown:le?d:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return D.a.createElement("div",{className:$e,style:he,title:xe,onMouseEnter:pe,onMouseLeave:ve,onMouseOver:ce,onMouseOut:fe,onFocus:function(){return null},onBlur:function(){return null}},D.a.createElement("div",{className:"".concat(F,"-handler-wrap")},D.a.createElement("span",Object.assign({unselectable:"on"},Q,{role:"button","aria-label":"Increase Value","aria-disabled":se,className:ue}),H||D.a.createElement("span",{unselectable:"on",className:"".concat(F,"-handler-up-inner"),onClick:o})),D.a.createElement("span",Object.assign({unselectable:"on"},te,{role:"button","aria-label":"Decrease Value","aria-disabled":le,className:J}),X||D.a.createElement("span",{unselectable:"on",className:"".concat(F,"-handler-down-inner"),onClick:o}))),D.a.createElement("div",{className:"".concat(F,"-input-wrap")},D.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":Ee,"aria-valuemax":re,"aria-valuenow":qe,required:$,type:ge,placeholder:Se,onPaste:ze,onClick:ae,onMouseUp:this.onMouseUp,className:"".concat(F,"-input"),tabIndex:Z,autoComplete:P,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:Ze?this.onKeyDown:d,onKeyUp:Ze?this.onKeyUp:d,autoFocus:Le,maxLength:ke,readOnly:W,disabled:j,max:re,min:Ee,step:Oe,name:_e,title:xe,id:me,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(Je),pattern:De,inputMode:we,onInput:Xe},Ae))))}}]),g}(D.a.Component);v.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:f,min:-f,step:1,style:{},onChange:d,onKeyDown:d,onPressEnter:d,onFocus:d,onBlur:d,parser:s,required:!1,autoComplete:"off"};var h=v,c=We.a=h},gnOq:function(ot,We,ee){"use strict";ee.r(We);var ne=ee("+L6B"),V=ee("2/Rp"),_=ee("5NDa"),G=ee("5rEg"),U=ee("sPJy"),R=ee("bE4q"),B=ee("k1fw"),I=ee("9og8"),D=ee("y8nQ"),L=ee("Vl3Y"),x=ee("tJVT"),A=ee("WmNS"),k=ee.n(A),C=ee("q1tI"),E=ee.n(C),b=ee("9kvl"),d=ee("55Ip"),o=ee("Ot1p"),s=ee("XYT7"),u=ee("we55"),S=ee.n(u),f=ee("500L"),m=ee("1vsH"),w=function(h){var c,l=h.shixunHomeworks,a=h.newCourse,g=h.globalSetting,p=h.loading,y=h.dispatch,M=h.match,F=L.a.useForm(),j=Object(x.a)(F,1),W=j[0],O=Object(C.useState)({}),P=Object(x.a)(O,2),H=P[0],X=P[1],q=Object(C.useState)(),re=Object(x.a)(q,2),Ee=re[0],he=re[1],xe=Object(C.useRef)(),pe=l.commonHomeWorkAddDefaultData;Object(C.useEffect)(function(){var fe;setTimeout(function(){document.body.scrollIntoView()},300);var $=M.params,ae=$.coursesId,Z=$.categoryId;xe.current=(fe=M.params)===null||fe===void 0?void 0:fe.courseId,he(!!xe.current),xe.current&&ve(),y({type:"shixunHomeworks/addCommonHomeWorkDefaultData",payload:{category:Z,coursesId:ae,type:1}})},[]);var ve=function(){var fe=Object(I.a)(k.a.mark(function $(){var ae;return k.a.wrap(function(ge){for(;;)switch(ge.prev=ge.next){case 0:return ge.next=2,y({type:"newCourse/getEditCourseData",payload:{id:xe.current}});case 2:ae=ge.sent,ae&&(W.setFieldsValue({name:ae.name}),W.setFieldsValue({intro:ae.description}),W.setFieldsValue({notice:ae.learning_notes}),X({name:ae.name,intro:ae.description,notice:ae.learning_notes}));case 4:case"end":return ge.stop()}},$)}));return function(){return fe.apply(this,arguments)}}(),ce=function(){var fe=Object(I.a)(k.a.mark(function $(ae){var Z,ge,Se,me,we,De,Oe;return k.a.wrap(function(Le){for(;;)switch(Le.prev=Le.next){case 0:return Z=Object(B.a)({},H),Z.attachment_ids&&(Z.attachment_ids=Z==null||((ge=Z.attachment_ids)===null||ge===void 0)?void 0:ge.map(function(_e){return _e.response.id})),Z.reference_attachment_ids&&(Z.reference_attachment_ids=Z==null||((Se=Z.reference_attachment_ids)===null||Se===void 0)?void 0:Se.map(function(_e){return _e.response.id})),me=M.params,we=me.coursesId,De=me.categoryId,Le.next=6,Object(s.a)(Object(B.a)(Object(B.a)({coursesId:we,category:De},Z),{},{base_on_project:!0,type:1}));case 6:Oe=Le.sent,(Oe==null?void 0:Oe.status)===0&&(Object(m.ab)(["\u6559\u5B66\u8BFE\u5802","\u56FE\u6587\u4F5C\u4E1A","\u65B0\u5EFA\u56FE\u6587\u4F5C\u4E1A"]),b.e.push("/classrooms/".concat(M.params.coursesId,"/common_homework/").concat(Oe.homework_id,"/detail")));case 8:case"end":return Le.stop()}},$)}));return function(ae){return fe.apply(this,arguments)}}();return E.a.createElement("section",{className:S.a.bg},pe.course_name&&E.a.createElement("section",{className:"animated fadeIn"},E.a.createElement("aside",{className:"mt10"},pe.category&&E.a.createElement(R.a,{separator:">"},E.a.createElement(R.a.Item,null,E.a.createElement(d.a,{to:"/classrooms/".concat(pe.course_id,"/common_homework")},pe.course_name)),E.a.createElement(R.a.Item,null,E.a.createElement(d.a,{to:"/classrooms/".concat(pe.course_id,"/common_homework")},pe.category.category_name)),E.a.createElement(R.a.Item,null,"\u65B0\u5EFA\u8BE6\u60C5")))),E.a.createElement("aside",{className:"font24 bold mt20 mb20"},"\u65B0\u5EFA\u56FE\u6587\u4F5C\u4E1A"),E.a.createElement(L.a,{form:W,className:S.a.formWrap,scrollToFirstError:!0,layout:"vertical",onValuesChange:function(){console.log("onchange: ",W.getFieldsValue()),X(Object(B.a)({},W.getFieldsValue()))},onFinish:ce},E.a.createElement("div",{className:S.a.fieldWrap},E.a.createElement(L.a.Item,{name:"name",label:"\u6807\u9898:",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u6807\u9898"}]},E.a.createElement(G.a,{maxLength:60,suffix:"".concat(((c=H.name)===null||c===void 0?void 0:c.length)||0,"/60"),placeholder:"\u4F8B\u5982\uFF1A\u4ECEPython\u7A0B\u5E8F\u8BBE\u8BA1-\u5165\u95E8\u7CBE\u901A"}))),E.a.createElement("div",{className:S.a.mdWrap},E.a.createElement(L.a.Item,{name:"description",label:"\u7B80\u4ECB:",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4F5C\u4E1A\u7684\u7B80\u4ECB"},{max:5e3,message:"\u4F5C\u4E1A\u7B80\u4ECB\u6700\u5927\u9650\u52365000\u4E2A\u5B57\u7B26"}]},E.a.createElement(o.a,{watch:!0,defaultValue:H.intro})),E.a.createElement("div",null,E.a.createElement(L.a.Item,{name:"attachment_ids"},E.a.createElement(f.b,null)))),E.a.createElement("div",{className:S.a.mdWrap},E.a.createElement(L.a.Item,{name:"reference_answer",label:"\u53C2\u8003\u7B54\u6848:"},E.a.createElement(o.a,{watch:!0,defaultValue:H.notice})),E.a.createElement("div",null,E.a.createElement(L.a.Item,{name:"reference_attachment_ids"},E.a.createElement(f.b,null)))),E.a.createElement("div",{className:S.a.backgroundFa},E.a.createElement("div",{className:"pt40 mb30"},E.a.createElement(L.a.Item,null,E.a.createElement(V.a,{size:"large",type:"primary",className:"".concat(S.a.button," mr20"),htmlType:"submit",loading:p["newCourse/editCourse"]||p["newCourse/submitCourse"]},"\u63D0\u4EA4"),E.a.createElement(V.a,{size:"large",type:"primary",ghost:!0,className:S.a.button,onClick:function(){return b.e.push("/classrooms/".concat(M.params.coursesId,"/common_homework"))}},"\u53D6\u6D88"))))))};We.default=Object(b.b)(function(v){var h=v.shixunHomeworks,c=v.newCourse,l=v.loading,a=v.globalSetting;return{shixunHomeworks:h,newCourse:c,globalSetting:a,loading:l.effects}})(w)},h78n:function(ot,We,ee){"use strict";ee.d(We,"a",function(){return y});var ne=ee("q1tI"),V=ee.n(ne),_=ee("TSYQ"),G=ee.n(_),U={className:"",percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,style:{},trailColor:"#D9D9D9",trailWidth:1},R=function(j){var W=j.map(function(){return Object(ne.useRef)()}),O=Object(ne.useRef)();return Object(ne.useEffect)(function(){var P=Date.now(),H=!1;Object.keys(W).forEach(function(X){var q=W[X].current;if(!q)return;H=!0;var re=q.style;re.transitionDuration=".3s, .3s, .3s, .06s",O.current&&P-O.current<100&&(re.transitionDuration="0s, 0s")}),H&&(O.current=Date.now())}),[W]};function B(){return B=Object.assign||function(F){for(var j=1;j<arguments.length;j++){var W=arguments[j];for(var O in W)Object.prototype.hasOwnProperty.call(W,O)&&(F[O]=W[O])}return F},B.apply(this,arguments)}function I(F,j){return k(F)||A(F,j)||L(F,j)||D()}function D(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function L(F,j){if(!F)return;if(typeof F=="string")return x(F,j);var W=Object.prototype.toString.call(F).slice(8,-1);if(W==="Object"&&F.constructor&&(W=F.constructor.name),W==="Map"||W==="Set")return Array.from(F);if(W==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(W))return x(F,j)}function x(F,j){(j==null||j>F.length)&&(j=F.length);for(var W=0,O=new Array(j);W<j;W++)O[W]=F[W];return O}function A(F,j){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(F)))return;var W=[],O=!0,P=!1,H=void 0;try{for(var X=F[Symbol.iterator](),q;!(O=(q=X.next()).done)&&!(W.push(q.value),j&&W.length===j);O=!0);}catch(re){P=!0,H=re}finally{try{!O&&X.return!=null&&X.return()}finally{if(P)throw H}}return W}function k(F){if(Array.isArray(F))return F}function C(F,j){if(F==null)return{};var W=E(F,j),O,P;if(Object.getOwnPropertySymbols){var H=Object.getOwnPropertySymbols(F);for(P=0;P<H.length;P++){if(O=H[P],j.indexOf(O)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(F,O))continue;W[O]=F[O]}}return W}function E(F,j){if(F==null)return{};var W={},O=Object.keys(F),P,H;for(H=0;H<O.length;H++){if(P=O[H],j.indexOf(P)>=0)continue;W[P]=F[P]}return W}var b=function(j){var W=j.className,O=j.percent,P=j.prefixCls,H=j.strokeColor,X=j.strokeLinecap,q=j.strokeWidth,re=j.style,Ee=j.trailColor,he=j.trailWidth,xe=j.transition,pe=C(j,["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"]);delete pe.gapPosition;var ve=Array.isArray(O)?O:[O],ce=Array.isArray(H)?H:[H],fe=R(ve),$=I(fe,1),ae=$[0],Z=q/2,ge=100-q/2,Se="M ".concat(X==="round"?Z:0,",").concat(Z,`
|
|
L `).concat(X==="round"?ge:100,",").concat(Z),me="0 0 100 ".concat(q),we=0;return V.a.createElement("svg",B({className:G()("".concat(P,"-line"),W),viewBox:me,preserveAspectRatio:"none",style:re},pe),V.a.createElement("path",{className:"".concat(P,"-line-trail"),d:Se,strokeLinecap:X,stroke:Ee,strokeWidth:he||q,fillOpacity:"0"}),ve.map(function(De,Oe){var ke={strokeDasharray:"".concat(De,"px, 100px"),strokeDashoffset:"-".concat(we,"px"),transition:xe||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},Le=ce[Oe]||ce[ce.length-1];return we+=De,V.a.createElement("path",{key:Oe,className:"".concat(P,"-line-path"),d:Se,strokeLinecap:X,stroke:Le,strokeWidth:q,fillOpacity:"0",ref:ae[Oe],style:ke})}))};b.defaultProps=U;var d=b;function o(){return o=Object.assign||function(F){for(var j=1;j<arguments.length;j++){var W=arguments[j];for(var O in W)Object.prototype.hasOwnProperty.call(W,O)&&(F[O]=W[O])}return F},o.apply(this,arguments)}function s(F,j){return w(F)||m(F,j)||S(F,j)||u()}function u(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function S(F,j){if(!F)return;if(typeof F=="string")return f(F,j);var W=Object.prototype.toString.call(F).slice(8,-1);if(W==="Object"&&F.constructor&&(W=F.constructor.name),W==="Map"||W==="Set")return Array.from(F);if(W==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(W))return f(F,j)}function f(F,j){(j==null||j>F.length)&&(j=F.length);for(var W=0,O=new Array(j);W<j;W++)O[W]=F[W];return O}function m(F,j){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(F)))return;var W=[],O=!0,P=!1,H=void 0;try{for(var X=F[Symbol.iterator](),q;!(O=(q=X.next()).done)&&!(W.push(q.value),j&&W.length===j);O=!0);}catch(re){P=!0,H=re}finally{try{!O&&X.return!=null&&X.return()}finally{if(P)throw H}}return W}function w(F){if(Array.isArray(F))return F}function v(F,j){if(F==null)return{};var W=h(F,j),O,P;if(Object.getOwnPropertySymbols){var H=Object.getOwnPropertySymbols(F);for(P=0;P<H.length;P++){if(O=H[P],j.indexOf(O)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(F,O))continue;W[O]=F[O]}}return W}function h(F,j){if(F==null)return{};var W={},O=Object.keys(F),P,H;for(H=0;H<O.length;H++){if(P=O[H],j.indexOf(P)>=0)continue;W[P]=F[P]}return W}var c=0;function l(F){return+F.replace("%","")}function a(F){return Array.isArray(F)?F:[F]}function g(F,j,W,O){var P=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,H=arguments.length>5?arguments[5]:void 0,X=50-O/2,q=0,re=-X,Ee=0,he=-2*X;switch(H){case"left":q=-X,re=0,Ee=2*X,he=0;break;case"right":q=X,re=0,Ee=-2*X,he=0;break;case"bottom":re=X,he=2*X;break;default:}var xe="M 50,50 m ".concat(q,",").concat(re,`
|
|
a `).concat(X,",").concat(X," 0 1 1 ").concat(Ee,",").concat(-he,`
|
|
a `).concat(X,",").concat(X," 0 1 1 ").concat(-Ee,",").concat(he),pe=Math.PI*2*X,ve={stroke:W,strokeDasharray:"".concat(j/100*(pe-P),"px ").concat(pe,"px"),strokeDashoffset:"-".concat(P/2+F/100*(pe-P),"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"};return{pathString:xe,pathStyle:ve}}var p=function(j){var W=j.prefixCls,O=j.strokeWidth,P=j.trailWidth,H=j.gapDegree,X=j.gapPosition,q=j.trailColor,re=j.strokeLinecap,Ee=j.style,he=j.className,xe=j.strokeColor,pe=j.percent,ve=v(j,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"]),ce=Object(ne.useMemo)(function(){return c+=1,c},[]),fe=g(0,100,q,O,H,X),$=fe.pathString,ae=fe.pathStyle,Z=a(pe),ge=a(xe),Se=ge.find(function(ke){return Object.prototype.toString.call(ke)==="[object Object]"}),me=R(Z),we=s(me,1),De=we[0],Oe=function(){var Le=0;return Z.map(function(_e,ze){var Xe=ge[ze]||ge[ge.length-1],Ve=Object.prototype.toString.call(Xe)==="[object Object]"?"url(#".concat(W,"-gradient-").concat(ce,")"):"",je=g(Le,_e,Xe,O,H,X);return Le+=_e,V.a.createElement("path",{key:ze,className:"".concat(W,"-circle-path"),d:je.pathString,stroke:Ve,strokeLinecap:re,strokeWidth:O,opacity:_e===0?0:1,fillOpacity:"0",style:je.pathStyle,ref:De[ze]})})};return V.a.createElement("svg",o({className:G()("".concat(W,"-circle"),he),viewBox:"0 0 100 100",style:Ee},ve),Se&&V.a.createElement("defs",null,V.a.createElement("linearGradient",{id:"".concat(W,"-gradient-").concat(ce),x1:"100%",y1:"0%",x2:"0%",y2:"0%"},Object.keys(Se).sort(function(ke,Le){return l(ke)-l(Le)}).map(function(ke,Le){return V.a.createElement("stop",{key:Le,offset:ke,stopColor:Se[ke]})}))),V.a.createElement("path",{className:"".concat(W,"-circle-trail"),d:$,stroke:q,strokeLinecap:re,strokeWidth:P||O,fillOpacity:"0",style:ae}),Oe().reverse())};p.defaultProps=U;var y=p,M={Line:d,Circle:y}},kSUc:function(ot,We,ee){},lZu9:function(ot,We,ee){(function(ne){ne(ee("VrN/"),ee("1eCo"),ee("8EBN"))})(function(ne){"use strict";ne.defineMode("markdown",function(V,_){var G=ne.getMode(V,"text/html"),U=G.name=="null";function R(O){if(ne.findModeByName){var P=ne.findModeByName(O);P&&(O=P.mime||P.mimes[0])}var H=ne.getMode(V,O);return H.name=="null"?null:H}_.highlightFormatting===void 0&&(_.highlightFormatting=!1),_.maxBlockquoteDepth===void 0&&(_.maxBlockquoteDepth=0),_.taskLists===void 0&&(_.taskLists=!1),_.strikethrough===void 0&&(_.strikethrough=!1),_.emoji===void 0&&(_.emoji=!1),_.fencedCodeBlockHighlighting===void 0&&(_.fencedCodeBlockHighlighting=!0),_.fencedCodeBlockDefaultMode===void 0&&(_.fencedCodeBlockDefaultMode="text/plain"),_.xml===void 0&&(_.xml=!0),_.tokenTypeOverrides===void 0&&(_.tokenTypeOverrides={});var B={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough",emoji:"builtin"};for(var I in B)B.hasOwnProperty(I)&&_.tokenTypeOverrides[I]&&(B[I]=_.tokenTypeOverrides[I]);var D=/^([*\-_])(?:\s*\1){2,}\s*$/,L=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,x=/^\[(x| )\](?=\s)/i,A=_.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,k=/^ {0,3}(?:\={1,}|-{2,})\s*$/,C=/^[^#!\[\]*_\\<>` "'(~:]+/,E=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,b=/^\s*\[[^\]]+?\]:.*$/,d=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,o=" ";function s(O,P,H){return P.f=P.inline=H,H(O,P)}function u(O,P,H){return P.f=P.block=H,H(O,P)}function S(O){return!O||!/\S/.test(O.string)}function f(O){if(O.linkTitle=!1,O.linkHref=!1,O.linkText=!1,O.em=!1,O.strong=!1,O.strikethrough=!1,O.quote=0,O.indentedCode=!1,O.f==w){var P=U;if(!P){var H=ne.innerMode(G,O.htmlState);P=H.mode.name=="xml"&&H.state.tagStart===null&&!H.state.context&&H.state.tokenize.isInText}P&&(O.f=l,O.block=m,O.htmlState=null)}return O.trailingSpace=0,O.trailingSpaceNewLine=!1,O.prevLine=O.thisLine,O.thisLine={stream:null},null}function m(O,P){var H=O.column()===P.indentation,X=S(P.prevLine.stream),q=P.indentedCode,re=P.prevLine.hr,Ee=P.list!==!1,he=(P.listStack[P.listStack.length-1]||0)+3;P.indentedCode=!1;var xe=P.indentation;if(P.indentationDiff===null&&(P.indentationDiff=P.indentation,Ee)){for(P.list=null;xe<P.listStack[P.listStack.length-1];)P.listStack.pop(),P.listStack.length?P.indentation=P.listStack[P.listStack.length-1]:P.list=!1;P.list!==!1&&(P.indentationDiff=xe-P.listStack[P.listStack.length-1])}var pe=!X&&!re&&!P.prevLine.header&&(!Ee||!q)&&!P.prevLine.fencedCodeEnd,ve=(P.list===!1||re||X)&&P.indentation<=he&&O.match(D),ce=null;if(P.indentationDiff>=4&&(q||P.prevLine.fencedCodeEnd||P.prevLine.header||X))return O.skipToEnd(),P.indentedCode=!0,B.code;if(O.eatSpace())return null;if(H&&P.indentation<=he&&(ce=O.match(A))&&ce[1].length<=6)return P.quote=0,P.header=ce[1].length,P.thisLine.header=!0,_.highlightFormatting&&(P.formatting="header"),P.f=P.inline,h(P);if(P.indentation<=he&&O.eat(">"))return P.quote=H?1:P.quote+1,_.highlightFormatting&&(P.formatting="quote"),O.eatSpace(),h(P);if(!ve&&!P.setext&&H&&P.indentation<=he&&(ce=O.match(L))){var fe=ce[1]?"ol":"ul";return P.indentation=xe+O.current().length,P.list=!0,P.quote=0,P.listStack.push(P.indentation),P.em=!1,P.strong=!1,P.code=!1,P.strikethrough=!1,_.taskLists&&O.match(x,!1)&&(P.taskList=!0),P.f=P.inline,_.highlightFormatting&&(P.formatting=["list","list-"+fe]),h(P)}else{if(H&&P.indentation<=he&&(ce=O.match(E,!0)))return P.quote=0,P.fencedEndRE=new RegExp(ce[1]+"+ *$"),P.localMode=_.fencedCodeBlockHighlighting&&R(ce[2]||_.fencedCodeBlockDefaultMode),P.localMode&&(P.localState=ne.startState(P.localMode)),P.f=P.block=v,_.highlightFormatting&&(P.formatting="code-block"),P.code=-1,h(P);if(P.setext||(!pe||!Ee)&&!P.quote&&P.list===!1&&!P.code&&!ve&&!b.test(O.string)&&(ce=O.lookAhead(1))&&(ce=ce.match(k)))return P.setext?(P.header=P.setext,P.setext=0,O.skipToEnd(),_.highlightFormatting&&(P.formatting="header")):(P.header=ce[0].charAt(0)=="="?1:2,P.setext=P.header),P.thisLine.header=!0,P.f=P.inline,h(P);if(ve)return O.skipToEnd(),P.hr=!0,P.thisLine.hr=!0,B.hr;if(O.peek()==="[")return s(O,P,M)}return s(O,P,P.inline)}function w(O,P){var H=G.token(O,P.htmlState);if(!U){var X=ne.innerMode(G,P.htmlState);(X.mode.name=="xml"&&X.state.tagStart===null&&!X.state.context&&X.state.tokenize.isInText||P.md_inside&&O.current().indexOf(">")>-1)&&(P.f=l,P.block=m,P.htmlState=null)}return H}function v(O,P){var H=P.listStack[P.listStack.length-1]||0,X=P.indentation<H,q=H+3;if(P.fencedEndRE&&P.indentation<=q&&(X||O.match(P.fencedEndRE))){_.highlightFormatting&&(P.formatting="code-block");var re;return X||(re=h(P)),P.localMode=P.localState=null,P.block=m,P.f=l,P.fencedEndRE=null,P.code=0,P.thisLine.fencedCodeEnd=!0,X?u(O,P,P.block):re}else return P.localMode?P.localMode.token(O,P.localState):(O.skipToEnd(),B.code)}function h(O){var P=[];if(O.formatting){P.push(B.formatting),typeof O.formatting=="string"&&(O.formatting=[O.formatting]);for(var H=0;H<O.formatting.length;H++)P.push(B.formatting+"-"+O.formatting[H]),O.formatting[H]==="header"&&P.push(B.formatting+"-"+O.formatting[H]+"-"+O.header),O.formatting[H]==="quote"&&(!_.maxBlockquoteDepth||_.maxBlockquoteDepth>=O.quote?P.push(B.formatting+"-"+O.formatting[H]+"-"+O.quote):P.push("error"))}if(O.taskOpen)return P.push("meta"),P.length?P.join(" "):null;if(O.taskClosed)return P.push("property"),P.length?P.join(" "):null;if(O.linkHref?P.push(B.linkHref,"url"):(O.strong&&P.push(B.strong),O.em&&P.push(B.em),O.strikethrough&&P.push(B.strikethrough),O.emoji&&P.push(B.emoji),O.linkText&&P.push(B.linkText),O.code&&P.push(B.code),O.image&&P.push(B.image),O.imageAltText&&P.push(B.imageAltText,"link"),O.imageMarker&&P.push(B.imageMarker)),O.header&&P.push(B.header,B.header+"-"+O.header),O.quote&&(P.push(B.quote),!_.maxBlockquoteDepth||_.maxBlockquoteDepth>=O.quote?P.push(B.quote+"-"+O.quote):P.push(B.quote+"-"+_.maxBlockquoteDepth)),O.list!==!1){var X=(O.listStack.length-1)%3;X?X===1?P.push(B.list2):P.push(B.list3):P.push(B.list1)}return O.trailingSpaceNewLine?P.push("trailing-space-new-line"):O.trailingSpace&&P.push("trailing-space-"+(O.trailingSpace%2?"a":"b")),P.length?P.join(" "):null}function c(O,P){return O.match(C,!0)?h(P):void 0}function l(O,P){var H=P.text(O,P);if(typeof H!="undefined")return H;if(P.list)return P.list=null,h(P);if(P.taskList){var X=O.match(x,!0)[1]===" ";return X?P.taskOpen=!0:P.taskClosed=!0,_.highlightFormatting&&(P.formatting="task"),P.taskList=!1,h(P)}if(P.taskOpen=!1,P.taskClosed=!1,P.header&&O.match(/^#+$/,!0))return _.highlightFormatting&&(P.formatting="header"),h(P);var q=O.next();if(P.linkTitle){P.linkTitle=!1;var re=q;q==="("&&(re=")"),re=(re+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var Ee="^\\s*(?:[^"+re+"\\\\]+|\\\\\\\\|\\\\.)"+re;if(O.match(new RegExp(Ee),!0))return B.linkHref}if(q==="`"){var he=P.formatting;_.highlightFormatting&&(P.formatting="code"),O.eatWhile("`");var xe=O.current().length;if(P.code==0&&(!P.quote||xe==1))return P.code=xe,h(P);if(xe==P.code){var pe=h(P);return P.code=0,pe}else return P.formatting=he,h(P)}else if(P.code)return h(P);if(q==="\\"&&(O.next(),_.highlightFormatting)){var ve=h(P),ce=B.formatting+"-escape";return ve?ve+" "+ce:ce}if(q==="!"&&O.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return P.imageMarker=!0,P.image=!0,_.highlightFormatting&&(P.formatting="image"),h(P);if(q==="["&&P.imageMarker&&O.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return P.imageMarker=!1,P.imageAltText=!0,_.highlightFormatting&&(P.formatting="image"),h(P);if(q==="]"&&P.imageAltText){_.highlightFormatting&&(P.formatting="image");var ve=h(P);return P.imageAltText=!1,P.image=!1,P.inline=P.f=g,ve}if(q==="["&&!P.image)return P.linkText&&O.match(/^.*?\]/)||(P.linkText=!0,_.highlightFormatting&&(P.formatting="link")),h(P);if(q==="]"&&P.linkText){_.highlightFormatting&&(P.formatting="link");var ve=h(P);return P.linkText=!1,P.inline=P.f=O.match(/\(.*?\)| ?\[.*?\]/,!1)?g:l,ve}if(q==="<"&&O.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){P.f=P.inline=a,_.highlightFormatting&&(P.formatting="link");var ve=h(P);return ve?ve+=" ":ve="",ve+B.linkInline}if(q==="<"&&O.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){P.f=P.inline=a,_.highlightFormatting&&(P.formatting="link");var ve=h(P);return ve?ve+=" ":ve="",ve+B.linkEmail}if(_.xml&&q==="<"&&O.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var fe=O.string.indexOf(">",O.pos);if(fe!=-1){var $=O.string.substring(O.start,fe);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test($)&&(P.md_inside=!0)}return O.backUp(1),P.htmlState=ne.startState(G),u(O,P,w)}if(_.xml&&q==="<"&&O.match(/^\/\w*?>/))return P.md_inside=!1,"tag";if(q==="*"||q==="_"){for(var ae=1,Z=O.pos==1?" ":O.string.charAt(O.pos-2);ae<3&&O.eat(q);)ae++;var ge=O.peek()||" ",Se=!/\s/.test(ge)&&(!d.test(ge)||/\s/.test(Z)||d.test(Z)),me=!/\s/.test(Z)&&(!d.test(Z)||/\s/.test(ge)||d.test(ge)),we=null,De=null;if(ae%2&&(!P.em&&Se&&(q==="*"||!me||d.test(Z))?we=!0:P.em==q&&me&&(q==="*"||!Se||d.test(ge))&&(we=!1)),ae>1&&(!P.strong&&Se&&(q==="*"||!me||d.test(Z))?De=!0:P.strong==q&&me&&(q==="*"||!Se||d.test(ge))&&(De=!1)),De!=null||we!=null){_.highlightFormatting&&(P.formatting=we==null?"strong":De==null?"em":"strong em"),we===!0&&(P.em=q),De===!0&&(P.strong=q);var pe=h(P);return we===!1&&(P.em=!1),De===!1&&(P.strong=!1),pe}}else if(q===" "&&(O.eat("*")||O.eat("_"))){if(O.peek()===" ")return h(P);O.backUp(1)}if(_.strikethrough){if(q==="~"&&O.eatWhile(q)){if(P.strikethrough){_.highlightFormatting&&(P.formatting="strikethrough");var pe=h(P);return P.strikethrough=!1,pe}else if(O.match(/^[^\s]/,!1))return P.strikethrough=!0,_.highlightFormatting&&(P.formatting="strikethrough"),h(P)}else if(q===" "&&O.match(/^~~/,!0)){if(O.peek()===" ")return h(P);O.backUp(2)}}if(_.emoji&&q===":"&&O.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){P.emoji=!0,_.highlightFormatting&&(P.formatting="emoji");var Oe=h(P);return P.emoji=!1,Oe}return q===" "&&(O.match(/^ +$/,!1)?P.trailingSpace++:P.trailingSpace&&(P.trailingSpaceNewLine=!0)),h(P)}function a(O,P){var H=O.next();if(H===">"){P.f=P.inline=l,_.highlightFormatting&&(P.formatting="link");var X=h(P);return X?X+=" ":X="",X+B.linkInline}return O.match(/^[^>]+/,!0),B.linkInline}function g(O,P){if(O.eatSpace())return null;var H=O.next();return H==="("||H==="["?(P.f=P.inline=y(H==="("?")":"]"),_.highlightFormatting&&(P.formatting="link-string"),P.linkHref=!0,h(P)):"error"}var p={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function y(O){return function(P,H){var X=P.next();if(X===O){H.f=H.inline=l,_.highlightFormatting&&(H.formatting="link-string");var q=h(H);return H.linkHref=!1,q}return P.match(p[O]),H.linkHref=!0,h(H)}}function M(O,P){return O.match(/^([^\]\\]|\\.)*\]:/,!1)?(P.f=F,O.next(),_.highlightFormatting&&(P.formatting="link"),P.linkText=!0,h(P)):s(O,P,l)}function F(O,P){if(O.match(/^\]:/,!0)){P.f=P.inline=j,_.highlightFormatting&&(P.formatting="link");var H=h(P);return P.linkText=!1,H}return O.match(/^([^\]\\]|\\.)+/,!0),B.linkText}function j(O,P){return O.eatSpace()?null:(O.match(/^[^\s]+/,!0),O.peek()===void 0?P.linkTitle=!0:O.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),P.f=P.inline=l,B.linkHref+" url")}var W={startState:function(){return{f:m,prevLine:{stream:null},thisLine:{stream:null},block:m,htmlState:null,indentation:0,inline:l,text:c,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(O){return{f:O.f,prevLine:O.prevLine,thisLine:O.thisLine,block:O.block,htmlState:O.htmlState&&ne.copyState(G,O.htmlState),indentation:O.indentation,localMode:O.localMode,localState:O.localMode?ne.copyState(O.localMode,O.localState):null,inline:O.inline,text:O.text,formatting:!1,linkText:O.linkText,linkTitle:O.linkTitle,linkHref:O.linkHref,code:O.code,em:O.em,strong:O.strong,strikethrough:O.strikethrough,emoji:O.emoji,header:O.header,setext:O.setext,hr:O.hr,taskList:O.taskList,list:O.list,listStack:O.listStack.slice(0),quote:O.quote,indentedCode:O.indentedCode,trailingSpace:O.trailingSpace,trailingSpaceNewLine:O.trailingSpaceNewLine,md_inside:O.md_inside,fencedEndRE:O.fencedEndRE}},token:function(O,P){if(P.formatting=!1,O!=P.thisLine.stream){if(P.header=0,P.hr=!1,O.match(/^\s*$/,!0))return f(P),null;if(P.prevLine=P.thisLine,P.thisLine={stream:O},P.taskList=!1,P.trailingSpace=0,P.trailingSpaceNewLine=!1,!P.localState&&(P.f=P.block,P.f!=w)){var H=O.match(/^\s*/,!0)[0].replace(/\t/g,o).length;if(P.indentation=H,P.indentationDiff=null,H>0)return null}}return P.f(O,P)},innerMode:function(O){return O.block==w?{state:O.htmlState,mode:G}:O.localState?{state:O.localState,mode:O.localMode}:{state:O,mode:W}},indent:function(O,P,H){return O.block==w&&G.indent?G.indent(O.htmlState,P,H):O.localState&&O.localMode.indent?O.localMode.indent(O.localState,P,H):ne.Pass},blankLine:f,getType:h,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return W},"xml"),ne.defineMIME("text/markdown","markdown"),ne.defineMIME("text/x-markdown","markdown")})},osHv:function(ot,We,ee){(function(ne){ne(ee("VrN/"))})(function(ne){"use strict";var V=ne.Pos;function _(d,o){return d.line-o.line||d.ch-o.ch}var G="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",U=G+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",R=new RegExp("<(/?)(["+G+"]["+U+"]*)","g");function B(d,o,s,u){this.line=o,this.ch=s,this.cm=d,this.text=d.getLine(o),this.min=u?Math.max(u.from,d.firstLine()):d.firstLine(),this.max=u?Math.min(u.to-1,d.lastLine()):d.lastLine()}function I(d,o){var s=d.cm.getTokenTypeAt(V(d.line,o));return s&&/\btag\b/.test(s)}function D(d){return d.line>=d.max?void 0:(d.ch=0,d.text=d.cm.getLine(++d.line),!0)}function L(d){return d.line<=d.min?void 0:(d.text=d.cm.getLine(--d.line),d.ch=d.text.length,!0)}function x(d){for(;;){var o=d.text.indexOf(">",d.ch);if(o==-1){if(D(d))continue;return}if(!I(d,o+1)){d.ch=o+1;continue}var s=d.text.lastIndexOf("/",o),u=s>-1&&!/\S/.test(d.text.slice(s+1,o));return d.ch=o+1,u?"selfClose":"regular"}}function A(d){for(;;){var o=d.ch?d.text.lastIndexOf("<",d.ch-1):-1;if(o==-1){if(L(d))continue;return}if(!I(d,o+1)){d.ch=o;continue}R.lastIndex=o,d.ch=o;var s=R.exec(d.text);if(s&&s.index==o)return s}}function k(d){for(;;){R.lastIndex=d.ch;var o=R.exec(d.text);if(!o){if(D(d))continue;return}if(!I(d,o.index+1)){d.ch=o.index+1;continue}return d.ch=o.index+o[0].length,o}}function C(d){for(;;){var o=d.ch?d.text.lastIndexOf(">",d.ch-1):-1;if(o==-1){if(L(d))continue;return}if(!I(d,o+1)){d.ch=o;continue}var s=d.text.lastIndexOf("/",o),u=s>-1&&!/\S/.test(d.text.slice(s+1,o));return d.ch=o+1,u?"selfClose":"regular"}}function E(d,o){for(var s=[];;){var u=k(d),S,f=d.line,m=d.ch-(u?u[0].length:0);if(!u||!(S=x(d)))return;if(S=="selfClose")continue;if(u[1]){for(var w=s.length-1;w>=0;--w)if(s[w]==u[2]){s.length=w;break}if(w<0&&(!o||o==u[2]))return{tag:u[2],from:V(f,m),to:V(d.line,d.ch)}}else s.push(u[2])}}function b(d,o){for(var s=[];;){var u=C(d);if(!u)return;if(u=="selfClose"){A(d);continue}var S=d.line,f=d.ch,m=A(d);if(!m)return;if(m[1])s.push(m[2]);else{for(var w=s.length-1;w>=0;--w)if(s[w]==m[2]){s.length=w;break}if(w<0&&(!o||o==m[2]))return{tag:m[2],from:V(d.line,d.ch),to:V(S,f)}}}}ne.registerHelper("fold","xml",function(d,o){for(var s=new B(d,o.line,0);;){var u=k(s);if(!u||s.line!=o.line)return;var S=x(s);if(!S)return;if(!u[1]&&S!="selfClose"){var f=V(s.line,s.ch),m=E(s,u[2]);return m&&_(m.from,f)>0?{from:f,to:m.from}:null}}}),ne.findMatchingTag=function(d,o,s){var u=new B(d,o.line,o.ch,s);if(u.text.indexOf(">")==-1&&u.text.indexOf("<")==-1)return;var S=x(u),f=S&&V(u.line,u.ch),m=S&&A(u);if(!S||!m||_(u,o)>0)return;var w={from:V(u.line,u.ch),to:f,tag:m[2]};return S=="selfClose"?{open:w,close:null,at:"open"}:m[1]?{open:b(u,m[2]),close:w,at:"close"}:(u=new B(d,f.line,f.ch,s),{open:w,close:E(u,m[2]),at:"open"})},ne.findEnclosingTag=function(d,o,s,u){for(var S=new B(d,o.line,o.ch,s);;){var f=b(S,u);if(!f)break;var m=new B(d,o.line,o.ch,s),w=E(m,f.tag);if(w)return{open:f,close:w}}},ne.scanForClosingTag=function(d,o,s,u){var S=new B(d,o.line,o.ch,u?{from:0,to:u}:null);return E(S,s)}})},p5ED:function(ot,We,ee){"use strict";var ne=ee("+L6B"),V=ee("2/Rp"),_=ee("5Dmo"),G=ee("3S7+"),U=ee("k1fw"),R=ee("tJVT"),B=ee("q1tI"),I=ee.n(B),D=ee("vHTk"),L=ee.n(D),x=ee("yEEn"),A=ee("ZW9T"),k=ee("1vsH");We.a=function(C){var E=C.name,b=C.data,d=C.theme,o=C.type,s=C.filename,u=C.monacoEditor,S=C.className,f=C.style,m=C.close,w=C.onClose,v=C.hasMask,h=Object(B.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),c=Object(R.a)(h,2),l=c[0],a=c[1],g=Object(B.useState)(""),p=Object(R.a)(g,2),y=p[0],M=p[1],F=Object(B.useRef)();s&&(u.filename=s),Object(B.useEffect)(function(){var O,P,H=(O=document.cookie)===null||O===void 0||((P=O.replace(/\s/g,""))===null||P===void 0)?void 0:P.split(";");H==null||H.map(function(X){var q=X.split("=");q[0]==="_educoder_session"&&M(q[1])})},[]);var j=function(){if(b.startsWith("http")||b.startsWith("/")){W();return}Object(k.x)(s||"educoder",b,s)},W=function(){Object(k.v)(s||E,b)};return I.a.createElement("div",{style:Object(U.a)({},f||{}),className:"".concat(v&&L.a.bgBlack," ").concat(o?L.a.wrp:"hide")},m&&I.a.createElement("div",{className:L.a.close,ref:F},I.a.createElement(G.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return F.current}},I.a.createElement("span",{onClick:W},I.a.createElement("i",{className:"icon-quxiaozhiding"}))),I.a.createElement(G.a,{title:"\u5173\u95ED",getPopupContainer:function(){return F.current}},I.a.createElement("span",{className:"",onClick:w},I.a.createElement("i",{className:"icon-guanbi1"})))),I.a.createElement("div",{className:"".concat(L.a[S]," ").concat(S," ").concat(L.a.monaco," ").concat(o==="txt"?"show":"hide")},o==="txt"&&I.a.createElement(A.b,u)),o==="audio"&&I.a.createElement("audio",{src:"".concat(b!=null&&b.startsWith("/")||(b==null?void 0:b.indexOf("https://"))>-1?b:"data:audio/mp3;base64,").concat(b),autoPlay:!0}),o==="video"&&I.a.createElement(I.a.Fragment,null,b!=null&&b.startsWith("/")?I.a.createElement("video",{controls:!0,src:"".concat(b),autoPlay:!0}):I.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(b),autoPlay:!0})),o==="pdf"&&I.a.createElement("embed",{className:L.a.embed,src:b}),o==="image"&&I.a.createElement(I.a.Fragment,null,I.a.createElement("img",{src:"".concat(b!=null&&b.startsWith("/")||(b==null?void 0:b.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(b)})),o==="other"&&I.a.createElement("div",null,I.a.createElement(V.a,{type:"primary",size:"large",onClick:j},I.a.createElement(x.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),(o==="download"||o==="office")&&I.a.createElement(V.a,{type:"primary",size:"large",onClick:j},I.a.createElement(x.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(ot,We,ee){},"rAM+":function(ot,We,ee){"use strict";ee.d(We,"a",function(){return V});var ne=ee("Qw5x");function V(_,G){var U;if(typeof Symbol=="undefined"||_[Symbol.iterator]==null){if(Array.isArray(_)||(U=Object(ne.a)(_))||G&&_&&typeof _.length=="number"){U&&(_=U);var R=0,B=function(){};return{s:B,n:function(){return R>=_.length?{done:!0}:{done:!1,value:_[R++]}},e:function(A){throw A},f:B}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var I=!0,D=!1,L;return{s:function(){U=_[Symbol.iterator]()},n:function(){var A=U.next();return I=A.done,A},e:function(A){D=!0,L=A},f:function(){try{!I&&U.return!=null&&U.return()}finally{if(D)throw L}}}}},rUJ1:function(ot,We){const ee=/[&<>"']/,ne=/[&<>"']/g,V=/[<>"']|&(?!#?\w+;)/,_=/[<>"']|&(?!#?\w+;)/g,G={"&":"&","<":"<",">":">",'"':""","'":"'"},U=v=>G[v];function R(v,h){if(h){if(ee.test(v))return v.replace(ne,U)}else if(V.test(v))return v.replace(_,U);return v}const B=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function I(v){return v.replace(B,(h,c)=>(c=c.toLowerCase(),c==="colon"?":":c.charAt(0)==="#"?c.charAt(1)==="x"?String.fromCharCode(parseInt(c.substring(2),16)):String.fromCharCode(+c.substring(1)):""))}const D=/(^|[^\[])\^/g;function L(v,h){v=v.source||v,h=h||"";const c={replace:(l,a)=>(a=a.source||a,a=a.replace(D,"$1"),v=v.replace(l,a),c),getRegex:()=>new RegExp(v,h)};return c}const x=/[^\w:]/g,A=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function k(v,h,c){if(v){let l;try{l=decodeURIComponent(I(c)).replace(x,"").toLowerCase()}catch(a){return null}if(l.indexOf("javascript:")===0||l.indexOf("vbscript:")===0||l.indexOf("data:")===0)return null}h&&!A.test(c)&&(c=o(h,c));try{c=encodeURI(c).replace(/%25/g,"%")}catch(l){return null}return c}const C={},E=/^[^:]+:\/*[^/]*$/,b=/^([^:]+:)[\s\S]*$/,d=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(v,h){C[" "+v]||(E.test(v)?C[" "+v]=v+"/":C[" "+v]=f(v,"/",!0)),v=C[" "+v];const c=v.indexOf(":")===-1;return h.substring(0,2)==="//"?c?h:v.replace(b,"$1")+h:h.charAt(0)==="/"?c?h:v.replace(d,"$1")+h:v+h}const s={exec:function(){}};function u(v){let h=1,c,l;for(;h<arguments.length;h++){c=arguments[h];for(l in c)Object.prototype.hasOwnProperty.call(c,l)&&(v[l]=c[l])}return v}function S(v,h){const c=v.replace(/\|/g,(g,p,y)=>{let M=!1,F=p;for(;--F>=0&&y[F]==="\\";)M=!M;return M?"|":" |"}),l=c.split(/ \|/);let a=0;if(l.length>h)l.splice(h);else for(;l.length<h;)l.push("");for(;a<l.length;a++)l[a]=l[a].trim().replace(/\\\|/g,"|");return l}function f(v,h,c){const l=v.length;if(l===0)return"";let a=0;for(;a<l;){const g=v.charAt(l-a-1);if(g===h&&!c)a++;else if(g!==h&&c)a++;else break}return v.substr(0,l-a)}function m(v,h){if(v.indexOf(h[1])===-1)return-1;const c=v.length;let l=0,a=0;for(;a<c;a++)if(v[a]==="\\")a++;else if(v[a]===h[0])l++;else if(v[a]===h[1]&&(l--,l<0))return a;return-1}function w(v){v&&v.sanitize&&!v.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}ot.exports={escape:R,unescape:I,edit:L,cleanUrl:k,resolveUrl:o,noopTest:s,merge:u,splitCells:S,rtrim:f,findClosingBracket:m,checkSanitizeDeprecation:w}},ulZh:function(ot,We,ee){typeof window!="undefined"&&function(V,_){ot.exports=_()}(this,function(){return function(ne){var V={};function _(G){if(V[G])return V[G].exports;var U=V[G]={i:G,l:!1,exports:{}};return ne[G].call(U.exports,U,U.exports,_),U.l=!0,U.exports}return _.m=ne,_.c=V,_.d=function(G,U,R){_.o(G,U)||Object.defineProperty(G,U,{enumerable:!0,get:R})},_.r=function(G){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(G,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(G,"__esModule",{value:!0})},_.t=function(G,U){if(U&1&&(G=_(G)),U&8)return G;if(U&4&&typeof G=="object"&&G&&G.__esModule)return G;var R=Object.create(null);if(_.r(R),Object.defineProperty(R,"default",{enumerable:!0,value:G}),U&2&&typeof G!="string")for(var B in G)_.d(R,B,function(I){return G[I]}.bind(null,B));return R},_.n=function(G){var U=G&&G.__esModule?function(){return G.default}:function(){return G};return _.d(U,"a",U),U},_.o=function(G,U){return Object.prototype.hasOwnProperty.call(G,U)},_.p="/dist/",_(_.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(ne,V,_){"use strict";var G=Object.prototype.hasOwnProperty,U="~";function R(){}Object.create&&(R.prototype=Object.create(null),new R().__proto__||(U=!1));function B(x,A,k){this.fn=x,this.context=A,this.once=k||!1}function I(x,A,k,C,E){if(typeof k!="function")throw new TypeError("The listener must be a function");var b=new B(k,C||x,E),d=U?U+A:A;return x._events[d]?x._events[d].fn?x._events[d]=[x._events[d],b]:x._events[d].push(b):(x._events[d]=b,x._eventsCount++),x}function D(x,A){--x._eventsCount===0?x._events=new R:delete x._events[A]}function L(){this._events=new R,this._eventsCount=0}L.prototype.eventNames=function(){var A=[],k,C;if(this._eventsCount===0)return A;for(C in k=this._events)G.call(k,C)&&A.push(U?C.slice(1):C);return Object.getOwnPropertySymbols?A.concat(Object.getOwnPropertySymbols(k)):A},L.prototype.listeners=function(A){var k=U?U+A:A,C=this._events[k];if(!C)return[];if(C.fn)return[C.fn];for(var E=0,b=C.length,d=new Array(b);E<b;E++)d[E]=C[E].fn;return d},L.prototype.listenerCount=function(A){var k=U?U+A:A,C=this._events[k];return C?C.fn?1:C.length:0},L.prototype.emit=function(A,k,C,E,b,d){var o=U?U+A:A;if(!this._events[o])return!1;var s=this._events[o],u=arguments.length,S,f;if(s.fn){s.once&&this.removeListener(A,s.fn,void 0,!0);switch(u){case 1:return s.fn.call(s.context),!0;case 2:return s.fn.call(s.context,k),!0;case 3:return s.fn.call(s.context,k,C),!0;case 4:return s.fn.call(s.context,k,C,E),!0;case 5:return s.fn.call(s.context,k,C,E,b),!0;case 6:return s.fn.call(s.context,k,C,E,b,d),!0}for(f=1,S=new Array(u-1);f<u;f++)S[f-1]=arguments[f];s.fn.apply(s.context,S)}else{var m=s.length,w;for(f=0;f<m;f++){s[f].once&&this.removeListener(A,s[f].fn,void 0,!0);switch(u){case 1:s[f].fn.call(s[f].context);break;case 2:s[f].fn.call(s[f].context,k);break;case 3:s[f].fn.call(s[f].context,k,C);break;case 4:s[f].fn.call(s[f].context,k,C,E);break;default:if(!S)for(w=1,S=new Array(u-1);w<u;w++)S[w-1]=arguments[w];s[f].fn.apply(s[f].context,S)}}}return!0},L.prototype.on=function(A,k,C){return I(this,A,k,C,!1)},L.prototype.once=function(A,k,C){return I(this,A,k,C,!0)},L.prototype.removeListener=function(A,k,C,E){var b=U?U+A:A;if(!this._events[b])return this;if(!k)return D(this,b),this;var d=this._events[b];if(d.fn)d.fn===k&&(!E||d.once)&&(!C||d.context===C)&&D(this,b);else{for(var o=0,s=[],u=d.length;o<u;o++)(d[o].fn!==k||E&&!d[o].once||C&&d[o].context!==C)&&s.push(d[o]);s.length?this._events[b]=s.length===1?s[0]:s:D(this,b)}return this},L.prototype.removeAllListeners=function(A){var k;return A?(k=U?U+A:A,this._events[k]&&D(this,k)):(this._events=new R,this._eventsCount=0),this},L.prototype.off=L.prototype.removeListener,L.prototype.addListener=L.prototype.on,L.prefixed=U,L.EventEmitter=L,ne.exports=L},"./node_modules/url-toolkit/src/url-toolkit.js":function(ne,V,_){(function(G){var U=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,R=/^([^\/?#]*)([^]*)$/,B=/(?:\/|^)\.(?=\/)/g,I=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,D={buildAbsoluteURL:function(L,x,A){if(A=A||{},L=L.trim(),x=x.trim(),!x){if(!A.alwaysNormalize)return L;var k=D.parseURL(L);if(!k)throw new Error("Error trying to parse base URL.");return k.path=D.normalizePath(k.path),D.buildURLFromParts(k)}var C=D.parseURL(x);if(!C)throw new Error("Error trying to parse relative URL.");if(C.scheme)return A.alwaysNormalize?(C.path=D.normalizePath(C.path),D.buildURLFromParts(C)):x;var E=D.parseURL(L);if(!E)throw new Error("Error trying to parse base URL.");if(!E.netLoc&&E.path&&E.path[0]!=="/"){var b=R.exec(E.path);E.netLoc=b[1],E.path=b[2]}E.netLoc&&!E.path&&(E.path="/");var d={scheme:E.scheme,netLoc:C.netLoc,path:null,params:C.params,query:C.query,fragment:C.fragment};if(!C.netLoc&&(d.netLoc=E.netLoc,C.path[0]!=="/"))if(!C.path)d.path=E.path,C.params||(d.params=E.params,C.query||(d.query=E.query));else{var o=E.path,s=o.substring(0,o.lastIndexOf("/")+1)+C.path;d.path=D.normalizePath(s)}return d.path===null&&(d.path=A.alwaysNormalize?D.normalizePath(C.path):C.path),D.buildURLFromParts(d)},parseURL:function(L){var x=U.exec(L);return x?{scheme:x[1]||"",netLoc:x[2]||"",path:x[3]||"",params:x[4]||"",query:x[5]||"",fragment:x[6]||""}:null},normalizePath:function(L){for(L=L.split("").reverse().join("").replace(B,"");L.length!==(L=L.replace(I,"")).length;);return L.split("").reverse().join("")},buildURLFromParts:function(L){return L.scheme+L.netLoc+L.path+L.params+L.query+L.fragment}};ne.exports=D})(this)},"./node_modules/webworkify-webpack/index.js":function(ne,V,_){function G(A){var k={};function C(b){if(k[b])return k[b].exports;var d=k[b]={i:b,l:!1,exports:{}};return A[b].call(d.exports,d,d.exports,C),d.l=!0,d.exports}C.m=A,C.c=k,C.i=function(b){return b},C.d=function(b,d,o){C.o(b,d)||Object.defineProperty(b,d,{configurable:!1,enumerable:!0,get:o})},C.r=function(b){Object.defineProperty(b,"__esModule",{value:!0})},C.n=function(b){var d=b&&b.__esModule?function(){return b.default}:function(){return b};return C.d(d,"a",d),d},C.o=function(b,d){return Object.prototype.hasOwnProperty.call(b,d)},C.p="/",C.oe=function(b){throw console.error(b),b};var E=C(C.s=ENTRY_MODULE);return E.default||E}var U="[\\.|\\-|\\+|\\w|/|@]+",R="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+U+").*?\\)";function B(A){return(A+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function I(A){return!isNaN(1*A)}function D(A,k,C){var E={};E[C]=[];var b=k.toString(),d=b.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!d)return E;for(var o=d[1],s=new RegExp("(\\\\n|\\W)"+B(o)+R,"g"),u;u=s.exec(b);){if(u[3]==="dll-reference")continue;E[C].push(u[3])}for(s=new RegExp("\\("+B(o)+'\\("(dll-reference\\s('+U+'))"\\)\\)'+R,"g");u=s.exec(b);)A[u[2]]||(E[C].push(u[1]),A[u[2]]=_(u[1]).m),E[u[2]]=E[u[2]]||[],E[u[2]].push(u[4]);for(var S=Object.keys(E),f=0;f<S.length;f++)for(var m=0;m<E[S[f]].length;m++)I(E[S[f]][m])&&(E[S[f]][m]=1*E[S[f]][m]);return E}function L(A){var k=Object.keys(A);return k.reduce(function(C,E){return C||A[E].length>0},!1)}function x(A,k){for(var C={main:[k]},E={main:[]},b={main:{}};L(C);)for(var d=Object.keys(C),o=0;o<d.length;o++){var s=d[o],u=C[s],S=u.pop();if(b[s]=b[s]||{},b[s][S]||!A[s][S])continue;b[s][S]=!0,E[s]=E[s]||[],E[s].push(S);for(var f=D(A,A[s][S],s),m=Object.keys(f),w=0;w<m.length;w++)C[m[w]]=C[m[w]]||[],C[m[w]]=C[m[w]].concat(f[m[w]])}return E}ne.exports=function(A,k){k=k||{};var C={main:_.m},E=k.all?{main:Object.keys(C.main)}:x(C,A),b="";Object.keys(E).filter(function(S){return S!=="main"}).forEach(function(S){for(var f=0;E[S][f];)f++;E[S].push(f),C[S][f]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",b=b+"var "+S+" = ("+G.toString().replace("ENTRY_MODULE",JSON.stringify(f))+")({"+E[S].map(function(m){return""+JSON.stringify(m)+": "+C[S][m].toString()}).join(",")+`});
|
|
`}),b=b+"new (("+G.toString().replace("ENTRY_MODULE",JSON.stringify(A))+")({"+E.main.map(function(S){return""+JSON.stringify(S)+": "+C.main[S].toString()}).join(",")+"}))(self);";var d=new window.Blob([b],{type:"text/javascript"});if(k.bare)return d;var o=window.URL||window.webkitURL||window.mozURL||window.msURL,s=o.createObjectURL(d),u=new window.Worker(s);return u.objectURL=s,u}},"./src/config.ts":function(ne,V,_){"use strict";_.r(V),_.d(V,"hlsDefaultConfig",function(){return w}),_.d(V,"mergeConfig",function(){return h}),_.d(V,"enableStreamingMode",function(){return c});var G=_("./src/controller/abr-controller.ts"),U=_("./src/controller/audio-stream-controller.ts"),R=_("./src/controller/audio-track-controller.ts"),B=_("./src/controller/subtitle-stream-controller.ts"),I=_("./src/controller/subtitle-track-controller.ts"),D=_("./src/controller/buffer-controller.ts"),L=_("./src/controller/timeline-controller.ts"),x=_("./src/controller/cap-level-controller.ts"),A=_("./src/controller/fps-controller.ts"),k=_("./src/controller/eme-controller.ts"),C=_("./src/controller/cmcd-controller.ts"),E=_("./src/utils/xhr-loader.ts"),b=_("./src/utils/fetch-loader.ts"),d=_("./src/utils/cues.ts"),o=_("./src/utils/mediakeys-helper.ts"),s=_("./src/utils/logger.ts");function u(){return u=Object.assign||function(l){for(var a=1;a<arguments.length;a++){var g=arguments[a];for(var p in g)Object.prototype.hasOwnProperty.call(g,p)&&(l[p]=g[p])}return l},u.apply(this,arguments)}function S(l,a){var g=Object.keys(l);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(l);a&&(p=p.filter(function(y){return Object.getOwnPropertyDescriptor(l,y).enumerable})),g.push.apply(g,p)}return g}function f(l){for(var a=1;a<arguments.length;a++){var g=arguments[a]!=null?arguments[a]:{};a%2?S(Object(g),!0).forEach(function(p){m(l,p,g[p])}):Object.getOwnPropertyDescriptors?Object.defineProperties(l,Object.getOwnPropertyDescriptors(g)):S(Object(g)).forEach(function(p){Object.defineProperty(l,p,Object.getOwnPropertyDescriptor(g,p))})}return l}function m(l,a,g){return a in l?Object.defineProperty(l,a,{value:g,enumerable:!0,configurable:!0,writable:!0}):l[a]=g,l}var w=f(f({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:Infinity,maxBufferSize:60*1e3*1e3,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:Infinity,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:E.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:G.default,bufferController:D.default,capLevelController:x.default,fpsController:A.default,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:o.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},v()),{},{subtitleStreamController:B.SubtitleStreamController,subtitleTrackController:I.default,timelineController:L.TimelineController,audioStreamController:U.default,audioTrackController:R.default,emeController:k.default,cmcdController:C.default});function v(){return{cueHandler:d.default,enableCEA708Captions:!0,enableWebVTT:!0,enableIMSC1:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function h(l,a){if((a.liveSyncDurationCount||a.liveMaxLatencyDurationCount)&&(a.liveSyncDuration||a.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(a.liveMaxLatencyDurationCount!==void 0&&(a.liveSyncDurationCount===void 0||a.liveMaxLatencyDurationCount<=a.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(a.liveMaxLatencyDuration!==void 0&&(a.liveSyncDuration===void 0||a.liveMaxLatencyDuration<=a.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return u({},l,a)}function c(l){var a=l.loader;if(a!==b.default&&a!==E.default)s.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),l.progressive=!1;else{var g=Object(b.fetchSupported)();g&&(l.loader=b.default,l.progressive=!0,l.enableSoftwareAES=!0,s.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(ne,V,_){"use strict";_.r(V);var G=_("./src/polyfills/number.ts"),U=_("./src/utils/ewma-bandwidth-estimator.ts"),R=_("./src/events.ts"),B=_("./src/utils/buffer-helper.ts"),I=_("./src/errors.ts"),D=_("./src/types/loader.ts"),L=_("./src/utils/logger.ts");function x(C,E){for(var b=0;b<E.length;b++){var d=E[b];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(C,d.key,d)}}function A(C,E,b){return E&&x(C.prototype,E),b&&x(C,b),C}var k=function(){function C(b){this.hls=void 0,this.lastLoadedFragLevel=0,this._nextAutoLevel=-1,this.timer=void 0,this.onCheck=this._abandonRulesCheck.bind(this),this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this.hls=b;var d=b.config;this.bwEstimator=new U.default(d.abrEwmaSlowVoD,d.abrEwmaFastVoD,d.abrEwmaDefaultEstimate),this.registerListeners()}var E=C.prototype;return E.registerListeners=function(){var d=this.hls;d.on(R.Events.FRAG_LOADING,this.onFragLoading,this),d.on(R.Events.FRAG_LOADED,this.onFragLoaded,this),d.on(R.Events.FRAG_BUFFERED,this.onFragBuffered,this),d.on(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.on(R.Events.ERROR,this.onError,this)},E.unregisterListeners=function(){var d=this.hls;d.off(R.Events.FRAG_LOADING,this.onFragLoading,this),d.off(R.Events.FRAG_LOADED,this.onFragLoaded,this),d.off(R.Events.FRAG_BUFFERED,this.onFragBuffered,this),d.off(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.off(R.Events.ERROR,this.onError,this)},E.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},E.onFragLoading=function(d,o){var s=o.frag;if(s.type===D.PlaylistLevelType.MAIN&&!this.timer){var u;this.fragCurrent=s,this.partCurrent=(u=o.part)!=null?u:null,this.timer=self.setInterval(this.onCheck,100)}},E.onLevelLoaded=function(d,o){var s=this.hls.config;o.details.live?this.bwEstimator.update(s.abrEwmaSlowLive,s.abrEwmaFastLive):this.bwEstimator.update(s.abrEwmaSlowVoD,s.abrEwmaFastVoD)},E._abandonRulesCheck=function(){var d=this.fragCurrent,o=this.partCurrent,s=this.hls,u=s.autoLevelEnabled,S=s.config,f=s.media;if(!d||!f)return;var m=o?o.stats:d.stats,w=o?o.duration:d.duration;if(m.aborted){L.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!u||f.paused||!f.playbackRate||!f.readyState)return;var v=performance.now()-m.loading.start,h=Math.abs(f.playbackRate);if(v<=500*w/h)return;var c=s.levels,l=s.minAutoLevel,a=c[d.level],g=m.total||Math.max(m.loaded,Math.round(w*a.maxBitrate/8)),p=Math.max(1,m.bwEstimate?m.bwEstimate/8:m.loaded*1e3/v),y=(g-m.loaded)/p,M=f.currentTime,F=(B.BufferHelper.bufferInfo(f,M,S.maxBufferHole).end-M)/h;if(F>=2*w/h||y<=F)return;var j=Number.POSITIVE_INFINITY,W;for(W=d.level-1;W>l;W--){var O=c[W].maxBitrate;if(j=w*O/(8*.8*p),j<F)break}if(j>=y)return;var P=this.bwEstimator.getEstimate();L.logger.warn("Fragment "+d.sn+(o?" part "+o.index:"")+" of level "+d.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+W+`
|
|
Current BW estimate: `+(Object(G.isFiniteNumber)(P)?(P/1024).toFixed(3):"Unknown")+` Kb/s
|
|
Estimated load time for current fragment: `+y.toFixed(3)+` s
|
|
Estimated load time for the next fragment: `+j.toFixed(3)+` s
|
|
Time to underbuffer: `+F.toFixed(3)+" s"),s.nextLoadLevel=W,this.bwEstimator.sample(v,m.loaded),this.clearTimer(),d.loader&&(this.fragCurrent=this.partCurrent=null,d.loader.abort()),s.trigger(R.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:d,part:o,stats:m})},E.onFragLoaded=function(d,o){var s=o.frag,u=o.part;if(s.type===D.PlaylistLevelType.MAIN&&Object(G.isFiniteNumber)(s.sn)){var S=u?u.stats:s.stats,f=u?u.duration:s.duration;if(this.clearTimer(),this.lastLoadedFragLevel=s.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var m=this.hls.levels[s.level],w=(m.loaded?m.loaded.bytes:0)+S.loaded,v=(m.loaded?m.loaded.duration:0)+f;m.loaded={bytes:w,duration:v},m.realBitrate=Math.round(8*w/v)}if(s.bitrateTest){var h={stats:S,frag:s,part:u,id:s.type};this.onFragBuffered(R.Events.FRAG_BUFFERED,h),s.bitrateTest=!1}}},E.onFragBuffered=function(d,o){var s=o.frag,u=o.part,S=u?u.stats:s.stats;if(S.aborted)return;if(s.type!==D.PlaylistLevelType.MAIN||s.sn==="initSegment")return;var f=S.parsing.end-S.loading.start;this.bwEstimator.sample(f,S.loaded),S.bwEstimate=this.bwEstimator.getEstimate(),s.bitrateTest?this.bitrateTestDelay=f/1e3:this.bitrateTestDelay=0},E.onError=function(d,o){switch(o.details){case I.ErrorDetails.FRAG_LOAD_ERROR:case I.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},E.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},E.getNextABRAutoLevel=function(){var d=this.fragCurrent,o=this.partCurrent,s=this.hls,u=s.maxAutoLevel,S=s.config,f=s.minAutoLevel,m=s.media,w=o?o.duration:d?d.duration:0,v=m?m.currentTime:0,h=m&&m.playbackRate!==0?Math.abs(m.playbackRate):1,c=this.bwEstimator?this.bwEstimator.getEstimate():S.abrEwmaDefaultEstimate,l=(B.BufferHelper.bufferInfo(m,v,S.maxBufferHole).end-v)/h,a=this.findBestLevel(c,f,u,l,S.abrBandWidthFactor,S.abrBandWidthUpFactor);if(a>=0)return a;L.logger.trace((l?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var g=w?Math.min(w,S.maxStarvationDelay):S.maxStarvationDelay,p=S.abrBandWidthFactor,y=S.abrBandWidthUpFactor;if(!l){var M=this.bitrateTestDelay;if(M){var F=w?Math.min(w,S.maxLoadingDelay):S.maxLoadingDelay;g=F-M,L.logger.trace("bitrate test took "+Math.round(1e3*M)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*g)+" ms"),p=y=1}}return a=this.findBestLevel(c,f,u,l+g,p,y),Math.max(a,0)},E.findBestLevel=function(d,o,s,u,S,f){for(var m,w=this.fragCurrent,v=this.partCurrent,h=this.lastLoadedFragLevel,c=this.hls.levels,l=c[h],a=!!(l!=null&&(m=l.details)!==null&&m!==void 0&&m.live),g=l==null?void 0:l.codecSet,p=v?v.duration:w?w.duration:0,y=s;y>=o;y--){var M=c[y];if(!M||g&&M.codecSet!==g)continue;var F=M.details,j=(v?F==null?void 0:F.partTarget:F==null?void 0:F.averagetargetduration)||p,W=void 0;y<=h?W=S*d:W=f*d;var O=c[y].maxBitrate,P=O*j/W;if(L.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+y+"/"+Math.round(W)+"/"+O+"/"+j+"/"+u+"/"+P),W>O&&(!P||a&&!this.bitrateTestDelay||P<u))return y}return-1},A(C,[{key:"nextAutoLevel",get:function(){var d=this._nextAutoLevel,o=this.bwEstimator;if(d!==-1&&(!o||!o.canEstimate()))return d;var s=this.getNextABRAutoLevel();return d!==-1&&(s=Math.min(d,s)),s},set:function(d){this._nextAutoLevel=d}}]),C}();V.default=k},"./src/controller/audio-stream-controller.ts":function(ne,V,_){"use strict";_.r(V);var G=_("./src/polyfills/number.ts"),U=_("./src/controller/base-stream-controller.ts"),R=_("./src/events.ts"),B=_("./src/utils/buffer-helper.ts"),I=_("./src/controller/fragment-tracker.ts"),D=_("./src/types/level.ts"),L=_("./src/types/loader.ts"),x=_("./src/loader/fragment.ts"),A=_("./src/demux/chunk-cache.ts"),k=_("./src/demux/transmuxer-interface.ts"),C=_("./src/types/transmuxer.ts"),E=_("./src/controller/fragment-finders.ts"),b=_("./src/utils/discontinuities.ts"),d=_("./src/errors.ts"),o=_("./src/utils/logger.ts");function s(){return s=Object.assign||function(w){for(var v=1;v<arguments.length;v++){var h=arguments[v];for(var c in h)Object.prototype.hasOwnProperty.call(h,c)&&(w[c]=h[c])}return w},s.apply(this,arguments)}function u(w,v){w.prototype=Object.create(v.prototype),w.prototype.constructor=w,S(w,v)}function S(w,v){return S=Object.setPrototypeOf||function(c,l){return c.__proto__=l,c},S(w,v)}var f=100,m=function(w){u(v,w);function v(c,l){var a;return a=w.call(this,c,l,"[audio-stream-controller]")||this,a.videoBuffer=null,a.videoTrackCC=-1,a.waitingVideoCC=-1,a.audioSwitch=!1,a.trackId=-1,a.waitingData=null,a.mainDetails=null,a.bufferFlushed=!1,a._registerListeners(),a}var h=v.prototype;return h.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},h._registerListeners=function(){var l=this.hls;l.on(R.Events.MEDIA_ATTACHED,this.onMediaAttached,this),l.on(R.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.on(R.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.on(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.on(R.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),l.on(R.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),l.on(R.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),l.on(R.Events.ERROR,this.onError,this),l.on(R.Events.BUFFER_RESET,this.onBufferReset,this),l.on(R.Events.BUFFER_CREATED,this.onBufferCreated,this),l.on(R.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),l.on(R.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),l.on(R.Events.FRAG_BUFFERED,this.onFragBuffered,this)},h._unregisterListeners=function(){var l=this.hls;l.off(R.Events.MEDIA_ATTACHED,this.onMediaAttached,this),l.off(R.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.off(R.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.off(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),l.off(R.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),l.off(R.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),l.off(R.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),l.off(R.Events.ERROR,this.onError,this),l.off(R.Events.BUFFER_RESET,this.onBufferReset,this),l.off(R.Events.BUFFER_CREATED,this.onBufferCreated,this),l.off(R.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),l.off(R.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),l.off(R.Events.FRAG_BUFFERED,this.onFragBuffered,this)},h.onInitPtsFound=function(l,a){var g=a.frag,p=a.id,y=a.initPTS;if(p==="main"){var M=g.cc;this.initPTS[g.cc]=y,this.log("InitPTS for cc: "+M+" found from main: "+y),this.videoTrackCC=M,this.state===U.State.WAITING_INIT_PTS&&this.tick()}},h.startLoad=function(l){if(!this.levels){this.startPosition=l,this.state=U.State.STOPPED;return}var a=this.lastCurrentTime;this.stopLoad(),this.setInterval(f),this.fragLoadError=0,a>0&&l===-1?(this.log("Override startPosition with lastCurrentTime @"+a.toFixed(3)),this.state=U.State.IDLE):(this.loadedmetadata=!1,this.state=U.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=l,this.tick()},h.doTick=function(){switch(this.state){case U.State.IDLE:this.doTickIdle();break;case U.State.WAITING_TRACK:{var l,a=this.levels,g=this.trackId,p=a==null||((l=a[g])===null||l===void 0)?void 0:l.details;if(p){if(this.waitForCdnTuneIn(p))break;this.state=U.State.WAITING_INIT_PTS}break}case U.State.FRAG_LOADING_WAITING_RETRY:{var y,M=performance.now(),F=this.retryDate;(!F||M>=F||(y=this.media)!==null&&y!==void 0&&y.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=U.State.IDLE);break}case U.State.WAITING_INIT_PTS:{var j=this.waitingData;if(j){var W=j.frag,O=j.part,P=j.cache,H=j.complete;if(this.initPTS[W.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=U.State.FRAG_LOADING;var X=P.flush(),q={frag:W,part:O,payload:X,networkDetails:null};this._handleFragmentLoadProgress(q),H&&w.prototype._handleFragmentLoadComplete.call(this,q)}else if(this.videoTrackCC!==this.waitingVideoCC)o.logger.log("Waiting fragment cc ("+W.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var re=this.getLoadPosition(),Ee=B.BufferHelper.bufferInfo(this.mediaBuffer,re,this.config.maxBufferHole),he=Object(E.fragmentWithinToleranceTest)(Ee.end,this.config.maxFragLookUpTolerance,W);he<0&&(o.logger.log("Waiting fragment cc ("+W.cc+") @ "+W.start+" cancelled because another fragment at "+Ee.end+" is needed"),this.clearWaitingFragment())}}else this.state=U.State.IDLE}}this.onTickEnd()},h.clearWaitingFragment=function(){var l=this.waitingData;l&&(this.fragmentTracker.removeFragment(l.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=U.State.IDLE)},h.onTickEnd=function(){var l=this.media;if(!l||!l.readyState)return;var a=this.mediaBuffer?this.mediaBuffer:l,g=a.buffered;!this.loadedmetadata&&g.length&&(this.loadedmetadata=!0),this.lastCurrentTime=l.currentTime},h.doTickIdle=function(){var l,a,g=this.hls,p=this.levels,y=this.media,M=this.trackId,F=g.config;if(!p||!p[M])return;if(!y&&(this.startFragRequested||!F.startFragPrefetch))return;var j=p[M],W=j.details;if(!W||W.live&&this.levelLastLoaded!==M||this.waitForCdnTuneIn(W)){this.state=U.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,x.ElementaryStreamTypes.AUDIO,L.PlaylistLevelType.AUDIO));var O=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,L.PlaylistLevelType.AUDIO);if(O===null)return;var P=O.len,H=this.getMaxBufferLength(),X=this.audioSwitch;if(P>=H&&!X)return;if(!X&&this._streamEnded(O,W)){g.trigger(R.Events.BUFFER_EOS,{type:"audio"}),this.state=U.State.ENDED;return}var q=W.fragments,re=q[0].start,Ee=O.end;if(X){var he=this.getLoadPosition();Ee=he,W.PTSKnown&&he<re&&((O.end>re||O.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),y.currentTime=re+.05))}var xe=this.getNextFragment(Ee,W);if(!xe){this.bufferFlushed=!0;return}((l=xe.decryptdata)===null||l===void 0?void 0:l.keyFormat)==="identity"&&!((a=xe.decryptdata)!==null&&a!==void 0&&a.key)?this.loadKey(xe,W):this.loadFragment(xe,W,Ee)},h.getMaxBufferLength=function(){var l=w.prototype.getMaxBufferLength.call(this),a=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,L.PlaylistLevelType.MAIN);return a===null?l:Math.max(l,a.len)},h.onMediaDetaching=function(){this.videoBuffer=null,w.prototype.onMediaDetaching.call(this)},h.onAudioTracksUpdated=function(l,a){var g=a.audioTracks;this.resetTransmuxer(),this.levels=g.map(function(p){return new D.Level(p)})},h.onAudioTrackSwitching=function(l,a){var g=!!a.url;this.trackId=a.id;var p=this.fragCurrent;p!=null&&p.loader&&p.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),g?this.setInterval(f):this.resetTransmuxer(),g?(this.audioSwitch=!0,this.state=U.State.IDLE):this.state=U.State.STOPPED,this.tick()},h.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},h.onLevelLoaded=function(l,a){this.mainDetails=a.details},h.onAudioTrackLoaded=function(l,a){var g,p=this.levels,y=a.details,M=a.id;if(!p){this.warn("Audio tracks were reset while loading level "+M);return}this.log("Track "+M+" loaded ["+y.startSN+","+y.endSN+"],duration:"+y.totalduration);var F=p[M],j=0;if(y.live||(g=F.details)!==null&&g!==void 0&&g.live){var W=this.mainDetails;if(y.fragments[0]||(y.deltaUpdateFailed=!0),y.deltaUpdateFailed||!W)return;!F.details&&y.hasProgramDateTime&&W.hasProgramDateTime?(Object(b.alignMediaPlaylistByPDT)(y,W),j=y.fragments[0].start):j=this.alignPlaylists(y,F.details)}F.details=y,this.levelLastLoaded=M,!this.startFragRequested&&(this.mainDetails||!y.live)&&this.setStartPosition(F.details,j),this.state===U.State.WAITING_TRACK&&!this.waitForCdnTuneIn(y)&&(this.state=U.State.IDLE),this.tick()},h._handleFragmentLoadProgress=function(l){var a,g=l.frag,p=l.part,y=l.payload,M=this.config,F=this.trackId,j=this.levels;if(!j){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+g.sn+" of level "+g.level+" will not be buffered");return}var W=j[F];console.assert(W,"Audio track is defined on fragment load progress");var O=W.details;console.assert(O,"Audio track details are defined on fragment load progress");var P=M.defaultAudioCodec||W.audioCodec||"mp4a.40.2",H=this.transmuxer;H||(H=this.transmuxer=new k.default(this.hls,L.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var X=this.initPTS[g.cc],q=(a=g.initSegment)===null||a===void 0?void 0:a.data;if(X!==void 0){var re=!1,Ee=p?p.index:-1,he=Ee!==-1,xe=new C.ChunkMetadata(g.level,g.sn,g.stats.chunkCount,y.byteLength,Ee,he);H.push(y,q,P,"",g,p,O.totalduration,re,xe,X)}else{o.logger.log("Unknown video PTS for cc "+g.cc+", waiting for video PTS before demuxing audio frag "+g.sn+" of ["+O.startSN+" ,"+O.endSN+"],track "+F);var pe=this.waitingData=this.waitingData||{frag:g,part:p,cache:new A.default,complete:!1},ve=pe.cache;ve.push(new Uint8Array(y)),this.waitingVideoCC=this.videoTrackCC,this.state=U.State.WAITING_INIT_PTS}},h._handleFragmentLoadComplete=function(l){if(this.waitingData){this.waitingData.complete=!0;return}w.prototype._handleFragmentLoadComplete.call(this,l)},h.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},h.onBufferCreated=function(l,a){var g=a.tracks.audio;g&&(this.mediaBuffer=g.buffer),a.tracks.video&&(this.videoBuffer=a.tracks.video.buffer)},h.onFragBuffered=function(l,a){var g=a.frag,p=a.part;if(g.type!==L.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(g)){this.warn("Fragment "+g.sn+(p?" p: "+p.index:"")+" of level "+g.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}g.sn!=="initSegment"&&(this.fragPrevious=g,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(R.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(g,p)},h.onError=function(l,a){switch(a.details){case d.ErrorDetails.FRAG_LOAD_ERROR:case d.ErrorDetails.FRAG_LOAD_TIMEOUT:case d.ErrorDetails.KEY_LOAD_ERROR:case d.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(L.PlaylistLevelType.AUDIO,a);break;case d.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case d.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==U.State.ERROR&&this.state!==U.State.STOPPED&&(this.state=a.fatal?U.State.ERROR:U.State.IDLE,this.warn(a.details+" while loading frag, switching to "+this.state+" state"));break;case d.ErrorDetails.BUFFER_FULL_ERROR:if(a.parent==="audio"&&(this.state===U.State.PARSING||this.state===U.State.PARSED)){var g=!0,p=this.getFwdBufferInfo(this.mediaBuffer,L.PlaylistLevelType.AUDIO);p&&p.len>.5&&(g=!this.reduceMaxBufferLength(p.len)),g&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,w.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},h.onBufferFlushed=function(l,a){var g=a.type;g===x.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},h._handleTransmuxComplete=function(l){var a,g="audio",p=this.hls,y=l.remuxResult,M=l.chunkMeta,F=this.getCurrentContext(M);if(!F){this.warn("The loading context changed while buffering fragment "+M.sn+" of level "+M.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(M.level);return}var j=F.frag,W=F.part,O=y.audio,P=y.text,H=y.id3,X=y.initSegment;if(this.fragContextChanged(j))return;if(this.state=U.State.PARSING,this.audioSwitch&&O&&this.completeAudioSwitch(),X!=null&&X.tracks&&(this._bufferInitSegment(X.tracks,j,M),p.trigger(R.Events.FRAG_PARSING_INIT_SEGMENT,{frag:j,id:g,tracks:X.tracks})),O){var q=O.startPTS,re=O.endPTS,Ee=O.startDTS,he=O.endDTS;W&&(W.elementaryStreams[x.ElementaryStreamTypes.AUDIO]={startPTS:q,endPTS:re,startDTS:Ee,endDTS:he}),j.setElementaryStreamInfo(x.ElementaryStreamTypes.AUDIO,q,re,Ee,he),this.bufferFragmentData(O,j,W,M)}if(H!=null&&(a=H.samples)!==null&&a!==void 0&&a.length){var xe=s({frag:j,id:g},H);p.trigger(R.Events.FRAG_PARSING_METADATA,xe)}if(P){var pe=s({frag:j,id:g},P);p.trigger(R.Events.FRAG_PARSING_USERDATA,pe)}},h._bufferInitSegment=function(l,a,g){if(this.state!==U.State.PARSING)return;l.video&&delete l.video;var p=l.audio;if(!p)return;p.levelCodec=p.codec,p.id="audio",this.log("Init audio buffer, container:"+p.container+", codecs[parsed]=["+p.codec+"]"),this.hls.trigger(R.Events.BUFFER_CODECS,l);var y=p.initSegment;if(y!=null&&y.byteLength){var M={type:"audio",frag:a,part:null,chunkMeta:g,parent:a.type,data:y};this.hls.trigger(R.Events.BUFFER_APPENDING,M)}this.tick()},h.loadFragment=function(l,a,g){var p=this.fragmentTracker.getState(l);this.fragCurrent=l,(this.audioSwitch||p===I.FragmentState.NOT_LOADED||p===I.FragmentState.PARTIAL)&&(l.sn==="initSegment"?this._loadInitSegment(l):a.live&&!Object(G.isFiniteNumber)(this.initPTS[l.cc])?(this.log("Waiting for video PTS in continuity counter "+l.cc+" of live stream before loading audio fragment "+l.sn+" of level "+this.trackId),this.state=U.State.WAITING_INIT_PTS):(this.startFragRequested=!0,w.prototype.loadFragment.call(this,l,a,g)))},h.completeAudioSwitch=function(){var l=this.hls,a=this.media,g=this.trackId;a&&(this.log("Switching audio track : flushing all audio"),w.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,l.trigger(R.Events.AUDIO_TRACK_SWITCHED,{id:g})},v}(U.default);V.default=m},"./src/controller/audio-track-controller.ts":function(ne,V,_){"use strict";_.r(V);var G=_("./src/events.ts"),U=_("./src/errors.ts"),R=_("./src/controller/base-playlist-controller.ts"),B=_("./src/types/loader.ts");function I(k,C){for(var E=0;E<C.length;E++){var b=C[E];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(k,b.key,b)}}function D(k,C,E){return C&&I(k.prototype,C),E&&I(k,E),k}function L(k,C){k.prototype=Object.create(C.prototype),k.prototype.constructor=k,x(k,C)}function x(k,C){return x=Object.setPrototypeOf||function(b,d){return b.__proto__=d,b},x(k,C)}var A=function(k){L(C,k);function C(b){var d;return d=k.call(this,b,"[audio-track-controller]")||this,d.tracks=[],d.groupId=null,d.tracksInGroup=[],d.trackId=-1,d.trackName="",d.selectDefaultTrack=!0,d.registerListeners(),d}var E=C.prototype;return E.registerListeners=function(){var d=this.hls;d.on(G.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.on(G.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.on(G.Events.LEVEL_LOADING,this.onLevelLoading,this),d.on(G.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),d.on(G.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.on(G.Events.ERROR,this.onError,this)},E.unregisterListeners=function(){var d=this.hls;d.off(G.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.off(G.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.off(G.Events.LEVEL_LOADING,this.onLevelLoading,this),d.off(G.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),d.off(G.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.off(G.Events.ERROR,this.onError,this)},E.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,k.prototype.destroy.call(this)},E.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},E.onManifestParsed=function(d,o){this.tracks=o.audioTracks||[]},E.onAudioTrackLoaded=function(d,o){var s=o.id,u=o.details,S=this.tracksInGroup[s];if(!S){this.warn("Invalid audio track id "+s);return}var f=S.details;S.details=o.details,this.log("audioTrack "+s+" loaded ["+u.startSN+"-"+u.endSN+"]"),s===this.trackId&&(this.retryCount=0,this.playlistLoaded(s,o,f))},E.onLevelLoading=function(d,o){this.switchLevel(o.level)},E.onLevelSwitching=function(d,o){this.switchLevel(o.level)},E.switchLevel=function(d){var o=this.hls.levels[d];if(!(o!=null&&o.audioGroupIds))return;var s=o.audioGroupIds[o.urlId];if(this.groupId!==s){this.groupId=s;var u=this.tracks.filter(function(f){return!s||f.groupId===s});this.selectDefaultTrack&&!u.some(function(f){return f.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=u;var S={audioTracks:u};this.log("Updating audio tracks, "+u.length+' track(s) found in "'+s+'" group-id'),this.hls.trigger(G.Events.AUDIO_TRACKS_UPDATED,S),this.selectInitialTrack()}},E.onError=function(d,o){if(k.prototype.onError.call(this,d,o),o.fatal||!o.context)return;o.context.type===B.PlaylistContextType.AUDIO_TRACK&&o.context.id===this.trackId&&o.context.groupId===this.groupId&&this.retryLoadingOrFail(o)},E.setAudioTrack=function(d){var o=this.tracksInGroup;if(d<0||d>=o.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var s=o[this.trackId];this.log("Now switching to audio-track index "+d);var u=o[d],S=u.id,f=u.groupId,m=f===void 0?"":f,w=u.name,v=u.type,h=u.url;if(this.trackId=d,this.trackName=w,this.selectDefaultTrack=!1,this.hls.trigger(G.Events.AUDIO_TRACK_SWITCHING,{id:S,groupId:m,name:w,type:v,url:h}),u.details&&!u.details.live)return;var c=this.switchParams(u.url,s==null?void 0:s.details);this.loadPlaylist(c)},E.selectInitialTrack=function(){var d=this.tracksInGroup;console.assert(d.length,"Initial audio track should be selected when tracks are known");var o=this.trackName,s=this.findTrackId(o)||this.findTrackId();s!==-1?this.setAudioTrack(s):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(G.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},E.findTrackId=function(d){for(var o=this.tracksInGroup,s=0;s<o.length;s++){var u=o[s];if((!this.selectDefaultTrack||u.default)&&(!d||d===u.name))return u.id}return-1},E.loadPlaylist=function(d){var o=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(o)){var s=o.id,u=o.groupId,S=o.url;if(d)try{S=d.addDirectives(S)}catch(f){this.warn("Could not construct new URL with HLS Delivery Directives: "+f)}this.log("loading audio-track playlist for id: "+s),this.clearTimer(),this.hls.trigger(G.Events.AUDIO_TRACK_LOADING,{url:S,id:s,groupId:u,deliveryDirectives:d||null})}},D(C,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(d){this.selectDefaultTrack=!1,this.setAudioTrack(d)}}]),C}(R.default);V.default=A},"./src/controller/base-playlist-controller.ts":function(ne,V,_){"use strict";_.r(V),_.d(V,"default",function(){return D});var G=_("./src/polyfills/number.ts"),U=_("./src/types/level.ts"),R=_("./src/controller/level-helper.ts"),B=_("./src/utils/logger.ts"),I=_("./src/errors.ts"),D=function(){function L(A,k){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=B.logger.log.bind(B.logger,k+":"),this.warn=B.logger.warn.bind(B.logger,k+":"),this.hls=A}var x=L.prototype;return x.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},x.onError=function(k,C){C.fatal&&C.type===I.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},x.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},x.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},x.stopLoad=function(){this.canLoad=!1,this.clearTimer()},x.switchParams=function(k,C){var E=C==null?void 0:C.renditionReports;if(E)for(var b=0;b<E.length;b++){var d=E[b],o=""+d.URI;if(o===k.substr(-o.length)){var s=parseInt(d["LAST-MSN"]),u=parseInt(d["LAST-PART"]);if(C&&this.hls.config.lowLatencyMode){var S=Math.min(C.age-C.partTarget,C.targetduration);u!==void 0&&S>C.partTarget&&(u+=1)}if(Object(G.isFiniteNumber)(s))return new U.HlsUrlParameters(s,Object(G.isFiniteNumber)(u)?u:void 0,U.HlsSkip.No)}}},x.loadPlaylist=function(k){},x.shouldLoadTrack=function(k){return this.canLoad&&k&&!!k.url&&(!k.details||k.details.live)},x.playlistLoaded=function(k,C,E){var b=this,d=C.details,o=C.stats,s=o.loading.end?Math.max(0,self.performance.now()-o.loading.end):0;if(d.advancedDateTime=Date.now()-s,d.live||E!=null&&E.live){if(d.reloaded(E),E&&this.log("live playlist "+k+" "+(d.advanced?"REFRESHED "+d.lastPartSn+"-"+d.lastPartIndex:"MISSED")),E&&d.fragments.length>0&&Object(R.mergeDetails)(E,d),!this.canLoad||!d.live)return;var u,S=void 0,f=void 0;if(d.canBlockReload&&d.endSN&&d.advanced){var m=this.hls.config.lowLatencyMode,w=d.lastPartSn,v=d.endSN,h=d.lastPartIndex,c=h!==-1,l=w===v,a=m?0:h;c?(S=l?v+1:w,f=l?a:h+1):S=v+1;var g=d.age,p=g+d.ageHeader,y=Math.min(p-d.partTarget,d.targetduration*1.5);if(y>0){if(E&&y>E.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+E.tuneInGoal+" to: "+y+" with playlist age: "+d.age),y=0;else{var M=Math.floor(y/d.targetduration);if(S+=M,f!==void 0){var F=Math.round(y%d.targetduration/d.partTarget);f+=F}this.log("CDN Tune-in age: "+d.ageHeader+"s last advanced "+g.toFixed(2)+"s goal: "+y+" skip sn "+M+" to part "+f)}d.tuneInGoal=y}if(u=this.getDeliveryDirectives(d,C.deliveryDirectives,S,f),m||!l){this.loadPlaylist(u);return}}else u=this.getDeliveryDirectives(d,C.deliveryDirectives,S,f);var j=Object(R.computeReloadInterval)(d,o);S!==void 0&&d.canBlockReload&&(j-=d.partTarget||1),this.log("reload live playlist "+k+" in "+Math.round(j)+" ms"),this.timer=self.setTimeout(function(){return b.loadPlaylist(u)},j)}else this.clearTimer()},x.getDeliveryDirectives=function(k,C,E,b){var d=Object(U.getSkipValue)(k,E);return C!=null&&C.skip&&k.deltaUpdateFailed&&(E=C.msn,b=C.part,d=U.HlsSkip.No),new U.HlsUrlParameters(E,b,d)},x.retryLoadingOrFail=function(k){var C=this,E=this.hls.config,b=this.retryCount<E.levelLoadingMaxRetry;if(b){var d;if(this.retryCount++,k.details.indexOf("LoadTimeOut")>-1&&(d=k.context)!==null&&d!==void 0&&d.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+k.details+'"'),this.loadPlaylist();else{var o=Math.min(Math.pow(2,this.retryCount)*E.levelLoadingRetryDelay,E.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return C.loadPlaylist()},o),this.warn("retry playlist loading #"+this.retryCount+" in "+o+' ms after "'+k.details+'"')}}else this.warn('cannot recover from error "'+k.details+'"'),this.clearTimer(),k.fatal=!0;return b},L}()},"./src/controller/base-stream-controller.ts":function(ne,V,_){"use strict";_.r(V),_.d(V,"State",function(){return v}),_.d(V,"default",function(){return h});var G=_("./src/polyfills/number.ts"),U=_("./src/task-loop.ts"),R=_("./src/controller/fragment-tracker.ts"),B=_("./src/utils/buffer-helper.ts"),I=_("./src/utils/logger.ts"),D=_("./src/events.ts"),L=_("./src/errors.ts"),x=_("./src/types/transmuxer.ts"),A=_("./src/utils/mp4-tools.ts"),k=_("./src/utils/discontinuities.ts"),C=_("./src/controller/fragment-finders.ts"),E=_("./src/controller/level-helper.ts"),b=_("./src/loader/fragment-loader.ts"),d=_("./src/crypt/decrypter.ts"),o=_("./src/utils/time-ranges.ts"),s=_("./src/types/loader.ts");function u(c,l){for(var a=0;a<l.length;a++){var g=l[a];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(c,g.key,g)}}function S(c,l,a){return l&&u(c.prototype,l),a&&u(c,a),c}function f(c){if(c===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return c}function m(c,l){c.prototype=Object.create(l.prototype),c.prototype.constructor=c,w(c,l)}function w(c,l){return w=Object.setPrototypeOf||function(g,p){return g.__proto__=p,g},w(c,l)}var v={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",BACKTRACKING:"BACKTRACKING",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"},h=function(c){m(l,c);function l(g,p,y){var M;return M=c.call(this)||this,M.hls=void 0,M.fragPrevious=null,M.fragCurrent=null,M.fragmentTracker=void 0,M.transmuxer=null,M._state=v.STOPPED,M.media=void 0,M.mediaBuffer=void 0,M.config=void 0,M.bitrateTest=!1,M.lastCurrentTime=0,M.nextLoadPosition=0,M.startPosition=0,M.loadedmetadata=!1,M.fragLoadError=0,M.retryDate=0,M.levels=null,M.fragmentLoader=void 0,M.levelLastLoaded=null,M.startFragRequested=!1,M.decrypter=void 0,M.initPTS=[],M.onvseeking=null,M.onvended=null,M.logPrefix="",M.log=void 0,M.warn=void 0,M.logPrefix=y,M.log=I.logger.log.bind(I.logger,y+":"),M.warn=I.logger.warn.bind(I.logger,y+":"),M.hls=g,M.fragmentLoader=new b.default(g.config),M.fragmentTracker=p,M.config=g.config,M.decrypter=new d.default(g,g.config),g.on(D.Events.KEY_LOADED,M.onKeyLoaded,f(M)),M}var a=l.prototype;return a.doTick=function(){this.onTickEnd()},a.onTickEnd=function(){},a.startLoad=function(p){},a.stopLoad=function(){this.fragmentLoader.abort();var p=this.fragCurrent;p&&this.fragmentTracker.removeFragment(p),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=v.STOPPED},a._streamEnded=function(p,y){var M=this.fragCurrent,F=this.fragmentTracker;if(!y.live&&M&&M.sn===y.endSN&&!p.nextStart){var j=F.getState(M);return j===R.FragmentState.PARTIAL||j===R.FragmentState.OK}return!1},a.onMediaAttached=function(p,y){var M=this.media=this.mediaBuffer=y.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),M.addEventListener("seeking",this.onvseeking),M.addEventListener("ended",this.onvended);var F=this.config;this.levels&&F.autoStartLoad&&this.state===v.STOPPED&&this.startLoad(F.startPosition)},a.onMediaDetaching=function(){var p=this.media;p!=null&&p.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),p&&(p.removeEventListener("seeking",this.onvseeking),p.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},a.onMediaSeeking=function(){var p=this.config,y=this.fragCurrent,M=this.media,F=this.mediaBuffer,j=this.state,W=M?M.currentTime:0,O=B.BufferHelper.bufferInfo(F||M,W,p.maxBufferHole);if(this.log("media seeking to "+(Object(G.isFiniteNumber)(W)?W.toFixed(3):W)+", state: "+j),j===v.ENDED)this.resetLoadingState();else if(y&&!O.len){var P=p.maxFragLookUpTolerance,H=y.start-P,X=y.start+y.duration+P,q=W>X;(W<H||q)&&(q&&y.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),y.loader.abort()),this.resetLoadingState())}M&&(this.lastCurrentTime=W),!this.loadedmetadata&&!O.len&&(this.nextLoadPosition=this.startPosition=W),this.tickImmediate()},a.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},a.onKeyLoaded=function(p,y){if(this.state!==v.KEY_LOADING||y.frag!==this.fragCurrent||!this.levels)return;this.state=v.IDLE;var M=this.levels[y.frag.level].details;M&&this.loadFragment(y.frag,M,y.frag.start)},a.onHandlerDestroying=function(){this.stopLoad(),c.prototype.onHandlerDestroying.call(this)},a.onHandlerDestroyed=function(){this.state=v.STOPPED,this.hls.off(D.Events.KEY_LOADED,this.onKeyLoaded,this),this.fragmentLoader&&this.fragmentLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.fragmentLoader=this.fragmentTracker=null,c.prototype.onHandlerDestroyed.call(this)},a.loadKey=function(p,y){this.log("Loading key for "+p.sn+" of ["+y.startSN+"-"+y.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+p.level),this.state=v.KEY_LOADING,this.fragCurrent=p,this.hls.trigger(D.Events.KEY_LOADING,{frag:p})},a.loadFragment=function(p,y,M){this._loadFragForPlayback(p,y,M)},a._loadFragForPlayback=function(p,y,M){var F=this,j=function(O){if(F.fragContextChanged(p)){F.warn("Fragment "+p.sn+(O.part?" p: "+O.part.index:"")+" of level "+p.level+" was dropped during download."),F.fragmentTracker.removeFragment(p);return}p.stats.chunkCount++,F._handleFragmentLoadProgress(O)};this._doFragLoad(p,y,M,j).then(function(W){if(!W)return;F.fragLoadError=0;var O=F.state;if(F.fragContextChanged(p)){(O===v.FRAG_LOADING||O===v.BACKTRACKING||!F.fragCurrent&&O===v.PARSING)&&(F.fragmentTracker.removeFragment(p),F.state=v.IDLE);return}if("payload"in W&&(F.log("Loaded fragment "+p.sn+" of level "+p.level),F.hls.trigger(D.Events.FRAG_LOADED,W),F.state===v.BACKTRACKING)){F.fragmentTracker.backtrack(p,W),F.resetFragmentLoading(p);return}F._handleFragmentLoadComplete(W)}).catch(function(W){F.warn(W),F.resetFragmentLoading(p)})},a.flushMainBuffer=function(p,y,M){if(M===void 0&&(M=null),!(p-y))return;var F={startOffset:p,endOffset:y,type:M};this.fragLoadError=0,this.hls.trigger(D.Events.BUFFER_FLUSHING,F)},a._loadInitSegment=function(p){var y=this;this._doFragLoad(p).then(function(M){if(!M||y.fragContextChanged(p)||!y.levels)throw new Error("init load aborted");return M}).then(function(M){var F=y.hls,j=M.payload,W=p.decryptdata;if(j&&j.byteLength>0&&W&&W.key&&W.iv&&W.method==="AES-128"){var O=self.performance.now();return y.decrypter.webCryptoDecrypt(new Uint8Array(j),W.key.buffer,W.iv.buffer).then(function(P){var H=self.performance.now();return F.trigger(D.Events.FRAG_DECRYPTED,{frag:p,payload:P,stats:{tstart:O,tdecrypt:H}}),M.payload=P,M})}return M}).then(function(M){var F=y.fragCurrent,j=y.hls,W=y.levels;if(!W)throw new Error("init load aborted, missing levels");var O=W[p.level].details;console.assert(O,"Level details are defined when init segment is loaded");var P=p.stats;y.state=v.IDLE,y.fragLoadError=0,p.data=new Uint8Array(M.payload),P.parsing.start=P.buffering.start=self.performance.now(),P.parsing.end=P.buffering.end=self.performance.now(),M.frag===F&&j.trigger(D.Events.FRAG_BUFFERED,{stats:P,frag:F,part:null,id:p.type}),y.tick()}).catch(function(M){y.warn(M),y.resetFragmentLoading(p)})},a.fragContextChanged=function(p){var y=this.fragCurrent;return!p||!y||p.level!==y.level||p.sn!==y.sn||p.urlId!==y.urlId},a.fragBufferedComplete=function(p,y){var M=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+p.type+" sn: "+p.sn+(y?" part: "+y.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+p.level+" "+o.default.toString(B.BufferHelper.getBuffered(M))),this.state=v.IDLE,this.tick()},a._handleFragmentLoadComplete=function(p){var y=this.transmuxer;if(!y)return;var M=p.frag,F=p.part,j=p.partsLoaded,W=!j||j.length===0||j.some(function(P){return!P}),O=new x.ChunkMetadata(M.level,M.sn,M.stats.chunkCount+1,0,F?F.index:-1,!W);y.flush(O)},a._handleFragmentLoadProgress=function(p){},a._doFragLoad=function(p,y,M,F){var j=this;if(M===void 0&&(M=null),!this.levels)throw new Error("frag load aborted, missing levels");if(M=Math.max(p.start,M||0),this.config.lowLatencyMode&&y){var W=y.partList;if(W&&F){M>p.end&&y.fragmentHint&&(p=y.fragmentHint);var O=this.getNextPart(W,p,M);if(O>-1){var P=W[O];return this.log("Loading part sn: "+p.sn+" p: "+P.index+" cc: "+p.cc+" of playlist ["+y.startSN+"-"+y.endSN+"] parts [0-"+O+"-"+(W.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+p.level+", target: "+parseFloat(M.toFixed(3))),this.nextLoadPosition=P.start+P.duration,this.state=v.FRAG_LOADING,this.hls.trigger(D.Events.FRAG_LOADING,{frag:p,part:W[O],targetBufferTime:M}),this.doFragPartsLoad(p,W,O,F).catch(function(H){return j.handleFragLoadError(H)})}else if(!p.url||this.loadedEndOfParts(W,M))return Promise.resolve(null)}}return this.log("Loading fragment "+p.sn+" cc: "+p.cc+" "+(y?"of ["+y.startSN+"-"+y.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+p.level+", target: "+parseFloat(M.toFixed(3))),Object(G.isFiniteNumber)(p.sn)&&!this.bitrateTest&&(this.nextLoadPosition=p.start+p.duration),this.state=v.FRAG_LOADING,this.hls.trigger(D.Events.FRAG_LOADING,{frag:p,targetBufferTime:M}),this.fragmentLoader.load(p,F).catch(function(H){return j.handleFragLoadError(H)})},a.doFragPartsLoad=function(p,y,M,F){var j=this;return new Promise(function(W,O){var P=[],H=function X(q){var re=y[q];j.fragmentLoader.loadPart(p,re,F).then(function(Ee){P[re.index]=Ee;var he=Ee.part;j.hls.trigger(D.Events.FRAG_LOADED,Ee);var xe=y[q+1];if(xe&&xe.fragment===p)X(q+1);else return W({frag:p,part:he,partsLoaded:P})}).catch(O)};H(M)})},a.handleFragLoadError=function(p){var y=p.data;return y&&y.details===L.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(y.frag,y.part):this.hls.trigger(D.Events.ERROR,y),null},a._handleTransmuxerFlush=function(p){var y=this.getCurrentContext(p);if(!y||this.state!==v.PARSING){this.fragCurrent||(this.state=v.IDLE);return}var M=y.frag,F=y.part,j=y.level,W=self.performance.now();M.stats.parsing.end=W,F&&(F.stats.parsing.end=W),this.updateLevelTiming(M,F,j,p.partial)},a.getCurrentContext=function(p){var y=this.levels,M=p.level,F=p.sn,j=p.part;if(!y||!y[M])return this.warn("Levels object was unset while buffering fragment "+F+" of level "+M+". The current chunk will not be buffered."),null;var W=y[M],O=j>-1?Object(E.getPartWith)(W,F,j):null,P=O?O.fragment:Object(E.getFragmentWithSN)(W,F,this.fragCurrent);return P?{frag:P,part:O,level:W}:null},a.bufferFragmentData=function(p,y,M,F){if(!p||this.state!==v.PARSING)return;var j=p.data1,W=p.data2,O=j;if(j&&W&&(O=Object(A.appendUint8Array)(j,W)),!O||!O.length)return;var P={type:p.type,frag:y,part:M,chunkMeta:F,parent:y.type,data:O};this.hls.trigger(D.Events.BUFFER_APPENDING,P),p.dropped&&p.independent&&!M&&this.flushBufferGap(y)},a.flushBufferGap=function(p){var y=this.media;if(!y)return;if(!B.BufferHelper.isBuffered(y,y.currentTime)){this.flushMainBuffer(0,p.start);return}var M=y.currentTime,F=B.BufferHelper.bufferInfo(y,M,0),j=p.duration,W=Math.min(this.config.maxFragLookUpTolerance*2,j*.25),O=Math.max(Math.min(p.start-W,F.end-W),M+W);p.start-O>W&&this.flushMainBuffer(O,p.start)},a.getFwdBufferInfo=function(p,y){var M=this.config,F=this.getLoadPosition();if(!Object(G.isFiniteNumber)(F))return null;var j=B.BufferHelper.bufferInfo(p,F,M.maxBufferHole);if(j.len===0&&j.nextStart!==void 0){var W=this.fragmentTracker.getBufferedFrag(F,y);if(W&&j.nextStart<W.end)return B.BufferHelper.bufferInfo(p,F,Math.max(j.nextStart,M.maxBufferHole))}return j},a.getMaxBufferLength=function(p){var y=this.config,M;return p?M=Math.max(8*y.maxBufferSize/p,y.maxBufferLength):M=y.maxBufferLength,Math.min(M,y.maxMaxBufferLength)},a.reduceMaxBufferLength=function(p){var y=this.config,M=p||y.maxBufferLength;return y.maxMaxBufferLength>=M?(y.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+y.maxMaxBufferLength+"s"),!0):!1},a.getNextFragment=function(p,y){var M,F,j=y.fragments,W=j.length;if(!W)return null;var O=this.config,P=j[0].start,H;if(y.live){var X=O.initialLiveManifestSize;if(W<X)return this.warn("Not enough fragments to start playback (have: "+W+", need: "+X+")"),null;!y.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(H=this.getInitialLiveFragment(y,j),this.startPosition=H?this.hls.liveSyncPosition||H.start:p)}else p<=P&&(H=j[0]);if(!H){var q=O.lowLatencyMode?y.partEnd:y.fragmentEnd;H=this.getFragmentAtPosition(p,q,y)}return(M=H)!==null&&M!==void 0&&M.initSegment&&!((F=H)!==null&&F!==void 0&&F.initSegment.data)&&!this.bitrateTest&&(H=H.initSegment),H},a.getNextPart=function(p,y,M){for(var F=-1,j=!1,W=!0,O=0,P=p.length;O<P;O++){var H=p[O];if(W=W&&!H.independent,F>-1&&M<H.start)break;var X=H.loaded;!X&&(j||H.independent||W)&&H.fragment===y&&(F=O),j=X}return F},a.loadedEndOfParts=function(p,y){var M=p[p.length-1];return M&&y>M.start&&M.loaded},a.getInitialLiveFragment=function(p,y){var M=this.fragPrevious,F=null;if(M){if(p.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+M.programDateTime),F=Object(C.findFragmentByPDT)(y,M.endProgramDateTime,this.config.maxFragLookUpTolerance)),!F){var j=M.sn+1;if(j>=p.startSN&&j<=p.endSN){var W=y[j-p.startSN];M.cc===W.cc&&(F=W,this.log("Live playlist, switching playlist, load frag with next SN: "+F.sn))}F||(F=Object(C.findFragWithCC)(y,M.cc),F&&this.log("Live playlist, switching playlist, load frag with same CC: "+F.sn))}}else{var O=this.hls.liveSyncPosition;O!==null&&(F=this.getFragmentAtPosition(O,this.bitrateTest?p.fragmentEnd:p.edge,p))}return F},a.getFragmentAtPosition=function(p,y,M){var F=this.config,j=this.fragPrevious,W=M.fragments,O=M.endSN,P=M.fragmentHint,H=F.maxFragLookUpTolerance,X=!!(F.lowLatencyMode&&M.partList&&P);X&&P&&!this.bitrateTest&&(W=W.concat(P),O=P.sn);var q;if(p<y){var re=p>y-H?0:H;q=Object(C.findFragmentByPTS)(j,W,p,re)}else q=W[W.length-1];if(q){var Ee=q.sn-M.startSN,he=j&&q.level===j.level,xe=W[Ee+1],pe=this.fragmentTracker.getState(q);if(pe===R.FragmentState.BACKTRACKED){q=null;for(var ve=Ee;W[ve]&&this.fragmentTracker.getState(W[ve])===R.FragmentState.BACKTRACKED;)j?q=W[ve--]:q=W[--ve];q||(q=xe)}else j&&q.sn===j.sn&&!X&&(he&&(q.sn<O&&this.fragmentTracker.getState(xe)!==R.FragmentState.OK?(this.log("SN "+q.sn+" just loaded, load next one: "+xe.sn),q=xe):q=null))}return q},a.synchronizeToLiveEdge=function(p){var y=this.config,M=this.media;if(!M)return;var F=this.hls.liveSyncPosition,j=M.currentTime,W=p.fragments[0].start,O=p.edge,P=j>=W-y.maxFragLookUpTolerance&&j<=O;if(F!==null&&M.duration>F&&(j<F||!P)){var H=y.liveMaxLatencyDuration!==void 0?y.liveMaxLatencyDuration:y.liveMaxLatencyDurationCount*p.targetduration;(!P&&M.readyState<4||j<O-H)&&(this.loadedmetadata||(this.nextLoadPosition=F),M.readyState&&(this.warn("Playback: "+j.toFixed(3)+" is located too far from the end of live sliding playlist: "+O+", reset currentTime to : "+F.toFixed(3)),M.currentTime=F))}},a.alignPlaylists=function(p,y){var M=this.levels,F=this.levelLastLoaded,j=this.fragPrevious,W=F!==null?M[F]:null,O=p.fragments.length;if(!O)return this.warn("No fragments in live playlist"),0;var P=p.fragments[0].start,H=!y,X=p.alignedSliding&&Object(G.isFiniteNumber)(P);if(H||!X&&!P){Object(k.alignStream)(j,W,p);var q=p.fragments[0].start;return this.log("Live playlist sliding: "+q.toFixed(2)+" start-sn: "+(y?y.startSN:"na")+"->"+p.startSN+" prev-sn: "+(j?j.sn:"na")+" fragments: "+O),q}return P},a.waitForCdnTuneIn=function(p){var y=3;return p.live&&p.canBlockReload&&p.tuneInGoal>Math.max(p.partHoldBack,p.partTarget*y)},a.setStartPosition=function(p,y){var M=this.startPosition;if(M<y&&(M=-1),M===-1||this.lastCurrentTime===-1){var F=p.startTimeOffset;Object(G.isFiniteNumber)(F)?(M=y+F,F<0&&(M+=p.totalduration),M=Math.min(Math.max(y,M),y+p.totalduration),this.log("Start time offset "+F+" found in playlist, adjust startPosition to "+M),this.startPosition=M):p.live?M=this.hls.liveSyncPosition||y:this.startPosition=M=0,this.lastCurrentTime=M}this.nextLoadPosition=M},a.getLoadPosition=function(){var p=this.media,y=0;return this.loadedmetadata&&p?y=p.currentTime:this.nextLoadPosition&&(y=this.nextLoadPosition),y},a.handleFragLoadAborted=function(p,y){this.transmuxer&&p.sn!=="initSegment"&&p.stats.aborted&&(this.warn("Fragment "+p.sn+(y?" part"+y.index:"")+" of level "+p.level+" was aborted"),this.resetFragmentLoading(p))},a.resetFragmentLoading=function(p){(!this.fragCurrent||!this.fragContextChanged(p))&&(this.state=v.IDLE)},a.onFragmentOrKeyLoadError=function(p,y){if(y.fatal)return;var M=y.frag;if(!M||M.type!==p)return;var F=this.fragCurrent;console.assert(F&&M.sn===F.sn&&M.level===F.level&&M.urlId===F.urlId,"Frag load error must match current frag to retry");var j=this.config;if(this.fragLoadError+1<=j.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(M.level))return;var W=Math.min(Math.pow(2,this.fragLoadError)*j.fragLoadingRetryDelay,j.fragLoadingMaxRetryTimeout);this.warn("Fragment "+M.sn+" of "+p+" "+M.level+" failed to load, retrying in "+W+"ms"),this.retryDate=self.performance.now()+W,this.fragLoadError++,this.state=v.FRAG_LOADING_WAITING_RETRY}else y.levelRetry?(p===s.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=v.IDLE):(I.logger.error(y.details+" reaches max retry, redispatch as fatal ..."),y.fatal=!0,this.hls.stopLoad(),this.state=v.ERROR)},a.afterBufferFlushed=function(p,y,M){if(!p)return;var F=B.BufferHelper.getBuffered(p);this.fragmentTracker.detectEvictedFragments(y,F,M),this.state===v.ENDED&&this.resetLoadingState()},a.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=v.IDLE},a.resetLiveStartWhenNotLoaded=function(p){if(!this.loadedmetadata){this.startFragRequested=!1;var y=this.levels?this.levels[p].details:null;if(y!=null&&y.live)return this.startPosition=-1,this.setStartPosition(y,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},a.updateLevelTiming=function(p,y,M,F){var j=this,W=M.details;console.assert(!!W,"level.details must be defined");var O=Object.keys(p.elementaryStreams).reduce(function(P,H){var X=p.elementaryStreams[H];if(X){var q=X.endPTS-X.startPTS;if(q<=0)return j.warn("Could not parse fragment "+p.sn+" "+H+" duration reliably ("+q+") resetting transmuxer to fallback to playlist timing"),j.resetTransmuxer(),P||!1;var re=F?0:Object(E.updateFragPTSDTS)(W,p,X.startPTS,X.endPTS,X.startDTS,X.endDTS);return j.hls.trigger(D.Events.LEVEL_PTS_UPDATED,{details:W,level:M,drift:re,type:H,frag:p,start:X.startPTS,end:X.endPTS}),!0}return P},!1);O?(this.state=v.PARSED,this.hls.trigger(D.Events.FRAG_PARSED,{frag:p,part:y})):this.resetLoadingState()},a.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},S(l,[{key:"state",get:function(){return this._state},set:function(p){var y=this._state;y!==p&&(this._state=p,this.log(y+"->"+p))}}]),l}(U.default)},"./src/controller/buffer-controller.ts":function(ne,V,_){"use strict";_.r(V),_.d(V,"default",function(){return C});var G=_("./src/polyfills/number.ts"),U=_("./src/events.ts"),R=_("./src/utils/logger.ts"),B=_("./src/errors.ts"),I=_("./src/utils/buffer-helper.ts"),D=_("./src/utils/mediasource-helper.ts"),L=_("./src/loader/fragment.ts"),x=_("./src/controller/buffer-operation-queue.ts"),A=Object(D.getMediaSource)(),k=/([ha]vc.)(?:\.[^.,]+)+/,C=function(){function E(d){var o=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var s=o.hls,u=o.media,S=o.mediaSource;R.logger.log("[buffer-controller]: Media source opened"),u&&(o.updateMediaElementDuration(),s.trigger(U.Events.MEDIA_ATTACHED,{media:u})),S&&S.removeEventListener("sourceopen",o._onMediaSourceOpen),o.checkPendingTracks()},this._onMediaSourceClose=function(){R.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){R.logger.log("[buffer-controller]: Media source ended")},this.hls=d,this._initSourceBuffer(),this.registerListeners()}var b=E.prototype;return b.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},b.destroy=function(){this.unregisterListeners(),this.details=null},b.registerListeners=function(){var o=this.hls;o.on(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.on(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(U.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(U.Events.BUFFER_RESET,this.onBufferReset,this),o.on(U.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.on(U.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.on(U.Events.BUFFER_EOS,this.onBufferEos,this),o.on(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.on(U.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.on(U.Events.FRAG_PARSED,this.onFragParsed,this),o.on(U.Events.FRAG_CHANGED,this.onFragChanged,this)},b.unregisterListeners=function(){var o=this.hls;o.off(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.off(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(U.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(U.Events.BUFFER_RESET,this.onBufferReset,this),o.off(U.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.off(U.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.off(U.Events.BUFFER_EOS,this.onBufferEos,this),o.off(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.off(U.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.off(U.Events.FRAG_PARSED,this.onFragParsed,this),o.off(U.Events.FRAG_CHANGED,this.onFragChanged,this)},b._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new x.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},b.onManifestParsed=function(o,s){var u=2;(s.audio&&!s.video||!s.altAudio)&&(u=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=u,this.details=null,R.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},b.onMediaAttaching=function(o,s){var u=this.media=s.media;if(u&&A){var S=this.mediaSource=new A;S.addEventListener("sourceopen",this._onMediaSourceOpen),S.addEventListener("sourceended",this._onMediaSourceEnded),S.addEventListener("sourceclose",this._onMediaSourceClose),u.src=self.URL.createObjectURL(S),this._objectUrl=u.src}},b.onMediaDetaching=function(){var o=this.media,s=this.mediaSource,u=this._objectUrl;if(s){if(R.logger.log("[buffer-controller]: media source detaching"),s.readyState==="open")try{s.endOfStream()}catch(S){R.logger.warn("[buffer-controller]: onMediaDetaching: "+S.message+" while calling endOfStream")}this.onBufferReset(),s.removeEventListener("sourceopen",this._onMediaSourceOpen),s.removeEventListener("sourceended",this._onMediaSourceEnded),s.removeEventListener("sourceclose",this._onMediaSourceClose),o&&(u&&self.URL.revokeObjectURL(u),o.src===u?(o.removeAttribute("src"),o.load()):R.logger.warn("[buffer-controller]: media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(U.Events.MEDIA_DETACHED,void 0)},b.onBufferReset=function(){var o=this;this.getSourceBufferTypes().forEach(function(s){var u=o.sourceBuffer[s];try{u&&(o.removeBufferListeners(s),o.mediaSource&&o.mediaSource.removeSourceBuffer(u),o.sourceBuffer[s]=void 0)}catch(S){R.logger.warn("[buffer-controller]: Failed to reset the "+s+" buffer",S)}}),this._initSourceBuffer()},b.onBufferCodecs=function(o,s){var u=this,S=this.getSourceBufferTypes().length;if(Object.keys(s).forEach(function(f){if(S){var m=u.tracks[f];if(m&&typeof m.buffer.changeType=="function"){var w=s[f],v=w.codec,h=w.levelCodec,c=w.container,l=(m.levelCodec||m.codec).replace(k,"$1"),a=(h||v).replace(k,"$1");if(l!==a){var g=c+";codecs="+(h||v);u.appendChangeType(f,g)}}}else u.pendingTracks[f]=s[f]}),S)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},b.appendChangeType=function(o,s){var u=this,S=this.operationQueue,f={execute:function(){var w=u.sourceBuffer[o];w&&(R.logger.log("[buffer-controller]: changing "+o+" sourceBuffer type to "+s),w.changeType(s)),S.shiftAndExecuteNext(o)},onStart:function(){},onComplete:function(){},onError:function(w){R.logger.warn("[buffer-controller]: Failed to change "+o+" SourceBuffer type",w)}};S.append(f,o)},b.onBufferAppending=function(o,s){var u=this,S=this.hls,f=this.operationQueue,m=this.tracks,w=s.data,v=s.type,h=s.frag,c=s.part,l=s.chunkMeta,a=l.buffering[v],g=self.performance.now();a.start=g;var p=h.stats.buffering,y=c?c.stats.buffering:null;p.start===0&&(p.start=g),y&&y.start===0&&(y.start=g);var M=m.audio,F=v==="audio"&&l.id===1&&(M==null?void 0:M.container)==="audio/mpeg",j={execute:function(){if(a.executeStart=self.performance.now(),F){var O=u.sourceBuffer[v];if(O){var P=h.start-O.timestampOffset;Math.abs(P)>=.1&&(R.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+h.start+" (delta: "+P+") sn: "+h.sn+")"),O.timestampOffset=h.start)}}u.appendExecutor(w,v)},onStart:function(){},onComplete:function(){var O=self.performance.now();a.executeEnd=a.end=O,p.first===0&&(p.first=O),y&&y.first===0&&(y.first=O);var P=u.sourceBuffer,H={};for(var X in P)H[X]=I.BufferHelper.getBuffered(P[X]);u.appendError=0,u.hls.trigger(U.Events.BUFFER_APPENDED,{type:v,frag:h,part:c,chunkMeta:l,parent:h.type,timeRanges:H})},onError:function(O){R.logger.error("[buffer-controller]: Error encountered while trying to append to the "+v+" SourceBuffer",O);var P={type:B.ErrorTypes.MEDIA_ERROR,parent:h.type,details:B.ErrorDetails.BUFFER_APPEND_ERROR,err:O,fatal:!1};O.code===DOMException.QUOTA_EXCEEDED_ERR?P.details=B.ErrorDetails.BUFFER_FULL_ERROR:(u.appendError++,P.details=B.ErrorDetails.BUFFER_APPEND_ERROR,u.appendError>S.config.appendErrorMaxRetry&&(R.logger.error("[buffer-controller]: Failed "+S.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),P.fatal=!0)),S.trigger(U.Events.ERROR,P)}};f.append(j,v)},b.onBufferFlushing=function(o,s){var u=this,S=this.operationQueue,f=function(w){return{execute:u.removeExecutor.bind(u,w,s.startOffset,s.endOffset),onStart:function(){},onComplete:function(){u.hls.trigger(U.Events.BUFFER_FLUSHED,{type:w})},onError:function(h){R.logger.warn("[buffer-controller]: Failed to remove from "+w+" SourceBuffer",h)}}};s.type?S.append(f(s.type),s.type):this.getSourceBufferTypes().forEach(function(m){S.append(f(m),m)})},b.onFragParsed=function(o,s){var u=this,S=s.frag,f=s.part,m=[],w=f?f.elementaryStreams:S.elementaryStreams;w[L.ElementaryStreamTypes.AUDIOVIDEO]?m.push("audiovideo"):(w[L.ElementaryStreamTypes.AUDIO]&&m.push("audio"),w[L.ElementaryStreamTypes.VIDEO]&&m.push("video"));var v=function(){var c=self.performance.now();S.stats.buffering.end=c,f&&(f.stats.buffering.end=c);var l=f?f.stats:S.stats;u.hls.trigger(U.Events.FRAG_BUFFERED,{frag:S,part:f,stats:l,id:S.type})};m.length===0&&R.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+S.type+" level: "+S.level+" sn: "+S.sn),this.blockBuffers(v,m)},b.onFragChanged=function(o,s){this.flushBackBuffer()},b.onBufferEos=function(o,s){var u=this,S=this.getSourceBufferTypes().reduce(function(f,m){var w=u.sourceBuffer[m];return(!s.type||s.type===m)&&(w&&!w.ended&&(w.ended=!0,R.logger.log("[buffer-controller]: "+m+" sourceBuffer now EOS"))),f&&!!(!w||w.ended)},!0);S&&this.blockBuffers(function(){var f=u.mediaSource;if(!f||f.readyState!=="open")return;f.endOfStream()})},b.onLevelUpdated=function(o,s){var u=s.details;if(!u.fragments.length)return;this.details=u,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},b.flushBackBuffer=function(){var o=this.hls,s=this.details,u=this.media,S=this.sourceBuffer;if(!u||s===null)return;var f=this.getSourceBufferTypes();if(!f.length)return;var m=s.live&&o.config.liveBackBufferLength!==null?o.config.liveBackBufferLength:o.config.backBufferLength;if(!Object(G.isFiniteNumber)(m)||m<0)return;var w=u.currentTime,v=s.levelTargetDuration,h=Math.max(m,v),c=Math.floor(w/v)*v-h;f.forEach(function(l){var a=S[l];if(a){var g=I.BufferHelper.getBuffered(a);g.length>0&&c>g.start(0)&&(o.trigger(U.Events.BACK_BUFFER_REACHED,{bufferEnd:c}),s.live&&o.trigger(U.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:c}),o.trigger(U.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:c,type:l}))}})},b.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var o=this.details,s=this.hls,u=this.media,S=this.mediaSource,f=o.fragments[0].start+o.totalduration,m=u.duration,w=Object(G.isFiniteNumber)(S.duration)?S.duration:0;o.live&&s.config.liveDurationInfinity?(R.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),S.duration=Infinity,this.updateSeekableRange(o)):(f>w&&f>m||!Object(G.isFiniteNumber)(m))&&(R.logger.log("[buffer-controller]: Updating Media Source duration to "+f.toFixed(3)),S.duration=f)},b.updateSeekableRange=function(o){var s=this.mediaSource,u=o.fragments,S=u.length;if(S&&o.live&&s!==null&&s!==void 0&&s.setLiveSeekableRange){var f=Math.max(0,u[0].start),m=Math.max(f,f+o.totalduration);s.setLiveSeekableRange(f,m)}},b.checkPendingTracks=function(){var o=this.bufferCodecEventsExpected,s=this.operationQueue,u=this.pendingTracks,S=Object.keys(u).length;if(S&&!o||S===2){this.createSourceBuffers(u),this.pendingTracks={};var f=this.getSourceBufferTypes();if(f.length===0){this.hls.trigger(U.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}f.forEach(function(m){s.executeNext(m)})}},b.createSourceBuffers=function(o){var s=this.sourceBuffer,u=this.mediaSource;if(!u)throw Error("createSourceBuffers called when mediaSource was null");var S=0;for(var f in o)if(!s[f]){var m=o[f];if(!m)throw Error("source buffer exists for track "+f+", however track does not");var w=m.levelCodec||m.codec,v=m.container+";codecs="+w;R.logger.log("[buffer-controller]: creating sourceBuffer("+v+")");try{var h=s[f]=u.addSourceBuffer(v),c=f;this.addBufferListener(c,"updatestart",this._onSBUpdateStart),this.addBufferListener(c,"updateend",this._onSBUpdateEnd),this.addBufferListener(c,"error",this._onSBUpdateError),this.tracks[f]={buffer:h,codec:w,container:m.container,levelCodec:m.levelCodec,id:m.id},S++}catch(l){R.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+l.message),this.hls.trigger(U.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:l,mimeType:v})}}S&&this.hls.trigger(U.Events.BUFFER_CREATED,{tracks:this.tracks})},b._onSBUpdateStart=function(o){var s=this.operationQueue,u=s.current(o);u.onStart()},b._onSBUpdateEnd=function(o){var s=this.operationQueue,u=s.current(o);u.onComplete(),s.shiftAndExecuteNext(o)},b._onSBUpdateError=function(o,s){R.logger.error("[buffer-controller]: "+o+" SourceBuffer error",s),this.hls.trigger(U.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var u=this.operationQueue.current(o);u&&u.onError(s)},b.removeExecutor=function(o,s,u){var S=this.media,f=this.mediaSource,m=this.operationQueue,w=this.sourceBuffer,v=w[o];if(!S||!f||!v){R.logger.warn("[buffer-controller]: Attempting to remove from the "+o+" SourceBuffer, but it does not exist"),m.shiftAndExecuteNext(o);return}var h=Object(G.isFiniteNumber)(S.duration)?S.duration:Infinity,c=Object(G.isFiniteNumber)(f.duration)?f.duration:Infinity,l=Math.max(0,s),a=Math.min(u,h,c);a>l?(R.logger.log("[buffer-controller]: Removing ["+l+","+a+"] from the "+o+" SourceBuffer"),console.assert(!v.updating,o+" sourceBuffer must not be updating"),v.remove(l,a)):m.shiftAndExecuteNext(o)},b.appendExecutor=function(o,s){var u=this.operationQueue,S=this.sourceBuffer,f=S[s];if(!f){R.logger.warn("[buffer-controller]: Attempting to append to the "+s+" SourceBuffer, but it does not exist"),u.shiftAndExecuteNext(s);return}f.ended=!1,console.assert(!f.updating,s+" sourceBuffer must not be updating"),f.appendBuffer(o)},b.blockBuffers=function(o,s){var u=this;if(s===void 0&&(s=this.getSourceBufferTypes()),!s.length){R.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(o);return}var S=this.operationQueue,f=s.map(function(m){return S.appendBlocker(m)});Promise.all(f).then(function(){o(),s.forEach(function(m){var w=u.sourceBuffer[m];(!w||!w.updating)&&S.shiftAndExecuteNext(m)})})},b.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},b.addBufferListener=function(o,s,u){var S=this.sourceBuffer[o];if(!S)return;var f=u.bind(this,o);this.listeners[o].push({event:s,listener:f}),S.addEventListener(s,f)},b.removeBufferListeners=function(o){var s=this.sourceBuffer[o];if(!s)return;this.listeners[o].forEach(function(u){s.removeEventListener(u.event,u.listener)})},E}()},"./src/controller/buffer-operation-queue.ts":function(ne,V,_){"use strict";_.r(V),_.d(V,"default",function(){return U});var G=_("./src/utils/logger.ts"),U=function(){function R(I){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=I}var B=R.prototype;return B.append=function(D,L){var x=this.queues[L];x.push(D),x.length===1&&this.buffers[L]&&this.executeNext(L)},B.insertAbort=function(D,L){var x=this.queues[L];x.unshift(D),this.executeNext(L)},B.appendBlocker=function(D){var L,x=new Promise(function(k){L=k}),A={execute:L,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(A,D),x},B.executeNext=function(D){var L=this.buffers,x=this.queues,A=L[D],k=x[D];if(k.length){var C=k[0];try{C.execute()}catch(E){G.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),C.onError(E),(!A||!A.updating)&&(k.shift(),this.executeNext(D))}}},B.shiftAndExecuteNext=function(D){this.queues[D].shift(),this.executeNext(D)},B.current=function(D){return this.queues[D][0]},R}()},"./src/controller/cap-level-controller.ts":function(ne,V,_){"use strict";_.r(V);var G=_("./src/events.ts");function U(I,D){for(var L=0;L<D.length;L++){var x=D[L];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(I,x.key,x)}}function R(I,D,L){return D&&U(I.prototype,D),L&&U(I,L),I}var B=function(){function I(L){this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.hls=void 0,this.streamController=void 0,this.clientRect=void 0,this.hls=L,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var D=I.prototype;return D.setStreamController=function(x){this.streamController=x},D.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},D.registerListeners=function(){var x=this.hls;x.on(G.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),x.on(G.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),x.on(G.Events.MANIFEST_PARSED,this.onManifestParsed,this),x.on(G.Events.BUFFER_CODECS,this.onBufferCodecs,this),x.on(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},D.unregisterListener=function(){var x=this.hls;x.off(G.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),x.off(G.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),x.off(G.Events.MANIFEST_PARSED,this.onManifestParsed,this),x.off(G.Events.BUFFER_CODECS,this.onBufferCodecs,this),x.off(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},D.onFpsDropLevelCapping=function(x,A){I.isLevelAllowed(A.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(A.droppedLevel)},D.onMediaAttaching=function(x,A){this.media=A.media instanceof HTMLVideoElement?A.media:null},D.onManifestParsed=function(x,A){var k=this.hls;this.restrictedLevels=[],this.firstLevel=A.firstLevel,k.config.capLevelToPlayerSize&&A.video&&this.startCapping()},D.onBufferCodecs=function(x,A){var k=this.hls;k.config.capLevelToPlayerSize&&A.video&&this.startCapping()},D.onMediaDetaching=function(){this.stopCapping()},D.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var x=this.hls.levels;if(x.length){var A=this.hls;A.autoLevelCapping=this.getMaxLevel(x.length-1),A.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=A.autoLevelCapping}}},D.getMaxLevel=function(x){var A=this,k=this.hls.levels;if(!k.length)return-1;var C=k.filter(function(E,b){return I.isLevelAllowed(b,A.restrictedLevels)&&b<=x});return this.clientRect=null,I.getMaxLevelByMediaSize(C,this.mediaWidth,this.mediaHeight)},D.startCapping=function(){if(this.timer)return;this.autoLevelCapping=Number.POSITIVE_INFINITY,this.hls.firstLevel=this.getMaxLevel(this.firstLevel),self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize()},D.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},D.getDimensions=function(){if(this.clientRect)return this.clientRect;var x=this.media,A={width:0,height:0};if(x){var k=x.getBoundingClientRect();A.width=k.width,A.height=k.height,!A.width&&!A.height&&(A.width=k.right-k.left||x.width||0,A.height=k.bottom-k.top||x.height||0)}return this.clientRect=A,A},I.isLevelAllowed=function(x,A){return A===void 0&&(A=[]),A.indexOf(x)===-1},I.getMaxLevelByMediaSize=function(x,A,k){if(!x||!x.length)return-1;for(var C=function(s,u){return u?s.width!==u.width||s.height!==u.height:!0},E=x.length-1,b=0;b<x.length;b+=1){var d=x[b];if((d.width>=A||d.height>=k)&&C(d,x[b+1])){E=b;break}}return E},R(I,[{key:"mediaWidth",get:function(){return this.getDimensions().width*I.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*I.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var x=1;try{x=self.devicePixelRatio}catch(A){}return x}}]),I}();V.default=B},"./src/controller/cmcd-controller.ts":function(ne,V,_){"use strict";_.r(V),_.d(V,"default",function(){return C});var G=_("./src/events.ts"),U=_("./src/types/cmcd.ts"),R=_("./src/utils/buffer-helper.ts"),B=_("./src/utils/logger.ts");function I(E,b){for(var d=0;d<b.length;d++){var o=b[d];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(E,o.key,o)}}function D(E,b,d){return b&&I(E.prototype,b),d&&I(E,d),E}function L(E,b){var d=typeof Symbol!="undefined"&&E[Symbol.iterator]||E["@@iterator"];if(d)return(d=d.call(E)).next.bind(d);if(Array.isArray(E)||(d=x(E))||b&&E&&typeof E.length=="number"){d&&(E=d);var o=0;return function(){return o>=E.length?{done:!0}:{done:!1,value:E[o++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function x(E,b){if(!E)return;if(typeof E=="string")return A(E,b);var d=Object.prototype.toString.call(E).slice(8,-1);if(d==="Object"&&E.constructor&&(d=E.constructor.name),d==="Map"||d==="Set")return Array.from(E);if(d==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(d))return A(E,b)}function A(E,b){(b==null||b>E.length)&&(b=E.length);for(var d=0,o=new Array(b);d<b;d++)o[d]=E[d];return o}function k(){return k=Object.assign||function(E){for(var b=1;b<arguments.length;b++){var d=arguments[b];for(var o in d)Object.prototype.hasOwnProperty.call(d,o)&&(E[o]=d[o])}return E},k.apply(this,arguments)}var C=function(){function E(d){var o=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){o.initialized&&(o.starved=!0),o.buffering=!0},this.onPlaying=function(){o.initialized||(o.initialized=!0),o.buffering=!1},this.applyPlaylistData=function(S){try{o.apply(S,{ot:U.CMCDObjectType.MANIFEST,su:!o.initialized})}catch(f){B.logger.warn("Could not generate manifest CMCD data.",f)}},this.applyFragmentData=function(S){try{var f=S.frag,m=o.hls.levels[f.level],w=o.getObjectType(f),v={d:f.duration*1e3,ot:w};(w===U.CMCDObjectType.VIDEO||w===U.CMCDObjectType.AUDIO||w==U.CMCDObjectType.MUXED)&&(v.br=m.bitrate/1e3,v.tb=o.getTopBandwidth(w),v.bl=o.getBufferLength(w)),o.apply(S,v)}catch(h){B.logger.warn("Could not generate segment CMCD data.",h)}},this.hls=d;var s=this.config=d.config,u=s.cmcd;u!=null&&(s.pLoader=this.createPlaylistLoader(),s.fLoader=this.createFragmentLoader(),this.sid=u.sessionId||E.uuid(),this.cid=u.contentId,this.useHeaders=u.useHeaders===!0,this.registerListeners())}var b=E.prototype;return b.registerListeners=function(){var o=this.hls;o.on(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(G.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.on(G.Events.BUFFER_CREATED,this.onBufferCreated,this)},b.unregisterListeners=function(){var o=this.hls;o.off(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(G.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.off(G.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},b.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},b.onMediaAttached=function(o,s){this.media=s.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},b.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},b.onBufferCreated=function(o,s){var u,S;this.audioBuffer=(u=s.tracks.audio)===null||u===void 0?void 0:u.buffer,this.videoBuffer=(S=s.tracks.video)===null||S===void 0?void 0:S.buffer},b.createData=function(){var o;return{v:U.CMCDVersion,sf:U.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(o=this.media)===null||o===void 0?void 0:o.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},b.apply=function(o,s){s===void 0&&(s={}),k(s,this.createData());var u=s.ot===U.CMCDObjectType.INIT||s.ot===U.CMCDObjectType.VIDEO||s.ot===U.CMCDObjectType.MUXED;if(this.starved&&u&&(s.bs=!0,s.su=!0,this.starved=!1),s.su==null&&(s.su=this.buffering),this.useHeaders){var S=E.toHeaders(s);if(!Object.keys(S).length)return;o.headers||(o.headers={}),k(o.headers,S)}else{var f=E.toQuery(s);if(!f)return;o.url=E.appendQueryToUri(o.url,f)}},b.getObjectType=function(o){var s=o.type;return s==="subtitle"?U.CMCDObjectType.TIMED_TEXT:o.sn==="initSegment"?U.CMCDObjectType.INIT:s==="audio"?U.CMCDObjectType.AUDIO:s==="main"?this.hls.audioTracks.length?U.CMCDObjectType.VIDEO:U.CMCDObjectType.MUXED:void 0},b.getTopBandwidth=function(o){for(var s=0,u=o===U.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,S=L(u),f;!(f=S()).done;){var m=f.value;m.bitrate>s&&(s=m.bitrate)}return s>0?s:NaN},b.getBufferLength=function(o){var s=this.hls.media,u=o===U.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!u||!s)return NaN;var S=R.BufferHelper.bufferInfo(u,s.currentTime,this.config.maxBufferHole);return S.len*1e3},b.createPlaylistLoader=function(){var o=this.config.pLoader,s=this.applyPlaylistData,u=o||this.config.loader;return function(){function S(m){this.loader=void 0,this.loader=new u(m)}var f=S.prototype;return f.destroy=function(){this.loader.destroy()},f.abort=function(){this.loader.abort()},f.load=function(w,v,h){s(w),this.loader.load(w,v,h)},D(S,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),S}()},b.createFragmentLoader=function(){var o=this.config.fLoader,s=this.applyFragmentData,u=o||this.config.loader;return function(){function S(m){this.loader=void 0,this.loader=new u(m)}var f=S.prototype;return f.destroy=function(){this.loader.destroy()},f.abort=function(){this.loader.abort()},f.load=function(w,v,h){s(w),this.loader.load(w,v,h)},D(S,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),S}()},E.uuid=function(){var o=URL.createObjectURL(new Blob),s=o.toString();return URL.revokeObjectURL(o),s.substr(s.lastIndexOf("/")+1)},E.serialize=function(o){for(var s=[],u=function(F){return!Number.isNaN(F)&&F!=null&&F!==""&&F!==!1},S=function(F){return Math.round(F)},f=function(F){return S(F/100)*100},m=function(F){return encodeURIComponent(F)},w={br:S,d:S,bl:f,dl:f,mtp:f,nor:m,rtp:f,tb:S},v=Object.keys(o||{}).sort(),h=L(v),c;!(c=h()).done;){var l=c.value,a=o[l];if(!u(a))continue;if(l==="v"&&a===1)continue;if(l=="pr"&&a===1)continue;var g=w[l];g&&(a=g(a));var p=typeof a,y=void 0;l==="ot"||l==="sf"||l==="st"?y=l+"="+a:p==="boolean"?y=l:p==="number"?y=l+"="+a:y=l+"="+JSON.stringify(a),s.push(y)}return s.join(",")},E.toHeaders=function(o){for(var s=Object.keys(o),u={},S=["Object","Request","Session","Status"],f=[{},{},{},{}],m={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,bs:3,rtp:3},w=0,v=s;w<v.length;w++){var h=v[w],c=m[h]!=null?m[h]:1;f[c][h]=o[h]}for(var l=0;l<f.length;l++){var a=E.serialize(f[l]);a&&(u["CMCD-"+S[l]]=a)}return u},E.toQuery=function(o){return"CMCD="+encodeURIComponent(E.serialize(o))},E.appendQueryToUri=function(o,s){if(!s)return o;var u=o.includes("?")?"&":"?";return""+o+u+s},E}()},"./src/controller/eme-controller.ts":function(ne,V,_){"use strict";_.r(V);var G=_("./src/events.ts"),U=_("./src/errors.ts"),R=_("./src/utils/logger.ts"),B=_("./src/utils/mediakeys-helper.ts");function I(C,E){for(var b=0;b<E.length;b++){var d=E[b];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(C,d.key,d)}}function D(C,E,b){return E&&I(C.prototype,E),b&&I(C,b),C}var L=3,x=function(E,b,d){var o={audioCapabilities:[],videoCapabilities:[]};return E.forEach(function(s){o.audioCapabilities.push({contentType:'audio/mp4; codecs="'+s+'"',robustness:d.audioRobustness||""})}),b.forEach(function(s){o.videoCapabilities.push({contentType:'video/mp4; codecs="'+s+'"',robustness:d.videoRobustness||""})}),[o]},A=function(E,b,d,o){switch(E){case B.KeySystems.WIDEVINE:return x(b,d,o);default:throw new Error("Unknown key-system: "+E)}},k=function(){function C(b){this.hls=void 0,this._widevineLicenseUrl=void 0,this._licenseXhrSetup=void 0,this._licenseResponseCallback=void 0,this._emeEnabled=void 0,this._requestMediaKeySystemAccess=void 0,this._drmSystemOptions=void 0,this._config=void 0,this._mediaKeysList=[],this._media=null,this._hasSetMediaKeys=!1,this._requestLicenseFailureCount=0,this.mediaKeysPromise=null,this._onMediaEncrypted=this.onMediaEncrypted.bind(this),this.hls=b,this._config=b.config,this._widevineLicenseUrl=this._config.widevineLicenseUrl,this._licenseXhrSetup=this._config.licenseXhrSetup,this._licenseResponseCallback=this._config.licenseResponseCallback,this._emeEnabled=this._config.emeEnabled,this._requestMediaKeySystemAccess=this._config.requestMediaKeySystemAccessFunc,this._drmSystemOptions=this._config.drmSystemOptions,this._registerListeners()}var E=C.prototype;return E.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},E._registerListeners=function(){this.hls.on(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(G.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(G.Events.MANIFEST_PARSED,this.onManifestParsed,this)},E._unregisterListeners=function(){this.hls.off(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(G.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(G.Events.MANIFEST_PARSED,this.onManifestParsed,this)},E.getLicenseServerUrl=function(d){switch(d){case B.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+d+'"')},E._attemptKeySystemAccess=function(d,o,s){var u=this,S=A(d,o,s,this._drmSystemOptions);R.logger.log("Requesting encrypted media key-system access");var f=this.requestMediaKeySystemAccess(d,S);this.mediaKeysPromise=f.then(function(m){return u._onMediaKeySystemAccessObtained(d,m)}),f.catch(function(m){R.logger.error('Failed to obtain key-system "'+d+'" access:',m)})},E._onMediaKeySystemAccessObtained=function(d,o){var s=this;R.logger.log('Access for key-system "'+d+'" obtained');var u={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:o,mediaKeySystemDomain:d};this._mediaKeysList.push(u);var S=Promise.resolve().then(function(){return o.createMediaKeys()}).then(function(f){return u.mediaKeys=f,R.logger.log('Media-keys created for key-system "'+d+'"'),s._onMediaKeysCreated(),f});return S.catch(function(f){R.logger.error("Failed to create media-keys:",f)}),S},E._onMediaKeysCreated=function(){var d=this;this._mediaKeysList.forEach(function(o){o.mediaKeysSession||(o.mediaKeysSession=o.mediaKeys.createSession(),d._onNewMediaKeySession(o.mediaKeysSession))})},E._onNewMediaKeySession=function(d){var o=this;R.logger.log("New key-system session "+d.sessionId),d.addEventListener("message",function(s){o._onKeySessionMessage(d,s.message)},!1)},E._onKeySessionMessage=function(d,o){R.logger.log("Got EME message event, creating license request"),this._requestLicense(o,function(s){R.logger.log("Received license data (length: "+(s&&s.byteLength)+"), updating key-session"),d.update(s)})},E.onMediaEncrypted=function(d){var o=this;if(R.logger.log('Media is encrypted using "'+d.initDataType+'" init data type'),!this.mediaKeysPromise){R.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(G.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var s=function(S){if(!o._media)return;o._attemptSetMediaKeys(S),o._generateRequestWithPreferredKeySession(d.initDataType,d.initData)};this.mediaKeysPromise.then(s).catch(s)},E._attemptSetMediaKeys=function(d){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var o=this._mediaKeysList[0];if(!o||!o.mediaKeys){R.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(G.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}R.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(o.mediaKeys),this._hasSetMediaKeys=!0}},E._generateRequestWithPreferredKeySession=function(d,o){var s=this,u=this._mediaKeysList[0];if(!u){R.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(G.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(u.mediaKeysSessionInitialized){R.logger.warn("Key-Session already initialized but requested again");return}var S=u.mediaKeysSession;if(!S){R.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(G.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!o){R.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(G.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}R.logger.log('Generating key-session request for "'+d+'" init data type'),u.mediaKeysSessionInitialized=!0,S.generateRequest(d,o).then(function(){R.logger.debug("Key-session generation succeeded")}).catch(function(f){R.logger.error("Error generating key-session request:",f),s.hls.trigger(G.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},E._createLicenseXhr=function(d,o,s){var u=new XMLHttpRequest;u.responseType="arraybuffer",u.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,u,d,o,s);var S=this._licenseXhrSetup;if(S)try{S.call(this.hls,u,d),S=void 0}catch(f){R.logger.error(f)}try{u.readyState||u.open("POST",d,!0),S&&S.call(this.hls,u,d)}catch(f){throw new Error("issue setting up KeySystem license XHR "+f)}return u},E._onLicenseRequestReadyStageChange=function(d,o,s,u){switch(d.readyState){case 4:if(d.status===200){this._requestLicenseFailureCount=0,R.logger.log("License request succeeded");var S=d.response,f=this._licenseResponseCallback;if(f)try{S=f.call(this.hls,d,o)}catch(w){R.logger.error(w)}u(S)}else{if(R.logger.error("License Request XHR failed ("+o+"). Status: "+d.status+" ("+d.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>L){this.hls.trigger(G.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var m=L-this._requestLicenseFailureCount+1;R.logger.warn("Retrying license request, "+m+" attempts left"),this._requestLicense(s,u)}break}},E._generateLicenseRequestChallenge=function(d,o){switch(d.mediaKeySystemDomain){case B.KeySystems.WIDEVINE:return o}throw new Error("unsupported key-system: "+d.mediaKeySystemDomain)},E._requestLicense=function(d,o){R.logger.log("Requesting content license for key-system");var s=this._mediaKeysList[0];if(!s){R.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(G.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var u=this.getLicenseServerUrl(s.mediaKeySystemDomain),S=this._createLicenseXhr(u,d,o);R.logger.log("Sending license request to URL: "+u);var f=this._generateLicenseRequestChallenge(s,d);S.send(f)}catch(m){R.logger.error("Failure requesting DRM license: "+m),this.hls.trigger(G.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},E.onMediaAttached=function(d,o){if(!this._emeEnabled)return;var s=o.media;this._media=s,s.addEventListener("encrypted",this._onMediaEncrypted)},E.onMediaDetached=function(){var d=this._media,o=this._mediaKeysList;if(!d)return;d.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(o.map(function(s){if(s.mediaKeysSession)return s.mediaKeysSession.close().catch(function(){})})).then(function(){return d.setMediaKeys(null)}).catch(function(){})},E.onManifestParsed=function(d,o){if(!this._emeEnabled)return;var s=o.levels.map(function(S){return S.audioCodec}).filter(function(S){return!!S}),u=o.levels.map(function(S){return S.videoCodec}).filter(function(S){return!!S});this._attemptKeySystemAccess(B.KeySystems.WIDEVINE,s,u)},D(C,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),C}();V.default=k},"./src/controller/fps-controller.ts":function(ne,V,_){"use strict";_.r(V);var G=_("./src/events.ts"),U=_("./src/utils/logger.ts"),R=function(){function B(D){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=D,this.registerListeners()}var I=B.prototype;return I.setStreamController=function(L){this.streamController=L},I.registerListeners=function(){this.hls.on(G.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},I.unregisterListeners=function(){this.hls.off(G.Events.MEDIA_ATTACHING,this.onMediaAttaching)},I.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},I.onMediaAttaching=function(L,x){var A=this.hls.config;if(A.capLevelOnFPSDrop){var k=x.media instanceof self.HTMLVideoElement?x.media:null;this.media=k,k&&typeof k.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),A.fpsDroppedMonitoringPeriod)}},I.checkFPS=function(L,x,A){var k=performance.now();if(x){if(this.lastTime){var C=k-this.lastTime,E=A-this.lastDroppedFrames,b=x-this.lastDecodedFrames,d=1e3*E/C,o=this.hls;if(o.trigger(G.Events.FPS_DROP,{currentDropped:E,currentDecoded:b,totalDroppedFrames:A}),d>0&&E>o.config.fpsDroppedMonitoringThreshold*b){var s=o.currentLevel;U.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+s),s>0&&(o.autoLevelCapping===-1||o.autoLevelCapping>=s)&&(s=s-1,o.trigger(G.Events.FPS_DROP_LEVEL_CAPPING,{level:s,droppedLevel:o.currentLevel}),o.autoLevelCapping=s,this.streamController.nextLevelSwitch())}}this.lastTime=k,this.lastDroppedFrames=A,this.lastDecodedFrames=x}},I.checkFPSInterval=function(){var L=this.media;if(L)if(this.isVideoPlaybackQualityAvailable){var x=L.getVideoPlaybackQuality();this.checkFPS(L,x.totalVideoFrames,x.droppedVideoFrames)}else this.checkFPS(L,L.webkitDecodedFrameCount,L.webkitDroppedFrameCount)},B}();V.default=R},"./src/controller/fragment-finders.ts":function(ne,V,_){"use strict";_.r(V),_.d(V,"findFragmentByPDT",function(){return R}),_.d(V,"findFragmentByPTS",function(){return B}),_.d(V,"fragmentWithinToleranceTest",function(){return I}),_.d(V,"pdtWithinToleranceTest",function(){return D}),_.d(V,"findFragWithCC",function(){return L});var G=_("./src/polyfills/number.ts"),U=_("./src/utils/binary-search.ts");function R(x,A,k){if(A===null||!Array.isArray(x)||!x.length||!Object(G.isFiniteNumber)(A))return null;var C=x[0].programDateTime;if(A<(C||0))return null;var E=x[x.length-1].endProgramDateTime;if(A>=(E||0))return null;k=k||0;for(var b=0;b<x.length;++b){var d=x[b];if(D(A,k,d))return d}return null}function B(x,A,k,C){k===void 0&&(k=0),C===void 0&&(C=0);var E=null;if(x?E=A[x.sn-A[0].sn+1]||null:k===0&&A[0].start===0&&(E=A[0]),E&&I(k,C,E)===0)return E;var b=U.default.search(A,I.bind(null,k,C));return b||E}function I(x,A,k){x===void 0&&(x=0),A===void 0&&(A=0);var C=Math.min(A,k.duration+(k.deltaPTS?k.deltaPTS:0));return k.start+k.duration-C<=x?1:k.start-C>x&&k.start?-1:0}function D(x,A,k){var C=Math.min(A,k.duration+(k.deltaPTS?k.deltaPTS:0))*1e3,E=k.endProgramDateTime||0;return E-C>x}function L(x,A){return U.default.search(x,function(k){return k.cc<A?1:k.cc>A?-1:0})}},"./src/controller/fragment-tracker.ts":function(ne,V,_){"use strict";_.r(V),_.d(V,"FragmentState",function(){return R}),_.d(V,"FragmentTracker",function(){return B});var G=_("./src/events.ts"),U=_("./src/types/loader.ts"),R;(function(L){L.NOT_LOADED="NOT_LOADED",L.BACKTRACKED="BACKTRACKED",L.APPENDING="APPENDING",L.PARTIAL="PARTIAL",L.OK="OK"})(R||(R={}));var B=function(){function L(A){this.activeFragment=null,this.activeParts=null,this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hls=A,this._registerListeners()}var x=L.prototype;return x._registerListeners=function(){var k=this.hls;k.on(G.Events.BUFFER_APPENDED,this.onBufferAppended,this),k.on(G.Events.FRAG_BUFFERED,this.onFragBuffered,this),k.on(G.Events.FRAG_LOADED,this.onFragLoaded,this)},x._unregisterListeners=function(){var k=this.hls;k.off(G.Events.BUFFER_APPENDED,this.onBufferAppended,this),k.off(G.Events.FRAG_BUFFERED,this.onFragBuffered,this),k.off(G.Events.FRAG_LOADED,this.onFragLoaded,this)},x.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},x.getAppendedFrag=function(k,C){if(C===U.PlaylistLevelType.MAIN){var E=this.activeFragment,b=this.activeParts;if(!E)return null;if(b)for(var d=b.length;d--;){var o=b[d],s=o?o.end:E.appendedPTS;if(o.start<=k&&s!==void 0&&k<=s)return d>9&&(this.activeParts=b.slice(d-9)),o}else if(E.start<=k&&E.appendedPTS!==void 0&&k<=E.appendedPTS)return E}return this.getBufferedFrag(k,C)},x.getBufferedFrag=function(k,C){for(var E=this.fragments,b=Object.keys(E),d=b.length;d--;){var o=E[b[d]];if((o==null?void 0:o.body.type)===C&&o.buffered){var s=o.body;if(s.start<=k&&k<=s.end)return s}}return null},x.detectEvictedFragments=function(k,C,E){var b=this;Object.keys(this.fragments).forEach(function(d){var o=b.fragments[d];if(!o)return;if(!o.buffered){o.body.type===E&&b.removeFragment(o.body);return}var s=o.range[k];if(!s)return;s.time.some(function(u){var S=!b.isTimeBuffered(u.startPTS,u.endPTS,C);return S&&b.removeFragment(o.body),S})})},x.detectPartialFragments=function(k){var C=this,E=this.timeRanges,b=k.frag,d=k.part;if(!E||b.sn==="initSegment")return;var o=D(b),s=this.fragments[o];if(!s)return;Object.keys(E).forEach(function(u){var S=b.elementaryStreams[u];if(!S)return;var f=E[u],m=d!==null||S.partial===!0;s.range[u]=C.getBufferedTimes(b,d,m,f)}),s.backtrack=s.loaded=null,Object.keys(s.range).length?s.buffered=!0:this.removeFragment(s.body)},x.fragBuffered=function(k){var C=D(k),E=this.fragments[C];E&&(E.backtrack=E.loaded=null,E.buffered=!0)},x.getBufferedTimes=function(k,C,E,b){for(var d={time:[],partial:E},o=C?C.start:k.start,s=C?C.end:k.end,u=k.minEndPTS||s,S=k.maxStartPTS||o,f=0;f<b.length;f++){var m=b.start(f)-this.bufferPadding,w=b.end(f)+this.bufferPadding;if(S>=m&&u<=w){d.time.push({startPTS:Math.max(o,b.start(f)),endPTS:Math.min(s,b.end(f))});break}else if(o<w&&s>m)d.partial=!0,d.time.push({startPTS:Math.max(o,b.start(f)),endPTS:Math.min(s,b.end(f))});else if(s<=m)break}return d},x.getPartialFragment=function(k){var C=null,E,b,d,o=0,s=this.bufferPadding,u=this.fragments;return Object.keys(u).forEach(function(S){var f=u[S];if(!f)return;I(f)&&(b=f.body.start-s,d=f.body.end+s,k>=b&&k<=d&&(E=Math.min(k-b,d-k),o<=E&&(C=f.body,o=E)))}),C},x.getState=function(k){var C=D(k),E=this.fragments[C];return E?E.buffered?I(E)?R.PARTIAL:R.OK:E.backtrack?R.BACKTRACKED:R.APPENDING:R.NOT_LOADED},x.backtrack=function(k,C){var E=D(k),b=this.fragments[E];if(!b||b.backtrack)return null;var d=b.backtrack=C||b.loaded;return b.loaded=null,d},x.getBacktrackData=function(k){var C=D(k),E=this.fragments[C];if(E){var b,d=E.backtrack;if(d!=null&&(b=d.payload)!==null&&b!==void 0&&b.byteLength)return d;this.removeFragment(k)}return null},x.isTimeBuffered=function(k,C,E){for(var b,d,o=0;o<E.length;o++){if(b=E.start(o)-this.bufferPadding,d=E.end(o)+this.bufferPadding,k>=b&&C<=d)return!0;if(C<=b)return!1}return!1},x.onFragLoaded=function(k,C){var E=C.frag,b=C.part;if(E.sn==="initSegment"||E.bitrateTest||b)return;var d=D(E);this.fragments[d]={body:E,loaded:C,backtrack:null,buffered:!1,range:Object.create(null)}},x.onBufferAppended=function(k,C){var E=this,b=C.frag,d=C.part,o=C.timeRanges;if(b.type===U.PlaylistLevelType.MAIN)if(this.activeFragment=b,d){var s=this.activeParts;s||(this.activeParts=s=[]),s.push(d)}else this.activeParts=null;this.timeRanges=o,Object.keys(o).forEach(function(u){var S=o[u];if(E.detectEvictedFragments(u,S),!d)for(var f=0;f<S.length;f++)b.appendedPTS=Math.max(S.end(f),b.appendedPTS||0)})},x.onFragBuffered=function(k,C){this.detectPartialFragments(C)},x.hasFragment=function(k){var C=D(k);return!!this.fragments[C]},x.removeFragmentsInRange=function(k,C,E){var b=this;Object.keys(this.fragments).forEach(function(d){var o=b.fragments[d];if(!o)return;if(o.buffered){var s=o.body;s.type===E&&s.start<C&&s.end>k&&b.removeFragment(s)}})},x.removeFragment=function(k){var C=D(k);k.stats.loaded=0,k.clearElementaryStreamInfo(),delete this.fragments[C]},x.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},L}();function I(L){var x,A;return L.buffered&&(((x=L.range.video)===null||x===void 0?void 0:x.partial)||((A=L.range.audio)===null||A===void 0?void 0:A.partial))}function D(L){return L.type+"_"+L.level+"_"+L.urlId+"_"+L.sn}},"./src/controller/gap-controller.ts":function(ne,V,_){"use strict";_.r(V),_.d(V,"STALL_MINIMUM_DURATION_MS",function(){return I}),_.d(V,"MAX_START_GAP_JUMP",function(){return D}),_.d(V,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return L}),_.d(V,"SKIP_BUFFER_RANGE_START",function(){return x}),_.d(V,"default",function(){return A});var G=_("./src/utils/buffer-helper.ts"),U=_("./src/errors.ts"),R=_("./src/events.ts"),B=_("./src/utils/logger.ts"),I=250,D=2,L=.1,x=.05,A=function(){function k(E,b,d,o){this.config=void 0,this.media=void 0,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=E,this.media=b,this.fragmentTracker=d,this.hls=o}var C=k.prototype;return C.destroy=function(){this.hls=this.fragmentTracker=this.media=null},C.poll=function(b){var d=this.config,o=this.media,s=this.stalled,u=o.currentTime,S=o.seeking,f=this.seeking&&!S,m=!this.seeking&&S;if(this.seeking=S,u!==b){if(this.moved=!0,s!==null){if(this.stallReported){var w=self.performance.now()-s;B.logger.warn("playback not stuck anymore @"+u+", after "+Math.round(w)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((m||f)&&(this.stalled=null),o.paused||o.ended||o.playbackRate===0||!G.BufferHelper.getBuffered(o).length)return;var v=G.BufferHelper.bufferInfo(o,u,0),h=v.len>0,c=v.nextStart||0;if(!h&&!c)return;if(S){var l=v.len>D,a=!c||c-u>D&&!this.fragmentTracker.getPartialFragment(u);if(l||a)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var g,p=Math.max(c,v.start||0)-u,y=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,M=y==null||((g=y.details)===null||g===void 0)?void 0:g.live,F=M?y.details.targetduration*2:D;if(p>0&&p<=F){this._trySkipBufferHole(null);return}}var j=self.performance.now();if(s===null){this.stalled=j;return}var W=j-s;!S&&W>=I&&this._reportStall(v.len);var O=G.BufferHelper.bufferInfo(o,u,d.maxBufferHole);this._tryFixBufferStall(O,W)},C._tryFixBufferStall=function(b,d){var o=this.config,s=this.fragmentTracker,u=this.media,S=u.currentTime,f=s.getPartialFragment(S);if(f){var m=this._trySkipBufferHole(f);if(m)return}b.len>o.maxBufferHole&&d>o.highBufferWatchdogPeriod*1e3&&(B.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},C._reportStall=function(b){var d=this.hls,o=this.media,s=this.stallReported;s||(this.stallReported=!0,B.logger.warn("Playback stalling at @"+o.currentTime+" due to low buffer (buffer="+b+")"),d.trigger(R.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:b}))},C._trySkipBufferHole=function(b){for(var d=this.config,o=this.hls,s=this.media,u=s.currentTime,S=0,f=G.BufferHelper.getBuffered(s),m=0;m<f.length;m++){var w=f.start(m);if(u+d.maxBufferHole>=S&&u<w){var v=Math.max(w+x,s.currentTime+L);return B.logger.warn("skipping hole, adjusting currentTime from "+u+" to "+v),this.moved=!0,this.stalled=null,s.currentTime=v,b&&o.trigger(R.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+u+" to "+v,frag:b}),v}S=f.end(m)}return 0},C._tryNudgeBuffer=function(){var b=this.config,d=this.hls,o=this.media,s=o.currentTime,u=(this.nudgeRetry||0)+1;if(this.nudgeRetry=u,u<b.nudgeMaxRetry){var S=s+u*b.nudgeOffset;B.logger.warn("Nudging 'currentTime' from "+s+" to "+S),o.currentTime=S,d.trigger(R.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else B.logger.error("Playhead still not moving while enough data buffered @"+s+" after "+b.nudgeMaxRetry+" nudges"),d.trigger(R.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},k}()},"./src/controller/id3-track-controller.ts":function(ne,V,_){"use strict";_.r(V);var G=_("./src/events.ts"),U=_("./src/utils/texttrack-utils.ts"),R=_("./src/demux/id3.ts"),B=.25,I=function(){function D(x){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=x,this._registerListeners()}var L=D.prototype;return L.destroy=function(){this._unregisterListeners()},L._registerListeners=function(){var A=this.hls;A.on(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),A.on(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this),A.on(G.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),A.on(G.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},L._unregisterListeners=function(){var A=this.hls;A.off(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),A.off(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this),A.off(G.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),A.off(G.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},L.onMediaAttached=function(A,k){this.media=k.media},L.onMediaDetaching=function(){if(!this.id3Track)return;Object(U.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},L.getID3Track=function(A){if(!this.media)return;for(var k=0;k<A.length;k++){var C=A[k];if(C.kind==="metadata"&&C.label==="id3")return Object(U.sendAddTrackEvent)(C,this.media),C}return this.media.addTextTrack("metadata","id3")},L.onFragParsingMetadata=function(A,k){if(!this.media)return;var C=k.frag,E=k.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var b=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,d=0;d<E.length;d++){var o=R.getID3Frames(E[d].data);if(o){var s=E[d].pts,u=d<E.length-1?E[d+1].pts:C.end,S=u-s;S<=0&&(u=s+B);for(var f=0;f<o.length;f++){var m=o[f];if(!R.isTimeStampFrame(m)){var w=new b(s,u,"");w.value=m,this.id3Track.addCue(w)}}}}},L.onBufferFlushing=function(A,k){var C=k.startOffset,E=k.endOffset,b=k.type;if(!b||b==="audio"){var d=this.id3Track;d&&Object(U.removeCuesInRange)(d,C,E)}},D}();V.default=I},"./src/controller/latency-controller.ts":function(ne,V,_){"use strict";_.r(V),_.d(V,"default",function(){return D});var G=_("./src/errors.ts"),U=_("./src/events.ts"),R=_("./src/utils/logger.ts");function B(L,x){for(var A=0;A<x.length;A++){var k=x[A];k.enumerable=k.enumerable||!1,k.configurable=!0,"value"in k&&(k.writable=!0),Object.defineProperty(L,k.key,k)}}function I(L,x,A){return x&&B(L.prototype,x),A&&B(L,A),L}var D=function(){function L(A){var k=this;this.hls=void 0,this.config=void 0,this.media=null,this.levelDetails=null,this.currentTime=0,this.stallCount=0,this._latency=null,this.timeupdateHandler=function(){return k.timeupdate()},this.hls=A,this.config=A.config,this.registerListeners()}var x=L.prototype;return x.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},x.registerListeners=function(){this.hls.on(U.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(U.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(U.Events.ERROR,this.onError,this)},x.unregisterListeners=function(){this.hls.off(U.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(U.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(U.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(U.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(U.Events.ERROR,this.onError)},x.onMediaAttached=function(k,C){this.media=C.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},x.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},x.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},x.onLevelUpdated=function(k,C){var E=C.details;this.levelDetails=E,E.advanced&&this.timeupdate(),!E.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},x.onError=function(k,C){if(C.details!==G.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,R.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},x.timeupdate=function(){var k=this.media,C=this.levelDetails;if(!k||!C)return;this.currentTime=k.currentTime;var E=this.computeLatency();if(E===null)return;this._latency=E;var b=this.config,d=b.lowLatencyMode,o=b.maxLiveSyncPlaybackRate;if(!d||o===1)return;var s=this.targetLatency;if(s===null)return;var u=E-s,S=Math.min(this.maxLatency,s+C.targetduration),f=u<S;if(C.live&&f&&u>.05&&this.forwardBufferLength>1){var m=Math.min(2,Math.max(1,o)),w=Math.round(2/(1+Math.exp(-.75*u-this.edgeStalled))*20)/20;k.playbackRate=Math.min(m,Math.max(1,w))}else k.playbackRate!==1&&k.playbackRate!==0&&(k.playbackRate=1)},x.estimateLiveEdge=function(){var k=this.levelDetails;return k===null?null:k.edge+k.age},x.computeLatency=function(){var k=this.estimateLiveEdge();return k===null?null:k-this.currentTime},I(L,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var k=this.config,C=this.levelDetails;return k.liveMaxLatencyDuration!==void 0?k.liveMaxLatencyDuration:C?k.liveMaxLatencyDurationCount*C.targetduration:0}},{key:"targetLatency",get:function(){var k=this.levelDetails;if(k===null)return null;var C=k.holdBack,E=k.partHoldBack,b=k.targetduration,d=this.config,o=d.liveSyncDuration,s=d.liveSyncDurationCount,u=d.lowLatencyMode,S=this.hls.userConfig,f=u&&E||C;(S.liveSyncDuration||S.liveSyncDurationCount||f===0)&&(f=o!==void 0?o:s*b);var m=b,w=1;return f+Math.min(this.stallCount*w,m)}},{key:"liveSyncPosition",get:function(){var k=this.estimateLiveEdge(),C=this.targetLatency,E=this.levelDetails;if(k===null||C===null||E===null)return null;var b=E.edge,d=k-C-this.edgeStalled,o=b-E.totalduration,s=b-(this.config.lowLatencyMode&&E.partTarget||E.targetduration);return Math.min(Math.max(o,d),s)}},{key:"drift",get:function(){var k=this.levelDetails;return k===null?1:k.drift}},{key:"edgeStalled",get:function(){var k=this.levelDetails;if(k===null)return 0;var C=(this.config.lowLatencyMode&&k.partTarget||k.targetduration)*3;return Math.max(k.age-C,0)}},{key:"forwardBufferLength",get:function(){var k=this.media,C=this.levelDetails;if(!k||!C)return 0;var E=k.buffered.length;return E?k.buffered.end(E-1):C.edge-this.currentTime}}]),L}()},"./src/controller/level-controller.ts":function(ne,V,_){"use strict";_.r(V),_.d(V,"default",function(){return d});var G=_("./src/types/level.ts"),U=_("./src/events.ts"),R=_("./src/errors.ts"),B=_("./src/utils/codecs.ts"),I=_("./src/controller/level-helper.ts"),D=_("./src/controller/base-playlist-controller.ts"),L=_("./src/types/loader.ts");function x(){return x=Object.assign||function(o){for(var s=1;s<arguments.length;s++){var u=arguments[s];for(var S in u)Object.prototype.hasOwnProperty.call(u,S)&&(o[S]=u[S])}return o},x.apply(this,arguments)}function A(o,s){for(var u=0;u<s.length;u++){var S=s[u];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(o,S.key,S)}}function k(o,s,u){return s&&A(o.prototype,s),u&&A(o,u),o}function C(o,s){o.prototype=Object.create(s.prototype),o.prototype.constructor=o,E(o,s)}function E(o,s){return E=Object.setPrototypeOf||function(S,f){return S.__proto__=f,S},E(o,s)}var b=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),d=function(o){C(s,o);function s(S){var f;return f=o.call(this,S,"[level-controller]")||this,f._levels=[],f._firstLevel=-1,f._startLevel=void 0,f.currentLevelIndex=-1,f.manualLevelIndex=-1,f.onParsedComplete=void 0,f._registerListeners(),f}var u=s.prototype;return u._registerListeners=function(){var f=this.hls;f.on(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),f.on(U.Events.LEVEL_LOADED,this.onLevelLoaded,this),f.on(U.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),f.on(U.Events.FRAG_LOADED,this.onFragLoaded,this),f.on(U.Events.ERROR,this.onError,this)},u._unregisterListeners=function(){var f=this.hls;f.off(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),f.off(U.Events.LEVEL_LOADED,this.onLevelLoaded,this),f.off(U.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),f.off(U.Events.FRAG_LOADED,this.onFragLoaded,this),f.off(U.Events.ERROR,this.onError,this)},u.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,o.prototype.destroy.call(this)},u.startLoad=function(){var f=this._levels;f.forEach(function(m){m.loadError=0}),o.prototype.startLoad.call(this)},u.onManifestLoaded=function(f,m){var w=[],v=[],h=[],c,l={},a,g=!1,p=!1,y=!1;if(m.levels.forEach(function(W){var O=W.attrs;g=g||!!(W.width&&W.height),p=p||!!W.videoCodec,y=y||!!W.audioCodec,b&&W.audioCodec&&W.audioCodec.indexOf("mp4a.40.34")!==-1&&(W.audioCodec=void 0);var P=W.bitrate+"-"+W.attrs.RESOLUTION+"-"+W.attrs.CODECS;a=l[P],a?a.url.push(W.url):(a=new G.Level(W),l[P]=a,w.push(a)),O&&(O.AUDIO&&Object(I.addGroupId)(a,"audio",O.AUDIO),O.SUBTITLES&&Object(I.addGroupId)(a,"text",O.SUBTITLES))}),(g||p)&&y&&(w=w.filter(function(W){var O=W.videoCodec,P=W.width,H=W.height;return!!O||!!(P&&H)})),w=w.filter(function(W){var O=W.audioCodec,P=W.videoCodec;return(!O||Object(B.isCodecSupportedInMp4)(O,"audio"))&&(!P||Object(B.isCodecSupportedInMp4)(P,"video"))}),m.audioTracks&&(v=m.audioTracks.filter(function(W){return!W.audioCodec||Object(B.isCodecSupportedInMp4)(W.audioCodec,"audio")}),Object(I.assignTrackIdsByGroup)(v)),m.subtitles&&(h=m.subtitles,Object(I.assignTrackIdsByGroup)(h)),w.length>0){c=w[0].bitrate,w.sort(function(W,O){return W.bitrate-O.bitrate}),this._levels=w;for(var M=0;M<w.length;M++)if(w[M].bitrate===c){this._firstLevel=M,this.log("manifest loaded, "+w.length+" level(s) found, first bitrate: "+c);break}var F=y&&!p,j={levels:w,audioTracks:v,subtitleTracks:h,firstLevel:this._firstLevel,stats:m.stats,audio:y,video:p,altAudio:!F&&v.some(function(W){return!!W.url})};this.hls.trigger(U.Events.MANIFEST_PARSED,j),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(U.Events.ERROR,{type:R.ErrorTypes.MEDIA_ERROR,details:R.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:m.url,reason:"no level with compatible codecs found in manifest"})},u.onError=function(f,m){if(o.prototype.onError.call(this,f,m),m.fatal)return;var w=m.context,v=this._levels[this.currentLevelIndex];if(w&&(w.type===L.PlaylistContextType.AUDIO_TRACK&&v.audioGroupIds&&w.groupId===v.audioGroupIds[v.urlId]||w.type===L.PlaylistContextType.SUBTITLE_TRACK&&v.textGroupIds&&w.groupId===v.textGroupIds[v.urlId])){this.redundantFailover(this.currentLevelIndex);return}var h=!1,c=!0,l;switch(m.details){case R.ErrorDetails.FRAG_LOAD_ERROR:case R.ErrorDetails.FRAG_LOAD_TIMEOUT:case R.ErrorDetails.KEY_LOAD_ERROR:case R.ErrorDetails.KEY_LOAD_TIMEOUT:if(m.frag){var a=this._levels[m.frag.level];a?(a.fragmentError++,a.fragmentError>this.hls.config.fragLoadingMaxRetry&&(l=m.frag.level)):l=m.frag.level}break;case R.ErrorDetails.LEVEL_LOAD_ERROR:case R.ErrorDetails.LEVEL_LOAD_TIMEOUT:w&&(w.deliveryDirectives&&(c=!1),l=w.level),h=!0;break;case R.ErrorDetails.REMUX_ALLOC_ERROR:l=m.level,h=!0;break}l!==void 0&&this.recoverLevel(m,l,h,c)},u.recoverLevel=function(f,m,w,v){var h=f.details,c=this._levels[m];if(c.loadError++,w){var l=this.retryLoadingOrFail(f);if(l)f.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(v){var a=c.url.length;if(a>1&&c.loadError<a)f.levelRetry=!0,this.redundantFailover(m);else if(this.manualLevelIndex===-1){var g=m===0?this._levels.length-1:m-1;this.currentLevelIndex!==g&&this._levels[g].loadError===0&&(this.warn(h+": switch to "+g),f.levelRetry=!0,this.hls.nextAutoLevel=g)}}},u.redundantFailover=function(f){var m=this._levels[f],w=m.url.length;if(w>1){var v=(m.urlId+1)%w;this.warn("Switching to redundant URL-id "+v),this._levels.forEach(function(h){h.urlId=v}),this.level=f}},u.onFragLoaded=function(f,m){var w=m.frag;if(w!==void 0&&w.type===L.PlaylistLevelType.MAIN){var v=this._levels[w.level];v!==void 0&&(v.fragmentError=0,v.loadError=0)}},u.onLevelLoaded=function(f,m){var w,v=m.level,h=m.details,c=this._levels[v];if(!c){var l;this.warn("Invalid level index "+v),(l=m.deliveryDirectives)!==null&&l!==void 0&&l.skip&&(h.deltaUpdateFailed=!0);return}v===this.currentLevelIndex?(c.fragmentError===0&&(c.loadError=0,this.retryCount=0),this.playlistLoaded(v,m,c.details)):(w=m.deliveryDirectives)!==null&&w!==void 0&&w.skip&&(h.deltaUpdateFailed=!0)},u.onAudioTrackSwitched=function(f,m){var w=this.hls.levels[this.currentLevelIndex];if(!w)return;if(w.audioGroupIds){for(var v=-1,h=this.hls.audioTracks[m.id].groupId,c=0;c<w.audioGroupIds.length;c++)if(w.audioGroupIds[c]===h){v=c;break}v!==w.urlId&&(w.urlId=v,this.startLoad())}},u.loadPlaylist=function(f){var m=this.currentLevelIndex,w=this._levels[m];if(this.canLoad&&w&&w.url.length>0){var v=w.urlId,h=w.url[v];if(f)try{h=f.addDirectives(h)}catch(c){this.warn("Could not construct new URL with HLS Delivery Directives: "+c)}this.log("Attempt loading level index "+m+(f?" at sn "+f.msn+" part "+f.part:"")+" with URL-id "+v+" "+h),this.clearTimer(),this.hls.trigger(U.Events.LEVEL_LOADING,{url:h,level:m,id:v,deliveryDirectives:f||null})}},u.removeLevel=function(f,m){var w=function(c,l){return l!==m},v=this._levels.filter(function(h,c){return c!==f?!0:h.url.length>1&&m!==void 0?(h.url=h.url.filter(w),h.audioGroupIds&&(h.audioGroupIds=h.audioGroupIds.filter(w)),h.textGroupIds&&(h.textGroupIds=h.textGroupIds.filter(w)),h.urlId=0,!0):!1}).map(function(h,c){var l=h.details;return l!=null&&l.fragments&&l.fragments.forEach(function(a){a.level=c}),h});this._levels=v,this.hls.trigger(U.Events.LEVELS_UPDATED,{levels:v})},k(s,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(f){var m,w=this._levels;if(w.length===0)return;if(this.currentLevelIndex===f&&(m=w[f])!==null&&m!==void 0&&m.details)return;if(f<0||f>=w.length){var v=f<0;if(this.hls.trigger(U.Events.ERROR,{type:R.ErrorTypes.OTHER_ERROR,details:R.ErrorDetails.LEVEL_SWITCH_ERROR,level:f,fatal:v,reason:"invalid level idx"}),v)return;f=Math.min(f,w.length-1)}this.clearTimer();var h=this.currentLevelIndex,c=w[h],l=w[f];this.log("switching to level "+f+" from "+h),this.currentLevelIndex=f;var a=x({},l,{level:f,maxBitrate:l.maxBitrate,uri:l.uri,urlId:l.urlId});delete a._urlId,this.hls.trigger(U.Events.LEVEL_SWITCHING,a);var g=l.details;if(!g||g.live){var p=this.switchParams(l.uri,c==null?void 0:c.details);this.loadPlaylist(p)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(f){this.manualLevelIndex=f,this._startLevel===void 0&&(this._startLevel=f),f!==-1&&(this.level=f)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(f){this._firstLevel=f}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var f=this.hls.config.startLevel;return f!==void 0?f:this._firstLevel}else return this._startLevel},set:function(f){this._startLevel=f}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(f){this.level=f,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=f)}}]),s}(D.default)},"./src/controller/level-helper.ts":function(ne,V,_){"use strict";_.r(V),_.d(V,"addGroupId",function(){return R}),_.d(V,"assignTrackIdsByGroup",function(){return B}),_.d(V,"updatePTS",function(){return I}),_.d(V,"updateFragPTSDTS",function(){return L}),_.d(V,"mergeDetails",function(){return x}),_.d(V,"mapPartIntersection",function(){return A}),_.d(V,"mapFragmentIntersection",function(){return k}),_.d(V,"adjustSliding",function(){return C}),_.d(V,"addSliding",function(){return E}),_.d(V,"computeReloadInterval",function(){return b}),_.d(V,"getFragmentWithSN",function(){return d}),_.d(V,"getPartWith",function(){return o});var G=_("./src/polyfills/number.ts"),U=_("./src/utils/logger.ts");function R(s,u,S){switch(u){case"audio":s.audioGroupIds||(s.audioGroupIds=[]),s.audioGroupIds.push(S);break;case"text":s.textGroupIds||(s.textGroupIds=[]),s.textGroupIds.push(S);break}}function B(s){var u={};s.forEach(function(S){var f=S.groupId||"";S.id=u[f]=u[f]||0,u[f]++})}function I(s,u,S){var f=s[u],m=s[S];D(f,m)}function D(s,u){var S=u.startPTS;if(Object(G.isFiniteNumber)(S)){var f=0,m;u.sn>s.sn?(f=S-s.start,m=s):(f=s.start-S,m=u),m.duration!==f&&(m.duration=f)}else if(u.sn>s.sn){var w=s.cc===u.cc;w&&s.minEndPTS?u.start=s.start+(s.minEndPTS-s.start):u.start=s.start+s.duration}else u.start=Math.max(s.start-u.duration,0)}function L(s,u,S,f,m,w){var v=f-S;v<=0&&(U.logger.warn("Fragment should have a positive duration",u),f=S+u.duration,w=m+u.duration);var h=S,c=f,l=u.startPTS,a=u.endPTS;if(Object(G.isFiniteNumber)(l)){var g=Math.abs(l-S);Object(G.isFiniteNumber)(u.deltaPTS)?u.deltaPTS=Math.max(g,u.deltaPTS):u.deltaPTS=g,h=Math.max(S,l),S=Math.min(S,l),m=Math.min(m,u.startDTS),c=Math.min(f,a),f=Math.max(f,a),w=Math.max(w,u.endDTS)}u.duration=f-S;var p=S-u.start;u.appendedPTS=f,u.start=u.startPTS=S,u.maxStartPTS=h,u.startDTS=m,u.endPTS=f,u.minEndPTS=c,u.endDTS=w;var y=u.sn;if(!s||y<s.startSN||y>s.endSN)return 0;var M,F=y-s.startSN,j=s.fragments;for(j[F]=u,M=F;M>0;M--)D(j[M],j[M-1]);for(M=F;M<j.length-1;M++)D(j[M],j[M+1]);return s.fragmentHint&&D(j[j.length-1],s.fragmentHint),s.PTSKnown=s.alignedSliding=!0,p}function x(s,u){for(var S=null,f=s.fragments,m=f.length-1;m>=0;m--){var w=f[m].initSegment;if(w){S=w;break}}s.fragmentHint&&delete s.fragmentHint.endPTS;var v=0,h;if(k(s,u,function(M,F){M.relurl&&(v=M.cc-F.cc),Object(G.isFiniteNumber)(M.startPTS)&&Object(G.isFiniteNumber)(M.endPTS)&&(F.start=F.startPTS=M.startPTS,F.startDTS=M.startDTS,F.appendedPTS=M.appendedPTS,F.maxStartPTS=M.maxStartPTS,F.endPTS=M.endPTS,F.endDTS=M.endDTS,F.minEndPTS=M.minEndPTS,F.duration=M.endPTS-M.startPTS,F.duration&&(h=F),u.PTSKnown=u.alignedSliding=!0),F.elementaryStreams=M.elementaryStreams,F.loader=M.loader,F.stats=M.stats,F.urlId=M.urlId,M.initSegment&&(F.initSegment=M.initSegment,S=M.initSegment)}),S){var c=u.fragmentHint?u.fragments.concat(u.fragmentHint):u.fragments;c.forEach(function(M){var F;(!M.initSegment||M.initSegment.relurl===((F=S)===null||F===void 0?void 0:F.relurl))&&(M.initSegment=S)})}if(u.skippedSegments&&(u.deltaUpdateFailed=u.fragments.some(function(M){return!M}),u.deltaUpdateFailed)){U.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var l=u.skippedSegments;l--;)u.fragments.shift();u.startSN=u.fragments[0].sn,u.startCC=u.fragments[0].cc}var a=u.fragments;if(v){U.logger.warn("discontinuity sliding from playlist, take drift into account");for(var g=0;g<a.length;g++)a[g].cc+=v}u.skippedSegments&&(u.startCC=u.fragments[0].cc),A(s.partList,u.partList,function(M,F){F.elementaryStreams=M.elementaryStreams,F.stats=M.stats}),h?L(u,h,h.startPTS,h.endPTS,h.startDTS,h.endDTS):C(s,u),a.length&&(u.totalduration=u.edge-a[0].start),u.driftStartTime=s.driftStartTime,u.driftStart=s.driftStart;var p=u.advancedDateTime;if(u.advanced&&p){var y=u.edge;u.driftStart||(u.driftStartTime=p,u.driftStart=y),u.driftEndTime=p,u.driftEnd=y}else u.driftEndTime=s.driftEndTime,u.driftEnd=s.driftEnd,u.advancedDateTime=s.advancedDateTime}function A(s,u,S){if(s&&u)for(var f=0,m=0,w=s.length;m<=w;m++){var v=s[m],h=u[m+f];v&&h&&v.index===h.index&&v.fragment.sn===h.fragment.sn?S(v,h):f--}}function k(s,u,S){for(var f=u.skippedSegments,m=Math.max(s.startSN,u.startSN)-u.startSN,w=(s.fragmentHint?1:0)+(f?u.endSN:Math.min(s.endSN,u.endSN))-u.startSN,v=u.startSN-s.startSN,h=u.fragmentHint?u.fragments.concat(u.fragmentHint):u.fragments,c=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments,l=m;l<=w;l++){var a=c[v+l],g=h[l];f&&!g&&l<f&&(g=u.fragments[l]=a),a&&g&&S(a,g)}}function C(s,u){var S=u.startSN+u.skippedSegments-s.startSN,f=s.fragments;if(S<0||S>=f.length)return;E(u,f[S].start)}function E(s,u){if(u){for(var S=s.fragments,f=s.skippedSegments;f<S.length;f++)S[f].start+=u;s.fragmentHint&&(s.fragmentHint.start+=u)}}function b(s,u){var S=1e3*s.levelTargetDuration,f=S/2,m=s.age,w=m>0&&m<S*3,v=u.loading.end-u.loading.start,h,c=s.availabilityDelay;if(s.updated===!1)if(w){var l=333*s.misses;h=Math.max(Math.min(f,v*2),l),s.availabilityDelay=(s.availabilityDelay||0)+h}else h=f;else w?(c=Math.min(c||S/2,m),s.availabilityDelay=c,h=c+S-m):h=S-v;return Math.round(h)}function d(s,u,S){if(!s||!s.details)return null;var f=s.details,m=f.fragments[u-f.startSN];return m||(m=f.fragmentHint,m&&m.sn===u?m:u<f.startSN&&S&&S.sn===u?S:null)}function o(s,u,S){if(!s||!s.details)return null;var f=s.details.partList;if(f)for(var m=f.length;m--;){var w=f[m];if(w.index===S&&w.fragment.sn===u)return w}return null}},"./src/controller/stream-controller.ts":function(ne,V,_){"use strict";_.r(V),_.d(V,"default",function(){return f});var G=_("./src/polyfills/number.ts"),U=_("./src/controller/base-stream-controller.ts"),R=_("./src/is-supported.ts"),B=_("./src/events.ts"),I=_("./src/utils/buffer-helper.ts"),D=_("./src/controller/fragment-tracker.ts"),L=_("./src/types/loader.ts"),x=_("./src/loader/fragment.ts"),A=_("./src/demux/transmuxer-interface.ts"),k=_("./src/types/transmuxer.ts"),C=_("./src/controller/gap-controller.ts"),E=_("./src/errors.ts"),b=_("./src/utils/logger.ts");function d(m,w){for(var v=0;v<w.length;v++){var h=w[v];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(m,h.key,h)}}function o(m,w,v){return w&&d(m.prototype,w),v&&d(m,v),m}function s(m,w){m.prototype=Object.create(w.prototype),m.prototype.constructor=m,u(m,w)}function u(m,w){return u=Object.setPrototypeOf||function(h,c){return h.__proto__=c,h},u(m,w)}var S=100,f=function(m){s(w,m);function w(h,c){var l;return l=m.call(this,h,c,"[stream-controller]")||this,l.audioCodecSwap=!1,l.gapController=null,l.level=-1,l._forceStartLoad=!1,l.altAudio=!1,l.audioOnly=!1,l.fragPlaying=null,l.onvplaying=null,l.onvseeked=null,l.fragLastKbps=0,l.stalled=!1,l.couldBacktrack=!1,l.audioCodecSwitch=!1,l.videoBuffer=null,l._registerListeners(),l}var v=w.prototype;return v._registerListeners=function(){var c=this.hls;c.on(B.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.on(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.on(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.on(B.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.on(B.Events.LEVEL_LOADING,this.onLevelLoading,this),c.on(B.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.on(B.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),c.on(B.Events.ERROR,this.onError,this),c.on(B.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),c.on(B.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),c.on(B.Events.BUFFER_CREATED,this.onBufferCreated,this),c.on(B.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),c.on(B.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),c.on(B.Events.FRAG_BUFFERED,this.onFragBuffered,this)},v._unregisterListeners=function(){var c=this.hls;c.off(B.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.off(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.off(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.off(B.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.off(B.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.off(B.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),c.off(B.Events.ERROR,this.onError,this),c.off(B.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),c.off(B.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),c.off(B.Events.BUFFER_CREATED,this.onBufferCreated,this),c.off(B.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),c.off(B.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),c.off(B.Events.FRAG_BUFFERED,this.onFragBuffered,this)},v.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},v.startLoad=function(c){if(this.levels){var l=this.lastCurrentTime,a=this.hls;if(this.stopLoad(),this.setInterval(S),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var g=a.startLevel;g===-1&&(a.config.testBandwidth?(g=0,this.bitrateTest=!0):g=a.nextAutoLevel),this.level=a.nextLoadLevel=g,this.loadedmetadata=!1}l>0&&c===-1&&(this.log("Override startPosition with lastCurrentTime @"+l.toFixed(3)),c=l),this.state=U.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=c,this.tick()}else this._forceStartLoad=!0,this.state=U.State.STOPPED},v.stopLoad=function(){this._forceStartLoad=!1,m.prototype.stopLoad.call(this)},v.doTick=function(){switch(this.state){case U.State.IDLE:this.doTickIdle();break;case U.State.WAITING_LEVEL:{var c,l=this.levels,a=this.level,g=l==null||((c=l[a])===null||c===void 0)?void 0:c.details;if(g&&(!g.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(g))break;this.state=U.State.IDLE;break}break}case U.State.FRAG_LOADING_WAITING_RETRY:{var p,y=self.performance.now(),M=this.retryDate;(!M||y>=M||(p=this.media)!==null&&p!==void 0&&p.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=U.State.IDLE)}break;default:break}this.onTickEnd()},v.onTickEnd=function(){m.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},v.doTickIdle=function(){var c,l,a=this.hls,g=this.levelLastLoaded,p=this.levels,y=this.media,M=a.config,F=a.nextLoadLevel;if(g===null||!y&&(this.startFragRequested||!M.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!p||!p[F])return;var j=p[F];this.level=a.nextLoadLevel=F;var W=j.details;if(!W||this.state===U.State.WAITING_LEVEL||W.live&&this.levelLastLoaded!==F){this.state=U.State.WAITING_LEVEL;return}var O=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:y,L.PlaylistLevelType.MAIN);if(O===null)return;var P=O.len,H=this.getMaxBufferLength(j.maxBitrate);if(P>=H)return;if(this._streamEnded(O,W)){var X={};this.altAudio&&(X.type="video"),this.hls.trigger(B.Events.BUFFER_EOS,X),this.state=U.State.ENDED;return}var q=O.end,re=this.getNextFragment(q,W);if(this.couldBacktrack&&!this.fragPrevious&&re&&re.sn!=="initSegment"){var Ee=re.sn-W.startSN;Ee>1&&(re=W.fragments[Ee-1],this.fragmentTracker.removeFragment(re))}if(re&&this.fragmentTracker.getState(re)===D.FragmentState.OK&&this.nextLoadPosition>q){var he=this.audioOnly&&!this.altAudio?x.ElementaryStreamTypes.AUDIO:x.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(y,he,L.PlaylistLevelType.MAIN),re=this.getNextFragment(this.nextLoadPosition,W)}if(!re)return;re.initSegment&&!re.initSegment.data&&!this.bitrateTest&&(re=re.initSegment),((c=re.decryptdata)===null||c===void 0?void 0:c.keyFormat)==="identity"&&!((l=re.decryptdata)!==null&&l!==void 0&&l.key)?this.loadKey(re,W):this.loadFragment(re,W,q)},v.loadFragment=function(c,l,a){var g,p=this.fragmentTracker.getState(c);if(this.fragCurrent=c,p===D.FragmentState.BACKTRACKED){var y=this.fragmentTracker.getBacktrackData(c);if(y){this._handleFragmentLoadProgress(y),this._handleFragmentLoadComplete(y);return}else p=D.FragmentState.NOT_LOADED}p===D.FragmentState.NOT_LOADED||p===D.FragmentState.PARTIAL?c.sn==="initSegment"?this._loadInitSegment(c):this.bitrateTest?(c.bitrateTest=!0,this.log("Fragment "+c.sn+" of level "+c.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(c)):(this.startFragRequested=!0,m.prototype.loadFragment.call(this,c,l,a)):p===D.FragmentState.APPENDING?this.reduceMaxBufferLength(c.duration)&&this.fragmentTracker.removeFragment(c):((g=this.media)===null||g===void 0?void 0:g.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},v.getAppendedFrag=function(c){var l=this.fragmentTracker.getAppendedFrag(c,L.PlaylistLevelType.MAIN);return l&&"fragment"in l?l.fragment:l},v.getBufferedFrag=function(c){return this.fragmentTracker.getBufferedFrag(c,L.PlaylistLevelType.MAIN)},v.followingBufferedFrag=function(c){return c?this.getBufferedFrag(c.end+.5):null},v.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},v.nextLevelSwitch=function(){var c=this.levels,l=this.media;if(l!=null&&l.readyState){var a,g=this.getAppendedFrag(l.currentTime);if(g&&g.start>1&&this.flushMainBuffer(0,g.start-1),!l.paused&&c){var p=this.hls.nextLoadLevel,y=c[p],M=this.fragLastKbps;M&&this.fragCurrent?a=this.fragCurrent.duration*y.maxBitrate/(1e3*M)+1:a=0}else a=0;var F=this.getBufferedFrag(l.currentTime+a);if(F){var j=this.followingBufferedFrag(F);if(j){this.abortCurrentFrag();var W=j.maxStartPTS?j.maxStartPTS:j.start,O=j.duration,P=Math.max(F.end,W+Math.min(Math.max(O-this.config.maxFragLookUpTolerance,O*.5),O*.75));this.flushMainBuffer(P,Number.POSITIVE_INFINITY)}}}},v.abortCurrentFrag=function(){var c=this.fragCurrent;this.fragCurrent=null,c!=null&&c.loader&&c.loader.abort(),this.state===U.State.KEY_LOADING&&(this.state=U.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},v.flushMainBuffer=function(c,l){m.prototype.flushMainBuffer.call(this,c,l,this.altAudio?"video":null)},v.onMediaAttached=function(c,l){m.prototype.onMediaAttached.call(this,c,l);var a=l.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),a.addEventListener("playing",this.onvplaying),a.addEventListener("seeked",this.onvseeked),this.gapController=new C.default(this.config,a,this.fragmentTracker,this.hls)},v.onMediaDetaching=function(){var c=this.media;c&&(c.removeEventListener("playing",this.onvplaying),c.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),m.prototype.onMediaDetaching.call(this)},v.onMediaPlaying=function(){this.tick()},v.onMediaSeeked=function(){var c=this.media,l=c?c.currentTime:null;Object(G.isFiniteNumber)(l)&&this.log("Media seeked to "+l.toFixed(3)),this.tick()},v.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(B.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},v.onManifestParsed=function(c,l){var a=!1,g=!1,p;l.levels.forEach(function(y){p=y.audioCodec,p&&(p.indexOf("mp4a.40.2")!==-1&&(a=!0),p.indexOf("mp4a.40.5")!==-1&&(g=!0))}),this.audioCodecSwitch=a&&g&&!Object(R.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=l.levels,this.startFragRequested=!1},v.onLevelLoading=function(c,l){var a=this.levels;if(!a||this.state!==U.State.IDLE)return;var g=a[l.level];(!g.details||g.details.live&&this.levelLastLoaded!==l.level||this.waitForCdnTuneIn(g.details))&&(this.state=U.State.WAITING_LEVEL)},v.onLevelLoaded=function(c,l){var a,g=this.levels,p=l.level,y=l.details,M=y.totalduration;if(!g){this.warn("Levels were reset while loading level "+p);return}this.log("Level "+p+" loaded ["+y.startSN+","+y.endSN+"], cc ["+y.startCC+", "+y.endCC+"] duration:"+M);var F=this.fragCurrent;F&&(this.state===U.State.FRAG_LOADING||this.state===U.State.FRAG_LOADING_WAITING_RETRY)&&(F.level!==l.level&&F.loader&&(this.state=U.State.IDLE,F.loader.abort()));var j=g[p],W=0;if(y.live||(a=j.details)!==null&&a!==void 0&&a.live){if(y.fragments[0]||(y.deltaUpdateFailed=!0),y.deltaUpdateFailed)return;W=this.alignPlaylists(y,j.details)}if(j.details=y,this.levelLastLoaded=p,this.hls.trigger(B.Events.LEVEL_UPDATED,{details:y,level:p}),this.state===U.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(y))return;this.state=U.State.IDLE}this.startFragRequested?y.live&&this.synchronizeToLiveEdge(y):this.setStartPosition(y,W),this.tick()},v._handleFragmentLoadProgress=function(c){var l,a=c.frag,g=c.part,p=c.payload,y=this.levels;if(!y){this.warn("Levels were reset while fragment load was in progress. Fragment "+a.sn+" of level "+a.level+" will not be buffered");return}var M=y[a.level],F=M.details;if(!F){this.warn("Dropping fragment "+a.sn+" of level "+a.level+" after level details were reset");return}var j=M.videoCodec,W=F.PTSKnown||!F.live,O=(l=a.initSegment)===null||l===void 0?void 0:l.data,P=this._getAudioCodec(M),H=this.transmuxer=this.transmuxer||new A.default(this.hls,L.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),X=g?g.index:-1,q=X!==-1,re=new k.ChunkMetadata(a.level,a.sn,a.stats.chunkCount,p.byteLength,X,q),Ee=this.initPTS[a.cc];H.push(p,O,P,j,a,g,F.totalduration,W,re,Ee)},v.onAudioTrackSwitching=function(c,l){var a=this.altAudio,g=!!l.url,p=l.id;if(!g){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var y=this.fragCurrent;y!=null&&y.loader&&(this.log("Switching to main audio track, cancel main fragment load"),y.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var M=this.hls;a&&M.trigger(B.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),M.trigger(B.Events.AUDIO_TRACK_SWITCHED,{id:p})}},v.onAudioTrackSwitched=function(c,l){var a=l.id,g=!!this.hls.audioTracks[a].url;if(g){var p=this.videoBuffer;p&&this.mediaBuffer!==p&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=p)}this.altAudio=g,this.tick()},v.onBufferCreated=function(c,l){var a=l.tracks,g,p,y=!1;for(var M in a){var F=a[M];if(F.id==="main"){if(p=M,g=F,M==="video"){var j=a[M];j&&(this.videoBuffer=j.buffer)}}else y=!0}y&&g?(this.log("Alternate track found, use "+p+".buffered to schedule main fragment loading"),this.mediaBuffer=g.buffer):this.mediaBuffer=this.media},v.onFragBuffered=function(c,l){var a=l.frag,g=l.part;if(a&&a.type!==L.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(a)){this.warn("Fragment "+a.sn+(g?" p: "+g.index:"")+" of level "+a.level+" finished buffering, but was aborted. state: "+this.state),this.state===U.State.PARSED&&(this.state=U.State.IDLE);return}var p=g?g.stats:a.stats;this.fragLastKbps=Math.round(8*p.total/(p.buffering.end-p.loading.first)),a.sn!=="initSegment"&&(this.fragPrevious=a),this.fragBufferedComplete(a,g)},v.onError=function(c,l){switch(l.details){case E.ErrorDetails.FRAG_LOAD_ERROR:case E.ErrorDetails.FRAG_LOAD_TIMEOUT:case E.ErrorDetails.KEY_LOAD_ERROR:case E.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(L.PlaylistLevelType.MAIN,l);break;case E.ErrorDetails.LEVEL_LOAD_ERROR:case E.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==U.State.ERROR&&(l.fatal?(this.warn(""+l.details),this.state=U.State.ERROR):!l.levelRetry&&this.state===U.State.WAITING_LEVEL&&(this.state=U.State.IDLE));break;case E.ErrorDetails.BUFFER_FULL_ERROR:if(l.parent==="main"&&(this.state===U.State.PARSING||this.state===U.State.PARSED)){var a=!0,g=this.getFwdBufferInfo(this.media,L.PlaylistLevelType.MAIN);g&&g.len>.5&&(a=!this.reduceMaxBufferLength(g.len)),a&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},v.checkBuffer=function(){var c=this.media,l=this.gapController;if(!c||!l||!c.readyState)return;var a=I.BufferHelper.getBuffered(c);!this.loadedmetadata&&a.length?(this.loadedmetadata=!0,this.seekToStartPos()):l.poll(this.lastCurrentTime),this.lastCurrentTime=c.currentTime},v.onFragLoadEmergencyAborted=function(){this.state=U.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},v.onBufferFlushed=function(c,l){var a=l.type;if(a!==x.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var g=(a===x.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(g,a,L.PlaylistLevelType.MAIN)}},v.onLevelsUpdated=function(c,l){this.levels=l.levels},v.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},v.seekToStartPos=function(){var c=this.media,l=c.currentTime,a=this.startPosition;if(a>=0&&l<a){if(c.seeking){b.logger.log("could not seek to "+a+", already seeking at "+l);return}var g=I.BufferHelper.getBuffered(c),p=g.length?g.start(0):0,y=p-a;y>0&&(y<this.config.maxBufferHole||y<this.config.maxFragLookUpTolerance)&&(b.logger.log("adjusting start position by "+y+" to match buffer start"),a+=y,this.startPosition=a),this.log("seek to target start position "+a+" from current time "+l),c.currentTime=a}},v._getAudioCodec=function(c){var l=this.config.defaultAudioCodec||c.audioCodec;return this.audioCodecSwap&&l&&(this.log("Swapping audio codec"),l.indexOf("mp4a.40.5")!==-1?l="mp4a.40.2":l="mp4a.40.5"),l},v._loadBitrateTestFrag=function(c){var l=this;this._doFragLoad(c).then(function(a){var g=l.hls;if(!a||g.nextLoadLevel||l.fragContextChanged(c))return;l.fragLoadError=0,l.state=U.State.IDLE,l.startFragRequested=!1,l.bitrateTest=!1;var p=c.stats;p.parsing.start=p.parsing.end=p.buffering.start=p.buffering.end=self.performance.now(),g.trigger(B.Events.FRAG_LOADED,a)})},v._handleTransmuxComplete=function(c){var l,a="main",g=this.hls,p=c.remuxResult,y=c.chunkMeta,M=this.getCurrentContext(y);if(!M){this.warn("The loading context changed while buffering fragment "+y.sn+" of level "+y.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(y.level);return}var F=M.frag,j=M.part,W=M.level,O=p.video,P=p.text,H=p.id3,X=p.initSegment,q=this.altAudio?void 0:p.audio;if(this.fragContextChanged(F))return;if(this.state=U.State.PARSING,X){X.tracks&&(this._bufferInitSegment(W,X.tracks,F,y),g.trigger(B.Events.FRAG_PARSING_INIT_SEGMENT,{frag:F,id:a,tracks:X.tracks}));var re=X.initPTS,Ee=X.timescale;Object(G.isFiniteNumber)(re)&&(this.initPTS[F.cc]=re,g.trigger(B.Events.INIT_PTS_FOUND,{frag:F,id:a,initPTS:re,timescale:Ee}))}if(O&&p.independent!==!1){if(W.details){var he=O.startPTS,xe=O.endPTS,pe=O.startDTS,ve=O.endDTS;if(j)j.elementaryStreams[O.type]={startPTS:he,endPTS:xe,startDTS:pe,endDTS:ve};else if(O.firstKeyFrame&&O.independent&&(this.couldBacktrack=!0),O.dropped&&O.independent){var ce=this.getLoadPosition()+this.config.maxBufferHole;if(ce<he){this.backtrack(F);return}F.setElementaryStreamInfo(O.type,F.start,xe,F.start,ve,!0)}F.setElementaryStreamInfo(O.type,he,xe,pe,ve),this.bufferFragmentData(O,F,j,y)}}else if(p.independent===!1){this.backtrack(F);return}if(q){var fe=q.startPTS,$=q.endPTS,ae=q.startDTS,Z=q.endDTS;j&&(j.elementaryStreams[x.ElementaryStreamTypes.AUDIO]={startPTS:fe,endPTS:$,startDTS:ae,endDTS:Z}),F.setElementaryStreamInfo(x.ElementaryStreamTypes.AUDIO,fe,$,ae,Z),this.bufferFragmentData(q,F,j,y)}if(H!=null&&(l=H.samples)!==null&&l!==void 0&&l.length){var ge={frag:F,id:a,samples:H.samples};g.trigger(B.Events.FRAG_PARSING_METADATA,ge)}if(P){var Se={frag:F,id:a,samples:P.samples};g.trigger(B.Events.FRAG_PARSING_USERDATA,Se)}},v._bufferInitSegment=function(c,l,a,g){var p=this;if(this.state!==U.State.PARSING)return;this.audioOnly=!!l.audio&&!l.video,this.altAudio&&!this.audioOnly&&delete l.audio;var y=l.audio,M=l.video,F=l.audiovideo;if(y){var j=c.audioCodec,W=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(j&&(j.indexOf("mp4a.40.5")!==-1?j="mp4a.40.2":j="mp4a.40.5"),y.metadata.channelCount!==1&&W.indexOf("firefox")===-1&&(j="mp4a.40.5")),W.indexOf("android")!==-1&&y.container!=="audio/mpeg"&&(j="mp4a.40.2",this.log("Android: force audio codec to "+j)),c.audioCodec&&c.audioCodec!==j&&this.log('Swapping manifest audio codec "'+c.audioCodec+'" for "'+j+'"'),y.levelCodec=j,y.id="main",this.log("Init audio buffer, container:"+y.container+", codecs[selected/level/parsed]=["+(j||"")+"/"+(c.audioCodec||"")+"/"+y.codec+"]")}M&&(M.levelCodec=c.videoCodec,M.id="main",this.log("Init video buffer, container:"+M.container+", codecs[level/parsed]=["+(c.videoCodec||"")+"/"+M.codec+"]")),F&&this.log("Init audiovideo buffer, container:"+F.container+", codecs[level/parsed]=["+(c.attrs.CODECS||"")+"/"+F.codec+"]"),this.hls.trigger(B.Events.BUFFER_CODECS,l),Object.keys(l).forEach(function(O){var P=l[O],H=P.initSegment;H!=null&&H.byteLength&&p.hls.trigger(B.Events.BUFFER_APPENDING,{type:O,data:H,frag:a,part:null,chunkMeta:g,parent:a.type})}),this.tick()},v.backtrack=function(c){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(c);var l=this.fragmentTracker.backtrack(c);this.fragPrevious=null,this.nextLoadPosition=c.start,l?this.resetFragmentLoading(c):this.state=U.State.BACKTRACKING},v.checkFragmentChanged=function(){var c=this.media,l=null;if(c&&c.readyState>1&&c.seeking===!1){var a=c.currentTime;if(I.BufferHelper.isBuffered(c,a)?l=this.getAppendedFrag(a):I.BufferHelper.isBuffered(c,a+.1)&&(l=this.getAppendedFrag(a+.1)),l){var g=this.fragPlaying,p=l.level;(!g||l.sn!==g.sn||g.level!==p||l.urlId!==g.urlId)&&(this.hls.trigger(B.Events.FRAG_CHANGED,{frag:l}),(!g||g.level!==p)&&this.hls.trigger(B.Events.LEVEL_SWITCHED,{level:p}),this.fragPlaying=l)}}},o(w,[{key:"nextLevel",get:function(){var c=this.nextBufferedFrag;return c?c.level:-1}},{key:"currentLevel",get:function(){var c=this.media;if(c){var l=this.getAppendedFrag(c.currentTime);if(l)return l.level}return-1}},{key:"nextBufferedFrag",get:function(){var c=this.media;if(c){var l=this.getAppendedFrag(c.currentTime);return this.followingBufferedFrag(l)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),w}(U.default)},"./src/controller/subtitle-stream-controller.ts":function(ne,V,_){"use strict";_.r(V),_.d(V,"SubtitleStreamController",function(){return s});var G=_("./src/events.ts"),U=_("./src/utils/logger.ts"),R=_("./src/utils/buffer-helper.ts"),B=_("./src/controller/fragment-finders.ts"),I=_("./src/utils/discontinuities.ts"),D=_("./src/controller/level-helper.ts"),L=_("./src/controller/fragment-tracker.ts"),x=_("./src/controller/base-stream-controller.ts"),A=_("./src/types/loader.ts"),k=_("./src/types/level.ts");function C(u,S){for(var f=0;f<S.length;f++){var m=S[f];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(u,m.key,m)}}function E(u,S,f){return S&&C(u.prototype,S),f&&C(u,f),u}function b(u,S){u.prototype=Object.create(S.prototype),u.prototype.constructor=u,d(u,S)}function d(u,S){return d=Object.setPrototypeOf||function(m,w){return m.__proto__=w,m},d(u,S)}var o=500,s=function(u){b(S,u);function S(m,w){var v;return v=u.call(this,m,w,"[subtitle-stream-controller]")||this,v.levels=[],v.currentTrackId=-1,v.tracksBuffered=[],v.mainDetails=null,v._registerListeners(),v}var f=S.prototype;return f.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},f._registerListeners=function(){var w=this.hls;w.on(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),w.on(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this),w.on(G.Events.MANIFEST_LOADING,this.onManifestLoading,this),w.on(G.Events.LEVEL_LOADED,this.onLevelLoaded,this),w.on(G.Events.ERROR,this.onError,this),w.on(G.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),w.on(G.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),w.on(G.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),w.on(G.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),w.on(G.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},f._unregisterListeners=function(){var w=this.hls;w.off(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),w.off(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this),w.off(G.Events.MANIFEST_LOADING,this.onManifestLoading,this),w.off(G.Events.LEVEL_LOADED,this.onLevelLoaded,this),w.off(G.Events.ERROR,this.onError,this),w.off(G.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),w.off(G.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),w.off(G.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),w.off(G.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),w.off(G.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},f.startLoad=function(){this.stopLoad(),this.state=x.State.IDLE,this.setInterval(o),this.tick()},f.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},f.onLevelLoaded=function(w,v){this.mainDetails=v.details},f.onSubtitleFragProcessed=function(w,v){var h=v.frag,c=v.success;if(this.fragPrevious=h,this.state=x.State.IDLE,!c)return;var l=this.tracksBuffered[this.currentTrackId];if(!l)return;for(var a,g=h.start,p=0;p<l.length;p++)if(g>=l[p].start&&g<=l[p].end){a=l[p];break}var y=h.start+h.duration;a?a.end=y:(a={start:g,end:y},l.push(a)),this.fragmentTracker.fragBuffered(h)},f.onBufferFlushing=function(w,v){var h=v.startOffset,c=v.endOffset;if(h===0&&c!==Number.POSITIVE_INFINITY){var l=this.currentTrackId,a=this.levels;if(!a.length||!a[l]||!a[l].details)return;var g=a[l].details,p=g.targetduration,y=c-p;if(y<=0)return;v.endOffsetSubtitles=Math.max(0,y),this.tracksBuffered.forEach(function(M){for(var F=0;F<M.length;){if(M[F].end<=y){M.shift();continue}else if(M[F].start<y)M[F].start=y;else break;F++}}),this.fragmentTracker.removeFragmentsInRange(h,y,A.PlaylistLevelType.SUBTITLE)}},f.onError=function(w,v){var h,c=v.frag;if(!c||c.type!==A.PlaylistLevelType.SUBTITLE)return;(h=this.fragCurrent)!==null&&h!==void 0&&h.loader&&this.fragCurrent.loader.abort(),this.state=x.State.IDLE},f.onSubtitleTracksUpdated=function(w,v){var h=this,c=v.subtitleTracks;this.tracksBuffered=[],this.levels=c.map(function(l){return new k.Level(l)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(l){h.tracksBuffered[l.id]=[]}),this.mediaBuffer=null},f.onSubtitleTrackSwitch=function(w,v){if(this.currentTrackId=v.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var h=this.levels[this.currentTrackId];h!=null&&h.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,h&&this.setInterval(o)},f.onSubtitleTrackLoaded=function(w,v){var h,c=v.details,l=v.id,a=this.currentTrackId,g=this.levels;if(!g.length)return;var p=g[a];if(l>=g.length||l!==a||!p)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,c.live||(h=p.details)!==null&&h!==void 0&&h.live){var y=this.mainDetails;if(c.deltaUpdateFailed||!y)return;var M=y.fragments[0];if(!p.details)c.hasProgramDateTime&&y.hasProgramDateTime?Object(I.alignMediaPlaylistByPDT)(c,y):M&&Object(D.addSliding)(c,M.start);else{var F=this.alignPlaylists(c,p.details);F===0&&M&&Object(D.addSliding)(c,M.start)}}if(p.details=c,this.levelLastLoaded=l,this.tick(),c.live&&!this.fragCurrent&&this.media&&this.state===x.State.IDLE){var j=Object(B.findFragmentByPTS)(null,c.fragments,this.media.currentTime,0);j||(this.warn("Subtitle playlist not aligned with playback"),p.details=void 0)}},f._handleFragmentLoadComplete=function(w){var v=w.frag,h=w.payload,c=v.decryptdata,l=this.hls;if(this.fragContextChanged(v))return;if(h&&h.byteLength>0&&c&&c.key&&c.iv&&c.method==="AES-128"){var a=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(h),c.key.buffer,c.iv.buffer).then(function(g){var p=performance.now();l.trigger(G.Events.FRAG_DECRYPTED,{frag:v,payload:g,stats:{tstart:a,tdecrypt:p}})})}},f.doTick=function(){if(!this.media){this.state=x.State.IDLE;return}if(this.state===x.State.IDLE){var w,v=this.currentTrackId,h=this.levels;if(!h.length||!h[v]||!h[v].details)return;var c=h[v].details,l=c.targetduration,a=this.config,g=this.media,p=R.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,g.currentTime-l,a.maxBufferHole),y=p.end,M=p.len,F=this.getMaxBufferLength()+l;if(M>F)return;console.assert(c,"Subtitle track details are defined on idle subtitle stream controller tick");var j=c.fragments,W=j.length,O=c.edge,P,H=this.fragPrevious;if(y<O){var X=a.maxFragLookUpTolerance;H&&c.hasProgramDateTime&&(P=Object(B.findFragmentByPDT)(j,H.endProgramDateTime,X)),P||(P=Object(B.findFragmentByPTS)(H,j,y,X),!P&&H&&H.start<j[0].start&&(P=j[0]))}else P=j[W-1];(w=P)!==null&&w!==void 0&&w.encrypted?(U.logger.log("Loading key for "+P.sn),this.state=x.State.KEY_LOADING,this.hls.trigger(G.Events.KEY_LOADING,{frag:P})):P&&this.fragmentTracker.getState(P)===L.FragmentState.NOT_LOADED&&this.loadFragment(P,c,y)}},f.loadFragment=function(w,v,h){this.fragCurrent=w,u.prototype.loadFragment.call(this,w,v,h)},E(S,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),S}(x.default)},"./src/controller/subtitle-track-controller.ts":function(ne,V,_){"use strict";_.r(V);var G=_("./src/events.ts"),U=_("./src/utils/texttrack-utils.ts"),R=_("./src/controller/base-playlist-controller.ts"),B=_("./src/types/loader.ts");function I(C,E){for(var b=0;b<E.length;b++){var d=E[b];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(C,d.key,d)}}function D(C,E,b){return E&&I(C.prototype,E),b&&I(C,b),C}function L(C,E){C.prototype=Object.create(E.prototype),C.prototype.constructor=C,x(C,E)}function x(C,E){return x=Object.setPrototypeOf||function(d,o){return d.__proto__=o,d},x(C,E)}var A=function(C){L(E,C);function E(d){var o;return o=C.call(this,d,"[subtitle-track-controller]")||this,o.media=null,o.tracks=[],o.groupId=null,o.tracksInGroup=[],o.trackId=-1,o.selectDefaultTrack=!0,o.queuedDefaultTrack=-1,o.trackChangeListener=function(){return o.onTextTracksChanged()},o.asyncPollTrackChange=function(){return o.pollTrackChange(0)},o.useTextTrackPolling=!1,o.subtitlePollingInterval=-1,o.subtitleDisplay=!0,o.registerListeners(),o}var b=E.prototype;return b.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,C.prototype.destroy.call(this)},b.registerListeners=function(){var o=this.hls;o.on(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(G.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(G.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(G.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(G.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.on(G.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.on(G.Events.ERROR,this.onError,this)},b.unregisterListeners=function(){var o=this.hls;o.off(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(G.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(G.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(G.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(G.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.off(G.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.off(G.Events.ERROR,this.onError,this)},b.onMediaAttached=function(o,s){if(this.media=s.media,!this.media)return;this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange)},b.pollTrackChange=function(o){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,o)},b.onMediaDetaching=function(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId);var o=k(this.media.textTracks);o.forEach(function(s){Object(U.clearCurrentCues)(s)}),this.subtitleTrack=-1,this.media=null},b.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},b.onManifestParsed=function(o,s){this.tracks=s.subtitleTracks},b.onSubtitleTrackLoaded=function(o,s){var u=s.id,S=s.details,f=this.trackId,m=this.tracksInGroup[f];if(!m){this.warn("Invalid subtitle track id "+u);return}var w=m.details;m.details=s.details,this.log("subtitle track "+u+" loaded ["+S.startSN+"-"+S.endSN+"]"),u===this.trackId&&(this.retryCount=0,this.playlistLoaded(u,s,w))},b.onLevelLoading=function(o,s){this.switchLevel(s.level)},b.onLevelSwitching=function(o,s){this.switchLevel(s.level)},b.switchLevel=function(o){var s=this.hls.levels[o];if(!(s!=null&&s.textGroupIds))return;var u=s.textGroupIds[s.urlId];if(this.groupId!==u){var S=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,f=this.tracks.filter(function(v){return!u||v.groupId===u});this.tracksInGroup=f;var m=this.findTrackId(S==null?void 0:S.name)||this.findTrackId();this.groupId=u;var w={subtitleTracks:f};this.log("Updating subtitle tracks, "+f.length+' track(s) found in "'+u+'" group-id'),this.hls.trigger(G.Events.SUBTITLE_TRACKS_UPDATED,w),m!==-1&&this.setSubtitleTrack(m,S)}},b.findTrackId=function(o){for(var s=this.tracksInGroup,u=0;u<s.length;u++){var S=s[u];if((!this.selectDefaultTrack||S.default)&&(!o||o===S.name))return S.id}return-1},b.onError=function(o,s){if(C.prototype.onError.call(this,o,s),s.fatal||!s.context)return;s.context.type===B.PlaylistContextType.SUBTITLE_TRACK&&s.context.id===this.trackId&&s.context.groupId===this.groupId&&this.retryLoadingOrFail(s)},b.loadPlaylist=function(o){var s=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(s)){var u=s.id,S=s.groupId,f=s.url;if(o)try{f=o.addDirectives(f)}catch(m){this.warn("Could not construct new URL with HLS Delivery Directives: "+m)}this.log("Loading subtitle playlist for id "+u),this.hls.trigger(G.Events.SUBTITLE_TRACK_LOADING,{url:f,id:u,groupId:S,deliveryDirectives:o||null})}},b.toggleTrackModes=function(o){var s=this,u=this.media,S=this.subtitleDisplay,f=this.trackId;if(!u)return;var m=k(u.textTracks),w=m.filter(function(c){return c.groupId===s.groupId});if(o===-1)[].slice.call(m).forEach(function(c){c.mode="disabled"});else{var v=w[f];v&&(v.mode="disabled")}var h=w[o];h&&(h.mode=S?"showing":"hidden")},b.setSubtitleTrack=function(o,s){var u,S=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=o;return}if(this.trackId!==o&&this.toggleTrackModes(o),this.trackId===o&&(o===-1||(u=S[o])!==null&&u!==void 0&&u.details)||o<-1||o>=S.length)return;this.clearTimer();var f=S[o];if(this.log("Switching to subtitle track "+o),this.trackId=o,f){var m=f.id,w=f.groupId,v=w===void 0?"":w,h=f.name,c=f.type,l=f.url;this.hls.trigger(G.Events.SUBTITLE_TRACK_SWITCH,{id:m,groupId:v,name:h,type:c,url:l});var a=this.switchParams(f.url,s==null?void 0:s.details);this.loadPlaylist(a)}else this.hls.trigger(G.Events.SUBTITLE_TRACK_SWITCH,{id:o})},b.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var o=-1,s=k(this.media.textTracks),u=0;u<s.length;u++)if(s[u].mode==="hidden")o=u;else if(s[u].mode==="showing"){o=u;break}this.subtitleTrack!==o&&(this.subtitleTrack=o)},D(E,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(o){this.selectDefaultTrack=!1;var s=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(o,s)}}]),E}(R.default);function k(C){for(var E=[],b=0;b<C.length;b++){var d=C[b];d.kind==="subtitles"&&d.label&&E.push(C[b])}return E}V.default=A},"./src/controller/timeline-controller.ts":function(ne,V,_){"use strict";_.r(V),_.d(V,"TimelineController",function(){return k});var G=_("./src/polyfills/number.ts"),U=_("./src/events.ts"),R=_("./src/utils/cea-608-parser.ts"),B=_("./src/utils/output-filter.ts"),I=_("./src/utils/webvtt-parser.ts"),D=_("./src/utils/texttrack-utils.ts"),L=_("./src/utils/imsc1-ttml-parser.ts"),x=_("./src/types/loader.ts"),A=_("./src/utils/logger.ts"),k=function(){function d(s){if(this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.timescale=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=b(),this.captionsProperties=void 0,this.hls=s,this.config=s.config,this.Cues=s.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},this.config.enableCEA708Captions){var u=new B.default(this,"textTrack1"),S=new B.default(this,"textTrack2"),f=new B.default(this,"textTrack3"),m=new B.default(this,"textTrack4");this.cea608Parser1=new R.default(1,u,S),this.cea608Parser2=new R.default(3,f,m)}s.on(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),s.on(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.on(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.on(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),s.on(U.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),s.on(U.Events.FRAG_LOADING,this.onFragLoading,this),s.on(U.Events.FRAG_LOADED,this.onFragLoaded,this),s.on(U.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),s.on(U.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),s.on(U.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),s.on(U.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),s.on(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var o=d.prototype;return o.destroy=function(){var u=this.hls;u.off(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),u.off(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.off(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.off(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),u.off(U.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),u.off(U.Events.FRAG_LOADING,this.onFragLoading,this),u.off(U.Events.FRAG_LOADED,this.onFragLoaded,this),u.off(U.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),u.off(U.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),u.off(U.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),u.off(U.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),u.off(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},o.addCues=function(u,S,f,m,w){for(var v=!1,h=w.length;h--;){var c=w[h],l=E(c[0],c[1],S,f);if(l>=0&&(c[0]=Math.min(c[0],S),c[1]=Math.max(c[1],f),v=!0,l/(f-S)>.5))return}if(v||w.push([S,f]),this.config.renderTextTracksNatively){var a=this.captionsTracks[u];this.Cues.newCue(a,S,f,m)}else{var g=this.Cues.newCue(null,S,f,m);this.hls.trigger(U.Events.CUES_PARSED,{type:"captions",cues:g,track:u})}},o.onInitPtsFound=function(u,S){var f=this,m=S.frag,w=S.id,v=S.initPTS,h=S.timescale,c=this.unparsedVttFrags;w==="main"&&(this.initPTS[m.cc]=v,this.timescale[m.cc]=h),c.length&&(this.unparsedVttFrags=[],c.forEach(function(l){f.onFragLoaded(U.Events.FRAG_LOADED,l)}))},o.getExistingTrack=function(u){var S=this.media;if(S)for(var f=0;f<S.textTracks.length;f++){var m=S.textTracks[f];if(m[u])return m}return null},o.createCaptionsTrack=function(u){this.config.renderTextTracksNatively?this.createNativeTrack(u):this.createNonNativeTrack(u)},o.createNativeTrack=function(u){if(this.captionsTracks[u])return;var S=this.captionsProperties,f=this.captionsTracks,m=this.media,w=S[u],v=w.label,h=w.languageCode,c=this.getExistingTrack(u);if(c)f[u]=c,Object(D.clearCurrentCues)(f[u]),Object(D.sendAddTrackEvent)(f[u],m);else{var l=this.createTextTrack("captions",v,h);l&&(l[u]=!0,f[u]=l)}},o.createNonNativeTrack=function(u){if(this.nonNativeCaptionsTracks[u])return;var S=this.captionsProperties[u];if(!S)return;var f=S.label,m={_id:u,label:f,kind:"captions",default:S.media?!!S.media.default:!1,closedCaptions:S.media};this.nonNativeCaptionsTracks[u]=m,this.hls.trigger(U.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[m]})},o.createTextTrack=function(u,S,f){var m=this.media;return m?m.addTextTrack(u,S,f):void 0},o.onMediaAttaching=function(u,S){this.media=S.media,this._cleanTracks()},o.onMediaDetaching=function(){var u=this.captionsTracks;Object.keys(u).forEach(function(S){Object(D.clearCurrentCues)(u[S]),delete u[S]}),this.nonNativeCaptionsTracks={}},o.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=b(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.timescale=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},o._cleanTracks=function(){var u=this.media;if(!u)return;var S=u.textTracks;if(S)for(var f=0;f<S.length;f++)Object(D.clearCurrentCues)(S[f])},o.onSubtitleTracksUpdated=function(u,S){var f=this;this.textTracks=[];var m=S.subtitleTracks||[],w=m.some(function(l){return l.textCodec===L.IMSC1_CODEC});if(this.config.enableWebVTT||w&&this.config.enableIMSC1){var v=this.tracks&&m&&this.tracks.length===m.length;if(this.tracks=m||[],this.config.renderTextTracksNatively){var h=this.media?this.media.textTracks:[];this.tracks.forEach(function(l,a){var g;if(a<h.length){for(var p=null,y=0;y<h.length;y++)if(C(h[y],l)){p=h[y];break}p&&(g=p)}g?Object(D.clearCurrentCues)(g):(g=f.createTextTrack("subtitles",l.name,l.lang),g&&(g.mode="disabled")),g&&(g.groupId=l.groupId,f.textTracks.push(g))})}else if(!v&&this.tracks&&this.tracks.length){var c=this.tracks.map(function(l){return{label:l.name,kind:l.type.toLowerCase(),default:l.default,subtitleTrack:l}});this.hls.trigger(U.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:c})}}},o.onManifestLoaded=function(u,S){var f=this;this.config.enableCEA708Captions&&S.captions&&S.captions.forEach(function(m){var w=/(?:CC|SERVICE)([1-4])/.exec(m.instreamId);if(!w)return;var v="textTrack"+w[1],h=f.captionsProperties[v];if(!h)return;h.label=m.name,m.lang&&(h.languageCode=m.lang),h.media=m})},o.onFragLoading=function(u,S){var f=this.cea608Parser1,m=this.cea608Parser2,w=this.lastSn,v=this.lastPartIndex;if(!this.enabled||!(f&&m))return;if(S.frag.type===x.PlaylistLevelType.MAIN){var h,c,l=S.frag.sn,a=(h=S==null||((c=S.part)===null||c===void 0)?void 0:c.index)!=null?h:-1;l===w+1||l===w&&a===v+1||(f.reset(),m.reset()),this.lastSn=l,this.lastPartIndex=a}},o.onFragLoaded=function(u,S){var f=S.frag,m=S.payload,w=this.initPTS,v=this.unparsedVttFrags;if(f.type===x.PlaylistLevelType.SUBTITLE)if(m.byteLength){if(!Object(G.isFiniteNumber)(w[f.cc])){v.push(S),w.length&&this.hls.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:f,error:new Error("Missing initial subtitle PTS")});return}var h=f.decryptdata;if(h==null||h.key==null||h.method!=="AES-128"){var c=this.tracks[f.level],l=this.vttCCs;l[f.cc]||(l[f.cc]={start:f.start,prevCC:this.prevCC,new:!0},this.prevCC=f.cc),c&&c.textCodec===L.IMSC1_CODEC?this._parseIMSC1(f,m):this._parseVTTs(f,m,l)}}else this.hls.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:f,error:new Error("Empty subtitle payload")})},o._parseIMSC1=function(u,S){var f=this,m=this.hls;Object(L.parseIMSC1)(S,this.initPTS[u.cc],this.timescale[u.cc],function(w){f._appendCues(w,u.level),m.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:u})},function(w){A.logger.log("Failed to parse IMSC1: "+w),m.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:u,error:w})})},o._parseVTTs=function(u,S,f){var m=this,w=this.hls;Object(I.parseWebVTT)(S,this.initPTS[u.cc],this.timescale[u.cc],f,u.cc,u.start,function(v){m._appendCues(v,u.level),w.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:u})},function(v){m._fallbackToIMSC1(u,S),A.logger.log("Failed to parse VTT cue: "+v),w.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:u,error:v})})},o._fallbackToIMSC1=function(u,S){var f=this,m=this.tracks[u.level];m.textCodec||Object(L.parseIMSC1)(S,this.initPTS[u.cc],this.timescale[u.cc],function(){m.textCodec=L.IMSC1_CODEC,f._parseIMSC1(u,S)},function(){m.textCodec="wvtt"})},o._appendCues=function(u,S){var f=this.hls;if(this.config.renderTextTracksNatively){var m=this.textTracks[S];if(m.mode==="disabled")return;u.forEach(function(h){return Object(D.addCueToTrack)(m,h)})}else{var w=this.tracks[S],v=w.default?"default":"subtitles"+S;f.trigger(U.Events.CUES_PARSED,{type:"subtitles",cues:u,track:v})}},o.onFragDecrypted=function(u,S){var f=S.frag;if(f.type===x.PlaylistLevelType.SUBTITLE){if(!Object(G.isFiniteNumber)(this.initPTS[f.cc])){this.unparsedVttFrags.push(S);return}this.onFragLoaded(U.Events.FRAG_LOADED,S)}},o.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},o.onFragParsingUserdata=function(u,S){var f=this.cea608Parser1,m=this.cea608Parser2;if(!this.enabled||!(f&&m))return;for(var w=0;w<S.samples.length;w++){var v=S.samples[w].bytes;if(v){var h=this.extractCea608Data(v);f.addData(S.samples[w].pts,h[0]),m.addData(S.samples[w].pts,h[1])}}},o.onBufferFlushing=function(u,S){var f=S.startOffset,m=S.endOffset,w=S.endOffsetSubtitles,v=S.type,h=this.media;if(!h||h.currentTime<m)return;if(!v||v==="video"){var c=this.captionsTracks;Object.keys(c).forEach(function(a){return Object(D.removeCuesInRange)(c[a],f,m)})}if(this.config.renderTextTracksNatively&&(f===0&&w!==void 0)){var l=this.textTracks;Object.keys(l).forEach(function(a){return Object(D.removeCuesInRange)(l[a],f,w)})}},o.extractCea608Data=function(u){for(var S=u[0]&31,f=2,m=[[],[]],w=0;w<S;w++){var v=u[f++],h=127&u[f++],c=127&u[f++],l=(4&v)!==0,a=3&v;if(h===0&&c===0)continue;l&&((a===0||a===1)&&(m[a].push(h),m[a].push(c)))}return m},d}();function C(d,o){return d&&d.label===o.name&&!(d.textTrack1||d.textTrack2)}function E(d,o,s,u){return Math.min(o,u)-Math.max(d,s)}function b(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(ne,V,_){"use strict";_.r(V),_.d(V,"default",function(){return G});var G=function(){function U(B,I){this.subtle=void 0,this.aesIV=void 0,this.subtle=B,this.aesIV=I}var R=U.prototype;return R.decrypt=function(I,D){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},D,I)},U}()},"./src/crypt/aes-decryptor.ts":function(ne,V,_){"use strict";_.r(V),_.d(V,"removePadding",function(){return U}),_.d(V,"default",function(){return R});var G=_("./src/utils/typed-array.ts");function U(B){var I=B.byteLength,D=I&&new DataView(B.buffer).getUint8(I-1);return D?Object(G.sliceUint8)(B,0,I-D):B}var R=function(){function B(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}var I=B.prototype;return I.uint8ArrayToUint32Array_=function(L){for(var x=new DataView(L),A=new Uint32Array(4),k=0;k<4;k++)A[k]=x.getUint32(k*4);return A},I.initTable=function(){var L=this.sBox,x=this.invSBox,A=this.subMix,k=A[0],C=A[1],E=A[2],b=A[3],d=this.invSubMix,o=d[0],s=d[1],u=d[2],S=d[3],f=new Uint32Array(256),m=0,w=0,v=0;for(v=0;v<256;v++)v<128?f[v]=v<<1:f[v]=v<<1^283;for(v=0;v<256;v++){var h=w^w<<1^w<<2^w<<3^w<<4;h=h>>>8^h&255^99,L[m]=h,x[h]=m;var c=f[m],l=f[c],a=f[l],g=f[h]*257^h*16843008;k[m]=g<<24|g>>>8,C[m]=g<<16|g>>>16,E[m]=g<<8|g>>>24,b[m]=g,g=a*16843009^l*65537^c*257^m*16843008,o[h]=g<<24|g>>>8,s[h]=g<<16|g>>>16,u[h]=g<<8|g>>>24,S[h]=g,m?(m=c^f[f[f[a^c]]],w^=f[f[w]]):m=w=1}},I.expandKey=function(L){for(var x=this.uint8ArrayToUint32Array_(L),A=!0,k=0;k<x.length&&A;)A=x[k]===this.key[k],k++;if(A)return;this.key=x;var C=this.keySize=x.length;if(C!==4&&C!==6&&C!==8)throw new Error("Invalid aes key size="+C);var E=this.ksRows=(C+6+1)*4,b,d,o=this.keySchedule=new Uint32Array(E),s=this.invKeySchedule=new Uint32Array(E),u=this.sBox,S=this.rcon,f=this.invSubMix,m=f[0],w=f[1],v=f[2],h=f[3],c,l;for(b=0;b<E;b++){if(b<C){c=o[b]=x[b];continue}l=c,b%C===0?(l=l<<8|l>>>24,l=u[l>>>24]<<24|u[l>>>16&255]<<16|u[l>>>8&255]<<8|u[l&255],l^=S[b/C|0]<<24):C>6&&b%C===4&&(l=u[l>>>24]<<24|u[l>>>16&255]<<16|u[l>>>8&255]<<8|u[l&255]),o[b]=c=(o[b-C]^l)>>>0}for(d=0;d<E;d++)b=E-d,d&3?l=o[b]:l=o[b-4],d<4||b<=4?s[d]=l:s[d]=m[u[l>>>24]]^w[u[l>>>16&255]]^v[u[l>>>8&255]]^h[u[l&255]],s[d]=s[d]>>>0},I.networkToHostOrderSwap=function(L){return L<<24|(L&65280)<<8|(L&16711680)>>8|L>>>24},I.decrypt=function(L,x,A){for(var k=this.keySize+6,C=this.invKeySchedule,E=this.invSBox,b=this.invSubMix,d=b[0],o=b[1],s=b[2],u=b[3],S=this.uint8ArrayToUint32Array_(A),f=S[0],m=S[1],w=S[2],v=S[3],h=new Int32Array(L),c=new Int32Array(h.length),l,a,g,p,y,M,F,j,W,O,P,H,X,q,re=this.networkToHostOrderSwap;x<h.length;){for(W=re(h[x]),O=re(h[x+1]),P=re(h[x+2]),H=re(h[x+3]),y=W^C[0],M=H^C[1],F=P^C[2],j=O^C[3],X=4,q=1;q<k;q++)l=d[y>>>24]^o[M>>16&255]^s[F>>8&255]^u[j&255]^C[X],a=d[M>>>24]^o[F>>16&255]^s[j>>8&255]^u[y&255]^C[X+1],g=d[F>>>24]^o[j>>16&255]^s[y>>8&255]^u[M&255]^C[X+2],p=d[j>>>24]^o[y>>16&255]^s[M>>8&255]^u[F&255]^C[X+3],y=l,M=a,F=g,j=p,X=X+4;l=E[y>>>24]<<24^E[M>>16&255]<<16^E[F>>8&255]<<8^E[j&255]^C[X],a=E[M>>>24]<<24^E[F>>16&255]<<16^E[j>>8&255]<<8^E[y&255]^C[X+1],g=E[F>>>24]<<24^E[j>>16&255]<<16^E[y>>8&255]<<8^E[M&255]^C[X+2],p=E[j>>>24]<<24^E[y>>16&255]<<16^E[M>>8&255]<<8^E[F&255]^C[X+3],c[x]=re(l^f),c[x+1]=re(p^m),c[x+2]=re(g^w),c[x+3]=re(a^v),f=W,m=O,w=P,v=H,x=x+4}return c.buffer},B}()},"./src/crypt/decrypter.ts":function(ne,V,_){"use strict";_.r(V),_.d(V,"default",function(){return x});var G=_("./src/crypt/aes-crypto.ts"),U=_("./src/crypt/fast-aes-key.ts"),R=_("./src/crypt/aes-decryptor.ts"),B=_("./src/utils/logger.ts"),I=_("./src/utils/mp4-tools.ts"),D=_("./src/utils/typed-array.ts"),L=16,x=function(){function A(C,E,b){var d=b===void 0?{}:b,o=d.removePKCS7Padding,s=o===void 0?!0:o;if(this.logEnabled=!0,this.observer=void 0,this.config=void 0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.observer=C,this.config=E,this.removePKCS7Padding=s,s)try{var u=self.crypto;u&&(this.subtle=u.subtle||u.webkitSubtle)}catch(S){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var k=A.prototype;return k.destroy=function(){this.observer=null},k.isSync=function(){return this.config.enableSoftwareAES},k.flush=function(){var E=this.currentResult;if(!E){this.reset();return}var b=new Uint8Array(E);return this.reset(),this.removePKCS7Padding?Object(R.removePadding)(b):b},k.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},k.decrypt=function(E,b,d,o){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(E),b,d);var s=this.flush();s&&o(s.buffer)}else this.webCryptoDecrypt(new Uint8Array(E),b,d).then(o)},k.softwareDecrypt=function(E,b,d){var o=this.currentIV,s=this.currentResult,u=this.remainderData;this.logOnce("JS AES decrypt"),u&&(E=Object(I.appendUint8Array)(u,E),this.remainderData=null);var S=this.getValidChunk(E);if(!S.length)return null;o&&(d=o);var f=this.softwareDecrypter;f||(f=this.softwareDecrypter=new R.default),f.expandKey(b);var m=s;return this.currentResult=f.decrypt(S.buffer,0,d),this.currentIV=Object(D.sliceUint8)(S,-16).buffer,m||null},k.webCryptoDecrypt=function(E,b,d){var o=this,s=this.subtle;return(this.key!==b||!this.fastAesKey)&&(this.key=b,this.fastAesKey=new U.default(s,b)),this.fastAesKey.expandKey().then(function(u){if(!s)return Promise.reject(new Error("web crypto not initialized"));var S=new G.default(s,d);return S.decrypt(E.buffer,u)}).catch(function(u){return o.onWebCryptoError(u,E,b,d)})},k.onWebCryptoError=function(E,b,d,o){return B.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",E),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(b,d,o)},k.getValidChunk=function(E){var b=E,d=E.length-E.length%L;return d!==E.length&&(b=Object(D.sliceUint8)(E,0,d),this.remainderData=Object(D.sliceUint8)(E,d)),b},k.logOnce=function(E){if(!this.logEnabled)return;B.logger.log("[decrypter.ts]: "+E),this.logEnabled=!1},A}()},"./src/crypt/fast-aes-key.ts":function(ne,V,_){"use strict";_.r(V),_.d(V,"default",function(){return G});var G=function(){function U(B,I){this.subtle=void 0,this.key=void 0,this.subtle=B,this.key=I}var R=U.prototype;return R.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},U}()},"./src/demux/aacdemuxer.ts":function(ne,V,_){"use strict";_.r(V);var G=_("./src/demux/base-audio-demuxer.ts"),U=_("./src/demux/adts.ts"),R=_("./src/utils/logger.ts"),B=_("./src/demux/id3.ts");function I(x,A){x.prototype=Object.create(A.prototype),x.prototype.constructor=x,D(x,A)}function D(x,A){return D=Object.setPrototypeOf||function(C,E){return C.__proto__=E,C},D(x,A)}var L=function(x){I(A,x);function A(C,E){var b;return b=x.call(this)||this,b.observer=void 0,b.config=void 0,b.observer=C,b.config=E,b}var k=A.prototype;return k.resetInitSegment=function(E,b,d){x.prototype.resetInitSegment.call(this,E,b,d),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:E,duration:d,inputTimeScale:9e4,dropped:0}},A.probe=function(E){if(!E)return!1;for(var b=B.getID3Data(E,0)||[],d=b.length,o=E.length;d<o;d++)if(U.probe(E,d))return R.logger.log("ADTS sync word found !"),!0;return!1},k.canParse=function(E,b){return U.canParse(E,b)},k.appendFrame=function(E,b,d){U.initTrackConfig(E,this.observer,b,d,E.manifestCodec);var o=U.appendFrame(E,b,d,this.initPTS,this.frameIndex);if(o&&o.missing===0)return o},A}(G.default);L.minProbeByteLength=9,V.default=L},"./src/demux/adts.ts":function(ne,V,_){"use strict";_.r(V),_.d(V,"getAudioConfig",function(){return B}),_.d(V,"isHeaderPattern",function(){return I}),_.d(V,"getHeaderLength",function(){return D}),_.d(V,"getFullFrameLength",function(){return L}),_.d(V,"canGetFrameLength",function(){return x}),_.d(V,"isHeader",function(){return A}),_.d(V,"canParse",function(){return k}),_.d(V,"probe",function(){return C}),_.d(V,"initTrackConfig",function(){return E}),_.d(V,"getFrameDuration",function(){return b}),_.d(V,"parseFrameHeader",function(){return d}),_.d(V,"appendFrame",function(){return o});var G=_("./src/utils/logger.ts"),U=_("./src/errors.ts"),R=_("./src/events.ts");function B(s,u,S,f){var m,w,v,h,c=navigator.userAgent.toLowerCase(),l=f,a=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];m=((u[S+2]&192)>>>6)+1;var g=(u[S+2]&60)>>>2;if(g>a.length-1){s.trigger(R.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+g});return}return v=(u[S+2]&1)<<2,v|=(u[S+3]&192)>>>6,G.logger.log("manifest codec:"+f+", ADTS type:"+m+", samplingIndex:"+g),/firefox/i.test(c)?g>=6?(m=5,h=new Array(4),w=g-3):(m=2,h=new Array(2),w=g):c.indexOf("android")!==-1?(m=2,h=new Array(2),w=g):(m=5,h=new Array(4),f&&(f.indexOf("mp4a.40.29")!==-1||f.indexOf("mp4a.40.5")!==-1)||!f&&g>=6?w=g-3:((f&&f.indexOf("mp4a.40.2")!==-1&&(g>=6&&v===1||/vivaldi/i.test(c))||!f&&v===1)&&(m=2,h=new Array(2)),w=g)),h[0]=m<<3,h[0]|=(g&14)>>1,h[1]|=(g&1)<<7,h[1]|=v<<3,m===5&&(h[1]|=(w&14)>>1,h[2]=(w&1)<<7,h[2]|=2<<2,h[3]=0),{config:h,samplerate:a[g],channelCount:v,codec:"mp4a.40."+m,manifestCodec:l}}function I(s,u){return s[u]===255&&(s[u+1]&246)===240}function D(s,u){return s[u+1]&1?7:9}function L(s,u){return(s[u+3]&3)<<11|s[u+4]<<3|(s[u+5]&224)>>>5}function x(s,u){return u+5<s.length}function A(s,u){return u+1<s.length&&I(s,u)}function k(s,u){return x(s,u)&&I(s,u)&&L(s,u)<=s.length-u}function C(s,u){if(A(s,u)){var S=D(s,u);if(u+S>=s.length)return!1;var f=L(s,u);if(f<=S)return!1;var m=u+f;return m===s.length||A(s,m)}return!1}function E(s,u,S,f,m){if(!s.samplerate){var w=B(u,S,f,m);if(!w)return;s.config=w.config,s.samplerate=w.samplerate,s.channelCount=w.channelCount,s.codec=w.codec,s.manifestCodec=w.manifestCodec,G.logger.log("parsed codec:"+s.codec+", rate:"+w.samplerate+", channels:"+w.channelCount)}}function b(s){return 1024*9e4/s}function d(s,u,S,f,m){var w=D(s,u),v=L(s,u);if(v-=w,v>0){var h=S+f*m;return{headerLength:w,frameLength:v,stamp:h}}}function o(s,u,S,f,m){var w=b(s.samplerate),v=d(u,S,f,m,w);if(v){var h=v.frameLength,c=v.headerLength,l=v.stamp,a=c+h,g=Math.max(0,S+a-u.length),p;g?(p=new Uint8Array(a-c),p.set(u.subarray(S+c,u.length),0)):p=u.subarray(S+c,S+a);var y={unit:p,pts:l};return g||s.samples.push(y),{sample:y,length:a,missing:g}}}},"./src/demux/base-audio-demuxer.ts":function(ne,V,_){"use strict";_.r(V),_.d(V,"initPTSFn",function(){return L});var G=_("./src/polyfills/number.ts"),U=_("./src/demux/id3.ts"),R=_("./src/demux/dummy-demuxed-track.ts"),B=_("./src/utils/mp4-tools.ts"),I=_("./src/utils/typed-array.ts"),D=function(){function x(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var A=x.prototype;return A.resetInitSegment=function(C,E,b){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},A.resetTimeStamp=function(){},A.resetContiguity=function(){},A.canParse=function(C,E){return!1},A.appendFrame=function(C,E,b){},A.demux=function(C,E){this.cachedData&&(C=Object(B.appendUint8Array)(this.cachedData,C),this.cachedData=null);var b=U.getID3Data(C,0),d=b?b.length:0,o,s,u=this._audioTrack,S=this._id3Track,f=b?U.getTimeStamp(b):void 0,m=C.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=L(f,E)),b&&b.length>0&&S.samples.push({pts:this.initPTS,dts:this.initPTS,data:b}),s=this.initPTS;d<m;){if(this.canParse(C,d)){var w=this.appendFrame(u,C,d);w?(this.frameIndex++,s=w.sample.pts,d+=w.length,o=d):d=m}else U.canParse(C,d)?(b=U.getID3Data(C,d),S.samples.push({pts:s,dts:s,data:b}),d+=b.length,o=d):d++;if(d===m&&o!==m){var v=Object(I.sliceUint8)(C,o);this.cachedData?this.cachedData=Object(B.appendUint8Array)(this.cachedData,v):this.cachedData=v}}return{audioTrack:u,avcTrack:Object(R.dummyTrack)(),id3Track:S,textTrack:Object(R.dummyTrack)()}},A.demuxSampleAes=function(C,E,b){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},A.flush=function(C){var E=this.cachedData;return E&&(this.cachedData=null,this.demux(E,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(R.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(R.dummyTrack)()}},A.destroy=function(){},x}(),L=function(A,k){return Object(G.isFiniteNumber)(A)?A*90:k*9e4};V.default=D},"./src/demux/chunk-cache.ts":function(ne,V,_){"use strict";_.r(V),_.d(V,"default",function(){return G});var G=function(){function R(){this.chunks=[],this.dataLength=0}var B=R.prototype;return B.push=function(D){this.chunks.push(D),this.dataLength+=D.length},B.flush=function(){var D=this.chunks,L=this.dataLength,x;if(D.length)D.length===1?x=D[0]:x=U(D,L);else return new Uint8Array(0);return this.reset(),x},B.reset=function(){this.chunks.length=0,this.dataLength=0},R}();function U(R,B){for(var I=new Uint8Array(B),D=0,L=0;L<R.length;L++){var x=R[L];I.set(x,D),D+=x.length}return I}},"./src/demux/dummy-demuxed-track.ts":function(ne,V,_){"use strict";_.r(V),_.d(V,"dummyTrack",function(){return G});function G(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(ne,V,_){"use strict";_.r(V);var G=_("./src/utils/logger.ts"),U=function(){function R(I){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=I,this.bytesAvailable=I.byteLength,this.word=0,this.bitsAvailable=0}var B=R.prototype;return B.loadWord=function(){var D=this.data,L=this.bytesAvailable,x=D.byteLength-L,A=new Uint8Array(4),k=Math.min(4,L);if(k===0)throw new Error("no bytes available");A.set(D.subarray(x,x+k)),this.word=new DataView(A.buffer).getUint32(0),this.bitsAvailable=k*8,this.bytesAvailable-=k},B.skipBits=function(D){var L;this.bitsAvailable>D?(this.word<<=D,this.bitsAvailable-=D):(D-=this.bitsAvailable,L=D>>3,D-=L>>3,this.bytesAvailable-=L,this.loadWord(),this.word<<=D,this.bitsAvailable-=D)},B.readBits=function(D){var L=Math.min(this.bitsAvailable,D),x=this.word>>>32-L;return D>32&&G.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=L,this.bitsAvailable>0?this.word<<=L:this.bytesAvailable>0&&this.loadWord(),L=D-L,L>0&&this.bitsAvailable?x<<L|this.readBits(L):x},B.skipLZ=function(){var D;for(D=0;D<this.bitsAvailable;++D)if((this.word&2147483648>>>D)!==0)return this.word<<=D,this.bitsAvailable-=D,D;return this.loadWord(),D+this.skipLZ()},B.skipUEG=function(){this.skipBits(1+this.skipLZ())},B.skipEG=function(){this.skipBits(1+this.skipLZ())},B.readUEG=function(){var D=this.skipLZ();return this.readBits(D+1)-1},B.readEG=function(){var D=this.readUEG();return 1&D?1+D>>>1:-1*(D>>>1)},B.readBoolean=function(){return this.readBits(1)===1},B.readUByte=function(){return this.readBits(8)},B.readUShort=function(){return this.readBits(16)},B.readUInt=function(){return this.readBits(32)},B.skipScalingList=function(D){for(var L=8,x=8,A,k=0;k<D;k++)x!==0&&(A=this.readEG(),x=(L+A+256)%256),L=x===0?L:x},B.readSPS=function(){var D=0,L=0,x=0,A=0,k,C,E,b=this.readUByte.bind(this),d=this.readBits.bind(this),o=this.readUEG.bind(this),s=this.readBoolean.bind(this),u=this.skipBits.bind(this),S=this.skipEG.bind(this),f=this.skipUEG.bind(this),m=this.skipScalingList.bind(this);b();var w=b();if(d(5),u(3),b(),f(),w===100||w===110||w===122||w===244||w===44||w===83||w===86||w===118||w===128){var v=o();if(v===3&&u(1),f(),f(),u(1),s())for(C=v!==3?8:12,E=0;E<C;E++)s()&&(E<6?m(16):m(64))}f();var h=o();if(h===0)o();else if(h===1)for(u(1),S(),S(),k=o(),E=0;E<k;E++)S();f(),u(1);var c=o(),l=o(),a=d(1);a===0&&u(1),u(1),s()&&(D=o(),L=o(),x=o(),A=o());var g=[1,1];if(s()&&s()){var p=b();switch(p){case 1:g=[1,1];break;case 2:g=[12,11];break;case 3:g=[10,11];break;case 4:g=[16,11];break;case 5:g=[40,33];break;case 6:g=[24,11];break;case 7:g=[20,11];break;case 8:g=[32,11];break;case 9:g=[80,33];break;case 10:g=[18,11];break;case 11:g=[15,11];break;case 12:g=[64,33];break;case 13:g=[160,99];break;case 14:g=[4,3];break;case 15:g=[3,2];break;case 16:g=[2,1];break;case 255:{g=[b()<<8|b(),b()<<8|b()];break}}}return{width:Math.ceil((c+1)*16-D*2-L*2),height:(2-a)*(l+1)*16-(a?2:4)*(x+A),pixelRatio:g}},B.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},R}();V.default=U},"./src/demux/id3.ts":function(ne,V,_){"use strict";_.r(V),_.d(V,"isHeader",function(){return G}),_.d(V,"isFooter",function(){return U}),_.d(V,"getID3Data",function(){return R}),_.d(V,"canParse",function(){return I}),_.d(V,"getTimeStamp",function(){return D}),_.d(V,"isTimeStampFrame",function(){return L}),_.d(V,"getID3Frames",function(){return A}),_.d(V,"decodeFrame",function(){return k}),_.d(V,"utf8ArrayToStr",function(){return o}),_.d(V,"testables",function(){return s});var G=function(m,w){return w+10<=m.length&&(m[w]===73&&m[w+1]===68&&m[w+2]===51&&(m[w+3]<255&&m[w+4]<255&&(m[w+6]<128&&m[w+7]<128&&m[w+8]<128&&m[w+9]<128)))},U=function(m,w){return w+10<=m.length&&(m[w]===51&&m[w+1]===68&&m[w+2]===73&&(m[w+3]<255&&m[w+4]<255&&(m[w+6]<128&&m[w+7]<128&&m[w+8]<128&&m[w+9]<128)))},R=function(m,w){for(var v=w,h=0;G(m,w);){h+=10;var c=B(m,w+6);h+=c,U(m,w+10)&&(h+=10),w+=h}return h>0?m.subarray(v,v+h):void 0},B=function(m,w){var v=0;return v=(m[w]&127)<<21,v|=(m[w+1]&127)<<14,v|=(m[w+2]&127)<<7,v|=m[w+3]&127,v},I=function(m,w){return G(m,w)&&B(m,w+6)+10<=m.length-w},D=function(m){for(var w=A(m),v=0;v<w.length;v++){var h=w[v];if(L(h))return d(h)}return},L=function(m){return m&&m.key==="PRIV"&&m.info==="com.apple.streaming.transportStreamTimestamp"},x=function(m){var w=String.fromCharCode(m[0],m[1],m[2],m[3]),v=B(m,4),h=10;return{type:w,size:v,data:m.subarray(h,h+v)}},A=function(m){for(var w=0,v=[];G(m,w);){var h=B(m,w+6);w+=10;for(var c=w+h;w+8<c;){var l=x(m.subarray(w)),a=k(l);a&&v.push(a),w+=l.size+10}U(m,w)&&(w+=10)}return v},k=function(m){return m.type==="PRIV"?C(m):m.type[0]==="W"?b(m):E(m)},C=function(m){if(m.size<2)return;var w=o(m.data,!0),v=new Uint8Array(m.data.subarray(w.length+1));return{key:m.type,info:w,data:v.buffer}},E=function(m){if(m.size<2)return;if(m.type==="TXXX"){var w=1,v=o(m.data.subarray(w),!0);w+=v.length+1;var h=o(m.data.subarray(w));return{key:m.type,info:v,data:h}}var c=o(m.data.subarray(1));return{key:m.type,data:c}},b=function(m){if(m.type==="WXXX"){if(m.size<2)return;var w=1,v=o(m.data.subarray(w),!0);w+=v.length+1;var h=o(m.data.subarray(w));return{key:m.type,info:v,data:h}}var c=o(m.data);return{key:m.type,data:c}},d=function(m){if(m.data.byteLength===8){var w=new Uint8Array(m.data),v=w[3]&1,h=(w[4]<<23)+(w[5]<<15)+(w[6]<<7)+w[7];return h/=45,v&&(h+=4772185884e-2),Math.round(h)}return},o=function(m,w){w===void 0&&(w=!1);var v=S();if(v){var h=v.decode(m);if(w){var c=h.indexOf("\0");return c!==-1?h.substring(0,c):h}return h.replace(/\0/g,"")}for(var l=m.length,a,g,p,y="",M=0;M<l;){if(a=m[M++],a===0&&w)return y;if(a===0||a===3)continue;switch(a>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:y+=String.fromCharCode(a);break;case 12:case 13:g=m[M++],y+=String.fromCharCode((a&31)<<6|g&63);break;case 14:g=m[M++],p=m[M++],y+=String.fromCharCode((a&15)<<12|(g&63)<<6|(p&63)<<0);break;default:}}return y},s={decodeTextFrame:E},u;function S(){return!u&&typeof self.TextDecoder!="undefined"&&(u=new self.TextDecoder("utf-8")),u}},"./src/demux/mp3demuxer.ts":function(ne,V,_){"use strict";_.r(V);var G=_("./src/demux/base-audio-demuxer.ts"),U=_("./src/demux/id3.ts"),R=_("./src/utils/logger.ts"),B=_("./src/demux/mpegaudio.ts");function I(x,A){x.prototype=Object.create(A.prototype),x.prototype.constructor=x,D(x,A)}function D(x,A){return D=Object.setPrototypeOf||function(C,E){return C.__proto__=E,C},D(x,A)}var L=function(x){I(A,x);function A(){return x.apply(this,arguments)||this}var k=A.prototype;return k.resetInitSegment=function(E,b,d){x.prototype.resetInitSegment.call(this,E,b,d),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:E,duration:d,inputTimeScale:9e4,dropped:0}},A.probe=function(E){if(!E)return!1;for(var b=U.getID3Data(E,0)||[],d=b.length,o=E.length;d<o;d++)if(B.probe(E,d))return R.logger.log("MPEG Audio sync word found !"),!0;return!1},k.canParse=function(E,b){return B.canParse(E,b)},k.appendFrame=function(E,b,d){return this.initPTS===null?void 0:B.appendFrame(E,b,d,this.initPTS,this.frameIndex)},A}(G.default);L.minProbeByteLength=4,V.default=L},"./src/demux/mp4demuxer.ts":function(ne,V,_){"use strict";_.r(V);var G=_("./src/utils/mp4-tools.ts"),U=_("./src/demux/dummy-demuxed-track.ts"),R=function(){function B(D,L){this.remainderData=null,this.config=void 0,this.config=L}var I=B.prototype;return I.resetTimeStamp=function(){},I.resetInitSegment=function(){},I.resetContiguity=function(){},B.probe=function(L){return Object(G.findBox)({data:L,start:0,end:Math.min(L.length,16384)},["moof"]).length>0},I.demux=function(L){var x=L,A=Object(U.dummyTrack)();if(this.config.progressive){this.remainderData&&(x=Object(G.appendUint8Array)(this.remainderData,L));var k=Object(G.segmentValidRange)(x);this.remainderData=k.remainder,A.samples=k.valid||new Uint8Array}else A.samples=x;return{audioTrack:Object(U.dummyTrack)(),avcTrack:A,id3Track:Object(U.dummyTrack)(),textTrack:Object(U.dummyTrack)()}},I.flush=function(){var L=Object(U.dummyTrack)();return L.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(U.dummyTrack)(),avcTrack:L,id3Track:Object(U.dummyTrack)(),textTrack:Object(U.dummyTrack)()}},I.demuxSampleAes=function(L,x,A){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},I.destroy=function(){},B}();R.minProbeByteLength=1024,V.default=R},"./src/demux/mpegaudio.ts":function(ne,V,_){"use strict";_.r(V),_.d(V,"appendFrame",function(){return D}),_.d(V,"parseHeader",function(){return L}),_.d(V,"isHeaderPattern",function(){return x}),_.d(V,"isHeader",function(){return A}),_.d(V,"canParse",function(){return k}),_.d(V,"probe",function(){return C});var G=null,U=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],R=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],B=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],I=[0,1,1,4];function D(E,b,d,o,s){if(d+24>b.length)return;var u=L(b,d);if(u&&d+u.frameLength<=b.length){var S=u.samplesPerFrame*9e4/u.sampleRate,f=o+s*S,m={unit:b.subarray(d,d+u.frameLength),pts:f,dts:f};return E.config=[],E.channelCount=u.channelCount,E.samplerate=u.sampleRate,E.samples.push(m),{sample:m,length:u.frameLength,missing:0}}}function L(E,b){var d=E[b+1]>>3&3,o=E[b+1]>>1&3,s=E[b+2]>>4&15,u=E[b+2]>>2&3;if(d!==1&&s!==0&&s!==15&&u!==3){var S=E[b+2]>>1&1,f=E[b+3]>>6,m=d===3?3-o:o===3?3:4,w=U[m*14+s-1]*1e3,v=d===3?0:d===2?1:2,h=R[v*3+u],c=f===3?1:2,l=B[d][o],a=I[o],g=l*8*a,p=Math.floor(l*w/h+S)*a;if(G===null){var y=navigator.userAgent||"",M=y.match(/Chrome\/(\d+)/i);G=M?parseInt(M[1]):0}var F=!!G&&G<=87;return F&&o===2&&w>=224e3&&f===0&&(E[b+3]=E[b+3]|128),{sampleRate:h,channelCount:c,frameLength:p,samplesPerFrame:g}}}function x(E,b){return E[b]===255&&(E[b+1]&224)===224&&(E[b+1]&6)!==0}function A(E,b){return b+1<E.length&&x(E,b)}function k(E,b){var d=4;return x(E,b)&&d<=E.length-b}function C(E,b){if(b+1<E.length&&x(E,b)){var d=4,o=L(E,b),s=d;o!=null&&o.frameLength&&(s=o.frameLength);var u=b+s;return u===E.length||A(E,u)}return!1}},"./src/demux/sample-aes.ts":function(ne,V,_){"use strict";_.r(V);var G=_("./src/crypt/decrypter.ts"),U=_("./src/demux/tsdemuxer.ts"),R=function(){function B(D,L,x){this.keyData=void 0,this.decrypter=void 0,this.keyData=x,this.decrypter=new G.default(D,L,{removePKCS7Padding:!1})}var I=B.prototype;return I.decryptBuffer=function(L,x){this.decrypter.decrypt(L,this.keyData.key.buffer,this.keyData.iv.buffer,x)},I.decryptAacSample=function(L,x,A,k){var C=L[x].unit,E=C.subarray(16,C.length-C.length%16),b=E.buffer.slice(E.byteOffset,E.byteOffset+E.length),d=this;this.decryptBuffer(b,function(o){var s=new Uint8Array(o);C.set(s,16),k||d.decryptAacSamples(L,x+1,A)})},I.decryptAacSamples=function(L,x,A){for(;;x++){if(x>=L.length){A();return}if(L[x].unit.length<32)continue;var k=this.decrypter.isSync();if(this.decryptAacSample(L,x,A,k),!k)return}},I.getAvcEncryptedData=function(L){for(var x=Math.floor((L.length-48)/160)*16+16,A=new Int8Array(x),k=0,C=32;C<=L.length-16;C+=160,k+=16)A.set(L.subarray(C,C+16),k);return A},I.getAvcDecryptedUnit=function(L,x){for(var A=new Uint8Array(x),k=0,C=32;C<=L.length-16;C+=160,k+=16)L.set(A.subarray(k,k+16),C);return L},I.decryptAvcSample=function(L,x,A,k,C,E){var b=Object(U.discardEPB)(C.data),d=this.getAvcEncryptedData(b),o=this;this.decryptBuffer(d.buffer,function(s){C.data=o.getAvcDecryptedUnit(b,s),E||o.decryptAvcSamples(L,x,A+1,k)})},I.decryptAvcSamples=function(L,x,A,k){if(L instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;x++,A=0){if(x>=L.length){k();return}for(var C=L[x].units;!(A>=C.length);A++){var E=C[A];if(E.data.length<=48||E.type!==1&&E.type!==5)continue;var b=this.decrypter.isSync();if(this.decryptAvcSample(L,x,A,k,E,b),!b)return}}},B}();V.default=R},"./src/demux/transmuxer-interface.ts":function(ne,V,_){"use strict";_.r(V),_.d(V,"default",function(){return C});var G=_("./node_modules/webworkify-webpack/index.js"),U=_.n(G),R=_("./src/events.ts"),B=_("./src/demux/transmuxer.ts"),I=_("./src/utils/logger.ts"),D=_("./src/errors.ts"),L=_("./src/utils/mediasource-helper.ts"),x=_("./node_modules/eventemitter3/index.js"),A=_.n(x),k=Object(L.getMediaSource)()||{isTypeSupported:function(){return!1}},C=function(){function E(d,o,s,u){var S=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=d,this.id=o,this.onTransmuxComplete=s,this.onFlush=u;var f=d.config,m=function(l,a){a=a||{},a.frag=S.frag,a.id=S.id,d.trigger(l,a)};this.observer=new x.EventEmitter,this.observer.on(R.Events.FRAG_DECRYPTED,m),this.observer.on(R.Events.ERROR,m);var w={mp4:k.isTypeSupported("video/mp4"),mpeg:k.isTypeSupported("audio/mpeg"),mp3:k.isTypeSupported('audio/mp4; codecs="mp3"')},v=navigator.vendor;if(f.enableWorker&&typeof Worker!="undefined"){I.logger.log("demuxing in webworker");var h;try{h=this.worker=G("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),h.addEventListener("message",this.onwmsg),h.onerror=function(c){d.trigger(R.Events.ERROR,{type:D.ErrorTypes.OTHER_ERROR,details:D.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(c.message+" ("+c.filename+":"+c.lineno+")")})},h.postMessage({cmd:"init",typeSupported:w,vendor:v,id:o,config:JSON.stringify(f)})}catch(c){I.logger.warn("Error in worker:",c),I.logger.error("Error while initializing DemuxerWorker, fallback to inline"),h&&self.URL.revokeObjectURL(h.objectURL),this.transmuxer=new B.default(this.observer,w,f,v,o),this.worker=null}}else this.transmuxer=new B.default(this.observer,w,f,v,o)}var b=E.prototype;return b.destroy=function(){var o=this.worker;if(o)o.removeEventListener("message",this.onwmsg),o.terminate(),this.worker=null;else{var s=this.transmuxer;s&&(s.destroy(),this.transmuxer=null)}var u=this.observer;u&&u.removeAllListeners(),this.observer=null},b.push=function(o,s,u,S,f,m,w,v,h,c){var l=this;h.transmuxing.start=self.performance.now();var a=this.transmuxer,g=this.worker,p=m?m.start:f.start,y=f.decryptdata,M=this.frag,F=!(M&&f.cc===M.cc),j=!(M&&h.level===M.level),W=M?h.sn-M.sn:-1,O=this.part?h.part-this.part.index:1,P=!j&&(W===1||W===0&&O===1),H=self.performance.now();(j||W||f.stats.parsing.start===0)&&(f.stats.parsing.start=H),m&&(O||!P)&&(m.stats.parsing.start=H);var X=new B.TransmuxState(F,P,v,j,p);if(!P||F){I.logger.log("[transmuxer-interface, "+f.type+"]: Starting new transmux session for sn: "+h.sn+" p: "+h.part+" level: "+h.level+" id: "+h.id+`
|
|
discontinuity: `+F+`
|
|
trackSwitch: `+j+`
|
|
contiguous: `+P+`
|
|
accurateTimeOffset: `+v+`
|
|
timeOffset: `+p);var q=new B.TransmuxConfig(u,S,s,w,c);this.configureTransmuxer(q)}if(this.frag=f,this.part=m,g)g.postMessage({cmd:"demux",data:o,decryptdata:y,chunkMeta:h,state:X},o instanceof ArrayBuffer?[o]:[]);else if(a){var re=a.push(o,y,h,X);Object(B.isPromise)(re)?re.then(function(Ee){l.handleTransmuxComplete(Ee)}):this.handleTransmuxComplete(re)}},b.flush=function(o){var s=this;o.transmuxing.start=self.performance.now();var u=this.transmuxer,S=this.worker;if(S)S.postMessage({cmd:"flush",chunkMeta:o});else if(u){var f=u.flush(o);Object(B.isPromise)(f)?f.then(function(m){s.handleFlushResult(m,o)}):this.handleFlushResult(f,o)}},b.handleFlushResult=function(o,s){var u=this;o.forEach(function(S){u.handleTransmuxComplete(S)}),this.onFlush(s)},b.onWorkerMessage=function(o){var s=o.data,u=this.hls;switch(s.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(s.data);break}case"flush":{this.onFlush(s.data);break}default:{s.data=s.data||{},s.data.frag=this.frag,s.data.id=this.id,u.trigger(s.event,s.data);break}}},b.configureTransmuxer=function(o){var s=this.worker,u=this.transmuxer;s?s.postMessage({cmd:"configure",config:o}):u&&u.configure(o)},b.handleTransmuxComplete=function(o){o.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(o)},E}()},"./src/demux/transmuxer-worker.ts":function(ne,V,_){"use strict";_.r(V),_.d(V,"default",function(){return D});var G=_("./src/demux/transmuxer.ts"),U=_("./src/events.ts"),R=_("./src/utils/logger.ts"),B=_("./node_modules/eventemitter3/index.js"),I=_.n(B);function D(C){var E=new B.EventEmitter,b=function(o,s){C.postMessage({event:o,data:s})};E.on(U.Events.FRAG_DECRYPTED,b),E.on(U.Events.ERROR,b),C.addEventListener("message",function(d){var o=d.data;switch(o.cmd){case"init":{var s=JSON.parse(o.config);C.transmuxer=new G.default(E,o.typeSupported,s,o.vendor,o.id),Object(R.enableLogs)(s.debug),b("init",null);break}case"configure":{C.transmuxer.configure(o.config);break}case"demux":{var u=C.transmuxer.push(o.data,o.decryptdata,o.chunkMeta,o.state);Object(G.isPromise)(u)?u.then(function(m){L(C,m)}):L(C,u);break}case"flush":{var S=o.chunkMeta,f=C.transmuxer.flush(S);Object(G.isPromise)(f)?f.then(function(m){A(C,m,S)}):A(C,f,S);break}default:break}})}function L(C,E){if(k(E.remuxResult))return;var b=[],d=E.remuxResult,o=d.audio,s=d.video;o&&x(b,o),s&&x(b,s),C.postMessage({event:"transmuxComplete",data:E},b)}function x(C,E){E.data1&&C.push(E.data1.buffer),E.data2&&C.push(E.data2.buffer)}function A(C,E,b){E.forEach(function(d){L(C,d)}),C.postMessage({event:"flush",data:b})}function k(C){return!C.audio&&!C.video&&!C.text&&!C.id3&&!C.initSegment}},"./src/demux/transmuxer.ts":function(ne,V,_){"use strict";_.r(V),_.d(V,"default",function(){return s}),_.d(V,"isPromise",function(){return f}),_.d(V,"TransmuxConfig",function(){return m}),_.d(V,"TransmuxState",function(){return w});var G=_("./src/events.ts"),U=_("./src/errors.ts"),R=_("./src/crypt/decrypter.ts"),B=_("./src/demux/aacdemuxer.ts"),I=_("./src/demux/mp4demuxer.ts"),D=_("./src/demux/tsdemuxer.ts"),L=_("./src/demux/mp3demuxer.ts"),x=_("./src/remux/mp4-remuxer.ts"),A=_("./src/remux/passthrough-remuxer.ts"),k=_("./src/demux/chunk-cache.ts"),C=_("./src/utils/mp4-tools.ts"),E=_("./src/utils/logger.ts"),b;try{b=self.performance.now.bind(self.performance)}catch(v){E.logger.debug("Unable to use Performance API on this environment"),b=self.Date.now}var d=[{demux:D.default,remux:x.default},{demux:I.default,remux:A.default},{demux:B.default,remux:x.default},{demux:L.default,remux:x.default}],o=1024;d.forEach(function(v){var h=v.demux;o=Math.max(o,h.minProbeByteLength)});var s=function(){function v(c,l,a,g,p){this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.cache=new k.default,this.observer=c,this.typeSupported=l,this.config=a,this.vendor=g,this.id=p}var h=v.prototype;return h.configure=function(l){this.transmuxConfig=l,this.decrypter&&this.decrypter.reset()},h.push=function(l,a,g,p){var y=this,M=g.transmuxing;M.executeStart=b();var F=new Uint8Array(l),j=this.cache,W=this.config,O=this.currentTransmuxState,P=this.transmuxConfig;p&&(this.currentTransmuxState=p);var H=u(F,a);if(H&&H.method==="AES-128"){var X=this.getDecrypter();if(W.enableSoftwareAES){var q=X.softwareDecrypt(F,H.key.buffer,H.iv.buffer);if(!q)return M.executeEnd=b(),S(g);F=new Uint8Array(q)}else return this.decryptionPromise=X.webCryptoDecrypt(F,H.key.buffer,H.iv.buffer).then(function(we){var De=y.push(we,null,g);return y.decryptionPromise=null,De}),this.decryptionPromise}var re=p||O,Ee=re.contiguous,he=re.discontinuity,xe=re.trackSwitch,pe=re.accurateTimeOffset,ve=re.timeOffset,ce=P.audioCodec,fe=P.videoCodec,$=P.defaultInitPts,ae=P.duration,Z=P.initSegmentData;if((he||xe)&&this.resetInitSegment(Z,ce,fe,ae),he&&this.resetInitialTimestamp($),Ee||this.resetContiguity(),this.needsProbing(F,he,xe)){if(j.dataLength){var ge=j.flush();F=Object(C.appendUint8Array)(ge,F)}this.configureTransmuxer(F,P)}var Se=this.transmux(F,H,ve,pe,g),me=this.currentTransmuxState;return me.contiguous=!0,me.discontinuity=!1,me.trackSwitch=!1,M.executeEnd=b(),Se},h.flush=function(l){var a=this,g=l.transmuxing;g.executeStart=b();var p=this.decrypter,y=this.cache,M=this.currentTransmuxState,F=this.decryptionPromise;if(F)return F.then(function(){return a.flush(l)});var j=[],W=M.timeOffset;if(p){var O=p.flush();O&&j.push(this.push(O,null,l))}var P=y.dataLength;y.reset();var H=this.demuxer,X=this.remuxer;if(!H||!X)return P>=o&&this.observer.emit(G.Events.ERROR,G.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),g.executeEnd=b(),[S(l)];var q=H.flush(W);return f(q)?q.then(function(re){return a.flushRemux(j,re,l),j}):(this.flushRemux(j,q,l),j)},h.flushRemux=function(l,a,g){var p=a.audioTrack,y=a.avcTrack,M=a.id3Track,F=a.textTrack,j=this.currentTransmuxState,W=j.accurateTimeOffset,O=j.timeOffset;E.logger.log("[transmuxer.ts]: Flushed fragment "+g.sn+(g.part>-1?" p: "+g.part:"")+" of level "+g.level);var P=this.remuxer.remux(p,y,M,F,O,W,!0,this.id);l.push({remuxResult:P,chunkMeta:g}),g.transmuxing.executeEnd=b()},h.resetInitialTimestamp=function(l){var a=this.demuxer,g=this.remuxer;if(!a||!g)return;a.resetTimeStamp(l),g.resetTimeStamp(l)},h.resetContiguity=function(){var l=this.demuxer,a=this.remuxer;if(!l||!a)return;l.resetContiguity(),a.resetNextTimestamp()},h.resetInitSegment=function(l,a,g,p){var y=this.demuxer,M=this.remuxer;if(!y||!M)return;y.resetInitSegment(a,g,p),M.resetInitSegment(l,a,g)},h.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},h.transmux=function(l,a,g,p,y){var M;return a&&a.method==="SAMPLE-AES"?M=this.transmuxSampleAes(l,a,g,p,y):M=this.transmuxUnencrypted(l,g,p,y),M},h.transmuxUnencrypted=function(l,a,g,p){var y=this.demuxer.demux(l,a,!1,!this.config.progressive),M=y.audioTrack,F=y.avcTrack,j=y.id3Track,W=y.textTrack,O=this.remuxer.remux(M,F,j,W,a,g,!1,this.id);return{remuxResult:O,chunkMeta:p}},h.transmuxSampleAes=function(l,a,g,p,y){var M=this;return this.demuxer.demuxSampleAes(l,a,g).then(function(F){var j=M.remuxer.remux(F.audioTrack,F.avcTrack,F.id3Track,F.textTrack,g,p,!1,M.id);return{remuxResult:j,chunkMeta:y}})},h.configureTransmuxer=function(l,a){for(var g=this.config,p=this.observer,y=this.typeSupported,M=this.vendor,F=a.audioCodec,j=a.defaultInitPts,W=a.duration,O=a.initSegmentData,P=a.videoCodec,H,X=0,q=d.length;X<q;X++)if(d[X].demux.probe(l)){H=d[X];break}H||(E.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),H={demux:I.default,remux:A.default});var re=this.demuxer,Ee=this.remuxer,he=H.remux,xe=H.demux;(!Ee||!(Ee instanceof he))&&(this.remuxer=new he(p,g,y,M)),(!re||!(re instanceof xe))&&(this.demuxer=new xe(p,g,y),this.probe=xe.probe),this.resetInitSegment(O,F,P,W),this.resetInitialTimestamp(j)},h.needsProbing=function(l,a,g){return!this.demuxer||!this.remuxer||a||g},h.getDecrypter=function(){var l=this.decrypter;return l||(l=this.decrypter=new R.default(this.observer,this.config)),l},v}();function u(v,h){var c=null;return v.byteLength>0&&h!=null&&h.key!=null&&h.iv!==null&&h.method!=null&&(c=h),c}var S=function(h){return{remuxResult:{},chunkMeta:h}};function f(v){return"then"in v&&v.then instanceof Function}var m=function(h,c,l,a,g){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=h,this.videoCodec=c,this.initSegmentData=l,this.duration=a,this.defaultInitPts=g},w=function(h,c,l,a,g){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=h,this.contiguous=c,this.accurateTimeOffset=l,this.trackSwitch=a,this.timeOffset=g}},"./src/demux/tsdemuxer.ts":function(ne,V,_){"use strict";_.r(V),_.d(V,"discardEPB",function(){return S});var G=_("./src/demux/adts.ts"),U=_("./src/demux/mpegaudio.ts"),R=_("./src/demux/exp-golomb.ts"),B=_("./src/demux/id3.ts"),I=_("./src/demux/sample-aes.ts"),D=_("./src/events.ts"),L=_("./src/utils/mp4-tools.ts"),x=_("./src/utils/logger.ts"),A=_("./src/errors.ts"),k={video:1,audio:2,id3:3,text:4},C=function(){function f(w,v,h){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this.aacLastPTS=null,this._initPTS=null,this._initDTS=null,this._pmtId=-1,this._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=w,this.config=v,this.typeSupported=h}f.probe=function(v){var h=f.syncOffset(v);return h<0?!1:(h&&x.logger.warn("MPEG2-TS detected but first sync word found @ offset "+h+", junk ahead ?"),!0)},f.syncOffset=function(v){for(var h=Math.min(1e3,v.length-3*188),c=0;c<h;){if(v[c]===71&&v[c+188]===71&&v[c+2*188]===71)return c;c++}return-1},f.createTrack=function(v,h){return{container:v==="video"||v==="audio"?"video/mp2t":void 0,type:v,id:k[v],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:v==="audio"?h:void 0}};var m=f.prototype;return m.resetInitSegment=function(v,h,c){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=f.createTrack("video",c),this._audioTrack=f.createTrack("audio",c),this._id3Track=f.createTrack("id3",c),this._txtTrack=f.createTrack("text",c),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=v,this.videoCodec=h,this._duration=c},m.resetTimeStamp=function(){},m.resetContiguity=function(){var v=this._audioTrack,h=this._avcTrack,c=this._id3Track;v&&(v.pesData=null),h&&(h.pesData=null),c&&(c.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},m.demux=function(v,h,c,l){c===void 0&&(c=!1),l===void 0&&(l=!1),c||(this.sampleAes=null);var a,g=this._avcTrack,p=this._audioTrack,y=this._id3Track,M=g.pid,F=g.pesData,j=p.pid,W=y.pid,O=p.pesData,P=y.pesData,H=!1,X=this.pmtParsed,q=this._pmtId,re=v.length;if(this.remainderData&&(v=Object(L.appendUint8Array)(this.remainderData,v),re=v.length,this.remainderData=null),re<188&&!l)return this.remainderData=v,{audioTrack:p,avcTrack:g,id3Track:y,textTrack:this._txtTrack};var Ee=Math.max(0,f.syncOffset(v));re-=(re+Ee)%188,re<v.byteLength&&!l&&(this.remainderData=new Uint8Array(v.buffer,re,v.buffer.byteLength-re));for(var he=Ee;he<re;he+=188)if(v[he]===71){var xe=!!(v[he+1]&64),pe=((v[he+1]&31)<<8)+v[he+2],ve=(v[he+3]&48)>>4,ce=void 0;if(ve>1){if(ce=he+5+v[he+4],ce===he+188)continue}else ce=he+4;switch(pe){case M:xe&&(F&&(a=o(F))&&this.parseAVCPES(a,!1),F={data:[],size:0}),F&&(F.data.push(v.subarray(ce,he+188)),F.size+=he+188-ce);break;case j:xe&&(O&&(a=o(O))&&(p.isAAC?this.parseAACPES(a):this.parseMPEGPES(a)),O={data:[],size:0}),O&&(O.data.push(v.subarray(ce,he+188)),O.size+=he+188-ce);break;case W:xe&&(P&&(a=o(P))&&this.parseID3PES(a),P={data:[],size:0}),P&&(P.data.push(v.subarray(ce,he+188)),P.size+=he+188-ce);break;case 0:xe&&(ce+=v[ce]+1),q=this._pmtId=b(v,ce);break;case q:{xe&&(ce+=v[ce]+1);var fe=d(v,ce,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,c);M=fe.avc,M>0&&(g.pid=M),j=fe.audio,j>0&&(p.pid=j,p.isAAC=fe.isAAC),W=fe.id3,W>0&&(y.pid=W),H&&!X&&(x.logger.log("reparse from beginning"),H=!1,he=Ee-188),X=this.pmtParsed=!0;break}case 17:case 8191:break;default:H=!0;break}}else this.observer.emit(D.Events.ERROR,D.Events.ERROR,{type:A.ErrorTypes.MEDIA_ERROR,details:A.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});g.pesData=F,p.pesData=O,y.pesData=P;var $={audioTrack:p,avcTrack:g,id3Track:y,textTrack:this._txtTrack};return l&&this.extractRemainingSamples($),$},m.flush=function(){var v=this.remainderData;this.remainderData=null;var h;return v?h=this.demux(v,-1,!1,!0):h={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(h),this.sampleAes?this.decrypt(h,this.sampleAes):h},m.extractRemainingSamples=function(v){var h=v.audioTrack,c=v.avcTrack,l=v.id3Track,a=c.pesData,g=h.pesData,p=l.pesData,y;a&&(y=o(a))?(this.parseAVCPES(y,!0),c.pesData=null):c.pesData=a,g&&(y=o(g))?(h.isAAC?this.parseAACPES(y):this.parseMPEGPES(y),h.pesData=null):(g!=null&&g.size&&x.logger.log("last AAC PES packet truncated,might overlap between fragments"),h.pesData=g),p&&(y=o(p))?(this.parseID3PES(y),l.pesData=null):l.pesData=p},m.demuxSampleAes=function(v,h,c){var l=this.demux(v,c,!0,!this.config.progressive),a=this.sampleAes=new I.default(this.observer,this.config,h);return this.decrypt(l,a)},m.decrypt=function(v,h){return new Promise(function(c){var l=v.audioTrack,a=v.avcTrack;l.samples&&l.isAAC?h.decryptAacSamples(l.samples,0,function(){a.samples?h.decryptAvcSamples(a.samples,0,0,function(){c(v)}):c(v)}):a.samples&&h.decryptAvcSamples(a.samples,0,0,function(){c(v)})})},m.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},m.parseAVCPES=function(v,h){var c=this,l=this._avcTrack,a=this.parseAVCNALu(v.data),g=!1,p=this.avcSample,y,M=!1;v.data=null,p&&a.length&&!l.audFound&&(s(p,l),p=this.avcSample=E(!1,v.pts,v.dts,"")),a.forEach(function(F){switch(F.type){case 1:{y=!0,p||(p=c.avcSample=E(!0,v.pts,v.dts,"")),g&&(p.debug+="NDR "),p.frame=!0;var j=F.data;if(M&&j.length>4){var W=new R.default(j).readSliceType();(W===2||W===4||W===7||W===9)&&(p.key=!0)}break}case 5:y=!0,p||(p=c.avcSample=E(!0,v.pts,v.dts,"")),g&&(p.debug+="IDR "),p.key=!0,p.frame=!0;break;case 6:{y=!0,g&&p&&(p.debug+="SEI ");var O=new R.default(S(F.data));O.readUByte();for(var P=0,H=0,X=!1,q=0;!X&&O.bytesAvailable>1;){P=0;do q=O.readUByte(),P+=q;while(q===255);H=0;do q=O.readUByte(),H+=q;while(q===255);if(P===4&&O.bytesAvailable!==0){X=!0;var re=O.readUByte();if(re===181){var Ee=O.readUShort();if(Ee===49){var he=O.readUInt();if(he===1195456820){var xe=O.readUByte();if(xe===3){for(var pe=O.readUByte(),ve=O.readUByte(),ce=31&pe,fe=[pe,ve],$=0;$<ce;$++)fe.push(O.readUByte()),fe.push(O.readUByte()),fe.push(O.readUByte());u(c._txtTrack.samples,{type:3,pts:v.pts,bytes:fe})}}}}}else if(P===5&&O.bytesAvailable!==0){if(X=!0,H>16){for(var ae=[],Z=0;Z<16;Z++)ae.push(O.readUByte().toString(16)),(Z===3||Z===5||Z===7||Z===9)&&ae.push("-");for(var ge=H-16,Se=new Uint8Array(ge),me=0;me<ge;me++)Se[me]=O.readUByte();u(c._txtTrack.samples,{pts:v.pts,payloadType:P,uuid:ae.join(""),userData:Object(B.utf8ArrayToStr)(Se),userDataBytes:Se})}}else if(H<O.bytesAvailable)for(var we=0;we<H;we++)O.readUByte()}break}case 7:if(y=!0,M=!0,g&&p&&(p.debug+="SPS "),!l.sps){var De=new R.default(F.data),Oe=De.readSPS();l.width=Oe.width,l.height=Oe.height,l.pixelRatio=Oe.pixelRatio,l.sps=[F.data],l.duration=c._duration;for(var ke=F.data.subarray(1,4),Le="avc1.",_e=0;_e<3;_e++){var ze=ke[_e].toString(16);ze.length<2&&(ze="0"+ze),Le+=ze}l.codec=Le}break;case 8:y=!0,g&&p&&(p.debug+="PPS "),l.pps||(l.pps=[F.data]);break;case 9:y=!1,l.audFound=!0,p&&s(p,l),p=c.avcSample=E(!1,v.pts,v.dts,g?"AUD ":"");break;case 12:y=!1;break;default:y=!1,p&&(p.debug+="unknown NAL "+F.type+" ");break}if(p&&y){var Xe=p.units;Xe.push(F)}}),h&&p&&(s(p,l),this.avcSample=null)},m.getLastNalUnit=function(){var v,h=this.avcSample,c;if(!h||h.units.length===0){var l=this._avcTrack.samples;h=l[l.length-1]}if((v=h)!==null&&v!==void 0&&v.units){var a=h.units;c=a[a.length-1]}return c},m.parseAVCNALu=function(v){var h=v.byteLength,c=this._avcTrack,l=c.naluState||0,a=l,g=[],p=0,y,M,F,j=-1,W=0;for(l===-1&&(j=0,W=v[0]&31,l=0,p=1);p<h;){if(y=v[p++],!l){l=y?0:1;continue}if(l===1){l=y?0:2;continue}if(!y)l=3;else if(y===1){if(j>=0){var O={data:v.subarray(j,p-l-1),type:W};g.push(O)}else{var P=this.getLastNalUnit();if(P&&(a&&p<=4-a&&(P.state&&(P.data=P.data.subarray(0,P.data.byteLength-a))),M=p-l-1,M>0)){var H=new Uint8Array(P.data.byteLength+M);H.set(P.data,0),H.set(v.subarray(0,M),P.data.byteLength),P.data=H,P.state=0}}p<h?(F=v[p]&31,j=p,W=F,l=0):l=-1}else l=0}if(j>=0&&l>=0){var X={data:v.subarray(j,h),type:W,state:l};g.push(X)}if(g.length===0){var q=this.getLastNalUnit();if(q){var re=new Uint8Array(q.data.byteLength+v.byteLength);re.set(q.data,0),re.set(v,q.data.byteLength),q.data=re}}return c.naluState=l,g},m.parseAACPES=function(v){var h=0,c=this._audioTrack,l=this.aacOverFlow,a=v.data;if(l){this.aacOverFlow=null;var g=l.sample.unit.byteLength,p=Math.min(l.missing,g),y=g-p;l.sample.unit.set(a.subarray(0,p),y),c.samples.push(l.sample),h=l.missing}var M,F;for(M=h,F=a.length;M<F-1&&!G.isHeader(a,M);M++);if(M!==h){var j,W;if(M<F-1?(j="AAC PES did not start with ADTS header,offset:"+M,W=!1):(j="no ADTS header found in AAC PES",W=!0),x.logger.warn("parsing error:"+j),this.observer.emit(D.Events.ERROR,D.Events.ERROR,{type:A.ErrorTypes.MEDIA_ERROR,details:A.ErrorDetails.FRAG_PARSING_ERROR,fatal:W,reason:j}),W)return}G.initTrackConfig(c,this.observer,a,M,this.audioCodec);var O;if(v.pts!==void 0)O=v.pts;else if(l){var P=G.getFrameDuration(c.samplerate);O=l.sample.pts+P}else{x.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var H=0;M<F;)if(G.isHeader(a,M)){if(M+5<F){var X=G.appendFrame(c,a,M,O,H);if(X)if(X.missing)this.aacOverFlow=X;else{M+=X.length,H++;continue}}break}else M++},m.parseMPEGPES=function(v){var h=v.data,c=h.length,l=0,a=0,g=v.pts;if(g===void 0){x.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;a<c;)if(U.isHeader(h,a)){var p=U.appendFrame(this._audioTrack,h,a,g,l);if(p)a+=p.length,l++;else break}else a++},m.parseID3PES=function(v){if(v.pts===void 0){x.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(v)},f}();C.minProbeByteLength=188;function E(f,m,w,v){return{key:f,frame:!1,pts:m,dts:w,units:[],debug:v,length:0}}function b(f,m){return(f[m+10]&31)<<8|f[m+11]}function d(f,m,w,v){var h={audio:-1,avc:-1,id3:-1,isAAC:!0},c=(f[m+1]&15)<<8|f[m+2],l=m+3+c-4,a=(f[m+10]&15)<<8|f[m+11];for(m+=12+a;m<l;){var g=(f[m+1]&31)<<8|f[m+2];switch(f[m]){case 207:if(!v){x.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:h.audio===-1&&(h.audio=g);break;case 21:h.id3===-1&&(h.id3=g);break;case 219:if(!v){x.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:h.avc===-1&&(h.avc=g);break;case 3:case 4:w?h.audio===-1&&(h.audio=g,h.isAAC=!1):x.logger.log("MPEG audio found, not supported in this browser");break;case 36:x.logger.warn("Unsupported HEVC stream type found");break;default:break}m+=((f[m+3]&15)<<8|f[m+4])+5}return h}function o(f){var m=0,w,v,h,c,l,a=f.data;if(!f||f.size===0)return null;for(;a[0].length<19&&a.length>1;){var g=new Uint8Array(a[0].length+a[1].length);g.set(a[0]),g.set(a[1],a[0].length),a[0]=g,a.splice(1,1)}w=a[0];var p=(w[0]<<16)+(w[1]<<8)+w[2];if(p===1){if(v=(w[4]<<8)+w[5],v&&v>f.size-6)return null;var y=w[7];y&192&&(c=(w[9]&14)*536870912+(w[10]&255)*4194304+(w[11]&254)*16384+(w[12]&255)*128+(w[13]&254)/2,y&64?(l=(w[14]&14)*536870912+(w[15]&255)*4194304+(w[16]&254)*16384+(w[17]&255)*128+(w[18]&254)/2,c-l>60*9e4&&(x.logger.warn(Math.round((c-l)/9e4)+"s delta between PTS and DTS, align them"),c=l)):l=c),h=w[8];var M=h+9;if(f.size<=M)return null;f.size-=M;for(var F=new Uint8Array(f.size),j=0,W=a.length;j<W;j++){w=a[j];var O=w.byteLength;if(M)if(M>O){M-=O;continue}else w=w.subarray(M),O-=M,M=0;F.set(w,m),m+=O}return v&&(v-=h+3),{data:F,pts:c,dts:l,len:v}}return null}function s(f,m){if(f.units.length&&f.frame){if(f.pts===void 0){var w=m.samples,v=w.length;if(v){var h=w[v-1];f.pts=h.pts,f.dts=h.dts}else{m.dropped++;return}}m.samples.push(f)}f.debug.length&&x.logger.log(f.pts+"/"+f.dts+":"+f.debug)}function u(f,m){var w=f.length;if(w>0){if(m.pts>=f[w-1].pts)f.push(m);else for(var v=w-1;v>=0;v--)if(m.pts<f[v].pts){f.splice(v,0,m);break}}else f.push(m)}function S(f){for(var m=f.byteLength,w=[],v=1;v<m-2;)f[v]===0&&f[v+1]===0&&f[v+2]===3?(w.push(v+2),v+=2):v++;if(w.length===0)return f;var h=m-w.length,c=new Uint8Array(h),l=0;for(v=0;v<h;l++,v++)l===w[0]&&(l++,w.shift()),c[v]=f[l];return c}V.default=C},"./src/errors.ts":function(ne,V,_){"use strict";_.r(V),_.d(V,"ErrorTypes",function(){return G}),_.d(V,"ErrorDetails",function(){return U});var G;(function(R){R.NETWORK_ERROR="networkError",R.MEDIA_ERROR="mediaError",R.KEY_SYSTEM_ERROR="keySystemError",R.MUX_ERROR="muxError",R.OTHER_ERROR="otherError"})(G||(G={}));var U;(function(R){R.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",R.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",R.KEY_SYSTEM_NO_SESSION="keySystemNoSession",R.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",R.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",R.MANIFEST_LOAD_ERROR="manifestLoadError",R.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",R.MANIFEST_PARSING_ERROR="manifestParsingError",R.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",R.LEVEL_EMPTY_ERROR="levelEmptyError",R.LEVEL_LOAD_ERROR="levelLoadError",R.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",R.LEVEL_SWITCH_ERROR="levelSwitchError",R.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",R.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",R.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",R.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",R.FRAG_LOAD_ERROR="fragLoadError",R.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",R.FRAG_DECRYPT_ERROR="fragDecryptError",R.FRAG_PARSING_ERROR="fragParsingError",R.REMUX_ALLOC_ERROR="remuxAllocError",R.KEY_LOAD_ERROR="keyLoadError",R.KEY_LOAD_TIMEOUT="keyLoadTimeOut",R.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",R.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",R.BUFFER_APPEND_ERROR="bufferAppendError",R.BUFFER_APPENDING_ERROR="bufferAppendingError",R.BUFFER_STALLED_ERROR="bufferStalledError",R.BUFFER_FULL_ERROR="bufferFullError",R.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",R.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",R.INTERNAL_EXCEPTION="internalException",R.INTERNAL_ABORTED="aborted",R.UNKNOWN="unknown"})(U||(U={}))},"./src/events.ts":function(ne,V,_){"use strict";_.r(V),_.d(V,"Events",function(){return G});var G;(function(U){U.MEDIA_ATTACHING="hlsMediaAttaching",U.MEDIA_ATTACHED="hlsMediaAttached",U.MEDIA_DETACHING="hlsMediaDetaching",U.MEDIA_DETACHED="hlsMediaDetached",U.BUFFER_RESET="hlsBufferReset",U.BUFFER_CODECS="hlsBufferCodecs",U.BUFFER_CREATED="hlsBufferCreated",U.BUFFER_APPENDING="hlsBufferAppending",U.BUFFER_APPENDED="hlsBufferAppended",U.BUFFER_EOS="hlsBufferEos",U.BUFFER_FLUSHING="hlsBufferFlushing",U.BUFFER_FLUSHED="hlsBufferFlushed",U.MANIFEST_LOADING="hlsManifestLoading",U.MANIFEST_LOADED="hlsManifestLoaded",U.MANIFEST_PARSED="hlsManifestParsed",U.LEVEL_SWITCHING="hlsLevelSwitching",U.LEVEL_SWITCHED="hlsLevelSwitched",U.LEVEL_LOADING="hlsLevelLoading",U.LEVEL_LOADED="hlsLevelLoaded",U.LEVEL_UPDATED="hlsLevelUpdated",U.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",U.LEVELS_UPDATED="hlsLevelsUpdated",U.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",U.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",U.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",U.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",U.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",U.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",U.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",U.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",U.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",U.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",U.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",U.CUES_PARSED="hlsCuesParsed",U.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",U.INIT_PTS_FOUND="hlsInitPtsFound",U.FRAG_LOADING="hlsFragLoading",U.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",U.FRAG_LOADED="hlsFragLoaded",U.FRAG_DECRYPTED="hlsFragDecrypted",U.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",U.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",U.FRAG_PARSING_METADATA="hlsFragParsingMetadata",U.FRAG_PARSED="hlsFragParsed",U.FRAG_BUFFERED="hlsFragBuffered",U.FRAG_CHANGED="hlsFragChanged",U.FPS_DROP="hlsFpsDrop",U.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",U.ERROR="hlsError",U.DESTROYING="hlsDestroying",U.KEY_LOADING="hlsKeyLoading",U.KEY_LOADED="hlsKeyLoaded",U.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",U.BACK_BUFFER_REACHED="hlsBackBufferReached"})(G||(G={}))},"./src/hls.ts":function(ne,V,_){"use strict";_.r(V),_.d(V,"default",function(){return f});var G=_("./node_modules/url-toolkit/src/url-toolkit.js"),U=_.n(G),R=_("./src/loader/playlist-loader.ts"),B=_("./src/loader/key-loader.ts"),I=_("./src/controller/id3-track-controller.ts"),D=_("./src/controller/latency-controller.ts"),L=_("./src/controller/level-controller.ts"),x=_("./src/controller/fragment-tracker.ts"),A=_("./src/controller/stream-controller.ts"),k=_("./src/is-supported.ts"),C=_("./src/utils/logger.ts"),E=_("./src/config.ts"),b=_("./node_modules/eventemitter3/index.js"),d=_.n(b),o=_("./src/events.ts"),s=_("./src/errors.ts");function u(m,w){for(var v=0;v<w.length;v++){var h=w[v];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(m,h.key,h)}}function S(m,w,v){return w&&u(m.prototype,w),v&&u(m,v),m}var f=function(){m.isSupported=function(){return Object(k.isSupported)()};function m(v){v===void 0&&(v={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new b.EventEmitter,this._autoLevelCapping=void 0,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null;var h=this.config=Object(E.mergeConfig)(m.DefaultConfig,v);this.userConfig=v,Object(C.enableLogs)(h.debug),this._autoLevelCapping=-1,h.progressive&&Object(E.enableStreamingMode)(h);var c=h.abrController,l=h.bufferController,a=h.capLevelController,g=h.fpsController,p=this.abrController=new c(this),y=this.bufferController=new l(this),M=this.capLevelController=new a(this),F=new g(this),j=new R.default(this),W=new B.default(this),O=new I.default(this),P=this.levelController=new L.default(this),H=new x.FragmentTracker(this),X=this.streamController=new A.default(this,H);M.setStreamController(X),F.setStreamController(X);var q=[P,X];this.networkControllers=q;var re=[j,W,p,y,M,F,O,H];this.audioTrackController=this.createController(h.audioTrackController,null,q),this.createController(h.audioStreamController,H,q),this.subtitleTrackController=this.createController(h.subtitleTrackController,null,q),this.createController(h.subtitleStreamController,H,q),this.createController(h.timelineController,null,re),this.emeController=this.createController(h.emeController,null,re),this.cmcdController=this.createController(h.cmcdController,null,re),this.latencyController=this.createController(D.default,null,re),this.coreComponents=re}var w=m.prototype;return w.createController=function(h,c,l){if(h){var a=c?new h(this,c):new h(this);return l&&l.push(a),a}return null},w.on=function(h,c,l){l===void 0&&(l=this),this._emitter.on(h,c,l)},w.once=function(h,c,l){l===void 0&&(l=this),this._emitter.once(h,c,l)},w.removeAllListeners=function(h){this._emitter.removeAllListeners(h)},w.off=function(h,c,l,a){l===void 0&&(l=this),this._emitter.off(h,c,l,a)},w.listeners=function(h){return this._emitter.listeners(h)},w.emit=function(h,c,l){return this._emitter.emit(h,c,l)},w.trigger=function(h,c){if(this.config.debug)return this.emit(h,h,c);try{return this.emit(h,h,c)}catch(l){C.logger.error("An internal error happened while handling event "+h+'. Error message: "'+l.message+'". Here is a stacktrace:',l),this.trigger(o.Events.ERROR,{type:s.ErrorTypes.OTHER_ERROR,details:s.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:h,error:l})}return!1},w.listenerCount=function(h){return this._emitter.listenerCount(h)},w.destroy=function(){C.logger.log("destroy"),this.trigger(o.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(h){return h.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(h){return h.destroy()}),this.coreComponents.length=0},w.attachMedia=function(h){C.logger.log("attachMedia"),this._media=h,this.trigger(o.Events.MEDIA_ATTACHING,{media:h})},w.detachMedia=function(){C.logger.log("detachMedia"),this.trigger(o.Events.MEDIA_DETACHING,void 0),this._media=null},w.loadSource=function(h){this.stopLoad();var c=this.media,l=this.url,a=this.url=G.buildAbsoluteURL(self.location.href,h,{alwaysNormalize:!0});C.logger.log("loadSource:"+a),c&&l&&l!==a&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(c)),this.trigger(o.Events.MANIFEST_LOADING,{url:h})},w.startLoad=function(h){h===void 0&&(h=-1),C.logger.log("startLoad("+h+")"),this.networkControllers.forEach(function(c){c.startLoad(h)})},w.stopLoad=function(){C.logger.log("stopLoad"),this.networkControllers.forEach(function(h){h.stopLoad()})},w.swapAudioCodec=function(){C.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},w.recoverMediaError=function(){C.logger.log("recoverMediaError");var h=this._media;this.detachMedia(),h&&this.attachMedia(h)},w.removeLevel=function(h,c){c===void 0&&(c=0),this.levelController.removeLevel(h,c)},S(m,[{key:"levels",get:function(){var h=this.levelController.levels;return h||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(h){C.logger.log("set currentLevel:"+h),this.loadLevel=h,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(h){C.logger.log("set nextLevel:"+h),this.levelController.manualLevel=h,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(h){C.logger.log("set loadLevel:"+h),this.levelController.manualLevel=h}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(h){this.levelController.nextLoadLevel=h}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(h){C.logger.log("set firstLevel:"+h),this.levelController.firstLevel=h}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(h){C.logger.log("set startLevel:"+h),h!==-1&&(h=Math.max(h,this.minAutoLevel)),this.levelController.startLevel=h}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(h){var c=!!h;c!==this.config.capLevelToPlayerSize&&(c?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=c)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(h){this._autoLevelCapping!==h&&(C.logger.log("set autoLevelCapping:"+h),this._autoLevelCapping=h)}},{key:"bandwidthEstimate",get:function(){var h=this.abrController.bwEstimator;return h?h.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var h=this.levels,c=this.config.minAutoBitrate;if(!h)return 0;for(var l=h.length,a=0;a<l;a++)if(h[a].maxBitrate>c)return a;return 0}},{key:"maxAutoLevel",get:function(){var h=this.levels,c=this.autoLevelCapping,l;return c===-1&&h&&h.length?l=h.length-1:l=c,l}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(h){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,h)}},{key:"audioTracks",get:function(){var h=this.audioTrackController;return h?h.audioTracks:[]}},{key:"audioTrack",get:function(){var h=this.audioTrackController;return h?h.audioTrack:-1},set:function(h){var c=this.audioTrackController;c&&(c.audioTrack=h)}},{key:"subtitleTracks",get:function(){var h=this.subtitleTrackController;return h?h.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var h=this.subtitleTrackController;return h?h.subtitleTrack:-1},set:function(h){var c=this.subtitleTrackController;c&&(c.subtitleTrack=h)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var h=this.subtitleTrackController;return h?h.subtitleDisplay:!1},set:function(h){var c=this.subtitleTrackController;c&&(c.subtitleDisplay=h)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(h){this.config.lowLatencyMode=h}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}],[{key:"version",get:function(){return"1.1.2"}},{key:"Events",get:function(){return o.Events}},{key:"ErrorTypes",get:function(){return s.ErrorTypes}},{key:"ErrorDetails",get:function(){return s.ErrorDetails}},{key:"DefaultConfig",get:function(){return m.defaultConfig?m.defaultConfig:E.hlsDefaultConfig},set:function(h){m.defaultConfig=h}}]),m}();f.defaultConfig=void 0},"./src/is-supported.ts":function(ne,V,_){"use strict";_.r(V),_.d(V,"isSupported",function(){return R}),_.d(V,"changeTypeSupported",function(){return B});var G=_("./src/utils/mediasource-helper.ts");function U(){return self.SourceBuffer||self.WebKitSourceBuffer}function R(){var I=Object(G.getMediaSource)();if(!I)return!1;var D=U(),L=I&&typeof I.isTypeSupported=="function"&&I.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),x=!D||D.prototype&&typeof D.prototype.appendBuffer=="function"&&typeof D.prototype.remove=="function";return!!L&&!!x}function B(){var I,D=U();return typeof(D==null||((I=D.prototype)===null||I===void 0)?void 0:I.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(ne,V,_){"use strict";_.r(V),_.d(V,"default",function(){return C}),_.d(V,"LoadError",function(){return b});var G=_("./src/polyfills/number.ts"),U=_("./src/errors.ts");function R(d,o){d.prototype=Object.create(o.prototype),d.prototype.constructor=d,x(d,o)}function B(d){var o=typeof Map=="function"?new Map:void 0;return B=function(u){if(u===null||!L(u))return u;if(typeof u!="function")throw new TypeError("Super expression must either be null or a function");if(typeof o!="undefined"){if(o.has(u))return o.get(u);o.set(u,S)}function S(){return I(u,arguments,A(this).constructor)}return S.prototype=Object.create(u.prototype,{constructor:{value:S,enumerable:!1,writable:!0,configurable:!0}}),x(S,u)},B(d)}function I(d,o,s){return D()?I=Reflect.construct:I=function(S,f,m){var w=[null];w.push.apply(w,f);var v=Function.bind.apply(S,w),h=new v;return m&&x(h,m.prototype),h},I.apply(null,arguments)}function D(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(d){return!1}}function L(d){return Function.toString.call(d).indexOf("[native code]")!==-1}function x(d,o){return x=Object.setPrototypeOf||function(u,S){return u.__proto__=S,u},x(d,o)}function A(d){return A=Object.setPrototypeOf?Object.getPrototypeOf:function(s){return s.__proto__||Object.getPrototypeOf(s)},A(d)}var k=Math.pow(2,17),C=function(){function d(s){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=s}var o=d.prototype;return o.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},o.abort=function(){this.loader&&this.loader.abort()},o.load=function(u,S){var f=this,m=u.url;if(!m)return Promise.reject(new b({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:u,networkDetails:null},"Fragment does not have a "+(m?"part list":"url")));this.abort();var w=this.config,v=w.fLoader,h=w.loader;return new Promise(function(c,l){f.loader&&f.loader.destroy();var a=f.loader=u.loader=v?new v(w):new h(w),g=E(u),p={timeout:w.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:w.fragLoadingMaxRetryTimeout,highWaterMark:k};u.stats=a.stats,a.load(g,p,{onSuccess:function(M,F,j,W){f.resetLoader(u,a),c({frag:u,part:null,payload:M.data,networkDetails:W})},onError:function(M,F,j){f.resetLoader(u,a),l(new b({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:u,response:M,networkDetails:j}))},onAbort:function(M,F,j){f.resetLoader(u,a),l(new b({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:u,networkDetails:j}))},onTimeout:function(M,F,j){f.resetLoader(u,a),l(new b({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:u,networkDetails:j}))},onProgress:function(M,F,j,W){S&&S({frag:u,part:null,payload:j,networkDetails:W})}})})},o.loadPart=function(u,S,f){var m=this;this.abort();var w=this.config,v=w.fLoader,h=w.loader;return new Promise(function(c,l){m.loader&&m.loader.destroy();var a=m.loader=u.loader=v?new v(w):new h(w),g=E(u,S),p={timeout:w.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:w.fragLoadingMaxRetryTimeout,highWaterMark:k};S.stats=a.stats,a.load(g,p,{onSuccess:function(M,F,j,W){m.resetLoader(u,a),m.updateStatsFromPart(u,S);var O={frag:u,part:S,payload:M.data,networkDetails:W};f(O),c(O)},onError:function(M,F,j){m.resetLoader(u,a),l(new b({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:u,part:S,response:M,networkDetails:j}))},onAbort:function(M,F,j){u.stats.aborted=S.stats.aborted,m.resetLoader(u,a),l(new b({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:u,part:S,networkDetails:j}))},onTimeout:function(M,F,j){m.resetLoader(u,a),l(new b({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:u,part:S,networkDetails:j}))}})})},o.updateStatsFromPart=function(u,S){var f=u.stats,m=S.stats,w=m.total;if(f.loaded+=m.loaded,w){var v=Math.round(u.duration/S.duration),h=Math.min(Math.round(f.loaded/w),v),c=v-h,l=c*Math.round(f.loaded/h);f.total=f.loaded+l}else f.total=Math.max(f.loaded,f.total);var a=f.loading,g=m.loading;a.start?a.first+=g.first-g.start:(a.start=g.start,a.first=g.first),a.end=g.end},o.resetLoader=function(u,S){u.loader=null,this.loader===S&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),S.destroy()},d}();function E(d,o){o===void 0&&(o=null);var s=o||d,u={frag:d,part:o,responseType:"arraybuffer",url:s.url,headers:{},rangeStart:0,rangeEnd:0},S=s.byteRangeStartOffset,f=s.byteRangeEndOffset;return Object(G.isFiniteNumber)(S)&&Object(G.isFiniteNumber)(f)&&(u.rangeStart=S,u.rangeEnd=f),u}var b=function(d){R(o,d);function o(s){for(var u,S=arguments.length,f=new Array(S>1?S-1:0),m=1;m<S;m++)f[m-1]=arguments[m];return u=d.call.apply(d,[this].concat(f))||this,u.data=void 0,u.data=s,u}return o}(B(Error))},"./src/loader/fragment.ts":function(ne,V,_){"use strict";_.r(V),_.d(V,"ElementaryStreamTypes",function(){return C}),_.d(V,"BaseSegment",function(){return E}),_.d(V,"Fragment",function(){return b}),_.d(V,"Part",function(){return d});var G=_("./src/polyfills/number.ts"),U=_("./node_modules/url-toolkit/src/url-toolkit.js"),R=_.n(U),B=_("./src/utils/logger.ts"),I=_("./src/loader/level-key.ts"),D=_("./src/loader/load-stats.ts");function L(o,s){o.prototype=Object.create(s.prototype),o.prototype.constructor=o,x(o,s)}function x(o,s){return x=Object.setPrototypeOf||function(S,f){return S.__proto__=f,S},x(o,s)}function A(o,s){for(var u=0;u<s.length;u++){var S=s[u];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(o,S.key,S)}}function k(o,s,u){return s&&A(o.prototype,s),u&&A(o,u),o}var C;(function(o){o.AUDIO="audio",o.VIDEO="video",o.AUDIOVIDEO="audiovideo"})(C||(C={}));var E=function(){function o(u){var S;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(S={},S[C.AUDIO]=null,S[C.VIDEO]=null,S[C.AUDIOVIDEO]=null,S),this.baseurl=u}var s=o.prototype;return s.setByteRange=function(S,f){var m=S.split("@",2),w=[];m.length===1?w[0]=f?f.byteRangeEndOffset:0:w[0]=parseInt(m[1]),w[1]=parseInt(m[0])+w[0],this._byteRange=w},k(o,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Object(U.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(S){this._url=S}}]),o}(),b=function(o){L(s,o);function s(S,f){var m;return m=o.call(this,f)||this,m._decryptdata=null,m.rawProgramDateTime=null,m.programDateTime=null,m.tagList=[],m.duration=0,m.sn=0,m.levelkey=void 0,m.type=void 0,m.loader=null,m.level=-1,m.cc=0,m.startPTS=void 0,m.endPTS=void 0,m.appendedPTS=void 0,m.startDTS=void 0,m.endDTS=void 0,m.start=0,m.deltaPTS=void 0,m.maxStartPTS=void 0,m.minEndPTS=void 0,m.stats=new D.LoadStats,m.urlId=0,m.data=void 0,m.bitrateTest=!1,m.title=null,m.initSegment=null,m.type=S,m}var u=s.prototype;return u.createInitializationVector=function(f){for(var m=new Uint8Array(16),w=12;w<16;w++)m[w]=f>>8*(15-w)&255;return m},u.setDecryptDataFromLevelKey=function(f,m){var w=f;return(f==null?void 0:f.method)==="AES-128"&&f.uri&&!f.iv&&(w=I.LevelKey.fromURI(f.uri),w.method=f.method,w.iv=this.createInitializationVector(m),w.keyFormat="identity"),w},u.setElementaryStreamInfo=function(f,m,w,v,h,c){c===void 0&&(c=!1);var l=this.elementaryStreams,a=l[f];if(!a){l[f]={startPTS:m,endPTS:w,startDTS:v,endDTS:h,partial:c};return}a.startPTS=Math.min(a.startPTS,m),a.endPTS=Math.max(a.endPTS,w),a.startDTS=Math.min(a.startDTS,v),a.endDTS=Math.max(a.endDTS,h)},u.clearElementaryStreamInfo=function(){var f=this.elementaryStreams;f[C.AUDIO]=null,f[C.VIDEO]=null,f[C.AUDIOVIDEO]=null},k(s,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var f=this.sn;typeof f!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&B.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),f=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,f)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(G.isFiniteNumber)(this.programDateTime))return null;var f=Object(G.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+f*1e3}},{key:"encrypted",get:function(){var f;return!!((f=this.decryptdata)!==null&&f!==void 0&&f.keyFormat&&this.decryptdata.uri)}}]),s}(E),d=function(o){L(s,o);function s(u,S,f,m,w){var v;v=o.call(this,f)||this,v.fragOffset=0,v.duration=0,v.gap=!1,v.independent=!1,v.relurl=void 0,v.fragment=void 0,v.index=void 0,v.stats=new D.LoadStats,v.duration=u.decimalFloatingPoint("DURATION"),v.gap=u.bool("GAP"),v.independent=u.bool("INDEPENDENT"),v.relurl=u.enumeratedString("URI"),v.fragment=S,v.index=m;var h=u.enumeratedString("BYTERANGE");return h&&v.setByteRange(h,w),w&&(v.fragOffset=w.fragOffset+w.duration),v}return k(s,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var S=this.elementaryStreams;return!!(S.audio||S.video||S.audiovideo)}}]),s}(E)},"./src/loader/key-loader.ts":function(ne,V,_){"use strict";_.r(V),_.d(V,"default",function(){return B});var G=_("./src/events.ts"),U=_("./src/errors.ts"),R=_("./src/utils/logger.ts"),B=function(){function I(L){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=L,this._registerListeners()}var D=I.prototype;return D._registerListeners=function(){this.hls.on(G.Events.KEY_LOADING,this.onKeyLoading,this)},D._unregisterListeners=function(){this.hls.off(G.Events.KEY_LOADING,this.onKeyLoading)},D.destroy=function(){this._unregisterListeners();for(var x in this.loaders){var A=this.loaders[x];A&&A.destroy()}this.loaders={}},D.onKeyLoading=function(x,A){var k=A.frag,C=k.type,E=this.loaders[C];if(!k.decryptdata){R.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var b=k.decryptdata.uri;if(b!==this.decrypturl||this.decryptkey===null){var d=this.hls.config;if(E&&(R.logger.warn("abort previous key loader for type:"+C),E.abort()),!b){R.logger.warn("key uri is falsy");return}var o=d.loader,s=k.loader=this.loaders[C]=new o(d);this.decrypturl=b,this.decryptkey=null;var u={url:b,frag:k,responseType:"arraybuffer"},S={timeout:d.fragLoadingTimeOut,maxRetry:0,retryDelay:d.fragLoadingRetryDelay,maxRetryDelay:d.fragLoadingMaxRetryTimeout,highWaterMark:0},f={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};s.load(u,S,f)}else this.decryptkey&&(k.decryptdata.key=this.decryptkey,this.hls.trigger(G.Events.KEY_LOADED,{frag:k}))},D.loadsuccess=function(x,A,k){var C=k.frag;if(!C.decryptdata){R.logger.error("after key load, decryptdata unset");return}this.decryptkey=C.decryptdata.key=new Uint8Array(x.data),C.loader=null,delete this.loaders[C.type],this.hls.trigger(G.Events.KEY_LOADED,{frag:C})},D.loaderror=function(x,A){var k=A.frag,C=k.loader;C&&C.abort(),delete this.loaders[k.type],this.hls.trigger(G.Events.ERROR,{type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:k,response:x})},D.loadtimeout=function(x,A){var k=A.frag,C=k.loader;C&&C.abort(),delete this.loaders[k.type],this.hls.trigger(G.Events.ERROR,{type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:k})},I}()},"./src/loader/level-details.ts":function(ne,V,_){"use strict";_.r(V),_.d(V,"LevelDetails",function(){return I});var G=_("./src/polyfills/number.ts");function U(D,L){for(var x=0;x<L.length;x++){var A=L[x];A.enumerable=A.enumerable||!1,A.configurable=!0,"value"in A&&(A.writable=!0),Object.defineProperty(D,A.key,A)}}function R(D,L,x){return L&&U(D.prototype,L),x&&U(D,x),D}var B=10,I=function(){function D(x){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.needSidxRanges=!1,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.fragments=[],this.url=x}var L=D.prototype;return L.reloaded=function(A){if(!A){this.advanced=!0,this.updated=!0;return}var k=this.lastPartSn-A.lastPartSn,C=this.lastPartIndex-A.lastPartIndex;this.updated=this.endSN!==A.endSN||!!C||!!k,this.advanced=this.endSN>A.endSN||k>0||k===0&&C>0,this.updated||this.advanced?this.misses=Math.floor(A.misses*.6):this.misses=A.misses+1,this.availabilityDelay=A.availabilityDelay},R(D,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(G.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||B}},{key:"drift",get:function(){var A=this.driftEndTime-this.driftStartTime;if(A>0){var k=this.driftEnd-this.driftStart;return k*1e3/A}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var A;return(A=this.partList)!==null&&A!==void 0&&A.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var A;return(A=this.fragments)!==null&&A!==void 0&&A.length?this.fragments[this.fragments.length-1].end:0}},{key:"age",get:function(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}},{key:"lastPartIndex",get:function(){var A;return(A=this.partList)!==null&&A!==void 0&&A.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var A;return(A=this.partList)!==null&&A!==void 0&&A.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),D}()},"./src/loader/level-key.ts":function(ne,V,_){"use strict";_.r(V),_.d(V,"LevelKey",function(){return I});var G=_("./node_modules/url-toolkit/src/url-toolkit.js"),U=_.n(G);function R(D,L){for(var x=0;x<L.length;x++){var A=L[x];A.enumerable=A.enumerable||!1,A.configurable=!0,"value"in A&&(A.writable=!0),Object.defineProperty(D,A.key,A)}}function B(D,L,x){return L&&R(D.prototype,L),x&&R(D,x),D}var I=function(){D.fromURL=function(x,A){return new D(x,A)},D.fromURI=function(x){return new D(x)};function D(L,x){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,x?this._uri=Object(G.buildAbsoluteURL)(L,x,{alwaysNormalize:!0}):this._uri=L}return B(D,[{key:"uri",get:function(){return this._uri}}]),D}()},"./src/loader/load-stats.ts":function(ne,V,_){"use strict";_.r(V),_.d(V,"LoadStats",function(){return G});var G=function(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}},"./src/loader/m3u8-parser.ts":function(ne,V,_){"use strict";_.r(V),_.d(V,"default",function(){return s});var G=_("./src/polyfills/number.ts"),U=_("./node_modules/url-toolkit/src/url-toolkit.js"),R=_.n(U),B=_("./src/loader/fragment.ts"),I=_("./src/loader/level-details.ts"),D=_("./src/loader/level-key.ts"),L=_("./src/utils/attr-list.ts"),x=_("./src/utils/logger.ts"),A=_("./src/utils/codecs.ts"),k=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,C=/#EXT-X-MEDIA:(.*)/g,E=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),b=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(PLAYLIST-TYPE):(.+)/.source,/#EXT-X-(MEDIA-SEQUENCE): *(\d+)/.source,/#EXT-X-(SKIP):(.+)/.source,/#EXT-X-(TARGETDURATION): *(\d+)/.source,/#EXT-X-(KEY):(.+)/.source,/#EXT-X-(START):(.+)/.source,/#EXT-X-(ENDLIST)/.source,/#EXT-X-(DISCONTINUITY-SEQ)UENCE: *(\d+)/.source,/#EXT-X-(DIS)CONTINUITY/.source,/#EXT-X-(VERSION):(\d+)/.source,/#EXT-X-(MAP):(.+)/.source,/#EXT-X-(SERVER-CONTROL):(.+)/.source,/#EXT-X-(PART-INF):(.+)/.source,/#EXT-X-(GAP)/.source,/#EXT-X-(BITRATE):\s*(\d+)/.source,/#EXT-X-(PART):(.+)/.source,/#EXT-X-(PRELOAD-HINT):(.+)/.source,/#EXT-X-(RENDITION-REPORT):(.+)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),d=/\.(mp4|m4s|m4v|m4a)$/i;function o(w){var v,h;return d.test((v=(h=U.parseURL(w))===null||h===void 0?void 0:h.path)!=null?v:"")}var s=function(){function w(){}return w.findGroup=function(h,c){for(var l=0;l<h.length;l++){var a=h[l];if(a.id===c)return a}},w.convertAVC1ToAVCOTI=function(h){var c=h.split(".");if(c.length>2){var l=c.shift()+".";return l+=parseInt(c.shift()).toString(16),l+=("000"+parseInt(c.shift()).toString(16)).substr(-4),l}return h},w.resolve=function(h,c){return U.buildAbsoluteURL(c,h,{alwaysNormalize:!0})},w.parseMasterPlaylist=function(h,c){var l=[],a={},g=!1;k.lastIndex=0;for(var p;(p=k.exec(h))!=null;)if(p[1]){var y=new L.AttrList(p[1]),M={attrs:y,bitrate:y.decimalInteger("AVERAGE-BANDWIDTH")||y.decimalInteger("BANDWIDTH"),name:y.NAME,url:w.resolve(p[2],c)},F=y.decimalResolution("RESOLUTION");F&&(M.width=F.width,M.height=F.height),u((y.CODECS||"").split(/[ ,]+/).filter(function(W){return W}),M),M.videoCodec&&M.videoCodec.indexOf("avc1")!==-1&&(M.videoCodec=w.convertAVC1ToAVCOTI(M.videoCodec)),l.push(M)}else if(p[3]){var j=new L.AttrList(p[3]);j["DATA-ID"]&&(g=!0,a[j["DATA-ID"]]=j)}return{levels:l,sessionData:g?a:null}},w.parseMasterPlaylistMedia=function(h,c,l,a){a===void 0&&(a=[]);var g,p=[],y=0;for(C.lastIndex=0;(g=C.exec(h))!==null;){var M=new L.AttrList(g[1]);if(M.TYPE===l){var F={attrs:M,bitrate:0,id:y++,groupId:M["GROUP-ID"],instreamId:M["INSTREAM-ID"],name:M.NAME||M.LANGUAGE||"",type:l,default:M.bool("DEFAULT"),autoselect:M.bool("AUTOSELECT"),forced:M.bool("FORCED"),lang:M.LANGUAGE,url:M.URI?w.resolve(M.URI,c):""};if(a.length){var j=w.findGroup(a,F.groupId)||a[0];S(F,j,"audioCodec"),S(F,j,"textCodec")}p.push(F)}}return p},w.parseLevelPlaylist=function(h,c,l,a,g){var p=new I.LevelDetails(c),y=p.fragments,M=null,F=0,j=0,W=0,O=0,P=null,H=new B.Fragment(a,c),X,q,re,Ee=-1,he=!1;for(E.lastIndex=0,p.m3u8=h;(X=E.exec(h))!==null;){he&&(he=!1,H=new B.Fragment(a,c),H.start=W,H.sn=F,H.cc=O,H.level=l,M&&(H.initSegment=M,H.rawProgramDateTime=M.rawProgramDateTime));var xe=X[1];if(xe){H.duration=parseFloat(xe);var pe=(" "+X[2]).slice(1);H.title=pe||null,H.tagList.push(pe?["INF",xe,pe]:["INF",xe])}else if(X[3])Object(G.isFiniteNumber)(H.duration)&&(H.start=W,re&&(H.levelkey=re),H.sn=F,H.level=l,H.cc=O,H.urlId=g,y.push(H),H.relurl=(" "+X[3]).slice(1),m(H,P),P=H,W+=H.duration,F++,j=0,he=!0);else if(X[4]){var ve=(" "+X[4]).slice(1);P?H.setByteRange(ve,P):H.setByteRange(ve)}else if(X[5])H.rawProgramDateTime=(" "+X[5]).slice(1),H.tagList.push(["PROGRAM-DATE-TIME",H.rawProgramDateTime]),Ee===-1&&(Ee=y.length);else{if(X=X[0].match(b),!X){x.logger.warn("No matches on slow regex match for level playlist!");continue}for(q=1;q<X.length&&!(typeof X[q]!="undefined");q++);var ce=(" "+X[q]).slice(1),fe=(" "+X[q+1]).slice(1),$=X[q+2]?(" "+X[q+2]).slice(1):"";switch(ce){case"PLAYLIST-TYPE":p.type=fe.toUpperCase();break;case"MEDIA-SEQUENCE":F=p.startSN=parseInt(fe);break;case"SKIP":{var ae=new L.AttrList(fe),Z=ae.decimalInteger("SKIPPED-SEGMENTS");if(Object(G.isFiniteNumber)(Z)){p.skippedSegments=Z;for(var ge=Z;ge--;)y.unshift(null);F+=Z}var Se=ae.enumeratedString("RECENTLY-REMOVED-DATERANGES");Se&&(p.recentlyRemovedDateranges=Se.split(" "));break}case"TARGETDURATION":p.targetduration=parseFloat(fe);break;case"VERSION":p.version=parseInt(fe);break;case"EXTM3U":break;case"ENDLIST":p.live=!1;break;case"#":(fe||$)&&H.tagList.push($?[fe,$]:[fe]);break;case"DIS":O++;case"GAP":H.tagList.push([ce]);break;case"BITRATE":H.tagList.push([ce,fe]);break;case"DISCONTINUITY-SEQ":O=parseInt(fe);break;case"KEY":{var me,we=new L.AttrList(fe),De=we.enumeratedString("METHOD"),Oe=we.URI,ke=we.hexadecimalInteger("IV"),Le=we.enumeratedString("KEYFORMATVERSIONS"),_e=we.enumeratedString("KEYID"),ze=(me=we.enumeratedString("KEYFORMAT"))!=null?me:"identity",Xe=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(Xe.indexOf(ze)>-1){x.logger.warn("Keyformat "+ze+" is not supported from the manifest");continue}else if(ze!=="identity")continue;De&&(re=D.LevelKey.fromURL(c,Oe),Oe&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(De)>=0&&(re.method=De,re.keyFormat=ze,_e&&(re.keyID=_e),Le&&(re.keyFormatVersions=Le),re.iv=ke));break}case"START":{var Ve=new L.AttrList(fe),je=Ve.decimalFloatingPoint("TIME-OFFSET");Object(G.isFiniteNumber)(je)&&(p.startTimeOffset=je);break}case"MAP":{var qe=new L.AttrList(fe);H.relurl=qe.URI,qe.BYTERANGE&&H.setByteRange(qe.BYTERANGE),H.level=l,H.sn="initSegment",re&&(H.levelkey=re),H.initSegment=null,M=H,he=!0;break}case"SERVER-CONTROL":{var He=new L.AttrList(fe);p.canBlockReload=He.bool("CAN-BLOCK-RELOAD"),p.canSkipUntil=He.optionalFloat("CAN-SKIP-UNTIL",0),p.canSkipDateRanges=p.canSkipUntil>0&&He.bool("CAN-SKIP-DATERANGES"),p.partHoldBack=He.optionalFloat("PART-HOLD-BACK",0),p.holdBack=He.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var $e=new L.AttrList(fe);p.partTarget=$e.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Ae=p.partList;Ae||(Ae=p.partList=[]);var Ze=j>0?Ae[Ae.length-1]:void 0,Je=j++,Re=new B.Part(new L.AttrList(fe),H,c,Je,Ze);Ae.push(Re),H.duration+=Re.duration;break}case"PRELOAD-HINT":{var Fe=new L.AttrList(fe);p.preloadHint=Fe;break}case"RENDITION-REPORT":{var se=new L.AttrList(fe);p.renditionReports=p.renditionReports||[],p.renditionReports.push(se);break}default:x.logger.warn("line parsed but not handled: "+X);break}}}P&&!P.relurl?(y.pop(),W-=P.duration,p.partList&&(p.fragmentHint=P)):p.partList&&(m(H,P),H.cc=O,p.fragmentHint=H);var le=y.length,ue=y[0],J=y[le-1];if(W+=p.skippedSegments*p.targetduration,W>0&&le&&J){p.averagetargetduration=W/le;var Q=J.sn;p.endSN=Q!=="initSegment"?Q:0,ue&&(p.startCC=ue.cc,ue.initSegment||p.fragments.every(function(te){return te.relurl&&o(te.relurl)})&&(x.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),H=new B.Fragment(a,c),H.relurl=J.relurl,H.level=l,H.sn="initSegment",ue.initSegment=H,p.needSidxRanges=!0))}else p.endSN=0,p.startCC=0;return p.fragmentHint&&(W+=p.fragmentHint.duration),p.totalduration=W,p.endCC=O,Ee>0&&f(y,Ee),p},w}();function u(w,v){["video","audio","text"].forEach(function(h){var c=w.filter(function(a){return Object(A.isCodecType)(a,h)});if(c.length){var l=c.filter(function(a){return a.lastIndexOf("avc1",0)===0||a.lastIndexOf("mp4a",0)===0});v[h+"Codec"]=l.length>0?l[0]:c[0],w=w.filter(function(a){return c.indexOf(a)===-1})}}),v.unknownCodecs=w}function S(w,v,h){var c=v[h];c&&(w[h]=c)}function f(w,v){for(var h=w[v],c=v;c--;){var l=w[c];if(!l)return;l.programDateTime=h.programDateTime-l.duration*1e3,h=l}}function m(w,v){w.rawProgramDateTime?w.programDateTime=Date.parse(w.rawProgramDateTime):v!=null&&v.programDateTime&&(w.programDateTime=v.endProgramDateTime),Object(G.isFiniteNumber)(w.programDateTime)||(w.programDateTime=null,w.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(ne,V,_){"use strict";_.r(V);var G=_("./src/polyfills/number.ts"),U=_("./src/events.ts"),R=_("./src/errors.ts"),B=_("./src/utils/logger.ts"),I=_("./src/utils/mp4-tools.ts"),D=_("./src/loader/m3u8-parser.ts"),L=_("./src/types/loader.ts"),x=_("./src/utils/attr-list.ts");function A(E){var b=E.type;switch(b){case L.PlaylistContextType.AUDIO_TRACK:return L.PlaylistLevelType.AUDIO;case L.PlaylistContextType.SUBTITLE_TRACK:return L.PlaylistLevelType.SUBTITLE;default:return L.PlaylistLevelType.MAIN}}function k(E,b){var d=E.url;return(d===void 0||d.indexOf("data:")===0)&&(d=b.url),d}var C=function(){function E(d){this.hls=void 0,this.loaders=Object.create(null),this.hls=d,this.registerListeners()}var b=E.prototype;return b.registerListeners=function(){var o=this.hls;o.on(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(U.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(U.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.on(U.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},b.unregisterListeners=function(){var o=this.hls;o.off(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(U.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(U.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.off(U.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},b.createInternalLoader=function(o){var s=this.hls.config,u=s.pLoader,S=s.loader,f=u||S,m=new f(s);return o.loader=m,this.loaders[o.type]=m,m},b.getInternalLoader=function(o){return this.loaders[o.type]},b.resetInternalLoader=function(o){this.loaders[o]&&delete this.loaders[o]},b.destroyInternalLoaders=function(){for(var o in this.loaders){var s=this.loaders[o];s&&s.destroy(),this.resetInternalLoader(o)}},b.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},b.onManifestLoading=function(o,s){var u=s.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:L.PlaylistContextType.MANIFEST,url:u,deliveryDirectives:null})},b.onLevelLoading=function(o,s){var u=s.id,S=s.level,f=s.url,m=s.deliveryDirectives;this.load({id:u,groupId:null,level:S,responseType:"text",type:L.PlaylistContextType.LEVEL,url:f,deliveryDirectives:m})},b.onAudioTrackLoading=function(o,s){var u=s.id,S=s.groupId,f=s.url,m=s.deliveryDirectives;this.load({id:u,groupId:S,level:null,responseType:"text",type:L.PlaylistContextType.AUDIO_TRACK,url:f,deliveryDirectives:m})},b.onSubtitleTrackLoading=function(o,s){var u=s.id,S=s.groupId,f=s.url,m=s.deliveryDirectives;this.load({id:u,groupId:S,level:null,responseType:"text",type:L.PlaylistContextType.SUBTITLE_TRACK,url:f,deliveryDirectives:m})},b.load=function(o){var s,u=this.hls.config,S=this.getInternalLoader(o);if(S){var f=S.context;if(f&&f.url===o.url){B.logger.trace("[playlist-loader]: playlist request ongoing");return}B.logger.log("[playlist-loader]: aborting previous loader for type: "+o.type),S.abort()}var m,w,v,h;switch(o.type){case L.PlaylistContextType.MANIFEST:m=u.manifestLoadingMaxRetry,w=u.manifestLoadingTimeOut,v=u.manifestLoadingRetryDelay,h=u.manifestLoadingMaxRetryTimeout;break;case L.PlaylistContextType.LEVEL:case L.PlaylistContextType.AUDIO_TRACK:case L.PlaylistContextType.SUBTITLE_TRACK:m=0,w=u.levelLoadingTimeOut;break;default:m=u.levelLoadingMaxRetry,w=u.levelLoadingTimeOut,v=u.levelLoadingRetryDelay,h=u.levelLoadingMaxRetryTimeout;break}if(S=this.createInternalLoader(o),(s=o.deliveryDirectives)!==null&&s!==void 0&&s.part){var c;if(o.type===L.PlaylistContextType.LEVEL&&o.level!==null?c=this.hls.levels[o.level].details:o.type===L.PlaylistContextType.AUDIO_TRACK&&o.id!==null?c=this.hls.audioTracks[o.id].details:o.type===L.PlaylistContextType.SUBTITLE_TRACK&&o.id!==null&&(c=this.hls.subtitleTracks[o.id].details),c){var l=c.partTarget,a=c.targetduration;l&&a&&(w=Math.min(Math.max(l*3,a*.8)*1e3,w))}}var g={timeout:w,maxRetry:m,retryDelay:v,maxRetryDelay:h,highWaterMark:0},p={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};S.load(o,g,p)},b.loadsuccess=function(o,s,u,S){if(S===void 0&&(S=null),u.isSidxRequest){this.handleSidxRequest(o,u),this.handlePlaylistLoaded(o,s,u,S);return}this.resetInternalLoader(u.type);var f=o.data;if(f.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(o,u,"no EXTM3U delimiter",S);return}s.parsing.start=performance.now(),f.indexOf("#EXTINF:")>0||f.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(o,s,u,S):this.handleMasterPlaylist(o,s,u,S)},b.loaderror=function(o,s,u){u===void 0&&(u=null),this.handleNetworkError(s,u,!1,o)},b.loadtimeout=function(o,s,u){u===void 0&&(u=null),this.handleNetworkError(s,u,!0)},b.handleMasterPlaylist=function(o,s,u,S){var f=this.hls,m=o.data,w=k(o,u),v=D.default.parseMasterPlaylist(m,w),h=v.levels,c=v.sessionData;if(!h.length){this.handleManifestParsingError(o,u,"no level found in manifest",S);return}var l=h.map(function(F){return{id:F.attrs.AUDIO,audioCodec:F.audioCodec}}),a=h.map(function(F){return{id:F.attrs.SUBTITLES,textCodec:F.textCodec}}),g=D.default.parseMasterPlaylistMedia(m,w,"AUDIO",l),p=D.default.parseMasterPlaylistMedia(m,w,"SUBTITLES",a),y=D.default.parseMasterPlaylistMedia(m,w,"CLOSED-CAPTIONS");if(g.length){var M=g.some(function(F){return!F.url});!M&&h[0].audioCodec&&!h[0].attrs.AUDIO&&(B.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),g.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new x.AttrList({}),bitrate:0,url:""}))}f.trigger(U.Events.MANIFEST_LOADED,{levels:h,audioTracks:g,subtitles:p,captions:y,url:w,stats:s,networkDetails:S,sessionData:c})},b.handleTrackOrLevelPlaylist=function(o,s,u,S){var f=this.hls,m=u.id,w=u.level,v=u.type,h=k(o,u),c=Object(G.isFiniteNumber)(m)?m:0,l=Object(G.isFiniteNumber)(w)?w:c,a=A(u),g=D.default.parseLevelPlaylist(o.data,h,l,a,c);if(!g.fragments.length){f.trigger(U.Events.ERROR,{type:R.ErrorTypes.NETWORK_ERROR,details:R.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:h,reason:"no fragments found in level",level:typeof u.level=="number"?u.level:void 0});return}if(v===L.PlaylistContextType.MANIFEST){var p={attrs:new x.AttrList({}),bitrate:0,details:g,name:"",url:h};f.trigger(U.Events.MANIFEST_LOADED,{levels:[p],audioTracks:[],url:h,stats:s,networkDetails:S,sessionData:null})}if(s.parsing.end=performance.now(),g.needSidxRanges){var y,M=(y=g.fragments[0].initSegment)===null||y===void 0?void 0:y.url;this.load({url:M,isSidxRequest:!0,type:v,level:w,levelDetails:g,id:m,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}u.levelDetails=g,this.handlePlaylistLoaded(o,s,u,S)},b.handleSidxRequest=function(o,s){var u=Object(I.parseSegmentIndex)(new Uint8Array(o.data));if(!u)return;var S=u.references,f=s.levelDetails;S.forEach(function(m,w){var v=m.info,h=f.fragments[w];h.byteRange.length===0&&h.setByteRange(String(1+v.end-v.start)+"@"+String(v.start)),h.initSegment&&h.initSegment.setByteRange(String(u.moovEndOffset)+"@0")})},b.handleManifestParsingError=function(o,s,u,S){this.hls.trigger(U.Events.ERROR,{type:R.ErrorTypes.NETWORK_ERROR,details:R.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:s.type===L.PlaylistContextType.MANIFEST,url:o.url,reason:u,response:o,context:s,networkDetails:S})},b.handleNetworkError=function(o,s,u,S){u===void 0&&(u=!1),B.logger.warn("[playlist-loader]: A network "+(u?"timeout":"error")+" occurred while loading "+o.type+" level: "+o.level+" id: "+o.id+' group-id: "'+o.groupId+'"');var f=R.ErrorDetails.UNKNOWN,m=!1,w=this.getInternalLoader(o);switch(o.type){case L.PlaylistContextType.MANIFEST:f=u?R.ErrorDetails.MANIFEST_LOAD_TIMEOUT:R.ErrorDetails.MANIFEST_LOAD_ERROR,m=!0;break;case L.PlaylistContextType.LEVEL:f=u?R.ErrorDetails.LEVEL_LOAD_TIMEOUT:R.ErrorDetails.LEVEL_LOAD_ERROR,m=!1;break;case L.PlaylistContextType.AUDIO_TRACK:f=u?R.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:R.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,m=!1;break;case L.PlaylistContextType.SUBTITLE_TRACK:f=u?R.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:R.ErrorDetails.SUBTITLE_LOAD_ERROR,m=!1;break}w&&this.resetInternalLoader(o.type);var v={type:R.ErrorTypes.NETWORK_ERROR,details:f,fatal:m,url:o.url,loader:w,context:o,networkDetails:s};S&&(v.response=S),this.hls.trigger(U.Events.ERROR,v)},b.handlePlaylistLoaded=function(o,s,u,S){var f=u.type,m=u.level,w=u.id,v=u.groupId,h=u.loader,c=u.levelDetails,l=u.deliveryDirectives;if(!(c!=null&&c.targetduration)){this.handleManifestParsingError(o,u,"invalid target duration",S);return}if(!h)return;c.live&&(h.getCacheAge&&(c.ageHeader=h.getCacheAge()||0),(!h.getCacheAge||isNaN(c.ageHeader))&&(c.ageHeader=0));switch(f){case L.PlaylistContextType.MANIFEST:case L.PlaylistContextType.LEVEL:this.hls.trigger(U.Events.LEVEL_LOADED,{details:c,level:m||0,id:w||0,stats:s,networkDetails:S,deliveryDirectives:l});break;case L.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(U.Events.AUDIO_TRACK_LOADED,{details:c,id:w||0,groupId:v||"",stats:s,networkDetails:S,deliveryDirectives:l});break;case L.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(U.Events.SUBTITLE_TRACK_LOADED,{details:c,id:w||0,groupId:v||"",stats:s,networkDetails:S,deliveryDirectives:l});break}},E}();V.default=C},"./src/polyfills/number.ts":function(ne,V,_){"use strict";_.r(V),_.d(V,"isFiniteNumber",function(){return G}),_.d(V,"MAX_SAFE_INTEGER",function(){return U});var G=Number.isFinite||function(R){return typeof R=="number"&&isFinite(R)},U=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(ne,V,_){"use strict";_.r(V);var G=function(){function U(){}return U.getSilentFrame=function(B,I){switch(B){case"mp4a.40.2":if(I===1)return new Uint8Array([0,200,0,128,35,128]);if(I===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(I===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(I===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(I===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(I===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(I===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(I===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(I===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}return},U}();V.default=G},"./src/remux/mp4-generator.ts":function(ne,V,_){"use strict";_.r(V);var G=Math.pow(2,32)-1,U=function(){function R(){}return R.init=function(){R.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var I;for(I in R.types)R.types.hasOwnProperty(I)&&(R.types[I]=[I.charCodeAt(0),I.charCodeAt(1),I.charCodeAt(2),I.charCodeAt(3)]);var D=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),L=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);R.HDLR_TYPES={video:D,audio:L};var x=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),A=new Uint8Array([0,0,0,0,0,0,0,0]);R.STTS=R.STSC=R.STCO=A,R.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),R.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),R.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),R.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var k=new Uint8Array([105,115,111,109]),C=new Uint8Array([97,118,99,49]),E=new Uint8Array([0,0,0,1]);R.FTYP=R.box(R.types.ftyp,k,E,k,C),R.DINF=R.box(R.types.dinf,R.box(R.types.dref,x))},R.box=function(I){for(var D=8,L=arguments.length,x=new Array(L>1?L-1:0),A=1;A<L;A++)x[A-1]=arguments[A];for(var k=x.length,C=k;k--;)D+=x[k].byteLength;var E=new Uint8Array(D);for(E[0]=D>>24&255,E[1]=D>>16&255,E[2]=D>>8&255,E[3]=D&255,E.set(I,4),k=0,D=8;k<C;k++)E.set(x[k],D),D+=x[k].byteLength;return E},R.hdlr=function(I){return R.box(R.types.hdlr,R.HDLR_TYPES[I])},R.mdat=function(I){return R.box(R.types.mdat,I)},R.mdhd=function(I,D){D*=I;var L=Math.floor(D/(G+1)),x=Math.floor(D%(G+1));return R.box(R.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,I>>24&255,I>>16&255,I>>8&255,I&255,L>>24,L>>16&255,L>>8&255,L&255,x>>24,x>>16&255,x>>8&255,x&255,85,196,0,0]))},R.mdia=function(I){return R.box(R.types.mdia,R.mdhd(I.timescale,I.duration),R.hdlr(I.type),R.minf(I))},R.mfhd=function(I){return R.box(R.types.mfhd,new Uint8Array([0,0,0,0,I>>24,I>>16&255,I>>8&255,I&255]))},R.minf=function(I){return I.type==="audio"?R.box(R.types.minf,R.box(R.types.smhd,R.SMHD),R.DINF,R.stbl(I)):R.box(R.types.minf,R.box(R.types.vmhd,R.VMHD),R.DINF,R.stbl(I))},R.moof=function(I,D,L){return R.box(R.types.moof,R.mfhd(I),R.traf(L,D))},R.moov=function(I){for(var D=I.length,L=[];D--;)L[D]=R.trak(I[D]);return R.box.apply(null,[R.types.moov,R.mvhd(I[0].timescale,I[0].duration)].concat(L).concat(R.mvex(I)))},R.mvex=function(I){for(var D=I.length,L=[];D--;)L[D]=R.trex(I[D]);return R.box.apply(null,[R.types.mvex].concat(L))},R.mvhd=function(I,D){D*=I;var L=Math.floor(D/(G+1)),x=Math.floor(D%(G+1)),A=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,I>>24&255,I>>16&255,I>>8&255,I&255,L>>24,L>>16&255,L>>8&255,L&255,x>>24,x>>16&255,x>>8&255,x&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return R.box(R.types.mvhd,A)},R.sdtp=function(I){var D=I.samples||[],L=new Uint8Array(4+D.length),x,A;for(x=0;x<D.length;x++)A=D[x].flags,L[x+4]=A.dependsOn<<4|A.isDependedOn<<2|A.hasRedundancy;return R.box(R.types.sdtp,L)},R.stbl=function(I){return R.box(R.types.stbl,R.stsd(I),R.box(R.types.stts,R.STTS),R.box(R.types.stsc,R.STSC),R.box(R.types.stsz,R.STSZ),R.box(R.types.stco,R.STCO))},R.avc1=function(I){var D=[],L=[],x,A,k;for(x=0;x<I.sps.length;x++)A=I.sps[x],k=A.byteLength,D.push(k>>>8&255),D.push(k&255),D=D.concat(Array.prototype.slice.call(A));for(x=0;x<I.pps.length;x++)A=I.pps[x],k=A.byteLength,L.push(k>>>8&255),L.push(k&255),L=L.concat(Array.prototype.slice.call(A));var C=R.box(R.types.avcC,new Uint8Array([1,D[3],D[4],D[5],252|3,224|I.sps.length].concat(D).concat([I.pps.length]).concat(L))),E=I.width,b=I.height,d=I.pixelRatio[0],o=I.pixelRatio[1];return R.box(R.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,E>>8&255,E&255,b>>8&255,b&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),C,R.box(R.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),R.box(R.types.pasp,new Uint8Array([d>>24,d>>16&255,d>>8&255,d&255,o>>24,o>>16&255,o>>8&255,o&255])))},R.esds=function(I){var D=I.config.length;return new Uint8Array([0,0,0,0,3,23+D,0,1,0,4,15+D,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([D]).concat(I.config).concat([6,1,2]))},R.mp4a=function(I){var D=I.samplerate;return R.box(R.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,I.channelCount,0,16,0,0,0,0,D>>8&255,D&255,0,0]),R.box(R.types.esds,R.esds(I)))},R.mp3=function(I){var D=I.samplerate;return R.box(R.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,I.channelCount,0,16,0,0,0,0,D>>8&255,D&255,0,0]))},R.stsd=function(I){return I.type==="audio"?!I.isAAC&&I.codec==="mp3"?R.box(R.types.stsd,R.STSD,R.mp3(I)):R.box(R.types.stsd,R.STSD,R.mp4a(I)):R.box(R.types.stsd,R.STSD,R.avc1(I))},R.tkhd=function(I){var D=I.id,L=I.duration*I.timescale,x=I.width,A=I.height,k=Math.floor(L/(G+1)),C=Math.floor(L%(G+1));return R.box(R.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,D>>24&255,D>>16&255,D>>8&255,D&255,0,0,0,0,k>>24,k>>16&255,k>>8&255,k&255,C>>24,C>>16&255,C>>8&255,C&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,x>>8&255,x&255,0,0,A>>8&255,A&255,0,0]))},R.traf=function(I,D){var L=R.sdtp(I),x=I.id,A=Math.floor(D/(G+1)),k=Math.floor(D%(G+1));return R.box(R.types.traf,R.box(R.types.tfhd,new Uint8Array([0,0,0,0,x>>24,x>>16&255,x>>8&255,x&255])),R.box(R.types.tfdt,new Uint8Array([1,0,0,0,A>>24,A>>16&255,A>>8&255,A&255,k>>24,k>>16&255,k>>8&255,k&255])),R.trun(I,L.length+16+20+8+16+8+8),L)},R.trak=function(I){return I.duration=I.duration||4294967295,R.box(R.types.trak,R.tkhd(I),R.mdia(I))},R.trex=function(I){var D=I.id;return R.box(R.types.trex,new Uint8Array([0,0,0,0,D>>24,D>>16&255,D>>8&255,D&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},R.trun=function(I,D){var L=I.samples||[],x=L.length,A=12+16*x,k=new Uint8Array(A),C,E,b,d,o,s;for(D+=8+A,k.set([0,0,15,1,x>>>24&255,x>>>16&255,x>>>8&255,x&255,D>>>24&255,D>>>16&255,D>>>8&255,D&255],0),C=0;C<x;C++)E=L[C],b=E.duration,d=E.size,o=E.flags,s=E.cts,k.set([b>>>24&255,b>>>16&255,b>>>8&255,b&255,d>>>24&255,d>>>16&255,d>>>8&255,d&255,o.isLeading<<2|o.dependsOn,o.isDependedOn<<6|o.hasRedundancy<<4|o.paddingValue<<1|o.isNonSync,o.degradPrio&240<<8,o.degradPrio&15,s>>>24&255,s>>>16&255,s>>>8&255,s&255],12+16*C);return R.box(R.types.trun,k)},R.initSegment=function(I){R.types||R.init();var D=R.moov(I),L=new Uint8Array(R.FTYP.byteLength+D.byteLength);return L.set(R.FTYP),L.set(D,R.FTYP.byteLength),L},R}();U.types=void 0,U.HDLR_TYPES=void 0,U.STTS=void 0,U.STSC=void 0,U.STCO=void 0,U.STSZ=void 0,U.VMHD=void 0,U.SMHD=void 0,U.STSD=void 0,U.FTYP=void 0,U.DINF=void 0,V.default=U},"./src/remux/mp4-remuxer.ts":function(ne,V,_){"use strict";_.r(V),_.d(V,"default",function(){return s}),_.d(V,"normalizePts",function(){return u});var G=_("./src/polyfills/number.ts"),U=_("./src/remux/aac-helper.ts"),R=_("./src/remux/mp4-generator.ts"),B=_("./src/events.ts"),I=_("./src/errors.ts"),D=_("./src/utils/logger.ts"),L=_("./src/types/loader.ts"),x=_("./src/utils/timescale-conversion.ts");function A(){return A=Object.assign||function(w){for(var v=1;v<arguments.length;v++){var h=arguments[v];for(var c in h)Object.prototype.hasOwnProperty.call(h,c)&&(w[c]=h[c])}return w},A.apply(this,arguments)}var k=10*1e3,C=1024,E=1152,b=null,d=null,o=!1,s=function(){function w(h,c,l,a){if(a===void 0&&(a=""),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=h,this.config=c,this.typeSupported=l,this.ISGenerated=!1,b===null){var g=navigator.userAgent||"",p=g.match(/Chrome\/(\d+)/i);b=p?parseInt(p[1]):0}if(d===null){var y=navigator.userAgent.match(/Safari\/(\d+)/i);d=y?parseInt(y[1]):0}o=!!b&&b<75||!!d&&d<600}var v=w.prototype;return v.destroy=function(){},v.resetTimeStamp=function(c){D.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=c},v.resetNextTimestamp=function(){D.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},v.resetInitSegment=function(){D.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},v.getVideoStartPts=function(c){var l=!1,a=c.reduce(function(g,p){var y=p.pts-g;return y<-4294967296?(l=!0,u(g,p.pts)):y>0?g:p.pts},c[0].pts);return l&&D.logger.debug("PTS rollover detected"),a},v.remux=function(c,l,a,g,p,y,M,F){var j,W,O,P,H,X,q=p,re=p,Ee=c.pid>-1,he=l.pid>-1,xe=l.samples.length,pe=c.samples.length>0,ve=xe>1,ce=(!Ee||pe)&&(!he||ve)||this.ISGenerated||M;if(ce){this.ISGenerated||(O=this.generateIS(c,l,p));var fe=this.isVideoContiguous,$=-1;if(ve&&($=S(l.samples),!fe&&this.config.forceKeyFrameOnDiscontinuity))if(X=!0,$>0){D.logger.warn("[mp4-remuxer]: Dropped "+$+" out of "+xe+" video samples due to a missing keyframe");var ae=this.getVideoStartPts(l.samples);l.samples=l.samples.slice($),l.dropped+=$,re+=(l.samples[0].pts-ae)/(l.timescale||9e4)}else $===-1&&(D.logger.warn("[mp4-remuxer]: No keyframe found out of "+xe+" video samples"),X=!1);if(this.ISGenerated){if(pe&&ve){var Z=this.getVideoStartPts(l.samples),ge=u(c.samples[0].pts,Z)-Z,Se=ge/l.inputTimeScale;q+=Math.max(0,Se),re+=Math.max(0,-Se)}if(pe){if(c.samplerate||(D.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),O=this.generateIS(c,l,p)),W=this.remuxAudio(c,q,this.isAudioContiguous,y,he||ve||F===L.PlaylistLevelType.AUDIO?re:void 0),ve){var me=W?W.endPTS-W.startPTS:0;l.inputTimeScale||(D.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),O=this.generateIS(c,l,p)),j=this.remuxVideo(l,re,fe,me)}}else ve&&(j=this.remuxVideo(l,re,fe,0));j&&(j.firstKeyFrame=$,j.independent=$!==-1)}}return this.ISGenerated&&(a.samples.length&&(H=this.remuxID3(a,p)),g.samples.length&&(P=this.remuxText(g,p))),{audio:W,video:j,initSegment:O,independent:X,text:P,id3:H}},v.generateIS=function(c,l,a){var g=c.samples,p=l.samples,y=this.typeSupported,M={},F=!Object(G.isFiniteNumber)(this._initPTS),j="audio/mp4",W,O,P;if(F&&(W=O=Infinity),c.config&&g.length&&(c.timescale=c.samplerate,c.isAAC||(y.mpeg?(j="audio/mpeg",c.codec=""):y.mp3&&(c.codec="mp3")),M.audio={id:"audio",container:j,codec:c.codec,initSegment:!c.isAAC&&y.mpeg?new Uint8Array(0):R.default.initSegment([c]),metadata:{channelCount:c.channelCount}},F&&(P=c.inputTimeScale,W=O=g[0].pts-Math.round(P*a))),l.sps&&l.pps&&p.length&&(l.timescale=l.inputTimeScale,M.video={id:"main",container:"video/mp4",codec:l.codec,initSegment:R.default.initSegment([l]),metadata:{width:l.width,height:l.height}},F)){P=l.inputTimeScale;var H=this.getVideoStartPts(p),X=Math.round(P*a);O=Math.min(O,u(p[0].dts,H)-X),W=Math.min(W,H-X)}if(Object.keys(M).length)return this.ISGenerated=!0,F&&(this._initPTS=W,this._initDTS=O),{tracks:M,initPTS:W,timescale:P}},v.remuxVideo=function(c,l,a,g){var p=c.inputTimeScale,y=c.samples,M=[],F=y.length,j=this._initPTS,W=this.nextAvcDts,O=8,P,H,X,q=Number.POSITIVE_INFINITY,re=Number.NEGATIVE_INFINITY,Ee=0,he=!1;if(!a||W===null){var xe=l*p,pe=y[0].pts-u(y[0].dts,y[0].pts);W=xe-pe}for(var ve=0;ve<F;ve++){var ce=y[ve];if(ce.pts=u(ce.pts-j,W),ce.dts=u(ce.dts-j,W),ce.dts>ce.pts){var fe=9e4*.2;Ee=Math.max(Math.min(Ee,ce.pts-ce.dts),-1*fe)}ce.dts<y[ve>0?ve-1:ve].dts&&(he=!0)}he&&y.sort(function(Lt,mt){var st=Lt.dts-mt.dts,It=Lt.pts-mt.pts;return st||It}),H=y[0].dts,X=y[y.length-1].dts;var $=Math.round((X-H)/(F-1));if(Ee<0){if(Ee<$*-2){D.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(x.toMsFromMpegTsClock)(-$,!0)+" ms");for(var ae=Ee,Z=0;Z<F;Z++)y[Z].dts=ae=Math.max(ae,y[Z].pts-$),y[Z].pts=Math.max(ae,y[Z].pts)}else{D.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(x.toMsFromMpegTsClock)(Ee,!0)+" ms to overcome this issue");for(var ge=0;ge<F;ge++)y[ge].dts=y[ge].dts+Ee}H=y[0].dts}if(a){var Se=H-W,me=Se>$,we=Se<-1;if(me||we){me?D.logger.warn("AVC: "+Object(x.toMsFromMpegTsClock)(Se,!0)+" ms ("+Se+"dts) hole between fragments detected, filling it"):D.logger.warn("AVC: "+Object(x.toMsFromMpegTsClock)(-Se,!0)+" ms ("+Se+"dts) overlapping between fragments detected"),H=W;var De=y[0].pts-Se;y[0].dts=H,y[0].pts=De,D.logger.log("Video: First PTS/DTS adjusted: "+Object(x.toMsFromMpegTsClock)(De,!0)+"/"+Object(x.toMsFromMpegTsClock)(H,!0)+", delta: "+Object(x.toMsFromMpegTsClock)(Se,!0)+" ms")}}o&&(H=Math.max(0,H));for(var Oe=0,ke=0,Le=0;Le<F;Le++){for(var _e=y[Le],ze=_e.units,Xe=ze.length,Ve=0,je=0;je<Xe;je++)Ve+=ze[je].data.length;ke+=Ve,Oe+=Xe,_e.length=Ve,_e.dts=Math.max(_e.dts,H),_e.pts=Math.max(_e.pts,_e.dts,0),q=Math.min(_e.pts,q),re=Math.max(_e.pts,re)}X=y[F-1].dts;var qe=ke+4*Oe+8,He;try{He=new Uint8Array(qe)}catch(Lt){this.observer.emit(B.Events.ERROR,B.Events.ERROR,{type:I.ErrorTypes.MUX_ERROR,details:I.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:qe,reason:"fail allocating video mdat "+qe});return}var $e=new DataView(He.buffer);$e.setUint32(0,qe),He.set(R.default.types.mdat,4);for(var Ae=0;Ae<F;Ae++){for(var Ze=y[Ae],Je=Ze.units,Re=0,Fe=0,se=Je.length;Fe<se;Fe++){var le=Je[Fe],ue=le.data,J=le.data.byteLength;$e.setUint32(O,J),O+=4,He.set(ue,O),O+=J,Re+=4+J}if(Ae<F-1)P=y[Ae+1].dts-Ze.dts;else{var Q=this.config,te=Ze.dts-y[Ae>0?Ae-1:Ae].dts;if(Q.stretchShortVideoTrack&&this.nextAudioPts!==null){var ie=Math.floor(Q.maxBufferHole*p),be=(g?q+g*p:this.nextAudioPts)-Ze.pts;be>ie?(P=be-te,P<0&&(P=te),D.logger.log("[mp4-remuxer]: It is approximately "+be/90+" ms to the next segment; using duration "+P/90+" ms for the last video frame.")):P=te}else P=te}var Ce=Math.round(Ze.pts-Ze.dts);M.push(new f(Ze.key,P,Re,Ce))}if(M.length&&b&&b<70){var Ie=M[0].flags;Ie.dependsOn=2,Ie.isNonSync=0}console.assert(P!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=W=X+P,this.isVideoContiguous=!0;var tt=R.default.moof(c.sequenceNumber++,H,A({},c,{samples:M})),dt="video",it={data1:tt,data2:He,startPTS:q/p,endPTS:(re+P)/p,startDTS:H/p,endDTS:W/p,type:dt,hasAudio:!1,hasVideo:!0,nb:M.length,dropped:c.dropped};return c.samples=[],c.dropped=0,console.assert(He.length,"MDAT length must not be zero"),it},v.remuxAudio=function(c,l,a,g,p){var y=c.inputTimeScale,M=c.samplerate?c.samplerate:y,F=y/M,j=c.isAAC?C:E,W=j*F,O=this._initPTS,P=!c.isAAC&&this.typeSupported.mpeg,H=[],X=c.samples,q=P?0:8,re=this.nextAudioPts||-1,Ee=l*y;if(this.isAudioContiguous=a=a||X.length&&re>0&&(g&&Math.abs(Ee-re)<9e3||Math.abs(u(X[0].pts-O,Ee)-re)<20*W),X.forEach(function(ue){ue.pts=u(ue.pts-O,Ee)}),!a||re<0){if(X=X.filter(function(ue){return ue.pts>=0}),!X.length)return;p===0?re=0:g?re=Math.max(0,Ee):re=X[0].pts}if(c.isAAC)for(var he=p!==void 0,xe=this.config.maxAudioFramesDrift,pe=0,ve=re;pe<X.length;pe++){var ce=X[pe],fe=ce.pts,$=fe-ve,ae=Math.abs(1e3*$/y);if($<=-xe*W&&he)pe===0&&(D.logger.warn("Audio frame @ "+(fe/y).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*$/y)+" ms."),this.nextAudioPts=re=ve=fe);else if($>=xe*W&&ae<k&&he){var Z=Math.round($/W);ve=fe-Z*W,ve<0&&(Z--,ve+=W),pe===0&&(this.nextAudioPts=re=ve),D.logger.warn("[mp4-remuxer]: Injecting "+Z+" audio frame @ "+(ve/y).toFixed(3)+"s due to "+Math.round(1e3*$/y)+" ms gap.");for(var ge=0;ge<Z;ge++){var Se=Math.max(ve,0),me=U.default.getSilentFrame(c.manifestCodec||c.codec,c.channelCount);me||(D.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),me=ce.unit.subarray()),X.splice(pe,0,{unit:me,pts:Se}),ve+=W,pe++}}ce.pts=ve,ve+=W}for(var we=null,De=null,Oe,ke=0,Le=X.length;Le--;)ke+=X[Le].unit.byteLength;for(var _e=0,ze=X.length;_e<ze;_e++){var Xe=X[_e],Ve=Xe.unit,je=Xe.pts;if(De!==null){var qe=H[_e-1];qe.duration=Math.round((je-De)/F)}else if(a&&c.isAAC&&(je=re),we=je,ke>0){ke+=q;try{Oe=new Uint8Array(ke)}catch(ue){this.observer.emit(B.Events.ERROR,B.Events.ERROR,{type:I.ErrorTypes.MUX_ERROR,details:I.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:ke,reason:"fail allocating audio mdat "+ke});return}if(!P){var He=new DataView(Oe.buffer);He.setUint32(0,ke),Oe.set(R.default.types.mdat,4)}}else return;Oe.set(Ve,q);var $e=Ve.byteLength;q+=$e,H.push(new f(!0,j,$e,0)),De=je}var Ae=H.length;if(!Ae)return;var Ze=H[H.length-1];this.nextAudioPts=re=De+F*Ze.duration;var Je=P?new Uint8Array(0):R.default.moof(c.sequenceNumber++,we/F,A({},c,{samples:H}));c.samples=[];var Re=we/y,Fe=re/y,se="audio",le={data1:Je,data2:Oe,startPTS:Re,endPTS:Fe,startDTS:Re,endDTS:Fe,type:se,hasAudio:!0,hasVideo:!1,nb:Ae};return this.isAudioContiguous=!0,console.assert(Oe.length,"MDAT length must not be zero"),le},v.remuxEmptyAudio=function(c,l,a,g){var p=c.inputTimeScale,y=c.samplerate?c.samplerate:p,M=p/y,F=this.nextAudioPts,j=(F!==null?F:g.startDTS*p)+this._initDTS,W=g.endDTS*p+this._initDTS,O=M*C,P=Math.ceil((W-j)/O),H=U.default.getSilentFrame(c.manifestCodec||c.codec,c.channelCount);if(D.logger.warn("[mp4-remuxer]: remux empty Audio"),!H){D.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var X=[],q=0;q<P;q++){var re=j+q*O;X.push({unit:H,pts:re,dts:re})}return c.samples=X,this.remuxAudio(c,l,a,!1)},v.remuxID3=function(c,l){var a=c.samples.length;if(!a)return;for(var g=c.inputTimeScale,p=this._initPTS,y=this._initDTS,M=0;M<a;M++){var F=c.samples[M];F.pts=u(F.pts-p,l*g)/g,F.dts=u(F.dts-y,l*g)/g}var j=c.samples;return c.samples=[],{samples:j}},v.remuxText=function(c,l){var a=c.samples.length;if(!a)return;for(var g=c.inputTimeScale,p=this._initPTS,y=0;y<a;y++){var M=c.samples[y];M.pts=u(M.pts-p,l*g)/g}c.samples.sort(function(j,W){return j.pts-W.pts});var F=c.samples;return c.samples=[],{samples:F}},w}();function u(w,v){var h;if(v===null)return w;for(v<w?h=-8589934592:h=8589934592;Math.abs(w-v)>4294967296;)w+=h;return w}function S(w){for(var v=0;v<w.length;v++)if(w[v].key)return v;return-1}var f=function(v,h,c,l){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=h,this.size=c,this.cts=l,this.flags=new m(v)},m=function(v){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=v?2:1,this.isNonSync=v?0:1}},"./src/remux/passthrough-remuxer.ts":function(ne,V,_){"use strict";_.r(V);var G=_("./src/polyfills/number.ts"),U=_("./src/utils/mp4-tools.ts"),R=_("./src/loader/fragment.ts"),B=_("./src/utils/logger.ts"),I=function(){function x(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=void 0,this.initTracks=void 0,this.lastEndDTS=null}var A=x.prototype;return A.destroy=function(){},A.resetTimeStamp=function(C){this.initPTS=C,this.lastEndDTS=null},A.resetNextTimestamp=function(){this.lastEndDTS=null},A.resetInitSegment=function(C,E,b){this.audioCodec=E,this.videoCodec=b,this.generateInitSegment(C),this.emitInitSegment=!0},A.generateInitSegment=function(C){var E=this.audioCodec,b=this.videoCodec;if(!C||!C.byteLength){this.initTracks=void 0,this.initData=void 0;return}var d=this.initData=Object(U.parseInitSegment)(C);E||(E=L(d.audio,R.ElementaryStreamTypes.AUDIO)),b||(b=L(d.video,R.ElementaryStreamTypes.VIDEO));var o={};d.audio&&d.video?o.audiovideo={container:"video/mp4",codec:E+","+b,initSegment:C,id:"main"}:d.audio?o.audio={container:"audio/mp4",codec:E,initSegment:C,id:"audio"}:d.video?o.video={container:"video/mp4",codec:b,initSegment:C,id:"main"}:B.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=o},A.remux=function(C,E,b,d,o){var s=this.initPTS,u=this.lastEndDTS,S={audio:void 0,video:void 0,text:d,id3:b,initSegment:void 0};Object(G.isFiniteNumber)(u)||(u=this.lastEndDTS=o||0);var f=E.samples;if(!f||!f.length)return S;var m={initPTS:void 0,timescale:1},w=this.initData;if((!w||!w.length)&&(this.generateInitSegment(f),w=this.initData),!w||!w.length)return B.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),S;this.emitInitSegment&&(m.tracks=this.initTracks,this.emitInitSegment=!1),Object(G.isFiniteNumber)(s)||(this.initPTS=m.initPTS=s=D(w,f,u));var v=Object(U.getDuration)(f,w),h=u,c=v+h;Object(U.offsetStartDTS)(w,f,s),v>0?this.lastEndDTS=c:(B.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var l=!!w.audio,a=!!w.video,g="";l&&(g+="audio"),a&&(g+="video");var p={data1:f,startPTS:h,startDTS:h,endPTS:c,endDTS:c,type:g,hasAudio:l,hasVideo:a,nb:1,dropped:0};return S.audio=p.type==="audio"?p:void 0,S.video=p.type!=="audio"?p:void 0,S.text=d,S.id3=b,S.initSegment=m,S},x}(),D=function(A,k,C){return Object(U.getStartDTS)(A,k)-C};function L(x,A){var k=x==null?void 0:x.codec;return k&&k.length>4?k:k==="hvc1"?"hvc1.1.c.L120.90":k==="av01"?"av01.0.04M.08":k==="avc1"||A===R.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}V.default=I},"./src/task-loop.ts":function(ne,V,_){"use strict";_.r(V),_.d(V,"default",function(){return G});var G=function(){function U(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var R=U.prototype;return R.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},R.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},R.onHandlerDestroyed=function(){},R.hasInterval=function(){return!!this._tickInterval},R.hasNextTick=function(){return!!this._tickTimer},R.setInterval=function(I){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,I),!0)},R.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},R.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},R.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},R.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},R.doTick=function(){},U}()},"./src/types/cmcd.ts":function(ne,V,_){"use strict";_.r(V),_.d(V,"CMCDVersion",function(){return G}),_.d(V,"CMCDObjectType",function(){return U}),_.d(V,"CMCDStreamingFormat",function(){return R}),_.d(V,"CMCDStreamType",function(){return B});var G=1,U;(function(I){I.MANIFEST="m",I.AUDIO="a",I.VIDEO="v",I.MUXED="av",I.INIT="i",I.CAPTION="c",I.TIMED_TEXT="tt",I.KEY="k",I.OTHER="o"})(U||(U={}));var R;(function(I){I.DASH="d",I.HLS="h",I.SMOOTH="s",I.OTHER="o"})(R||(R={}));var B;(function(I){I.VOD="v",I.LIVE="l"})(B||(B={}))},"./src/types/level.ts":function(ne,V,_){"use strict";_.r(V),_.d(V,"HlsSkip",function(){return R}),_.d(V,"getSkipValue",function(){return B}),_.d(V,"HlsUrlParameters",function(){return I}),_.d(V,"Level",function(){return D});function G(L,x){for(var A=0;A<x.length;A++){var k=x[A];k.enumerable=k.enumerable||!1,k.configurable=!0,"value"in k&&(k.writable=!0),Object.defineProperty(L,k.key,k)}}function U(L,x,A){return x&&G(L.prototype,x),A&&G(L,A),L}var R;(function(L){L.No="",L.Yes="YES",L.v2="v2"})(R||(R={}));function B(L,x){var A=L.canSkipUntil,k=L.canSkipDateRanges,C=L.endSN,E=x!==void 0?x-C:0;return A&&E<A?k?R.v2:R.Yes:R.No}var I=function(){function L(A,k,C){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=A,this.part=k,this.skip=C}var x=L.prototype;return x.addDirectives=function(k){var C=new self.URL(k);return this.msn!==void 0&&C.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&C.searchParams.set("_HLS_part",this.part.toString()),this.skip&&C.searchParams.set("_HLS_skip",this.skip),C.toString()},L}(),D=function(){function L(x){this.attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.unknownCodecs=void 0,this.audioGroupIds=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.textGroupIds=void 0,this.url=void 0,this._urlId=0,this.url=[x.url],this.attrs=x.attrs,this.bitrate=x.bitrate,x.details&&(this.details=x.details),this.id=x.id||0,this.name=x.name,this.width=x.width||0,this.height=x.height||0,this.audioCodec=x.audioCodec,this.videoCodec=x.videoCodec,this.unknownCodecs=x.unknownCodecs,this.codecSet=[x.videoCodec,x.audioCodec].filter(function(A){return A}).join(",").replace(/\.[^.,]+/g,"")}return U(L,[{key:"maxBitrate",get:function(){return Math.max(this.realBitrate,this.bitrate)}},{key:"uri",get:function(){return this.url[this._urlId]||""}},{key:"urlId",get:function(){return this._urlId},set:function(A){var k=A%this.url.length;this._urlId!==k&&(this.details=void 0,this._urlId=k)}}]),L}()},"./src/types/loader.ts":function(ne,V,_){"use strict";_.r(V),_.d(V,"PlaylistContextType",function(){return G}),_.d(V,"PlaylistLevelType",function(){return U});var G;(function(R){R.MANIFEST="manifest",R.LEVEL="level",R.AUDIO_TRACK="audioTrack",R.SUBTITLE_TRACK="subtitleTrack"})(G||(G={}));var U;(function(R){R.MAIN="main",R.AUDIO="audio",R.SUBTITLE="subtitle"})(U||(U={}))},"./src/types/transmuxer.ts":function(ne,V,_){"use strict";_.r(V),_.d(V,"ChunkMetadata",function(){return G});var G=function(B,I,D,L,x,A){L===void 0&&(L=0),x===void 0&&(x=-1),A===void 0&&(A=!1),this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=U(),this.buffering={audio:U(),video:U(),audiovideo:U()},this.level=B,this.sn=I,this.id=D,this.size=L,this.part=x,this.partial=A};function U(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(ne,V,_){"use strict";_.r(V),_.d(V,"AttrList",function(){return R});var G=/^(\d+)x(\d+)$/,U=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,R=function(){function B(D){typeof D=="string"&&(D=B.parseAttrList(D));for(var L in D)D.hasOwnProperty(L)&&(this[L]=D[L])}var I=B.prototype;return I.decimalInteger=function(L){var x=parseInt(this[L],10);return x>Number.MAX_SAFE_INTEGER?Infinity:x},I.hexadecimalInteger=function(L){if(this[L]){var x=(this[L]||"0x").slice(2);x=(x.length&1?"0":"")+x;for(var A=new Uint8Array(x.length/2),k=0;k<x.length/2;k++)A[k]=parseInt(x.slice(k*2,k*2+2),16);return A}else return null},I.hexadecimalIntegerAsNumber=function(L){var x=parseInt(this[L],16);return x>Number.MAX_SAFE_INTEGER?Infinity:x},I.decimalFloatingPoint=function(L){return parseFloat(this[L])},I.optionalFloat=function(L,x){var A=this[L];return A?parseFloat(A):x},I.enumeratedString=function(L){return this[L]},I.bool=function(L){return this[L]==="YES"},I.decimalResolution=function(L){var x=G.exec(this[L]);return x===null?void 0:{width:parseInt(x[1],10),height:parseInt(x[2],10)}},B.parseAttrList=function(L){var x,A={},k='"';for(U.lastIndex=0;(x=U.exec(L))!==null;){var C=x[2];C.indexOf(k)===0&&C.lastIndexOf(k)===C.length-1&&(C=C.slice(1,-1)),A[x[1]]=C}return A},B}()},"./src/utils/binary-search.ts":function(ne,V,_){"use strict";_.r(V);var G={search:function(R,B){for(var I=0,D=R.length-1,L=null,x=null;I<=D;){L=(I+D)/2|0,x=R[L];var A=B(x);if(A>0)I=L+1;else if(A<0)D=L-1;else return x}return null}};V.default=G},"./src/utils/buffer-helper.ts":function(ne,V,_){"use strict";_.r(V),_.d(V,"BufferHelper",function(){return R});var G=_("./src/utils/logger.ts"),U={length:0,start:function(){return 0},end:function(){return 0}},R=function(){function B(){}return B.isBuffered=function(D,L){try{if(D){for(var x=B.getBuffered(D),A=0;A<x.length;A++)if(L>=x.start(A)&&L<=x.end(A))return!0}}catch(k){}return!1},B.bufferInfo=function(D,L,x){try{if(D){var A=B.getBuffered(D),k=[],C;for(C=0;C<A.length;C++)k.push({start:A.start(C),end:A.end(C)});return this.bufferedInfo(k,L,x)}}catch(E){}return{len:0,start:L,end:L,nextStart:void 0}},B.bufferedInfo=function(D,L,x){L=Math.max(0,L),D.sort(function(m,w){var v=m.start-w.start;return v||w.end-m.end});var A=[];if(x)for(var k=0;k<D.length;k++){var C=A.length;if(C){var E=A[C-1].end;D[k].start-E<x?D[k].end>E&&(A[C-1].end=D[k].end):A.push(D[k])}else A.push(D[k])}else A=D;for(var b=0,d,o=L,s=L,u=0;u<A.length;u++){var S=A[u].start,f=A[u].end;if(L+x>=S&&L<f)o=S,s=f,b=s-L;else if(L+x<S){d=S;break}}return{len:b,start:o||0,end:s||0,nextStart:d}},B.getBuffered=function(D){try{return D.buffered}catch(L){return G.logger.log("failed to get media.buffered",L),U}},B}()},"./src/utils/cea-608-parser.ts":function(ne,V,_){"use strict";_.r(V),_.d(V,"Row",function(){return s}),_.d(V,"CaptionScreen",function(){return u});var G=_("./src/utils/logger.ts"),U={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},R=function(c){var l=c;return U.hasOwnProperty(c)&&(l=U[c]),String.fromCharCode(l)},B=15,I=100,D={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},L={17:2,18:4,21:6,22:8,23:10,19:13,20:15},x={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},A={25:2,26:4,29:6,30:8,31:10,27:13,28:15},k=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],C;(function(h){h[h.ERROR=0]="ERROR",h[h.TEXT=1]="TEXT",h[h.WARNING=2]="WARNING",h[h.INFO=2]="INFO",h[h.DEBUG=3]="DEBUG",h[h.DATA=3]="DATA"})(C||(C={}));var E=function(){function h(){this.time=null,this.verboseLevel=C.ERROR}var c=h.prototype;return c.log=function(a,g){this.verboseLevel>=a&&G.logger.log(this.time+" ["+a+"] "+g)},h}(),b=function(c){for(var l=[],a=0;a<c.length;a++)l.push(c[a].toString(16));return l},d=function(){function h(l,a,g,p,y){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=l||"white",this.underline=a||!1,this.italics=g||!1,this.background=p||"black",this.flash=y||!1}var c=h.prototype;return c.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},c.setStyles=function(a){for(var g=["foreground","underline","italics","background","flash"],p=0;p<g.length;p++){var y=g[p];a.hasOwnProperty(y)&&(this[y]=a[y])}},c.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},c.equals=function(a){return this.foreground===a.foreground&&this.underline===a.underline&&this.italics===a.italics&&this.background===a.background&&this.flash===a.flash},c.copy=function(a){this.foreground=a.foreground,this.underline=a.underline,this.italics=a.italics,this.background=a.background,this.flash=a.flash},c.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},h}(),o=function(){function h(l,a,g,p,y,M){this.uchar=void 0,this.penState=void 0,this.uchar=l||" ",this.penState=new d(a,g,p,y,M)}var c=h.prototype;return c.reset=function(){this.uchar=" ",this.penState.reset()},c.setChar=function(a,g){this.uchar=a,this.penState.copy(g)},c.setPenState=function(a){this.penState.copy(a)},c.equals=function(a){return this.uchar===a.uchar&&this.penState.equals(a.penState)},c.copy=function(a){this.uchar=a.uchar,this.penState.copy(a.penState)},c.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},h}(),s=function(){function h(l){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var a=0;a<I;a++)this.chars.push(new o);this.logger=l,this.pos=0,this.currPenState=new d}var c=h.prototype;return c.equals=function(a){for(var g=!0,p=0;p<I;p++)if(!this.chars[p].equals(a.chars[p])){g=!1;break}return g},c.copy=function(a){for(var g=0;g<I;g++)this.chars[g].copy(a.chars[g])},c.isEmpty=function(){for(var a=!0,g=0;g<I;g++)if(!this.chars[g].isEmpty()){a=!1;break}return a},c.setCursor=function(a){this.pos!==a&&(this.pos=a),this.pos<0?(this.logger.log(C.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>I&&(this.logger.log(C.DEBUG,"Too large cursor position "+this.pos),this.pos=I)},c.moveCursor=function(a){var g=this.pos+a;if(a>1)for(var p=this.pos+1;p<g+1;p++)this.chars[p].setPenState(this.currPenState);this.setCursor(g)},c.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},c.insertChar=function(a){a>=144&&this.backSpace();var g=R(a);if(this.pos>=I){this.logger.log(C.ERROR,"Cannot insert "+a.toString(16)+" ("+g+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(g,this.currPenState),this.moveCursor(1)},c.clearFromPos=function(a){var g;for(g=a;g<I;g++)this.chars[g].reset()},c.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},c.clearToEndOfRow=function(){this.clearFromPos(this.pos)},c.getTextString=function(){for(var a=[],g=!0,p=0;p<I;p++){var y=this.chars[p].uchar;y!==" "&&(g=!1),a.push(y)}return g?"":a.join("")},c.setPenStyles=function(a){this.currPenState.setStyles(a);var g=this.chars[this.pos];g.setPenState(this.currPenState)},h}(),u=function(){function h(l){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var a=0;a<B;a++)this.rows.push(new s(l));this.logger=l,this.currRow=B-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var c=h.prototype;return c.reset=function(){for(var a=0;a<B;a++)this.rows[a].clear();this.currRow=B-1},c.equals=function(a){for(var g=!0,p=0;p<B;p++)if(!this.rows[p].equals(a.rows[p])){g=!1;break}return g},c.copy=function(a){for(var g=0;g<B;g++)this.rows[g].copy(a.rows[g])},c.isEmpty=function(){for(var a=!0,g=0;g<B;g++)if(!this.rows[g].isEmpty()){a=!1;break}return a},c.backSpace=function(){var a=this.rows[this.currRow];a.backSpace()},c.clearToEndOfRow=function(){var a=this.rows[this.currRow];a.clearToEndOfRow()},c.insertChar=function(a){var g=this.rows[this.currRow];g.insertChar(a)},c.setPen=function(a){var g=this.rows[this.currRow];g.setPenStyles(a)},c.moveCursor=function(a){var g=this.rows[this.currRow];g.moveCursor(a)},c.setCursor=function(a){this.logger.log(C.INFO,"setCursor: "+a);var g=this.rows[this.currRow];g.setCursor(a)},c.setPAC=function(a){this.logger.log(C.INFO,"pacData = "+JSON.stringify(a));var g=a.row-1;if(this.nrRollUpRows&&g<this.nrRollUpRows-1&&(g=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==g){for(var p=0;p<B;p++)this.rows[p].clear();var y=this.currRow+1-this.nrRollUpRows,M=this.lastOutputScreen;if(M){var F=M.rows[y].cueStartTime,j=this.logger.time;if(F&&j!==null&&F<j)for(var W=0;W<this.nrRollUpRows;W++)this.rows[g-this.nrRollUpRows+W+1].copy(M.rows[y+W])}}this.currRow=g;var O=this.rows[this.currRow];if(a.indent!==null){var P=a.indent,H=Math.max(P-1,0);O.setCursor(a.indent),a.color=O.chars[H].penState.foreground}var X={foreground:a.color,underline:a.underline,italics:a.italics,background:"black",flash:!1};this.setPen(X)},c.setBkgData=function(a){this.logger.log(C.INFO,"bkgData = "+JSON.stringify(a)),this.backSpace(),this.setPen(a),this.insertChar(32)},c.setRollUpRows=function(a){this.nrRollUpRows=a},c.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(C.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(C.TEXT,this.getDisplayText());var a=this.currRow+1-this.nrRollUpRows,g=this.rows.splice(a,1)[0];g.clear(),this.rows.splice(this.currRow,0,g),this.logger.log(C.INFO,"Rolling up")},c.getDisplayText=function(a){a=a||!1;for(var g=[],p="",y=-1,M=0;M<B;M++){var F=this.rows[M].getTextString();F&&(y=M+1,a?g.push("Row "+y+": '"+F+"'"):g.push(F.trim()))}return g.length>0&&(a?p="["+g.join(" | ")+"]":p=g.join(`
|
|
`)),p},c.getTextAndFormat=function(){return this.rows},h}(),S=function(){function h(l,a,g){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=l,this.outputFilter=a,this.mode=null,this.verbose=0,this.displayedMemory=new u(g),this.nonDisplayedMemory=new u(g),this.lastOutputScreen=new u(g),this.currRollUpRow=this.displayedMemory.rows[B-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=g}var c=h.prototype;return c.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[B-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},c.getHandler=function(){return this.outputFilter},c.setHandler=function(a){this.outputFilter=a},c.setPAC=function(a){this.writeScreen.setPAC(a)},c.setBkgData=function(a){this.writeScreen.setBkgData(a)},c.setMode=function(a){if(a===this.mode)return;this.mode=a,this.logger.log(C.INFO,"MODE="+a),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=a},c.insertChars=function(a){for(var g=0;g<a.length;g++)this.writeScreen.insertChar(a[g]);var p=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(C.INFO,p+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(C.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},c.ccRCL=function(){this.logger.log(C.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},c.ccBS=function(){if(this.logger.log(C.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},c.ccAOF=function(){},c.ccAON=function(){},c.ccDER=function(){this.logger.log(C.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},c.ccRU=function(a){this.logger.log(C.INFO,"RU("+a+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(a)},c.ccFON=function(){this.logger.log(C.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},c.ccRDC=function(){this.logger.log(C.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},c.ccTR=function(){this.logger.log(C.INFO,"TR"),this.setMode("MODE_TEXT")},c.ccRTD=function(){this.logger.log(C.INFO,"RTD"),this.setMode("MODE_TEXT")},c.ccEDM=function(){this.logger.log(C.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},c.ccCR=function(){this.logger.log(C.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},c.ccENM=function(){this.logger.log(C.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},c.ccEOC=function(){if(this.logger.log(C.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var a=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=a,this.writeScreen=this.nonDisplayedMemory,this.logger.log(C.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},c.ccTO=function(a){this.logger.log(C.INFO,"TO("+a+") - Tab Offset"),this.writeScreen.moveCursor(a)},c.ccMIDROW=function(a){var g={flash:!1};if(g.underline=a%2===1,g.italics=a>=46,g.italics)g.foreground="white";else{var p=Math.floor(a/2)-16,y=["white","green","blue","cyan","red","yellow","magenta"];g.foreground=y[p]}this.logger.log(C.INFO,"MIDROW: "+JSON.stringify(g)),this.writeScreen.setPen(g)},c.outputDataUpdate=function(a){a===void 0&&(a=!1);var g=this.logger.time;if(g===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=g:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,g,this.lastOutputScreen),a&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:g),this.lastOutputScreen.copy(this.displayedMemory))},c.cueSplitAtTime=function(a){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,a,this.displayedMemory),this.cueStartTime=a))},h}(),f=function(){function h(l,a,g){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var p=new E;this.channels=[null,new S(l,a,p),new S(l+1,g,p)],this.cmdHistory=v(),this.logger=p}var c=h.prototype;return c.getHandler=function(a){return this.channels[a].getHandler()},c.setHandler=function(a,g){this.channels[a].setHandler(g)},c.addData=function(a,g){var p,y,M,F=!1;this.logger.time=a;for(var j=0;j<g.length;j+=2){if(y=g[j]&127,M=g[j+1]&127,y===0&&M===0)continue;if(this.logger.log(C.DATA,"["+b([g[j],g[j+1]])+"] -> ("+b([y,M])+")"),p=this.parseCmd(y,M),p||(p=this.parseMidrow(y,M)),p||(p=this.parsePAC(y,M)),p||(p=this.parseBackgroundAttributes(y,M)),!p&&(F=this.parseChars(y,M),F)){var W=this.currentChannel;if(W&&W>0){var O=this.channels[W];O.insertChars(F)}else this.logger.log(C.WARNING,"No channel found yet. TEXT-MODE?")}!p&&!F&&this.logger.log(C.WARNING,"Couldn't parse cleaned data "+b([y,M])+" orig: "+b([g[j],g[j+1]]))}},c.parseCmd=function(a,g){var p=this.cmdHistory,y=(a===20||a===28||a===21||a===29)&&g>=32&&g<=47,M=(a===23||a===31)&&g>=33&&g<=35;if(!(y||M))return!1;if(w(a,g,p))return m(null,null,p),this.logger.log(C.DEBUG,"Repeated command ("+b([a,g])+") is dropped"),!0;var F=a===20||a===21||a===23?1:2,j=this.channels[F];return a===20||a===21||a===28||a===29?g===32?j.ccRCL():g===33?j.ccBS():g===34?j.ccAOF():g===35?j.ccAON():g===36?j.ccDER():g===37?j.ccRU(2):g===38?j.ccRU(3):g===39?j.ccRU(4):g===40?j.ccFON():g===41?j.ccRDC():g===42?j.ccTR():g===43?j.ccRTD():g===44?j.ccEDM():g===45?j.ccCR():g===46?j.ccENM():g===47&&j.ccEOC():j.ccTO(g-32),m(a,g,p),this.currentChannel=F,!0},c.parseMidrow=function(a,g){var p=0;if((a===17||a===25)&&g>=32&&g<=47){if(a===17?p=1:p=2,p!==this.currentChannel)return this.logger.log(C.ERROR,"Mismatch channel in midrow parsing"),!1;var y=this.channels[p];return y?(y.ccMIDROW(g),this.logger.log(C.DEBUG,"MIDROW ("+b([a,g])+")"),!0):!1}return!1},c.parsePAC=function(a,g){var p,y=this.cmdHistory,M=(a>=17&&a<=23||a>=25&&a<=31)&&g>=64&&g<=127,F=(a===16||a===24)&&g>=64&&g<=95;if(!(M||F))return!1;if(w(a,g,y))return m(null,null,y),!0;var j=a<=23?1:2;g>=64&&g<=95?p=j===1?D[a]:x[a]:p=j===1?L[a]:A[a];var W=this.channels[j];return W?(W.setPAC(this.interpretPAC(p,g)),m(a,g,y),this.currentChannel=j,!0):!1},c.interpretPAC=function(a,g){var p,y={color:null,italics:!1,indent:null,underline:!1,row:a};return g>95?p=g-96:p=g-64,y.underline=(p&1)===1,p<=13?y.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(p/2)]:p<=15?(y.italics=!0,y.color="white"):y.indent=Math.floor((p-16)/2)*4,y},c.parseChars=function(a,g){var p,y=null,M=null;if(a>=25?(p=2,M=a-8):(p=1,M=a),M>=17&&M<=19){var F;M===17?F=g+80:M===18?F=g+112:F=g+144,this.logger.log(C.INFO,"Special char '"+R(F)+"' in channel "+p),y=[F]}else a>=32&&a<=127&&(y=g===0?[a]:[a,g]);if(y){var j=b(y);this.logger.log(C.DEBUG,"Char codes = "+j.join(",")),m(a,g,this.cmdHistory)}return y},c.parseBackgroundAttributes=function(a,g){var p=(a===16||a===24)&&g>=32&&g<=47,y=(a===23||a===31)&&g>=45&&g<=47;if(!(p||y))return!1;var M,F={};a===16||a===24?(M=Math.floor((g-32)/2),F.background=k[M],g%2===1&&(F.background=F.background+"_semi")):g===45?F.background="transparent":(F.foreground="black",g===47&&(F.underline=!0));var j=a<=23?1:2,W=this.channels[j];return W.setBkgData(F),m(a,g,this.cmdHistory),!0},c.reset=function(){for(var a=0;a<Object.keys(this.channels).length;a++){var g=this.channels[a];g&&g.reset()}this.cmdHistory=v()},c.cueSplitAtTime=function(a){for(var g=0;g<this.channels.length;g++){var p=this.channels[g];p&&p.cueSplitAtTime(a)}},h}();function m(h,c,l){l.a=h,l.b=c}function w(h,c,l){return l.a===h&&l.b===c}function v(){return{a:null,b:null}}V.default=f},"./src/utils/codecs.ts":function(ne,V,_){"use strict";_.r(V),_.d(V,"isCodecType",function(){return U}),_.d(V,"isCodecSupportedInMp4",function(){return R});var G={audio:{a3ds:!0,"ac-3":!0,"ac-4":!0,alac:!0,alaw:!0,dra1:!0,"dts+":!0,"dts-":!0,dtsc:!0,dtse:!0,dtsh:!0,"ec-3":!0,enca:!0,g719:!0,g726:!0,m4ae:!0,mha1:!0,mha2:!0,mhm1:!0,mhm2:!0,mlpa:!0,mp4a:!0,"raw ":!0,Opus:!0,samr:!0,sawb:!0,sawp:!0,sevc:!0,sqcp:!0,ssmv:!0,twos:!0,ulaw:!0},video:{avc1:!0,avc2:!0,avc3:!0,avc4:!0,avcp:!0,av01:!0,drac:!0,dvav:!0,dvhe:!0,encv:!0,hev1:!0,hvc1:!0,mjp2:!0,mp4v:!0,mvc1:!0,mvc2:!0,mvc3:!0,mvc4:!0,resv:!0,rv60:!0,s263:!0,svc1:!0,svc2:!0,"vc-1":!0,vp08:!0,vp09:!0},text:{stpp:!0,wvtt:!0}};function U(B,I){var D=G[I];return!!D&&D[B.slice(0,4)]===!0}function R(B,I){return MediaSource.isTypeSupported((I||"video")+'/mp4;codecs="'+B+'"')}},"./src/utils/cues.ts":function(ne,V,_){"use strict";_.r(V);var G=_("./src/utils/vttparser.ts"),U=_("./src/utils/webvtt-parser.ts"),R=_("./src/utils/texttrack-utils.ts"),B=/\s/,I={newCue:function(L,x,A,k){for(var C=[],E,b,d,o,s,u=self.VTTCue||self.TextTrackCue,S=0;S<k.rows.length;S++)if(E=k.rows[S],d=!0,o=0,s="",!E.isEmpty()){for(var f=0;f<E.chars.length;f++)B.test(E.chars[f].uchar)&&d?o++:(s+=E.chars[f].uchar,d=!1);E.cueStartTime=x,x===A&&(A+=1e-4),o>=16?o--:o++;var m=Object(G.fixLineBreaks)(s.trim()),w=Object(U.generateCueId)(x,A,m);(!L||!L.cues||!L.cues.getCueById(w))&&(b=new u(x,A,m),b.id=w,b.line=S+1,b.align="left",b.position=10+Math.min(80,Math.floor(o*8/32)*10),C.push(b))}return L&&C.length&&(C.sort(function(v,h){return v.line==="auto"||h.line==="auto"?0:v.line>8&&h.line>8?h.line-v.line:v.line-h.line}),C.forEach(function(v){return Object(R.addCueToTrack)(L,v)})),C}};V.default=I},"./src/utils/discontinuities.ts":function(ne,V,_){"use strict";_.r(V),_.d(V,"findFirstFragWithCC",function(){return B}),_.d(V,"shouldAlignOnDiscontinuities",function(){return I}),_.d(V,"findDiscontinuousReferenceFrag",function(){return D}),_.d(V,"adjustSlidingStart",function(){return x}),_.d(V,"alignStream",function(){return A}),_.d(V,"alignPDT",function(){return C}),_.d(V,"alignFragmentByPDTDelta",function(){return E}),_.d(V,"alignMediaPlaylistByPDT",function(){return b});var G=_("./src/polyfills/number.ts"),U=_("./src/utils/logger.ts"),R=_("./src/controller/level-helper.ts");function B(d,o){for(var s=null,u=0,S=d.length;u<S;u++){var f=d[u];if(f&&f.cc===o){s=f;break}}return s}function I(d,o,s){return!!(o.details&&(s.endCC>s.startCC||d&&d.cc<s.startCC))}function D(d,o){var s=d.fragments,u=o.fragments;if(!u.length||!s.length){U.logger.log("No fragments to align");return}var S=B(s,u[0].cc);if(!S||S&&!S.startPTS){U.logger.log("No frag in previous level to align on");return}return S}function L(d,o){if(d){var s=d.start+o;d.start=d.startPTS=s,d.endPTS=s+d.duration}}function x(d,o){for(var s=o.fragments,u=0,S=s.length;u<S;u++)L(s[u],d);o.fragmentHint&&L(o.fragmentHint,d),o.alignedSliding=!0}function A(d,o,s){if(!o)return;k(d,s,o),!s.alignedSliding&&o.details&&C(s,o.details),!s.alignedSliding&&o.details&&!s.skippedSegments&&Object(R.adjustSliding)(o.details,s)}function k(d,o,s){if(I(d,s,o)){var u=D(s.details,o);u&&Object(G.isFiniteNumber)(u.start)&&(U.logger.log("Adjusting PTS using last level due to CC increase within current level "+o.url),x(u.start,o))}}function C(d,o){if(!o.fragments.length||!d.hasProgramDateTime||!o.hasProgramDateTime)return;var s=o.fragments[0].programDateTime,u=d.fragments[0].programDateTime,S=(u-s)/1e3+o.fragments[0].start;S&&Object(G.isFiniteNumber)(S)&&(U.logger.log("Adjusting PTS using programDateTime delta "+(u-s)+"ms, sliding:"+S.toFixed(3)+" "+d.url+" "),x(S,d))}function E(d,o){var s=d.programDateTime;if(!s)return;var u=(s-o)/1e3;d.start=d.startPTS=u,d.endPTS=u+d.duration}function b(d,o){if(!o.fragments.length||!d.hasProgramDateTime||!o.hasProgramDateTime)return;var s=o.fragments[0].programDateTime,u=o.fragments[0].start,S=s-u*1e3;d.fragments.forEach(function(f){E(f,S)}),d.fragmentHint&&E(d.fragmentHint,S),d.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(ne,V,_){"use strict";_.r(V);var G=_("./src/utils/ewma.ts"),U=function(){function R(I,D,L){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=L,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new G.default(I),this.fast_=new G.default(D)}var B=R.prototype;return B.update=function(D,L){var x=this.slow_,A=this.fast_;this.slow_.halfLife!==D&&(this.slow_=new G.default(D,x.getEstimate(),x.getTotalWeight())),this.fast_.halfLife!==L&&(this.fast_=new G.default(L,A.getEstimate(),A.getTotalWeight()))},B.sample=function(D,L){D=Math.max(D,this.minDelayMs_);var x=8*L,A=D/1e3,k=x/A;this.fast_.sample(A,k),this.slow_.sample(A,k)},B.canEstimate=function(){var D=this.fast_;return D&&D.getTotalWeight()>=this.minWeight_},B.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},B.destroy=function(){},R}();V.default=U},"./src/utils/ewma.ts":function(ne,V,_){"use strict";_.r(V);var G=function(){function U(B,I,D){I===void 0&&(I=0),D===void 0&&(D=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=B,this.alpha_=B?Math.exp(Math.log(.5)/B):0,this.estimate_=I,this.totalWeight_=D}var R=U.prototype;return R.sample=function(I,D){var L=Math.pow(this.alpha_,I);this.estimate_=D*(1-L)+L*this.estimate_,this.totalWeight_+=I},R.getTotalWeight=function(){return this.totalWeight_},R.getEstimate=function(){if(this.alpha_){var I=1-Math.pow(this.alpha_,this.totalWeight_);if(I)return this.estimate_/I}return this.estimate_},U}();V.default=G},"./src/utils/fetch-loader.ts":function(ne,V,_){"use strict";_.r(V),_.d(V,"fetchSupported",function(){return E});var G=_("./src/polyfills/number.ts"),U=_("./src/loader/load-stats.ts"),R=_("./src/demux/chunk-cache.ts");function B(u,S){u.prototype=Object.create(S.prototype),u.prototype.constructor=u,A(u,S)}function I(u){var S=typeof Map=="function"?new Map:void 0;return I=function(m){if(m===null||!x(m))return m;if(typeof m!="function")throw new TypeError("Super expression must either be null or a function");if(typeof S!="undefined"){if(S.has(m))return S.get(m);S.set(m,w)}function w(){return D(m,arguments,k(this).constructor)}return w.prototype=Object.create(m.prototype,{constructor:{value:w,enumerable:!1,writable:!0,configurable:!0}}),A(w,m)},I(u)}function D(u,S,f){return L()?D=Reflect.construct:D=function(w,v,h){var c=[null];c.push.apply(c,v);var l=Function.bind.apply(w,c),a=new l;return h&&A(a,h.prototype),a},D.apply(null,arguments)}function L(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(u){return!1}}function x(u){return Function.toString.call(u).indexOf("[native code]")!==-1}function A(u,S){return A=Object.setPrototypeOf||function(m,w){return m.__proto__=w,m},A(u,S)}function k(u){return k=Object.setPrototypeOf?Object.getPrototypeOf:function(f){return f.__proto__||Object.getPrototypeOf(f)},k(u)}function C(){return C=Object.assign||function(u){for(var S=1;S<arguments.length;S++){var f=arguments[S];for(var m in f)Object.prototype.hasOwnProperty.call(f,m)&&(u[m]=f[m])}return u},C.apply(this,arguments)}function E(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(u){}return!1}var b=function(){function u(f){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=void 0,this.response=void 0,this.controller=void 0,this.context=void 0,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=f.fetchSetup||o,this.controller=new self.AbortController,this.stats=new U.LoadStats}var S=u.prototype;return S.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},S.abortInternal=function(){var m=this.response;(!m||!m.ok)&&(this.stats.aborted=!0,this.controller.abort())},S.abort=function(){var m;this.abortInternal(),(m=this.callbacks)!==null&&m!==void 0&&m.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},S.load=function(m,w,v){var h=this,c=this.stats;if(c.loading.start)throw new Error("Loader can only be used once.");c.loading.start=self.performance.now();var l=d(m,this.controller.signal),a=v.onProgress,g=m.responseType==="arraybuffer",p=g?"byteLength":"length";this.context=m,this.config=w,this.callbacks=v,this.request=this.fetchSetup(m,l),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){h.abortInternal(),v.onTimeout(c,m,h.response)},w.timeout),self.fetch(this.request).then(function(y){if(h.response=h.loader=y,!y.ok){var M=y.status,F=y.statusText;throw new s(F||"fetch, bad network response",M,y)}return c.loading.first=Math.max(self.performance.now(),c.loading.start),c.total=parseInt(y.headers.get("Content-Length")||"0"),a&&Object(G.isFiniteNumber)(w.highWaterMark)?h.loadProgressively(y,c,m,w.highWaterMark,a):g?y.arrayBuffer():y.text()}).then(function(y){var M=h.response;self.clearTimeout(h.requestTimeout),c.loading.end=Math.max(self.performance.now(),c.loading.first),c.loaded=c.total=y[p];var F={url:M.url,data:y};a&&!Object(G.isFiniteNumber)(w.highWaterMark)&&a(c,m,y,M),v.onSuccess(F,c,m,M)}).catch(function(y){if(self.clearTimeout(h.requestTimeout),c.aborted)return;var M=y.code||0;v.onError({code:M,text:y.message},m,y.details)})},S.getCacheAge=function(){var m=null;if(this.response){var w=this.response.headers.get("age");m=w?parseFloat(w):null}return m},S.loadProgressively=function(m,w,v,h,c){h===void 0&&(h=0);var l=new R.default,a=m.body.getReader(),g=function p(){return a.read().then(function(y){if(y.done)return l.dataLength&&c(w,v,l.flush(),m),Promise.resolve(new ArrayBuffer(0));var M=y.value,F=M.length;return w.loaded+=F,F<h||l.dataLength?(l.push(M),l.dataLength>=h&&c(w,v,l.flush(),m)):c(w,v,M,m),p()}).catch(function(){return Promise.reject()})};return g()},u}();function d(u,S){var f={method:"GET",mode:"cors",credentials:"same-origin",signal:S,headers:new self.Headers(C({},u.headers))};return u.rangeEnd&&f.headers.set("Range","bytes="+u.rangeStart+"-"+String(u.rangeEnd-1)),f}function o(u,S){return new self.Request(u.url,S)}var s=function(u){B(S,u);function S(f,m,w){var v;return v=u.call(this,f)||this,v.code=void 0,v.details=void 0,v.code=m,v.details=w,v}return S}(I(Error));V.default=b},"./src/utils/imsc1-ttml-parser.ts":function(ne,V,_){"use strict";_.r(V),_.d(V,"IMSC1_CODEC",function(){return x}),_.d(V,"parseIMSC1",function(){return E});var G=_("./src/utils/mp4-tools.ts"),U=_("./src/utils/vttparser.ts"),R=_("./src/utils/vttcue.ts"),B=_("./src/demux/id3.ts"),I=_("./src/utils/timescale-conversion.ts"),D=_("./src/utils/webvtt-parser.ts");function L(){return L=Object.assign||function(h){for(var c=1;c<arguments.length;c++){var l=arguments[c];for(var a in l)Object.prototype.hasOwnProperty.call(l,a)&&(h[a]=l[a])}return h},L.apply(this,arguments)}var x="stpp.ttml.im1t",A=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,k=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,C={left:"start",center:"center",right:"end",start:"start",end:"end"};function E(h,c,l,a,g){var p=Object(G.findBox)(new Uint8Array(h),["mdat"]);if(p.length===0){g(new Error("Could not parse IMSC1 mdat"));return}var y=p[0],M=Object(B.utf8ArrayToStr)(new Uint8Array(h,y.start,y.end-y.start)),F=Object(I.toTimescaleFromScale)(c,1,l);try{a(b(M,F))}catch(j){g(j)}}function b(h,c){var l=new DOMParser,a=l.parseFromString(h,"text/xml"),g=a.getElementsByTagName("tt")[0];if(!g)throw new Error("Invalid ttml");var p={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},y=Object.keys(p).reduce(function(O,P){return O[P]=g.getAttribute("ttp:"+P)||p[P],O},{}),M=g.getAttribute("xml:space")!=="preserve",F=o(d(g,"styling","style")),j=o(d(g,"layout","region")),W=d(g,"body","[begin]");return[].map.call(W,function(O){var P=s(O,M);if(!P||!O.hasAttribute("begin"))return null;var H=m(O.getAttribute("begin"),y),X=m(O.getAttribute("dur"),y),q=m(O.getAttribute("end"),y);if(H===null)throw f(O);if(q===null){if(X===null)throw f(O);q=H+X}var re=new R.default(H-c,q-c,P);re.id=Object(D.generateCueId)(re.startTime,re.endTime,re.text);var Ee=j[O.getAttribute("region")],he=F[O.getAttribute("style")];re.position=10,re.size=80;var xe=u(Ee,he),pe=xe.textAlign;if(pe){var ve=C[pe];ve&&(re.lineAlign=ve),re.align=pe}return L(re,xe),re}).filter(function(O){return O!==null})}function d(h,c,l){var a=h.getElementsByTagName(c)[0];return a?[].slice.call(a.querySelectorAll(l)):[]}function o(h){return h.reduce(function(c,l){var a=l.getAttribute("xml:id");return a&&(c[a]=l),c},{})}function s(h,c){return[].slice.call(h.childNodes).reduce(function(l,a,g){var p;return a.nodeName==="br"&&g?l+`
|
|
`:(p=a.childNodes)!==null&&p!==void 0&&p.length?s(a,c):c?l+a.textContent.trim().replace(/\s+/g," "):l+a.textContent},"")}function u(h,c){var l="http://www.w3.org/ns/ttml#styling",a=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return a.reduce(function(g,p){var y=S(c,l,p)||S(h,l,p);return y&&(g[p]=y),g},{})}function S(h,c,l){return h.hasAttributeNS(c,l)?h.getAttributeNS(c,l):null}function f(h){return new Error("Could not parse ttml timestamp "+h)}function m(h,c){if(!h)return null;var l=Object(U.parseTimeStamp)(h);return l===null&&(A.test(h)?l=w(h,c):k.test(h)&&(l=v(h,c))),l}function w(h,c){var l=A.exec(h),a=(l[4]|0)+(l[5]|0)/c.subFrameRate;return(l[1]|0)*3600+(l[2]|0)*60+(l[3]|0)+a/c.frameRate}function v(h,c){var l=k.exec(h),a=Number(l[1]),g=l[2];switch(g){case"h":return a*3600;case"m":return a*60;case"ms":return a*1e3;case"f":return a/c.frameRate;case"t":return a/c.tickRate}return a}},"./src/utils/logger.ts":function(ne,V,_){"use strict";_.r(V),_.d(V,"enableLogs",function(){return D}),_.d(V,"logger",function(){return L});var G=function(){},U={trace:G,debug:G,log:G,warn:G,info:G,error:G},R=U;function B(x){var A=self.console[x];return A?A.bind(self.console,"["+x+"] >"):G}function I(x){for(var A=arguments.length,k=new Array(A>1?A-1:0),C=1;C<A;C++)k[C-1]=arguments[C];k.forEach(function(E){R[E]=x[E]?x[E].bind(x):B(E)})}function D(x){if(self.console&&x===!0||typeof x=="object"){I(x,"debug","log","info","warn","error");try{R.log()}catch(A){R=U}}else R=U}var L=R},"./src/utils/mediakeys-helper.ts":function(ne,V,_){"use strict";_.r(V),_.d(V,"KeySystems",function(){return G}),_.d(V,"requestMediaKeySystemAccess",function(){return U});var G;(function(R){R.WIDEVINE="com.widevine.alpha",R.PLAYREADY="com.microsoft.playready"})(G||(G={}));var U=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(ne,V,_){"use strict";_.r(V),_.d(V,"getMediaSource",function(){return G});function G(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(ne,V,_){"use strict";_.r(V),_.d(V,"bin2str",function(){return I}),_.d(V,"readUint16",function(){return D}),_.d(V,"readUint32",function(){return L}),_.d(V,"writeUint32",function(){return x}),_.d(V,"findBox",function(){return A}),_.d(V,"parseSegmentIndex",function(){return k}),_.d(V,"parseInitSegment",function(){return C}),_.d(V,"getStartDTS",function(){return E}),_.d(V,"getDuration",function(){return b}),_.d(V,"computeRawDurationFromSamples",function(){return d}),_.d(V,"offsetStartDTS",function(){return o}),_.d(V,"segmentValidRange",function(){return s}),_.d(V,"appendUint8Array",function(){return u});var G=_("./src/utils/typed-array.ts"),U=_("./src/loader/fragment.ts"),R=Math.pow(2,32)-1,B=[].push;function I(S){return String.fromCharCode.apply(null,S)}function D(S,f){"data"in S&&(f+=S.start,S=S.data);var m=S[f]<<8|S[f+1];return m<0?65536+m:m}function L(S,f){"data"in S&&(f+=S.start,S=S.data);var m=S[f]<<24|S[f+1]<<16|S[f+2]<<8|S[f+3];return m<0?4294967296+m:m}function x(S,f,m){"data"in S&&(f+=S.start,S=S.data),S[f]=m>>24,S[f+1]=m>>16&255,S[f+2]=m>>8&255,S[f+3]=m&255}function A(S,f){var m=[];if(!f.length)return m;var w,v,h;"data"in S?(w=S.data,v=S.start,h=S.end):(w=S,v=0,h=w.byteLength);for(var c=v;c<h;){var l=L(w,c),a=I(w.subarray(c+4,c+8)),g=l>1?c+l:h;if(a===f[0])if(f.length===1)m.push({data:w,start:c+8,end:g});else{var p=A({data:w,start:c+8,end:g},f.slice(1));p.length&&B.apply(m,p)}c=g}return m}function k(S){var f=A(S,["moov"]),m=f[0],w=m?m.end:null,v=A(S,["sidx"]);if(!v||!v[0])return null;var h=[],c=v[0],l=c.data[0],a=l===0?8:16,g=L(c,a);a+=4;var p=0,y=0;l===0?a+=8:a+=16,a+=2;var M=c.end+y,F=D(c,a);a+=2;for(var j=0;j<F;j++){var W=a,O=L(c,W);W+=4;var P=O&2147483647,H=(O&2147483648)>>>31;if(H===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var X=L(c,W);W+=4,h.push({referenceSize:P,subsegmentDuration:X,info:{duration:X/g,start:M,end:M+P-1}}),M+=P,W+=4,a=W}return{earliestPresentationTime:p,timescale:g,version:l,referencesCount:F,references:h,moovEndOffset:w}}function C(S){for(var f=[],m=A(S,["moov","trak"]),w=0;w<m.length;w++){var v=m[w],h=A(v,["tkhd"])[0];if(h){var c=h.data[h.start],l=c===0?12:20,a=L(h,l),g=A(v,["mdia","mdhd"])[0];if(g){c=g.data[g.start],l=c===0?12:20;var p=L(g,l),y=A(v,["mdia","hdlr"])[0];if(y){var M=I(y.data.subarray(y.start+8,y.start+12)),F={soun:U.ElementaryStreamTypes.AUDIO,vide:U.ElementaryStreamTypes.VIDEO}[M];if(F){var j=A(v,["mdia","minf","stbl","stsd"])[0],W=void 0;j&&(W=I(j.data.subarray(j.start+12,j.start+16))),f[a]={timescale:p,type:F},f[F]={timescale:p,id:a,codec:W}}}}}}var O=A(S,["moov","mvex","trex"]);return O.forEach(function(P){var H=L(P,4),X=f[H];X&&(X.default={duration:L(P,12),flags:L(P,20)})}),f}function E(S,f){return A(f,["moof","traf"]).reduce(function(m,w){var v=A(w,["tfdt"])[0],h=v.data[v.start],c=A(w,["tfhd"]).reduce(function(l,a){var g=L(a,4),p=S[g];if(p){var y=L(v,4);h===1&&(y*=Math.pow(2,32),y+=L(v,8));var M=p.timescale||9e4,F=y/M;if(isFinite(F)&&(l===null||F<l))return F}return l},null);return c!==null&&isFinite(c)&&(m===null||c<m)?c:m},null)||0}function b(S,f){for(var m=0,w=0,v=0,h=A(S,["moof","traf"]),c=0;c<h.length;c++){var l=h[c],a=A(l,["tfhd"])[0],g=L(a,4),p=f[g];if(!p)continue;var y=p.default,M=L(a,0)|(y==null?void 0:y.flags),F=y==null?void 0:y.duration;M&8&&(M&2?F=L(a,12):F=L(a,8));for(var j=p.timescale||9e4,W=A(l,["trun"]),O=0;O<W.length;O++){if(F){var P=L(W[O],4);m=F*P}else m=d(W[O]);p.type===U.ElementaryStreamTypes.VIDEO?w+=m/j:p.type===U.ElementaryStreamTypes.AUDIO&&(v+=m/j)}}if(w===0&&v===0){var H=k(S);if(H!=null&&H.references)return H.references.reduce(function(X,q){return X+q.info.duration||0},0)}return w||v}function d(S){var f=L(S,0),m=8;f&1&&(m+=4),f&4&&(m+=4);for(var w=0,v=L(S,4),h=0;h<v;h++){if(f&256){var c=L(S,m);w+=c,m+=4}f&512&&(m+=4),f&1024&&(m+=4),f&2048&&(m+=4)}return w}function o(S,f,m){A(f,["moof","traf"]).forEach(function(w){A(w,["tfhd"]).forEach(function(v){var h=L(v,4),c=S[h];if(!c)return;var l=c.timescale||9e4;A(w,["tfdt"]).forEach(function(a){var g=a.data[a.start],p=L(a,4);if(g===0)x(a,4,p-m*l);else{p*=Math.pow(2,32),p+=L(a,8),p-=m*l,p=Math.max(p,0);var y=Math.floor(p/(R+1)),M=Math.floor(p%(R+1));x(a,4,y),x(a,8,M)}})})})}function s(S){var f={valid:null,remainder:null},m=A(S,["moof"]);if(m){if(m.length<2)return f.remainder=S,f}else return f;var w=m[m.length-1];return f.valid=Object(G.sliceUint8)(S,0,w.start-8),f.remainder=Object(G.sliceUint8)(S,w.start-8),f}function u(S,f){var m=new Uint8Array(S.length+f.length);return m.set(S),m.set(f,S.length),m}},"./src/utils/output-filter.ts":function(ne,V,_){"use strict";_.r(V),_.d(V,"default",function(){return G});var G=function(){function U(B,I){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=B,this.trackName=I}var R=U.prototype;return R.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},R.newCue=function(I,D,L){(this.startTime===null||this.startTime>I)&&(this.startTime=I),this.endTime=D,this.screen=L,this.timelineController.createCaptionsTrack(this.trackName)},R.reset=function(){this.cueRanges=[]},U}()},"./src/utils/texttrack-utils.ts":function(ne,V,_){"use strict";_.r(V),_.d(V,"sendAddTrackEvent",function(){return U}),_.d(V,"addCueToTrack",function(){return R}),_.d(V,"clearCurrentCues",function(){return B}),_.d(V,"removeCuesInRange",function(){return I}),_.d(V,"getCuesInRange",function(){return L});var G=_("./src/utils/logger.ts");function U(x,A){var k;try{k=new Event("addtrack")}catch(C){k=document.createEvent("Event"),k.initEvent("addtrack",!1,!1)}k.track=x,A.dispatchEvent(k)}function R(x,A){var k=x.mode;if(k==="disabled"&&(x.mode="hidden"),x.cues&&!x.cues.getCueById(A.id))try{if(x.addCue(A),!x.cues.getCueById(A.id))throw new Error("addCue is failed for: "+A)}catch(E){G.logger.debug("[texttrack-utils]: "+E);var C=new self.TextTrackCue(A.startTime,A.endTime,A.text);C.id=A.id,x.addCue(C)}k==="disabled"&&(x.mode=k)}function B(x){var A=x.mode;if(A==="disabled"&&(x.mode="hidden"),x.cues)for(var k=x.cues.length;k--;)x.removeCue(x.cues[k]);A==="disabled"&&(x.mode=A)}function I(x,A,k){var C=x.mode;if(C==="disabled"&&(x.mode="hidden"),x.cues&&x.cues.length>0)for(var E=L(x.cues,A,k),b=0;b<E.length;b++)x.removeCue(E[b]);C==="disabled"&&(x.mode=C)}function D(x,A){if(A<x[0].startTime)return 0;var k=x.length-1;if(A>x[k].endTime)return-1;for(var C=0,E=k;C<=E;){var b=Math.floor((E+C)/2);if(A<x[b].startTime)E=b-1;else if(A>x[b].startTime&&C<k)C=b+1;else return b}return x[C].startTime-A<A-x[E].startTime?C:E}function L(x,A,k){var C=[],E=D(x,A);if(E>-1)for(var b=E,d=x.length;b<d;b++){var o=x[b];if(o.startTime>=A&&o.endTime<=k)C.push(o);else if(o.startTime>k)return C}return C}},"./src/utils/time-ranges.ts":function(ne,V,_){"use strict";_.r(V);var G={toString:function(R){for(var B="",I=R.length,D=0;D<I;D++)B+="["+R.start(D).toFixed(3)+","+R.end(D).toFixed(3)+"]";return B}};V.default=G},"./src/utils/timescale-conversion.ts":function(ne,V,_){"use strict";_.r(V),_.d(V,"toTimescaleFromBase",function(){return U}),_.d(V,"toTimescaleFromScale",function(){return R}),_.d(V,"toMsFromMpegTsClock",function(){return B}),_.d(V,"toMpegTsClockFromTimescale",function(){return I});var G=9e4;function U(D,L,x,A){x===void 0&&(x=1),A===void 0&&(A=!1);var k=D*L*x;return A?Math.round(k):k}function R(D,L,x,A){return x===void 0&&(x=1),A===void 0&&(A=!1),U(D,L,1/x,A)}function B(D,L){return L===void 0&&(L=!1),U(D,1e3,1/G,L)}function I(D,L){return L===void 0&&(L=1),U(D,G,1/L)}},"./src/utils/typed-array.ts":function(ne,V,_){"use strict";_.r(V),_.d(V,"sliceUint8",function(){return G});function G(U,R,B){return Uint8Array.prototype.slice?U.slice(R,B):new Uint8Array(Array.prototype.slice.call(U,R,B))}},"./src/utils/vttcue.ts":function(ne,V,_){"use strict";_.r(V),V.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var G=["","lr","rl"],U=["start","middle","end","left","right"];function R(x,A){if(typeof A!="string")return!1;if(!Array.isArray(x))return!1;var k=A.toLowerCase();return~x.indexOf(k)?k:!1}function B(x){return R(G,x)}function I(x){return R(U,x)}function D(x){for(var A=arguments.length,k=new Array(A>1?A-1:0),C=1;C<A;C++)k[C-1]=arguments[C];for(var E=1;E<arguments.length;E++){var b=arguments[E];for(var d in b)x[d]=b[d]}return x}function L(x,A,k){var C=this,E={enumerable:!0};C.hasBeenReset=!1;var b="",d=!1,o=x,s=A,u=k,S=null,f="",m=!0,w="auto",v="start",h=50,c="middle",l=50,a="middle";Object.defineProperty(C,"id",D({},E,{get:function(){return b},set:function(p){b=""+p}})),Object.defineProperty(C,"pauseOnExit",D({},E,{get:function(){return d},set:function(p){d=!!p}})),Object.defineProperty(C,"startTime",D({},E,{get:function(){return o},set:function(p){if(typeof p!="number")throw new TypeError("Start time must be set to a number.");o=p,this.hasBeenReset=!0}})),Object.defineProperty(C,"endTime",D({},E,{get:function(){return s},set:function(p){if(typeof p!="number")throw new TypeError("End time must be set to a number.");s=p,this.hasBeenReset=!0}})),Object.defineProperty(C,"text",D({},E,{get:function(){return u},set:function(p){u=""+p,this.hasBeenReset=!0}})),Object.defineProperty(C,"region",D({},E,{get:function(){return S},set:function(p){S=p,this.hasBeenReset=!0}})),Object.defineProperty(C,"vertical",D({},E,{get:function(){return f},set:function(p){var y=B(p);if(y===!1)throw new SyntaxError("An invalid or illegal string was specified.");f=y,this.hasBeenReset=!0}})),Object.defineProperty(C,"snapToLines",D({},E,{get:function(){return m},set:function(p){m=!!p,this.hasBeenReset=!0}})),Object.defineProperty(C,"line",D({},E,{get:function(){return w},set:function(p){if(typeof p!="number"&&p!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");w=p,this.hasBeenReset=!0}})),Object.defineProperty(C,"lineAlign",D({},E,{get:function(){return v},set:function(p){var y=I(p);if(!y)throw new SyntaxError("An invalid or illegal string was specified.");v=y,this.hasBeenReset=!0}})),Object.defineProperty(C,"position",D({},E,{get:function(){return h},set:function(p){if(p<0||p>100)throw new Error("Position must be between 0 and 100.");h=p,this.hasBeenReset=!0}})),Object.defineProperty(C,"positionAlign",D({},E,{get:function(){return c},set:function(p){var y=I(p);if(!y)throw new SyntaxError("An invalid or illegal string was specified.");c=y,this.hasBeenReset=!0}})),Object.defineProperty(C,"size",D({},E,{get:function(){return l},set:function(p){if(p<0||p>100)throw new Error("Size must be between 0 and 100.");l=p,this.hasBeenReset=!0}})),Object.defineProperty(C,"align",D({},E,{get:function(){return a},set:function(p){var y=I(p);if(!y)throw new SyntaxError("An invalid or illegal string was specified.");a=y,this.hasBeenReset=!0}})),C.displayState=void 0}return L.prototype.getCueAsHTML=function(){var x=self.WebVTT;return x.convertCueToDOMTree(self,this.text)},L}()},"./src/utils/vttparser.ts":function(ne,V,_){"use strict";_.r(V),_.d(V,"parseTimeStamp",function(){return R}),_.d(V,"fixLineBreaks",function(){return A}),_.d(V,"VTTParser",function(){return k});var G=_("./src/utils/vttcue.ts"),U=function(){function C(){}var E=C.prototype;return E.decode=function(d,o){if(!d)return"";if(typeof d!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(d))},C}();function R(C){function E(d,o,s,u){return(d|0)*3600+(o|0)*60+(s|0)+parseFloat(u||0)}var b=C.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return b?parseFloat(b[2])>59?E(b[2],b[3],0,b[4]):E(b[1],b[2],b[3],b[4]):null}var B=function(){function C(){this.values=Object.create(null)}var E=C.prototype;return E.set=function(d,o){!this.get(d)&&o!==""&&(this.values[d]=o)},E.get=function(d,o,s){return s?this.has(d)?this.values[d]:o[s]:this.has(d)?this.values[d]:o},E.has=function(d){return d in this.values},E.alt=function(d,o,s){for(var u=0;u<s.length;++u)if(o===s[u]){this.set(d,o);break}},E.integer=function(d,o){/^-?\d+$/.test(o)&&this.set(d,parseInt(o,10))},E.percent=function(d,o){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(o)){var s=parseFloat(o);if(s>=0&&s<=100)return this.set(d,s),!0}return!1},C}();function I(C,E,b,d){var o=d?C.split(d):[C];for(var s in o){if(typeof o[s]!="string")continue;var u=o[s].split(b);if(u.length!==2)continue;var S=u[0],f=u[1];E(S,f)}}var D=new G.default(0,0,""),L=D.align==="middle"?"middle":"center";function x(C,E,b){var d=C;function o(){var S=R(C);if(S===null)throw new Error("Malformed timestamp: "+d);return C=C.replace(/^[^\sa-zA-Z-]+/,""),S}function s(S,f){var m=new B;I(S,function(h,c){var l;switch(h){case"region":for(var a=b.length-1;a>=0;a--)if(b[a].id===c){m.set(h,b[a].region);break}break;case"vertical":m.alt(h,c,["rl","lr"]);break;case"line":l=c.split(","),m.integer(h,l[0]),m.percent(h,l[0])&&m.set("snapToLines",!1),m.alt(h,l[0],["auto"]),l.length===2&&m.alt("lineAlign",l[1],["start",L,"end"]);break;case"position":l=c.split(","),m.percent(h,l[0]),l.length===2&&m.alt("positionAlign",l[1],["start",L,"end","line-left","line-right","auto"]);break;case"size":m.percent(h,c);break;case"align":m.alt(h,c,["start",L,"end","left","right"]);break}},/:/,/\s/),f.region=m.get("region",null),f.vertical=m.get("vertical","");var w=m.get("line","auto");w==="auto"&&D.line===-1&&(w=-1),f.line=w,f.lineAlign=m.get("lineAlign","start"),f.snapToLines=m.get("snapToLines",!0),f.size=m.get("size",100),f.align=m.get("align",L);var v=m.get("position","auto");v==="auto"&&D.position===50&&(v=f.align==="start"||f.align==="left"?0:f.align==="end"||f.align==="right"?100:50),f.position=v}function u(){C=C.replace(/^\s+/,"")}if(u(),E.startTime=o(),u(),C.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+d);C=C.substr(3),u(),E.endTime=o(),u(),s(C,E)}function A(C){return C.replace(/<br(?: \/)?>/gi,`
|
|
`)}var k=function(){function C(){this.state="INITIAL",this.buffer="",this.decoder=new U,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var E=C.prototype;return E.parse=function(d){var o=this;d&&(o.buffer+=o.decoder.decode(d,{stream:!0}));function s(){var v=o.buffer,h=0;for(v=A(v);h<v.length&&v[h]!=="\r"&&v[h]!==`
|
|
`;)++h;var c=v.substr(0,h);return v[h]==="\r"&&++h,v[h]===`
|
|
`&&++h,o.buffer=v.substr(h),c}function u(v){I(v,function(h,c){},/:/)}try{var S="";if(o.state==="INITIAL"){if(!/\r\n|\n/.test(o.buffer))return this;S=s();var f=S.match(/^()?WEBVTT([ \t].*)?$/);if(!f||!f[0])throw new Error("Malformed WebVTT signature.");o.state="HEADER"}for(var m=!1;o.buffer;){if(!/\r\n|\n/.test(o.buffer))return this;m?m=!1:S=s();switch(o.state){case"HEADER":/:/.test(S)?u(S):S||(o.state="ID");continue;case"NOTE":S||(o.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(S)){o.state="NOTE";break}if(!S)continue;if(o.cue=new G.default(0,0,""),o.state="CUE",S.indexOf("-->")===-1){o.cue.id=S;continue}case"CUE":if(!o.cue){o.state="BADCUE";continue}try{x(S,o.cue,o.regionList)}catch(v){o.cue=null,o.state="BADCUE";continue}o.state="CUETEXT";continue;case"CUETEXT":{var w=S.indexOf("-->")!==-1;if(!S||w&&(m=!0)){o.oncue&&o.cue&&o.oncue(o.cue),o.cue=null,o.state="ID";continue}if(o.cue===null)continue;o.cue.text&&(o.cue.text+=`
|
|
`),o.cue.text+=S}continue;case"BADCUE":S||(o.state="ID")}}}catch(v){o.state==="CUETEXT"&&o.cue&&o.oncue&&o.oncue(o.cue),o.cue=null,o.state=o.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},E.flush=function(){var d=this;try{if((d.cue||d.state==="HEADER")&&(d.buffer+=`
|
|
|
|
`,d.parse()),d.state==="INITIAL"||d.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(o){d.onparsingerror&&d.onparsingerror(o)}return d.onflush&&d.onflush(),this},C}()},"./src/utils/webvtt-parser.ts":function(ne,V,_){"use strict";_.r(V),_.d(V,"generateCueId",function(){return k}),_.d(V,"parseWebVTT",function(){return E});var G=_("./src/polyfills/number.ts"),U=_("./src/utils/vttparser.ts"),R=_("./src/demux/id3.ts"),B=_("./src/utils/timescale-conversion.ts"),I=_("./src/remux/mp4-remuxer.ts"),D=/\r\n|\n\r|\n|\r/g,L=function(d,o,s){return s===void 0&&(s=0),d.substr(s,o.length)===o},x=function(d){var o=parseInt(d.substr(-3)),s=parseInt(d.substr(-6,2)),u=parseInt(d.substr(-9,2)),S=d.length>9?parseInt(d.substr(0,d.indexOf(":"))):0;if(!Object(G.isFiniteNumber)(o)||!Object(G.isFiniteNumber)(s)||!Object(G.isFiniteNumber)(u)||!Object(G.isFiniteNumber)(S))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+d);return o+=1e3*s,o+=60*1e3*u,o+=60*60*1e3*S,o},A=function(d){for(var o=5381,s=d.length;s;)o=o*33^d.charCodeAt(--s);return(o>>>0).toString()};function k(b,d,o){return A(b.toString())+A(d.toString())+A(o)}var C=function(d,o,s){var u=d[o],S=d[u.prevCC];if(!S||!S.new&&u.new){d.ccOffset=d.presentationOffset=u.start,u.new=!1;return}for(;(f=S)!==null&&f!==void 0&&f.new;){var f;d.ccOffset+=u.start-S.start,u.new=!1,u=S,S=d[u.prevCC]}d.presentationOffset=s};function E(b,d,o,s,u,S,f,m){var w=new U.VTTParser,v=Object(R.utf8ArrayToStr)(new Uint8Array(b)).trim().replace(D,`
|
|
`).split(`
|
|
`),h=[],c=Object(B.toMpegTsClockFromTimescale)(d,o),l="00:00.000",a=0,g=0,p,y=!0,M=!1;w.oncue=function(F){var j=s[u],W=s.ccOffset,O=(a-c)/9e4;if(j!=null&&j.new&&(g!==void 0?W=s.ccOffset=j.start:C(s,u,O)),O&&(W=O-s.presentationOffset),M){var P=F.endTime-F.startTime,H=Object(I.normalizePts)((F.startTime+W-g)*9e4,S*9e4)/9e4;F.startTime=H,F.endTime=H+P}var X=F.text.trim();F.text=decodeURIComponent(encodeURIComponent(X)),F.id||(F.id=k(F.startTime,F.endTime,X)),F.endTime>0&&h.push(F)},w.onparsingerror=function(F){p=F},w.onflush=function(){if(p){m(p);return}f(h)},v.forEach(function(F){if(y)if(L(F,"X-TIMESTAMP-MAP=")){y=!1,M=!0,F.substr(16).split(",").forEach(function(j){L(j,"LOCAL:")?l=j.substr(6):L(j,"MPEGTS:")&&(a=parseInt(j.substr(7)))});try{g=x(l)/1e3}catch(j){M=!1,p=j}return}else F===""&&(y=!1);w.parse(F+`
|
|
`)}),w.flush()}},"./src/utils/xhr-loader.ts":function(ne,V,_){"use strict";_.r(V);var G=_("./src/utils/logger.ts"),U=_("./src/loader/load-stats.ts"),R=/^age:\s*[\d.]+\s*$/m,B=function(){function I(L){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=void 0,this.loader=null,this.stats=void 0,this.xhrSetup=L?L.xhrSetup:null,this.stats=new U.LoadStats,this.retryDelay=0}var D=I.prototype;return D.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},D.abortInternal=function(){var x=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),x&&(x.onreadystatechange=null,x.onprogress=null,x.readyState!==4&&(this.stats.aborted=!0,x.abort()))},D.abort=function(){var x;this.abortInternal(),(x=this.callbacks)!==null&&x!==void 0&&x.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},D.load=function(x,A,k){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=x,this.config=A,this.callbacks=k,this.retryDelay=A.retryDelay,this.loadInternal()},D.loadInternal=function(){var x=this.config,A=this.context;if(!x)return;var k=this.loader=new self.XMLHttpRequest,C=this.stats;C.loading.first=0,C.loaded=0;var E=this.xhrSetup;try{if(E)try{E(k,A.url)}catch(o){k.open("GET",A.url,!0),E(k,A.url)}k.readyState||k.open("GET",A.url,!0);var b=this.context.headers;if(b)for(var d in b)k.setRequestHeader(d,b[d])}catch(o){this.callbacks.onError({code:k.status,text:o.message},A,k);return}A.rangeEnd&&k.setRequestHeader("Range","bytes="+A.rangeStart+"-"+(A.rangeEnd-1)),k.onreadystatechange=this.readystatechange.bind(this),k.onprogress=this.loadprogress.bind(this),k.responseType=A.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),x.timeout),k.send()},D.readystatechange=function(){var x=this.context,A=this.loader,k=this.stats;if(!x||!A)return;var C=A.readyState,E=this.config;if(k.aborted)return;if(C>=2)if(self.clearTimeout(this.requestTimeout),k.loading.first===0&&(k.loading.first=Math.max(self.performance.now(),k.loading.start)),C===4){A.onreadystatechange=null,A.onprogress=null;var b=A.status;if(b>=200&&b<300){k.loading.end=Math.max(self.performance.now(),k.loading.first);var d,o;if(x.responseType==="arraybuffer"?(d=A.response,o=d.byteLength):(d=A.responseText,o=d.length),k.loaded=k.total=o,!this.callbacks)return;var s=this.callbacks.onProgress;if(s&&s(k,x,d,A),!this.callbacks)return;var u={url:A.responseURL,data:d};this.callbacks.onSuccess(u,k,x,A)}else k.retry>=E.maxRetry||b>=400&&b<499?(G.logger.error(b+" while loading "+x.url),this.callbacks.onError({code:b,text:A.statusText},x,A)):(G.logger.warn(b+" while loading "+x.url+", retrying in "+this.retryDelay+"..."),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,E.maxRetryDelay),k.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),E.timeout)},D.loadtimeout=function(){G.logger.warn("timeout while loading "+this.context.url);var x=this.callbacks;x&&(this.abortInternal(),x.onTimeout(this.stats,this.context,this.loader))},D.loadprogress=function(x){var A=this.stats;A.loaded=x.loaded,x.lengthComputable&&(A.total=x.total)},D.getCacheAge=function(){var x=null;if(this.loader&&R.test(this.loader.getAllResponseHeaders())){var A=this.loader.getResponseHeader("age");x=A?parseFloat(A):null}return x},I}();V.default=B}}).default})},vHTk:function(ot,We,ee){ot.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}},we55:function(ot,We,ee){ot.exports={bg:"bg___3PaSA",flexRow:"flexRow___1k1iY",flexJustifyCenter:"flexJustifyCenter___MzzvD",flexAlignEnd:"flexAlignEnd___1KYBf",flexAlignCenter:"flexAlignCenter___3XoYY",flexColumn:"flexColumn___28jeJ",formWrap:"formWrap___2IoYS",titleWrap:"titleWrap___2LenH",fieldWrap:"fieldWrap___3zhLT",mdWrap:"mdWrap___3fVSN",backgroundFa:"backgroundFa___21qxJ",button:"button___3eTeL"}},wzkS:function(ot,We,ee){"use strict";ee.d(We,"c",function(){return U}),ee.d(We,"b",function(){return R}),ee.d(We,"d",function(){return B}),ee.d(We,"a",function(){return D}),ee.d(We,"e",function(){return L});var ne=ee("9og8"),V=ee("WmNS"),_=ee.n(V),G=ee("ErOA");function U(x){return Object(G.c)("libraries/".concat(x,".json"))}function R(){return Object(G.c)("library_tags.json")}function B(x){return I.apply(this,arguments)}function I(){return I=Object(ne.a)(_.a.mark(function x(A){var k;return _.a.wrap(function(E){for(;;)switch(E.prev=E.next){case 0:return E.next=2,Object(G.b)("attachments/".concat(A,".json"));case 2:return k=E.sent,E.abrupt("return",k.status===0);case 4:case"end":return E.stop()}},x)})),I.apply(this,arguments)}function D(x){return Object(G.f)("libraries.json",x)}function L(x,A){return Object(G.g)("libraries/".concat(x,".json"),A)}},y5JW:function(ot,We,ee){"use strict";ee.d(We,"c",function(){return b}),ee.d(We,"a",function(){return d});var ne=ee("DZo9"),V=ee("8z0m"),_=ee("+L6B"),G=ee("2/Rp"),U=ee("9og8"),R=ee("k1fw"),B=ee("oBTY"),I=ee("miYZ"),D=ee("tsqr"),L=ee("WmNS"),x=ee.n(L),A=ee("q1tI"),k=ee.n(A),C=ee("m3rI"),E=ee("wzkS"),b="\u3000\u3000";function d(o){var s=["Bytes","KB","MB","GB","TB"];if(o==0)return"0 Byte";var u=parseInt(""+Math.floor(Math.log(o)/Math.log(1024)),10);return(o/Math.pow(1024,u)).toFixed(1)+" "+s[u]}We.b=function(o){var s=o.value,u=s===void 0?[]:s,S=o.action,f=o.onChange,m=o.className,w=o.maxSize,v=w===void 0?150:w,h=o.title,c=h===void 0?"\u6587\u4EF6\u4E0A\u4F20":h,l=o.accept,a=l===void 0?null:l,g={multiple:!1,fileList:u,accept:a,withCredentials:!0,beforeUpload:function(M){var F=M.size/1024/1024;return F<v?!0:(D.b.error("\u8BE5\u6587\u4EF6\u65E0\u6CD5\u4E0A\u4F20\u3002\u8D85\u8FC7\u6587\u4EF6\u5927\u5C0F\u9650\u5236(".concat(v,"MB),\u5EFA\u8BAE\u4E0A\u4F20\u5230\u767E\u5EA6\u4E91\u7B49\u5176\u5B83\u5171\u4EAB\u5DE5\u5177\u91CC\uFF0C\u7136\u540E\u518Dtxt\u6587\u6863\u91CC\u7ED9\u51FA\u94FE\u63A5\u4EE5\u53CA\u5171\u4EAB\u5BC6\u7801\u5E76\u4E0A\u4F20")),Promise.reject())},action:"".concat(C.a.API_SERVER,"/api/attachments.json"),onChange:function(M){var F=Object(B.a)(M.fileList);F=F.map(function(j){return j.name.indexOf(b)===-1&&(j.name="".concat(j.name).concat(b).concat(d(j.size))),Object(R.a)({},j)}),f(F)},onRemove:function(){var y=Object(U.a)(x.a.mark(function F(j){var W,O,P;return x.a.wrap(function(X){for(;;)switch(X.prev=X.next){case 0:if(W=j.size/1024/1024,!(j.status==="uploading")){X.next=3;break}return X.abrupt("return",!0);case 3:if(W<v){X.next=7;break}return X.abrupt("return",!0);case 7:if(O=j.response?j.response.id:j.uid,!O){X.next=15;break}return X.next=11,Object(E.d)(j.response?j.response.id:j.id);case 11:return P=X.sent,X.abrupt("return",P);case 15:return X.abrupt("return",!0);case 16:case"end":return X.stop()}},F)}));function M(F){return y.apply(this,arguments)}return M}()};function p(y){y.preventDefault(),y.stopPropagation()}return k.a.createElement("div",{className:"single-upload ".concat(m||"")},k.a.createElement(V.a,g,k.a.createElement(G.a,{type:"primary",title:u.length>0?"\u6BCF\u6B21\u53EA\u80FD\u4E0A\u4F20\u4E00\u4E2A\u8D44\u6E90\uFF0C \u5220\u9664\u4E0B\u9762\u8D44\u6E90\u53EF\u91CD\u65B0\u4E0A\u4F20 ":"",disabled:u.length>0,ghost:!0},c),k.a.createElement("span",{onClick:p,style:{marginLeft:10}},"(\u5355\u4E2A\u6587\u4EF6\u6700\u5927",v,"M) ")))}}}]);
|