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.
143 lines
768 KiB
143 lines
768 KiB
(window.webpackJsonp=window.webpackJsonp||[]).push([[274,5,6,7,16],{"+NIl":function(tt,Ve,te){(function(J){J(te("VrN/"))})(function(J){"use strict";J.defineMode("stex",function(z,D){"use strict";function K(w,x){w.cmdState.push(x)}function F(w){return w.cmdState.length>0?w.cmdState[w.cmdState.length-1]:null}function O(w){var x=w.cmdState.pop();x&&x.closeBracket()}function N(w){for(var x=w.cmdState,v=x.length-1;v>=0;v--){var d=x[v];if(d.name=="DEFAULT")continue;return d}return{styleIdentifier:function(){return null}}}function I(w,x,v){return function(){this.name=w,this.bracketNo=0,this.style=x,this.styles=v,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var R={};R.importmodule=I("importmodule","tag",["string","builtin"]),R.documentclass=I("documentclass","tag",["","atom"]),R.usepackage=I("usepackage","tag",["atom"]),R.begin=I("begin","tag",["atom"]),R.end=I("end","tag",["atom"]),R.label=I("label","tag",["atom"]),R.ref=I("ref","tag",["atom"]),R.eqref=I("eqref","tag",["atom"]),R.cite=I("cite","tag",["atom"]),R.bibitem=I("bibitem","tag",["atom"]),R.Bibitem=I("Bibitem","tag",["atom"]),R.RBibitem=I("RBibitem","tag",["atom"]),R.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function C(w,x){w.f=x}function h(w,x){var v;if(w.match(/^\\[a-zA-Z@]+/)){var d=w.current().slice(1);return v=R.hasOwnProperty(d)?R[d]:R.DEFAULT,v=new v,K(x,v),C(x,P),v.style}if(w.match(/^\\[$&%#{}_]/))return"tag";if(w.match(/^\\[,;!\/\\]/))return"tag";if(w.match("\\["))return C(x,function(l,s){return y(l,s,"\\]")}),"keyword";if(w.match("\\("))return C(x,function(l,s){return y(l,s,"\\)")}),"keyword";if(w.match("$$"))return C(x,function(l,s){return y(l,s,"$$")}),"keyword";if(w.match("$"))return C(x,function(l,s){return y(l,s,"$")}),"keyword";var o=w.next();if(o=="%")return w.skipToEnd(),"comment";if(o=="}"||o=="]"){if(v=F(x),v)v.closeBracket(o),C(x,P);else return"error";return"bracket"}else return o=="{"||o=="["?(v=R.DEFAULT,v=new v,K(x,v),"bracket"):/\d/.test(o)?(w.eatWhile(/[\w.%]/),"atom"):(w.eatWhile(/[\w\-_]/),v=N(x),v.name=="begin"&&(v.argument=w.current()),v.styleIdentifier())}function y(w,x,v){if(w.eatSpace())return null;if(v&&w.match(v))return C(x,h),"keyword";if(w.match(/^\\[a-zA-Z@]+/))return"tag";if(w.match(/^[a-zA-Z]+/))return"variable-2";if(w.match(/^\\[$&%#{}_]/))return"tag";if(w.match(/^\\[,;!\/]/))return"tag";if(w.match(/^[\^_&]/))return"tag";if(w.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(w.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var d=w.next();return d=="{"||d=="}"||d=="["||d=="]"||d=="("||d==")"?"bracket":d=="%"?(w.skipToEnd(),"comment"):"error"}function P(w,x){var v=w.peek(),d;return v=="{"||v=="["?(d=F(x),d.openBracket(v),w.eat(v),C(x,h),"bracket"):/[ \t\r]/.test(v)?(w.eat(v),null):(C(x,h),O(x),h(w,x))}return{startState:function(){var w=D.inMathMode?function(x,v){return y(x,v)}:h;return{cmdState:[],f:w}},copyState:function(w){return{cmdState:w.cmdState.slice(),f:w.f}},token:function(w,x){return x.f(w,x)},blankLine:function(w){w.f=h,w.cmdState.length=0},lineComment:"%"}}),J.defineMIME("text/x-stex","stex"),J.defineMIME("text/x-latex","stex")})},"+ua5":function(tt,Ve,te){},"19Vz":function(tt,Ve,te){(function(J){J(te("VrN/"))})(function(J){J.defineOption("placeholder","",function(I,R,C){var h=C&&C!=J.Init;if(R&&!h)I.on("blur",F),I.on("change",O),I.on("swapDoc",O),J.on(I.getInputField(),"compositionupdate",I.state.placeholderCompose=function(){K(I)}),O(I);else if(!R&&h){I.off("blur",F),I.off("change",O),I.off("swapDoc",O),J.off(I.getInputField(),"compositionupdate",I.state.placeholderCompose),z(I);var y=I.getWrapperElement();y.className=y.className.replace(" CodeMirror-empty","")}R&&!I.hasFocus()&&F(I)});function z(I){I.state.placeholder&&(I.state.placeholder.parentNode.removeChild(I.state.placeholder),I.state.placeholder=null)}function D(I){z(I);var R=I.state.placeholder=document.createElement("pre");R.style.cssText="height: 0; overflow: visible",R.style.direction=I.getOption("direction"),R.className="CodeMirror-placeholder CodeMirror-line-like";var C=I.getOption("placeholder");typeof C=="string"&&(C=document.createTextNode(C)),R.appendChild(C),I.display.lineSpace.insertBefore(R,I.display.lineSpace.firstChild)}function K(I){setTimeout(function(){var R=!1,C=I.getInputField();C.nodeName=="TEXTAREA"?R=!C.value:I.lineCount()==1&&(R=!/[^\u200b]/.test(C.querySelector(".CodeMirror-line").textContent)),R?D(I):z(I)},20)}function F(I){N(I)&&D(I)}function O(I){var R=I.getWrapperElement(),C=N(I);R.className=R.className.replace(" CodeMirror-empty","")+(C?" CodeMirror-empty":""),C?D(I):z(I)}function N(I){return I.lineCount()===1&&I.getLine(0)===""}})},"1eCo":function(tt,Ve,te){(function(J){J(te("VrN/"))})(function(J){"use strict";var z={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},D={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};J.defineMode("xml",function(K,F){var O=K.indentUnit,N={},I=F.htmlMode?z:D;for(var R in I)N[R]=I[R];for(var R in F)N[R]=F[R];var C,h;function y(a,E){function g(U){return E.tokenize=U,U(a,E)}var p=a.next();if(p=="<")return a.eat("!")?a.eat("[")?a.match("CDATA[")?g(x("atom","]]>")):null:a.match("--")?g(x("comment","-->")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),g(v(1))):null:a.eat("?")?(a.eatWhile(/[\w\._\-]/),E.tokenize=x("meta","?>"),"meta"):(C=a.eat("/")?"closeTag":"openTag",E.tokenize=P,"tag bracket");if(p=="&"){var _;return a.eat("#")?a.eat("x")?_=a.eatWhile(/[a-fA-F\d]/)&&a.eat(";"):_=a.eatWhile(/[\d]/)&&a.eat(";"):_=a.eatWhile(/[\w\.\-:]/)&&a.eat(";"),_?"atom":"error"}else return a.eatWhile(/[^&<]/),null}y.isInText=!0;function P(a,E){var g=a.next();if(g==">"||g=="/"&&a.eat(">"))return E.tokenize=y,C=g==">"?"endTag":"selfcloseTag","tag bracket";if(g=="=")return C="equals",null;if(g=="<"){E.tokenize=y,E.state=s,E.tagName=E.tagStart=null;var p=E.tokenize(a,E);return p?p+" tag error":"tag error"}else return/[\'\"]/.test(g)?(E.tokenize=w(g),E.stringStartCol=a.column(),E.tokenize(a,E)):(a.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function w(a){var E=function(g,p){for(;!g.eol();)if(g.next()==a){p.tokenize=P;break}return"string"};return E.isInAttribute=!0,E}function x(a,E){return function(g,p){for(;!g.eol();){if(g.match(E)){p.tokenize=y;break}g.next()}return a}}function v(a){return function(E,g){for(var p;(p=E.next())!=null;){if(p=="<")return g.tokenize=v(a+1),g.tokenize(E,g);if(p==">")if(a==1){g.tokenize=y;break}else return g.tokenize=v(a-1),g.tokenize(E,g)}return"meta"}}function d(a,E,g){this.prev=a.context,this.tagName=E,this.indent=a.indented,this.startOfLine=g,(N.doNotIndent.hasOwnProperty(E)||a.context&&a.context.noIndent)&&(this.noIndent=!0)}function o(a){a.context&&(a.context=a.context.prev)}function l(a,E){for(var g;;){if(!a.context)return;if(g=a.context.tagName,!N.contextGrabbers.hasOwnProperty(g)||!N.contextGrabbers[g].hasOwnProperty(E))return;o(a)}}function s(a,E,g){return a=="openTag"?(g.tagStart=E.column(),S):a=="closeTag"?b:s}function S(a,E,g){return a=="word"?(g.tagName=E.current(),h="tag",T):N.allowMissingTagName&&a=="endTag"?(h="tag bracket",T(a,E,g)):(h="error",S)}function b(a,E,g){if(a=="word"){var p=E.current();return g.context&&g.context.tagName!=p&&N.implicitlyClosed.hasOwnProperty(g.context.tagName)&&o(g),g.context&&g.context.tagName==p||N.matchClosing===!1?(h="tag",f):(h="tag error",L)}else return N.allowMissingTagName&&a=="endTag"?(h="tag bracket",f(a,E,g)):(h="error",L)}function f(a,E,g){return a!="endTag"?(h="error",f):(o(g),s)}function L(a,E,g){return h="error",f(a,E,g)}function T(a,E,g){if(a=="word")return h="attribute",m;if(a=="endTag"||a=="selfcloseTag"){var p=g.tagName,_=g.tagStart;return g.tagName=g.tagStart=null,a=="selfcloseTag"||N.autoSelfClosers.hasOwnProperty(p)?l(g,p):(l(g,p),g.context=new d(g,p,_==g.indented)),s}return h="error",T}function m(a,E,g){return a=="equals"?c:(N.allowMissing||(h="error"),T(a,E,g))}function c(a,E,g){return a=="string"?u:a=="word"&&N.allowUnquoted?(h="string",T):(h="error",T(a,E,g))}function u(a,E,g){return a=="string"?u:T(a,E,g)}return{startState:function(a){var E={tokenize:y,state:s,indented:a||0,tagName:null,tagStart:null,context:null};return a!=null&&(E.baseIndent=a),E},token:function(a,E){if(!E.tagName&&a.sol()&&(E.indented=a.indentation()),a.eatSpace())return null;C=null;var g=E.tokenize(a,E);return(g||C)&&g!="comment"&&(h=null,E.state=E.state(C||g,a,E),h&&(g=h=="error"?g+" error":h)),g},indent:function(a,E,g){var p=a.context;if(a.tokenize.isInAttribute)return a.tagStart==a.indented?a.stringStartCol+1:a.indented+O;if(p&&p.noIndent)return J.Pass;if(a.tokenize!=P&&a.tokenize!=y)return g?g.match(/^(\s*)/)[0].length:0;if(a.tagName)return N.multilineTagIndentPastTag!==!1?a.tagStart+a.tagName.length+2:a.tagStart+O*(N.multilineTagIndentFactor||1);if(N.alignCDATA&&/<!\[CDATA\[/.test(E))return 0;var _=E&&/^<(\/)?([\w_:\.-]*)/.exec(E);if(_&&_[1])for(;p;)if(p.tagName==_[2]){p=p.prev;break}else if(N.implicitlyClosed.hasOwnProperty(p.tagName))p=p.prev;else break;else if(_)for(;p;){var U=N.contextGrabbers[p.tagName];if(U&&U.hasOwnProperty(_[2]))p=p.prev;else break}for(;p&&p.prev&&!p.startOfLine;)p=p.prev;return p?p.indent+O:a.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:N.htmlMode?"html":"xml",helperType:N.htmlMode?"html":"xml",skipAttribute:function(a){a.state==c&&(a.state=T)},xmlCurrentTag:function(a){return a.tagName?{name:a.tagName,close:a.type=="closeTag"}:null},xmlCurrentContext:function(a){for(var E=[],g=a.context;g;g=g.prev)g.tagName&&E.push(g.tagName);return E.reverse()}}}),J.defineMIME("text/xml","xml"),J.defineMIME("application/xml","xml"),J.mimeModes.hasOwnProperty("text/html")||J.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"55Ip":function(tt,Ve,te){"use strict";te.d(Ve,"a",function(){return l});var J=te("Ty5D"),z=te("dI71"),D=te("cDcd"),K=te.n(D),F=te("YS25"),O=te("17x9"),N=te.n(O),I=te("wx14"),R=te("zLVn"),C=te("9R94"),h=function(c){Object(z.a)(u,c);function u(){for(var E,g=arguments.length,p=new Array(g),_=0;_<g;_++)p[_]=arguments[_];return E=c.call.apply(c,[this].concat(p))||this,E.history=Object(F.a)(E.props),E}var a=u.prototype;return a.render=function(){return K.a.createElement(J.c,{history:this.history,children:this.props.children})},u}(K.a.Component),y=function(c){Object(z.a)(u,c);function u(){for(var E,g=arguments.length,p=new Array(g),_=0;_<g;_++)p[_]=arguments[_];return E=c.call.apply(c,[this].concat(p))||this,E.history=Object(F.b)(E.props),E}var a=u.prototype;return a.render=function(){return K.a.createElement(J.c,{history:this.history,children:this.props.children})},u}(K.a.Component),P=function(u,a){return typeof u=="function"?u(a):u},w=function(u,a){return typeof u=="string"?Object(F.c)(u,null,null,a):u},x=function(u){return u},v=K.a.forwardRef;typeof v=="undefined"&&(v=x);function d(c){return!!(c.metaKey||c.altKey||c.ctrlKey||c.shiftKey)}var o=v(function(c,u){var a=c.innerRef,E=c.navigate,g=c.onClick,p=Object(R.a)(c,["innerRef","navigate","onClick"]),_=p.target,U=Object(I.a)({},p,{onClick:function(W){try{g&&g(W)}catch(k){throw W.preventDefault(),k}!W.defaultPrevented&&W.button===0&&(!_||_==="_self")&&!d(W)&&(W.preventDefault(),E())}});return x!==v?U.ref=u||a:U.ref=a,K.a.createElement("a",U)}),l=v(function(c,u){var a=c.component,E=a===void 0?o:a,g=c.replace,p=c.to,_=c.innerRef,U=Object(R.a)(c,["component","replace","to","innerRef"]);return K.a.createElement(J.e.Consumer,null,function(B){B||Object(C.a)(!1);var W=B.history,k=w(P(p,B.location),B.location),M=k?W.createHref(k):"",H=Object(I.a)({},U,{href:M,navigate:function(){var ee=P(p,B.location),ie=g?W.replace:W.push;ie(ee)}});return x!==v?H.ref=u||_:H.innerRef=_,K.a.createElement(E,H)})});if(!1)var s,S;var b=function(u){return u},f=K.a.forwardRef;typeof f=="undefined"&&(f=b);function L(){for(var c=arguments.length,u=new Array(c),a=0;a<c;a++)u[a]=arguments[a];return u.filter(function(E){return E}).join(" ")}var T=f(function(c,u){var a=c["aria-current"],E=a===void 0?"page":a,g=c.activeClassName,p=g===void 0?"active":g,_=c.activeStyle,U=c.className,B=c.exact,W=c.isActive,k=c.location,M=c.sensitive,H=c.strict,X=c.style,ee=c.to,ie=c.innerRef,ve=Object(R.a)(c,["aria-current","activeClassName","activeStyle","className","exact","isActive","location","sensitive","strict","style","to","innerRef"]);return K.a.createElement(J.e.Consumer,null,function(pe){pe||Object(C.a)(!1);var he=k||pe.location,ce=w(P(ee,he),he),fe=ce.pathname,ne=fe&&fe.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),me=ne?Object(J.f)(he.pathname,{path:ne,exact:B,sensitive:M,strict:H}):null,$=!!(W?W(me,he):me),ae=$?L(U,p):U,q=$?Object(I.a)({},X,{},_):X,Ee=Object(I.a)({"aria-current":$&&E||null,className:ae,style:q,to:ce},ve);return b!==f?Ee.ref=u||ie:Ee.innerRef=ie,K.a.createElement(l,Ee)})});if(!1)var m},"7Cbv":function(tt,Ve,te){"use strict";var J=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),z=new Uint8Array(16);function D(){if(!J)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return J(z)}var K=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function F(P){return typeof P=="string"&&K.test(P)}for(var O=F,N=[],I=0;I<256;++I)N.push((I+256).toString(16).substr(1));function R(P){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,x=(N[P[w+0]]+N[P[w+1]]+N[P[w+2]]+N[P[w+3]]+"-"+N[P[w+4]]+N[P[w+5]]+"-"+N[P[w+6]]+N[P[w+7]]+"-"+N[P[w+8]]+N[P[w+9]]+"-"+N[P[w+10]]+N[P[w+11]]+N[P[w+12]]+N[P[w+13]]+N[P[w+14]]+N[P[w+15]]).toLowerCase();if(!O(x))throw TypeError("Stringified UUID is invalid");return x}var C=R;function h(P,w,x){P=P||{};var v=P.random||(P.rng||D)();if(v[6]=v[6]&15|64,v[8]=v[8]&63|128,w){x=x||0;for(var d=0;d<16;++d)w[x+d]=v[d];return w}return C(v)}var y=Ve.a=h},"7ahc":function(tt,Ve,te){"use strict";te.d(Ve,"a",function(){return S});var J=te("k1fw"),z=te("0Owb"),D=te("+L6B"),K=te("2/Rp"),F=te("y8nQ"),O=te("Vl3Y"),N=te("tJVT"),I=te("OaEy"),R=te("2fM7"),C=te("cDcd"),h=te.n(C),y=te("VrN/"),P=te.n(y),w=te("p77/"),x=te.n(w),v=te("c5Ni"),d=te.n(v),o=R.a.Option,l={labelCol:{span:4},wrapperCol:{span:20}},s={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"]};Ve.b=function(b){var f=b.callback,L=b.onCancel,T=Object(C.useState)("python"),m=Object(N.a)(T,2),c=m[0],u=m[1];function a(g){u(s[g][1])}function E(g){f(g)}return h.a.createElement(O.a,Object(z.a)({},l,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:E}),h.a.createElement(O.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},h.a.createElement(R.a,{onChange:a},Object.keys(s).map(function(g){return h.a.createElement(o,{key:g,value:g},s[g][0])}))),h.a.createElement(O.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},h.a.createElement(S,{mode:c})),h.a.createElement("div",{className:"flex-container flex-end"},h.a.createElement(K.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),h.a.createElement(K.a,{type:"ghost",onClick:L},"\u53D6\u6D88")))};function S(b){var f=b.value,L=b.onChange,T=b.mode,m=b.options,c=m===void 0?{}:m,u=Object(C.useRef)(),a=Object(C.useState)(),E=Object(N.a)(a,2),g=E[0],p=E[1];return Object(C.useEffect)(function(){if(g){function _(U){var B=U.getValue();L&&L(B)}return g.on("change",_),function(){g.off("change",_)}}},[g,L]),Object(C.useEffect)(function(){g&&g.setOption("mode",T)},[g,T]),Object(C.useEffect)(function(){g&&((f!==g.getValue()||f==="")&&setTimeout(function(){g.setValue(f||" ")},300))},[g,f]),Object(C.useEffect)(function(){if(u.current&&!g){var _=P.a.fromTextArea(u.current,Object(J.a)({mode:T,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},c));p(_)}},[u.current,g]),h.a.createElement("div",{className:"my-codemirror-container"},h.a.createElement("textarea",{ref:u}))}},"8EBN":function(tt,Ve,te){(function(J){J(te("VrN/"))})(function(J){"use strict";J.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 z=0;z<J.modeInfo.length;z++){var D=J.modeInfo[z];D.mimes&&(D.mime=D.mimes[0])}J.findModeByMIME=function(K){K=K.toLowerCase();for(var F=0;F<J.modeInfo.length;F++){var O=J.modeInfo[F];if(O.mime==K)return O;if(O.mimes){for(var N=0;N<O.mimes.length;N++)if(O.mimes[N]==K)return O}}if(/\+xml$/.test(K))return J.findModeByMIME("application/xml");if(/\+json$/.test(K))return J.findModeByMIME("application/json")},J.findModeByExtension=function(K){K=K.toLowerCase();for(var F=0;F<J.modeInfo.length;F++){var O=J.modeInfo[F];if(O.ext){for(var N=0;N<O.ext.length;N++)if(O.ext[N]==K)return O}}},J.findModeByFileName=function(K){for(var F=0;F<J.modeInfo.length;F++){var O=J.modeInfo[F];if(O.file&&O.file.test(K))return O}var N=K.lastIndexOf("."),I=N>-1&&K.substring(N+1,K.length);if(I)return J.findModeByExtension(I)},J.findModeByName=function(K){K=K.toLowerCase();for(var F=0;F<J.modeInfo.length;F++){var O=J.modeInfo[F];if(O.name.toLowerCase()==K)return O;if(O.alias){for(var N=0;N<O.alias.length;N++)if(O.alias[N].toLowerCase()==K)return O}}}})},"8hTe":function(tt,Ve,te){tt.exports={button:"button___1wy9m"}},"9Bee":function(tt,Ve,te){"use strict";var J=te("DYRE"),z=te("zeV3"),D=te("+L6B"),K=te("2/Rp"),F=te("k1fw"),O=te("tJVT"),N=te("cDcd"),I=te.n(N),R=te("vg9a"),C=te("DlQD"),h=te.n(C),y=te("rUJ1");function P(he,ce){var fe=he.match(/^(\s+)(?:```)/);if(fe===null)return ce;var ne=fe[1];return ce.split(`
|
|
`).map(function(me){var $=me.match(/^\s+/);if($===null)return me;var ae=Object(O.a)($,1),q=ae[0];return q.length>=ne.length?me.slice(ne.length):me}).join(`
|
|
`)}var w=[],x=["<ul>"],v=new h.a.Renderer,d=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function o(){w.length=0,x=["<ul>"]}var l={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function s(he,ce,fe,ne){if(ce>=he.length||he[ce].level<=fe)return ce;var me=he[ce];ne.push("<li><a href='#"+me.anchor+"'>"+me.text+"</a>"),ce++;var $=[];return ce=s(he,ce,me.level,$),$.length>0&&(ne.push("<ul>"),$.forEach(function(ae){ne.push(ae)}),ne.push("</ul>")),ne.push("</li>"),ce=s(he,ce,fe,ne),ce}function S(){return s(w,0,0,x),x.push("</ul>"),x.join("")}var b={heading:function(ce){var fe=d.exec(ce);if(fe)return{type:"heading",raw:fe[0],depth:fe[1].length,text:fe[2]}},fences:function(ce){var fe=this.rules.block.fences.exec(ce);if(fe){var ne=fe[0],me=P(ne,fe[3]||""),$=fe[2]?fe[2].trim():fe[2];if(["latex","katex","math"].indexOf($)>=0){var ae=T(),q=me;me=ae,m[ae]={type:"block",expression:q}}return{type:"code",raw:ne,lang:$,text:me}}}},f=/(?:\${2})([^\n`]+?)(?:\${2})/gi,L=0,T=function(){return"__special_katext_id_".concat(L++,"__")},m={};function c(){return m}function u(){L=0,m={}}function a(he){return he=he.replace(f,function(ce,fe){var ne=T();return m[ne]={type:"inline",expression:fe},ne}),he}var E=v.listitem;v.listitem=function(he){return E(a(he))};var g=v.paragraph;v.paragraph=function(he){return g(a(he))};var p=v.tablecell;v.tablecell=function(he,ce){return p(a(he),ce)},v.code=function(he,ce,fe){var ne=(ce||"").match(/\S*/)[0];return ne?["latex","katex","math"].indexOf(ne)>=0?"<p class='editormd-tex'>".concat(he,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(ce,'">').concat(fe?he:Object(y.escape)(he,!0),`</code></pre>
|
|
`):'<pre class="prettyprint linenums"><code>'+(fe?he:Object(y.escape)(he,!0))+"</code></pre>"},v.heading=function(he,ce,fe){var ne=this.options.headerPrefix+fe.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return w.push({anchor:ne,level:ce,text:he}),"<h"+ce+' id="'+ne+'">'+he+"</h"+ce+">"},h.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),h.a.use({tokenizer:b,renderer:v});var _=h.a,U=te("SJMd"),B=te("ulZh"),W=te.n(B),k=te("m3rI"),M=te("Oy/b"),H=te("p5ED"),X=te("8hTe"),ee=te.n(X),ie=/<pre[^>]*>/g;function ve(he){var ce=document.createElement("div");return ce.innerHTML=he,ce.childNodes.length===0?"":ce.childNodes[0].nodeValue}var pe=Ve.a=function(he){var ce=he.value,fe=ce===void 0?"":ce,ne=he.edit,me=ne===void 0?!1:ne,$=he.className,ae=he.showTextOnly,q=he.showLines,Ee=he.replaces,Ce=he.zoomImg,ye=he.hasMask,we=he.style,Le=we===void 0?{}:we,ke=he.stylesPrev,Fe=ke===void 0?{}:ke,Me=String(fe),Pe=Object(N.useRef)(),Ze=Object(N.useRef)(),qe=Object(N.useState)(""),Ge=Object(O.a)(qe,2),He=Ge[0],$e=Ge[1],We=Object(N.useState)("office"),ze=Object(O.a)(We,2),Se=ze[0],Je=ze[1],Qe=Object(N.useMemo)(function(){try{var de=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Q=/\"\/api\/attachments\/|\"\/attachments\/download\//g,Z=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;Me=Me.replace(de,"("+k.a.API_SERVER+"/api/attachments/").replace(Q,'"'+k.a.API_SERVER+"/api/attachments/").replace(Z,'"'+k.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,`
|
|
`)}catch(De){}var re=_(Me),se=c();if(Me.match(/\[TOC\]/)&&(re=re.replace("<p>[TOC]</p>",S()),o()),re=re.replace(/(__special_katext_id_\d+__)/g,function(De,Oe){var Ke=se[Oe],it=Ke.type,_e=Ke.expression;return Object(M.renderToString)(ve(_e)||"",{displayMode:it==="block",throwOnError:!1,output:"html"})}),re=re.replace(/▁/g,"\u2581\u2581\u2581"),u(),ae){var Te=document.createElement("div");return Te.innerHTML=re,Te.innerText}return setTimeout(function(){return ge()},500),re},[Me]),Ae=Object(N.useRef)();l.WebkitLineClamp=q,q&&(Le=Object(F.a)(Object(F.a)({},Le),l));function Ie(de){var Q=de.target;if(Q.tagName.toUpperCase()==="IMG"){if(Ce){var Z=Q.getAttribute("src");$e(Z),Je("image")}}else if(Q.tagName.toUpperCase()==="A"){var re=Q.getAttribute("href");if(re.indexOf("office")>-1)de.preventDefault(),$e(re),Je("office");else if(re.indexOf("application/pdf")>-1)de.preventDefault(),$e(re),Je("pdf");else if(re.indexOf("text/html")>-1)de.preventDefault(),$e(re),Je("html");else if(re.startsWith("#")){de.preventDefault();var se=document.getElementById(re.replace("#",""));se&&se.scrollIntoView(!0)}}}var ge=function(){var Q,Z=(Q=Ae.current)===null||Q===void 0?void 0:Q.querySelectorAll("video");Z==null||Z.forEach(function(re){if(re.oncontextmenu=function(){return!1},re.src.indexOf(".m3u8")>-1&&!re.canPlayType("application/vnd.apple.mpegurl")){if(W.a.isSupported()){var se=new W.a;se.loadSource(re.src),se.attachMedia(re)}}})};Object(N.useEffect)(function(){if(Ae.current&&Qe&&(Qe.match(ie)&&window.PR.prettyPrint()),Ae.current)return Ae.current.addEventListener("click",Ie),function(){Ae.current.removeEventListener("click",Ie),u(),o()}},[Qe,Ae.current,Ie]);var le=function(Q){if(!me)return;Q.target.nodeName==="IMG"?(Pe.current.style.display="flex",Pe.current.style.width=Q.target.clientWidth+"px",Pe.current.style.height=Q.target.clientHeight+"px",Pe.current.style.top=Q.target.offsetTop+"px",Pe.current.style.left=Q.target.offsetLeft+"px",Ze.current.src=Q.target.getAttribute("src")):Pe.current.style.display="none"};return I.a.createElement("div",{style:{position:"relative"}},I.a.createElement("div",{ref:Ae,style:Object(F.a)({},Le),className:"".concat($||""," markdown-body ").concat(ee.a.mdBody),onMouseOver:le,dangerouslySetInnerHTML:{__html:Qe}}),I.a.createElement("div",{ref:Pe,className:ee.a.button},I.a.createElement(z.a,null,I.a.createElement(K.a,{onClick:function(){return openCrop()}},"\u88C1\u526A"),I.a.createElement(K.a,{onClick:function(){return openEditor()}},"\u7F16\u8F91"))),I.a.createElement("img",{ref:Ze,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1,top:"-10000px"}}),I.a.createElement(H.a,{close:!0,data:He,type:He!=null&&He.length?Se:"",style:Object(F.a)({},Fe),onClose:function(){return $e("")}}))}},"9VGf":function(tt,Ve,te){"use strict";te.d(Ve,"a",function(){return D});var J=te("cDcd"),z=te.n(J);function D(K,F){var O=Object(J.useRef)();Object(J.useEffect)(function(){O.current=K}),Object(J.useEffect)(function(){function N(){O.current()}if(F!==null){var I=setInterval(N,F);return function(){return clearInterval(I)}}},[F])}},BU3w:function(tt,Ve,te){"use strict";te.d(Ve,"a",function(){return O});var J=te("MNnm"),z="rc-util-key";function D(N){if(N.attachTo)return N.attachTo;var I=document.querySelector("head");return I||document.body}function K(N){var I,R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(J.a)())return null;var C=document.createElement("style");if((I=R.csp)===null||I===void 0?void 0:I.nonce){var h;C.nonce=(h=R.csp)===null||h===void 0?void 0:h.nonce}C.innerHTML=N;var y=D(R),P=y.firstChild;return R.prepend&&y.prepend?y.prepend(C):R.prepend&&P?y.insertBefore(C,P):y.appendChild(C),C}var F=new Map;function O(N,I){var R=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},C=D(R);if(!F.has(C)){var h=K("",R),y=h.parentNode;F.set(C,y),y.removeChild(h)}var P=Array.from(F.get(C).children).find(function(o){return o.tagName==="STYLE"&&o[z]===I});if(P){var w,x;if(((w=R.csp)===null||w===void 0?void 0:w.nonce)&&P.nonce!==((x=R.csp)===null||x===void 0?void 0:x.nonce)){var v;P.nonce=(v=R.csp)===null||v===void 0?void 0:v.nonce}return P.innerHTML!==N&&(P.innerHTML=N),P}var d=K(N,R);return d[z]=I,d}},Bd2K:function(tt,Ve,te){(function(J){J(te("VrN/"),te("osHv"))})(function(J){J.defineOption("autoCloseTags",!1,function(R,C,h){if(h!=J.Init&&h&&R.removeKeyMap("autoCloseTags"),!C)return;var y={name:"autoCloseTags"};(typeof C!="object"||C.whenClosing!==!1)&&(y["'/'"]=function(P){return O(P)}),(typeof C!="object"||C.whenOpening!==!1)&&(y["'>'"]=function(P){return K(P)}),R.addKeyMap(y)});var z=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],D=["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 K(R){if(R.getOption("disableInput"))return J.Pass;for(var C=R.listSelections(),h=[],y=R.getOption("autoCloseTags"),P=0;P<C.length;P++){if(!C[P].empty())return J.Pass;var w=C[P].head,x=R.getTokenAt(w),v=J.innerMode(R.getMode(),x.state),d=v.state,o=v.mode.xmlCurrentTag&&v.mode.xmlCurrentTag(d),l=o&&o.name;if(!l)return J.Pass;var s=v.mode.configuration=="html",S=typeof y=="object"&&y.dontCloseTags||s&&z,b=typeof y=="object"&&y.indentTags||s&&D;x.end>w.ch&&(l=l.slice(0,l.length-x.end+w.ch));var f=l.toLowerCase();if(!l||x.type=="string"&&(x.end!=w.ch||!/[\"\']/.test(x.string.charAt(x.string.length-1))||x.string.length==1)||x.type=="tag"&&o.close||x.string.indexOf("/")==w.ch-x.start-1||S&&N(S,f)>-1||I(R,v.mode.xmlCurrentContext&&v.mode.xmlCurrentContext(d)||[],l,w,!0))return J.Pass;var L=typeof y=="object"&&y.emptyTags;if(L&&N(L,l)>-1){h[P]={text:"/>",newPos:J.Pos(w.line,w.ch+2)};continue}var T=b&&N(b,f)>-1;h[P]={indent:T,text:">"+(T?`
|
|
|
|
`:"")+"</"+l+">",newPos:T?J.Pos(w.line+1,0):J.Pos(w.line,w.ch+1)}}for(var m=typeof y=="object"&&y.dontIndentOnAutoClose,P=C.length-1;P>=0;P--){var c=h[P];R.replaceRange(c.text,C[P].head,C[P].anchor,"+insert");var u=R.listSelections().slice(0);u[P]={head:c.newPos,anchor:c.newPos},R.setSelections(u),!m&&c.indent&&(R.indentLine(c.newPos.line,null,!0),R.indentLine(c.newPos.line+1,null,!0))}}function F(R,C){for(var h=R.listSelections(),y=[],P=C?"/":"</",w=R.getOption("autoCloseTags"),x=typeof w=="object"&&w.dontIndentOnSlash,v=0;v<h.length;v++){if(!h[v].empty())return J.Pass;var d=h[v].head,o=R.getTokenAt(d),l=J.innerMode(R.getMode(),o.state),s=l.state;if(C&&(o.type=="string"||o.string.charAt(0)!="<"||o.start!=d.ch-1))return J.Pass;var S,b=l.mode.name!="xml"&&R.getMode().name=="htmlmixed";if(b&&l.mode.name=="javascript")S=P+"script";else if(b&&l.mode.name=="css")S=P+"style";else{var f=l.mode.xmlCurrentContext&&l.mode.xmlCurrentContext(s);if(!f||f.length&&I(R,f,f[f.length-1],d))return J.Pass;S=P+f[f.length-1]}R.getLine(d.line).charAt(o.end)!=">"&&(S+=">"),y[v]=S}if(R.replaceSelections(y),h=R.listSelections(),!x)for(var v=0;v<h.length;v++)(v==h.length-1||h[v].head.line<h[v+1].head.line)&&R.indentLine(h[v].head.line)}function O(R){return R.getOption("disableInput")?J.Pass:F(R,!0)}J.commands.closeTag=function(R){return F(R)};function N(R,C){if(R.indexOf)return R.indexOf(C);for(var h=0,y=R.length;h<y;++h)if(R[h]==C)return h;return-1}function I(R,C,h,y,P){if(!J.scanForClosingTag)return!1;var w=Math.min(R.lastLine()+1,y.line+500),x=J.scanForClosingTag(R,y,null,w);if(!x||x.tag!=h)return!1;for(var v=P?1:0,d=C.length-1;d>=0&&C[d]==h;d--)++v;y=x.to;for(var d=1;d<v;d++){var o=J.scanForClosingTag(R,y,null,w);if(!o||o.tag!=h)return!1;y=o.to}return!0}})},BjJ7:function(tt,Ve,te){"use strict";te.d(Ve,"d",function(){return z}),te.d(Ve,"c",function(){return D}),te.d(Ve,"e",function(){return K}),te.d(Ve,"b",function(){return F}),te.d(Ve,"a",function(){return N});var J=te("m3rI");function z(I){var R=!0;if(I.length>0){for(var C=0;C<I.length;C++)if(I[C].compile_success==0||!I[C].compile_success){R=!1;break}}else R=!1;return R}function D(I){for(var R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",C=[],h=0;h<I.length;h++){var y=I[h],P=R?"".concat(R,"/").concat(y.name):"".concat(y.name);C.push({title:y.name,isLeaf:!(y.type==="tree"),key:P})}return C}function K(I,R,C){for(var h=0;h<I.length;h++){var y=I[h];if(y.key===R){y.children=C;break}y.children&&K(y.children,R,C)}return I}function F(I,R,C){var h;return function(){var y=this,P=arguments,w=function(){h=null,C||I.apply(y,P)},x=C&&!h;clearTimeout(h),h=setTimeout(w,R),x&&I.apply(y,P)}}var O=!0,N=J.a.API_SERVER},"C+DQ":function(tt,Ve,te){},D1Df:function(tt,Ve,te){"use strict";function J(p){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?J=function(U){return typeof U}:J=function(U){return U&&typeof Symbol=="function"&&U.constructor===Symbol&&U!==Symbol.prototype?"symbol":typeof U},J(p)}function z(){return z=Object.assign||function(p){for(var _=1;_<arguments.length;_++){var U=arguments[_];for(var B in U)Object.prototype.hasOwnProperty.call(U,B)&&(p[B]=U[B])}return p},z.apply(this,arguments)}function D(p,_){var U=Object.keys(p);if(Object.getOwnPropertySymbols){var B=Object.getOwnPropertySymbols(p);_&&(B=B.filter(function(W){return Object.getOwnPropertyDescriptor(p,W).enumerable})),U.push.apply(U,B)}return U}function K(p){for(var _=1;_<arguments.length;_++){var U=arguments[_]!=null?arguments[_]:{};_%2?D(U,!0).forEach(function(B){x(p,B,U[B])}):Object.getOwnPropertyDescriptors?Object.defineProperties(p,Object.getOwnPropertyDescriptors(U)):D(U).forEach(function(B){Object.defineProperty(p,B,Object.getOwnPropertyDescriptor(U,B))})}return p}function F(p,_){if(p==null)return{};var U=O(p,_),B,W;if(Object.getOwnPropertySymbols){var k=Object.getOwnPropertySymbols(p);for(W=0;W<k.length;W++){if(B=k[W],_.indexOf(B)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(p,B))continue;U[B]=p[B]}}return U}function O(p,_){if(p==null)return{};var U={},B=Object.keys(p),W,k;for(k=0;k<B.length;k++){if(W=B[k],_.indexOf(W)>=0)continue;U[W]=p[W]}return U}function N(p,_){if(!(p instanceof _))throw new TypeError("Cannot call a class as a function")}function I(p,_){for(var U=0;U<_.length;U++){var B=_[U];B.enumerable=B.enumerable||!1,B.configurable=!0,"value"in B&&(B.writable=!0),Object.defineProperty(p,B.key,B)}}function R(p,_,U){return _&&I(p.prototype,_),U&&I(p,U),p}function C(p,_){return _&&(J(_)==="object"||typeof _=="function")?_:y(p)}function h(p){return h=Object.setPrototypeOf?Object.getPrototypeOf:function(U){return U.__proto__||Object.getPrototypeOf(U)},h(p)}function y(p){if(p===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return p}function P(p,_){if(typeof _!="function"&&_!==null)throw new TypeError("Super expression must either be null or a function");p.prototype=Object.create(_&&_.prototype,{constructor:{value:p,writable:!0,configurable:!0}}),_&&w(p,_)}function w(p,_){return w=Object.setPrototypeOf||function(B,W){return B.__proto__=W,B},w(p,_)}function x(p,_,U){return _ in p?Object.defineProperty(p,_,{value:U,enumerable:!0,configurable:!0,writable:!0}):p[_]=U,p}var v=te("cDcd"),d=te("17x9"),o=te("H38U"),l=te("aRTE");function s(p){for(var _="",U=0;U<p.length;U++){var B=p.charCodeAt(U);B<128?_+=String.fromCharCode(B):B<2048?(_+=String.fromCharCode(192|B>>6),_+=String.fromCharCode(128|B&63)):B<55296||B>=57344?(_+=String.fromCharCode(224|B>>12),_+=String.fromCharCode(128|B>>6&63),_+=String.fromCharCode(128|B&63)):(U++,B=65536+((B&1023)<<10|p.charCodeAt(U)&1023),_+=String.fromCharCode(240|B>>18),_+=String.fromCharCode(128|B>>12&63),_+=String.fromCharCode(128|B>>6&63),_+=String.fromCharCode(128|B&63))}return _}var S={size:128,level:"L",bgColor:"#FFFFFF",fgColor:"#000000",includeMargin:!1},b={},f=4,L=.1;function T(p){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,U=[];return p.forEach(function(B,W){var k=null;B.forEach(function(M,H){if(!M&&k!==null){U.push("M".concat(k+_," ").concat(W+_,"h").concat(H-k,"v1H").concat(k+_,"z")),k=null;return}if(H===B.length-1){if(!M)return;k===null?U.push("M".concat(H+_,",").concat(W+_," h1v1H").concat(H+_,"z")):U.push("M".concat(k+_,",").concat(W+_," h").concat(H+1-k,"v1H").concat(k+_,"z"));return}M&&k===null&&(k=H)})}),U.join("")}function m(p,_){return p.slice().map(function(U,B){return B<_.y||B>=_.y+_.h?U:U.map(function(W,k){return k<_.x||k>=_.x+_.w?W:!1})})}function c(p,_){var U=p.imageSettings,B=p.size,W=p.includeMargin;if(U==null)return null;var k=W?f:0,M=_.length+k*2,H=Math.floor(B*L),X=M/B,ee=(U.width||H)*X,ie=(U.height||H)*X,ve=U.x==null?_.length/2-ee/2:U.x*X,pe=U.y==null?_.length/2-ie/2:U.y*X,he=null;if(U.excavate){var ce=Math.floor(ve),fe=Math.floor(pe),ne=Math.ceil(ee+ve-ce),me=Math.ceil(ie+pe-fe);he={x:ce,y:fe,w:ne,h:me}}return{x:ve,y:pe,h:ie,w:ee,excavation:he}}var u=function(){try{new Path2D().addPath(new Path2D)}catch(p){return!1}return!0}(),a=function(p){P(_,p);function _(){var U,B;N(this,_);for(var W=arguments.length,k=new Array(W),M=0;M<W;M++)k[M]=arguments[M];return B=C(this,(U=h(_)).call.apply(U,[this].concat(k))),x(y(B),"_canvas",void 0),x(y(B),"_image",void 0),x(y(B),"state",{imgLoaded:!1}),x(y(B),"handleImageLoad",function(){B.setState({imgLoaded:!0})}),B}return R(_,[{key:"componentDidMount",value:function(){this.update()}},{key:"componentDidUpdate",value:function(){this.update()}},{key:"update",value:function(){var B=this.props,W=B.value,k=B.size,M=B.level,H=B.bgColor,X=B.fgColor,ee=B.includeMargin,ie=B.imageSettings,ve=new o(-1,l[M]);if(ve.addData(s(W)),ve.make(),this._canvas!=null){var pe=this._canvas,he=pe.getContext("2d");if(!he)return;var ce=ve.modules;if(ce===null)return;var fe=ee?f:0,ne=ce.length+fe*2,me=c(this.props,ce);ie!=null&&me!=null&&(me.excavation!=null&&(ce=m(ce,me.excavation)));var $=window.devicePixelRatio||1;pe.height=pe.width=k*$;var ae=k/ne*$;he.scale(ae,ae),he.fillStyle=H,he.fillRect(0,0,ne,ne),he.fillStyle=X,u?he.fill(new Path2D(T(ce,fe))):ce.forEach(function(q,Ee){q.forEach(function(Ce,ye){Ce&&he.fillRect(ye+fe,Ee+fe,1,1)})}),this.state.imgLoaded&&this._image&&me!=null&&he.drawImage(this._image,me.x+fe,me.y+fe,me.w,me.h)}}},{key:"render",value:function(){var B=this,W=this.props,k=W.value,M=W.size,H=W.level,X=W.bgColor,ee=W.fgColor,ie=W.style,ve=W.includeMargin,pe=W.imageSettings,he=F(W,["value","size","level","bgColor","fgColor","style","includeMargin","imageSettings"]),ce=K({height:M,width:M},ie),fe=null,ne=pe&&pe.src;return pe!=null&&ne!=null&&(fe=v.createElement("img",{src:ne,style:{display:"none"},onLoad:this.handleImageLoad,ref:function($){return B._image=$}})),v.createElement(v.Fragment,null,v.createElement("canvas",z({style:ce,height:M,width:M,ref:function($){return B._canvas=$}},he)),fe)}}]),_}(v.PureComponent);x(a,"defaultProps",S);var E=function(p){P(_,p);function _(){return N(this,_),C(this,h(_).apply(this,arguments))}return R(_,[{key:"render",value:function(){var B=this.props,W=B.value,k=B.size,M=B.level,H=B.bgColor,X=B.fgColor,ee=B.includeMargin,ie=B.imageSettings,ve=F(B,["value","size","level","bgColor","fgColor","includeMargin","imageSettings"]),pe=new o(-1,l[M]);pe.addData(s(W)),pe.make();var he=pe.modules;if(he===null)return null;var ce=ee?f:0,fe=he.length+ce*2,ne=c(this.props,he),me=null;ie!=null&&ne!=null&&(ne.excavation!=null&&(he=m(he,ne.excavation)),me=v.createElement("image",{xlinkHref:ie.src,height:ne.h,width:ne.w,x:ne.x+ce,y:ne.y+ce,preserveAspectRatio:"none"}));var $=T(he,ce);return v.createElement("svg",z({shapeRendering:"crispEdges",height:k,width:k,viewBox:"0 0 ".concat(fe," ").concat(fe)},ve),v.createElement("path",{fill:H,d:"M0,0 h".concat(fe,"v").concat(fe,"H0z")}),v.createElement("path",{fill:X,d:$}),me)}}]),_}(v.PureComponent);x(E,"defaultProps",S);var g=function(_){var U=_.renderAs,B=F(_,["renderAs"]),W=U==="svg"?E:a;return v.createElement(W,B)};g.defaultProps=K({renderAs:"canvas"},S),tt.exports=g},DlQD:function(tt,Ve,te){(function(J,z){tt.exports=z()})(this,function(){"use strict";function J(ge,le){for(var de=0;de<le.length;de++){var Q=le[de];Q.enumerable=Q.enumerable||!1,Q.configurable=!0,"value"in Q&&(Q.writable=!0),Object.defineProperty(ge,Q.key,Q)}}function z(ge,le,de){return le&&J(ge.prototype,le),de&&J(ge,de),ge}function D(ge,le){if(!ge)return;if(typeof ge=="string")return K(ge,le);var de=Object.prototype.toString.call(ge).slice(8,-1);if(de==="Object"&&ge.constructor&&(de=ge.constructor.name),de==="Map"||de==="Set")return Array.from(ge);if(de==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(de))return K(ge,le)}function K(ge,le){(le==null||le>ge.length)&&(le=ge.length);for(var de=0,Q=new Array(le);de<le;de++)Q[de]=ge[de];return Q}function F(ge,le){var de;if(typeof Symbol=="undefined"||ge[Symbol.iterator]==null){if(Array.isArray(ge)||(de=D(ge))||le&&ge&&typeof ge.length=="number"){de&&(ge=de);var Q=0;return function(){return Q>=ge.length?{done:!0}:{done:!1,value:ge[Q++]}}}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 de=ge[Symbol.iterator](),de.next.bind(de)}function O(ge,le){return le={exports:{}},ge(le,le.exports),le.exports}var N=O(function(ge){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 de(Q){ge.exports.defaults=Q}ge.exports={defaults:le(),getDefaults:le,changeDefaults:de}}),I=N.defaults,R=N.getDefaults,C=N.changeDefaults,h=/[&<>"']/,y=/[&<>"']/g,P=/[<>"']|&(?!#?\w+;)/,w=/[<>"']|&(?!#?\w+;)/g,x={"&":"&","<":"<",">":">",'"':""","'":"'"},v=function(le){return x[le]};function d(ge,le){if(le){if(h.test(ge))return ge.replace(y,v)}else if(P.test(ge))return ge.replace(w,v);return ge}var o=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function l(ge){return ge.replace(o,function(le,de){return de=de.toLowerCase(),de==="colon"?":":de.charAt(0)==="#"?de.charAt(1)==="x"?String.fromCharCode(parseInt(de.substring(2),16)):String.fromCharCode(+de.substring(1)):""})}var s=/(^|[^\[])\^/g;function S(ge,le){ge=ge.source||ge,le=le||"";var de={replace:function(Z,re){return re=re.source||re,re=re.replace(s,"$1"),ge=ge.replace(Z,re),de},getRegex:function(){return new RegExp(ge,le)}};return de}var b=/[^\w:]/g,f=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function L(ge,le,de){if(ge){var Q;try{Q=decodeURIComponent(l(de)).replace(b,"").toLowerCase()}catch(Z){return null}if(Q.indexOf("javascript:")===0||Q.indexOf("vbscript:")===0||Q.indexOf("data:")===0)return null}le&&!f.test(de)&&(de=a(le,de));try{de=encodeURI(de).replace(/%25/g,"%")}catch(Z){return null}return de}var T={},m=/^[^:]+:\/*[^/]*$/,c=/^([^:]+:)[\s\S]*$/,u=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(ge,le){T[" "+ge]||(m.test(ge)?T[" "+ge]=ge+"/":T[" "+ge]=_(ge,"/",!0)),ge=T[" "+ge];var de=ge.indexOf(":")===-1;return le.substring(0,2)==="//"?de?le:ge.replace(c,"$1")+le:le.charAt(0)==="/"?de?le:ge.replace(u,"$1")+le:ge+le}var E={exec:function(){}};function g(ge){for(var le=1,de,Q;le<arguments.length;le++){de=arguments[le];for(Q in de)Object.prototype.hasOwnProperty.call(de,Q)&&(ge[Q]=de[Q])}return ge}function p(ge,le){var de=ge.replace(/\|/g,function(re,se,Te){for(var De=!1,Oe=se;--Oe>=0&&Te[Oe]==="\\";)De=!De;return De?"|":" |"}),Q=de.split(/ \|/),Z=0;if(Q.length>le)Q.splice(le);else for(;Q.length<le;)Q.push("");for(;Z<Q.length;Z++)Q[Z]=Q[Z].trim().replace(/\\\|/g,"|");return Q}function _(ge,le,de){var Q=ge.length;if(Q===0)return"";for(var Z=0;Z<Q;){var re=ge.charAt(Q-Z-1);if(re===le&&!de)Z++;else if(re!==le&&de)Z++;else break}return ge.substr(0,Q-Z)}function U(ge,le){if(ge.indexOf(le[1])===-1)return-1;for(var de=ge.length,Q=0,Z=0;Z<de;Z++)if(ge[Z]==="\\")Z++;else if(ge[Z]===le[0])Q++;else if(ge[Z]===le[1]&&(Q--,Q<0))return Z;return-1}function B(ge){ge&&ge.sanitize&&!ge.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:l,edit:S,cleanUrl:L,resolveUrl:a,noopTest:E,merge:g,splitCells:p,rtrim:_,findClosingBracket:U,checkSanitizeDeprecation:B},k=N.defaults,M=W.rtrim,H=W.splitCells,X=W.escape,ee=W.findClosingBracket;function ie(ge,le,de){var Q=le.href,Z=le.title?X(le.title):null,re=ge[1].replace(/\\([\[\]])/g,"$1");return ge[0].charAt(0)!=="!"?{type:"link",raw:de,href:Q,title:Z,text:re}:{type:"image",raw:de,href:Q,title:Z,text:X(re)}}function ve(ge,le){var de=ge.match(/^(\s+)(?:```)/);if(de===null)return le;var Q=de[1];return le.split(`
|
|
`).map(function(Z){var re=Z.match(/^\s+/);if(re===null)return Z;var se=re[0];return se.length>=Q.length?Z.slice(Q.length):Z}).join(`
|
|
`)}var pe=function(){function ge(de){this.options=de||k}var le=ge.prototype;return le.space=function(Q){var Z=this.rules.block.newline.exec(Q);if(Z)return Z[0].length>1?{type:"space",raw:Z[0]}:{raw:`
|
|
`}},le.code=function(Q,Z){var re=this.rules.block.code.exec(Q);if(re){var se=Z[Z.length-1];if(se&&se.type==="paragraph")return{raw:re[0],text:re[0].trimRight()};var Te=re[0].replace(/^ {4}/gm,"");return{type:"code",raw:re[0],codeBlockStyle:"indented",text:this.options.pedantic?Te:M(Te,`
|
|
`)}}},le.fences=function(Q){var Z=this.rules.block.fences.exec(Q);if(Z){var re=Z[0],se=ve(re,Z[3]||"");return{type:"code",raw:re,lang:Z[2]?Z[2].trim():Z[2],text:se}}},le.heading=function(Q){var Z=this.rules.block.heading.exec(Q);if(Z)return{type:"heading",raw:Z[0],depth:Z[1].length,text:Z[2]}},le.nptable=function(Q){var Z=this.rules.block.nptable.exec(Q);if(Z){var re={type:"table",header:H(Z[1].replace(/^ *| *\| *$/g,"")),align:Z[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:Z[3]?Z[3].replace(/\n$/,"").split(`
|
|
`):[],raw:Z[0]};if(re.header.length===re.align.length){var se=re.align.length,Te;for(Te=0;Te<se;Te++)/^ *-+: *$/.test(re.align[Te])?re.align[Te]="right":/^ *:-+: *$/.test(re.align[Te])?re.align[Te]="center":/^ *:-+ *$/.test(re.align[Te])?re.align[Te]="left":re.align[Te]=null;for(se=re.cells.length,Te=0;Te<se;Te++)re.cells[Te]=H(re.cells[Te],re.header.length);return re}}},le.hr=function(Q){var Z=this.rules.block.hr.exec(Q);if(Z)return{type:"hr",raw:Z[0]}},le.blockquote=function(Q){var Z=this.rules.block.blockquote.exec(Q);if(Z){var re=Z[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:Z[0],text:re}}},le.list=function(Q){var Z=this.rules.block.list.exec(Q);if(Z){for(var re=Z[0],se=Z[2],Te=se.length>1,De=se[se.length-1]===")",Oe={type:"list",raw:re,ordered:Te,start:Te?+se.slice(0,-1):"",loose:!1,items:[]},Ke=Z[0].match(this.rules.block.item),it=!1,_e,ct,at,rt,xt,Et,Rt,Lt=Ke.length,pt=0;pt<Lt;pt++)_e=Ke[pt],re=_e,ct=_e.length,_e=_e.replace(/^ *([*+-]|\d+[.)]) */,""),~_e.indexOf(`
|
|
`)&&(ct-=_e.length,_e=this.options.pedantic?_e.replace(/^ {1,4}/gm,""):_e.replace(new RegExp("^ {1,"+ct+"}","gm"),"")),pt!==Lt-1&&(at=this.rules.block.bullet.exec(Ke[pt+1])[0],(Te?at.length===1||!De&&at[at.length-1]===")":at.length>1||this.options.smartLists&&at!==se)&&(rt=Ke.slice(pt+1).join(`
|
|
`),Oe.raw=Oe.raw.substring(0,Oe.raw.length-rt.length),pt=Lt-1)),xt=it||/\n\n(?!\s*$)/.test(_e),pt!==Lt-1&&(it=_e.charAt(_e.length-1)===`
|
|
`,xt||(xt=it)),xt&&(Oe.loose=!0),Et=/^\[[ xX]\] /.test(_e),Rt=void 0,Et&&(Rt=_e[1]!==" ",_e=_e.replace(/^\[[ xX]\] +/,"")),Oe.items.push({type:"list_item",raw:re,task:Et,checked:Rt,loose:xt,text:_e});return Oe}},le.html=function(Q){var Z=this.rules.block.html.exec(Q);if(Z)return{type:this.options.sanitize?"paragraph":"html",raw:Z[0],pre:!this.options.sanitizer&&(Z[1]==="pre"||Z[1]==="script"||Z[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(Z[0]):X(Z[0]):Z[0]}},le.def=function(Q){var Z=this.rules.block.def.exec(Q);if(Z){Z[3]&&(Z[3]=Z[3].substring(1,Z[3].length-1));var re=Z[1].toLowerCase().replace(/\s+/g," ");return{tag:re,raw:Z[0],href:Z[2],title:Z[3]}}},le.table=function(Q){var Z=this.rules.block.table.exec(Q);if(Z){var re={type:"table",header:H(Z[1].replace(/^ *| *\| *$/g,"")),align:Z[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:Z[3]?Z[3].replace(/\n$/,"").split(`
|
|
`):[]};if(re.header.length===re.align.length){re.raw=Z[0];var se=re.align.length,Te;for(Te=0;Te<se;Te++)/^ *-+: *$/.test(re.align[Te])?re.align[Te]="right":/^ *:-+: *$/.test(re.align[Te])?re.align[Te]="center":/^ *:-+ *$/.test(re.align[Te])?re.align[Te]="left":re.align[Te]=null;for(se=re.cells.length,Te=0;Te<se;Te++)re.cells[Te]=H(re.cells[Te].replace(/^ *\| *| *\| *$/g,""),re.header.length);return re}}},le.lheading=function(Q){var Z=this.rules.block.lheading.exec(Q);if(Z)return{type:"heading",raw:Z[0],depth:Z[2].charAt(0)==="="?1:2,text:Z[1]}},le.paragraph=function(Q){var Z=this.rules.block.paragraph.exec(Q);if(Z)return{type:"paragraph",raw:Z[0],text:Z[1].charAt(Z[1].length-1)===`
|
|
`?Z[1].slice(0,-1):Z[1]}},le.text=function(Q,Z){var re=this.rules.block.text.exec(Q);if(re){var se=Z[Z.length-1];return se&&se.type==="text"?{raw:re[0],text:re[0]}:{type:"text",raw:re[0],text:re[0]}}},le.escape=function(Q){var Z=this.rules.inline.escape.exec(Q);if(Z)return{type:"escape",raw:Z[0],text:X(Z[1])}},le.tag=function(Q,Z,re){var se=this.rules.inline.tag.exec(Q);if(se)return!Z&&/^<a /i.test(se[0])?Z=!0:Z&&/^<\/a>/i.test(se[0])&&(Z=!1),!re&&/^<(pre|code|kbd|script)(\s|>)/i.test(se[0])?re=!0:re&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(se[0])&&(re=!1),{type:this.options.sanitize?"text":"html",raw:se[0],inLink:Z,inRawBlock:re,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(se[0]):X(se[0]):se[0]}},le.link=function(Q){var Z=this.rules.inline.link.exec(Q);if(Z){var re=ee(Z[2],"()");if(re>-1){var se=Z[0].indexOf("!")===0?5:4,Te=se+Z[1].length+re;Z[2]=Z[2].substring(0,re),Z[0]=Z[0].substring(0,Te).trim(),Z[3]=""}var De=Z[2],Oe="";if(this.options.pedantic){var Ke=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(De);Ke?(De=Ke[1],Oe=Ke[3]):Oe=""}else Oe=Z[3]?Z[3].slice(1,-1):"";De=De.trim().replace(/^<([\s\S]*)>$/,"$1");var it=ie(Z,{href:De&&De.replace(this.rules.inline._escapes,"$1"),title:Oe&&Oe.replace(this.rules.inline._escapes,"$1")},Z[0]);return it}},le.reflink=function(Q,Z){var re;if((re=this.rules.inline.reflink.exec(Q))||(re=this.rules.inline.nolink.exec(Q))){var se=(re[2]||re[1]).replace(/\s+/g," ");if(se=Z[se.toLowerCase()],!se||!se.href){var Te=re[0].charAt(0);return{type:"text",raw:Te,text:Te}}var De=ie(re,se,re[0]);return De}},le.strong=function(Q,Z,re){re===void 0&&(re="");var se=this.rules.inline.strong.start.exec(Q);if(se&&(!se[1]||se[1]&&(re===""||this.rules.inline.punctuation.exec(re)))){Z=Z.slice(-1*Q.length);var Te=se[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;Te.lastIndex=0;for(var De;(se=Te.exec(Z))!=null;)if(De=this.rules.inline.strong.middle.exec(Z.slice(0,se.index+3)),De)return{type:"strong",raw:Q.slice(0,De[0].length),text:Q.slice(2,De[0].length-2)}}},le.em=function(Q,Z,re){re===void 0&&(re="");var se=this.rules.inline.em.start.exec(Q);if(se&&(!se[1]||se[1]&&(re===""||this.rules.inline.punctuation.exec(re)))){Z=Z.slice(-1*Q.length);var Te=se[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;Te.lastIndex=0;for(var De;(se=Te.exec(Z))!=null;)if(De=this.rules.inline.em.middle.exec(Z.slice(0,se.index+2)),De)return{type:"em",raw:Q.slice(0,De[0].length),text:Q.slice(1,De[0].length-1)}}},le.codespan=function(Q){var Z=this.rules.inline.code.exec(Q);if(Z){var re=Z[2].replace(/\n/g," "),se=/[^ ]/.test(re),Te=re.startsWith(" ")&&re.endsWith(" ");return se&&Te&&(re=re.substring(1,re.length-1)),re=X(re,!0),{type:"codespan",raw:Z[0],text:re}}},le.br=function(Q){var Z=this.rules.inline.br.exec(Q);if(Z)return{type:"br",raw:Z[0]}},le.del=function(Q){var Z=this.rules.inline.del.exec(Q);if(Z)return{type:"del",raw:Z[0],text:Z[1]}},le.autolink=function(Q,Z){var re=this.rules.inline.autolink.exec(Q);if(re){var se,Te;return re[2]==="@"?(se=X(this.options.mangle?Z(re[1]):re[1]),Te="mailto:"+se):(se=X(re[1]),Te=se),{type:"link",raw:re[0],text:se,href:Te,tokens:[{type:"text",raw:se,text:se}]}}},le.url=function(Q,Z){var re;if(re=this.rules.inline.url.exec(Q)){var se,Te;if(re[2]==="@")se=X(this.options.mangle?Z(re[0]):re[0]),Te="mailto:"+se;else{var De;do De=re[0],re[0]=this.rules.inline._backpedal.exec(re[0])[0];while(De!==re[0]);se=X(re[0]),re[1]==="www."?Te="http://"+se:Te=se}return{type:"link",raw:re[0],text:se,href:Te,tokens:[{type:"text",raw:se,text:se}]}}},le.inlineText=function(Q,Z,re){var se=this.rules.inline.text.exec(Q);if(se){var Te;return Z?Te=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(se[0]):X(se[0]):se[0]:Te=X(this.options.smartypants?re(se[0]):se[0]),{type:"text",raw:se[0],text:Te}}},ge}(),he=W.noopTest,ce=W.edit,fe=W.merge,ne={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:he,table:he,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};ne._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,ne._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,ne.def=ce(ne.def).replace("label",ne._label).replace("title",ne._title).getRegex(),ne.bullet=/(?:[*+-]|\d{1,9}[.)])/,ne.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,ne.item=ce(ne.item,"gm").replace(/bull/g,ne.bullet).getRegex(),ne.list=ce(ne.list).replace(/bull/g,ne.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+ne.def.source+")").getRegex(),ne._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",ne._comment=/<!--(?!-?>)[\s\S]*?-->/,ne.html=ce(ne.html,"i").replace("comment",ne._comment).replace("tag",ne._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ne.paragraph=ce(ne._paragraph).replace("hr",ne.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",ne._tag).getRegex(),ne.blockquote=ce(ne.blockquote).replace("paragraph",ne.paragraph).getRegex(),ne.normal=fe({},ne),ne.gfm=fe({},ne.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*|$)"}),ne.gfm.nptable=ce(ne.gfm.nptable).replace("hr",ne.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",ne._tag).getRegex(),ne.gfm.table=ce(ne.gfm.table).replace("hr",ne.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",ne._tag).getRegex(),ne.pedantic=fe({},ne.normal,{html:ce(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ne._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:he,paragraph:ce(ne.normal._paragraph).replace("hr",ne.hr).replace("heading",` *#{1,6} *[^
|
|
]`).replace("lheading",ne.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var me={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:he,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:he,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};me._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",me.punctuation=ce(me.punctuation).replace(/punctuation/g,me._punctuation).getRegex(),me._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",me._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",me.em.start=ce(me.em.start).replace(/punctuation/g,me._punctuation).getRegex(),me.em.middle=ce(me.em.middle).replace(/punctuation/g,me._punctuation).replace(/overlapSkip/g,me._overlapSkip).getRegex(),me.em.endAst=ce(me.em.endAst,"g").replace(/punctuation/g,me._punctuation).getRegex(),me.em.endUnd=ce(me.em.endUnd,"g").replace(/punctuation/g,me._punctuation).getRegex(),me.strong.start=ce(me.strong.start).replace(/punctuation/g,me._punctuation).getRegex(),me.strong.middle=ce(me.strong.middle).replace(/punctuation/g,me._punctuation).replace(/blockSkip/g,me._blockSkip).getRegex(),me.strong.endAst=ce(me.strong.endAst,"g").replace(/punctuation/g,me._punctuation).getRegex(),me.strong.endUnd=ce(me.strong.endUnd,"g").replace(/punctuation/g,me._punctuation).getRegex(),me.blockSkip=ce(me._blockSkip,"g").getRegex(),me.overlapSkip=ce(me._overlapSkip,"g").getRegex(),me._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,me._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,me._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])?)+(?![-_])/,me.autolink=ce(me.autolink).replace("scheme",me._scheme).replace("email",me._email).getRegex(),me._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,me.tag=ce(me.tag).replace("comment",ne._comment).replace("attribute",me._attribute).getRegex(),me._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,me._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,me._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,me.link=ce(me.link).replace("label",me._label).replace("href",me._href).replace("title",me._title).getRegex(),me.reflink=ce(me.reflink).replace("label",me._label).getRegex(),me.reflinkSearch=ce(me.reflinkSearch,"g").replace("reflink",me.reflink).replace("nolink",me.nolink).getRegex(),me.normal=fe({},me),me.pedantic=fe({},me.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:ce(/^!?\[(label)\]\((.*?)\)/).replace("label",me._label).getRegex(),reflink:ce(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",me._label).getRegex()}),me.gfm=fe({},me.normal,{escape:ce(me.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),me.gfm.url=ce(me.gfm.url,"i").replace("email",me.gfm._extended_email).getRegex(),me.breaks=fe({},me.gfm,{br:ce(me.br).replace("{2,}","*").getRegex(),text:ce(me.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var $={block:ne,inline:me},ae=N.defaults,q=$.block,Ee=$.inline;function Ce(ge){return ge.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 ye(ge){var le="",de,Q,Z=ge.length;for(de=0;de<Z;de++)Q=ge.charCodeAt(de),Math.random()>.5&&(Q="x"+Q.toString(16)),le+="&#"+Q+";";return le}var we=function(){function ge(de){this.tokens=[],this.tokens.links=Object.create(null),this.options=de||ae,this.options.tokenizer=this.options.tokenizer||new pe,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var Q={block:q.normal,inline:Ee.normal};this.options.pedantic?(Q.block=q.pedantic,Q.inline=Ee.pedantic):this.options.gfm&&(Q.block=q.gfm,this.options.breaks?Q.inline=Ee.breaks:Q.inline=Ee.gfm),this.tokenizer.rules=Q}ge.lex=function(Q,Z){var re=new ge(Z);return re.lex(Q)};var le=ge.prototype;return le.lex=function(Q){return Q=Q.replace(/\r\n|\r/g,`
|
|
`).replace(/\t/g," "),this.blockTokens(Q,this.tokens,!0),this.inline(this.tokens),this.tokens},le.blockTokens=function(Q,Z,re){Z===void 0&&(Z=[]),re===void 0&&(re=!0),Q=Q.replace(/^ +$/gm,"");for(var se,Te,De,Oe;Q;){if(se=this.tokenizer.space(Q)){Q=Q.substring(se.raw.length),se.type&&Z.push(se);continue}if(se=this.tokenizer.code(Q,Z)){Q=Q.substring(se.raw.length),se.type?Z.push(se):(Oe=Z[Z.length-1],Oe.raw+=`
|
|
`+se.raw,Oe.text+=`
|
|
`+se.text);continue}if(se=this.tokenizer.fences(Q)){Q=Q.substring(se.raw.length),Z.push(se);continue}if(se=this.tokenizer.heading(Q)){Q=Q.substring(se.raw.length),Z.push(se);continue}if(se=this.tokenizer.nptable(Q)){Q=Q.substring(se.raw.length),Z.push(se);continue}if(se=this.tokenizer.hr(Q)){Q=Q.substring(se.raw.length),Z.push(se);continue}if(se=this.tokenizer.blockquote(Q)){Q=Q.substring(se.raw.length),se.tokens=this.blockTokens(se.text,[],re),Z.push(se);continue}if(se=this.tokenizer.list(Q)){for(Q=Q.substring(se.raw.length),De=se.items.length,Te=0;Te<De;Te++)se.items[Te].tokens=this.blockTokens(se.items[Te].text,[],!1);Z.push(se);continue}if(se=this.tokenizer.html(Q)){Q=Q.substring(se.raw.length),Z.push(se);continue}if(re&&(se=this.tokenizer.def(Q))){Q=Q.substring(se.raw.length),this.tokens.links[se.tag]||(this.tokens.links[se.tag]={href:se.href,title:se.title});continue}if(se=this.tokenizer.table(Q)){Q=Q.substring(se.raw.length),Z.push(se);continue}if(se=this.tokenizer.lheading(Q)){Q=Q.substring(se.raw.length),Z.push(se);continue}if(re&&(se=this.tokenizer.paragraph(Q))){Q=Q.substring(se.raw.length),Z.push(se);continue}if(se=this.tokenizer.text(Q,Z)){Q=Q.substring(se.raw.length),se.type?Z.push(se):(Oe=Z[Z.length-1],Oe.raw+=`
|
|
`+se.raw,Oe.text+=`
|
|
`+se.text);continue}if(Q){var Ke="Infinite loop on byte: "+Q.charCodeAt(0);if(this.options.silent){console.error(Ke);break}else throw new Error(Ke)}}return Z},le.inline=function(Q){var Z,re,se,Te,De,Oe,Ke=Q.length;for(Z=0;Z<Ke;Z++){Oe=Q[Z];switch(Oe.type){case"paragraph":case"text":case"heading":{Oe.tokens=[],this.inlineTokens(Oe.text,Oe.tokens);break}case"table":{for(Oe.tokens={header:[],cells:[]},Te=Oe.header.length,re=0;re<Te;re++)Oe.tokens.header[re]=[],this.inlineTokens(Oe.header[re],Oe.tokens.header[re]);for(Te=Oe.cells.length,re=0;re<Te;re++)for(De=Oe.cells[re],Oe.tokens.cells[re]=[],se=0;se<De.length;se++)Oe.tokens.cells[re][se]=[],this.inlineTokens(De[se],Oe.tokens.cells[re][se]);break}case"blockquote":{this.inline(Oe.tokens);break}case"list":{for(Te=Oe.items.length,re=0;re<Te;re++)this.inline(Oe.items[re].tokens);break}}}return Q},le.inlineTokens=function(Q,Z,re,se,Te){Z===void 0&&(Z=[]),re===void 0&&(re=!1),se===void 0&&(se=!1),Te===void 0&&(Te="");var De,Oe=Q,Ke;if(this.tokens.links){var it=Object.keys(this.tokens.links);if(it.length>0)for(;(Ke=this.tokenizer.rules.inline.reflinkSearch.exec(Oe))!=null;)it.includes(Ke[0].slice(Ke[0].lastIndexOf("[")+1,-1))&&(Oe=Oe.slice(0,Ke.index)+"["+"a".repeat(Ke[0].length-2)+"]"+Oe.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(Ke=this.tokenizer.rules.inline.blockSkip.exec(Oe))!=null;)Oe=Oe.slice(0,Ke.index)+"["+"a".repeat(Ke[0].length-2)+"]"+Oe.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;Q;){if(De=this.tokenizer.escape(Q)){Q=Q.substring(De.raw.length),Z.push(De);continue}if(De=this.tokenizer.tag(Q,re,se)){Q=Q.substring(De.raw.length),re=De.inLink,se=De.inRawBlock,Z.push(De);continue}if(De=this.tokenizer.link(Q)){Q=Q.substring(De.raw.length),De.type==="link"&&(De.tokens=this.inlineTokens(De.text,[],!0,se)),Z.push(De);continue}if(De=this.tokenizer.reflink(Q,this.tokens.links)){Q=Q.substring(De.raw.length),De.type==="link"&&(De.tokens=this.inlineTokens(De.text,[],!0,se)),Z.push(De);continue}if(De=this.tokenizer.strong(Q,Oe,Te)){Q=Q.substring(De.raw.length),De.tokens=this.inlineTokens(De.text,[],re,se),Z.push(De);continue}if(De=this.tokenizer.em(Q,Oe,Te)){Q=Q.substring(De.raw.length),De.tokens=this.inlineTokens(De.text,[],re,se),Z.push(De);continue}if(De=this.tokenizer.codespan(Q)){Q=Q.substring(De.raw.length),Z.push(De);continue}if(De=this.tokenizer.br(Q)){Q=Q.substring(De.raw.length),Z.push(De);continue}if(De=this.tokenizer.del(Q)){Q=Q.substring(De.raw.length),De.tokens=this.inlineTokens(De.text,[],re,se),Z.push(De);continue}if(De=this.tokenizer.autolink(Q,ye)){Q=Q.substring(De.raw.length),Z.push(De);continue}if(!re&&(De=this.tokenizer.url(Q,ye))){Q=Q.substring(De.raw.length),Z.push(De);continue}if(De=this.tokenizer.inlineText(Q,se,Ce)){Q=Q.substring(De.raw.length),Te=De.raw.slice(-1),Z.push(De);continue}if(Q){var _e="Infinite loop on byte: "+Q.charCodeAt(0);if(this.options.silent){console.error(_e);break}else throw new Error(_e)}}return Z},z(ge,null,[{key:"rules",get:function(){return{block:q,inline:Ee}}}]),ge}(),Le=N.defaults,ke=W.cleanUrl,Fe=W.escape,Me=function(){function ge(de){this.options=de||Le}var le=ge.prototype;return le.code=function(Q,Z,re){var se=(Z||"").match(/\S*/)[0];if(this.options.highlight){var Te=this.options.highlight(Q,se);Te!=null&&Te!==Q&&(re=!0,Q=Te)}return se?'<pre><code class="'+this.options.langPrefix+Fe(se,!0)+'">'+(re?Q:Fe(Q,!0))+`</code></pre>
|
|
`:"<pre><code>"+(re?Q:Fe(Q,!0))+`</code></pre>
|
|
`},le.blockquote=function(Q){return`<blockquote>
|
|
`+Q+`</blockquote>
|
|
`},le.html=function(Q){return Q},le.heading=function(Q,Z,re,se){return this.options.headerIds?"<h"+Z+' id="'+this.options.headerPrefix+se.slug(re)+'">'+Q+"</h"+Z+`>
|
|
`:"<h"+Z+">"+Q+"</h"+Z+`>
|
|
`},le.hr=function(){return this.options.xhtml?`<hr/>
|
|
`:`<hr>
|
|
`},le.list=function(Q,Z,re){var se=Z?"ol":"ul",Te=Z&&re!==1?' start="'+re+'"':"";return"<"+se+Te+`>
|
|
`+Q+"</"+se+`>
|
|
`},le.listitem=function(Q){return"<li>"+Q+`</li>
|
|
`},le.checkbox=function(Q){return"<input "+(Q?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},le.paragraph=function(Q){return"<p>"+Q+`</p>
|
|
`},le.table=function(Q,Z){return Z&&(Z="<tbody>"+Z+"</tbody>"),`<table>
|
|
<thead>
|
|
`+Q+`</thead>
|
|
`+Z+`</table>
|
|
`},le.tablerow=function(Q){return`<tr>
|
|
`+Q+`</tr>
|
|
`},le.tablecell=function(Q,Z){var re=Z.header?"th":"td",se=Z.align?"<"+re+' align="'+Z.align+'">':"<"+re+">";return se+Q+"</"+re+`>
|
|
`},le.strong=function(Q){return"<strong>"+Q+"</strong>"},le.em=function(Q){return"<em>"+Q+"</em>"},le.codespan=function(Q){return"<code>"+Q+"</code>"},le.br=function(){return this.options.xhtml?"<br/>":"<br>"},le.del=function(Q){return"<del>"+Q+"</del>"},le.link=function(Q,Z,re){if(Q=ke(this.options.sanitize,this.options.baseUrl,Q),Q===null)return re;var se='<a href="'+Fe(Q)+'"';return Z&&(se+=' title="'+Z+'"'),se+=">"+re+"</a>",se},le.image=function(Q,Z,re){if(Q=ke(this.options.sanitize,this.options.baseUrl,Q),Q===null)return re;var se='<img src="'+Q+'" alt="'+re+'"';return Z&&(se+=' title="'+Z+'"'),se+=this.options.xhtml?"/>":">",se},le.text=function(Q){return Q},ge}(),Pe=function(){function ge(){}var le=ge.prototype;return le.strong=function(Q){return Q},le.em=function(Q){return Q},le.codespan=function(Q){return Q},le.del=function(Q){return Q},le.html=function(Q){return Q},le.text=function(Q){return Q},le.link=function(Q,Z,re){return""+re},le.image=function(Q,Z,re){return""+re},le.br=function(){return""},ge}(),Ze=function(){function ge(){this.seen={}}var le=ge.prototype;return le.slug=function(Q){var Z=Q.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(Z)){var re=Z;do this.seen[re]++,Z=re+"-"+this.seen[re];while(this.seen.hasOwnProperty(Z))}return this.seen[Z]=0,Z},ge}(),qe=N.defaults,Ge=W.unescape,He=function(){function ge(de){this.options=de||qe,this.options.renderer=this.options.renderer||new Me,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Pe,this.slugger=new Ze}ge.parse=function(Q,Z){var re=new ge(Z);return re.parse(Q)};var le=ge.prototype;return le.parse=function(Q,Z){Z===void 0&&(Z=!0);var re="",se,Te,De,Oe,Ke,it,_e,ct,at,rt,xt,Et,Rt,Lt,pt,or,Kt,Nt,Tr=Q.length;for(se=0;se<Tr;se++){rt=Q[se];switch(rt.type){case"space":continue;case"hr":{re+=this.renderer.hr();continue}case"heading":{re+=this.renderer.heading(this.parseInline(rt.tokens),rt.depth,Ge(this.parseInline(rt.tokens,this.textRenderer)),this.slugger);continue}case"code":{re+=this.renderer.code(rt.text,rt.lang,rt.escaped);continue}case"table":{for(ct="",_e="",Oe=rt.header.length,Te=0;Te<Oe;Te++)_e+=this.renderer.tablecell(this.parseInline(rt.tokens.header[Te]),{header:!0,align:rt.align[Te]});for(ct+=this.renderer.tablerow(_e),at="",Oe=rt.cells.length,Te=0;Te<Oe;Te++){for(it=rt.tokens.cells[Te],_e="",Ke=it.length,De=0;De<Ke;De++)_e+=this.renderer.tablecell(this.parseInline(it[De]),{header:!1,align:rt.align[De]});at+=this.renderer.tablerow(_e)}re+=this.renderer.table(ct,at);continue}case"blockquote":{at=this.parse(rt.tokens),re+=this.renderer.blockquote(at);continue}case"list":{for(xt=rt.ordered,Et=rt.start,Rt=rt.loose,Oe=rt.items.length,at="",Te=0;Te<Oe;Te++)pt=rt.items[Te],or=pt.checked,Kt=pt.task,Lt="",pt.task&&(Nt=this.renderer.checkbox(or),Rt?pt.tokens.length>0&&pt.tokens[0].type==="text"?(pt.tokens[0].text=Nt+" "+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=Nt+" "+pt.tokens[0].tokens[0].text)):pt.tokens.unshift({type:"text",text:Nt}):Lt+=Nt),Lt+=this.parse(pt.tokens,Rt),at+=this.renderer.listitem(Lt,Kt,or);re+=this.renderer.list(at,xt,Et);continue}case"html":{re+=this.renderer.html(rt.text);continue}case"paragraph":{re+=this.renderer.paragraph(this.parseInline(rt.tokens));continue}case"text":{for(at=rt.tokens?this.parseInline(rt.tokens):rt.text;se+1<Tr&&Q[se+1].type==="text";)rt=Q[++se],at+=`
|
|
`+(rt.tokens?this.parseInline(rt.tokens):rt.text);re+=Z?this.renderer.paragraph(at):at;continue}default:{var vr='Token with "'+rt.type+'" type was not found.';if(this.options.silent){console.error(vr);return}else throw new Error(vr)}}}return re},le.parseInline=function(Q,Z){Z=Z||this.renderer;var re="",se,Te,De=Q.length;for(se=0;se<De;se++){Te=Q[se];switch(Te.type){case"escape":{re+=Z.text(Te.text);break}case"html":{re+=Z.html(Te.text);break}case"link":{re+=Z.link(Te.href,Te.title,this.parseInline(Te.tokens,Z));break}case"image":{re+=Z.image(Te.href,Te.title,Te.text);break}case"strong":{re+=Z.strong(this.parseInline(Te.tokens,Z));break}case"em":{re+=Z.em(this.parseInline(Te.tokens,Z));break}case"codespan":{re+=Z.codespan(Te.text);break}case"br":{re+=Z.br();break}case"del":{re+=Z.del(this.parseInline(Te.tokens,Z));break}case"text":{re+=Z.text(Te.text);break}default:{var Oe='Token with "'+Te.type+'" type was not found.';if(this.options.silent){console.error(Oe);return}else throw new Error(Oe)}}}return re},ge}(),$e=W.merge,We=W.checkSanitizeDeprecation,ze=W.escape,Se=N.getDefaults,Je=N.changeDefaults,Qe=N.defaults;function Ae(ge,le,de){if(typeof ge=="undefined"||ge===null)throw new Error("marked(): input parameter is undefined or null");if(typeof ge!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(ge)+", string expected");if(typeof le=="function"&&(de=le,le=null),le=$e({},Ae.defaults,le||{}),We(le),de){var Q=le.highlight,Z;try{Z=we.lex(ge,le)}catch(De){return de(De)}var re=function(Oe){var Ke;if(!Oe)try{Ke=He.parse(Z,le)}catch(it){Oe=it}return le.highlight=Q,Oe?de(Oe):de(null,Ke)};if(!Q||Q.length<3)return re();if(delete le.highlight,!Z.length)return re();var se=0;Ae.walkTokens(Z,function(De){De.type==="code"&&(se++,setTimeout(function(){Q(De.text,De.lang,function(Oe,Ke){if(Oe)return re(Oe);Ke!=null&&Ke!==De.text&&(De.text=Ke,De.escaped=!0),se--,se===0&&re()})},0))}),se===0&&re();return}try{var Te=we.lex(ge,le);return le.walkTokens&&Ae.walkTokens(Te,le.walkTokens),He.parse(Te,le)}catch(De){if(De.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,le.silent)return"<p>An error occurred:</p><pre>"+ze(De.message+"",!0)+"</pre>";throw De}}Ae.options=Ae.setOptions=function(ge){return $e(Ae.defaults,ge),Je(Ae.defaults),Ae},Ae.getDefaults=Se,Ae.defaults=Qe,Ae.use=function(ge){var le=$e({},ge);if(ge.renderer&&function(){var Q=Ae.defaults.renderer||new Me,Z=function(Te){var De=Q[Te];Q[Te]=function(){for(var Oe=arguments.length,Ke=new Array(Oe),it=0;it<Oe;it++)Ke[it]=arguments[it];var _e=ge.renderer[Te].apply(Q,Ke);return _e===!1&&(_e=De.apply(Q,Ke)),_e}};for(var re in ge.renderer)Z(re);le.renderer=Q}(),ge.tokenizer&&function(){var Q=Ae.defaults.tokenizer||new pe,Z=function(Te){var De=Q[Te];Q[Te]=function(){for(var Oe=arguments.length,Ke=new Array(Oe),it=0;it<Oe;it++)Ke[it]=arguments[it];var _e=ge.tokenizer[Te].apply(Q,Ke);return _e===!1&&(_e=De.apply(Q,Ke)),_e}};for(var re in ge.tokenizer)Z(re);le.tokenizer=Q}(),ge.walkTokens){var de=Ae.defaults.walkTokens;le.walkTokens=function(Q){ge.walkTokens(Q),de&&de(Q)}}Ae.setOptions(le)},Ae.walkTokens=function(ge,le){for(var de=F(ge),Q;!(Q=de()).done;){var Z=Q.value;le(Z);switch(Z.type){case"table":{for(var re=F(Z.tokens.header),se;!(se=re()).done;){var Te=se.value;Ae.walkTokens(Te,le)}for(var De=F(Z.tokens.cells),Oe;!(Oe=De()).done;)for(var Ke=Oe.value,it=F(Ke),_e;!(_e=it()).done;){var ct=_e.value;Ae.walkTokens(ct,le)}break}case"list":{Ae.walkTokens(Z.items,le);break}default:Z.tokens&&Ae.walkTokens(Z.tokens,le)}}},Ae.Parser=He,Ae.parser=He.parse,Ae.Renderer=Me,Ae.TextRenderer=Pe,Ae.Lexer=we,Ae.lexer=we.lex,Ae.Tokenizer=pe,Ae.Slugger=Ze,Ae.parse=Ae;var Ie=Ae;return Ie})},ELLl:function(tt,Ve,te){(function(J){J(te("VrN/"))})(function(J){var z={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},D=J.Pos;J.defineOption("autoCloseBrackets",!1,function(x,v,d){d&&d!=J.Init&&(x.removeKeyMap(F),x.state.closeBrackets=null),v&&(O(K(v,"pairs")),x.state.closeBrackets=v,x.addKeyMap(F))});function K(x,v){return v=="pairs"&&typeof x=="string"?x:typeof x=="object"&&x[v]!=null?x[v]:z[v]}var F={Backspace:R,Enter:C};function O(x){for(var v=0;v<x.length;v++){var d=x.charAt(v),o="'"+d+"'";F[o]||(F[o]=N(d))}}O(z.pairs+"`");function N(x){return function(v){return y(v,x)}}function I(x){var v=x.state.closeBrackets;if(!v||v.override)return v;var d=x.getModeAt(x.getCursor());return d.closeBrackets||v}function R(x){var v=I(x);if(!v||x.getOption("disableInput"))return J.Pass;for(var d=K(v,"pairs"),o=x.listSelections(),l=0;l<o.length;l++){if(!o[l].empty())return J.Pass;var s=P(x,o[l].head);if(!s||d.indexOf(s)%2!=0)return J.Pass}for(var l=o.length-1;l>=0;l--){var S=o[l].head;x.replaceRange("",D(S.line,S.ch-1),D(S.line,S.ch+1),"+delete")}}function C(x){var v=I(x),d=v&&K(v,"explode");if(!d||x.getOption("disableInput"))return J.Pass;for(var o=x.listSelections(),l=0;l<o.length;l++){if(!o[l].empty())return J.Pass;var s=P(x,o[l].head);if(!s||d.indexOf(s)%2!=0)return J.Pass}x.operation(function(){var S=x.lineSeparator()||`
|
|
`;x.replaceSelection(S+S,null),x.execCommand("goCharLeft"),o=x.listSelections();for(var b=0;b<o.length;b++){var f=o[b].head.line;x.indentLine(f,null,!0),x.indentLine(f+1,null,!0)}})}function h(x){var v=J.cmpPos(x.anchor,x.head)>0;return{anchor:new D(x.anchor.line,x.anchor.ch+(v?-1:1)),head:new D(x.head.line,x.head.ch+(v?1:-1))}}function y(x,v){var d=I(x);if(!d||x.getOption("disableInput"))return J.Pass;var o=K(d,"pairs"),l=o.indexOf(v);if(l==-1)return J.Pass;for(var s=K(d,"closeBefore"),S=K(d,"triples"),b=o.charAt(l+1)==v,f=x.listSelections(),L=l%2==0,T,m=0;m<f.length;m++){var c=f[m],u=c.head,a,E=x.getRange(u,D(u.line,u.ch+1));if(L&&!c.empty())a="surround";else if((b||!L)&&E==v)b&&w(x,u)?a="both":S.indexOf(v)>=0&&x.getRange(u,D(u.line,u.ch+3))==v+v+v?a="skipThree":a="skip";else if(b&&u.ch>1&&S.indexOf(v)>=0&&x.getRange(D(u.line,u.ch-2),u)==v+v){if(u.ch>2&&/\bstring/.test(x.getTokenTypeAt(D(u.line,u.ch-2))))return J.Pass;a="addFour"}else if(b){var g=u.ch==0?" ":x.getRange(D(u.line,u.ch-1),u);if(!J.isWordChar(E)&&g!=v&&!J.isWordChar(g))a="both";else return J.Pass}else if(L&&(E.length===0||/\s/.test(E)||s.indexOf(E)>-1))a="both";else return J.Pass;if(!T)T=a;else if(T!=a)return J.Pass}var p=l%2?o.charAt(l-1):v,_=l%2?v:o.charAt(l+1);x.operation(function(){if(T=="skip")x.execCommand("goCharRight");else if(T=="skipThree")for(var U=0;U<3;U++)x.execCommand("goCharRight");else if(T=="surround"){for(var B=x.getSelections(),U=0;U<B.length;U++)B[U]=p+B[U]+_;x.replaceSelections(B,"around"),B=x.listSelections().slice();for(var U=0;U<B.length;U++)B[U]=h(B[U]);x.setSelections(B)}else T=="both"?(x.replaceSelection(p+_,null),x.triggerElectric(p+_),x.execCommand("goCharLeft")):T=="addFour"&&(x.replaceSelection(p+p+p+p,"before"),x.execCommand("goCharRight"))})}function P(x,v){var d=x.getRange(D(v.line,v.ch-1),D(v.line,v.ch+1));return d.length==2?d:null}function w(x,v){var d=x.getTokenAt(D(v.line,v.ch+1));return/\bstring/.test(d.type)&&d.start==v.ch&&(v.ch==0||!/\bstring/.test(x.getTokenTypeAt(v)))}})},GfqC:function(tt,Ve,te){"use strict";var J=te("cDcd"),z=te.n(J),D=te("TSYQ"),K=te.n(D);function F(W,k){var M="cannot "+W.method+" "+W.action+" "+k.status+"'",H=new Error(M);return H.status=k.status,H.method=W.method,H.url=W.action,H}function O(W){var k=W.responseText||W.response;if(!k)return k;try{return JSON.parse(k)}catch(M){return k}}function N(W){var k=new XMLHttpRequest;W.onProgress&&k.upload&&(k.upload.onprogress=function(ee){ee.total>0&&(ee.percent=ee.loaded/ee.total*100),W.onProgress(ee)});var M=new FormData;W.data&&Object.keys(W.data).forEach(function(X){var ee=W.data[X];if(Array.isArray(ee)){ee.forEach(function(ie){M.append(X+"[]",ie)});return}M.append(X,W.data[X])}),W.file instanceof Blob?M.append(W.filename,W.file,W.file.name):M.append(W.filename,W.file),k.onerror=function(ee){W.onError(ee)},k.onload=function(){return k.status<200||k.status>=300?W.onError(F(W,k),O(k)):W.onSuccess(O(k),k)},k.open(W.method,W.action,!0),W.withCredentials&&"withCredentials"in k&&(k.withCredentials=!0);var H=W.headers||{};return H["X-Requested-With"]!==null&&k.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(H).forEach(function(X){H[X]!==null&&k.setRequestHeader(X,H[X])}),k.send(M),{abort:function(){k.abort()}}}var I=+new Date,R=0;function C(){return"rc-upload-"+I+"-"+ ++R}function h(W,k){return W.indexOf(k,W.length-k.length)!==-1}var y=function(W,k){if(W&&k){var M=Array.isArray(k)?k:k.split(","),H=W.name||"",X=W.type||"",ee=X.replace(/\/.*$/,"");return M.some(function(ie){var ve=ie.trim();return ve.charAt(0)==="."?h(H.toLowerCase(),ve.toLowerCase()):/\/\*$/.test(ve)?ee===ve.replace(/\/.*$/,""):X===ve})}return!0};function P(W,k){var M=W.createReader(),H=[];function X(){M.readEntries(function(ee){var ie=Array.prototype.slice.apply(ee);H=H.concat(ie);var ve=!ie.length;ve?k(H):X()})}X()}var w=function(k,M,H){var X=function ee(ie,ve){ve=ve||"",ie.isFile?ie.file(function(pe){H(pe)&&(ie.fullPath&&!pe.webkitRelativePath&&(Object.defineProperties(pe,{webkitRelativePath:{writable:!0}}),pe.webkitRelativePath=ie.fullPath.replace(/^\//,""),Object.defineProperties(pe,{webkitRelativePath:{writable:!1}})),M([pe]))}):ie.isDirectory&&P(ie,function(pe){pe.forEach(function(he){ee(he,""+ve+ie.name+"/")})})};k.forEach(function(ee){X(ee.webkitGetAsEntry())})},x=w,v=Object.assign||function(W){for(var k=1;k<arguments.length;k++){var M=arguments[k];for(var H in M)Object.prototype.hasOwnProperty.call(M,H)&&(W[H]=M[H])}return W},d=function(){function W(k,M){var H=[],X=!0,ee=!1,ie=void 0;try{for(var ve=k[Symbol.iterator](),pe;!(X=(pe=ve.next()).done)&&!(H.push(pe.value),M&&H.length===M);X=!0);}catch(he){ee=!0,ie=he}finally{try{!X&&ve.return&&ve.return()}finally{if(ee)throw ie}}return H}return function(k,M){if(Array.isArray(k))return k;if(Symbol.iterator in Object(k))return W(k,M);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),o=function(){function W(k,M){for(var H=0;H<M.length;H++){var X=M[H];X.enumerable=X.enumerable||!1,X.configurable=!0,"value"in X&&(X.writable=!0),Object.defineProperty(k,X.key,X)}}return function(k,M,H){return M&&W(k.prototype,M),H&&W(k,H),k}}();function l(W,k,M){return k in W?Object.defineProperty(W,k,{value:M,enumerable:!0,configurable:!0,writable:!0}):W[k]=M,W}function s(W,k){var M={};for(var H in W){if(k.indexOf(H)>=0)continue;if(!Object.prototype.hasOwnProperty.call(W,H))continue;M[H]=W[H]}return M}function S(W,k){if(!(W instanceof k))throw new TypeError("Cannot call a class as a function")}function b(W,k){if(!W)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return k&&(typeof k=="object"||typeof k=="function")?k:W}function f(W,k){if(typeof k!="function"&&k!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof k);W.prototype=Object.create(k&&k.prototype,{constructor:{value:W,enumerable:!1,writable:!0,configurable:!0}}),k&&(Object.setPrototypeOf?Object.setPrototypeOf(W,k):W.__proto__=k)}var L=function(k){return Object.keys(k).reduce(function(M,H){return(H.substr(0,5)==="data-"||H.substr(0,5)==="aria-"||H==="role")&&(M[H]=k[H]),M},{})},T=function(W){f(k,W);function k(){var M,H,X,ee;S(this,k);for(var ie=arguments.length,ve=Array(ie),pe=0;pe<ie;pe++)ve[pe]=arguments[pe];return ee=(H=(X=b(this,(M=k.__proto__||Object.getPrototypeOf(k)).call.apply(M,[this].concat(ve))),X),X.state={uid:C()},X.reqs={},X.onChange=function(he){var ce=he.target.files;X.uploadFiles(ce),X.reset()},X.onClick=function(he){var ce=X.fileInput;if(!ce)return;var fe=X.props,ne=fe.children,me=fe.onClick;ne&&ne.type==="button"&&(ce.parentNode.focus(),ce.parentNode.querySelector("button").blur()),ce.click(),me&&me(he)},X.onKeyDown=function(he){he.key==="Enter"&&X.onClick()},X.onFileDrop=function(he){var ce=X.props.multiple;if(he.preventDefault(),he.type==="dragover")return;if(X.props.directory)x(Array.prototype.slice.call(he.dataTransfer.items),X.uploadFiles,function(ne){return y(ne,X.props.accept)});else{var fe=Array.prototype.slice.call(he.dataTransfer.files).filter(function(ne){return y(ne,X.props.accept)});ce===!1&&(fe=fe.slice(0,1)),X.uploadFiles(fe)}},X.uploadFiles=function(he){var ce=Array.prototype.slice.call(he);ce.map(function(fe){return fe.uid=C(),fe}).forEach(function(fe){X.upload(fe,ce)})},X.saveFileInput=function(he){X.fileInput=he},H),b(X,ee)}return o(k,[{key:"componentDidMount",value:function(){this._isMounted=!0}},{key:"componentWillUnmount",value:function(){this._isMounted=!1,this.abort()}},{key:"upload",value:function(H,X){var ee=this,ie=this.props;if(!ie.beforeUpload)return setTimeout(function(){return ee.post(H)},0);var ve=ie.beforeUpload(H,X);ve&&ve.then?ve.then(function(pe){var he=Object.prototype.toString.call(pe);return he==="[object File]"||he==="[object Blob]"?ee.post(pe):ee.post(H)}).catch(function(pe){console.log(pe)}):ve!==!1&&setTimeout(function(){return ee.post(H)},0);return}},{key:"post",value:function(H){var X=this;if(!this._isMounted)return;var ee=this.props,ie=ee.onStart,ve=ee.onProgress,pe=ee.transformFile,he=pe===void 0?function(ce){return ce}:pe;new Promise(function(ce){var fe=ee.action;return typeof fe=="function"&&(fe=fe(H)),ce(fe)}).then(function(ce){var fe=H.uid,ne=ee.customRequest||N,me=Promise.resolve(he(H)).then(function($){var ae=ee.data;return typeof ae=="function"&&(ae=ae($)),Promise.all([$,ae])}).catch(function($){console.error($)});me.then(function($){var ae=d($,2),q=ae[0],Ee=ae[1],Ce={action:ce,filename:ee.name,data:Ee,file:q,headers:ee.headers,withCredentials:ee.withCredentials,method:ee.method||"post",onProgress:ve?function(ye){ve(ye,H)}:null,onSuccess:function(we,Le){delete X.reqs[fe],ee.onSuccess(we,H,Le)},onError:function(we,Le){delete X.reqs[fe],ee.onError(we,Le,H)}};ie(H),X.reqs[fe]=ne(Ce)})})}},{key:"reset",value:function(){this.setState({uid:C()})}},{key:"abort",value:function(H){var X=this.reqs;if(H){var ee=H;H&&H.uid&&(ee=H.uid),X[ee]&&X[ee].abort&&X[ee].abort(),delete X[ee]}else Object.keys(X).forEach(function(ie){X[ie]&&X[ie].abort&&X[ie].abort(),delete X[ie]})}},{key:"render",value:function(){var H,X=this.props,ee=X.component,ie=X.prefixCls,ve=X.className,pe=X.disabled,he=X.id,ce=X.style,fe=X.multiple,ne=X.accept,me=X.children,$=X.directory,ae=X.openFileDialogOnClick,q=X.onMouseEnter,Ee=X.onMouseLeave,Ce=s(X,["component","prefixCls","className","disabled","id","style","multiple","accept","children","directory","openFileDialogOnClick","onMouseEnter","onMouseLeave"]),ye=K()((H={},l(H,ie,!0),l(H,ie+"-disabled",pe),l(H,ve,ve),H)),we=pe?{}:{onClick:ae?this.onClick:function(){},onKeyDown:ae?this.onKeyDown:function(){},onMouseEnter:q,onMouseLeave:Ee,onDrop:this.onFileDrop,onDragOver:this.onFileDrop,tabIndex:"0"};return z.a.createElement(ee,v({},we,{className:ye,role:"button",style:ce}),z.a.createElement("input",v({},L(Ce),{id:he,type:"file",ref:this.saveFileInput,onClick:function(ke){return ke.stopPropagation()},key:this.state.uid,style:{display:"none"},accept:ne,directory:$?"directory":null,webkitdirectory:$?"webkitdirectory":null,multiple:fe,onChange:this.onChange})),me)}}]),k}(J.Component),m=T,c=Object.assign||function(W){for(var k=1;k<arguments.length;k++){var M=arguments[k];for(var H in M)Object.prototype.hasOwnProperty.call(M,H)&&(W[H]=M[H])}return W},u=function(){function W(k,M){for(var H=0;H<M.length;H++){var X=M[H];X.enumerable=X.enumerable||!1,X.configurable=!0,"value"in X&&(X.writable=!0),Object.defineProperty(k,X.key,X)}}return function(k,M,H){return M&&W(k.prototype,M),H&&W(k,H),k}}();function a(W,k){if(!(W instanceof k))throw new TypeError("Cannot call a class as a function")}function E(W,k){if(!W)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return k&&(typeof k=="object"||typeof k=="function")?k:W}function g(W,k){if(typeof k!="function"&&k!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof k);W.prototype=Object.create(k&&k.prototype,{constructor:{value:W,enumerable:!1,writable:!0,configurable:!0}}),k&&(Object.setPrototypeOf?Object.setPrototypeOf(W,k):W.__proto__=k)}function p(){}var _=function(W){g(k,W);function k(){var M,H,X,ee;a(this,k);for(var ie=arguments.length,ve=Array(ie),pe=0;pe<ie;pe++)ve[pe]=arguments[pe];return ee=(H=(X=E(this,(M=k.__proto__||Object.getPrototypeOf(k)).call.apply(M,[this].concat(ve))),X),X.saveUploader=function(he){X.uploader=he},H),E(X,ee)}return u(k,[{key:"abort",value:function(H){this.uploader.abort(H)}},{key:"render",value:function(){return z.a.createElement(m,c({},this.props,{ref:this.saveUploader}))}}]),k}(J.Component);_.defaultProps={component:"span",prefixCls:"rc-upload",data:{},headers:{},name:"file",multipart:!1,onStart:p,onError:p,onSuccess:p,multiple:!1,beforeUpload:null,customRequest:null,withCredentials:!1,openFileDialogOnClick:!0};var U=_,B=Ve.a=U},H38U:function(tt,Ve,te){var J=te("f4xo"),z=te("rcnY"),D=te("wU8J"),K=te("Iq15"),F=te("dWSS");function O(I,R){this.typeNumber=I,this.errorCorrectLevel=R,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}var N=O.prototype;N.addData=function(I){var R=new J(I);this.dataList.push(R),this.dataCache=null},N.isDark=function(I,R){if(I<0||this.moduleCount<=I||R<0||this.moduleCount<=R)throw new Error(I+","+R);return this.modules[I][R]},N.getModuleCount=function(){return this.moduleCount},N.make=function(){if(this.typeNumber<1){var I=1;for(I=1;I<40;I++){for(var R=z.getRSBlocks(I,this.errorCorrectLevel),C=new D,h=0,y=0;y<R.length;y++)h+=R[y].dataCount;for(var y=0;y<this.dataList.length;y++){var P=this.dataList[y];C.put(P.mode,4),C.put(P.getLength(),K.getLengthInBits(P.mode,I)),P.write(C)}if(C.getLengthInBits()<=h*8)break}this.typeNumber=I}this.makeImpl(!1,this.getBestMaskPattern())},N.makeImpl=function(I,R){this.moduleCount=this.typeNumber*4+17,this.modules=new Array(this.moduleCount);for(var C=0;C<this.moduleCount;C++){this.modules[C]=new Array(this.moduleCount);for(var h=0;h<this.moduleCount;h++)this.modules[C][h]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(I,R),this.typeNumber>=7&&this.setupTypeNumber(I),this.dataCache==null&&(this.dataCache=O.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,R)},N.setupPositionProbePattern=function(I,R){for(var C=-1;C<=7;C++){if(I+C<=-1||this.moduleCount<=I+C)continue;for(var h=-1;h<=7;h++){if(R+h<=-1||this.moduleCount<=R+h)continue;0<=C&&C<=6&&(h==0||h==6)||0<=h&&h<=6&&(C==0||C==6)||2<=C&&C<=4&&2<=h&&h<=4?this.modules[I+C][R+h]=!0:this.modules[I+C][R+h]=!1}}},N.getBestMaskPattern=function(){for(var I=0,R=0,C=0;C<8;C++){this.makeImpl(!0,C);var h=K.getLostPoint(this);(C==0||I>h)&&(I=h,R=C)}return R},N.createMovieClip=function(I,R,C){var h=I.createEmptyMovieClip(R,C),y=1;this.make();for(var P=0;P<this.modules.length;P++)for(var w=P*y,x=0;x<this.modules[P].length;x++){var v=x*y,d=this.modules[P][x];d&&(h.beginFill(0,100),h.moveTo(v,w),h.lineTo(v+y,w),h.lineTo(v+y,w+y),h.lineTo(v,w+y),h.endFill())}return h},N.setupTimingPattern=function(){for(var I=8;I<this.moduleCount-8;I++){if(this.modules[I][6]!=null)continue;this.modules[I][6]=I%2==0}for(var R=8;R<this.moduleCount-8;R++){if(this.modules[6][R]!=null)continue;this.modules[6][R]=R%2==0}},N.setupPositionAdjustPattern=function(){for(var I=K.getPatternPosition(this.typeNumber),R=0;R<I.length;R++)for(var C=0;C<I.length;C++){var h=I[R],y=I[C];if(this.modules[h][y]!=null)continue;for(var P=-2;P<=2;P++)for(var w=-2;w<=2;w++)P==-2||P==2||w==-2||w==2||P==0&&w==0?this.modules[h+P][y+w]=!0:this.modules[h+P][y+w]=!1}},N.setupTypeNumber=function(I){for(var R=K.getBCHTypeNumber(this.typeNumber),C=0;C<18;C++){var h=!I&&(R>>C&1)==1;this.modules[Math.floor(C/3)][C%3+this.moduleCount-8-3]=h}for(var C=0;C<18;C++){var h=!I&&(R>>C&1)==1;this.modules[C%3+this.moduleCount-8-3][Math.floor(C/3)]=h}},N.setupTypeInfo=function(I,R){for(var C=this.errorCorrectLevel<<3|R,h=K.getBCHTypeInfo(C),y=0;y<15;y++){var P=!I&&(h>>y&1)==1;y<6?this.modules[y][8]=P:y<8?this.modules[y+1][8]=P:this.modules[this.moduleCount-15+y][8]=P}for(var y=0;y<15;y++){var P=!I&&(h>>y&1)==1;y<8?this.modules[8][this.moduleCount-y-1]=P:y<9?this.modules[8][15-y-1+1]=P:this.modules[8][15-y-1]=P}this.modules[this.moduleCount-8][8]=!I},N.mapData=function(I,R){for(var C=-1,h=this.moduleCount-1,y=7,P=0,w=this.moduleCount-1;w>0;w-=2)for(w==6&&w--;;){for(var x=0;x<2;x++)if(this.modules[h][w-x]==null){var v=!1;P<I.length&&(v=(I[P]>>>y&1)==1);var d=K.getMask(R,h,w-x);d&&(v=!v),this.modules[h][w-x]=v,y--,y==-1&&(P++,y=7)}if(h+=C,h<0||this.moduleCount<=h){h-=C,C=-C;break}}},O.PAD0=236,O.PAD1=17,O.createData=function(I,R,C){for(var h=z.getRSBlocks(I,R),y=new D,P=0;P<C.length;P++){var w=C[P];y.put(w.mode,4),y.put(w.getLength(),K.getLengthInBits(w.mode,I)),w.write(y)}for(var x=0,P=0;P<h.length;P++)x+=h[P].dataCount;if(y.getLengthInBits()>x*8)throw new Error("code length overflow. ("+y.getLengthInBits()+">"+x*8+")");for(y.getLengthInBits()+4<=x*8&&y.put(0,4);y.getLengthInBits()%8!=0;)y.putBit(!1);for(;!(y.getLengthInBits()>=x*8);){if(y.put(O.PAD0,8),y.getLengthInBits()>=x*8)break;y.put(O.PAD1,8)}return O.createBytes(y,h)},O.createBytes=function(I,R){for(var C=0,h=0,y=0,P=new Array(R.length),w=new Array(R.length),x=0;x<R.length;x++){var v=R[x].dataCount,d=R[x].totalCount-v;h=Math.max(h,v),y=Math.max(y,d),P[x]=new Array(v);for(var o=0;o<P[x].length;o++)P[x][o]=255&I.buffer[o+C];C+=v;var l=K.getErrorCorrectPolynomial(d),s=new F(P[x],l.getLength()-1),S=s.mod(l);w[x]=new Array(l.getLength()-1);for(var o=0;o<w[x].length;o++){var b=o+S.getLength()-w[x].length;w[x][o]=b>=0?S.get(b):0}}for(var f=0,o=0;o<R.length;o++)f+=R[o].totalCount;for(var L=new Array(f),T=0,o=0;o<h;o++)for(var x=0;x<R.length;x++)o<P[x].length&&(L[T++]=P[x][o]);for(var o=0;o<y;o++)for(var x=0;x<R.length;x++)o<w[x].length&&(L[T++]=w[x][o]);return L},tt.exports=O},HmJG:function(tt,Ve,te){},Iq15:function(tt,Ve,te){var J=te("nVVt"),z=te("dWSS"),D=te("dQei"),K={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},F={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1<<10|1<<8|1<<5|1<<4|1<<2|1<<1|1<<0,G18:1<<12|1<<11|1<<10|1<<9|1<<8|1<<5|1<<2|1<<0,G15_MASK:1<<14|1<<12|1<<10|1<<4|1<<1,getBCHTypeInfo:function(O){for(var N=O<<10;F.getBCHDigit(N)-F.getBCHDigit(F.G15)>=0;)N^=F.G15<<F.getBCHDigit(N)-F.getBCHDigit(F.G15);return(O<<10|N)^F.G15_MASK},getBCHTypeNumber:function(O){for(var N=O<<12;F.getBCHDigit(N)-F.getBCHDigit(F.G18)>=0;)N^=F.G18<<F.getBCHDigit(N)-F.getBCHDigit(F.G18);return O<<12|N},getBCHDigit:function(O){for(var N=0;O!=0;)N++,O>>>=1;return N},getPatternPosition:function(O){return F.PATTERN_POSITION_TABLE[O-1]},getMask:function(O,N,I){switch(O){case K.PATTERN000:return(N+I)%2==0;case K.PATTERN001:return N%2==0;case K.PATTERN010:return I%3==0;case K.PATTERN011:return(N+I)%3==0;case K.PATTERN100:return(Math.floor(N/2)+Math.floor(I/3))%2==0;case K.PATTERN101:return N*I%2+N*I%3==0;case K.PATTERN110:return(N*I%2+N*I%3)%2==0;case K.PATTERN111:return(N*I%3+(N+I)%2)%2==0;default:throw new Error("bad maskPattern:"+O)}},getErrorCorrectPolynomial:function(O){for(var N=new z([1],0),I=0;I<O;I++)N=N.multiply(new z([1,D.gexp(I)],0));return N},getLengthInBits:function(O,N){if(1<=N&&N<10)switch(O){case J.MODE_NUMBER:return 10;case J.MODE_ALPHA_NUM:return 9;case J.MODE_8BIT_BYTE:return 8;case J.MODE_KANJI:return 8;default:throw new Error("mode:"+O)}else if(N<27)switch(O){case J.MODE_NUMBER:return 12;case J.MODE_ALPHA_NUM:return 11;case J.MODE_8BIT_BYTE:return 16;case J.MODE_KANJI:return 10;default:throw new Error("mode:"+O)}else if(N<41)switch(O){case J.MODE_NUMBER:return 14;case J.MODE_ALPHA_NUM:return 13;case J.MODE_8BIT_BYTE:return 16;case J.MODE_KANJI:return 12;default:throw new Error("mode:"+O)}else throw new Error("type:"+N)},getLostPoint:function(O){for(var N=O.getModuleCount(),I=0,R=0;R<N;R++)for(var C=0;C<N;C++){for(var h=0,y=O.isDark(R,C),P=-1;P<=1;P++){if(R+P<0||N<=R+P)continue;for(var w=-1;w<=1;w++){if(C+w<0||N<=C+w)continue;if(P==0&&w==0)continue;y==O.isDark(R+P,C+w)&&h++}}h>5&&(I+=3+h-5)}for(var R=0;R<N-1;R++)for(var C=0;C<N-1;C++){var x=0;O.isDark(R,C)&&x++,O.isDark(R+1,C)&&x++,O.isDark(R,C+1)&&x++,O.isDark(R+1,C+1)&&x++,(x==0||x==4)&&(I+=3)}for(var R=0;R<N;R++)for(var C=0;C<N-6;C++)O.isDark(R,C)&&!O.isDark(R,C+1)&&O.isDark(R,C+2)&&O.isDark(R,C+3)&&O.isDark(R,C+4)&&!O.isDark(R,C+5)&&O.isDark(R,C+6)&&(I+=40);for(var C=0;C<N;C++)for(var R=0;R<N-6;R++)O.isDark(R,C)&&!O.isDark(R+1,C)&&O.isDark(R+2,C)&&O.isDark(R+3,C)&&O.isDark(R+4,C)&&!O.isDark(R+5,C)&&O.isDark(R+6,C)&&(I+=40);for(var v=0,C=0;C<N;C++)for(var R=0;R<N;R++)O.isDark(R,C)&&v++;var d=Math.abs(100*v/N/N-50)/5;return I+=d*10,I}};tt.exports=F},LdHM:function(tt,Ve,te){"use strict";te.d(Ve,"b",function(){return s}),te.d(Ve,"a",function(){return b});var J=te("1OyB"),z=te("vuIU"),D=te("Ji7U"),K=te("LK+K"),F=te("cDcd"),O=te("rePB"),N=te("Ff2n"),I=te("ODXe"),R=te("4IlW"),C=te("bX4T"),h=te("YrtM"),y=te("TSYQ"),P=te.n(y),w=te("+nKL"),x=te("8OUc"),v=function(H,X){var ee=H.prefixCls,ie=H.id,ve=H.flattenOptions,pe=H.childrenAsData,he=H.values,ce=H.searchValue,fe=H.multiple,ne=H.defaultActiveFirstOption,me=H.height,$=H.itemHeight,ae=H.notFoundContent,q=H.open,Ee=H.menuItemSelectedIcon,Ce=H.virtual,ye=H.onSelect,we=H.onToggleOpen,Le=H.onActiveValue,ke=H.onScroll,Fe=H.onMouseEnter,Me="".concat(ee,"-item"),Pe=Object(h.a)(function(){return ve},[q,ve],function(Ie,ge){return ge[0]&&Ie[1]!==ge[1]}),Ze=F.useRef(null),qe=function(ge){ge.preventDefault()},Ge=function(ge){Ze.current&&Ze.current.scrollTo({index:ge})},He=function(ge){for(var le=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,de=Pe.length,Q=0;Q<de;Q+=1){var Z=(ge+Q*le+de)%de,re=Pe[Z],se=re.group,Te=re.data;if(!se&&!Te.disabled)return Z}return-1},$e=F.useState(function(){return He(0)}),We=Object(I.a)($e,2),ze=We[0],Se=We[1],Je=function(ge){Se(ge);var le=Pe[ge];if(!le){Le(null,-1);return}Le(le.data.value,ge)};F.useEffect(function(){Je(ne!==!1?He(0):-1)},[Pe.length,ce]),F.useEffect(function(){var Ie=setTimeout(function(){if(!fe&&q&&he.size===1){var ge=Array.from(he)[0],le=Pe.findIndex(function(de){var Q=de.data;return Q.value===ge});Je(le),Ge(le)}});return function(){return clearTimeout(Ie)}},[q]);var Qe=function(ge){ge!==void 0&&ye(ge,{selected:!he.has(ge)}),fe||we(!1)};if(F.useImperativeHandle(X,function(){return{onKeyDown:function(ge){var le=ge.which;switch(le){case R.a.UP:case R.a.DOWN:{var de=0;if(le===R.a.UP?de=-1:le===R.a.DOWN&&(de=1),de!==0){var Q=He(ze+de,de);Ge(Q),Je(Q)}break}case R.a.ENTER:{var Z=Pe[ze];Z&&!Z.data.disabled?Qe(Z.data.value):Qe(void 0),q&&ge.preventDefault();break}case R.a.ESC:we(!1)}},onKeyUp:function(){},scrollTo:function(ge){Ge(ge)}}}),Pe.length===0)return F.createElement("div",{role:"listbox",id:"".concat(ie,"_list"),className:"".concat(Me,"-empty"),onMouseDown:qe},ae);function Ae(Ie){var ge=Pe[Ie];if(!ge)return null;var le=ge.data||{},de=le.value,Q=le.label,Z=le.children,re=Object(C.a)(le,!0),se=pe?Z:Q;return ge?F.createElement("div",Object.assign({"aria-label":typeof se=="string"?se:null},re,{key:Ie,role:"option",id:"".concat(ie,"_list_").concat(Ie),"aria-selected":he.has(de)}),de):null}return F.createElement(F.Fragment,null,F.createElement("div",{role:"listbox",id:"".concat(ie,"_list"),style:{height:0,width:0,overflow:"hidden"}},Ae(ze-1),Ae(ze),Ae(ze+1)),F.createElement(w.a,{itemKey:"key",ref:Ze,data:Pe,height:me,itemHeight:$,fullHeight:!1,onMouseDown:qe,onScroll:ke,virtual:Ce,onMouseEnter:Fe},function(Ie,ge){var le,de=Ie.group,Q=Ie.groupOption,Z=Ie.data,re=Z.label,se=Z.key;if(de)return F.createElement("div",{className:P()(Me,"".concat(Me,"-group"))},re!==void 0?re:se);var Te=Z.disabled,De=Z.value,Oe=Z.title,Ke=Z.children,it=Z.style,_e=Z.className,ct=Object(N.a)(Z,["disabled","value","title","children","style","className"]),at=he.has(De),rt="".concat(Me,"-option"),xt=P()(Me,rt,_e,(le={},Object(O.a)(le,"".concat(rt,"-grouped"),Q),Object(O.a)(le,"".concat(rt,"-active"),ze===ge&&!Te),Object(O.a)(le,"".concat(rt,"-disabled"),Te),Object(O.a)(le,"".concat(rt,"-selected"),at),le)),Et=pe?Ke:re,Rt=!Ee||typeof Ee=="function"||at;return F.createElement("div",Object.assign({},ct,{"aria-selected":at,className:xt,title:Oe,onMouseMove:function(){if(ze===ge||Te)return;Je(ge)},onClick:function(){Te||Qe(De)},style:it}),F.createElement("div",{className:"".concat(rt,"-content")},Et||De),F.isValidElement(Ee)||at,Rt&&F.createElement(x.a,{className:"".concat(Me,"-option-state"),customizeIcon:Ee,customizeIconProps:{isSelected:at}},at?"\u2713":null))}))},d=F.forwardRef(v);d.displayName="OptionList";var o=d,l=function(){return null};l.isSelectOption=!0;var s=l,S=function(){return null};S.isSelectOptGroup=!0;var b=S,f=te("VTBJ"),L=te("Zm9Q");function T(M){var H=M.key,X=M.props,ee=X.children,ie=X.value,ve=Object(N.a)(X,["children","value"]);return Object(f.a)({key:H,value:ie!==void 0?ie:H,children:ee},ve)}function m(M){var H=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(L.a)(M).map(function(X,ee){if(!F.isValidElement(X)||!X.type)return null;var ie=X.type.isSelectOptGroup,ve=X.key,pe=X.props,he=pe.children,ce=Object(N.a)(pe,["children"]);return H||!ie?T(X):Object(f.a)(Object(f.a)({key:"__RC_SELECT_GRP__".concat(ve===null?ee:ve,"__"),label:ve},ce),{},{options:m(he)})}).filter(function(X){return X})}var c=te("2Qr1"),u=te("qNPg"),a=te("U8pU"),E=te("Kwbf"),g=te("WKfj");function p(M){var H=M.mode,X=M.options,ee=M.children,ie=M.backfill,ve=M.allowClear,pe=M.placeholder,he=M.getInputElement,ce=M.showSearch,fe=M.onSearch,ne=M.defaultOpen,me=M.autoFocus,$=M.labelInValue,ae=M.value,q=M.inputValue,Ee=M.optionLabelProp,Ce=H==="multiple"||H==="tags",ye=ce!==void 0?ce:Ce||H==="combobox",we=X||m(ee);if(Object(E.a)(H!=="tags"||we.every(function(Me){return!Me.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),H==="tags"||H==="combobox"){var Le=we.some(function(Me){return Me.options?Me.options.some(function(Pe){return typeof("value"in Pe?Pe.value:Pe.key)=="number"}):typeof("value"in Me?Me.value:Me.key)=="number"});Object(E.a)(!Le,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(E.a)(H!=="combobox"||!Ee,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(E.a)(H==="combobox"||!ie,"`backfill` only works with `combobox` mode."),Object(E.a)(H==="combobox"||!he,"`getInputElement` only work with `combobox` mode."),Object(E.b)(H!=="combobox"||!he||!ve||!pe,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),fe&&!ye&&H!=="combobox"&&H!=="tags"&&Object(E.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(E.b)(!ne||me,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),ae!=null){var ke=Object(g.d)(ae);Object(E.a)(!$||ke.every(function(Me){return Object(a.a)(Me)==="object"&&("key"in Me||"value"in Me)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(E.a)(!Ce||Array.isArray(ae),"`value` should be array when `mode` is `multiple` or `tags`")}if(ee){var Fe=null;Object(L.a)(ee).some(function(Me){if(!F.isValidElement(Me)||!Me.type)return!1;var Pe=Me.type;if(Pe.isSelectOption)return!1;if(Pe.isSelectOptGroup){var Ze=Object(L.a)(Me.props.children).every(function(qe){return!F.isValidElement(qe)||!Me.type||qe.type.isSelectOption?!0:(Fe=qe.type,!1)});return!Ze}return Fe=Pe,!0}),Fe&&Object(E.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(Fe.displayName||Fe.name||Fe,"`.")),Object(E.a)(q===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var _=p,U=Object(u.a)({prefixCls:"rc-select",components:{optionList:o},convertChildrenToData:m,flattenOptions:c.d,getLabeledValue:c.e,filterOptions:c.b,isValueDisabled:c.g,findValueOption:c.c,warningProps:_,fillOptionsWithMissingValue:c.a}),B=function(M){Object(D.a)(X,M);var H=Object(K.a)(X);function X(){var ee;return Object(J.a)(this,X),ee=H.apply(this,arguments),ee.selectRef=F.createRef(),ee.focus=function(){ee.selectRef.current.focus()},ee.blur=function(){ee.selectRef.current.blur()},ee}return Object(z.a)(X,[{key:"render",value:function(){return F.createElement(U,Object.assign({ref:this.selectRef},this.props))}}]),X}(F.Component);B.Option=s,B.OptGroup=b;var W=B,k=Ve.c=W},M8RZ:function(tt,Ve,te){"use strict";te.d(Ve,"a",function(){return R});var J=te("fWQN"),z=te("mtLc"),D=te("yKVA"),K=te("879j"),F=te("cDcd"),O=te.n(F),N=te("faye"),I=te.n(N),R=function(C){Object(D.a)(y,C);var h=Object(K.a)(y);function y(P){var w;Object(J.a)(this,y),w=h.call(this,P);var x=window.document;return w.node=x.createElement("div"),x.body.appendChild(w.node),w}return Object(z.a)(y,[{key:"render",value:function(){var w=this.props.children;return Object(N.createPortal)(w,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),y}(O.a.Component)},Ot1p:function(tt,Ve,te){"use strict";var J=te("2qtc"),z=te("kLXV"),D=te("rAM+"),K=te("miYZ"),F=te("tsqr"),O=te("9og8"),N=te("tJVT"),I=te("jrin"),R=te("WmNS"),C=te.n(R),h=te("cDcd"),y=te.n(h),P=te("VrN/"),w=te.n(P),x=te("bdgK"),v=te("p77/"),d=te("Bd2K"),o=te("ELLl"),l=te("19Vz"),s=te("lZu9"),S=te("+NIl"),b=te("kSUc"),f=te("9Bee"),L=function(_e){var ct=_e.value,at=ct===void 0?"":ct,rt=_e.className,xt=_e.showTextOnly,Et=_e.showLines,Rt=_e.style,Lt=Rt===void 0?{}:Rt,pt=Object(h.useMemo)(function(){return""},[at]);return y.a.createElement(y.a.Fragment,null,y.a.createElement("div",{dangerouslySetInnerHTML:{__html:pt}}))},T=te("Q9mQ"),m=te("diRs"),c=te("0Owb"),u=te("dejd"),a=te("C+DQ"),E=te("D1Df"),g=te.n(E),p=te("1vsH"),_=te("m3rI"),U=[{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 B(_e){var ct=_e.onActionCallback,at=_e.title,rt=_e.icon,xt=_e.actionName,Et=_e.className,Rt=Et===void 0?"":Et,Lt=_e.children;function pt(){ct(xt)}return y.a.createElement("a",{title:at,className:Rt,onClick:pt},y.a.createElement("i",{className:"md-iconfont ".concat(rt)}),Lt)}var W=function(_e){var ct=_e.watch,at=_e.showNullButton,rt=_e.onActionCallback,xt=_e.fullScreen,Et=_e.insertTemp,Rt=_e.hidetoolBar,Lt=_e.uuid,pt=_e.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(p.G)("_educoder_session_login"),"&_educoder_session=").concat(Object(p.G)("_educoder_session"),"&key=").concat(Lt,"&api=").concat(encodeURIComponent(_.a.PROXY_SERVER)));var or=[].concat(U,[{title:"".concat(ct?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(ct?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return y.a.createElement("ul",{className:"markdown-toolbar-container"},!Rt&&or.map(function(Kt,Nt){return y.a.createElement("li",{key:Nt},Kt.actionName?y.a.createElement(B,Object(c.a)({},Kt,{onActionCallback:rt})):y.a.createElement("span",{className:"v-line"}))}),at?y.a.createElement("li",null,y.a.createElement(B,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:rt},y.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,Et&&y.a.createElement("li",null,y.a.createElement(B,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(Et),onActionCallback:rt},y.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),y.a.createElement("li",null,y.a.createElement(m.a,{title:"\u6253\u5F00\u624B\u673A\u626B\u4E00\u626B",content:y.a.createElement("div",null,y.a.createElement(g.a,{size:150,fgColor:"#000",value:"https://test2.educoder.net/upload.html?_educoder_session_login=".concat(Object(p.G)("_educoder_session_login"),"&_educoder_session=").concat(Object(p.G)("_educoder_session"),"&key=").concat(Lt,"&api=").concat(encodeURIComponent(_.a.PROXY_SERVER))}))},y.a.createElement("span",{className:"fill-tip",onMouseOver:function(){return pt(!0)}},"\u624B\u673A\u4E0A\u4F20\u6587\u4EF6"))),y.a.createElement("li",{className:"btn-full-screen"},y.a.createElement(B,{icon:"".concat(xt?"icon-shrink":"icon-enlarge"),title:xt?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:rt})))},k=te("M8RZ"),M=te("+L6B"),H=te("2/Rp"),X=te("y8nQ"),ee=te("Vl3Y"),ie=te("5NDa"),ve=te("5rEg"),pe={labelCol:{span:4},wrapperCol:{span:20}},he=function(_e){var ct=_e.callback,at=_e.onCancel;function rt(xt){ct(xt)}return y.a.createElement(ee.a,Object(c.a)({},pe,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:rt}),y.a.createElement(ee.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},y.a.createElement(ve.a,null)),y.a.createElement(ee.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},y.a.createElement(ve.a,null)),y.a.createElement("div",{className:"flex-container flex-end"},y.a.createElement(H.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),y.a.createElement(H.a,{type:"ghost",onClick:at},"\u53D6\u6D88")))},ce=te("7ahc"),fe=te("k1fw"),ne=te("HmJG"),me=te("BjJ7"),$=ee.a.useForm,ae={width:280,marginRight:10},q={labelCol:{span:5},wrapperCol:{span:19}},Ee=function(_e){var ct=_e.callback,at=_e.onCancel,rt=$(),xt=Object(N.a)(rt,1),Et=xt[0],Rt=useRef();function Lt(Kt){ct(Object(fe.a)(Object(fe.a)({},Kt),{},{name:Rt.current}))}function pt(Kt,Nt){if(Kt.status===-1){F.b.error(Kt.message);return}Et.setFieldsValue({src:"/api/attachments/".concat(Kt.id),type:Nt.type})}function or(Kt){var Nt=Kt.target.files[0];Rt.current=Nt.name,ye(Nt,pt)}return y.a.createElement(ee.a,Object(c.a)({form:Et},q,{className:"upload-image-panel",onFinish:Lt}),y.a.createElement(ee.a.Item,{label:"\u6587\u4EF6\u5730\u5740",required:!0},y.a.createElement("div",{className:"flex-container"},y.a.createElement(ee.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u6587\u4EF6\u5730\u5740"}]},y.a.createElement(ve.a,{style:ae})),y.a.createElement(Ce,{onFileChange:or}))),y.a.createElement(ee.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},y.a.createElement(ve.a,{style:{width:264}})),y.a.createElement(ee.a.Item,{style:{textAlign:"right"}},y.a.createElement(H.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),y.a.createElement(H.a,{type:"ghost",onClick:at},"\u53D6\u6D88")))};function Ce(_e){var ct=_e.onFileChange;return y.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",y.a.createElement("input",{type:"file",onChange:ct}))}function ye(_e,ct){if(!_e)throw new String("\u6CA1\u6709\u6587\u4EF6");var at=new FormData;at.append("editormd-image-file",_e),at.append("file_param_name","editormd-image-file"),at.append("byxhr","true");var rt=new window.XMLHttpRequest;rt.withCredentials=!0,rt.addEventListener("load",function(xt){ct(JSON.parse(xt.target.responseText),_e)},!1),rt.addEventListener("error",function(xt){console.error(xt)},!1),rt.open("POST","".concat(me.a,"/api/attachments.json")),rt.send(at)}var we=te("giR+"),Le=te("fyUT"),ke=te("7Kak"),Fe=te("9yH6"),Me=Fe.a.Group,Pe={margin:"0 8px"},Ze=function(_e){var ct=_e.callback,at=_e.onCancel;function rt(xt){ct(xt)}return y.a.createElement(ee.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:rt},y.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},y.a.createElement("span",{style:Pe},"\u5355\u5143\u683C\u6570\uFF1A"),y.a.createElement("span",{style:Pe},"\u884C\u6570"),y.a.createElement(ee.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},y.a.createElement(Le.a,null)),y.a.createElement("span",{style:Pe},"\u5217\u6570"),y.a.createElement(ee.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},y.a.createElement(Le.a,null))),y.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},y.a.createElement("span",{style:Pe},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),y.a.createElement(ee.a.Item,{name:"align"},y.a.createElement(Me,null,y.a.createElement(Fe.a,{value:"default"},y.a.createElement("i",{className:"fa fa-align-justify"})),y.a.createElement(Fe.a,{value:"left"},y.a.createElement("i",{className:"fa fa-align-left"})),y.a.createElement(Fe.a,{value:"center"},y.a.createElement("i",{className:"fa fa-align-center"})),y.a.createElement(Fe.a,{value:"right"},y.a.createElement("i",{className:"fa fa-align-right"}))))),y.a.createElement("div",{className:"flex-container flex-end"},y.a.createElement(H.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),y.a.createElement(H.a,{type:"ghost",onClick:at},"\u53D6\u6D88")))},qe=te("ErOA"),Ge=te("7Cbv"),He="link",$e="upload-image",We="code-block",ze="add-table",Se="------------",Je={default:Se,left:":".concat(Se),center:":".concat(Se,":"),right:"".concat(Se,":")},Qe=te("9VGf"),Ae,Ie;function ge(){}var le=0,de=1e4,Q="\u2581",Z=`
|
|
**\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 re(_e){return/^\d+$/.test(_e)?"".concat(_e,"px"):_e}var se=navigator.platform.toUpperCase().indexOf("MAC")>=0,Te=se?"Cmd":"Ctrl",De=["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"],Oe=(Ae={},Object(I.a)(Ae,Te+"-B","bold"),Object(I.a)(Ae,Te+"-I","italic"),Ae),Ke=(Ie={},Object(I.a)(Ie,He,"\u6DFB\u52A0\u94FE\u63A5"),Object(I.a)(Ie,We,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(I.a)(Ie,$e,"\u6DFB\u52A0\u6587\u4EF6"),Object(I.a)(Ie,ze,"\u6DFB\u52A0\u8868\u683C"),Ie),it=Ve.a=function(_e){var ct=_e.defaultValue,at=ct===void 0?"":ct,rt=_e.onChange,xt=_e.width,Et=xt===void 0?"100%":xt,Rt=_e.height,Lt=Rt===void 0?400:Rt,pt=_e.miniToolbar,or=pt===void 0?!1:pt,Kt=_e.isFocus,Nt=Kt===void 0?!1:Kt,Tr=_e.watch,vr=_e.insertTemp,wi=_e.mode,mr=wi===void 0?"markdown":wi,vn=_e.id,Jr=vn===void 0?"markdown-editor-id":vn,kt=_e.showResizeBar,st=kt===void 0?!1:kt,Sr=_e.noStorage,Vn=Sr===void 0?!1:Sr,cr=_e.showNullButton,St=cr===void 0?!1:cr,wr=_e.hidetoolBar,Zr=wr===void 0?!1:wr,yn=_e.fullScreen,Ne=yn===void 0?!1:yn,ft=_e.onBlur,qr=_e.onCMBeforeChange,en=_e.onFullScreen,tn=_e.className,bn=tn===void 0?"":tn,Xn=_e.disablePaste,mt=Xn===void 0?!1:Xn,Ci=_e.placeholder,Ai=Ci===void 0?"":Ci,rn=_e.values,sr=rn===void 0?"":rn,Li=Object(h.useState)(null),Yn=Object(N.a)(Li,2),Be=Yn[0],$n=Yn[1],Di=Object(h.useState)(at),En=Object(N.a)(Di,2),nn=En[0],Ur=En[1],_i=Object(h.useState)(Tr),Qn=Object(N.a)(_i,2),_r=Qn[0],Oi=Qn[1],Ri=Object(h.useState)(Ne),pr=Object(N.a)(Ri,2),Cr=pr[0],Pi=pr[1],xn=Object(h.useState)(""),Fr=Object(N.a)(xn,2),Nr=Fr[0],Br=Fr[1],aa=Object(h.useState)(0),ki=Object(N.a)(aa,2),Or=ki[0],Tn=ki[1],oa=Object(h.useState)(Lt),Jn=Object(N.a)(oa,2),Zn=Jn[0],an=Jn[1],Sn=Object(h.useState)(!1),wn=Object(N.a)(Sn,2),sa=wn[0],Cn=wn[1],on=Object(h.useRef)(Object(Ge.a)()),Mi=Object(h.useRef)(!1),qn=Object(h.useRef)(),$t=Object(h.useRef)(),jr=Object(h.useRef)(),An=Object(h.useRef)(),Wr=Object(h.useRef)(),Ii=function(){var ot=Object(O.a)(C.a.mark(function ht(){var ut,vt;return C.a.wrap(function(_t){for(;;)switch(_t.prev=_t.next){case 0:return _t.next=2,Object(qe.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:on.current}});case 2:vt=_t.sent,vt!=null&&(ut=vt.attachments)!==null&&ut!==void 0&&ut.length&&(console.log("cm:",Be,$t),vt.attachments.map(function(yt){yt.content_type.indexOf("image")>-1?Be.replaceSelection(".concat(yt.content_type,")")):yt.content_type.indexOf("video")>-1?Be.replaceSelection('<video width="100%" controls src="'.concat(_.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):yt.content_type.indexOf("pdf")>-1?Be.replaceSelection('<a href="'.concat(_.a.API_SERVER,"/api/attachments/").concat(yt.id,"?type=").concat(yt.content_type,'&disposition=inline" target="_blank">').concat(yt.name,"</a>")):Be.replaceSelection("[".concat(yt.name,"](").concat(_.a.API_SERVER,"/api/attachments/").concat(yt.id,"?type=").concat(yt.content_type,")"))}));case 4:case"end":return _t.stop()}},ht)}));return function(){return ot.apply(this,arguments)}}();Object(h.useEffect)(function(){Ur(sr),Be==null||Be.setValue(sr)},[sr]),Object(h.useEffect)(function(){en==null||en(Cr)},[Cr]),Object(h.useEffect)(function(){if($t.current){var ot=w.a.fromTextArea($t.current,{mode:mr,lineNumbers:!or,lineWrapping:!0,value:at,autoCloseTags:!0,autoCloseBrackets:!0});Nt&&ot.focus();function ht(ut,vt){if(mt){vt.preventDefault();return}var Tt=vt.clipboardData;if(Tt){var _t=Tt.types.toString(),yt=Tt.items;if(_t==="Files"||Tt.types.indexOf("Files")>-1){if(vt.preventDefault(),mr=="stex")return;try{var It,Wt=yt[1];((It=yt[0])===null||It===void 0?void 0:It.kind)==="file"&&(Wt=yt[0]);var bt=Wt.getAsFile(),Pr=bt.name.split(".").pop();ye(bt,function(Ct){if(Ct.id){var Zt,Dt,gr;(bt==null||((Zt=bt.type)===null||Zt===void 0)?void 0:Zt.indexOf("image"))>-1?ot.replaceSelection(".concat(Ct.content_type,")")):(bt==null||((Dt=bt.type)===null||Dt===void 0)?void 0:Dt.indexOf("video"))>-1?ot.replaceSelection('<video width="100%" controls src="'.concat(_.a.API_SERVER,"/api/attachments/").concat(Ct.id,'"></video>')):(bt==null||((gr=bt.type)===null||gr===void 0)?void 0:gr.indexOf("pdf"))>-1?ot.replaceSelection('<a href="'.concat(_.a.API_SERVER,"/api/attachments/").concat(Ct.id,"?type=").concat(bt.type,'&disposition=inline" target="_blank">').concat(bt.name,"</a>")):De.includes(Pr)?ot.replaceSelection('<a href="'.concat(_.a.API_SERVER,"/api/attachments/").concat(Ct.id,'?type=office&disposition=inline" target="_blank">').concat(bt.name,"</a>")):ot.replaceSelection("[".concat(bt.name,"](").concat(_.a.API_SERVER,"/api/attachments/").concat(Ct.id,"?type=").concat(Ct.content_type,")"))}else(Ct==null?void 0:Ct.status)===401&&(document.location.href="/user/login")})}catch(Ct){F.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return ot.on("paste",ht),ot.on("dragleave",function(ut,vt){jr.current.classList.remove("mouse-hover-md")}),ot.on("dragover",function(ut,vt){jr.current.classList.add("mouse-hover-md")}),ot.on("drop",function(ut,vt){jr.current.classList.add("mouse-hover-md");var Tt;if(Tt=vt.dataTransfer.files,Tt.length>0){vt.preventDefault(),vt.stopPropagation();for(var _t=function(Wt){var bt=Tt[Wt],Pr=bt.name.split(".").pop();ye(bt,function(Ct){if(Ct.id){var Zt,Dt,gr;(bt==null||((Zt=bt.type)===null||Zt===void 0)?void 0:Zt.indexOf("image"))>-1?ot.replaceSelection(".concat(Ct.content_type,")")):(bt==null||((Dt=bt.type)===null||Dt===void 0)?void 0:Dt.indexOf("video"))>-1?ot.replaceSelection('<video width="100%" controls src="'.concat(_.a.API_SERVER,"/api/attachments/").concat(Ct.id,'"></video>')):(bt==null||((gr=bt.type)===null||gr===void 0)?void 0:gr.indexOf("pdf"))>-1?ot.replaceSelection('<a href="'.concat(_.a.API_SERVER,"/api/attachments/").concat(Ct.id,"?type=").concat(bt.type,'&disposition=inline" target="_blank">').concat(bt.name,"</a>")):De.includes(Pr)?ot.replaceSelection('<a href="'.concat(_.a.API_SERVER,"/api/attachments/").concat(Ct.id,'?type=office&disposition=inline" target="_blank">').concat(bt.name,"</a>")):ot.replaceSelection("[".concat(bt.name,"](").concat(_.a.API_SERVER,"/api/attachments/").concat(Ct.id,"?type=").concat(Ct.content_type,")"))}else(Ct==null?void 0:Ct.status)===401&&(document.location.href="/user/login")})},yt=0;yt<Tt.length;yt++)_t(yt)}}),$n(ot),function(){ot.off("paste",ht)}}},[]);var yr=Object(h.useCallback)(function(){if(jr.current)try{}catch(ot){console.log(ot,"---- to set md editor body height")}},[Zn,jr,Cr]);Object(h.useEffect)(function(){function ot(){var ut=new x.default(function(vt){var Tt=Object(D.a)(vt),_t;try{for(Tt.s();!(_t=Tt.n()).done;){var yt=_t.value;(yt.target.offsetHeight>0||yt.target.offsetWidth>0)&&(yr(),Be.setSize("100%","100%"),Be.refresh())}}catch(It){Tt.e(It)}finally{Tt.f()}});return ut.observe($t.current.parentElement),ut}if(Be){var ht=ot();return function(){ht.unobserve($t.current.parentElement)}}},[Be,yr]),Object(h.useEffect)(function(){if(Be){for(var ot=[],ht=function(){var yt=vt[ut];Tt=Object(N.a)(yt,2);var It=Tt[0],Wt=Tt[1],bt=Object(I.a)({},It,function(){Ln(Wt)});ot.push(bt),Be.addKeyMap(bt)},ut=0,vt=Object.entries(Oe);ut<vt.length;ut++){var Tt;ht()}return qn.current=setInterval(function(){Mi.current&&Ii()},4e3),function(){clearInterval(qn.current);var _t=Object(D.a)(ot),yt;try{for(_t.s();!(yt=_t.n()).done;){var It=yt.value;Be.removeKeyMap(It)}}catch(Wt){_t.e(Wt)}finally{_t.f()}}}},[Be]),Object(h.useEffect)(function(){Ne!==Cr&&Pi(Ne)},[Ne]),Object(Qe.a)(function(){if(!Vn&&Or>0){var ot=new Date().getTime(),ht=window.sessionStorage.getItem(Jr);ot>=Or+de&&(!ht||ht!==nn)&&(window.sessionStorage.setItem(Jr,nn),Cn(!0))}},de),Object(h.useEffect)(function(){Oi(Tr)},[Be,Tr]),Object(h.useEffect)(function(){Be&&(Nt&&Be.focus())},[Be,Nt]),Object(h.useEffect)(function(){if(_r&&Be){var ot=Be.getScrollerElement();function ht(ut){var vt=ut.target;if(Wr.current){var Tt=vt.scrollTop/vt.scrollHeight;Wr.current.scrollTop=Wr.current.scrollHeight*Tt}}return ot.addEventListener("scroll",ht),function(){ot.removeEventListener("scroll",ht)}}},[Be,_r]),Object(h.useEffect)(function(){if(Be&&qr){function ot(ht,ut){qr(ht,ut)}return Be.on("beforeChange",ot),function(){Be.off("beforeChange",ot)}}},[Be,qr]),Object(h.useEffect)(function(){if(Be&&ft){function ot(){ft(Be.getValue())}return Be.on("blur",ot),function(){Be.off("blur",ot)}}},[Be,ft]),Object(h.useEffect)(function(){if(Be){function ot(ht){var ut=ht.getValue();Ur(ut),Tn(new Date().getTime()),ht.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),rt&&rt(ut)}return Be.on("change",ot),function(){Be.off("change",ot)}}},[Be,rt]),Object(h.useEffect)(function(){Be&&(at==null?(Be.setValue(""),Ur("")):at!==Be.getValue()&&(Be.setValue(at),Ur(at),Be.setCursor(Be.lineCount(),0)))},[Be,at]);var Ln=Object(h.useCallback)(function(ot){var ht=Be.getCursor(),ut=Be.getSelection(),vt=ut.split(`
|
|
`);switch(ot){case"bold":return Be.replaceSelection("**"+ut+"**"),ut===""&&Be.setCursor(ht.line,ht.ch+2),Be.focus();case"italic":return Be.replaceSelection("*"+ut+"*"),ut===""&&Be.setCursor(ht.line,ht.ch+1),Be.focus();case"code":return Be.replaceSelection("`"+ut+"`"),ut===""&&Be.setCursor(ht.line,ht.ch+1),Be.focus();case"inline-latex":return Be.replaceSelection("`$$"+ut+"$$`"),ut===""&&Be.setCursor(ht.line,ht.ch+3),Be.focus();case"latex":return Be.replaceSelection("```latex\n"+ut+"\n```"),Be.setCursor(ht.line+1,ut.length+1),Be.focus();case"line-break":return Be.replaceSelection(`<br/>
|
|
`),Be.focus();case"list-ul":return ut===""?Be.replaceSelection("- "+ut):Be.replaceSelection(vt.map(function(Tt){return Tt===""?"":"- ".concat(Tt)}).join(`
|
|
`)),Be.focus();case"list-ol":return ut===""?Be.replaceSelection("1. "+ut):Be.replaceSelection(vt.map(function(Tt,_t){return Tt===""?"":"".concat(_t+1,". ").concat(Tt)}).join(`
|
|
`)),Be.focus();case"add-null-ch":return ut===""&&Be.setCursor(ht.line,ht.ch+1),Be.replaceSelection(Q),Be.focus();case"inster-template-1":return ut===""&&Be.setCursor(ht.line,ht.ch),Be.replaceSelection(Z),Be.focus();case"eraser":return Be.setValue(""),Be.focus();case"trigger-watch":return Oi(!_r),Be.focus();case"trigger-full-screen":return Pi(!Cr),Be.focus();case He:Br(He);return;case We:Br(We);return;case $e:Br($e);return;case ze:Br(ze);return;default:throw new Error}},[Be,_r,Cr]),lr=Object(h.useCallback)(function(ot){Br("");switch(Nr){case He:var ht=ot.title,ut=ot.link;return Be.replaceSelection("[".concat(ht,"](").concat(ut,")")),Be.focus();case We:var vt=ot.language,Tt=ot.content;return Be.replaceSelection(["```"+vt,Tt,"```"].join(`
|
|
`)),Be.focus();case $e:var _t=ot.src,yt=ot.alt;return yt?Be.replaceSelection(".concat(_t,' "').concat(yt,'" )')):Be.replaceSelection("")),Be.focus();case ze:for(var It=ot.row,Wt=ot.col,bt=ot.align,Pr=`
|
|
`,Ct=0;Ct<It;Ct++){for(var Zt=[],Dt=[],gr=0;gr<Wt;gr++)Ct===1&&Dt.push(Je[bt]),Zt.push(" ");Ct===1&&(Pr+="| ".concat(Dt.join(" | "),` |
|
|
`)),Pr+="| ".concat(Zt.join(Wt===1?"":" | "),` |
|
|
`)}return Be.replaceSelection(Pr+`
|
|
`),Be.focus();default:throw new Error}},[Be,Nr]),Dn=Object(h.useMemo)(function(){switch(Nr){case He:return y.a.createElement(he,{callback:lr,onCancel:Rr});case We:return y.a.createElement(ce.b,{callback:lr,onCancel:Rr});case $e:return y.a.createElement(Ee,{callback:lr,onCancel:Rr});case ze:return y.a.createElement(Ze,{callback:lr,onCancel:Rr});default:return null}},[Nr]);function Rr(){Br("")}Object(h.useEffect)(function(){if(An.current){var ot=An.current,ht=!1,ut=0;function vt(yt){ht=!0,ut=yt.pageY}function Tt(){ht=!1}function _t(yt){if(ht){var It=yt.pageY-ut;It<0&&(It=0),It>300&&(It=300);var Wt=Lt+It+"px";an(Wt)}}return ot.addEventListener("mousedown",vt),document.addEventListener("mousemove",_t),document.addEventListener("mouseup",Tt),function(){ot.removeEventListener("mousedown",vt),document.removeEventListener("mousemove",_t),document.removeEventListener("mouseup",Tt)}}},[Be,An]),Object(h.useEffect)(function(){an(Lt)},[Lt]);var Hr=re(Et),la=re(Zn),ua={width:Hr,height:la},$a=Object(h.useMemo)(function(){if(Or){var ot=new Date(Or),ht=ot.getHours(),ut=ot.getMinutes(),vt=ot.getSeconds();return ht=ht<10?"0"+ht:ht,ut=ut<10?"0"+ut:ut,vt=vt<10?"0"+vt:vt,"".concat(ht,":").concat(ut,":").concat(vt)}return 0},[Or]);function Qa(){window.sessionStorage.removeItem(Jr),Cn(!1),Tn(0)}function da(){Cn(!1),Tn(0),Be.setValue(window.sessionStorage.getItem(Jr))}function Ui(ot,ht){var ut=Be.getValue();ut=ut.replace(ot,ht),Ur(ut),Be==null||Be.setValue(ut)}return y.a.createElement(h.Fragment,null,y.a.createElement("div",{className:"markdown-editor-wrapper",ref:jr},y.a.createElement("div",{className:"markdown-editor-container ".concat(bn," ").concat(_r?"on-preview":""," ").concat(or?"mini":""," ").concat(Cr?"full-screen":""),style:ua},y.a.createElement(W,{insertTemp:vr,watch:_r,fullScreen:Cr,showNullButton:St,onActionCallback:Ln,hidetoolBar:Zr,uuid:on.current,setOpenPhones:function(){Mi.current=!0}}),y.a.createElement("div",{className:"markdown-editor-body"},y.a.createElement("div",{className:"codemirror-container"},y.a.createElement("textarea",{ref:$t,placeholder:Ai})),_r?y.a.createElement("div",{ref:Wr,className:"preview-container"},mr==="stex"&&y.a.createElement(L,{value:nn}),mr!=="stex"&&y.a.createElement(f.a,{edit:!0,value:nn,replaces:Ui})):null))),st?y.a.createElement("a",{ref:An,className:"editor-resize"}):null,y.a.createElement(k.a,null,Ke[Nr]?y.a.createElement(z.a,{centered:!0,title:Ke[Nr],visible:!0,onCancel:Rr,footer:null,className:"markdown-popup-form"},Dn):null))}},R7cW:function(tt,Ve,te){"use strict";te.r(Ve);var J=te("+L6B"),z=te("2/Rp"),D=te("DZo9"),K=te("8z0m"),F=te("0Owb"),O=te("5NDa"),N=te("5rEg"),I=te("sPJy"),R=te("bE4q"),C=te("k1fw"),h=te("oBTY"),y=te("9og8"),P=te("miYZ"),w=te("tsqr"),x=te("y8nQ"),v=te("Vl3Y"),d=te("tJVT"),o=te("WmNS"),l=te.n(o),s=te("cDcd"),S=te.n(s),b=te("Ty5D"),f=te("9kvl"),L=te("55Ip"),T=te("Ot1p"),m=te("XYT7"),c=te("m3rI"),u=te("YiJy"),a=te.n(u),E=function(p){var _,U=p.shixunHomeworks,B=p.newCourse,W=p.globalSetting,k=p.loading,M=p.dispatch,H=p.match,X=Object(b.i)(),ee=v.a.useForm(),ie=Object(d.a)(ee,1),ve=ie[0],pe=Object(s.useState)({}),he=Object(d.a)(pe,2),ce=he[0],fe=he[1],ne=Object(s.useState)(!1),me=Object(d.a)(ne,2),$=me[0],ae=me[1],q=Object(s.useState)([]),Ee=Object(d.a)(q,2),Ce=Ee[0],ye=Ee[1],we=Object(s.useState)([]),Le=Object(d.a)(we,2),ke=Le[0],Fe=Le[1],Me=U.commonHomeWorkEditDefaultData,Pe={name:"file",multiple:!0,action:c.a.API_SERVER+"/api/attachments.json",defaultFileList:Ce,onChange:function($e){var We=$e.file.status;We!=="uploading",We==="done"?w.b.success("".concat($e.file.name," \u6587\u4EF6\u4E0A\u4F20\u6210\u529F")):We==="error"&&w.b.error("".concat($e.file.name," \u6587\u4EF6\u4E0A\u4F20\u5931\u8D25"))}};Object(s.useEffect)(function(){qe()},[X.topicId]);var Ze=function($e){return $e==null?void 0:$e.map(function(We){return{uid:We.id,response:{id:We.id},name:We.title,status:"done",url:We.url}})},qe=function(){var He=Object(y.a)(l.a.mark(function $e(){var We;return l.a.wrap(function(Se){for(;;)switch(Se.prev=Se.next){case 0:return Se.next=2,M({type:"shixunHomeworks/editCommonHomeWorkDefaultBankData",payload:{id:X.topicId}});case 2:We=Se.sent,We&&(ve.setFieldsValue({name:We.name}),ve.setFieldsValue({description:We.description}),ve.setFieldsValue({reference_answer:We.reference_answer}),ye(Object(h.a)(Ze(We.attachments))),Fe(Object(h.a)(Ze(We.reference_attachments))),ae(!0));case 4:case"end":return Se.stop()}},$e)}));return function(){return He.apply(this,arguments)}}(),Ge=function(){var He=Object(y.a)(l.a.mark(function $e(We){var ze,Se,Je,Qe;return l.a.wrap(function(Ie){for(;;)switch(Ie.prev=Ie.next){case 0:return ze=Object(C.a)({},ce),ze.attachment_ids&&(ze.attachment_ids=ze==null||((Se=ze.attachment_ids.fileList)===null||Se===void 0)?void 0:Se.map(function(ge){var le;return(le=ge.response)===null||le===void 0?void 0:le.id})),ze.reference_attachment_ids&&(ze.reference_attachment_ids=ze==null||((Je=ze.reference_attachment_ids.fileList)===null||Je===void 0)?void 0:Je.map(function(ge){var le;return(le=ge.response)===null||le===void 0?void 0:le.id})),Ie.next=5,Object(m.n)(Object(C.a)(Object(C.a)({id:X.topicId},ze),{},{base_on_project:null,type:1}));case 5:Qe=Ie.sent,Qe&&f.d.push("/users/".concat(X.username,"/topics/").concat(X.topicId,"/").concat(X.topictype,"/normal/detail"));case 7:case"end":return Ie.stop()}},$e)}));return function(We){return He.apply(this,arguments)}}();return S.a.createElement("section",{className:a.a.bg},S.a.createElement("section",{className:"animated fadeIn"},S.a.createElement("aside",{className:"mt10"},S.a.createElement(R.a,{separator:">"},S.a.createElement(R.a.Item,null,S.a.createElement(L.a,{to:"/users/".concat(X.username,"/").concat(X.topictype==="personal"?"topics":"topicbank","/").concat(X.topictype)},X.topictype==="personal"?"\u6211\u7684\u8BFE\u5802\u8D44\u6E90":"\u516C\u5171\u9898\u5E93")),S.a.createElement(R.a.Item,null,S.a.createElement(L.a,{to:"/users/".concat(X.username,"/topics/").concat(X.topicId,"/").concat(X.topictype,"/normal/detail")},"\u8BE6\u60C5")),S.a.createElement(R.a.Item,null,"\u7F16\u8F91")))),S.a.createElement("aside",{className:"font24 bold mt20 mb20"},"\u7F16\u8F91"),S.a.createElement(v.a,{form:ve,className:a.a.formWrap,scrollToFirstError:!0,layout:"vertical",onValuesChange:function(){fe(Object(C.a)({},ve.getFieldsValue()))},onFinish:Ge},S.a.createElement("div",{className:a.a.fieldWrap},S.a.createElement(v.a.Item,{name:"name",label:"\u6807\u9898:",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u6807\u9898"}]},S.a.createElement(N.a,{maxLength:60,suffix:"".concat(((_=ce.name)===null||_===void 0?void 0:_.length)||0,"/60"),placeholder:"\u4F8B\u5982\uFF1A\u4ECEPython\u7A0B\u5E8F\u8BBE\u8BA1-\u5165\u95E8\u7CBE\u901A"}))),S.a.createElement("div",{className:a.a.mdWrap},S.a.createElement(v.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"}]},S.a.createElement(T.a,{id:"topic-normal-description",watch:!0,defaultValue:Me.description})),S.a.createElement("div",null,S.a.createElement(v.a.Item,{name:"attachment_ids"},$&&S.a.createElement(K.a,Object(F.a)({defaultFileList:Ce},Pe),S.a.createElement("span",{className:"c-blue"},"\u4E0A\u4F20\u9644\u4EF6")," \uFF08\u5355\u4E2A\u6587\u4EF6150MB\u4EE5\u5185\uFF09")))),S.a.createElement("div",{className:a.a.mdWrap},S.a.createElement(v.a.Item,{name:"reference_answer",label:"\u53C2\u8003\u7B54\u6848:"},S.a.createElement(T.a,{id:"topic-normal-reference_answer",defaultValue:Me.reference_answer,watch:!0})),S.a.createElement("div",null,S.a.createElement(v.a.Item,{name:"reference_attachment_ids"},$&&S.a.createElement(K.a,Object(F.a)({},Pe,{defaultFileList:ke}),S.a.createElement("span",{className:"c-blue"},"\u4E0A\u4F20\u9644\u4EF6")," \uFF08\u5355\u4E2A\u6587\u4EF6150MB\u4EE5\u5185\uFF09")))),S.a.createElement("div",{className:a.a.backgroundFa},S.a.createElement("div",{className:"pt40 mb30"},S.a.createElement(v.a.Item,null,S.a.createElement(z.a,{size:"large",type:"primary",className:"".concat(a.a.button," mr20"),htmlType:"submit"},"\u63D0\u4EA4"),S.a.createElement(z.a,{size:"large",type:"primary",ghost:!0,className:a.a.button,onClick:function(){return f.d.push("/users/".concat(X.username,"/topics/").concat(X.topicId,"/").concat(X.topictype,"/normal/detail"))}},"\u53D6\u6D88"))))))};Ve.default=Object(f.a)(function(g){var p=g.shixunHomeworks,_=g.newCourse,U=g.loading,B=g.globalSetting;return{shixunHomeworks:p,newCourse:_,globalSetting:B,loading:U.effects}})(E)},SJMd:function(tt,Ve){/**
|
|
* @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 te,J,z,D=!1,K,F;window.PR_SHOULD_USE_CONTINUATION=!0;var O,N;(function(){var I=window,R=["break,continue,do,else,for,if,return,while"],C=[R,"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"],h=[C,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],y=[h,"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"],P=[h,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],w=[h,"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"],x="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",v=[h,"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=[R,"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"],l=[R,"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"],s=[R,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],S=[y,w,P,v,d,o,l,s],b=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,f="str",L="kwd",T="com",m="typ",c="lit",u="pun",a="pln",E="tag",g="dec",p="src",_="atn",U="atv",B="nocode",W="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function k(ye){for(var we=0,Le=!1,ke=!1,Fe=0,Me=ye.length;Fe<Me;++Fe){var Pe=ye[Fe];if(Pe.ignoreCase)ke=!0;else if(/[a-z]/i.test(Pe.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Le=!0,ke=!1;break}}var Ze={b:8,t:9,n:10,v:11,f:12,r:13};function qe(ze){var Se=ze.charCodeAt(0);if(Se!==92)return Se;var Je=ze.charAt(1);return Se=Ze[Je],Se||("0"<=Je&&Je<="7"?parseInt(ze.substring(1),8):Je==="u"||Je==="x"?parseInt(ze.substring(2),16):ze.charCodeAt(1))}function Ge(ze){if(ze<32)return(ze<16?"\\x0":"\\x")+ze.toString(16);var Se=String.fromCharCode(ze);return Se==="\\"||Se==="-"||Se==="]"||Se==="^"?"\\"+Se:Se}function He(ze){var Se=ze.substring(1,ze.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")),Je=[],Qe=Se[0]==="^",Ae=["["];Qe&&Ae.push("^");for(var Ie=Qe?1:0,ge=Se.length;Ie<ge;++Ie){var le=Se[Ie];if(/\\[bdsw]/i.test(le))Ae.push(le);else{var de=qe(le),Q;Ie+2<ge&&Se[Ie+1]==="-"?(Q=qe(Se[Ie+2]),Ie+=2):Q=de,Je.push([de,Q]),Q<65||de>122||(Q<65||de>90||Je.push([Math.max(65,de)|32,Math.min(Q,90)|32]),Q<97||de>122||Je.push([Math.max(97,de)&~32,Math.min(Q,122)&~32]))}}Je.sort(function(Te,De){return Te[0]-De[0]||De[1]-Te[1]});for(var Z=[],re=[],Ie=0;Ie<Je.length;++Ie){var se=Je[Ie];se[0]<=re[1]+1?re[1]=Math.max(re[1],se[1]):Z.push(re=se)}for(var Ie=0;Ie<Z.length;++Ie){var se=Z[Ie];Ae.push(Ge(se[0])),se[1]>se[0]&&(se[1]+1>se[0]&&Ae.push("-"),Ae.push(Ge(se[1])))}return Ae.push("]"),Ae.join("")}function $e(ze){for(var Se=ze.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")),Je=Se.length,Qe=[],Ae=0,Ie=0;Ae<Je;++Ae){var ge=Se[Ae];if(ge==="(")++Ie;else if(ge.charAt(0)==="\\"){var le=+ge.substring(1);le&&(le<=Ie?Qe[le]=-1:Se[Ae]=Ge(le))}}for(var Ae=1;Ae<Qe.length;++Ae)Qe[Ae]===-1&&(Qe[Ae]=++we);for(var Ae=0,Ie=0;Ae<Je;++Ae){var ge=Se[Ae];if(ge==="(")++Ie,Qe[Ie]||(Se[Ae]="(?:");else if(ge.charAt(0)==="\\"){var le=+ge.substring(1);le&&le<=Ie&&(Se[Ae]="\\"+Qe[le])}}for(var Ae=0;Ae<Je;++Ae)Se[Ae]==="^"&&Se[Ae+1]!=="^"&&(Se[Ae]="");if(ze.ignoreCase&&Le)for(var Ae=0;Ae<Je;++Ae){var ge=Se[Ae],de=ge.charAt(0);ge.length>=2&&de==="["?Se[Ae]=He(ge):de!=="\\"&&(Se[Ae]=ge.replace(/[a-zA-Z]/g,function(re){var se=re.charCodeAt(0);return"["+String.fromCharCode(se&~32,se|32)+"]"}))}return Se.join("")}for(var We=[],Fe=0,Me=ye.length;Fe<Me;++Fe){var Pe=ye[Fe];if(Pe.global||Pe.multiline)throw new Error(""+Pe);We.push("(?:"+$e(Pe)+")")}return new RegExp(We.join("|"),ke?"gi":"g")}function M(ye,we){var Le=/(?:^|\s)nocode(?:\s|$)/,ke=[],Fe=0,Me=[],Pe=0;function Ze(qe){var Ge=qe.nodeType;if(Ge==1){if(Le.test(qe.className))return;for(var He=qe.firstChild;He;He=He.nextSibling)Ze(He);var $e=qe.nodeName.toLowerCase();($e==="br"||$e==="li")&&(ke[Pe]=`
|
|
`,Me[Pe<<1]=Fe++,Me[Pe++<<1|1]=qe)}else if(Ge==3||Ge==4){var We=qe.nodeValue;We.length&&(we?We=We.replace(/\r\n?/g,`
|
|
`):We=We.replace(/[ \t\r\n]+/g," "),ke[Pe]=We,Me[Pe<<1]=Fe,Fe+=We.length,Me[Pe++<<1|1]=qe)}}return Ze(ye),{sourceCode:ke.join("").replace(/\n$/,""),spans:Me}}function H(ye,we,Le,ke,Fe){if(!Le)return;var Me={sourceNode:ye,pre:1,langExtension:null,numberLines:null,sourceCode:Le,spans:null,basePos:we,decorations:null};ke(Me),Fe.push.apply(Fe,Me.decorations)}var X=/\S/;function ee(ye){for(var we=void 0,Le=ye.firstChild;Le;Le=Le.nextSibling){var ke=Le.nodeType;we=ke===1?we?ye:Le:ke===3&&X.test(Le.nodeValue)?ye:we}return we===ye?void 0:we}function ie(ye,we){var Le={},ke;(function(){for(var Pe=ye.concat(we),Ze=[],qe={},Ge=0,He=Pe.length;Ge<He;++Ge){var $e=Pe[Ge],We=$e[3];if(We)for(var ze=We.length;--ze>=0;)Le[We.charAt(ze)]=$e;var Se=$e[1],Je=""+Se;qe.hasOwnProperty(Je)||(Ze.push(Se),qe[Je]=null)}Ze.push(/[\0-\uffff]/),ke=k(Ze)})();var Fe=we.length,Me=function(Pe){for(var Ze=Pe.sourceCode,qe=Pe.basePos,Ge=Pe.sourceNode,He=[qe,a],$e=0,We=Ze.match(ke)||[],ze={},Se=0,Je=We.length;Se<Je;++Se){var Qe=We[Se],Ae=ze[Qe],Ie=void 0,ge;if(typeof Ae=="string")ge=!1;else{var le=Le[Qe.charAt(0)];if(le)Ie=Qe.match(le[1]),Ae=le[0];else{for(var de=0;de<Fe;++de)if(le=we[de],Ie=Qe.match(le[1]),Ie){Ae=le[0];break}Ie||(Ae=a)}ge=Ae.length>=5&&Ae.substring(0,5)==="lang-",ge&&!(Ie&&typeof Ie[1]=="string")&&(ge=!1,Ae=p),ge||(ze[Qe]=Ae)}var Q=$e;if($e+=Qe.length,!ge)He.push(qe+Q,Ae);else{var Z=Ie[1],re=Qe.indexOf(Z),se=re+Z.length;Ie[2]&&(se=Qe.length-Ie[2].length,re=se-Z.length);var Te=Ae.substring(5);H(Ge,qe+Q,Qe.substring(0,re),Me,He),H(Ge,qe+Q+re,Z,me(Te,Z),He),H(Ge,qe+Q+se,Qe.substring(se),Me,He)}}Pe.decorations=He};return Me}function ve(ye){var we=[],Le=[];ye.tripleQuotedStrings?we.push([f,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):ye.multiLineStrings?we.push([f,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):we.push([f,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),ye.verbatimStrings&&Le.push([f,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var ke=ye.hashComments;ke&&(ye.cStyleComments?(ke>1?we.push([T,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):we.push([T,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Le.push([f,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):we.push([T,/^#[^\r\n]*/,null,"#"])),ye.cStyleComments&&(Le.push([T,/^\/\/[^\r\n]*/,null]),Le.push([T,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Fe=ye.regexLiterals;if(Fe){var Me=Fe>1?"":`
|
|
\r`,Pe=Me?".":"[\\S\\s]",Ze="/(?=[^/*"+Me+"])(?:[^/\\x5B\\x5C"+Me+"]|\\x5C"+Pe+"|\\x5B(?:[^\\x5C\\x5D"+Me+"]|\\x5C"+Pe+")*(?:\\x5D|$))+/";Le.push(["lang-regex",RegExp("^"+W+"("+Ze+")")])}var qe=ye.types;qe&&Le.push([m,qe]);var Ge=(""+ye.keywords).replace(/^ | $/g,"");Ge.length&&Le.push([L,new RegExp("^(?:"+Ge.replace(/[\s,]+/g,"|")+")\\b"),null]),we.push([a,/^\s+/,null,` \r
|
|
\xA0`]);var He="^.[^\\s\\w.$@'\"`/\\\\]*";return ye.regexLiterals&&(He+="(?!s*/)"),Le.push([c,/^@[a-z_$][a-z_$@0-9]*/i,null],[m,/^(?:[@_]?[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],[u,new RegExp(He),null]),ie(we,Le)}var pe=ve({keywords:S,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function he(ye,we,Le){for(var ke=/(?:^|\s)nocode(?:\s|$)/,Fe=/\r\n?|\n/,Me=ye.ownerDocument,Pe=Me.createElement("li");ye.firstChild;)Pe.appendChild(ye.firstChild);var Ze=[Pe];function qe(Se){var Je=Se.nodeType;if(Je==1&&!ke.test(Se.className))if(Se.nodeName==="br")Ge(Se),Se.parentNode&&Se.parentNode.removeChild(Se);else for(var Qe=Se.firstChild;Qe;Qe=Qe.nextSibling)qe(Qe);else if((Je==3||Je==4)&&Le){var Ae=Se.nodeValue,Ie=Ae.match(Fe);if(Ie){var ge=Ae.substring(0,Ie.index);Se.nodeValue=ge;var le=Ae.substring(Ie.index+Ie[0].length);if(le){var de=Se.parentNode;de.insertBefore(Me.createTextNode(le),Se.nextSibling)}Ge(Se),ge||Se.parentNode.removeChild(Se)}}}function Ge(Se){for(;!Se.nextSibling;)if(Se=Se.parentNode,!Se)return;function Je(Ie,ge){var le=ge?Ie.cloneNode(!1):Ie,de=Ie.parentNode;if(de){var Q=Je(de,1),Z=Ie.nextSibling;Q.appendChild(le);for(var re=Z;re;re=Z)Z=re.nextSibling,Q.appendChild(re)}return le}for(var Qe=Je(Se.nextSibling,0),Ae;(Ae=Qe.parentNode)&&Ae.nodeType===1;)Qe=Ae;Ze.push(Qe)}for(var He=0;He<Ze.length;++He)qe(Ze[He]);we===(we|0)&&Ze[0].setAttribute("value",we);var $e=Me.createElement("ol");$e.className="linenums";for(var We=Math.max(0,we-1|0)||0,He=0,ze=Ze.length;He<ze;++He)Pe=Ze[He],Pe.className="L"+(He+We)%10,Pe.firstChild||Pe.appendChild(Me.createTextNode("\xA0")),$e.appendChild(Pe);ye.appendChild($e)}function ce(ye){var we=/\bMSIE\s(\d+)/.exec(navigator.userAgent);we=we&&+we[1]<=8;var Le=/\n/g,ke=ye.sourceCode,Fe=ke.length,Me=0,Pe=ye.spans,Ze=Pe.length,qe=0,Ge=ye.decorations,He=Ge.length,$e=0;Ge[He]=Fe;var We,ze;for(ze=We=0;ze<He;)Ge[ze]!==Ge[ze+2]?(Ge[We++]=Ge[ze++],Ge[We++]=Ge[ze++]):ze+=2;for(He=We,ze=We=0;ze<He;){for(var Se=Ge[ze],Je=Ge[ze+1],Qe=ze+2;Qe+2<=He&&Ge[Qe+1]===Je;)Qe+=2;Ge[We++]=Se,Ge[We++]=Je,ze=Qe}He=Ge.length=We;var Ae=ye.sourceNode,Ie="";Ae&&(Ie=Ae.style.display,Ae.style.display="none");try{for(var ge=null;qe<Ze;){var le=Pe[qe],de=Pe[qe+2]||Fe,Q=Ge[$e+2]||Fe,Qe=Math.min(de,Q),Z=Pe[qe+1],re;if(Z.nodeType!==1&&(re=ke.substring(Me,Qe))){we&&(re=re.replace(Le,"\r")),Z.nodeValue=re;var se=Z.ownerDocument,Te=se.createElement("span");Te.className=Ge[$e+1];var De=Z.parentNode;De.replaceChild(Te,Z),Te.appendChild(Z),Me<de&&(Pe[qe+1]=Z=se.createTextNode(ke.substring(Qe,de)),De.insertBefore(Z,Te.nextSibling))}Me=Qe,Me>=de&&(qe+=2),Me>=Q&&($e+=2)}}finally{Ae&&(Ae.style.display=Ie)}}var fe={};function ne(ye,we){for(var Le=we.length;--Le>=0;){var ke=we[Le];fe.hasOwnProperty(ke)?I.console&&console.warn("cannot override language handler %s",ke):fe[ke]=ye}}function me(ye,we){return ye&&fe.hasOwnProperty(ye)||(ye=/^\s*</.test(we)?"default-markup":"default-code"),fe[ye]}ne(pe,["default-code"]),ne(ie([],[[a,/^[^<?]+/],[g,/^<!\w[^>]*(?:>|$)/],[T,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[u,/^(?:<[%?]|[%?]>)/],["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"]),ne(ie([[a,/^[\s]+/,null,` \r
|
|
`],[U,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[E,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[_,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[u,/^[=<>\/]+/],["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"]),ne(ie([],[[U,/^[\s\S]+/]]),["uq.val"]),ne(ve({keywords:y,hashComments:!0,cStyleComments:!0,types:b}),["c","cc","cpp","cxx","cyc","m"]),ne(ve({keywords:"null,true,false"}),["json"]),ne(ve({keywords:w,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:b}),["cs"]),ne(ve({keywords:P,cStyleComments:!0}),["java"]),ne(ve({keywords:s,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),ne(ve({keywords:o,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),ne(ve({keywords:d,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),ne(ve({keywords:l,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),ne(ve({keywords:v,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),ne(ve({keywords:x,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),ne(ie([],[[f,/^[\s\S]+/]]),["regex"]);function $(ye){var we=ye.langExtension;try{var Le=M(ye.sourceNode,ye.pre),ke=Le.sourceCode;ye.sourceCode=ke,ye.spans=Le.spans,ye.basePos=0,me(we,ke)(ye),ce(ye)}catch(Fe){I.console&&console.log(Fe&&Fe.stack||Fe)}}function ae(ye,we,Le){var ke=Le||!1,Fe=we||null,Me=document.createElement("div");Me.innerHTML="<pre>"+ye+"</pre>",Me=Me.firstChild,ke&&he(Me,ke,!0);var Pe={langExtension:Fe,numberLines:ke,sourceNode:Me,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return $(Pe),Me.innerHTML}function q(ye,we){var Le=we||document.body,ke=Le.ownerDocument||document;function Fe(le){return Le.getElementsByTagName(le)}for(var Me=[Fe("pre"),Fe("code"),Fe("xmp")],Pe=[],Ze=0;Ze<Me.length;++Ze)for(var qe=0,Ge=Me[Ze].length;qe<Ge;++qe)Pe.push(Me[Ze][qe]);Me=null;var He=Date;He.now||(He={now:function(){return+new Date}});var $e=0,We=/\blang(?:uage)?-([\w.]+)(?!\S)/,ze=/\bprettyprint\b/,Se=/\bprettyprinted\b/,Je=/pre|xmp/i,Qe=/^code$/i,Ae=/^(?:pre|code|xmp)$/i,Ie={};function ge(){for(var le=I.PR_SHOULD_USE_CONTINUATION?He.now()+250:Infinity;$e<Pe.length&&He.now()<le;$e++){for(var de=Pe[$e],Q=Ie,Z=de;Z=Z.previousSibling;){var re=Z.nodeType,se=(re===7||re===8)&&Z.nodeValue;if(se?!/^\??prettify\b/.test(se):re!==3||/\S/.test(Z.nodeValue))break;if(se){Q={},se.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Lt,pt,or){Q[pt]=or});break}}var Te=de.className;if((Q!==Ie||ze.test(Te))&&!Se.test(Te)){for(var De=!1,Oe=de.parentNode;Oe;Oe=Oe.parentNode){var Ke=Oe.tagName;if(Ae.test(Ke)&&Oe.className&&ze.test(Oe.className)){De=!0;break}}if(!De){de.className+=" prettyprinted";var it=Q.lang;if(!it){it=Te.match(We);var _e;!it&&(_e=ee(de))&&Qe.test(_e.tagName)&&(it=_e.className.match(We)),it&&(it=it[1])}var ct;if(Je.test(de.tagName))ct=1;else{var at=de.currentStyle,rt=ke.defaultView,xt=at?at.whiteSpace:rt&&rt.getComputedStyle?rt.getComputedStyle(de,null).getPropertyValue("white-space"):0;ct=xt&&xt.substring(0,3)==="pre"}var Et=Q.linenums;(Et=Et==="true"||+Et)||(Et=Te.match(/\blinenums\b(?::(\d+))?/),Et=Et?Et[1]&&Et[1].length?+Et[1]:!0:!1),Et&&he(de,Et,ct);var Rt={langExtension:it,sourceNode:de,numberLines:Et,pre:ct,sourceCode:null,basePos:null,spans:null,decorations:null};$(Rt)}}}$e<Pe.length?I.setTimeout(ge,250):typeof ye=="function"&&ye()}ge()}var Ee=I.PR={createSimpleLexer:ie,registerLangHandler:ne,sourceDecorator:ve,PR_ATTRIB_NAME:_,PR_ATTRIB_VALUE:U,PR_COMMENT:T,PR_DECLARATION:g,PR_KEYWORD:L,PR_LITERAL:c,PR_NOCODE:B,PR_PLAIN:a,PR_PUNCTUATION:u,PR_SOURCE:p,PR_STRING:f,PR_TAG:E,PR_TYPE:m,prettyPrintOne:D?I.prettyPrintOne=ae:O=ae,prettyPrint:N=D?I.prettyPrint=q:N=q},Ce=I.define;typeof Ce=="function"&&Ce.amd&&Ce("google-code-prettify",[],function(){return Ee})})()},"VrN/":function(tt,Ve,te){(function(J,z){tt.exports=z()})(this,function(){"use strict";var J=navigator.userAgent,z=navigator.platform,D=/gecko\/\d/i.test(J),K=/MSIE \d/.test(J),F=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(J),O=/Edge\/(\d+)/.exec(J),N=K||F||O,I=N&&(K?document.documentMode||6:+(O||F)[1]),R=!O&&/WebKit\//.test(J),C=R&&/Qt\/\d+\.\d+/.test(J),h=!O&&/Chrome\//.test(J),y=/Opera\//.test(J),P=/Apple Computer/.test(navigator.vendor),w=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(J),x=/PhantomJS/.test(J),v=!O&&/AppleWebKit/.test(J)&&/Mobile\/\w+/.test(J),d=/Android/.test(J),o=v||d||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(J),l=v||/Mac/.test(z),s=/\bCrOS\b/.test(J),S=/win/i.test(z),b=y&&J.match(/Version\/(\d*\.\d*)/);b&&(b=Number(b[1])),b&&b>=15&&(y=!1,R=!0);var f=l&&(C||y&&(b==null||b<12.11)),L=D||N&&I>=9;function T(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var m=function(e,t){var n=e.className,r=T(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 u(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 A=0;A<t.length;++A)i.appendChild(t[A]);return i}function E(e,t,n,r){var i=a(e,t,n,r);return i.setAttribute("role","presentation"),i}var g;document.createRange?g=function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:g=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 p(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 _(){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 U(e,t){var n=e.className;T(t).test(n)||(e.className+=(n?" ":"")+t)}function B(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!T(n[r]).test(t)&&(t+=" "+n[r]);return t}var W=function(e){e.select()};v?W=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:N&&(W=function(e){try{e.select()}catch(t){}});function k(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function M(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 A=r||0,j=i||0;;){var G=e.indexOf(" ",A);if(G<0||G>=t)return j+(t-A);j+=G-A,j+=n-j%n,A=G+1}}var X=function(){this.id=null,this.f=null,this.time=0,this.handler=k(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 ee(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}var ie=50,ve={toString:function(){return"CodeMirror.Pass"}},pe={scroll:!1},he={origin:"*mouse"},ce={origin:"+move"};function fe(e,t,n){for(var r=0,i=0;;){var A=e.indexOf(" ",r);A==-1&&(A=e.length);var j=A-r;if(A==e.length||i+j>=t)return r+Math.min(j,t-i);if(i+=A-r,i+=n-i%n,r=A+1,i>=t)return r}}var ne=[""];function me(e){for(;ne.length<=e;)ne.push($(ne)+" ");return ne[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 q(e,t,n){for(var r=0,i=n(t);r<e.length&&n(e[r])<=i;)r++;e.splice(r,0,t)}function Ee(){}function Ce(e,t){var n;return Object.create?n=Object.create(e):(Ee.prototype=e,n=new Ee),t&&M(t,n),n}var ye=/[\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()||ye.test(e))}function Le(e,t){return t?t.source.indexOf("\\w")>-1&&we(e)?!0:t.test(e):we(e)}function ke(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var Fe=/[\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 Me(e){return e.charCodeAt(0)>=768&&Fe.test(e)}function Pe(e,t,n){for(;(n<0?t>0:t<e.length)&&Me(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,A=r<0?Math.ceil(i):Math.floor(i);if(A==t)return e(A)?t:n;e(A)?n=A:t=A+r}}function qe(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var i=!1,A=0;A<e.length;++A){var j=e[A];(j.from<n&&j.to>t||t==n&&j.to==t)&&(r(Math.max(j.from,t),Math.min(j.to,n),j.level==1?"rtl":"ltr",A),i=!0)}i||r(t,n,"ltr")}var Ge=null;function He(e,t,n){var r;Ge=null;for(var i=0;i<e.length;++i){var A=e[i];if(A.from<t&&A.to>t)return i;A.to==t&&(A.from!=A.to&&n=="before"?r=i:Ge=i),A.from==t&&(A.from!=A.to&&n!="before"?r=i:Ge=i)}return r!=null?r:Ge}var $e=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]/,A=/[LRr]/,j=/[Lb1n]/,G=/[1n]/;function V(Y,oe,ue){this.level=Y,this.from=oe,this.to=ue}return function(Y,oe){var ue=oe=="ltr"?"L":"R";if(Y.length==0||oe=="ltr"&&!r.test(Y))return!1;for(var xe=Y.length,be=[],Re=0;Re<xe;++Re)be.push(n(Y.charCodeAt(Re)));for(var Ue=0,je=ue;Ue<xe;++Ue){var Xe=be[Ue];Xe=="m"?be[Ue]=je:je=Xe}for(var et=0,Ye=ue;et<xe;++et){var nt=be[et];nt=="1"&&Ye=="r"?be[et]="n":A.test(nt)&&(Ye=nt,nt=="r"&&(be[et]="R"))}for(var dt=1,lt=be[0];dt<xe-1;++dt){var gt=be[dt];gt=="+"&<=="1"&&be[dt+1]=="1"?be[dt]="1":gt==","&<==be[dt+1]&&(lt=="1"||lt=="n")&&(be[dt]=lt),lt=gt}for(var Ot=0;Ot<xe;++Ot){var Vt=be[Ot];if(Vt==",")be[Ot]="N";else if(Vt=="%"){var Mt=void 0;for(Mt=Ot+1;Mt<xe&&be[Mt]=="%";++Mt);for(var dr=Ot&&be[Ot-1]=="!"||Mt<xe&&be[Mt]=="1"?"1":"N",nr=Ot;nr<Mt;++nr)be[nr]=dr;Ot=Mt-1}}for(var Bt=0,ir=ue;Bt<xe;++Bt){var Yt=be[Bt];ir=="L"&&Yt=="1"?be[Bt]="L":A.test(Yt)&&(ir=Yt)}for(var Ht=0;Ht<xe;++Ht)if(i.test(be[Ht])){var jt=void 0;for(jt=Ht+1;jt<xe&&i.test(be[jt]);++jt);for(var Ut=(Ht?be[Ht-1]:ue)=="L",ar=(jt<xe?be[jt]:ue)=="L",Gn=Ut==ar?Ut?"L":"R":ue,Qr=Ht;Qr<jt;++Qr)be[Qr]=Gn;Ht=jt-1}for(var Jt=[],Dr,Xt=0;Xt<xe;)if(j.test(be[Xt])){var Xa=Xt;for(++Xt;Xt<xe&&j.test(be[Xt]);++Xt);Jt.push(new V(0,Xa,Xt))}else{var Ir=Xt,pn=Jt.length,gn=oe=="rtl"?1:0;for(++Xt;Xt<xe&&be[Xt]!="L";++Xt);for(var er=Ir;er<Xt;)if(G.test(be[er])){Ir<er&&(Jt.splice(pn,0,new V(1,Ir,er)),pn+=gn);var zn=er;for(++er;er<Xt&&G.test(be[er]);++er);Jt.splice(pn,0,new V(2,zn,er)),pn+=gn,Ir=er}else++er;Ir<Xt&&Jt.splice(pn,0,new V(1,Ir,Xt))}return oe=="ltr"&&(Jt[0].level==1&&(Dr=Y.match(/^\s+/))&&(Jt[0].from=Dr[0].length,Jt.unshift(new V(0,0,Dr[0].length))),$(Jt).level==1&&(Dr=Y.match(/\s+$/))&&($(Jt).to-=Dr[0].length,Jt.push(new V(0,xe-Dr[0].length,xe)))),oe=="rtl"?Jt.reverse():Jt}}();function We(e,t){var n=e.order;return n==null&&(n=e.order=$e(e.text,t)),n}var ze=[],Se=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]||ze).concat(n)}};function Je(e,t){return e._handlers&&e._handlers[t]||ze}function Qe(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 A=ee(i,n);A>-1&&(r[t]=i.slice(0,A).concat(i.slice(A+1)))}}}function Ae(e,t){var n=Je(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 Ie(e,t,n){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Ae(e,n||t.type,e,t),re(t)||t.codemirrorIgnore}function ge(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)ee(n,t[r])==-1&&n.push(t[r])}function le(e,t){return Je(e,t).length>0}function de(e){e.prototype.on=function(t,n){Se(this,t,n)},e.prototype.off=function(t,n){Qe(this,t,n)}}function Q(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Z(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function re(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function se(e){Q(e),Z(e)}function Te(e){return e.target||e.srcElement}function De(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),l&&e.ctrlKey&&t==1&&(t=3),t}var Oe=function(){if(N&&I<9)return!1;var e=a("div");return"draggable"in e||"dragDrop"in e}(),Ke;function it(e){if(Ke==null){var t=a("span","\u200B");u(e,a("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(Ke=t.offsetWidth<=1&&t.offsetHeight>2&&!(N&&I<8))}var n=Ke?a("span","\u200B"):a("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var _e;function ct(e){if(_e!=null)return _e;var t=u(e,document.createTextNode("A\u062EA")),n=g(t,0,1).getBoundingClientRect(),r=g(t,1,2).getBoundingClientRect();return c(e),!n||n.left==n.right?!1:_e=r.right-n.right<3}var at=`
|
|
|
|
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 A=e.slice(t,e.charAt(i-1)=="\r"?i-1:i),j=A.indexOf("\r");j!=-1?(n.push(A.slice(0,j)),t+=j+1):(n.push(A),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},rt=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},xt=function(){var e=a("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),Et=null;function Rt(e){if(Et!=null)return Et;var t=u(e,a("span","x")),n=t.getBoundingClientRect(),r=g(t,0,1).getBoundingClientRect();return Et=Math.abs(n.left-r.left)>1}var Lt={},pt={};function or(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Lt[e]=t}function Kt(e,t){pt[e]=t}function Nt(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=Ce(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Nt("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Nt("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function Tr(e,t){t=Nt(t);var n=Lt[t.name];if(!n)return Tr(e,"text/plain");var r=n(e,t);if(vr.hasOwnProperty(t.name)){var i=vr[t.name];for(var A in i){if(!i.hasOwnProperty(A))continue;r.hasOwnProperty(A)&&(r["_"+A]=r[A]),r[A]=i[A]}}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var j in t.modeProps)r[j]=t.modeProps[j];return r}var vr={};function wi(e,t){var n=vr.hasOwnProperty(e)?vr[e]:vr[e]={};M(t,n)}function mr(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 vn(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 Jr(e,t,n){return e.startState?e.startState(t,n):!0}var kt=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};kt.prototype.eol=function(){return this.pos>=this.string.length},kt.prototype.sol=function(){return this.pos==this.lineStart},kt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},kt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},kt.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},kt.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},kt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},kt.prototype.skipToEnd=function(){this.pos=this.string.length},kt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},kt.prototype.backUp=function(e){this.pos-=e},kt.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)},kt.prototype.indentation=function(){return H(this.string,null,this.tabSize)-(this.lineStart?H(this.string,this.lineStart,this.tabSize):0)},kt.prototype.match=function(e,t,n){if(typeof e=="string"){var r=function(j){return n?j.toLowerCase():j},i=this.string.substr(this.pos,e.length);if(r(i)==r(e))return t!==!1&&(this.pos+=e.length),!0}else{var A=this.string.slice(this.pos).match(e);return A&&A.index>0?null:(A&&t!==!1&&(this.pos+=A[0].length),A)}},kt.prototype.current=function(){return this.string.slice(this.start,this.pos)},kt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},kt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},kt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function st(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],A=i.chunkSize();if(t<A){n=i;break}t-=A}return n.lines[t]}function Sr(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,function(A){var j=A.text;i==n.line&&(j=j.slice(0,n.ch)),i==t.line&&(j=j.slice(t.ch)),r.push(j),++i}),r}function Vn(e,t,n){var r=[];return e.iter(t,n,function(i){r.push(i.text)}),r}function cr(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function St(e){if(e.parent==null)return null;for(var t=e.parent,n=ee(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 wr(e,t){var n=e.first;e:do{for(var r=0;r<e.children.length;++r){var i=e.children[r],A=i.height;if(t<A){e=i;continue e}t-=A,n+=i.chunkSize()}return n}while(!e.lines);for(var j=0;j<e.lines.length;++j){var G=e.lines[j],V=G.height;if(t<V)break;t-=V}return n+j}function Zr(e,t){return t>=e.first&&t<e.first+e.size}function yn(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function Ne(e,t,n){if(n===void 0&&(n=null),!(this instanceof Ne))return new Ne(e,t,n);this.line=e,this.ch=t,this.sticky=n}function ft(e,t){return e.line-t.line||e.ch-t.ch}function qr(e,t){return e.sticky==t.sticky&&ft(e,t)==0}function en(e){return Ne(e.line,e.ch)}function tn(e,t){return ft(e,t)<0?t:e}function bn(e,t){return ft(e,t)<0?e:t}function Xn(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function mt(e,t){if(t.line<e.first)return Ne(e.first,0);var n=e.first+e.size-1;return t.line>n?Ne(n,st(e,n).text.length):Ci(t,st(e,t.line).text.length)}function Ci(e,t){var n=e.ch;return n==null||n>t?Ne(e.line,t):n<0?Ne(e.line,0):e}function Ai(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=mt(e,t[r]);return n}var rn=function(e,t){this.state=e,this.lookAhead=t},sr=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};sr.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},sr.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}},sr.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},sr.fromSaved=function(e,t,n){return t instanceof rn?new sr(e,mr(e.mode,t.state),n,t.lookAhead):new sr(e,mr(e.mode,t),n)},sr.prototype.save=function(e){var t=e!==!1?mr(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new rn(t,this.maxLookAhead):t};function Li(e,t,n,r){var i=[e.state.modeGen],A={};Qn(e,t.text,e.doc.mode,n,function(Y,oe){return i.push(Y,oe)},A,r);for(var j=n.state,G=function(Y){n.baseTokens=i;var oe=e.state.overlays[Y],ue=1,xe=0;n.state=!0,Qn(e,t.text,oe.mode,n,function(be,Re){for(var Ue=ue;xe<be;){var je=i[ue];je>be&&i.splice(ue,1,be,i[ue+1],je),ue+=2,xe=Math.min(be,je)}if(!Re)return;if(oe.opaque)i.splice(Ue,ue-Ue,be,"overlay "+Re),ue=Ue+2;else for(;Ue<ue;Ue+=2){var Xe=i[Ue+1];i[Ue+1]=(Xe?Xe+" ":"")+"overlay "+Re}},A),n.state=j,n.baseTokens=null,n.baseTokenPos=1},V=0;V<e.state.overlays.length;++V)G(V);return{styles:i,classes:A.bgClass||A.textClass?A:null}}function Yn(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=Be(e,St(t)),i=t.text.length>e.options.maxHighlightLength&&mr(e.doc.mode,r.state),A=Li(e,t,r);i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=A.styles,A.classes?t.styleClasses=A.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 Be(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new sr(r,!0,t);var A=_r(e,t,n),j=A>r.first&&st(r,A-1).stateAfter,G=j?sr.fromSaved(r,j,A):new sr(r,Jr(r.mode),A);return r.iter(A,t,function(V){$n(e,V.text,G);var Y=G.line;V.stateAfter=Y==t-1||Y%5==0||Y>=i.viewFrom&&Y<i.viewTo?G.save():null,G.nextLine()}),n&&(r.modeFrontier=G.line),G}function $n(e,t,n,r){var i=e.doc.mode,A=new kt(t,e.options.tabSize,n);for(A.start=A.pos=r||0,t==""&&Di(i,n.state);!A.eol();)En(i,A,n.state),A.start=A.pos}function Di(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var n=vn(e,t);if(n.mode.blankLine)return n.mode.blankLine(n.state)}function En(e,t,n,r){for(var i=0;i<10;i++){r&&(r[0]=vn(e,n).mode);var A=e.token(t,n);if(t.pos>t.start)return A}throw new Error("Mode "+e.name+" failed to advance stream.")}var nn=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function Ur(e,t,n,r){var i=e.doc,A=i.mode,j;t=mt(i,t);var G=st(i,t.line),V=Be(e,t.line,n),Y=new kt(G.text,e.options.tabSize,V),oe;for(r&&(oe=[]);(r||Y.pos<t.ch)&&!Y.eol();)Y.start=Y.pos,j=En(A,Y,V.state),r&&oe.push(new nn(Y,j,mr(i.mode,V.state)));return r?oe:new nn(Y,j,V.state)}function _i(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 Qn(e,t,n,r,i,A,j){var G=n.flattenSpans;G==null&&(G=e.options.flattenSpans);var V=0,Y=null,oe=new kt(t,e.options.tabSize,r),ue,xe=e.options.addModeClass&&[null];for(t==""&&_i(Di(n,r.state),A);!oe.eol();){if(oe.pos>e.options.maxHighlightLength?(G=!1,j&&$n(e,t,r,oe.pos),oe.pos=t.length,ue=null):ue=_i(En(n,oe,r.state,xe),A),xe){var be=xe[0].name;be&&(ue="m-"+(ue?be+" "+ue:be))}if(!G||Y!=ue){for(;V<oe.start;)V=Math.min(oe.start,V+5e3),i(V,Y);Y=ue}oe.start=oe.pos}for(;V<oe.pos;){var Re=Math.min(oe.pos,V+5e3);i(Re,Y),V=Re}}function _r(e,t,n){for(var r,i,A=e.doc,j=n?-1:t-(e.doc.mode.innerMode?1e3:100),G=t;G>j;--G){if(G<=A.first)return A.first;var V=st(A,G-1),Y=V.stateAfter;if(Y&&(!n||G+(Y instanceof rn?Y.lookAhead:0)<=A.modeFrontier))return G;var oe=H(V.text,null,e.options.tabSize);(i==null||r>oe)&&(i=G-1,r=oe)}return i}function Oi(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=st(e,r).stateAfter;if(i&&(!(i instanceof rn)||r+i.lookAhead<t)){n=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}var Ri=!1,pr=!1;function Cr(){Ri=!0}function Pi(){pr=!0}function xn(e,t,n){this.marker=e,this.from=t,this.to=n}function Fr(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function Nr(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n||(n=[])).push(e[r]);return n}function Br(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function aa(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var A=e[i],j=A.marker,G=A.from==null||(j.inclusiveLeft?A.from<=t:A.from<t);if(G||A.from==t&&j.type=="bookmark"&&(!n||!A.marker.insertLeft)){var V=A.to==null||(j.inclusiveRight?A.to>=t:A.to>t);(r||(r=[])).push(new xn(j,A.from,V?null:A.to))}}return r}function ki(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var A=e[i],j=A.marker,G=A.to==null||(j.inclusiveRight?A.to>=t:A.to>t);if(G||A.from==t&&j.type=="bookmark"&&(!n||A.marker.insertLeft)){var V=A.from==null||(j.inclusiveLeft?A.from<=t:A.from<t);(r||(r=[])).push(new xn(j,V?null:A.from-t,A.to==null?null:A.to-t))}}return r}function Or(e,t){if(t.full)return null;var n=Zr(e,t.from.line)&&st(e,t.from.line).markedSpans,r=Zr(e,t.to.line)&&st(e,t.to.line).markedSpans;if(!n&&!r)return null;var i=t.from.ch,A=t.to.ch,j=ft(t.from,t.to)==0,G=aa(n,i,j),V=ki(r,A,j),Y=t.text.length==1,oe=$(t.text).length+(Y?i:0);if(G)for(var ue=0;ue<G.length;++ue){var xe=G[ue];if(xe.to==null){var be=Fr(V,xe.marker);be?Y&&(xe.to=be.to==null?null:be.to+oe):xe.to=i}}if(V)for(var Re=0;Re<V.length;++Re){var Ue=V[Re];if(Ue.to!=null&&(Ue.to+=oe),Ue.from==null){var je=Fr(G,Ue.marker);je||(Ue.from=oe,Y&&(G||(G=[])).push(Ue))}else Ue.from+=oe,Y&&(G||(G=[])).push(Ue)}G&&(G=Tn(G)),V&&V!=G&&(V=Tn(V));var Xe=[G];if(!Y){var et=t.text.length-2,Ye;if(et>0&&G)for(var nt=0;nt<G.length;++nt)G[nt].to==null&&(Ye||(Ye=[])).push(new xn(G[nt].marker,null,null));for(var dt=0;dt<et;++dt)Xe.push(Ye);Xe.push(V)}return Xe}function Tn(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 oa(e,t,n){var r=null;if(e.iter(t.line,n.line+1,function(be){if(be.markedSpans)for(var Re=0;Re<be.markedSpans.length;++Re){var Ue=be.markedSpans[Re].marker;Ue.readOnly&&(!r||ee(r,Ue)==-1)&&(r||(r=[])).push(Ue)}}),!r)return null;for(var i=[{from:t,to:n}],A=0;A<r.length;++A)for(var j=r[A],G=j.find(0),V=0;V<i.length;++V){var Y=i[V];if(ft(Y.to,G.from)<0||ft(Y.from,G.to)>0)continue;var oe=[V,1],ue=ft(Y.from,G.from),xe=ft(Y.to,G.to);(ue<0||!j.inclusiveLeft&&!ue)&&oe.push({from:Y.from,to:G.from}),(xe>0||!j.inclusiveRight&&!xe)&&oe.push({from:G.to,to:Y.to}),i.splice.apply(i,oe),V+=oe.length-3}return i}function Jn(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 Zn(e,t){if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}function an(e){return e.inclusiveLeft?-1:0}function Sn(e){return e.inclusiveRight?1:0}function wn(e,t){var n=e.lines.length-t.lines.length;if(n!=0)return n;var r=e.find(),i=t.find(),A=ft(r.from,i.from)||an(e)-an(t);if(A)return-A;var j=ft(r.to,i.to)||Sn(e)-Sn(t);return j||t.id-e.id}function sa(e,t){var n=pr&&e.markedSpans,r;if(n)for(var i=void 0,A=0;A<n.length;++A)i=n[A],i.marker.collapsed&&(t?i.from:i.to)==null&&(!r||wn(r,i.marker)<0)&&(r=i.marker);return r}function Cn(e){return sa(e,!0)}function on(e){return sa(e,!1)}function Mi(e,t){var n=pr&&e.markedSpans,r;if(n)for(var i=0;i<n.length;++i){var A=n[i];A.marker.collapsed&&(A.from==null||A.from<t)&&(A.to==null||A.to>t)&&(!r||wn(r,A.marker)<0)&&(r=A.marker)}return r}function qn(e,t,n,r,i){var A=st(e,t),j=pr&&A.markedSpans;if(j)for(var G=0;G<j.length;++G){var V=j[G];if(!V.marker.collapsed)continue;var Y=V.marker.find(0),oe=ft(Y.from,n)||an(V.marker)-an(i),ue=ft(Y.to,r)||Sn(V.marker)-Sn(i);if(oe>=0&&ue<=0||oe<=0&&ue>=0)continue;if(oe<=0&&(V.marker.inclusiveRight&&i.inclusiveLeft?ft(Y.to,n)>=0:ft(Y.to,n)>0)||oe>=0&&(V.marker.inclusiveRight&&i.inclusiveLeft?ft(Y.from,r)<=0:ft(Y.from,r)<0))return!0}}function $t(e){for(var t;t=Cn(e);)e=t.find(-1,!0).line;return e}function jr(e){for(var t;t=on(e);)e=t.find(1,!0).line;return e}function An(e){for(var t,n;t=on(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function Wr(e,t){var n=st(e,t),r=$t(n);return n==r?t:St(r)}function Ii(e,t){if(t>e.lastLine())return t;var n=st(e,t),r;if(!yr(e,n))return t;for(;r=on(n);)n=r.find(1,!0).line;return St(n)+1}function yr(e,t){var n=pr&&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&&Ln(e,t,r))return!0}}function Ln(e,t,n){if(n.to==null){var r=n.marker.find(1,!0);return Ln(e,r.line,Fr(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var i=void 0,A=0;A<t.markedSpans.length;++A)if(i=t.markedSpans[A],i.marker.collapsed&&!i.marker.widgetNode&&i.from==n.to&&(i.to==null||i.to!=n.from)&&(i.marker.inclusiveLeft||n.marker.inclusiveRight)&&Ln(e,t,i))return!0}function lr(e){e=$t(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 A=n.parent;A;n=A,A=n.parent)for(var j=0;j<A.children.length;++j){var G=A.children[j];if(G==n)break;t+=G.height}return t}function Dn(e){if(e.height==0)return 0;for(var t=e.text.length,n,r=e;n=Cn(r);){var i=n.find(0,!0);r=i.from.line,t+=i.from.ch-i.to.ch}for(r=e;n=on(r);){var A=n.find(0,!0);t-=r.text.length-A.from.ch,r=A.to.line,t+=r.text.length-A.to.ch}return t}function Rr(e){var t=e.display,n=e.doc;t.maxLine=st(n,n.first),t.maxLineLength=Dn(t.maxLine),t.maxLineChanged=!0,n.iter(function(r){var i=Dn(r);i>t.maxLineLength&&(t.maxLineLength=i,t.maxLine=r)})}var Hr=function(e,t,n){this.text=e,Zn(this,t),this.height=n?n(this):1};Hr.prototype.lineNo=function(){return St(this)},de(Hr);function la(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),Jn(e),Zn(e,n);var i=r?r(e):1;i!=e.height&&cr(e,i)}function ua(e){e.parent=null,Jn(e)}var $a={},Qa={};function da(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?Qa:$a;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Ui(e,t){var n=E("span",null,null,R?"padding-right: .1px":null),r={pre:E("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 A=i?t.rest[i-1]:t.line,j=void 0;r.pos=0,r.addToken=ht,ct(e.display.measure)&&(j=We(A,e.doc.direction))&&(r.addToken=vt(r.addToken,j)),r.map=[];var G=t!=e.display.externalMeasured&&St(A);_t(A,r,Yn(e,A,G)),A.styleClasses&&(A.styleClasses.bgClass&&(r.bgClass=B(A.styleClasses.bgClass,r.bgClass||"")),A.styleClasses.textClass&&(r.textClass=B(A.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(it(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(R){var V=r.content.lastChild;(/\bcm-tab\b/.test(V.className)||V.querySelector&&V.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return Ae(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=B(r.pre.className,r.textClass||"")),r}function ot(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 ht(e,t,n,r,i,A,j){if(!t)return;var G=e.splitSpaces?ut(t,e.trailingSpace):t,V=e.cm.state.specialChars,Y=!1,oe;if(!V.test(t))e.col+=t.length,oe=document.createTextNode(G),e.map.push(e.pos,e.pos+t.length,oe),N&&I<9&&(Y=!0),e.pos+=t.length;else{oe=document.createDocumentFragment();for(var ue=0;;){V.lastIndex=ue;var xe=V.exec(t),be=xe?xe.index-ue:t.length-ue;if(be){var Re=document.createTextNode(G.slice(ue,ue+be));N&&I<9?oe.appendChild(a("span",[Re])):oe.appendChild(Re),e.map.push(e.pos,e.pos+be,Re),e.col+=be,e.pos+=be}if(!xe)break;ue+=be+1;var Ue=void 0;if(xe[0]==" "){var je=e.cm.options.tabSize,Xe=je-e.col%je;Ue=oe.appendChild(a("span",me(Xe),"cm-tab")),Ue.setAttribute("role","presentation"),Ue.setAttribute("cm-text"," "),e.col+=Xe}else xe[0]=="\r"||xe[0]==`
|
|
`?(Ue=oe.appendChild(a("span",xe[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Ue.setAttribute("cm-text",xe[0]),e.col+=1):(Ue=e.cm.options.specialCharPlaceholder(xe[0]),Ue.setAttribute("cm-text",xe[0]),N&&I<9?oe.appendChild(a("span",[Ue])):oe.appendChild(Ue),e.col+=1);e.map.push(e.pos,e.pos+1,Ue),e.pos++}}if(e.trailingSpace=G.charCodeAt(t.length-1)==32,n||r||i||Y||A||j){var et=n||"";r&&(et+=r),i&&(et+=i);var Ye=a("span",[oe],et,A);if(j)for(var nt in j)j.hasOwnProperty(nt)&&nt!="style"&&nt!="class"&&Ye.setAttribute(nt,j[nt]);return e.content.appendChild(Ye)}e.content.appendChild(oe)}function ut(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",i=0;i<e.length;i++){var A=e.charAt(i);A==" "&&n&&(i==e.length-1||e.charCodeAt(i+1)==32)&&(A="\xA0"),r+=A,n=A==" "}return r}function vt(e,t){return function(n,r,i,A,j,G,V){i=i?i+" cm-force-border":"cm-force-border";for(var Y=n.pos,oe=Y+r.length;;){for(var ue=void 0,xe=0;xe<t.length&&!(ue=t[xe],ue.to>Y&&ue.from<=Y);xe++);if(ue.to>=oe)return e(n,r,i,A,j,G,V);e(n,r.slice(0,ue.to-Y),i,A,null,G,V),A=null,r=r.slice(ue.to-Y),Y=ue.to}}}function Tt(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 _t(e,t,n){var r=e.markedSpans,i=e.text,A=0;if(!r){for(var j=1;j<n.length;j+=2)t.addToken(t,i.slice(A,A=n[j]),da(n[j+1],t.cm.options));return}for(var G=i.length,V=0,Y=1,oe="",ue,xe,be=0,Re,Ue,je,Xe,et;;){if(be==V){Re=Ue=je=xe="",et=null,Xe=null,be=Infinity;for(var Ye=[],nt=void 0,dt=0;dt<r.length;++dt){var lt=r[dt],gt=lt.marker;if(gt.type=="bookmark"&<.from==V&>.widgetNode)Ye.push(gt);else if(lt.from<=V&&(lt.to==null||lt.to>V||gt.collapsed&<.to==V&<.from==V)){if(lt.to!=null&<.to!=V&&be>lt.to&&(be=lt.to,Ue=""),gt.className&&(Re+=" "+gt.className),gt.css&&(xe=(xe?xe+";":"")+gt.css),gt.startStyle&<.from==V&&(je+=" "+gt.startStyle),gt.endStyle&<.to==be&&(nt||(nt=[])).push(gt.endStyle,lt.to),gt.title&&((et||(et={})).title=gt.title),gt.attributes)for(var Ot in gt.attributes)(et||(et={}))[Ot]=gt.attributes[Ot];gt.collapsed&&(!Xe||wn(Xe.marker,gt)<0)&&(Xe=lt)}else lt.from>V&&be>lt.from&&(be=lt.from)}if(nt)for(var Vt=0;Vt<nt.length;Vt+=2)nt[Vt+1]==be&&(Ue+=" "+nt[Vt]);if(!Xe||Xe.from==V)for(var Mt=0;Mt<Ye.length;++Mt)Tt(t,0,Ye[Mt]);if(Xe&&(Xe.from||0)==V){if(Tt(t,(Xe.to==null?G+1:Xe.to)-V,Xe.marker,Xe.from==null),Xe.to==null)return;Xe.to==V&&(Xe=!1)}}if(V>=G)break;for(var dr=Math.min(G,be);;){if(oe){var nr=V+oe.length;if(!Xe){var Bt=nr>dr?oe.slice(0,dr-V):oe;t.addToken(t,Bt,ue?ue+Re:Re,je,V+Bt.length==be?Ue:"",xe,et)}if(nr>=dr){oe=oe.slice(dr-V),V=dr;break}V=nr,je=""}oe=i.slice(A,A=n[Y++]),ue=da(n[Y++],t.cm.options)}}}function yt(e,t,n){this.line=t,this.rest=An(t),this.size=this.rest?St($(this.rest))-n+1:1,this.node=this.text=null,this.hidden=yr(e,t)}function It(e,t,n){for(var r=[],i,A=t;A<n;A=i){var j=new yt(e.doc,st(e.doc,A),A);i=A+j.size,r.push(j)}return r}var Wt=null;function bt(e){Wt?Wt.ops.push(e):e.ownsGroup=Wt={ops:[e],delayedCallbacks:[]}}function Pr(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 Ct(e,t){var n=e.ownsGroup;if(!n)return;try{Pr(n)}finally{Wt=null,t(n)}}var Zt=null;function Dt(e,t){var n=Je(e,t);if(!n.length)return;var r=Array.prototype.slice.call(arguments,2),i;Wt?i=Wt.delayedCallbacks:Zt?i=Zt:(i=Zt=[],setTimeout(gr,0));for(var A=function(G){i.push(function(){return n[G].apply(null,r)})},j=0;j<n.length;++j)A(j)}function gr(){var e=Zt;Zt=null;for(var t=0;t<e.length;++t)e[t]()}function Ja(e,t,n,r){for(var i=0;i<t.changes.length;i++){var A=t.changes[i];A=="text"?Ms(e,t):A=="gutter"?qa(e,t,n,r):A=="class"?ca(e,t):A=="widget"&&Is(e,t,r)}t.changes=null}function ei(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),N&&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=ei(t);t.background=r.insertBefore(a("div",null,n),r.firstChild),e.display.input.setUneditable(t.background)}}function Za(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):Ui(e,t)}function Ms(e,t){var n=t.text.className,r=Za(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,ca(e,t)):n&&(t.text.className=n)}function ca(e,t){ks(e,t),t.line.wrapClass?ei(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 qa(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=ei(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 A=t.line.gutterMarkers;if(e.options.lineNumbers||A){var j=ei(t),G=t.gutter=a("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(G),j.insertBefore(G,t.text),t.line.gutterClass&&(G.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!A||!A["CodeMirror-linenumbers"])&&(t.lineNumber=G.appendChild(a("div",yn(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),A)for(var V=0;V<e.display.gutterSpecs.length;++V){var Y=e.display.gutterSpecs[V].className,oe=A.hasOwnProperty(Y)&&A[Y];oe&&G.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=T("CodeMirror-linewidget"),i=t.node.firstChild,A=void 0;i;i=A)A=i.nextSibling,r.test(i.className)&&t.node.removeChild(i);eo(e,t,n)}function Us(e,t,n,r){var i=Za(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),ca(e,t),qa(e,t,n,r),eo(e,t,r),t.node}function eo(e,t,n){if(to(e,t.line,t,n,!0),t.rest)for(var r=0;r<t.rest.length;r++)to(e,t.rest[r],t,n,!1)}function to(e,t,n,r,i){if(!t.widgets)return;for(var A=ei(n),j=0,G=t.widgets;j<G.length;++j){var V=G[j],Y=a("div",[V.node],"CodeMirror-linewidget"+(V.className?" "+V.className:""));V.handleMouseEvents||Y.setAttribute("cm-ignore-events","true"),Fs(V,Y,n,r),e.display.input.setUneditable(Y),i&&V.above?A.insertBefore(Y,n.gutter||n.text):A.appendChild(Y),Dt(V,"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 ti(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!p(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;"),u(t.display.measure,a("div",[e.node],null,n))}return e.height=e.node.parentNode.offsetHeight}function kr(e,t){for(var n=Te(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 Fi(e){return e.lineSpace.offsetTop}function fa(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function ro(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=u(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 Ar(e){return ie-e.display.nativeBarWidth}function sn(e){return e.display.scroller.clientWidth-Ar(e)-e.display.barWidth}function ha(e){return e.display.scroller.clientHeight-Ar(e)-e.display.barHeight}function Ns(e,t,n){var r=e.options.lineWrapping,i=r&&sn(e);if(!t.measure.heights||r&&t.measure.width!=i){var A=t.measure.heights=[];if(r){t.measure.width=i;for(var j=t.text.firstChild.getClientRects(),G=0;G<j.length-1;G++){var V=j[G],Y=j[G+1];Math.abs(V.bottom-Y.bottom)>2&&A.push((V.bottom+Y.top)/2-n.top)}}A.push(n.bottom-n.top)}}function no(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(St(e.rest[i])>n)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Bs(e,t){t=$t(t);var n=St(t),r=e.display.externalMeasured=new yt(e.doc,t,n);r.lineN=n;var i=r.built=Ui(e,r);return r.text=i.pre,u(e.display.lineMeasure,i.pre),r}function io(e,t,n,r){return Lr(e,_n(e,t),n,r)}function ma(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[dn(e,t)];var n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size)return n}function _n(e,t){var n=St(t),r=ma(e,n);r&&!r.text?r=null:r&&r.changes&&(Ja(e,r,n,Ea(e)),e.curOp.forceUpdate=!0),r||(r=Bs(e,t));var i=no(r,t,n);return{line:t,view:r,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function Lr(e,t,n,r,i){t.before&&(n=-1);var A=n+(r||""),j;return t.cache.hasOwnProperty(A)?j=t.cache[A]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Ns(e,t.view,t.rect),t.hasHeights=!0),j=Ws(e,t,n,r),j.bogus||(t.cache[A]=j)),{left:j.left,right:j.right,top:i?j.rtop:j.top,bottom:i?j.rbottom:j.bottom}}var ao={left:0,right:0,top:0,bottom:0};function oo(e,t,n){for(var r,i,A,j,G,V,Y=0;Y<e.length;Y+=3)if(G=e[Y],V=e[Y+1],t<G?(i=0,A=1,j="left"):t<V?(i=t-G,A=i+1):(Y==e.length-3||t==V&&e[Y+3]>t)&&(A=V-G,i=A-1,t>=V&&(j="right")),i!=null){if(r=e[Y+2],G==V&&n==(r.insertLeft?"left":"right")&&(j=n),n=="left"&&i==0)for(;Y&&e[Y-2]==e[Y-3]&&e[Y-1].insertLeft;)r=e[(Y-=3)+2],j="left";if(n=="right"&&i==V-G)for(;Y<e.length-3&&e[Y+3]==e[Y+4]&&!e[Y+5].insertLeft;)r=e[(Y+=3)+2],j="right";break}return{node:r,start:i,end:A,collapse:j,coverStart:G,coverEnd:V}}function js(e,t){var n=ao;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=oo(t.map,n,r),A=i.node,j=i.start,G=i.end,V=i.collapse,Y;if(A.nodeType==3){for(var oe=0;oe<4;oe++){for(;j&&Me(t.line.text.charAt(i.coverStart+j));)--j;for(;i.coverStart+G<i.coverEnd&&Me(t.line.text.charAt(i.coverStart+G));)++G;if(N&&I<9&&j==0&&G==i.coverEnd-i.coverStart?Y=A.parentNode.getBoundingClientRect():Y=js(g(A,j,G).getClientRects(),r),Y.left||Y.right||j==0)break;G=j,j=j-1,V="right"}N&&I<11&&(Y=Hs(e.display.measure,Y))}else{j>0&&(V=r="right");var ue;e.options.lineWrapping&&(ue=A.getClientRects()).length>1?Y=ue[r=="right"?ue.length-1:0]:Y=A.getBoundingClientRect()}if(N&&I<9&&!j&&(!Y||!Y.left&&!Y.right)){var xe=A.parentNode.getClientRects()[0];xe?Y={left:xe.left,right:xe.left+Rn(e.display),top:xe.top,bottom:xe.bottom}:Y=ao}for(var be=Y.top-t.rect.top,Re=Y.bottom-t.rect.top,Ue=(be+Re)/2,je=t.view.measure.heights,Xe=0;Xe<je.length-1&&!(Ue<je[Xe]);Xe++);var et=Xe?je[Xe-1]:0,Ye=je[Xe],nt={left:(V=="right"?Y.right:Y.left)-t.rect.left,right:(V=="left"?Y.left:Y.right)-t.rect.left,top:et,bottom:Ye};return!Y.left&&!Y.right&&(nt.bogus=!0),e.options.singleCursorHeightPerLine||(nt.rtop=be,nt.rbottom=Re),nt}function Hs(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!Rt(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 so(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 lo(e){e.display.externalMeasure=null,c(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)so(e.display.view[t])}function ri(e){lo(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function uo(){return h&&d?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function co(){return h&&d?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function pa(e){var t=0;if(e.widgets)for(var n=0;n<e.widgets.length;++n)e.widgets[n].above&&(t+=ti(e.widgets[n]));return t}function Ni(e,t,n,r,i){if(!i){var A=pa(t);n.top+=A,n.bottom+=A}if(r=="line")return n;r||(r="local");var j=lr(t);if(r=="local"?j+=Fi(e.display):j-=e.display.viewOffset,r=="page"||r=="window"){var G=e.display.lineSpace.getBoundingClientRect();j+=G.top+(r=="window"?0:co());var V=G.left+(r=="window"?0:uo());n.left+=V,n.right+=V}return n.top+=j,n.bottom+=j,n}function fo(e,t,n){if(n=="div")return t;var r=t.left,i=t.top;if(n=="page")r-=uo(),i-=co();else if(n=="local"||!n){var A=e.display.sizer.getBoundingClientRect();r+=A.left,i+=A.top}var j=e.display.lineSpace.getBoundingClientRect();return{left:r-j.left,top:i-j.top}}function ga(e,t,n,r,i){return r||(r=st(e.doc,t.line)),Ni(e,r,io(e,r,t.ch,i),n)}function br(e,t,n,r,i,A){r=r||st(e.doc,t.line),i||(i=_n(e,r));function j(Re,Ue){var je=Lr(e,i,Re,Ue?"right":"left",A);return Ue?je.left=je.right:je.right=je.left,Ni(e,r,je,n)}var G=We(r,e.doc.direction),V=t.ch,Y=t.sticky;if(V>=r.text.length?(V=r.text.length,Y="before"):V<=0&&(V=0,Y="after"),!G)return j(Y=="before"?V-1:V,Y=="before");function oe(Re,Ue,je){var Xe=G[Ue],et=Xe.level==1;return j(je?Re-1:Re,et!=je)}var ue=He(G,V,Y),xe=Ge,be=oe(V,ue,Y=="before");return xe!=null&&(be.other=oe(V,xe,Y!="before")),be}function ho(e,t){var n=0;t=mt(e.doc,t),e.options.lineWrapping||(n=Rn(e.display)*t.ch);var r=st(e.doc,t.line),i=lr(r)+Fi(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function va(e,t,n,r,i){var A=Ne(e,t,n);return A.xRel=i,r&&(A.outside=r),A}function ya(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return va(r.first,0,null,-1,-1);var i=wr(r,n),A=r.first+r.size-1;if(i>A)return va(r.first+r.size-1,st(r,A).text.length,null,1,1);t<0&&(t=0);for(var j=st(r,i);;){var G=Ks(e,j,i,t,n),V=Mi(j,G.ch+(G.xRel>0||G.outside>0?1:0));if(!V)return G;var Y=V.find(1);if(Y.line==i)return Y;j=st(r,i=Y.line)}}function mo(e,t,n,r){r-=pa(t);var i=t.text.length,A=Ze(function(j){return Lr(e,n,j-1).bottom<=r},i,0);return i=Ze(function(j){return Lr(e,n,j).top>r},A,i),{begin:A,end:i}}function po(e,t,n,r){n||(n=_n(e,t));var i=Ni(e,t,Lr(e,n,r),"line").top;return mo(e,t,n,i)}function ba(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-=lr(t);var A=_n(e,t),j=pa(t),G=0,V=t.text.length,Y=!0,oe=We(t,e.doc.direction);if(oe){var ue=(e.options.lineWrapping?zs:Gs)(e,t,n,A,oe,r,i);Y=ue.level!=1,G=Y?ue.from:ue.to-1,V=Y?ue.to:ue.from-1}var xe=null,be=null,Re=Ze(function(dt){var lt=Lr(e,A,dt);return lt.top+=j,lt.bottom+=j,ba(lt,r,i,!1)?(lt.top<=i&<.left<=r&&(xe=dt,be=lt),!0):!1},G,V),Ue,je,Xe=!1;if(be){var et=r-be.left<be.right-r,Ye=et==Y;Re=xe+(Ye?0:1),je=Ye?"after":"before",Ue=et?be.left:be.right}else{!Y&&(Re==V||Re==G)&&Re++,je=Re==0?"after":Re==t.text.length?"before":Lr(e,A,Re-(Y?1:0)).bottom+j<=i==Y?"after":"before";var nt=br(e,Ne(n,Re,je),"line",t,A);Ue=nt.left,Xe=i<nt.top?-1:i>=nt.bottom?1:0}return Re=Pe(t.text,Re,1),va(n,Re,je,Xe,r-Ue)}function Gs(e,t,n,r,i,A,j){var G=Ze(function(ue){var xe=i[ue],be=xe.level!=1;return ba(br(e,Ne(n,be?xe.to:xe.from,be?"before":"after"),"line",t,r),A,j,!0)},0,i.length-1),V=i[G];if(G>0){var Y=V.level!=1,oe=br(e,Ne(n,Y?V.from:V.to,Y?"after":"before"),"line",t,r);ba(oe,A,j,!0)&&oe.top>j&&(V=i[G-1])}return V}function zs(e,t,n,r,i,A,j){var G=mo(e,t,r,j),V=G.begin,Y=G.end;/\s/.test(t.text.charAt(Y-1))&&Y--;for(var oe=null,ue=null,xe=0;xe<i.length;xe++){var be=i[xe];if(be.from>=Y||be.to<=V)continue;var Re=be.level!=1,Ue=Lr(e,r,Re?Math.min(Y,be.to)-1:Math.max(V,be.from)).right,je=Ue<A?A-Ue+1e9:Ue-A;(!oe||ue>je)&&(oe=be,ue=je)}return oe||(oe=i[i.length-1]),oe.from<V&&(oe={from:V,to:oe.to,level:oe.level}),oe.to>Y&&(oe={from:oe.from,to:Y,level:oe.level}),oe}var ln;function On(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(ln==null){ln=a("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)ln.appendChild(document.createTextNode("x")),ln.appendChild(a("br"));ln.appendChild(document.createTextNode("x"))}u(e.measure,ln);var n=ln.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),c(e.measure),n||1}function Rn(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=a("span","xxxxxxxxxx"),n=a("pre",[t],"CodeMirror-line-like");u(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function Ea(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,A=t.gutters.firstChild,j=0;A;A=A.nextSibling,++j){var G=e.display.gutterSpecs[j].className;n[G]=A.offsetLeft+A.clientLeft+i,r[G]=A.clientWidth}return{fixedPos:xa(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function xa(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function go(e){var t=On(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/Rn(e.display)-3);return function(i){if(yr(e.doc,i))return 0;var A=0;if(i.widgets)for(var j=0;j<i.widgets.length;j++)i.widgets[j].height&&(A+=i.widgets[j].height);return n?A+(Math.ceil(i.text.length/r)||1)*t:A+t}}function Ta(e){var t=e.doc,n=go(e);t.iter(function(r){var i=n(r);i!=r.height&&cr(r,i)})}function un(e,t,n,r){var i=e.display;if(!n&&Te(t).getAttribute("cm-not-content")=="true")return null;var A,j,G=i.lineSpace.getBoundingClientRect();try{A=t.clientX-G.left,j=t.clientY-G.top}catch(ue){return null}var V=ya(e,A,j),Y;if(r&&V.xRel>0&&(Y=st(e.doc,V.line).text).length==V.ch){var oe=H(Y,Y.length,e.options.tabSize)-Y.length;V=Ne(V.line,Math.max(0,Math.round((A-ro(e.display).left)/Rn(e.display))-oe))}return V}function dn(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 tr(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)pr&&Wr(e.doc,t)<i.viewTo&&Gr(e);else if(n<=i.viewFrom)pr&&Ii(e.doc,n+r)>i.viewFrom?Gr(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)Gr(e);else if(t<=i.viewFrom){var A=Bi(e,n,n+r,1);A?(i.view=i.view.slice(A.index),i.viewFrom=A.lineN,i.viewTo+=r):Gr(e)}else if(n>=i.viewTo){var j=Bi(e,t,t,-1);j?(i.view=i.view.slice(0,j.index),i.viewTo=j.lineN):Gr(e)}else{var G=Bi(e,t,t,-1),V=Bi(e,n,n+r,1);G&&V?(i.view=i.view.slice(0,G.index).concat(It(e,G.lineN,V.lineN)).concat(i.view.slice(V.index)),i.viewTo+=r):Gr(e)}var Y=i.externalMeasured;Y&&(n<Y.lineN?Y.lineN+=r:t<Y.lineN+Y.size&&(i.externalMeasured=null))}function Kr(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 A=r.view[dn(e,t)];if(A.node==null)return;var j=A.changes||(A.changes=[]);ee(j,n)==-1&&j.push(n)}function Gr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Bi(e,t,n,r){var i=dn(e,t),A,j=e.display.view;if(!pr||n==e.doc.first+e.doc.size)return{index:i,lineN:n};for(var G=e.display.viewFrom,V=0;V<i;V++)G+=j[V].size;if(G!=t){if(r>0){if(i==j.length-1)return null;A=G+j[i].size-t,i++}else A=G-t;t+=A,n+=A}for(;Wr(e.doc,n)!=n;){if(i==(r<0?0:j.length-1))return null;n+=r*j[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=It(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=It(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(dn(e,t))),r.viewFrom=t,r.viewTo<n?r.view=r.view.concat(It(e,r.viewTo,n)):r.viewTo>n&&(r.view=r.view.slice(0,dn(e,n)))),r.viewTo=n}function vo(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 ni(e){e.display.input.showSelection(e.display.input.prepareSelection())}function yo(e,t){t===void 0&&(t=!0);for(var n=e.doc,r={},i=r.cursors=document.createDocumentFragment(),A=r.selection=document.createDocumentFragment(),j=0;j<n.sel.ranges.length;j++){if(!t&&j==n.sel.primIndex)continue;var G=n.sel.ranges[j];if(G.from().line>=e.display.viewTo||G.to().line<e.display.viewFrom)continue;var V=G.empty();(V||e.options.showCursorWhenSelecting)&&bo(e,G.head,i),V||Xs(e,G,A)}return r}function bo(e,t,n){var r=br(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 A=n.appendChild(a("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));A.style.display="",A.style.left=r.other.left+"px",A.style.top=r.other.top+"px",A.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function ji(e,t){return e.top-t.top||e.left-t.left}function Xs(e,t,n){var r=e.display,i=e.doc,A=document.createDocumentFragment(),j=ro(e.display),G=j.left,V=Math.max(r.sizerWidth,sn(e)-r.sizer.offsetLeft)-j.right,Y=i.direction=="ltr";function oe(Ye,nt,dt,lt){nt<0&&(nt=0),nt=Math.round(nt),lt=Math.round(lt),A.appendChild(a("div",null,"CodeMirror-selected","position: absolute; left: "+Ye+`px;
|
|
top: `+nt+"px; width: "+(dt==null?V-Ye:dt)+`px;
|
|
height: `+(lt-nt)+"px"))}function ue(Ye,nt,dt){var lt=st(i,Ye),gt=lt.text.length,Ot,Vt;function Mt(Bt,ir){return ga(e,Ne(Ye,Bt),"div",lt,ir)}function dr(Bt,ir,Yt){var Ht=po(e,lt,null,Bt),jt=ir=="ltr"==(Yt=="after")?"left":"right",Ut=Yt=="after"?Ht.begin:Ht.end-(/\s/.test(lt.text.charAt(Ht.end-1))?2:1);return Mt(Ut,jt)[jt]}var nr=We(lt,i.direction);return qe(nr,nt||0,dt==null?gt:dt,function(Bt,ir,Yt,Ht){var jt=Yt=="ltr",Ut=Mt(Bt,jt?"left":"right"),ar=Mt(ir-1,jt?"right":"left"),Gn=nt==null&&Bt==0,Qr=dt==null&&ir==gt,Jt=Ht==0,Dr=!nr||Ht==nr.length-1;if(ar.top-Ut.top<=3){var Xt=(Y?Gn:Qr)&&Jt,Xa=(Y?Qr:Gn)&&Dr,Ir=Xt?G:(jt?Ut:ar).left,pn=Xa?V:(jt?ar:Ut).right;oe(Ir,Ut.top,pn-Ir,Ut.bottom)}else{var gn,er,zn,Ya;jt?(gn=Y&&Gn&&Jt?G:Ut.left,er=Y?V:dr(Bt,Yt,"before"),zn=Y?G:dr(ir,Yt,"after"),Ya=Y&&Qr&&Dr?V:ar.right):(gn=Y?dr(Bt,Yt,"before"):G,er=!Y&&Gn&&Jt?V:Ut.right,zn=!Y&&Qr&&Dr?G:ar.left,Ya=Y?dr(ir,Yt,"after"):V),oe(gn,Ut.top,er-gn,Ut.bottom),Ut.bottom<ar.top&&oe(G,Ut.bottom,null,ar.top),oe(zn,ar.top,Ya-zn,ar.bottom)}(!Ot||ji(Ut,Ot)<0)&&(Ot=Ut),ji(ar,Ot)<0&&(Ot=ar),(!Vt||ji(Ut,Vt)<0)&&(Vt=Ut),ji(ar,Vt)<0&&(Vt=ar)}),{start:Ot,end:Vt}}var xe=t.from(),be=t.to();if(xe.line==be.line)ue(xe.line,xe.ch,be.ch);else{var Re=st(i,xe.line),Ue=st(i,be.line),je=$t(Re)==$t(Ue),Xe=ue(xe.line,xe.ch,je?Re.text.length+1:null).end,et=ue(be.line,je?0:null,be.ch).start;je&&(Xe.top<et.top-2?(oe(Xe.right,Xe.top,null,Xe.bottom),oe(G,et.top,et.left,et.bottom)):oe(Xe.right,Xe.top,et.left-Xe.right,Xe.bottom)),Xe.bottom<et.top&&oe(G,Xe.bottom,null,et.top)}n.appendChild(A)}function Sa(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()||Pn(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function Eo(e){e.state.focused||(e.display.input.focus(),wa(e))}function xo(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Pn(e))},100)}function wa(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(Ae(e,"focus",e,t),e.state.focused=!0,U(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),R&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Sa(e)}function Pn(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(Ae(e,"blur",e,t),e.state.focused=!1,m(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function Wi(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var i=t.view[r],A=e.options.lineWrapping,j=void 0,G=0;if(i.hidden)continue;if(N&&I<8){var V=i.node.offsetTop+i.node.offsetHeight;j=V-n,n=V}else{var Y=i.node.getBoundingClientRect();j=Y.bottom-Y.top,!A&&i.text.firstChild&&(G=i.text.firstChild.getBoundingClientRect().right-Y.left-1)}var oe=i.line.height-j;if((oe>.005||oe<-.005)&&(cr(i.line,j),To(i.line),i.rest))for(var ue=0;ue<i.rest.length;ue++)To(i.rest[ue]);if(G>e.display.sizerWidth){var xe=Math.ceil(G/Rn(e.display));xe>e.display.maxLineLength&&(e.display.maxLineLength=xe,e.display.maxLine=i.line,e.display.maxLineChanged=!0)}}}function To(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 Hi(e,t,n){var r=n&&n.top!=null?Math.max(0,n.top):e.scroller.scrollTop;r=Math.floor(r-Fi(e));var i=n&&n.bottom!=null?n.bottom:r+e.wrapper.clientHeight,A=wr(t,r),j=wr(t,i);if(n&&n.ensure){var G=n.ensure.from.line,V=n.ensure.to.line;G<A?(A=G,j=wr(t,lr(st(t,G))+e.wrapper.clientHeight)):Math.min(V,t.lastLine())>=j&&(A=wr(t,lr(st(t,V))-e.wrapper.clientHeight),j=V)}return{from:A,to:Math.max(j,A+1)}}function Ys(e,t){if(Ie(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&&!x){var A=a("div","\u200B",null,`position: absolute;
|
|
top: `+(t.top-n.viewOffset-Fi(e.display))+`px;
|
|
height: `+(t.bottom-t.top+Ar(e)+n.barHeight)+`px;
|
|
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(A),A.scrollIntoView(i),e.display.lineSpace.removeChild(A)}}function $s(e,t,n,r){r==null&&(r=0);var i;!e.options.lineWrapping&&t==n&&(t=t.ch?Ne(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,n=t.sticky=="before"?Ne(t.line,t.ch+1,"before"):t);for(var A=0;A<5;A++){var j=!1,G=br(e,t),V=!n||n==t?G:br(e,n);i={left:Math.min(G.left,V.left),top:Math.min(G.top,V.top)-r,right:Math.max(G.left,V.left),bottom:Math.max(G.bottom,V.bottom)+r};var Y=Ca(e,i),oe=e.doc.scrollTop,ue=e.doc.scrollLeft;if(Y.scrollTop!=null&&(ai(e,Y.scrollTop),Math.abs(e.doc.scrollTop-oe)>1&&(j=!0)),Y.scrollLeft!=null&&(cn(e,Y.scrollLeft),Math.abs(e.doc.scrollLeft-ue)>1&&(j=!0)),!j)break}return i}function Qs(e,t){var n=Ca(e,t);n.scrollTop!=null&&ai(e,n.scrollTop),n.scrollLeft!=null&&cn(e,n.scrollLeft)}function Ca(e,t){var n=e.display,r=On(e.display);t.top<0&&(t.top=0);var i=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop,A=ha(e),j={};t.bottom-t.top>A&&(t.bottom=t.top+A);var G=e.doc.height+fa(n),V=t.top<r,Y=t.bottom>G-r;if(t.top<i)j.scrollTop=V?0:t.top;else if(t.bottom>i+A){var oe=Math.min(t.top,(Y?G:t.bottom)-A);oe!=i&&(j.scrollTop=oe)}var ue=e.options.fixedGutter?0:n.gutters.offsetWidth,xe=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-ue,be=sn(e)-n.gutters.offsetWidth,Re=t.right-t.left>be;return Re&&(t.right=t.left+be),t.left<10?j.scrollLeft=0:t.left<xe?j.scrollLeft=Math.max(0,t.left+ue-(Re?0:10)):t.right>be+xe-3&&(j.scrollLeft=t.right+(Re?0:10)-be),j}function Aa(e,t){if(t==null)return;Ki(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function kn(e){Ki(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function ii(e,t,n){(t!=null||n!=null)&&Ki(e),t!=null&&(e.curOp.scrollLeft=t),n!=null&&(e.curOp.scrollTop=n)}function Js(e,t){Ki(e),e.curOp.scrollToPos=t}function Ki(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=ho(e,t.from),r=ho(e,t.to);So(e,n,r,t.margin)}}function So(e,t,n,r){var i=Ca(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});ii(e,i.scrollLeft,i.scrollTop)}function ai(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;D||Da(e,{top:t}),wo(e,t,!0),D&&Da(e),li(e,100)}function wo(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 cn(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,_o(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function oi(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+fa(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+Ar(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var fn=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),Se(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),Se(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,N&&I<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};fn.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 A=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+A)+"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}},fn.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},fn.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},fn.prototype.zeroWidthHack=function(){var e=l&&!w?"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},fn.prototype.enableZeroWidthBar=function(e,t,n){e.style.pointerEvents="auto";function r(){var i=e.getBoundingClientRect(),A=n=="vert"?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1);A!=e?e.style.pointerEvents="none":t.set(1e3,r)}t.set(1e3,r)},fn.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var si=function(){};si.prototype.update=function(){return{bottom:0,right:0}},si.prototype.setScrollLeft=function(){},si.prototype.setScrollTop=function(){},si.prototype.clear=function(){};function Mn(e,t){t||(t=oi(e));var n=e.display.barWidth,r=e.display.barHeight;Co(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&Wi(e),Co(e,oi(e)),n=e.display.barWidth,r=e.display.barHeight}function Co(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 Ao={native:fn,null:si};function Lo(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&m(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Ao[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Se(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"?cn(e,t):ai(e,t)},e),e.display.scrollbars.addClass&&U(e.display.wrapper,e.display.scrollbars.addClass)}var Zs=0;function hn(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},bt(e.curOp)}function mn(e){var t=e.curOp;t&&Ct(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 A=0;A<t.length;A++)nl(t[A]);for(var j=0;j<t.length;j++)il(t[j])}function el(e){var t=e.cm,n=t.display;ol(t),e.updateMaxLine&&Rr(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 Gi(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&La(e.cm,e.update)}function rl(e){var t=e.cm,n=t.display;e.updatedDisplay&&Wi(t),e.barMeasure=oi(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=io(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+Ar(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-sn(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&&cn(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var n=e.focus&&e.focus==_();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,n),(e.updatedDisplay||e.startHeight!=t.doc.height)&&Mn(t,e.barMeasure),e.updatedDisplay&&Oa(t,e.barMeasure),e.selectionChanged&&Sa(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),n&&Eo(e.cm)}function il(e){var t=e.cm,n=t.display,r=t.doc;if(e.updatedDisplay&&Do(t,e.update),n.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(n.wheelStartX=n.wheelStartY=null),e.scrollTop!=null&&wo(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&cn(t,e.scrollLeft,!0,!0),e.scrollToPos){var i=$s(t,mt(r,e.scrollToPos.from),mt(r,e.scrollToPos.to),e.scrollToPos.margin);Ys(t,i)}var A=e.maybeHiddenMarkers,j=e.maybeUnhiddenMarkers;if(A)for(var G=0;G<A.length;++G)A[G].lines.length||Ae(A[G],"hide");if(j)for(var V=0;V<j.length;++V)j[V].lines.length&&Ae(j[V],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Ae(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function ur(e,t){if(e.curOp)return t();hn(e);try{return t()}finally{mn(e)}}function Gt(e,t){return function(){if(e.curOp)return t.apply(e,arguments);hn(e);try{return t.apply(e,arguments)}finally{mn(e)}}}function qt(e){return function(){if(this.curOp)return e.apply(this,arguments);hn(this);try{return e.apply(this,arguments)}finally{mn(this)}}}function zt(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);hn(t);try{return e.apply(this,arguments)}finally{mn(t)}}}function li(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,k(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var n=+new Date+e.options.workTime,r=Be(e,t.highlightFrontier),i=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(A){if(r.line>=e.display.viewFrom){var j=A.styles,G=A.text.length>e.options.maxHighlightLength?mr(t.mode,r.state):null,V=Li(e,A,r,!0);G&&(r.state=G),A.styles=V.styles;var Y=A.styleClasses,oe=V.classes;oe?A.styleClasses=oe:Y&&(A.styleClasses=null);for(var ue=!j||j.length!=A.styles.length||Y!=oe&&(!Y||!oe||Y.bgClass!=oe.bgClass||Y.textClass!=oe.textClass),xe=0;!ue&&xe<j.length;++xe)ue=j[xe]!=A.styles[xe];ue&&i.push(r.line),A.stateAfter=r.save(),r.nextLine()}else A.text.length<=e.options.maxHighlightLength&&$n(e,A.text,r),A.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>n)return li(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&ur(e,function(){for(var A=0;A<i.length;A++)Kr(e,i[A],"text")})}var Gi=function(e,t,n){var r=e.display;this.viewport=t,this.visible=Hi(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=sn(e),this.force=n,this.dims=Ea(e),this.events=[]};Gi.prototype.signal=function(e,t){le(e,t)&&this.events.push(arguments)},Gi.prototype.finish=function(){for(var e=0;e<this.events.length;e++)Ae.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=Ar(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Ar(e)+"px",t.scrollbarsClipped=!0)}function sl(e){if(e.hasFocus())return null;var t=_();if(!t||!p(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&p(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==_())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&p(document.body,e.anchorNode)&&p(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 La(e,t){var n=e.display,r=e.doc;if(t.editorIsHidden)return Gr(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&&vo(e)==0)return!1;Oo(e)&&(Gr(e),t.dims=Ea(e));var i=r.first+r.size,A=Math.max(t.visible.from-e.options.viewportMargin,r.first),j=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFrom<A&&A-n.viewFrom<20&&(A=Math.max(r.first,n.viewFrom)),n.viewTo>j&&n.viewTo-j<20&&(j=Math.min(i,n.viewTo)),pr&&(A=Wr(e.doc,A),j=Ii(e.doc,j));var G=A!=n.viewFrom||j!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Vs(e,A,j),n.viewOffset=lr(st(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var V=vo(e);if(!G&&V==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var Y=sl(e);return V>4&&(n.lineDiv.style.display="none"),ul(e,n.updateLineNumbers,t.dims),V>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,G&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,li(e,400)),n.updateLineNumbers=null,!0}function Do(e,t){for(var n=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==sn(e)){if(n&&n.top!=null&&(n={top:Math.min(e.doc.height+fa(e.display)-ha(e),n.top)}),t.visible=Hi(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=Hi(e.display,e.doc,n));if(!La(e,t))break;Wi(e);var i=oi(e);ni(e),Mn(e,i),Oa(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 Da(e,t){var n=new Gi(e,t);if(La(e,n)){Wi(e),Do(e,n);var r=oi(e);ni(e),Mn(e,r),Oa(e,r),n.finish()}}function ul(e,t,n){var r=e.display,i=e.options.lineNumbers,A=r.lineDiv,j=A.firstChild;function G(Re){var Ue=Re.nextSibling;return R&&l&&e.display.currentWheelTarget==Re?Re.style.display="none":Re.parentNode.removeChild(Re),Ue}for(var V=r.view,Y=r.viewFrom,oe=0;oe<V.length;oe++){var ue=V[oe];if(!ue.hidden)if(!ue.node||ue.node.parentNode!=A){var xe=Us(e,ue,Y,n);A.insertBefore(xe,j)}else{for(;j!=ue.node;)j=G(j);var be=i&&t!=null&&t<=Y&&ue.lineNumber;ue.changes&&(ee(ue.changes,"gutter")>-1&&(be=!1),Ja(e,ue,Y,n)),be&&(c(ue.lineNumber),ue.lineNumber.appendChild(document.createTextNode(yn(e.options,Y)))),j=ue.node.nextSibling}Y+=ue.size}for(;j;)j=G(j)}function _a(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Oa(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+Ar(e)+"px"}function _o(e){var t=e.display,n=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var r=xa(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,A=r+"px",j=0;j<n.length;j++)if(!n[j].hidden){e.options.fixedGutter&&(n[j].gutter&&(n[j].gutter.style.left=A),n[j].gutterBackground&&(n[j].gutterBackground.style.left=A));var G=n[j].alignable;if(G)for(var V=0;V<G.length;V++)G[V].style.left=A}e.options.fixedGutter&&(t.gutters.style.left=r+i+"px")}function Oo(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=yn(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")),A=i.firstChild.offsetWidth,j=i.offsetWidth-A;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(A,r.lineGutter.offsetWidth-j)+1,r.lineNumWidth=r.lineNumInnerWidth+j,r.lineNumChars=r.lineNumInnerWidth?n.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",_a(e.display),!0}return!1}function Ra(e,t){for(var n=[],r=!1,i=0;i<e.length;i++){var A=e[i],j=null;if(typeof A!="string"&&(j=A.style,A=A.className),A=="CodeMirror-linenumbers")if(t)r=!0;else continue;n.push({className:A,style:j})}return t&&!r&&n.push({className:"CodeMirror-linenumbers",style:null}),n}function Ro(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],A=i.className,j=i.style,G=t.appendChild(a("div",null,"CodeMirror-gutter "+A));j&&(G.style.cssText=j),A=="CodeMirror-linenumbers"&&(e.lineGutter=G,G.style.width=(e.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",_a(e)}function ui(e){Ro(e.display),tr(e),_o(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=E("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=E("div",[i.measure,i.lineMeasure,i.selectionDiv,i.cursorDiv,i.lineDiv],null,"position: relative; outline: none");var A=E("div",[i.lineSpace],"CodeMirror-lines");i.mover=a("div",[A],null,"position: relative"),i.sizer=a("div",[i.mover],"CodeMirror-sizer"),i.sizerWidth=null,i.heightForcer=a("div",null,null,"position: absolute; height: "+ie+"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"),N&&I<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),!R&&!(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=Ra(r.gutters,r.lineNumbers),Ro(i),n.init(i)}var zi=0,fr=null;N?fr=-.53:D?fr=15:h?fr=-.7:P&&(fr=-1/3);function Po(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=Po(e);return t.x*=fr,t.y*=fr,t}function ko(e,t){var n=Po(t),r=n.x,i=n.y,A=e.display,j=A.scroller,G=j.scrollWidth>j.clientWidth,V=j.scrollHeight>j.clientHeight;if(!(r&&G||i&&V))return;if(i&&l&&R){e:for(var Y=t.target,oe=A.view;Y!=j;Y=Y.parentNode)for(var ue=0;ue<oe.length;ue++)if(oe[ue].node==Y){e.display.currentWheelTarget=Y;break e}}if(r&&!D&&!y&&fr!=null){i&&V&&ai(e,Math.max(0,j.scrollTop+i*fr)),cn(e,Math.max(0,j.scrollLeft+r*fr)),(!i||i&&V)&&Q(t),A.wheelStartX=null;return}if(i&&fr!=null){var xe=i*fr,be=e.doc.scrollTop,Re=be+A.wrapper.clientHeight;xe<0?be=Math.max(0,be+xe-50):Re=Math.min(e.doc.height,Re+xe+50),Da(e,{top:be,bottom:Re})}zi<20&&(A.wheelStartX==null?(A.wheelStartX=j.scrollLeft,A.wheelStartY=j.scrollTop,A.wheelDX=r,A.wheelDY=i,setTimeout(function(){if(A.wheelStartX==null)return;var Ue=j.scrollLeft-A.wheelStartX,je=j.scrollTop-A.wheelStartY,Xe=je&&A.wheelDY&&je/A.wheelDY||Ue&&A.wheelDX&&Ue/A.wheelDX;if(A.wheelStartX=A.wheelStartY=null,!Xe)return;fr=(fr*zi+Xe)/(zi+1),++zi},200)):(A.wheelDX+=r,A.wheelDY+=i))}var hr=function(e,t){this.ranges=e,this.primIndex=t};hr.prototype.primary=function(){return this.ranges[this.primIndex]},hr.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(!qr(n.anchor,r.anchor)||!qr(n.head,r.head))return!1}return!0},hr.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new wt(en(this.ranges[t].anchor),en(this.ranges[t].head));return new hr(e,this.primIndex)},hr.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},hr.prototype.contains=function(e,t){t||(t=e);for(var n=0;n<this.ranges.length;n++){var r=this.ranges[n];if(ft(t,r.from())>=0&&ft(e,r.to())<=0)return n}return-1};var wt=function(e,t){this.anchor=e,this.head=t};wt.prototype.from=function(){return bn(this.anchor,this.head)},wt.prototype.to=function(){return tn(this.anchor,this.head)},wt.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Er(e,t,n){var r=e&&e.options.selectionsMayTouch,i=t[n];t.sort(function(xe,be){return ft(xe.from(),be.from())}),n=ee(t,i);for(var A=1;A<t.length;A++){var j=t[A],G=t[A-1],V=ft(G.to(),j.from());if(r&&!j.empty()?V>0:V>=0){var Y=bn(G.from(),j.from()),oe=tn(G.to(),j.to()),ue=G.empty()?j.from()==j.head:G.from()==G.head;A<=n&&--n,t.splice(--A,2,new wt(ue?oe:Y,ue?Y:oe))}}return new hr(t,n)}function zr(e,t){return new hr([new wt(e,t||e)],0)}function Vr(e){return e.text?Ne(e.from.line+e.text.length-1,$(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Mo(e,t){if(ft(e,t.from)<0)return e;if(ft(e,t.to)<=0)return Vr(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+=Vr(t).ch-t.to.ch),Ne(n,r)}function Pa(e,t){for(var n=[],r=0;r<e.sel.ranges.length;r++){var i=e.sel.ranges[r];n.push(new wt(Mo(i.anchor,t),Mo(i.head,t)))}return Er(e.cm,n,e.sel.primIndex)}function Io(e,t,n){return e.line==t.line?Ne(n.line,e.ch-t.ch+n.ch):Ne(n.line+(e.line-t.line),e.ch)}function fl(e,t,n){for(var r=[],i=Ne(e.first,0),A=i,j=0;j<t.length;j++){var G=t[j],V=Io(G.from,i,A),Y=Io(Vr(G),i,A);if(i=G.to,A=Y,n=="around"){var oe=e.sel.ranges[j],ue=ft(oe.head,oe.anchor)<0;r[j]=new wt(ue?Y:V,ue?V:Y)}else r[j]=new wt(V,V)}return new hr(r,e.sel.primIndex)}function ka(e){e.doc.mode=Tr(e.options,e.doc.modeOption),di(e)}function di(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,li(e,100),e.state.modeGen++,e.curOp&&tr(e)}function Uo(e,t){return t.from.ch==0&&t.to.ch==0&&$(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Ma(e,t,n,r){function i(et){return n?n[et]:null}function A(et,Ye,nt){la(et,Ye,nt,r),Dt(et,"change",et,t)}function j(et,Ye){for(var nt=[],dt=et;dt<Ye;++dt)nt.push(new Hr(Y[dt],i(dt),r));return nt}var G=t.from,V=t.to,Y=t.text,oe=st(e,G.line),ue=st(e,V.line),xe=$(Y),be=i(Y.length-1),Re=V.line-G.line;if(t.full)e.insert(0,j(0,Y.length)),e.remove(Y.length,e.size-Y.length);else if(Uo(e,t)){var Ue=j(0,Y.length-1);A(ue,ue.text,be),Re&&e.remove(G.line,Re),Ue.length&&e.insert(G.line,Ue)}else if(oe==ue)if(Y.length==1)A(oe,oe.text.slice(0,G.ch)+xe+oe.text.slice(V.ch),be);else{var je=j(1,Y.length-1);je.push(new Hr(xe+oe.text.slice(V.ch),be,r)),A(oe,oe.text.slice(0,G.ch)+Y[0],i(0)),e.insert(G.line+1,je)}else if(Y.length==1)A(oe,oe.text.slice(0,G.ch)+Y[0]+ue.text.slice(V.ch),i(0)),e.remove(G.line+1,Re);else{A(oe,oe.text.slice(0,G.ch)+Y[0],i(0)),A(ue,xe+ue.text.slice(V.ch),be);var Xe=j(1,Y.length-1);Re>1&&e.remove(G.line+1,Re-1),e.insert(G.line+1,Xe)}Dt(e,"change",e,t)}function Xr(e,t,n){function r(i,A,j){if(i.linked)for(var G=0;G<i.linked.length;++G){var V=i.linked[G];if(V.doc==A)continue;var Y=j&&V.sharedHist;if(n&&!Y)continue;t(V.doc,Y),r(V.doc,i,Y)}}r(e,null,!0)}function Fo(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,Ta(e),ka(e),No(e),e.options.lineWrapping||Rr(e),e.options.mode=t.modeOption,tr(e)}function No(e){(e.doc.direction=="rtl"?U:m)(e.display.lineDiv,"CodeMirror-rtl")}function hl(e){ur(e,function(){No(e),tr(e)})}function Vi(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 Ia(e,t){var n={from:en(t.from),to:Vr(t),text:Sr(e,t.from,t.to)};return Wo(e,n,t.from.line,t.to.line+1),Xr(e,function(r){return Wo(r,n,t.from.line,t.to.line+1)},!0),n}function Bo(e){for(;e.length;){var t=$(e);if(t.ranges)e.pop();else break}}function ml(e,t){if(t)return Bo(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 jo(e,t,n,r){var i=e.history;i.undone.length=0;var A=+new Date,j,G;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&i.lastModTime>A-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(j=ml(i,i.lastOp==r)))G=$(j.changes),ft(t.from,t.to)==0&&ft(t.from,G.to)==0?G.to=Vr(t):j.changes.push(Ia(e,t));else{var V=$(i.done);for((!V||!V.ranges)&&Xi(e.sel,i.done),j={changes:[Ia(e,t)],generation:i.generation},i.done.push(j);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=A,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,G||Ae(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,A=r&&r.origin;n==i.lastSelOp||A&&i.lastSelOrigin==A&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==A||pl(e,A,$(i.done),t))?i.done[i.done.length-1]=t:Xi(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=A,i.lastSelOp=n,r&&r.clearRedo!==!1&&Bo(i.undone)}function Xi(e,t){var n=$(t);n&&n.ranges&&n.equals(e)||t.push(e)}function Wo(e,t,n,r){var i=t["spans_"+e.id],A=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(j){j.markedSpans&&((i||(i=t["spans_"+e.id]={}))[A]=j.markedSpans),++A})}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 Ho(e,t){var n=yl(e,t),r=Or(e,t);if(!n)return r;if(!r)return n;for(var i=0;i<n.length;++i){var A=n[i],j=r[i];if(A&&j){e:for(var G=0;G<j.length;++G){for(var V=j[G],Y=0;Y<A.length;++Y)if(A[Y].marker==V.marker)continue e;A.push(V)}}else j&&(n[i]=j)}return n}function In(e,t,n){for(var r=[],i=0;i<e.length;++i){var A=e[i];if(A.ranges){r.push(n?hr.prototype.deepCopy.call(A):A);continue}var j=A.changes,G=[];r.push({changes:G});for(var V=0;V<j.length;++V){var Y=j[V],oe=void 0;if(G.push({from:Y.from,to:Y.to,text:Y.text}),t)for(var ue in Y)(oe=ue.match(/^spans_(\d+)$/))&&(ee(t,Number(oe[1]))>-1&&($(G)[ue]=Y[ue],delete Y[ue]))}}return r}function Ua(e,t,n,r){if(r){var i=e.anchor;if(n){var A=ft(t,i)<0;A!=ft(n,i)<0?(i=t,t=n):A!=ft(t,n)<0&&(t=n)}return new wt(i,t)}else return new wt(n||t,t)}function Yi(e,t,n,r,i){i==null&&(i=e.cm&&(e.cm.display.shift||e.extend)),Qt(e,new hr([Ua(e.sel.primary(),t,n,i)],0),r)}function Ko(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),A=0;A<e.sel.ranges.length;A++)r[A]=Ua(e.sel.ranges[A],t[A],null,i);var j=Er(e.cm,r,e.sel.primIndex);Qt(e,j,n)}function Fa(e,t,n,r){var i=e.sel.ranges.slice(0);i[t]=n,Qt(e,Er(e.cm,i,e.sel.primIndex),r)}function Go(e,t,n,r){Qt(e,zr(t,n),r)}function bl(e,t,n){var r={ranges:t.ranges,update:function(i){this.ranges=[];for(var A=0;A<i.length;A++)this.ranges[A]=new wt(mt(e,i[A].anchor),mt(e,i[A].head))},origin:n&&n.origin};return Ae(e,"beforeSelectionChange",e,r),e.cm&&Ae(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?Er(e.cm,r.ranges,r.ranges.length-1):t}function zo(e,t,n){var r=e.history.done,i=$(r);i&&i.ranges?(r[r.length-1]=t,$i(e,t,n)):Qt(e,t,n)}function Qt(e,t,n){$i(e,t,n),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function $i(e,t,n){(le(e,"beforeSelectionChange")||e.cm&&le(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,n));var r=n&&n.bias||(ft(t.primary().head,e.sel.primary().head)<0?-1:1);Vo(e,Yo(e,t,r,!0)),!(n&&n.scroll===!1)&&e.cm&&kn(e.cm)}function Vo(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,ge(e.cm)),Dt(e,"cursorActivity",e)}function Xo(e){Vo(e,Yo(e,e.sel,null,!1))}function Yo(e,t,n,r){for(var i,A=0;A<t.ranges.length;A++){var j=t.ranges[A],G=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[A],V=Qi(e,j.anchor,G&&G.anchor,n,r),Y=Qi(e,j.head,G&&G.head,n,r);(i||V!=j.anchor||Y!=j.head)&&(i||(i=t.ranges.slice(0,A)),i[A]=new wt(V,Y))}return i?Er(e.cm,i,t.primIndex):t}function Un(e,t,n,r,i){var A=st(e,t.line);if(A.markedSpans)for(var j=0;j<A.markedSpans.length;++j){var G=A.markedSpans[j],V=G.marker,Y="selectLeft"in V?!V.selectLeft:V.inclusiveLeft,oe="selectRight"in V?!V.selectRight:V.inclusiveRight;if((G.from==null||(Y?G.from<=t.ch:G.from<t.ch))&&(G.to==null||(oe?G.to>=t.ch:G.to>t.ch))){if(i&&(Ae(V,"beforeCursorEnter"),V.explicitlyCleared))if(A.markedSpans){--j;continue}else break;if(!V.atomic)continue;if(n){var ue=V.find(r<0?1:-1),xe=void 0;if((r<0?oe:Y)&&(ue=$o(e,ue,-r,ue&&ue.line==t.line?A:null)),ue&&ue.line==t.line&&(xe=ft(ue,n))&&(r<0?xe<0:xe>0))return Un(e,ue,t,r,i)}var be=V.find(r<0?-1:1);return(r<0?Y:oe)&&(be=$o(e,be,r,be.line==t.line?A:null)),be?Un(e,be,t,r,i):null}}return t}function Qi(e,t,n,r,i){var A=r||1,j=Un(e,t,n,A,i)||!i&&Un(e,t,n,A,!0)||Un(e,t,n,-A,i)||!i&&Un(e,t,n,-A,!0);return j||(e.cantEdit=!0,Ne(e.first,0))}function $o(e,t,n,r){return n<0&&t.ch==0?t.line>e.first?mt(e,Ne(t.line-1)):null:n>0&&t.ch==(r||st(e,t.line)).text.length?t.line<e.first+e.size-1?Ne(t.line+1,0):null:new Ne(t.line,t.ch+n)}function Qo(e){e.setSelection(Ne(e.firstLine(),0),Ne(e.lastLine()),pe)}function Jo(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,A,j,G){i&&(r.from=mt(e,i)),A&&(r.to=mt(e,A)),j&&(r.text=j),G!==void 0&&(r.origin=G)}),Ae(e,"beforeChange",e,r),e.cm&&Ae(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 Fn(e,t,n){if(e.cm){if(!e.cm.curOp)return Gt(e.cm,Fn)(e,t,n);if(e.cm.state.suppressEdits)return}if((le(e,"beforeChange")||e.cm&&le(e.cm,"beforeChange"))&&(t=Jo(e,t,!0),!t))return;var r=Ri&&!n&&oa(e,t.from,t.to);if(r)for(var i=r.length-1;i>=0;--i)Zo(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else Zo(e,t)}function Zo(e,t){if(t.text.length==1&&t.text[0]==""&&ft(t.from,t.to)==0)return;var n=Pa(e,t);jo(e,t,n,e.cm?e.cm.curOp.id:NaN),ci(e,t,n,Or(e,t));var r=[];Xr(e,function(i,A){!A&&ee(r,i.history)==-1&&(rs(i.history,t),r.push(i.history)),ci(i,t,null,Or(i,t))})}function Ji(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(r&&!n)return;for(var i=e.history,A,j=e.sel,G=t=="undo"?i.done:i.undone,V=t=="undo"?i.undone:i.done,Y=0;Y<G.length&&!(A=G[Y],n?A.ranges&&!A.equals(e.sel):!A.ranges);Y++);if(Y==G.length)return;for(i.lastOrigin=i.lastSelOrigin=null;;)if(A=G.pop(),A.ranges){if(Xi(A,V),n&&!A.equals(e.sel)){Qt(e,A,{clearRedo:!1});return}j=A}else if(r){G.push(A);return}else break;var oe=[];Xi(j,V),V.push({changes:oe,generation:i.generation}),i.generation=A.generation||++i.maxGeneration;for(var ue=le(e,"beforeChange")||e.cm&&le(e.cm,"beforeChange"),xe=function(Ue){var je=A.changes[Ue];if(je.origin=t,ue&&!Jo(e,je,!1))return G.length=0,{};oe.push(Ia(e,je));var Xe=Ue?Pa(e,je):$(G);ci(e,je,Xe,Ho(e,je)),!Ue&&e.cm&&e.cm.scrollIntoView({from:je.from,to:Vr(je)});var et=[];Xr(e,function(Ye,nt){!nt&&ee(et,Ye.history)==-1&&(rs(Ye.history,je),et.push(Ye.history)),ci(Ye,je,null,Ho(Ye,je))})},be=A.changes.length-1;be>=0;--be){var Re=xe(be);if(Re)return Re.v}}function qo(e,t){if(t==0)return;if(e.first+=t,e.sel=new hr(ae(e.sel.ranges,function(i){return new wt(Ne(i.anchor.line+t,i.anchor.ch),Ne(i.head.line+t,i.head.ch))}),e.sel.primIndex),e.cm){tr(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;r<n.viewTo;r++)Kr(e.cm,r,"gutter")}}function ci(e,t,n,r){if(e.cm&&!e.cm.curOp)return Gt(e.cm,ci)(e,t,n,r);if(t.to.line<e.first){qo(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);qo(e,i),t={from:Ne(e.first,0),to:Ne(t.to.line+i,t.to.ch),text:[$(t.text)],origin:t.origin}}var A=e.lastLine();t.to.line>A&&(t={from:t.from,to:Ne(A,st(e,A).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Sr(e,t.from,t.to),n||(n=Pa(e,t)),e.cm?El(e.cm,t,r):Ma(e,t,r),$i(e,n,pe),e.cantEdit&&Qi(e,Ne(e.firstLine(),0))&&(e.cantEdit=!1)}function El(e,t,n){var r=e.doc,i=e.display,A=t.from,j=t.to,G=!1,V=A.line;e.options.lineWrapping||(V=St($t(st(r,A.line))),r.iter(V,j.line+1,function(be){if(be==i.maxLine)return G=!0,!0})),r.sel.contains(t.from,t.to)>-1&&ge(e),Ma(r,t,n,go(e)),e.options.lineWrapping||(r.iter(V,A.line+t.text.length,function(be){var Re=Dn(be);Re>i.maxLineLength&&(i.maxLine=be,i.maxLineLength=Re,i.maxLineChanged=!0,G=!1)}),G&&(e.curOp.updateMaxLine=!0)),Oi(r,A.line),li(e,400);var Y=t.text.length-(j.line-A.line)-1;t.full?tr(e):A.line==j.line&&t.text.length==1&&!Uo(e.doc,t)?Kr(e,A.line,"text"):tr(e,A.line,j.line+1,Y);var oe=le(e,"changes"),ue=le(e,"change");if(ue||oe){var xe={from:A,to:j,text:t.text,removed:t.removed,origin:t.origin};ue&&Dt(e,"change",e,xe),oe&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(xe)}e.display.selForContextMenu=null}function Nn(e,t,n,r,i){var A;r||(r=n),ft(r,n)<0&&(A=[r,n],n=A[0],r=A[1]),typeof t=="string"&&(t=e.splitLines(t)),Fn(e,{from:n,to:r,text:t,origin:i})}function es(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function ts(e,t,n,r){for(var i=0;i<e.length;++i){var A=e[i],j=!0;if(A.ranges){A.copied||(A=e[i]=A.deepCopy(),A.copied=!0);for(var G=0;G<A.ranges.length;G++)es(A.ranges[G].anchor,t,n,r),es(A.ranges[G].head,t,n,r);continue}for(var V=0;V<A.changes.length;++V){var Y=A.changes[V];if(n<Y.from.line)Y.from=Ne(Y.from.line+r,Y.from.ch),Y.to=Ne(Y.to.line+r,Y.to.ch);else if(t<=Y.to.line){j=!1;break}}j||(e.splice(0,i+1),i=0)}}function rs(e,t){var n=t.from.line,r=t.to.line,i=t.text.length-(r-n)-1;ts(e.done,n,r,i),ts(e.undone,n,r,i)}function fi(e,t,n,r){var i=t,A=t;return typeof t=="number"?A=st(e,Xn(e,t)):i=St(t),i==null?null:(r(A,i)&&e.cm&&Kr(e.cm,i,n),A)}function hi(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}hi.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,ua(i),Dt(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 mi(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}mi.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 A=Math.min(t,i-e),j=r.height;if(r.removeInner(e,A),this.height-=j-r.height,i==A&&(this.children.splice(n--,1),r.parent=null),(t-=A)==0)break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof hi))){var G=[];this.collapse(G),this.children=[new hi(G)],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],A=i.chunkSize();if(e<=A){if(i.insertInner(e,t,n),i.lines&&i.lines.length>50){for(var j=i.lines.length%25+25,G=j;G<i.lines.length;){var V=new hi(i.lines.slice(G,G+=25));i.height-=V.height,this.children.splice(++r,0,V),V.parent=this}i.lines=i.lines.slice(0,j),this.maybeSpill()}break}e-=A}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),n=new mi(t);if(e.parent){e.size-=n.size,e.height-=n.height;var i=ee(e.parent.children,e);e.parent.children.splice(i+1,0,n)}else{var r=new mi(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],A=i.chunkSize();if(e<A){var j=Math.min(t,A-e);if(i.iterN(e,j,n))return!0;if((t-=j)==0)break;e=0}else e-=A}}};var pi=function(e,t,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.doc=e,this.node=t};pi.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,r=St(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 A=ti(this);cr(n,Math.max(0,n.height-A)),e&&(ur(e,function(){ns(e,n,-A),Kr(e,r,"widget")}),Dt(e,"lineWidgetCleared",e,this,r))},pi.prototype.changed=function(){var e=this,t=this.height,n=this.doc.cm,r=this.line;this.height=null;var i=ti(this)-t;if(!i)return;yr(this.doc,r)||cr(r,r.height+i),n&&ur(n,function(){n.curOp.forceUpdate=!0,ns(n,r,i),Dt(n,"lineWidgetChanged",n,e,St(r))})},de(pi);function ns(e,t,n){lr(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Aa(e,n)}function xl(e,t,n,r){var i=new pi(e,n,r),A=e.cm;return A&&i.noHScroll&&(A.display.alignWidgets=!0),fi(e,t,"widget",function(j){var G=j.widgets||(j.widgets=[]);if(i.insertAt==null?G.push(i):G.splice(Math.min(G.length-1,Math.max(0,i.insertAt)),0,i),i.line=j,A&&!yr(e,j)){var V=lr(j)<e.scrollTop;cr(j,j.height+ti(i)),V&&Aa(A,i.height),A.curOp.forceUpdate=!0}return!0}),A&&Dt(A,"lineWidgetAdded",A,i,typeof t=="number"?t:St(t)),i}var is=0,Yr=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++is};Yr.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&hn(e),le(this,"clear")){var n=this.find();n&&Dt(this,"clear",n.from,n.to)}for(var r=null,i=null,A=0;A<this.lines.length;++A){var j=this.lines[A],G=Fr(j.markedSpans,this);e&&!this.collapsed?Kr(e,St(j),"text"):e&&(G.to!=null&&(i=St(j)),G.from!=null&&(r=St(j))),j.markedSpans=Nr(j.markedSpans,G),G.from==null&&this.collapsed&&!yr(this.doc,j)&&e&&cr(j,On(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var V=0;V<this.lines.length;++V){var Y=$t(this.lines[V]),oe=Dn(Y);oe>e.display.maxLineLength&&(e.display.maxLine=Y,e.display.maxLineLength=oe,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&tr(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Xo(e.doc)),e&&Dt(e,"markerCleared",e,this,r,i),t&&mn(e),this.parent&&this.parent.clear()},Yr.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var n,r,i=0;i<this.lines.length;++i){var A=this.lines[i],j=Fr(A.markedSpans,this);if(j.from!=null&&(n=Ne(t?A:St(A),j.from),e==-1))return n;if(j.to!=null&&(r=Ne(t?A:St(A),j.to),e==1))return r}return n&&{from:n,to:r}},Yr.prototype.changed=function(){var e=this,t=this.find(-1,!0),n=this,r=this.doc.cm;if(!t||!r)return;ur(r,function(){var i=t.line,A=St(t.line),j=ma(r,A);if(j&&(so(j),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!yr(n.doc,i)&&n.height!=null){var G=n.height;n.height=null;var V=ti(n)-G;V&&cr(i,i.height+V)}Dt(r,"markerChanged",r,e)})},Yr.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||ee(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Yr.prototype.detachLine=function(e){if(this.lines.splice(ee(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},de(Yr);function Bn(e,t,n,r,i){if(r&&r.shared)return Tl(e,t,n,r,i);if(e.cm&&!e.cm.curOp)return Gt(e.cm,Bn)(e,t,n,r,i);var A=new Yr(e,i),j=ft(t,n);if(r&&M(r,A,!1),j>0||j==0&&A.clearWhenEmpty!==!1)return A;if(A.replacedWith&&(A.collapsed=!0,A.widgetNode=E("span",[A.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||A.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(A.widgetNode.insertLeft=!0)),A.collapsed){if(qn(e,t.line,t,n,A)||t.line!=n.line&&qn(e,n.line,t,n,A))throw new Error("Inserting collapsed marker partially overlapping an existing one");Pi()}A.addToHistory&&jo(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var G=t.line,V=e.cm,Y;if(e.iter(G,n.line+1,function(ue){V&&A.collapsed&&!V.options.lineWrapping&&$t(ue)==V.display.maxLine&&(Y=!0),A.collapsed&&G!=t.line&&cr(ue,0),Br(ue,new xn(A,G==t.line?t.ch:null,G==n.line?n.ch:null)),++G}),A.collapsed&&e.iter(t.line,n.line+1,function(ue){yr(e,ue)&&cr(ue,0)}),A.clearOnEnter&&Se(A,"beforeCursorEnter",function(){return A.clear()}),A.readOnly&&(Cr(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),A.collapsed&&(A.id=++is,A.atomic=!0),V){if(Y&&(V.curOp.updateMaxLine=!0),A.collapsed)tr(V,t.line,n.line+1);else if(A.className||A.startStyle||A.endStyle||A.css||A.attributes||A.title)for(var oe=t.line;oe<=n.line;oe++)Kr(V,oe,"text");A.atomic&&Xo(V.doc),Dt(V,"markerAdded",V,A)}return A}var gi=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};gi.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();Dt(this,"clear")},gi.prototype.find=function(e,t){return this.primary.find(e,t)},de(gi);function Tl(e,t,n,r,i){r=M(r),r.shared=!1;var A=[Bn(e,t,n,r,i)],j=A[0],G=r.widgetNode;return Xr(e,function(V){G&&(r.widgetNode=G.cloneNode(!0)),A.push(Bn(V,mt(V,t),mt(V,n),r,i));for(var Y=0;Y<V.linked.length;++Y)if(V.linked[Y].isParent)return;j=$(A)}),new gi(A,j)}function as(e){return e.findMarks(Ne(e.first,0),e.clipPos(Ne(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(),A=e.clipPos(i.from),j=e.clipPos(i.to);if(ft(A,j)){var G=Bn(e,A,j,r.primary,r.primary.type);r.markers.push(G),G.parent=r}}}function wl(e){for(var t=function(r){var i=e[r],A=[i.primary.doc];Xr(i.primary.doc,function(V){return A.push(V)});for(var j=0;j<i.markers.length;j++){var G=i.markers[j];ee(A,G.doc)==-1&&(G.parent=null,i.markers.splice(j--,1))}},n=0;n<e.length;n++)t(n)}var Cl=0,rr=function(e,t,n,r,i){if(!(this instanceof rr))return new rr(e,t,n,r,i);n==null&&(n=0),mi.call(this,[new hi([new Hr("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var A=Ne(n,0);this.sel=zr(A),this.history=new Vi(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)),Ma(this,{from:A,to:A,text:e}),Qt(this,zr(A),pe)};rr.prototype=Ce(mi.prototype,{constructor:rr,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=Vn(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:zt(function(e){var t=Ne(this.first,0),n=this.first+this.size-1;Fn(this,{from:t,to:Ne(n,st(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&ii(this.cm,0,0),Qt(this,zr(t),pe)}),replaceRange:function(e,t,n,r){t=mt(this,t),n=n?mt(this,n):t,Nn(this,e,t,n,r)},getRange:function(e,t,n){var r=Sr(this,mt(this,e),mt(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(Zr(this,e))return st(this,e)},getLineNumber:function(e){return St(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=st(this,e)),$t(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return mt(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:zt(function(e,t,n){Go(this,mt(this,typeof e=="number"?Ne(e,t||0):e),null,n)}),setSelection:zt(function(e,t,n){Go(this,mt(this,e),mt(this,t||e),n)}),extendSelection:zt(function(e,t,n){Yi(this,mt(this,e),t&&mt(this,t),n)}),extendSelections:zt(function(e,t){Ko(this,Ai(this,e),t)}),extendSelectionsBy:zt(function(e,t){var n=ae(this.sel.ranges,e);Ko(this,Ai(this,n),t)}),setSelections:zt(function(e,t,n){if(!e.length)return;for(var r=[],i=0;i<e.length;i++)r[i]=new wt(mt(this,e[i].anchor),mt(this,e[i].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),Qt(this,Er(this.cm,r,t),n)}),addSelection:zt(function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new wt(mt(this,e),mt(this,t||e))),Qt(this,Er(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=Sr(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=Sr(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:zt(function(e,t,n){for(var r=[],i=this.sel,A=0;A<i.ranges.length;A++){var j=i.ranges[A];r[A]={from:j.from(),to:j.to(),text:this.splitLines(e[A]),origin:n}}for(var G=t&&t!="end"&&fl(this,r,t),V=r.length-1;V>=0;V--)Fn(this,r[V]);G?zo(this,G):this.cm&&kn(this.cm)}),undo:zt(function(){Ji(this,"undo")}),redo:zt(function(){Ji(this,"redo")}),undoSelection:zt(function(){Ji(this,"undo",!0)}),redoSelection:zt(function(){Ji(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 Vi(this.history.maxGeneration),Xr(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:In(this.history.done),undone:In(this.history.undone)}},setHistory:function(e){var t=this.history=new Vi(this.history.maxGeneration);t.done=In(e.done.slice(0),null,!0),t.undone=In(e.undone.slice(0),null,!0)},setGutterMarker:zt(function(e,t,n){return fi(this,e,"gutter",function(r){var i=r.gutterMarkers||(r.gutterMarkers={});return i[t]=n,!n&&ke(i)&&(r.gutterMarkers=null),!0})}),clearGutter:zt(function(e){var t=this;this.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&fi(t,n,"gutter",function(){return n.gutterMarkers[e]=null,ke(n.gutterMarkers)&&(n.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!Zr(this,e))return null;if(t=e,e=st(this,e),!e)return null}else if(t=St(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:zt(function(e,t,n){return fi(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(T(n).test(r[i]))return!1;r[i]+=" "+n}return!0})}),removeLineClass:zt(function(e,t,n){return fi(this,e,t=="gutter"?"gutter":"class",function(r){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",A=r[i];if(A)if(n==null)r[i]=null;else{var j=A.match(T(n));if(!j)return!1;var G=j.index+j[0].length;r[i]=A.slice(0,j.index)+(!j.index||G==A.length?"":" ")+A.slice(G)||null}else return!1;return!0})}),addLineWidget:zt(function(e,t,n){return xl(this,e,t,n)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return Bn(this,mt(this,e),mt(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=mt(this,e),Bn(this,e,e,n,"bookmark")},findMarksAt:function(e){e=mt(this,e);var t=[],n=st(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=mt(this,e),t=mt(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,function(A){var j=A.markedSpans;if(j)for(var G=0;G<j.length;G++){var V=j[G];!(V.to!=null&&i==e.line&&e.ch>=V.to||V.from==null&&i!=e.line||V.from!=null&&i==t.line&&V.from>=t.ch)&&(!n||n(V.marker))&&r.push(V.marker.parent||V.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 A=i.text.length+r;if(A>e)return t=e,!0;e-=A,++n}),mt(this,Ne(n,t))},indexFromPos:function(e){e=mt(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 rr(Vn(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 rr(Vn(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,as(this)),r},unlinkDoc:function(e){if(e instanceof Pt&&(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(as(this));break}if(e.history==this.history){var r=[e.id];Xr(e,function(i){return r.push(i.id)},!0),e.history=new Vi(null),e.history.done=In(this.history.done,r),e.history.undone=In(this.history.undone,r)}},iterLinkedDocs:function(e){Xr(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):at(e)},lineSeparator:function(){return this.lineSep||`
|
|
`},setDirection:zt(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)})}),rr.prototype.eachLine=rr.prototype.iter;var os=0;function Al(e){var t=this;if(ss(t),Ie(t,e)||kr(t.display,e))return;Q(e),N&&(os=+new Date);var n=un(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,A=Array(i),j=0,G=function(){++j==i&&Gt(t,function(){n=mt(t.doc,n);var be={from:n,to:n,text:t.doc.splitLines(A.filter(function(Re){return Re!=null}).join(t.doc.lineSeparator())),origin:"paste"};Fn(t.doc,be),zo(t.doc,zr(mt(t.doc,n),mt(t.doc,Vr(be))))})()},V=function(be,Re){if(t.options.allowDropFileTypes&&ee(t.options.allowDropFileTypes,be.type)==-1){G();return}var Ue=new FileReader;Ue.onerror=function(){return G()},Ue.onload=function(){var je=Ue.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(je)){G();return}A[Re]=je,G()},Ue.readAsText(be)},Y=0;Y<r.length;Y++)V(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 ue;if(t.state.draggingText&&!t.state.draggingText.copy&&(ue=t.listSelections()),$i(t.doc,zr(n,n)),ue)for(var xe=0;xe<ue.length;++xe)Nn(t.doc,"",ue[xe].anchor,ue[xe].head,"drag");t.replaceSelection(oe,"around","paste"),t.display.input.focus()}}catch(be){}}}function Ll(e,t){if(N&&(!e.state.draggingText||+new Date-os<100)){se(t);return}if(Ie(e,t)||kr(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!P){var n=a("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",y&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),y&&n.parentNode.removeChild(n)}}function Dl(e,t){var n=un(e,t);if(!n)return;var r=document.createDocumentFragment();bo(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)),u(e.display.dragCursor,r)}function ss(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function ls(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 A=0;A<n.length;A++)e(n[A])})}var us=!1;function _l(){if(us)return;Ol(),us=!0}function Ol(){var e;Se(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,ls(Rl)},100))}),Se(window,"blur",function(){return ls(Pn)})}function Rl(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var $r={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"},vi=0;vi<10;vi++)$r[vi+48]=$r[vi+96]=String(vi);for(var Zi=65;Zi<=90;Zi++)$r[Zi]=String.fromCharCode(Zi);for(var yi=1;yi<=12;yi++)$r[yi+111]=$r[yi+63235]="F"+yi;var Mr={};Mr.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"},Mr.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"},Mr.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"},Mr.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"]},Mr.default=l?Mr.macDefault:Mr.pcDefault;function Pl(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var n,r,i,A,j=0;j<t.length-1;j++){var G=t[j];if(/^(cmd|meta|m)$/i.test(G))A=!0;else if(/^a(lt)?$/i.test(G))n=!0;else if(/^(c|ctrl|control)$/i.test(G))r=!0;else if(/^s(hift)?$/i.test(G))i=!0;else throw new Error("Unrecognized modifier name: "+G)}return n&&(e="Alt-"+e),r&&(e="Ctrl-"+e),A&&(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),A=0;A<i.length;A++){var j=void 0,G=void 0;A==i.length-1?(G=i.join(" "),j=r):(G=i.slice(0,A+1).join(" "),j="...");var V=t[G];if(!V)t[G]=j;else if(V!=j)throw new Error("Inconsistent bindings for "+G)}delete e[n]}for(var Y in t)e[Y]=t[Y];return e}function jn(e,t,n,r){t=qi(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 jn(e,t.fallthrough,n,r);for(var A=0;A<t.fallthrough.length;A++){var j=jn(e,t.fallthrough[A],n,r);if(j)return j}}}function ds(e){var t=typeof e=="string"?e:$r[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function cs(e,t,n){var r=e;return t.altKey&&r!="Alt"&&(e="Alt-"+e),(f?t.metaKey:t.ctrlKey)&&r!="Ctrl"&&(e="Ctrl-"+e),(f?t.ctrlKey:t.metaKey)&&r!="Mod"&&(e="Cmd-"+e),!n&&t.shiftKey&&r!="Shift"&&(e="Shift-"+e),e}function fs(e,t){if(y&&e.keyCode==34&&e.char)return!1;var n=$r[e.keyCode];return n==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(n=e.code),cs(n,e,t))}function qi(e){return typeof e=="string"?Mr[e]:e}function Wn(e,t){for(var n=e.doc.sel.ranges,r=[],i=0;i<n.length;i++){for(var A=t(n[i]);r.length&&ft(A.from,$(r).to)<=0;){var j=r.pop();if(ft(j.from,A.from)<0){A.from=j.from;break}}r.push(A)}ur(e,function(){for(var G=r.length-1;G>=0;G--)Nn(e.doc,"",r[G].from,r[G].to,"+delete");kn(e)})}function Na(e,t,n){var r=Pe(e.text,t+n,n);return r<0||r>e.text.length?null:r}function Ba(e,t,n){var r=Na(e,t.ch,n);return r==null?null:new Ne(t.line,r,n<0?"after":"before")}function ja(e,t,n,r,i){if(e){t.doc.direction=="rtl"&&(i=-i);var A=We(n,t.doc.direction);if(A){var j=i<0?$(A):A[0],G=i<0==(j.level==1),V=G?"after":"before",Y;if(j.level>0||t.doc.direction=="rtl"){var oe=_n(t,n);Y=i<0?n.text.length-1:0;var ue=Lr(t,oe,Y).top;Y=Ze(function(xe){return Lr(t,oe,xe).top==ue},i<0==(j.level==1)?j.from:j.to-1,Y),V=="before"&&(Y=Na(n,Y,1))}else Y=i<0?j.to:j.from;return new Ne(r,Y,V)}}return new Ne(r,i<0?n.text.length:0,i<0?"before":"after")}function Ml(e,t,n,r){var i=We(t,e.doc.direction);if(!i)return Ba(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 A=He(i,n.ch,n.sticky),j=i[A];if(e.doc.direction=="ltr"&&j.level%2==0&&(r>0?j.to>n.ch:j.from<n.ch))return Ba(t,n,r);var G=function(Xe,et){return Na(t,Xe instanceof Ne?Xe.ch:Xe,et)},V,Y=function(Xe){return e.options.lineWrapping?(V=V||_n(e,t),po(e,t,V,Xe)):{begin:0,end:t.text.length}},oe=Y(n.sticky=="before"?G(n,-1):n.ch);if(e.doc.direction=="rtl"||j.level==1){var ue=j.level==1==r<0,xe=G(n,ue?1:-1);if(xe!=null&&(ue?xe<=j.to&&xe<=oe.end:xe>=j.from&&xe>=oe.begin)){var be=ue?"before":"after";return new Ne(n.line,xe,be)}}var Re=function(Xe,et,Ye){for(var nt=function(Ot,Vt){return Vt?new Ne(n.line,G(Ot,1),"before"):new Ne(n.line,Ot,"after")};Xe>=0&&Xe<i.length;Xe+=et){var dt=i[Xe],lt=et>0==(dt.level!=1),gt=lt?Ye.begin:G(Ye.end,-1);if(dt.from<=gt&><dt.to)return nt(gt,lt);if(gt=lt?dt.from:G(dt.to,-1),Ye.begin<=gt&><Ye.end)return nt(gt,lt)}},Ue=Re(A+r,r,oe);if(Ue)return Ue;var je=r>0?oe.end:G(oe.begin,-1);return je!=null&&!(r>0&&je==t.text.length)&&(Ue=Re(r>0?0:i.length-1,r,Y(je)),Ue)?Ue:null}var bi={selectAll:Qo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),pe)},killLine:function(e){return Wn(e,function(t){if(t.empty()){var n=st(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line<e.lastLine()?{from:t.head,to:Ne(t.head.line+1,0)}:{from:t.head,to:Ne(t.head.line,n)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return Wn(e,function(t){return{from:Ne(t.from().line,0),to:mt(e.doc,Ne(t.to().line+1,0))}})},delLineLeft:function(e){return Wn(e,function(t){return{from:Ne(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return Wn(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 Wn(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(Ne(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(Ne(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return hs(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return ms(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")},ce)},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")},ce)},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/)?ms(e,t.head):r},ce)},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 A=n[i].from(),j=H(e.getLine(A.line),A.ch,r);t.push(me(r-j%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return ur(e,function(){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++){if(!t[r].empty())continue;var i=t[r].head,A=st(e.doc,i.line).text;if(A){if(i.ch==A.length&&(i=new Ne(i.line,i.ch-1)),i.ch>0)i=new Ne(i.line,i.ch+1),e.replaceRange(A.charAt(i.ch-1)+A.charAt(i.ch-2),Ne(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var j=st(e.doc,i.line-1).text;j&&(i=new Ne(i.line,1),e.replaceRange(A.charAt(0)+e.doc.lineSeparator()+j.charAt(j.length-1),Ne(i.line-1,j.length-1),i,"+transpose"))}}n.push(new wt(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){return ur(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);kn(e)})},openLine:function(e){return e.replaceSelection(`
|
|
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function hs(e,t){var n=st(e.doc,t),r=$t(n);return r!=n&&(t=St(r)),ja(!0,e,r,t,1)}function Il(e,t){var n=st(e.doc,t),r=jr(n);return r!=n&&(t=St(r)),ja(!0,e,n,t,-1)}function ms(e,t){var n=hs(e,t.line),r=st(e.doc,n.line),i=We(r,e.doc.direction);if(!i||i[0].level==0){var A=Math.max(n.ch,r.text.search(/\S/)),j=t.line==n.line&&t.ch<=A&&t.ch;return Ne(n.line,j?0:A,n.sticky)}return n}function ea(e,t,n){if(typeof t=="string"&&(t=bi[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)!=ve}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=jn(t,e.state.keyMaps[r],n,e);if(i)return i}return e.options.extraKeys&&jn(t,e.options.extraKeys,n,e)||jn(t,e.options.keyMap,n,e)}var Fl=new X;function Ei(e,t,n,r){var i=e.state.keySeq;if(i){if(ds(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())}),ps(e,i+" "+t,n,r))return!0}return ps(e,t,n,r)}function ps(e,t,n,r){var i=Ul(e,t,r);return i=="multi"&&(e.state.keySeq=t),i=="handled"&&Dt(e,"keyHandled",e,t,n),(i=="handled"||i=="multi")&&(Q(n),Sa(e)),!!i}function gs(e,t){var n=fs(t,!0);return n?t.shiftKey&&!e.state.keySeq?Ei(e,"Shift-"+n,t,function(r){return ea(e,r,!0)})||Ei(e,n,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return ea(e,r)}):Ei(e,n,t,function(r){return ea(e,r)}):!1}function Nl(e,t,n){return Ei(e,"'"+n+"'",t,function(r){return ea(e,r,!0)})}var Wa=null;function vs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=_(),Ie(t,e))return;N&&I<11&&e.keyCode==27&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=n==16||e.shiftKey;var r=gs(t,e);y&&(Wa=r?n:null,!r&&n==88&&!xt&&(l?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),D&&!l&&!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;U(t,"CodeMirror-crosshair");function n(r){(r.keyCode==18||!r.altKey)&&(m(t,"CodeMirror-crosshair"),Qe(document,"keyup",n),Qe(document,"mouseover",n))}Se(document,"keyup",n),Se(document,"mouseover",n)}function ys(e){e.keyCode==16&&(this.doc.sel.shift=!1),Ie(this,e)}function bs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(kr(t.display,e)||Ie(t,e)||e.ctrlKey&&!e.altKey||l&&e.metaKey)return;var n=e.keyCode,r=e.charCode;if(y&&n==Wa){Wa=null,Q(e);return}if(y&&(!e.which||e.which<10)&&gs(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,Ha=function(e,t,n){this.time=e,this.pos=t,this.button=n};Ha.prototype.compare=function(e,t,n){return this.time+jl>e&&ft(t,this.pos)==0&&n==this.button};var xi,Ti;function Wl(e,t){var n=+new Date;return Ti&&Ti.compare(n,e,t)?(xi=Ti=null,"triple"):xi&&xi.compare(n,e,t)?(Ti=new Ha(n,e,t),xi=null,"double"):(xi=new Ha(n,e,t),Ti=null,"single")}function Es(e){var t=this,n=t.display;if(Ie(t,e)||n.activeTouch&&n.input.supportsTouch())return;if(n.input.ensurePolled(),n.shift=e.shiftKey,kr(n,e)){R||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(Ka(t,e))return;var r=un(t,e),i=De(e),A=r?Wl(r,i):"single";if(window.focus(),i==1&&t.state.selectingText&&t.state.selectingText(e),r&&Hl(t,i,r,A,e))return;i==1?r?Gl(t,r,A,e):Te(e)==n.scroller&&Q(e):i==2?(r&&Yi(t.doc,r),setTimeout(function(){return n.input.focus()},20)):i==3&&(L?t.display.input.onContextMenu(e):xo(t))}function Hl(e,t,n,r,i){var A="Click";return r=="double"?A="Double"+A:r=="triple"&&(A="Triple"+A),A=(t==1?"Left":t==2?"Middle":"Right")+A,Ei(e,cs(A,i),i,function(j){if(typeof j=="string"&&(j=bi[j]),!j)return!1;var G=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),G=j(e,n)!=ve}finally{e.state.suppressEdits=!1}return G})}function Kl(e,t,n){var r=e.getOption("configureMouse"),i=r?r(e,t,n):{};if(i.unit==null){var A=s?n.shiftKey&&n.metaKey:n.altKey;i.unit=A?"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=l?n.metaKey:n.ctrlKey),i.moveOnDrag==null&&(i.moveOnDrag=!(l?n.altKey:n.ctrlKey)),i}function Gl(e,t,n,r){N?setTimeout(k(Eo,e),0):e.curOp.focus=_();var i=Kl(e,n,r),A=e.doc.sel,j;e.options.dragDrop&&Oe&&!e.isReadOnly()&&n=="single"&&(j=A.contains(t))>-1&&(ft((j=A.ranges[j]).from(),t)<0||t.xRel>0)&&(ft(j.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,A=!1,j=Gt(e,function(Y){R&&(i.scroller.draggable=!1),e.state.draggingText=!1,Qe(i.wrapper.ownerDocument,"mouseup",j),Qe(i.wrapper.ownerDocument,"mousemove",G),Qe(i.scroller,"dragstart",V),Qe(i.scroller,"drop",j),A||(Q(Y),r.addNew||Yi(e.doc,n,null,null,r.extend),R&&!P||N&&I==9?setTimeout(function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()},20):i.input.focus())}),G=function(Y){A=A||Math.abs(t.clientX-Y.clientX)+Math.abs(t.clientY-Y.clientY)>=10},V=function(){return A=!0};R&&(i.scroller.draggable=!0),e.state.draggingText=j,j.copy=!r.moveOnDrag,i.scroller.dragDrop&&i.scroller.dragDrop(),Se(i.wrapper.ownerDocument,"mouseup",j),Se(i.wrapper.ownerDocument,"mousemove",G),Se(i.scroller,"dragstart",V),Se(i.scroller,"drop",j),xo(e),setTimeout(function(){return i.input.focus()},20)}function xs(e,t,n){if(n=="char")return new wt(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new wt(Ne(t.line,0),mt(e.doc,Ne(t.line+1,0)));var r=n(e,t);return new wt(r.from,r.to)}function Vl(e,t,n,r){var i=e.display,A=e.doc;Q(t);var j,G,V=A.sel,Y=V.ranges;if(r.addNew&&!r.extend?(G=A.sel.contains(n),G>-1?j=Y[G]:j=new wt(n,n)):(j=A.sel.primary(),G=A.sel.primIndex),r.unit=="rectangle")r.addNew||(j=new wt(n,n)),n=un(e,t,!0,!0),G=-1;else{var oe=xs(e,n,r.unit);r.extend?j=Ua(j,oe.anchor,oe.head,r.extend):j=oe}r.addNew?G==-1?(G=Y.length,Qt(A,Er(e,Y.concat([j]),G),{scroll:!1,origin:"*mouse"})):Y.length>1&&Y[G].empty()&&r.unit=="char"&&!r.extend?(Qt(A,Er(e,Y.slice(0,G).concat(Y.slice(G+1)),0),{scroll:!1,origin:"*mouse"}),V=A.sel):Fa(A,G,j,he):(G=0,Qt(A,new hr([j],0),he),V=A.sel);var ue=n;function xe(Ye){if(ft(ue,Ye)==0)return;if(ue=Ye,r.unit=="rectangle"){for(var nt=[],dt=e.options.tabSize,lt=H(st(A,n.line).text,n.ch,dt),gt=H(st(A,Ye.line).text,Ye.ch,dt),Ot=Math.min(lt,gt),Vt=Math.max(lt,gt),Mt=Math.min(n.line,Ye.line),dr=Math.min(e.lastLine(),Math.max(n.line,Ye.line));Mt<=dr;Mt++){var nr=st(A,Mt).text,Bt=fe(nr,Ot,dt);Ot==Vt?nt.push(new wt(Ne(Mt,Bt),Ne(Mt,Bt))):nr.length>Bt&&nt.push(new wt(Ne(Mt,Bt),Ne(Mt,fe(nr,Vt,dt))))}nt.length||nt.push(new wt(n,n)),Qt(A,Er(e,V.ranges.slice(0,G).concat(nt),G),{origin:"*mouse",scroll:!1}),e.scrollIntoView(Ye)}else{var ir=j,Yt=xs(e,Ye,r.unit),Ht=ir.anchor,jt;ft(Yt.anchor,Ht)>0?(jt=Yt.head,Ht=bn(ir.from(),Yt.anchor)):(jt=Yt.anchor,Ht=tn(ir.to(),Yt.head));var Ut=V.ranges.slice(0);Ut[G]=Xl(e,new wt(mt(A,Ht),jt)),Qt(A,Er(e,Ut,G),he)}}var be=i.wrapper.getBoundingClientRect(),Re=0;function Ue(Ye){var nt=++Re,dt=un(e,Ye,!0,r.unit=="rectangle");if(!dt)return;if(ft(dt,ue)!=0){e.curOp.focus=_(),xe(dt);var lt=Hi(i,A);(dt.line>=lt.to||dt.line<lt.from)&&setTimeout(Gt(e,function(){Re==nt&&Ue(Ye)}),150)}else{var gt=Ye.clientY<be.top?-20:Ye.clientY>be.bottom?20:0;gt&&setTimeout(Gt(e,function(){if(Re!=nt)return;i.scroller.scrollTop+=gt,Ue(Ye)}),50)}}function je(Ye){e.state.selectingText=!1,Re=Infinity,Ye&&(Q(Ye),i.input.focus()),Qe(i.wrapper.ownerDocument,"mousemove",Xe),Qe(i.wrapper.ownerDocument,"mouseup",et),A.history.lastSelOrigin=null}var Xe=Gt(e,function(Ye){Ye.buttons===0||!De(Ye)?je(Ye):Ue(Ye)}),et=Gt(e,je);e.state.selectingText=et,Se(i.wrapper.ownerDocument,"mousemove",Xe),Se(i.wrapper.ownerDocument,"mouseup",et)}function Xl(e,t){var n=t.anchor,r=t.head,i=st(e.doc,n.line);if(ft(n,r)==0&&n.sticky==r.sticky)return t;var A=We(i);if(!A)return t;var j=He(A,n.ch,n.sticky),G=A[j];if(G.from!=n.ch&&G.to!=n.ch)return t;var V=j+(G.from==n.ch==(G.level!=1)?0:1);if(V==0||V==A.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=He(A,r.ch,r.sticky),ue=oe-j||(r.ch-n.ch)*(G.level==1?-1:1);oe==V-1||oe==V?Y=ue<0:Y=ue>0}var xe=A[V+(Y?-1:0)],be=Y==(xe.level==1),Re=be?xe.from:xe.to,Ue=be?"after":"before";return n.ch==Re&&n.sticky==Ue?t:new wt(new Ne(n.line,Re,Ue),r)}function Ts(e,t,n,r){var i,A;if(t.touches)i=t.touches[0].clientX,A=t.touches[0].clientY;else try{i=t.clientX,A=t.clientY}catch(xe){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&Q(t);var j=e.display,G=j.lineDiv.getBoundingClientRect();if(A>G.bottom||!le(e,n))return re(t);A-=G.top-j.viewOffset;for(var V=0;V<e.display.gutterSpecs.length;++V){var Y=j.gutters.childNodes[V];if(Y&&Y.getBoundingClientRect().right>=i){var oe=wr(e.doc,A),ue=e.display.gutterSpecs[V];return Ae(e,n,e,oe,ue.className,t),re(t)}}}function Ka(e,t){return Ts(e,t,"gutterClick",!0)}function Ss(e,t){if(kr(e.display,t)||Yl(e,t))return;if(Ie(e,t,"contextmenu"))return;L||e.display.input.onContextMenu(t)}function Yl(e,t){return le(e,"gutterContextMenu")?Ts(e,t,"gutterContextMenu",!1):!1}function ws(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),ri(e)}var Hn={toString:function(){return"CodeMirror.Init"}},Cs={},ta={};function $l(e){var t=e.optionHandlers;function n(r,i,A,j){e.defaults[r]=i,A&&(t[r]=j?function(G,V,Y){Y!=Hn&&A(G,V,Y)}:A)}e.defineOption=n,e.Init=Hn,n("value","",function(r,i){return r.setValue(i)},!0),n("mode",null,function(r,i){r.doc.modeOption=i,ka(r)},!0),n("indentUnit",2,ka,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(r){di(r),ri(r),tr(r)},!0),n("lineSeparator",null,function(r,i){if(r.doc.lineSep=i,!i)return;var A=[],j=r.doc.first;r.doc.iter(function(V){for(var Y=0;;){var oe=V.text.indexOf(i,Y);if(oe==-1)break;Y=oe+i.length,A.push(Ne(j,oe))}j++});for(var G=A.length-1;G>=0;G--)Nn(r.doc,i,A[G],Ne(A[G].line,A[G].ch+i.length))}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(r,i,A){r.state.specialChars=new RegExp(i.source+(i.test(" ")?"":"| "),"g"),A!=Hn&&r.refresh()}),n("specialCharPlaceholder",ot,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){ws(r),ui(r)},!0),n("keyMap","default",function(r,i,A){var j=qi(i),G=A!=Hn&&qi(A);G&&G.detach&&G.detach(r,j),j.attach&&j.attach(r,G||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Jl,!0),n("gutters",[],function(r,i){r.display.gutterSpecs=Ra(i,r.options.lineNumbers),ui(r)},!0),n("fixedGutter",!0,function(r,i){r.display.gutters.style.left=i?xa(r.display)+"px":"0",r.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(r){return Mn(r)},!0),n("scrollbarStyle","native",function(r){Lo(r),Mn(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=Ra(r.options.gutters,i),ui(r)},!0),n("firstLineNumber",1,ui,!0),n("lineNumberFormatter",function(r){return r},ui,!0),n("showCursorWhenSelecting",!1,ni,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,function(r,i){i=="nocursor"&&(Pn(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,Ql),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,ni,!0),n("singleCursorHeightPerLine",!0,ni,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,di,!0),n("addModeClass",!1,di,!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,di,!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 Ql(e,t,n){var r=n&&n!=Hn;if(!t!=!r){var i=e.display.dragFunctions,A=t?Se:Qe;A(e.display.scroller,"dragstart",i.start),A(e.display.scroller,"dragenter",i.enter),A(e.display.scroller,"dragover",i.over),A(e.display.scroller,"dragleave",i.leave),A(e.display.scroller,"drop",i.drop)}}function Jl(e){e.options.lineWrapping?(U(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(m(e.display.wrapper,"CodeMirror-wrap"),Rr(e)),Ta(e),tr(e),ri(e),setTimeout(function(){return Mn(e)},100)}function Pt(e,t){var n=this;if(!(this instanceof Pt))return new Pt(e,t);this.options=t=t?M(t):{},M(Cs,t,!1);var r=t.value;typeof r=="string"?r=new rr(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var i=new Pt.inputStyles[t.inputStyle](this),A=this.display=new dl(e,r,i,t);A.wrapper.CodeMirror=this,ws(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Lo(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&&A.input.focus(),N&&I<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Zl(this),_l(),hn(this),this.curOp.forceUpdate=!0,Fo(this,r),t.autofocus&&!o||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&wa(n)},20):Pn(this);for(var j in ta)ta.hasOwnProperty(j)&&ta[j](this,t[j],Hn);Oo(this),t.finishInit&&t.finishInit(this);for(var G=0;G<Ga.length;++G)Ga[G](this);mn(this),R&&t.lineWrapping&&getComputedStyle(A.lineDiv).textRendering=="optimizelegibility"&&(A.lineDiv.style.textRendering="auto")}Pt.defaults=Cs,Pt.optionHandlers=ta;function Zl(e){var t=e.display;Se(t.scroller,"mousedown",Gt(e,Es)),N&&I<11?Se(t.scroller,"dblclick",Gt(e,function(V){if(Ie(e,V))return;var Y=un(e,V);if(!Y||Ka(e,V)||kr(e.display,V))return;Q(V);var oe=e.findWordAt(Y);Yi(e.doc,oe.anchor,oe.head)})):Se(t.scroller,"dblclick",function(V){return Ie(e,V)||Q(V)}),Se(t.scroller,"contextmenu",function(V){return Ss(e,V)}),Se(t.input.getField(),"contextmenu",function(V){t.scroller.contains(V.target)||Ss(e,V)});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 A(V){if(V.touches.length!=1)return!1;var Y=V.touches[0];return Y.radiusX<=1&&Y.radiusY<=1}function j(V,Y){if(Y.left==null)return!0;var oe=Y.left-V.left,ue=Y.top-V.top;return oe*oe+ue*ue>20*20}Se(t.scroller,"touchstart",function(V){if(!Ie(e,V)&&!A(V)&&!Ka(e,V)){t.input.ensurePolled(),clearTimeout(n);var Y=+new Date;t.activeTouch={start:Y,moved:!1,prev:Y-r.end<=300?r:null},V.touches.length==1&&(t.activeTouch.left=V.touches[0].pageX,t.activeTouch.top=V.touches[0].pageY)}}),Se(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Se(t.scroller,"touchend",function(V){var Y=t.activeTouch;if(Y&&!kr(t,V)&&Y.left!=null&&!Y.moved&&new Date-Y.start<300){var oe=e.coordsChar(t.activeTouch,"page"),ue;!Y.prev||j(Y,Y.prev)?ue=new wt(oe,oe):!Y.prev.prev||j(Y,Y.prev.prev)?ue=e.findWordAt(oe):ue=new wt(Ne(oe.line,0),mt(e.doc,Ne(oe.line+1,0))),e.setSelection(ue.anchor,ue.head),e.focus(),Q(V)}i()}),Se(t.scroller,"touchcancel",i),Se(t.scroller,"scroll",function(){t.scroller.clientHeight&&(ai(e,t.scroller.scrollTop),cn(e,t.scroller.scrollLeft,!0),Ae(e,"scroll",e))}),Se(t.scroller,"mousewheel",function(V){return ko(e,V)}),Se(t.scroller,"DOMMouseScroll",function(V){return ko(e,V)}),Se(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(V){Ie(e,V)||se(V)},over:function(V){Ie(e,V)||(Dl(e,V),se(V))},start:function(V){return Ll(e,V)},drop:Gt(e,Al),leave:function(V){Ie(e,V)||ss(e)}};var G=t.input.getField();Se(G,"keyup",function(V){return ys.call(e,V)}),Se(G,"keydown",Gt(e,vs)),Se(G,"keypress",Gt(e,bs)),Se(G,"focus",function(V){return wa(e,V)}),Se(G,"blur",function(V){return Pn(e,V)})}var Ga=[];Pt.defineInitHook=function(e){return Ga.push(e)};function Si(e,t,n,r){var i=e.doc,A;n==null&&(n="add"),n=="smart"&&(i.mode.indent?A=Be(e,t).state:n="prev");var j=e.options.tabSize,G=st(i,t),V=H(G.text,null,j);G.stateAfter&&(G.stateAfter=null);var Y=G.text.match(/^\s*/)[0],oe;if(!r&&!/\S/.test(G.text))oe=0,n="not";else if(n=="smart"&&(oe=i.mode.indent(A,G.text.slice(Y.length),G.text),oe==ve||oe>150)){if(!r)return;n="prev"}n=="prev"?t>i.first?oe=H(st(i,t-1).text,null,j):oe=0:n=="add"?oe=V+e.options.indentUnit:n=="subtract"?oe=V-e.options.indentUnit:typeof n=="number"&&(oe=V+n),oe=Math.max(0,oe);var ue="",xe=0;if(e.options.indentWithTabs)for(var be=Math.floor(oe/j);be;--be)xe+=j,ue+=" ";if(xe<oe&&(ue+=me(oe-xe)),ue!=Y)return Nn(i,ue,Ne(t,0),Ne(t,Y.length),"+input"),G.stateAfter=null,!0;for(var Re=0;Re<i.sel.ranges.length;Re++){var Ue=i.sel.ranges[Re];if(Ue.head.line==t&&Ue.head.ch<Y.length){var je=Ne(t,Y.length);Fa(i,Re,new wt(je,je));break}}}var xr=null;function ra(e){xr=e}function za(e,t,n,r,i){var A=e.doc;e.display.shift=!1,r||(r=A.sel);var j=+new Date-200,G=i=="paste"||e.state.pasteIncoming>j,V=at(t),Y=null;if(G&&r.ranges.length>1)if(xr&&xr.text.join(`
|
|
`)==t){if(r.ranges.length%xr.text.length==0){Y=[];for(var oe=0;oe<xr.text.length;oe++)Y.push(A.splitLines(xr.text[oe]))}}else V.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(Y=ae(V,function(Xe){return[Xe]}));for(var ue=e.curOp.updateInput,xe=r.ranges.length-1;xe>=0;xe--){var be=r.ranges[xe],Re=be.from(),Ue=be.to();be.empty()&&(n&&n>0?Re=Ne(Re.line,Re.ch-n):e.state.overwrite&&!G?Ue=Ne(Ue.line,Math.min(st(A,Ue.line).text.length,Ue.ch+$(V).length)):G&&xr&&xr.lineWise&&xr.text.join(`
|
|
`)==V.join(`
|
|
`)&&(Re=Ue=Ne(Re.line,0)));var je={from:Re,to:Ue,text:Y?Y[xe%Y.length]:V,origin:i||(G?"paste":e.state.cutIncoming>j?"cut":"+input")};Fn(e.doc,je),Dt(e,"inputRead",e,je)}t&&!G&&Ls(e,t),kn(e),e.curOp.updateInput<2&&(e.curOp.updateInput=ue),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function As(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&ur(t,function(){return za(t,n,0,null,"paste")}),!0}function Ls(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 A=e.getModeAt(i.head),j=!1;if(A.electricChars){for(var G=0;G<A.electricChars.length;G++)if(t.indexOf(A.electricChars.charAt(G))>-1){j=Si(e,i.head.line,"smart");break}}else A.electricInput&&(A.electricInput.test(st(e.doc,i.head.line).text.slice(0,i.head.ch))&&(j=Si(e,i.head.line,"smart")));j&&Dt(e,"electricInput",e,i.head.line)}}function Ds(e){for(var t=[],n=[],r=0;r<e.doc.sel.ranges.length;r++){var i=e.doc.sel.ranges[r].head.line,A={anchor:Ne(i,0),head:Ne(i+1,0)};n.push(A),t.push(e.getRange(A.anchor,A.head))}return{text:t,ranges:n}}function _s(e,t,n,r){e.setAttribute("autocorrect",n?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function Os(){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 R?e.style.width="1000px":e.setAttribute("wrap","off"),v&&(e.style.border="1px solid black"),_s(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 A=this.options,j=A[r];if(A[r]==i&&r!="mode")return;A[r]=i,t.hasOwnProperty(r)&&Gt(this,t[r])(this,i,j),Ae(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"](qi(r))},removeKeyMap:function(r){for(var i=this.state.keyMaps,A=0;A<i.length;++A)if(i[A]==r||i[A].name==r)return i.splice(A,1),!0},addOverlay:qt(function(r,i){var A=r.token?r:e.getMode(this.options,r);if(A.startState)throw new Error("Overlays may not be stateful.");q(this.state.overlays,{mode:A,modeSpec:r,opaque:i&&i.opaque,priority:i&&i.priority||0},function(j){return j.priority}),this.state.modeGen++,tr(this)}),removeOverlay:qt(function(r){for(var i=this.state.overlays,A=0;A<i.length;++A){var j=i[A].modeSpec;if(j==r||typeof r=="string"&&j.name==r){i.splice(A,1),this.state.modeGen++,tr(this);return}}}),indentLine:qt(function(r,i,A){typeof i!="string"&&typeof i!="number"&&(i==null?i=this.options.smartIndent?"smart":"prev":i=i?"add":"subtract"),Zr(this.doc,r)&&Si(this,r,i,A)}),indentSelection:qt(function(r){for(var i=this.doc.sel.ranges,A=-1,j=0;j<i.length;j++){var G=i[j];if(G.empty())G.head.line>A&&(Si(this,G.head.line,r,!0),A=G.head.line,j==this.doc.sel.primIndex&&kn(this));else{var V=G.from(),Y=G.to(),oe=Math.max(A,V.line);A=Math.min(this.lastLine(),Y.line-(Y.ch?0:1))+1;for(var ue=oe;ue<A;++ue)Si(this,ue,r);var xe=this.doc.sel.ranges;V.ch==0&&i.length==xe.length&&xe[j].from().ch>0&&Fa(this.doc,j,new wt(V,xe[j].to()),pe)}}}),getTokenAt:function(r,i){return Ur(this,r,i)},getLineTokens:function(r,i){return Ur(this,Ne(r),i,!0)},getTokenTypeAt:function(r){r=mt(this.doc,r);var i=Yn(this,st(this.doc,r.line)),A=0,j=(i.length-1)/2,G=r.ch,V;if(G==0)V=i[2];else for(;;){var Y=A+j>>1;if((Y?i[Y*2-1]:0)>=G)j=Y;else if(i[Y*2+1]<G)A=Y+1;else{V=i[Y*2+2];break}}var oe=V?V.indexOf("overlay "):-1;return oe<0?V:oe==0?null:V.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 A=[];if(!n.hasOwnProperty(i))return A;var j=n[i],G=this.getModeAt(r);if(typeof G[i]=="string")j[G[i]]&&A.push(j[G[i]]);else if(G[i])for(var V=0;V<G[i].length;V++){var Y=j[G[i][V]];Y&&A.push(Y)}else G.helperType&&j[G.helperType]?A.push(j[G.helperType]):j[G.name]&&A.push(j[G.name]);for(var oe=0;oe<j._global.length;oe++){var ue=j._global[oe];ue.pred(G,this)&&ee(A,ue.val)==-1&&A.push(ue.val)}return A},getStateAfter:function(r,i){var A=this.doc;return r=Xn(A,r==null?A.first+A.size-1:r),Be(this,r+1,i).state},cursorCoords:function(r,i){var A,j=this.doc.sel.primary();return r==null?A=j.head:typeof r=="object"?A=mt(this.doc,r):A=r?j.from():j.to(),br(this,A,i||"page")},charCoords:function(r,i){return ga(this,mt(this.doc,r),i||"page")},coordsChar:function(r,i){return r=fo(this,r,i||"page"),ya(this,r.left,r.top)},lineAtHeight:function(r,i){return r=fo(this,{top:r,left:0},i||"page").top,wr(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,i,A){var j=!1,G;if(typeof r=="number"){var V=this.doc.first+this.doc.size-1;r<this.doc.first?r=this.doc.first:r>V&&(r=V,j=!0),G=st(this.doc,r)}else G=r;return Ni(this,G,{top:0,left:0},i||"page",A||j).top+(j?this.doc.height-lr(G):0)},defaultTextHeight:function(){return On(this.display)},defaultCharWidth:function(){return Rn(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,i,A,j,G){var V=this.display;r=br(this,mt(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),V.sizer.appendChild(i),j=="over")Y=r.top;else if(j=="above"||j=="near"){var ue=Math.max(V.wrapper.clientHeight,this.doc.height),xe=Math.max(V.sizer.clientWidth,V.lineSpace.clientWidth);(j=="above"||r.bottom+i.offsetHeight>ue)&&r.top>i.offsetHeight?Y=r.top-i.offsetHeight:r.bottom+i.offsetHeight<=ue&&(Y=r.bottom),oe+i.offsetWidth>xe&&(oe=xe-i.offsetWidth)}i.style.top=Y+"px",i.style.left=i.style.right="",G=="right"?(oe=V.sizer.clientWidth-i.offsetWidth,i.style.right="0px"):(G=="left"?oe=0:G=="middle"&&(oe=(V.sizer.clientWidth-i.offsetWidth)/2),i.style.left=oe+"px"),A&&Qs(this,{left:oe,top:Y,right:oe+i.offsetWidth,bottom:Y+i.offsetHeight})},triggerOnKeyDown:qt(vs),triggerOnKeyPress:qt(bs),triggerOnKeyUp:ys,triggerOnMouseDown:qt(Es),execCommand:function(r){if(bi.hasOwnProperty(r))return bi[r].call(null,this)},triggerElectric:qt(function(r){Ls(this,r)}),findPosH:function(r,i,A,j){var G=1;i<0&&(G=-1,i=-i);for(var V=mt(this.doc,r),Y=0;Y<i&&!(V=Va(this.doc,V,G,A,j),V.hitSide);++Y);return V},moveH:qt(function(r,i){var A=this;this.extendSelectionsBy(function(j){return A.display.shift||A.doc.extend||j.empty()?Va(A.doc,j.head,r,i,A.options.rtlMoveVisually):r<0?j.from():j.to()},ce)}),deleteH:qt(function(r,i){var A=this.doc.sel,j=this.doc;A.somethingSelected()?j.replaceSelection("",null,"+delete"):Wn(this,function(G){var V=Va(j,G.head,r,i,!1);return r<0?{from:V,to:G.head}:{from:G.head,to:V}})}),findPosV:function(r,i,A,j){var G=1,V=j;i<0&&(G=-1,i=-i);for(var Y=mt(this.doc,r),oe=0;oe<i;++oe){var ue=br(this,Y,"div");if(V==null?V=ue.left:ue.left=V,Y=Rs(this,ue,G,A),Y.hitSide)break}return Y},moveV:qt(function(r,i){var A=this,j=this.doc,G=[],V=!this.display.shift&&!j.extend&&j.sel.somethingSelected();if(j.extendSelectionsBy(function(oe){if(V)return r<0?oe.from():oe.to();var ue=br(A,oe.head,"div");oe.goalColumn!=null&&(ue.left=oe.goalColumn),G.push(ue.left);var xe=Rs(A,ue,r,i);return i=="page"&&oe==j.sel.primary()&&Aa(A,ga(A,xe,"div").top-ue.top),xe},ce),G.length)for(var Y=0;Y<j.sel.ranges.length;Y++)j.sel.ranges[Y].goalColumn=G[Y]}),findWordAt:function(r){var i=this.doc,A=st(i,r.line).text,j=r.ch,G=r.ch;if(A){var V=this.getHelper(r,"wordChars");(r.sticky=="before"||G==A.length)&&j?--j:++G;for(var Y=A.charAt(j),oe=Le(Y,V)?function(ue){return Le(ue,V)}:/\s/.test(Y)?function(ue){return/\s/.test(ue)}:function(ue){return!/\s/.test(ue)&&!Le(ue)};j>0&&oe(A.charAt(j-1));)--j;for(;G<A.length&&oe(A.charAt(G));)++G}return new wt(Ne(r.line,j),Ne(r.line,G))},toggleOverwrite:function(r){if(r!=null&&r==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?U(this.display.cursorDiv,"CodeMirror-overwrite"):m(this.display.cursorDiv,"CodeMirror-overwrite"),Ae(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==_()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:qt(function(r,i){ii(this,r,i)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-Ar(this)-this.display.barHeight,width:r.scrollWidth-Ar(this)-this.display.barWidth,clientHeight:ha(this),clientWidth:sn(this)}},scrollIntoView:qt(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:Ne(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?Js(this,r):So(this,r.from,r.to,r.margin)}),setSize:qt(function(r,i){var A=this,j=function(V){return typeof V=="number"||/^\d+$/.test(String(V))?V+"px":V};r!=null&&(this.display.wrapper.style.width=j(r)),i!=null&&(this.display.wrapper.style.height=j(i)),this.options.lineWrapping&&lo(this);var G=this.display.viewFrom;this.doc.iter(G,this.display.viewTo,function(V){if(V.widgets){for(var Y=0;Y<V.widgets.length;Y++)if(V.widgets[Y].noHScroll){Kr(A,G,"widget");break}}++G}),this.curOp.forceUpdate=!0,Ae(this,"refresh",this)}),operation:function(r){return ur(this,r)},startOperation:function(){return hn(this)},endOperation:function(){return mn(this)},refresh:qt(function(){var r=this.display.cachedTextHeight;tr(this),this.curOp.forceUpdate=!0,ri(this),ii(this,this.doc.scrollLeft,this.doc.scrollTop),_a(this.display),(r==null||Math.abs(r-On(this.display))>.5||this.options.lineWrapping)&&Ta(this),Ae(this,"refresh",this)}),swapDoc:qt(function(r){var i=this.doc;return i.cm=null,this.state.selectingText&&this.state.selectingText(),Fo(this,r),ri(this),this.display.input.reset(),ii(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,Dt(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}},de(e),e.registerHelper=function(r,i,A){n.hasOwnProperty(r)||(n[r]=e[r]={_global:[]}),n[r][i]=A},e.registerGlobalHelper=function(r,i,A,j){e.registerHelper(r,i,j),n[r]._global.push({pred:A,val:j})}}function Va(e,t,n,r,i){var A=t,j=n,G=st(e,t.line),V=i&&e.direction=="rtl"?-n:n;function Y(){var et=t.line+V;return et<e.first||et>=e.first+e.size?!1:(t=new Ne(et,t.ch,t.sticky),G=st(e,et))}function oe(et){var Ye;if(r=="codepoint"){var nt=G.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(nt)?Ye=null:Ye=new Ne(t.line,Math.max(0,Math.min(G.text.length,t.ch+n*(nt>=55296&&nt<56320?2:1))),-n)}else i?Ye=Ml(e.cm,G,t,n):Ye=Ba(G,t,n);if(Ye==null)if(!et&&Y())t=ja(i,e.cm,G,t.line,V);else return!1;else t=Ye;return!0}if(r=="char"||r=="codepoint")oe();else if(r=="column")oe(!0);else if(r=="word"||r=="group")for(var ue=null,xe=r=="group",be=e.cm&&e.cm.getHelper(t,"wordChars"),Re=!0;!(n<0&&!oe(!Re));Re=!1){var Ue=G.text.charAt(t.ch)||`
|
|
`,je=Le(Ue,be)?"w":xe&&Ue==`
|
|
`?"n":!xe||/\s/.test(Ue)?null:"p";if(xe&&!Re&&!je&&(je="s"),ue&&ue!=je){n<0&&(n=1,oe(),t.sticky="after");break}if(je&&(ue=je),n>0&&!oe(!Re))break}var Xe=Qi(e,t,A,j,!0);return qr(A,Xe)&&(Xe.hitSide=!0),Xe}function Rs(e,t,n,r){var i=e.doc,A=t.left,j;if(r=="page"){var G=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),V=Math.max(G-.5*On(e.display),3);j=(n>0?t.bottom:t.top)+n*V}else r=="line"&&(j=n>0?t.bottom+3:t.top-3);for(var Y;!(Y=ya(e,A,j),!Y.outside);){if(n<0?j<=0:j>=i.height){Y.hitSide=!0;break}j+=n*5}return Y}var At=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};At.prototype.init=function(e){var t=this,n=this,r=n.cm,i=n.div=e.lineDiv;_s(i,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function A(G){for(var V=G.target;V;V=V.parentNode){if(V==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(V.className))break}return!1}Se(i,"paste",function(G){if(!A(G)||Ie(r,G)||As(G,r))return;I<=11&&setTimeout(Gt(r,function(){return t.updateFromDOM()}),20)}),Se(i,"compositionstart",function(G){t.composing={data:G.data,done:!1}}),Se(i,"compositionupdate",function(G){t.composing||(t.composing={data:G.data,done:!1})}),Se(i,"compositionend",function(G){t.composing&&(G.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Se(i,"touchstart",function(){return n.forceCompositionEnd()}),Se(i,"input",function(){t.composing||t.readFromDOMSoon()});function j(G){if(!A(G)||Ie(r,G))return;if(r.somethingSelected())ra({lineWise:!1,text:r.getSelections()}),G.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var V=Ds(r);ra({lineWise:!0,text:V.text}),G.type=="cut"&&r.operation(function(){r.setSelections(V.ranges,0,pe),r.replaceSelection("",null,"cut")})}else return;if(G.clipboardData){G.clipboardData.clearData();var Y=xr.text.join(`
|
|
`);if(G.clipboardData.setData("Text",Y),G.clipboardData.getData("Text")==Y){G.preventDefault();return}}var oe=Os(),ue=oe.firstChild;r.display.lineSpace.insertBefore(oe,r.display.lineSpace.firstChild),ue.value=xr.text.join(`
|
|
`);var xe=document.activeElement;W(ue),setTimeout(function(){r.display.lineSpace.removeChild(oe),xe.focus(),xe==i&&n.showPrimarySelection()},50)}Se(i,"copy",j),Se(i,"cut",j)},At.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},At.prototype.prepareSelection=function(){var e=yo(this.cm,!1);return e.focus=document.activeElement==this.div,e},At.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},At.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},At.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 A=na(t,e.anchorNode,e.anchorOffset),j=na(t,e.focusNode,e.focusOffset);if(A&&!A.bad&&j&&!j.bad&&ft(bn(A,j),r)==0&&ft(tn(A,j),i)==0)return;var G=t.display.view,V=r.line>=t.display.viewFrom&&Ps(t,r)||{node:G[0].measure.map[2],offset:0},Y=i.line<t.display.viewTo&&Ps(t,i);if(!Y){var oe=G[G.length-1].measure,ue=oe.maps?oe.maps[oe.maps.length-1]:oe.map;Y={node:ue[ue.length-1],offset:ue[ue.length-2]-ue[ue.length-3]}}if(!V||!Y){e.removeAllRanges();return}var xe=e.rangeCount&&e.getRangeAt(0),be;try{be=g(V.node,V.offset,Y.offset,Y.node)}catch(Re){}be&&(!D&&t.state.focused?(e.collapse(V.node,V.offset),be.collapsed||(e.removeAllRanges(),e.addRange(be))):(e.removeAllRanges(),e.addRange(be)),xe&&e.anchorNode==null?e.addRange(xe):D&&this.startGracePeriod()),this.rememberSelection()},At.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)},At.prototype.showMultipleSelections=function(e){u(this.cm.display.cursorDiv,e.cursors),u(this.cm.display.selectionDiv,e.selection)},At.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},At.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return p(this.div,t)},At.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},At.prototype.blur=function(){this.div.blur()},At.prototype.getField=function(){return this.div},At.prototype.supportsTouch=function(){return!0},At.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():ur(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)},At.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},At.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(d&&h&&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=na(t,e.anchorNode,e.anchorOffset),r=na(t,e.focusNode,e.focusOffset);n&&r&&ur(t,function(){Qt(t.doc,zr(n,r),pe),(n.bad||r.bad)&&(t.curOp.selectionChanged=!0)})},At.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=Ne(r.line-1,st(e.doc,r.line-1).length)),i.ch==st(e.doc,i.line).text.length&&i.line<e.lastLine()&&(i=Ne(i.line+1,0)),r.line<t.viewFrom||i.line>t.viewTo-1)return!1;var A,j,G;r.line==t.viewFrom||(A=dn(e,r.line))==0?(j=St(t.view[0].line),G=t.view[0].node):(j=St(t.view[A].line),G=t.view[A-1].node.nextSibling);var V=dn(e,i.line),Y,oe;if(V==t.view.length-1?(Y=t.viewTo-1,oe=t.lineDiv.lastChild):(Y=St(t.view[V+1].line)-1,oe=t.view[V+1].node.previousSibling),!G)return!1;for(var ue=e.doc.splitLines(tu(e,G,oe,j,Y)),xe=Sr(e.doc,Ne(j,0),Ne(Y,st(e.doc,Y).text.length));ue.length>1&&xe.length>1;)if($(ue)==$(xe))ue.pop(),xe.pop(),Y--;else if(ue[0]==xe[0])ue.shift(),xe.shift(),j++;else break;for(var be=0,Re=0,Ue=ue[0],je=xe[0],Xe=Math.min(Ue.length,je.length);be<Xe&&Ue.charCodeAt(be)==je.charCodeAt(be);)++be;for(var et=$(ue),Ye=$(xe),nt=Math.min(et.length-(ue.length==1?be:0),Ye.length-(xe.length==1?be:0));Re<nt&&et.charCodeAt(et.length-Re-1)==Ye.charCodeAt(Ye.length-Re-1);)++Re;if(ue.length==1&&xe.length==1&&j==r.line)for(;be&&be>r.ch&&et.charCodeAt(et.length-Re-1)==Ye.charCodeAt(Ye.length-Re-1);)be--,Re++;ue[ue.length-1]=et.slice(0,et.length-Re).replace(/^\u200b+/,""),ue[0]=ue[0].slice(be).replace(/\u200b+$/,"");var dt=Ne(j,be),lt=Ne(Y,xe.length?$(xe).length-Re:0);if(ue.length>1||ue[0]||ft(dt,lt))return Nn(e.doc,ue,dt,lt,"+input"),!0},At.prototype.ensurePolled=function(){this.forceCompositionEnd()},At.prototype.reset=function(){this.forceCompositionEnd()},At.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},At.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)},At.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&ur(this.cm,function(){return tr(e.cm)})},At.prototype.setUneditable=function(e){e.contentEditable="false"},At.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||Gt(this.cm,za)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},At.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},At.prototype.onContextMenu=function(){},At.prototype.resetPosition=function(){},At.prototype.needsContentAttribute=!0;function Ps(e,t){var n=ma(e,t.line);if(!n||n.hidden)return null;var r=st(e.doc,t.line),i=no(n,r,t.line),A=We(r,e.doc.direction),j="left";if(A){var G=He(A,t.ch);j=G%2?"right":"left"}var V=oo(i.map,t.ch,j);return V.offset=V.collapse=="right"?V.end:V.start,V}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function Kn(e,t){return t&&(e.bad=!0),e}function tu(e,t,n,r,i){var A="",j=!1,G=e.doc.lineSeparator(),V=!1;function Y(be){return function(Re){return Re.id==be}}function oe(){j&&(A+=G,V&&(A+=G),j=V=!1)}function ue(be){be&&(oe(),A+=be)}function xe(be){if(be.nodeType==1){var Re=be.getAttribute("cm-text");if(Re){ue(Re);return}var Ue=be.getAttribute("cm-marker"),je;if(Ue){var Xe=e.findMarks(Ne(r,0),Ne(i+1,0),Y(+Ue));Xe.length&&(je=Xe[0].find(0))&&ue(Sr(e.doc,je.from,je.to).join(G));return}if(be.getAttribute("contenteditable")=="false")return;var et=/^(pre|div|p|li|table|br)$/i.test(be.nodeName);if(!/^br$/i.test(be.nodeName)&&be.textContent.length==0)return;et&&oe();for(var Ye=0;Ye<be.childNodes.length;Ye++)xe(be.childNodes[Ye]);/^(pre|p)$/i.test(be.nodeName)&&(V=!0),et&&(j=!0)}else be.nodeType==3&&ue(be.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(xe(t),t==n);)t=t.nextSibling,V=!1;return A}function na(e,t,n){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[n],!r)return Kn(e.clipPos(Ne(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 A=e.display.view[i];if(A.node==r)return ru(A,t,n)}}function ru(e,t,n){var r=e.text.firstChild,i=!1;if(!t||!p(r,t))return Kn(Ne(St(e.line),0),!0);if(t==r&&(i=!0,t=r.childNodes[n],n=0,!t)){var A=e.rest?$(e.rest):e.line;return Kn(Ne(St(A),A.text.length),i)}var j=t.nodeType==3?t:null,G=t;for(!j&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(j=t.firstChild,n&&(n=j.nodeValue.length));G.parentNode!=r;)G=G.parentNode;var V=e.measure,Y=V.maps;function oe(je,Xe,et){for(var Ye=-1;Ye<(Y?Y.length:0);Ye++)for(var nt=Ye<0?V.map:Y[Ye],dt=0;dt<nt.length;dt+=3){var lt=nt[dt+2];if(lt==je||lt==Xe){var gt=St(Ye<0?e.line:e.rest[Ye]),Ot=nt[dt]+et;return(et<0||lt!=je)&&(Ot=nt[dt+(et?1:0)]),Ne(gt,Ot)}}}var ue=oe(j,G,n);if(ue)return Kn(ue,i);for(var xe=G.nextSibling,be=j?j.nodeValue.length-n:0;xe;xe=xe.nextSibling){if(ue=oe(xe,xe.firstChild,0),ue)return Kn(Ne(ue.line,ue.ch-be),i);be+=xe.textContent.length}for(var Re=G.previousSibling,Ue=n;Re;Re=Re.previousSibling){if(ue=oe(Re,Re.firstChild,-1),ue)return Kn(Ne(ue.line,ue.ch+Ue),i);Ue+=Re.textContent.length}}var Ft=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new X,this.hasSelection=!1,this.composing=null};Ft.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),v&&(i.style.width="0px"),Se(i,"input",function(){N&&I>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),Se(i,"paste",function(j){if(Ie(r,j)||As(j,r))return;r.state.pasteIncoming=+new Date,n.fastPoll()});function A(j){if(Ie(r,j))return;if(r.somethingSelected())ra({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var G=Ds(r);ra({lineWise:!0,text:G.text}),j.type=="cut"?r.setSelections(G.ranges,null,pe):(n.prevInput="",i.value=G.text.join(`
|
|
`),W(i))}else return;j.type=="cut"&&(r.state.cutIncoming=+new Date)}Se(i,"cut",A),Se(i,"copy",A),Se(e.scroller,"paste",function(j){if(kr(e,j)||Ie(r,j))return;if(!i.dispatchEvent){r.state.pasteIncoming=+new Date,n.focus();return}var G=new Event("paste");G.clipboardData=j.clipboardData,i.dispatchEvent(G)}),Se(e.lineSpace,"selectstart",function(j){kr(e,j)||Q(j)}),Se(i,"compositionstart",function(){var j=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:j,range:r.markText(j,r.getCursor("to"),{className:"CodeMirror-composing"})}}),Se(i,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},Ft.prototype.createField=function(e){this.wrapper=Os(),this.textarea=this.wrapper.firstChild},Ft.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},Ft.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=yo(e);if(e.options.moveInputWithCursor){var i=br(e,n.sel.primary().head,"div"),A=t.wrapper.getBoundingClientRect(),j=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+j.top-A.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+j.left-A.left))}return r},Ft.prototype.showSelection=function(e){var t=this.cm,n=t.display;u(n.cursorDiv,e.cursors),u(n.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Ft.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),N&&I>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",N&&I>=9&&(this.hasSelection=null))},Ft.prototype.getField=function(){return this.textarea},Ft.prototype.supportsTouch=function(){return!1},Ft.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!o||_()!=this.textarea))try{this.textarea.focus()}catch(e){}},Ft.prototype.blur=function(){this.textarea.blur()},Ft.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Ft.prototype.receivedFocus=function(){this.slowPoll()},Ft.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()})},Ft.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)},Ft.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||rt(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(N&&I>=9&&this.hasSelection===i||l&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var A=i.charCodeAt(0);if(A==8203&&!r&&(r="\u200B"),A==8666)return this.reset(),this.cm.execCommand("undo")}for(var j=0,G=Math.min(r.length,i.length);j<G&&r.charCodeAt(j)==i.charCodeAt(j);)++j;return ur(t,function(){za(t,i.slice(j),r.length-j,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},Ft.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Ft.prototype.onKeyPress=function(){N&&I>=9&&(this.hasSelection=null),this.fastPoll()},Ft.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var A=un(n,e),j=r.scroller.scrollTop;if(!A||y)return;var G=n.options.resetSelectionOnContextMenu;G&&n.doc.sel.contains(A)==-1&&Gt(n,Qt)(n.doc,zr(A),pe);var V=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: `+(N?"rgba(255, 255, 255, .05)":"transparent")+`;
|
|
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var ue;R&&(ue=window.scrollY),r.input.focus(),R&&window.scrollTo(null,ue),r.input.reset(),n.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=be,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll);function xe(){if(i.selectionStart!=null){var Ue=n.somethingSelected(),je="\u200B"+(Ue?i.value:"");i.value="\u21DA",i.value=je,t.prevInput=Ue?"":"\u200B",i.selectionStart=1,i.selectionEnd=je.length,r.selForContextMenu=n.doc.sel}}function be(){if(t.contextMenuPending!=be)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=Y,i.style.cssText=V,N&&I<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=j),i.selectionStart!=null){(!N||N&&I<9)&&xe();var Ue=0,je=function(){r.selForContextMenu==n.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&t.prevInput=="\u200B"?Gt(n,Qo)(n):Ue++<10?r.detectingSelectAll=setTimeout(je,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(je,200)}}if(N&&I>=9&&xe(),L){se(e);var Re=function(){Qe(window,"mouseup",Re),setTimeout(be,20)};Se(window,"mouseup",Re)}else setTimeout(be,50)},Ft.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},Ft.prototype.setUneditable=function(){},Ft.prototype.needsContentAttribute=!1;function nu(e,t){if(t=t?M(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=_();t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function r(){e.value=G.getValue()}var i;if(e.form&&(Se(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var A=e.form;i=A.submit;try{var j=A.submit=function(){r(),A.submit=i,A.submit(),A.submit=j}}catch(V){}}t.finishInit=function(V){V.save=r,V.getTextArea=function(){return e},V.toTextArea=function(){V.toTextArea=isNaN,r(),e.parentNode.removeChild(V.getWrapperElement()),e.style.display="",e.form&&(Qe(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=i))}},e.style.display="none";var G=Pt(function(V){return e.parentNode.insertBefore(V,e.nextSibling)},t);return G}function iu(e){e.off=Qe,e.on=Se,e.wheelEventPixels=cl,e.Doc=rr,e.splitLines=at,e.countColumn=H,e.findColumn=fe,e.isWordChar=we,e.Pass=ve,e.signal=Ae,e.Line=Hr,e.changeEnd=Vr,e.scrollbarModel=Ao,e.Pos=Ne,e.cmpPos=ft,e.modes=Lt,e.mimeModes=pt,e.resolveMode=Nt,e.getMode=Tr,e.modeExtensions=vr,e.extendMode=wi,e.copyState=mr,e.startState=Jr,e.innerMode=vn,e.commands=bi,e.keyMap=Mr,e.keyName=fs,e.isModifierKey=ds,e.lookupKey=jn,e.normalizeKeyMap=kl,e.StringStream=kt,e.SharedTextMarker=gi,e.TextMarker=Yr,e.LineWidget=pi,e.e_preventDefault=Q,e.e_stopPropagation=Z,e.e_stop=se,e.addClass=U,e.contains=p,e.rmClass=m,e.keyNames=$r}$l(Pt),ql(Pt);var au="iter insert remove copy getEditor constructor".split(" ");for(var ia in rr.prototype)rr.prototype.hasOwnProperty(ia)&&ee(au,ia)<0&&(Pt.prototype[ia]=function(e){return function(){return e.apply(this.doc,arguments)}}(rr.prototype[ia]));return de(rr),Pt.inputStyles={textarea:Ft,contenteditable:At},Pt.defineMode=function(e){!Pt.defaults.mode&&e!="null"&&(Pt.defaults.mode=e),or.apply(this,arguments)},Pt.defineMIME=Kt,Pt.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Pt.defineMIME("text/plain","null"),Pt.defineExtension=function(e,t){Pt.prototype[e]=t},Pt.defineDocExtension=function(e,t){rr.prototype[e]=t},Pt.fromTextArea=nu,iu(Pt),Pt.version="5.58.2",Pt})},Y1PL:function(tt,Ve,te){"use strict";te.r(Ve),te.d(Ve,"ResizableTextArea",function(){return ee});var J=te("wx14"),z=te("1OyB"),D=te("vuIU"),K=te("Ji7U"),F=te("LK+K"),O=te("cDcd"),N=te("VTBJ"),I=te("rePB"),R=te("Zm9Q"),C=te("Kwbf"),h=te("c+Xe"),y=te("m+aA"),P=te("bdgK"),w=new Map;function x(pe){pe.forEach(function(he){var ce,fe=he.target;(ce=w.get(fe))===null||ce===void 0||ce.forEach(function(ne){return ne(fe)})})}var v=new P.default(x),d=null,o=null;function l(pe,he){w.has(pe)||(w.set(pe,new Set),v.observe(pe)),w.get(pe).add(he)}function s(pe,he){w.has(pe)&&(w.get(pe).delete(he),w.get(pe).size||(v.unobserve(pe),w.delete(pe)))}var S=function(pe){Object(K.a)(ce,pe);var he=Object(F.a)(ce);function ce(){return Object(z.a)(this,ce),he.apply(this,arguments)}return Object(D.a)(ce,[{key:"render",value:function(){return this.props.children}}]),ce}(O.Component),b=O.createContext(null);function f(pe){var he=pe.children,ce=pe.onBatchResize,fe=O.useRef(0),ne=O.useRef([]),me=O.useContext(b),$=O.useCallback(function(ae,q,Ee){fe.current+=1;var Ce=fe.current;ne.current.push({size:ae,element:q,data:Ee}),Promise.resolve().then(function(){Ce===fe.current&&(ce==null||ce(ne.current),ne.current=[])}),me==null||me(ae,q,Ee)},[ce,me]);return O.createElement(b.Provider,{value:$},he)}function L(pe){var he=pe.children,ce=pe.disabled,fe=O.useRef(null),ne=O.useRef(null),me=O.useContext(b),$=O.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),ae=O.isValidElement(he)&&Object(h.c)(he),q=ae?he.ref:null,Ee=O.useMemo(function(){return Object(h.a)(q,fe)},[q,fe]),Ce=O.useRef(pe);Ce.current=pe;var ye=O.useCallback(function(we){var Le=Ce.current,ke=Le.onResize,Fe=Le.data,Me=we.getBoundingClientRect(),Pe=Me.width,Ze=Me.height,qe=we.offsetWidth,Ge=we.offsetHeight,He=Math.floor(Pe),$e=Math.floor(Ze);if($.current.width!==He||$.current.height!==$e||$.current.offsetWidth!==qe||$.current.offsetHeight!==Ge){var We={width:He,height:$e,offsetWidth:qe,offsetHeight:Ge};$.current=We;var ze=qe===Math.round(Pe)?Pe:qe,Se=Ge===Math.round(Ze)?Ze:Ge,Je=Object(N.a)(Object(N.a)({},We),{},{offsetWidth:ze,offsetHeight:Se});me==null||me(Je,we,Fe),ke&&Promise.resolve().then(function(){ke(Je,we)})}},[]);return O.useEffect(function(){var we=Object(y.a)(fe.current)||Object(y.a)(ne.current);return we&&!ce&&l(we,ye),function(){return s(we,ye)}},[fe.current,ce]),O.createElement(S,{ref:ne},ae?O.cloneElement(he,{ref:Ee}):he)}var T="rc-observer-key";function m(pe){var he=pe.children,ce=Object(R.a)(he);return ce.map(function(fe,ne){var me=(fe==null?void 0:fe.key)||"".concat(T,"-").concat(ne);return O.createElement(L,Object(J.a)({},pe,{key:me}),fe)})}m.Collection=f;var c=m,u=te("bT9E"),a=te("TSYQ"),E=te.n(a),g=`
|
|
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
|
|
`,p=["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"],_={},U;function B(pe){var he=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,ce=pe.getAttribute("id")||pe.getAttribute("data-reactid")||pe.getAttribute("name");if(he&&_[ce])return _[ce];var fe=window.getComputedStyle(pe),ne=fe.getPropertyValue("box-sizing")||fe.getPropertyValue("-moz-box-sizing")||fe.getPropertyValue("-webkit-box-sizing"),me=parseFloat(fe.getPropertyValue("padding-bottom"))+parseFloat(fe.getPropertyValue("padding-top")),$=parseFloat(fe.getPropertyValue("border-bottom-width"))+parseFloat(fe.getPropertyValue("border-top-width")),ae=p.map(function(Ee){return"".concat(Ee,":").concat(fe.getPropertyValue(Ee))}).join(";"),q={sizingStyle:ae,paddingSize:me,borderSize:$,boxSizing:ne};return he&&ce&&(_[ce]=q),q}function W(pe){var he=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,ce=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,fe=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;U||(U=document.createElement("textarea"),U.setAttribute("tab-index","-1"),U.setAttribute("aria-hidden","true"),document.body.appendChild(U)),pe.getAttribute("wrap")?U.setAttribute("wrap",pe.getAttribute("wrap")):U.removeAttribute("wrap");var ne=B(pe,he),me=ne.paddingSize,$=ne.borderSize,ae=ne.boxSizing,q=ne.sizingStyle;U.setAttribute("style","".concat(q,";").concat(g)),U.value=pe.value||pe.placeholder||"";var Ee=Number.MIN_SAFE_INTEGER,Ce=Number.MAX_SAFE_INTEGER,ye=U.scrollHeight,we;if(ae==="border-box"?ye+=$:ae==="content-box"&&(ye-=me),ce!==null||fe!==null){U.value=" ";var Le=U.scrollHeight-me;ce!==null&&(Ee=Le*ce,ae==="border-box"&&(Ee=Ee+me+$),ye=Math.max(Ee,ye)),fe!==null&&(Ce=Le*fe,ae==="border-box"&&(Ce=Ce+me+$),we=ye>Ce?"":"hidden",ye=Math.min(Ce,ye))}return{height:ye,minHeight:Ee,maxHeight:Ce,overflowY:we,resize:"none"}}var k=te("Gytx"),M=te.n(k),H;(function(pe){pe[pe.NONE=0]="NONE",pe[pe.RESIZING=1]="RESIZING",pe[pe.RESIZED=2]="RESIZED"})(H||(H={}));var X=function(pe){Object(K.a)(ce,pe);var he=Object(F.a)(ce);function ce(fe){var ne;return Object(z.a)(this,ce),ne=he.call(this,fe),ne.nextFrameActionId=void 0,ne.resizeFrameId=void 0,ne.textArea=void 0,ne.saveTextArea=function(me){ne.textArea=me},ne.handleResize=function(me){var $=ne.state.resizeStatus,ae=ne.props,q=ae.autoSize,Ee=ae.onResize;if($!==H.NONE)return;typeof Ee=="function"&&Ee(me),q&&ne.resizeOnNextFrame()},ne.resizeOnNextFrame=function(){cancelAnimationFrame(ne.nextFrameActionId),ne.nextFrameActionId=requestAnimationFrame(ne.resizeTextarea)},ne.resizeTextarea=function(){var me=ne.props.autoSize;if(!me||!ne.textArea)return;var $=me.minRows,ae=me.maxRows,q=W(ne.textArea,!1,$,ae);ne.setState({textareaStyles:q,resizeStatus:H.RESIZING},function(){cancelAnimationFrame(ne.resizeFrameId),ne.resizeFrameId=requestAnimationFrame(function(){ne.setState({resizeStatus:H.RESIZED},function(){ne.resizeFrameId=requestAnimationFrame(function(){ne.setState({resizeStatus:H.NONE}),ne.fixFirefoxAutoScroll()})})})})},ne.renderTextArea=function(){var me=ne.props,$=me.prefixCls,ae=$===void 0?"rc-textarea":$,q=me.autoSize,Ee=me.onResize,Ce=me.className,ye=me.disabled,we=ne.state,Le=we.textareaStyles,ke=we.resizeStatus,Fe=Object(u.a)(ne.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Me=E()(ae,Ce,Object(I.a)({},"".concat(ae,"-disabled"),ye));"value"in Fe&&(Fe.value=Fe.value||"");var Pe=Object(N.a)(Object(N.a)(Object(N.a)({},ne.props.style),Le),ke===H.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return O.createElement(c,{onResize:ne.handleResize,disabled:!(q||Ee)},O.createElement("textarea",Object(J.a)({},Fe,{className:Me,style:Pe,ref:ne.saveTextArea})))},ne.state={textareaStyles:{},resizeStatus:H.NONE},ne}return Object(D.a)(ce,[{key:"componentDidUpdate",value:function(ne){(ne.value!==this.props.value||!M()(ne.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 ne=this.textArea.selectionStart,me=this.textArea.selectionEnd;this.textArea.setSelectionRange(ne,me)}}catch($){}}},{key:"render",value:function(){return this.renderTextArea()}}]),ce}(O.Component),ee=X,ie=function(pe){Object(K.a)(ce,pe);var he=Object(F.a)(ce);function ce(fe){var ne;Object(z.a)(this,ce),ne=he.call(this,fe),ne.resizableTextArea=void 0,ne.focus=function(){ne.resizableTextArea.textArea.focus()},ne.saveTextArea=function($){ne.resizableTextArea=$},ne.handleChange=function($){var ae=ne.props.onChange;ne.setValue($.target.value,function(){ne.resizableTextArea.resizeTextarea()}),ae&&ae($)},ne.handleKeyDown=function($){var ae=ne.props,q=ae.onPressEnter,Ee=ae.onKeyDown;$.keyCode===13&&q&&q($),Ee&&Ee($)};var me=typeof fe.value=="undefined"||fe.value===null?fe.defaultValue:fe.value;return ne.state={value:me},ne}return Object(D.a)(ce,[{key:"setValue",value:function(ne,me){"value"in this.props||this.setState({value:ne},me)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return O.createElement(ee,Object(J.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(ne){return"value"in ne?{value:ne.value}:null}}]),ce}(O.Component),ve=Ve.default=ie},YiJy:function(tt,Ve,te){tt.exports={bg:"bg___2xkgh",flexRow:"flexRow___3_RB8",flexJustifyCenter:"flexJustifyCenter___3Rbeo",flexAlignEnd:"flexAlignEnd___Up4h1",flexAlignCenter:"flexAlignCenter___hv6Pr",flexColumn:"flexColumn___kNPED",formWrap:"formWrap___2LY7l",titleWrap:"titleWrap___1TXK0",fieldWrap:"fieldWrap___2Bk37",mdWrap:"mdWrap___3VsOd",backgroundFa:"backgroundFa___13msX",button:"button___2BNet"}},ZW9T:function(tt,Ve,te){"use strict";te.d(Ve,"a",function(){return b});var J=te("k1fw"),z=te("miYZ"),D=te("tsqr"),K=te("rAM+"),F=te("tJVT"),O=te("PpiC"),N=te("cDcd"),I=te.n(N),R=te("bdgK");function C(f,L,T,m,c){var u=L.getWordUntilPosition(T),a={startLineNumber:T.lineNumber,endLineNumber:T.lineNumber,startColumn:u.startColumn,endColumn:u.endColumn},E=m.map(function(g){return{label:g,kind:f.languages.CompletionItemKind.Keyword,insertText:g,insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:a}});return c.map(function(g){E.push(Object(J.a)(Object(J.a)({},g),{},{range:a}))}),E}var h=function(f){var L={label:"ifelse",kind:f.languages.CompletionItemKind.Method,insertText:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
|
|
`),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet},T=["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(a,E){var g=C(f,a,E,T,[L]);return{suggestions:g}}});var m=["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(a,E){var g=[{label:"print",kind:f.languages.CompletionItemKind.Snippet,insertText:["print($0)"].join(`
|
|
`),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet}],p=C(f,a,E,m,g);return{suggestions:p}}});var c=["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(a,E){var g=[L,{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=C(f,a,E,c,g);return{suggestions:p}}})},y="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",P=te("LvDl"),w=te("+ua5");function x(f){return/^\d+$/.test(f)?"".concat(f,"px"):f}function v(){}var d=!1,o={"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 l(){var f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],L=f;if(Array.isArray(f)){for(var T=0;T<f.length;T++){var m=o[f[T]];if(m)return m}return L[0]}return o[L]||L}var s=null,S=Ve.b=function(f){var L=f.width,T=L===void 0?"100%":L,m=f.height,c=m===void 0?"100%":m,u=f.value,a=f.language,E=a===void 0?"javascript":a,g=f.style,p=g===void 0?{}:g,_=f.options,U=_===void 0?{}:_,B=f.overrideServices,W=B===void 0?{}:B,k=f.theme,M=k===void 0?"vs-dark":k,H=f.onEditBlur,X=f.onSave,ee=f.autoHeight,ie=ee===void 0?!1:ee,ve=f.forbidCopy,pe=ve===void 0?!1:ve,he=f.onChange,ce=he===void 0?v:he,fe=f.editorDidMount,ne=fe===void 0?v:fe,me=f.onFocus,$=me===void 0?v:me,ae=f.filename,q=ae===void 0?"educoder.txt":ae,Ee=f.errorLine,Ce=f.errorContent,ye=Ce===void 0?"":Ce,we=Object(O.a)(f,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename","errorLine","errorContent"]),Le=Object(N.useRef)(),ke=Object(N.useRef)({}),Fe=Object(N.useRef)(),Me=Object(N.useRef)(!1),Pe=Object(N.useRef)(),Ze=Object(N.useState)(!1),qe=Object(F.a)(Ze,2),Ge=qe[0],He=qe[1];function $e(){var Oe;return Le.current&&(Oe=new R.default(function(Ke){var it=Object(K.a)(Ke),_e;try{for(it.s();!(_e=it.n()).done;){var ct=_e.value;(ct.target.offsetHeight>0||ct.target.offsetWidth>0)&&ke.current.instance.layout()}}catch(at){it.e(at)}finally{it.f()}}),Oe.observe(Le.current)),Oe}function We(){D.b.warn(decodeURIComponent(y))}var ze=function(){var Ke=ke.current.instance;if(u!=null&&Ke&&Ge){var it=Ke.getModel();it&&u!==it.getValue()&&(d=!0,it.setValue(u),Ke.layout(),d=!1)}};Object(N.useEffect)(function(){Fe.current&&clearTimeout(Fe.current),Fe.current=setTimeout(function(){ze()},500)},[u,Ge,ke.current]),Object(N.useEffect)(function(){if(Ee&&ke.current&&ke.current.instance){var Oe=ke.current.instance;Oe.changeViewZones(function(it){var _e=document.createElement("div");_e.style.padding="10px 20px",_e.style.width="calc(100% - 20px)",_e.className="my-error-line-wrp",_e.innerHTML=ye,it.addZone({afterLineNumber:Ee||11,heightInLines:3,domNode:_e})});var Ke={domNode:null,getId:function(){return"my.overlay.widget"},getDomNode:function(){return this.domNode||(this.domNode=document.createElement("div"),this.domNode.innerHTML="",this.domNode.style.width="100%",this.domNode.style.padding="20px 100px",this.domNode.style.right="0px",this.domNode.style.top="50px",this.domNode.style.position="relative",this.domNode.style.color="#333"),this.domNode},getPosition:function(){return null}};Oe.addOverlayWidget(Ke),Oe.revealPositionInCenter({lineNumber:20,column:1})}},[Ee,ke.current,Ge]);function Se(){var Oe=ke.current.instance;if(Oe){var Ke=Oe.getSelection(),it=ke.current.pastePos||{},_e=new s.Range(it.startLineNumber||Ke.endLineNumber,it.startColumn||Ke.endColumn,it.endLineNumber||Ke.endLineNumber,it.endColumn||Ke.endColumn);setTimeout(function(){Oe.executeEdits("",[{range:_e,text:""}])},300)}}function Je(Oe){(window.navigator.platform.match("Mac")?Oe.metaKey:Oe.ctrlKey)&&Oe.keyCode==83&&(Oe.preventDefault(),X())}var Qe=function(){if(ie&&ke.current.instance){var Ke=ke.current.instance.getContentHeight();Te(Ke<c?c:Ke)}else Te(c)};function Ae(Oe){var Ke=document.createEvent("MouseEvents");Ke.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),Oe.dispatchEvent(Ke)}function Ie(Oe,Ke){var it=window.URL||window.webkitURL||window,_e=new Blob([Ke]),ct=document.createElementNS("http://www.w3.org/1999/xhtml","a");ct.href=it.createObjectURL(_e),ct.download=Oe,Ae(ct)}Object(N.useEffect)(function(){Qe()},[Qe]),Object(N.useEffect)(function(){Le.current&&!Ge&&te.e(27).then(te.t.bind(null,"M/lh",7)).then(function(Oe){try{s=Oe,ke.current.instance=s.editor.create(Le.current,{value:u,language:l(E),theme:M,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0},W);var Ke=ke.current.instance;if(ne(Ke,s),setTimeout(function(){Qe(),ke.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){Ie(q||"educoder.txt",Ke.getValue())}})},500),ke.current.subscription=Ke.onDidChangeModelContent(function(_e){Me.current?clearTimeout(Pe.current):(Qe(),ce(Ke.getValue(),_e)),Pe.current=setTimeout(function(){Me.current=!1},500)}),window.Monaco||h(s),pe&&(Ke.addCommand(s.KeyMod.CtrlCmd|s.KeyMod.Shift|s.KeyCode.KEY_V,function(){return We(),null}),Ke.addCommand(s.KeyMod.CtrlCmd|s.KeyCode.KEY_C,function(){return We(),null})),window.Monaco=s,H&&Ke.onDidBlurEditorWidget(function(){H(Ke.getValue())}),$&&Ke.onDidFocusEditorText(function(){$(Ke.getValue())}),pe){Ke.addCommand(s.KeyMod.CtrlCmd|s.KeyCode.KEY_V,function(){return We(),null}),Ke.onDidPaste(function(_e){ke.current.pastePos=_e});try{window.addEventListener("paste",Se)}catch(_e){}}var it=$e();return He(!0),function(){var _e=ke.current.instance;_e.dispose();var ct=_e.getModel();ct&&ct.dispose(),ke.current.subscription&&ke.current.subscription.dispose(),pe&&window.removeEventListener("paste",Se),it.unobserve(Le.current)}}catch(_e){}})},[]),Object(N.useEffect)(function(){var Oe=ke.current.instance;if(Oe&&Ge)return document.addEventListener("keydown",Je,!1),function(){document.removeEventListener("keydown",Je)}},[X,Ge]),Object(N.useEffect)(function(){var Oe=ke.current.instance;if(Oe&&Ge){var Ke=l(E);s.editor.setModelLanguage(Oe.getModel(),Ke),console.log("language:",E,Oe.getModel(),Ke)}},[E,Ge]),Object(N.useEffect)(function(){var Oe=ke.current.instance;Oe&&Ge&&s.editor.setTheme(M)},[M,Ge]),Object(N.useEffect)(function(){var Oe=ke.current.instance;Oe&&Ge&&(Oe.updateOptions(Object(J.a)({},U)),setTimeout(function(){Oe.getModel().updateOptions(Object(J.a)({},U))},200))},[JSON.stringify(U),Ge]),Object(N.useEffect)(function(){var Oe=ke.current.instance;Oe&&Ge&&Oe.layout()},[T,c,Ge]);var ge=Object(N.useState)(x(T)),le=Object(F.a)(ge,2),de=le[0],Q=le[1],Z=Object(N.useState)(x(c)),re=Object(F.a)(Z,2),se=re[0],Te=re[1],De=Object(J.a)(Object(J.a)({},p),{},{width:de,height:se});return I.a.createElement("div",{className:"my-monaco-editor",ref:Le,style:De})};function b(f){var L=f.width,T=L===void 0?"100%":L,m=f.height,c=m===void 0?"100%":m,u=f.original,a=f.modified,E=f.language,g=f.options,p=g===void 0?{}:g,_=Object(N.useRef)(),U=Object(N.useState)(null),B=Object(F.a)(U,2),W=B[0],k=B[1];function M(ie){var ve;return _.current&&(ve=new R.default(function(pe){var he=Object(K.a)(pe),ce;try{for(he.s();!(ce=he.n()).done;){var fe=ce.value;(fe.target.offsetHeight>0||fe.target.offsetWidth>0)&&ie.layout()}}catch(ne){he.e(ne)}finally{he.f()}}),ve.observe(_.current)),ve}Object(N.useEffect)(function(){_.current&&te.e(27).then(te.t.bind(null,"M/lh",7)).then(function(ie){s=ie;var ve=s.editor.createDiffEditor(_.current,Object(J.a)(Object(J.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}));k(ve);var pe=M(ve);return function(){ve.dispose();var he=ve.getModel();he&&he.dispose(),pe.unobserve(_.current)}})},[]),Object(N.useEffect)(function(){W&&W.setModel({original:s.editor.createModel(u,E),modified:s.editor.createModel(a,E)})},[u,a,E,W]);var H=x(T),X=x(c),ee={width:H,height:X};return I.a.createElement("div",{className:"my-diff-editor",ref:_,style:ee})}},ZpRC:function(tt,Ve,te){"use strict";function J(h){return typeof h=="object"&&h!=null&&h.nodeType===1}function z(h,y){return(!y||h!=="hidden")&&h!=="visible"&&h!=="clip"}function D(h,y){if(h.clientHeight<h.scrollHeight||h.clientWidth<h.scrollWidth){var P=getComputedStyle(h,null);return z(P.overflowY,y)||z(P.overflowX,y)||function(w){var x=function(v){if(!v.ownerDocument||!v.ownerDocument.defaultView)return null;try{return v.ownerDocument.defaultView.frameElement}catch(d){return null}}(w);return!!x&&(x.clientHeight<w.scrollHeight||x.clientWidth<w.scrollWidth)}(h)}return!1}function K(h,y,P,w,x,v,d,o){return v<h&&d>y||v>h&&d<y?0:v<=h&&o<=P||d>=y&&o>=P?v-h-w:d>y&&o<P||v<h&&o>P?d-y+x:0}var F=function(h,y){var P=window,w=y.scrollMode,x=y.block,v=y.inline,d=y.boundary,o=y.skipOverflowHiddenElements,l=typeof d=="function"?d:function(Le){return Le!==d};if(!J(h))throw new TypeError("Invalid target");for(var s=document.scrollingElement||document.documentElement,S=[],b=h;J(b)&&l(b);){if((b=b.parentElement)===s){S.push(b);break}b!=null&&b===document.body&&D(b)&&!D(document.documentElement)||b!=null&&D(b,o)&&S.push(b)}for(var f=P.visualViewport?P.visualViewport.width:innerWidth,L=P.visualViewport?P.visualViewport.height:innerHeight,T=window.scrollX||pageXOffset,m=window.scrollY||pageYOffset,c=h.getBoundingClientRect(),u=c.height,a=c.width,E=c.top,g=c.right,p=c.bottom,_=c.left,U=x==="start"||x==="nearest"?E:x==="end"?p:E+u/2,B=v==="center"?_+a/2:v==="end"?g:_,W=[],k=0;k<S.length;k++){var M=S[k],H=M.getBoundingClientRect(),X=H.height,ee=H.width,ie=H.top,ve=H.right,pe=H.bottom,he=H.left;if(w==="if-needed"&&E>=0&&_>=0&&p<=L&&g<=f&&E>=ie&&p<=pe&&_>=he&&g<=ve)return W;var ce=getComputedStyle(M),fe=parseInt(ce.borderLeftWidth,10),ne=parseInt(ce.borderTopWidth,10),me=parseInt(ce.borderRightWidth,10),$=parseInt(ce.borderBottomWidth,10),ae=0,q=0,Ee="offsetWidth"in M?M.offsetWidth-M.clientWidth-fe-me:0,Ce="offsetHeight"in M?M.offsetHeight-M.clientHeight-ne-$:0;if(s===M)ae=x==="start"?U:x==="end"?U-L:x==="nearest"?K(m,m+L,L,ne,$,m+U,m+U+u,u):U-L/2,q=v==="start"?B:v==="center"?B-f/2:v==="end"?B-f:K(T,T+f,f,fe,me,T+B,T+B+a,a),ae=Math.max(0,ae+m),q=Math.max(0,q+T);else{ae=x==="start"?U-ie-ne:x==="end"?U-pe+$+Ce:x==="nearest"?K(ie,pe,X,ne,$+Ce,U,U+u,u):U-(ie+X/2)+Ce/2,q=v==="start"?B-he-fe:v==="center"?B-(he+ee/2)+Ee/2:v==="end"?B-ve+me+Ee:K(he,ve,ee,fe,me+Ee,B,B+a,a);var ye=M.scrollLeft,we=M.scrollTop;U+=we-(ae=Math.max(0,Math.min(we+ae,M.scrollHeight-X+Ce))),B+=ye-(q=Math.max(0,Math.min(ye+q,M.scrollWidth-ee+Ee)))}W.push({el:M,top:ae,left:q})}return W};function O(h){return h===Object(h)&&Object.keys(h).length!==0}function N(h,y){y===void 0&&(y="auto");var P="scrollBehavior"in document.body.style;h.forEach(function(w){var x=w.el,v=w.top,d=w.left;x.scroll&&P?x.scroll({top:v,left:d,behavior:y}):(x.scrollTop=v,x.scrollLeft=d)})}function I(h){return h===!1?{block:"end",inline:"nearest"}:O(h)?h:{block:"start",inline:"nearest"}}function R(h,y){var P=!h.ownerDocument.documentElement.contains(h);if(O(y)&&typeof y.behavior=="function")return y.behavior(P?[]:F(h,y));if(P)return;var w=I(y);return N(F(h,w),w.behavior)}var C=Ve.a=R},Zss7:function(tt,Ve,te){var J;(function(z){var D=/^\s+/,K=/\s+$/,F=0,O=z.round,N=z.min,I=z.max,R=z.random;function C($,ae){if($=$||"",ae=ae||{},$ instanceof C)return $;if(!(this instanceof C))return new C($,ae);var q=h($);this._originalInput=$,this._r=q.r,this._g=q.g,this._b=q.b,this._a=q.a,this._roundA=O(100*this._a)/100,this._format=ae.format||q.format,this._gradientType=ae.gradientType,this._r<1&&(this._r=O(this._r)),this._g<1&&(this._g=O(this._g)),this._b<1&&(this._b=O(this._b)),this._ok=q.ok,this._tc_id=F++}C.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,q,Ee,Ce,ye,we;return ae=$.r/255,q=$.g/255,Ee=$.b/255,ae<=.03928?Ce=ae/12.92:Ce=z.pow((ae+.055)/1.055,2.4),q<=.03928?ye=q/12.92:ye=z.pow((q+.055)/1.055,2.4),Ee<=.03928?we=Ee/12.92:we=z.pow((Ee+.055)/1.055,2.4),.2126*Ce+.7152*ye+.0722*we},setAlpha:function($){return this._a=W($),this._roundA=O(100*this._a)/100,this},toHsv:function(){var $=x(this._r,this._g,this._b);return{h:$.h*360,s:$.s,v:$.v,a:this._a}},toHsvString:function(){var $=x(this._r,this._g,this._b),ae=O($.h*360),q=O($.s*100),Ee=O($.v*100);return this._a==1?"hsv("+ae+", "+q+"%, "+Ee+"%)":"hsva("+ae+", "+q+"%, "+Ee+"%, "+this._roundA+")"},toHsl:function(){var $=P(this._r,this._g,this._b);return{h:$.h*360,s:$.s,l:$.l,a:this._a}},toHslString:function(){var $=P(this._r,this._g,this._b),ae=O($.h*360),q=O($.s*100),Ee=O($.l*100);return this._a==1?"hsl("+ae+", "+q+"%, "+Ee+"%)":"hsla("+ae+", "+q+"%, "+Ee+"%, "+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:O(this._r),g:O(this._g),b:O(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+O(this._r)+", "+O(this._g)+", "+O(this._b)+")":"rgba("+O(this._r)+", "+O(this._g)+", "+O(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:O(k(this._r,255)*100)+"%",g:O(k(this._g,255)*100)+"%",b:O(k(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+O(k(this._r,255)*100)+"%, "+O(k(this._g,255)*100)+"%, "+O(k(this._b,255)*100)+"%)":"rgba("+O(k(this._r,255)*100)+"%, "+O(k(this._g,255)*100)+"%, "+O(k(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:U[d(this._r,this._g,this._b,!0)]||!1},toFilter:function($){var ae="#"+l(this._r,this._g,this._b,this._a),q=ae,Ee=this._gradientType?"GradientType = 1, ":"";if($){var Ce=C($);q="#"+l(Ce._r,Ce._g,Ce._b,Ce._a)}return"progid:DXImageTransform.Microsoft.gradient("+Ee+"startColorstr="+ae+",endColorstr="+q+")"},toString:function($){var ae=!!$;$=$||this._format;var q=!1,Ee=this._a<1&&this._a>=0,Ce=!ae&&Ee&&($==="hex"||$==="hex6"||$==="hex3"||$==="hex4"||$==="hex8"||$==="name");return Ce?$==="name"&&this._a===0?this.toName():this.toRgbString():($==="rgb"&&(q=this.toRgbString()),$==="prgb"&&(q=this.toPercentageRgbString()),($==="hex"||$==="hex6")&&(q=this.toHexString()),$==="hex3"&&(q=this.toHexString(!0)),$==="hex4"&&(q=this.toHex8String(!0)),$==="hex8"&&(q=this.toHex8String()),$==="name"&&(q=this.toName()),$==="hsl"&&(q=this.toHslString()),$==="hsv"&&(q=this.toHsvString()),q||this.toHexString())},clone:function(){return C(this.toString())},_applyModification:function($,ae){var q=$.apply(null,[this].concat([].slice.call(ae)));return this._r=q._r,this._g=q._g,this._b=q._b,this.setAlpha(q._a),this},lighten:function(){return this._applyModification(f,arguments)},brighten:function(){return this._applyModification(L,arguments)},darken:function(){return this._applyModification(T,arguments)},desaturate:function(){return this._applyModification(s,arguments)},saturate:function(){return this._applyModification(S,arguments)},greyscale:function(){return this._applyModification(b,arguments)},spin:function(){return this._applyModification(m,arguments)},_applyCombination:function($,ae){return $.apply(null,[this].concat([].slice.call(ae)))},analogous:function(){return this._applyCombination(g,arguments)},complement:function(){return this._applyCombination(c,arguments)},monochromatic:function(){return this._applyCombination(p,arguments)},splitcomplement:function(){return this._applyCombination(E,arguments)},triad:function(){return this._applyCombination(u,arguments)},tetrad:function(){return this._applyCombination(a,arguments)}},C.fromRatio=function($,ae){if(typeof $=="object"){var q={};for(var Ee in $)$.hasOwnProperty(Ee)&&(Ee==="a"?q[Ee]=$[Ee]:q[Ee]=ve($[Ee]));$=q}return C($,ae)};function h($){var ae={r:0,g:0,b:0},q=1,Ee=null,Ce=null,ye=null,we=!1,Le=!1;return typeof $=="string"&&($=ne($)),typeof $=="object"&&(fe($.r)&&fe($.g)&&fe($.b)?(ae=y($.r,$.g,$.b),we=!0,Le=String($.r).substr(-1)==="%"?"prgb":"rgb"):fe($.h)&&fe($.s)&&fe($.v)?(Ee=ve($.s),Ce=ve($.v),ae=v($.h,Ee,Ce),we=!0,Le="hsv"):fe($.h)&&fe($.s)&&fe($.l)&&(Ee=ve($.s),ye=ve($.l),ae=w($.h,Ee,ye),we=!0,Le="hsl"),$.hasOwnProperty("a")&&(q=$.a)),q=W(q),{ok:we,format:$.format||Le,r:N(255,I(ae.r,0)),g:N(255,I(ae.g,0)),b:N(255,I(ae.b,0)),a:q}}function y($,ae,q){return{r:k($,255)*255,g:k(ae,255)*255,b:k(q,255)*255}}function P($,ae,q){$=k($,255),ae=k(ae,255),q=k(q,255);var Ee=I($,ae,q),Ce=N($,ae,q),ye,we,Le=(Ee+Ce)/2;if(Ee==Ce)ye=we=0;else{var ke=Ee-Ce;we=Le>.5?ke/(2-Ee-Ce):ke/(Ee+Ce);switch(Ee){case $:ye=(ae-q)/ke+(ae<q?6:0);break;case ae:ye=(q-$)/ke+2;break;case q:ye=($-ae)/ke+4;break}ye/=6}return{h:ye,s:we,l:Le}}function w($,ae,q){var Ee,Ce,ye;$=k($,360),ae=k(ae,100),q=k(q,100);function we(Fe,Me,Pe){return Pe<0&&(Pe+=1),Pe>1&&(Pe-=1),Pe<1/6?Fe+(Me-Fe)*6*Pe:Pe<1/2?Me:Pe<2/3?Fe+(Me-Fe)*(2/3-Pe)*6:Fe}if(ae===0)Ee=Ce=ye=q;else{var Le=q<.5?q*(1+ae):q+ae-q*ae,ke=2*q-Le;Ee=we(ke,Le,$+1/3),Ce=we(ke,Le,$),ye=we(ke,Le,$-1/3)}return{r:Ee*255,g:Ce*255,b:ye*255}}function x($,ae,q){$=k($,255),ae=k(ae,255),q=k(q,255);var Ee=I($,ae,q),Ce=N($,ae,q),ye,we,Le=Ee,ke=Ee-Ce;if(we=Ee===0?0:ke/Ee,Ee==Ce)ye=0;else{switch(Ee){case $:ye=(ae-q)/ke+(ae<q?6:0);break;case ae:ye=(q-$)/ke+2;break;case q:ye=($-ae)/ke+4;break}ye/=6}return{h:ye,s:we,v:Le}}function v($,ae,q){$=k($,360)*6,ae=k(ae,100),q=k(q,100);var Ee=z.floor($),Ce=$-Ee,ye=q*(1-ae),we=q*(1-Ce*ae),Le=q*(1-(1-Ce)*ae),ke=Ee%6,Fe=[q,we,ye,ye,Le,q][ke],Me=[Le,q,q,we,ye,ye][ke],Pe=[ye,ye,Le,q,q,we][ke];return{r:Fe*255,g:Me*255,b:Pe*255}}function d($,ae,q,Ee){var Ce=[ie(O($).toString(16)),ie(O(ae).toString(16)),ie(O(q).toString(16))];return Ee&&Ce[0].charAt(0)==Ce[0].charAt(1)&&Ce[1].charAt(0)==Ce[1].charAt(1)&&Ce[2].charAt(0)==Ce[2].charAt(1)?Ce[0].charAt(0)+Ce[1].charAt(0)+Ce[2].charAt(0):Ce.join("")}function o($,ae,q,Ee,Ce){var ye=[ie(O($).toString(16)),ie(O(ae).toString(16)),ie(O(q).toString(16)),ie(pe(Ee))];return Ce&&ye[0].charAt(0)==ye[0].charAt(1)&&ye[1].charAt(0)==ye[1].charAt(1)&&ye[2].charAt(0)==ye[2].charAt(1)&&ye[3].charAt(0)==ye[3].charAt(1)?ye[0].charAt(0)+ye[1].charAt(0)+ye[2].charAt(0)+ye[3].charAt(0):ye.join("")}function l($,ae,q,Ee){var Ce=[ie(pe(Ee)),ie(O($).toString(16)),ie(O(ae).toString(16)),ie(O(q).toString(16))];return Ce.join("")}C.equals=function($,ae){return!$||!ae?!1:C($).toRgbString()==C(ae).toRgbString()},C.random=function(){return C.fromRatio({r:R(),g:R(),b:R()})};function s($,ae){ae=ae===0?0:ae||10;var q=C($).toHsl();return q.s-=ae/100,q.s=M(q.s),C(q)}function S($,ae){ae=ae===0?0:ae||10;var q=C($).toHsl();return q.s+=ae/100,q.s=M(q.s),C(q)}function b($){return C($).desaturate(100)}function f($,ae){ae=ae===0?0:ae||10;var q=C($).toHsl();return q.l+=ae/100,q.l=M(q.l),C(q)}function L($,ae){ae=ae===0?0:ae||10;var q=C($).toRgb();return q.r=I(0,N(255,q.r-O(255*-(ae/100)))),q.g=I(0,N(255,q.g-O(255*-(ae/100)))),q.b=I(0,N(255,q.b-O(255*-(ae/100)))),C(q)}function T($,ae){ae=ae===0?0:ae||10;var q=C($).toHsl();return q.l-=ae/100,q.l=M(q.l),C(q)}function m($,ae){var q=C($).toHsl(),Ee=(q.h+ae)%360;return q.h=Ee<0?360+Ee:Ee,C(q)}function c($){var ae=C($).toHsl();return ae.h=(ae.h+180)%360,C(ae)}function u($){var ae=C($).toHsl(),q=ae.h;return[C($),C({h:(q+120)%360,s:ae.s,l:ae.l}),C({h:(q+240)%360,s:ae.s,l:ae.l})]}function a($){var ae=C($).toHsl(),q=ae.h;return[C($),C({h:(q+90)%360,s:ae.s,l:ae.l}),C({h:(q+180)%360,s:ae.s,l:ae.l}),C({h:(q+270)%360,s:ae.s,l:ae.l})]}function E($){var ae=C($).toHsl(),q=ae.h;return[C($),C({h:(q+72)%360,s:ae.s,l:ae.l}),C({h:(q+216)%360,s:ae.s,l:ae.l})]}function g($,ae,q){ae=ae||6,q=q||30;var Ee=C($).toHsl(),Ce=360/q,ye=[C($)];for(Ee.h=(Ee.h-(Ce*ae>>1)+720)%360;--ae;)Ee.h=(Ee.h+Ce)%360,ye.push(C(Ee));return ye}function p($,ae){ae=ae||6;for(var q=C($).toHsv(),Ee=q.h,Ce=q.s,ye=q.v,we=[],Le=1/ae;ae--;)we.push(C({h:Ee,s:Ce,v:ye})),ye=(ye+Le)%1;return we}C.mix=function($,ae,q){q=q===0?0:q||50;var Ee=C($).toRgb(),Ce=C(ae).toRgb(),ye=q/100,we={r:(Ce.r-Ee.r)*ye+Ee.r,g:(Ce.g-Ee.g)*ye+Ee.g,b:(Ce.b-Ee.b)*ye+Ee.b,a:(Ce.a-Ee.a)*ye+Ee.a};return C(we)},C.readability=function($,ae){var q=C($),Ee=C(ae);return(z.max(q.getLuminance(),Ee.getLuminance())+.05)/(z.min(q.getLuminance(),Ee.getLuminance())+.05)},C.isReadable=function($,ae,q){var Ee=C.readability($,ae),Ce,ye;ye=!1,Ce=me(q);switch(Ce.level+Ce.size){case"AAsmall":case"AAAlarge":ye=Ee>=4.5;break;case"AAlarge":ye=Ee>=3;break;case"AAAsmall":ye=Ee>=7;break}return ye},C.mostReadable=function($,ae,q){var Ee=null,Ce=0,ye,we,Le,ke;q=q||{},we=q.includeFallbackColors,Le=q.level,ke=q.size;for(var Fe=0;Fe<ae.length;Fe++)ye=C.readability($,ae[Fe]),ye>Ce&&(Ce=ye,Ee=C(ae[Fe]));return C.isReadable($,Ee,{level:Le,size:ke})||!we?Ee:(q.includeFallbackColors=!1,C.mostReadable($,["#fff","#000"],q))};var _=C.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"},U=C.hexNames=B(_);function B($){var ae={};for(var q in $)$.hasOwnProperty(q)&&(ae[$[q]]=q);return ae}function W($){return $=parseFloat($),(isNaN($)||$<0||$>1)&&($=1),$}function k($,ae){X($)&&($="100%");var q=ee($);return $=N(ae,I(0,parseFloat($))),q&&($=parseInt($*ae,10)/100),z.abs($-ae)<1e-6?1:$%ae/parseFloat(ae)}function M($){return N(1,I(0,$))}function H($){return parseInt($,16)}function X($){return typeof $=="string"&&$.indexOf(".")!=-1&&parseFloat($)===1}function ee($){return typeof $=="string"&&$.indexOf("%")!=-1}function ie($){return $.length==1?"0"+$:""+$}function ve($){return $<=1&&($=$*100+"%"),$}function pe($){return z.round(parseFloat($)*255).toString(16)}function he($){return H($)/255}var ce=function(){var $="[-\\+]?\\d+%?",ae="[-\\+]?\\d*\\.\\d+%?",q="(?:"+ae+")|(?:"+$+")",Ee="[\\s|\\(]+("+q+")[,|\\s]+("+q+")[,|\\s]+("+q+")\\s*\\)?",Ce="[\\s|\\(]+("+q+")[,|\\s]+("+q+")[,|\\s]+("+q+")[,|\\s]+("+q+")\\s*\\)?";return{CSS_UNIT:new RegExp(q),rgb:new RegExp("rgb"+Ee),rgba:new RegExp("rgba"+Ce),hsl:new RegExp("hsl"+Ee),hsla:new RegExp("hsla"+Ce),hsv:new RegExp("hsv"+Ee),hsva:new RegExp("hsva"+Ce),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 fe($){return!!ce.CSS_UNIT.exec($)}function ne($){$=$.replace(D,"").replace(K,"").toLowerCase();var ae=!1;if(_[$])$=_[$],ae=!0;else if($=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var q;return(q=ce.rgb.exec($))?{r:q[1],g:q[2],b:q[3]}:(q=ce.rgba.exec($))?{r:q[1],g:q[2],b:q[3],a:q[4]}:(q=ce.hsl.exec($))?{h:q[1],s:q[2],l:q[3]}:(q=ce.hsla.exec($))?{h:q[1],s:q[2],l:q[3],a:q[4]}:(q=ce.hsv.exec($))?{h:q[1],s:q[2],v:q[3]}:(q=ce.hsva.exec($))?{h:q[1],s:q[2],v:q[3],a:q[4]}:(q=ce.hex8.exec($))?{r:H(q[1]),g:H(q[2]),b:H(q[3]),a:he(q[4]),format:ae?"name":"hex8"}:(q=ce.hex6.exec($))?{r:H(q[1]),g:H(q[2]),b:H(q[3]),format:ae?"name":"hex"}:(q=ce.hex4.exec($))?{r:H(q[1]+""+q[1]),g:H(q[2]+""+q[2]),b:H(q[3]+""+q[3]),a:he(q[4]+""+q[4]),format:ae?"name":"hex8"}:(q=ce.hex3.exec($))?{r:H(q[1]+""+q[1]),g:H(q[2]+""+q[2]),b:H(q[3]+""+q[3]),format:ae?"name":"hex"}:!1}function me($){var ae,q;return $=$||{level:"AA",size:"small"},ae=($.level||"AA").toUpperCase(),q=($.size||"small").toLowerCase(),ae!=="AA"&&ae!=="AAA"&&(ae="AA"),q!=="small"&&q!=="large"&&(q="small"),{level:ae,size:q}}tt.exports?tt.exports=C:!(J=function(){return C}.call(Ve,te,Ve,tt),J!==void 0&&(tt.exports=J))})(Math)},aRTE:function(tt,Ve){tt.exports={L:1,M:0,Q:3,H:2}},bT9E:function(tt,Ve,te){"use strict";te.d(Ve,"a",function(){return z});var J=te("VTBJ");function z(D,K){var F=Object(J.a)({},D);return Array.isArray(K)&&K.forEach(function(O){delete F[O]}),F}},c5Ni:function(tt,Ve,te){},dQei:function(tt,Ve){for(var te={glog:function(z){if(z<1)throw new Error("glog("+z+")");return te.LOG_TABLE[z]},gexp:function(z){for(;z<0;)z+=255;for(;z>=256;)z-=255;return te.EXP_TABLE[z]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)},J=0;J<8;J++)te.EXP_TABLE[J]=1<<J;for(var J=8;J<256;J++)te.EXP_TABLE[J]=te.EXP_TABLE[J-4]^te.EXP_TABLE[J-5]^te.EXP_TABLE[J-6]^te.EXP_TABLE[J-8];for(var J=0;J<255;J++)te.LOG_TABLE[te.EXP_TABLE[J]]=J;tt.exports=te},dWSS:function(tt,Ve,te){var J=te("dQei");function z(D,K){if(D.length==null)throw new Error(D.length+"/"+K);for(var F=0;F<D.length&&D[F]==0;)F++;this.num=new Array(D.length-F+K);for(var O=0;O<D.length-F;O++)this.num[O]=D[O+F]}z.prototype={get:function(D){return this.num[D]},getLength:function(){return this.num.length},multiply:function(D){for(var K=new Array(this.getLength()+D.getLength()-1),F=0;F<this.getLength();F++)for(var O=0;O<D.getLength();O++)K[F+O]^=J.gexp(J.glog(this.get(F))+J.glog(D.get(O)));return new z(K,0)},mod:function(D){if(this.getLength()-D.getLength()<0)return this;for(var K=J.glog(this.get(0))-J.glog(D.get(0)),F=new Array(this.getLength()),O=0;O<this.getLength();O++)F[O]=this.get(O);for(var O=0;O<D.getLength();O++)F[O]^=J.gexp(J.glog(D.get(O))+K);return new z(F,0).mod(D)}},tt.exports=z},dejd:function(tt,Ve,te){},dmUQ:function(tt,Ve,te){"use strict";var J=te("Ff2n"),z=te("rePB"),D=te("1OyB"),K=te("vuIU"),F=te("Ji7U"),O=te("md7G"),N=te("foSv"),I=te("cDcd"),R=te.n(I),C=te("TSYQ"),h=te.n(C),y=te("4IlW");function P(u,a){var E=Object.keys(u);if(Object.getOwnPropertySymbols){var g=Object.getOwnPropertySymbols(u);a&&(g=g.filter(function(p){return Object.getOwnPropertyDescriptor(u,p).enumerable})),E.push.apply(E,g)}return E}function w(u){for(var a=1;a<arguments.length;a++){var E=arguments[a]!=null?arguments[a]:{};a%2?P(Object(E),!0).forEach(function(g){Object(z.a)(u,g,E[g])}):Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(E)):P(Object(E)).forEach(function(g){Object.defineProperty(u,g,Object.getOwnPropertyDescriptor(E,g))})}return u}function x(u){var a=v();return function(){var g=Object(N.a)(u),p;if(a){var _=Object(N.a)(this).constructor;p=Reflect.construct(g,arguments,_)}else p=g.apply(this,arguments);return Object(O.a)(this,p)}}function v(){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(u){return!1}}function d(){}function o(u){u.preventDefault()}var l=function(a){return a.replace(/[^\w.-]+/g,"")},s=200,S=600,b=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,f=function(a){return a!=null},L=function(a,E){return E===a||typeof E=="number"&&typeof a=="number"&&isNaN(E)&&isNaN(a)},T=function(u){Object(F.a)(E,u);var a=x(E);function E(g){var p;Object(D.a)(this,E),p=a.call(this,g),p.onKeyDown=function(B){var W=p.props,k=W.onKeyDown,M=W.onPressEnter;if(B.keyCode===y.a.UP){var H=p.getRatio(B);p.up(B,H,null),p.stop()}else if(B.keyCode===y.a.DOWN){var X=p.getRatio(B);p.down(B,X,null),p.stop()}else B.keyCode===y.a.ENTER&&M&&M(B);if(p.recordCursorPosition(),p.lastKeyCode=B.keyCode,k){for(var ee=arguments.length,ie=new Array(ee>1?ee-1:0),ve=1;ve<ee;ve++)ie[ve-1]=arguments[ve];k.apply(void 0,[B].concat(ie))}},p.onKeyUp=function(B){var W=p.props.onKeyUp;if(p.stop(),p.recordCursorPosition(),W){for(var k=arguments.length,M=new Array(k>1?k-1:0),H=1;H<k;H++)M[H-1]=arguments[H];W.apply(void 0,[B].concat(M))}},p.onChange=function(B){var W=p.props.onChange;p.state.focused&&(p.inputting=!0),p.rawInput=p.props.parser(p.getValueFromEvent(B)),p.setState({inputValue:p.rawInput}),W(p.toNumber(p.rawInput))},p.onMouseUp=function(){var B=p.props.onMouseUp;p.recordCursorPosition(),B&&B.apply(void 0,arguments)},p.onFocus=function(){var B;p.setState({focused:!0}),(B=p.props).onFocus.apply(B,arguments)},p.onBlur=function(){var B=p.props.onBlur;p.inputting=!1,p.setState({focused:!1});var W=p.getCurrentValidValue(p.state.inputValue),k=p.setValue(W,d);if(B){var M=p.input.value,H=p.getInputDisplayValue({focus:!1,value:k});p.input.value=H&&Number(H),B.apply(void 0,arguments),p.input.value=M}},p.getRatio=function(B){var W=1;return B.metaKey||B.ctrlKey?W=.1:B.shiftKey&&(W=10),W},p.getFullNum=function(B){return isNaN(B)?B:/e/i.test(String(B))?Number(B).toFixed(18).replace(/\.?0+$/,""):B},p.getPrecision=function(B){if(f(p.props.precision))return p.props.precision;var W=String(B);if(W.indexOf("e-")>=0)return parseInt(W.slice(W.indexOf("e-")+2),10);var k=0;return W.indexOf(".")>=0&&(k=W.length-W.indexOf(".")-1),k},p.getInputDisplayValue=function(B){var W=B||p.state,k=W.focused,M=W.inputValue,H=W.value,X;k?X=M:X=p.toPrecisionAsStep(H),X==null&&(X="");var ee=p.formatWrapper(X);return f(p.props.decimalSeparator)&&(ee=ee.toString().replace(".",p.props.decimalSeparator)),ee},p.recordCursorPosition=function(){try{p.cursorStart=p.input.selectionStart,p.cursorEnd=p.input.selectionEnd,p.currentValue=p.input.value,p.cursorBefore=p.input.value.substring(0,p.cursorStart),p.cursorAfter=p.input.value.substring(p.cursorEnd)}catch(B){}},p.restoreByAfter=function(B){if(B===void 0)return!1;var W=p.input.value,k=W.lastIndexOf(B);if(k===-1)return!1;var M=p.cursorBefore.length;return p.lastKeyCode===y.a.DELETE&&p.cursorBefore.charAt(M-1)===B[0]?(p.fixCaret(M,M),!0):k+B.length===W.length?(p.fixCaret(k,k),!0):!1},p.partRestoreByAfter=function(B){return B===void 0?!1:Array.prototype.some.call(B,function(W,k){var M=B.substring(k);return p.restoreByAfter(M)})},p.isNotCompleteNumber=function(B){return isNaN(B)||B===""||B===null||B&&B.toString().indexOf(".")===B.toString().length-1},p.stop=function(){p.autoStepTimer&&clearTimeout(p.autoStepTimer)},p.down=function(B,W,k){p.pressingUpOrDown=!0,p.step("down",B,W,k)},p.up=function(B,W,k){p.pressingUpOrDown=!0,p.step("up",B,W,k)},p.saveInput=function(B){p.input=B};var _=g.value;_===void 0&&(_=g.defaultValue),p.state={focused:g.autoFocus};var U=p.getValidValue(p.toNumber(_));return p.state=w(w({},p.state),{},{inputValue:p.toPrecisionAsStep(U),value:U}),p}return Object(K.a)(E,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(p){var _=this.props,U=_.value,B=_.onChange,W=_.max,k=_.min,M=this.state.focused;if(p){if(!L(p.value,U)||!L(p.max,W)||!L(p.min,k)){var H=M?U:this.getValidValue(U),X;this.pressingUpOrDown?X=H:this.inputting?X=this.rawInput:X=this.toPrecisionAsStep(H),this.setState({value:H,inputValue:X})}var ee="value"in this.props?U:this.state.value;"max"in this.props&&p.max!==W&&typeof ee=="number"&&ee>W&&B&&B(W),"min"in this.props&&p.min!==k&&typeof ee=="number"&&ee<k&&B&&B(k)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var ie=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===y.a.BACKSPACE?ie=this.cursorStart-1:this.lastKeyCode===y.a.DELETE&&(ie=this.cursorStart):ie=this.input.value.length,this.fixCaret(ie,ie)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case y.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case y.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(ve){}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(p){var _=p;return _===""?_="":this.isNotCompleteNumber(parseFloat(_))?_=this.state.value:_=this.getValidValue(_),this.toNumber(_)}},{key:"getValueFromEvent",value:function(p){var _=p.target.value.trim().replace(/。/g,".");return f(this.props.decimalSeparator)&&(_=_.replace(this.props.decimalSeparator,".")),_}},{key:"getValidValue",value:function(p){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,U=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,B=parseFloat(p);return isNaN(B)?p:(B<_&&(B=_),B>U&&(B=U),B)}},{key:"setValue",value:function(p,_){var U=this.props.precision,B=this.isNotCompleteNumber(parseFloat(p))?null:parseFloat(p),W=this.state.value,k=W===void 0?null:W,M=this.state.inputValue,H=M===void 0?null:M,X=typeof B=="number"?B.toFixed(U):"".concat(B),ee=B!==k||X!=="".concat(H);return"value"in this.props?(H=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:H},_)):this.setState({value:B,inputValue:this.toPrecisionAsStep(p)},_),ee&&this.props.onChange(B),B}},{key:"getMaxPrecision",value:function(p){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,U=this.props,B=U.precision,W=U.step;if(f(B))return B;var k=this.getPrecision(_),M=this.getPrecision(W),H=this.getPrecision(p);return p?Math.max(H,k+M):k+M}},{key:"getPrecisionFactor",value:function(p){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,U=this.getMaxPrecision(p,_);return Math.pow(10,U)}},{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(p){return this.props.formatter?this.props.formatter(p):p}},{key:"toPrecisionAsStep",value:function(p){if(this.isNotCompleteNumber(p)||p==="")return p;var _=Math.abs(this.getMaxPrecision(p));return isNaN(_)?p.toString():Number(p).toFixed(_)}},{key:"toNumber",value:function(p){var _=this.props.precision,U=this.state.focused,B=p&&p.length>16&&U;return this.isNotCompleteNumber(p)||B?p:f(_)?Math.round(p*Math.pow(10,_))/Math.pow(10,_):Number(p)}},{key:"upStep",value:function(p,_){var U=this.props.step,B=this.getPrecisionFactor(p,_),W=Math.abs(this.getMaxPrecision(p,_)),k=((B*p+B*U*_)/B).toFixed(W);return this.toNumber(k)}},{key:"downStep",value:function(p,_){var U=this.props.step,B=this.getPrecisionFactor(p,_),W=Math.abs(this.getMaxPrecision(p,_)),k=((B*p-B*U*_)/B).toFixed(W);return this.toNumber(k)}},{key:"step",value:function(p,_){var U=this,B=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,W=arguments.length>3?arguments[3]:void 0;this.stop(),_&&(_.persist(),_.preventDefault());var k=this.props;if(k.disabled)return;var M=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(M))return;var H=this["".concat(p,"Step")](M,B),X=H>k.max||H<k.min;if(H>k.max?H=k.max:H<k.min&&(H=k.min),this.setValue(H,null),this.setState({focused:!0},function(){U.pressingUpOrDown=!1}),X)return;this.autoStepTimer=setTimeout(function(){U[p](_,B,!0)},W?s:S)}},{key:"fixCaret",value:function(p,_){if(p===void 0||_===void 0||!this.input||!this.input.value)return;try{var U=this.input.selectionStart,B=this.input.selectionEnd;(p!==U||_!==B)&&this.input.setSelectionRange(p,_)}catch(W){}}},{key:"render",value:function(){var p,_=this.props,U=_.prefixCls,B=_.disabled,W=_.readOnly,k=_.useTouch,M=_.autoComplete,H=_.upHandler,X=_.downHandler,ee=_.className,ie=_.max,ve=_.min,pe=_.style,he=_.title,ce=_.onMouseEnter,fe=_.onMouseLeave,ne=_.onMouseOver,me=_.onMouseOut,$=_.required,ae=_.onClick,q=_.tabIndex,Ee=_.type,Ce=_.placeholder,ye=_.id,we=_.inputMode,Le=_.pattern,ke=_.step,Fe=_.maxLength,Me=_.autoFocus,Pe=_.name,Ze=_.onPaste,qe=_.onInput,Ge=Object(J.a)(_,["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"]),He=this.state,$e=He.value,We=He.focused,ze=h()(U,(p={},Object(z.a)(p,ee,!!ee),Object(z.a)(p,"".concat(U,"-disabled"),B),Object(z.a)(p,"".concat(U,"-focused"),We),p)),Se={};Object.keys(Ge).forEach(function(se){(se.substr(0,5)==="data-"||se.substr(0,5)==="aria-"||se==="role")&&(Se[se]=Ge[se])});var Je=!W&&!B,Qe=this.getInputDisplayValue(null),Ae=($e||$e===0)&&(isNaN($e)||Number($e)>=ie),Ie=($e||$e===0)&&(isNaN($e)||Number($e)<=ve),ge=Ae||B||W,le=Ie||B||W,de=h()("".concat(U,"-handler"),"".concat(U,"-handler-up"),Object(z.a)({},"".concat(U,"-handler-up-disabled"),ge)),Q=h()("".concat(U,"-handler"),"".concat(U,"-handler-down"),Object(z.a)({},"".concat(U,"-handler-down-disabled"),le)),Z=k?{onTouchStart:ge?d:this.up,onTouchEnd:this.stop}:{onMouseDown:ge?d:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},re=k?{onTouchStart:le?d:this.down,onTouchEnd:this.stop}:{onMouseDown:le?d:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return R.a.createElement("div",{className:ze,style:pe,title:he,onMouseEnter:ce,onMouseLeave:fe,onMouseOver:ne,onMouseOut:me,onFocus:function(){return null},onBlur:function(){return null}},R.a.createElement("div",{className:"".concat(U,"-handler-wrap")},R.a.createElement("span",Object.assign({unselectable:"on"},Z,{role:"button","aria-label":"Increase Value","aria-disabled":ge,className:de}),H||R.a.createElement("span",{unselectable:"on",className:"".concat(U,"-handler-up-inner"),onClick:o})),R.a.createElement("span",Object.assign({unselectable:"on"},re,{role:"button","aria-label":"Decrease Value","aria-disabled":le,className:Q}),X||R.a.createElement("span",{unselectable:"on",className:"".concat(U,"-handler-down-inner"),onClick:o}))),R.a.createElement("div",{className:"".concat(U,"-input-wrap")},R.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":ve,"aria-valuemax":ie,"aria-valuenow":$e,required:$,type:Ee,placeholder:Ce,onPaste:Ze,onClick:ae,onMouseUp:this.onMouseUp,className:"".concat(U,"-input"),tabIndex:q,autoComplete:M,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:Je?this.onKeyDown:d,onKeyUp:Je?this.onKeyUp:d,autoFocus:Me,maxLength:Fe,readOnly:W,disabled:B,max:ie,min:ve,step:ke,name:Pe,title:he,id:ye,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(Qe),pattern:Le,inputMode:we,onInput:qe},Se))))}}]),E}(R.a.Component);T.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:b,min:-b,step:1,style:{},onChange:d,onKeyDown:d,onPressEnter:d,onFocus:d,onBlur:d,parser:l,required:!1,autoComplete:"off"};var m=T,c=Ve.a=m},f4xo:function(tt,Ve,te){var J=te("nVVt");function z(D){this.mode=J.MODE_8BIT_BYTE,this.data=D}z.prototype={getLength:function(D){return this.data.length},write:function(D){for(var K=0;K<this.data.length;K++)D.put(this.data.charCodeAt(K),8)}},tt.exports=z},h78n:function(tt,Ve,te){"use strict";te.d(Ve,"a",function(){return p});var J=te("cDcd"),z=te.n(J),D=te("TSYQ"),K=te.n(D),F={className:"",percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,style:{},trailColor:"#D9D9D9",trailWidth:1},O=function(B){var W=B.map(function(){return Object(J.useRef)()}),k=Object(J.useRef)();return Object(J.useEffect)(function(){var M=Date.now(),H=!1;Object.keys(W).forEach(function(X){var ee=W[X].current;if(!ee)return;H=!0;var ie=ee.style;ie.transitionDuration=".3s, .3s, .3s, .06s",k.current&&M-k.current<100&&(ie.transitionDuration="0s, 0s")}),H&&(k.current=Date.now())}),[W]};function N(){return N=Object.assign||function(U){for(var B=1;B<arguments.length;B++){var W=arguments[B];for(var k in W)Object.prototype.hasOwnProperty.call(W,k)&&(U[k]=W[k])}return U},N.apply(this,arguments)}function I(U,B){return P(U)||y(U,B)||C(U,B)||R()}function R(){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 C(U,B){if(!U)return;if(typeof U=="string")return h(U,B);var W=Object.prototype.toString.call(U).slice(8,-1);if(W==="Object"&&U.constructor&&(W=U.constructor.name),W==="Map"||W==="Set")return Array.from(U);if(W==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(W))return h(U,B)}function h(U,B){(B==null||B>U.length)&&(B=U.length);for(var W=0,k=new Array(B);W<B;W++)k[W]=U[W];return k}function y(U,B){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(U)))return;var W=[],k=!0,M=!1,H=void 0;try{for(var X=U[Symbol.iterator](),ee;!(k=(ee=X.next()).done)&&!(W.push(ee.value),B&&W.length===B);k=!0);}catch(ie){M=!0,H=ie}finally{try{!k&&X.return!=null&&X.return()}finally{if(M)throw H}}return W}function P(U){if(Array.isArray(U))return U}function w(U,B){if(U==null)return{};var W=x(U,B),k,M;if(Object.getOwnPropertySymbols){var H=Object.getOwnPropertySymbols(U);for(M=0;M<H.length;M++){if(k=H[M],B.indexOf(k)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(U,k))continue;W[k]=U[k]}}return W}function x(U,B){if(U==null)return{};var W={},k=Object.keys(U),M,H;for(H=0;H<k.length;H++){if(M=k[H],B.indexOf(M)>=0)continue;W[M]=U[M]}return W}var v=function(B){var W=B.className,k=B.percent,M=B.prefixCls,H=B.strokeColor,X=B.strokeLinecap,ee=B.strokeWidth,ie=B.style,ve=B.trailColor,pe=B.trailWidth,he=B.transition,ce=w(B,["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"]);delete ce.gapPosition;var fe=Array.isArray(k)?k:[k],ne=Array.isArray(H)?H:[H],me=O(fe),$=I(me,1),ae=$[0],q=ee/2,Ee=100-ee/2,Ce="M ".concat(X==="round"?q:0,",").concat(q,`
|
|
L `).concat(X==="round"?Ee:100,",").concat(q),ye="0 0 100 ".concat(ee),we=0;return z.a.createElement("svg",N({className:K()("".concat(M,"-line"),W),viewBox:ye,preserveAspectRatio:"none",style:ie},ce),z.a.createElement("path",{className:"".concat(M,"-line-trail"),d:Ce,strokeLinecap:X,stroke:ve,strokeWidth:pe||ee,fillOpacity:"0"}),fe.map(function(Le,ke){var Fe={strokeDasharray:"".concat(Le,"px, 100px"),strokeDashoffset:"-".concat(we,"px"),transition:he||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},Me=ne[ke]||ne[ne.length-1];return we+=Le,z.a.createElement("path",{key:ke,className:"".concat(M,"-line-path"),d:Ce,strokeLinecap:X,stroke:Me,strokeWidth:ee,fillOpacity:"0",ref:ae[ke],style:Fe})}))};v.defaultProps=F;var d=v;function o(){return o=Object.assign||function(U){for(var B=1;B<arguments.length;B++){var W=arguments[B];for(var k in W)Object.prototype.hasOwnProperty.call(W,k)&&(U[k]=W[k])}return U},o.apply(this,arguments)}function l(U,B){return L(U)||f(U,B)||S(U,B)||s()}function s(){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(U,B){if(!U)return;if(typeof U=="string")return b(U,B);var W=Object.prototype.toString.call(U).slice(8,-1);if(W==="Object"&&U.constructor&&(W=U.constructor.name),W==="Map"||W==="Set")return Array.from(U);if(W==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(W))return b(U,B)}function b(U,B){(B==null||B>U.length)&&(B=U.length);for(var W=0,k=new Array(B);W<B;W++)k[W]=U[W];return k}function f(U,B){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(U)))return;var W=[],k=!0,M=!1,H=void 0;try{for(var X=U[Symbol.iterator](),ee;!(k=(ee=X.next()).done)&&!(W.push(ee.value),B&&W.length===B);k=!0);}catch(ie){M=!0,H=ie}finally{try{!k&&X.return!=null&&X.return()}finally{if(M)throw H}}return W}function L(U){if(Array.isArray(U))return U}function T(U,B){if(U==null)return{};var W=m(U,B),k,M;if(Object.getOwnPropertySymbols){var H=Object.getOwnPropertySymbols(U);for(M=0;M<H.length;M++){if(k=H[M],B.indexOf(k)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(U,k))continue;W[k]=U[k]}}return W}function m(U,B){if(U==null)return{};var W={},k=Object.keys(U),M,H;for(H=0;H<k.length;H++){if(M=k[H],B.indexOf(M)>=0)continue;W[M]=U[M]}return W}var c=0;function u(U){return+U.replace("%","")}function a(U){return Array.isArray(U)?U:[U]}function E(U,B,W,k){var M=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,H=arguments.length>5?arguments[5]:void 0,X=50-k/2,ee=0,ie=-X,ve=0,pe=-2*X;switch(H){case"left":ee=-X,ie=0,ve=2*X,pe=0;break;case"right":ee=X,ie=0,ve=-2*X,pe=0;break;case"bottom":ie=X,pe=2*X;break;default:}var he="M 50,50 m ".concat(ee,",").concat(ie,`
|
|
a `).concat(X,",").concat(X," 0 1 1 ").concat(ve,",").concat(-pe,`
|
|
a `).concat(X,",").concat(X," 0 1 1 ").concat(-ve,",").concat(pe),ce=Math.PI*2*X,fe={stroke:W,strokeDasharray:"".concat(B/100*(ce-M),"px ").concat(ce,"px"),strokeDashoffset:"-".concat(M/2+U/100*(ce-M),"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"};return{pathString:he,pathStyle:fe}}var g=function(B){var W=B.prefixCls,k=B.strokeWidth,M=B.trailWidth,H=B.gapDegree,X=B.gapPosition,ee=B.trailColor,ie=B.strokeLinecap,ve=B.style,pe=B.className,he=B.strokeColor,ce=B.percent,fe=T(B,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"]),ne=Object(J.useMemo)(function(){return c+=1,c},[]),me=E(0,100,ee,k,H,X),$=me.pathString,ae=me.pathStyle,q=a(ce),Ee=a(he),Ce=Ee.find(function(Fe){return Object.prototype.toString.call(Fe)==="[object Object]"}),ye=O(q),we=l(ye,1),Le=we[0],ke=function(){var Me=0;return q.map(function(Pe,Ze){var qe=Ee[Ze]||Ee[Ee.length-1],Ge=Object.prototype.toString.call(qe)==="[object Object]"?"url(#".concat(W,"-gradient-").concat(ne,")"):"",He=E(Me,Pe,qe,k,H,X);return Me+=Pe,z.a.createElement("path",{key:Ze,className:"".concat(W,"-circle-path"),d:He.pathString,stroke:Ge,strokeLinecap:ie,strokeWidth:k,opacity:Pe===0?0:1,fillOpacity:"0",style:He.pathStyle,ref:Le[Ze]})})};return z.a.createElement("svg",o({className:K()("".concat(W,"-circle"),pe),viewBox:"0 0 100 100",style:ve},fe),Ce&&z.a.createElement("defs",null,z.a.createElement("linearGradient",{id:"".concat(W,"-gradient-").concat(ne),x1:"100%",y1:"0%",x2:"0%",y2:"0%"},Object.keys(Ce).sort(function(Fe,Me){return u(Fe)-u(Me)}).map(function(Fe,Me){return z.a.createElement("stop",{key:Me,offset:Fe,stopColor:Ce[Fe]})}))),z.a.createElement("path",{className:"".concat(W,"-circle-trail"),d:$,stroke:ee,strokeLinecap:ie,strokeWidth:M||k,fillOpacity:"0",style:ae}),ke().reverse())};g.defaultProps=F;var p=g,_={Line:d,Circle:p}},kSUc:function(tt,Ve,te){},lZu9:function(tt,Ve,te){(function(J){J(te("VrN/"),te("1eCo"),te("8EBN"))})(function(J){"use strict";J.defineMode("markdown",function(z,D){var K=J.getMode(z,"text/html"),F=K.name=="null";function O(k){if(J.findModeByName){var M=J.findModeByName(k);M&&(k=M.mime||M.mimes[0])}var H=J.getMode(z,k);return H.name=="null"?null:H}D.highlightFormatting===void 0&&(D.highlightFormatting=!1),D.maxBlockquoteDepth===void 0&&(D.maxBlockquoteDepth=0),D.taskLists===void 0&&(D.taskLists=!1),D.strikethrough===void 0&&(D.strikethrough=!1),D.emoji===void 0&&(D.emoji=!1),D.fencedCodeBlockHighlighting===void 0&&(D.fencedCodeBlockHighlighting=!0),D.fencedCodeBlockDefaultMode===void 0&&(D.fencedCodeBlockDefaultMode="text/plain"),D.xml===void 0&&(D.xml=!0),D.tokenTypeOverrides===void 0&&(D.tokenTypeOverrides={});var N={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 N)N.hasOwnProperty(I)&&D.tokenTypeOverrides[I]&&(N[I]=D.tokenTypeOverrides[I]);var R=/^([*\-_])(?:\s*\1){2,}\s*$/,C=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,h=/^\[(x| )\](?=\s)/i,y=D.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,P=/^ {0,3}(?:\={1,}|-{2,})\s*$/,w=/^[^#!\[\]*_\\<>` "'(~:]+/,x=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,v=/^\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 l(k,M,H){return M.f=M.inline=H,H(k,M)}function s(k,M,H){return M.f=M.block=H,H(k,M)}function S(k){return!k||!/\S/.test(k.string)}function b(k){if(k.linkTitle=!1,k.linkHref=!1,k.linkText=!1,k.em=!1,k.strong=!1,k.strikethrough=!1,k.quote=0,k.indentedCode=!1,k.f==L){var M=F;if(!M){var H=J.innerMode(K,k.htmlState);M=H.mode.name=="xml"&&H.state.tagStart===null&&!H.state.context&&H.state.tokenize.isInText}M&&(k.f=u,k.block=f,k.htmlState=null)}return k.trailingSpace=0,k.trailingSpaceNewLine=!1,k.prevLine=k.thisLine,k.thisLine={stream:null},null}function f(k,M){var H=k.column()===M.indentation,X=S(M.prevLine.stream),ee=M.indentedCode,ie=M.prevLine.hr,ve=M.list!==!1,pe=(M.listStack[M.listStack.length-1]||0)+3;M.indentedCode=!1;var he=M.indentation;if(M.indentationDiff===null&&(M.indentationDiff=M.indentation,ve)){for(M.list=null;he<M.listStack[M.listStack.length-1];)M.listStack.pop(),M.listStack.length?M.indentation=M.listStack[M.listStack.length-1]:M.list=!1;M.list!==!1&&(M.indentationDiff=he-M.listStack[M.listStack.length-1])}var ce=!X&&!ie&&!M.prevLine.header&&(!ve||!ee)&&!M.prevLine.fencedCodeEnd,fe=(M.list===!1||ie||X)&&M.indentation<=pe&&k.match(R),ne=null;if(M.indentationDiff>=4&&(ee||M.prevLine.fencedCodeEnd||M.prevLine.header||X))return k.skipToEnd(),M.indentedCode=!0,N.code;if(k.eatSpace())return null;if(H&&M.indentation<=pe&&(ne=k.match(y))&&ne[1].length<=6)return M.quote=0,M.header=ne[1].length,M.thisLine.header=!0,D.highlightFormatting&&(M.formatting="header"),M.f=M.inline,m(M);if(M.indentation<=pe&&k.eat(">"))return M.quote=H?1:M.quote+1,D.highlightFormatting&&(M.formatting="quote"),k.eatSpace(),m(M);if(!fe&&!M.setext&&H&&M.indentation<=pe&&(ne=k.match(C))){var me=ne[1]?"ol":"ul";return M.indentation=he+k.current().length,M.list=!0,M.quote=0,M.listStack.push(M.indentation),M.em=!1,M.strong=!1,M.code=!1,M.strikethrough=!1,D.taskLists&&k.match(h,!1)&&(M.taskList=!0),M.f=M.inline,D.highlightFormatting&&(M.formatting=["list","list-"+me]),m(M)}else{if(H&&M.indentation<=pe&&(ne=k.match(x,!0)))return M.quote=0,M.fencedEndRE=new RegExp(ne[1]+"+ *$"),M.localMode=D.fencedCodeBlockHighlighting&&O(ne[2]||D.fencedCodeBlockDefaultMode),M.localMode&&(M.localState=J.startState(M.localMode)),M.f=M.block=T,D.highlightFormatting&&(M.formatting="code-block"),M.code=-1,m(M);if(M.setext||(!ce||!ve)&&!M.quote&&M.list===!1&&!M.code&&!fe&&!v.test(k.string)&&(ne=k.lookAhead(1))&&(ne=ne.match(P)))return M.setext?(M.header=M.setext,M.setext=0,k.skipToEnd(),D.highlightFormatting&&(M.formatting="header")):(M.header=ne[0].charAt(0)=="="?1:2,M.setext=M.header),M.thisLine.header=!0,M.f=M.inline,m(M);if(fe)return k.skipToEnd(),M.hr=!0,M.thisLine.hr=!0,N.hr;if(k.peek()==="[")return l(k,M,_)}return l(k,M,M.inline)}function L(k,M){var H=K.token(k,M.htmlState);if(!F){var X=J.innerMode(K,M.htmlState);(X.mode.name=="xml"&&X.state.tagStart===null&&!X.state.context&&X.state.tokenize.isInText||M.md_inside&&k.current().indexOf(">")>-1)&&(M.f=u,M.block=f,M.htmlState=null)}return H}function T(k,M){var H=M.listStack[M.listStack.length-1]||0,X=M.indentation<H,ee=H+3;if(M.fencedEndRE&&M.indentation<=ee&&(X||k.match(M.fencedEndRE))){D.highlightFormatting&&(M.formatting="code-block");var ie;return X||(ie=m(M)),M.localMode=M.localState=null,M.block=f,M.f=u,M.fencedEndRE=null,M.code=0,M.thisLine.fencedCodeEnd=!0,X?s(k,M,M.block):ie}else return M.localMode?M.localMode.token(k,M.localState):(k.skipToEnd(),N.code)}function m(k){var M=[];if(k.formatting){M.push(N.formatting),typeof k.formatting=="string"&&(k.formatting=[k.formatting]);for(var H=0;H<k.formatting.length;H++)M.push(N.formatting+"-"+k.formatting[H]),k.formatting[H]==="header"&&M.push(N.formatting+"-"+k.formatting[H]+"-"+k.header),k.formatting[H]==="quote"&&(!D.maxBlockquoteDepth||D.maxBlockquoteDepth>=k.quote?M.push(N.formatting+"-"+k.formatting[H]+"-"+k.quote):M.push("error"))}if(k.taskOpen)return M.push("meta"),M.length?M.join(" "):null;if(k.taskClosed)return M.push("property"),M.length?M.join(" "):null;if(k.linkHref?M.push(N.linkHref,"url"):(k.strong&&M.push(N.strong),k.em&&M.push(N.em),k.strikethrough&&M.push(N.strikethrough),k.emoji&&M.push(N.emoji),k.linkText&&M.push(N.linkText),k.code&&M.push(N.code),k.image&&M.push(N.image),k.imageAltText&&M.push(N.imageAltText,"link"),k.imageMarker&&M.push(N.imageMarker)),k.header&&M.push(N.header,N.header+"-"+k.header),k.quote&&(M.push(N.quote),!D.maxBlockquoteDepth||D.maxBlockquoteDepth>=k.quote?M.push(N.quote+"-"+k.quote):M.push(N.quote+"-"+D.maxBlockquoteDepth)),k.list!==!1){var X=(k.listStack.length-1)%3;X?X===1?M.push(N.list2):M.push(N.list3):M.push(N.list1)}return k.trailingSpaceNewLine?M.push("trailing-space-new-line"):k.trailingSpace&&M.push("trailing-space-"+(k.trailingSpace%2?"a":"b")),M.length?M.join(" "):null}function c(k,M){return k.match(w,!0)?m(M):void 0}function u(k,M){var H=M.text(k,M);if(typeof H!="undefined")return H;if(M.list)return M.list=null,m(M);if(M.taskList){var X=k.match(h,!0)[1]===" ";return X?M.taskOpen=!0:M.taskClosed=!0,D.highlightFormatting&&(M.formatting="task"),M.taskList=!1,m(M)}if(M.taskOpen=!1,M.taskClosed=!1,M.header&&k.match(/^#+$/,!0))return D.highlightFormatting&&(M.formatting="header"),m(M);var ee=k.next();if(M.linkTitle){M.linkTitle=!1;var ie=ee;ee==="("&&(ie=")"),ie=(ie+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var ve="^\\s*(?:[^"+ie+"\\\\]+|\\\\\\\\|\\\\.)"+ie;if(k.match(new RegExp(ve),!0))return N.linkHref}if(ee==="`"){var pe=M.formatting;D.highlightFormatting&&(M.formatting="code"),k.eatWhile("`");var he=k.current().length;if(M.code==0&&(!M.quote||he==1))return M.code=he,m(M);if(he==M.code){var ce=m(M);return M.code=0,ce}else return M.formatting=pe,m(M)}else if(M.code)return m(M);if(ee==="\\"&&(k.next(),D.highlightFormatting)){var fe=m(M),ne=N.formatting+"-escape";return fe?fe+" "+ne:ne}if(ee==="!"&&k.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return M.imageMarker=!0,M.image=!0,D.highlightFormatting&&(M.formatting="image"),m(M);if(ee==="["&&M.imageMarker&&k.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return M.imageMarker=!1,M.imageAltText=!0,D.highlightFormatting&&(M.formatting="image"),m(M);if(ee==="]"&&M.imageAltText){D.highlightFormatting&&(M.formatting="image");var fe=m(M);return M.imageAltText=!1,M.image=!1,M.inline=M.f=E,fe}if(ee==="["&&!M.image)return M.linkText&&k.match(/^.*?\]/)||(M.linkText=!0,D.highlightFormatting&&(M.formatting="link")),m(M);if(ee==="]"&&M.linkText){D.highlightFormatting&&(M.formatting="link");var fe=m(M);return M.linkText=!1,M.inline=M.f=k.match(/\(.*?\)| ?\[.*?\]/,!1)?E:u,fe}if(ee==="<"&&k.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){M.f=M.inline=a,D.highlightFormatting&&(M.formatting="link");var fe=m(M);return fe?fe+=" ":fe="",fe+N.linkInline}if(ee==="<"&&k.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){M.f=M.inline=a,D.highlightFormatting&&(M.formatting="link");var fe=m(M);return fe?fe+=" ":fe="",fe+N.linkEmail}if(D.xml&&ee==="<"&&k.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var me=k.string.indexOf(">",k.pos);if(me!=-1){var $=k.string.substring(k.start,me);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test($)&&(M.md_inside=!0)}return k.backUp(1),M.htmlState=J.startState(K),s(k,M,L)}if(D.xml&&ee==="<"&&k.match(/^\/\w*?>/))return M.md_inside=!1,"tag";if(ee==="*"||ee==="_"){for(var ae=1,q=k.pos==1?" ":k.string.charAt(k.pos-2);ae<3&&k.eat(ee);)ae++;var Ee=k.peek()||" ",Ce=!/\s/.test(Ee)&&(!d.test(Ee)||/\s/.test(q)||d.test(q)),ye=!/\s/.test(q)&&(!d.test(q)||/\s/.test(Ee)||d.test(Ee)),we=null,Le=null;if(ae%2&&(!M.em&&Ce&&(ee==="*"||!ye||d.test(q))?we=!0:M.em==ee&&ye&&(ee==="*"||!Ce||d.test(Ee))&&(we=!1)),ae>1&&(!M.strong&&Ce&&(ee==="*"||!ye||d.test(q))?Le=!0:M.strong==ee&&ye&&(ee==="*"||!Ce||d.test(Ee))&&(Le=!1)),Le!=null||we!=null){D.highlightFormatting&&(M.formatting=we==null?"strong":Le==null?"em":"strong em"),we===!0&&(M.em=ee),Le===!0&&(M.strong=ee);var ce=m(M);return we===!1&&(M.em=!1),Le===!1&&(M.strong=!1),ce}}else if(ee===" "&&(k.eat("*")||k.eat("_"))){if(k.peek()===" ")return m(M);k.backUp(1)}if(D.strikethrough){if(ee==="~"&&k.eatWhile(ee)){if(M.strikethrough){D.highlightFormatting&&(M.formatting="strikethrough");var ce=m(M);return M.strikethrough=!1,ce}else if(k.match(/^[^\s]/,!1))return M.strikethrough=!0,D.highlightFormatting&&(M.formatting="strikethrough"),m(M)}else if(ee===" "&&k.match(/^~~/,!0)){if(k.peek()===" ")return m(M);k.backUp(2)}}if(D.emoji&&ee===":"&&k.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){M.emoji=!0,D.highlightFormatting&&(M.formatting="emoji");var ke=m(M);return M.emoji=!1,ke}return ee===" "&&(k.match(/^ +$/,!1)?M.trailingSpace++:M.trailingSpace&&(M.trailingSpaceNewLine=!0)),m(M)}function a(k,M){var H=k.next();if(H===">"){M.f=M.inline=u,D.highlightFormatting&&(M.formatting="link");var X=m(M);return X?X+=" ":X="",X+N.linkInline}return k.match(/^[^>]+/,!0),N.linkInline}function E(k,M){if(k.eatSpace())return null;var H=k.next();return H==="("||H==="["?(M.f=M.inline=p(H==="("?")":"]"),D.highlightFormatting&&(M.formatting="link-string"),M.linkHref=!0,m(M)):"error"}var g={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function p(k){return function(M,H){var X=M.next();if(X===k){H.f=H.inline=u,D.highlightFormatting&&(H.formatting="link-string");var ee=m(H);return H.linkHref=!1,ee}return M.match(g[k]),H.linkHref=!0,m(H)}}function _(k,M){return k.match(/^([^\]\\]|\\.)*\]:/,!1)?(M.f=U,k.next(),D.highlightFormatting&&(M.formatting="link"),M.linkText=!0,m(M)):l(k,M,u)}function U(k,M){if(k.match(/^\]:/,!0)){M.f=M.inline=B,D.highlightFormatting&&(M.formatting="link");var H=m(M);return M.linkText=!1,H}return k.match(/^([^\]\\]|\\.)+/,!0),N.linkText}function B(k,M){return k.eatSpace()?null:(k.match(/^[^\s]+/,!0),k.peek()===void 0?M.linkTitle=!0:k.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),M.f=M.inline=u,N.linkHref+" url")}var W={startState:function(){return{f,prevLine:{stream:null},thisLine:{stream:null},block:f,htmlState:null,indentation:0,inline:u,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(k){return{f:k.f,prevLine:k.prevLine,thisLine:k.thisLine,block:k.block,htmlState:k.htmlState&&J.copyState(K,k.htmlState),indentation:k.indentation,localMode:k.localMode,localState:k.localMode?J.copyState(k.localMode,k.localState):null,inline:k.inline,text:k.text,formatting:!1,linkText:k.linkText,linkTitle:k.linkTitle,linkHref:k.linkHref,code:k.code,em:k.em,strong:k.strong,strikethrough:k.strikethrough,emoji:k.emoji,header:k.header,setext:k.setext,hr:k.hr,taskList:k.taskList,list:k.list,listStack:k.listStack.slice(0),quote:k.quote,indentedCode:k.indentedCode,trailingSpace:k.trailingSpace,trailingSpaceNewLine:k.trailingSpaceNewLine,md_inside:k.md_inside,fencedEndRE:k.fencedEndRE}},token:function(k,M){if(M.formatting=!1,k!=M.thisLine.stream){if(M.header=0,M.hr=!1,k.match(/^\s*$/,!0))return b(M),null;if(M.prevLine=M.thisLine,M.thisLine={stream:k},M.taskList=!1,M.trailingSpace=0,M.trailingSpaceNewLine=!1,!M.localState&&(M.f=M.block,M.f!=L)){var H=k.match(/^\s*/,!0)[0].replace(/\t/g,o).length;if(M.indentation=H,M.indentationDiff=null,H>0)return null}}return M.f(k,M)},innerMode:function(k){return k.block==L?{state:k.htmlState,mode:K}:k.localState?{state:k.localState,mode:k.localMode}:{state:k,mode:W}},indent:function(k,M,H){return k.block==L&&K.indent?K.indent(k.htmlState,M,H):k.localState&&k.localMode.indent?k.localMode.indent(k.localState,M,H):J.Pass},blankLine:b,getType:m,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return W},"xml"),J.defineMIME("text/markdown","markdown"),J.defineMIME("text/x-markdown","markdown")})},nVVt:function(tt,Ve){tt.exports={MODE_NUMBER:1<<0,MODE_ALPHA_NUM:1<<1,MODE_8BIT_BYTE:1<<2,MODE_KANJI:1<<3}},osHv:function(tt,Ve,te){(function(J){J(te("VrN/"))})(function(J){"use strict";var z=J.Pos;function D(d,o){return d.line-o.line||d.ch-o.ch}var K="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",F=K+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",O=new RegExp("<(/?)(["+K+"]["+F+"]*)","g");function N(d,o,l,s){this.line=o,this.ch=l,this.cm=d,this.text=d.getLine(o),this.min=s?Math.max(s.from,d.firstLine()):d.firstLine(),this.max=s?Math.min(s.to-1,d.lastLine()):d.lastLine()}function I(d,o){var l=d.cm.getTokenTypeAt(z(d.line,o));return l&&/\btag\b/.test(l)}function R(d){return d.line>=d.max?void 0:(d.ch=0,d.text=d.cm.getLine(++d.line),!0)}function C(d){return d.line<=d.min?void 0:(d.text=d.cm.getLine(--d.line),d.ch=d.text.length,!0)}function h(d){for(;;){var o=d.text.indexOf(">",d.ch);if(o==-1){if(R(d))continue;return}if(!I(d,o+1)){d.ch=o+1;continue}var l=d.text.lastIndexOf("/",o),s=l>-1&&!/\S/.test(d.text.slice(l+1,o));return d.ch=o+1,s?"selfClose":"regular"}}function y(d){for(;;){var o=d.ch?d.text.lastIndexOf("<",d.ch-1):-1;if(o==-1){if(C(d))continue;return}if(!I(d,o+1)){d.ch=o;continue}O.lastIndex=o,d.ch=o;var l=O.exec(d.text);if(l&&l.index==o)return l}}function P(d){for(;;){O.lastIndex=d.ch;var o=O.exec(d.text);if(!o){if(R(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 w(d){for(;;){var o=d.ch?d.text.lastIndexOf(">",d.ch-1):-1;if(o==-1){if(C(d))continue;return}if(!I(d,o+1)){d.ch=o;continue}var l=d.text.lastIndexOf("/",o),s=l>-1&&!/\S/.test(d.text.slice(l+1,o));return d.ch=o+1,s?"selfClose":"regular"}}function x(d,o){for(var l=[];;){var s=P(d),S,b=d.line,f=d.ch-(s?s[0].length:0);if(!s||!(S=h(d)))return;if(S=="selfClose")continue;if(s[1]){for(var L=l.length-1;L>=0;--L)if(l[L]==s[2]){l.length=L;break}if(L<0&&(!o||o==s[2]))return{tag:s[2],from:z(b,f),to:z(d.line,d.ch)}}else l.push(s[2])}}function v(d,o){for(var l=[];;){var s=w(d);if(!s)return;if(s=="selfClose"){y(d);continue}var S=d.line,b=d.ch,f=y(d);if(!f)return;if(f[1])l.push(f[2]);else{for(var L=l.length-1;L>=0;--L)if(l[L]==f[2]){l.length=L;break}if(L<0&&(!o||o==f[2]))return{tag:f[2],from:z(d.line,d.ch),to:z(S,b)}}}}J.registerHelper("fold","xml",function(d,o){for(var l=new N(d,o.line,0);;){var s=P(l);if(!s||l.line!=o.line)return;var S=h(l);if(!S)return;if(!s[1]&&S!="selfClose"){var b=z(l.line,l.ch),f=x(l,s[2]);return f&&D(f.from,b)>0?{from:b,to:f.from}:null}}}),J.findMatchingTag=function(d,o,l){var s=new N(d,o.line,o.ch,l);if(s.text.indexOf(">")==-1&&s.text.indexOf("<")==-1)return;var S=h(s),b=S&&z(s.line,s.ch),f=S&&y(s);if(!S||!f||D(s,o)>0)return;var L={from:z(s.line,s.ch),to:b,tag:f[2]};return S=="selfClose"?{open:L,close:null,at:"open"}:f[1]?{open:v(s,f[2]),close:L,at:"close"}:(s=new N(d,b.line,b.ch,l),{open:L,close:x(s,f[2]),at:"open"})},J.findEnclosingTag=function(d,o,l,s){for(var S=new N(d,o.line,o.ch,l);;){var b=v(S,s);if(!b)break;var f=new N(d,o.line,o.ch,l),L=x(f,b.tag);if(L)return{open:b,close:L}}},J.scanForClosingTag=function(d,o,l,s){var S=new N(d,o.line,o.ch,s?{from:0,to:s}:null);return x(S,l)}})},p5ED:function(tt,Ve,te){"use strict";var J=te("+L6B"),z=te("2/Rp"),D=te("5Dmo"),K=te("3S7+"),F=te("k1fw"),O=te("tJVT"),N=te("cDcd"),I=te.n(N),R=te("vHTk"),C=te.n(R),h=te("yEEn"),y=te("ZW9T"),P=te("1vsH");Ve.a=function(w){var x=w.name,v=w.data,d=w.theme,o=w.type,l=w.filename,s=w.monacoEditor,S=w.className,b=w.style,f=w.close,L=w.onClose,T=w.hasMask,m=Object(N.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),c=Object(O.a)(m,2),u=c[0],a=c[1],E=Object(N.useState)(""),g=Object(O.a)(E,2),p=g[0],_=g[1],U,B=1024*1024,W=10*B,k=Object(N.useRef)();o==="office"&&(U=Object(P.V)(v).filesize,U>W&&(o="other")),l&&(s.filename=l),Object(N.useEffect)(function(){var X,ee,ie=(X=document.cookie)===null||X===void 0||((ee=X.replace(/\s/g,""))===null||ee===void 0)?void 0:ee.split(";");ie==null||ie.map(function(ve){var pe=ve.split("=");pe[0]==="_educoder_session"&&_(pe[1])})},[]);var M=function(){if(v.startsWith("http")||v.startsWith("blob:")){H();return}Object(P.z)(l||"educoder",v,l)},H=function(){Object(P.x)(l||"educoder",decodeURIComponent(v))};return console.log("data:",v,"fileanme:",l," name:",x),I.a.createElement("div",{style:Object(F.a)({},b||{}),className:"".concat(T&&C.a.bgBlack," ").concat(o?C.a.wrp:"hide")},f&&I.a.createElement("div",{className:C.a.close,ref:k},I.a.createElement(K.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return k.current}},I.a.createElement("span",{onClick:H},I.a.createElement("i",{className:"icon-quxiaozhiding"}))),I.a.createElement(K.a,{title:"\u5173\u95ED",getPopupContainer:function(){return k.current}},I.a.createElement("span",{className:"",onClick:L},I.a.createElement("i",{className:"icon-guanbi1"})))),I.a.createElement("div",{className:"".concat(C.a[S]," ").concat(S," ").concat(C.a.monaco," ").concat(o==="txt"?"show":"hide")},o==="txt"&&I.a.createElement(y.b,s)),o==="audio"&&I.a.createElement("audio",{src:"".concat(v!=null&&v.startsWith("/")||(v==null?void 0:v.indexOf("https://"))>-1?v:"data:audio/mp3;base64,").concat(v),autoPlay:!0}),o==="video"&&I.a.createElement(I.a.Fragment,null,v!=null&&v.startsWith("/")?I.a.createElement("video",{controls:!0,src:"".concat(v),autoPlay:!0}):I.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(v),autoPlay:!0})),o==="html"&&I.a.createElement("iframe",{src:v+"&disposition=inline"}),o==="html"&&I.a.createElement("iframe",{src:v+"&disposition=inline"}),o==="pdf"&&I.a.createElement("embed",{className:C.a.embed,src:v}),o==="image"&&I.a.createElement(I.a.Fragment,null,I.a.createElement("img",{src:"".concat(v!=null&&v.startsWith("/")||(v==null?void 0:v.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(v)})),o==="other"&&I.a.createElement("div",null,I.a.createElement(z.a,{type:"primary",size:"large",onClick:M},I.a.createElement(h.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),(o==="download"||o==="office")&&I.a.createElement(z.a,{type:"primary",size:"large",onClick:M},I.a.createElement(h.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(tt,Ve,te){},"rAM+":function(tt,Ve,te){"use strict";te.d(Ve,"a",function(){return z});var J=te("Qw5x");function z(D,K){var F;if(typeof Symbol=="undefined"||D[Symbol.iterator]==null){if(Array.isArray(D)||(F=Object(J.a)(D))||K&&D&&typeof D.length=="number"){F&&(D=F);var O=0,N=function(){};return{s:N,n:function(){return O>=D.length?{done:!0}:{done:!1,value:D[O++]}},e:function(y){throw y},f:N}}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,R=!1,C;return{s:function(){F=D[Symbol.iterator]()},n:function(){var y=F.next();return I=y.done,y},e:function(y){R=!0,C=y},f:function(){try{!I&&F.return!=null&&F.return()}finally{if(R)throw C}}}}},rUJ1:function(tt,Ve){const te=/[&<>"']/,J=/[&<>"']/g,z=/[<>"']|&(?!#?\w+;)/,D=/[<>"']|&(?!#?\w+;)/g,K={"&":"&","<":"<",">":">",'"':""","'":"'"},F=T=>K[T];function O(T,m){if(m){if(te.test(T))return T.replace(J,F)}else if(z.test(T))return T.replace(D,F);return T}const N=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function I(T){return T.replace(N,(m,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 R=/(^|[^\[])\^/g;function C(T,m){T=T.source||T,m=m||"";const c={replace:(u,a)=>(a=a.source||a,a=a.replace(R,"$1"),T=T.replace(u,a),c),getRegex:()=>new RegExp(T,m)};return c}const h=/[^\w:]/g,y=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function P(T,m,c){if(T){let u;try{u=decodeURIComponent(I(c)).replace(h,"").toLowerCase()}catch(a){return null}if(u.indexOf("javascript:")===0||u.indexOf("vbscript:")===0||u.indexOf("data:")===0)return null}m&&!y.test(c)&&(c=o(m,c));try{c=encodeURI(c).replace(/%25/g,"%")}catch(u){return null}return c}const w={},x=/^[^:]+:\/*[^/]*$/,v=/^([^:]+:)[\s\S]*$/,d=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(T,m){w[" "+T]||(x.test(T)?w[" "+T]=T+"/":w[" "+T]=b(T,"/",!0)),T=w[" "+T];const c=T.indexOf(":")===-1;return m.substring(0,2)==="//"?c?m:T.replace(v,"$1")+m:m.charAt(0)==="/"?c?m:T.replace(d,"$1")+m:T+m}const l={exec:function(){}};function s(T){let m=1,c,u;for(;m<arguments.length;m++){c=arguments[m];for(u in c)Object.prototype.hasOwnProperty.call(c,u)&&(T[u]=c[u])}return T}function S(T,m){const c=T.replace(/\|/g,(E,g,p)=>{let _=!1,U=g;for(;--U>=0&&p[U]==="\\";)_=!_;return _?"|":" |"}),u=c.split(/ \|/);let a=0;if(u.length>m)u.splice(m);else for(;u.length<m;)u.push("");for(;a<u.length;a++)u[a]=u[a].trim().replace(/\\\|/g,"|");return u}function b(T,m,c){const u=T.length;if(u===0)return"";let a=0;for(;a<u;){const E=T.charAt(u-a-1);if(E===m&&!c)a++;else if(E!==m&&c)a++;else break}return T.substr(0,u-a)}function f(T,m){if(T.indexOf(m[1])===-1)return-1;const c=T.length;let u=0,a=0;for(;a<c;a++)if(T[a]==="\\")a++;else if(T[a]===m[0])u++;else if(T[a]===m[1]&&(u--,u<0))return a;return-1}function L(T){T&&T.sanitize&&!T.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")}tt.exports={escape:O,unescape:I,edit:C,cleanUrl:P,resolveUrl:o,noopTest:l,merge:s,splitCells:S,rtrim:b,findClosingBracket:f,checkSanitizeDeprecation:L}},rcnY:function(tt,Ve,te){var J=te("aRTE");function z(D,K){this.totalCount=D,this.dataCount=K}z.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],z.getRSBlocks=function(D,K){var F=z.getRsBlockTable(D,K);if(F==null)throw new Error("bad rs block @ typeNumber:"+D+"/errorCorrectLevel:"+K);for(var O=F.length/3,N=new Array,I=0;I<O;I++)for(var R=F[I*3+0],C=F[I*3+1],h=F[I*3+2],y=0;y<R;y++)N.push(new z(C,h));return N},z.getRsBlockTable=function(D,K){switch(K){case J.L:return z.RS_BLOCK_TABLE[(D-1)*4+0];case J.M:return z.RS_BLOCK_TABLE[(D-1)*4+1];case J.Q:return z.RS_BLOCK_TABLE[(D-1)*4+2];case J.H:return z.RS_BLOCK_TABLE[(D-1)*4+3];default:return}},tt.exports=z},ulZh:function(tt,Ve,te){typeof window!="undefined"&&function(z,D){tt.exports=D()}(this,function(){return function(J){var z={};function D(K){if(z[K])return z[K].exports;var F=z[K]={i:K,l:!1,exports:{}};return J[K].call(F.exports,F,F.exports,D),F.l=!0,F.exports}return D.m=J,D.c=z,D.d=function(K,F,O){D.o(K,F)||Object.defineProperty(K,F,{enumerable:!0,get:O})},D.r=function(K){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(K,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(K,"__esModule",{value:!0})},D.t=function(K,F){if(F&1&&(K=D(K)),F&8)return K;if(F&4&&typeof K=="object"&&K&&K.__esModule)return K;var O=Object.create(null);if(D.r(O),Object.defineProperty(O,"default",{enumerable:!0,value:K}),F&2&&typeof K!="string")for(var N in K)D.d(O,N,function(I){return K[I]}.bind(null,N));return O},D.n=function(K){var F=K&&K.__esModule?function(){return K.default}:function(){return K};return D.d(F,"a",F),F},D.o=function(K,F){return Object.prototype.hasOwnProperty.call(K,F)},D.p="/dist/",D(D.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(J,z,D){"use strict";var K=Object.prototype.hasOwnProperty,F="~";function O(){}Object.create&&(O.prototype=Object.create(null),new O().__proto__||(F=!1));function N(h,y,P){this.fn=h,this.context=y,this.once=P||!1}function I(h,y,P,w,x){if(typeof P!="function")throw new TypeError("The listener must be a function");var v=new N(P,w||h,x),d=F?F+y:y;return h._events[d]?h._events[d].fn?h._events[d]=[h._events[d],v]:h._events[d].push(v):(h._events[d]=v,h._eventsCount++),h}function R(h,y){--h._eventsCount===0?h._events=new O:delete h._events[y]}function C(){this._events=new O,this._eventsCount=0}C.prototype.eventNames=function(){var y=[],P,w;if(this._eventsCount===0)return y;for(w in P=this._events)K.call(P,w)&&y.push(F?w.slice(1):w);return Object.getOwnPropertySymbols?y.concat(Object.getOwnPropertySymbols(P)):y},C.prototype.listeners=function(y){var P=F?F+y:y,w=this._events[P];if(!w)return[];if(w.fn)return[w.fn];for(var x=0,v=w.length,d=new Array(v);x<v;x++)d[x]=w[x].fn;return d},C.prototype.listenerCount=function(y){var P=F?F+y:y,w=this._events[P];return w?w.fn?1:w.length:0},C.prototype.emit=function(y,P,w,x,v,d){var o=F?F+y:y;if(!this._events[o])return!1;var l=this._events[o],s=arguments.length,S,b;if(l.fn){l.once&&this.removeListener(y,l.fn,void 0,!0);switch(s){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,P),!0;case 3:return l.fn.call(l.context,P,w),!0;case 4:return l.fn.call(l.context,P,w,x),!0;case 5:return l.fn.call(l.context,P,w,x,v),!0;case 6:return l.fn.call(l.context,P,w,x,v,d),!0}for(b=1,S=new Array(s-1);b<s;b++)S[b-1]=arguments[b];l.fn.apply(l.context,S)}else{var f=l.length,L;for(b=0;b<f;b++){l[b].once&&this.removeListener(y,l[b].fn,void 0,!0);switch(s){case 1:l[b].fn.call(l[b].context);break;case 2:l[b].fn.call(l[b].context,P);break;case 3:l[b].fn.call(l[b].context,P,w);break;case 4:l[b].fn.call(l[b].context,P,w,x);break;default:if(!S)for(L=1,S=new Array(s-1);L<s;L++)S[L-1]=arguments[L];l[b].fn.apply(l[b].context,S)}}}return!0},C.prototype.on=function(y,P,w){return I(this,y,P,w,!1)},C.prototype.once=function(y,P,w){return I(this,y,P,w,!0)},C.prototype.removeListener=function(y,P,w,x){var v=F?F+y:y;if(!this._events[v])return this;if(!P)return R(this,v),this;var d=this._events[v];if(d.fn)d.fn===P&&(!x||d.once)&&(!w||d.context===w)&&R(this,v);else{for(var o=0,l=[],s=d.length;o<s;o++)(d[o].fn!==P||x&&!d[o].once||w&&d[o].context!==w)&&l.push(d[o]);l.length?this._events[v]=l.length===1?l[0]:l:R(this,v)}return this},C.prototype.removeAllListeners=function(y){var P;return y?(P=F?F+y:y,this._events[P]&&R(this,P)):(this._events=new O,this._eventsCount=0),this},C.prototype.off=C.prototype.removeListener,C.prototype.addListener=C.prototype.on,C.prefixed=F,C.EventEmitter=C,J.exports=C},"./node_modules/url-toolkit/src/url-toolkit.js":function(J,z,D){(function(K){var F=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,O=/^([^\/?#]*)([^]*)$/,N=/(?:\/|^)\.(?=\/)/g,I=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,R={buildAbsoluteURL:function(C,h,y){if(y=y||{},C=C.trim(),h=h.trim(),!h){if(!y.alwaysNormalize)return C;var P=R.parseURL(C);if(!P)throw new Error("Error trying to parse base URL.");return P.path=R.normalizePath(P.path),R.buildURLFromParts(P)}var w=R.parseURL(h);if(!w)throw new Error("Error trying to parse relative URL.");if(w.scheme)return y.alwaysNormalize?(w.path=R.normalizePath(w.path),R.buildURLFromParts(w)):h;var x=R.parseURL(C);if(!x)throw new Error("Error trying to parse base URL.");if(!x.netLoc&&x.path&&x.path[0]!=="/"){var v=O.exec(x.path);x.netLoc=v[1],x.path=v[2]}x.netLoc&&!x.path&&(x.path="/");var d={scheme:x.scheme,netLoc:w.netLoc,path:null,params:w.params,query:w.query,fragment:w.fragment};if(!w.netLoc&&(d.netLoc=x.netLoc,w.path[0]!=="/"))if(!w.path)d.path=x.path,w.params||(d.params=x.params,w.query||(d.query=x.query));else{var o=x.path,l=o.substring(0,o.lastIndexOf("/")+1)+w.path;d.path=R.normalizePath(l)}return d.path===null&&(d.path=y.alwaysNormalize?R.normalizePath(w.path):w.path),R.buildURLFromParts(d)},parseURL:function(C){var h=F.exec(C);return h?{scheme:h[1]||"",netLoc:h[2]||"",path:h[3]||"",params:h[4]||"",query:h[5]||"",fragment:h[6]||""}:null},normalizePath:function(C){for(C=C.split("").reverse().join("").replace(N,"");C.length!==(C=C.replace(I,"")).length;);return C.split("").reverse().join("")},buildURLFromParts:function(C){return C.scheme+C.netLoc+C.path+C.params+C.query+C.fragment}};J.exports=R})(this)},"./node_modules/webworkify-webpack/index.js":function(J,z,D){function K(y){var P={};function w(v){if(P[v])return P[v].exports;var d=P[v]={i:v,l:!1,exports:{}};return y[v].call(d.exports,d,d.exports,w),d.l=!0,d.exports}w.m=y,w.c=P,w.i=function(v){return v},w.d=function(v,d,o){w.o(v,d)||Object.defineProperty(v,d,{configurable:!1,enumerable:!0,get:o})},w.r=function(v){Object.defineProperty(v,"__esModule",{value:!0})},w.n=function(v){var d=v&&v.__esModule?function(){return v.default}:function(){return v};return w.d(d,"a",d),d},w.o=function(v,d){return Object.prototype.hasOwnProperty.call(v,d)},w.p="/",w.oe=function(v){throw console.error(v),v};var x=w(w.s=ENTRY_MODULE);return x.default||x}var F="[\\.|\\-|\\+|\\w|/|@]+",O="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+F+").*?\\)";function N(y){return(y+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function I(y){return!isNaN(1*y)}function R(y,P,w){var x={};x[w]=[];var v=P.toString(),d=v.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!d)return x;for(var o=d[1],l=new RegExp("(\\\\n|\\W)"+N(o)+O,"g"),s;s=l.exec(v);){if(s[3]==="dll-reference")continue;x[w].push(s[3])}for(l=new RegExp("\\("+N(o)+'\\("(dll-reference\\s('+F+'))"\\)\\)'+O,"g");s=l.exec(v);)y[s[2]]||(x[w].push(s[1]),y[s[2]]=D(s[1]).m),x[s[2]]=x[s[2]]||[],x[s[2]].push(s[4]);for(var S=Object.keys(x),b=0;b<S.length;b++)for(var f=0;f<x[S[b]].length;f++)I(x[S[b]][f])&&(x[S[b]][f]=1*x[S[b]][f]);return x}function C(y){var P=Object.keys(y);return P.reduce(function(w,x){return w||y[x].length>0},!1)}function h(y,P){for(var w={main:[P]},x={main:[]},v={main:{}};C(w);)for(var d=Object.keys(w),o=0;o<d.length;o++){var l=d[o],s=w[l],S=s.pop();if(v[l]=v[l]||{},v[l][S]||!y[l][S])continue;v[l][S]=!0,x[l]=x[l]||[],x[l].push(S);for(var b=R(y,y[l][S],l),f=Object.keys(b),L=0;L<f.length;L++)w[f[L]]=w[f[L]]||[],w[f[L]]=w[f[L]].concat(b[f[L]])}return x}J.exports=function(y,P){P=P||{};var w={main:D.m},x=P.all?{main:Object.keys(w.main)}:h(w,y),v="";Object.keys(x).filter(function(S){return S!=="main"}).forEach(function(S){for(var b=0;x[S][b];)b++;x[S].push(b),w[S][b]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",v=v+"var "+S+" = ("+K.toString().replace("ENTRY_MODULE",JSON.stringify(b))+")({"+x[S].map(function(f){return""+JSON.stringify(f)+": "+w[S][f].toString()}).join(",")+`});
|
|
`}),v=v+"new (("+K.toString().replace("ENTRY_MODULE",JSON.stringify(y))+")({"+x.main.map(function(S){return""+JSON.stringify(S)+": "+w.main[S].toString()}).join(",")+"}))(self);";var d=new window.Blob([v],{type:"text/javascript"});if(P.bare)return d;var o=window.URL||window.webkitURL||window.mozURL||window.msURL,l=o.createObjectURL(d),s=new window.Worker(l);return s.objectURL=l,s}},"./src/config.ts":function(J,z,D){"use strict";D.r(z),D.d(z,"hlsDefaultConfig",function(){return L}),D.d(z,"mergeConfig",function(){return m}),D.d(z,"enableStreamingMode",function(){return c});var K=D("./src/controller/abr-controller.ts"),F=D("./src/controller/audio-stream-controller.ts"),O=D("./src/controller/audio-track-controller.ts"),N=D("./src/controller/subtitle-stream-controller.ts"),I=D("./src/controller/subtitle-track-controller.ts"),R=D("./src/controller/buffer-controller.ts"),C=D("./src/controller/timeline-controller.ts"),h=D("./src/controller/cap-level-controller.ts"),y=D("./src/controller/fps-controller.ts"),P=D("./src/controller/eme-controller.ts"),w=D("./src/controller/cmcd-controller.ts"),x=D("./src/utils/xhr-loader.ts"),v=D("./src/utils/fetch-loader.ts"),d=D("./src/utils/cues.ts"),o=D("./src/utils/mediakeys-helper.ts"),l=D("./src/utils/logger.ts");function s(){return s=Object.assign||function(u){for(var a=1;a<arguments.length;a++){var E=arguments[a];for(var g in E)Object.prototype.hasOwnProperty.call(E,g)&&(u[g]=E[g])}return u},s.apply(this,arguments)}function S(u,a){var E=Object.keys(u);if(Object.getOwnPropertySymbols){var g=Object.getOwnPropertySymbols(u);a&&(g=g.filter(function(p){return Object.getOwnPropertyDescriptor(u,p).enumerable})),E.push.apply(E,g)}return E}function b(u){for(var a=1;a<arguments.length;a++){var E=arguments[a]!=null?arguments[a]:{};a%2?S(Object(E),!0).forEach(function(g){f(u,g,E[g])}):Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(E)):S(Object(E)).forEach(function(g){Object.defineProperty(u,g,Object.getOwnPropertyDescriptor(E,g))})}return u}function f(u,a,E){return a in u?Object.defineProperty(u,a,{value:E,enumerable:!0,configurable:!0,writable:!0}):u[a]=E,u}var L=b(b({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:x.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:K.default,bufferController:R.default,capLevelController:h.default,fpsController:y.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},T()),{},{subtitleStreamController:N.SubtitleStreamController,subtitleTrackController:I.default,timelineController:C.TimelineController,audioStreamController:F.default,audioTrackController:O.default,emeController:P.default,cmcdController:w.default});function T(){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 m(u,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 s({},u,a)}function c(u){var a=u.loader;if(a!==v.default&&a!==x.default)l.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),u.progressive=!1;else{var E=Object(v.fetchSupported)();E&&(u.loader=v.default,u.progressive=!0,u.enableSoftwareAES=!0,l.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(J,z,D){"use strict";D.r(z);var K=D("./src/polyfills/number.ts"),F=D("./src/utils/ewma-bandwidth-estimator.ts"),O=D("./src/events.ts"),N=D("./src/utils/buffer-helper.ts"),I=D("./src/errors.ts"),R=D("./src/types/loader.ts"),C=D("./src/utils/logger.ts");function h(w,x){for(var v=0;v<x.length;v++){var d=x[v];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(w,d.key,d)}}function y(w,x,v){return x&&h(w.prototype,x),v&&h(w,v),w}var P=function(){function w(v){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=v;var d=v.config;this.bwEstimator=new F.default(d.abrEwmaSlowVoD,d.abrEwmaFastVoD,d.abrEwmaDefaultEstimate),this.registerListeners()}var x=w.prototype;return x.registerListeners=function(){var d=this.hls;d.on(O.Events.FRAG_LOADING,this.onFragLoading,this),d.on(O.Events.FRAG_LOADED,this.onFragLoaded,this),d.on(O.Events.FRAG_BUFFERED,this.onFragBuffered,this),d.on(O.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.on(O.Events.ERROR,this.onError,this)},x.unregisterListeners=function(){var d=this.hls;d.off(O.Events.FRAG_LOADING,this.onFragLoading,this),d.off(O.Events.FRAG_LOADED,this.onFragLoaded,this),d.off(O.Events.FRAG_BUFFERED,this.onFragBuffered,this),d.off(O.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.off(O.Events.ERROR,this.onError,this)},x.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},x.onFragLoading=function(d,o){var l=o.frag;if(l.type===R.PlaylistLevelType.MAIN&&!this.timer){var s;this.fragCurrent=l,this.partCurrent=(s=o.part)!=null?s:null,this.timer=self.setInterval(this.onCheck,100)}},x.onLevelLoaded=function(d,o){var l=this.hls.config;o.details.live?this.bwEstimator.update(l.abrEwmaSlowLive,l.abrEwmaFastLive):this.bwEstimator.update(l.abrEwmaSlowVoD,l.abrEwmaFastVoD)},x._abandonRulesCheck=function(){var d=this.fragCurrent,o=this.partCurrent,l=this.hls,s=l.autoLevelEnabled,S=l.config,b=l.media;if(!d||!b)return;var f=o?o.stats:d.stats,L=o?o.duration:d.duration;if(f.aborted){C.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!s||b.paused||!b.playbackRate||!b.readyState)return;var T=performance.now()-f.loading.start,m=Math.abs(b.playbackRate);if(T<=500*L/m)return;var c=l.levels,u=l.minAutoLevel,a=c[d.level],E=f.total||Math.max(f.loaded,Math.round(L*a.maxBitrate/8)),g=Math.max(1,f.bwEstimate?f.bwEstimate/8:f.loaded*1e3/T),p=(E-f.loaded)/g,_=b.currentTime,U=(N.BufferHelper.bufferInfo(b,_,S.maxBufferHole).end-_)/m;if(U>=2*L/m||p<=U)return;var B=Number.POSITIVE_INFINITY,W;for(W=d.level-1;W>u;W--){var k=c[W].maxBitrate;if(B=L*k/(8*.8*g),B<U)break}if(B>=p)return;var M=this.bwEstimator.getEstimate();C.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(K.isFiniteNumber)(M)?(M/1024).toFixed(3):"Unknown")+` Kb/s
|
|
Estimated load time for current fragment: `+p.toFixed(3)+` s
|
|
Estimated load time for the next fragment: `+B.toFixed(3)+` s
|
|
Time to underbuffer: `+U.toFixed(3)+" s"),l.nextLoadLevel=W,this.bwEstimator.sample(T,f.loaded),this.clearTimer(),d.loader&&(this.fragCurrent=this.partCurrent=null,d.loader.abort()),l.trigger(O.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:d,part:o,stats:f})},x.onFragLoaded=function(d,o){var l=o.frag,s=o.part;if(l.type===R.PlaylistLevelType.MAIN&&Object(K.isFiniteNumber)(l.sn)){var S=s?s.stats:l.stats,b=s?s.duration:l.duration;if(this.clearTimer(),this.lastLoadedFragLevel=l.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var f=this.hls.levels[l.level],L=(f.loaded?f.loaded.bytes:0)+S.loaded,T=(f.loaded?f.loaded.duration:0)+b;f.loaded={bytes:L,duration:T},f.realBitrate=Math.round(8*L/T)}if(l.bitrateTest){var m={stats:S,frag:l,part:s,id:l.type};this.onFragBuffered(O.Events.FRAG_BUFFERED,m),l.bitrateTest=!1}}},x.onFragBuffered=function(d,o){var l=o.frag,s=o.part,S=s?s.stats:l.stats;if(S.aborted)return;if(l.type!==R.PlaylistLevelType.MAIN||l.sn==="initSegment")return;var b=S.parsing.end-S.loading.start;this.bwEstimator.sample(b,S.loaded),S.bwEstimate=this.bwEstimator.getEstimate(),l.bitrateTest?this.bitrateTestDelay=b/1e3:this.bitrateTestDelay=0},x.onError=function(d,o){switch(o.details){case I.ErrorDetails.FRAG_LOAD_ERROR:case I.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},x.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},x.getNextABRAutoLevel=function(){var d=this.fragCurrent,o=this.partCurrent,l=this.hls,s=l.maxAutoLevel,S=l.config,b=l.minAutoLevel,f=l.media,L=o?o.duration:d?d.duration:0,T=f?f.currentTime:0,m=f&&f.playbackRate!==0?Math.abs(f.playbackRate):1,c=this.bwEstimator?this.bwEstimator.getEstimate():S.abrEwmaDefaultEstimate,u=(N.BufferHelper.bufferInfo(f,T,S.maxBufferHole).end-T)/m,a=this.findBestLevel(c,b,s,u,S.abrBandWidthFactor,S.abrBandWidthUpFactor);if(a>=0)return a;C.logger.trace((u?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var E=L?Math.min(L,S.maxStarvationDelay):S.maxStarvationDelay,g=S.abrBandWidthFactor,p=S.abrBandWidthUpFactor;if(!u){var _=this.bitrateTestDelay;if(_){var U=L?Math.min(L,S.maxLoadingDelay):S.maxLoadingDelay;E=U-_,C.logger.trace("bitrate test took "+Math.round(1e3*_)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*E)+" ms"),g=p=1}}return a=this.findBestLevel(c,b,s,u+E,g,p),Math.max(a,0)},x.findBestLevel=function(d,o,l,s,S,b){for(var f,L=this.fragCurrent,T=this.partCurrent,m=this.lastLoadedFragLevel,c=this.hls.levels,u=c[m],a=!!(u!=null&&(f=u.details)!==null&&f!==void 0&&f.live),E=u==null?void 0:u.codecSet,g=T?T.duration:L?L.duration:0,p=l;p>=o;p--){var _=c[p];if(!_||E&&_.codecSet!==E)continue;var U=_.details,B=(T?U==null?void 0:U.partTarget:U==null?void 0:U.averagetargetduration)||g,W=void 0;p<=m?W=S*d:W=b*d;var k=c[p].maxBitrate,M=k*B/W;if(C.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+p+"/"+Math.round(W)+"/"+k+"/"+B+"/"+s+"/"+M),W>k&&(!M||a&&!this.bitrateTestDelay||M<s))return p}return-1},y(w,[{key:"nextAutoLevel",get:function(){var d=this._nextAutoLevel,o=this.bwEstimator;if(d!==-1&&(!o||!o.canEstimate()))return d;var l=this.getNextABRAutoLevel();return d!==-1&&(l=Math.min(d,l)),l},set:function(d){this._nextAutoLevel=d}}]),w}();z.default=P},"./src/controller/audio-stream-controller.ts":function(J,z,D){"use strict";D.r(z);var K=D("./src/polyfills/number.ts"),F=D("./src/controller/base-stream-controller.ts"),O=D("./src/events.ts"),N=D("./src/utils/buffer-helper.ts"),I=D("./src/controller/fragment-tracker.ts"),R=D("./src/types/level.ts"),C=D("./src/types/loader.ts"),h=D("./src/loader/fragment.ts"),y=D("./src/demux/chunk-cache.ts"),P=D("./src/demux/transmuxer-interface.ts"),w=D("./src/types/transmuxer.ts"),x=D("./src/controller/fragment-finders.ts"),v=D("./src/utils/discontinuities.ts"),d=D("./src/errors.ts"),o=D("./src/utils/logger.ts");function l(){return l=Object.assign||function(L){for(var T=1;T<arguments.length;T++){var m=arguments[T];for(var c in m)Object.prototype.hasOwnProperty.call(m,c)&&(L[c]=m[c])}return L},l.apply(this,arguments)}function s(L,T){L.prototype=Object.create(T.prototype),L.prototype.constructor=L,S(L,T)}function S(L,T){return S=Object.setPrototypeOf||function(c,u){return c.__proto__=u,c},S(L,T)}var b=100,f=function(L){s(T,L);function T(c,u){var a;return a=L.call(this,c,u,"[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 m=T.prototype;return m.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},m._registerListeners=function(){var u=this.hls;u.on(O.Events.MEDIA_ATTACHED,this.onMediaAttached,this),u.on(O.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.on(O.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.on(O.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.on(O.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),u.on(O.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),u.on(O.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),u.on(O.Events.ERROR,this.onError,this),u.on(O.Events.BUFFER_RESET,this.onBufferReset,this),u.on(O.Events.BUFFER_CREATED,this.onBufferCreated,this),u.on(O.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),u.on(O.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),u.on(O.Events.FRAG_BUFFERED,this.onFragBuffered,this)},m._unregisterListeners=function(){var u=this.hls;u.off(O.Events.MEDIA_ATTACHED,this.onMediaAttached,this),u.off(O.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.off(O.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.off(O.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.off(O.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),u.off(O.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),u.off(O.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),u.off(O.Events.ERROR,this.onError,this),u.off(O.Events.BUFFER_RESET,this.onBufferReset,this),u.off(O.Events.BUFFER_CREATED,this.onBufferCreated,this),u.off(O.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),u.off(O.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),u.off(O.Events.FRAG_BUFFERED,this.onFragBuffered,this)},m.onInitPtsFound=function(u,a){var E=a.frag,g=a.id,p=a.initPTS;if(g==="main"){var _=E.cc;this.initPTS[E.cc]=p,this.log("InitPTS for cc: "+_+" found from main: "+p),this.videoTrackCC=_,this.state===F.State.WAITING_INIT_PTS&&this.tick()}},m.startLoad=function(u){if(!this.levels){this.startPosition=u,this.state=F.State.STOPPED;return}var a=this.lastCurrentTime;this.stopLoad(),this.setInterval(b),this.fragLoadError=0,a>0&&u===-1?(this.log("Override startPosition with lastCurrentTime @"+a.toFixed(3)),this.state=F.State.IDLE):(this.loadedmetadata=!1,this.state=F.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=u,this.tick()},m.doTick=function(){switch(this.state){case F.State.IDLE:this.doTickIdle();break;case F.State.WAITING_TRACK:{var u,a=this.levels,E=this.trackId,g=a==null||((u=a[E])===null||u===void 0)?void 0:u.details;if(g){if(this.waitForCdnTuneIn(g))break;this.state=F.State.WAITING_INIT_PTS}break}case F.State.FRAG_LOADING_WAITING_RETRY:{var p,_=performance.now(),U=this.retryDate;(!U||_>=U||(p=this.media)!==null&&p!==void 0&&p.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=F.State.IDLE);break}case F.State.WAITING_INIT_PTS:{var B=this.waitingData;if(B){var W=B.frag,k=B.part,M=B.cache,H=B.complete;if(this.initPTS[W.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=F.State.FRAG_LOADING;var X=M.flush(),ee={frag:W,part:k,payload:X,networkDetails:null};this._handleFragmentLoadProgress(ee),H&&L.prototype._handleFragmentLoadComplete.call(this,ee)}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 ie=this.getLoadPosition(),ve=N.BufferHelper.bufferInfo(this.mediaBuffer,ie,this.config.maxBufferHole),pe=Object(x.fragmentWithinToleranceTest)(ve.end,this.config.maxFragLookUpTolerance,W);pe<0&&(o.logger.log("Waiting fragment cc ("+W.cc+") @ "+W.start+" cancelled because another fragment at "+ve.end+" is needed"),this.clearWaitingFragment())}}else this.state=F.State.IDLE}}this.onTickEnd()},m.clearWaitingFragment=function(){var u=this.waitingData;u&&(this.fragmentTracker.removeFragment(u.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=F.State.IDLE)},m.onTickEnd=function(){var u=this.media;if(!u||!u.readyState)return;var a=this.mediaBuffer?this.mediaBuffer:u,E=a.buffered;!this.loadedmetadata&&E.length&&(this.loadedmetadata=!0),this.lastCurrentTime=u.currentTime},m.doTickIdle=function(){var u,a,E=this.hls,g=this.levels,p=this.media,_=this.trackId,U=E.config;if(!g||!g[_])return;if(!p&&(this.startFragRequested||!U.startFragPrefetch))return;var B=g[_],W=B.details;if(!W||W.live&&this.levelLastLoaded!==_||this.waitForCdnTuneIn(W)){this.state=F.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,h.ElementaryStreamTypes.AUDIO,C.PlaylistLevelType.AUDIO));var k=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,C.PlaylistLevelType.AUDIO);if(k===null)return;var M=k.len,H=this.getMaxBufferLength(),X=this.audioSwitch;if(M>=H&&!X)return;if(!X&&this._streamEnded(k,W)){E.trigger(O.Events.BUFFER_EOS,{type:"audio"}),this.state=F.State.ENDED;return}var ee=W.fragments,ie=ee[0].start,ve=k.end;if(X){var pe=this.getLoadPosition();ve=pe,W.PTSKnown&&pe<ie&&((k.end>ie||k.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),p.currentTime=ie+.05))}var he=this.getNextFragment(ve,W);if(!he){this.bufferFlushed=!0;return}((u=he.decryptdata)===null||u===void 0?void 0:u.keyFormat)==="identity"&&!((a=he.decryptdata)!==null&&a!==void 0&&a.key)?this.loadKey(he,W):this.loadFragment(he,W,ve)},m.getMaxBufferLength=function(){var u=L.prototype.getMaxBufferLength.call(this),a=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,C.PlaylistLevelType.MAIN);return a===null?u:Math.max(u,a.len)},m.onMediaDetaching=function(){this.videoBuffer=null,L.prototype.onMediaDetaching.call(this)},m.onAudioTracksUpdated=function(u,a){var E=a.audioTracks;this.resetTransmuxer(),this.levels=E.map(function(g){return new R.Level(g)})},m.onAudioTrackSwitching=function(u,a){var E=!!a.url;this.trackId=a.id;var g=this.fragCurrent;g!=null&&g.loader&&g.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),E?this.setInterval(b):this.resetTransmuxer(),E?(this.audioSwitch=!0,this.state=F.State.IDLE):this.state=F.State.STOPPED,this.tick()},m.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},m.onLevelLoaded=function(u,a){this.mainDetails=a.details},m.onAudioTrackLoaded=function(u,a){var E,g=this.levels,p=a.details,_=a.id;if(!g){this.warn("Audio tracks were reset while loading level "+_);return}this.log("Track "+_+" loaded ["+p.startSN+","+p.endSN+"],duration:"+p.totalduration);var U=g[_],B=0;if(p.live||(E=U.details)!==null&&E!==void 0&&E.live){var W=this.mainDetails;if(p.fragments[0]||(p.deltaUpdateFailed=!0),p.deltaUpdateFailed||!W)return;!U.details&&p.hasProgramDateTime&&W.hasProgramDateTime?(Object(v.alignMediaPlaylistByPDT)(p,W),B=p.fragments[0].start):B=this.alignPlaylists(p,U.details)}U.details=p,this.levelLastLoaded=_,!this.startFragRequested&&(this.mainDetails||!p.live)&&this.setStartPosition(U.details,B),this.state===F.State.WAITING_TRACK&&!this.waitForCdnTuneIn(p)&&(this.state=F.State.IDLE),this.tick()},m._handleFragmentLoadProgress=function(u){var a,E=u.frag,g=u.part,p=u.payload,_=this.config,U=this.trackId,B=this.levels;if(!B){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+E.sn+" of level "+E.level+" will not be buffered");return}var W=B[U];console.assert(W,"Audio track is defined on fragment load progress");var k=W.details;console.assert(k,"Audio track details are defined on fragment load progress");var M=_.defaultAudioCodec||W.audioCodec||"mp4a.40.2",H=this.transmuxer;H||(H=this.transmuxer=new P.default(this.hls,C.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var X=this.initPTS[E.cc],ee=(a=E.initSegment)===null||a===void 0?void 0:a.data;if(X!==void 0){var ie=!1,ve=g?g.index:-1,pe=ve!==-1,he=new w.ChunkMetadata(E.level,E.sn,E.stats.chunkCount,p.byteLength,ve,pe);H.push(p,ee,M,"",E,g,k.totalduration,ie,he,X)}else{o.logger.log("Unknown video PTS for cc "+E.cc+", waiting for video PTS before demuxing audio frag "+E.sn+" of ["+k.startSN+" ,"+k.endSN+"],track "+U);var ce=this.waitingData=this.waitingData||{frag:E,part:g,cache:new y.default,complete:!1},fe=ce.cache;fe.push(new Uint8Array(p)),this.waitingVideoCC=this.videoTrackCC,this.state=F.State.WAITING_INIT_PTS}},m._handleFragmentLoadComplete=function(u){if(this.waitingData){this.waitingData.complete=!0;return}L.prototype._handleFragmentLoadComplete.call(this,u)},m.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},m.onBufferCreated=function(u,a){var E=a.tracks.audio;E&&(this.mediaBuffer=E.buffer),a.tracks.video&&(this.videoBuffer=a.tracks.video.buffer)},m.onFragBuffered=function(u,a){var E=a.frag,g=a.part;if(E.type!==C.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(E)){this.warn("Fragment "+E.sn+(g?" p: "+g.index:"")+" of level "+E.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}E.sn!=="initSegment"&&(this.fragPrevious=E,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(O.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(E,g)},m.onError=function(u,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(C.PlaylistLevelType.AUDIO,a);break;case d.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case d.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==F.State.ERROR&&this.state!==F.State.STOPPED&&(this.state=a.fatal?F.State.ERROR:F.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===F.State.PARSING||this.state===F.State.PARSED)){var E=!0,g=this.getFwdBufferInfo(this.mediaBuffer,C.PlaylistLevelType.AUDIO);g&&g.len>.5&&(E=!this.reduceMaxBufferLength(g.len)),E&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,L.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},m.onBufferFlushed=function(u,a){var E=a.type;E===h.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},m._handleTransmuxComplete=function(u){var a,E="audio",g=this.hls,p=u.remuxResult,_=u.chunkMeta,U=this.getCurrentContext(_);if(!U){this.warn("The loading context changed while buffering fragment "+_.sn+" of level "+_.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(_.level);return}var B=U.frag,W=U.part,k=p.audio,M=p.text,H=p.id3,X=p.initSegment;if(this.fragContextChanged(B))return;if(this.state=F.State.PARSING,this.audioSwitch&&k&&this.completeAudioSwitch(),X!=null&&X.tracks&&(this._bufferInitSegment(X.tracks,B,_),g.trigger(O.Events.FRAG_PARSING_INIT_SEGMENT,{frag:B,id:E,tracks:X.tracks})),k){var ee=k.startPTS,ie=k.endPTS,ve=k.startDTS,pe=k.endDTS;W&&(W.elementaryStreams[h.ElementaryStreamTypes.AUDIO]={startPTS:ee,endPTS:ie,startDTS:ve,endDTS:pe}),B.setElementaryStreamInfo(h.ElementaryStreamTypes.AUDIO,ee,ie,ve,pe),this.bufferFragmentData(k,B,W,_)}if(H!=null&&(a=H.samples)!==null&&a!==void 0&&a.length){var he=l({frag:B,id:E},H);g.trigger(O.Events.FRAG_PARSING_METADATA,he)}if(M){var ce=l({frag:B,id:E},M);g.trigger(O.Events.FRAG_PARSING_USERDATA,ce)}},m._bufferInitSegment=function(u,a,E){if(this.state!==F.State.PARSING)return;u.video&&delete u.video;var g=u.audio;if(!g)return;g.levelCodec=g.codec,g.id="audio",this.log("Init audio buffer, container:"+g.container+", codecs[parsed]=["+g.codec+"]"),this.hls.trigger(O.Events.BUFFER_CODECS,u);var p=g.initSegment;if(p!=null&&p.byteLength){var _={type:"audio",frag:a,part:null,chunkMeta:E,parent:a.type,data:p};this.hls.trigger(O.Events.BUFFER_APPENDING,_)}this.tick()},m.loadFragment=function(u,a,E){var g=this.fragmentTracker.getState(u);this.fragCurrent=u,(this.audioSwitch||g===I.FragmentState.NOT_LOADED||g===I.FragmentState.PARTIAL)&&(u.sn==="initSegment"?this._loadInitSegment(u):a.live&&!Object(K.isFiniteNumber)(this.initPTS[u.cc])?(this.log("Waiting for video PTS in continuity counter "+u.cc+" of live stream before loading audio fragment "+u.sn+" of level "+this.trackId),this.state=F.State.WAITING_INIT_PTS):(this.startFragRequested=!0,L.prototype.loadFragment.call(this,u,a,E)))},m.completeAudioSwitch=function(){var u=this.hls,a=this.media,E=this.trackId;a&&(this.log("Switching audio track : flushing all audio"),L.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,u.trigger(O.Events.AUDIO_TRACK_SWITCHED,{id:E})},T}(F.default);z.default=f},"./src/controller/audio-track-controller.ts":function(J,z,D){"use strict";D.r(z);var K=D("./src/events.ts"),F=D("./src/errors.ts"),O=D("./src/controller/base-playlist-controller.ts"),N=D("./src/types/loader.ts");function I(P,w){for(var x=0;x<w.length;x++){var v=w[x];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(P,v.key,v)}}function R(P,w,x){return w&&I(P.prototype,w),x&&I(P,x),P}function C(P,w){P.prototype=Object.create(w.prototype),P.prototype.constructor=P,h(P,w)}function h(P,w){return h=Object.setPrototypeOf||function(v,d){return v.__proto__=d,v},h(P,w)}var y=function(P){C(w,P);function w(v){var d;return d=P.call(this,v,"[audio-track-controller]")||this,d.tracks=[],d.groupId=null,d.tracksInGroup=[],d.trackId=-1,d.trackName="",d.selectDefaultTrack=!0,d.registerListeners(),d}var x=w.prototype;return x.registerListeners=function(){var d=this.hls;d.on(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.on(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.on(K.Events.LEVEL_LOADING,this.onLevelLoading,this),d.on(K.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),d.on(K.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.on(K.Events.ERROR,this.onError,this)},x.unregisterListeners=function(){var d=this.hls;d.off(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.off(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),d.off(K.Events.LEVEL_LOADING,this.onLevelLoading,this),d.off(K.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),d.off(K.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.off(K.Events.ERROR,this.onError,this)},x.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,P.prototype.destroy.call(this)},x.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},x.onManifestParsed=function(d,o){this.tracks=o.audioTracks||[]},x.onAudioTrackLoaded=function(d,o){var l=o.id,s=o.details,S=this.tracksInGroup[l];if(!S){this.warn("Invalid audio track id "+l);return}var b=S.details;S.details=o.details,this.log("audioTrack "+l+" loaded ["+s.startSN+"-"+s.endSN+"]"),l===this.trackId&&(this.retryCount=0,this.playlistLoaded(l,o,b))},x.onLevelLoading=function(d,o){this.switchLevel(o.level)},x.onLevelSwitching=function(d,o){this.switchLevel(o.level)},x.switchLevel=function(d){var o=this.hls.levels[d];if(!(o!=null&&o.audioGroupIds))return;var l=o.audioGroupIds[o.urlId];if(this.groupId!==l){this.groupId=l;var s=this.tracks.filter(function(b){return!l||b.groupId===l});this.selectDefaultTrack&&!s.some(function(b){return b.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=s;var S={audioTracks:s};this.log("Updating audio tracks, "+s.length+' track(s) found in "'+l+'" group-id'),this.hls.trigger(K.Events.AUDIO_TRACKS_UPDATED,S),this.selectInitialTrack()}},x.onError=function(d,o){if(P.prototype.onError.call(this,d,o),o.fatal||!o.context)return;o.context.type===N.PlaylistContextType.AUDIO_TRACK&&o.context.id===this.trackId&&o.context.groupId===this.groupId&&this.retryLoadingOrFail(o)},x.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 l=o[this.trackId];this.log("Now switching to audio-track index "+d);var s=o[d],S=s.id,b=s.groupId,f=b===void 0?"":b,L=s.name,T=s.type,m=s.url;if(this.trackId=d,this.trackName=L,this.selectDefaultTrack=!1,this.hls.trigger(K.Events.AUDIO_TRACK_SWITCHING,{id:S,groupId:f,name:L,type:T,url:m}),s.details&&!s.details.live)return;var c=this.switchParams(s.url,l==null?void 0:l.details);this.loadPlaylist(c)},x.selectInitialTrack=function(){var d=this.tracksInGroup;console.assert(d.length,"Initial audio track should be selected when tracks are known");var o=this.trackName,l=this.findTrackId(o)||this.findTrackId();l!==-1?this.setAudioTrack(l):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(K.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},x.findTrackId=function(d){for(var o=this.tracksInGroup,l=0;l<o.length;l++){var s=o[l];if((!this.selectDefaultTrack||s.default)&&(!d||d===s.name))return s.id}return-1},x.loadPlaylist=function(d){var o=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(o)){var l=o.id,s=o.groupId,S=o.url;if(d)try{S=d.addDirectives(S)}catch(b){this.warn("Could not construct new URL with HLS Delivery Directives: "+b)}this.log("loading audio-track playlist for id: "+l),this.clearTimer(),this.hls.trigger(K.Events.AUDIO_TRACK_LOADING,{url:S,id:l,groupId:s,deliveryDirectives:d||null})}},R(w,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(d){this.selectDefaultTrack=!1,this.setAudioTrack(d)}}]),w}(O.default);z.default=y},"./src/controller/base-playlist-controller.ts":function(J,z,D){"use strict";D.r(z),D.d(z,"default",function(){return R});var K=D("./src/polyfills/number.ts"),F=D("./src/types/level.ts"),O=D("./src/controller/level-helper.ts"),N=D("./src/utils/logger.ts"),I=D("./src/errors.ts"),R=function(){function C(y,P){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=N.logger.log.bind(N.logger,P+":"),this.warn=N.logger.warn.bind(N.logger,P+":"),this.hls=y}var h=C.prototype;return h.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},h.onError=function(P,w){w.fatal&&w.type===I.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},h.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},h.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},h.stopLoad=function(){this.canLoad=!1,this.clearTimer()},h.switchParams=function(P,w){var x=w==null?void 0:w.renditionReports;if(x)for(var v=0;v<x.length;v++){var d=x[v],o=""+d.URI;if(o===P.substr(-o.length)){var l=parseInt(d["LAST-MSN"]),s=parseInt(d["LAST-PART"]);if(w&&this.hls.config.lowLatencyMode){var S=Math.min(w.age-w.partTarget,w.targetduration);s!==void 0&&S>w.partTarget&&(s+=1)}if(Object(K.isFiniteNumber)(l))return new F.HlsUrlParameters(l,Object(K.isFiniteNumber)(s)?s:void 0,F.HlsSkip.No)}}},h.loadPlaylist=function(P){},h.shouldLoadTrack=function(P){return this.canLoad&&P&&!!P.url&&(!P.details||P.details.live)},h.playlistLoaded=function(P,w,x){var v=this,d=w.details,o=w.stats,l=o.loading.end?Math.max(0,self.performance.now()-o.loading.end):0;if(d.advancedDateTime=Date.now()-l,d.live||x!=null&&x.live){if(d.reloaded(x),x&&this.log("live playlist "+P+" "+(d.advanced?"REFRESHED "+d.lastPartSn+"-"+d.lastPartIndex:"MISSED")),x&&d.fragments.length>0&&Object(O.mergeDetails)(x,d),!this.canLoad||!d.live)return;var s,S=void 0,b=void 0;if(d.canBlockReload&&d.endSN&&d.advanced){var f=this.hls.config.lowLatencyMode,L=d.lastPartSn,T=d.endSN,m=d.lastPartIndex,c=m!==-1,u=L===T,a=f?0:m;c?(S=u?T+1:L,b=u?a:m+1):S=T+1;var E=d.age,g=E+d.ageHeader,p=Math.min(g-d.partTarget,d.targetduration*1.5);if(p>0){if(x&&p>x.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+x.tuneInGoal+" to: "+p+" with playlist age: "+d.age),p=0;else{var _=Math.floor(p/d.targetduration);if(S+=_,b!==void 0){var U=Math.round(p%d.targetduration/d.partTarget);b+=U}this.log("CDN Tune-in age: "+d.ageHeader+"s last advanced "+E.toFixed(2)+"s goal: "+p+" skip sn "+_+" to part "+b)}d.tuneInGoal=p}if(s=this.getDeliveryDirectives(d,w.deliveryDirectives,S,b),f||!u){this.loadPlaylist(s);return}}else s=this.getDeliveryDirectives(d,w.deliveryDirectives,S,b);var B=Object(O.computeReloadInterval)(d,o);S!==void 0&&d.canBlockReload&&(B-=d.partTarget||1),this.log("reload live playlist "+P+" in "+Math.round(B)+" ms"),this.timer=self.setTimeout(function(){return v.loadPlaylist(s)},B)}else this.clearTimer()},h.getDeliveryDirectives=function(P,w,x,v){var d=Object(F.getSkipValue)(P,x);return w!=null&&w.skip&&P.deltaUpdateFailed&&(x=w.msn,v=w.part,d=F.HlsSkip.No),new F.HlsUrlParameters(x,v,d)},h.retryLoadingOrFail=function(P){var w=this,x=this.hls.config,v=this.retryCount<x.levelLoadingMaxRetry;if(v){var d;if(this.retryCount++,P.details.indexOf("LoadTimeOut")>-1&&(d=P.context)!==null&&d!==void 0&&d.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+P.details+'"'),this.loadPlaylist();else{var o=Math.min(Math.pow(2,this.retryCount)*x.levelLoadingRetryDelay,x.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return w.loadPlaylist()},o),this.warn("retry playlist loading #"+this.retryCount+" in "+o+' ms after "'+P.details+'"')}}else this.warn('cannot recover from error "'+P.details+'"'),this.clearTimer(),P.fatal=!0;return v},C}()},"./src/controller/base-stream-controller.ts":function(J,z,D){"use strict";D.r(z),D.d(z,"State",function(){return T}),D.d(z,"default",function(){return m});var K=D("./src/polyfills/number.ts"),F=D("./src/task-loop.ts"),O=D("./src/controller/fragment-tracker.ts"),N=D("./src/utils/buffer-helper.ts"),I=D("./src/utils/logger.ts"),R=D("./src/events.ts"),C=D("./src/errors.ts"),h=D("./src/types/transmuxer.ts"),y=D("./src/utils/mp4-tools.ts"),P=D("./src/utils/discontinuities.ts"),w=D("./src/controller/fragment-finders.ts"),x=D("./src/controller/level-helper.ts"),v=D("./src/loader/fragment-loader.ts"),d=D("./src/crypt/decrypter.ts"),o=D("./src/utils/time-ranges.ts"),l=D("./src/types/loader.ts");function s(c,u){for(var a=0;a<u.length;a++){var E=u[a];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(c,E.key,E)}}function S(c,u,a){return u&&s(c.prototype,u),a&&s(c,a),c}function b(c){if(c===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return c}function f(c,u){c.prototype=Object.create(u.prototype),c.prototype.constructor=c,L(c,u)}function L(c,u){return L=Object.setPrototypeOf||function(E,g){return E.__proto__=g,E},L(c,u)}var T={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"},m=function(c){f(u,c);function u(E,g,p){var _;return _=c.call(this)||this,_.hls=void 0,_.fragPrevious=null,_.fragCurrent=null,_.fragmentTracker=void 0,_.transmuxer=null,_._state=T.STOPPED,_.media=void 0,_.mediaBuffer=void 0,_.config=void 0,_.bitrateTest=!1,_.lastCurrentTime=0,_.nextLoadPosition=0,_.startPosition=0,_.loadedmetadata=!1,_.fragLoadError=0,_.retryDate=0,_.levels=null,_.fragmentLoader=void 0,_.levelLastLoaded=null,_.startFragRequested=!1,_.decrypter=void 0,_.initPTS=[],_.onvseeking=null,_.onvended=null,_.logPrefix="",_.log=void 0,_.warn=void 0,_.logPrefix=p,_.log=I.logger.log.bind(I.logger,p+":"),_.warn=I.logger.warn.bind(I.logger,p+":"),_.hls=E,_.fragmentLoader=new v.default(E.config),_.fragmentTracker=g,_.config=E.config,_.decrypter=new d.default(E,E.config),E.on(R.Events.KEY_LOADED,_.onKeyLoaded,b(_)),_}var a=u.prototype;return a.doTick=function(){this.onTickEnd()},a.onTickEnd=function(){},a.startLoad=function(g){},a.stopLoad=function(){this.fragmentLoader.abort();var g=this.fragCurrent;g&&this.fragmentTracker.removeFragment(g),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=T.STOPPED},a._streamEnded=function(g,p){var _=this.fragCurrent,U=this.fragmentTracker;if(!p.live&&_&&_.sn===p.endSN&&!g.nextStart){var B=U.getState(_);return B===O.FragmentState.PARTIAL||B===O.FragmentState.OK}return!1},a.onMediaAttached=function(g,p){var _=this.media=this.mediaBuffer=p.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),_.addEventListener("seeking",this.onvseeking),_.addEventListener("ended",this.onvended);var U=this.config;this.levels&&U.autoStartLoad&&this.state===T.STOPPED&&this.startLoad(U.startPosition)},a.onMediaDetaching=function(){var g=this.media;g!=null&&g.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),g&&(g.removeEventListener("seeking",this.onvseeking),g.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 g=this.config,p=this.fragCurrent,_=this.media,U=this.mediaBuffer,B=this.state,W=_?_.currentTime:0,k=N.BufferHelper.bufferInfo(U||_,W,g.maxBufferHole);if(this.log("media seeking to "+(Object(K.isFiniteNumber)(W)?W.toFixed(3):W)+", state: "+B),B===T.ENDED)this.resetLoadingState();else if(p&&!k.len){var M=g.maxFragLookUpTolerance,H=p.start-M,X=p.start+p.duration+M,ee=W>X;(W<H||ee)&&(ee&&p.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),p.loader.abort()),this.resetLoadingState())}_&&(this.lastCurrentTime=W),!this.loadedmetadata&&!k.len&&(this.nextLoadPosition=this.startPosition=W),this.tickImmediate()},a.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},a.onKeyLoaded=function(g,p){if(this.state!==T.KEY_LOADING||p.frag!==this.fragCurrent||!this.levels)return;this.state=T.IDLE;var _=this.levels[p.frag.level].details;_&&this.loadFragment(p.frag,_,p.frag.start)},a.onHandlerDestroying=function(){this.stopLoad(),c.prototype.onHandlerDestroying.call(this)},a.onHandlerDestroyed=function(){this.state=T.STOPPED,this.hls.off(R.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(g,p){this.log("Loading key for "+g.sn+" of ["+p.startSN+"-"+p.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+g.level),this.state=T.KEY_LOADING,this.fragCurrent=g,this.hls.trigger(R.Events.KEY_LOADING,{frag:g})},a.loadFragment=function(g,p,_){this._loadFragForPlayback(g,p,_)},a._loadFragForPlayback=function(g,p,_){var U=this,B=function(k){if(U.fragContextChanged(g)){U.warn("Fragment "+g.sn+(k.part?" p: "+k.part.index:"")+" of level "+g.level+" was dropped during download."),U.fragmentTracker.removeFragment(g);return}g.stats.chunkCount++,U._handleFragmentLoadProgress(k)};this._doFragLoad(g,p,_,B).then(function(W){if(!W)return;U.fragLoadError=0;var k=U.state;if(U.fragContextChanged(g)){(k===T.FRAG_LOADING||k===T.BACKTRACKING||!U.fragCurrent&&k===T.PARSING)&&(U.fragmentTracker.removeFragment(g),U.state=T.IDLE);return}if("payload"in W&&(U.log("Loaded fragment "+g.sn+" of level "+g.level),U.hls.trigger(R.Events.FRAG_LOADED,W),U.state===T.BACKTRACKING)){U.fragmentTracker.backtrack(g,W),U.resetFragmentLoading(g);return}U._handleFragmentLoadComplete(W)}).catch(function(W){U.warn(W),U.resetFragmentLoading(g)})},a.flushMainBuffer=function(g,p,_){if(_===void 0&&(_=null),!(g-p))return;var U={startOffset:g,endOffset:p,type:_};this.fragLoadError=0,this.hls.trigger(R.Events.BUFFER_FLUSHING,U)},a._loadInitSegment=function(g){var p=this;this._doFragLoad(g).then(function(_){if(!_||p.fragContextChanged(g)||!p.levels)throw new Error("init load aborted");return _}).then(function(_){var U=p.hls,B=_.payload,W=g.decryptdata;if(B&&B.byteLength>0&&W&&W.key&&W.iv&&W.method==="AES-128"){var k=self.performance.now();return p.decrypter.webCryptoDecrypt(new Uint8Array(B),W.key.buffer,W.iv.buffer).then(function(M){var H=self.performance.now();return U.trigger(R.Events.FRAG_DECRYPTED,{frag:g,payload:M,stats:{tstart:k,tdecrypt:H}}),_.payload=M,_})}return _}).then(function(_){var U=p.fragCurrent,B=p.hls,W=p.levels;if(!W)throw new Error("init load aborted, missing levels");var k=W[g.level].details;console.assert(k,"Level details are defined when init segment is loaded");var M=g.stats;p.state=T.IDLE,p.fragLoadError=0,g.data=new Uint8Array(_.payload),M.parsing.start=M.buffering.start=self.performance.now(),M.parsing.end=M.buffering.end=self.performance.now(),_.frag===U&&B.trigger(R.Events.FRAG_BUFFERED,{stats:M,frag:U,part:null,id:g.type}),p.tick()}).catch(function(_){p.warn(_),p.resetFragmentLoading(g)})},a.fragContextChanged=function(g){var p=this.fragCurrent;return!g||!p||g.level!==p.level||g.sn!==p.sn||g.urlId!==p.urlId},a.fragBufferedComplete=function(g,p){var _=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+g.type+" sn: "+g.sn+(p?" part: "+p.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+g.level+" "+o.default.toString(N.BufferHelper.getBuffered(_))),this.state=T.IDLE,this.tick()},a._handleFragmentLoadComplete=function(g){var p=this.transmuxer;if(!p)return;var _=g.frag,U=g.part,B=g.partsLoaded,W=!B||B.length===0||B.some(function(M){return!M}),k=new h.ChunkMetadata(_.level,_.sn,_.stats.chunkCount+1,0,U?U.index:-1,!W);p.flush(k)},a._handleFragmentLoadProgress=function(g){},a._doFragLoad=function(g,p,_,U){var B=this;if(_===void 0&&(_=null),!this.levels)throw new Error("frag load aborted, missing levels");if(_=Math.max(g.start,_||0),this.config.lowLatencyMode&&p){var W=p.partList;if(W&&U){_>g.end&&p.fragmentHint&&(g=p.fragmentHint);var k=this.getNextPart(W,g,_);if(k>-1){var M=W[k];return this.log("Loading part sn: "+g.sn+" p: "+M.index+" cc: "+g.cc+" of playlist ["+p.startSN+"-"+p.endSN+"] parts [0-"+k+"-"+(W.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+g.level+", target: "+parseFloat(_.toFixed(3))),this.nextLoadPosition=M.start+M.duration,this.state=T.FRAG_LOADING,this.hls.trigger(R.Events.FRAG_LOADING,{frag:g,part:W[k],targetBufferTime:_}),this.doFragPartsLoad(g,W,k,U).catch(function(H){return B.handleFragLoadError(H)})}else if(!g.url||this.loadedEndOfParts(W,_))return Promise.resolve(null)}}return this.log("Loading fragment "+g.sn+" cc: "+g.cc+" "+(p?"of ["+p.startSN+"-"+p.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+g.level+", target: "+parseFloat(_.toFixed(3))),Object(K.isFiniteNumber)(g.sn)&&!this.bitrateTest&&(this.nextLoadPosition=g.start+g.duration),this.state=T.FRAG_LOADING,this.hls.trigger(R.Events.FRAG_LOADING,{frag:g,targetBufferTime:_}),this.fragmentLoader.load(g,U).catch(function(H){return B.handleFragLoadError(H)})},a.doFragPartsLoad=function(g,p,_,U){var B=this;return new Promise(function(W,k){var M=[],H=function X(ee){var ie=p[ee];B.fragmentLoader.loadPart(g,ie,U).then(function(ve){M[ie.index]=ve;var pe=ve.part;B.hls.trigger(R.Events.FRAG_LOADED,ve);var he=p[ee+1];if(he&&he.fragment===g)X(ee+1);else return W({frag:g,part:pe,partsLoaded:M})}).catch(k)};H(_)})},a.handleFragLoadError=function(g){var p=g.data;return p&&p.details===C.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(p.frag,p.part):this.hls.trigger(R.Events.ERROR,p),null},a._handleTransmuxerFlush=function(g){var p=this.getCurrentContext(g);if(!p||this.state!==T.PARSING){this.fragCurrent||(this.state=T.IDLE);return}var _=p.frag,U=p.part,B=p.level,W=self.performance.now();_.stats.parsing.end=W,U&&(U.stats.parsing.end=W),this.updateLevelTiming(_,U,B,g.partial)},a.getCurrentContext=function(g){var p=this.levels,_=g.level,U=g.sn,B=g.part;if(!p||!p[_])return this.warn("Levels object was unset while buffering fragment "+U+" of level "+_+". The current chunk will not be buffered."),null;var W=p[_],k=B>-1?Object(x.getPartWith)(W,U,B):null,M=k?k.fragment:Object(x.getFragmentWithSN)(W,U,this.fragCurrent);return M?{frag:M,part:k,level:W}:null},a.bufferFragmentData=function(g,p,_,U){if(!g||this.state!==T.PARSING)return;var B=g.data1,W=g.data2,k=B;if(B&&W&&(k=Object(y.appendUint8Array)(B,W)),!k||!k.length)return;var M={type:g.type,frag:p,part:_,chunkMeta:U,parent:p.type,data:k};this.hls.trigger(R.Events.BUFFER_APPENDING,M),g.dropped&&g.independent&&!_&&this.flushBufferGap(p)},a.flushBufferGap=function(g){var p=this.media;if(!p)return;if(!N.BufferHelper.isBuffered(p,p.currentTime)){this.flushMainBuffer(0,g.start);return}var _=p.currentTime,U=N.BufferHelper.bufferInfo(p,_,0),B=g.duration,W=Math.min(this.config.maxFragLookUpTolerance*2,B*.25),k=Math.max(Math.min(g.start-W,U.end-W),_+W);g.start-k>W&&this.flushMainBuffer(k,g.start)},a.getFwdBufferInfo=function(g,p){var _=this.config,U=this.getLoadPosition();if(!Object(K.isFiniteNumber)(U))return null;var B=N.BufferHelper.bufferInfo(g,U,_.maxBufferHole);if(B.len===0&&B.nextStart!==void 0){var W=this.fragmentTracker.getBufferedFrag(U,p);if(W&&B.nextStart<W.end)return N.BufferHelper.bufferInfo(g,U,Math.max(B.nextStart,_.maxBufferHole))}return B},a.getMaxBufferLength=function(g){var p=this.config,_;return g?_=Math.max(8*p.maxBufferSize/g,p.maxBufferLength):_=p.maxBufferLength,Math.min(_,p.maxMaxBufferLength)},a.reduceMaxBufferLength=function(g){var p=this.config,_=g||p.maxBufferLength;return p.maxMaxBufferLength>=_?(p.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+p.maxMaxBufferLength+"s"),!0):!1},a.getNextFragment=function(g,p){var _,U,B=p.fragments,W=B.length;if(!W)return null;var k=this.config,M=B[0].start,H;if(p.live){var X=k.initialLiveManifestSize;if(W<X)return this.warn("Not enough fragments to start playback (have: "+W+", need: "+X+")"),null;!p.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(H=this.getInitialLiveFragment(p,B),this.startPosition=H?this.hls.liveSyncPosition||H.start:g)}else g<=M&&(H=B[0]);if(!H){var ee=k.lowLatencyMode?p.partEnd:p.fragmentEnd;H=this.getFragmentAtPosition(g,ee,p)}return(_=H)!==null&&_!==void 0&&_.initSegment&&!((U=H)!==null&&U!==void 0&&U.initSegment.data)&&!this.bitrateTest&&(H=H.initSegment),H},a.getNextPart=function(g,p,_){for(var U=-1,B=!1,W=!0,k=0,M=g.length;k<M;k++){var H=g[k];if(W=W&&!H.independent,U>-1&&_<H.start)break;var X=H.loaded;!X&&(B||H.independent||W)&&H.fragment===p&&(U=k),B=X}return U},a.loadedEndOfParts=function(g,p){var _=g[g.length-1];return _&&p>_.start&&_.loaded},a.getInitialLiveFragment=function(g,p){var _=this.fragPrevious,U=null;if(_){if(g.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+_.programDateTime),U=Object(w.findFragmentByPDT)(p,_.endProgramDateTime,this.config.maxFragLookUpTolerance)),!U){var B=_.sn+1;if(B>=g.startSN&&B<=g.endSN){var W=p[B-g.startSN];_.cc===W.cc&&(U=W,this.log("Live playlist, switching playlist, load frag with next SN: "+U.sn))}U||(U=Object(w.findFragWithCC)(p,_.cc),U&&this.log("Live playlist, switching playlist, load frag with same CC: "+U.sn))}}else{var k=this.hls.liveSyncPosition;k!==null&&(U=this.getFragmentAtPosition(k,this.bitrateTest?g.fragmentEnd:g.edge,g))}return U},a.getFragmentAtPosition=function(g,p,_){var U=this.config,B=this.fragPrevious,W=_.fragments,k=_.endSN,M=_.fragmentHint,H=U.maxFragLookUpTolerance,X=!!(U.lowLatencyMode&&_.partList&&M);X&&M&&!this.bitrateTest&&(W=W.concat(M),k=M.sn);var ee;if(g<p){var ie=g>p-H?0:H;ee=Object(w.findFragmentByPTS)(B,W,g,ie)}else ee=W[W.length-1];if(ee){var ve=ee.sn-_.startSN,pe=B&&ee.level===B.level,he=W[ve+1],ce=this.fragmentTracker.getState(ee);if(ce===O.FragmentState.BACKTRACKED){ee=null;for(var fe=ve;W[fe]&&this.fragmentTracker.getState(W[fe])===O.FragmentState.BACKTRACKED;)B?ee=W[fe--]:ee=W[--fe];ee||(ee=he)}else B&&ee.sn===B.sn&&!X&&(pe&&(ee.sn<k&&this.fragmentTracker.getState(he)!==O.FragmentState.OK?(this.log("SN "+ee.sn+" just loaded, load next one: "+he.sn),ee=he):ee=null))}return ee},a.synchronizeToLiveEdge=function(g){var p=this.config,_=this.media;if(!_)return;var U=this.hls.liveSyncPosition,B=_.currentTime,W=g.fragments[0].start,k=g.edge,M=B>=W-p.maxFragLookUpTolerance&&B<=k;if(U!==null&&_.duration>U&&(B<U||!M)){var H=p.liveMaxLatencyDuration!==void 0?p.liveMaxLatencyDuration:p.liveMaxLatencyDurationCount*g.targetduration;(!M&&_.readyState<4||B<k-H)&&(this.loadedmetadata||(this.nextLoadPosition=U),_.readyState&&(this.warn("Playback: "+B.toFixed(3)+" is located too far from the end of live sliding playlist: "+k+", reset currentTime to : "+U.toFixed(3)),_.currentTime=U))}},a.alignPlaylists=function(g,p){var _=this.levels,U=this.levelLastLoaded,B=this.fragPrevious,W=U!==null?_[U]:null,k=g.fragments.length;if(!k)return this.warn("No fragments in live playlist"),0;var M=g.fragments[0].start,H=!p,X=g.alignedSliding&&Object(K.isFiniteNumber)(M);if(H||!X&&!M){Object(P.alignStream)(B,W,g);var ee=g.fragments[0].start;return this.log("Live playlist sliding: "+ee.toFixed(2)+" start-sn: "+(p?p.startSN:"na")+"->"+g.startSN+" prev-sn: "+(B?B.sn:"na")+" fragments: "+k),ee}return M},a.waitForCdnTuneIn=function(g){var p=3;return g.live&&g.canBlockReload&&g.tuneInGoal>Math.max(g.partHoldBack,g.partTarget*p)},a.setStartPosition=function(g,p){var _=this.startPosition;if(_<p&&(_=-1),_===-1||this.lastCurrentTime===-1){var U=g.startTimeOffset;Object(K.isFiniteNumber)(U)?(_=p+U,U<0&&(_+=g.totalduration),_=Math.min(Math.max(p,_),p+g.totalduration),this.log("Start time offset "+U+" found in playlist, adjust startPosition to "+_),this.startPosition=_):g.live?_=this.hls.liveSyncPosition||p:this.startPosition=_=0,this.lastCurrentTime=_}this.nextLoadPosition=_},a.getLoadPosition=function(){var g=this.media,p=0;return this.loadedmetadata&&g?p=g.currentTime:this.nextLoadPosition&&(p=this.nextLoadPosition),p},a.handleFragLoadAborted=function(g,p){this.transmuxer&&g.sn!=="initSegment"&&g.stats.aborted&&(this.warn("Fragment "+g.sn+(p?" part"+p.index:"")+" of level "+g.level+" was aborted"),this.resetFragmentLoading(g))},a.resetFragmentLoading=function(g){(!this.fragCurrent||!this.fragContextChanged(g))&&(this.state=T.IDLE)},a.onFragmentOrKeyLoadError=function(g,p){if(p.fatal)return;var _=p.frag;if(!_||_.type!==g)return;var U=this.fragCurrent;console.assert(U&&_.sn===U.sn&&_.level===U.level&&_.urlId===U.urlId,"Frag load error must match current frag to retry");var B=this.config;if(this.fragLoadError+1<=B.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(_.level))return;var W=Math.min(Math.pow(2,this.fragLoadError)*B.fragLoadingRetryDelay,B.fragLoadingMaxRetryTimeout);this.warn("Fragment "+_.sn+" of "+g+" "+_.level+" failed to load, retrying in "+W+"ms"),this.retryDate=self.performance.now()+W,this.fragLoadError++,this.state=T.FRAG_LOADING_WAITING_RETRY}else p.levelRetry?(g===l.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=T.IDLE):(I.logger.error(p.details+" reaches max retry, redispatch as fatal ..."),p.fatal=!0,this.hls.stopLoad(),this.state=T.ERROR)},a.afterBufferFlushed=function(g,p,_){if(!g)return;var U=N.BufferHelper.getBuffered(g);this.fragmentTracker.detectEvictedFragments(p,U,_),this.state===T.ENDED&&this.resetLoadingState()},a.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=T.IDLE},a.resetLiveStartWhenNotLoaded=function(g){if(!this.loadedmetadata){this.startFragRequested=!1;var p=this.levels?this.levels[g].details:null;if(p!=null&&p.live)return this.startPosition=-1,this.setStartPosition(p,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},a.updateLevelTiming=function(g,p,_,U){var B=this,W=_.details;console.assert(!!W,"level.details must be defined");var k=Object.keys(g.elementaryStreams).reduce(function(M,H){var X=g.elementaryStreams[H];if(X){var ee=X.endPTS-X.startPTS;if(ee<=0)return B.warn("Could not parse fragment "+g.sn+" "+H+" duration reliably ("+ee+") resetting transmuxer to fallback to playlist timing"),B.resetTransmuxer(),M||!1;var ie=U?0:Object(x.updateFragPTSDTS)(W,g,X.startPTS,X.endPTS,X.startDTS,X.endDTS);return B.hls.trigger(R.Events.LEVEL_PTS_UPDATED,{details:W,level:_,drift:ie,type:H,frag:g,start:X.startPTS,end:X.endPTS}),!0}return M},!1);k?(this.state=T.PARSED,this.hls.trigger(R.Events.FRAG_PARSED,{frag:g,part:p})):this.resetLoadingState()},a.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},S(u,[{key:"state",get:function(){return this._state},set:function(g){var p=this._state;p!==g&&(this._state=g,this.log(p+"->"+g))}}]),u}(F.default)},"./src/controller/buffer-controller.ts":function(J,z,D){"use strict";D.r(z),D.d(z,"default",function(){return w});var K=D("./src/polyfills/number.ts"),F=D("./src/events.ts"),O=D("./src/utils/logger.ts"),N=D("./src/errors.ts"),I=D("./src/utils/buffer-helper.ts"),R=D("./src/utils/mediasource-helper.ts"),C=D("./src/loader/fragment.ts"),h=D("./src/controller/buffer-operation-queue.ts"),y=Object(R.getMediaSource)(),P=/([ha]vc.)(?:\.[^.,]+)+/,w=function(){function x(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 l=o.hls,s=o.media,S=o.mediaSource;O.logger.log("[buffer-controller]: Media source opened"),s&&(o.updateMediaElementDuration(),l.trigger(F.Events.MEDIA_ATTACHED,{media:s})),S&&S.removeEventListener("sourceopen",o._onMediaSourceOpen),o.checkPendingTracks()},this._onMediaSourceClose=function(){O.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){O.logger.log("[buffer-controller]: Media source ended")},this.hls=d,this._initSourceBuffer(),this.registerListeners()}var v=x.prototype;return v.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},v.destroy=function(){this.unregisterListeners(),this.details=null},v.registerListeners=function(){var o=this.hls;o.on(F.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.on(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(F.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(F.Events.BUFFER_RESET,this.onBufferReset,this),o.on(F.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.on(F.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.on(F.Events.BUFFER_EOS,this.onBufferEos,this),o.on(F.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.on(F.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.on(F.Events.FRAG_PARSED,this.onFragParsed,this),o.on(F.Events.FRAG_CHANGED,this.onFragChanged,this)},v.unregisterListeners=function(){var o=this.hls;o.off(F.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.off(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(F.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(F.Events.BUFFER_RESET,this.onBufferReset,this),o.off(F.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.off(F.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.off(F.Events.BUFFER_EOS,this.onBufferEos,this),o.off(F.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.off(F.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.off(F.Events.FRAG_PARSED,this.onFragParsed,this),o.off(F.Events.FRAG_CHANGED,this.onFragChanged,this)},v._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new h.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},v.onManifestParsed=function(o,l){var s=2;(l.audio&&!l.video||!l.altAudio)&&(s=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=s,this.details=null,O.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},v.onMediaAttaching=function(o,l){var s=this.media=l.media;if(s&&y){var S=this.mediaSource=new y;S.addEventListener("sourceopen",this._onMediaSourceOpen),S.addEventListener("sourceended",this._onMediaSourceEnded),S.addEventListener("sourceclose",this._onMediaSourceClose),s.src=self.URL.createObjectURL(S),this._objectUrl=s.src}},v.onMediaDetaching=function(){var o=this.media,l=this.mediaSource,s=this._objectUrl;if(l){if(O.logger.log("[buffer-controller]: media source detaching"),l.readyState==="open")try{l.endOfStream()}catch(S){O.logger.warn("[buffer-controller]: onMediaDetaching: "+S.message+" while calling endOfStream")}this.onBufferReset(),l.removeEventListener("sourceopen",this._onMediaSourceOpen),l.removeEventListener("sourceended",this._onMediaSourceEnded),l.removeEventListener("sourceclose",this._onMediaSourceClose),o&&(s&&self.URL.revokeObjectURL(s),o.src===s?(o.removeAttribute("src"),o.load()):O.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(F.Events.MEDIA_DETACHED,void 0)},v.onBufferReset=function(){var o=this;this.getSourceBufferTypes().forEach(function(l){var s=o.sourceBuffer[l];try{s&&(o.removeBufferListeners(l),o.mediaSource&&o.mediaSource.removeSourceBuffer(s),o.sourceBuffer[l]=void 0)}catch(S){O.logger.warn("[buffer-controller]: Failed to reset the "+l+" buffer",S)}}),this._initSourceBuffer()},v.onBufferCodecs=function(o,l){var s=this,S=this.getSourceBufferTypes().length;if(Object.keys(l).forEach(function(b){if(S){var f=s.tracks[b];if(f&&typeof f.buffer.changeType=="function"){var L=l[b],T=L.codec,m=L.levelCodec,c=L.container,u=(f.levelCodec||f.codec).replace(P,"$1"),a=(m||T).replace(P,"$1");if(u!==a){var E=c+";codecs="+(m||T);s.appendChangeType(b,E)}}}else s.pendingTracks[b]=l[b]}),S)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},v.appendChangeType=function(o,l){var s=this,S=this.operationQueue,b={execute:function(){var L=s.sourceBuffer[o];L&&(O.logger.log("[buffer-controller]: changing "+o+" sourceBuffer type to "+l),L.changeType(l)),S.shiftAndExecuteNext(o)},onStart:function(){},onComplete:function(){},onError:function(L){O.logger.warn("[buffer-controller]: Failed to change "+o+" SourceBuffer type",L)}};S.append(b,o)},v.onBufferAppending=function(o,l){var s=this,S=this.hls,b=this.operationQueue,f=this.tracks,L=l.data,T=l.type,m=l.frag,c=l.part,u=l.chunkMeta,a=u.buffering[T],E=self.performance.now();a.start=E;var g=m.stats.buffering,p=c?c.stats.buffering:null;g.start===0&&(g.start=E),p&&p.start===0&&(p.start=E);var _=f.audio,U=T==="audio"&&u.id===1&&(_==null?void 0:_.container)==="audio/mpeg",B={execute:function(){if(a.executeStart=self.performance.now(),U){var k=s.sourceBuffer[T];if(k){var M=m.start-k.timestampOffset;Math.abs(M)>=.1&&(O.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+m.start+" (delta: "+M+") sn: "+m.sn+")"),k.timestampOffset=m.start)}}s.appendExecutor(L,T)},onStart:function(){},onComplete:function(){var k=self.performance.now();a.executeEnd=a.end=k,g.first===0&&(g.first=k),p&&p.first===0&&(p.first=k);var M=s.sourceBuffer,H={};for(var X in M)H[X]=I.BufferHelper.getBuffered(M[X]);s.appendError=0,s.hls.trigger(F.Events.BUFFER_APPENDED,{type:T,frag:m,part:c,chunkMeta:u,parent:m.type,timeRanges:H})},onError:function(k){O.logger.error("[buffer-controller]: Error encountered while trying to append to the "+T+" SourceBuffer",k);var M={type:N.ErrorTypes.MEDIA_ERROR,parent:m.type,details:N.ErrorDetails.BUFFER_APPEND_ERROR,err:k,fatal:!1};k.code===DOMException.QUOTA_EXCEEDED_ERR?M.details=N.ErrorDetails.BUFFER_FULL_ERROR:(s.appendError++,M.details=N.ErrorDetails.BUFFER_APPEND_ERROR,s.appendError>S.config.appendErrorMaxRetry&&(O.logger.error("[buffer-controller]: Failed "+S.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),M.fatal=!0)),S.trigger(F.Events.ERROR,M)}};b.append(B,T)},v.onBufferFlushing=function(o,l){var s=this,S=this.operationQueue,b=function(L){return{execute:s.removeExecutor.bind(s,L,l.startOffset,l.endOffset),onStart:function(){},onComplete:function(){s.hls.trigger(F.Events.BUFFER_FLUSHED,{type:L})},onError:function(m){O.logger.warn("[buffer-controller]: Failed to remove from "+L+" SourceBuffer",m)}}};l.type?S.append(b(l.type),l.type):this.getSourceBufferTypes().forEach(function(f){S.append(b(f),f)})},v.onFragParsed=function(o,l){var s=this,S=l.frag,b=l.part,f=[],L=b?b.elementaryStreams:S.elementaryStreams;L[C.ElementaryStreamTypes.AUDIOVIDEO]?f.push("audiovideo"):(L[C.ElementaryStreamTypes.AUDIO]&&f.push("audio"),L[C.ElementaryStreamTypes.VIDEO]&&f.push("video"));var T=function(){var c=self.performance.now();S.stats.buffering.end=c,b&&(b.stats.buffering.end=c);var u=b?b.stats:S.stats;s.hls.trigger(F.Events.FRAG_BUFFERED,{frag:S,part:b,stats:u,id:S.type})};f.length===0&&O.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+S.type+" level: "+S.level+" sn: "+S.sn),this.blockBuffers(T,f)},v.onFragChanged=function(o,l){this.flushBackBuffer()},v.onBufferEos=function(o,l){var s=this,S=this.getSourceBufferTypes().reduce(function(b,f){var L=s.sourceBuffer[f];return(!l.type||l.type===f)&&(L&&!L.ended&&(L.ended=!0,O.logger.log("[buffer-controller]: "+f+" sourceBuffer now EOS"))),b&&!!(!L||L.ended)},!0);S&&this.blockBuffers(function(){var b=s.mediaSource;if(!b||b.readyState!=="open")return;b.endOfStream()})},v.onLevelUpdated=function(o,l){var s=l.details;if(!s.fragments.length)return;this.details=s,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},v.flushBackBuffer=function(){var o=this.hls,l=this.details,s=this.media,S=this.sourceBuffer;if(!s||l===null)return;var b=this.getSourceBufferTypes();if(!b.length)return;var f=l.live&&o.config.liveBackBufferLength!==null?o.config.liveBackBufferLength:o.config.backBufferLength;if(!Object(K.isFiniteNumber)(f)||f<0)return;var L=s.currentTime,T=l.levelTargetDuration,m=Math.max(f,T),c=Math.floor(L/T)*T-m;b.forEach(function(u){var a=S[u];if(a){var E=I.BufferHelper.getBuffered(a);E.length>0&&c>E.start(0)&&(o.trigger(F.Events.BACK_BUFFER_REACHED,{bufferEnd:c}),l.live&&o.trigger(F.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:c}),o.trigger(F.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:c,type:u}))}})},v.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var o=this.details,l=this.hls,s=this.media,S=this.mediaSource,b=o.fragments[0].start+o.totalduration,f=s.duration,L=Object(K.isFiniteNumber)(S.duration)?S.duration:0;o.live&&l.config.liveDurationInfinity?(O.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),S.duration=Infinity,this.updateSeekableRange(o)):(b>L&&b>f||!Object(K.isFiniteNumber)(f))&&(O.logger.log("[buffer-controller]: Updating Media Source duration to "+b.toFixed(3)),S.duration=b)},v.updateSeekableRange=function(o){var l=this.mediaSource,s=o.fragments,S=s.length;if(S&&o.live&&l!==null&&l!==void 0&&l.setLiveSeekableRange){var b=Math.max(0,s[0].start),f=Math.max(b,b+o.totalduration);l.setLiveSeekableRange(b,f)}},v.checkPendingTracks=function(){var o=this.bufferCodecEventsExpected,l=this.operationQueue,s=this.pendingTracks,S=Object.keys(s).length;if(S&&!o||S===2){this.createSourceBuffers(s),this.pendingTracks={};var b=this.getSourceBufferTypes();if(b.length===0){this.hls.trigger(F.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}b.forEach(function(f){l.executeNext(f)})}},v.createSourceBuffers=function(o){var l=this.sourceBuffer,s=this.mediaSource;if(!s)throw Error("createSourceBuffers called when mediaSource was null");var S=0;for(var b in o)if(!l[b]){var f=o[b];if(!f)throw Error("source buffer exists for track "+b+", however track does not");var L=f.levelCodec||f.codec,T=f.container+";codecs="+L;O.logger.log("[buffer-controller]: creating sourceBuffer("+T+")");try{var m=l[b]=s.addSourceBuffer(T),c=b;this.addBufferListener(c,"updatestart",this._onSBUpdateStart),this.addBufferListener(c,"updateend",this._onSBUpdateEnd),this.addBufferListener(c,"error",this._onSBUpdateError),this.tracks[b]={buffer:m,codec:L,container:f.container,levelCodec:f.levelCodec,id:f.id},S++}catch(u){O.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+u.message),this.hls.trigger(F.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:u,mimeType:T})}}S&&this.hls.trigger(F.Events.BUFFER_CREATED,{tracks:this.tracks})},v._onSBUpdateStart=function(o){var l=this.operationQueue,s=l.current(o);s.onStart()},v._onSBUpdateEnd=function(o){var l=this.operationQueue,s=l.current(o);s.onComplete(),l.shiftAndExecuteNext(o)},v._onSBUpdateError=function(o,l){O.logger.error("[buffer-controller]: "+o+" SourceBuffer error",l),this.hls.trigger(F.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var s=this.operationQueue.current(o);s&&s.onError(l)},v.removeExecutor=function(o,l,s){var S=this.media,b=this.mediaSource,f=this.operationQueue,L=this.sourceBuffer,T=L[o];if(!S||!b||!T){O.logger.warn("[buffer-controller]: Attempting to remove from the "+o+" SourceBuffer, but it does not exist"),f.shiftAndExecuteNext(o);return}var m=Object(K.isFiniteNumber)(S.duration)?S.duration:Infinity,c=Object(K.isFiniteNumber)(b.duration)?b.duration:Infinity,u=Math.max(0,l),a=Math.min(s,m,c);a>u?(O.logger.log("[buffer-controller]: Removing ["+u+","+a+"] from the "+o+" SourceBuffer"),console.assert(!T.updating,o+" sourceBuffer must not be updating"),T.remove(u,a)):f.shiftAndExecuteNext(o)},v.appendExecutor=function(o,l){var s=this.operationQueue,S=this.sourceBuffer,b=S[l];if(!b){O.logger.warn("[buffer-controller]: Attempting to append to the "+l+" SourceBuffer, but it does not exist"),s.shiftAndExecuteNext(l);return}b.ended=!1,console.assert(!b.updating,l+" sourceBuffer must not be updating"),b.appendBuffer(o)},v.blockBuffers=function(o,l){var s=this;if(l===void 0&&(l=this.getSourceBufferTypes()),!l.length){O.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(o);return}var S=this.operationQueue,b=l.map(function(f){return S.appendBlocker(f)});Promise.all(b).then(function(){o(),l.forEach(function(f){var L=s.sourceBuffer[f];(!L||!L.updating)&&S.shiftAndExecuteNext(f)})})},v.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},v.addBufferListener=function(o,l,s){var S=this.sourceBuffer[o];if(!S)return;var b=s.bind(this,o);this.listeners[o].push({event:l,listener:b}),S.addEventListener(l,b)},v.removeBufferListeners=function(o){var l=this.sourceBuffer[o];if(!l)return;this.listeners[o].forEach(function(s){l.removeEventListener(s.event,s.listener)})},x}()},"./src/controller/buffer-operation-queue.ts":function(J,z,D){"use strict";D.r(z),D.d(z,"default",function(){return F});var K=D("./src/utils/logger.ts"),F=function(){function O(I){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=I}var N=O.prototype;return N.append=function(R,C){var h=this.queues[C];h.push(R),h.length===1&&this.buffers[C]&&this.executeNext(C)},N.insertAbort=function(R,C){var h=this.queues[C];h.unshift(R),this.executeNext(C)},N.appendBlocker=function(R){var C,h=new Promise(function(P){C=P}),y={execute:C,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(y,R),h},N.executeNext=function(R){var C=this.buffers,h=this.queues,y=C[R],P=h[R];if(P.length){var w=P[0];try{w.execute()}catch(x){K.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),w.onError(x),(!y||!y.updating)&&(P.shift(),this.executeNext(R))}}},N.shiftAndExecuteNext=function(R){this.queues[R].shift(),this.executeNext(R)},N.current=function(R){return this.queues[R][0]},O}()},"./src/controller/cap-level-controller.ts":function(J,z,D){"use strict";D.r(z);var K=D("./src/events.ts");function F(I,R){for(var C=0;C<R.length;C++){var h=R[C];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(I,h.key,h)}}function O(I,R,C){return R&&F(I.prototype,R),C&&F(I,C),I}var N=function(){function I(C){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=C,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var R=I.prototype;return R.setStreamController=function(h){this.streamController=h},R.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},R.registerListeners=function(){var h=this.hls;h.on(K.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),h.on(K.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),h.on(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),h.on(K.Events.BUFFER_CODECS,this.onBufferCodecs,this),h.on(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},R.unregisterListener=function(){var h=this.hls;h.off(K.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),h.off(K.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),h.off(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),h.off(K.Events.BUFFER_CODECS,this.onBufferCodecs,this),h.off(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},R.onFpsDropLevelCapping=function(h,y){I.isLevelAllowed(y.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(y.droppedLevel)},R.onMediaAttaching=function(h,y){this.media=y.media instanceof HTMLVideoElement?y.media:null},R.onManifestParsed=function(h,y){var P=this.hls;this.restrictedLevels=[],this.firstLevel=y.firstLevel,P.config.capLevelToPlayerSize&&y.video&&this.startCapping()},R.onBufferCodecs=function(h,y){var P=this.hls;P.config.capLevelToPlayerSize&&y.video&&this.startCapping()},R.onMediaDetaching=function(){this.stopCapping()},R.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var h=this.hls.levels;if(h.length){var y=this.hls;y.autoLevelCapping=this.getMaxLevel(h.length-1),y.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=y.autoLevelCapping}}},R.getMaxLevel=function(h){var y=this,P=this.hls.levels;if(!P.length)return-1;var w=P.filter(function(x,v){return I.isLevelAllowed(v,y.restrictedLevels)&&v<=h});return this.clientRect=null,I.getMaxLevelByMediaSize(w,this.mediaWidth,this.mediaHeight)},R.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()},R.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},R.getDimensions=function(){if(this.clientRect)return this.clientRect;var h=this.media,y={width:0,height:0};if(h){var P=h.getBoundingClientRect();y.width=P.width,y.height=P.height,!y.width&&!y.height&&(y.width=P.right-P.left||h.width||0,y.height=P.bottom-P.top||h.height||0)}return this.clientRect=y,y},I.isLevelAllowed=function(h,y){return y===void 0&&(y=[]),y.indexOf(h)===-1},I.getMaxLevelByMediaSize=function(h,y,P){if(!h||!h.length)return-1;for(var w=function(l,s){return s?l.width!==s.width||l.height!==s.height:!0},x=h.length-1,v=0;v<h.length;v+=1){var d=h[v];if((d.width>=y||d.height>=P)&&w(d,h[v+1])){x=v;break}}return x},O(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 h=1;try{h=self.devicePixelRatio}catch(y){}return h}}]),I}();z.default=N},"./src/controller/cmcd-controller.ts":function(J,z,D){"use strict";D.r(z),D.d(z,"default",function(){return w});var K=D("./src/events.ts"),F=D("./src/types/cmcd.ts"),O=D("./src/utils/buffer-helper.ts"),N=D("./src/utils/logger.ts");function I(x,v){for(var d=0;d<v.length;d++){var o=v[d];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(x,o.key,o)}}function R(x,v,d){return v&&I(x.prototype,v),d&&I(x,d),x}function C(x,v){var d=typeof Symbol!="undefined"&&x[Symbol.iterator]||x["@@iterator"];if(d)return(d=d.call(x)).next.bind(d);if(Array.isArray(x)||(d=h(x))||v&&x&&typeof x.length=="number"){d&&(x=d);var o=0;return function(){return o>=x.length?{done:!0}:{done:!1,value:x[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 h(x,v){if(!x)return;if(typeof x=="string")return y(x,v);var d=Object.prototype.toString.call(x).slice(8,-1);if(d==="Object"&&x.constructor&&(d=x.constructor.name),d==="Map"||d==="Set")return Array.from(x);if(d==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(d))return y(x,v)}function y(x,v){(v==null||v>x.length)&&(v=x.length);for(var d=0,o=new Array(v);d<v;d++)o[d]=x[d];return o}function P(){return P=Object.assign||function(x){for(var v=1;v<arguments.length;v++){var d=arguments[v];for(var o in d)Object.prototype.hasOwnProperty.call(d,o)&&(x[o]=d[o])}return x},P.apply(this,arguments)}var w=function(){function x(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:F.CMCDObjectType.MANIFEST,su:!o.initialized})}catch(b){N.logger.warn("Could not generate manifest CMCD data.",b)}},this.applyFragmentData=function(S){try{var b=S.frag,f=o.hls.levels[b.level],L=o.getObjectType(b),T={d:b.duration*1e3,ot:L};(L===F.CMCDObjectType.VIDEO||L===F.CMCDObjectType.AUDIO||L==F.CMCDObjectType.MUXED)&&(T.br=f.bitrate/1e3,T.tb=o.getTopBandwidth(L),T.bl=o.getBufferLength(L)),o.apply(S,T)}catch(m){N.logger.warn("Could not generate segment CMCD data.",m)}},this.hls=d;var l=this.config=d.config,s=l.cmcd;s!=null&&(l.pLoader=this.createPlaylistLoader(),l.fLoader=this.createFragmentLoader(),this.sid=s.sessionId||x.uuid(),this.cid=s.contentId,this.useHeaders=s.useHeaders===!0,this.registerListeners())}var v=x.prototype;return v.registerListeners=function(){var o=this.hls;o.on(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(K.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.on(K.Events.BUFFER_CREATED,this.onBufferCreated,this)},v.unregisterListeners=function(){var o=this.hls;o.off(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(K.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.off(K.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},v.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},v.onMediaAttached=function(o,l){this.media=l.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},v.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},v.onBufferCreated=function(o,l){var s,S;this.audioBuffer=(s=l.tracks.audio)===null||s===void 0?void 0:s.buffer,this.videoBuffer=(S=l.tracks.video)===null||S===void 0?void 0:S.buffer},v.createData=function(){var o;return{v:F.CMCDVersion,sf:F.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}},v.apply=function(o,l){l===void 0&&(l={}),P(l,this.createData());var s=l.ot===F.CMCDObjectType.INIT||l.ot===F.CMCDObjectType.VIDEO||l.ot===F.CMCDObjectType.MUXED;if(this.starved&&s&&(l.bs=!0,l.su=!0,this.starved=!1),l.su==null&&(l.su=this.buffering),this.useHeaders){var S=x.toHeaders(l);if(!Object.keys(S).length)return;o.headers||(o.headers={}),P(o.headers,S)}else{var b=x.toQuery(l);if(!b)return;o.url=x.appendQueryToUri(o.url,b)}},v.getObjectType=function(o){var l=o.type;return l==="subtitle"?F.CMCDObjectType.TIMED_TEXT:o.sn==="initSegment"?F.CMCDObjectType.INIT:l==="audio"?F.CMCDObjectType.AUDIO:l==="main"?this.hls.audioTracks.length?F.CMCDObjectType.VIDEO:F.CMCDObjectType.MUXED:void 0},v.getTopBandwidth=function(o){for(var l=0,s=o===F.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,S=C(s),b;!(b=S()).done;){var f=b.value;f.bitrate>l&&(l=f.bitrate)}return l>0?l:NaN},v.getBufferLength=function(o){var l=this.hls.media,s=o===F.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!s||!l)return NaN;var S=O.BufferHelper.bufferInfo(s,l.currentTime,this.config.maxBufferHole);return S.len*1e3},v.createPlaylistLoader=function(){var o=this.config.pLoader,l=this.applyPlaylistData,s=o||this.config.loader;return function(){function S(f){this.loader=void 0,this.loader=new s(f)}var b=S.prototype;return b.destroy=function(){this.loader.destroy()},b.abort=function(){this.loader.abort()},b.load=function(L,T,m){l(L),this.loader.load(L,T,m)},R(S,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),S}()},v.createFragmentLoader=function(){var o=this.config.fLoader,l=this.applyFragmentData,s=o||this.config.loader;return function(){function S(f){this.loader=void 0,this.loader=new s(f)}var b=S.prototype;return b.destroy=function(){this.loader.destroy()},b.abort=function(){this.loader.abort()},b.load=function(L,T,m){l(L),this.loader.load(L,T,m)},R(S,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),S}()},x.uuid=function(){var o=URL.createObjectURL(new Blob),l=o.toString();return URL.revokeObjectURL(o),l.substr(l.lastIndexOf("/")+1)},x.serialize=function(o){for(var l=[],s=function(U){return!Number.isNaN(U)&&U!=null&&U!==""&&U!==!1},S=function(U){return Math.round(U)},b=function(U){return S(U/100)*100},f=function(U){return encodeURIComponent(U)},L={br:S,d:S,bl:b,dl:b,mtp:b,nor:f,rtp:b,tb:S},T=Object.keys(o||{}).sort(),m=C(T),c;!(c=m()).done;){var u=c.value,a=o[u];if(!s(a))continue;if(u==="v"&&a===1)continue;if(u=="pr"&&a===1)continue;var E=L[u];E&&(a=E(a));var g=typeof a,p=void 0;u==="ot"||u==="sf"||u==="st"?p=u+"="+a:g==="boolean"?p=u:g==="number"?p=u+"="+a:p=u+"="+JSON.stringify(a),l.push(p)}return l.join(",")},x.toHeaders=function(o){for(var l=Object.keys(o),s={},S=["Object","Request","Session","Status"],b=[{},{},{},{}],f={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},L=0,T=l;L<T.length;L++){var m=T[L],c=f[m]!=null?f[m]:1;b[c][m]=o[m]}for(var u=0;u<b.length;u++){var a=x.serialize(b[u]);a&&(s["CMCD-"+S[u]]=a)}return s},x.toQuery=function(o){return"CMCD="+encodeURIComponent(x.serialize(o))},x.appendQueryToUri=function(o,l){if(!l)return o;var s=o.includes("?")?"&":"?";return""+o+s+l},x}()},"./src/controller/eme-controller.ts":function(J,z,D){"use strict";D.r(z);var K=D("./src/events.ts"),F=D("./src/errors.ts"),O=D("./src/utils/logger.ts"),N=D("./src/utils/mediakeys-helper.ts");function I(w,x){for(var v=0;v<x.length;v++){var d=x[v];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(w,d.key,d)}}function R(w,x,v){return x&&I(w.prototype,x),v&&I(w,v),w}var C=3,h=function(x,v,d){var o={audioCapabilities:[],videoCapabilities:[]};return x.forEach(function(l){o.audioCapabilities.push({contentType:'audio/mp4; codecs="'+l+'"',robustness:d.audioRobustness||""})}),v.forEach(function(l){o.videoCapabilities.push({contentType:'video/mp4; codecs="'+l+'"',robustness:d.videoRobustness||""})}),[o]},y=function(x,v,d,o){switch(x){case N.KeySystems.WIDEVINE:return h(v,d,o);default:throw new Error("Unknown key-system: "+x)}},P=function(){function w(v){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=v,this._config=v.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 x=w.prototype;return x.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},x._registerListeners=function(){this.hls.on(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(K.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(K.Events.MANIFEST_PARSED,this.onManifestParsed,this)},x._unregisterListeners=function(){this.hls.off(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(K.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(K.Events.MANIFEST_PARSED,this.onManifestParsed,this)},x.getLicenseServerUrl=function(d){switch(d){case N.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+d+'"')},x._attemptKeySystemAccess=function(d,o,l){var s=this,S=y(d,o,l,this._drmSystemOptions);O.logger.log("Requesting encrypted media key-system access");var b=this.requestMediaKeySystemAccess(d,S);this.mediaKeysPromise=b.then(function(f){return s._onMediaKeySystemAccessObtained(d,f)}),b.catch(function(f){O.logger.error('Failed to obtain key-system "'+d+'" access:',f)})},x._onMediaKeySystemAccessObtained=function(d,o){var l=this;O.logger.log('Access for key-system "'+d+'" obtained');var s={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:o,mediaKeySystemDomain:d};this._mediaKeysList.push(s);var S=Promise.resolve().then(function(){return o.createMediaKeys()}).then(function(b){return s.mediaKeys=b,O.logger.log('Media-keys created for key-system "'+d+'"'),l._onMediaKeysCreated(),b});return S.catch(function(b){O.logger.error("Failed to create media-keys:",b)}),S},x._onMediaKeysCreated=function(){var d=this;this._mediaKeysList.forEach(function(o){o.mediaKeysSession||(o.mediaKeysSession=o.mediaKeys.createSession(),d._onNewMediaKeySession(o.mediaKeysSession))})},x._onNewMediaKeySession=function(d){var o=this;O.logger.log("New key-system session "+d.sessionId),d.addEventListener("message",function(l){o._onKeySessionMessage(d,l.message)},!1)},x._onKeySessionMessage=function(d,o){O.logger.log("Got EME message event, creating license request"),this._requestLicense(o,function(l){O.logger.log("Received license data (length: "+(l&&l.byteLength)+"), updating key-session"),d.update(l)})},x.onMediaEncrypted=function(d){var o=this;if(O.logger.log('Media is encrypted using "'+d.initDataType+'" init data type'),!this.mediaKeysPromise){O.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(K.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var l=function(S){if(!o._media)return;o._attemptSetMediaKeys(S),o._generateRequestWithPreferredKeySession(d.initDataType,d.initData)};this.mediaKeysPromise.then(l).catch(l)},x._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){O.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(K.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}O.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(o.mediaKeys),this._hasSetMediaKeys=!0}},x._generateRequestWithPreferredKeySession=function(d,o){var l=this,s=this._mediaKeysList[0];if(!s){O.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(K.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(s.mediaKeysSessionInitialized){O.logger.warn("Key-Session already initialized but requested again");return}var S=s.mediaKeysSession;if(!S){O.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(K.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!o){O.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(K.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}O.logger.log('Generating key-session request for "'+d+'" init data type'),s.mediaKeysSessionInitialized=!0,S.generateRequest(d,o).then(function(){O.logger.debug("Key-session generation succeeded")}).catch(function(b){O.logger.error("Error generating key-session request:",b),l.hls.trigger(K.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},x._createLicenseXhr=function(d,o,l){var s=new XMLHttpRequest;s.responseType="arraybuffer",s.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,s,d,o,l);var S=this._licenseXhrSetup;if(S)try{S.call(this.hls,s,d),S=void 0}catch(b){O.logger.error(b)}try{s.readyState||s.open("POST",d,!0),S&&S.call(this.hls,s,d)}catch(b){throw new Error("issue setting up KeySystem license XHR "+b)}return s},x._onLicenseRequestReadyStageChange=function(d,o,l,s){switch(d.readyState){case 4:if(d.status===200){this._requestLicenseFailureCount=0,O.logger.log("License request succeeded");var S=d.response,b=this._licenseResponseCallback;if(b)try{S=b.call(this.hls,d,o)}catch(L){O.logger.error(L)}s(S)}else{if(O.logger.error("License Request XHR failed ("+o+"). Status: "+d.status+" ("+d.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>C){this.hls.trigger(K.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var f=C-this._requestLicenseFailureCount+1;O.logger.warn("Retrying license request, "+f+" attempts left"),this._requestLicense(l,s)}break}},x._generateLicenseRequestChallenge=function(d,o){switch(d.mediaKeySystemDomain){case N.KeySystems.WIDEVINE:return o}throw new Error("unsupported key-system: "+d.mediaKeySystemDomain)},x._requestLicense=function(d,o){O.logger.log("Requesting content license for key-system");var l=this._mediaKeysList[0];if(!l){O.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(K.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var s=this.getLicenseServerUrl(l.mediaKeySystemDomain),S=this._createLicenseXhr(s,d,o);O.logger.log("Sending license request to URL: "+s);var b=this._generateLicenseRequestChallenge(l,d);S.send(b)}catch(f){O.logger.error("Failure requesting DRM license: "+f),this.hls.trigger(K.Events.ERROR,{type:F.ErrorTypes.KEY_SYSTEM_ERROR,details:F.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},x.onMediaAttached=function(d,o){if(!this._emeEnabled)return;var l=o.media;this._media=l,l.addEventListener("encrypted",this._onMediaEncrypted)},x.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(l){if(l.mediaKeysSession)return l.mediaKeysSession.close().catch(function(){})})).then(function(){return d.setMediaKeys(null)}).catch(function(){})},x.onManifestParsed=function(d,o){if(!this._emeEnabled)return;var l=o.levels.map(function(S){return S.audioCodec}).filter(function(S){return!!S}),s=o.levels.map(function(S){return S.videoCodec}).filter(function(S){return!!S});this._attemptKeySystemAccess(N.KeySystems.WIDEVINE,l,s)},R(w,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),w}();z.default=P},"./src/controller/fps-controller.ts":function(J,z,D){"use strict";D.r(z);var K=D("./src/events.ts"),F=D("./src/utils/logger.ts"),O=function(){function N(R){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=R,this.registerListeners()}var I=N.prototype;return I.setStreamController=function(C){this.streamController=C},I.registerListeners=function(){this.hls.on(K.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},I.unregisterListeners=function(){this.hls.off(K.Events.MEDIA_ATTACHING,this.onMediaAttaching)},I.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},I.onMediaAttaching=function(C,h){var y=this.hls.config;if(y.capLevelOnFPSDrop){var P=h.media instanceof self.HTMLVideoElement?h.media:null;this.media=P,P&&typeof P.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),y.fpsDroppedMonitoringPeriod)}},I.checkFPS=function(C,h,y){var P=performance.now();if(h){if(this.lastTime){var w=P-this.lastTime,x=y-this.lastDroppedFrames,v=h-this.lastDecodedFrames,d=1e3*x/w,o=this.hls;if(o.trigger(K.Events.FPS_DROP,{currentDropped:x,currentDecoded:v,totalDroppedFrames:y}),d>0&&x>o.config.fpsDroppedMonitoringThreshold*v){var l=o.currentLevel;F.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+l),l>0&&(o.autoLevelCapping===-1||o.autoLevelCapping>=l)&&(l=l-1,o.trigger(K.Events.FPS_DROP_LEVEL_CAPPING,{level:l,droppedLevel:o.currentLevel}),o.autoLevelCapping=l,this.streamController.nextLevelSwitch())}}this.lastTime=P,this.lastDroppedFrames=y,this.lastDecodedFrames=h}},I.checkFPSInterval=function(){var C=this.media;if(C)if(this.isVideoPlaybackQualityAvailable){var h=C.getVideoPlaybackQuality();this.checkFPS(C,h.totalVideoFrames,h.droppedVideoFrames)}else this.checkFPS(C,C.webkitDecodedFrameCount,C.webkitDroppedFrameCount)},N}();z.default=O},"./src/controller/fragment-finders.ts":function(J,z,D){"use strict";D.r(z),D.d(z,"findFragmentByPDT",function(){return O}),D.d(z,"findFragmentByPTS",function(){return N}),D.d(z,"fragmentWithinToleranceTest",function(){return I}),D.d(z,"pdtWithinToleranceTest",function(){return R}),D.d(z,"findFragWithCC",function(){return C});var K=D("./src/polyfills/number.ts"),F=D("./src/utils/binary-search.ts");function O(h,y,P){if(y===null||!Array.isArray(h)||!h.length||!Object(K.isFiniteNumber)(y))return null;var w=h[0].programDateTime;if(y<(w||0))return null;var x=h[h.length-1].endProgramDateTime;if(y>=(x||0))return null;P=P||0;for(var v=0;v<h.length;++v){var d=h[v];if(R(y,P,d))return d}return null}function N(h,y,P,w){P===void 0&&(P=0),w===void 0&&(w=0);var x=null;if(h?x=y[h.sn-y[0].sn+1]||null:P===0&&y[0].start===0&&(x=y[0]),x&&I(P,w,x)===0)return x;var v=F.default.search(y,I.bind(null,P,w));return v||x}function I(h,y,P){h===void 0&&(h=0),y===void 0&&(y=0);var w=Math.min(y,P.duration+(P.deltaPTS?P.deltaPTS:0));return P.start+P.duration-w<=h?1:P.start-w>h&&P.start?-1:0}function R(h,y,P){var w=Math.min(y,P.duration+(P.deltaPTS?P.deltaPTS:0))*1e3,x=P.endProgramDateTime||0;return x-w>h}function C(h,y){return F.default.search(h,function(P){return P.cc<y?1:P.cc>y?-1:0})}},"./src/controller/fragment-tracker.ts":function(J,z,D){"use strict";D.r(z),D.d(z,"FragmentState",function(){return O}),D.d(z,"FragmentTracker",function(){return N});var K=D("./src/events.ts"),F=D("./src/types/loader.ts"),O;(function(C){C.NOT_LOADED="NOT_LOADED",C.BACKTRACKED="BACKTRACKED",C.APPENDING="APPENDING",C.PARTIAL="PARTIAL",C.OK="OK"})(O||(O={}));var N=function(){function C(y){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=y,this._registerListeners()}var h=C.prototype;return h._registerListeners=function(){var P=this.hls;P.on(K.Events.BUFFER_APPENDED,this.onBufferAppended,this),P.on(K.Events.FRAG_BUFFERED,this.onFragBuffered,this),P.on(K.Events.FRAG_LOADED,this.onFragLoaded,this)},h._unregisterListeners=function(){var P=this.hls;P.off(K.Events.BUFFER_APPENDED,this.onBufferAppended,this),P.off(K.Events.FRAG_BUFFERED,this.onFragBuffered,this),P.off(K.Events.FRAG_LOADED,this.onFragLoaded,this)},h.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},h.getAppendedFrag=function(P,w){if(w===F.PlaylistLevelType.MAIN){var x=this.activeFragment,v=this.activeParts;if(!x)return null;if(v)for(var d=v.length;d--;){var o=v[d],l=o?o.end:x.appendedPTS;if(o.start<=P&&l!==void 0&&P<=l)return d>9&&(this.activeParts=v.slice(d-9)),o}else if(x.start<=P&&x.appendedPTS!==void 0&&P<=x.appendedPTS)return x}return this.getBufferedFrag(P,w)},h.getBufferedFrag=function(P,w){for(var x=this.fragments,v=Object.keys(x),d=v.length;d--;){var o=x[v[d]];if((o==null?void 0:o.body.type)===w&&o.buffered){var l=o.body;if(l.start<=P&&P<=l.end)return l}}return null},h.detectEvictedFragments=function(P,w,x){var v=this;Object.keys(this.fragments).forEach(function(d){var o=v.fragments[d];if(!o)return;if(!o.buffered){o.body.type===x&&v.removeFragment(o.body);return}var l=o.range[P];if(!l)return;l.time.some(function(s){var S=!v.isTimeBuffered(s.startPTS,s.endPTS,w);return S&&v.removeFragment(o.body),S})})},h.detectPartialFragments=function(P){var w=this,x=this.timeRanges,v=P.frag,d=P.part;if(!x||v.sn==="initSegment")return;var o=R(v),l=this.fragments[o];if(!l)return;Object.keys(x).forEach(function(s){var S=v.elementaryStreams[s];if(!S)return;var b=x[s],f=d!==null||S.partial===!0;l.range[s]=w.getBufferedTimes(v,d,f,b)}),l.backtrack=l.loaded=null,Object.keys(l.range).length?l.buffered=!0:this.removeFragment(l.body)},h.fragBuffered=function(P){var w=R(P),x=this.fragments[w];x&&(x.backtrack=x.loaded=null,x.buffered=!0)},h.getBufferedTimes=function(P,w,x,v){for(var d={time:[],partial:x},o=w?w.start:P.start,l=w?w.end:P.end,s=P.minEndPTS||l,S=P.maxStartPTS||o,b=0;b<v.length;b++){var f=v.start(b)-this.bufferPadding,L=v.end(b)+this.bufferPadding;if(S>=f&&s<=L){d.time.push({startPTS:Math.max(o,v.start(b)),endPTS:Math.min(l,v.end(b))});break}else if(o<L&&l>f)d.partial=!0,d.time.push({startPTS:Math.max(o,v.start(b)),endPTS:Math.min(l,v.end(b))});else if(l<=f)break}return d},h.getPartialFragment=function(P){var w=null,x,v,d,o=0,l=this.bufferPadding,s=this.fragments;return Object.keys(s).forEach(function(S){var b=s[S];if(!b)return;I(b)&&(v=b.body.start-l,d=b.body.end+l,P>=v&&P<=d&&(x=Math.min(P-v,d-P),o<=x&&(w=b.body,o=x)))}),w},h.getState=function(P){var w=R(P),x=this.fragments[w];return x?x.buffered?I(x)?O.PARTIAL:O.OK:x.backtrack?O.BACKTRACKED:O.APPENDING:O.NOT_LOADED},h.backtrack=function(P,w){var x=R(P),v=this.fragments[x];if(!v||v.backtrack)return null;var d=v.backtrack=w||v.loaded;return v.loaded=null,d},h.getBacktrackData=function(P){var w=R(P),x=this.fragments[w];if(x){var v,d=x.backtrack;if(d!=null&&(v=d.payload)!==null&&v!==void 0&&v.byteLength)return d;this.removeFragment(P)}return null},h.isTimeBuffered=function(P,w,x){for(var v,d,o=0;o<x.length;o++){if(v=x.start(o)-this.bufferPadding,d=x.end(o)+this.bufferPadding,P>=v&&w<=d)return!0;if(w<=v)return!1}return!1},h.onFragLoaded=function(P,w){var x=w.frag,v=w.part;if(x.sn==="initSegment"||x.bitrateTest||v)return;var d=R(x);this.fragments[d]={body:x,loaded:w,backtrack:null,buffered:!1,range:Object.create(null)}},h.onBufferAppended=function(P,w){var x=this,v=w.frag,d=w.part,o=w.timeRanges;if(v.type===F.PlaylistLevelType.MAIN)if(this.activeFragment=v,d){var l=this.activeParts;l||(this.activeParts=l=[]),l.push(d)}else this.activeParts=null;this.timeRanges=o,Object.keys(o).forEach(function(s){var S=o[s];if(x.detectEvictedFragments(s,S),!d)for(var b=0;b<S.length;b++)v.appendedPTS=Math.max(S.end(b),v.appendedPTS||0)})},h.onFragBuffered=function(P,w){this.detectPartialFragments(w)},h.hasFragment=function(P){var w=R(P);return!!this.fragments[w]},h.removeFragmentsInRange=function(P,w,x){var v=this;Object.keys(this.fragments).forEach(function(d){var o=v.fragments[d];if(!o)return;if(o.buffered){var l=o.body;l.type===x&&l.start<w&&l.end>P&&v.removeFragment(l)}})},h.removeFragment=function(P){var w=R(P);P.stats.loaded=0,P.clearElementaryStreamInfo(),delete this.fragments[w]},h.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},C}();function I(C){var h,y;return C.buffered&&(((h=C.range.video)===null||h===void 0?void 0:h.partial)||((y=C.range.audio)===null||y===void 0?void 0:y.partial))}function R(C){return C.type+"_"+C.level+"_"+C.urlId+"_"+C.sn}},"./src/controller/gap-controller.ts":function(J,z,D){"use strict";D.r(z),D.d(z,"STALL_MINIMUM_DURATION_MS",function(){return I}),D.d(z,"MAX_START_GAP_JUMP",function(){return R}),D.d(z,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return C}),D.d(z,"SKIP_BUFFER_RANGE_START",function(){return h}),D.d(z,"default",function(){return y});var K=D("./src/utils/buffer-helper.ts"),F=D("./src/errors.ts"),O=D("./src/events.ts"),N=D("./src/utils/logger.ts"),I=250,R=2,C=.1,h=.05,y=function(){function P(x,v,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=x,this.media=v,this.fragmentTracker=d,this.hls=o}var w=P.prototype;return w.destroy=function(){this.hls=this.fragmentTracker=this.media=null},w.poll=function(v){var d=this.config,o=this.media,l=this.stalled,s=o.currentTime,S=o.seeking,b=this.seeking&&!S,f=!this.seeking&&S;if(this.seeking=S,s!==v){if(this.moved=!0,l!==null){if(this.stallReported){var L=self.performance.now()-l;N.logger.warn("playback not stuck anymore @"+s+", after "+Math.round(L)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((f||b)&&(this.stalled=null),o.paused||o.ended||o.playbackRate===0||!K.BufferHelper.getBuffered(o).length)return;var T=K.BufferHelper.bufferInfo(o,s,0),m=T.len>0,c=T.nextStart||0;if(!m&&!c)return;if(S){var u=T.len>R,a=!c||c-s>R&&!this.fragmentTracker.getPartialFragment(s);if(u||a)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var E,g=Math.max(c,T.start||0)-s,p=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,_=p==null||((E=p.details)===null||E===void 0)?void 0:E.live,U=_?p.details.targetduration*2:R;if(g>0&&g<=U){this._trySkipBufferHole(null);return}}var B=self.performance.now();if(l===null){this.stalled=B;return}var W=B-l;!S&&W>=I&&this._reportStall(T.len);var k=K.BufferHelper.bufferInfo(o,s,d.maxBufferHole);this._tryFixBufferStall(k,W)},w._tryFixBufferStall=function(v,d){var o=this.config,l=this.fragmentTracker,s=this.media,S=s.currentTime,b=l.getPartialFragment(S);if(b){var f=this._trySkipBufferHole(b);if(f)return}v.len>o.maxBufferHole&&d>o.highBufferWatchdogPeriod*1e3&&(N.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},w._reportStall=function(v){var d=this.hls,o=this.media,l=this.stallReported;l||(this.stallReported=!0,N.logger.warn("Playback stalling at @"+o.currentTime+" due to low buffer (buffer="+v+")"),d.trigger(O.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:v}))},w._trySkipBufferHole=function(v){for(var d=this.config,o=this.hls,l=this.media,s=l.currentTime,S=0,b=K.BufferHelper.getBuffered(l),f=0;f<b.length;f++){var L=b.start(f);if(s+d.maxBufferHole>=S&&s<L){var T=Math.max(L+h,l.currentTime+C);return N.logger.warn("skipping hole, adjusting currentTime from "+s+" to "+T),this.moved=!0,this.stalled=null,l.currentTime=T,v&&o.trigger(O.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+s+" to "+T,frag:v}),T}S=b.end(f)}return 0},w._tryNudgeBuffer=function(){var v=this.config,d=this.hls,o=this.media,l=o.currentTime,s=(this.nudgeRetry||0)+1;if(this.nudgeRetry=s,s<v.nudgeMaxRetry){var S=l+s*v.nudgeOffset;N.logger.warn("Nudging 'currentTime' from "+l+" to "+S),o.currentTime=S,d.trigger(O.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else N.logger.error("Playhead still not moving while enough data buffered @"+l+" after "+v.nudgeMaxRetry+" nudges"),d.trigger(O.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},P}()},"./src/controller/id3-track-controller.ts":function(J,z,D){"use strict";D.r(z);var K=D("./src/events.ts"),F=D("./src/utils/texttrack-utils.ts"),O=D("./src/demux/id3.ts"),N=.25,I=function(){function R(h){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=h,this._registerListeners()}var C=R.prototype;return C.destroy=function(){this._unregisterListeners()},C._registerListeners=function(){var y=this.hls;y.on(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),y.on(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),y.on(K.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),y.on(K.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},C._unregisterListeners=function(){var y=this.hls;y.off(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),y.off(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),y.off(K.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),y.off(K.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},C.onMediaAttached=function(y,P){this.media=P.media},C.onMediaDetaching=function(){if(!this.id3Track)return;Object(F.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},C.getID3Track=function(y){if(!this.media)return;for(var P=0;P<y.length;P++){var w=y[P];if(w.kind==="metadata"&&w.label==="id3")return Object(F.sendAddTrackEvent)(w,this.media),w}return this.media.addTextTrack("metadata","id3")},C.onFragParsingMetadata=function(y,P){if(!this.media)return;var w=P.frag,x=P.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var v=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,d=0;d<x.length;d++){var o=O.getID3Frames(x[d].data);if(o){var l=x[d].pts,s=d<x.length-1?x[d+1].pts:w.end,S=s-l;S<=0&&(s=l+N);for(var b=0;b<o.length;b++){var f=o[b];if(!O.isTimeStampFrame(f)){var L=new v(l,s,"");L.value=f,this.id3Track.addCue(L)}}}}},C.onBufferFlushing=function(y,P){var w=P.startOffset,x=P.endOffset,v=P.type;if(!v||v==="audio"){var d=this.id3Track;d&&Object(F.removeCuesInRange)(d,w,x)}},R}();z.default=I},"./src/controller/latency-controller.ts":function(J,z,D){"use strict";D.r(z),D.d(z,"default",function(){return R});var K=D("./src/errors.ts"),F=D("./src/events.ts"),O=D("./src/utils/logger.ts");function N(C,h){for(var y=0;y<h.length;y++){var P=h[y];P.enumerable=P.enumerable||!1,P.configurable=!0,"value"in P&&(P.writable=!0),Object.defineProperty(C,P.key,P)}}function I(C,h,y){return h&&N(C.prototype,h),y&&N(C,y),C}var R=function(){function C(y){var P=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 P.timeupdate()},this.hls=y,this.config=y.config,this.registerListeners()}var h=C.prototype;return h.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},h.registerListeners=function(){this.hls.on(F.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(F.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(F.Events.ERROR,this.onError,this)},h.unregisterListeners=function(){this.hls.off(F.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(F.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(F.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(F.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(F.Events.ERROR,this.onError)},h.onMediaAttached=function(P,w){this.media=w.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},h.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},h.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},h.onLevelUpdated=function(P,w){var x=w.details;this.levelDetails=x,x.advanced&&this.timeupdate(),!x.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},h.onError=function(P,w){if(w.details!==K.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,O.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},h.timeupdate=function(){var P=this.media,w=this.levelDetails;if(!P||!w)return;this.currentTime=P.currentTime;var x=this.computeLatency();if(x===null)return;this._latency=x;var v=this.config,d=v.lowLatencyMode,o=v.maxLiveSyncPlaybackRate;if(!d||o===1)return;var l=this.targetLatency;if(l===null)return;var s=x-l,S=Math.min(this.maxLatency,l+w.targetduration),b=s<S;if(w.live&&b&&s>.05&&this.forwardBufferLength>1){var f=Math.min(2,Math.max(1,o)),L=Math.round(2/(1+Math.exp(-.75*s-this.edgeStalled))*20)/20;P.playbackRate=Math.min(f,Math.max(1,L))}else P.playbackRate!==1&&P.playbackRate!==0&&(P.playbackRate=1)},h.estimateLiveEdge=function(){var P=this.levelDetails;return P===null?null:P.edge+P.age},h.computeLatency=function(){var P=this.estimateLiveEdge();return P===null?null:P-this.currentTime},I(C,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var P=this.config,w=this.levelDetails;return P.liveMaxLatencyDuration!==void 0?P.liveMaxLatencyDuration:w?P.liveMaxLatencyDurationCount*w.targetduration:0}},{key:"targetLatency",get:function(){var P=this.levelDetails;if(P===null)return null;var w=P.holdBack,x=P.partHoldBack,v=P.targetduration,d=this.config,o=d.liveSyncDuration,l=d.liveSyncDurationCount,s=d.lowLatencyMode,S=this.hls.userConfig,b=s&&x||w;(S.liveSyncDuration||S.liveSyncDurationCount||b===0)&&(b=o!==void 0?o:l*v);var f=v,L=1;return b+Math.min(this.stallCount*L,f)}},{key:"liveSyncPosition",get:function(){var P=this.estimateLiveEdge(),w=this.targetLatency,x=this.levelDetails;if(P===null||w===null||x===null)return null;var v=x.edge,d=P-w-this.edgeStalled,o=v-x.totalduration,l=v-(this.config.lowLatencyMode&&x.partTarget||x.targetduration);return Math.min(Math.max(o,d),l)}},{key:"drift",get:function(){var P=this.levelDetails;return P===null?1:P.drift}},{key:"edgeStalled",get:function(){var P=this.levelDetails;if(P===null)return 0;var w=(this.config.lowLatencyMode&&P.partTarget||P.targetduration)*3;return Math.max(P.age-w,0)}},{key:"forwardBufferLength",get:function(){var P=this.media,w=this.levelDetails;if(!P||!w)return 0;var x=P.buffered.length;return x?P.buffered.end(x-1):w.edge-this.currentTime}}]),C}()},"./src/controller/level-controller.ts":function(J,z,D){"use strict";D.r(z),D.d(z,"default",function(){return d});var K=D("./src/types/level.ts"),F=D("./src/events.ts"),O=D("./src/errors.ts"),N=D("./src/utils/codecs.ts"),I=D("./src/controller/level-helper.ts"),R=D("./src/controller/base-playlist-controller.ts"),C=D("./src/types/loader.ts");function h(){return h=Object.assign||function(o){for(var l=1;l<arguments.length;l++){var s=arguments[l];for(var S in s)Object.prototype.hasOwnProperty.call(s,S)&&(o[S]=s[S])}return o},h.apply(this,arguments)}function y(o,l){for(var s=0;s<l.length;s++){var S=l[s];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(o,S.key,S)}}function P(o,l,s){return l&&y(o.prototype,l),s&&y(o,s),o}function w(o,l){o.prototype=Object.create(l.prototype),o.prototype.constructor=o,x(o,l)}function x(o,l){return x=Object.setPrototypeOf||function(S,b){return S.__proto__=b,S},x(o,l)}var v=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),d=function(o){w(l,o);function l(S){var b;return b=o.call(this,S,"[level-controller]")||this,b._levels=[],b._firstLevel=-1,b._startLevel=void 0,b.currentLevelIndex=-1,b.manualLevelIndex=-1,b.onParsedComplete=void 0,b._registerListeners(),b}var s=l.prototype;return s._registerListeners=function(){var b=this.hls;b.on(F.Events.MANIFEST_LOADED,this.onManifestLoaded,this),b.on(F.Events.LEVEL_LOADED,this.onLevelLoaded,this),b.on(F.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),b.on(F.Events.FRAG_LOADED,this.onFragLoaded,this),b.on(F.Events.ERROR,this.onError,this)},s._unregisterListeners=function(){var b=this.hls;b.off(F.Events.MANIFEST_LOADED,this.onManifestLoaded,this),b.off(F.Events.LEVEL_LOADED,this.onLevelLoaded,this),b.off(F.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),b.off(F.Events.FRAG_LOADED,this.onFragLoaded,this),b.off(F.Events.ERROR,this.onError,this)},s.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,o.prototype.destroy.call(this)},s.startLoad=function(){var b=this._levels;b.forEach(function(f){f.loadError=0}),o.prototype.startLoad.call(this)},s.onManifestLoaded=function(b,f){var L=[],T=[],m=[],c,u={},a,E=!1,g=!1,p=!1;if(f.levels.forEach(function(W){var k=W.attrs;E=E||!!(W.width&&W.height),g=g||!!W.videoCodec,p=p||!!W.audioCodec,v&&W.audioCodec&&W.audioCodec.indexOf("mp4a.40.34")!==-1&&(W.audioCodec=void 0);var M=W.bitrate+"-"+W.attrs.RESOLUTION+"-"+W.attrs.CODECS;a=u[M],a?a.url.push(W.url):(a=new K.Level(W),u[M]=a,L.push(a)),k&&(k.AUDIO&&Object(I.addGroupId)(a,"audio",k.AUDIO),k.SUBTITLES&&Object(I.addGroupId)(a,"text",k.SUBTITLES))}),(E||g)&&p&&(L=L.filter(function(W){var k=W.videoCodec,M=W.width,H=W.height;return!!k||!!(M&&H)})),L=L.filter(function(W){var k=W.audioCodec,M=W.videoCodec;return(!k||Object(N.isCodecSupportedInMp4)(k,"audio"))&&(!M||Object(N.isCodecSupportedInMp4)(M,"video"))}),f.audioTracks&&(T=f.audioTracks.filter(function(W){return!W.audioCodec||Object(N.isCodecSupportedInMp4)(W.audioCodec,"audio")}),Object(I.assignTrackIdsByGroup)(T)),f.subtitles&&(m=f.subtitles,Object(I.assignTrackIdsByGroup)(m)),L.length>0){c=L[0].bitrate,L.sort(function(W,k){return W.bitrate-k.bitrate}),this._levels=L;for(var _=0;_<L.length;_++)if(L[_].bitrate===c){this._firstLevel=_,this.log("manifest loaded, "+L.length+" level(s) found, first bitrate: "+c);break}var U=p&&!g,B={levels:L,audioTracks:T,subtitleTracks:m,firstLevel:this._firstLevel,stats:f.stats,audio:p,video:g,altAudio:!U&&T.some(function(W){return!!W.url})};this.hls.trigger(F.Events.MANIFEST_PARSED,B),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(F.Events.ERROR,{type:O.ErrorTypes.MEDIA_ERROR,details:O.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:f.url,reason:"no level with compatible codecs found in manifest"})},s.onError=function(b,f){if(o.prototype.onError.call(this,b,f),f.fatal)return;var L=f.context,T=this._levels[this.currentLevelIndex];if(L&&(L.type===C.PlaylistContextType.AUDIO_TRACK&&T.audioGroupIds&&L.groupId===T.audioGroupIds[T.urlId]||L.type===C.PlaylistContextType.SUBTITLE_TRACK&&T.textGroupIds&&L.groupId===T.textGroupIds[T.urlId])){this.redundantFailover(this.currentLevelIndex);return}var m=!1,c=!0,u;switch(f.details){case O.ErrorDetails.FRAG_LOAD_ERROR:case O.ErrorDetails.FRAG_LOAD_TIMEOUT:case O.ErrorDetails.KEY_LOAD_ERROR:case O.ErrorDetails.KEY_LOAD_TIMEOUT:if(f.frag){var a=this._levels[f.frag.level];a?(a.fragmentError++,a.fragmentError>this.hls.config.fragLoadingMaxRetry&&(u=f.frag.level)):u=f.frag.level}break;case O.ErrorDetails.LEVEL_LOAD_ERROR:case O.ErrorDetails.LEVEL_LOAD_TIMEOUT:L&&(L.deliveryDirectives&&(c=!1),u=L.level),m=!0;break;case O.ErrorDetails.REMUX_ALLOC_ERROR:u=f.level,m=!0;break}u!==void 0&&this.recoverLevel(f,u,m,c)},s.recoverLevel=function(b,f,L,T){var m=b.details,c=this._levels[f];if(c.loadError++,L){var u=this.retryLoadingOrFail(b);if(u)b.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(T){var a=c.url.length;if(a>1&&c.loadError<a)b.levelRetry=!0,this.redundantFailover(f);else if(this.manualLevelIndex===-1){var E=f===0?this._levels.length-1:f-1;this.currentLevelIndex!==E&&this._levels[E].loadError===0&&(this.warn(m+": switch to "+E),b.levelRetry=!0,this.hls.nextAutoLevel=E)}}},s.redundantFailover=function(b){var f=this._levels[b],L=f.url.length;if(L>1){var T=(f.urlId+1)%L;this.warn("Switching to redundant URL-id "+T),this._levels.forEach(function(m){m.urlId=T}),this.level=b}},s.onFragLoaded=function(b,f){var L=f.frag;if(L!==void 0&&L.type===C.PlaylistLevelType.MAIN){var T=this._levels[L.level];T!==void 0&&(T.fragmentError=0,T.loadError=0)}},s.onLevelLoaded=function(b,f){var L,T=f.level,m=f.details,c=this._levels[T];if(!c){var u;this.warn("Invalid level index "+T),(u=f.deliveryDirectives)!==null&&u!==void 0&&u.skip&&(m.deltaUpdateFailed=!0);return}T===this.currentLevelIndex?(c.fragmentError===0&&(c.loadError=0,this.retryCount=0),this.playlistLoaded(T,f,c.details)):(L=f.deliveryDirectives)!==null&&L!==void 0&&L.skip&&(m.deltaUpdateFailed=!0)},s.onAudioTrackSwitched=function(b,f){var L=this.hls.levels[this.currentLevelIndex];if(!L)return;if(L.audioGroupIds){for(var T=-1,m=this.hls.audioTracks[f.id].groupId,c=0;c<L.audioGroupIds.length;c++)if(L.audioGroupIds[c]===m){T=c;break}T!==L.urlId&&(L.urlId=T,this.startLoad())}},s.loadPlaylist=function(b){var f=this.currentLevelIndex,L=this._levels[f];if(this.canLoad&&L&&L.url.length>0){var T=L.urlId,m=L.url[T];if(b)try{m=b.addDirectives(m)}catch(c){this.warn("Could not construct new URL with HLS Delivery Directives: "+c)}this.log("Attempt loading level index "+f+(b?" at sn "+b.msn+" part "+b.part:"")+" with URL-id "+T+" "+m),this.clearTimer(),this.hls.trigger(F.Events.LEVEL_LOADING,{url:m,level:f,id:T,deliveryDirectives:b||null})}},s.removeLevel=function(b,f){var L=function(c,u){return u!==f},T=this._levels.filter(function(m,c){return c!==b?!0:m.url.length>1&&f!==void 0?(m.url=m.url.filter(L),m.audioGroupIds&&(m.audioGroupIds=m.audioGroupIds.filter(L)),m.textGroupIds&&(m.textGroupIds=m.textGroupIds.filter(L)),m.urlId=0,!0):!1}).map(function(m,c){var u=m.details;return u!=null&&u.fragments&&u.fragments.forEach(function(a){a.level=c}),m});this._levels=T,this.hls.trigger(F.Events.LEVELS_UPDATED,{levels:T})},P(l,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(b){var f,L=this._levels;if(L.length===0)return;if(this.currentLevelIndex===b&&(f=L[b])!==null&&f!==void 0&&f.details)return;if(b<0||b>=L.length){var T=b<0;if(this.hls.trigger(F.Events.ERROR,{type:O.ErrorTypes.OTHER_ERROR,details:O.ErrorDetails.LEVEL_SWITCH_ERROR,level:b,fatal:T,reason:"invalid level idx"}),T)return;b=Math.min(b,L.length-1)}this.clearTimer();var m=this.currentLevelIndex,c=L[m],u=L[b];this.log("switching to level "+b+" from "+m),this.currentLevelIndex=b;var a=h({},u,{level:b,maxBitrate:u.maxBitrate,uri:u.uri,urlId:u.urlId});delete a._urlId,this.hls.trigger(F.Events.LEVEL_SWITCHING,a);var E=u.details;if(!E||E.live){var g=this.switchParams(u.uri,c==null?void 0:c.details);this.loadPlaylist(g)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(b){this.manualLevelIndex=b,this._startLevel===void 0&&(this._startLevel=b),b!==-1&&(this.level=b)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(b){this._firstLevel=b}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var b=this.hls.config.startLevel;return b!==void 0?b:this._firstLevel}else return this._startLevel},set:function(b){this._startLevel=b}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(b){this.level=b,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=b)}}]),l}(R.default)},"./src/controller/level-helper.ts":function(J,z,D){"use strict";D.r(z),D.d(z,"addGroupId",function(){return O}),D.d(z,"assignTrackIdsByGroup",function(){return N}),D.d(z,"updatePTS",function(){return I}),D.d(z,"updateFragPTSDTS",function(){return C}),D.d(z,"mergeDetails",function(){return h}),D.d(z,"mapPartIntersection",function(){return y}),D.d(z,"mapFragmentIntersection",function(){return P}),D.d(z,"adjustSliding",function(){return w}),D.d(z,"addSliding",function(){return x}),D.d(z,"computeReloadInterval",function(){return v}),D.d(z,"getFragmentWithSN",function(){return d}),D.d(z,"getPartWith",function(){return o});var K=D("./src/polyfills/number.ts"),F=D("./src/utils/logger.ts");function O(l,s,S){switch(s){case"audio":l.audioGroupIds||(l.audioGroupIds=[]),l.audioGroupIds.push(S);break;case"text":l.textGroupIds||(l.textGroupIds=[]),l.textGroupIds.push(S);break}}function N(l){var s={};l.forEach(function(S){var b=S.groupId||"";S.id=s[b]=s[b]||0,s[b]++})}function I(l,s,S){var b=l[s],f=l[S];R(b,f)}function R(l,s){var S=s.startPTS;if(Object(K.isFiniteNumber)(S)){var b=0,f;s.sn>l.sn?(b=S-l.start,f=l):(b=l.start-S,f=s),f.duration!==b&&(f.duration=b)}else if(s.sn>l.sn){var L=l.cc===s.cc;L&&l.minEndPTS?s.start=l.start+(l.minEndPTS-l.start):s.start=l.start+l.duration}else s.start=Math.max(l.start-s.duration,0)}function C(l,s,S,b,f,L){var T=b-S;T<=0&&(F.logger.warn("Fragment should have a positive duration",s),b=S+s.duration,L=f+s.duration);var m=S,c=b,u=s.startPTS,a=s.endPTS;if(Object(K.isFiniteNumber)(u)){var E=Math.abs(u-S);Object(K.isFiniteNumber)(s.deltaPTS)?s.deltaPTS=Math.max(E,s.deltaPTS):s.deltaPTS=E,m=Math.max(S,u),S=Math.min(S,u),f=Math.min(f,s.startDTS),c=Math.min(b,a),b=Math.max(b,a),L=Math.max(L,s.endDTS)}s.duration=b-S;var g=S-s.start;s.appendedPTS=b,s.start=s.startPTS=S,s.maxStartPTS=m,s.startDTS=f,s.endPTS=b,s.minEndPTS=c,s.endDTS=L;var p=s.sn;if(!l||p<l.startSN||p>l.endSN)return 0;var _,U=p-l.startSN,B=l.fragments;for(B[U]=s,_=U;_>0;_--)R(B[_],B[_-1]);for(_=U;_<B.length-1;_++)R(B[_],B[_+1]);return l.fragmentHint&&R(B[B.length-1],l.fragmentHint),l.PTSKnown=l.alignedSliding=!0,g}function h(l,s){for(var S=null,b=l.fragments,f=b.length-1;f>=0;f--){var L=b[f].initSegment;if(L){S=L;break}}l.fragmentHint&&delete l.fragmentHint.endPTS;var T=0,m;if(P(l,s,function(_,U){_.relurl&&(T=_.cc-U.cc),Object(K.isFiniteNumber)(_.startPTS)&&Object(K.isFiniteNumber)(_.endPTS)&&(U.start=U.startPTS=_.startPTS,U.startDTS=_.startDTS,U.appendedPTS=_.appendedPTS,U.maxStartPTS=_.maxStartPTS,U.endPTS=_.endPTS,U.endDTS=_.endDTS,U.minEndPTS=_.minEndPTS,U.duration=_.endPTS-_.startPTS,U.duration&&(m=U),s.PTSKnown=s.alignedSliding=!0),U.elementaryStreams=_.elementaryStreams,U.loader=_.loader,U.stats=_.stats,U.urlId=_.urlId,_.initSegment&&(U.initSegment=_.initSegment,S=_.initSegment)}),S){var c=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments;c.forEach(function(_){var U;(!_.initSegment||_.initSegment.relurl===((U=S)===null||U===void 0?void 0:U.relurl))&&(_.initSegment=S)})}if(s.skippedSegments&&(s.deltaUpdateFailed=s.fragments.some(function(_){return!_}),s.deltaUpdateFailed)){F.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var u=s.skippedSegments;u--;)s.fragments.shift();s.startSN=s.fragments[0].sn,s.startCC=s.fragments[0].cc}var a=s.fragments;if(T){F.logger.warn("discontinuity sliding from playlist, take drift into account");for(var E=0;E<a.length;E++)a[E].cc+=T}s.skippedSegments&&(s.startCC=s.fragments[0].cc),y(l.partList,s.partList,function(_,U){U.elementaryStreams=_.elementaryStreams,U.stats=_.stats}),m?C(s,m,m.startPTS,m.endPTS,m.startDTS,m.endDTS):w(l,s),a.length&&(s.totalduration=s.edge-a[0].start),s.driftStartTime=l.driftStartTime,s.driftStart=l.driftStart;var g=s.advancedDateTime;if(s.advanced&&g){var p=s.edge;s.driftStart||(s.driftStartTime=g,s.driftStart=p),s.driftEndTime=g,s.driftEnd=p}else s.driftEndTime=l.driftEndTime,s.driftEnd=l.driftEnd,s.advancedDateTime=l.advancedDateTime}function y(l,s,S){if(l&&s)for(var b=0,f=0,L=l.length;f<=L;f++){var T=l[f],m=s[f+b];T&&m&&T.index===m.index&&T.fragment.sn===m.fragment.sn?S(T,m):b--}}function P(l,s,S){for(var b=s.skippedSegments,f=Math.max(l.startSN,s.startSN)-s.startSN,L=(l.fragmentHint?1:0)+(b?s.endSN:Math.min(l.endSN,s.endSN))-s.startSN,T=s.startSN-l.startSN,m=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments,c=l.fragmentHint?l.fragments.concat(l.fragmentHint):l.fragments,u=f;u<=L;u++){var a=c[T+u],E=m[u];b&&!E&&u<b&&(E=s.fragments[u]=a),a&&E&&S(a,E)}}function w(l,s){var S=s.startSN+s.skippedSegments-l.startSN,b=l.fragments;if(S<0||S>=b.length)return;x(s,b[S].start)}function x(l,s){if(s){for(var S=l.fragments,b=l.skippedSegments;b<S.length;b++)S[b].start+=s;l.fragmentHint&&(l.fragmentHint.start+=s)}}function v(l,s){var S=1e3*l.levelTargetDuration,b=S/2,f=l.age,L=f>0&&f<S*3,T=s.loading.end-s.loading.start,m,c=l.availabilityDelay;if(l.updated===!1)if(L){var u=333*l.misses;m=Math.max(Math.min(b,T*2),u),l.availabilityDelay=(l.availabilityDelay||0)+m}else m=b;else L?(c=Math.min(c||S/2,f),l.availabilityDelay=c,m=c+S-f):m=S-T;return Math.round(m)}function d(l,s,S){if(!l||!l.details)return null;var b=l.details,f=b.fragments[s-b.startSN];return f||(f=b.fragmentHint,f&&f.sn===s?f:s<b.startSN&&S&&S.sn===s?S:null)}function o(l,s,S){if(!l||!l.details)return null;var b=l.details.partList;if(b)for(var f=b.length;f--;){var L=b[f];if(L.index===S&&L.fragment.sn===s)return L}return null}},"./src/controller/stream-controller.ts":function(J,z,D){"use strict";D.r(z),D.d(z,"default",function(){return b});var K=D("./src/polyfills/number.ts"),F=D("./src/controller/base-stream-controller.ts"),O=D("./src/is-supported.ts"),N=D("./src/events.ts"),I=D("./src/utils/buffer-helper.ts"),R=D("./src/controller/fragment-tracker.ts"),C=D("./src/types/loader.ts"),h=D("./src/loader/fragment.ts"),y=D("./src/demux/transmuxer-interface.ts"),P=D("./src/types/transmuxer.ts"),w=D("./src/controller/gap-controller.ts"),x=D("./src/errors.ts"),v=D("./src/utils/logger.ts");function d(f,L){for(var T=0;T<L.length;T++){var m=L[T];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(f,m.key,m)}}function o(f,L,T){return L&&d(f.prototype,L),T&&d(f,T),f}function l(f,L){f.prototype=Object.create(L.prototype),f.prototype.constructor=f,s(f,L)}function s(f,L){return s=Object.setPrototypeOf||function(m,c){return m.__proto__=c,m},s(f,L)}var S=100,b=function(f){l(L,f);function L(m,c){var u;return u=f.call(this,m,c,"[stream-controller]")||this,u.audioCodecSwap=!1,u.gapController=null,u.level=-1,u._forceStartLoad=!1,u.altAudio=!1,u.audioOnly=!1,u.fragPlaying=null,u.onvplaying=null,u.onvseeked=null,u.fragLastKbps=0,u.stalled=!1,u.couldBacktrack=!1,u.audioCodecSwitch=!1,u.videoBuffer=null,u._registerListeners(),u}var T=L.prototype;return T._registerListeners=function(){var c=this.hls;c.on(N.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.on(N.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.on(N.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.on(N.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.on(N.Events.LEVEL_LOADING,this.onLevelLoading,this),c.on(N.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.on(N.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),c.on(N.Events.ERROR,this.onError,this),c.on(N.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),c.on(N.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),c.on(N.Events.BUFFER_CREATED,this.onBufferCreated,this),c.on(N.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),c.on(N.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),c.on(N.Events.FRAG_BUFFERED,this.onFragBuffered,this)},T._unregisterListeners=function(){var c=this.hls;c.off(N.Events.MEDIA_ATTACHED,this.onMediaAttached,this),c.off(N.Events.MEDIA_DETACHING,this.onMediaDetaching,this),c.off(N.Events.MANIFEST_LOADING,this.onManifestLoading,this),c.off(N.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.off(N.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.off(N.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),c.off(N.Events.ERROR,this.onError,this),c.off(N.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),c.off(N.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),c.off(N.Events.BUFFER_CREATED,this.onBufferCreated,this),c.off(N.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),c.off(N.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),c.off(N.Events.FRAG_BUFFERED,this.onFragBuffered,this)},T.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},T.startLoad=function(c){if(this.levels){var u=this.lastCurrentTime,a=this.hls;if(this.stopLoad(),this.setInterval(S),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var E=a.startLevel;E===-1&&(a.config.testBandwidth?(E=0,this.bitrateTest=!0):E=a.nextAutoLevel),this.level=a.nextLoadLevel=E,this.loadedmetadata=!1}u>0&&c===-1&&(this.log("Override startPosition with lastCurrentTime @"+u.toFixed(3)),c=u),this.state=F.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=c,this.tick()}else this._forceStartLoad=!0,this.state=F.State.STOPPED},T.stopLoad=function(){this._forceStartLoad=!1,f.prototype.stopLoad.call(this)},T.doTick=function(){switch(this.state){case F.State.IDLE:this.doTickIdle();break;case F.State.WAITING_LEVEL:{var c,u=this.levels,a=this.level,E=u==null||((c=u[a])===null||c===void 0)?void 0:c.details;if(E&&(!E.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(E))break;this.state=F.State.IDLE;break}break}case F.State.FRAG_LOADING_WAITING_RETRY:{var g,p=self.performance.now(),_=this.retryDate;(!_||p>=_||(g=this.media)!==null&&g!==void 0&&g.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=F.State.IDLE)}break;default:break}this.onTickEnd()},T.onTickEnd=function(){f.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},T.doTickIdle=function(){var c,u,a=this.hls,E=this.levelLastLoaded,g=this.levels,p=this.media,_=a.config,U=a.nextLoadLevel;if(E===null||!p&&(this.startFragRequested||!_.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!g||!g[U])return;var B=g[U];this.level=a.nextLoadLevel=U;var W=B.details;if(!W||this.state===F.State.WAITING_LEVEL||W.live&&this.levelLastLoaded!==U){this.state=F.State.WAITING_LEVEL;return}var k=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:p,C.PlaylistLevelType.MAIN);if(k===null)return;var M=k.len,H=this.getMaxBufferLength(B.maxBitrate);if(M>=H)return;if(this._streamEnded(k,W)){var X={};this.altAudio&&(X.type="video"),this.hls.trigger(N.Events.BUFFER_EOS,X),this.state=F.State.ENDED;return}var ee=k.end,ie=this.getNextFragment(ee,W);if(this.couldBacktrack&&!this.fragPrevious&&ie&&ie.sn!=="initSegment"){var ve=ie.sn-W.startSN;ve>1&&(ie=W.fragments[ve-1],this.fragmentTracker.removeFragment(ie))}if(ie&&this.fragmentTracker.getState(ie)===R.FragmentState.OK&&this.nextLoadPosition>ee){var pe=this.audioOnly&&!this.altAudio?h.ElementaryStreamTypes.AUDIO:h.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(p,pe,C.PlaylistLevelType.MAIN),ie=this.getNextFragment(this.nextLoadPosition,W)}if(!ie)return;ie.initSegment&&!ie.initSegment.data&&!this.bitrateTest&&(ie=ie.initSegment),((c=ie.decryptdata)===null||c===void 0?void 0:c.keyFormat)==="identity"&&!((u=ie.decryptdata)!==null&&u!==void 0&&u.key)?this.loadKey(ie,W):this.loadFragment(ie,W,ee)},T.loadFragment=function(c,u,a){var E,g=this.fragmentTracker.getState(c);if(this.fragCurrent=c,g===R.FragmentState.BACKTRACKED){var p=this.fragmentTracker.getBacktrackData(c);if(p){this._handleFragmentLoadProgress(p),this._handleFragmentLoadComplete(p);return}else g=R.FragmentState.NOT_LOADED}g===R.FragmentState.NOT_LOADED||g===R.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,f.prototype.loadFragment.call(this,c,u,a)):g===R.FragmentState.APPENDING?this.reduceMaxBufferLength(c.duration)&&this.fragmentTracker.removeFragment(c):((E=this.media)===null||E===void 0?void 0:E.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},T.getAppendedFrag=function(c){var u=this.fragmentTracker.getAppendedFrag(c,C.PlaylistLevelType.MAIN);return u&&"fragment"in u?u.fragment:u},T.getBufferedFrag=function(c){return this.fragmentTracker.getBufferedFrag(c,C.PlaylistLevelType.MAIN)},T.followingBufferedFrag=function(c){return c?this.getBufferedFrag(c.end+.5):null},T.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},T.nextLevelSwitch=function(){var c=this.levels,u=this.media;if(u!=null&&u.readyState){var a,E=this.getAppendedFrag(u.currentTime);if(E&&E.start>1&&this.flushMainBuffer(0,E.start-1),!u.paused&&c){var g=this.hls.nextLoadLevel,p=c[g],_=this.fragLastKbps;_&&this.fragCurrent?a=this.fragCurrent.duration*p.maxBitrate/(1e3*_)+1:a=0}else a=0;var U=this.getBufferedFrag(u.currentTime+a);if(U){var B=this.followingBufferedFrag(U);if(B){this.abortCurrentFrag();var W=B.maxStartPTS?B.maxStartPTS:B.start,k=B.duration,M=Math.max(U.end,W+Math.min(Math.max(k-this.config.maxFragLookUpTolerance,k*.5),k*.75));this.flushMainBuffer(M,Number.POSITIVE_INFINITY)}}}},T.abortCurrentFrag=function(){var c=this.fragCurrent;this.fragCurrent=null,c!=null&&c.loader&&c.loader.abort(),this.state===F.State.KEY_LOADING&&(this.state=F.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},T.flushMainBuffer=function(c,u){f.prototype.flushMainBuffer.call(this,c,u,this.altAudio?"video":null)},T.onMediaAttached=function(c,u){f.prototype.onMediaAttached.call(this,c,u);var a=u.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 w.default(this.config,a,this.fragmentTracker,this.hls)},T.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),f.prototype.onMediaDetaching.call(this)},T.onMediaPlaying=function(){this.tick()},T.onMediaSeeked=function(){var c=this.media,u=c?c.currentTime:null;Object(K.isFiniteNumber)(u)&&this.log("Media seeked to "+u.toFixed(3)),this.tick()},T.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(N.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},T.onManifestParsed=function(c,u){var a=!1,E=!1,g;u.levels.forEach(function(p){g=p.audioCodec,g&&(g.indexOf("mp4a.40.2")!==-1&&(a=!0),g.indexOf("mp4a.40.5")!==-1&&(E=!0))}),this.audioCodecSwitch=a&&E&&!Object(O.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=u.levels,this.startFragRequested=!1},T.onLevelLoading=function(c,u){var a=this.levels;if(!a||this.state!==F.State.IDLE)return;var E=a[u.level];(!E.details||E.details.live&&this.levelLastLoaded!==u.level||this.waitForCdnTuneIn(E.details))&&(this.state=F.State.WAITING_LEVEL)},T.onLevelLoaded=function(c,u){var a,E=this.levels,g=u.level,p=u.details,_=p.totalduration;if(!E){this.warn("Levels were reset while loading level "+g);return}this.log("Level "+g+" loaded ["+p.startSN+","+p.endSN+"], cc ["+p.startCC+", "+p.endCC+"] duration:"+_);var U=this.fragCurrent;U&&(this.state===F.State.FRAG_LOADING||this.state===F.State.FRAG_LOADING_WAITING_RETRY)&&(U.level!==u.level&&U.loader&&(this.state=F.State.IDLE,U.loader.abort()));var B=E[g],W=0;if(p.live||(a=B.details)!==null&&a!==void 0&&a.live){if(p.fragments[0]||(p.deltaUpdateFailed=!0),p.deltaUpdateFailed)return;W=this.alignPlaylists(p,B.details)}if(B.details=p,this.levelLastLoaded=g,this.hls.trigger(N.Events.LEVEL_UPDATED,{details:p,level:g}),this.state===F.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(p))return;this.state=F.State.IDLE}this.startFragRequested?p.live&&this.synchronizeToLiveEdge(p):this.setStartPosition(p,W),this.tick()},T._handleFragmentLoadProgress=function(c){var u,a=c.frag,E=c.part,g=c.payload,p=this.levels;if(!p){this.warn("Levels were reset while fragment load was in progress. Fragment "+a.sn+" of level "+a.level+" will not be buffered");return}var _=p[a.level],U=_.details;if(!U){this.warn("Dropping fragment "+a.sn+" of level "+a.level+" after level details were reset");return}var B=_.videoCodec,W=U.PTSKnown||!U.live,k=(u=a.initSegment)===null||u===void 0?void 0:u.data,M=this._getAudioCodec(_),H=this.transmuxer=this.transmuxer||new y.default(this.hls,C.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),X=E?E.index:-1,ee=X!==-1,ie=new P.ChunkMetadata(a.level,a.sn,a.stats.chunkCount,g.byteLength,X,ee),ve=this.initPTS[a.cc];H.push(g,k,M,B,a,E,U.totalduration,W,ie,ve)},T.onAudioTrackSwitching=function(c,u){var a=this.altAudio,E=!!u.url,g=u.id;if(!E){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var p=this.fragCurrent;p!=null&&p.loader&&(this.log("Switching to main audio track, cancel main fragment load"),p.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var _=this.hls;a&&_.trigger(N.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),_.trigger(N.Events.AUDIO_TRACK_SWITCHED,{id:g})}},T.onAudioTrackSwitched=function(c,u){var a=u.id,E=!!this.hls.audioTracks[a].url;if(E){var g=this.videoBuffer;g&&this.mediaBuffer!==g&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=g)}this.altAudio=E,this.tick()},T.onBufferCreated=function(c,u){var a=u.tracks,E,g,p=!1;for(var _ in a){var U=a[_];if(U.id==="main"){if(g=_,E=U,_==="video"){var B=a[_];B&&(this.videoBuffer=B.buffer)}}else p=!0}p&&E?(this.log("Alternate track found, use "+g+".buffered to schedule main fragment loading"),this.mediaBuffer=E.buffer):this.mediaBuffer=this.media},T.onFragBuffered=function(c,u){var a=u.frag,E=u.part;if(a&&a.type!==C.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(a)){this.warn("Fragment "+a.sn+(E?" p: "+E.index:"")+" of level "+a.level+" finished buffering, but was aborted. state: "+this.state),this.state===F.State.PARSED&&(this.state=F.State.IDLE);return}var g=E?E.stats:a.stats;this.fragLastKbps=Math.round(8*g.total/(g.buffering.end-g.loading.first)),a.sn!=="initSegment"&&(this.fragPrevious=a),this.fragBufferedComplete(a,E)},T.onError=function(c,u){switch(u.details){case x.ErrorDetails.FRAG_LOAD_ERROR:case x.ErrorDetails.FRAG_LOAD_TIMEOUT:case x.ErrorDetails.KEY_LOAD_ERROR:case x.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(C.PlaylistLevelType.MAIN,u);break;case x.ErrorDetails.LEVEL_LOAD_ERROR:case x.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==F.State.ERROR&&(u.fatal?(this.warn(""+u.details),this.state=F.State.ERROR):!u.levelRetry&&this.state===F.State.WAITING_LEVEL&&(this.state=F.State.IDLE));break;case x.ErrorDetails.BUFFER_FULL_ERROR:if(u.parent==="main"&&(this.state===F.State.PARSING||this.state===F.State.PARSED)){var a=!0,E=this.getFwdBufferInfo(this.media,C.PlaylistLevelType.MAIN);E&&E.len>.5&&(a=!this.reduceMaxBufferLength(E.len)),a&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},T.checkBuffer=function(){var c=this.media,u=this.gapController;if(!c||!u||!c.readyState)return;var a=I.BufferHelper.getBuffered(c);!this.loadedmetadata&&a.length?(this.loadedmetadata=!0,this.seekToStartPos()):u.poll(this.lastCurrentTime),this.lastCurrentTime=c.currentTime},T.onFragLoadEmergencyAborted=function(){this.state=F.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},T.onBufferFlushed=function(c,u){var a=u.type;if(a!==h.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var E=(a===h.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(E,a,C.PlaylistLevelType.MAIN)}},T.onLevelsUpdated=function(c,u){this.levels=u.levels},T.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},T.seekToStartPos=function(){var c=this.media,u=c.currentTime,a=this.startPosition;if(a>=0&&u<a){if(c.seeking){v.logger.log("could not seek to "+a+", already seeking at "+u);return}var E=I.BufferHelper.getBuffered(c),g=E.length?E.start(0):0,p=g-a;p>0&&(p<this.config.maxBufferHole||p<this.config.maxFragLookUpTolerance)&&(v.logger.log("adjusting start position by "+p+" to match buffer start"),a+=p,this.startPosition=a),this.log("seek to target start position "+a+" from current time "+u),c.currentTime=a}},T._getAudioCodec=function(c){var u=this.config.defaultAudioCodec||c.audioCodec;return this.audioCodecSwap&&u&&(this.log("Swapping audio codec"),u.indexOf("mp4a.40.5")!==-1?u="mp4a.40.2":u="mp4a.40.5"),u},T._loadBitrateTestFrag=function(c){var u=this;this._doFragLoad(c).then(function(a){var E=u.hls;if(!a||E.nextLoadLevel||u.fragContextChanged(c))return;u.fragLoadError=0,u.state=F.State.IDLE,u.startFragRequested=!1,u.bitrateTest=!1;var g=c.stats;g.parsing.start=g.parsing.end=g.buffering.start=g.buffering.end=self.performance.now(),E.trigger(N.Events.FRAG_LOADED,a)})},T._handleTransmuxComplete=function(c){var u,a="main",E=this.hls,g=c.remuxResult,p=c.chunkMeta,_=this.getCurrentContext(p);if(!_){this.warn("The loading context changed while buffering fragment "+p.sn+" of level "+p.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(p.level);return}var U=_.frag,B=_.part,W=_.level,k=g.video,M=g.text,H=g.id3,X=g.initSegment,ee=this.altAudio?void 0:g.audio;if(this.fragContextChanged(U))return;if(this.state=F.State.PARSING,X){X.tracks&&(this._bufferInitSegment(W,X.tracks,U,p),E.trigger(N.Events.FRAG_PARSING_INIT_SEGMENT,{frag:U,id:a,tracks:X.tracks}));var ie=X.initPTS,ve=X.timescale;Object(K.isFiniteNumber)(ie)&&(this.initPTS[U.cc]=ie,E.trigger(N.Events.INIT_PTS_FOUND,{frag:U,id:a,initPTS:ie,timescale:ve}))}if(k&&g.independent!==!1){if(W.details){var pe=k.startPTS,he=k.endPTS,ce=k.startDTS,fe=k.endDTS;if(B)B.elementaryStreams[k.type]={startPTS:pe,endPTS:he,startDTS:ce,endDTS:fe};else if(k.firstKeyFrame&&k.independent&&(this.couldBacktrack=!0),k.dropped&&k.independent){var ne=this.getLoadPosition()+this.config.maxBufferHole;if(ne<pe){this.backtrack(U);return}U.setElementaryStreamInfo(k.type,U.start,he,U.start,fe,!0)}U.setElementaryStreamInfo(k.type,pe,he,ce,fe),this.bufferFragmentData(k,U,B,p)}}else if(g.independent===!1){this.backtrack(U);return}if(ee){var me=ee.startPTS,$=ee.endPTS,ae=ee.startDTS,q=ee.endDTS;B&&(B.elementaryStreams[h.ElementaryStreamTypes.AUDIO]={startPTS:me,endPTS:$,startDTS:ae,endDTS:q}),U.setElementaryStreamInfo(h.ElementaryStreamTypes.AUDIO,me,$,ae,q),this.bufferFragmentData(ee,U,B,p)}if(H!=null&&(u=H.samples)!==null&&u!==void 0&&u.length){var Ee={frag:U,id:a,samples:H.samples};E.trigger(N.Events.FRAG_PARSING_METADATA,Ee)}if(M){var Ce={frag:U,id:a,samples:M.samples};E.trigger(N.Events.FRAG_PARSING_USERDATA,Ce)}},T._bufferInitSegment=function(c,u,a,E){var g=this;if(this.state!==F.State.PARSING)return;this.audioOnly=!!u.audio&&!u.video,this.altAudio&&!this.audioOnly&&delete u.audio;var p=u.audio,_=u.video,U=u.audiovideo;if(p){var B=c.audioCodec,W=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(B&&(B.indexOf("mp4a.40.5")!==-1?B="mp4a.40.2":B="mp4a.40.5"),p.metadata.channelCount!==1&&W.indexOf("firefox")===-1&&(B="mp4a.40.5")),W.indexOf("android")!==-1&&p.container!=="audio/mpeg"&&(B="mp4a.40.2",this.log("Android: force audio codec to "+B)),c.audioCodec&&c.audioCodec!==B&&this.log('Swapping manifest audio codec "'+c.audioCodec+'" for "'+B+'"'),p.levelCodec=B,p.id="main",this.log("Init audio buffer, container:"+p.container+", codecs[selected/level/parsed]=["+(B||"")+"/"+(c.audioCodec||"")+"/"+p.codec+"]")}_&&(_.levelCodec=c.videoCodec,_.id="main",this.log("Init video buffer, container:"+_.container+", codecs[level/parsed]=["+(c.videoCodec||"")+"/"+_.codec+"]")),U&&this.log("Init audiovideo buffer, container:"+U.container+", codecs[level/parsed]=["+(c.attrs.CODECS||"")+"/"+U.codec+"]"),this.hls.trigger(N.Events.BUFFER_CODECS,u),Object.keys(u).forEach(function(k){var M=u[k],H=M.initSegment;H!=null&&H.byteLength&&g.hls.trigger(N.Events.BUFFER_APPENDING,{type:k,data:H,frag:a,part:null,chunkMeta:E,parent:a.type})}),this.tick()},T.backtrack=function(c){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(c);var u=this.fragmentTracker.backtrack(c);this.fragPrevious=null,this.nextLoadPosition=c.start,u?this.resetFragmentLoading(c):this.state=F.State.BACKTRACKING},T.checkFragmentChanged=function(){var c=this.media,u=null;if(c&&c.readyState>1&&c.seeking===!1){var a=c.currentTime;if(I.BufferHelper.isBuffered(c,a)?u=this.getAppendedFrag(a):I.BufferHelper.isBuffered(c,a+.1)&&(u=this.getAppendedFrag(a+.1)),u){var E=this.fragPlaying,g=u.level;(!E||u.sn!==E.sn||E.level!==g||u.urlId!==E.urlId)&&(this.hls.trigger(N.Events.FRAG_CHANGED,{frag:u}),(!E||E.level!==g)&&this.hls.trigger(N.Events.LEVEL_SWITCHED,{level:g}),this.fragPlaying=u)}}},o(L,[{key:"nextLevel",get:function(){var c=this.nextBufferedFrag;return c?c.level:-1}},{key:"currentLevel",get:function(){var c=this.media;if(c){var u=this.getAppendedFrag(c.currentTime);if(u)return u.level}return-1}},{key:"nextBufferedFrag",get:function(){var c=this.media;if(c){var u=this.getAppendedFrag(c.currentTime);return this.followingBufferedFrag(u)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),L}(F.default)},"./src/controller/subtitle-stream-controller.ts":function(J,z,D){"use strict";D.r(z),D.d(z,"SubtitleStreamController",function(){return l});var K=D("./src/events.ts"),F=D("./src/utils/logger.ts"),O=D("./src/utils/buffer-helper.ts"),N=D("./src/controller/fragment-finders.ts"),I=D("./src/utils/discontinuities.ts"),R=D("./src/controller/level-helper.ts"),C=D("./src/controller/fragment-tracker.ts"),h=D("./src/controller/base-stream-controller.ts"),y=D("./src/types/loader.ts"),P=D("./src/types/level.ts");function w(s,S){for(var b=0;b<S.length;b++){var f=S[b];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(s,f.key,f)}}function x(s,S,b){return S&&w(s.prototype,S),b&&w(s,b),s}function v(s,S){s.prototype=Object.create(S.prototype),s.prototype.constructor=s,d(s,S)}function d(s,S){return d=Object.setPrototypeOf||function(f,L){return f.__proto__=L,f},d(s,S)}var o=500,l=function(s){v(S,s);function S(f,L){var T;return T=s.call(this,f,L,"[subtitle-stream-controller]")||this,T.levels=[],T.currentTrackId=-1,T.tracksBuffered=[],T.mainDetails=null,T._registerListeners(),T}var b=S.prototype;return b.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},b._registerListeners=function(){var L=this.hls;L.on(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),L.on(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),L.on(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),L.on(K.Events.LEVEL_LOADED,this.onLevelLoaded,this),L.on(K.Events.ERROR,this.onError,this),L.on(K.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),L.on(K.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),L.on(K.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),L.on(K.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),L.on(K.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},b._unregisterListeners=function(){var L=this.hls;L.off(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),L.off(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),L.off(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),L.off(K.Events.LEVEL_LOADED,this.onLevelLoaded,this),L.off(K.Events.ERROR,this.onError,this),L.off(K.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),L.off(K.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),L.off(K.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),L.off(K.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),L.off(K.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},b.startLoad=function(){this.stopLoad(),this.state=h.State.IDLE,this.setInterval(o),this.tick()},b.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},b.onLevelLoaded=function(L,T){this.mainDetails=T.details},b.onSubtitleFragProcessed=function(L,T){var m=T.frag,c=T.success;if(this.fragPrevious=m,this.state=h.State.IDLE,!c)return;var u=this.tracksBuffered[this.currentTrackId];if(!u)return;for(var a,E=m.start,g=0;g<u.length;g++)if(E>=u[g].start&&E<=u[g].end){a=u[g];break}var p=m.start+m.duration;a?a.end=p:(a={start:E,end:p},u.push(a)),this.fragmentTracker.fragBuffered(m)},b.onBufferFlushing=function(L,T){var m=T.startOffset,c=T.endOffset;if(m===0&&c!==Number.POSITIVE_INFINITY){var u=this.currentTrackId,a=this.levels;if(!a.length||!a[u]||!a[u].details)return;var E=a[u].details,g=E.targetduration,p=c-g;if(p<=0)return;T.endOffsetSubtitles=Math.max(0,p),this.tracksBuffered.forEach(function(_){for(var U=0;U<_.length;){if(_[U].end<=p){_.shift();continue}else if(_[U].start<p)_[U].start=p;else break;U++}}),this.fragmentTracker.removeFragmentsInRange(m,p,y.PlaylistLevelType.SUBTITLE)}},b.onError=function(L,T){var m,c=T.frag;if(!c||c.type!==y.PlaylistLevelType.SUBTITLE)return;(m=this.fragCurrent)!==null&&m!==void 0&&m.loader&&this.fragCurrent.loader.abort(),this.state=h.State.IDLE},b.onSubtitleTracksUpdated=function(L,T){var m=this,c=T.subtitleTracks;this.tracksBuffered=[],this.levels=c.map(function(u){return new P.Level(u)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(u){m.tracksBuffered[u.id]=[]}),this.mediaBuffer=null},b.onSubtitleTrackSwitch=function(L,T){if(this.currentTrackId=T.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var m=this.levels[this.currentTrackId];m!=null&&m.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,m&&this.setInterval(o)},b.onSubtitleTrackLoaded=function(L,T){var m,c=T.details,u=T.id,a=this.currentTrackId,E=this.levels;if(!E.length)return;var g=E[a];if(u>=E.length||u!==a||!g)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,c.live||(m=g.details)!==null&&m!==void 0&&m.live){var p=this.mainDetails;if(c.deltaUpdateFailed||!p)return;var _=p.fragments[0];if(!g.details)c.hasProgramDateTime&&p.hasProgramDateTime?Object(I.alignMediaPlaylistByPDT)(c,p):_&&Object(R.addSliding)(c,_.start);else{var U=this.alignPlaylists(c,g.details);U===0&&_&&Object(R.addSliding)(c,_.start)}}if(g.details=c,this.levelLastLoaded=u,this.tick(),c.live&&!this.fragCurrent&&this.media&&this.state===h.State.IDLE){var B=Object(N.findFragmentByPTS)(null,c.fragments,this.media.currentTime,0);B||(this.warn("Subtitle playlist not aligned with playback"),g.details=void 0)}},b._handleFragmentLoadComplete=function(L){var T=L.frag,m=L.payload,c=T.decryptdata,u=this.hls;if(this.fragContextChanged(T))return;if(m&&m.byteLength>0&&c&&c.key&&c.iv&&c.method==="AES-128"){var a=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(m),c.key.buffer,c.iv.buffer).then(function(E){var g=performance.now();u.trigger(K.Events.FRAG_DECRYPTED,{frag:T,payload:E,stats:{tstart:a,tdecrypt:g}})})}},b.doTick=function(){if(!this.media){this.state=h.State.IDLE;return}if(this.state===h.State.IDLE){var L,T=this.currentTrackId,m=this.levels;if(!m.length||!m[T]||!m[T].details)return;var c=m[T].details,u=c.targetduration,a=this.config,E=this.media,g=O.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,E.currentTime-u,a.maxBufferHole),p=g.end,_=g.len,U=this.getMaxBufferLength()+u;if(_>U)return;console.assert(c,"Subtitle track details are defined on idle subtitle stream controller tick");var B=c.fragments,W=B.length,k=c.edge,M,H=this.fragPrevious;if(p<k){var X=a.maxFragLookUpTolerance;H&&c.hasProgramDateTime&&(M=Object(N.findFragmentByPDT)(B,H.endProgramDateTime,X)),M||(M=Object(N.findFragmentByPTS)(H,B,p,X),!M&&H&&H.start<B[0].start&&(M=B[0]))}else M=B[W-1];(L=M)!==null&&L!==void 0&&L.encrypted?(F.logger.log("Loading key for "+M.sn),this.state=h.State.KEY_LOADING,this.hls.trigger(K.Events.KEY_LOADING,{frag:M})):M&&this.fragmentTracker.getState(M)===C.FragmentState.NOT_LOADED&&this.loadFragment(M,c,p)}},b.loadFragment=function(L,T,m){this.fragCurrent=L,s.prototype.loadFragment.call(this,L,T,m)},x(S,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),S}(h.default)},"./src/controller/subtitle-track-controller.ts":function(J,z,D){"use strict";D.r(z);var K=D("./src/events.ts"),F=D("./src/utils/texttrack-utils.ts"),O=D("./src/controller/base-playlist-controller.ts"),N=D("./src/types/loader.ts");function I(w,x){for(var v=0;v<x.length;v++){var d=x[v];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(w,d.key,d)}}function R(w,x,v){return x&&I(w.prototype,x),v&&I(w,v),w}function C(w,x){w.prototype=Object.create(x.prototype),w.prototype.constructor=w,h(w,x)}function h(w,x){return h=Object.setPrototypeOf||function(d,o){return d.__proto__=o,d},h(w,x)}var y=function(w){C(x,w);function x(d){var o;return o=w.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 v=x.prototype;return v.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,w.prototype.destroy.call(this)},v.registerListeners=function(){var o=this.hls;o.on(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(K.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(K.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.on(K.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.on(K.Events.ERROR,this.onError,this)},v.unregisterListeners=function(){var o=this.hls;o.off(K.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(K.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(K.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(K.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(K.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(K.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.off(K.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.off(K.Events.ERROR,this.onError,this)},v.onMediaAttached=function(o,l){if(this.media=l.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)},v.pollTrackChange=function(o){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,o)},v.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=P(this.media.textTracks);o.forEach(function(l){Object(F.clearCurrentCues)(l)}),this.subtitleTrack=-1,this.media=null},v.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},v.onManifestParsed=function(o,l){this.tracks=l.subtitleTracks},v.onSubtitleTrackLoaded=function(o,l){var s=l.id,S=l.details,b=this.trackId,f=this.tracksInGroup[b];if(!f){this.warn("Invalid subtitle track id "+s);return}var L=f.details;f.details=l.details,this.log("subtitle track "+s+" loaded ["+S.startSN+"-"+S.endSN+"]"),s===this.trackId&&(this.retryCount=0,this.playlistLoaded(s,l,L))},v.onLevelLoading=function(o,l){this.switchLevel(l.level)},v.onLevelSwitching=function(o,l){this.switchLevel(l.level)},v.switchLevel=function(o){var l=this.hls.levels[o];if(!(l!=null&&l.textGroupIds))return;var s=l.textGroupIds[l.urlId];if(this.groupId!==s){var S=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,b=this.tracks.filter(function(T){return!s||T.groupId===s});this.tracksInGroup=b;var f=this.findTrackId(S==null?void 0:S.name)||this.findTrackId();this.groupId=s;var L={subtitleTracks:b};this.log("Updating subtitle tracks, "+b.length+' track(s) found in "'+s+'" group-id'),this.hls.trigger(K.Events.SUBTITLE_TRACKS_UPDATED,L),f!==-1&&this.setSubtitleTrack(f,S)}},v.findTrackId=function(o){for(var l=this.tracksInGroup,s=0;s<l.length;s++){var S=l[s];if((!this.selectDefaultTrack||S.default)&&(!o||o===S.name))return S.id}return-1},v.onError=function(o,l){if(w.prototype.onError.call(this,o,l),l.fatal||!l.context)return;l.context.type===N.PlaylistContextType.SUBTITLE_TRACK&&l.context.id===this.trackId&&l.context.groupId===this.groupId&&this.retryLoadingOrFail(l)},v.loadPlaylist=function(o){var l=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(l)){var s=l.id,S=l.groupId,b=l.url;if(o)try{b=o.addDirectives(b)}catch(f){this.warn("Could not construct new URL with HLS Delivery Directives: "+f)}this.log("Loading subtitle playlist for id "+s),this.hls.trigger(K.Events.SUBTITLE_TRACK_LOADING,{url:b,id:s,groupId:S,deliveryDirectives:o||null})}},v.toggleTrackModes=function(o){var l=this,s=this.media,S=this.subtitleDisplay,b=this.trackId;if(!s)return;var f=P(s.textTracks),L=f.filter(function(c){return c.groupId===l.groupId});if(o===-1)[].slice.call(f).forEach(function(c){c.mode="disabled"});else{var T=L[b];T&&(T.mode="disabled")}var m=L[o];m&&(m.mode=S?"showing":"hidden")},v.setSubtitleTrack=function(o,l){var s,S=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=o;return}if(this.trackId!==o&&this.toggleTrackModes(o),this.trackId===o&&(o===-1||(s=S[o])!==null&&s!==void 0&&s.details)||o<-1||o>=S.length)return;this.clearTimer();var b=S[o];if(this.log("Switching to subtitle track "+o),this.trackId=o,b){var f=b.id,L=b.groupId,T=L===void 0?"":L,m=b.name,c=b.type,u=b.url;this.hls.trigger(K.Events.SUBTITLE_TRACK_SWITCH,{id:f,groupId:T,name:m,type:c,url:u});var a=this.switchParams(b.url,l==null?void 0:l.details);this.loadPlaylist(a)}else this.hls.trigger(K.Events.SUBTITLE_TRACK_SWITCH,{id:o})},v.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var o=-1,l=P(this.media.textTracks),s=0;s<l.length;s++)if(l[s].mode==="hidden")o=s;else if(l[s].mode==="showing"){o=s;break}this.subtitleTrack!==o&&(this.subtitleTrack=o)},R(x,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(o){this.selectDefaultTrack=!1;var l=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(o,l)}}]),x}(O.default);function P(w){for(var x=[],v=0;v<w.length;v++){var d=w[v];d.kind==="subtitles"&&d.label&&x.push(w[v])}return x}z.default=y},"./src/controller/timeline-controller.ts":function(J,z,D){"use strict";D.r(z),D.d(z,"TimelineController",function(){return P});var K=D("./src/polyfills/number.ts"),F=D("./src/events.ts"),O=D("./src/utils/cea-608-parser.ts"),N=D("./src/utils/output-filter.ts"),I=D("./src/utils/webvtt-parser.ts"),R=D("./src/utils/texttrack-utils.ts"),C=D("./src/utils/imsc1-ttml-parser.ts"),h=D("./src/types/loader.ts"),y=D("./src/utils/logger.ts"),P=function(){function d(l){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=v(),this.captionsProperties=void 0,this.hls=l,this.config=l.config,this.Cues=l.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 s=new N.default(this,"textTrack1"),S=new N.default(this,"textTrack2"),b=new N.default(this,"textTrack3"),f=new N.default(this,"textTrack4");this.cea608Parser1=new O.default(1,s,S),this.cea608Parser2=new O.default(3,b,f)}l.on(F.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),l.on(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.on(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.on(F.Events.MANIFEST_LOADED,this.onManifestLoaded,this),l.on(F.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),l.on(F.Events.FRAG_LOADING,this.onFragLoading,this),l.on(F.Events.FRAG_LOADED,this.onFragLoaded,this),l.on(F.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),l.on(F.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),l.on(F.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),l.on(F.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),l.on(F.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var o=d.prototype;return o.destroy=function(){var s=this.hls;s.off(F.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),s.off(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.off(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.off(F.Events.MANIFEST_LOADED,this.onManifestLoaded,this),s.off(F.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),s.off(F.Events.FRAG_LOADING,this.onFragLoading,this),s.off(F.Events.FRAG_LOADED,this.onFragLoaded,this),s.off(F.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),s.off(F.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),s.off(F.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),s.off(F.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),s.off(F.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},o.addCues=function(s,S,b,f,L){for(var T=!1,m=L.length;m--;){var c=L[m],u=x(c[0],c[1],S,b);if(u>=0&&(c[0]=Math.min(c[0],S),c[1]=Math.max(c[1],b),T=!0,u/(b-S)>.5))return}if(T||L.push([S,b]),this.config.renderTextTracksNatively){var a=this.captionsTracks[s];this.Cues.newCue(a,S,b,f)}else{var E=this.Cues.newCue(null,S,b,f);this.hls.trigger(F.Events.CUES_PARSED,{type:"captions",cues:E,track:s})}},o.onInitPtsFound=function(s,S){var b=this,f=S.frag,L=S.id,T=S.initPTS,m=S.timescale,c=this.unparsedVttFrags;L==="main"&&(this.initPTS[f.cc]=T,this.timescale[f.cc]=m),c.length&&(this.unparsedVttFrags=[],c.forEach(function(u){b.onFragLoaded(F.Events.FRAG_LOADED,u)}))},o.getExistingTrack=function(s){var S=this.media;if(S)for(var b=0;b<S.textTracks.length;b++){var f=S.textTracks[b];if(f[s])return f}return null},o.createCaptionsTrack=function(s){this.config.renderTextTracksNatively?this.createNativeTrack(s):this.createNonNativeTrack(s)},o.createNativeTrack=function(s){if(this.captionsTracks[s])return;var S=this.captionsProperties,b=this.captionsTracks,f=this.media,L=S[s],T=L.label,m=L.languageCode,c=this.getExistingTrack(s);if(c)b[s]=c,Object(R.clearCurrentCues)(b[s]),Object(R.sendAddTrackEvent)(b[s],f);else{var u=this.createTextTrack("captions",T,m);u&&(u[s]=!0,b[s]=u)}},o.createNonNativeTrack=function(s){if(this.nonNativeCaptionsTracks[s])return;var S=this.captionsProperties[s];if(!S)return;var b=S.label,f={_id:s,label:b,kind:"captions",default:S.media?!!S.media.default:!1,closedCaptions:S.media};this.nonNativeCaptionsTracks[s]=f,this.hls.trigger(F.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[f]})},o.createTextTrack=function(s,S,b){var f=this.media;return f?f.addTextTrack(s,S,b):void 0},o.onMediaAttaching=function(s,S){this.media=S.media,this._cleanTracks()},o.onMediaDetaching=function(){var s=this.captionsTracks;Object.keys(s).forEach(function(S){Object(R.clearCurrentCues)(s[S]),delete s[S]}),this.nonNativeCaptionsTracks={}},o.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=v(),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 s=this.media;if(!s)return;var S=s.textTracks;if(S)for(var b=0;b<S.length;b++)Object(R.clearCurrentCues)(S[b])},o.onSubtitleTracksUpdated=function(s,S){var b=this;this.textTracks=[];var f=S.subtitleTracks||[],L=f.some(function(u){return u.textCodec===C.IMSC1_CODEC});if(this.config.enableWebVTT||L&&this.config.enableIMSC1){var T=this.tracks&&f&&this.tracks.length===f.length;if(this.tracks=f||[],this.config.renderTextTracksNatively){var m=this.media?this.media.textTracks:[];this.tracks.forEach(function(u,a){var E;if(a<m.length){for(var g=null,p=0;p<m.length;p++)if(w(m[p],u)){g=m[p];break}g&&(E=g)}E?Object(R.clearCurrentCues)(E):(E=b.createTextTrack("subtitles",u.name,u.lang),E&&(E.mode="disabled")),E&&(E.groupId=u.groupId,b.textTracks.push(E))})}else if(!T&&this.tracks&&this.tracks.length){var c=this.tracks.map(function(u){return{label:u.name,kind:u.type.toLowerCase(),default:u.default,subtitleTrack:u}});this.hls.trigger(F.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:c})}}},o.onManifestLoaded=function(s,S){var b=this;this.config.enableCEA708Captions&&S.captions&&S.captions.forEach(function(f){var L=/(?:CC|SERVICE)([1-4])/.exec(f.instreamId);if(!L)return;var T="textTrack"+L[1],m=b.captionsProperties[T];if(!m)return;m.label=f.name,f.lang&&(m.languageCode=f.lang),m.media=f})},o.onFragLoading=function(s,S){var b=this.cea608Parser1,f=this.cea608Parser2,L=this.lastSn,T=this.lastPartIndex;if(!this.enabled||!(b&&f))return;if(S.frag.type===h.PlaylistLevelType.MAIN){var m,c,u=S.frag.sn,a=(m=S==null||((c=S.part)===null||c===void 0)?void 0:c.index)!=null?m:-1;u===L+1||u===L&&a===T+1||(b.reset(),f.reset()),this.lastSn=u,this.lastPartIndex=a}},o.onFragLoaded=function(s,S){var b=S.frag,f=S.payload,L=this.initPTS,T=this.unparsedVttFrags;if(b.type===h.PlaylistLevelType.SUBTITLE)if(f.byteLength){if(!Object(K.isFiniteNumber)(L[b.cc])){T.push(S),L.length&&this.hls.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:b,error:new Error("Missing initial subtitle PTS")});return}var m=b.decryptdata;if(m==null||m.key==null||m.method!=="AES-128"){var c=this.tracks[b.level],u=this.vttCCs;u[b.cc]||(u[b.cc]={start:b.start,prevCC:this.prevCC,new:!0},this.prevCC=b.cc),c&&c.textCodec===C.IMSC1_CODEC?this._parseIMSC1(b,f):this._parseVTTs(b,f,u)}}else this.hls.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:b,error:new Error("Empty subtitle payload")})},o._parseIMSC1=function(s,S){var b=this,f=this.hls;Object(C.parseIMSC1)(S,this.initPTS[s.cc],this.timescale[s.cc],function(L){b._appendCues(L,s.level),f.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:s})},function(L){y.logger.log("Failed to parse IMSC1: "+L),f.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:s,error:L})})},o._parseVTTs=function(s,S,b){var f=this,L=this.hls;Object(I.parseWebVTT)(S,this.initPTS[s.cc],this.timescale[s.cc],b,s.cc,s.start,function(T){f._appendCues(T,s.level),L.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:s})},function(T){f._fallbackToIMSC1(s,S),y.logger.log("Failed to parse VTT cue: "+T),L.trigger(F.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:s,error:T})})},o._fallbackToIMSC1=function(s,S){var b=this,f=this.tracks[s.level];f.textCodec||Object(C.parseIMSC1)(S,this.initPTS[s.cc],this.timescale[s.cc],function(){f.textCodec=C.IMSC1_CODEC,b._parseIMSC1(s,S)},function(){f.textCodec="wvtt"})},o._appendCues=function(s,S){var b=this.hls;if(this.config.renderTextTracksNatively){var f=this.textTracks[S];if(f.mode==="disabled")return;s.forEach(function(m){return Object(R.addCueToTrack)(f,m)})}else{var L=this.tracks[S],T=L.default?"default":"subtitles"+S;b.trigger(F.Events.CUES_PARSED,{type:"subtitles",cues:s,track:T})}},o.onFragDecrypted=function(s,S){var b=S.frag;if(b.type===h.PlaylistLevelType.SUBTITLE){if(!Object(K.isFiniteNumber)(this.initPTS[b.cc])){this.unparsedVttFrags.push(S);return}this.onFragLoaded(F.Events.FRAG_LOADED,S)}},o.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},o.onFragParsingUserdata=function(s,S){var b=this.cea608Parser1,f=this.cea608Parser2;if(!this.enabled||!(b&&f))return;for(var L=0;L<S.samples.length;L++){var T=S.samples[L].bytes;if(T){var m=this.extractCea608Data(T);b.addData(S.samples[L].pts,m[0]),f.addData(S.samples[L].pts,m[1])}}},o.onBufferFlushing=function(s,S){var b=S.startOffset,f=S.endOffset,L=S.endOffsetSubtitles,T=S.type,m=this.media;if(!m||m.currentTime<f)return;if(!T||T==="video"){var c=this.captionsTracks;Object.keys(c).forEach(function(a){return Object(R.removeCuesInRange)(c[a],b,f)})}if(this.config.renderTextTracksNatively&&(b===0&&L!==void 0)){var u=this.textTracks;Object.keys(u).forEach(function(a){return Object(R.removeCuesInRange)(u[a],b,L)})}},o.extractCea608Data=function(s){for(var S=s[0]&31,b=2,f=[[],[]],L=0;L<S;L++){var T=s[b++],m=127&s[b++],c=127&s[b++],u=(4&T)!==0,a=3&T;if(m===0&&c===0)continue;u&&((a===0||a===1)&&(f[a].push(m),f[a].push(c)))}return f},d}();function w(d,o){return d&&d.label===o.name&&!(d.textTrack1||d.textTrack2)}function x(d,o,l,s){return Math.min(o,s)-Math.max(d,l)}function v(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(J,z,D){"use strict";D.r(z),D.d(z,"default",function(){return K});var K=function(){function F(N,I){this.subtle=void 0,this.aesIV=void 0,this.subtle=N,this.aesIV=I}var O=F.prototype;return O.decrypt=function(I,R){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},R,I)},F}()},"./src/crypt/aes-decryptor.ts":function(J,z,D){"use strict";D.r(z),D.d(z,"removePadding",function(){return F}),D.d(z,"default",function(){return O});var K=D("./src/utils/typed-array.ts");function F(N){var I=N.byteLength,R=I&&new DataView(N.buffer).getUint8(I-1);return R?Object(K.sliceUint8)(N,0,I-R):N}var O=function(){function N(){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=N.prototype;return I.uint8ArrayToUint32Array_=function(C){for(var h=new DataView(C),y=new Uint32Array(4),P=0;P<4;P++)y[P]=h.getUint32(P*4);return y},I.initTable=function(){var C=this.sBox,h=this.invSBox,y=this.subMix,P=y[0],w=y[1],x=y[2],v=y[3],d=this.invSubMix,o=d[0],l=d[1],s=d[2],S=d[3],b=new Uint32Array(256),f=0,L=0,T=0;for(T=0;T<256;T++)T<128?b[T]=T<<1:b[T]=T<<1^283;for(T=0;T<256;T++){var m=L^L<<1^L<<2^L<<3^L<<4;m=m>>>8^m&255^99,C[f]=m,h[m]=f;var c=b[f],u=b[c],a=b[u],E=b[m]*257^m*16843008;P[f]=E<<24|E>>>8,w[f]=E<<16|E>>>16,x[f]=E<<8|E>>>24,v[f]=E,E=a*16843009^u*65537^c*257^f*16843008,o[m]=E<<24|E>>>8,l[m]=E<<16|E>>>16,s[m]=E<<8|E>>>24,S[m]=E,f?(f=c^b[b[b[a^c]]],L^=b[b[L]]):f=L=1}},I.expandKey=function(C){for(var h=this.uint8ArrayToUint32Array_(C),y=!0,P=0;P<h.length&&y;)y=h[P]===this.key[P],P++;if(y)return;this.key=h;var w=this.keySize=h.length;if(w!==4&&w!==6&&w!==8)throw new Error("Invalid aes key size="+w);var x=this.ksRows=(w+6+1)*4,v,d,o=this.keySchedule=new Uint32Array(x),l=this.invKeySchedule=new Uint32Array(x),s=this.sBox,S=this.rcon,b=this.invSubMix,f=b[0],L=b[1],T=b[2],m=b[3],c,u;for(v=0;v<x;v++){if(v<w){c=o[v]=h[v];continue}u=c,v%w===0?(u=u<<8|u>>>24,u=s[u>>>24]<<24|s[u>>>16&255]<<16|s[u>>>8&255]<<8|s[u&255],u^=S[v/w|0]<<24):w>6&&v%w===4&&(u=s[u>>>24]<<24|s[u>>>16&255]<<16|s[u>>>8&255]<<8|s[u&255]),o[v]=c=(o[v-w]^u)>>>0}for(d=0;d<x;d++)v=x-d,d&3?u=o[v]:u=o[v-4],d<4||v<=4?l[d]=u:l[d]=f[s[u>>>24]]^L[s[u>>>16&255]]^T[s[u>>>8&255]]^m[s[u&255]],l[d]=l[d]>>>0},I.networkToHostOrderSwap=function(C){return C<<24|(C&65280)<<8|(C&16711680)>>8|C>>>24},I.decrypt=function(C,h,y){for(var P=this.keySize+6,w=this.invKeySchedule,x=this.invSBox,v=this.invSubMix,d=v[0],o=v[1],l=v[2],s=v[3],S=this.uint8ArrayToUint32Array_(y),b=S[0],f=S[1],L=S[2],T=S[3],m=new Int32Array(C),c=new Int32Array(m.length),u,a,E,g,p,_,U,B,W,k,M,H,X,ee,ie=this.networkToHostOrderSwap;h<m.length;){for(W=ie(m[h]),k=ie(m[h+1]),M=ie(m[h+2]),H=ie(m[h+3]),p=W^w[0],_=H^w[1],U=M^w[2],B=k^w[3],X=4,ee=1;ee<P;ee++)u=d[p>>>24]^o[_>>16&255]^l[U>>8&255]^s[B&255]^w[X],a=d[_>>>24]^o[U>>16&255]^l[B>>8&255]^s[p&255]^w[X+1],E=d[U>>>24]^o[B>>16&255]^l[p>>8&255]^s[_&255]^w[X+2],g=d[B>>>24]^o[p>>16&255]^l[_>>8&255]^s[U&255]^w[X+3],p=u,_=a,U=E,B=g,X=X+4;u=x[p>>>24]<<24^x[_>>16&255]<<16^x[U>>8&255]<<8^x[B&255]^w[X],a=x[_>>>24]<<24^x[U>>16&255]<<16^x[B>>8&255]<<8^x[p&255]^w[X+1],E=x[U>>>24]<<24^x[B>>16&255]<<16^x[p>>8&255]<<8^x[_&255]^w[X+2],g=x[B>>>24]<<24^x[p>>16&255]<<16^x[_>>8&255]<<8^x[U&255]^w[X+3],c[h]=ie(u^b),c[h+1]=ie(g^f),c[h+2]=ie(E^L),c[h+3]=ie(a^T),b=W,f=k,L=M,T=H,h=h+4}return c.buffer},N}()},"./src/crypt/decrypter.ts":function(J,z,D){"use strict";D.r(z),D.d(z,"default",function(){return h});var K=D("./src/crypt/aes-crypto.ts"),F=D("./src/crypt/fast-aes-key.ts"),O=D("./src/crypt/aes-decryptor.ts"),N=D("./src/utils/logger.ts"),I=D("./src/utils/mp4-tools.ts"),R=D("./src/utils/typed-array.ts"),C=16,h=function(){function y(w,x,v){var d=v===void 0?{}:v,o=d.removePKCS7Padding,l=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=w,this.config=x,this.removePKCS7Padding=l,l)try{var s=self.crypto;s&&(this.subtle=s.subtle||s.webkitSubtle)}catch(S){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var P=y.prototype;return P.destroy=function(){this.observer=null},P.isSync=function(){return this.config.enableSoftwareAES},P.flush=function(){var x=this.currentResult;if(!x){this.reset();return}var v=new Uint8Array(x);return this.reset(),this.removePKCS7Padding?Object(O.removePadding)(v):v},P.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},P.decrypt=function(x,v,d,o){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(x),v,d);var l=this.flush();l&&o(l.buffer)}else this.webCryptoDecrypt(new Uint8Array(x),v,d).then(o)},P.softwareDecrypt=function(x,v,d){var o=this.currentIV,l=this.currentResult,s=this.remainderData;this.logOnce("JS AES decrypt"),s&&(x=Object(I.appendUint8Array)(s,x),this.remainderData=null);var S=this.getValidChunk(x);if(!S.length)return null;o&&(d=o);var b=this.softwareDecrypter;b||(b=this.softwareDecrypter=new O.default),b.expandKey(v);var f=l;return this.currentResult=b.decrypt(S.buffer,0,d),this.currentIV=Object(R.sliceUint8)(S,-16).buffer,f||null},P.webCryptoDecrypt=function(x,v,d){var o=this,l=this.subtle;return(this.key!==v||!this.fastAesKey)&&(this.key=v,this.fastAesKey=new F.default(l,v)),this.fastAesKey.expandKey().then(function(s){if(!l)return Promise.reject(new Error("web crypto not initialized"));var S=new K.default(l,d);return S.decrypt(x.buffer,s)}).catch(function(s){return o.onWebCryptoError(s,x,v,d)})},P.onWebCryptoError=function(x,v,d,o){return N.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",x),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(v,d,o)},P.getValidChunk=function(x){var v=x,d=x.length-x.length%C;return d!==x.length&&(v=Object(R.sliceUint8)(x,0,d),this.remainderData=Object(R.sliceUint8)(x,d)),v},P.logOnce=function(x){if(!this.logEnabled)return;N.logger.log("[decrypter.ts]: "+x),this.logEnabled=!1},y}()},"./src/crypt/fast-aes-key.ts":function(J,z,D){"use strict";D.r(z),D.d(z,"default",function(){return K});var K=function(){function F(N,I){this.subtle=void 0,this.key=void 0,this.subtle=N,this.key=I}var O=F.prototype;return O.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},F}()},"./src/demux/aacdemuxer.ts":function(J,z,D){"use strict";D.r(z);var K=D("./src/demux/base-audio-demuxer.ts"),F=D("./src/demux/adts.ts"),O=D("./src/utils/logger.ts"),N=D("./src/demux/id3.ts");function I(h,y){h.prototype=Object.create(y.prototype),h.prototype.constructor=h,R(h,y)}function R(h,y){return R=Object.setPrototypeOf||function(w,x){return w.__proto__=x,w},R(h,y)}var C=function(h){I(y,h);function y(w,x){var v;return v=h.call(this)||this,v.observer=void 0,v.config=void 0,v.observer=w,v.config=x,v}var P=y.prototype;return P.resetInitSegment=function(x,v,d){h.prototype.resetInitSegment.call(this,x,v,d),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:x,duration:d,inputTimeScale:9e4,dropped:0}},y.probe=function(x){if(!x)return!1;for(var v=N.getID3Data(x,0)||[],d=v.length,o=x.length;d<o;d++)if(F.probe(x,d))return O.logger.log("ADTS sync word found !"),!0;return!1},P.canParse=function(x,v){return F.canParse(x,v)},P.appendFrame=function(x,v,d){F.initTrackConfig(x,this.observer,v,d,x.manifestCodec);var o=F.appendFrame(x,v,d,this.initPTS,this.frameIndex);if(o&&o.missing===0)return o},y}(K.default);C.minProbeByteLength=9,z.default=C},"./src/demux/adts.ts":function(J,z,D){"use strict";D.r(z),D.d(z,"getAudioConfig",function(){return N}),D.d(z,"isHeaderPattern",function(){return I}),D.d(z,"getHeaderLength",function(){return R}),D.d(z,"getFullFrameLength",function(){return C}),D.d(z,"canGetFrameLength",function(){return h}),D.d(z,"isHeader",function(){return y}),D.d(z,"canParse",function(){return P}),D.d(z,"probe",function(){return w}),D.d(z,"initTrackConfig",function(){return x}),D.d(z,"getFrameDuration",function(){return v}),D.d(z,"parseFrameHeader",function(){return d}),D.d(z,"appendFrame",function(){return o});var K=D("./src/utils/logger.ts"),F=D("./src/errors.ts"),O=D("./src/events.ts");function N(l,s,S,b){var f,L,T,m,c=navigator.userAgent.toLowerCase(),u=b,a=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];f=((s[S+2]&192)>>>6)+1;var E=(s[S+2]&60)>>>2;if(E>a.length-1){l.trigger(O.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+E});return}return T=(s[S+2]&1)<<2,T|=(s[S+3]&192)>>>6,K.logger.log("manifest codec:"+b+", ADTS type:"+f+", samplingIndex:"+E),/firefox/i.test(c)?E>=6?(f=5,m=new Array(4),L=E-3):(f=2,m=new Array(2),L=E):c.indexOf("android")!==-1?(f=2,m=new Array(2),L=E):(f=5,m=new Array(4),b&&(b.indexOf("mp4a.40.29")!==-1||b.indexOf("mp4a.40.5")!==-1)||!b&&E>=6?L=E-3:((b&&b.indexOf("mp4a.40.2")!==-1&&(E>=6&&T===1||/vivaldi/i.test(c))||!b&&T===1)&&(f=2,m=new Array(2)),L=E)),m[0]=f<<3,m[0]|=(E&14)>>1,m[1]|=(E&1)<<7,m[1]|=T<<3,f===5&&(m[1]|=(L&14)>>1,m[2]=(L&1)<<7,m[2]|=2<<2,m[3]=0),{config:m,samplerate:a[E],channelCount:T,codec:"mp4a.40."+f,manifestCodec:u}}function I(l,s){return l[s]===255&&(l[s+1]&246)===240}function R(l,s){return l[s+1]&1?7:9}function C(l,s){return(l[s+3]&3)<<11|l[s+4]<<3|(l[s+5]&224)>>>5}function h(l,s){return s+5<l.length}function y(l,s){return s+1<l.length&&I(l,s)}function P(l,s){return h(l,s)&&I(l,s)&&C(l,s)<=l.length-s}function w(l,s){if(y(l,s)){var S=R(l,s);if(s+S>=l.length)return!1;var b=C(l,s);if(b<=S)return!1;var f=s+b;return f===l.length||y(l,f)}return!1}function x(l,s,S,b,f){if(!l.samplerate){var L=N(s,S,b,f);if(!L)return;l.config=L.config,l.samplerate=L.samplerate,l.channelCount=L.channelCount,l.codec=L.codec,l.manifestCodec=L.manifestCodec,K.logger.log("parsed codec:"+l.codec+", rate:"+L.samplerate+", channels:"+L.channelCount)}}function v(l){return 1024*9e4/l}function d(l,s,S,b,f){var L=R(l,s),T=C(l,s);if(T-=L,T>0){var m=S+b*f;return{headerLength:L,frameLength:T,stamp:m}}}function o(l,s,S,b,f){var L=v(l.samplerate),T=d(s,S,b,f,L);if(T){var m=T.frameLength,c=T.headerLength,u=T.stamp,a=c+m,E=Math.max(0,S+a-s.length),g;E?(g=new Uint8Array(a-c),g.set(s.subarray(S+c,s.length),0)):g=s.subarray(S+c,S+a);var p={unit:g,pts:u};return E||l.samples.push(p),{sample:p,length:a,missing:E}}}},"./src/demux/base-audio-demuxer.ts":function(J,z,D){"use strict";D.r(z),D.d(z,"initPTSFn",function(){return C});var K=D("./src/polyfills/number.ts"),F=D("./src/demux/id3.ts"),O=D("./src/demux/dummy-demuxed-track.ts"),N=D("./src/utils/mp4-tools.ts"),I=D("./src/utils/typed-array.ts"),R=function(){function h(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var y=h.prototype;return y.resetInitSegment=function(w,x,v){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},y.resetTimeStamp=function(){},y.resetContiguity=function(){},y.canParse=function(w,x){return!1},y.appendFrame=function(w,x,v){},y.demux=function(w,x){this.cachedData&&(w=Object(N.appendUint8Array)(this.cachedData,w),this.cachedData=null);var v=F.getID3Data(w,0),d=v?v.length:0,o,l,s=this._audioTrack,S=this._id3Track,b=v?F.getTimeStamp(v):void 0,f=w.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=C(b,x)),v&&v.length>0&&S.samples.push({pts:this.initPTS,dts:this.initPTS,data:v}),l=this.initPTS;d<f;){if(this.canParse(w,d)){var L=this.appendFrame(s,w,d);L?(this.frameIndex++,l=L.sample.pts,d+=L.length,o=d):d=f}else F.canParse(w,d)?(v=F.getID3Data(w,d),S.samples.push({pts:l,dts:l,data:v}),d+=v.length,o=d):d++;if(d===f&&o!==f){var T=Object(I.sliceUint8)(w,o);this.cachedData?this.cachedData=Object(N.appendUint8Array)(this.cachedData,T):this.cachedData=T}}return{audioTrack:s,avcTrack:Object(O.dummyTrack)(),id3Track:S,textTrack:Object(O.dummyTrack)()}},y.demuxSampleAes=function(w,x,v){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},y.flush=function(w){var x=this.cachedData;return x&&(this.cachedData=null,this.demux(x,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(O.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(O.dummyTrack)()}},y.destroy=function(){},h}(),C=function(y,P){return Object(K.isFiniteNumber)(y)?y*90:P*9e4};z.default=R},"./src/demux/chunk-cache.ts":function(J,z,D){"use strict";D.r(z),D.d(z,"default",function(){return K});var K=function(){function O(){this.chunks=[],this.dataLength=0}var N=O.prototype;return N.push=function(R){this.chunks.push(R),this.dataLength+=R.length},N.flush=function(){var R=this.chunks,C=this.dataLength,h;if(R.length)R.length===1?h=R[0]:h=F(R,C);else return new Uint8Array(0);return this.reset(),h},N.reset=function(){this.chunks.length=0,this.dataLength=0},O}();function F(O,N){for(var I=new Uint8Array(N),R=0,C=0;C<O.length;C++){var h=O[C];I.set(h,R),R+=h.length}return I}},"./src/demux/dummy-demuxed-track.ts":function(J,z,D){"use strict";D.r(z),D.d(z,"dummyTrack",function(){return K});function K(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(J,z,D){"use strict";D.r(z);var K=D("./src/utils/logger.ts"),F=function(){function O(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 N=O.prototype;return N.loadWord=function(){var R=this.data,C=this.bytesAvailable,h=R.byteLength-C,y=new Uint8Array(4),P=Math.min(4,C);if(P===0)throw new Error("no bytes available");y.set(R.subarray(h,h+P)),this.word=new DataView(y.buffer).getUint32(0),this.bitsAvailable=P*8,this.bytesAvailable-=P},N.skipBits=function(R){var C;this.bitsAvailable>R?(this.word<<=R,this.bitsAvailable-=R):(R-=this.bitsAvailable,C=R>>3,R-=C>>3,this.bytesAvailable-=C,this.loadWord(),this.word<<=R,this.bitsAvailable-=R)},N.readBits=function(R){var C=Math.min(this.bitsAvailable,R),h=this.word>>>32-C;return R>32&&K.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=C,this.bitsAvailable>0?this.word<<=C:this.bytesAvailable>0&&this.loadWord(),C=R-C,C>0&&this.bitsAvailable?h<<C|this.readBits(C):h},N.skipLZ=function(){var R;for(R=0;R<this.bitsAvailable;++R)if((this.word&2147483648>>>R)!==0)return this.word<<=R,this.bitsAvailable-=R,R;return this.loadWord(),R+this.skipLZ()},N.skipUEG=function(){this.skipBits(1+this.skipLZ())},N.skipEG=function(){this.skipBits(1+this.skipLZ())},N.readUEG=function(){var R=this.skipLZ();return this.readBits(R+1)-1},N.readEG=function(){var R=this.readUEG();return 1&R?1+R>>>1:-1*(R>>>1)},N.readBoolean=function(){return this.readBits(1)===1},N.readUByte=function(){return this.readBits(8)},N.readUShort=function(){return this.readBits(16)},N.readUInt=function(){return this.readBits(32)},N.skipScalingList=function(R){for(var C=8,h=8,y,P=0;P<R;P++)h!==0&&(y=this.readEG(),h=(C+y+256)%256),C=h===0?C:h},N.readSPS=function(){var R=0,C=0,h=0,y=0,P,w,x,v=this.readUByte.bind(this),d=this.readBits.bind(this),o=this.readUEG.bind(this),l=this.readBoolean.bind(this),s=this.skipBits.bind(this),S=this.skipEG.bind(this),b=this.skipUEG.bind(this),f=this.skipScalingList.bind(this);v();var L=v();if(d(5),s(3),v(),b(),L===100||L===110||L===122||L===244||L===44||L===83||L===86||L===118||L===128){var T=o();if(T===3&&s(1),b(),b(),s(1),l())for(w=T!==3?8:12,x=0;x<w;x++)l()&&(x<6?f(16):f(64))}b();var m=o();if(m===0)o();else if(m===1)for(s(1),S(),S(),P=o(),x=0;x<P;x++)S();b(),s(1);var c=o(),u=o(),a=d(1);a===0&&s(1),s(1),l()&&(R=o(),C=o(),h=o(),y=o());var E=[1,1];if(l()&&l()){var g=v();switch(g){case 1:E=[1,1];break;case 2:E=[12,11];break;case 3:E=[10,11];break;case 4:E=[16,11];break;case 5:E=[40,33];break;case 6:E=[24,11];break;case 7:E=[20,11];break;case 8:E=[32,11];break;case 9:E=[80,33];break;case 10:E=[18,11];break;case 11:E=[15,11];break;case 12:E=[64,33];break;case 13:E=[160,99];break;case 14:E=[4,3];break;case 15:E=[3,2];break;case 16:E=[2,1];break;case 255:{E=[v()<<8|v(),v()<<8|v()];break}}}return{width:Math.ceil((c+1)*16-R*2-C*2),height:(2-a)*(u+1)*16-(a?2:4)*(h+y),pixelRatio:E}},N.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},O}();z.default=F},"./src/demux/id3.ts":function(J,z,D){"use strict";D.r(z),D.d(z,"isHeader",function(){return K}),D.d(z,"isFooter",function(){return F}),D.d(z,"getID3Data",function(){return O}),D.d(z,"canParse",function(){return I}),D.d(z,"getTimeStamp",function(){return R}),D.d(z,"isTimeStampFrame",function(){return C}),D.d(z,"getID3Frames",function(){return y}),D.d(z,"decodeFrame",function(){return P}),D.d(z,"utf8ArrayToStr",function(){return o}),D.d(z,"testables",function(){return l});var K=function(f,L){return L+10<=f.length&&(f[L]===73&&f[L+1]===68&&f[L+2]===51&&(f[L+3]<255&&f[L+4]<255&&(f[L+6]<128&&f[L+7]<128&&f[L+8]<128&&f[L+9]<128)))},F=function(f,L){return L+10<=f.length&&(f[L]===51&&f[L+1]===68&&f[L+2]===73&&(f[L+3]<255&&f[L+4]<255&&(f[L+6]<128&&f[L+7]<128&&f[L+8]<128&&f[L+9]<128)))},O=function(f,L){for(var T=L,m=0;K(f,L);){m+=10;var c=N(f,L+6);m+=c,F(f,L+10)&&(m+=10),L+=m}return m>0?f.subarray(T,T+m):void 0},N=function(f,L){var T=0;return T=(f[L]&127)<<21,T|=(f[L+1]&127)<<14,T|=(f[L+2]&127)<<7,T|=f[L+3]&127,T},I=function(f,L){return K(f,L)&&N(f,L+6)+10<=f.length-L},R=function(f){for(var L=y(f),T=0;T<L.length;T++){var m=L[T];if(C(m))return d(m)}return},C=function(f){return f&&f.key==="PRIV"&&f.info==="com.apple.streaming.transportStreamTimestamp"},h=function(f){var L=String.fromCharCode(f[0],f[1],f[2],f[3]),T=N(f,4),m=10;return{type:L,size:T,data:f.subarray(m,m+T)}},y=function(f){for(var L=0,T=[];K(f,L);){var m=N(f,L+6);L+=10;for(var c=L+m;L+8<c;){var u=h(f.subarray(L)),a=P(u);a&&T.push(a),L+=u.size+10}F(f,L)&&(L+=10)}return T},P=function(f){return f.type==="PRIV"?w(f):f.type[0]==="W"?v(f):x(f)},w=function(f){if(f.size<2)return;var L=o(f.data,!0),T=new Uint8Array(f.data.subarray(L.length+1));return{key:f.type,info:L,data:T.buffer}},x=function(f){if(f.size<2)return;if(f.type==="TXXX"){var L=1,T=o(f.data.subarray(L),!0);L+=T.length+1;var m=o(f.data.subarray(L));return{key:f.type,info:T,data:m}}var c=o(f.data.subarray(1));return{key:f.type,data:c}},v=function(f){if(f.type==="WXXX"){if(f.size<2)return;var L=1,T=o(f.data.subarray(L),!0);L+=T.length+1;var m=o(f.data.subarray(L));return{key:f.type,info:T,data:m}}var c=o(f.data);return{key:f.type,data:c}},d=function(f){if(f.data.byteLength===8){var L=new Uint8Array(f.data),T=L[3]&1,m=(L[4]<<23)+(L[5]<<15)+(L[6]<<7)+L[7];return m/=45,T&&(m+=4772185884e-2),Math.round(m)}return},o=function(f,L){L===void 0&&(L=!1);var T=S();if(T){var m=T.decode(f);if(L){var c=m.indexOf("\0");return c!==-1?m.substring(0,c):m}return m.replace(/\0/g,"")}for(var u=f.length,a,E,g,p="",_=0;_<u;){if(a=f[_++],a===0&&L)return p;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:p+=String.fromCharCode(a);break;case 12:case 13:E=f[_++],p+=String.fromCharCode((a&31)<<6|E&63);break;case 14:E=f[_++],g=f[_++],p+=String.fromCharCode((a&15)<<12|(E&63)<<6|(g&63)<<0);break;default:}}return p},l={decodeTextFrame:x},s;function S(){return!s&&typeof self.TextDecoder!="undefined"&&(s=new self.TextDecoder("utf-8")),s}},"./src/demux/mp3demuxer.ts":function(J,z,D){"use strict";D.r(z);var K=D("./src/demux/base-audio-demuxer.ts"),F=D("./src/demux/id3.ts"),O=D("./src/utils/logger.ts"),N=D("./src/demux/mpegaudio.ts");function I(h,y){h.prototype=Object.create(y.prototype),h.prototype.constructor=h,R(h,y)}function R(h,y){return R=Object.setPrototypeOf||function(w,x){return w.__proto__=x,w},R(h,y)}var C=function(h){I(y,h);function y(){return h.apply(this,arguments)||this}var P=y.prototype;return P.resetInitSegment=function(x,v,d){h.prototype.resetInitSegment.call(this,x,v,d),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:x,duration:d,inputTimeScale:9e4,dropped:0}},y.probe=function(x){if(!x)return!1;for(var v=F.getID3Data(x,0)||[],d=v.length,o=x.length;d<o;d++)if(N.probe(x,d))return O.logger.log("MPEG Audio sync word found !"),!0;return!1},P.canParse=function(x,v){return N.canParse(x,v)},P.appendFrame=function(x,v,d){return this.initPTS===null?void 0:N.appendFrame(x,v,d,this.initPTS,this.frameIndex)},y}(K.default);C.minProbeByteLength=4,z.default=C},"./src/demux/mp4demuxer.ts":function(J,z,D){"use strict";D.r(z);var K=D("./src/utils/mp4-tools.ts"),F=D("./src/demux/dummy-demuxed-track.ts"),O=function(){function N(R,C){this.remainderData=null,this.config=void 0,this.config=C}var I=N.prototype;return I.resetTimeStamp=function(){},I.resetInitSegment=function(){},I.resetContiguity=function(){},N.probe=function(C){return Object(K.findBox)({data:C,start:0,end:Math.min(C.length,16384)},["moof"]).length>0},I.demux=function(C){var h=C,y=Object(F.dummyTrack)();if(this.config.progressive){this.remainderData&&(h=Object(K.appendUint8Array)(this.remainderData,C));var P=Object(K.segmentValidRange)(h);this.remainderData=P.remainder,y.samples=P.valid||new Uint8Array}else y.samples=h;return{audioTrack:Object(F.dummyTrack)(),avcTrack:y,id3Track:Object(F.dummyTrack)(),textTrack:Object(F.dummyTrack)()}},I.flush=function(){var C=Object(F.dummyTrack)();return C.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(F.dummyTrack)(),avcTrack:C,id3Track:Object(F.dummyTrack)(),textTrack:Object(F.dummyTrack)()}},I.demuxSampleAes=function(C,h,y){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},I.destroy=function(){},N}();O.minProbeByteLength=1024,z.default=O},"./src/demux/mpegaudio.ts":function(J,z,D){"use strict";D.r(z),D.d(z,"appendFrame",function(){return R}),D.d(z,"parseHeader",function(){return C}),D.d(z,"isHeaderPattern",function(){return h}),D.d(z,"isHeader",function(){return y}),D.d(z,"canParse",function(){return P}),D.d(z,"probe",function(){return w});var K=null,F=[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],O=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],N=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],I=[0,1,1,4];function R(x,v,d,o,l){if(d+24>v.length)return;var s=C(v,d);if(s&&d+s.frameLength<=v.length){var S=s.samplesPerFrame*9e4/s.sampleRate,b=o+l*S,f={unit:v.subarray(d,d+s.frameLength),pts:b,dts:b};return x.config=[],x.channelCount=s.channelCount,x.samplerate=s.sampleRate,x.samples.push(f),{sample:f,length:s.frameLength,missing:0}}}function C(x,v){var d=x[v+1]>>3&3,o=x[v+1]>>1&3,l=x[v+2]>>4&15,s=x[v+2]>>2&3;if(d!==1&&l!==0&&l!==15&&s!==3){var S=x[v+2]>>1&1,b=x[v+3]>>6,f=d===3?3-o:o===3?3:4,L=F[f*14+l-1]*1e3,T=d===3?0:d===2?1:2,m=O[T*3+s],c=b===3?1:2,u=N[d][o],a=I[o],E=u*8*a,g=Math.floor(u*L/m+S)*a;if(K===null){var p=navigator.userAgent||"",_=p.match(/Chrome\/(\d+)/i);K=_?parseInt(_[1]):0}var U=!!K&&K<=87;return U&&o===2&&L>=224e3&&b===0&&(x[v+3]=x[v+3]|128),{sampleRate:m,channelCount:c,frameLength:g,samplesPerFrame:E}}}function h(x,v){return x[v]===255&&(x[v+1]&224)===224&&(x[v+1]&6)!==0}function y(x,v){return v+1<x.length&&h(x,v)}function P(x,v){var d=4;return h(x,v)&&d<=x.length-v}function w(x,v){if(v+1<x.length&&h(x,v)){var d=4,o=C(x,v),l=d;o!=null&&o.frameLength&&(l=o.frameLength);var s=v+l;return s===x.length||y(x,s)}return!1}},"./src/demux/sample-aes.ts":function(J,z,D){"use strict";D.r(z);var K=D("./src/crypt/decrypter.ts"),F=D("./src/demux/tsdemuxer.ts"),O=function(){function N(R,C,h){this.keyData=void 0,this.decrypter=void 0,this.keyData=h,this.decrypter=new K.default(R,C,{removePKCS7Padding:!1})}var I=N.prototype;return I.decryptBuffer=function(C,h){this.decrypter.decrypt(C,this.keyData.key.buffer,this.keyData.iv.buffer,h)},I.decryptAacSample=function(C,h,y,P){var w=C[h].unit,x=w.subarray(16,w.length-w.length%16),v=x.buffer.slice(x.byteOffset,x.byteOffset+x.length),d=this;this.decryptBuffer(v,function(o){var l=new Uint8Array(o);w.set(l,16),P||d.decryptAacSamples(C,h+1,y)})},I.decryptAacSamples=function(C,h,y){for(;;h++){if(h>=C.length){y();return}if(C[h].unit.length<32)continue;var P=this.decrypter.isSync();if(this.decryptAacSample(C,h,y,P),!P)return}},I.getAvcEncryptedData=function(C){for(var h=Math.floor((C.length-48)/160)*16+16,y=new Int8Array(h),P=0,w=32;w<=C.length-16;w+=160,P+=16)y.set(C.subarray(w,w+16),P);return y},I.getAvcDecryptedUnit=function(C,h){for(var y=new Uint8Array(h),P=0,w=32;w<=C.length-16;w+=160,P+=16)C.set(y.subarray(P,P+16),w);return C},I.decryptAvcSample=function(C,h,y,P,w,x){var v=Object(F.discardEPB)(w.data),d=this.getAvcEncryptedData(v),o=this;this.decryptBuffer(d.buffer,function(l){w.data=o.getAvcDecryptedUnit(v,l),x||o.decryptAvcSamples(C,h,y+1,P)})},I.decryptAvcSamples=function(C,h,y,P){if(C instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;h++,y=0){if(h>=C.length){P();return}for(var w=C[h].units;!(y>=w.length);y++){var x=w[y];if(x.data.length<=48||x.type!==1&&x.type!==5)continue;var v=this.decrypter.isSync();if(this.decryptAvcSample(C,h,y,P,x,v),!v)return}}},N}();z.default=O},"./src/demux/transmuxer-interface.ts":function(J,z,D){"use strict";D.r(z),D.d(z,"default",function(){return w});var K=D("./node_modules/webworkify-webpack/index.js"),F=D.n(K),O=D("./src/events.ts"),N=D("./src/demux/transmuxer.ts"),I=D("./src/utils/logger.ts"),R=D("./src/errors.ts"),C=D("./src/utils/mediasource-helper.ts"),h=D("./node_modules/eventemitter3/index.js"),y=D.n(h),P=Object(C.getMediaSource)()||{isTypeSupported:function(){return!1}},w=function(){function x(d,o,l,s){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=l,this.onFlush=s;var b=d.config,f=function(u,a){a=a||{},a.frag=S.frag,a.id=S.id,d.trigger(u,a)};this.observer=new h.EventEmitter,this.observer.on(O.Events.FRAG_DECRYPTED,f),this.observer.on(O.Events.ERROR,f);var L={mp4:P.isTypeSupported("video/mp4"),mpeg:P.isTypeSupported("audio/mpeg"),mp3:P.isTypeSupported('audio/mp4; codecs="mp3"')},T=navigator.vendor;if(b.enableWorker&&typeof Worker!="undefined"){I.logger.log("demuxing in webworker");var m;try{m=this.worker=K("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),m.addEventListener("message",this.onwmsg),m.onerror=function(c){d.trigger(O.Events.ERROR,{type:R.ErrorTypes.OTHER_ERROR,details:R.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(c.message+" ("+c.filename+":"+c.lineno+")")})},m.postMessage({cmd:"init",typeSupported:L,vendor:T,id:o,config:JSON.stringify(b)})}catch(c){I.logger.warn("Error in worker:",c),I.logger.error("Error while initializing DemuxerWorker, fallback to inline"),m&&self.URL.revokeObjectURL(m.objectURL),this.transmuxer=new N.default(this.observer,L,b,T,o),this.worker=null}}else this.transmuxer=new N.default(this.observer,L,b,T,o)}var v=x.prototype;return v.destroy=function(){var o=this.worker;if(o)o.removeEventListener("message",this.onwmsg),o.terminate(),this.worker=null;else{var l=this.transmuxer;l&&(l.destroy(),this.transmuxer=null)}var s=this.observer;s&&s.removeAllListeners(),this.observer=null},v.push=function(o,l,s,S,b,f,L,T,m,c){var u=this;m.transmuxing.start=self.performance.now();var a=this.transmuxer,E=this.worker,g=f?f.start:b.start,p=b.decryptdata,_=this.frag,U=!(_&&b.cc===_.cc),B=!(_&&m.level===_.level),W=_?m.sn-_.sn:-1,k=this.part?m.part-this.part.index:1,M=!B&&(W===1||W===0&&k===1),H=self.performance.now();(B||W||b.stats.parsing.start===0)&&(b.stats.parsing.start=H),f&&(k||!M)&&(f.stats.parsing.start=H);var X=new N.TransmuxState(U,M,T,B,g);if(!M||U){I.logger.log("[transmuxer-interface, "+b.type+"]: Starting new transmux session for sn: "+m.sn+" p: "+m.part+" level: "+m.level+" id: "+m.id+`
|
|
discontinuity: `+U+`
|
|
trackSwitch: `+B+`
|
|
contiguous: `+M+`
|
|
accurateTimeOffset: `+T+`
|
|
timeOffset: `+g);var ee=new N.TransmuxConfig(s,S,l,L,c);this.configureTransmuxer(ee)}if(this.frag=b,this.part=f,E)E.postMessage({cmd:"demux",data:o,decryptdata:p,chunkMeta:m,state:X},o instanceof ArrayBuffer?[o]:[]);else if(a){var ie=a.push(o,p,m,X);Object(N.isPromise)(ie)?ie.then(function(ve){u.handleTransmuxComplete(ve)}):this.handleTransmuxComplete(ie)}},v.flush=function(o){var l=this;o.transmuxing.start=self.performance.now();var s=this.transmuxer,S=this.worker;if(S)S.postMessage({cmd:"flush",chunkMeta:o});else if(s){var b=s.flush(o);Object(N.isPromise)(b)?b.then(function(f){l.handleFlushResult(f,o)}):this.handleFlushResult(b,o)}},v.handleFlushResult=function(o,l){var s=this;o.forEach(function(S){s.handleTransmuxComplete(S)}),this.onFlush(l)},v.onWorkerMessage=function(o){var l=o.data,s=this.hls;switch(l.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(l.data);break}case"flush":{this.onFlush(l.data);break}default:{l.data=l.data||{},l.data.frag=this.frag,l.data.id=this.id,s.trigger(l.event,l.data);break}}},v.configureTransmuxer=function(o){var l=this.worker,s=this.transmuxer;l?l.postMessage({cmd:"configure",config:o}):s&&s.configure(o)},v.handleTransmuxComplete=function(o){o.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(o)},x}()},"./src/demux/transmuxer-worker.ts":function(J,z,D){"use strict";D.r(z),D.d(z,"default",function(){return R});var K=D("./src/demux/transmuxer.ts"),F=D("./src/events.ts"),O=D("./src/utils/logger.ts"),N=D("./node_modules/eventemitter3/index.js"),I=D.n(N);function R(w){var x=new N.EventEmitter,v=function(o,l){w.postMessage({event:o,data:l})};x.on(F.Events.FRAG_DECRYPTED,v),x.on(F.Events.ERROR,v),w.addEventListener("message",function(d){var o=d.data;switch(o.cmd){case"init":{var l=JSON.parse(o.config);w.transmuxer=new K.default(x,o.typeSupported,l,o.vendor,o.id),Object(O.enableLogs)(l.debug),v("init",null);break}case"configure":{w.transmuxer.configure(o.config);break}case"demux":{var s=w.transmuxer.push(o.data,o.decryptdata,o.chunkMeta,o.state);Object(K.isPromise)(s)?s.then(function(f){C(w,f)}):C(w,s);break}case"flush":{var S=o.chunkMeta,b=w.transmuxer.flush(S);Object(K.isPromise)(b)?b.then(function(f){y(w,f,S)}):y(w,b,S);break}default:break}})}function C(w,x){if(P(x.remuxResult))return;var v=[],d=x.remuxResult,o=d.audio,l=d.video;o&&h(v,o),l&&h(v,l),w.postMessage({event:"transmuxComplete",data:x},v)}function h(w,x){x.data1&&w.push(x.data1.buffer),x.data2&&w.push(x.data2.buffer)}function y(w,x,v){x.forEach(function(d){C(w,d)}),w.postMessage({event:"flush",data:v})}function P(w){return!w.audio&&!w.video&&!w.text&&!w.id3&&!w.initSegment}},"./src/demux/transmuxer.ts":function(J,z,D){"use strict";D.r(z),D.d(z,"default",function(){return l}),D.d(z,"isPromise",function(){return b}),D.d(z,"TransmuxConfig",function(){return f}),D.d(z,"TransmuxState",function(){return L});var K=D("./src/events.ts"),F=D("./src/errors.ts"),O=D("./src/crypt/decrypter.ts"),N=D("./src/demux/aacdemuxer.ts"),I=D("./src/demux/mp4demuxer.ts"),R=D("./src/demux/tsdemuxer.ts"),C=D("./src/demux/mp3demuxer.ts"),h=D("./src/remux/mp4-remuxer.ts"),y=D("./src/remux/passthrough-remuxer.ts"),P=D("./src/demux/chunk-cache.ts"),w=D("./src/utils/mp4-tools.ts"),x=D("./src/utils/logger.ts"),v;try{v=self.performance.now.bind(self.performance)}catch(T){x.logger.debug("Unable to use Performance API on this environment"),v=self.Date.now}var d=[{demux:R.default,remux:h.default},{demux:I.default,remux:y.default},{demux:N.default,remux:h.default},{demux:C.default,remux:h.default}],o=1024;d.forEach(function(T){var m=T.demux;o=Math.max(o,m.minProbeByteLength)});var l=function(){function T(c,u,a,E,g){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 P.default,this.observer=c,this.typeSupported=u,this.config=a,this.vendor=E,this.id=g}var m=T.prototype;return m.configure=function(u){this.transmuxConfig=u,this.decrypter&&this.decrypter.reset()},m.push=function(u,a,E,g){var p=this,_=E.transmuxing;_.executeStart=v();var U=new Uint8Array(u),B=this.cache,W=this.config,k=this.currentTransmuxState,M=this.transmuxConfig;g&&(this.currentTransmuxState=g);var H=s(U,a);if(H&&H.method==="AES-128"){var X=this.getDecrypter();if(W.enableSoftwareAES){var ee=X.softwareDecrypt(U,H.key.buffer,H.iv.buffer);if(!ee)return _.executeEnd=v(),S(E);U=new Uint8Array(ee)}else return this.decryptionPromise=X.webCryptoDecrypt(U,H.key.buffer,H.iv.buffer).then(function(we){var Le=p.push(we,null,E);return p.decryptionPromise=null,Le}),this.decryptionPromise}var ie=g||k,ve=ie.contiguous,pe=ie.discontinuity,he=ie.trackSwitch,ce=ie.accurateTimeOffset,fe=ie.timeOffset,ne=M.audioCodec,me=M.videoCodec,$=M.defaultInitPts,ae=M.duration,q=M.initSegmentData;if((pe||he)&&this.resetInitSegment(q,ne,me,ae),pe&&this.resetInitialTimestamp($),ve||this.resetContiguity(),this.needsProbing(U,pe,he)){if(B.dataLength){var Ee=B.flush();U=Object(w.appendUint8Array)(Ee,U)}this.configureTransmuxer(U,M)}var Ce=this.transmux(U,H,fe,ce,E),ye=this.currentTransmuxState;return ye.contiguous=!0,ye.discontinuity=!1,ye.trackSwitch=!1,_.executeEnd=v(),Ce},m.flush=function(u){var a=this,E=u.transmuxing;E.executeStart=v();var g=this.decrypter,p=this.cache,_=this.currentTransmuxState,U=this.decryptionPromise;if(U)return U.then(function(){return a.flush(u)});var B=[],W=_.timeOffset;if(g){var k=g.flush();k&&B.push(this.push(k,null,u))}var M=p.dataLength;p.reset();var H=this.demuxer,X=this.remuxer;if(!H||!X)return M>=o&&this.observer.emit(K.Events.ERROR,K.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),E.executeEnd=v(),[S(u)];var ee=H.flush(W);return b(ee)?ee.then(function(ie){return a.flushRemux(B,ie,u),B}):(this.flushRemux(B,ee,u),B)},m.flushRemux=function(u,a,E){var g=a.audioTrack,p=a.avcTrack,_=a.id3Track,U=a.textTrack,B=this.currentTransmuxState,W=B.accurateTimeOffset,k=B.timeOffset;x.logger.log("[transmuxer.ts]: Flushed fragment "+E.sn+(E.part>-1?" p: "+E.part:"")+" of level "+E.level);var M=this.remuxer.remux(g,p,_,U,k,W,!0,this.id);u.push({remuxResult:M,chunkMeta:E}),E.transmuxing.executeEnd=v()},m.resetInitialTimestamp=function(u){var a=this.demuxer,E=this.remuxer;if(!a||!E)return;a.resetTimeStamp(u),E.resetTimeStamp(u)},m.resetContiguity=function(){var u=this.demuxer,a=this.remuxer;if(!u||!a)return;u.resetContiguity(),a.resetNextTimestamp()},m.resetInitSegment=function(u,a,E,g){var p=this.demuxer,_=this.remuxer;if(!p||!_)return;p.resetInitSegment(a,E,g),_.resetInitSegment(u,a,E)},m.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},m.transmux=function(u,a,E,g,p){var _;return a&&a.method==="SAMPLE-AES"?_=this.transmuxSampleAes(u,a,E,g,p):_=this.transmuxUnencrypted(u,E,g,p),_},m.transmuxUnencrypted=function(u,a,E,g){var p=this.demuxer.demux(u,a,!1,!this.config.progressive),_=p.audioTrack,U=p.avcTrack,B=p.id3Track,W=p.textTrack,k=this.remuxer.remux(_,U,B,W,a,E,!1,this.id);return{remuxResult:k,chunkMeta:g}},m.transmuxSampleAes=function(u,a,E,g,p){var _=this;return this.demuxer.demuxSampleAes(u,a,E).then(function(U){var B=_.remuxer.remux(U.audioTrack,U.avcTrack,U.id3Track,U.textTrack,E,g,!1,_.id);return{remuxResult:B,chunkMeta:p}})},m.configureTransmuxer=function(u,a){for(var E=this.config,g=this.observer,p=this.typeSupported,_=this.vendor,U=a.audioCodec,B=a.defaultInitPts,W=a.duration,k=a.initSegmentData,M=a.videoCodec,H,X=0,ee=d.length;X<ee;X++)if(d[X].demux.probe(u)){H=d[X];break}H||(x.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),H={demux:I.default,remux:y.default});var ie=this.demuxer,ve=this.remuxer,pe=H.remux,he=H.demux;(!ve||!(ve instanceof pe))&&(this.remuxer=new pe(g,E,p,_)),(!ie||!(ie instanceof he))&&(this.demuxer=new he(g,E,p),this.probe=he.probe),this.resetInitSegment(k,U,M,W),this.resetInitialTimestamp(B)},m.needsProbing=function(u,a,E){return!this.demuxer||!this.remuxer||a||E},m.getDecrypter=function(){var u=this.decrypter;return u||(u=this.decrypter=new O.default(this.observer,this.config)),u},T}();function s(T,m){var c=null;return T.byteLength>0&&m!=null&&m.key!=null&&m.iv!==null&&m.method!=null&&(c=m),c}var S=function(m){return{remuxResult:{},chunkMeta:m}};function b(T){return"then"in T&&T.then instanceof Function}var f=function(m,c,u,a,E){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=m,this.videoCodec=c,this.initSegmentData=u,this.duration=a,this.defaultInitPts=E},L=function(m,c,u,a,E){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=m,this.contiguous=c,this.accurateTimeOffset=u,this.trackSwitch=a,this.timeOffset=E}},"./src/demux/tsdemuxer.ts":function(J,z,D){"use strict";D.r(z),D.d(z,"discardEPB",function(){return S});var K=D("./src/demux/adts.ts"),F=D("./src/demux/mpegaudio.ts"),O=D("./src/demux/exp-golomb.ts"),N=D("./src/demux/id3.ts"),I=D("./src/demux/sample-aes.ts"),R=D("./src/events.ts"),C=D("./src/utils/mp4-tools.ts"),h=D("./src/utils/logger.ts"),y=D("./src/errors.ts"),P={video:1,audio:2,id3:3,text:4},w=function(){function b(L,T,m){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=L,this.config=T,this.typeSupported=m}b.probe=function(T){var m=b.syncOffset(T);return m<0?!1:(m&&h.logger.warn("MPEG2-TS detected but first sync word found @ offset "+m+", junk ahead ?"),!0)},b.syncOffset=function(T){for(var m=Math.min(1e3,T.length-3*188),c=0;c<m;){if(T[c]===71&&T[c+188]===71&&T[c+2*188]===71)return c;c++}return-1},b.createTrack=function(T,m){return{container:T==="video"||T==="audio"?"video/mp2t":void 0,type:T,id:P[T],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:T==="audio"?m:void 0}};var f=b.prototype;return f.resetInitSegment=function(T,m,c){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=b.createTrack("video",c),this._audioTrack=b.createTrack("audio",c),this._id3Track=b.createTrack("id3",c),this._txtTrack=b.createTrack("text",c),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=T,this.videoCodec=m,this._duration=c},f.resetTimeStamp=function(){},f.resetContiguity=function(){var T=this._audioTrack,m=this._avcTrack,c=this._id3Track;T&&(T.pesData=null),m&&(m.pesData=null),c&&(c.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},f.demux=function(T,m,c,u){c===void 0&&(c=!1),u===void 0&&(u=!1),c||(this.sampleAes=null);var a,E=this._avcTrack,g=this._audioTrack,p=this._id3Track,_=E.pid,U=E.pesData,B=g.pid,W=p.pid,k=g.pesData,M=p.pesData,H=!1,X=this.pmtParsed,ee=this._pmtId,ie=T.length;if(this.remainderData&&(T=Object(C.appendUint8Array)(this.remainderData,T),ie=T.length,this.remainderData=null),ie<188&&!u)return this.remainderData=T,{audioTrack:g,avcTrack:E,id3Track:p,textTrack:this._txtTrack};var ve=Math.max(0,b.syncOffset(T));ie-=(ie+ve)%188,ie<T.byteLength&&!u&&(this.remainderData=new Uint8Array(T.buffer,ie,T.buffer.byteLength-ie));for(var pe=ve;pe<ie;pe+=188)if(T[pe]===71){var he=!!(T[pe+1]&64),ce=((T[pe+1]&31)<<8)+T[pe+2],fe=(T[pe+3]&48)>>4,ne=void 0;if(fe>1){if(ne=pe+5+T[pe+4],ne===pe+188)continue}else ne=pe+4;switch(ce){case _:he&&(U&&(a=o(U))&&this.parseAVCPES(a,!1),U={data:[],size:0}),U&&(U.data.push(T.subarray(ne,pe+188)),U.size+=pe+188-ne);break;case B:he&&(k&&(a=o(k))&&(g.isAAC?this.parseAACPES(a):this.parseMPEGPES(a)),k={data:[],size:0}),k&&(k.data.push(T.subarray(ne,pe+188)),k.size+=pe+188-ne);break;case W:he&&(M&&(a=o(M))&&this.parseID3PES(a),M={data:[],size:0}),M&&(M.data.push(T.subarray(ne,pe+188)),M.size+=pe+188-ne);break;case 0:he&&(ne+=T[ne]+1),ee=this._pmtId=v(T,ne);break;case ee:{he&&(ne+=T[ne]+1);var me=d(T,ne,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,c);_=me.avc,_>0&&(E.pid=_),B=me.audio,B>0&&(g.pid=B,g.isAAC=me.isAAC),W=me.id3,W>0&&(p.pid=W),H&&!X&&(h.logger.log("reparse from beginning"),H=!1,pe=ve-188),X=this.pmtParsed=!0;break}case 17:case 8191:break;default:H=!0;break}}else this.observer.emit(R.Events.ERROR,R.Events.ERROR,{type:y.ErrorTypes.MEDIA_ERROR,details:y.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});E.pesData=U,g.pesData=k,p.pesData=M;var $={audioTrack:g,avcTrack:E,id3Track:p,textTrack:this._txtTrack};return u&&this.extractRemainingSamples($),$},f.flush=function(){var T=this.remainderData;this.remainderData=null;var m;return T?m=this.demux(T,-1,!1,!0):m={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(m),this.sampleAes?this.decrypt(m,this.sampleAes):m},f.extractRemainingSamples=function(T){var m=T.audioTrack,c=T.avcTrack,u=T.id3Track,a=c.pesData,E=m.pesData,g=u.pesData,p;a&&(p=o(a))?(this.parseAVCPES(p,!0),c.pesData=null):c.pesData=a,E&&(p=o(E))?(m.isAAC?this.parseAACPES(p):this.parseMPEGPES(p),m.pesData=null):(E!=null&&E.size&&h.logger.log("last AAC PES packet truncated,might overlap between fragments"),m.pesData=E),g&&(p=o(g))?(this.parseID3PES(p),u.pesData=null):u.pesData=g},f.demuxSampleAes=function(T,m,c){var u=this.demux(T,c,!0,!this.config.progressive),a=this.sampleAes=new I.default(this.observer,this.config,m);return this.decrypt(u,a)},f.decrypt=function(T,m){return new Promise(function(c){var u=T.audioTrack,a=T.avcTrack;u.samples&&u.isAAC?m.decryptAacSamples(u.samples,0,function(){a.samples?m.decryptAvcSamples(a.samples,0,0,function(){c(T)}):c(T)}):a.samples&&m.decryptAvcSamples(a.samples,0,0,function(){c(T)})})},f.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},f.parseAVCPES=function(T,m){var c=this,u=this._avcTrack,a=this.parseAVCNALu(T.data),E=!1,g=this.avcSample,p,_=!1;T.data=null,g&&a.length&&!u.audFound&&(l(g,u),g=this.avcSample=x(!1,T.pts,T.dts,"")),a.forEach(function(U){switch(U.type){case 1:{p=!0,g||(g=c.avcSample=x(!0,T.pts,T.dts,"")),E&&(g.debug+="NDR "),g.frame=!0;var B=U.data;if(_&&B.length>4){var W=new O.default(B).readSliceType();(W===2||W===4||W===7||W===9)&&(g.key=!0)}break}case 5:p=!0,g||(g=c.avcSample=x(!0,T.pts,T.dts,"")),E&&(g.debug+="IDR "),g.key=!0,g.frame=!0;break;case 6:{p=!0,E&&g&&(g.debug+="SEI ");var k=new O.default(S(U.data));k.readUByte();for(var M=0,H=0,X=!1,ee=0;!X&&k.bytesAvailable>1;){M=0;do ee=k.readUByte(),M+=ee;while(ee===255);H=0;do ee=k.readUByte(),H+=ee;while(ee===255);if(M===4&&k.bytesAvailable!==0){X=!0;var ie=k.readUByte();if(ie===181){var ve=k.readUShort();if(ve===49){var pe=k.readUInt();if(pe===1195456820){var he=k.readUByte();if(he===3){for(var ce=k.readUByte(),fe=k.readUByte(),ne=31&ce,me=[ce,fe],$=0;$<ne;$++)me.push(k.readUByte()),me.push(k.readUByte()),me.push(k.readUByte());s(c._txtTrack.samples,{type:3,pts:T.pts,bytes:me})}}}}}else if(M===5&&k.bytesAvailable!==0){if(X=!0,H>16){for(var ae=[],q=0;q<16;q++)ae.push(k.readUByte().toString(16)),(q===3||q===5||q===7||q===9)&&ae.push("-");for(var Ee=H-16,Ce=new Uint8Array(Ee),ye=0;ye<Ee;ye++)Ce[ye]=k.readUByte();s(c._txtTrack.samples,{pts:T.pts,payloadType:M,uuid:ae.join(""),userData:Object(N.utf8ArrayToStr)(Ce),userDataBytes:Ce})}}else if(H<k.bytesAvailable)for(var we=0;we<H;we++)k.readUByte()}break}case 7:if(p=!0,_=!0,E&&g&&(g.debug+="SPS "),!u.sps){var Le=new O.default(U.data),ke=Le.readSPS();u.width=ke.width,u.height=ke.height,u.pixelRatio=ke.pixelRatio,u.sps=[U.data],u.duration=c._duration;for(var Fe=U.data.subarray(1,4),Me="avc1.",Pe=0;Pe<3;Pe++){var Ze=Fe[Pe].toString(16);Ze.length<2&&(Ze="0"+Ze),Me+=Ze}u.codec=Me}break;case 8:p=!0,E&&g&&(g.debug+="PPS "),u.pps||(u.pps=[U.data]);break;case 9:p=!1,u.audFound=!0,g&&l(g,u),g=c.avcSample=x(!1,T.pts,T.dts,E?"AUD ":"");break;case 12:p=!1;break;default:p=!1,g&&(g.debug+="unknown NAL "+U.type+" ");break}if(g&&p){var qe=g.units;qe.push(U)}}),m&&g&&(l(g,u),this.avcSample=null)},f.getLastNalUnit=function(){var T,m=this.avcSample,c;if(!m||m.units.length===0){var u=this._avcTrack.samples;m=u[u.length-1]}if((T=m)!==null&&T!==void 0&&T.units){var a=m.units;c=a[a.length-1]}return c},f.parseAVCNALu=function(T){var m=T.byteLength,c=this._avcTrack,u=c.naluState||0,a=u,E=[],g=0,p,_,U,B=-1,W=0;for(u===-1&&(B=0,W=T[0]&31,u=0,g=1);g<m;){if(p=T[g++],!u){u=p?0:1;continue}if(u===1){u=p?0:2;continue}if(!p)u=3;else if(p===1){if(B>=0){var k={data:T.subarray(B,g-u-1),type:W};E.push(k)}else{var M=this.getLastNalUnit();if(M&&(a&&g<=4-a&&(M.state&&(M.data=M.data.subarray(0,M.data.byteLength-a))),_=g-u-1,_>0)){var H=new Uint8Array(M.data.byteLength+_);H.set(M.data,0),H.set(T.subarray(0,_),M.data.byteLength),M.data=H,M.state=0}}g<m?(U=T[g]&31,B=g,W=U,u=0):u=-1}else u=0}if(B>=0&&u>=0){var X={data:T.subarray(B,m),type:W,state:u};E.push(X)}if(E.length===0){var ee=this.getLastNalUnit();if(ee){var ie=new Uint8Array(ee.data.byteLength+T.byteLength);ie.set(ee.data,0),ie.set(T,ee.data.byteLength),ee.data=ie}}return c.naluState=u,E},f.parseAACPES=function(T){var m=0,c=this._audioTrack,u=this.aacOverFlow,a=T.data;if(u){this.aacOverFlow=null;var E=u.sample.unit.byteLength,g=Math.min(u.missing,E),p=E-g;u.sample.unit.set(a.subarray(0,g),p),c.samples.push(u.sample),m=u.missing}var _,U;for(_=m,U=a.length;_<U-1&&!K.isHeader(a,_);_++);if(_!==m){var B,W;if(_<U-1?(B="AAC PES did not start with ADTS header,offset:"+_,W=!1):(B="no ADTS header found in AAC PES",W=!0),h.logger.warn("parsing error:"+B),this.observer.emit(R.Events.ERROR,R.Events.ERROR,{type:y.ErrorTypes.MEDIA_ERROR,details:y.ErrorDetails.FRAG_PARSING_ERROR,fatal:W,reason:B}),W)return}K.initTrackConfig(c,this.observer,a,_,this.audioCodec);var k;if(T.pts!==void 0)k=T.pts;else if(u){var M=K.getFrameDuration(c.samplerate);k=u.sample.pts+M}else{h.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var H=0;_<U;)if(K.isHeader(a,_)){if(_+5<U){var X=K.appendFrame(c,a,_,k,H);if(X)if(X.missing)this.aacOverFlow=X;else{_+=X.length,H++;continue}}break}else _++},f.parseMPEGPES=function(T){var m=T.data,c=m.length,u=0,a=0,E=T.pts;if(E===void 0){h.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;a<c;)if(F.isHeader(m,a)){var g=F.appendFrame(this._audioTrack,m,a,E,u);if(g)a+=g.length,u++;else break}else a++},f.parseID3PES=function(T){if(T.pts===void 0){h.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(T)},b}();w.minProbeByteLength=188;function x(b,f,L,T){return{key:b,frame:!1,pts:f,dts:L,units:[],debug:T,length:0}}function v(b,f){return(b[f+10]&31)<<8|b[f+11]}function d(b,f,L,T){var m={audio:-1,avc:-1,id3:-1,isAAC:!0},c=(b[f+1]&15)<<8|b[f+2],u=f+3+c-4,a=(b[f+10]&15)<<8|b[f+11];for(f+=12+a;f<u;){var E=(b[f+1]&31)<<8|b[f+2];switch(b[f]){case 207:if(!T){h.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:m.audio===-1&&(m.audio=E);break;case 21:m.id3===-1&&(m.id3=E);break;case 219:if(!T){h.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:m.avc===-1&&(m.avc=E);break;case 3:case 4:L?m.audio===-1&&(m.audio=E,m.isAAC=!1):h.logger.log("MPEG audio found, not supported in this browser");break;case 36:h.logger.warn("Unsupported HEVC stream type found");break;default:break}f+=((b[f+3]&15)<<8|b[f+4])+5}return m}function o(b){var f=0,L,T,m,c,u,a=b.data;if(!b||b.size===0)return null;for(;a[0].length<19&&a.length>1;){var E=new Uint8Array(a[0].length+a[1].length);E.set(a[0]),E.set(a[1],a[0].length),a[0]=E,a.splice(1,1)}L=a[0];var g=(L[0]<<16)+(L[1]<<8)+L[2];if(g===1){if(T=(L[4]<<8)+L[5],T&&T>b.size-6)return null;var p=L[7];p&192&&(c=(L[9]&14)*536870912+(L[10]&255)*4194304+(L[11]&254)*16384+(L[12]&255)*128+(L[13]&254)/2,p&64?(u=(L[14]&14)*536870912+(L[15]&255)*4194304+(L[16]&254)*16384+(L[17]&255)*128+(L[18]&254)/2,c-u>60*9e4&&(h.logger.warn(Math.round((c-u)/9e4)+"s delta between PTS and DTS, align them"),c=u)):u=c),m=L[8];var _=m+9;if(b.size<=_)return null;b.size-=_;for(var U=new Uint8Array(b.size),B=0,W=a.length;B<W;B++){L=a[B];var k=L.byteLength;if(_)if(_>k){_-=k;continue}else L=L.subarray(_),k-=_,_=0;U.set(L,f),f+=k}return T&&(T-=m+3),{data:U,pts:c,dts:u,len:T}}return null}function l(b,f){if(b.units.length&&b.frame){if(b.pts===void 0){var L=f.samples,T=L.length;if(T){var m=L[T-1];b.pts=m.pts,b.dts=m.dts}else{f.dropped++;return}}f.samples.push(b)}b.debug.length&&h.logger.log(b.pts+"/"+b.dts+":"+b.debug)}function s(b,f){var L=b.length;if(L>0){if(f.pts>=b[L-1].pts)b.push(f);else for(var T=L-1;T>=0;T--)if(f.pts<b[T].pts){b.splice(T,0,f);break}}else b.push(f)}function S(b){for(var f=b.byteLength,L=[],T=1;T<f-2;)b[T]===0&&b[T+1]===0&&b[T+2]===3?(L.push(T+2),T+=2):T++;if(L.length===0)return b;var m=f-L.length,c=new Uint8Array(m),u=0;for(T=0;T<m;u++,T++)u===L[0]&&(u++,L.shift()),c[T]=b[u];return c}z.default=w},"./src/errors.ts":function(J,z,D){"use strict";D.r(z),D.d(z,"ErrorTypes",function(){return K}),D.d(z,"ErrorDetails",function(){return F});var K;(function(O){O.NETWORK_ERROR="networkError",O.MEDIA_ERROR="mediaError",O.KEY_SYSTEM_ERROR="keySystemError",O.MUX_ERROR="muxError",O.OTHER_ERROR="otherError"})(K||(K={}));var F;(function(O){O.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",O.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",O.KEY_SYSTEM_NO_SESSION="keySystemNoSession",O.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",O.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",O.MANIFEST_LOAD_ERROR="manifestLoadError",O.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",O.MANIFEST_PARSING_ERROR="manifestParsingError",O.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",O.LEVEL_EMPTY_ERROR="levelEmptyError",O.LEVEL_LOAD_ERROR="levelLoadError",O.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",O.LEVEL_SWITCH_ERROR="levelSwitchError",O.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",O.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",O.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",O.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",O.FRAG_LOAD_ERROR="fragLoadError",O.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",O.FRAG_DECRYPT_ERROR="fragDecryptError",O.FRAG_PARSING_ERROR="fragParsingError",O.REMUX_ALLOC_ERROR="remuxAllocError",O.KEY_LOAD_ERROR="keyLoadError",O.KEY_LOAD_TIMEOUT="keyLoadTimeOut",O.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",O.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",O.BUFFER_APPEND_ERROR="bufferAppendError",O.BUFFER_APPENDING_ERROR="bufferAppendingError",O.BUFFER_STALLED_ERROR="bufferStalledError",O.BUFFER_FULL_ERROR="bufferFullError",O.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",O.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",O.INTERNAL_EXCEPTION="internalException",O.INTERNAL_ABORTED="aborted",O.UNKNOWN="unknown"})(F||(F={}))},"./src/events.ts":function(J,z,D){"use strict";D.r(z),D.d(z,"Events",function(){return K});var K;(function(F){F.MEDIA_ATTACHING="hlsMediaAttaching",F.MEDIA_ATTACHED="hlsMediaAttached",F.MEDIA_DETACHING="hlsMediaDetaching",F.MEDIA_DETACHED="hlsMediaDetached",F.BUFFER_RESET="hlsBufferReset",F.BUFFER_CODECS="hlsBufferCodecs",F.BUFFER_CREATED="hlsBufferCreated",F.BUFFER_APPENDING="hlsBufferAppending",F.BUFFER_APPENDED="hlsBufferAppended",F.BUFFER_EOS="hlsBufferEos",F.BUFFER_FLUSHING="hlsBufferFlushing",F.BUFFER_FLUSHED="hlsBufferFlushed",F.MANIFEST_LOADING="hlsManifestLoading",F.MANIFEST_LOADED="hlsManifestLoaded",F.MANIFEST_PARSED="hlsManifestParsed",F.LEVEL_SWITCHING="hlsLevelSwitching",F.LEVEL_SWITCHED="hlsLevelSwitched",F.LEVEL_LOADING="hlsLevelLoading",F.LEVEL_LOADED="hlsLevelLoaded",F.LEVEL_UPDATED="hlsLevelUpdated",F.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",F.LEVELS_UPDATED="hlsLevelsUpdated",F.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",F.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",F.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",F.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",F.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",F.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",F.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",F.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",F.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",F.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",F.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",F.CUES_PARSED="hlsCuesParsed",F.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",F.INIT_PTS_FOUND="hlsInitPtsFound",F.FRAG_LOADING="hlsFragLoading",F.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",F.FRAG_LOADED="hlsFragLoaded",F.FRAG_DECRYPTED="hlsFragDecrypted",F.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",F.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",F.FRAG_PARSING_METADATA="hlsFragParsingMetadata",F.FRAG_PARSED="hlsFragParsed",F.FRAG_BUFFERED="hlsFragBuffered",F.FRAG_CHANGED="hlsFragChanged",F.FPS_DROP="hlsFpsDrop",F.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",F.ERROR="hlsError",F.DESTROYING="hlsDestroying",F.KEY_LOADING="hlsKeyLoading",F.KEY_LOADED="hlsKeyLoaded",F.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",F.BACK_BUFFER_REACHED="hlsBackBufferReached"})(K||(K={}))},"./src/hls.ts":function(J,z,D){"use strict";D.r(z),D.d(z,"default",function(){return b});var K=D("./node_modules/url-toolkit/src/url-toolkit.js"),F=D.n(K),O=D("./src/loader/playlist-loader.ts"),N=D("./src/loader/key-loader.ts"),I=D("./src/controller/id3-track-controller.ts"),R=D("./src/controller/latency-controller.ts"),C=D("./src/controller/level-controller.ts"),h=D("./src/controller/fragment-tracker.ts"),y=D("./src/controller/stream-controller.ts"),P=D("./src/is-supported.ts"),w=D("./src/utils/logger.ts"),x=D("./src/config.ts"),v=D("./node_modules/eventemitter3/index.js"),d=D.n(v),o=D("./src/events.ts"),l=D("./src/errors.ts");function s(f,L){for(var T=0;T<L.length;T++){var m=L[T];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(f,m.key,m)}}function S(f,L,T){return L&&s(f.prototype,L),T&&s(f,T),f}var b=function(){f.isSupported=function(){return Object(P.isSupported)()};function f(T){T===void 0&&(T={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new v.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 m=this.config=Object(x.mergeConfig)(f.DefaultConfig,T);this.userConfig=T,Object(w.enableLogs)(m.debug),this._autoLevelCapping=-1,m.progressive&&Object(x.enableStreamingMode)(m);var c=m.abrController,u=m.bufferController,a=m.capLevelController,E=m.fpsController,g=this.abrController=new c(this),p=this.bufferController=new u(this),_=this.capLevelController=new a(this),U=new E(this),B=new O.default(this),W=new N.default(this),k=new I.default(this),M=this.levelController=new C.default(this),H=new h.FragmentTracker(this),X=this.streamController=new y.default(this,H);_.setStreamController(X),U.setStreamController(X);var ee=[M,X];this.networkControllers=ee;var ie=[B,W,g,p,_,U,k,H];this.audioTrackController=this.createController(m.audioTrackController,null,ee),this.createController(m.audioStreamController,H,ee),this.subtitleTrackController=this.createController(m.subtitleTrackController,null,ee),this.createController(m.subtitleStreamController,H,ee),this.createController(m.timelineController,null,ie),this.emeController=this.createController(m.emeController,null,ie),this.cmcdController=this.createController(m.cmcdController,null,ie),this.latencyController=this.createController(R.default,null,ie),this.coreComponents=ie}var L=f.prototype;return L.createController=function(m,c,u){if(m){var a=c?new m(this,c):new m(this);return u&&u.push(a),a}return null},L.on=function(m,c,u){u===void 0&&(u=this),this._emitter.on(m,c,u)},L.once=function(m,c,u){u===void 0&&(u=this),this._emitter.once(m,c,u)},L.removeAllListeners=function(m){this._emitter.removeAllListeners(m)},L.off=function(m,c,u,a){u===void 0&&(u=this),this._emitter.off(m,c,u,a)},L.listeners=function(m){return this._emitter.listeners(m)},L.emit=function(m,c,u){return this._emitter.emit(m,c,u)},L.trigger=function(m,c){if(this.config.debug)return this.emit(m,m,c);try{return this.emit(m,m,c)}catch(u){w.logger.error("An internal error happened while handling event "+m+'. Error message: "'+u.message+'". Here is a stacktrace:',u),this.trigger(o.Events.ERROR,{type:l.ErrorTypes.OTHER_ERROR,details:l.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:m,error:u})}return!1},L.listenerCount=function(m){return this._emitter.listenerCount(m)},L.destroy=function(){w.logger.log("destroy"),this.trigger(o.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(m){return m.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(m){return m.destroy()}),this.coreComponents.length=0},L.attachMedia=function(m){w.logger.log("attachMedia"),this._media=m,this.trigger(o.Events.MEDIA_ATTACHING,{media:m})},L.detachMedia=function(){w.logger.log("detachMedia"),this.trigger(o.Events.MEDIA_DETACHING,void 0),this._media=null},L.loadSource=function(m){this.stopLoad();var c=this.media,u=this.url,a=this.url=K.buildAbsoluteURL(self.location.href,m,{alwaysNormalize:!0});w.logger.log("loadSource:"+a),c&&u&&u!==a&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(c)),this.trigger(o.Events.MANIFEST_LOADING,{url:m})},L.startLoad=function(m){m===void 0&&(m=-1),w.logger.log("startLoad("+m+")"),this.networkControllers.forEach(function(c){c.startLoad(m)})},L.stopLoad=function(){w.logger.log("stopLoad"),this.networkControllers.forEach(function(m){m.stopLoad()})},L.swapAudioCodec=function(){w.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},L.recoverMediaError=function(){w.logger.log("recoverMediaError");var m=this._media;this.detachMedia(),m&&this.attachMedia(m)},L.removeLevel=function(m,c){c===void 0&&(c=0),this.levelController.removeLevel(m,c)},S(f,[{key:"levels",get:function(){var m=this.levelController.levels;return m||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(m){w.logger.log("set currentLevel:"+m),this.loadLevel=m,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(m){w.logger.log("set nextLevel:"+m),this.levelController.manualLevel=m,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(m){w.logger.log("set loadLevel:"+m),this.levelController.manualLevel=m}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(m){this.levelController.nextLoadLevel=m}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(m){w.logger.log("set firstLevel:"+m),this.levelController.firstLevel=m}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(m){w.logger.log("set startLevel:"+m),m!==-1&&(m=Math.max(m,this.minAutoLevel)),this.levelController.startLevel=m}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(m){var c=!!m;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(m){this._autoLevelCapping!==m&&(w.logger.log("set autoLevelCapping:"+m),this._autoLevelCapping=m)}},{key:"bandwidthEstimate",get:function(){var m=this.abrController.bwEstimator;return m?m.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var m=this.levels,c=this.config.minAutoBitrate;if(!m)return 0;for(var u=m.length,a=0;a<u;a++)if(m[a].maxBitrate>c)return a;return 0}},{key:"maxAutoLevel",get:function(){var m=this.levels,c=this.autoLevelCapping,u;return c===-1&&m&&m.length?u=m.length-1:u=c,u}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(m){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,m)}},{key:"audioTracks",get:function(){var m=this.audioTrackController;return m?m.audioTracks:[]}},{key:"audioTrack",get:function(){var m=this.audioTrackController;return m?m.audioTrack:-1},set:function(m){var c=this.audioTrackController;c&&(c.audioTrack=m)}},{key:"subtitleTracks",get:function(){var m=this.subtitleTrackController;return m?m.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var m=this.subtitleTrackController;return m?m.subtitleTrack:-1},set:function(m){var c=this.subtitleTrackController;c&&(c.subtitleTrack=m)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var m=this.subtitleTrackController;return m?m.subtitleDisplay:!1},set:function(m){var c=this.subtitleTrackController;c&&(c.subtitleDisplay=m)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(m){this.config.lowLatencyMode=m}},{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 l.ErrorTypes}},{key:"ErrorDetails",get:function(){return l.ErrorDetails}},{key:"DefaultConfig",get:function(){return f.defaultConfig?f.defaultConfig:x.hlsDefaultConfig},set:function(m){f.defaultConfig=m}}]),f}();b.defaultConfig=void 0},"./src/is-supported.ts":function(J,z,D){"use strict";D.r(z),D.d(z,"isSupported",function(){return O}),D.d(z,"changeTypeSupported",function(){return N});var K=D("./src/utils/mediasource-helper.ts");function F(){return self.SourceBuffer||self.WebKitSourceBuffer}function O(){var I=Object(K.getMediaSource)();if(!I)return!1;var R=F(),C=I&&typeof I.isTypeSupported=="function"&&I.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),h=!R||R.prototype&&typeof R.prototype.appendBuffer=="function"&&typeof R.prototype.remove=="function";return!!C&&!!h}function N(){var I,R=F();return typeof(R==null||((I=R.prototype)===null||I===void 0)?void 0:I.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(J,z,D){"use strict";D.r(z),D.d(z,"default",function(){return w}),D.d(z,"LoadError",function(){return v});var K=D("./src/polyfills/number.ts"),F=D("./src/errors.ts");function O(d,o){d.prototype=Object.create(o.prototype),d.prototype.constructor=d,h(d,o)}function N(d){var o=typeof Map=="function"?new Map:void 0;return N=function(s){if(s===null||!C(s))return s;if(typeof s!="function")throw new TypeError("Super expression must either be null or a function");if(typeof o!="undefined"){if(o.has(s))return o.get(s);o.set(s,S)}function S(){return I(s,arguments,y(this).constructor)}return S.prototype=Object.create(s.prototype,{constructor:{value:S,enumerable:!1,writable:!0,configurable:!0}}),h(S,s)},N(d)}function I(d,o,l){return R()?I=Reflect.construct:I=function(S,b,f){var L=[null];L.push.apply(L,b);var T=Function.bind.apply(S,L),m=new T;return f&&h(m,f.prototype),m},I.apply(null,arguments)}function R(){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 C(d){return Function.toString.call(d).indexOf("[native code]")!==-1}function h(d,o){return h=Object.setPrototypeOf||function(s,S){return s.__proto__=S,s},h(d,o)}function y(d){return y=Object.setPrototypeOf?Object.getPrototypeOf:function(l){return l.__proto__||Object.getPrototypeOf(l)},y(d)}var P=Math.pow(2,17),w=function(){function d(l){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=l}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(s,S){var b=this,f=s.url;if(!f)return Promise.reject(new v({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:s,networkDetails:null},"Fragment does not have a "+(f?"part list":"url")));this.abort();var L=this.config,T=L.fLoader,m=L.loader;return new Promise(function(c,u){b.loader&&b.loader.destroy();var a=b.loader=s.loader=T?new T(L):new m(L),E=x(s),g={timeout:L.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:L.fragLoadingMaxRetryTimeout,highWaterMark:P};s.stats=a.stats,a.load(E,g,{onSuccess:function(_,U,B,W){b.resetLoader(s,a),c({frag:s,part:null,payload:_.data,networkDetails:W})},onError:function(_,U,B){b.resetLoader(s,a),u(new v({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:s,response:_,networkDetails:B}))},onAbort:function(_,U,B){b.resetLoader(s,a),u(new v({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:s,networkDetails:B}))},onTimeout:function(_,U,B){b.resetLoader(s,a),u(new v({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:s,networkDetails:B}))},onProgress:function(_,U,B,W){S&&S({frag:s,part:null,payload:B,networkDetails:W})}})})},o.loadPart=function(s,S,b){var f=this;this.abort();var L=this.config,T=L.fLoader,m=L.loader;return new Promise(function(c,u){f.loader&&f.loader.destroy();var a=f.loader=s.loader=T?new T(L):new m(L),E=x(s,S),g={timeout:L.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:L.fragLoadingMaxRetryTimeout,highWaterMark:P};S.stats=a.stats,a.load(E,g,{onSuccess:function(_,U,B,W){f.resetLoader(s,a),f.updateStatsFromPart(s,S);var k={frag:s,part:S,payload:_.data,networkDetails:W};b(k),c(k)},onError:function(_,U,B){f.resetLoader(s,a),u(new v({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:s,part:S,response:_,networkDetails:B}))},onAbort:function(_,U,B){s.stats.aborted=S.stats.aborted,f.resetLoader(s,a),u(new v({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:s,part:S,networkDetails:B}))},onTimeout:function(_,U,B){f.resetLoader(s,a),u(new v({type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:s,part:S,networkDetails:B}))}})})},o.updateStatsFromPart=function(s,S){var b=s.stats,f=S.stats,L=f.total;if(b.loaded+=f.loaded,L){var T=Math.round(s.duration/S.duration),m=Math.min(Math.round(b.loaded/L),T),c=T-m,u=c*Math.round(b.loaded/m);b.total=b.loaded+u}else b.total=Math.max(b.loaded,b.total);var a=b.loading,E=f.loading;a.start?a.first+=E.first-E.start:(a.start=E.start,a.first=E.first),a.end=E.end},o.resetLoader=function(s,S){s.loader=null,this.loader===S&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),S.destroy()},d}();function x(d,o){o===void 0&&(o=null);var l=o||d,s={frag:d,part:o,responseType:"arraybuffer",url:l.url,headers:{},rangeStart:0,rangeEnd:0},S=l.byteRangeStartOffset,b=l.byteRangeEndOffset;return Object(K.isFiniteNumber)(S)&&Object(K.isFiniteNumber)(b)&&(s.rangeStart=S,s.rangeEnd=b),s}var v=function(d){O(o,d);function o(l){for(var s,S=arguments.length,b=new Array(S>1?S-1:0),f=1;f<S;f++)b[f-1]=arguments[f];return s=d.call.apply(d,[this].concat(b))||this,s.data=void 0,s.data=l,s}return o}(N(Error))},"./src/loader/fragment.ts":function(J,z,D){"use strict";D.r(z),D.d(z,"ElementaryStreamTypes",function(){return w}),D.d(z,"BaseSegment",function(){return x}),D.d(z,"Fragment",function(){return v}),D.d(z,"Part",function(){return d});var K=D("./src/polyfills/number.ts"),F=D("./node_modules/url-toolkit/src/url-toolkit.js"),O=D.n(F),N=D("./src/utils/logger.ts"),I=D("./src/loader/level-key.ts"),R=D("./src/loader/load-stats.ts");function C(o,l){o.prototype=Object.create(l.prototype),o.prototype.constructor=o,h(o,l)}function h(o,l){return h=Object.setPrototypeOf||function(S,b){return S.__proto__=b,S},h(o,l)}function y(o,l){for(var s=0;s<l.length;s++){var S=l[s];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(o,S.key,S)}}function P(o,l,s){return l&&y(o.prototype,l),s&&y(o,s),o}var w;(function(o){o.AUDIO="audio",o.VIDEO="video",o.AUDIOVIDEO="audiovideo"})(w||(w={}));var x=function(){function o(s){var S;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(S={},S[w.AUDIO]=null,S[w.VIDEO]=null,S[w.AUDIOVIDEO]=null,S),this.baseurl=s}var l=o.prototype;return l.setByteRange=function(S,b){var f=S.split("@",2),L=[];f.length===1?L[0]=b?b.byteRangeEndOffset:0:L[0]=parseInt(f[1]),L[1]=parseInt(f[0])+L[0],this._byteRange=L},P(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(F.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(S){this._url=S}}]),o}(),v=function(o){C(l,o);function l(S,b){var f;return f=o.call(this,b)||this,f._decryptdata=null,f.rawProgramDateTime=null,f.programDateTime=null,f.tagList=[],f.duration=0,f.sn=0,f.levelkey=void 0,f.type=void 0,f.loader=null,f.level=-1,f.cc=0,f.startPTS=void 0,f.endPTS=void 0,f.appendedPTS=void 0,f.startDTS=void 0,f.endDTS=void 0,f.start=0,f.deltaPTS=void 0,f.maxStartPTS=void 0,f.minEndPTS=void 0,f.stats=new R.LoadStats,f.urlId=0,f.data=void 0,f.bitrateTest=!1,f.title=null,f.initSegment=null,f.type=S,f}var s=l.prototype;return s.createInitializationVector=function(b){for(var f=new Uint8Array(16),L=12;L<16;L++)f[L]=b>>8*(15-L)&255;return f},s.setDecryptDataFromLevelKey=function(b,f){var L=b;return(b==null?void 0:b.method)==="AES-128"&&b.uri&&!b.iv&&(L=I.LevelKey.fromURI(b.uri),L.method=b.method,L.iv=this.createInitializationVector(f),L.keyFormat="identity"),L},s.setElementaryStreamInfo=function(b,f,L,T,m,c){c===void 0&&(c=!1);var u=this.elementaryStreams,a=u[b];if(!a){u[b]={startPTS:f,endPTS:L,startDTS:T,endDTS:m,partial:c};return}a.startPTS=Math.min(a.startPTS,f),a.endPTS=Math.max(a.endPTS,L),a.startDTS=Math.min(a.startDTS,T),a.endDTS=Math.max(a.endDTS,m)},s.clearElementaryStreamInfo=function(){var b=this.elementaryStreams;b[w.AUDIO]=null,b[w.VIDEO]=null,b[w.AUDIOVIDEO]=null},P(l,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var b=this.sn;typeof b!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&N.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),b=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,b)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(K.isFiniteNumber)(this.programDateTime))return null;var b=Object(K.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+b*1e3}},{key:"encrypted",get:function(){var b;return!!((b=this.decryptdata)!==null&&b!==void 0&&b.keyFormat&&this.decryptdata.uri)}}]),l}(x),d=function(o){C(l,o);function l(s,S,b,f,L){var T;T=o.call(this,b)||this,T.fragOffset=0,T.duration=0,T.gap=!1,T.independent=!1,T.relurl=void 0,T.fragment=void 0,T.index=void 0,T.stats=new R.LoadStats,T.duration=s.decimalFloatingPoint("DURATION"),T.gap=s.bool("GAP"),T.independent=s.bool("INDEPENDENT"),T.relurl=s.enumeratedString("URI"),T.fragment=S,T.index=f;var m=s.enumeratedString("BYTERANGE");return m&&T.setByteRange(m,L),L&&(T.fragOffset=L.fragOffset+L.duration),T}return P(l,[{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)}}]),l}(x)},"./src/loader/key-loader.ts":function(J,z,D){"use strict";D.r(z),D.d(z,"default",function(){return N});var K=D("./src/events.ts"),F=D("./src/errors.ts"),O=D("./src/utils/logger.ts"),N=function(){function I(C){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=C,this._registerListeners()}var R=I.prototype;return R._registerListeners=function(){this.hls.on(K.Events.KEY_LOADING,this.onKeyLoading,this)},R._unregisterListeners=function(){this.hls.off(K.Events.KEY_LOADING,this.onKeyLoading)},R.destroy=function(){this._unregisterListeners();for(var h in this.loaders){var y=this.loaders[h];y&&y.destroy()}this.loaders={}},R.onKeyLoading=function(h,y){var P=y.frag,w=P.type,x=this.loaders[w];if(!P.decryptdata){O.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var v=P.decryptdata.uri;if(v!==this.decrypturl||this.decryptkey===null){var d=this.hls.config;if(x&&(O.logger.warn("abort previous key loader for type:"+w),x.abort()),!v){O.logger.warn("key uri is falsy");return}var o=d.loader,l=P.loader=this.loaders[w]=new o(d);this.decrypturl=v,this.decryptkey=null;var s={url:v,frag:P,responseType:"arraybuffer"},S={timeout:d.fragLoadingTimeOut,maxRetry:0,retryDelay:d.fragLoadingRetryDelay,maxRetryDelay:d.fragLoadingMaxRetryTimeout,highWaterMark:0},b={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};l.load(s,S,b)}else this.decryptkey&&(P.decryptdata.key=this.decryptkey,this.hls.trigger(K.Events.KEY_LOADED,{frag:P}))},R.loadsuccess=function(h,y,P){var w=P.frag;if(!w.decryptdata){O.logger.error("after key load, decryptdata unset");return}this.decryptkey=w.decryptdata.key=new Uint8Array(h.data),w.loader=null,delete this.loaders[w.type],this.hls.trigger(K.Events.KEY_LOADED,{frag:w})},R.loaderror=function(h,y){var P=y.frag,w=P.loader;w&&w.abort(),delete this.loaders[P.type],this.hls.trigger(K.Events.ERROR,{type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:P,response:h})},R.loadtimeout=function(h,y){var P=y.frag,w=P.loader;w&&w.abort(),delete this.loaders[P.type],this.hls.trigger(K.Events.ERROR,{type:F.ErrorTypes.NETWORK_ERROR,details:F.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:P})},I}()},"./src/loader/level-details.ts":function(J,z,D){"use strict";D.r(z),D.d(z,"LevelDetails",function(){return I});var K=D("./src/polyfills/number.ts");function F(R,C){for(var h=0;h<C.length;h++){var y=C[h];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(R,y.key,y)}}function O(R,C,h){return C&&F(R.prototype,C),h&&F(R,h),R}var N=10,I=function(){function R(h){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=h}var C=R.prototype;return C.reloaded=function(y){if(!y){this.advanced=!0,this.updated=!0;return}var P=this.lastPartSn-y.lastPartSn,w=this.lastPartIndex-y.lastPartIndex;this.updated=this.endSN!==y.endSN||!!w||!!P,this.advanced=this.endSN>y.endSN||P>0||P===0&&w>0,this.updated||this.advanced?this.misses=Math.floor(y.misses*.6):this.misses=y.misses+1,this.availabilityDelay=y.availabilityDelay},O(R,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(K.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||N}},{key:"drift",get:function(){var y=this.driftEndTime-this.driftStartTime;if(y>0){var P=this.driftEnd-this.driftStart;return P*1e3/y}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var y;return(y=this.partList)!==null&&y!==void 0&&y.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var y;return(y=this.fragments)!==null&&y!==void 0&&y.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 y;return(y=this.partList)!==null&&y!==void 0&&y.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var y;return(y=this.partList)!==null&&y!==void 0&&y.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),R}()},"./src/loader/level-key.ts":function(J,z,D){"use strict";D.r(z),D.d(z,"LevelKey",function(){return I});var K=D("./node_modules/url-toolkit/src/url-toolkit.js"),F=D.n(K);function O(R,C){for(var h=0;h<C.length;h++){var y=C[h];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(R,y.key,y)}}function N(R,C,h){return C&&O(R.prototype,C),h&&O(R,h),R}var I=function(){R.fromURL=function(h,y){return new R(h,y)},R.fromURI=function(h){return new R(h)};function R(C,h){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,h?this._uri=Object(K.buildAbsoluteURL)(C,h,{alwaysNormalize:!0}):this._uri=C}return N(R,[{key:"uri",get:function(){return this._uri}}]),R}()},"./src/loader/load-stats.ts":function(J,z,D){"use strict";D.r(z),D.d(z,"LoadStats",function(){return K});var K=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(J,z,D){"use strict";D.r(z),D.d(z,"default",function(){return l});var K=D("./src/polyfills/number.ts"),F=D("./node_modules/url-toolkit/src/url-toolkit.js"),O=D.n(F),N=D("./src/loader/fragment.ts"),I=D("./src/loader/level-details.ts"),R=D("./src/loader/level-key.ts"),C=D("./src/utils/attr-list.ts"),h=D("./src/utils/logger.ts"),y=D("./src/utils/codecs.ts"),P=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,w=/#EXT-X-MEDIA:(.*)/g,x=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),v=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(L){var T,m;return d.test((T=(m=F.parseURL(L))===null||m===void 0?void 0:m.path)!=null?T:"")}var l=function(){function L(){}return L.findGroup=function(m,c){for(var u=0;u<m.length;u++){var a=m[u];if(a.id===c)return a}},L.convertAVC1ToAVCOTI=function(m){var c=m.split(".");if(c.length>2){var u=c.shift()+".";return u+=parseInt(c.shift()).toString(16),u+=("000"+parseInt(c.shift()).toString(16)).substr(-4),u}return m},L.resolve=function(m,c){return F.buildAbsoluteURL(c,m,{alwaysNormalize:!0})},L.parseMasterPlaylist=function(m,c){var u=[],a={},E=!1;P.lastIndex=0;for(var g;(g=P.exec(m))!=null;)if(g[1]){var p=new C.AttrList(g[1]),_={attrs:p,bitrate:p.decimalInteger("AVERAGE-BANDWIDTH")||p.decimalInteger("BANDWIDTH"),name:p.NAME,url:L.resolve(g[2],c)},U=p.decimalResolution("RESOLUTION");U&&(_.width=U.width,_.height=U.height),s((p.CODECS||"").split(/[ ,]+/).filter(function(W){return W}),_),_.videoCodec&&_.videoCodec.indexOf("avc1")!==-1&&(_.videoCodec=L.convertAVC1ToAVCOTI(_.videoCodec)),u.push(_)}else if(g[3]){var B=new C.AttrList(g[3]);B["DATA-ID"]&&(E=!0,a[B["DATA-ID"]]=B)}return{levels:u,sessionData:E?a:null}},L.parseMasterPlaylistMedia=function(m,c,u,a){a===void 0&&(a=[]);var E,g=[],p=0;for(w.lastIndex=0;(E=w.exec(m))!==null;){var _=new C.AttrList(E[1]);if(_.TYPE===u){var U={attrs:_,bitrate:0,id:p++,groupId:_["GROUP-ID"],instreamId:_["INSTREAM-ID"],name:_.NAME||_.LANGUAGE||"",type:u,default:_.bool("DEFAULT"),autoselect:_.bool("AUTOSELECT"),forced:_.bool("FORCED"),lang:_.LANGUAGE,url:_.URI?L.resolve(_.URI,c):""};if(a.length){var B=L.findGroup(a,U.groupId)||a[0];S(U,B,"audioCodec"),S(U,B,"textCodec")}g.push(U)}}return g},L.parseLevelPlaylist=function(m,c,u,a,E){var g=new I.LevelDetails(c),p=g.fragments,_=null,U=0,B=0,W=0,k=0,M=null,H=new N.Fragment(a,c),X,ee,ie,ve=-1,pe=!1;for(x.lastIndex=0,g.m3u8=m;(X=x.exec(m))!==null;){pe&&(pe=!1,H=new N.Fragment(a,c),H.start=W,H.sn=U,H.cc=k,H.level=u,_&&(H.initSegment=_,H.rawProgramDateTime=_.rawProgramDateTime));var he=X[1];if(he){H.duration=parseFloat(he);var ce=(" "+X[2]).slice(1);H.title=ce||null,H.tagList.push(ce?["INF",he,ce]:["INF",he])}else if(X[3])Object(K.isFiniteNumber)(H.duration)&&(H.start=W,ie&&(H.levelkey=ie),H.sn=U,H.level=u,H.cc=k,H.urlId=E,p.push(H),H.relurl=(" "+X[3]).slice(1),f(H,M),M=H,W+=H.duration,U++,B=0,pe=!0);else if(X[4]){var fe=(" "+X[4]).slice(1);M?H.setByteRange(fe,M):H.setByteRange(fe)}else if(X[5])H.rawProgramDateTime=(" "+X[5]).slice(1),H.tagList.push(["PROGRAM-DATE-TIME",H.rawProgramDateTime]),ve===-1&&(ve=p.length);else{if(X=X[0].match(v),!X){h.logger.warn("No matches on slow regex match for level playlist!");continue}for(ee=1;ee<X.length&&!(typeof X[ee]!="undefined");ee++);var ne=(" "+X[ee]).slice(1),me=(" "+X[ee+1]).slice(1),$=X[ee+2]?(" "+X[ee+2]).slice(1):"";switch(ne){case"PLAYLIST-TYPE":g.type=me.toUpperCase();break;case"MEDIA-SEQUENCE":U=g.startSN=parseInt(me);break;case"SKIP":{var ae=new C.AttrList(me),q=ae.decimalInteger("SKIPPED-SEGMENTS");if(Object(K.isFiniteNumber)(q)){g.skippedSegments=q;for(var Ee=q;Ee--;)p.unshift(null);U+=q}var Ce=ae.enumeratedString("RECENTLY-REMOVED-DATERANGES");Ce&&(g.recentlyRemovedDateranges=Ce.split(" "));break}case"TARGETDURATION":g.targetduration=parseFloat(me);break;case"VERSION":g.version=parseInt(me);break;case"EXTM3U":break;case"ENDLIST":g.live=!1;break;case"#":(me||$)&&H.tagList.push($?[me,$]:[me]);break;case"DIS":k++;case"GAP":H.tagList.push([ne]);break;case"BITRATE":H.tagList.push([ne,me]);break;case"DISCONTINUITY-SEQ":k=parseInt(me);break;case"KEY":{var ye,we=new C.AttrList(me),Le=we.enumeratedString("METHOD"),ke=we.URI,Fe=we.hexadecimalInteger("IV"),Me=we.enumeratedString("KEYFORMATVERSIONS"),Pe=we.enumeratedString("KEYID"),Ze=(ye=we.enumeratedString("KEYFORMAT"))!=null?ye:"identity",qe=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(qe.indexOf(Ze)>-1){h.logger.warn("Keyformat "+Ze+" is not supported from the manifest");continue}else if(Ze!=="identity")continue;Le&&(ie=R.LevelKey.fromURL(c,ke),ke&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Le)>=0&&(ie.method=Le,ie.keyFormat=Ze,Pe&&(ie.keyID=Pe),Me&&(ie.keyFormatVersions=Me),ie.iv=Fe));break}case"START":{var Ge=new C.AttrList(me),He=Ge.decimalFloatingPoint("TIME-OFFSET");Object(K.isFiniteNumber)(He)&&(g.startTimeOffset=He);break}case"MAP":{var $e=new C.AttrList(me);H.relurl=$e.URI,$e.BYTERANGE&&H.setByteRange($e.BYTERANGE),H.level=u,H.sn="initSegment",ie&&(H.levelkey=ie),H.initSegment=null,_=H,pe=!0;break}case"SERVER-CONTROL":{var We=new C.AttrList(me);g.canBlockReload=We.bool("CAN-BLOCK-RELOAD"),g.canSkipUntil=We.optionalFloat("CAN-SKIP-UNTIL",0),g.canSkipDateRanges=g.canSkipUntil>0&&We.bool("CAN-SKIP-DATERANGES"),g.partHoldBack=We.optionalFloat("PART-HOLD-BACK",0),g.holdBack=We.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var ze=new C.AttrList(me);g.partTarget=ze.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Se=g.partList;Se||(Se=g.partList=[]);var Je=B>0?Se[Se.length-1]:void 0,Qe=B++,Ae=new N.Part(new C.AttrList(me),H,c,Qe,Je);Se.push(Ae),H.duration+=Ae.duration;break}case"PRELOAD-HINT":{var Ie=new C.AttrList(me);g.preloadHint=Ie;break}case"RENDITION-REPORT":{var ge=new C.AttrList(me);g.renditionReports=g.renditionReports||[],g.renditionReports.push(ge);break}default:h.logger.warn("line parsed but not handled: "+X);break}}}M&&!M.relurl?(p.pop(),W-=M.duration,g.partList&&(g.fragmentHint=M)):g.partList&&(f(H,M),H.cc=k,g.fragmentHint=H);var le=p.length,de=p[0],Q=p[le-1];if(W+=g.skippedSegments*g.targetduration,W>0&&le&&Q){g.averagetargetduration=W/le;var Z=Q.sn;g.endSN=Z!=="initSegment"?Z:0,de&&(g.startCC=de.cc,de.initSegment||g.fragments.every(function(re){return re.relurl&&o(re.relurl)})&&(h.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),H=new N.Fragment(a,c),H.relurl=Q.relurl,H.level=u,H.sn="initSegment",de.initSegment=H,g.needSidxRanges=!0))}else g.endSN=0,g.startCC=0;return g.fragmentHint&&(W+=g.fragmentHint.duration),g.totalduration=W,g.endCC=k,ve>0&&b(p,ve),g},L}();function s(L,T){["video","audio","text"].forEach(function(m){var c=L.filter(function(a){return Object(y.isCodecType)(a,m)});if(c.length){var u=c.filter(function(a){return a.lastIndexOf("avc1",0)===0||a.lastIndexOf("mp4a",0)===0});T[m+"Codec"]=u.length>0?u[0]:c[0],L=L.filter(function(a){return c.indexOf(a)===-1})}}),T.unknownCodecs=L}function S(L,T,m){var c=T[m];c&&(L[m]=c)}function b(L,T){for(var m=L[T],c=T;c--;){var u=L[c];if(!u)return;u.programDateTime=m.programDateTime-u.duration*1e3,m=u}}function f(L,T){L.rawProgramDateTime?L.programDateTime=Date.parse(L.rawProgramDateTime):T!=null&&T.programDateTime&&(L.programDateTime=T.endProgramDateTime),Object(K.isFiniteNumber)(L.programDateTime)||(L.programDateTime=null,L.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(J,z,D){"use strict";D.r(z);var K=D("./src/polyfills/number.ts"),F=D("./src/events.ts"),O=D("./src/errors.ts"),N=D("./src/utils/logger.ts"),I=D("./src/utils/mp4-tools.ts"),R=D("./src/loader/m3u8-parser.ts"),C=D("./src/types/loader.ts"),h=D("./src/utils/attr-list.ts");function y(x){var v=x.type;switch(v){case C.PlaylistContextType.AUDIO_TRACK:return C.PlaylistLevelType.AUDIO;case C.PlaylistContextType.SUBTITLE_TRACK:return C.PlaylistLevelType.SUBTITLE;default:return C.PlaylistLevelType.MAIN}}function P(x,v){var d=x.url;return(d===void 0||d.indexOf("data:")===0)&&(d=v.url),d}var w=function(){function x(d){this.hls=void 0,this.loaders=Object.create(null),this.hls=d,this.registerListeners()}var v=x.prototype;return v.registerListeners=function(){var o=this.hls;o.on(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(F.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(F.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.on(F.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},v.unregisterListeners=function(){var o=this.hls;o.off(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(F.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(F.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.off(F.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},v.createInternalLoader=function(o){var l=this.hls.config,s=l.pLoader,S=l.loader,b=s||S,f=new b(l);return o.loader=f,this.loaders[o.type]=f,f},v.getInternalLoader=function(o){return this.loaders[o.type]},v.resetInternalLoader=function(o){this.loaders[o]&&delete this.loaders[o]},v.destroyInternalLoaders=function(){for(var o in this.loaders){var l=this.loaders[o];l&&l.destroy(),this.resetInternalLoader(o)}},v.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},v.onManifestLoading=function(o,l){var s=l.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:C.PlaylistContextType.MANIFEST,url:s,deliveryDirectives:null})},v.onLevelLoading=function(o,l){var s=l.id,S=l.level,b=l.url,f=l.deliveryDirectives;this.load({id:s,groupId:null,level:S,responseType:"text",type:C.PlaylistContextType.LEVEL,url:b,deliveryDirectives:f})},v.onAudioTrackLoading=function(o,l){var s=l.id,S=l.groupId,b=l.url,f=l.deliveryDirectives;this.load({id:s,groupId:S,level:null,responseType:"text",type:C.PlaylistContextType.AUDIO_TRACK,url:b,deliveryDirectives:f})},v.onSubtitleTrackLoading=function(o,l){var s=l.id,S=l.groupId,b=l.url,f=l.deliveryDirectives;this.load({id:s,groupId:S,level:null,responseType:"text",type:C.PlaylistContextType.SUBTITLE_TRACK,url:b,deliveryDirectives:f})},v.load=function(o){var l,s=this.hls.config,S=this.getInternalLoader(o);if(S){var b=S.context;if(b&&b.url===o.url){N.logger.trace("[playlist-loader]: playlist request ongoing");return}N.logger.log("[playlist-loader]: aborting previous loader for type: "+o.type),S.abort()}var f,L,T,m;switch(o.type){case C.PlaylistContextType.MANIFEST:f=s.manifestLoadingMaxRetry,L=s.manifestLoadingTimeOut,T=s.manifestLoadingRetryDelay,m=s.manifestLoadingMaxRetryTimeout;break;case C.PlaylistContextType.LEVEL:case C.PlaylistContextType.AUDIO_TRACK:case C.PlaylistContextType.SUBTITLE_TRACK:f=0,L=s.levelLoadingTimeOut;break;default:f=s.levelLoadingMaxRetry,L=s.levelLoadingTimeOut,T=s.levelLoadingRetryDelay,m=s.levelLoadingMaxRetryTimeout;break}if(S=this.createInternalLoader(o),(l=o.deliveryDirectives)!==null&&l!==void 0&&l.part){var c;if(o.type===C.PlaylistContextType.LEVEL&&o.level!==null?c=this.hls.levels[o.level].details:o.type===C.PlaylistContextType.AUDIO_TRACK&&o.id!==null?c=this.hls.audioTracks[o.id].details:o.type===C.PlaylistContextType.SUBTITLE_TRACK&&o.id!==null&&(c=this.hls.subtitleTracks[o.id].details),c){var u=c.partTarget,a=c.targetduration;u&&a&&(L=Math.min(Math.max(u*3,a*.8)*1e3,L))}}var E={timeout:L,maxRetry:f,retryDelay:T,maxRetryDelay:m,highWaterMark:0},g={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};S.load(o,E,g)},v.loadsuccess=function(o,l,s,S){if(S===void 0&&(S=null),s.isSidxRequest){this.handleSidxRequest(o,s),this.handlePlaylistLoaded(o,l,s,S);return}this.resetInternalLoader(s.type);var b=o.data;if(b.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(o,s,"no EXTM3U delimiter",S);return}l.parsing.start=performance.now(),b.indexOf("#EXTINF:")>0||b.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(o,l,s,S):this.handleMasterPlaylist(o,l,s,S)},v.loaderror=function(o,l,s){s===void 0&&(s=null),this.handleNetworkError(l,s,!1,o)},v.loadtimeout=function(o,l,s){s===void 0&&(s=null),this.handleNetworkError(l,s,!0)},v.handleMasterPlaylist=function(o,l,s,S){var b=this.hls,f=o.data,L=P(o,s),T=R.default.parseMasterPlaylist(f,L),m=T.levels,c=T.sessionData;if(!m.length){this.handleManifestParsingError(o,s,"no level found in manifest",S);return}var u=m.map(function(U){return{id:U.attrs.AUDIO,audioCodec:U.audioCodec}}),a=m.map(function(U){return{id:U.attrs.SUBTITLES,textCodec:U.textCodec}}),E=R.default.parseMasterPlaylistMedia(f,L,"AUDIO",u),g=R.default.parseMasterPlaylistMedia(f,L,"SUBTITLES",a),p=R.default.parseMasterPlaylistMedia(f,L,"CLOSED-CAPTIONS");if(E.length){var _=E.some(function(U){return!U.url});!_&&m[0].audioCodec&&!m[0].attrs.AUDIO&&(N.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),E.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new h.AttrList({}),bitrate:0,url:""}))}b.trigger(F.Events.MANIFEST_LOADED,{levels:m,audioTracks:E,subtitles:g,captions:p,url:L,stats:l,networkDetails:S,sessionData:c})},v.handleTrackOrLevelPlaylist=function(o,l,s,S){var b=this.hls,f=s.id,L=s.level,T=s.type,m=P(o,s),c=Object(K.isFiniteNumber)(f)?f:0,u=Object(K.isFiniteNumber)(L)?L:c,a=y(s),E=R.default.parseLevelPlaylist(o.data,m,u,a,c);if(!E.fragments.length){b.trigger(F.Events.ERROR,{type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:m,reason:"no fragments found in level",level:typeof s.level=="number"?s.level:void 0});return}if(T===C.PlaylistContextType.MANIFEST){var g={attrs:new h.AttrList({}),bitrate:0,details:E,name:"",url:m};b.trigger(F.Events.MANIFEST_LOADED,{levels:[g],audioTracks:[],url:m,stats:l,networkDetails:S,sessionData:null})}if(l.parsing.end=performance.now(),E.needSidxRanges){var p,_=(p=E.fragments[0].initSegment)===null||p===void 0?void 0:p.url;this.load({url:_,isSidxRequest:!0,type:T,level:L,levelDetails:E,id:f,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}s.levelDetails=E,this.handlePlaylistLoaded(o,l,s,S)},v.handleSidxRequest=function(o,l){var s=Object(I.parseSegmentIndex)(new Uint8Array(o.data));if(!s)return;var S=s.references,b=l.levelDetails;S.forEach(function(f,L){var T=f.info,m=b.fragments[L];m.byteRange.length===0&&m.setByteRange(String(1+T.end-T.start)+"@"+String(T.start)),m.initSegment&&m.initSegment.setByteRange(String(s.moovEndOffset)+"@0")})},v.handleManifestParsingError=function(o,l,s,S){this.hls.trigger(F.Events.ERROR,{type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:l.type===C.PlaylistContextType.MANIFEST,url:o.url,reason:s,response:o,context:l,networkDetails:S})},v.handleNetworkError=function(o,l,s,S){s===void 0&&(s=!1),N.logger.warn("[playlist-loader]: A network "+(s?"timeout":"error")+" occurred while loading "+o.type+" level: "+o.level+" id: "+o.id+' group-id: "'+o.groupId+'"');var b=O.ErrorDetails.UNKNOWN,f=!1,L=this.getInternalLoader(o);switch(o.type){case C.PlaylistContextType.MANIFEST:b=s?O.ErrorDetails.MANIFEST_LOAD_TIMEOUT:O.ErrorDetails.MANIFEST_LOAD_ERROR,f=!0;break;case C.PlaylistContextType.LEVEL:b=s?O.ErrorDetails.LEVEL_LOAD_TIMEOUT:O.ErrorDetails.LEVEL_LOAD_ERROR,f=!1;break;case C.PlaylistContextType.AUDIO_TRACK:b=s?O.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:O.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,f=!1;break;case C.PlaylistContextType.SUBTITLE_TRACK:b=s?O.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:O.ErrorDetails.SUBTITLE_LOAD_ERROR,f=!1;break}L&&this.resetInternalLoader(o.type);var T={type:O.ErrorTypes.NETWORK_ERROR,details:b,fatal:f,url:o.url,loader:L,context:o,networkDetails:l};S&&(T.response=S),this.hls.trigger(F.Events.ERROR,T)},v.handlePlaylistLoaded=function(o,l,s,S){var b=s.type,f=s.level,L=s.id,T=s.groupId,m=s.loader,c=s.levelDetails,u=s.deliveryDirectives;if(!(c!=null&&c.targetduration)){this.handleManifestParsingError(o,s,"invalid target duration",S);return}if(!m)return;c.live&&(m.getCacheAge&&(c.ageHeader=m.getCacheAge()||0),(!m.getCacheAge||isNaN(c.ageHeader))&&(c.ageHeader=0));switch(b){case C.PlaylistContextType.MANIFEST:case C.PlaylistContextType.LEVEL:this.hls.trigger(F.Events.LEVEL_LOADED,{details:c,level:f||0,id:L||0,stats:l,networkDetails:S,deliveryDirectives:u});break;case C.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(F.Events.AUDIO_TRACK_LOADED,{details:c,id:L||0,groupId:T||"",stats:l,networkDetails:S,deliveryDirectives:u});break;case C.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(F.Events.SUBTITLE_TRACK_LOADED,{details:c,id:L||0,groupId:T||"",stats:l,networkDetails:S,deliveryDirectives:u});break}},x}();z.default=w},"./src/polyfills/number.ts":function(J,z,D){"use strict";D.r(z),D.d(z,"isFiniteNumber",function(){return K}),D.d(z,"MAX_SAFE_INTEGER",function(){return F});var K=Number.isFinite||function(O){return typeof O=="number"&&isFinite(O)},F=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(J,z,D){"use strict";D.r(z);var K=function(){function F(){}return F.getSilentFrame=function(N,I){switch(N){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},F}();z.default=K},"./src/remux/mp4-generator.ts":function(J,z,D){"use strict";D.r(z);var K=Math.pow(2,32)-1,F=function(){function O(){}return O.init=function(){O.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 O.types)O.types.hasOwnProperty(I)&&(O.types[I]=[I.charCodeAt(0),I.charCodeAt(1),I.charCodeAt(2),I.charCodeAt(3)]);var R=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]),C=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]);O.HDLR_TYPES={video:R,audio:C};var h=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),y=new Uint8Array([0,0,0,0,0,0,0,0]);O.STTS=O.STSC=O.STCO=y,O.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),O.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),O.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),O.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var P=new Uint8Array([105,115,111,109]),w=new Uint8Array([97,118,99,49]),x=new Uint8Array([0,0,0,1]);O.FTYP=O.box(O.types.ftyp,P,x,P,w),O.DINF=O.box(O.types.dinf,O.box(O.types.dref,h))},O.box=function(I){for(var R=8,C=arguments.length,h=new Array(C>1?C-1:0),y=1;y<C;y++)h[y-1]=arguments[y];for(var P=h.length,w=P;P--;)R+=h[P].byteLength;var x=new Uint8Array(R);for(x[0]=R>>24&255,x[1]=R>>16&255,x[2]=R>>8&255,x[3]=R&255,x.set(I,4),P=0,R=8;P<w;P++)x.set(h[P],R),R+=h[P].byteLength;return x},O.hdlr=function(I){return O.box(O.types.hdlr,O.HDLR_TYPES[I])},O.mdat=function(I){return O.box(O.types.mdat,I)},O.mdhd=function(I,R){R*=I;var C=Math.floor(R/(K+1)),h=Math.floor(R%(K+1));return O.box(O.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,C>>24,C>>16&255,C>>8&255,C&255,h>>24,h>>16&255,h>>8&255,h&255,85,196,0,0]))},O.mdia=function(I){return O.box(O.types.mdia,O.mdhd(I.timescale,I.duration),O.hdlr(I.type),O.minf(I))},O.mfhd=function(I){return O.box(O.types.mfhd,new Uint8Array([0,0,0,0,I>>24,I>>16&255,I>>8&255,I&255]))},O.minf=function(I){return I.type==="audio"?O.box(O.types.minf,O.box(O.types.smhd,O.SMHD),O.DINF,O.stbl(I)):O.box(O.types.minf,O.box(O.types.vmhd,O.VMHD),O.DINF,O.stbl(I))},O.moof=function(I,R,C){return O.box(O.types.moof,O.mfhd(I),O.traf(C,R))},O.moov=function(I){for(var R=I.length,C=[];R--;)C[R]=O.trak(I[R]);return O.box.apply(null,[O.types.moov,O.mvhd(I[0].timescale,I[0].duration)].concat(C).concat(O.mvex(I)))},O.mvex=function(I){for(var R=I.length,C=[];R--;)C[R]=O.trex(I[R]);return O.box.apply(null,[O.types.mvex].concat(C))},O.mvhd=function(I,R){R*=I;var C=Math.floor(R/(K+1)),h=Math.floor(R%(K+1)),y=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,C>>24,C>>16&255,C>>8&255,C&255,h>>24,h>>16&255,h>>8&255,h&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 O.box(O.types.mvhd,y)},O.sdtp=function(I){var R=I.samples||[],C=new Uint8Array(4+R.length),h,y;for(h=0;h<R.length;h++)y=R[h].flags,C[h+4]=y.dependsOn<<4|y.isDependedOn<<2|y.hasRedundancy;return O.box(O.types.sdtp,C)},O.stbl=function(I){return O.box(O.types.stbl,O.stsd(I),O.box(O.types.stts,O.STTS),O.box(O.types.stsc,O.STSC),O.box(O.types.stsz,O.STSZ),O.box(O.types.stco,O.STCO))},O.avc1=function(I){var R=[],C=[],h,y,P;for(h=0;h<I.sps.length;h++)y=I.sps[h],P=y.byteLength,R.push(P>>>8&255),R.push(P&255),R=R.concat(Array.prototype.slice.call(y));for(h=0;h<I.pps.length;h++)y=I.pps[h],P=y.byteLength,C.push(P>>>8&255),C.push(P&255),C=C.concat(Array.prototype.slice.call(y));var w=O.box(O.types.avcC,new Uint8Array([1,R[3],R[4],R[5],252|3,224|I.sps.length].concat(R).concat([I.pps.length]).concat(C))),x=I.width,v=I.height,d=I.pixelRatio[0],o=I.pixelRatio[1];return O.box(O.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,x>>8&255,x&255,v>>8&255,v&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]),w,O.box(O.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),O.box(O.types.pasp,new Uint8Array([d>>24,d>>16&255,d>>8&255,d&255,o>>24,o>>16&255,o>>8&255,o&255])))},O.esds=function(I){var R=I.config.length;return new Uint8Array([0,0,0,0,3,23+R,0,1,0,4,15+R,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([R]).concat(I.config).concat([6,1,2]))},O.mp4a=function(I){var R=I.samplerate;return O.box(O.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,R>>8&255,R&255,0,0]),O.box(O.types.esds,O.esds(I)))},O.mp3=function(I){var R=I.samplerate;return O.box(O.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,R>>8&255,R&255,0,0]))},O.stsd=function(I){return I.type==="audio"?!I.isAAC&&I.codec==="mp3"?O.box(O.types.stsd,O.STSD,O.mp3(I)):O.box(O.types.stsd,O.STSD,O.mp4a(I)):O.box(O.types.stsd,O.STSD,O.avc1(I))},O.tkhd=function(I){var R=I.id,C=I.duration*I.timescale,h=I.width,y=I.height,P=Math.floor(C/(K+1)),w=Math.floor(C%(K+1));return O.box(O.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,R>>24&255,R>>16&255,R>>8&255,R&255,0,0,0,0,P>>24,P>>16&255,P>>8&255,P&255,w>>24,w>>16&255,w>>8&255,w&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,h>>8&255,h&255,0,0,y>>8&255,y&255,0,0]))},O.traf=function(I,R){var C=O.sdtp(I),h=I.id,y=Math.floor(R/(K+1)),P=Math.floor(R%(K+1));return O.box(O.types.traf,O.box(O.types.tfhd,new Uint8Array([0,0,0,0,h>>24,h>>16&255,h>>8&255,h&255])),O.box(O.types.tfdt,new Uint8Array([1,0,0,0,y>>24,y>>16&255,y>>8&255,y&255,P>>24,P>>16&255,P>>8&255,P&255])),O.trun(I,C.length+16+20+8+16+8+8),C)},O.trak=function(I){return I.duration=I.duration||4294967295,O.box(O.types.trak,O.tkhd(I),O.mdia(I))},O.trex=function(I){var R=I.id;return O.box(O.types.trex,new Uint8Array([0,0,0,0,R>>24,R>>16&255,R>>8&255,R&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},O.trun=function(I,R){var C=I.samples||[],h=C.length,y=12+16*h,P=new Uint8Array(y),w,x,v,d,o,l;for(R+=8+y,P.set([0,0,15,1,h>>>24&255,h>>>16&255,h>>>8&255,h&255,R>>>24&255,R>>>16&255,R>>>8&255,R&255],0),w=0;w<h;w++)x=C[w],v=x.duration,d=x.size,o=x.flags,l=x.cts,P.set([v>>>24&255,v>>>16&255,v>>>8&255,v&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,l>>>24&255,l>>>16&255,l>>>8&255,l&255],12+16*w);return O.box(O.types.trun,P)},O.initSegment=function(I){O.types||O.init();var R=O.moov(I),C=new Uint8Array(O.FTYP.byteLength+R.byteLength);return C.set(O.FTYP),C.set(R,O.FTYP.byteLength),C},O}();F.types=void 0,F.HDLR_TYPES=void 0,F.STTS=void 0,F.STSC=void 0,F.STCO=void 0,F.STSZ=void 0,F.VMHD=void 0,F.SMHD=void 0,F.STSD=void 0,F.FTYP=void 0,F.DINF=void 0,z.default=F},"./src/remux/mp4-remuxer.ts":function(J,z,D){"use strict";D.r(z),D.d(z,"default",function(){return l}),D.d(z,"normalizePts",function(){return s});var K=D("./src/polyfills/number.ts"),F=D("./src/remux/aac-helper.ts"),O=D("./src/remux/mp4-generator.ts"),N=D("./src/events.ts"),I=D("./src/errors.ts"),R=D("./src/utils/logger.ts"),C=D("./src/types/loader.ts"),h=D("./src/utils/timescale-conversion.ts");function y(){return y=Object.assign||function(L){for(var T=1;T<arguments.length;T++){var m=arguments[T];for(var c in m)Object.prototype.hasOwnProperty.call(m,c)&&(L[c]=m[c])}return L},y.apply(this,arguments)}var P=10*1e3,w=1024,x=1152,v=null,d=null,o=!1,l=function(){function L(m,c,u,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=m,this.config=c,this.typeSupported=u,this.ISGenerated=!1,v===null){var E=navigator.userAgent||"",g=E.match(/Chrome\/(\d+)/i);v=g?parseInt(g[1]):0}if(d===null){var p=navigator.userAgent.match(/Safari\/(\d+)/i);d=p?parseInt(p[1]):0}o=!!v&&v<75||!!d&&d<600}var T=L.prototype;return T.destroy=function(){},T.resetTimeStamp=function(c){R.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=c},T.resetNextTimestamp=function(){R.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},T.resetInitSegment=function(){R.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},T.getVideoStartPts=function(c){var u=!1,a=c.reduce(function(E,g){var p=g.pts-E;return p<-4294967296?(u=!0,s(E,g.pts)):p>0?E:g.pts},c[0].pts);return u&&R.logger.debug("PTS rollover detected"),a},T.remux=function(c,u,a,E,g,p,_,U){var B,W,k,M,H,X,ee=g,ie=g,ve=c.pid>-1,pe=u.pid>-1,he=u.samples.length,ce=c.samples.length>0,fe=he>1,ne=(!ve||ce)&&(!pe||fe)||this.ISGenerated||_;if(ne){this.ISGenerated||(k=this.generateIS(c,u,g));var me=this.isVideoContiguous,$=-1;if(fe&&($=S(u.samples),!me&&this.config.forceKeyFrameOnDiscontinuity))if(X=!0,$>0){R.logger.warn("[mp4-remuxer]: Dropped "+$+" out of "+he+" video samples due to a missing keyframe");var ae=this.getVideoStartPts(u.samples);u.samples=u.samples.slice($),u.dropped+=$,ie+=(u.samples[0].pts-ae)/(u.timescale||9e4)}else $===-1&&(R.logger.warn("[mp4-remuxer]: No keyframe found out of "+he+" video samples"),X=!1);if(this.ISGenerated){if(ce&&fe){var q=this.getVideoStartPts(u.samples),Ee=s(c.samples[0].pts,q)-q,Ce=Ee/u.inputTimeScale;ee+=Math.max(0,Ce),ie+=Math.max(0,-Ce)}if(ce){if(c.samplerate||(R.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),k=this.generateIS(c,u,g)),W=this.remuxAudio(c,ee,this.isAudioContiguous,p,pe||fe||U===C.PlaylistLevelType.AUDIO?ie:void 0),fe){var ye=W?W.endPTS-W.startPTS:0;u.inputTimeScale||(R.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),k=this.generateIS(c,u,g)),B=this.remuxVideo(u,ie,me,ye)}}else fe&&(B=this.remuxVideo(u,ie,me,0));B&&(B.firstKeyFrame=$,B.independent=$!==-1)}}return this.ISGenerated&&(a.samples.length&&(H=this.remuxID3(a,g)),E.samples.length&&(M=this.remuxText(E,g))),{audio:W,video:B,initSegment:k,independent:X,text:M,id3:H}},T.generateIS=function(c,u,a){var E=c.samples,g=u.samples,p=this.typeSupported,_={},U=!Object(K.isFiniteNumber)(this._initPTS),B="audio/mp4",W,k,M;if(U&&(W=k=Infinity),c.config&&E.length&&(c.timescale=c.samplerate,c.isAAC||(p.mpeg?(B="audio/mpeg",c.codec=""):p.mp3&&(c.codec="mp3")),_.audio={id:"audio",container:B,codec:c.codec,initSegment:!c.isAAC&&p.mpeg?new Uint8Array(0):O.default.initSegment([c]),metadata:{channelCount:c.channelCount}},U&&(M=c.inputTimeScale,W=k=E[0].pts-Math.round(M*a))),u.sps&&u.pps&&g.length&&(u.timescale=u.inputTimeScale,_.video={id:"main",container:"video/mp4",codec:u.codec,initSegment:O.default.initSegment([u]),metadata:{width:u.width,height:u.height}},U)){M=u.inputTimeScale;var H=this.getVideoStartPts(g),X=Math.round(M*a);k=Math.min(k,s(g[0].dts,H)-X),W=Math.min(W,H-X)}if(Object.keys(_).length)return this.ISGenerated=!0,U&&(this._initPTS=W,this._initDTS=k),{tracks:_,initPTS:W,timescale:M}},T.remuxVideo=function(c,u,a,E){var g=c.inputTimeScale,p=c.samples,_=[],U=p.length,B=this._initPTS,W=this.nextAvcDts,k=8,M,H,X,ee=Number.POSITIVE_INFINITY,ie=Number.NEGATIVE_INFINITY,ve=0,pe=!1;if(!a||W===null){var he=u*g,ce=p[0].pts-s(p[0].dts,p[0].pts);W=he-ce}for(var fe=0;fe<U;fe++){var ne=p[fe];if(ne.pts=s(ne.pts-B,W),ne.dts=s(ne.dts-B,W),ne.dts>ne.pts){var me=9e4*.2;ve=Math.max(Math.min(ve,ne.pts-ne.dts),-1*me)}ne.dts<p[fe>0?fe-1:fe].dts&&(pe=!0)}pe&&p.sort(function(ct,at){var rt=ct.dts-at.dts,xt=ct.pts-at.pts;return rt||xt}),H=p[0].dts,X=p[p.length-1].dts;var $=Math.round((X-H)/(U-1));if(ve<0){if(ve<$*-2){R.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(h.toMsFromMpegTsClock)(-$,!0)+" ms");for(var ae=ve,q=0;q<U;q++)p[q].dts=ae=Math.max(ae,p[q].pts-$),p[q].pts=Math.max(ae,p[q].pts)}else{R.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(h.toMsFromMpegTsClock)(ve,!0)+" ms to overcome this issue");for(var Ee=0;Ee<U;Ee++)p[Ee].dts=p[Ee].dts+ve}H=p[0].dts}if(a){var Ce=H-W,ye=Ce>$,we=Ce<-1;if(ye||we){ye?R.logger.warn("AVC: "+Object(h.toMsFromMpegTsClock)(Ce,!0)+" ms ("+Ce+"dts) hole between fragments detected, filling it"):R.logger.warn("AVC: "+Object(h.toMsFromMpegTsClock)(-Ce,!0)+" ms ("+Ce+"dts) overlapping between fragments detected"),H=W;var Le=p[0].pts-Ce;p[0].dts=H,p[0].pts=Le,R.logger.log("Video: First PTS/DTS adjusted: "+Object(h.toMsFromMpegTsClock)(Le,!0)+"/"+Object(h.toMsFromMpegTsClock)(H,!0)+", delta: "+Object(h.toMsFromMpegTsClock)(Ce,!0)+" ms")}}o&&(H=Math.max(0,H));for(var ke=0,Fe=0,Me=0;Me<U;Me++){for(var Pe=p[Me],Ze=Pe.units,qe=Ze.length,Ge=0,He=0;He<qe;He++)Ge+=Ze[He].data.length;Fe+=Ge,ke+=qe,Pe.length=Ge,Pe.dts=Math.max(Pe.dts,H),Pe.pts=Math.max(Pe.pts,Pe.dts,0),ee=Math.min(Pe.pts,ee),ie=Math.max(Pe.pts,ie)}X=p[U-1].dts;var $e=Fe+4*ke+8,We;try{We=new Uint8Array($e)}catch(ct){this.observer.emit(N.Events.ERROR,N.Events.ERROR,{type:I.ErrorTypes.MUX_ERROR,details:I.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:$e,reason:"fail allocating video mdat "+$e});return}var ze=new DataView(We.buffer);ze.setUint32(0,$e),We.set(O.default.types.mdat,4);for(var Se=0;Se<U;Se++){for(var Je=p[Se],Qe=Je.units,Ae=0,Ie=0,ge=Qe.length;Ie<ge;Ie++){var le=Qe[Ie],de=le.data,Q=le.data.byteLength;ze.setUint32(k,Q),k+=4,We.set(de,k),k+=Q,Ae+=4+Q}if(Se<U-1)M=p[Se+1].dts-Je.dts;else{var Z=this.config,re=Je.dts-p[Se>0?Se-1:Se].dts;if(Z.stretchShortVideoTrack&&this.nextAudioPts!==null){var se=Math.floor(Z.maxBufferHole*g),Te=(E?ee+E*g:this.nextAudioPts)-Je.pts;Te>se?(M=Te-re,M<0&&(M=re),R.logger.log("[mp4-remuxer]: It is approximately "+Te/90+" ms to the next segment; using duration "+M/90+" ms for the last video frame.")):M=re}else M=re}var De=Math.round(Je.pts-Je.dts);_.push(new b(Je.key,M,Ae,De))}if(_.length&&v&&v<70){var Oe=_[0].flags;Oe.dependsOn=2,Oe.isNonSync=0}console.assert(M!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=W=X+M,this.isVideoContiguous=!0;var Ke=O.default.moof(c.sequenceNumber++,H,y({},c,{samples:_})),it="video",_e={data1:Ke,data2:We,startPTS:ee/g,endPTS:(ie+M)/g,startDTS:H/g,endDTS:W/g,type:it,hasAudio:!1,hasVideo:!0,nb:_.length,dropped:c.dropped};return c.samples=[],c.dropped=0,console.assert(We.length,"MDAT length must not be zero"),_e},T.remuxAudio=function(c,u,a,E,g){var p=c.inputTimeScale,_=c.samplerate?c.samplerate:p,U=p/_,B=c.isAAC?w:x,W=B*U,k=this._initPTS,M=!c.isAAC&&this.typeSupported.mpeg,H=[],X=c.samples,ee=M?0:8,ie=this.nextAudioPts||-1,ve=u*p;if(this.isAudioContiguous=a=a||X.length&&ie>0&&(E&&Math.abs(ve-ie)<9e3||Math.abs(s(X[0].pts-k,ve)-ie)<20*W),X.forEach(function(de){de.pts=s(de.pts-k,ve)}),!a||ie<0){if(X=X.filter(function(de){return de.pts>=0}),!X.length)return;g===0?ie=0:E?ie=Math.max(0,ve):ie=X[0].pts}if(c.isAAC)for(var pe=g!==void 0,he=this.config.maxAudioFramesDrift,ce=0,fe=ie;ce<X.length;ce++){var ne=X[ce],me=ne.pts,$=me-fe,ae=Math.abs(1e3*$/p);if($<=-he*W&&pe)ce===0&&(R.logger.warn("Audio frame @ "+(me/p).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*$/p)+" ms."),this.nextAudioPts=ie=fe=me);else if($>=he*W&&ae<P&&pe){var q=Math.round($/W);fe=me-q*W,fe<0&&(q--,fe+=W),ce===0&&(this.nextAudioPts=ie=fe),R.logger.warn("[mp4-remuxer]: Injecting "+q+" audio frame @ "+(fe/p).toFixed(3)+"s due to "+Math.round(1e3*$/p)+" ms gap.");for(var Ee=0;Ee<q;Ee++){var Ce=Math.max(fe,0),ye=F.default.getSilentFrame(c.manifestCodec||c.codec,c.channelCount);ye||(R.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),ye=ne.unit.subarray()),X.splice(ce,0,{unit:ye,pts:Ce}),fe+=W,ce++}}ne.pts=fe,fe+=W}for(var we=null,Le=null,ke,Fe=0,Me=X.length;Me--;)Fe+=X[Me].unit.byteLength;for(var Pe=0,Ze=X.length;Pe<Ze;Pe++){var qe=X[Pe],Ge=qe.unit,He=qe.pts;if(Le!==null){var $e=H[Pe-1];$e.duration=Math.round((He-Le)/U)}else if(a&&c.isAAC&&(He=ie),we=He,Fe>0){Fe+=ee;try{ke=new Uint8Array(Fe)}catch(de){this.observer.emit(N.Events.ERROR,N.Events.ERROR,{type:I.ErrorTypes.MUX_ERROR,details:I.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Fe,reason:"fail allocating audio mdat "+Fe});return}if(!M){var We=new DataView(ke.buffer);We.setUint32(0,Fe),ke.set(O.default.types.mdat,4)}}else return;ke.set(Ge,ee);var ze=Ge.byteLength;ee+=ze,H.push(new b(!0,B,ze,0)),Le=He}var Se=H.length;if(!Se)return;var Je=H[H.length-1];this.nextAudioPts=ie=Le+U*Je.duration;var Qe=M?new Uint8Array(0):O.default.moof(c.sequenceNumber++,we/U,y({},c,{samples:H}));c.samples=[];var Ae=we/p,Ie=ie/p,ge="audio",le={data1:Qe,data2:ke,startPTS:Ae,endPTS:Ie,startDTS:Ae,endDTS:Ie,type:ge,hasAudio:!0,hasVideo:!1,nb:Se};return this.isAudioContiguous=!0,console.assert(ke.length,"MDAT length must not be zero"),le},T.remuxEmptyAudio=function(c,u,a,E){var g=c.inputTimeScale,p=c.samplerate?c.samplerate:g,_=g/p,U=this.nextAudioPts,B=(U!==null?U:E.startDTS*g)+this._initDTS,W=E.endDTS*g+this._initDTS,k=_*w,M=Math.ceil((W-B)/k),H=F.default.getSilentFrame(c.manifestCodec||c.codec,c.channelCount);if(R.logger.warn("[mp4-remuxer]: remux empty Audio"),!H){R.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var X=[],ee=0;ee<M;ee++){var ie=B+ee*k;X.push({unit:H,pts:ie,dts:ie})}return c.samples=X,this.remuxAudio(c,u,a,!1)},T.remuxID3=function(c,u){var a=c.samples.length;if(!a)return;for(var E=c.inputTimeScale,g=this._initPTS,p=this._initDTS,_=0;_<a;_++){var U=c.samples[_];U.pts=s(U.pts-g,u*E)/E,U.dts=s(U.dts-p,u*E)/E}var B=c.samples;return c.samples=[],{samples:B}},T.remuxText=function(c,u){var a=c.samples.length;if(!a)return;for(var E=c.inputTimeScale,g=this._initPTS,p=0;p<a;p++){var _=c.samples[p];_.pts=s(_.pts-g,u*E)/E}c.samples.sort(function(B,W){return B.pts-W.pts});var U=c.samples;return c.samples=[],{samples:U}},L}();function s(L,T){var m;if(T===null)return L;for(T<L?m=-8589934592:m=8589934592;Math.abs(L-T)>4294967296;)L+=m;return L}function S(L){for(var T=0;T<L.length;T++)if(L[T].key)return T;return-1}var b=function(T,m,c,u){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=m,this.size=c,this.cts=u,this.flags=new f(T)},f=function(T){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=T?2:1,this.isNonSync=T?0:1}},"./src/remux/passthrough-remuxer.ts":function(J,z,D){"use strict";D.r(z);var K=D("./src/polyfills/number.ts"),F=D("./src/utils/mp4-tools.ts"),O=D("./src/loader/fragment.ts"),N=D("./src/utils/logger.ts"),I=function(){function h(){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 y=h.prototype;return y.destroy=function(){},y.resetTimeStamp=function(w){this.initPTS=w,this.lastEndDTS=null},y.resetNextTimestamp=function(){this.lastEndDTS=null},y.resetInitSegment=function(w,x,v){this.audioCodec=x,this.videoCodec=v,this.generateInitSegment(w),this.emitInitSegment=!0},y.generateInitSegment=function(w){var x=this.audioCodec,v=this.videoCodec;if(!w||!w.byteLength){this.initTracks=void 0,this.initData=void 0;return}var d=this.initData=Object(F.parseInitSegment)(w);x||(x=C(d.audio,O.ElementaryStreamTypes.AUDIO)),v||(v=C(d.video,O.ElementaryStreamTypes.VIDEO));var o={};d.audio&&d.video?o.audiovideo={container:"video/mp4",codec:x+","+v,initSegment:w,id:"main"}:d.audio?o.audio={container:"audio/mp4",codec:x,initSegment:w,id:"audio"}:d.video?o.video={container:"video/mp4",codec:v,initSegment:w,id:"main"}:N.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=o},y.remux=function(w,x,v,d,o){var l=this.initPTS,s=this.lastEndDTS,S={audio:void 0,video:void 0,text:d,id3:v,initSegment:void 0};Object(K.isFiniteNumber)(s)||(s=this.lastEndDTS=o||0);var b=x.samples;if(!b||!b.length)return S;var f={initPTS:void 0,timescale:1},L=this.initData;if((!L||!L.length)&&(this.generateInitSegment(b),L=this.initData),!L||!L.length)return N.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),S;this.emitInitSegment&&(f.tracks=this.initTracks,this.emitInitSegment=!1),Object(K.isFiniteNumber)(l)||(this.initPTS=f.initPTS=l=R(L,b,s));var T=Object(F.getDuration)(b,L),m=s,c=T+m;Object(F.offsetStartDTS)(L,b,l),T>0?this.lastEndDTS=c:(N.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var u=!!L.audio,a=!!L.video,E="";u&&(E+="audio"),a&&(E+="video");var g={data1:b,startPTS:m,startDTS:m,endPTS:c,endDTS:c,type:E,hasAudio:u,hasVideo:a,nb:1,dropped:0};return S.audio=g.type==="audio"?g:void 0,S.video=g.type!=="audio"?g:void 0,S.text=d,S.id3=v,S.initSegment=f,S},h}(),R=function(y,P,w){return Object(F.getStartDTS)(y,P)-w};function C(h,y){var P=h==null?void 0:h.codec;return P&&P.length>4?P:P==="hvc1"?"hvc1.1.c.L120.90":P==="av01"?"av01.0.04M.08":P==="avc1"||y===O.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}z.default=I},"./src/task-loop.ts":function(J,z,D){"use strict";D.r(z),D.d(z,"default",function(){return K});var K=function(){function F(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var O=F.prototype;return O.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},O.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},O.onHandlerDestroyed=function(){},O.hasInterval=function(){return!!this._tickInterval},O.hasNextTick=function(){return!!this._tickTimer},O.setInterval=function(I){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,I),!0)},O.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},O.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},O.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},O.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},O.doTick=function(){},F}()},"./src/types/cmcd.ts":function(J,z,D){"use strict";D.r(z),D.d(z,"CMCDVersion",function(){return K}),D.d(z,"CMCDObjectType",function(){return F}),D.d(z,"CMCDStreamingFormat",function(){return O}),D.d(z,"CMCDStreamType",function(){return N});var K=1,F;(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"})(F||(F={}));var O;(function(I){I.DASH="d",I.HLS="h",I.SMOOTH="s",I.OTHER="o"})(O||(O={}));var N;(function(I){I.VOD="v",I.LIVE="l"})(N||(N={}))},"./src/types/level.ts":function(J,z,D){"use strict";D.r(z),D.d(z,"HlsSkip",function(){return O}),D.d(z,"getSkipValue",function(){return N}),D.d(z,"HlsUrlParameters",function(){return I}),D.d(z,"Level",function(){return R});function K(C,h){for(var y=0;y<h.length;y++){var P=h[y];P.enumerable=P.enumerable||!1,P.configurable=!0,"value"in P&&(P.writable=!0),Object.defineProperty(C,P.key,P)}}function F(C,h,y){return h&&K(C.prototype,h),y&&K(C,y),C}var O;(function(C){C.No="",C.Yes="YES",C.v2="v2"})(O||(O={}));function N(C,h){var y=C.canSkipUntil,P=C.canSkipDateRanges,w=C.endSN,x=h!==void 0?h-w:0;return y&&x<y?P?O.v2:O.Yes:O.No}var I=function(){function C(y,P,w){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=y,this.part=P,this.skip=w}var h=C.prototype;return h.addDirectives=function(P){var w=new self.URL(P);return this.msn!==void 0&&w.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&w.searchParams.set("_HLS_part",this.part.toString()),this.skip&&w.searchParams.set("_HLS_skip",this.skip),w.toString()},C}(),R=function(){function C(h){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=[h.url],this.attrs=h.attrs,this.bitrate=h.bitrate,h.details&&(this.details=h.details),this.id=h.id||0,this.name=h.name,this.width=h.width||0,this.height=h.height||0,this.audioCodec=h.audioCodec,this.videoCodec=h.videoCodec,this.unknownCodecs=h.unknownCodecs,this.codecSet=[h.videoCodec,h.audioCodec].filter(function(y){return y}).join(",").replace(/\.[^.,]+/g,"")}return F(C,[{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(y){var P=y%this.url.length;this._urlId!==P&&(this.details=void 0,this._urlId=P)}}]),C}()},"./src/types/loader.ts":function(J,z,D){"use strict";D.r(z),D.d(z,"PlaylistContextType",function(){return K}),D.d(z,"PlaylistLevelType",function(){return F});var K;(function(O){O.MANIFEST="manifest",O.LEVEL="level",O.AUDIO_TRACK="audioTrack",O.SUBTITLE_TRACK="subtitleTrack"})(K||(K={}));var F;(function(O){O.MAIN="main",O.AUDIO="audio",O.SUBTITLE="subtitle"})(F||(F={}))},"./src/types/transmuxer.ts":function(J,z,D){"use strict";D.r(z),D.d(z,"ChunkMetadata",function(){return K});var K=function(N,I,R,C,h,y){C===void 0&&(C=0),h===void 0&&(h=-1),y===void 0&&(y=!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=F(),this.buffering={audio:F(),video:F(),audiovideo:F()},this.level=N,this.sn=I,this.id=R,this.size=C,this.part=h,this.partial=y};function F(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(J,z,D){"use strict";D.r(z),D.d(z,"AttrList",function(){return O});var K=/^(\d+)x(\d+)$/,F=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,O=function(){function N(R){typeof R=="string"&&(R=N.parseAttrList(R));for(var C in R)R.hasOwnProperty(C)&&(this[C]=R[C])}var I=N.prototype;return I.decimalInteger=function(C){var h=parseInt(this[C],10);return h>Number.MAX_SAFE_INTEGER?Infinity:h},I.hexadecimalInteger=function(C){if(this[C]){var h=(this[C]||"0x").slice(2);h=(h.length&1?"0":"")+h;for(var y=new Uint8Array(h.length/2),P=0;P<h.length/2;P++)y[P]=parseInt(h.slice(P*2,P*2+2),16);return y}else return null},I.hexadecimalIntegerAsNumber=function(C){var h=parseInt(this[C],16);return h>Number.MAX_SAFE_INTEGER?Infinity:h},I.decimalFloatingPoint=function(C){return parseFloat(this[C])},I.optionalFloat=function(C,h){var y=this[C];return y?parseFloat(y):h},I.enumeratedString=function(C){return this[C]},I.bool=function(C){return this[C]==="YES"},I.decimalResolution=function(C){var h=K.exec(this[C]);return h===null?void 0:{width:parseInt(h[1],10),height:parseInt(h[2],10)}},N.parseAttrList=function(C){var h,y={},P='"';for(F.lastIndex=0;(h=F.exec(C))!==null;){var w=h[2];w.indexOf(P)===0&&w.lastIndexOf(P)===w.length-1&&(w=w.slice(1,-1)),y[h[1]]=w}return y},N}()},"./src/utils/binary-search.ts":function(J,z,D){"use strict";D.r(z);var K={search:function(O,N){for(var I=0,R=O.length-1,C=null,h=null;I<=R;){C=(I+R)/2|0,h=O[C];var y=N(h);if(y>0)I=C+1;else if(y<0)R=C-1;else return h}return null}};z.default=K},"./src/utils/buffer-helper.ts":function(J,z,D){"use strict";D.r(z),D.d(z,"BufferHelper",function(){return O});var K=D("./src/utils/logger.ts"),F={length:0,start:function(){return 0},end:function(){return 0}},O=function(){function N(){}return N.isBuffered=function(R,C){try{if(R){for(var h=N.getBuffered(R),y=0;y<h.length;y++)if(C>=h.start(y)&&C<=h.end(y))return!0}}catch(P){}return!1},N.bufferInfo=function(R,C,h){try{if(R){var y=N.getBuffered(R),P=[],w;for(w=0;w<y.length;w++)P.push({start:y.start(w),end:y.end(w)});return this.bufferedInfo(P,C,h)}}catch(x){}return{len:0,start:C,end:C,nextStart:void 0}},N.bufferedInfo=function(R,C,h){C=Math.max(0,C),R.sort(function(f,L){var T=f.start-L.start;return T||L.end-f.end});var y=[];if(h)for(var P=0;P<R.length;P++){var w=y.length;if(w){var x=y[w-1].end;R[P].start-x<h?R[P].end>x&&(y[w-1].end=R[P].end):y.push(R[P])}else y.push(R[P])}else y=R;for(var v=0,d,o=C,l=C,s=0;s<y.length;s++){var S=y[s].start,b=y[s].end;if(C+h>=S&&C<b)o=S,l=b,v=l-C;else if(C+h<S){d=S;break}}return{len:v,start:o||0,end:l||0,nextStart:d}},N.getBuffered=function(R){try{return R.buffered}catch(C){return K.logger.log("failed to get media.buffered",C),F}},N}()},"./src/utils/cea-608-parser.ts":function(J,z,D){"use strict";D.r(z),D.d(z,"Row",function(){return l}),D.d(z,"CaptionScreen",function(){return s});var K=D("./src/utils/logger.ts"),F={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},O=function(c){var u=c;return F.hasOwnProperty(c)&&(u=F[c]),String.fromCharCode(u)},N=15,I=100,R={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},C={17:2,18:4,21:6,22:8,23:10,19:13,20:15},h={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},y={25:2,26:4,29:6,30:8,31:10,27:13,28:15},P=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],w;(function(m){m[m.ERROR=0]="ERROR",m[m.TEXT=1]="TEXT",m[m.WARNING=2]="WARNING",m[m.INFO=2]="INFO",m[m.DEBUG=3]="DEBUG",m[m.DATA=3]="DATA"})(w||(w={}));var x=function(){function m(){this.time=null,this.verboseLevel=w.ERROR}var c=m.prototype;return c.log=function(a,E){this.verboseLevel>=a&&K.logger.log(this.time+" ["+a+"] "+E)},m}(),v=function(c){for(var u=[],a=0;a<c.length;a++)u.push(c[a].toString(16));return u},d=function(){function m(u,a,E,g,p){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=u||"white",this.underline=a||!1,this.italics=E||!1,this.background=g||"black",this.flash=p||!1}var c=m.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 E=["foreground","underline","italics","background","flash"],g=0;g<E.length;g++){var p=E[g];a.hasOwnProperty(p)&&(this[p]=a[p])}},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},m}(),o=function(){function m(u,a,E,g,p,_){this.uchar=void 0,this.penState=void 0,this.uchar=u||" ",this.penState=new d(a,E,g,p,_)}var c=m.prototype;return c.reset=function(){this.uchar=" ",this.penState.reset()},c.setChar=function(a,E){this.uchar=a,this.penState.copy(E)},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()},m}(),l=function(){function m(u){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=u,this.pos=0,this.currPenState=new d}var c=m.prototype;return c.equals=function(a){for(var E=!0,g=0;g<I;g++)if(!this.chars[g].equals(a.chars[g])){E=!1;break}return E},c.copy=function(a){for(var E=0;E<I;E++)this.chars[E].copy(a.chars[E])},c.isEmpty=function(){for(var a=!0,E=0;E<I;E++)if(!this.chars[E].isEmpty()){a=!1;break}return a},c.setCursor=function(a){this.pos!==a&&(this.pos=a),this.pos<0?(this.logger.log(w.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>I&&(this.logger.log(w.DEBUG,"Too large cursor position "+this.pos),this.pos=I)},c.moveCursor=function(a){var E=this.pos+a;if(a>1)for(var g=this.pos+1;g<E+1;g++)this.chars[g].setPenState(this.currPenState);this.setCursor(E)},c.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},c.insertChar=function(a){a>=144&&this.backSpace();var E=O(a);if(this.pos>=I){this.logger.log(w.ERROR,"Cannot insert "+a.toString(16)+" ("+E+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(E,this.currPenState),this.moveCursor(1)},c.clearFromPos=function(a){var E;for(E=a;E<I;E++)this.chars[E].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=[],E=!0,g=0;g<I;g++){var p=this.chars[g].uchar;p!==" "&&(E=!1),a.push(p)}return E?"":a.join("")},c.setPenStyles=function(a){this.currPenState.setStyles(a);var E=this.chars[this.pos];E.setPenState(this.currPenState)},m}(),s=function(){function m(u){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<N;a++)this.rows.push(new l(u));this.logger=u,this.currRow=N-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var c=m.prototype;return c.reset=function(){for(var a=0;a<N;a++)this.rows[a].clear();this.currRow=N-1},c.equals=function(a){for(var E=!0,g=0;g<N;g++)if(!this.rows[g].equals(a.rows[g])){E=!1;break}return E},c.copy=function(a){for(var E=0;E<N;E++)this.rows[E].copy(a.rows[E])},c.isEmpty=function(){for(var a=!0,E=0;E<N;E++)if(!this.rows[E].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 E=this.rows[this.currRow];E.insertChar(a)},c.setPen=function(a){var E=this.rows[this.currRow];E.setPenStyles(a)},c.moveCursor=function(a){var E=this.rows[this.currRow];E.moveCursor(a)},c.setCursor=function(a){this.logger.log(w.INFO,"setCursor: "+a);var E=this.rows[this.currRow];E.setCursor(a)},c.setPAC=function(a){this.logger.log(w.INFO,"pacData = "+JSON.stringify(a));var E=a.row-1;if(this.nrRollUpRows&&E<this.nrRollUpRows-1&&(E=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==E){for(var g=0;g<N;g++)this.rows[g].clear();var p=this.currRow+1-this.nrRollUpRows,_=this.lastOutputScreen;if(_){var U=_.rows[p].cueStartTime,B=this.logger.time;if(U&&B!==null&&U<B)for(var W=0;W<this.nrRollUpRows;W++)this.rows[E-this.nrRollUpRows+W+1].copy(_.rows[p+W])}}this.currRow=E;var k=this.rows[this.currRow];if(a.indent!==null){var M=a.indent,H=Math.max(M-1,0);k.setCursor(a.indent),a.color=k.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(w.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(w.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(w.TEXT,this.getDisplayText());var a=this.currRow+1-this.nrRollUpRows,E=this.rows.splice(a,1)[0];E.clear(),this.rows.splice(this.currRow,0,E),this.logger.log(w.INFO,"Rolling up")},c.getDisplayText=function(a){a=a||!1;for(var E=[],g="",p=-1,_=0;_<N;_++){var U=this.rows[_].getTextString();U&&(p=_+1,a?E.push("Row "+p+": '"+U+"'"):E.push(U.trim()))}return E.length>0&&(a?g="["+E.join(" | ")+"]":g=E.join(`
|
|
`)),g},c.getTextAndFormat=function(){return this.rows},m}(),S=function(){function m(u,a,E){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=u,this.outputFilter=a,this.mode=null,this.verbose=0,this.displayedMemory=new s(E),this.nonDisplayedMemory=new s(E),this.lastOutputScreen=new s(E),this.currRollUpRow=this.displayedMemory.rows[N-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=E}var c=m.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[N-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(w.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 E=0;E<a.length;E++)this.writeScreen.insertChar(a[E]);var g=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(w.INFO,g+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(w.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},c.ccRCL=function(){this.logger.log(w.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},c.ccBS=function(){if(this.logger.log(w.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(w.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},c.ccRU=function(a){this.logger.log(w.INFO,"RU("+a+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(a)},c.ccFON=function(){this.logger.log(w.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},c.ccRDC=function(){this.logger.log(w.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},c.ccTR=function(){this.logger.log(w.INFO,"TR"),this.setMode("MODE_TEXT")},c.ccRTD=function(){this.logger.log(w.INFO,"RTD"),this.setMode("MODE_TEXT")},c.ccEDM=function(){this.logger.log(w.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},c.ccCR=function(){this.logger.log(w.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},c.ccENM=function(){this.logger.log(w.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},c.ccEOC=function(){if(this.logger.log(w.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(w.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},c.ccTO=function(a){this.logger.log(w.INFO,"TO("+a+") - Tab Offset"),this.writeScreen.moveCursor(a)},c.ccMIDROW=function(a){var E={flash:!1};if(E.underline=a%2===1,E.italics=a>=46,E.italics)E.foreground="white";else{var g=Math.floor(a/2)-16,p=["white","green","blue","cyan","red","yellow","magenta"];E.foreground=p[g]}this.logger.log(w.INFO,"MIDROW: "+JSON.stringify(E)),this.writeScreen.setPen(E)},c.outputDataUpdate=function(a){a===void 0&&(a=!1);var E=this.logger.time;if(E===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=E:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,E,this.lastOutputScreen),a&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:E),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))},m}(),b=function(){function m(u,a,E){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var g=new x;this.channels=[null,new S(u,a,g),new S(u+1,E,g)],this.cmdHistory=T(),this.logger=g}var c=m.prototype;return c.getHandler=function(a){return this.channels[a].getHandler()},c.setHandler=function(a,E){this.channels[a].setHandler(E)},c.addData=function(a,E){var g,p,_,U=!1;this.logger.time=a;for(var B=0;B<E.length;B+=2){if(p=E[B]&127,_=E[B+1]&127,p===0&&_===0)continue;if(this.logger.log(w.DATA,"["+v([E[B],E[B+1]])+"] -> ("+v([p,_])+")"),g=this.parseCmd(p,_),g||(g=this.parseMidrow(p,_)),g||(g=this.parsePAC(p,_)),g||(g=this.parseBackgroundAttributes(p,_)),!g&&(U=this.parseChars(p,_),U)){var W=this.currentChannel;if(W&&W>0){var k=this.channels[W];k.insertChars(U)}else this.logger.log(w.WARNING,"No channel found yet. TEXT-MODE?")}!g&&!U&&this.logger.log(w.WARNING,"Couldn't parse cleaned data "+v([p,_])+" orig: "+v([E[B],E[B+1]]))}},c.parseCmd=function(a,E){var g=this.cmdHistory,p=(a===20||a===28||a===21||a===29)&&E>=32&&E<=47,_=(a===23||a===31)&&E>=33&&E<=35;if(!(p||_))return!1;if(L(a,E,g))return f(null,null,g),this.logger.log(w.DEBUG,"Repeated command ("+v([a,E])+") is dropped"),!0;var U=a===20||a===21||a===23?1:2,B=this.channels[U];return a===20||a===21||a===28||a===29?E===32?B.ccRCL():E===33?B.ccBS():E===34?B.ccAOF():E===35?B.ccAON():E===36?B.ccDER():E===37?B.ccRU(2):E===38?B.ccRU(3):E===39?B.ccRU(4):E===40?B.ccFON():E===41?B.ccRDC():E===42?B.ccTR():E===43?B.ccRTD():E===44?B.ccEDM():E===45?B.ccCR():E===46?B.ccENM():E===47&&B.ccEOC():B.ccTO(E-32),f(a,E,g),this.currentChannel=U,!0},c.parseMidrow=function(a,E){var g=0;if((a===17||a===25)&&E>=32&&E<=47){if(a===17?g=1:g=2,g!==this.currentChannel)return this.logger.log(w.ERROR,"Mismatch channel in midrow parsing"),!1;var p=this.channels[g];return p?(p.ccMIDROW(E),this.logger.log(w.DEBUG,"MIDROW ("+v([a,E])+")"),!0):!1}return!1},c.parsePAC=function(a,E){var g,p=this.cmdHistory,_=(a>=17&&a<=23||a>=25&&a<=31)&&E>=64&&E<=127,U=(a===16||a===24)&&E>=64&&E<=95;if(!(_||U))return!1;if(L(a,E,p))return f(null,null,p),!0;var B=a<=23?1:2;E>=64&&E<=95?g=B===1?R[a]:h[a]:g=B===1?C[a]:y[a];var W=this.channels[B];return W?(W.setPAC(this.interpretPAC(g,E)),f(a,E,p),this.currentChannel=B,!0):!1},c.interpretPAC=function(a,E){var g,p={color:null,italics:!1,indent:null,underline:!1,row:a};return E>95?g=E-96:g=E-64,p.underline=(g&1)===1,g<=13?p.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(g/2)]:g<=15?(p.italics=!0,p.color="white"):p.indent=Math.floor((g-16)/2)*4,p},c.parseChars=function(a,E){var g,p=null,_=null;if(a>=25?(g=2,_=a-8):(g=1,_=a),_>=17&&_<=19){var U;_===17?U=E+80:_===18?U=E+112:U=E+144,this.logger.log(w.INFO,"Special char '"+O(U)+"' in channel "+g),p=[U]}else a>=32&&a<=127&&(p=E===0?[a]:[a,E]);if(p){var B=v(p);this.logger.log(w.DEBUG,"Char codes = "+B.join(",")),f(a,E,this.cmdHistory)}return p},c.parseBackgroundAttributes=function(a,E){var g=(a===16||a===24)&&E>=32&&E<=47,p=(a===23||a===31)&&E>=45&&E<=47;if(!(g||p))return!1;var _,U={};a===16||a===24?(_=Math.floor((E-32)/2),U.background=P[_],E%2===1&&(U.background=U.background+"_semi")):E===45?U.background="transparent":(U.foreground="black",E===47&&(U.underline=!0));var B=a<=23?1:2,W=this.channels[B];return W.setBkgData(U),f(a,E,this.cmdHistory),!0},c.reset=function(){for(var a=0;a<Object.keys(this.channels).length;a++){var E=this.channels[a];E&&E.reset()}this.cmdHistory=T()},c.cueSplitAtTime=function(a){for(var E=0;E<this.channels.length;E++){var g=this.channels[E];g&&g.cueSplitAtTime(a)}},m}();function f(m,c,u){u.a=m,u.b=c}function L(m,c,u){return u.a===m&&u.b===c}function T(){return{a:null,b:null}}z.default=b},"./src/utils/codecs.ts":function(J,z,D){"use strict";D.r(z),D.d(z,"isCodecType",function(){return F}),D.d(z,"isCodecSupportedInMp4",function(){return O});var K={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 F(N,I){var R=K[I];return!!R&&R[N.slice(0,4)]===!0}function O(N,I){return MediaSource.isTypeSupported((I||"video")+'/mp4;codecs="'+N+'"')}},"./src/utils/cues.ts":function(J,z,D){"use strict";D.r(z);var K=D("./src/utils/vttparser.ts"),F=D("./src/utils/webvtt-parser.ts"),O=D("./src/utils/texttrack-utils.ts"),N=/\s/,I={newCue:function(C,h,y,P){for(var w=[],x,v,d,o,l,s=self.VTTCue||self.TextTrackCue,S=0;S<P.rows.length;S++)if(x=P.rows[S],d=!0,o=0,l="",!x.isEmpty()){for(var b=0;b<x.chars.length;b++)N.test(x.chars[b].uchar)&&d?o++:(l+=x.chars[b].uchar,d=!1);x.cueStartTime=h,h===y&&(y+=1e-4),o>=16?o--:o++;var f=Object(K.fixLineBreaks)(l.trim()),L=Object(F.generateCueId)(h,y,f);(!C||!C.cues||!C.cues.getCueById(L))&&(v=new s(h,y,f),v.id=L,v.line=S+1,v.align="left",v.position=10+Math.min(80,Math.floor(o*8/32)*10),w.push(v))}return C&&w.length&&(w.sort(function(T,m){return T.line==="auto"||m.line==="auto"?0:T.line>8&&m.line>8?m.line-T.line:T.line-m.line}),w.forEach(function(T){return Object(O.addCueToTrack)(C,T)})),w}};z.default=I},"./src/utils/discontinuities.ts":function(J,z,D){"use strict";D.r(z),D.d(z,"findFirstFragWithCC",function(){return N}),D.d(z,"shouldAlignOnDiscontinuities",function(){return I}),D.d(z,"findDiscontinuousReferenceFrag",function(){return R}),D.d(z,"adjustSlidingStart",function(){return h}),D.d(z,"alignStream",function(){return y}),D.d(z,"alignPDT",function(){return w}),D.d(z,"alignFragmentByPDTDelta",function(){return x}),D.d(z,"alignMediaPlaylistByPDT",function(){return v});var K=D("./src/polyfills/number.ts"),F=D("./src/utils/logger.ts"),O=D("./src/controller/level-helper.ts");function N(d,o){for(var l=null,s=0,S=d.length;s<S;s++){var b=d[s];if(b&&b.cc===o){l=b;break}}return l}function I(d,o,l){return!!(o.details&&(l.endCC>l.startCC||d&&d.cc<l.startCC))}function R(d,o){var l=d.fragments,s=o.fragments;if(!s.length||!l.length){F.logger.log("No fragments to align");return}var S=N(l,s[0].cc);if(!S||S&&!S.startPTS){F.logger.log("No frag in previous level to align on");return}return S}function C(d,o){if(d){var l=d.start+o;d.start=d.startPTS=l,d.endPTS=l+d.duration}}function h(d,o){for(var l=o.fragments,s=0,S=l.length;s<S;s++)C(l[s],d);o.fragmentHint&&C(o.fragmentHint,d),o.alignedSliding=!0}function y(d,o,l){if(!o)return;P(d,l,o),!l.alignedSliding&&o.details&&w(l,o.details),!l.alignedSliding&&o.details&&!l.skippedSegments&&Object(O.adjustSliding)(o.details,l)}function P(d,o,l){if(I(d,l,o)){var s=R(l.details,o);s&&Object(K.isFiniteNumber)(s.start)&&(F.logger.log("Adjusting PTS using last level due to CC increase within current level "+o.url),h(s.start,o))}}function w(d,o){if(!o.fragments.length||!d.hasProgramDateTime||!o.hasProgramDateTime)return;var l=o.fragments[0].programDateTime,s=d.fragments[0].programDateTime,S=(s-l)/1e3+o.fragments[0].start;S&&Object(K.isFiniteNumber)(S)&&(F.logger.log("Adjusting PTS using programDateTime delta "+(s-l)+"ms, sliding:"+S.toFixed(3)+" "+d.url+" "),h(S,d))}function x(d,o){var l=d.programDateTime;if(!l)return;var s=(l-o)/1e3;d.start=d.startPTS=s,d.endPTS=s+d.duration}function v(d,o){if(!o.fragments.length||!d.hasProgramDateTime||!o.hasProgramDateTime)return;var l=o.fragments[0].programDateTime,s=o.fragments[0].start,S=l-s*1e3;d.fragments.forEach(function(b){x(b,S)}),d.fragmentHint&&x(d.fragmentHint,S),d.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(J,z,D){"use strict";D.r(z);var K=D("./src/utils/ewma.ts"),F=function(){function O(I,R,C){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=C,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new K.default(I),this.fast_=new K.default(R)}var N=O.prototype;return N.update=function(R,C){var h=this.slow_,y=this.fast_;this.slow_.halfLife!==R&&(this.slow_=new K.default(R,h.getEstimate(),h.getTotalWeight())),this.fast_.halfLife!==C&&(this.fast_=new K.default(C,y.getEstimate(),y.getTotalWeight()))},N.sample=function(R,C){R=Math.max(R,this.minDelayMs_);var h=8*C,y=R/1e3,P=h/y;this.fast_.sample(y,P),this.slow_.sample(y,P)},N.canEstimate=function(){var R=this.fast_;return R&&R.getTotalWeight()>=this.minWeight_},N.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},N.destroy=function(){},O}();z.default=F},"./src/utils/ewma.ts":function(J,z,D){"use strict";D.r(z);var K=function(){function F(N,I,R){I===void 0&&(I=0),R===void 0&&(R=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=N,this.alpha_=N?Math.exp(Math.log(.5)/N):0,this.estimate_=I,this.totalWeight_=R}var O=F.prototype;return O.sample=function(I,R){var C=Math.pow(this.alpha_,I);this.estimate_=R*(1-C)+C*this.estimate_,this.totalWeight_+=I},O.getTotalWeight=function(){return this.totalWeight_},O.getEstimate=function(){if(this.alpha_){var I=1-Math.pow(this.alpha_,this.totalWeight_);if(I)return this.estimate_/I}return this.estimate_},F}();z.default=K},"./src/utils/fetch-loader.ts":function(J,z,D){"use strict";D.r(z),D.d(z,"fetchSupported",function(){return x});var K=D("./src/polyfills/number.ts"),F=D("./src/loader/load-stats.ts"),O=D("./src/demux/chunk-cache.ts");function N(s,S){s.prototype=Object.create(S.prototype),s.prototype.constructor=s,y(s,S)}function I(s){var S=typeof Map=="function"?new Map:void 0;return I=function(f){if(f===null||!h(f))return f;if(typeof f!="function")throw new TypeError("Super expression must either be null or a function");if(typeof S!="undefined"){if(S.has(f))return S.get(f);S.set(f,L)}function L(){return R(f,arguments,P(this).constructor)}return L.prototype=Object.create(f.prototype,{constructor:{value:L,enumerable:!1,writable:!0,configurable:!0}}),y(L,f)},I(s)}function R(s,S,b){return C()?R=Reflect.construct:R=function(L,T,m){var c=[null];c.push.apply(c,T);var u=Function.bind.apply(L,c),a=new u;return m&&y(a,m.prototype),a},R.apply(null,arguments)}function C(){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(s){return!1}}function h(s){return Function.toString.call(s).indexOf("[native code]")!==-1}function y(s,S){return y=Object.setPrototypeOf||function(f,L){return f.__proto__=L,f},y(s,S)}function P(s){return P=Object.setPrototypeOf?Object.getPrototypeOf:function(b){return b.__proto__||Object.getPrototypeOf(b)},P(s)}function w(){return w=Object.assign||function(s){for(var S=1;S<arguments.length;S++){var b=arguments[S];for(var f in b)Object.prototype.hasOwnProperty.call(b,f)&&(s[f]=b[f])}return s},w.apply(this,arguments)}function x(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(s){}return!1}var v=function(){function s(b){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=b.fetchSetup||o,this.controller=new self.AbortController,this.stats=new F.LoadStats}var S=s.prototype;return S.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},S.abortInternal=function(){var f=this.response;(!f||!f.ok)&&(this.stats.aborted=!0,this.controller.abort())},S.abort=function(){var f;this.abortInternal(),(f=this.callbacks)!==null&&f!==void 0&&f.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},S.load=function(f,L,T){var m=this,c=this.stats;if(c.loading.start)throw new Error("Loader can only be used once.");c.loading.start=self.performance.now();var u=d(f,this.controller.signal),a=T.onProgress,E=f.responseType==="arraybuffer",g=E?"byteLength":"length";this.context=f,this.config=L,this.callbacks=T,this.request=this.fetchSetup(f,u),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){m.abortInternal(),T.onTimeout(c,f,m.response)},L.timeout),self.fetch(this.request).then(function(p){if(m.response=m.loader=p,!p.ok){var _=p.status,U=p.statusText;throw new l(U||"fetch, bad network response",_,p)}return c.loading.first=Math.max(self.performance.now(),c.loading.start),c.total=parseInt(p.headers.get("Content-Length")||"0"),a&&Object(K.isFiniteNumber)(L.highWaterMark)?m.loadProgressively(p,c,f,L.highWaterMark,a):E?p.arrayBuffer():p.text()}).then(function(p){var _=m.response;self.clearTimeout(m.requestTimeout),c.loading.end=Math.max(self.performance.now(),c.loading.first),c.loaded=c.total=p[g];var U={url:_.url,data:p};a&&!Object(K.isFiniteNumber)(L.highWaterMark)&&a(c,f,p,_),T.onSuccess(U,c,f,_)}).catch(function(p){if(self.clearTimeout(m.requestTimeout),c.aborted)return;var _=p.code||0;T.onError({code:_,text:p.message},f,p.details)})},S.getCacheAge=function(){var f=null;if(this.response){var L=this.response.headers.get("age");f=L?parseFloat(L):null}return f},S.loadProgressively=function(f,L,T,m,c){m===void 0&&(m=0);var u=new O.default,a=f.body.getReader(),E=function g(){return a.read().then(function(p){if(p.done)return u.dataLength&&c(L,T,u.flush(),f),Promise.resolve(new ArrayBuffer(0));var _=p.value,U=_.length;return L.loaded+=U,U<m||u.dataLength?(u.push(_),u.dataLength>=m&&c(L,T,u.flush(),f)):c(L,T,_,f),g()}).catch(function(){return Promise.reject()})};return E()},s}();function d(s,S){var b={method:"GET",mode:"cors",credentials:"same-origin",signal:S,headers:new self.Headers(w({},s.headers))};return s.rangeEnd&&b.headers.set("Range","bytes="+s.rangeStart+"-"+String(s.rangeEnd-1)),b}function o(s,S){return new self.Request(s.url,S)}var l=function(s){N(S,s);function S(b,f,L){var T;return T=s.call(this,b)||this,T.code=void 0,T.details=void 0,T.code=f,T.details=L,T}return S}(I(Error));z.default=v},"./src/utils/imsc1-ttml-parser.ts":function(J,z,D){"use strict";D.r(z),D.d(z,"IMSC1_CODEC",function(){return h}),D.d(z,"parseIMSC1",function(){return x});var K=D("./src/utils/mp4-tools.ts"),F=D("./src/utils/vttparser.ts"),O=D("./src/utils/vttcue.ts"),N=D("./src/demux/id3.ts"),I=D("./src/utils/timescale-conversion.ts"),R=D("./src/utils/webvtt-parser.ts");function C(){return C=Object.assign||function(m){for(var c=1;c<arguments.length;c++){var u=arguments[c];for(var a in u)Object.prototype.hasOwnProperty.call(u,a)&&(m[a]=u[a])}return m},C.apply(this,arguments)}var h="stpp.ttml.im1t",y=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,P=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,w={left:"start",center:"center",right:"end",start:"start",end:"end"};function x(m,c,u,a,E){var g=Object(K.findBox)(new Uint8Array(m),["mdat"]);if(g.length===0){E(new Error("Could not parse IMSC1 mdat"));return}var p=g[0],_=Object(N.utf8ArrayToStr)(new Uint8Array(m,p.start,p.end-p.start)),U=Object(I.toTimescaleFromScale)(c,1,u);try{a(v(_,U))}catch(B){E(B)}}function v(m,c){var u=new DOMParser,a=u.parseFromString(m,"text/xml"),E=a.getElementsByTagName("tt")[0];if(!E)throw new Error("Invalid ttml");var g={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},p=Object.keys(g).reduce(function(k,M){return k[M]=E.getAttribute("ttp:"+M)||g[M],k},{}),_=E.getAttribute("xml:space")!=="preserve",U=o(d(E,"styling","style")),B=o(d(E,"layout","region")),W=d(E,"body","[begin]");return[].map.call(W,function(k){var M=l(k,_);if(!M||!k.hasAttribute("begin"))return null;var H=f(k.getAttribute("begin"),p),X=f(k.getAttribute("dur"),p),ee=f(k.getAttribute("end"),p);if(H===null)throw b(k);if(ee===null){if(X===null)throw b(k);ee=H+X}var ie=new O.default(H-c,ee-c,M);ie.id=Object(R.generateCueId)(ie.startTime,ie.endTime,ie.text);var ve=B[k.getAttribute("region")],pe=U[k.getAttribute("style")];ie.position=10,ie.size=80;var he=s(ve,pe),ce=he.textAlign;if(ce){var fe=w[ce];fe&&(ie.lineAlign=fe),ie.align=ce}return C(ie,he),ie}).filter(function(k){return k!==null})}function d(m,c,u){var a=m.getElementsByTagName(c)[0];return a?[].slice.call(a.querySelectorAll(u)):[]}function o(m){return m.reduce(function(c,u){var a=u.getAttribute("xml:id");return a&&(c[a]=u),c},{})}function l(m,c){return[].slice.call(m.childNodes).reduce(function(u,a,E){var g;return a.nodeName==="br"&&E?u+`
|
|
`:(g=a.childNodes)!==null&&g!==void 0&&g.length?l(a,c):c?u+a.textContent.trim().replace(/\s+/g," "):u+a.textContent},"")}function s(m,c){var u="http://www.w3.org/ns/ttml#styling",a=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return a.reduce(function(E,g){var p=S(c,u,g)||S(m,u,g);return p&&(E[g]=p),E},{})}function S(m,c,u){return m.hasAttributeNS(c,u)?m.getAttributeNS(c,u):null}function b(m){return new Error("Could not parse ttml timestamp "+m)}function f(m,c){if(!m)return null;var u=Object(F.parseTimeStamp)(m);return u===null&&(y.test(m)?u=L(m,c):P.test(m)&&(u=T(m,c))),u}function L(m,c){var u=y.exec(m),a=(u[4]|0)+(u[5]|0)/c.subFrameRate;return(u[1]|0)*3600+(u[2]|0)*60+(u[3]|0)+a/c.frameRate}function T(m,c){var u=P.exec(m),a=Number(u[1]),E=u[2];switch(E){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(J,z,D){"use strict";D.r(z),D.d(z,"enableLogs",function(){return R}),D.d(z,"logger",function(){return C});var K=function(){},F={trace:K,debug:K,log:K,warn:K,info:K,error:K},O=F;function N(h){var y=self.console[h];return y?y.bind(self.console,"["+h+"] >"):K}function I(h){for(var y=arguments.length,P=new Array(y>1?y-1:0),w=1;w<y;w++)P[w-1]=arguments[w];P.forEach(function(x){O[x]=h[x]?h[x].bind(h):N(x)})}function R(h){if(self.console&&h===!0||typeof h=="object"){I(h,"debug","log","info","warn","error");try{O.log()}catch(y){O=F}}else O=F}var C=O},"./src/utils/mediakeys-helper.ts":function(J,z,D){"use strict";D.r(z),D.d(z,"KeySystems",function(){return K}),D.d(z,"requestMediaKeySystemAccess",function(){return F});var K;(function(O){O.WIDEVINE="com.widevine.alpha",O.PLAYREADY="com.microsoft.playready"})(K||(K={}));var F=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(J,z,D){"use strict";D.r(z),D.d(z,"getMediaSource",function(){return K});function K(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(J,z,D){"use strict";D.r(z),D.d(z,"bin2str",function(){return I}),D.d(z,"readUint16",function(){return R}),D.d(z,"readUint32",function(){return C}),D.d(z,"writeUint32",function(){return h}),D.d(z,"findBox",function(){return y}),D.d(z,"parseSegmentIndex",function(){return P}),D.d(z,"parseInitSegment",function(){return w}),D.d(z,"getStartDTS",function(){return x}),D.d(z,"getDuration",function(){return v}),D.d(z,"computeRawDurationFromSamples",function(){return d}),D.d(z,"offsetStartDTS",function(){return o}),D.d(z,"segmentValidRange",function(){return l}),D.d(z,"appendUint8Array",function(){return s});var K=D("./src/utils/typed-array.ts"),F=D("./src/loader/fragment.ts"),O=Math.pow(2,32)-1,N=[].push;function I(S){return String.fromCharCode.apply(null,S)}function R(S,b){"data"in S&&(b+=S.start,S=S.data);var f=S[b]<<8|S[b+1];return f<0?65536+f:f}function C(S,b){"data"in S&&(b+=S.start,S=S.data);var f=S[b]<<24|S[b+1]<<16|S[b+2]<<8|S[b+3];return f<0?4294967296+f:f}function h(S,b,f){"data"in S&&(b+=S.start,S=S.data),S[b]=f>>24,S[b+1]=f>>16&255,S[b+2]=f>>8&255,S[b+3]=f&255}function y(S,b){var f=[];if(!b.length)return f;var L,T,m;"data"in S?(L=S.data,T=S.start,m=S.end):(L=S,T=0,m=L.byteLength);for(var c=T;c<m;){var u=C(L,c),a=I(L.subarray(c+4,c+8)),E=u>1?c+u:m;if(a===b[0])if(b.length===1)f.push({data:L,start:c+8,end:E});else{var g=y({data:L,start:c+8,end:E},b.slice(1));g.length&&N.apply(f,g)}c=E}return f}function P(S){var b=y(S,["moov"]),f=b[0],L=f?f.end:null,T=y(S,["sidx"]);if(!T||!T[0])return null;var m=[],c=T[0],u=c.data[0],a=u===0?8:16,E=C(c,a);a+=4;var g=0,p=0;u===0?a+=8:a+=16,a+=2;var _=c.end+p,U=R(c,a);a+=2;for(var B=0;B<U;B++){var W=a,k=C(c,W);W+=4;var M=k&2147483647,H=(k&2147483648)>>>31;if(H===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var X=C(c,W);W+=4,m.push({referenceSize:M,subsegmentDuration:X,info:{duration:X/E,start:_,end:_+M-1}}),_+=M,W+=4,a=W}return{earliestPresentationTime:g,timescale:E,version:u,referencesCount:U,references:m,moovEndOffset:L}}function w(S){for(var b=[],f=y(S,["moov","trak"]),L=0;L<f.length;L++){var T=f[L],m=y(T,["tkhd"])[0];if(m){var c=m.data[m.start],u=c===0?12:20,a=C(m,u),E=y(T,["mdia","mdhd"])[0];if(E){c=E.data[E.start],u=c===0?12:20;var g=C(E,u),p=y(T,["mdia","hdlr"])[0];if(p){var _=I(p.data.subarray(p.start+8,p.start+12)),U={soun:F.ElementaryStreamTypes.AUDIO,vide:F.ElementaryStreamTypes.VIDEO}[_];if(U){var B=y(T,["mdia","minf","stbl","stsd"])[0],W=void 0;B&&(W=I(B.data.subarray(B.start+12,B.start+16))),b[a]={timescale:g,type:U},b[U]={timescale:g,id:a,codec:W}}}}}}var k=y(S,["moov","mvex","trex"]);return k.forEach(function(M){var H=C(M,4),X=b[H];X&&(X.default={duration:C(M,12),flags:C(M,20)})}),b}function x(S,b){return y(b,["moof","traf"]).reduce(function(f,L){var T=y(L,["tfdt"])[0],m=T.data[T.start],c=y(L,["tfhd"]).reduce(function(u,a){var E=C(a,4),g=S[E];if(g){var p=C(T,4);m===1&&(p*=Math.pow(2,32),p+=C(T,8));var _=g.timescale||9e4,U=p/_;if(isFinite(U)&&(u===null||U<u))return U}return u},null);return c!==null&&isFinite(c)&&(f===null||c<f)?c:f},null)||0}function v(S,b){for(var f=0,L=0,T=0,m=y(S,["moof","traf"]),c=0;c<m.length;c++){var u=m[c],a=y(u,["tfhd"])[0],E=C(a,4),g=b[E];if(!g)continue;var p=g.default,_=C(a,0)|(p==null?void 0:p.flags),U=p==null?void 0:p.duration;_&8&&(_&2?U=C(a,12):U=C(a,8));for(var B=g.timescale||9e4,W=y(u,["trun"]),k=0;k<W.length;k++){if(U){var M=C(W[k],4);f=U*M}else f=d(W[k]);g.type===F.ElementaryStreamTypes.VIDEO?L+=f/B:g.type===F.ElementaryStreamTypes.AUDIO&&(T+=f/B)}}if(L===0&&T===0){var H=P(S);if(H!=null&&H.references)return H.references.reduce(function(X,ee){return X+ee.info.duration||0},0)}return L||T}function d(S){var b=C(S,0),f=8;b&1&&(f+=4),b&4&&(f+=4);for(var L=0,T=C(S,4),m=0;m<T;m++){if(b&256){var c=C(S,f);L+=c,f+=4}b&512&&(f+=4),b&1024&&(f+=4),b&2048&&(f+=4)}return L}function o(S,b,f){y(b,["moof","traf"]).forEach(function(L){y(L,["tfhd"]).forEach(function(T){var m=C(T,4),c=S[m];if(!c)return;var u=c.timescale||9e4;y(L,["tfdt"]).forEach(function(a){var E=a.data[a.start],g=C(a,4);if(E===0)h(a,4,g-f*u);else{g*=Math.pow(2,32),g+=C(a,8),g-=f*u,g=Math.max(g,0);var p=Math.floor(g/(O+1)),_=Math.floor(g%(O+1));h(a,4,p),h(a,8,_)}})})})}function l(S){var b={valid:null,remainder:null},f=y(S,["moof"]);if(f){if(f.length<2)return b.remainder=S,b}else return b;var L=f[f.length-1];return b.valid=Object(K.sliceUint8)(S,0,L.start-8),b.remainder=Object(K.sliceUint8)(S,L.start-8),b}function s(S,b){var f=new Uint8Array(S.length+b.length);return f.set(S),f.set(b,S.length),f}},"./src/utils/output-filter.ts":function(J,z,D){"use strict";D.r(z),D.d(z,"default",function(){return K});var K=function(){function F(N,I){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=N,this.trackName=I}var O=F.prototype;return O.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},O.newCue=function(I,R,C){(this.startTime===null||this.startTime>I)&&(this.startTime=I),this.endTime=R,this.screen=C,this.timelineController.createCaptionsTrack(this.trackName)},O.reset=function(){this.cueRanges=[]},F}()},"./src/utils/texttrack-utils.ts":function(J,z,D){"use strict";D.r(z),D.d(z,"sendAddTrackEvent",function(){return F}),D.d(z,"addCueToTrack",function(){return O}),D.d(z,"clearCurrentCues",function(){return N}),D.d(z,"removeCuesInRange",function(){return I}),D.d(z,"getCuesInRange",function(){return C});var K=D("./src/utils/logger.ts");function F(h,y){var P;try{P=new Event("addtrack")}catch(w){P=document.createEvent("Event"),P.initEvent("addtrack",!1,!1)}P.track=h,y.dispatchEvent(P)}function O(h,y){var P=h.mode;if(P==="disabled"&&(h.mode="hidden"),h.cues&&!h.cues.getCueById(y.id))try{if(h.addCue(y),!h.cues.getCueById(y.id))throw new Error("addCue is failed for: "+y)}catch(x){K.logger.debug("[texttrack-utils]: "+x);var w=new self.TextTrackCue(y.startTime,y.endTime,y.text);w.id=y.id,h.addCue(w)}P==="disabled"&&(h.mode=P)}function N(h){var y=h.mode;if(y==="disabled"&&(h.mode="hidden"),h.cues)for(var P=h.cues.length;P--;)h.removeCue(h.cues[P]);y==="disabled"&&(h.mode=y)}function I(h,y,P){var w=h.mode;if(w==="disabled"&&(h.mode="hidden"),h.cues&&h.cues.length>0)for(var x=C(h.cues,y,P),v=0;v<x.length;v++)h.removeCue(x[v]);w==="disabled"&&(h.mode=w)}function R(h,y){if(y<h[0].startTime)return 0;var P=h.length-1;if(y>h[P].endTime)return-1;for(var w=0,x=P;w<=x;){var v=Math.floor((x+w)/2);if(y<h[v].startTime)x=v-1;else if(y>h[v].startTime&&w<P)w=v+1;else return v}return h[w].startTime-y<y-h[x].startTime?w:x}function C(h,y,P){var w=[],x=R(h,y);if(x>-1)for(var v=x,d=h.length;v<d;v++){var o=h[v];if(o.startTime>=y&&o.endTime<=P)w.push(o);else if(o.startTime>P)return w}return w}},"./src/utils/time-ranges.ts":function(J,z,D){"use strict";D.r(z);var K={toString:function(O){for(var N="",I=O.length,R=0;R<I;R++)N+="["+O.start(R).toFixed(3)+","+O.end(R).toFixed(3)+"]";return N}};z.default=K},"./src/utils/timescale-conversion.ts":function(J,z,D){"use strict";D.r(z),D.d(z,"toTimescaleFromBase",function(){return F}),D.d(z,"toTimescaleFromScale",function(){return O}),D.d(z,"toMsFromMpegTsClock",function(){return N}),D.d(z,"toMpegTsClockFromTimescale",function(){return I});var K=9e4;function F(R,C,h,y){h===void 0&&(h=1),y===void 0&&(y=!1);var P=R*C*h;return y?Math.round(P):P}function O(R,C,h,y){return h===void 0&&(h=1),y===void 0&&(y=!1),F(R,C,1/h,y)}function N(R,C){return C===void 0&&(C=!1),F(R,1e3,1/K,C)}function I(R,C){return C===void 0&&(C=1),F(R,K,1/C)}},"./src/utils/typed-array.ts":function(J,z,D){"use strict";D.r(z),D.d(z,"sliceUint8",function(){return K});function K(F,O,N){return Uint8Array.prototype.slice?F.slice(O,N):new Uint8Array(Array.prototype.slice.call(F,O,N))}},"./src/utils/vttcue.ts":function(J,z,D){"use strict";D.r(z),z.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var K=["","lr","rl"],F=["start","middle","end","left","right"];function O(h,y){if(typeof y!="string")return!1;if(!Array.isArray(h))return!1;var P=y.toLowerCase();return~h.indexOf(P)?P:!1}function N(h){return O(K,h)}function I(h){return O(F,h)}function R(h){for(var y=arguments.length,P=new Array(y>1?y-1:0),w=1;w<y;w++)P[w-1]=arguments[w];for(var x=1;x<arguments.length;x++){var v=arguments[x];for(var d in v)h[d]=v[d]}return h}function C(h,y,P){var w=this,x={enumerable:!0};w.hasBeenReset=!1;var v="",d=!1,o=h,l=y,s=P,S=null,b="",f=!0,L="auto",T="start",m=50,c="middle",u=50,a="middle";Object.defineProperty(w,"id",R({},x,{get:function(){return v},set:function(g){v=""+g}})),Object.defineProperty(w,"pauseOnExit",R({},x,{get:function(){return d},set:function(g){d=!!g}})),Object.defineProperty(w,"startTime",R({},x,{get:function(){return o},set:function(g){if(typeof g!="number")throw new TypeError("Start time must be set to a number.");o=g,this.hasBeenReset=!0}})),Object.defineProperty(w,"endTime",R({},x,{get:function(){return l},set:function(g){if(typeof g!="number")throw new TypeError("End time must be set to a number.");l=g,this.hasBeenReset=!0}})),Object.defineProperty(w,"text",R({},x,{get:function(){return s},set:function(g){s=""+g,this.hasBeenReset=!0}})),Object.defineProperty(w,"region",R({},x,{get:function(){return S},set:function(g){S=g,this.hasBeenReset=!0}})),Object.defineProperty(w,"vertical",R({},x,{get:function(){return b},set:function(g){var p=N(g);if(p===!1)throw new SyntaxError("An invalid or illegal string was specified.");b=p,this.hasBeenReset=!0}})),Object.defineProperty(w,"snapToLines",R({},x,{get:function(){return f},set:function(g){f=!!g,this.hasBeenReset=!0}})),Object.defineProperty(w,"line",R({},x,{get:function(){return L},set:function(g){if(typeof g!="number"&&g!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");L=g,this.hasBeenReset=!0}})),Object.defineProperty(w,"lineAlign",R({},x,{get:function(){return T},set:function(g){var p=I(g);if(!p)throw new SyntaxError("An invalid or illegal string was specified.");T=p,this.hasBeenReset=!0}})),Object.defineProperty(w,"position",R({},x,{get:function(){return m},set:function(g){if(g<0||g>100)throw new Error("Position must be between 0 and 100.");m=g,this.hasBeenReset=!0}})),Object.defineProperty(w,"positionAlign",R({},x,{get:function(){return c},set:function(g){var p=I(g);if(!p)throw new SyntaxError("An invalid or illegal string was specified.");c=p,this.hasBeenReset=!0}})),Object.defineProperty(w,"size",R({},x,{get:function(){return u},set:function(g){if(g<0||g>100)throw new Error("Size must be between 0 and 100.");u=g,this.hasBeenReset=!0}})),Object.defineProperty(w,"align",R({},x,{get:function(){return a},set:function(g){var p=I(g);if(!p)throw new SyntaxError("An invalid or illegal string was specified.");a=p,this.hasBeenReset=!0}})),w.displayState=void 0}return C.prototype.getCueAsHTML=function(){var h=self.WebVTT;return h.convertCueToDOMTree(self,this.text)},C}()},"./src/utils/vttparser.ts":function(J,z,D){"use strict";D.r(z),D.d(z,"parseTimeStamp",function(){return O}),D.d(z,"fixLineBreaks",function(){return y}),D.d(z,"VTTParser",function(){return P});var K=D("./src/utils/vttcue.ts"),F=function(){function w(){}var x=w.prototype;return x.decode=function(d,o){if(!d)return"";if(typeof d!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(d))},w}();function O(w){function x(d,o,l,s){return(d|0)*3600+(o|0)*60+(l|0)+parseFloat(s||0)}var v=w.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return v?parseFloat(v[2])>59?x(v[2],v[3],0,v[4]):x(v[1],v[2],v[3],v[4]):null}var N=function(){function w(){this.values=Object.create(null)}var x=w.prototype;return x.set=function(d,o){!this.get(d)&&o!==""&&(this.values[d]=o)},x.get=function(d,o,l){return l?this.has(d)?this.values[d]:o[l]:this.has(d)?this.values[d]:o},x.has=function(d){return d in this.values},x.alt=function(d,o,l){for(var s=0;s<l.length;++s)if(o===l[s]){this.set(d,o);break}},x.integer=function(d,o){/^-?\d+$/.test(o)&&this.set(d,parseInt(o,10))},x.percent=function(d,o){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(o)){var l=parseFloat(o);if(l>=0&&l<=100)return this.set(d,l),!0}return!1},w}();function I(w,x,v,d){var o=d?w.split(d):[w];for(var l in o){if(typeof o[l]!="string")continue;var s=o[l].split(v);if(s.length!==2)continue;var S=s[0],b=s[1];x(S,b)}}var R=new K.default(0,0,""),C=R.align==="middle"?"middle":"center";function h(w,x,v){var d=w;function o(){var S=O(w);if(S===null)throw new Error("Malformed timestamp: "+d);return w=w.replace(/^[^\sa-zA-Z-]+/,""),S}function l(S,b){var f=new N;I(S,function(m,c){var u;switch(m){case"region":for(var a=v.length-1;a>=0;a--)if(v[a].id===c){f.set(m,v[a].region);break}break;case"vertical":f.alt(m,c,["rl","lr"]);break;case"line":u=c.split(","),f.integer(m,u[0]),f.percent(m,u[0])&&f.set("snapToLines",!1),f.alt(m,u[0],["auto"]),u.length===2&&f.alt("lineAlign",u[1],["start",C,"end"]);break;case"position":u=c.split(","),f.percent(m,u[0]),u.length===2&&f.alt("positionAlign",u[1],["start",C,"end","line-left","line-right","auto"]);break;case"size":f.percent(m,c);break;case"align":f.alt(m,c,["start",C,"end","left","right"]);break}},/:/,/\s/),b.region=f.get("region",null),b.vertical=f.get("vertical","");var L=f.get("line","auto");L==="auto"&&R.line===-1&&(L=-1),b.line=L,b.lineAlign=f.get("lineAlign","start"),b.snapToLines=f.get("snapToLines",!0),b.size=f.get("size",100),b.align=f.get("align",C);var T=f.get("position","auto");T==="auto"&&R.position===50&&(T=b.align==="start"||b.align==="left"?0:b.align==="end"||b.align==="right"?100:50),b.position=T}function s(){w=w.replace(/^\s+/,"")}if(s(),x.startTime=o(),s(),w.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+d);w=w.substr(3),s(),x.endTime=o(),s(),l(w,x)}function y(w){return w.replace(/<br(?: \/)?>/gi,`
|
|
`)}var P=function(){function w(){this.state="INITIAL",this.buffer="",this.decoder=new F,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var x=w.prototype;return x.parse=function(d){var o=this;d&&(o.buffer+=o.decoder.decode(d,{stream:!0}));function l(){var T=o.buffer,m=0;for(T=y(T);m<T.length&&T[m]!=="\r"&&T[m]!==`
|
|
`;)++m;var c=T.substr(0,m);return T[m]==="\r"&&++m,T[m]===`
|
|
`&&++m,o.buffer=T.substr(m),c}function s(T){I(T,function(m,c){},/:/)}try{var S="";if(o.state==="INITIAL"){if(!/\r\n|\n/.test(o.buffer))return this;S=l();var b=S.match(/^()?WEBVTT([ \t].*)?$/);if(!b||!b[0])throw new Error("Malformed WebVTT signature.");o.state="HEADER"}for(var f=!1;o.buffer;){if(!/\r\n|\n/.test(o.buffer))return this;f?f=!1:S=l();switch(o.state){case"HEADER":/:/.test(S)?s(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 K.default(0,0,""),o.state="CUE",S.indexOf("-->")===-1){o.cue.id=S;continue}case"CUE":if(!o.cue){o.state="BADCUE";continue}try{h(S,o.cue,o.regionList)}catch(T){o.cue=null,o.state="BADCUE";continue}o.state="CUETEXT";continue;case"CUETEXT":{var L=S.indexOf("-->")!==-1;if(!S||L&&(f=!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(T){o.state==="CUETEXT"&&o.cue&&o.oncue&&o.oncue(o.cue),o.cue=null,o.state=o.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},x.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},w}()},"./src/utils/webvtt-parser.ts":function(J,z,D){"use strict";D.r(z),D.d(z,"generateCueId",function(){return P}),D.d(z,"parseWebVTT",function(){return x});var K=D("./src/polyfills/number.ts"),F=D("./src/utils/vttparser.ts"),O=D("./src/demux/id3.ts"),N=D("./src/utils/timescale-conversion.ts"),I=D("./src/remux/mp4-remuxer.ts"),R=/\r\n|\n\r|\n|\r/g,C=function(d,o,l){return l===void 0&&(l=0),d.substr(l,o.length)===o},h=function(d){var o=parseInt(d.substr(-3)),l=parseInt(d.substr(-6,2)),s=parseInt(d.substr(-9,2)),S=d.length>9?parseInt(d.substr(0,d.indexOf(":"))):0;if(!Object(K.isFiniteNumber)(o)||!Object(K.isFiniteNumber)(l)||!Object(K.isFiniteNumber)(s)||!Object(K.isFiniteNumber)(S))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+d);return o+=1e3*l,o+=60*1e3*s,o+=60*60*1e3*S,o},y=function(d){for(var o=5381,l=d.length;l;)o=o*33^d.charCodeAt(--l);return(o>>>0).toString()};function P(v,d,o){return y(v.toString())+y(d.toString())+y(o)}var w=function(d,o,l){var s=d[o],S=d[s.prevCC];if(!S||!S.new&&s.new){d.ccOffset=d.presentationOffset=s.start,s.new=!1;return}for(;(b=S)!==null&&b!==void 0&&b.new;){var b;d.ccOffset+=s.start-S.start,s.new=!1,s=S,S=d[s.prevCC]}d.presentationOffset=l};function x(v,d,o,l,s,S,b,f){var L=new F.VTTParser,T=Object(O.utf8ArrayToStr)(new Uint8Array(v)).trim().replace(R,`
|
|
`).split(`
|
|
`),m=[],c=Object(N.toMpegTsClockFromTimescale)(d,o),u="00:00.000",a=0,E=0,g,p=!0,_=!1;L.oncue=function(U){var B=l[s],W=l.ccOffset,k=(a-c)/9e4;if(B!=null&&B.new&&(E!==void 0?W=l.ccOffset=B.start:w(l,s,k)),k&&(W=k-l.presentationOffset),_){var M=U.endTime-U.startTime,H=Object(I.normalizePts)((U.startTime+W-E)*9e4,S*9e4)/9e4;U.startTime=H,U.endTime=H+M}var X=U.text.trim();U.text=decodeURIComponent(encodeURIComponent(X)),U.id||(U.id=P(U.startTime,U.endTime,X)),U.endTime>0&&m.push(U)},L.onparsingerror=function(U){g=U},L.onflush=function(){if(g){f(g);return}b(m)},T.forEach(function(U){if(p)if(C(U,"X-TIMESTAMP-MAP=")){p=!1,_=!0,U.substr(16).split(",").forEach(function(B){C(B,"LOCAL:")?u=B.substr(6):C(B,"MPEGTS:")&&(a=parseInt(B.substr(7)))});try{E=h(u)/1e3}catch(B){_=!1,g=B}return}else U===""&&(p=!1);L.parse(U+`
|
|
`)}),L.flush()}},"./src/utils/xhr-loader.ts":function(J,z,D){"use strict";D.r(z);var K=D("./src/utils/logger.ts"),F=D("./src/loader/load-stats.ts"),O=/^age:\s*[\d.]+\s*$/m,N=function(){function I(C){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=C?C.xhrSetup:null,this.stats=new F.LoadStats,this.retryDelay=0}var R=I.prototype;return R.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},R.abortInternal=function(){var h=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),h&&(h.onreadystatechange=null,h.onprogress=null,h.readyState!==4&&(this.stats.aborted=!0,h.abort()))},R.abort=function(){var h;this.abortInternal(),(h=this.callbacks)!==null&&h!==void 0&&h.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},R.load=function(h,y,P){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=h,this.config=y,this.callbacks=P,this.retryDelay=y.retryDelay,this.loadInternal()},R.loadInternal=function(){var h=this.config,y=this.context;if(!h)return;var P=this.loader=new self.XMLHttpRequest,w=this.stats;w.loading.first=0,w.loaded=0;var x=this.xhrSetup;try{if(x)try{x(P,y.url)}catch(o){P.open("GET",y.url,!0),x(P,y.url)}P.readyState||P.open("GET",y.url,!0);var v=this.context.headers;if(v)for(var d in v)P.setRequestHeader(d,v[d])}catch(o){this.callbacks.onError({code:P.status,text:o.message},y,P);return}y.rangeEnd&&P.setRequestHeader("Range","bytes="+y.rangeStart+"-"+(y.rangeEnd-1)),P.onreadystatechange=this.readystatechange.bind(this),P.onprogress=this.loadprogress.bind(this),P.responseType=y.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),h.timeout),P.send()},R.readystatechange=function(){var h=this.context,y=this.loader,P=this.stats;if(!h||!y)return;var w=y.readyState,x=this.config;if(P.aborted)return;if(w>=2)if(self.clearTimeout(this.requestTimeout),P.loading.first===0&&(P.loading.first=Math.max(self.performance.now(),P.loading.start)),w===4){y.onreadystatechange=null,y.onprogress=null;var v=y.status;if(v>=200&&v<300){P.loading.end=Math.max(self.performance.now(),P.loading.first);var d,o;if(h.responseType==="arraybuffer"?(d=y.response,o=d.byteLength):(d=y.responseText,o=d.length),P.loaded=P.total=o,!this.callbacks)return;var l=this.callbacks.onProgress;if(l&&l(P,h,d,y),!this.callbacks)return;var s={url:y.responseURL,data:d};this.callbacks.onSuccess(s,P,h,y)}else P.retry>=x.maxRetry||v>=400&&v<499?(K.logger.error(v+" while loading "+h.url),this.callbacks.onError({code:v,text:y.statusText},h,y)):(K.logger.warn(v+" while loading "+h.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,x.maxRetryDelay),P.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),x.timeout)},R.loadtimeout=function(){K.logger.warn("timeout while loading "+this.context.url);var h=this.callbacks;h&&(this.abortInternal(),h.onTimeout(this.stats,this.context,this.loader))},R.loadprogress=function(h){var y=this.stats;y.loaded=h.loaded,h.lengthComputable&&(y.total=h.total)},R.getCacheAge=function(){var h=null;if(this.loader&&O.test(this.loader.getAllResponseHeaders())){var y=this.loader.getResponseHeader("age");h=y?parseFloat(y):null}return h},I}();z.default=N}}).default})},vHTk:function(tt,Ve,te){tt.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}},wU8J:function(tt,Ve){function te(){this.buffer=new Array,this.length=0}te.prototype={get:function(J){var z=Math.floor(J/8);return(this.buffer[z]>>>7-J%8&1)==1},put:function(J,z){for(var D=0;D<z;D++)this.putBit((J>>>z-D-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(J){var z=Math.floor(this.length/8);this.buffer.length<=z&&this.buffer.push(0),J&&(this.buffer[z]|=128>>>this.length%8),this.length++}},tt.exports=te}}]);
|