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.
NewEduCoderBuild/p__RestFul__Edit__index.45b...

182 lines
720 KiB

(window.webpackJsonp=window.webpackJsonp||[]).push([[218,7,16],{"+NIl":function(at,qe,ee){(function(Q){Q(ee("VrN/"))})(function(Q){"use strict";Q.defineMode("stex",function(K,L){"use strict";function H(w,b){w.cmdState.push(b)}function k(w){return w.cmdState.length>0?w.cmdState[w.cmdState.length-1]:null}function M(w){var b=w.cmdState.pop();b&&b.closeBracket()}function N(w){for(var b=w.cmdState,E=b.length-1;E>=0;E--){var s=b[E];if(s.name=="DEFAULT")continue;return s}return{styleIdentifier:function(){return null}}}function _(w,b,E){return function(){this.name=w,this.bracketNo=0,this.style=b,this.styles=E,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var P={};P.importmodule=_("importmodule","tag",["string","builtin"]),P.documentclass=_("documentclass","tag",["","atom"]),P.usepackage=_("usepackage","tag",["atom"]),P.begin=_("begin","tag",["atom"]),P.end=_("end","tag",["atom"]),P.label=_("label","tag",["atom"]),P.ref=_("ref","tag",["atom"]),P.eqref=_("eqref","tag",["atom"]),P.cite=_("cite","tag",["atom"]),P.bibitem=_("bibitem","tag",["atom"]),P.Bibitem=_("Bibitem","tag",["atom"]),P.RBibitem=_("RBibitem","tag",["atom"]),P.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function D(w,b){w.f=b}function c(w,b){var E;if(w.match(/^\\[a-zA-Z@]+/)){var s=w.current().slice(1);return E=P.hasOwnProperty(s)?P[s]:P.DEFAULT,E=new E,H(b,E),D(b,O),E.style}if(w.match(/^\\[$&%#{}_]/))return"tag";if(w.match(/^\\[,;!\/\\]/))return"tag";if(w.match("\\["))return D(b,function(l,u){return v(l,u,"\\]")}),"keyword";if(w.match("\\("))return D(b,function(l,u){return v(l,u,"\\)")}),"keyword";if(w.match("$$"))return D(b,function(l,u){return v(l,u,"$$")}),"keyword";if(w.match("$"))return D(b,function(l,u){return v(l,u,"$")}),"keyword";var a=w.next();if(a=="%")return w.skipToEnd(),"comment";if(a=="}"||a=="]"){if(E=k(b),E)E.closeBracket(a),D(b,O);else return"error";return"bracket"}else return a=="{"||a=="["?(E=P.DEFAULT,E=new E,H(b,E),"bracket"):/\d/.test(a)?(w.eatWhile(/[\w.%]/),"atom"):(w.eatWhile(/[\w\-_]/),E=N(b),E.name=="begin"&&(E.argument=w.current()),E.styleIdentifier())}function v(w,b,E){if(w.eatSpace())return null;if(E&&w.match(E))return D(b,c),"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 s=w.next();return s=="{"||s=="}"||s=="["||s=="]"||s=="("||s==")"?"bracket":s=="%"?(w.skipToEnd(),"comment"):"error"}function O(w,b){var E=w.peek(),s;return E=="{"||E=="["?(s=k(b),s.openBracket(E),w.eat(E),D(b,c),"bracket"):/[ \t\r]/.test(E)?(w.eat(E),null):(D(b,c),M(b),c(w,b))}return{startState:function(){var w=L.inMathMode?function(b,E){return v(b,E)}:c;return{cmdState:[],f:w}},copyState:function(w){return{cmdState:w.cmdState.slice(),f:w.f}},token:function(w,b){return b.f(w,b)},blankLine:function(w){w.f=c,w.cmdState.length=0},lineComment:"%"}}),Q.defineMIME("text/x-stex","stex"),Q.defineMIME("text/x-latex","stex")})},"19Vz":function(at,qe,ee){(function(Q){Q(ee("VrN/"))})(function(Q){Q.defineOption("placeholder","",function(_,P,D){var c=D&&D!=Q.Init;if(P&&!c)_.on("blur",k),_.on("change",M),_.on("swapDoc",M),Q.on(_.getInputField(),"compositionupdate",_.state.placeholderCompose=function(){H(_)}),M(_);else if(!P&&c){_.off("blur",k),_.off("change",M),_.off("swapDoc",M),Q.off(_.getInputField(),"compositionupdate",_.state.placeholderCompose),K(_);var v=_.getWrapperElement();v.className=v.className.replace(" CodeMirror-empty","")}P&&!_.hasFocus()&&k(_)});function K(_){_.state.placeholder&&(_.state.placeholder.parentNode.removeChild(_.state.placeholder),_.state.placeholder=null)}function L(_){K(_);var P=_.state.placeholder=document.createElement("pre");P.style.cssText="height: 0; overflow: visible",P.style.direction=_.getOption("direction"),P.className="CodeMirror-placeholder CodeMirror-line-like";var D=_.getOption("placeholder");typeof D=="string"&&(D=document.createTextNode(D)),P.appendChild(D),_.display.lineSpace.insertBefore(P,_.display.lineSpace.firstChild)}function H(_){setTimeout(function(){var P=!1,D=_.getInputField();D.nodeName=="TEXTAREA"?P=!D.value:_.lineCount()==1&&(P=!/[^\u200b]/.test(D.querySelector(".CodeMirror-line").textContent)),P?L(_):K(_)},20)}function k(_){N(_)&&L(_)}function M(_){var P=_.getWrapperElement(),D=N(_);P.className=P.className.replace(" CodeMirror-empty","")+(D?" CodeMirror-empty":""),D?L(_):K(_)}function N(_){return _.lineCount()===1&&_.getLine(0)===""}})},"1eCo":function(at,qe,ee){(function(Q){Q(ee("VrN/"))})(function(Q){"use strict";var K={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},L={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};Q.defineMode("xml",function(H,k){var M=H.indentUnit,N={},_=k.htmlMode?K:L;for(var P in _)N[P]=_[P];for(var P in k)N[P]=k[P];var D,c;function v(o,x){function y(U){return x.tokenize=U,U(o,x)}var p=o.next();if(p=="<")return o.eat("!")?o.eat("[")?o.match("CDATA[")?y(b("atom","]]>")):null:o.match("--")?y(b("comment","-->")):o.match("DOCTYPE",!0,!0)?(o.eatWhile(/[\w\._\-]/),y(E(1))):null:o.eat("?")?(o.eatWhile(/[\w\._\-]/),x.tokenize=b("meta","?>"),"meta"):(D=o.eat("/")?"closeTag":"openTag",x.tokenize=O,"tag bracket");if(p=="&"){var R;return o.eat("#")?o.eat("x")?R=o.eatWhile(/[a-fA-F\d]/)&&o.eat(";"):R=o.eatWhile(/[\d]/)&&o.eat(";"):R=o.eatWhile(/[\w\.\-:]/)&&o.eat(";"),R?"atom":"error"}else return o.eatWhile(/[^&<]/),null}v.isInText=!0;function O(o,x){var y=o.next();if(y==">"||y=="/"&&o.eat(">"))return x.tokenize=v,D=y==">"?"endTag":"selfcloseTag","tag bracket";if(y=="=")return D="equals",null;if(y=="<"){x.tokenize=v,x.state=u,x.tagName=x.tagStart=null;var p=x.tokenize(o,x);return p?p+" tag error":"tag error"}else return/[\'\"]/.test(y)?(x.tokenize=w(y),x.stringStartCol=o.column(),x.tokenize(o,x)):(o.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function w(o){var x=function(y,p){for(;!y.eol();)if(y.next()==o){p.tokenize=O;break}return"string"};return x.isInAttribute=!0,x}function b(o,x){return function(y,p){for(;!y.eol();){if(y.match(x)){p.tokenize=v;break}y.next()}return o}}function E(o){return function(x,y){for(var p;(p=x.next())!=null;){if(p=="<")return y.tokenize=E(o+1),y.tokenize(x,y);if(p==">")if(o==1){y.tokenize=v;break}else return y.tokenize=E(o-1),y.tokenize(x,y)}return"meta"}}function s(o,x,y){this.prev=o.context,this.tagName=x,this.indent=o.indented,this.startOfLine=y,(N.doNotIndent.hasOwnProperty(x)||o.context&&o.context.noIndent)&&(this.noIndent=!0)}function a(o){o.context&&(o.context=o.context.prev)}function l(o,x){for(var y;;){if(!o.context)return;if(y=o.context.tagName,!N.contextGrabbers.hasOwnProperty(y)||!N.contextGrabbers[y].hasOwnProperty(x))return;a(o)}}function u(o,x,y){return o=="openTag"?(y.tagStart=x.column(),C):o=="closeTag"?g:u}function C(o,x,y){return o=="word"?(y.tagName=x.current(),c="tag",T):N.allowMissingTagName&&o=="endTag"?(c="tag bracket",T(o,x,y)):(c="error",C)}function g(o,x,y){if(o=="word"){var p=x.current();return y.context&&y.context.tagName!=p&&N.implicitlyClosed.hasOwnProperty(y.context.tagName)&&a(y),y.context&&y.context.tagName==p||N.matchClosing===!1?(c="tag",h):(c="tag error",A)}else return N.allowMissingTagName&&o=="endTag"?(c="tag bracket",h(o,x,y)):(c="error",A)}function h(o,x,y){return o!="endTag"?(c="error",h):(a(y),u)}function A(o,x,y){return c="error",h(o,x,y)}function T(o,x,y){if(o=="word")return c="attribute",f;if(o=="endTag"||o=="selfcloseTag"){var p=y.tagName,R=y.tagStart;return y.tagName=y.tagStart=null,o=="selfcloseTag"||N.autoSelfClosers.hasOwnProperty(p)?l(y,p):(l(y,p),y.context=new s(y,p,R==y.indented)),u}return c="error",T}function f(o,x,y){return o=="equals"?m:(N.allowMissing||(c="error"),T(o,x,y))}function m(o,x,y){return o=="string"?d:o=="word"&&N.allowUnquoted?(c="string",T):(c="error",T(o,x,y))}function d(o,x,y){return o=="string"?d:T(o,x,y)}return{startState:function(o){var x={tokenize:v,state:u,indented:o||0,tagName:null,tagStart:null,context:null};return o!=null&&(x.baseIndent=o),x},token:function(o,x){if(!x.tagName&&o.sol()&&(x.indented=o.indentation()),o.eatSpace())return null;D=null;var y=x.tokenize(o,x);return(y||D)&&y!="comment"&&(c=null,x.state=x.state(D||y,o,x),c&&(y=c=="error"?y+" error":c)),y},indent:function(o,x,y){var p=o.context;if(o.tokenize.isInAttribute)return o.tagStart==o.indented?o.stringStartCol+1:o.indented+M;if(p&&p.noIndent)return Q.Pass;if(o.tokenize!=O&&o.tokenize!=v)return y?y.match(/^(\s*)/)[0].length:0;if(o.tagName)return N.multilineTagIndentPastTag!==!1?o.tagStart+o.tagName.length+2:o.tagStart+M*(N.multilineTagIndentFactor||1);if(N.alignCDATA&&/<!\[CDATA\[/.test(x))return 0;var R=x&&/^<(\/)?([\w_:\.-]*)/.exec(x);if(R&&R[1])for(;p;)if(p.tagName==R[2]){p=p.prev;break}else if(N.implicitlyClosed.hasOwnProperty(p.tagName))p=p.prev;else break;else if(R)for(;p;){var U=N.contextGrabbers[p.tagName];if(U&&U.hasOwnProperty(R[2]))p=p.prev;else break}for(;p&&p.prev&&!p.startOfLine;)p=p.prev;return p?p.indent+M:o.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:N.htmlMode?"html":"xml",helperType:N.htmlMode?"html":"xml",skipAttribute:function(o){o.state==m&&(o.state=T)},xmlCurrentTag:function(o){return o.tagName?{name:o.tagName,close:o.type=="closeTag"}:null},xmlCurrentContext:function(o){for(var x=[],y=o.context;y;y=y.prev)y.tagName&&x.push(y.tagName);return x.reverse()}}}),Q.defineMIME("text/xml","xml"),Q.defineMIME("application/xml","xml"),Q.mimeModes.hasOwnProperty("text/html")||Q.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"7Cbv":function(at,qe,ee){"use strict";var Q=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),K=new Uint8Array(16);function L(){if(!Q)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Q(K)}var H=/^(?:[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 k(O){return typeof O=="string"&&H.test(O)}for(var M=k,N=[],_=0;_<256;++_)N.push((_+256).toString(16).substr(1));function P(O){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,b=(N[O[w+0]]+N[O[w+1]]+N[O[w+2]]+N[O[w+3]]+"-"+N[O[w+4]]+N[O[w+5]]+"-"+N[O[w+6]]+N[O[w+7]]+"-"+N[O[w+8]]+N[O[w+9]]+"-"+N[O[w+10]]+N[O[w+11]]+N[O[w+12]]+N[O[w+13]]+N[O[w+14]]+N[O[w+15]]).toLowerCase();if(!M(b))throw TypeError("Stringified UUID is invalid");return b}var D=P;function c(O,w,b){O=O||{};var E=O.random||(O.rng||L)();if(E[6]=E[6]&15|64,E[8]=E[8]&63|128,w){b=b||0;for(var s=0;s<16;++s)w[b+s]=E[s];return w}return D(E)}var v=qe.a=c},"7ahc":function(at,qe,ee){"use strict";ee.d(qe,"a",function(){return C});var Q=ee("k1fw"),K=ee("0Owb"),L=ee("+L6B"),H=ee("2/Rp"),k=ee("y8nQ"),M=ee("Vl3Y"),N=ee("tJVT"),_=ee("OaEy"),P=ee("2fM7"),D=ee("cDcd"),c=ee.n(D),v=ee("VrN/"),O=ee.n(v),w=ee("p77/"),b=ee.n(w),E=ee("c5Ni"),s=ee.n(E),a=P.a.Option,l={labelCol:{span:4},wrapperCol:{span:20}},u={asp:["ASP","vbscript"],actionscript:["ActionScript(3.0)/Flash/Flex","clike"],bash:["Bash/Bat","shell"],css:["CSS","css"],c:["C","clike"],cpp:["C++","clike"],csharp:["C#","clike"],coffeescript:["CoffeeScript","coffeescript"],d:["D","d"],dart:["Dart","dart"],delphi:["Delphi/Pascal","pascal"],erlang:["Erlang","erlang"],go:["Golang","go"],groovy:["Groovy","groovy"],html:["HTML","text/html"],java:["Java","clike"],json:["JSON","text/json"],javascript:["Javascript","javascript"],lua:["Lua","lua"],less:["LESS","css"],markdown:["Markdown","gfm"],"objective-c":["Objective-C","clike"],php:["PHP","php"],perl:["Perl","perl"],python:["Python","python"],r:["R","r"],rst:["reStructedText","rst"],ruby:["Ruby","ruby"],sql:["SQL","sql"],sass:["SASS/SCSS","sass"],shell:["Shell","shell"],scala:["Scala","clike"],swift:["Swift","clike"],vb:["VB/VBScript","vb"],xml:["XML","text/xml"],yaml:["YAML","yaml"]};qe.b=function(g){var h=g.callback,A=g.onCancel,T=Object(D.useState)("python"),f=Object(N.a)(T,2),m=f[0],d=f[1];function o(y){d(u[y][1])}function x(y){h(y)}return c.a.createElement(M.a,Object(K.a)({},l,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:x}),c.a.createElement(M.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},c.a.createElement(P.a,{onChange:o},Object.keys(u).map(function(y){return c.a.createElement(a,{key:y,value:y},u[y][0])}))),c.a.createElement(M.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},c.a.createElement(C,{mode:m})),c.a.createElement("div",{className:"flex-container flex-end"},c.a.createElement(H.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),c.a.createElement(H.a,{type:"ghost",onClick:A},"\u53D6\u6D88")))};function C(g){var h=g.value,A=g.onChange,T=g.mode,f=g.options,m=f===void 0?{}:f,d=Object(D.useRef)(),o=Object(D.useState)(),x=Object(N.a)(o,2),y=x[0],p=x[1];return Object(D.useEffect)(function(){if(y){function R(U){var B=U.getValue();A&&A(B)}return y.on("change",R),function(){y.off("change",R)}}},[y,A]),Object(D.useEffect)(function(){y&&y.setOption("mode",T)},[y,T]),Object(D.useEffect)(function(){y&&((h!==y.getValue()||h==="")&&setTimeout(function(){y.setValue(h||" ")},300))},[y,h]),Object(D.useEffect)(function(){if(d.current&&!y){var R=O.a.fromTextArea(d.current,Object(Q.a)({mode:T,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},m));p(R)}},[d.current,y]),c.a.createElement("div",{className:"my-codemirror-container"},c.a.createElement("textarea",{ref:d}))}},"7ixt":function(at,qe,ee){"use strict";ee.d(qe,"a",function(){return L});var Q={adjustX:1,adjustY:1},K=[0,0],L={left:{points:["cr","cl"],overflow:Q,offset:[-4,0],targetOffset:K},right:{points:["cl","cr"],overflow:Q,offset:[4,0],targetOffset:K},top:{points:["bc","tc"],overflow:Q,offset:[0,-4],targetOffset:K},bottom:{points:["tc","bc"],overflow:Q,offset:[0,4],targetOffset:K},topLeft:{points:["bl","tl"],overflow:Q,offset:[0,-4],targetOffset:K},leftTop:{points:["tr","tl"],overflow:Q,offset:[-4,0],targetOffset:K},topRight:{points:["br","tr"],overflow:Q,offset:[0,-4],targetOffset:K},rightTop:{points:["tl","tr"],overflow:Q,offset:[4,0],targetOffset:K},bottomRight:{points:["tr","br"],overflow:Q,offset:[0,4],targetOffset:K},rightBottom:{points:["bl","br"],overflow:Q,offset:[4,0],targetOffset:K},bottomLeft:{points:["tl","bl"],overflow:Q,offset:[0,4],targetOffset:K},leftBottom:{points:["br","bl"],overflow:Q,offset:[-4,0],targetOffset:K}},H=L},"8EBN":function(at,qe,ee){(function(Q){Q(ee("VrN/"))})(function(Q){"use strict";Q.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 K=0;K<Q.modeInfo.length;K++){var L=Q.modeInfo[K];L.mimes&&(L.mime=L.mimes[0])}Q.findModeByMIME=function(H){H=H.toLowerCase();for(var k=0;k<Q.modeInfo.length;k++){var M=Q.modeInfo[k];if(M.mime==H)return M;if(M.mimes){for(var N=0;N<M.mimes.length;N++)if(M.mimes[N]==H)return M}}if(/\+xml$/.test(H))return Q.findModeByMIME("application/xml");if(/\+json$/.test(H))return Q.findModeByMIME("application/json")},Q.findModeByExtension=function(H){H=H.toLowerCase();for(var k=0;k<Q.modeInfo.length;k++){var M=Q.modeInfo[k];if(M.ext){for(var N=0;N<M.ext.length;N++)if(M.ext[N]==H)return M}}},Q.findModeByFileName=function(H){for(var k=0;k<Q.modeInfo.length;k++){var M=Q.modeInfo[k];if(M.file&&M.file.test(H))return M}var N=H.lastIndexOf("."),_=N>-1&&H.substring(N+1,H.length);if(_)return Q.findModeByExtension(_)},Q.findModeByName=function(H){H=H.toLowerCase();for(var k=0;k<Q.modeInfo.length;k++){var M=Q.modeInfo[k];if(M.name.toLowerCase()==H)return M;if(M.alias){for(var N=0;N<M.alias.length;N++)if(M.alias[N].toLowerCase()==H)return M}}}})},"8hTe":function(at,qe,ee){at.exports={button:"button___1wy9m"}},"9Bee":function(at,qe,ee){"use strict";var Q=ee("DYRE"),K=ee("zeV3"),L=ee("+L6B"),H=ee("2/Rp"),k=ee("k1fw"),M=ee("tJVT"),N=ee("cDcd"),_=ee.n(N),P=ee("vg9a"),D=ee("DlQD"),c=ee.n(D),v=ee("rUJ1");function O(he,de){var fe=he.match(/^(\s+)(?:```)/);if(fe===null)return de;var te=fe[1];return de.split(`
`).map(function(se){var ye=se.match(/^\s+/);if(ye===null)return se;var Me=Object(M.a)(ye,1),ke=Me[0];return ke.length>=te.length?se.slice(te.length):se}).join(`
`)}var w=[],b=["<ul>"],E=new c.a.Renderer,s=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function a(){w.length=0,b=["<ul>"]}var l={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function u(he,de,fe,te){if(de>=he.length||he[de].level<=fe)return de;var se=he[de];te.push("<li><a href='#"+se.anchor+"'>"+se.text+"</a>"),de++;var ye=[];return de=u(he,de,se.level,ye),ye.length>0&&(te.push("<ul>"),ye.forEach(function(Me){te.push(Me)}),te.push("</ul>")),te.push("</li>"),de=u(he,de,fe,te),de}function C(){return u(w,0,0,b),b.push("</ul>"),b.join("")}var g={heading:function(de){var fe=s.exec(de);if(fe)return{type:"heading",raw:fe[0],depth:fe[1].length,text:fe[2]}},fences:function(de){var fe=this.rules.block.fences.exec(de);if(fe){var te=fe[0],se=O(te,fe[3]||""),ye=fe[2]?fe[2].trim():fe[2];if(["latex","katex","math"].indexOf(ye)>=0){var Me=T(),ke=se;se=Me,f[Me]={type:"block",expression:ke}}return{type:"code",raw:te,lang:ye,text:se}}}},h=/(?:\${2})([^\n`]+?)(?:\${2})/gi,A=0,T=function(){return"__special_katext_id_".concat(A++,"__")},f={};function m(){return f}function d(){A=0,f={}}function o(he){return he=he.replace(h,function(de,fe){var te=T();return f[te]={type:"inline",expression:fe},te}),he}var x=E.listitem;E.listitem=function(he){return x(o(he))};var y=E.paragraph;E.paragraph=function(he){return y(o(he))};var p=E.tablecell;E.tablecell=function(he,de){return p(o(he),de)},E.code=function(he,de,fe){var te=(de||"").match(/\S*/)[0];return te?["latex","katex","math"].indexOf(te)>=0?"<p class='editormd-tex'>".concat(he,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(de,'">').concat(fe?he:Object(v.escape)(he,!0),`</code></pre>
`):'<pre class="prettyprint linenums"><code>'+(fe?he:Object(v.escape)(he,!0))+"</code></pre>"},E.heading=function(he,de,fe){var te=this.options.headerPrefix+fe.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return w.push({anchor:te,level:de,text:he}),"<h"+de+' id="'+te+'">'+he+"</h"+de+">"},c.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),c.a.use({tokenizer:g,renderer:E});var R=c.a,U=ee("SJMd"),B=ee("ulZh"),z=ee.n(B),j=ee("m3rI"),F=ee("Oy/b"),X=ee("p5ED"),q=ee("8hTe"),ne=ee.n(q),ue=/<pre[^>]*>/g;function xe(he){var de=document.createElement("div");return de.innerHTML=he,de.childNodes.length===0?"":de.childNodes[0].nodeValue}var pe=qe.a=function(he){var de=he.value,fe=de===void 0?"":de,te=he.edit,se=te===void 0?!1:te,ye=he.className,Me=he.showTextOnly,ke=he.showLines,He=he.replaces,$e=he.zoomImg,we=he.hasMask,De=he.style,_e=De===void 0?{}:De,Be=he.stylesPrev,Ne=Be===void 0?{}:Be,Se=String(fe),Ce=Object(N.useRef)(),Ke=Object(N.useRef)(),Qe=Object(N.useState)(""),Ve=Object(M.a)(Qe,2),Ue=Ve[0],tt=Ve[1],Ye=Object(N.useState)("office"),Xe=Object(M.a)(Ye,2),ve=Xe[0],et=Xe[1],Ge=Object(N.useMemo)(function(){try{var oe=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Y=/\"\/api\/attachments\/|\"\/attachments\/download\//g,$=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;Se=Se.replace(oe,"("+j.a.API_SERVER+"/api/attachments/").replace(Y,'"'+j.a.API_SERVER+"/api/attachments/").replace($,'"'+j.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(Ee){}var J=R(Se),re=m();if(Se.match(/\[TOC\]/)&&(J=J.replace("<p>[TOC]</p>",C()),a()),J=J.replace(/(__special_katext_id_\d+__)/g,function(Ee,Ie){var st=re[Ie],ht=st.type,Le=st.expression;return Object(F.renderToString)(xe(Le)||"",{displayMode:ht==="block",throwOnError:!1,output:"html"})}),J=J.replace(/▁/g,"\u2581\u2581\u2581"),d(),Me){var ge=document.createElement("div");return ge.innerHTML=J,ge.innerText}return setTimeout(function(){return le()},500),J},[Se]),be=Object(N.useRef)();l.WebkitLineClamp=ke,ke&&(_e=Object(k.a)(Object(k.a)({},_e),l));function Oe(oe){var Y=oe.target;if(Y.tagName.toUpperCase()==="IMG"){if($e){var $=Y.getAttribute("src");tt($),et("image")}}else if(Y.tagName.toUpperCase()==="A"){var J=Y.getAttribute("href");if(J.indexOf("office")>-1)oe.preventDefault(),tt(J),et("office");else if(J.indexOf("application/pdf")>-1)oe.preventDefault(),tt(J),et("pdf");else if(J.indexOf("text/html")>-1)oe.preventDefault(),tt(J),et("html");else if(J.startsWith("#")){oe.preventDefault();var re=document.getElementById(J.replace("#",""));re&&re.scrollIntoView(!0)}}}var le=function(){var Y,$=(Y=be.current)===null||Y===void 0?void 0:Y.querySelectorAll("video");$==null||$.forEach(function(J){if(J.oncontextmenu=function(){return!1},J.src.indexOf(".m3u8")>-1&&!J.canPlayType("application/vnd.apple.mpegurl")){if(z.a.isSupported()){var re=new z.a;re.loadSource(J.src),re.attachMedia(J)}}})};Object(N.useEffect)(function(){if(be.current&&Ge&&(Ge.match(ue)&&window.PR.prettyPrint()),be.current)return be.current.addEventListener("click",Oe),function(){be.current.removeEventListener("click",Oe),d(),a()}},[Ge,be.current,Oe]);var ae=function(Y){if(!se)return;Y.target.nodeName==="IMG"?(Ce.current.style.display="flex",Ce.current.style.width=Y.target.clientWidth+"px",Ce.current.style.height=Y.target.clientHeight+"px",Ce.current.style.top=Y.target.offsetTop+"px",Ce.current.style.left=Y.target.offsetLeft+"px",Ke.current.src=Y.target.getAttribute("src")):Ce.current.style.display="none"};return _.a.createElement("div",{style:{position:"relative"}},_.a.createElement("div",{ref:be,style:Object(k.a)({},_e),className:"".concat(ye||""," markdown-body ").concat(ne.a.mdBody),onMouseOver:ae,dangerouslySetInnerHTML:{__html:Ge}}),_.a.createElement("div",{ref:Ce,className:ne.a.button},_.a.createElement(K.a,null,_.a.createElement(H.a,{onClick:function(){return openCrop()}},"\u88C1\u526A"),_.a.createElement(H.a,{onClick:function(){return openEditor()}},"\u7F16\u8F91"))),_.a.createElement("img",{ref:Ke,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1,top:"-10000px"}}),_.a.createElement(X.a,{close:!0,data:Ue,type:Ue!=null&&Ue.length?ve:"",style:Object(k.a)({},Ne),onClose:function(){return tt("")}}))}},"9VGf":function(at,qe,ee){"use strict";ee.d(qe,"a",function(){return L});var Q=ee("cDcd"),K=ee.n(Q);function L(H,k){var M=Object(Q.useRef)();Object(Q.useEffect)(function(){M.current=H}),Object(Q.useEffect)(function(){function N(){M.current()}if(k!==null){var _=setInterval(N,k);return function(){return clearInterval(_)}}},[k])}},Bd2K:function(at,qe,ee){(function(Q){Q(ee("VrN/"),ee("osHv"))})(function(Q){Q.defineOption("autoCloseTags",!1,function(P,D,c){if(c!=Q.Init&&c&&P.removeKeyMap("autoCloseTags"),!D)return;var v={name:"autoCloseTags"};(typeof D!="object"||D.whenClosing!==!1)&&(v["'/'"]=function(O){return M(O)}),(typeof D!="object"||D.whenOpening!==!1)&&(v["'>'"]=function(O){return H(O)}),P.addKeyMap(v)});var K=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],L=["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 H(P){if(P.getOption("disableInput"))return Q.Pass;for(var D=P.listSelections(),c=[],v=P.getOption("autoCloseTags"),O=0;O<D.length;O++){if(!D[O].empty())return Q.Pass;var w=D[O].head,b=P.getTokenAt(w),E=Q.innerMode(P.getMode(),b.state),s=E.state,a=E.mode.xmlCurrentTag&&E.mode.xmlCurrentTag(s),l=a&&a.name;if(!l)return Q.Pass;var u=E.mode.configuration=="html",C=typeof v=="object"&&v.dontCloseTags||u&&K,g=typeof v=="object"&&v.indentTags||u&&L;b.end>w.ch&&(l=l.slice(0,l.length-b.end+w.ch));var h=l.toLowerCase();if(!l||b.type=="string"&&(b.end!=w.ch||!/[\"\']/.test(b.string.charAt(b.string.length-1))||b.string.length==1)||b.type=="tag"&&a.close||b.string.indexOf("/")==w.ch-b.start-1||C&&N(C,h)>-1||_(P,E.mode.xmlCurrentContext&&E.mode.xmlCurrentContext(s)||[],l,w,!0))return Q.Pass;var A=typeof v=="object"&&v.emptyTags;if(A&&N(A,l)>-1){c[O]={text:"/>",newPos:Q.Pos(w.line,w.ch+2)};continue}var T=g&&N(g,h)>-1;c[O]={indent:T,text:">"+(T?`
`:"")+"</"+l+">",newPos:T?Q.Pos(w.line+1,0):Q.Pos(w.line,w.ch+1)}}for(var f=typeof v=="object"&&v.dontIndentOnAutoClose,O=D.length-1;O>=0;O--){var m=c[O];P.replaceRange(m.text,D[O].head,D[O].anchor,"+insert");var d=P.listSelections().slice(0);d[O]={head:m.newPos,anchor:m.newPos},P.setSelections(d),!f&&m.indent&&(P.indentLine(m.newPos.line,null,!0),P.indentLine(m.newPos.line+1,null,!0))}}function k(P,D){for(var c=P.listSelections(),v=[],O=D?"/":"</",w=P.getOption("autoCloseTags"),b=typeof w=="object"&&w.dontIndentOnSlash,E=0;E<c.length;E++){if(!c[E].empty())return Q.Pass;var s=c[E].head,a=P.getTokenAt(s),l=Q.innerMode(P.getMode(),a.state),u=l.state;if(D&&(a.type=="string"||a.string.charAt(0)!="<"||a.start!=s.ch-1))return Q.Pass;var C,g=l.mode.name!="xml"&&P.getMode().name=="htmlmixed";if(g&&l.mode.name=="javascript")C=O+"script";else if(g&&l.mode.name=="css")C=O+"style";else{var h=l.mode.xmlCurrentContext&&l.mode.xmlCurrentContext(u);if(!h||h.length&&_(P,h,h[h.length-1],s))return Q.Pass;C=O+h[h.length-1]}P.getLine(s.line).charAt(a.end)!=">"&&(C+=">"),v[E]=C}if(P.replaceSelections(v),c=P.listSelections(),!b)for(var E=0;E<c.length;E++)(E==c.length-1||c[E].head.line<c[E+1].head.line)&&P.indentLine(c[E].head.line)}function M(P){return P.getOption("disableInput")?Q.Pass:k(P,!0)}Q.commands.closeTag=function(P){return k(P)};function N(P,D){if(P.indexOf)return P.indexOf(D);for(var c=0,v=P.length;c<v;++c)if(P[c]==D)return c;return-1}function _(P,D,c,v,O){if(!Q.scanForClosingTag)return!1;var w=Math.min(P.lastLine()+1,v.line+500),b=Q.scanForClosingTag(P,v,null,w);if(!b||b.tag!=c)return!1;for(var E=O?1:0,s=D.length-1;s>=0&&D[s]==c;s--)++E;v=b.to;for(var s=1;s<E;s++){var a=Q.scanForClosingTag(P,v,null,w);if(!a||a.tag!=c)return!1;v=a.to}return!0}})},BjJ7:function(at,qe,ee){"use strict";ee.d(qe,"d",function(){return K}),ee.d(qe,"c",function(){return L}),ee.d(qe,"e",function(){return H}),ee.d(qe,"b",function(){return k}),ee.d(qe,"a",function(){return N});var Q=ee("m3rI");function K(_){var P=!0;if(_.length>0){for(var D=0;D<_.length;D++)if(_[D].compile_success==0||!_[D].compile_success){P=!1;break}}else P=!1;return P}function L(_){for(var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",D=[],c=0;c<_.length;c++){var v=_[c],O=P?"".concat(P,"/").concat(v.name):"".concat(v.name);D.push({title:v.name,isLeaf:!(v.type==="tree"),key:O})}return D}function H(_,P,D){for(var c=0;c<_.length;c++){var v=_[c];if(v.key===P){v.children=D;break}v.children&&H(v.children,P,D)}return _}function k(_,P,D){var c;return function(){var v=this,O=arguments,w=function(){c=null,D||_.apply(v,O)},b=D&&!c;clearTimeout(c),c=setTimeout(w,P),b&&_.apply(v,O)}}var M=!0,N=Q.a.API_SERVER},"C+DQ":function(at,qe,ee){},D1Df:function(at,qe,ee){"use strict";function Q(p){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Q=function(U){return typeof U}:Q=function(U){return U&&typeof Symbol=="function"&&U.constructor===Symbol&&U!==Symbol.prototype?"symbol":typeof U},Q(p)}function K(){return K=Object.assign||function(p){for(var R=1;R<arguments.length;R++){var U=arguments[R];for(var B in U)Object.prototype.hasOwnProperty.call(U,B)&&(p[B]=U[B])}return p},K.apply(this,arguments)}function L(p,R){var U=Object.keys(p);if(Object.getOwnPropertySymbols){var B=Object.getOwnPropertySymbols(p);R&&(B=B.filter(function(z){return Object.getOwnPropertyDescriptor(p,z).enumerable})),U.push.apply(U,B)}return U}function H(p){for(var R=1;R<arguments.length;R++){var U=arguments[R]!=null?arguments[R]:{};R%2?L(U,!0).forEach(function(B){b(p,B,U[B])}):Object.getOwnPropertyDescriptors?Object.defineProperties(p,Object.getOwnPropertyDescriptors(U)):L(U).forEach(function(B){Object.defineProperty(p,B,Object.getOwnPropertyDescriptor(U,B))})}return p}function k(p,R){if(p==null)return{};var U=M(p,R),B,z;if(Object.getOwnPropertySymbols){var j=Object.getOwnPropertySymbols(p);for(z=0;z<j.length;z++){if(B=j[z],R.indexOf(B)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(p,B))continue;U[B]=p[B]}}return U}function M(p,R){if(p==null)return{};var U={},B=Object.keys(p),z,j;for(j=0;j<B.length;j++){if(z=B[j],R.indexOf(z)>=0)continue;U[z]=p[z]}return U}function N(p,R){if(!(p instanceof R))throw new TypeError("Cannot call a class as a function")}function _(p,R){for(var U=0;U<R.length;U++){var B=R[U];B.enumerable=B.enumerable||!1,B.configurable=!0,"value"in B&&(B.writable=!0),Object.defineProperty(p,B.key,B)}}function P(p,R,U){return R&&_(p.prototype,R),U&&_(p,U),p}function D(p,R){return R&&(Q(R)==="object"||typeof R=="function")?R:v(p)}function c(p){return c=Object.setPrototypeOf?Object.getPrototypeOf:function(U){return U.__proto__||Object.getPrototypeOf(U)},c(p)}function v(p){if(p===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return p}function O(p,R){if(typeof R!="function"&&R!==null)throw new TypeError("Super expression must either be null or a function");p.prototype=Object.create(R&&R.prototype,{constructor:{value:p,writable:!0,configurable:!0}}),R&&w(p,R)}function w(p,R){return w=Object.setPrototypeOf||function(B,z){return B.__proto__=z,B},w(p,R)}function b(p,R,U){return R in p?Object.defineProperty(p,R,{value:U,enumerable:!0,configurable:!0,writable:!0}):p[R]=U,p}var E=ee("cDcd"),s=ee("17x9"),a=ee("H38U"),l=ee("aRTE");function u(p){for(var R="",U=0;U<p.length;U++){var B=p.charCodeAt(U);B<128?R+=String.fromCharCode(B):B<2048?(R+=String.fromCharCode(192|B>>6),R+=String.fromCharCode(128|B&63)):B<55296||B>=57344?(R+=String.fromCharCode(224|B>>12),R+=String.fromCharCode(128|B>>6&63),R+=String.fromCharCode(128|B&63)):(U++,B=65536+((B&1023)<<10|p.charCodeAt(U)&1023),R+=String.fromCharCode(240|B>>18),R+=String.fromCharCode(128|B>>12&63),R+=String.fromCharCode(128|B>>6&63),R+=String.fromCharCode(128|B&63))}return R}var C={size:128,level:"L",bgColor:"#FFFFFF",fgColor:"#000000",includeMargin:!1},g={},h=4,A=.1;function T(p){var R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,U=[];return p.forEach(function(B,z){var j=null;B.forEach(function(F,X){if(!F&&j!==null){U.push("M".concat(j+R," ").concat(z+R,"h").concat(X-j,"v1H").concat(j+R,"z")),j=null;return}if(X===B.length-1){if(!F)return;j===null?U.push("M".concat(X+R,",").concat(z+R," h1v1H").concat(X+R,"z")):U.push("M".concat(j+R,",").concat(z+R," h").concat(X+1-j,"v1H").concat(j+R,"z"));return}F&&j===null&&(j=X)})}),U.join("")}function f(p,R){return p.slice().map(function(U,B){return B<R.y||B>=R.y+R.h?U:U.map(function(z,j){return j<R.x||j>=R.x+R.w?z:!1})})}function m(p,R){var U=p.imageSettings,B=p.size,z=p.includeMargin;if(U==null)return null;var j=z?h:0,F=R.length+j*2,X=Math.floor(B*A),q=F/B,ne=(U.width||X)*q,ue=(U.height||X)*q,xe=U.x==null?R.length/2-ne/2:U.x*q,pe=U.y==null?R.length/2-ue/2:U.y*q,he=null;if(U.excavate){var de=Math.floor(xe),fe=Math.floor(pe),te=Math.ceil(ne+xe-de),se=Math.ceil(ue+pe-fe);he={x:de,y:fe,w:te,h:se}}return{x:xe,y:pe,h:ue,w:ne,excavation:he}}var d=function(){try{new Path2D().addPath(new Path2D)}catch(p){return!1}return!0}(),o=function(p){O(R,p);function R(){var U,B;N(this,R);for(var z=arguments.length,j=new Array(z),F=0;F<z;F++)j[F]=arguments[F];return B=D(this,(U=c(R)).call.apply(U,[this].concat(j))),b(v(B),"_canvas",void 0),b(v(B),"_image",void 0),b(v(B),"state",{imgLoaded:!1}),b(v(B),"handleImageLoad",function(){B.setState({imgLoaded:!0})}),B}return P(R,[{key:"componentDidMount",value:function(){this.update()}},{key:"componentDidUpdate",value:function(){this.update()}},{key:"update",value:function(){var B=this.props,z=B.value,j=B.size,F=B.level,X=B.bgColor,q=B.fgColor,ne=B.includeMargin,ue=B.imageSettings,xe=new a(-1,l[F]);if(xe.addData(u(z)),xe.make(),this._canvas!=null){var pe=this._canvas,he=pe.getContext("2d");if(!he)return;var de=xe.modules;if(de===null)return;var fe=ne?h:0,te=de.length+fe*2,se=m(this.props,de);ue!=null&&se!=null&&(se.excavation!=null&&(de=f(de,se.excavation)));var ye=window.devicePixelRatio||1;pe.height=pe.width=j*ye;var Me=j/te*ye;he.scale(Me,Me),he.fillStyle=X,he.fillRect(0,0,te,te),he.fillStyle=q,d?he.fill(new Path2D(T(de,fe))):de.forEach(function(ke,He){ke.forEach(function($e,we){$e&&he.fillRect(we+fe,He+fe,1,1)})}),this.state.imgLoaded&&this._image&&se!=null&&he.drawImage(this._image,se.x+fe,se.y+fe,se.w,se.h)}}},{key:"render",value:function(){var B=this,z=this.props,j=z.value,F=z.size,X=z.level,q=z.bgColor,ne=z.fgColor,ue=z.style,xe=z.includeMargin,pe=z.imageSettings,he=k(z,["value","size","level","bgColor","fgColor","style","includeMargin","imageSettings"]),de=H({height:F,width:F},ue),fe=null,te=pe&&pe.src;return pe!=null&&te!=null&&(fe=E.createElement("img",{src:te,style:{display:"none"},onLoad:this.handleImageLoad,ref:function(ye){return B._image=ye}})),E.createElement(E.Fragment,null,E.createElement("canvas",K({style:de,height:F,width:F,ref:function(ye){return B._canvas=ye}},he)),fe)}}]),R}(E.PureComponent);b(o,"defaultProps",C);var x=function(p){O(R,p);function R(){return N(this,R),D(this,c(R).apply(this,arguments))}return P(R,[{key:"render",value:function(){var B=this.props,z=B.value,j=B.size,F=B.level,X=B.bgColor,q=B.fgColor,ne=B.includeMargin,ue=B.imageSettings,xe=k(B,["value","size","level","bgColor","fgColor","includeMargin","imageSettings"]),pe=new a(-1,l[F]);pe.addData(u(z)),pe.make();var he=pe.modules;if(he===null)return null;var de=ne?h:0,fe=he.length+de*2,te=m(this.props,he),se=null;ue!=null&&te!=null&&(te.excavation!=null&&(he=f(he,te.excavation)),se=E.createElement("image",{xlinkHref:ue.src,height:te.h,width:te.w,x:te.x+de,y:te.y+de,preserveAspectRatio:"none"}));var ye=T(he,de);return E.createElement("svg",K({shapeRendering:"crispEdges",height:j,width:j,viewBox:"0 0 ".concat(fe," ").concat(fe)},xe),E.createElement("path",{fill:X,d:"M0,0 h".concat(fe,"v").concat(fe,"H0z")}),E.createElement("path",{fill:q,d:ye}),se)}}]),R}(E.PureComponent);b(x,"defaultProps",C);var y=function(R){var U=R.renderAs,B=k(R,["renderAs"]),z=U==="svg"?x:o;return E.createElement(z,B)};y.defaultProps=H({renderAs:"canvas"},C),at.exports=y},DlQD:function(at,qe,ee){(function(Q,K){at.exports=K()})(this,function(){"use strict";function Q(le,ae){for(var oe=0;oe<ae.length;oe++){var Y=ae[oe];Y.enumerable=Y.enumerable||!1,Y.configurable=!0,"value"in Y&&(Y.writable=!0),Object.defineProperty(le,Y.key,Y)}}function K(le,ae,oe){return ae&&Q(le.prototype,ae),oe&&Q(le,oe),le}function L(le,ae){if(!le)return;if(typeof le=="string")return H(le,ae);var oe=Object.prototype.toString.call(le).slice(8,-1);if(oe==="Object"&&le.constructor&&(oe=le.constructor.name),oe==="Map"||oe==="Set")return Array.from(le);if(oe==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(oe))return H(le,ae)}function H(le,ae){(ae==null||ae>le.length)&&(ae=le.length);for(var oe=0,Y=new Array(ae);oe<ae;oe++)Y[oe]=le[oe];return Y}function k(le,ae){var oe;if(typeof Symbol=="undefined"||le[Symbol.iterator]==null){if(Array.isArray(le)||(oe=L(le))||ae&&le&&typeof le.length=="number"){oe&&(le=oe);var Y=0;return function(){return Y>=le.length?{done:!0}:{done:!1,value:le[Y++]}}}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 oe=le[Symbol.iterator](),oe.next.bind(oe)}function M(le,ae){return ae={exports:{}},le(ae,ae.exports),ae.exports}var N=M(function(le){function ae(){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 oe(Y){le.exports.defaults=Y}le.exports={defaults:ae(),getDefaults:ae,changeDefaults:oe}}),_=N.defaults,P=N.getDefaults,D=N.changeDefaults,c=/[&<>"']/,v=/[&<>"']/g,O=/[<>"']|&(?!#?\w+;)/,w=/[<>"']|&(?!#?\w+;)/g,b={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},E=function(ae){return b[ae]};function s(le,ae){if(ae){if(c.test(le))return le.replace(v,E)}else if(O.test(le))return le.replace(w,E);return le}var a=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function l(le){return le.replace(a,function(ae,oe){return oe=oe.toLowerCase(),oe==="colon"?":":oe.charAt(0)==="#"?oe.charAt(1)==="x"?String.fromCharCode(parseInt(oe.substring(2),16)):String.fromCharCode(+oe.substring(1)):""})}var u=/(^|[^\[])\^/g;function C(le,ae){le=le.source||le,ae=ae||"";var oe={replace:function($,J){return J=J.source||J,J=J.replace(u,"$1"),le=le.replace($,J),oe},getRegex:function(){return new RegExp(le,ae)}};return oe}var g=/[^\w:]/g,h=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function A(le,ae,oe){if(le){var Y;try{Y=decodeURIComponent(l(oe)).replace(g,"").toLowerCase()}catch($){return null}if(Y.indexOf("javascript:")===0||Y.indexOf("vbscript:")===0||Y.indexOf("data:")===0)return null}ae&&!h.test(oe)&&(oe=o(ae,oe));try{oe=encodeURI(oe).replace(/%25/g,"%")}catch($){return null}return oe}var T={},f=/^[^:]+:\/*[^/]*$/,m=/^([^:]+:)[\s\S]*$/,d=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(le,ae){T[" "+le]||(f.test(le)?T[" "+le]=le+"/":T[" "+le]=R(le,"/",!0)),le=T[" "+le];var oe=le.indexOf(":")===-1;return ae.substring(0,2)==="//"?oe?ae:le.replace(m,"$1")+ae:ae.charAt(0)==="/"?oe?ae:le.replace(d,"$1")+ae:le+ae}var x={exec:function(){}};function y(le){for(var ae=1,oe,Y;ae<arguments.length;ae++){oe=arguments[ae];for(Y in oe)Object.prototype.hasOwnProperty.call(oe,Y)&&(le[Y]=oe[Y])}return le}function p(le,ae){var oe=le.replace(/\|/g,function(J,re,ge){for(var Ee=!1,Ie=re;--Ie>=0&&ge[Ie]==="\\";)Ee=!Ee;return Ee?"|":" |"}),Y=oe.split(/ \|/),$=0;if(Y.length>ae)Y.splice(ae);else for(;Y.length<ae;)Y.push("");for(;$<Y.length;$++)Y[$]=Y[$].trim().replace(/\\\|/g,"|");return Y}function R(le,ae,oe){var Y=le.length;if(Y===0)return"";for(var $=0;$<Y;){var J=le.charAt(Y-$-1);if(J===ae&&!oe)$++;else if(J!==ae&&oe)$++;else break}return le.substr(0,Y-$)}function U(le,ae){if(le.indexOf(ae[1])===-1)return-1;for(var oe=le.length,Y=0,$=0;$<oe;$++)if(le[$]==="\\")$++;else if(le[$]===ae[0])Y++;else if(le[$]===ae[1]&&(Y--,Y<0))return $;return-1}function B(le){le&&le.sanitize&&!le.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 z={escape:s,unescape:l,edit:C,cleanUrl:A,resolveUrl:o,noopTest:x,merge:y,splitCells:p,rtrim:R,findClosingBracket:U,checkSanitizeDeprecation:B},j=N.defaults,F=z.rtrim,X=z.splitCells,q=z.escape,ne=z.findClosingBracket;function ue(le,ae,oe){var Y=ae.href,$=ae.title?q(ae.title):null,J=le[1].replace(/\\([\[\]])/g,"$1");return le[0].charAt(0)!=="!"?{type:"link",raw:oe,href:Y,title:$,text:J}:{type:"image",raw:oe,href:Y,title:$,text:q(J)}}function xe(le,ae){var oe=le.match(/^(\s+)(?:```)/);if(oe===null)return ae;var Y=oe[1];return ae.split(`
`).map(function($){var J=$.match(/^\s+/);if(J===null)return $;var re=J[0];return re.length>=Y.length?$.slice(Y.length):$}).join(`
`)}var pe=function(){function le(oe){this.options=oe||j}var ae=le.prototype;return ae.space=function(Y){var $=this.rules.block.newline.exec(Y);if($)return $[0].length>1?{type:"space",raw:$[0]}:{raw:`
`}},ae.code=function(Y,$){var J=this.rules.block.code.exec(Y);if(J){var re=$[$.length-1];if(re&&re.type==="paragraph")return{raw:J[0],text:J[0].trimRight()};var ge=J[0].replace(/^ {4}/gm,"");return{type:"code",raw:J[0],codeBlockStyle:"indented",text:this.options.pedantic?ge:F(ge,`
`)}}},ae.fences=function(Y){var $=this.rules.block.fences.exec(Y);if($){var J=$[0],re=xe(J,$[3]||"");return{type:"code",raw:J,lang:$[2]?$[2].trim():$[2],text:re}}},ae.heading=function(Y){var $=this.rules.block.heading.exec(Y);if($)return{type:"heading",raw:$[0],depth:$[1].length,text:$[2]}},ae.nptable=function(Y){var $=this.rules.block.nptable.exec(Y);if($){var J={type:"table",header:X($[1].replace(/^ *| *\| *$/g,"")),align:$[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:$[3]?$[3].replace(/\n$/,"").split(`
`):[],raw:$[0]};if(J.header.length===J.align.length){var re=J.align.length,ge;for(ge=0;ge<re;ge++)/^ *-+: *$/.test(J.align[ge])?J.align[ge]="right":/^ *:-+: *$/.test(J.align[ge])?J.align[ge]="center":/^ *:-+ *$/.test(J.align[ge])?J.align[ge]="left":J.align[ge]=null;for(re=J.cells.length,ge=0;ge<re;ge++)J.cells[ge]=X(J.cells[ge],J.header.length);return J}}},ae.hr=function(Y){var $=this.rules.block.hr.exec(Y);if($)return{type:"hr",raw:$[0]}},ae.blockquote=function(Y){var $=this.rules.block.blockquote.exec(Y);if($){var J=$[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:$[0],text:J}}},ae.list=function(Y){var $=this.rules.block.list.exec(Y);if($){for(var J=$[0],re=$[2],ge=re.length>1,Ee=re[re.length-1]===")",Ie={type:"list",raw:J,ordered:ge,start:ge?+re.slice(0,-1):"",loose:!1,items:[]},st=$[0].match(this.rules.block.item),ht=!1,Le,pt,it,Je,xt,Et,Pt,At=st.length,mt=0;mt<At;mt++)Le=st[mt],J=Le,pt=Le.length,Le=Le.replace(/^ *([*+-]|\d+[.)]) */,""),~Le.indexOf(`
`)&&(pt-=Le.length,Le=this.options.pedantic?Le.replace(/^ {1,4}/gm,""):Le.replace(new RegExp("^ {1,"+pt+"}","gm"),"")),mt!==At-1&&(it=this.rules.block.bullet.exec(st[mt+1])[0],(ge?it.length===1||!Ee&&it[it.length-1]===")":it.length>1||this.options.smartLists&&it!==re)&&(Je=st.slice(mt+1).join(`
`),Ie.raw=Ie.raw.substring(0,Ie.raw.length-Je.length),mt=At-1)),xt=ht||/\n\n(?!\s*$)/.test(Le),mt!==At-1&&(ht=Le.charAt(Le.length-1)===`
`,xt||(xt=ht)),xt&&(Ie.loose=!0),Et=/^\[[ xX]\] /.test(Le),Pt=void 0,Et&&(Pt=Le[1]!==" ",Le=Le.replace(/^\[[ xX]\] +/,"")),Ie.items.push({type:"list_item",raw:J,task:Et,checked:Pt,loose:xt,text:Le});return Ie}},ae.html=function(Y){var $=this.rules.block.html.exec(Y);if($)return{type:this.options.sanitize?"paragraph":"html",raw:$[0],pre:!this.options.sanitizer&&($[1]==="pre"||$[1]==="script"||$[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer($[0]):q($[0]):$[0]}},ae.def=function(Y){var $=this.rules.block.def.exec(Y);if($){$[3]&&($[3]=$[3].substring(1,$[3].length-1));var J=$[1].toLowerCase().replace(/\s+/g," ");return{tag:J,raw:$[0],href:$[2],title:$[3]}}},ae.table=function(Y){var $=this.rules.block.table.exec(Y);if($){var J={type:"table",header:X($[1].replace(/^ *| *\| *$/g,"")),align:$[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:$[3]?$[3].replace(/\n$/,"").split(`
`):[]};if(J.header.length===J.align.length){J.raw=$[0];var re=J.align.length,ge;for(ge=0;ge<re;ge++)/^ *-+: *$/.test(J.align[ge])?J.align[ge]="right":/^ *:-+: *$/.test(J.align[ge])?J.align[ge]="center":/^ *:-+ *$/.test(J.align[ge])?J.align[ge]="left":J.align[ge]=null;for(re=J.cells.length,ge=0;ge<re;ge++)J.cells[ge]=X(J.cells[ge].replace(/^ *\| *| *\| *$/g,""),J.header.length);return J}}},ae.lheading=function(Y){var $=this.rules.block.lheading.exec(Y);if($)return{type:"heading",raw:$[0],depth:$[2].charAt(0)==="="?1:2,text:$[1]}},ae.paragraph=function(Y){var $=this.rules.block.paragraph.exec(Y);if($)return{type:"paragraph",raw:$[0],text:$[1].charAt($[1].length-1)===`
`?$[1].slice(0,-1):$[1]}},ae.text=function(Y,$){var J=this.rules.block.text.exec(Y);if(J){var re=$[$.length-1];return re&&re.type==="text"?{raw:J[0],text:J[0]}:{type:"text",raw:J[0],text:J[0]}}},ae.escape=function(Y){var $=this.rules.inline.escape.exec(Y);if($)return{type:"escape",raw:$[0],text:q($[1])}},ae.tag=function(Y,$,J){var re=this.rules.inline.tag.exec(Y);if(re)return!$&&/^<a /i.test(re[0])?$=!0:$&&/^<\/a>/i.test(re[0])&&($=!1),!J&&/^<(pre|code|kbd|script)(\s|>)/i.test(re[0])?J=!0:J&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(re[0])&&(J=!1),{type:this.options.sanitize?"text":"html",raw:re[0],inLink:$,inRawBlock:J,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(re[0]):q(re[0]):re[0]}},ae.link=function(Y){var $=this.rules.inline.link.exec(Y);if($){var J=ne($[2],"()");if(J>-1){var re=$[0].indexOf("!")===0?5:4,ge=re+$[1].length+J;$[2]=$[2].substring(0,J),$[0]=$[0].substring(0,ge).trim(),$[3]=""}var Ee=$[2],Ie="";if(this.options.pedantic){var st=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Ee);st?(Ee=st[1],Ie=st[3]):Ie=""}else Ie=$[3]?$[3].slice(1,-1):"";Ee=Ee.trim().replace(/^<([\s\S]*)>$/,"$1");var ht=ue($,{href:Ee&&Ee.replace(this.rules.inline._escapes,"$1"),title:Ie&&Ie.replace(this.rules.inline._escapes,"$1")},$[0]);return ht}},ae.reflink=function(Y,$){var J;if((J=this.rules.inline.reflink.exec(Y))||(J=this.rules.inline.nolink.exec(Y))){var re=(J[2]||J[1]).replace(/\s+/g," ");if(re=$[re.toLowerCase()],!re||!re.href){var ge=J[0].charAt(0);return{type:"text",raw:ge,text:ge}}var Ee=ue(J,re,J[0]);return Ee}},ae.strong=function(Y,$,J){J===void 0&&(J="");var re=this.rules.inline.strong.start.exec(Y);if(re&&(!re[1]||re[1]&&(J===""||this.rules.inline.punctuation.exec(J)))){$=$.slice(-1*Y.length);var ge=re[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;ge.lastIndex=0;for(var Ee;(re=ge.exec($))!=null;)if(Ee=this.rules.inline.strong.middle.exec($.slice(0,re.index+3)),Ee)return{type:"strong",raw:Y.slice(0,Ee[0].length),text:Y.slice(2,Ee[0].length-2)}}},ae.em=function(Y,$,J){J===void 0&&(J="");var re=this.rules.inline.em.start.exec(Y);if(re&&(!re[1]||re[1]&&(J===""||this.rules.inline.punctuation.exec(J)))){$=$.slice(-1*Y.length);var ge=re[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;ge.lastIndex=0;for(var Ee;(re=ge.exec($))!=null;)if(Ee=this.rules.inline.em.middle.exec($.slice(0,re.index+2)),Ee)return{type:"em",raw:Y.slice(0,Ee[0].length),text:Y.slice(1,Ee[0].length-1)}}},ae.codespan=function(Y){var $=this.rules.inline.code.exec(Y);if($){var J=$[2].replace(/\n/g," "),re=/[^ ]/.test(J),ge=J.startsWith(" ")&&J.endsWith(" ");return re&&ge&&(J=J.substring(1,J.length-1)),J=q(J,!0),{type:"codespan",raw:$[0],text:J}}},ae.br=function(Y){var $=this.rules.inline.br.exec(Y);if($)return{type:"br",raw:$[0]}},ae.del=function(Y){var $=this.rules.inline.del.exec(Y);if($)return{type:"del",raw:$[0],text:$[1]}},ae.autolink=function(Y,$){var J=this.rules.inline.autolink.exec(Y);if(J){var re,ge;return J[2]==="@"?(re=q(this.options.mangle?$(J[1]):J[1]),ge="mailto:"+re):(re=q(J[1]),ge=re),{type:"link",raw:J[0],text:re,href:ge,tokens:[{type:"text",raw:re,text:re}]}}},ae.url=function(Y,$){var J;if(J=this.rules.inline.url.exec(Y)){var re,ge;if(J[2]==="@")re=q(this.options.mangle?$(J[0]):J[0]),ge="mailto:"+re;else{var Ee;do Ee=J[0],J[0]=this.rules.inline._backpedal.exec(J[0])[0];while(Ee!==J[0]);re=q(J[0]),J[1]==="www."?ge="http://"+re:ge=re}return{type:"link",raw:J[0],text:re,href:ge,tokens:[{type:"text",raw:re,text:re}]}}},ae.inlineText=function(Y,$,J){var re=this.rules.inline.text.exec(Y);if(re){var ge;return $?ge=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(re[0]):q(re[0]):re[0]:ge=q(this.options.smartypants?J(re[0]):re[0]),{type:"text",raw:re[0],text:ge}}},le}(),he=z.noopTest,de=z.edit,fe=z.merge,te={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]+/};te._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,te._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,te.def=de(te.def).replace("label",te._label).replace("title",te._title).getRegex(),te.bullet=/(?:[*+-]|\d{1,9}[.)])/,te.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,te.item=de(te.item,"gm").replace(/bull/g,te.bullet).getRegex(),te.list=de(te.list).replace(/bull/g,te.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+te.def.source+")").getRegex(),te._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",te._comment=/<!--(?!-?>)[\s\S]*?-->/,te.html=de(te.html,"i").replace("comment",te._comment).replace("tag",te._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),te.paragraph=de(te._paragraph).replace("hr",te.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",te._tag).getRegex(),te.blockquote=de(te.blockquote).replace("paragraph",te.paragraph).getRegex(),te.normal=fe({},te),te.gfm=fe({},te.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*|$)"}),te.gfm.nptable=de(te.gfm.nptable).replace("hr",te.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",te._tag).getRegex(),te.gfm.table=de(te.gfm.table).replace("hr",te.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",te._tag).getRegex(),te.pedantic=fe({},te.normal,{html:de(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",te._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:de(te.normal._paragraph).replace("hr",te.hr).replace("heading",` *#{1,6} *[^
]`).replace("lheading",te.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var se={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])/};se._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",se.punctuation=de(se.punctuation).replace(/punctuation/g,se._punctuation).getRegex(),se._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",se._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",se.em.start=de(se.em.start).replace(/punctuation/g,se._punctuation).getRegex(),se.em.middle=de(se.em.middle).replace(/punctuation/g,se._punctuation).replace(/overlapSkip/g,se._overlapSkip).getRegex(),se.em.endAst=de(se.em.endAst,"g").replace(/punctuation/g,se._punctuation).getRegex(),se.em.endUnd=de(se.em.endUnd,"g").replace(/punctuation/g,se._punctuation).getRegex(),se.strong.start=de(se.strong.start).replace(/punctuation/g,se._punctuation).getRegex(),se.strong.middle=de(se.strong.middle).replace(/punctuation/g,se._punctuation).replace(/blockSkip/g,se._blockSkip).getRegex(),se.strong.endAst=de(se.strong.endAst,"g").replace(/punctuation/g,se._punctuation).getRegex(),se.strong.endUnd=de(se.strong.endUnd,"g").replace(/punctuation/g,se._punctuation).getRegex(),se.blockSkip=de(se._blockSkip,"g").getRegex(),se.overlapSkip=de(se._overlapSkip,"g").getRegex(),se._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,se._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,se._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])?)+(?![-_])/,se.autolink=de(se.autolink).replace("scheme",se._scheme).replace("email",se._email).getRegex(),se._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,se.tag=de(se.tag).replace("comment",te._comment).replace("attribute",se._attribute).getRegex(),se._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,se._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,se._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,se.link=de(se.link).replace("label",se._label).replace("href",se._href).replace("title",se._title).getRegex(),se.reflink=de(se.reflink).replace("label",se._label).getRegex(),se.reflinkSearch=de(se.reflinkSearch,"g").replace("reflink",se.reflink).replace("nolink",se.nolink).getRegex(),se.normal=fe({},se),se.pedantic=fe({},se.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:de(/^!?\[(label)\]\((.*?)\)/).replace("label",se._label).getRegex(),reflink:de(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",se._label).getRegex()}),se.gfm=fe({},se.normal,{escape:de(se.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),se.gfm.url=de(se.gfm.url,"i").replace("email",se.gfm._extended_email).getRegex(),se.breaks=fe({},se.gfm,{br:de(se.br).replace("{2,}","*").getRegex(),text:de(se.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var ye={block:te,inline:se},Me=N.defaults,ke=ye.block,He=ye.inline;function $e(le){return le.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 we(le){var ae="",oe,Y,$=le.length;for(oe=0;oe<$;oe++)Y=le.charCodeAt(oe),Math.random()>.5&&(Y="x"+Y.toString(16)),ae+="&#"+Y+";";return ae}var De=function(){function le(oe){this.tokens=[],this.tokens.links=Object.create(null),this.options=oe||Me,this.options.tokenizer=this.options.tokenizer||new pe,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var Y={block:ke.normal,inline:He.normal};this.options.pedantic?(Y.block=ke.pedantic,Y.inline=He.pedantic):this.options.gfm&&(Y.block=ke.gfm,this.options.breaks?Y.inline=He.breaks:Y.inline=He.gfm),this.tokenizer.rules=Y}le.lex=function(Y,$){var J=new le($);return J.lex(Y)};var ae=le.prototype;return ae.lex=function(Y){return Y=Y.replace(/\r\n|\r/g,`
`).replace(/\t/g," "),this.blockTokens(Y,this.tokens,!0),this.inline(this.tokens),this.tokens},ae.blockTokens=function(Y,$,J){$===void 0&&($=[]),J===void 0&&(J=!0),Y=Y.replace(/^ +$/gm,"");for(var re,ge,Ee,Ie;Y;){if(re=this.tokenizer.space(Y)){Y=Y.substring(re.raw.length),re.type&&$.push(re);continue}if(re=this.tokenizer.code(Y,$)){Y=Y.substring(re.raw.length),re.type?$.push(re):(Ie=$[$.length-1],Ie.raw+=`
`+re.raw,Ie.text+=`
`+re.text);continue}if(re=this.tokenizer.fences(Y)){Y=Y.substring(re.raw.length),$.push(re);continue}if(re=this.tokenizer.heading(Y)){Y=Y.substring(re.raw.length),$.push(re);continue}if(re=this.tokenizer.nptable(Y)){Y=Y.substring(re.raw.length),$.push(re);continue}if(re=this.tokenizer.hr(Y)){Y=Y.substring(re.raw.length),$.push(re);continue}if(re=this.tokenizer.blockquote(Y)){Y=Y.substring(re.raw.length),re.tokens=this.blockTokens(re.text,[],J),$.push(re);continue}if(re=this.tokenizer.list(Y)){for(Y=Y.substring(re.raw.length),Ee=re.items.length,ge=0;ge<Ee;ge++)re.items[ge].tokens=this.blockTokens(re.items[ge].text,[],!1);$.push(re);continue}if(re=this.tokenizer.html(Y)){Y=Y.substring(re.raw.length),$.push(re);continue}if(J&&(re=this.tokenizer.def(Y))){Y=Y.substring(re.raw.length),this.tokens.links[re.tag]||(this.tokens.links[re.tag]={href:re.href,title:re.title});continue}if(re=this.tokenizer.table(Y)){Y=Y.substring(re.raw.length),$.push(re);continue}if(re=this.tokenizer.lheading(Y)){Y=Y.substring(re.raw.length),$.push(re);continue}if(J&&(re=this.tokenizer.paragraph(Y))){Y=Y.substring(re.raw.length),$.push(re);continue}if(re=this.tokenizer.text(Y,$)){Y=Y.substring(re.raw.length),re.type?$.push(re):(Ie=$[$.length-1],Ie.raw+=`
`+re.raw,Ie.text+=`
`+re.text);continue}if(Y){var st="Infinite loop on byte: "+Y.charCodeAt(0);if(this.options.silent){console.error(st);break}else throw new Error(st)}}return $},ae.inline=function(Y){var $,J,re,ge,Ee,Ie,st=Y.length;for($=0;$<st;$++){Ie=Y[$];switch(Ie.type){case"paragraph":case"text":case"heading":{Ie.tokens=[],this.inlineTokens(Ie.text,Ie.tokens);break}case"table":{for(Ie.tokens={header:[],cells:[]},ge=Ie.header.length,J=0;J<ge;J++)Ie.tokens.header[J]=[],this.inlineTokens(Ie.header[J],Ie.tokens.header[J]);for(ge=Ie.cells.length,J=0;J<ge;J++)for(Ee=Ie.cells[J],Ie.tokens.cells[J]=[],re=0;re<Ee.length;re++)Ie.tokens.cells[J][re]=[],this.inlineTokens(Ee[re],Ie.tokens.cells[J][re]);break}case"blockquote":{this.inline(Ie.tokens);break}case"list":{for(ge=Ie.items.length,J=0;J<ge;J++)this.inline(Ie.items[J].tokens);break}}}return Y},ae.inlineTokens=function(Y,$,J,re,ge){$===void 0&&($=[]),J===void 0&&(J=!1),re===void 0&&(re=!1),ge===void 0&&(ge="");var Ee,Ie=Y,st;if(this.tokens.links){var ht=Object.keys(this.tokens.links);if(ht.length>0)for(;(st=this.tokenizer.rules.inline.reflinkSearch.exec(Ie))!=null;)ht.includes(st[0].slice(st[0].lastIndexOf("[")+1,-1))&&(Ie=Ie.slice(0,st.index)+"["+"a".repeat(st[0].length-2)+"]"+Ie.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(st=this.tokenizer.rules.inline.blockSkip.exec(Ie))!=null;)Ie=Ie.slice(0,st.index)+"["+"a".repeat(st[0].length-2)+"]"+Ie.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;Y;){if(Ee=this.tokenizer.escape(Y)){Y=Y.substring(Ee.raw.length),$.push(Ee);continue}if(Ee=this.tokenizer.tag(Y,J,re)){Y=Y.substring(Ee.raw.length),J=Ee.inLink,re=Ee.inRawBlock,$.push(Ee);continue}if(Ee=this.tokenizer.link(Y)){Y=Y.substring(Ee.raw.length),Ee.type==="link"&&(Ee.tokens=this.inlineTokens(Ee.text,[],!0,re)),$.push(Ee);continue}if(Ee=this.tokenizer.reflink(Y,this.tokens.links)){Y=Y.substring(Ee.raw.length),Ee.type==="link"&&(Ee.tokens=this.inlineTokens(Ee.text,[],!0,re)),$.push(Ee);continue}if(Ee=this.tokenizer.strong(Y,Ie,ge)){Y=Y.substring(Ee.raw.length),Ee.tokens=this.inlineTokens(Ee.text,[],J,re),$.push(Ee);continue}if(Ee=this.tokenizer.em(Y,Ie,ge)){Y=Y.substring(Ee.raw.length),Ee.tokens=this.inlineTokens(Ee.text,[],J,re),$.push(Ee);continue}if(Ee=this.tokenizer.codespan(Y)){Y=Y.substring(Ee.raw.length),$.push(Ee);continue}if(Ee=this.tokenizer.br(Y)){Y=Y.substring(Ee.raw.length),$.push(Ee);continue}if(Ee=this.tokenizer.del(Y)){Y=Y.substring(Ee.raw.length),Ee.tokens=this.inlineTokens(Ee.text,[],J,re),$.push(Ee);continue}if(Ee=this.tokenizer.autolink(Y,we)){Y=Y.substring(Ee.raw.length),$.push(Ee);continue}if(!J&&(Ee=this.tokenizer.url(Y,we))){Y=Y.substring(Ee.raw.length),$.push(Ee);continue}if(Ee=this.tokenizer.inlineText(Y,re,$e)){Y=Y.substring(Ee.raw.length),ge=Ee.raw.slice(-1),$.push(Ee);continue}if(Y){var Le="Infinite loop on byte: "+Y.charCodeAt(0);if(this.options.silent){console.error(Le);break}else throw new Error(Le)}}return $},K(le,null,[{key:"rules",get:function(){return{block:ke,inline:He}}}]),le}(),_e=N.defaults,Be=z.cleanUrl,Ne=z.escape,Se=function(){function le(oe){this.options=oe||_e}var ae=le.prototype;return ae.code=function(Y,$,J){var re=($||"").match(/\S*/)[0];if(this.options.highlight){var ge=this.options.highlight(Y,re);ge!=null&&ge!==Y&&(J=!0,Y=ge)}return re?'<pre><code class="'+this.options.langPrefix+Ne(re,!0)+'">'+(J?Y:Ne(Y,!0))+`</code></pre>
`:"<pre><code>"+(J?Y:Ne(Y,!0))+`</code></pre>
`},ae.blockquote=function(Y){return`<blockquote>
`+Y+`</blockquote>
`},ae.html=function(Y){return Y},ae.heading=function(Y,$,J,re){return this.options.headerIds?"<h"+$+' id="'+this.options.headerPrefix+re.slug(J)+'">'+Y+"</h"+$+`>
`:"<h"+$+">"+Y+"</h"+$+`>
`},ae.hr=function(){return this.options.xhtml?`<hr/>
`:`<hr>
`},ae.list=function(Y,$,J){var re=$?"ol":"ul",ge=$&&J!==1?' start="'+J+'"':"";return"<"+re+ge+`>
`+Y+"</"+re+`>
`},ae.listitem=function(Y){return"<li>"+Y+`</li>
`},ae.checkbox=function(Y){return"<input "+(Y?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},ae.paragraph=function(Y){return"<p>"+Y+`</p>
`},ae.table=function(Y,$){return $&&($="<tbody>"+$+"</tbody>"),`<table>
<thead>
`+Y+`</thead>
`+$+`</table>
`},ae.tablerow=function(Y){return`<tr>
`+Y+`</tr>
`},ae.tablecell=function(Y,$){var J=$.header?"th":"td",re=$.align?"<"+J+' align="'+$.align+'">':"<"+J+">";return re+Y+"</"+J+`>
`},ae.strong=function(Y){return"<strong>"+Y+"</strong>"},ae.em=function(Y){return"<em>"+Y+"</em>"},ae.codespan=function(Y){return"<code>"+Y+"</code>"},ae.br=function(){return this.options.xhtml?"<br/>":"<br>"},ae.del=function(Y){return"<del>"+Y+"</del>"},ae.link=function(Y,$,J){if(Y=Be(this.options.sanitize,this.options.baseUrl,Y),Y===null)return J;var re='<a href="'+Ne(Y)+'"';return $&&(re+=' title="'+$+'"'),re+=">"+J+"</a>",re},ae.image=function(Y,$,J){if(Y=Be(this.options.sanitize,this.options.baseUrl,Y),Y===null)return J;var re='<img src="'+Y+'" alt="'+J+'"';return $&&(re+=' title="'+$+'"'),re+=this.options.xhtml?"/>":">",re},ae.text=function(Y){return Y},le}(),Ce=function(){function le(){}var ae=le.prototype;return ae.strong=function(Y){return Y},ae.em=function(Y){return Y},ae.codespan=function(Y){return Y},ae.del=function(Y){return Y},ae.html=function(Y){return Y},ae.text=function(Y){return Y},ae.link=function(Y,$,J){return""+J},ae.image=function(Y,$,J){return""+J},ae.br=function(){return""},le}(),Ke=function(){function le(){this.seen={}}var ae=le.prototype;return ae.slug=function(Y){var $=Y.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty($)){var J=$;do this.seen[J]++,$=J+"-"+this.seen[J];while(this.seen.hasOwnProperty($))}return this.seen[$]=0,$},le}(),Qe=N.defaults,Ve=z.unescape,Ue=function(){function le(oe){this.options=oe||Qe,this.options.renderer=this.options.renderer||new Se,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Ce,this.slugger=new Ke}le.parse=function(Y,$){var J=new le($);return J.parse(Y)};var ae=le.prototype;return ae.parse=function(Y,$){$===void 0&&($=!0);var J="",re,ge,Ee,Ie,st,ht,Le,pt,it,Je,xt,Et,Pt,At,mt,or,Kt,Ut,Tr=Y.length;for(re=0;re<Tr;re++){Je=Y[re];switch(Je.type){case"space":continue;case"hr":{J+=this.renderer.hr();continue}case"heading":{J+=this.renderer.heading(this.parseInline(Je.tokens),Je.depth,Ve(this.parseInline(Je.tokens,this.textRenderer)),this.slugger);continue}case"code":{J+=this.renderer.code(Je.text,Je.lang,Je.escaped);continue}case"table":{for(pt="",Le="",Ie=Je.header.length,ge=0;ge<Ie;ge++)Le+=this.renderer.tablecell(this.parseInline(Je.tokens.header[ge]),{header:!0,align:Je.align[ge]});for(pt+=this.renderer.tablerow(Le),it="",Ie=Je.cells.length,ge=0;ge<Ie;ge++){for(ht=Je.tokens.cells[ge],Le="",st=ht.length,Ee=0;Ee<st;Ee++)Le+=this.renderer.tablecell(this.parseInline(ht[Ee]),{header:!1,align:Je.align[Ee]});it+=this.renderer.tablerow(Le)}J+=this.renderer.table(pt,it);continue}case"blockquote":{it=this.parse(Je.tokens),J+=this.renderer.blockquote(it);continue}case"list":{for(xt=Je.ordered,Et=Je.start,Pt=Je.loose,Ie=Je.items.length,it="",ge=0;ge<Ie;ge++)mt=Je.items[ge],or=mt.checked,Kt=mt.task,At="",mt.task&&(Ut=this.renderer.checkbox(or),Pt?mt.tokens.length>0&&mt.tokens[0].type==="text"?(mt.tokens[0].text=Ut+" "+mt.tokens[0].text,mt.tokens[0].tokens&&mt.tokens[0].tokens.length>0&&mt.tokens[0].tokens[0].type==="text"&&(mt.tokens[0].tokens[0].text=Ut+" "+mt.tokens[0].tokens[0].text)):mt.tokens.unshift({type:"text",text:Ut}):At+=Ut),At+=this.parse(mt.tokens,Pt),it+=this.renderer.listitem(At,Kt,or);J+=this.renderer.list(it,xt,Et);continue}case"html":{J+=this.renderer.html(Je.text);continue}case"paragraph":{J+=this.renderer.paragraph(this.parseInline(Je.tokens));continue}case"text":{for(it=Je.tokens?this.parseInline(Je.tokens):Je.text;re+1<Tr&&Y[re+1].type==="text";)Je=Y[++re],it+=`
`+(Je.tokens?this.parseInline(Je.tokens):Je.text);J+=$?this.renderer.paragraph(it):it;continue}default:{var vr='Token with "'+Je.type+'" type was not found.';if(this.options.silent){console.error(vr);return}else throw new Error(vr)}}}return J},ae.parseInline=function(Y,$){$=$||this.renderer;var J="",re,ge,Ee=Y.length;for(re=0;re<Ee;re++){ge=Y[re];switch(ge.type){case"escape":{J+=$.text(ge.text);break}case"html":{J+=$.html(ge.text);break}case"link":{J+=$.link(ge.href,ge.title,this.parseInline(ge.tokens,$));break}case"image":{J+=$.image(ge.href,ge.title,ge.text);break}case"strong":{J+=$.strong(this.parseInline(ge.tokens,$));break}case"em":{J+=$.em(this.parseInline(ge.tokens,$));break}case"codespan":{J+=$.codespan(ge.text);break}case"br":{J+=$.br();break}case"del":{J+=$.del(this.parseInline(ge.tokens,$));break}case"text":{J+=$.text(ge.text);break}default:{var Ie='Token with "'+ge.type+'" type was not found.';if(this.options.silent){console.error(Ie);return}else throw new Error(Ie)}}}return J},le}(),tt=z.merge,Ye=z.checkSanitizeDeprecation,Xe=z.escape,ve=N.getDefaults,et=N.changeDefaults,Ge=N.defaults;function be(le,ae,oe){if(typeof le=="undefined"||le===null)throw new Error("marked(): input parameter is undefined or null");if(typeof le!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(le)+", string expected");if(typeof ae=="function"&&(oe=ae,ae=null),ae=tt({},be.defaults,ae||{}),Ye(ae),oe){var Y=ae.highlight,$;try{$=De.lex(le,ae)}catch(Ee){return oe(Ee)}var J=function(Ie){var st;if(!Ie)try{st=Ue.parse($,ae)}catch(ht){Ie=ht}return ae.highlight=Y,Ie?oe(Ie):oe(null,st)};if(!Y||Y.length<3)return J();if(delete ae.highlight,!$.length)return J();var re=0;be.walkTokens($,function(Ee){Ee.type==="code"&&(re++,setTimeout(function(){Y(Ee.text,Ee.lang,function(Ie,st){if(Ie)return J(Ie);st!=null&&st!==Ee.text&&(Ee.text=st,Ee.escaped=!0),re--,re===0&&J()})},0))}),re===0&&J();return}try{var ge=De.lex(le,ae);return ae.walkTokens&&be.walkTokens(ge,ae.walkTokens),Ue.parse(ge,ae)}catch(Ee){if(Ee.message+=`
Please report this to https://github.com/markedjs/marked.`,ae.silent)return"<p>An error occurred:</p><pre>"+Xe(Ee.message+"",!0)+"</pre>";throw Ee}}be.options=be.setOptions=function(le){return tt(be.defaults,le),et(be.defaults),be},be.getDefaults=ve,be.defaults=Ge,be.use=function(le){var ae=tt({},le);if(le.renderer&&function(){var Y=be.defaults.renderer||new Se,$=function(ge){var Ee=Y[ge];Y[ge]=function(){for(var Ie=arguments.length,st=new Array(Ie),ht=0;ht<Ie;ht++)st[ht]=arguments[ht];var Le=le.renderer[ge].apply(Y,st);return Le===!1&&(Le=Ee.apply(Y,st)),Le}};for(var J in le.renderer)$(J);ae.renderer=Y}(),le.tokenizer&&function(){var Y=be.defaults.tokenizer||new pe,$=function(ge){var Ee=Y[ge];Y[ge]=function(){for(var Ie=arguments.length,st=new Array(Ie),ht=0;ht<Ie;ht++)st[ht]=arguments[ht];var Le=le.tokenizer[ge].apply(Y,st);return Le===!1&&(Le=Ee.apply(Y,st)),Le}};for(var J in le.tokenizer)$(J);ae.tokenizer=Y}(),le.walkTokens){var oe=be.defaults.walkTokens;ae.walkTokens=function(Y){le.walkTokens(Y),oe&&oe(Y)}}be.setOptions(ae)},be.walkTokens=function(le,ae){for(var oe=k(le),Y;!(Y=oe()).done;){var $=Y.value;ae($);switch($.type){case"table":{for(var J=k($.tokens.header),re;!(re=J()).done;){var ge=re.value;be.walkTokens(ge,ae)}for(var Ee=k($.tokens.cells),Ie;!(Ie=Ee()).done;)for(var st=Ie.value,ht=k(st),Le;!(Le=ht()).done;){var pt=Le.value;be.walkTokens(pt,ae)}break}case"list":{be.walkTokens($.items,ae);break}default:$.tokens&&be.walkTokens($.tokens,ae)}}},be.Parser=Ue,be.parser=Ue.parse,be.Renderer=Se,be.TextRenderer=Ce,be.Lexer=De,be.lexer=De.lex,be.Tokenizer=pe,be.Slugger=Ke,be.parse=be;var Oe=be;return Oe})},ELLl:function(at,qe,ee){(function(Q){Q(ee("VrN/"))})(function(Q){var K={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},L=Q.Pos;Q.defineOption("autoCloseBrackets",!1,function(b,E,s){s&&s!=Q.Init&&(b.removeKeyMap(k),b.state.closeBrackets=null),E&&(M(H(E,"pairs")),b.state.closeBrackets=E,b.addKeyMap(k))});function H(b,E){return E=="pairs"&&typeof b=="string"?b:typeof b=="object"&&b[E]!=null?b[E]:K[E]}var k={Backspace:P,Enter:D};function M(b){for(var E=0;E<b.length;E++){var s=b.charAt(E),a="'"+s+"'";k[a]||(k[a]=N(s))}}M(K.pairs+"`");function N(b){return function(E){return v(E,b)}}function _(b){var E=b.state.closeBrackets;if(!E||E.override)return E;var s=b.getModeAt(b.getCursor());return s.closeBrackets||E}function P(b){var E=_(b);if(!E||b.getOption("disableInput"))return Q.Pass;for(var s=H(E,"pairs"),a=b.listSelections(),l=0;l<a.length;l++){if(!a[l].empty())return Q.Pass;var u=O(b,a[l].head);if(!u||s.indexOf(u)%2!=0)return Q.Pass}for(var l=a.length-1;l>=0;l--){var C=a[l].head;b.replaceRange("",L(C.line,C.ch-1),L(C.line,C.ch+1),"+delete")}}function D(b){var E=_(b),s=E&&H(E,"explode");if(!s||b.getOption("disableInput"))return Q.Pass;for(var a=b.listSelections(),l=0;l<a.length;l++){if(!a[l].empty())return Q.Pass;var u=O(b,a[l].head);if(!u||s.indexOf(u)%2!=0)return Q.Pass}b.operation(function(){var C=b.lineSeparator()||`
`;b.replaceSelection(C+C,null),b.execCommand("goCharLeft"),a=b.listSelections();for(var g=0;g<a.length;g++){var h=a[g].head.line;b.indentLine(h,null,!0),b.indentLine(h+1,null,!0)}})}function c(b){var E=Q.cmpPos(b.anchor,b.head)>0;return{anchor:new L(b.anchor.line,b.anchor.ch+(E?-1:1)),head:new L(b.head.line,b.head.ch+(E?1:-1))}}function v(b,E){var s=_(b);if(!s||b.getOption("disableInput"))return Q.Pass;var a=H(s,"pairs"),l=a.indexOf(E);if(l==-1)return Q.Pass;for(var u=H(s,"closeBefore"),C=H(s,"triples"),g=a.charAt(l+1)==E,h=b.listSelections(),A=l%2==0,T,f=0;f<h.length;f++){var m=h[f],d=m.head,o,x=b.getRange(d,L(d.line,d.ch+1));if(A&&!m.empty())o="surround";else if((g||!A)&&x==E)g&&w(b,d)?o="both":C.indexOf(E)>=0&&b.getRange(d,L(d.line,d.ch+3))==E+E+E?o="skipThree":o="skip";else if(g&&d.ch>1&&C.indexOf(E)>=0&&b.getRange(L(d.line,d.ch-2),d)==E+E){if(d.ch>2&&/\bstring/.test(b.getTokenTypeAt(L(d.line,d.ch-2))))return Q.Pass;o="addFour"}else if(g){var y=d.ch==0?" ":b.getRange(L(d.line,d.ch-1),d);if(!Q.isWordChar(x)&&y!=E&&!Q.isWordChar(y))o="both";else return Q.Pass}else if(A&&(x.length===0||/\s/.test(x)||u.indexOf(x)>-1))o="both";else return Q.Pass;if(!T)T=o;else if(T!=o)return Q.Pass}var p=l%2?a.charAt(l-1):E,R=l%2?E:a.charAt(l+1);b.operation(function(){if(T=="skip")b.execCommand("goCharRight");else if(T=="skipThree")for(var U=0;U<3;U++)b.execCommand("goCharRight");else if(T=="surround"){for(var B=b.getSelections(),U=0;U<B.length;U++)B[U]=p+B[U]+R;b.replaceSelections(B,"around"),B=b.listSelections().slice();for(var U=0;U<B.length;U++)B[U]=c(B[U]);b.setSelections(B)}else T=="both"?(b.replaceSelection(p+R,null),b.triggerElectric(p+R),b.execCommand("goCharLeft")):T=="addFour"&&(b.replaceSelection(p+p+p+p,"before"),b.execCommand("goCharRight"))})}function O(b,E){var s=b.getRange(L(E.line,E.ch-1),L(E.line,E.ch+1));return s.length==2?s:null}function w(b,E){var s=b.getTokenAt(L(E.line,E.ch+1));return/\bstring/.test(s.type)&&s.start==E.ch&&(E.ch==0||!/\bstring/.test(b.getTokenTypeAt(E)))}})},Gytx:function(at,qe){at.exports=function(Q,K,L,H){var k=L?L.call(H,Q,K):void 0;if(k!==void 0)return!!k;if(Q===K)return!0;if(typeof Q!="object"||!Q||typeof K!="object"||!K)return!1;var M=Object.keys(Q),N=Object.keys(K);if(M.length!==N.length)return!1;for(var _=Object.prototype.hasOwnProperty.bind(K),P=0;P<M.length;P++){var D=M[P];if(!_(D))return!1;var c=Q[D],v=K[D];if(k=L?L.call(H,c,v,D):void 0,k===!1||k===void 0&&c!==v)return!1}return!0}},H38U:function(at,qe,ee){var Q=ee("f4xo"),K=ee("rcnY"),L=ee("wU8J"),H=ee("Iq15"),k=ee("dWSS");function M(_,P){this.typeNumber=_,this.errorCorrectLevel=P,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}var N=M.prototype;N.addData=function(_){var P=new Q(_);this.dataList.push(P),this.dataCache=null},N.isDark=function(_,P){if(_<0||this.moduleCount<=_||P<0||this.moduleCount<=P)throw new Error(_+","+P);return this.modules[_][P]},N.getModuleCount=function(){return this.moduleCount},N.make=function(){if(this.typeNumber<1){var _=1;for(_=1;_<40;_++){for(var P=K.getRSBlocks(_,this.errorCorrectLevel),D=new L,c=0,v=0;v<P.length;v++)c+=P[v].dataCount;for(var v=0;v<this.dataList.length;v++){var O=this.dataList[v];D.put(O.mode,4),D.put(O.getLength(),H.getLengthInBits(O.mode,_)),O.write(D)}if(D.getLengthInBits()<=c*8)break}this.typeNumber=_}this.makeImpl(!1,this.getBestMaskPattern())},N.makeImpl=function(_,P){this.moduleCount=this.typeNumber*4+17,this.modules=new Array(this.moduleCount);for(var D=0;D<this.moduleCount;D++){this.modules[D]=new Array(this.moduleCount);for(var c=0;c<this.moduleCount;c++)this.modules[D][c]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(_,P),this.typeNumber>=7&&this.setupTypeNumber(_),this.dataCache==null&&(this.dataCache=M.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,P)},N.setupPositionProbePattern=function(_,P){for(var D=-1;D<=7;D++){if(_+D<=-1||this.moduleCount<=_+D)continue;for(var c=-1;c<=7;c++){if(P+c<=-1||this.moduleCount<=P+c)continue;0<=D&&D<=6&&(c==0||c==6)||0<=c&&c<=6&&(D==0||D==6)||2<=D&&D<=4&&2<=c&&c<=4?this.modules[_+D][P+c]=!0:this.modules[_+D][P+c]=!1}}},N.getBestMaskPattern=function(){for(var _=0,P=0,D=0;D<8;D++){this.makeImpl(!0,D);var c=H.getLostPoint(this);(D==0||_>c)&&(_=c,P=D)}return P},N.createMovieClip=function(_,P,D){var c=_.createEmptyMovieClip(P,D),v=1;this.make();for(var O=0;O<this.modules.length;O++)for(var w=O*v,b=0;b<this.modules[O].length;b++){var E=b*v,s=this.modules[O][b];s&&(c.beginFill(0,100),c.moveTo(E,w),c.lineTo(E+v,w),c.lineTo(E+v,w+v),c.lineTo(E,w+v),c.endFill())}return c},N.setupTimingPattern=function(){for(var _=8;_<this.moduleCount-8;_++){if(this.modules[_][6]!=null)continue;this.modules[_][6]=_%2==0}for(var P=8;P<this.moduleCount-8;P++){if(this.modules[6][P]!=null)continue;this.modules[6][P]=P%2==0}},N.setupPositionAdjustPattern=function(){for(var _=H.getPatternPosition(this.typeNumber),P=0;P<_.length;P++)for(var D=0;D<_.length;D++){var c=_[P],v=_[D];if(this.modules[c][v]!=null)continue;for(var O=-2;O<=2;O++)for(var w=-2;w<=2;w++)O==-2||O==2||w==-2||w==2||O==0&&w==0?this.modules[c+O][v+w]=!0:this.modules[c+O][v+w]=!1}},N.setupTypeNumber=function(_){for(var P=H.getBCHTypeNumber(this.typeNumber),D=0;D<18;D++){var c=!_&&(P>>D&1)==1;this.modules[Math.floor(D/3)][D%3+this.moduleCount-8-3]=c}for(var D=0;D<18;D++){var c=!_&&(P>>D&1)==1;this.modules[D%3+this.moduleCount-8-3][Math.floor(D/3)]=c}},N.setupTypeInfo=function(_,P){for(var D=this.errorCorrectLevel<<3|P,c=H.getBCHTypeInfo(D),v=0;v<15;v++){var O=!_&&(c>>v&1)==1;v<6?this.modules[v][8]=O:v<8?this.modules[v+1][8]=O:this.modules[this.moduleCount-15+v][8]=O}for(var v=0;v<15;v++){var O=!_&&(c>>v&1)==1;v<8?this.modules[8][this.moduleCount-v-1]=O:v<9?this.modules[8][15-v-1+1]=O:this.modules[8][15-v-1]=O}this.modules[this.moduleCount-8][8]=!_},N.mapData=function(_,P){for(var D=-1,c=this.moduleCount-1,v=7,O=0,w=this.moduleCount-1;w>0;w-=2)for(w==6&&w--;;){for(var b=0;b<2;b++)if(this.modules[c][w-b]==null){var E=!1;O<_.length&&(E=(_[O]>>>v&1)==1);var s=H.getMask(P,c,w-b);s&&(E=!E),this.modules[c][w-b]=E,v--,v==-1&&(O++,v=7)}if(c+=D,c<0||this.moduleCount<=c){c-=D,D=-D;break}}},M.PAD0=236,M.PAD1=17,M.createData=function(_,P,D){for(var c=K.getRSBlocks(_,P),v=new L,O=0;O<D.length;O++){var w=D[O];v.put(w.mode,4),v.put(w.getLength(),H.getLengthInBits(w.mode,_)),w.write(v)}for(var b=0,O=0;O<c.length;O++)b+=c[O].dataCount;if(v.getLengthInBits()>b*8)throw new Error("code length overflow. ("+v.getLengthInBits()+">"+b*8+")");for(v.getLengthInBits()+4<=b*8&&v.put(0,4);v.getLengthInBits()%8!=0;)v.putBit(!1);for(;!(v.getLengthInBits()>=b*8);){if(v.put(M.PAD0,8),v.getLengthInBits()>=b*8)break;v.put(M.PAD1,8)}return M.createBytes(v,c)},M.createBytes=function(_,P){for(var D=0,c=0,v=0,O=new Array(P.length),w=new Array(P.length),b=0;b<P.length;b++){var E=P[b].dataCount,s=P[b].totalCount-E;c=Math.max(c,E),v=Math.max(v,s),O[b]=new Array(E);for(var a=0;a<O[b].length;a++)O[b][a]=255&_.buffer[a+D];D+=E;var l=H.getErrorCorrectPolynomial(s),u=new k(O[b],l.getLength()-1),C=u.mod(l);w[b]=new Array(l.getLength()-1);for(var a=0;a<w[b].length;a++){var g=a+C.getLength()-w[b].length;w[b][a]=g>=0?C.get(g):0}}for(var h=0,a=0;a<P.length;a++)h+=P[a].totalCount;for(var A=new Array(h),T=0,a=0;a<c;a++)for(var b=0;b<P.length;b++)a<O[b].length&&(A[T++]=O[b][a]);for(var a=0;a<v;a++)for(var b=0;b<P.length;b++)a<w[b].length&&(A[T++]=w[b][a]);return A},at.exports=M},HmJG:function(at,qe,ee){},Iq15:function(at,qe,ee){var Q=ee("nVVt"),K=ee("dWSS"),L=ee("dQei"),H={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},k={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(M){for(var N=M<<10;k.getBCHDigit(N)-k.getBCHDigit(k.G15)>=0;)N^=k.G15<<k.getBCHDigit(N)-k.getBCHDigit(k.G15);return(M<<10|N)^k.G15_MASK},getBCHTypeNumber:function(M){for(var N=M<<12;k.getBCHDigit(N)-k.getBCHDigit(k.G18)>=0;)N^=k.G18<<k.getBCHDigit(N)-k.getBCHDigit(k.G18);return M<<12|N},getBCHDigit:function(M){for(var N=0;M!=0;)N++,M>>>=1;return N},getPatternPosition:function(M){return k.PATTERN_POSITION_TABLE[M-1]},getMask:function(M,N,_){switch(M){case H.PATTERN000:return(N+_)%2==0;case H.PATTERN001:return N%2==0;case H.PATTERN010:return _%3==0;case H.PATTERN011:return(N+_)%3==0;case H.PATTERN100:return(Math.floor(N/2)+Math.floor(_/3))%2==0;case H.PATTERN101:return N*_%2+N*_%3==0;case H.PATTERN110:return(N*_%2+N*_%3)%2==0;case H.PATTERN111:return(N*_%3+(N+_)%2)%2==0;default:throw new Error("bad maskPattern:"+M)}},getErrorCorrectPolynomial:function(M){for(var N=new K([1],0),_=0;_<M;_++)N=N.multiply(new K([1,L.gexp(_)],0));return N},getLengthInBits:function(M,N){if(1<=N&&N<10)switch(M){case Q.MODE_NUMBER:return 10;case Q.MODE_ALPHA_NUM:return 9;case Q.MODE_8BIT_BYTE:return 8;case Q.MODE_KANJI:return 8;default:throw new Error("mode:"+M)}else if(N<27)switch(M){case Q.MODE_NUMBER:return 12;case Q.MODE_ALPHA_NUM:return 11;case Q.MODE_8BIT_BYTE:return 16;case Q.MODE_KANJI:return 10;default:throw new Error("mode:"+M)}else if(N<41)switch(M){case Q.MODE_NUMBER:return 14;case Q.MODE_ALPHA_NUM:return 13;case Q.MODE_8BIT_BYTE:return 16;case Q.MODE_KANJI:return 12;default:throw new Error("mode:"+M)}else throw new Error("type:"+N)},getLostPoint:function(M){for(var N=M.getModuleCount(),_=0,P=0;P<N;P++)for(var D=0;D<N;D++){for(var c=0,v=M.isDark(P,D),O=-1;O<=1;O++){if(P+O<0||N<=P+O)continue;for(var w=-1;w<=1;w++){if(D+w<0||N<=D+w)continue;if(O==0&&w==0)continue;v==M.isDark(P+O,D+w)&&c++}}c>5&&(_+=3+c-5)}for(var P=0;P<N-1;P++)for(var D=0;D<N-1;D++){var b=0;M.isDark(P,D)&&b++,M.isDark(P+1,D)&&b++,M.isDark(P,D+1)&&b++,M.isDark(P+1,D+1)&&b++,(b==0||b==4)&&(_+=3)}for(var P=0;P<N;P++)for(var D=0;D<N-6;D++)M.isDark(P,D)&&!M.isDark(P,D+1)&&M.isDark(P,D+2)&&M.isDark(P,D+3)&&M.isDark(P,D+4)&&!M.isDark(P,D+5)&&M.isDark(P,D+6)&&(_+=40);for(var D=0;D<N;D++)for(var P=0;P<N-6;P++)M.isDark(P,D)&&!M.isDark(P+1,D)&&M.isDark(P+2,D)&&M.isDark(P+3,D)&&M.isDark(P+4,D)&&!M.isDark(P+5,D)&&M.isDark(P+6,D)&&(_+=40);for(var E=0,D=0;D<N;D++)for(var P=0;P<N;P++)M.isDark(P,D)&&E++;var s=Math.abs(100*E/N/N-50)/5;return _+=s*10,_}};at.exports=k},LdHM:function(at,qe,ee){"use strict";ee.d(qe,"b",function(){return u}),ee.d(qe,"a",function(){return g});var Q=ee("1OyB"),K=ee("vuIU"),L=ee("Ji7U"),H=ee("LK+K"),k=ee("cDcd"),M=ee("rePB"),N=ee("Ff2n"),_=ee("ODXe"),P=ee("4IlW"),D=ee("bX4T"),c=ee("YrtM"),v=ee("TSYQ"),O=ee.n(v),w=ee("+nKL"),b=ee("8OUc"),E=function(X,q){var ne=X.prefixCls,ue=X.id,xe=X.flattenOptions,pe=X.childrenAsData,he=X.values,de=X.searchValue,fe=X.multiple,te=X.defaultActiveFirstOption,se=X.height,ye=X.itemHeight,Me=X.notFoundContent,ke=X.open,He=X.menuItemSelectedIcon,$e=X.virtual,we=X.onSelect,De=X.onToggleOpen,_e=X.onActiveValue,Be=X.onScroll,Ne=X.onMouseEnter,Se="".concat(ne,"-item"),Ce=Object(c.a)(function(){return xe},[ke,xe],function(Oe,le){return le[0]&&Oe[1]!==le[1]}),Ke=k.useRef(null),Qe=function(le){le.preventDefault()},Ve=function(le){Ke.current&&Ke.current.scrollTo({index:le})},Ue=function(le){for(var ae=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,oe=Ce.length,Y=0;Y<oe;Y+=1){var $=(le+Y*ae+oe)%oe,J=Ce[$],re=J.group,ge=J.data;if(!re&&!ge.disabled)return $}return-1},tt=k.useState(function(){return Ue(0)}),Ye=Object(_.a)(tt,2),Xe=Ye[0],ve=Ye[1],et=function(le){ve(le);var ae=Ce[le];if(!ae){_e(null,-1);return}_e(ae.data.value,le)};k.useEffect(function(){et(te!==!1?Ue(0):-1)},[Ce.length,de]),k.useEffect(function(){var Oe=setTimeout(function(){if(!fe&&ke&&he.size===1){var le=Array.from(he)[0],ae=Ce.findIndex(function(oe){var Y=oe.data;return Y.value===le});et(ae),Ve(ae)}});return function(){return clearTimeout(Oe)}},[ke]);var Ge=function(le){le!==void 0&&we(le,{selected:!he.has(le)}),fe||De(!1)};if(k.useImperativeHandle(q,function(){return{onKeyDown:function(le){var ae=le.which;switch(ae){case P.a.UP:case P.a.DOWN:{var oe=0;if(ae===P.a.UP?oe=-1:ae===P.a.DOWN&&(oe=1),oe!==0){var Y=Ue(Xe+oe,oe);Ve(Y),et(Y)}break}case P.a.ENTER:{var $=Ce[Xe];$&&!$.data.disabled?Ge($.data.value):Ge(void 0),ke&&le.preventDefault();break}case P.a.ESC:De(!1)}},onKeyUp:function(){},scrollTo:function(le){Ve(le)}}}),Ce.length===0)return k.createElement("div",{role:"listbox",id:"".concat(ue,"_list"),className:"".concat(Se,"-empty"),onMouseDown:Qe},Me);function be(Oe){var le=Ce[Oe];if(!le)return null;var ae=le.data||{},oe=ae.value,Y=ae.label,$=ae.children,J=Object(D.a)(ae,!0),re=pe?$:Y;return le?k.createElement("div",Object.assign({"aria-label":typeof re=="string"?re:null},J,{key:Oe,role:"option",id:"".concat(ue,"_list_").concat(Oe),"aria-selected":he.has(oe)}),oe):null}return k.createElement(k.Fragment,null,k.createElement("div",{role:"listbox",id:"".concat(ue,"_list"),style:{height:0,width:0,overflow:"hidden"}},be(Xe-1),be(Xe),be(Xe+1)),k.createElement(w.a,{itemKey:"key",ref:Ke,data:Ce,height:se,itemHeight:ye,fullHeight:!1,onMouseDown:Qe,onScroll:Be,virtual:$e,onMouseEnter:Ne},function(Oe,le){var ae,oe=Oe.group,Y=Oe.groupOption,$=Oe.data,J=$.label,re=$.key;if(oe)return k.createElement("div",{className:O()(Se,"".concat(Se,"-group"))},J!==void 0?J:re);var ge=$.disabled,Ee=$.value,Ie=$.title,st=$.children,ht=$.style,Le=$.className,pt=Object(N.a)($,["disabled","value","title","children","style","className"]),it=he.has(Ee),Je="".concat(Se,"-option"),xt=O()(Se,Je,Le,(ae={},Object(M.a)(ae,"".concat(Je,"-grouped"),Y),Object(M.a)(ae,"".concat(Je,"-active"),Xe===le&&!ge),Object(M.a)(ae,"".concat(Je,"-disabled"),ge),Object(M.a)(ae,"".concat(Je,"-selected"),it),ae)),Et=pe?st:J,Pt=!He||typeof He=="function"||it;return k.createElement("div",Object.assign({},pt,{"aria-selected":it,className:xt,title:Ie,onMouseMove:function(){if(Xe===le||ge)return;et(le)},onClick:function(){ge||Ge(Ee)},style:ht}),k.createElement("div",{className:"".concat(Je,"-content")},Et||Ee),k.isValidElement(He)||it,Pt&&k.createElement(b.a,{className:"".concat(Se,"-option-state"),customizeIcon:He,customizeIconProps:{isSelected:it}},it?"\u2713":null))}))},s=k.forwardRef(E);s.displayName="OptionList";var a=s,l=function(){return null};l.isSelectOption=!0;var u=l,C=function(){return null};C.isSelectOptGroup=!0;var g=C,h=ee("VTBJ"),A=ee("Zm9Q");function T(F){var X=F.key,q=F.props,ne=q.children,ue=q.value,xe=Object(N.a)(q,["children","value"]);return Object(h.a)({key:X,value:ue!==void 0?ue:X,children:ne},xe)}function f(F){var X=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(A.a)(F).map(function(q,ne){if(!k.isValidElement(q)||!q.type)return null;var ue=q.type.isSelectOptGroup,xe=q.key,pe=q.props,he=pe.children,de=Object(N.a)(pe,["children"]);return X||!ue?T(q):Object(h.a)(Object(h.a)({key:"__RC_SELECT_GRP__".concat(xe===null?ne:xe,"__"),label:xe},de),{},{options:f(he)})}).filter(function(q){return q})}var m=ee("2Qr1"),d=ee("qNPg"),o=ee("U8pU"),x=ee("Kwbf"),y=ee("WKfj");function p(F){var X=F.mode,q=F.options,ne=F.children,ue=F.backfill,xe=F.allowClear,pe=F.placeholder,he=F.getInputElement,de=F.showSearch,fe=F.onSearch,te=F.defaultOpen,se=F.autoFocus,ye=F.labelInValue,Me=F.value,ke=F.inputValue,He=F.optionLabelProp,$e=X==="multiple"||X==="tags",we=de!==void 0?de:$e||X==="combobox",De=q||f(ne);if(Object(x.a)(X!=="tags"||De.every(function(Se){return!Se.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),X==="tags"||X==="combobox"){var _e=De.some(function(Se){return Se.options?Se.options.some(function(Ce){return typeof("value"in Ce?Ce.value:Ce.key)=="number"}):typeof("value"in Se?Se.value:Se.key)=="number"});Object(x.a)(!_e,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(x.a)(X!=="combobox"||!He,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(x.a)(X==="combobox"||!ue,"`backfill` only works with `combobox` mode."),Object(x.a)(X==="combobox"||!he,"`getInputElement` only work with `combobox` mode."),Object(x.b)(X!=="combobox"||!he||!xe||!pe,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),fe&&!we&&X!=="combobox"&&X!=="tags"&&Object(x.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(x.b)(!te||se,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),Me!=null){var Be=Object(y.d)(Me);Object(x.a)(!ye||Be.every(function(Se){return Object(o.a)(Se)==="object"&&("key"in Se||"value"in Se)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(x.a)(!$e||Array.isArray(Me),"`value` should be array when `mode` is `multiple` or `tags`")}if(ne){var Ne=null;Object(A.a)(ne).some(function(Se){if(!k.isValidElement(Se)||!Se.type)return!1;var Ce=Se.type;if(Ce.isSelectOption)return!1;if(Ce.isSelectOptGroup){var Ke=Object(A.a)(Se.props.children).every(function(Qe){return!k.isValidElement(Qe)||!Se.type||Qe.type.isSelectOption?!0:(Ne=Qe.type,!1)});return!Ke}return Ne=Ce,!0}),Ne&&Object(x.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(Ne.displayName||Ne.name||Ne,"`.")),Object(x.a)(ke===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var R=p,U=Object(d.a)({prefixCls:"rc-select",components:{optionList:a},convertChildrenToData:f,flattenOptions:m.d,getLabeledValue:m.e,filterOptions:m.b,isValueDisabled:m.g,findValueOption:m.c,warningProps:R,fillOptionsWithMissingValue:m.a}),B=function(F){Object(L.a)(q,F);var X=Object(H.a)(q);function q(){var ne;return Object(Q.a)(this,q),ne=X.apply(this,arguments),ne.selectRef=k.createRef(),ne.focus=function(){ne.selectRef.current.focus()},ne.blur=function(){ne.selectRef.current.blur()},ne}return Object(K.a)(q,[{key:"render",value:function(){return k.createElement(U,Object.assign({ref:this.selectRef},this.props))}}]),q}(k.Component);B.Option=u,B.OptGroup=g;var z=B,j=qe.c=z},M8RZ:function(at,qe,ee){"use strict";ee.d(qe,"a",function(){return P});var Q=ee("fWQN"),K=ee("mtLc"),L=ee("yKVA"),H=ee("879j"),k=ee("cDcd"),M=ee.n(k),N=ee("faye"),_=ee.n(N),P=function(D){Object(L.a)(v,D);var c=Object(H.a)(v);function v(O){var w;Object(Q.a)(this,v),w=c.call(this,O);var b=window.document;return w.node=b.createElement("div"),b.body.appendChild(w.node),w}return Object(K.a)(v,[{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)}}]),v}(M.a.Component)},OLES:function(at,qe,ee){"use strict";var Q=ee("U8pU"),K=ee("VTBJ"),L=ee("Ff2n"),H=ee("cDcd"),k=ee("uciX"),M=ee("7ixt"),N=function(O){var w=O.overlay,b=O.prefixCls,E=O.id,s=O.overlayInnerStyle;return H.createElement("div",{className:"".concat(b,"-inner"),id:E,role:"tooltip",style:s},typeof w=="function"?w():w)},_=N,P=function(O,w){var b=O.overlayClassName,E=O.trigger,s=E===void 0?["hover"]:E,a=O.mouseEnterDelay,l=a===void 0?0:a,u=O.mouseLeaveDelay,C=u===void 0?.1:u,g=O.overlayStyle,h=O.prefixCls,A=h===void 0?"rc-tooltip":h,T=O.children,f=O.onVisibleChange,m=O.afterVisibleChange,d=O.transitionName,o=O.animation,x=O.placement,y=x===void 0?"right":x,p=O.align,R=p===void 0?{}:p,U=O.destroyTooltipOnHide,B=U===void 0?!1:U,z=O.defaultVisible,j=O.getTooltipContainer,F=O.overlayInnerStyle,X=Object(L.a)(O,["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle"]),q=Object(H.useRef)(null);Object(H.useImperativeHandle)(w,function(){return q.current});var ne=Object(K.a)({},X);"visible"in O&&(ne.popupVisible=O.visible);var ue=function(){var fe=O.arrowContent,te=fe===void 0?null:fe,se=O.overlay,ye=O.id;return[H.createElement("div",{className:"".concat(A,"-arrow"),key:"arrow"},te),H.createElement(_,{key:"content",prefixCls:A,id:ye,overlay:se,overlayInnerStyle:F})]},xe=!1,pe=!1;if(typeof B=="boolean")xe=B;else if(B&&Object(Q.a)(B)==="object"){var he=B.keepParent;xe=he===!0,pe=he===!1}return H.createElement(k.a,Object.assign({popupClassName:b,prefixCls:A,popup:ue,action:s,builtinPlacements:M.a,popupPlacement:y,ref:q,popupAlign:R,getPopupContainer:j,onPopupVisibleChange:f,afterPopupVisibleChange:m,popupTransitionName:d,popupAnimation:o,defaultPopupVisible:z,destroyPopupOnHide:xe,autoDestroy:pe,mouseLeaveDelay:C,popupStyle:g,mouseEnterDelay:l},ne),T)},D=Object(H.forwardRef)(P),c=qe.a=D},Ot1p:function(at,qe,ee){"use strict";var Q=ee("2qtc"),K=ee("kLXV"),L=ee("rAM+"),H=ee("miYZ"),k=ee("tsqr"),M=ee("9og8"),N=ee("tJVT"),_=ee("jrin"),P=ee("WmNS"),D=ee.n(P),c=ee("cDcd"),v=ee.n(c),O=ee("VrN/"),w=ee.n(O),b=ee("bdgK"),E=ee("p77/"),s=ee("Bd2K"),a=ee("ELLl"),l=ee("19Vz"),u=ee("lZu9"),C=ee("+NIl"),g=ee("kSUc"),h=ee("9Bee"),A=function(Le){var pt=Le.value,it=pt===void 0?"":pt,Je=Le.className,xt=Le.showTextOnly,Et=Le.showLines,Pt=Le.style,At=Pt===void 0?{}:Pt,mt=Object(c.useMemo)(function(){return""},[it]);return v.a.createElement(v.a.Fragment,null,v.a.createElement("div",{dangerouslySetInnerHTML:{__html:mt}}))},T=ee("Q9mQ"),f=ee("diRs"),m=ee("0Owb"),d=ee("dejd"),o=ee("C+DQ"),x=ee("D1Df"),y=ee.n(x),p=ee("1vsH"),R=ee("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(Le){var pt=Le.onActionCallback,it=Le.title,Je=Le.icon,xt=Le.actionName,Et=Le.className,Pt=Et===void 0?"":Et,At=Le.children;function mt(){pt(xt)}return v.a.createElement("a",{title:it,className:Pt,onClick:mt},v.a.createElement("i",{className:"md-iconfont ".concat(Je)}),At)}var z=function(Le){var pt=Le.watch,it=Le.showNullButton,Je=Le.onActionCallback,xt=Le.fullScreen,Et=Le.insertTemp,Pt=Le.hidetoolBar,At=Le.uuid,mt=Le.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(At,"&api=").concat(encodeURIComponent(R.a.PROXY_SERVER)));var or=[].concat(U,[{title:"".concat(pt?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(pt?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return v.a.createElement("ul",{className:"markdown-toolbar-container"},!Pt&&or.map(function(Kt,Ut){return v.a.createElement("li",{key:Ut},Kt.actionName?v.a.createElement(B,Object(m.a)({},Kt,{onActionCallback:Je})):v.a.createElement("span",{className:"v-line"}))}),it?v.a.createElement("li",null,v.a.createElement(B,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:Je},v.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,Et&&v.a.createElement("li",null,v.a.createElement(B,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(Et),onActionCallback:Je},v.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),v.a.createElement("li",null,v.a.createElement(f.a,{title:"\u6253\u5F00\u624B\u673A\u626B\u4E00\u626B",content:v.a.createElement("div",null,v.a.createElement(y.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(At,"&api=").concat(encodeURIComponent(R.a.PROXY_SERVER))}))},v.a.createElement("span",{className:"fill-tip",onMouseOver:function(){return mt(!0)}},"\u624B\u673A\u4E0A\u4F20\u6587\u4EF6"))),v.a.createElement("li",{className:"btn-full-screen"},v.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:Je})))},j=ee("M8RZ"),F=ee("+L6B"),X=ee("2/Rp"),q=ee("y8nQ"),ne=ee("Vl3Y"),ue=ee("5NDa"),xe=ee("5rEg"),pe={labelCol:{span:4},wrapperCol:{span:20}},he=function(Le){var pt=Le.callback,it=Le.onCancel;function Je(xt){pt(xt)}return v.a.createElement(ne.a,Object(m.a)({},pe,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:Je}),v.a.createElement(ne.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},v.a.createElement(xe.a,null)),v.a.createElement(ne.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},v.a.createElement(xe.a,null)),v.a.createElement("div",{className:"flex-container flex-end"},v.a.createElement(X.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),v.a.createElement(X.a,{type:"ghost",onClick:it},"\u53D6\u6D88")))},de=ee("7ahc"),fe=ee("k1fw"),te=ee("HmJG"),se=ee("BjJ7"),ye=ne.a.useForm,Me={width:280,marginRight:10},ke={labelCol:{span:5},wrapperCol:{span:19}},He=function(Le){var pt=Le.callback,it=Le.onCancel,Je=ye(),xt=Object(N.a)(Je,1),Et=xt[0],Pt=useRef();function At(Kt){pt(Object(fe.a)(Object(fe.a)({},Kt),{},{name:Pt.current}))}function mt(Kt,Ut){if(Kt.status===-1){k.b.error(Kt.message);return}Et.setFieldsValue({src:"/api/attachments/".concat(Kt.id),type:Ut.type})}function or(Kt){var Ut=Kt.target.files[0];Pt.current=Ut.name,we(Ut,mt)}return v.a.createElement(ne.a,Object(m.a)({form:Et},ke,{className:"upload-image-panel",onFinish:At}),v.a.createElement(ne.a.Item,{label:"\u6587\u4EF6\u5730\u5740",required:!0},v.a.createElement("div",{className:"flex-container"},v.a.createElement(ne.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u6587\u4EF6\u5730\u5740"}]},v.a.createElement(xe.a,{style:Me})),v.a.createElement($e,{onFileChange:or}))),v.a.createElement(ne.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},v.a.createElement(xe.a,{style:{width:264}})),v.a.createElement(ne.a.Item,{style:{textAlign:"right"}},v.a.createElement(X.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),v.a.createElement(X.a,{type:"ghost",onClick:it},"\u53D6\u6D88")))};function $e(Le){var pt=Le.onFileChange;return v.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",v.a.createElement("input",{type:"file",onChange:pt}))}function we(Le,pt){if(!Le)throw new String("\u6CA1\u6709\u6587\u4EF6");var it=new FormData;it.append("editormd-image-file",Le),it.append("file_param_name","editormd-image-file"),it.append("byxhr","true");var Je=new window.XMLHttpRequest;Je.withCredentials=!0,Je.addEventListener("load",function(xt){pt(JSON.parse(xt.target.responseText),Le)},!1),Je.addEventListener("error",function(xt){console.error(xt)},!1),Je.open("POST","".concat(se.a,"/api/attachments.json")),Je.send(it)}var De=ee("giR+"),_e=ee("fyUT"),Be=ee("7Kak"),Ne=ee("9yH6"),Se=Ne.a.Group,Ce={margin:"0 8px"},Ke=function(Le){var pt=Le.callback,it=Le.onCancel;function Je(xt){pt(xt)}return v.a.createElement(ne.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:Je},v.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},v.a.createElement("span",{style:Ce},"\u5355\u5143\u683C\u6570\uFF1A"),v.a.createElement("span",{style:Ce},"\u884C\u6570"),v.a.createElement(ne.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},v.a.createElement(_e.a,null)),v.a.createElement("span",{style:Ce},"\u5217\u6570"),v.a.createElement(ne.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},v.a.createElement(_e.a,null))),v.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},v.a.createElement("span",{style:Ce},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),v.a.createElement(ne.a.Item,{name:"align"},v.a.createElement(Se,null,v.a.createElement(Ne.a,{value:"default"},v.a.createElement("i",{className:"fa fa-align-justify"})),v.a.createElement(Ne.a,{value:"left"},v.a.createElement("i",{className:"fa fa-align-left"})),v.a.createElement(Ne.a,{value:"center"},v.a.createElement("i",{className:"fa fa-align-center"})),v.a.createElement(Ne.a,{value:"right"},v.a.createElement("i",{className:"fa fa-align-right"}))))),v.a.createElement("div",{className:"flex-container flex-end"},v.a.createElement(X.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),v.a.createElement(X.a,{type:"ghost",onClick:it},"\u53D6\u6D88")))},Qe=ee("ErOA"),Ve=ee("7Cbv"),Ue="link",tt="upload-image",Ye="code-block",Xe="add-table",ve="------------",et={default:ve,left:":".concat(ve),center:":".concat(ve,":"),right:"".concat(ve,":")},Ge=ee("9VGf"),be,Oe;function le(){}var ae=0,oe=1e4,Y="\u2581",$=`
**\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 J(Le){return/^\d+$/.test(Le)?"".concat(Le,"px"):Le}var re=navigator.platform.toUpperCase().indexOf("MAC")>=0,ge=re?"Cmd":"Ctrl",Ee=["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"],Ie=(be={},Object(_.a)(be,ge+"-B","bold"),Object(_.a)(be,ge+"-I","italic"),be),st=(Oe={},Object(_.a)(Oe,Ue,"\u6DFB\u52A0\u94FE\u63A5"),Object(_.a)(Oe,Ye,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(_.a)(Oe,tt,"\u6DFB\u52A0\u6587\u4EF6"),Object(_.a)(Oe,Xe,"\u6DFB\u52A0\u8868\u683C"),Oe),ht=qe.a=function(Le){var pt=Le.defaultValue,it=pt===void 0?"":pt,Je=Le.onChange,xt=Le.width,Et=xt===void 0?"100%":xt,Pt=Le.height,At=Pt===void 0?400:Pt,mt=Le.miniToolbar,or=mt===void 0?!1:mt,Kt=Le.isFocus,Ut=Kt===void 0?!1:Kt,Tr=Le.watch,vr=Le.insertTemp,wi=Le.mode,mr=wi===void 0?"markdown":wi,vn=Le.id,Jr=vn===void 0?"markdown-editor-id":vn,kt=Le.showResizeBar,nt=kt===void 0?!1:kt,Sr=Le.noStorage,Vn=Sr===void 0?!1:Sr,fr=Le.showNullButton,St=fr===void 0?!1:fr,wr=Le.hidetoolBar,Zr=wr===void 0?!1:wr,yn=Le.fullScreen,Re=yn===void 0?!1:yn,dt=Le.onBlur,qr=Le.onCMBeforeChange,en=Le.onFullScreen,tn=Le.className,bn=tn===void 0?"":tn,Xn=Le.disablePaste,ct=Xn===void 0?!1:Xn,Ci=Le.placeholder,Li=Ci===void 0?"":Ci,rn=Le.values,sr=rn===void 0?"":rn,Ai=Object(c.useState)(null),Yn=Object(N.a)(Ai,2),Pe=Yn[0],$n=Yn[1],Di=Object(c.useState)(it),En=Object(N.a)(Di,2),nn=En[0],Fr=En[1],Oi=Object(c.useState)(Tr),Qn=Object(N.a)(Oi,2),Or=Qn[0],Ri=Qn[1],Pi=Object(c.useState)(Re),pr=Object(N.a)(Pi,2),Cr=pr[0],Mi=pr[1],xn=Object(c.useState)(""),Nr=Object(N.a)(xn,2),Ur=Nr[0],Br=Nr[1],aa=Object(c.useState)(0),ki=Object(N.a)(aa,2),Rr=ki[0],Tn=ki[1],oa=Object(c.useState)(At),Jn=Object(N.a)(oa,2),Zn=Jn[0],an=Jn[1],Sn=Object(c.useState)(!1),wn=Object(N.a)(Sn,2),sa=wn[0],Cn=wn[1],on=Object(c.useRef)(Object(Ve.a)()),_i=Object(c.useRef)(!1),qn=Object(c.useRef)(),$t=Object(c.useRef)(),jr=Object(c.useRef)(),Ln=Object(c.useRef)(),Wr=Object(c.useRef)(),Ii=function(){var rt=Object(M.a)(D.a.mark(function ft(){var lt,vt;return D.a.wrap(function(Ot){for(;;)switch(Ot.prev=Ot.next){case 0:return Ot.next=2,Object(Qe.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:on.current}});case 2:vt=Ot.sent,vt!=null&&(lt=vt.attachments)!==null&&lt!==void 0&&lt.length&&(console.log("cm:",Pe,$t),vt.attachments.map(function(yt){yt.content_type.indexOf("image")>-1?Pe.replaceSelection("![,](/api/attachments/".concat(yt.id,"?type=").concat(yt.content_type,")")):yt.content_type.indexOf("video")>-1?Pe.replaceSelection('<video width="100%" controls src="'.concat(R.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):yt.content_type.indexOf("pdf")>-1?Pe.replaceSelection('<a href="'.concat(R.a.API_SERVER,"/api/attachments/").concat(yt.id,"?type=").concat(yt.content_type,'&disposition=inline" target="_blank">').concat(yt.name,"</a>")):Pe.replaceSelection("[".concat(yt.name,"](").concat(R.a.API_SERVER,"/api/attachments/").concat(yt.id,"?type=").concat(yt.content_type,")"))}));case 4:case"end":return Ot.stop()}},ft)}));return function(){return rt.apply(this,arguments)}}();Object(c.useEffect)(function(){Fr(sr),Pe==null||Pe.setValue(sr)},[sr]),Object(c.useEffect)(function(){en==null||en(Cr)},[Cr]),Object(c.useEffect)(function(){if($t.current){var rt=w.a.fromTextArea($t.current,{mode:mr,lineNumbers:!or,lineWrapping:!0,value:it,autoCloseTags:!0,autoCloseBrackets:!0});Ut&&rt.focus();function ft(lt,vt){if(ct){vt.preventDefault();return}var Tt=vt.clipboardData;if(Tt){var Ot=Tt.types.toString(),yt=Tt.items;if(Ot==="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(),Mr=bt.name.split(".").pop();we(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?rt.replaceSelection("![,](/api/attachments/".concat(Ct.id,"?type=").concat(Ct.content_type,")")):(bt==null||((Dt=bt.type)===null||Dt===void 0)?void 0:Dt.indexOf("video"))>-1?rt.replaceSelection('<video width="100%" controls src="'.concat(R.a.API_SERVER,"/api/attachments/").concat(Ct.id,'"></video>')):(bt==null||((gr=bt.type)===null||gr===void 0)?void 0:gr.indexOf("pdf"))>-1?rt.replaceSelection('<a href="'.concat(R.a.API_SERVER,"/api/attachments/").concat(Ct.id,"?type=").concat(bt.type,'&disposition=inline" target="_blank">').concat(bt.name,"</a>")):Ee.includes(Mr)?rt.replaceSelection('<a href="'.concat(R.a.API_SERVER,"/api/attachments/").concat(Ct.id,'?type=office&disposition=inline" target="_blank">').concat(bt.name,"</a>")):rt.replaceSelection("[".concat(bt.name,"](").concat(R.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){k.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return rt.on("paste",ft),rt.on("dragleave",function(lt,vt){jr.current.classList.remove("mouse-hover-md")}),rt.on("dragover",function(lt,vt){jr.current.classList.add("mouse-hover-md")}),rt.on("drop",function(lt,vt){jr.current.classList.add("mouse-hover-md");var Tt;if(Tt=vt.dataTransfer.files,Tt.length>0){vt.preventDefault(),vt.stopPropagation();for(var Ot=function(Wt){var bt=Tt[Wt],Mr=bt.name.split(".").pop();we(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?rt.replaceSelection("![,](/api/attachments/".concat(Ct.id,"?type=").concat(Ct.content_type,")")):(bt==null||((Dt=bt.type)===null||Dt===void 0)?void 0:Dt.indexOf("video"))>-1?rt.replaceSelection('<video width="100%" controls src="'.concat(R.a.API_SERVER,"/api/attachments/").concat(Ct.id,'"></video>')):(bt==null||((gr=bt.type)===null||gr===void 0)?void 0:gr.indexOf("pdf"))>-1?rt.replaceSelection('<a href="'.concat(R.a.API_SERVER,"/api/attachments/").concat(Ct.id,"?type=").concat(bt.type,'&disposition=inline" target="_blank">').concat(bt.name,"</a>")):Ee.includes(Mr)?rt.replaceSelection('<a href="'.concat(R.a.API_SERVER,"/api/attachments/").concat(Ct.id,'?type=office&disposition=inline" target="_blank">').concat(bt.name,"</a>")):rt.replaceSelection("[".concat(bt.name,"](").concat(R.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++)Ot(yt)}}),$n(rt),function(){rt.off("paste",ft)}}},[]);var yr=Object(c.useCallback)(function(){if(jr.current)try{}catch(rt){console.log(rt,"---- to set md editor body height")}},[Zn,jr,Cr]);Object(c.useEffect)(function(){function rt(){var lt=new b.default(function(vt){var Tt=Object(L.a)(vt),Ot;try{for(Tt.s();!(Ot=Tt.n()).done;){var yt=Ot.value;(yt.target.offsetHeight>0||yt.target.offsetWidth>0)&&(yr(),Pe.setSize("100%","100%"),Pe.refresh())}}catch(It){Tt.e(It)}finally{Tt.f()}});return lt.observe($t.current.parentElement),lt}if(Pe){var ft=rt();return function(){ft.unobserve($t.current.parentElement)}}},[Pe,yr]),Object(c.useEffect)(function(){if(Pe){for(var rt=[],ft=function(){var yt=vt[lt];Tt=Object(N.a)(yt,2);var It=Tt[0],Wt=Tt[1],bt=Object(_.a)({},It,function(){An(Wt)});rt.push(bt),Pe.addKeyMap(bt)},lt=0,vt=Object.entries(Ie);lt<vt.length;lt++){var Tt;ft()}return qn.current=setInterval(function(){_i.current&&Ii()},4e3),function(){clearInterval(qn.current);var Ot=Object(L.a)(rt),yt;try{for(Ot.s();!(yt=Ot.n()).done;){var It=yt.value;Pe.removeKeyMap(It)}}catch(Wt){Ot.e(Wt)}finally{Ot.f()}}}},[Pe]),Object(c.useEffect)(function(){Re!==Cr&&Mi(Re)},[Re]),Object(Ge.a)(function(){if(!Vn&&Rr>0){var rt=new Date().getTime(),ft=window.sessionStorage.getItem(Jr);rt>=Rr+oe&&(!ft||ft!==nn)&&(window.sessionStorage.setItem(Jr,nn),Cn(!0))}},oe),Object(c.useEffect)(function(){Ri(Tr)},[Pe,Tr]),Object(c.useEffect)(function(){Pe&&(Ut&&Pe.focus())},[Pe,Ut]),Object(c.useEffect)(function(){if(Or&&Pe){var rt=Pe.getScrollerElement();function ft(lt){var vt=lt.target;if(Wr.current){var Tt=vt.scrollTop/vt.scrollHeight;Wr.current.scrollTop=Wr.current.scrollHeight*Tt}}return rt.addEventListener("scroll",ft),function(){rt.removeEventListener("scroll",ft)}}},[Pe,Or]),Object(c.useEffect)(function(){if(Pe&&qr){function rt(ft,lt){qr(ft,lt)}return Pe.on("beforeChange",rt),function(){Pe.off("beforeChange",rt)}}},[Pe,qr]),Object(c.useEffect)(function(){if(Pe&&dt){function rt(){dt(Pe.getValue())}return Pe.on("blur",rt),function(){Pe.off("blur",rt)}}},[Pe,dt]),Object(c.useEffect)(function(){if(Pe){function rt(ft){var lt=ft.getValue();Fr(lt),Tn(new Date().getTime()),ft.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),Je&&Je(lt)}return Pe.on("change",rt),function(){Pe.off("change",rt)}}},[Pe,Je]),Object(c.useEffect)(function(){Pe&&(it==null?(Pe.setValue(""),Fr("")):it!==Pe.getValue()&&(Pe.setValue(it),Fr(it),Pe.setCursor(Pe.lineCount(),0)))},[Pe,it]);var An=Object(c.useCallback)(function(rt){var ft=Pe.getCursor(),lt=Pe.getSelection(),vt=lt.split(`
`);switch(rt){case"bold":return Pe.replaceSelection("**"+lt+"**"),lt===""&&Pe.setCursor(ft.line,ft.ch+2),Pe.focus();case"italic":return Pe.replaceSelection("*"+lt+"*"),lt===""&&Pe.setCursor(ft.line,ft.ch+1),Pe.focus();case"code":return Pe.replaceSelection("`"+lt+"`"),lt===""&&Pe.setCursor(ft.line,ft.ch+1),Pe.focus();case"inline-latex":return Pe.replaceSelection("`$$"+lt+"$$`"),lt===""&&Pe.setCursor(ft.line,ft.ch+3),Pe.focus();case"latex":return Pe.replaceSelection("```latex\n"+lt+"\n```"),Pe.setCursor(ft.line+1,lt.length+1),Pe.focus();case"line-break":return Pe.replaceSelection(`<br/>
`),Pe.focus();case"list-ul":return lt===""?Pe.replaceSelection("- "+lt):Pe.replaceSelection(vt.map(function(Tt){return Tt===""?"":"- ".concat(Tt)}).join(`
`)),Pe.focus();case"list-ol":return lt===""?Pe.replaceSelection("1. "+lt):Pe.replaceSelection(vt.map(function(Tt,Ot){return Tt===""?"":"".concat(Ot+1,". ").concat(Tt)}).join(`
`)),Pe.focus();case"add-null-ch":return lt===""&&Pe.setCursor(ft.line,ft.ch+1),Pe.replaceSelection(Y),Pe.focus();case"inster-template-1":return lt===""&&Pe.setCursor(ft.line,ft.ch),Pe.replaceSelection($),Pe.focus();case"eraser":return Pe.setValue(""),Pe.focus();case"trigger-watch":return Ri(!Or),Pe.focus();case"trigger-full-screen":return Mi(!Cr),Pe.focus();case Ue:Br(Ue);return;case Ye:Br(Ye);return;case tt:Br(tt);return;case Xe:Br(Xe);return;default:throw new Error}},[Pe,Or,Cr]),lr=Object(c.useCallback)(function(rt){Br("");switch(Ur){case Ue:var ft=rt.title,lt=rt.link;return Pe.replaceSelection("[".concat(ft,"](").concat(lt,")")),Pe.focus();case Ye:var vt=rt.language,Tt=rt.content;return Pe.replaceSelection(["```"+vt,Tt,"```"].join(`
`)),Pe.focus();case tt:var Ot=rt.src,yt=rt.alt;return yt?Pe.replaceSelection("![ ".concat(yt," ]( ").concat(Ot,' "').concat(yt,'" )')):Pe.replaceSelection("![,](".concat(Ot,")")),Pe.focus();case Xe:for(var It=rt.row,Wt=rt.col,bt=rt.align,Mr=`
`,Ct=0;Ct<It;Ct++){for(var Zt=[],Dt=[],gr=0;gr<Wt;gr++)Ct===1&&Dt.push(et[bt]),Zt.push(" ");Ct===1&&(Mr+="| ".concat(Dt.join(" | "),` |
`)),Mr+="| ".concat(Zt.join(Wt===1?"":" | "),` |
`)}return Pe.replaceSelection(Mr+`
`),Pe.focus();default:throw new Error}},[Pe,Ur]),Dn=Object(c.useMemo)(function(){switch(Ur){case Ue:return v.a.createElement(he,{callback:lr,onCancel:Pr});case Ye:return v.a.createElement(de.b,{callback:lr,onCancel:Pr});case tt:return v.a.createElement(He,{callback:lr,onCancel:Pr});case Xe:return v.a.createElement(Ke,{callback:lr,onCancel:Pr});default:return null}},[Ur]);function Pr(){Br("")}Object(c.useEffect)(function(){if(Ln.current){var rt=Ln.current,ft=!1,lt=0;function vt(yt){ft=!0,lt=yt.pageY}function Tt(){ft=!1}function Ot(yt){if(ft){var It=yt.pageY-lt;It<0&&(It=0),It>300&&(It=300);var Wt=At+It+"px";an(Wt)}}return rt.addEventListener("mousedown",vt),document.addEventListener("mousemove",Ot),document.addEventListener("mouseup",Tt),function(){rt.removeEventListener("mousedown",vt),document.removeEventListener("mousemove",Ot),document.removeEventListener("mouseup",Tt)}}},[Pe,Ln]),Object(c.useEffect)(function(){an(At)},[At]);var Hr=J(Et),la=J(Zn),ua={width:Hr,height:la},$a=Object(c.useMemo)(function(){if(Rr){var rt=new Date(Rr),ft=rt.getHours(),lt=rt.getMinutes(),vt=rt.getSeconds();return ft=ft<10?"0"+ft:ft,lt=lt<10?"0"+lt:lt,vt=vt<10?"0"+vt:vt,"".concat(ft,":").concat(lt,":").concat(vt)}return 0},[Rr]);function Qa(){window.sessionStorage.removeItem(Jr),Cn(!1),Tn(0)}function da(){Cn(!1),Tn(0),Pe.setValue(window.sessionStorage.getItem(Jr))}function Fi(rt,ft){var lt=Pe.getValue();lt=lt.replace(rt,ft),Fr(lt),Pe==null||Pe.setValue(lt)}return v.a.createElement(c.Fragment,null,v.a.createElement("div",{className:"markdown-editor-wrapper",ref:jr},v.a.createElement("div",{className:"markdown-editor-container ".concat(bn," ").concat(Or?"on-preview":""," ").concat(or?"mini":""," ").concat(Cr?"full-screen":""),style:ua},v.a.createElement(z,{insertTemp:vr,watch:Or,fullScreen:Cr,showNullButton:St,onActionCallback:An,hidetoolBar:Zr,uuid:on.current,setOpenPhones:function(){_i.current=!0}}),v.a.createElement("div",{className:"markdown-editor-body"},v.a.createElement("div",{className:"codemirror-container"},v.a.createElement("textarea",{ref:$t,placeholder:Li})),Or?v.a.createElement("div",{ref:Wr,className:"preview-container"},mr==="stex"&&v.a.createElement(A,{value:nn}),mr!=="stex"&&v.a.createElement(h.a,{edit:!0,value:nn,replaces:Fi})):null))),nt?v.a.createElement("a",{ref:Ln,className:"editor-resize"}):null,v.a.createElement(j.a,null,st[Ur]?v.a.createElement(K.a,{centered:!0,title:st[Ur],visible:!0,onCancel:Pr,footer:null,className:"markdown-popup-form"},Dn):null))}},SJMd:function(at,qe){/**
* @license
* Copyright (C) 2006 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/var ee,Q,K,L=!1,H,k;window.PR_SHOULD_USE_CONTINUATION=!0;var M,N;(function(){var _=window,P=["break,continue,do,else,for,if,return,while"],D=[P,"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"],c=[D,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],v=[c,"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"],O=[c,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],w=[c,"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"],b="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",E=[c,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],s="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",a=[P,"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=[P,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],u=[P,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],C=[v,w,O,E,s,a,l,u],g=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,h="str",A="kwd",T="com",f="typ",m="lit",d="pun",o="pln",x="tag",y="dec",p="src",R="atn",U="atv",B="nocode",z="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function j(we){for(var De=0,_e=!1,Be=!1,Ne=0,Se=we.length;Ne<Se;++Ne){var Ce=we[Ne];if(Ce.ignoreCase)Be=!0;else if(/[a-z]/i.test(Ce.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){_e=!0,Be=!1;break}}var Ke={b:8,t:9,n:10,v:11,f:12,r:13};function Qe(Xe){var ve=Xe.charCodeAt(0);if(ve!==92)return ve;var et=Xe.charAt(1);return ve=Ke[et],ve||("0"<=et&&et<="7"?parseInt(Xe.substring(1),8):et==="u"||et==="x"?parseInt(Xe.substring(2),16):Xe.charCodeAt(1))}function Ve(Xe){if(Xe<32)return(Xe<16?"\\x0":"\\x")+Xe.toString(16);var ve=String.fromCharCode(Xe);return ve==="\\"||ve==="-"||ve==="]"||ve==="^"?"\\"+ve:ve}function Ue(Xe){var ve=Xe.substring(1,Xe.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")),et=[],Ge=ve[0]==="^",be=["["];Ge&&be.push("^");for(var Oe=Ge?1:0,le=ve.length;Oe<le;++Oe){var ae=ve[Oe];if(/\\[bdsw]/i.test(ae))be.push(ae);else{var oe=Qe(ae),Y;Oe+2<le&&ve[Oe+1]==="-"?(Y=Qe(ve[Oe+2]),Oe+=2):Y=oe,et.push([oe,Y]),Y<65||oe>122||(Y<65||oe>90||et.push([Math.max(65,oe)|32,Math.min(Y,90)|32]),Y<97||oe>122||et.push([Math.max(97,oe)&~32,Math.min(Y,122)&~32]))}}et.sort(function(ge,Ee){return ge[0]-Ee[0]||Ee[1]-ge[1]});for(var $=[],J=[],Oe=0;Oe<et.length;++Oe){var re=et[Oe];re[0]<=J[1]+1?J[1]=Math.max(J[1],re[1]):$.push(J=re)}for(var Oe=0;Oe<$.length;++Oe){var re=$[Oe];be.push(Ve(re[0])),re[1]>re[0]&&(re[1]+1>re[0]&&be.push("-"),be.push(Ve(re[1])))}return be.push("]"),be.join("")}function tt(Xe){for(var ve=Xe.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")),et=ve.length,Ge=[],be=0,Oe=0;be<et;++be){var le=ve[be];if(le==="(")++Oe;else if(le.charAt(0)==="\\"){var ae=+le.substring(1);ae&&(ae<=Oe?Ge[ae]=-1:ve[be]=Ve(ae))}}for(var be=1;be<Ge.length;++be)Ge[be]===-1&&(Ge[be]=++De);for(var be=0,Oe=0;be<et;++be){var le=ve[be];if(le==="(")++Oe,Ge[Oe]||(ve[be]="(?:");else if(le.charAt(0)==="\\"){var ae=+le.substring(1);ae&&ae<=Oe&&(ve[be]="\\"+Ge[ae])}}for(var be=0;be<et;++be)ve[be]==="^"&&ve[be+1]!=="^"&&(ve[be]="");if(Xe.ignoreCase&&_e)for(var be=0;be<et;++be){var le=ve[be],oe=le.charAt(0);le.length>=2&&oe==="["?ve[be]=Ue(le):oe!=="\\"&&(ve[be]=le.replace(/[a-zA-Z]/g,function(J){var re=J.charCodeAt(0);return"["+String.fromCharCode(re&~32,re|32)+"]"}))}return ve.join("")}for(var Ye=[],Ne=0,Se=we.length;Ne<Se;++Ne){var Ce=we[Ne];if(Ce.global||Ce.multiline)throw new Error(""+Ce);Ye.push("(?:"+tt(Ce)+")")}return new RegExp(Ye.join("|"),Be?"gi":"g")}function F(we,De){var _e=/(?:^|\s)nocode(?:\s|$)/,Be=[],Ne=0,Se=[],Ce=0;function Ke(Qe){var Ve=Qe.nodeType;if(Ve==1){if(_e.test(Qe.className))return;for(var Ue=Qe.firstChild;Ue;Ue=Ue.nextSibling)Ke(Ue);var tt=Qe.nodeName.toLowerCase();(tt==="br"||tt==="li")&&(Be[Ce]=`
`,Se[Ce<<1]=Ne++,Se[Ce++<<1|1]=Qe)}else if(Ve==3||Ve==4){var Ye=Qe.nodeValue;Ye.length&&(De?Ye=Ye.replace(/\r\n?/g,`
`):Ye=Ye.replace(/[ \t\r\n]+/g," "),Be[Ce]=Ye,Se[Ce<<1]=Ne,Ne+=Ye.length,Se[Ce++<<1|1]=Qe)}}return Ke(we),{sourceCode:Be.join("").replace(/\n$/,""),spans:Se}}function X(we,De,_e,Be,Ne){if(!_e)return;var Se={sourceNode:we,pre:1,langExtension:null,numberLines:null,sourceCode:_e,spans:null,basePos:De,decorations:null};Be(Se),Ne.push.apply(Ne,Se.decorations)}var q=/\S/;function ne(we){for(var De=void 0,_e=we.firstChild;_e;_e=_e.nextSibling){var Be=_e.nodeType;De=Be===1?De?we:_e:Be===3&&q.test(_e.nodeValue)?we:De}return De===we?void 0:De}function ue(we,De){var _e={},Be;(function(){for(var Ce=we.concat(De),Ke=[],Qe={},Ve=0,Ue=Ce.length;Ve<Ue;++Ve){var tt=Ce[Ve],Ye=tt[3];if(Ye)for(var Xe=Ye.length;--Xe>=0;)_e[Ye.charAt(Xe)]=tt;var ve=tt[1],et=""+ve;Qe.hasOwnProperty(et)||(Ke.push(ve),Qe[et]=null)}Ke.push(/[\0-\uffff]/),Be=j(Ke)})();var Ne=De.length,Se=function(Ce){for(var Ke=Ce.sourceCode,Qe=Ce.basePos,Ve=Ce.sourceNode,Ue=[Qe,o],tt=0,Ye=Ke.match(Be)||[],Xe={},ve=0,et=Ye.length;ve<et;++ve){var Ge=Ye[ve],be=Xe[Ge],Oe=void 0,le;if(typeof be=="string")le=!1;else{var ae=_e[Ge.charAt(0)];if(ae)Oe=Ge.match(ae[1]),be=ae[0];else{for(var oe=0;oe<Ne;++oe)if(ae=De[oe],Oe=Ge.match(ae[1]),Oe){be=ae[0];break}Oe||(be=o)}le=be.length>=5&&be.substring(0,5)==="lang-",le&&!(Oe&&typeof Oe[1]=="string")&&(le=!1,be=p),le||(Xe[Ge]=be)}var Y=tt;if(tt+=Ge.length,!le)Ue.push(Qe+Y,be);else{var $=Oe[1],J=Ge.indexOf($),re=J+$.length;Oe[2]&&(re=Ge.length-Oe[2].length,J=re-$.length);var ge=be.substring(5);X(Ve,Qe+Y,Ge.substring(0,J),Se,Ue),X(Ve,Qe+Y+J,$,se(ge,$),Ue),X(Ve,Qe+Y+re,Ge.substring(re),Se,Ue)}}Ce.decorations=Ue};return Se}function xe(we){var De=[],_e=[];we.tripleQuotedStrings?De.push([h,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):we.multiLineStrings?De.push([h,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):De.push([h,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),we.verbatimStrings&&_e.push([h,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Be=we.hashComments;Be&&(we.cStyleComments?(Be>1?De.push([T,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):De.push([T,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),_e.push([h,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):De.push([T,/^#[^\r\n]*/,null,"#"])),we.cStyleComments&&(_e.push([T,/^\/\/[^\r\n]*/,null]),_e.push([T,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Ne=we.regexLiterals;if(Ne){var Se=Ne>1?"":`
\r`,Ce=Se?".":"[\\S\\s]",Ke="/(?=[^/*"+Se+"])(?:[^/\\x5B\\x5C"+Se+"]|\\x5C"+Ce+"|\\x5B(?:[^\\x5C\\x5D"+Se+"]|\\x5C"+Ce+")*(?:\\x5D|$))+/";_e.push(["lang-regex",RegExp("^"+z+"("+Ke+")")])}var Qe=we.types;Qe&&_e.push([f,Qe]);var Ve=(""+we.keywords).replace(/^ | $/g,"");Ve.length&&_e.push([A,new RegExp("^(?:"+Ve.replace(/[\s,]+/g,"|")+")\\b"),null]),De.push([o,/^\s+/,null,` \r
\xA0`]);var Ue="^.[^\\s\\w.$@'\"`/\\\\]*";return we.regexLiterals&&(Ue+="(?!s*/)"),_e.push([m,/^@[a-z_$][a-z_$@0-9]*/i,null],[f,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[o,/^[a-z_$][a-z_$@0-9]*/i,null],[m,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[o,/^\\[\s\S]?/,null],[d,new RegExp(Ue),null]),ue(De,_e)}var pe=xe({keywords:C,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function he(we,De,_e){for(var Be=/(?:^|\s)nocode(?:\s|$)/,Ne=/\r\n?|\n/,Se=we.ownerDocument,Ce=Se.createElement("li");we.firstChild;)Ce.appendChild(we.firstChild);var Ke=[Ce];function Qe(ve){var et=ve.nodeType;if(et==1&&!Be.test(ve.className))if(ve.nodeName==="br")Ve(ve),ve.parentNode&&ve.parentNode.removeChild(ve);else for(var Ge=ve.firstChild;Ge;Ge=Ge.nextSibling)Qe(Ge);else if((et==3||et==4)&&_e){var be=ve.nodeValue,Oe=be.match(Ne);if(Oe){var le=be.substring(0,Oe.index);ve.nodeValue=le;var ae=be.substring(Oe.index+Oe[0].length);if(ae){var oe=ve.parentNode;oe.insertBefore(Se.createTextNode(ae),ve.nextSibling)}Ve(ve),le||ve.parentNode.removeChild(ve)}}}function Ve(ve){for(;!ve.nextSibling;)if(ve=ve.parentNode,!ve)return;function et(Oe,le){var ae=le?Oe.cloneNode(!1):Oe,oe=Oe.parentNode;if(oe){var Y=et(oe,1),$=Oe.nextSibling;Y.appendChild(ae);for(var J=$;J;J=$)$=J.nextSibling,Y.appendChild(J)}return ae}for(var Ge=et(ve.nextSibling,0),be;(be=Ge.parentNode)&&be.nodeType===1;)Ge=be;Ke.push(Ge)}for(var Ue=0;Ue<Ke.length;++Ue)Qe(Ke[Ue]);De===(De|0)&&Ke[0].setAttribute("value",De);var tt=Se.createElement("ol");tt.className="linenums";for(var Ye=Math.max(0,De-1|0)||0,Ue=0,Xe=Ke.length;Ue<Xe;++Ue)Ce=Ke[Ue],Ce.className="L"+(Ue+Ye)%10,Ce.firstChild||Ce.appendChild(Se.createTextNode("\xA0")),tt.appendChild(Ce);we.appendChild(tt)}function de(we){var De=/\bMSIE\s(\d+)/.exec(navigator.userAgent);De=De&&+De[1]<=8;var _e=/\n/g,Be=we.sourceCode,Ne=Be.length,Se=0,Ce=we.spans,Ke=Ce.length,Qe=0,Ve=we.decorations,Ue=Ve.length,tt=0;Ve[Ue]=Ne;var Ye,Xe;for(Xe=Ye=0;Xe<Ue;)Ve[Xe]!==Ve[Xe+2]?(Ve[Ye++]=Ve[Xe++],Ve[Ye++]=Ve[Xe++]):Xe+=2;for(Ue=Ye,Xe=Ye=0;Xe<Ue;){for(var ve=Ve[Xe],et=Ve[Xe+1],Ge=Xe+2;Ge+2<=Ue&&Ve[Ge+1]===et;)Ge+=2;Ve[Ye++]=ve,Ve[Ye++]=et,Xe=Ge}Ue=Ve.length=Ye;var be=we.sourceNode,Oe="";be&&(Oe=be.style.display,be.style.display="none");try{for(var le=null;Qe<Ke;){var ae=Ce[Qe],oe=Ce[Qe+2]||Ne,Y=Ve[tt+2]||Ne,Ge=Math.min(oe,Y),$=Ce[Qe+1],J;if($.nodeType!==1&&(J=Be.substring(Se,Ge))){De&&(J=J.replace(_e,"\r")),$.nodeValue=J;var re=$.ownerDocument,ge=re.createElement("span");ge.className=Ve[tt+1];var Ee=$.parentNode;Ee.replaceChild(ge,$),ge.appendChild($),Se<oe&&(Ce[Qe+1]=$=re.createTextNode(Be.substring(Ge,oe)),Ee.insertBefore($,ge.nextSibling))}Se=Ge,Se>=oe&&(Qe+=2),Se>=Y&&(tt+=2)}}finally{be&&(be.style.display=Oe)}}var fe={};function te(we,De){for(var _e=De.length;--_e>=0;){var Be=De[_e];fe.hasOwnProperty(Be)?_.console&&console.warn("cannot override language handler %s",Be):fe[Be]=we}}function se(we,De){return we&&fe.hasOwnProperty(we)||(we=/^\s*</.test(De)?"default-markup":"default-code"),fe[we]}te(pe,["default-code"]),te(ue([],[[o,/^[^<?]+/],[y,/^<!\w[^>]*(?:>|$)/],[T,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[d,/^(?:<[%?]|[%?]>)/],["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"]),te(ue([[o,/^[\s]+/,null,` \r
`],[U,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[x,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[R,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[d,/^[=<>\/]+/],["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"]),te(ue([],[[U,/^[\s\S]+/]]),["uq.val"]),te(xe({keywords:v,hashComments:!0,cStyleComments:!0,types:g}),["c","cc","cpp","cxx","cyc","m"]),te(xe({keywords:"null,true,false"}),["json"]),te(xe({keywords:w,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:g}),["cs"]),te(xe({keywords:O,cStyleComments:!0}),["java"]),te(xe({keywords:u,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),te(xe({keywords:a,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),te(xe({keywords:s,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),te(xe({keywords:l,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),te(xe({keywords:E,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),te(xe({keywords:b,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),te(ue([],[[h,/^[\s\S]+/]]),["regex"]);function ye(we){var De=we.langExtension;try{var _e=F(we.sourceNode,we.pre),Be=_e.sourceCode;we.sourceCode=Be,we.spans=_e.spans,we.basePos=0,se(De,Be)(we),de(we)}catch(Ne){_.console&&console.log(Ne&&Ne.stack||Ne)}}function Me(we,De,_e){var Be=_e||!1,Ne=De||null,Se=document.createElement("div");Se.innerHTML="<pre>"+we+"</pre>",Se=Se.firstChild,Be&&he(Se,Be,!0);var Ce={langExtension:Ne,numberLines:Be,sourceNode:Se,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return ye(Ce),Se.innerHTML}function ke(we,De){var _e=De||document.body,Be=_e.ownerDocument||document;function Ne(ae){return _e.getElementsByTagName(ae)}for(var Se=[Ne("pre"),Ne("code"),Ne("xmp")],Ce=[],Ke=0;Ke<Se.length;++Ke)for(var Qe=0,Ve=Se[Ke].length;Qe<Ve;++Qe)Ce.push(Se[Ke][Qe]);Se=null;var Ue=Date;Ue.now||(Ue={now:function(){return+new Date}});var tt=0,Ye=/\blang(?:uage)?-([\w.]+)(?!\S)/,Xe=/\bprettyprint\b/,ve=/\bprettyprinted\b/,et=/pre|xmp/i,Ge=/^code$/i,be=/^(?:pre|code|xmp)$/i,Oe={};function le(){for(var ae=_.PR_SHOULD_USE_CONTINUATION?Ue.now()+250:Infinity;tt<Ce.length&&Ue.now()<ae;tt++){for(var oe=Ce[tt],Y=Oe,$=oe;$=$.previousSibling;){var J=$.nodeType,re=(J===7||J===8)&&$.nodeValue;if(re?!/^\??prettify\b/.test(re):J!==3||/\S/.test($.nodeValue))break;if(re){Y={},re.replace(/\b(\w+)=([\w:.%+-]+)/g,function(At,mt,or){Y[mt]=or});break}}var ge=oe.className;if((Y!==Oe||Xe.test(ge))&&!ve.test(ge)){for(var Ee=!1,Ie=oe.parentNode;Ie;Ie=Ie.parentNode){var st=Ie.tagName;if(be.test(st)&&Ie.className&&Xe.test(Ie.className)){Ee=!0;break}}if(!Ee){oe.className+=" prettyprinted";var ht=Y.lang;if(!ht){ht=ge.match(Ye);var Le;!ht&&(Le=ne(oe))&&Ge.test(Le.tagName)&&(ht=Le.className.match(Ye)),ht&&(ht=ht[1])}var pt;if(et.test(oe.tagName))pt=1;else{var it=oe.currentStyle,Je=Be.defaultView,xt=it?it.whiteSpace:Je&&Je.getComputedStyle?Je.getComputedStyle(oe,null).getPropertyValue("white-space"):0;pt=xt&&xt.substring(0,3)==="pre"}var Et=Y.linenums;(Et=Et==="true"||+Et)||(Et=ge.match(/\blinenums\b(?::(\d+))?/),Et=Et?Et[1]&&Et[1].length?+Et[1]:!0:!1),Et&&he(oe,Et,pt);var Pt={langExtension:ht,sourceNode:oe,numberLines:Et,pre:pt,sourceCode:null,basePos:null,spans:null,decorations:null};ye(Pt)}}}tt<Ce.length?_.setTimeout(le,250):typeof we=="function"&&we()}le()}var He=_.PR={createSimpleLexer:ue,registerLangHandler:te,sourceDecorator:xe,PR_ATTRIB_NAME:R,PR_ATTRIB_VALUE:U,PR_COMMENT:T,PR_DECLARATION:y,PR_KEYWORD:A,PR_LITERAL:m,PR_NOCODE:B,PR_PLAIN:o,PR_PUNCTUATION:d,PR_SOURCE:p,PR_STRING:h,PR_TAG:x,PR_TYPE:f,prettyPrintOne:L?_.prettyPrintOne=Me:M=Me,prettyPrint:N=L?_.prettyPrint=ke:N=ke},$e=_.define;typeof $e=="function"&&$e.amd&&$e("google-code-prettify",[],function(){return He})})()},"VrN/":function(at,qe,ee){(function(Q,K){at.exports=K()})(this,function(){"use strict";var Q=navigator.userAgent,K=navigator.platform,L=/gecko\/\d/i.test(Q),H=/MSIE \d/.test(Q),k=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Q),M=/Edge\/(\d+)/.exec(Q),N=H||k||M,_=N&&(H?document.documentMode||6:+(M||k)[1]),P=!M&&/WebKit\//.test(Q),D=P&&/Qt\/\d+\.\d+/.test(Q),c=!M&&/Chrome\//.test(Q),v=/Opera\//.test(Q),O=/Apple Computer/.test(navigator.vendor),w=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(Q),b=/PhantomJS/.test(Q),E=!M&&/AppleWebKit/.test(Q)&&/Mobile\/\w+/.test(Q),s=/Android/.test(Q),a=E||s||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(Q),l=E||/Mac/.test(K),u=/\bCrOS\b/.test(Q),C=/win/i.test(K),g=v&&Q.match(/Version\/(\d*\.\d*)/);g&&(g=Number(g[1])),g&&g>=15&&(v=!1,P=!0);var h=l&&(D||v&&(g==null||g<12.11)),A=L||N&&_>=9;function T(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var f=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 m(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function d(e,t){return m(e).appendChild(t)}function o(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 S=0;S<t.length;++S)i.appendChild(t[S]);return i}function x(e,t,n,r){var i=o(e,t,n,r);return i.setAttribute("role","presentation"),i}var y;document.createRange?y=function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:y=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 R(){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 z=function(e){e.select()};E?z=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:N&&(z=function(e){try{e.select()}catch(t){}});function j(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function F(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 X(e,t,n,r,i){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var S=r||0,I=i||0;;){var W=e.indexOf(" ",S);if(W<0||W>=t)return I+(t-S);I+=W-S,I+=n-I%n,S=W+1}}var q=function(){this.id=null,this.f=null,this.time=0,this.handler=j(this.onTimeout,this)};q.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},q.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 ne(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}var ue=50,xe={toString:function(){return"CodeMirror.Pass"}},pe={scroll:!1},he={origin:"*mouse"},de={origin:"+move"};function fe(e,t,n){for(var r=0,i=0;;){var S=e.indexOf(" ",r);S==-1&&(S=e.length);var I=S-r;if(S==e.length||i+I>=t)return r+Math.min(I,t-i);if(i+=S-r,i+=n-i%n,r=S+1,i>=t)return r}}var te=[""];function se(e){for(;te.length<=e;)te.push(ye(te)+" ");return te[e]}function ye(e){return e[e.length-1]}function Me(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function ke(e,t,n){for(var r=0,i=n(t);r<e.length&&n(e[r])<=i;)r++;e.splice(r,0,t)}function He(){}function $e(e,t){var n;return Object.create?n=Object.create(e):(He.prototype=e,n=new He),t&&F(t,n),n}var we=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function De(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||we.test(e))}function _e(e,t){return t?t.source.indexOf("\\w")>-1&&De(e)?!0:t.test(e):De(e)}function Be(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var Ne=/[\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 Se(e){return e.charCodeAt(0)>=768&&Ne.test(e)}function Ce(e,t,n){for(;(n<0?t>0:t<e.length)&&Se(e.charAt(t));)t+=n;return t}function Ke(e,t,n){for(var r=t>n?-1:1;;){if(t==n)return t;var i=(t+n)/2,S=r<0?Math.ceil(i):Math.floor(i);if(S==t)return e(S)?t:n;e(S)?n=S:t=S+r}}function Qe(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var i=!1,S=0;S<e.length;++S){var I=e[S];(I.from<n&&I.to>t||t==n&&I.to==t)&&(r(Math.max(I.from,t),Math.min(I.to,n),I.level==1?"rtl":"ltr",S),i=!0)}i||r(t,n,"ltr")}var Ve=null;function Ue(e,t,n){var r;Ve=null;for(var i=0;i<e.length;++i){var S=e[i];if(S.from<t&&S.to>t)return i;S.to==t&&(S.from!=S.to&&n=="before"?r=i:Ve=i),S.from==t&&(S.from!=S.to&&n!="before"?r=i:Ve=i)}return r!=null?r:Ve}var tt=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n(V){return V<=247?e.charAt(V):1424<=V&&V<=1524?"R":1536<=V&&V<=1785?t.charAt(V-1536):1774<=V&&V<=2220?"r":8192<=V&&V<=8203?"w":V==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,S=/[LRr]/,I=/[Lb1n]/,W=/[1n]/;function G(V,Z,ie){this.level=V,this.from=Z,this.to=ie}return function(V,Z){var ie=Z=="ltr"?"L":"R";if(V.length==0||Z=="ltr"&&!r.test(V))return!1;for(var me=V.length,ce=[],Te=0;Te<me;++Te)ce.push(n(V.charCodeAt(Te)));for(var Ae=0,Fe=ie;Ae<me;++Ae){var je=ce[Ae];je=="m"?ce[Ae]=Fe:Fe=je}for(var ze=0,We=ie;ze<me;++ze){var Ze=ce[ze];Ze=="1"&&We=="r"?ce[ze]="n":S.test(Ze)&&(We=Ze,Ze=="r"&&(ce[ze]="R"))}for(var ut=1,ot=ce[0];ut<me-1;++ut){var gt=ce[ut];gt=="+"&&ot=="1"&&ce[ut+1]=="1"?ce[ut]="1":gt==","&&ot==ce[ut+1]&&(ot=="1"||ot=="n")&&(ce[ut]=ot),ot=gt}for(var Rt=0;Rt<me;++Rt){var Vt=ce[Rt];if(Vt==",")ce[Rt]="N";else if(Vt=="%"){var _t=void 0;for(_t=Rt+1;_t<me&&ce[_t]=="%";++_t);for(var dr=Rt&&ce[Rt-1]=="!"||_t<me&&ce[_t]=="1"?"1":"N",nr=Rt;nr<_t;++nr)ce[nr]=dr;Rt=_t-1}}for(var Bt=0,ir=ie;Bt<me;++Bt){var Yt=ce[Bt];ir=="L"&&Yt=="1"?ce[Bt]="L":S.test(Yt)&&(ir=Yt)}for(var Ht=0;Ht<me;++Ht)if(i.test(ce[Ht])){var jt=void 0;for(jt=Ht+1;jt<me&&i.test(ce[jt]);++jt);for(var Ft=(Ht?ce[Ht-1]:ie)=="L",ar=(jt<me?ce[jt]:ie)=="L",Gn=Ft==ar?Ft?"L":"R":ie,Qr=Ht;Qr<jt;++Qr)ce[Qr]=Gn;Ht=jt-1}for(var Jt=[],Dr,Xt=0;Xt<me;)if(I.test(ce[Xt])){var Xa=Xt;for(++Xt;Xt<me&&I.test(ce[Xt]);++Xt);Jt.push(new G(0,Xa,Xt))}else{var Ir=Xt,pn=Jt.length,gn=Z=="rtl"?1:0;for(++Xt;Xt<me&&ce[Xt]!="L";++Xt);for(var er=Ir;er<Xt;)if(W.test(ce[er])){Ir<er&&(Jt.splice(pn,0,new G(1,Ir,er)),pn+=gn);var zn=er;for(++er;er<Xt&&W.test(ce[er]);++er);Jt.splice(pn,0,new G(2,zn,er)),pn+=gn,Ir=er}else++er;Ir<Xt&&Jt.splice(pn,0,new G(1,Ir,Xt))}return Z=="ltr"&&(Jt[0].level==1&&(Dr=V.match(/^\s+/))&&(Jt[0].from=Dr[0].length,Jt.unshift(new G(0,0,Dr[0].length))),ye(Jt).level==1&&(Dr=V.match(/\s+$/))&&(ye(Jt).to-=Dr[0].length,Jt.push(new G(0,me-Dr[0].length,me)))),Z=="rtl"?Jt.reverse():Jt}}();function Ye(e,t){var n=e.order;return n==null&&(n=e.order=tt(e.text,t)),n}var Xe=[],ve=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]||Xe).concat(n)}};function et(e,t){return e._handlers&&e._handlers[t]||Xe}function Ge(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 S=ne(i,n);S>-1&&(r[t]=i.slice(0,S).concat(i.slice(S+1)))}}}function be(e,t){var n=et(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 Oe(e,t,n){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),be(e,n||t.type,e,t),J(t)||t.codemirrorIgnore}function le(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)ne(n,t[r])==-1&&n.push(t[r])}function ae(e,t){return et(e,t).length>0}function oe(e){e.prototype.on=function(t,n){ve(this,t,n)},e.prototype.off=function(t,n){Ge(this,t,n)}}function Y(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function $(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function J(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function re(e){Y(e),$(e)}function ge(e){return e.target||e.srcElement}function Ee(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 Ie=function(){if(N&&_<9)return!1;var e=o("div");return"draggable"in e||"dragDrop"in e}(),st;function ht(e){if(st==null){var t=o("span","\u200B");d(e,o("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(st=t.offsetWidth<=1&&t.offsetHeight>2&&!(N&&_<8))}var n=st?o("span","\u200B"):o("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var Le;function pt(e){if(Le!=null)return Le;var t=d(e,document.createTextNode("A\u062EA")),n=y(t,0,1).getBoundingClientRect(),r=y(t,1,2).getBoundingClientRect();return m(e),!n||n.left==n.right?!1:Le=r.right-n.right<3}var it=`
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 S=e.slice(t,e.charAt(i-1)=="\r"?i-1:i),I=S.indexOf("\r");I!=-1?(n.push(S.slice(0,I)),t+=I+1):(n.push(S),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},Je=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=o("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),Et=null;function Pt(e){if(Et!=null)return Et;var t=d(e,o("span","x")),n=t.getBoundingClientRect(),r=y(t,0,1).getBoundingClientRect();return Et=Math.abs(n.left-r.left)>1}var At={},mt={};function or(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),At[e]=t}function Kt(e,t){mt[e]=t}function Ut(e){if(typeof e=="string"&&mt.hasOwnProperty(e))e=mt[e];else if(e&&typeof e.name=="string"&&mt.hasOwnProperty(e.name)){var t=mt[e.name];typeof t=="string"&&(t={name:t}),e=$e(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Ut("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Ut("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function Tr(e,t){t=Ut(t);var n=At[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 S in i){if(!i.hasOwnProperty(S))continue;r.hasOwnProperty(S)&&(r["_"+S]=r[S]),r[S]=i[S]}}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var I in t.modeProps)r[I]=t.modeProps[I];return r}var vr={};function wi(e,t){var n=vr.hasOwnProperty(e)?vr[e]:vr[e]={};F(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=X(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?X(this.string,this.lineStart,this.tabSize):0)},kt.prototype.indentation=function(){return X(this.string,null,this.tabSize)-(this.lineStart?X(this.string,this.lineStart,this.tabSize):0)},kt.prototype.match=function(e,t,n){if(typeof e=="string"){var r=function(I){return n?I.toLowerCase():I},i=this.string.substr(this.pos,e.length);if(r(i)==r(e))return t!==!1&&(this.pos+=e.length),!0}else{var S=this.string.slice(this.pos).match(e);return S&&S.index>0?null:(S&&t!==!1&&(this.pos+=S[0].length),S)}},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 nt(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],S=i.chunkSize();if(t<S){n=i;break}t-=S}return n.lines[t]}function Sr(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,function(S){var I=S.text;i==n.line&&(I=I.slice(0,n.ch)),i==t.line&&(I=I.slice(t.ch)),r.push(I),++i}),r}function Vn(e,t,n){var r=[];return e.iter(t,n,function(i){r.push(i.text)}),r}function fr(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=ne(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],S=i.height;if(t<S){e=i;continue e}t-=S,n+=i.chunkSize()}return n}while(!e.lines);for(var I=0;I<e.lines.length;++I){var W=e.lines[I],G=W.height;if(t<G)break;t-=G}return n+I}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 Re(e,t,n){if(n===void 0&&(n=null),!(this instanceof Re))return new Re(e,t,n);this.line=e,this.ch=t,this.sticky=n}function dt(e,t){return e.line-t.line||e.ch-t.ch}function qr(e,t){return e.sticky==t.sticky&&dt(e,t)==0}function en(e){return Re(e.line,e.ch)}function tn(e,t){return dt(e,t)<0?t:e}function bn(e,t){return dt(e,t)<0?e:t}function Xn(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function ct(e,t){if(t.line<e.first)return Re(e.first,0);var n=e.first+e.size-1;return t.line>n?Re(n,nt(e,n).text.length):Ci(t,nt(e,t.line).text.length)}function Ci(e,t){var n=e.ch;return n==null||n>t?Re(e.line,t):n<0?Re(e.line,0):e}function Li(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=ct(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 Ai(e,t,n,r){var i=[e.state.modeGen],S={};Qn(e,t.text,e.doc.mode,n,function(V,Z){return i.push(V,Z)},S,r);for(var I=n.state,W=function(V){n.baseTokens=i;var Z=e.state.overlays[V],ie=1,me=0;n.state=!0,Qn(e,t.text,Z.mode,n,function(ce,Te){for(var Ae=ie;me<ce;){var Fe=i[ie];Fe>ce&&i.splice(ie,1,ce,i[ie+1],Fe),ie+=2,me=Math.min(ce,Fe)}if(!Te)return;if(Z.opaque)i.splice(Ae,ie-Ae,ce,"overlay "+Te),ie=Ae+2;else for(;Ae<ie;Ae+=2){var je=i[Ae+1];i[Ae+1]=(je?je+" ":"")+"overlay "+Te}},S),n.state=I,n.baseTokens=null,n.baseTokenPos=1},G=0;G<e.state.overlays.length;++G)W(G);return{styles:i,classes:S.bgClass||S.textClass?S:null}}function Yn(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=Pe(e,St(t)),i=t.text.length>e.options.maxHighlightLength&&mr(e.doc.mode,r.state),S=Ai(e,t,r);i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=S.styles,S.classes?t.styleClasses=S.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 Pe(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new sr(r,!0,t);var S=Or(e,t,n),I=S>r.first&&nt(r,S-1).stateAfter,W=I?sr.fromSaved(r,I,S):new sr(r,Jr(r.mode),S);return r.iter(S,t,function(G){$n(e,G.text,W);var V=W.line;G.stateAfter=V==t-1||V%5==0||V>=i.viewFrom&&V<i.viewTo?W.save():null,W.nextLine()}),n&&(r.modeFrontier=W.line),W}function $n(e,t,n,r){var i=e.doc.mode,S=new kt(t,e.options.tabSize,n);for(S.start=S.pos=r||0,t==""&&Di(i,n.state);!S.eol();)En(i,S,n.state),S.start=S.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 S=e.token(t,n);if(t.pos>t.start)return S}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 Fr(e,t,n,r){var i=e.doc,S=i.mode,I;t=ct(i,t);var W=nt(i,t.line),G=Pe(e,t.line,n),V=new kt(W.text,e.options.tabSize,G),Z;for(r&&(Z=[]);(r||V.pos<t.ch)&&!V.eol();)V.start=V.pos,I=En(S,V,G.state),r&&Z.push(new nn(V,I,mr(i.mode,G.state)));return r?Z:new nn(V,I,G.state)}function Oi(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,S,I){var W=n.flattenSpans;W==null&&(W=e.options.flattenSpans);var G=0,V=null,Z=new kt(t,e.options.tabSize,r),ie,me=e.options.addModeClass&&[null];for(t==""&&Oi(Di(n,r.state),S);!Z.eol();){if(Z.pos>e.options.maxHighlightLength?(W=!1,I&&$n(e,t,r,Z.pos),Z.pos=t.length,ie=null):ie=Oi(En(n,Z,r.state,me),S),me){var ce=me[0].name;ce&&(ie="m-"+(ie?ce+" "+ie:ce))}if(!W||V!=ie){for(;G<Z.start;)G=Math.min(Z.start,G+5e3),i(G,V);V=ie}Z.start=Z.pos}for(;G<Z.pos;){var Te=Math.min(Z.pos,G+5e3);i(Te,V),G=Te}}function Or(e,t,n){for(var r,i,S=e.doc,I=n?-1:t-(e.doc.mode.innerMode?1e3:100),W=t;W>I;--W){if(W<=S.first)return S.first;var G=nt(S,W-1),V=G.stateAfter;if(V&&(!n||W+(V instanceof rn?V.lookAhead:0)<=S.modeFrontier))return W;var Z=X(G.text,null,e.options.tabSize);(i==null||r>Z)&&(i=W-1,r=Z)}return i}function Ri(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=nt(e,r).stateAfter;if(i&&(!(i instanceof rn)||r+i.lookAhead<t)){n=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}var Pi=!1,pr=!1;function Cr(){Pi=!0}function Mi(){pr=!0}function xn(e,t,n){this.marker=e,this.from=t,this.to=n}function Nr(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function Ur(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 S=e[i],I=S.marker,W=S.from==null||(I.inclusiveLeft?S.from<=t:S.from<t);if(W||S.from==t&&I.type=="bookmark"&&(!n||!S.marker.insertLeft)){var G=S.to==null||(I.inclusiveRight?S.to>=t:S.to>t);(r||(r=[])).push(new xn(I,S.from,G?null:S.to))}}return r}function ki(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var S=e[i],I=S.marker,W=S.to==null||(I.inclusiveRight?S.to>=t:S.to>t);if(W||S.from==t&&I.type=="bookmark"&&(!n||S.marker.insertLeft)){var G=S.from==null||(I.inclusiveLeft?S.from<=t:S.from<t);(r||(r=[])).push(new xn(I,G?null:S.from-t,S.to==null?null:S.to-t))}}return r}function Rr(e,t){if(t.full)return null;var n=Zr(e,t.from.line)&&nt(e,t.from.line).markedSpans,r=Zr(e,t.to.line)&&nt(e,t.to.line).markedSpans;if(!n&&!r)return null;var i=t.from.ch,S=t.to.ch,I=dt(t.from,t.to)==0,W=aa(n,i,I),G=ki(r,S,I),V=t.text.length==1,Z=ye(t.text).length+(V?i:0);if(W)for(var ie=0;ie<W.length;++ie){var me=W[ie];if(me.to==null){var ce=Nr(G,me.marker);ce?V&&(me.to=ce.to==null?null:ce.to+Z):me.to=i}}if(G)for(var Te=0;Te<G.length;++Te){var Ae=G[Te];if(Ae.to!=null&&(Ae.to+=Z),Ae.from==null){var Fe=Nr(W,Ae.marker);Fe||(Ae.from=Z,V&&(W||(W=[])).push(Ae))}else Ae.from+=Z,V&&(W||(W=[])).push(Ae)}W&&(W=Tn(W)),G&&G!=W&&(G=Tn(G));var je=[W];if(!V){var ze=t.text.length-2,We;if(ze>0&&W)for(var Ze=0;Ze<W.length;++Ze)W[Ze].to==null&&(We||(We=[])).push(new xn(W[Ze].marker,null,null));for(var ut=0;ut<ze;++ut)je.push(We);je.push(G)}return je}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(ce){if(ce.markedSpans)for(var Te=0;Te<ce.markedSpans.length;++Te){var Ae=ce.markedSpans[Te].marker;Ae.readOnly&&(!r||ne(r,Ae)==-1)&&(r||(r=[])).push(Ae)}}),!r)return null;for(var i=[{from:t,to:n}],S=0;S<r.length;++S)for(var I=r[S],W=I.find(0),G=0;G<i.length;++G){var V=i[G];if(dt(V.to,W.from)<0||dt(V.from,W.to)>0)continue;var Z=[G,1],ie=dt(V.from,W.from),me=dt(V.to,W.to);(ie<0||!I.inclusiveLeft&&!ie)&&Z.push({from:V.from,to:W.from}),(me>0||!I.inclusiveRight&&!me)&&Z.push({from:W.to,to:V.to}),i.splice.apply(i,Z),G+=Z.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(),S=dt(r.from,i.from)||an(e)-an(t);if(S)return-S;var I=dt(r.to,i.to)||Sn(e)-Sn(t);return I||t.id-e.id}function sa(e,t){var n=pr&&e.markedSpans,r;if(n)for(var i=void 0,S=0;S<n.length;++S)i=n[S],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 _i(e,t){var n=pr&&e.markedSpans,r;if(n)for(var i=0;i<n.length;++i){var S=n[i];S.marker.collapsed&&(S.from==null||S.from<t)&&(S.to==null||S.to>t)&&(!r||wn(r,S.marker)<0)&&(r=S.marker)}return r}function qn(e,t,n,r,i){var S=nt(e,t),I=pr&&S.markedSpans;if(I)for(var W=0;W<I.length;++W){var G=I[W];if(!G.marker.collapsed)continue;var V=G.marker.find(0),Z=dt(V.from,n)||an(G.marker)-an(i),ie=dt(V.to,r)||Sn(G.marker)-Sn(i);if(Z>=0&&ie<=0||Z<=0&&ie>=0)continue;if(Z<=0&&(G.marker.inclusiveRight&&i.inclusiveLeft?dt(V.to,n)>=0:dt(V.to,n)>0)||Z>=0&&(G.marker.inclusiveRight&&i.inclusiveLeft?dt(V.from,r)<=0:dt(V.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 Ln(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=nt(e,t),r=$t(n);return n==r?t:St(r)}function Ii(e,t){if(t>e.lastLine())return t;var n=nt(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&&An(e,t,r))return!0}}function An(e,t,n){if(n.to==null){var r=n.marker.find(1,!0);return An(e,r.line,Nr(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var i=void 0,S=0;S<t.markedSpans.length;++S)if(i=t.markedSpans[S],i.marker.collapsed&&!i.marker.widgetNode&&i.from==n.to&&(i.to==null||i.to!=n.from)&&(i.marker.inclusiveLeft||n.marker.inclusiveRight)&&An(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 S=n.parent;S;n=S,S=n.parent)for(var I=0;I<S.children.length;++I){var W=S.children[I];if(W==n)break;t+=W.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 S=n.find(0,!0);t-=r.text.length-S.from.ch,r=S.to.line,t+=r.text.length-S.to.ch}return t}function Pr(e){var t=e.display,n=e.doc;t.maxLine=nt(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)},oe(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&&fr(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 Fi(e,t){var n=x("span",null,null,P?"padding-right: .1px":null),r={pre:x("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 S=i?t.rest[i-1]:t.line,I=void 0;r.pos=0,r.addToken=ft,pt(e.display.measure)&&(I=Ye(S,e.doc.direction))&&(r.addToken=vt(r.addToken,I)),r.map=[];var W=t!=e.display.externalMeasured&&St(S);Ot(S,r,Yn(e,S,W)),S.styleClasses&&(S.styleClasses.bgClass&&(r.bgClass=B(S.styleClasses.bgClass,r.bgClass||"")),S.styleClasses.textClass&&(r.textClass=B(S.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(ht(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(P){var G=r.content.lastChild;(/\bcm-tab\b/.test(G.className)||G.querySelector&&G.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return be(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=B(r.pre.className,r.textClass||"")),r}function rt(e){var t=o("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function ft(e,t,n,r,i,S,I){if(!t)return;var W=e.splitSpaces?lt(t,e.trailingSpace):t,G=e.cm.state.specialChars,V=!1,Z;if(!G.test(t))e.col+=t.length,Z=document.createTextNode(W),e.map.push(e.pos,e.pos+t.length,Z),N&&_<9&&(V=!0),e.pos+=t.length;else{Z=document.createDocumentFragment();for(var ie=0;;){G.lastIndex=ie;var me=G.exec(t),ce=me?me.index-ie:t.length-ie;if(ce){var Te=document.createTextNode(W.slice(ie,ie+ce));N&&_<9?Z.appendChild(o("span",[Te])):Z.appendChild(Te),e.map.push(e.pos,e.pos+ce,Te),e.col+=ce,e.pos+=ce}if(!me)break;ie+=ce+1;var Ae=void 0;if(me[0]==" "){var Fe=e.cm.options.tabSize,je=Fe-e.col%Fe;Ae=Z.appendChild(o("span",se(je),"cm-tab")),Ae.setAttribute("role","presentation"),Ae.setAttribute("cm-text"," "),e.col+=je}else me[0]=="\r"||me[0]==`
`?(Ae=Z.appendChild(o("span",me[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Ae.setAttribute("cm-text",me[0]),e.col+=1):(Ae=e.cm.options.specialCharPlaceholder(me[0]),Ae.setAttribute("cm-text",me[0]),N&&_<9?Z.appendChild(o("span",[Ae])):Z.appendChild(Ae),e.col+=1);e.map.push(e.pos,e.pos+1,Ae),e.pos++}}if(e.trailingSpace=W.charCodeAt(t.length-1)==32,n||r||i||V||S||I){var ze=n||"";r&&(ze+=r),i&&(ze+=i);var We=o("span",[Z],ze,S);if(I)for(var Ze in I)I.hasOwnProperty(Ze)&&Ze!="style"&&Ze!="class"&&We.setAttribute(Ze,I[Ze]);return e.content.appendChild(We)}e.content.appendChild(Z)}function lt(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",i=0;i<e.length;i++){var S=e.charAt(i);S==" "&&n&&(i==e.length-1||e.charCodeAt(i+1)==32)&&(S="\xA0"),r+=S,n=S==" "}return r}function vt(e,t){return function(n,r,i,S,I,W,G){i=i?i+" cm-force-border":"cm-force-border";for(var V=n.pos,Z=V+r.length;;){for(var ie=void 0,me=0;me<t.length&&!(ie=t[me],ie.to>V&&ie.from<=V);me++);if(ie.to>=Z)return e(n,r,i,S,I,W,G);e(n,r.slice(0,ie.to-V),i,S,null,W,G),S=null,r=r.slice(ie.to-V),V=ie.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 Ot(e,t,n){var r=e.markedSpans,i=e.text,S=0;if(!r){for(var I=1;I<n.length;I+=2)t.addToken(t,i.slice(S,S=n[I]),da(n[I+1],t.cm.options));return}for(var W=i.length,G=0,V=1,Z="",ie,me,ce=0,Te,Ae,Fe,je,ze;;){if(ce==G){Te=Ae=Fe=me="",ze=null,je=null,ce=Infinity;for(var We=[],Ze=void 0,ut=0;ut<r.length;++ut){var ot=r[ut],gt=ot.marker;if(gt.type=="bookmark"&&ot.from==G&&gt.widgetNode)We.push(gt);else if(ot.from<=G&&(ot.to==null||ot.to>G||gt.collapsed&&ot.to==G&&ot.from==G)){if(ot.to!=null&&ot.to!=G&&ce>ot.to&&(ce=ot.to,Ae=""),gt.className&&(Te+=" "+gt.className),gt.css&&(me=(me?me+";":"")+gt.css),gt.startStyle&&ot.from==G&&(Fe+=" "+gt.startStyle),gt.endStyle&&ot.to==ce&&(Ze||(Ze=[])).push(gt.endStyle,ot.to),gt.title&&((ze||(ze={})).title=gt.title),gt.attributes)for(var Rt in gt.attributes)(ze||(ze={}))[Rt]=gt.attributes[Rt];gt.collapsed&&(!je||wn(je.marker,gt)<0)&&(je=ot)}else ot.from>G&&ce>ot.from&&(ce=ot.from)}if(Ze)for(var Vt=0;Vt<Ze.length;Vt+=2)Ze[Vt+1]==ce&&(Ae+=" "+Ze[Vt]);if(!je||je.from==G)for(var _t=0;_t<We.length;++_t)Tt(t,0,We[_t]);if(je&&(je.from||0)==G){if(Tt(t,(je.to==null?W+1:je.to)-G,je.marker,je.from==null),je.to==null)return;je.to==G&&(je=!1)}}if(G>=W)break;for(var dr=Math.min(W,ce);;){if(Z){var nr=G+Z.length;if(!je){var Bt=nr>dr?Z.slice(0,dr-G):Z;t.addToken(t,Bt,ie?ie+Te:Te,Fe,G+Bt.length==ce?Ae:"",me,ze)}if(nr>=dr){Z=Z.slice(dr-G),G=dr;break}G=nr,Fe=""}Z=i.slice(S,S=n[V++]),ie=da(n[V++],t.cm.options)}}}function yt(e,t,n){this.line=t,this.rest=Ln(t),this.size=this.rest?St(ye(this.rest))-n+1:1,this.node=this.text=null,this.hidden=yr(e,t)}function It(e,t,n){for(var r=[],i,S=t;S<n;S=i){var I=new yt(e.doc,nt(e.doc,S),S);i=S+I.size,r.push(I)}return r}var Wt=null;function bt(e){Wt?Wt.ops.push(e):e.ownsGroup=Wt={ops:[e],delayedCallbacks:[]}}function Mr(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{Mr(n)}finally{Wt=null,t(n)}}var Zt=null;function Dt(e,t){var n=et(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 S=function(W){i.push(function(){return n[W].apply(null,r)})},I=0;I<n.length;++I)S(I)}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 S=t.changes[i];S=="text"?_s(e,t):S=="gutter"?qa(e,t,n,r):S=="class"?fa(e,t):S=="widget"&&Is(e,t,r)}t.changes=null}function ei(e){return e.node==e.text&&(e.node=o("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),N&&_<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(o("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):Fi(e,t)}function _s(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,fa(e,t)):n&&(t.text.className=n)}function fa(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=o("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 S=t.line.gutterMarkers;if(e.options.lineNumbers||S){var I=ei(t),W=t.gutter=o("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(W),I.insertBefore(W,t.text),t.line.gutterClass&&(W.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!S||!S["CodeMirror-linenumbers"])&&(t.lineNumber=W.appendChild(o("div",yn(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),S)for(var G=0;G<e.display.gutterSpecs.length;++G){var V=e.display.gutterSpecs[G].className,Z=S.hasOwnProperty(V)&&S[V];Z&&W.appendChild(o("div",[Z],"CodeMirror-gutter-elt","left: "+r.gutterLeft[V]+"px; width: "+r.gutterWidth[V]+"px"))}}}function Is(e,t,n){t.alignable&&(t.alignable=null);for(var r=T("CodeMirror-linewidget"),i=t.node.firstChild,S=void 0;i;i=S)S=i.nextSibling,r.test(i.className)&&t.node.removeChild(i);eo(e,t,n)}function Fs(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),fa(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 S=ei(n),I=0,W=t.widgets;I<W.length;++I){var G=W[I],V=o("div",[G.node],"CodeMirror-linewidget"+(G.className?" "+G.className:""));G.handleMouseEvents||V.setAttribute("cm-ignore-events","true"),Ns(G,V,n,r),e.display.input.setUneditable(V),i&&G.above?S.insertBefore(V,n.gutter||n.text):S.appendChild(V),Dt(G,"redraw")}}function Ns(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;"),d(t.display.measure,o("div",[e.node],null,n))}return e.height=e.node.parentNode.offsetHeight}function kr(e,t){for(var n=ge(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 Ni(e){return e.lineSpace.offsetTop}function ca(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function ro(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=d(e.measure,o("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 Lr(e){return ue-e.display.nativeBarWidth}function sn(e){return e.display.scroller.clientWidth-Lr(e)-e.display.barWidth}function ha(e){return e.display.scroller.clientHeight-Lr(e)-e.display.barHeight}function Us(e,t,n){var r=e.options.lineWrapping,i=r&&sn(e);if(!t.measure.heights||r&&t.measure.width!=i){var S=t.measure.heights=[];if(r){t.measure.width=i;for(var I=t.text.firstChild.getClientRects(),W=0;W<I.length-1;W++){var G=I[W],V=I[W+1];Math.abs(G.bottom-V.bottom)>2&&S.push((G.bottom+V.top)/2-n.top)}}S.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=Fi(e,r);return r.text=i.pre,d(e.display.lineMeasure,i.pre),r}function io(e,t,n,r){return Ar(e,On(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 On(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 Ar(e,t,n,r,i){t.before&&(n=-1);var S=n+(r||""),I;return t.cache.hasOwnProperty(S)?I=t.cache[S]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Us(e,t.view,t.rect),t.hasHeights=!0),I=Ws(e,t,n,r),I.bogus||(t.cache[S]=I)),{left:I.left,right:I.right,top:i?I.rtop:I.top,bottom:i?I.rbottom:I.bottom}}var ao={left:0,right:0,top:0,bottom:0};function oo(e,t,n){for(var r,i,S,I,W,G,V=0;V<e.length;V+=3)if(W=e[V],G=e[V+1],t<W?(i=0,S=1,I="left"):t<G?(i=t-W,S=i+1):(V==e.length-3||t==G&&e[V+3]>t)&&(S=G-W,i=S-1,t>=G&&(I="right")),i!=null){if(r=e[V+2],W==G&&n==(r.insertLeft?"left":"right")&&(I=n),n=="left"&&i==0)for(;V&&e[V-2]==e[V-3]&&e[V-1].insertLeft;)r=e[(V-=3)+2],I="left";if(n=="right"&&i==G-W)for(;V<e.length-3&&e[V+3]==e[V+4]&&!e[V+5].insertLeft;)r=e[(V+=3)+2],I="right";break}return{node:r,start:i,end:S,collapse:I,coverStart:W,coverEnd:G}}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),S=i.node,I=i.start,W=i.end,G=i.collapse,V;if(S.nodeType==3){for(var Z=0;Z<4;Z++){for(;I&&Se(t.line.text.charAt(i.coverStart+I));)--I;for(;i.coverStart+W<i.coverEnd&&Se(t.line.text.charAt(i.coverStart+W));)++W;if(N&&_<9&&I==0&&W==i.coverEnd-i.coverStart?V=S.parentNode.getBoundingClientRect():V=js(y(S,I,W).getClientRects(),r),V.left||V.right||I==0)break;W=I,I=I-1,G="right"}N&&_<11&&(V=Hs(e.display.measure,V))}else{I>0&&(G=r="right");var ie;e.options.lineWrapping&&(ie=S.getClientRects()).length>1?V=ie[r=="right"?ie.length-1:0]:V=S.getBoundingClientRect()}if(N&&_<9&&!I&&(!V||!V.left&&!V.right)){var me=S.parentNode.getClientRects()[0];me?V={left:me.left,right:me.left+Pn(e.display),top:me.top,bottom:me.bottom}:V=ao}for(var ce=V.top-t.rect.top,Te=V.bottom-t.rect.top,Ae=(ce+Te)/2,Fe=t.view.measure.heights,je=0;je<Fe.length-1&&!(Ae<Fe[je]);je++);var ze=je?Fe[je-1]:0,We=Fe[je],Ze={left:(G=="right"?V.right:V.left)-t.rect.left,right:(G=="left"?V.left:V.right)-t.rect.left,top:ze,bottom:We};return!V.left&&!V.right&&(Ze.bogus=!0),e.options.singleCursorHeightPerLine||(Ze.rtop=ce,Ze.rbottom=Te),Ze}function Hs(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!Pt(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,m(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 c&&s?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function fo(){return c&&s?-(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 Ui(e,t,n,r,i){if(!i){var S=pa(t);n.top+=S,n.bottom+=S}if(r=="line")return n;r||(r="local");var I=lr(t);if(r=="local"?I+=Ni(e.display):I-=e.display.viewOffset,r=="page"||r=="window"){var W=e.display.lineSpace.getBoundingClientRect();I+=W.top+(r=="window"?0:fo());var G=W.left+(r=="window"?0:uo());n.left+=G,n.right+=G}return n.top+=I,n.bottom+=I,n}function co(e,t,n){if(n=="div")return t;var r=t.left,i=t.top;if(n=="page")r-=uo(),i-=fo();else if(n=="local"||!n){var S=e.display.sizer.getBoundingClientRect();r+=S.left,i+=S.top}var I=e.display.lineSpace.getBoundingClientRect();return{left:r-I.left,top:i-I.top}}function ga(e,t,n,r,i){return r||(r=nt(e.doc,t.line)),Ui(e,r,io(e,r,t.ch,i),n)}function br(e,t,n,r,i,S){r=r||nt(e.doc,t.line),i||(i=On(e,r));function I(Te,Ae){var Fe=Ar(e,i,Te,Ae?"right":"left",S);return Ae?Fe.left=Fe.right:Fe.right=Fe.left,Ui(e,r,Fe,n)}var W=Ye(r,e.doc.direction),G=t.ch,V=t.sticky;if(G>=r.text.length?(G=r.text.length,V="before"):G<=0&&(G=0,V="after"),!W)return I(V=="before"?G-1:G,V=="before");function Z(Te,Ae,Fe){var je=W[Ae],ze=je.level==1;return I(Fe?Te-1:Te,ze!=Fe)}var ie=Ue(W,G,V),me=Ve,ce=Z(G,ie,V=="before");return me!=null&&(ce.other=Z(G,me,V!="before")),ce}function ho(e,t){var n=0;t=ct(e.doc,t),e.options.lineWrapping||(n=Pn(e.display)*t.ch);var r=nt(e.doc,t.line),i=lr(r)+Ni(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function va(e,t,n,r,i){var S=Re(e,t,n);return S.xRel=i,r&&(S.outside=r),S}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),S=r.first+r.size-1;if(i>S)return va(r.first+r.size-1,nt(r,S).text.length,null,1,1);t<0&&(t=0);for(var I=nt(r,i);;){var W=Ks(e,I,i,t,n),G=_i(I,W.ch+(W.xRel>0||W.outside>0?1:0));if(!G)return W;var V=G.find(1);if(V.line==i)return V;I=nt(r,i=V.line)}}function mo(e,t,n,r){r-=pa(t);var i=t.text.length,S=Ke(function(I){return Ar(e,n,I-1).bottom<=r},i,0);return i=Ke(function(I){return Ar(e,n,I).top>r},S,i),{begin:S,end:i}}function po(e,t,n,r){n||(n=On(e,t));var i=Ui(e,t,Ar(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 S=On(e,t),I=pa(t),W=0,G=t.text.length,V=!0,Z=Ye(t,e.doc.direction);if(Z){var ie=(e.options.lineWrapping?zs:Gs)(e,t,n,S,Z,r,i);V=ie.level!=1,W=V?ie.from:ie.to-1,G=V?ie.to:ie.from-1}var me=null,ce=null,Te=Ke(function(ut){var ot=Ar(e,S,ut);return ot.top+=I,ot.bottom+=I,ba(ot,r,i,!1)?(ot.top<=i&&ot.left<=r&&(me=ut,ce=ot),!0):!1},W,G),Ae,Fe,je=!1;if(ce){var ze=r-ce.left<ce.right-r,We=ze==V;Te=me+(We?0:1),Fe=We?"after":"before",Ae=ze?ce.left:ce.right}else{!V&&(Te==G||Te==W)&&Te++,Fe=Te==0?"after":Te==t.text.length?"before":Ar(e,S,Te-(V?1:0)).bottom+I<=i==V?"after":"before";var Ze=br(e,Re(n,Te,Fe),"line",t,S);Ae=Ze.left,je=i<Ze.top?-1:i>=Ze.bottom?1:0}return Te=Ce(t.text,Te,1),va(n,Te,Fe,je,r-Ae)}function Gs(e,t,n,r,i,S,I){var W=Ke(function(ie){var me=i[ie],ce=me.level!=1;return ba(br(e,Re(n,ce?me.to:me.from,ce?"before":"after"),"line",t,r),S,I,!0)},0,i.length-1),G=i[W];if(W>0){var V=G.level!=1,Z=br(e,Re(n,V?G.from:G.to,V?"after":"before"),"line",t,r);ba(Z,S,I,!0)&&Z.top>I&&(G=i[W-1])}return G}function zs(e,t,n,r,i,S,I){var W=mo(e,t,r,I),G=W.begin,V=W.end;/\s/.test(t.text.charAt(V-1))&&V--;for(var Z=null,ie=null,me=0;me<i.length;me++){var ce=i[me];if(ce.from>=V||ce.to<=G)continue;var Te=ce.level!=1,Ae=Ar(e,r,Te?Math.min(V,ce.to)-1:Math.max(G,ce.from)).right,Fe=Ae<S?S-Ae+1e9:Ae-S;(!Z||ie>Fe)&&(Z=ce,ie=Fe)}return Z||(Z=i[i.length-1]),Z.from<G&&(Z={from:G,to:Z.to,level:Z.level}),Z.to>V&&(Z={from:Z.from,to:V,level:Z.level}),Z}var ln;function Rn(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(ln==null){ln=o("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)ln.appendChild(document.createTextNode("x")),ln.appendChild(o("br"));ln.appendChild(document.createTextNode("x"))}d(e.measure,ln);var n=ln.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),m(e.measure),n||1}function Pn(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=o("span","xxxxxxxxxx"),n=o("pre",[t],"CodeMirror-line-like");d(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,S=t.gutters.firstChild,I=0;S;S=S.nextSibling,++I){var W=e.display.gutterSpecs[I].className;n[W]=S.offsetLeft+S.clientLeft+i,r[W]=S.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=Rn(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/Pn(e.display)-3);return function(i){if(yr(e.doc,i))return 0;var S=0;if(i.widgets)for(var I=0;I<i.widgets.length;I++)i.widgets[I].height&&(S+=i.widgets[I].height);return n?S+(Math.ceil(i.text.length/r)||1)*t:S+t}}function Ta(e){var t=e.doc,n=go(e);t.iter(function(r){var i=n(r);i!=r.height&&fr(r,i)})}function un(e,t,n,r){var i=e.display;if(!n&&ge(t).getAttribute("cm-not-content")=="true")return null;var S,I,W=i.lineSpace.getBoundingClientRect();try{S=t.clientX-W.left,I=t.clientY-W.top}catch(ie){return null}var G=ya(e,S,I),V;if(r&&G.xRel>0&&(V=nt(e.doc,G.line).text).length==G.ch){var Z=X(V,V.length,e.options.tabSize)-V.length;G=Re(G.line,Math.max(0,Math.round((S-ro(e.display).left)/Pn(e.display))-Z))}return G}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 S=Bi(e,n,n+r,1);S?(i.view=i.view.slice(S.index),i.viewFrom=S.lineN,i.viewTo+=r):Gr(e)}else if(n>=i.viewTo){var I=Bi(e,t,t,-1);I?(i.view=i.view.slice(0,I.index),i.viewTo=I.lineN):Gr(e)}else{var W=Bi(e,t,t,-1),G=Bi(e,n,n+r,1);W&&G?(i.view=i.view.slice(0,W.index).concat(It(e,W.lineN,G.lineN)).concat(i.view.slice(G.index)),i.viewTo+=r):Gr(e)}var V=i.externalMeasured;V&&(n<V.lineN?V.lineN+=r:t<V.lineN+V.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 S=r.view[dn(e,t)];if(S.node==null)return;var I=S.changes||(S.changes=[]);ne(I,n)==-1&&I.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),S,I=e.display.view;if(!pr||n==e.doc.first+e.doc.size)return{index:i,lineN:n};for(var W=e.display.viewFrom,G=0;G<i;G++)W+=I[G].size;if(W!=t){if(r>0){if(i==I.length-1)return null;S=W+I[i].size-t,i++}else S=W-t;t+=S,n+=S}for(;Wr(e.doc,n)!=n;){if(i==(r<0?0:I.length-1))return null;n+=r*I[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(),S=r.selection=document.createDocumentFragment(),I=0;I<n.sel.ranges.length;I++){if(!t&&I==n.sel.primIndex)continue;var W=n.sel.ranges[I];if(W.from().line>=e.display.viewTo||W.to().line<e.display.viewFrom)continue;var G=W.empty();(G||e.options.showCursorWhenSelecting)&&bo(e,W.head,i),G||Xs(e,W,S)}return r}function bo(e,t,n){var r=br(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),i=n.appendChild(o("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 S=n.appendChild(o("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));S.style.display="",S.style.left=r.other.left+"px",S.style.top=r.other.top+"px",S.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,S=document.createDocumentFragment(),I=ro(e.display),W=I.left,G=Math.max(r.sizerWidth,sn(e)-r.sizer.offsetLeft)-I.right,V=i.direction=="ltr";function Z(We,Ze,ut,ot){Ze<0&&(Ze=0),Ze=Math.round(Ze),ot=Math.round(ot),S.appendChild(o("div",null,"CodeMirror-selected","position: absolute; left: "+We+`px;
top: `+Ze+"px; width: "+(ut==null?G-We:ut)+`px;
height: `+(ot-Ze)+"px"))}function ie(We,Ze,ut){var ot=nt(i,We),gt=ot.text.length,Rt,Vt;function _t(Bt,ir){return ga(e,Re(We,Bt),"div",ot,ir)}function dr(Bt,ir,Yt){var Ht=po(e,ot,null,Bt),jt=ir=="ltr"==(Yt=="after")?"left":"right",Ft=Yt=="after"?Ht.begin:Ht.end-(/\s/.test(ot.text.charAt(Ht.end-1))?2:1);return _t(Ft,jt)[jt]}var nr=Ye(ot,i.direction);return Qe(nr,Ze||0,ut==null?gt:ut,function(Bt,ir,Yt,Ht){var jt=Yt=="ltr",Ft=_t(Bt,jt?"left":"right"),ar=_t(ir-1,jt?"right":"left"),Gn=Ze==null&&Bt==0,Qr=ut==null&&ir==gt,Jt=Ht==0,Dr=!nr||Ht==nr.length-1;if(ar.top-Ft.top<=3){var Xt=(V?Gn:Qr)&&Jt,Xa=(V?Qr:Gn)&&Dr,Ir=Xt?W:(jt?Ft:ar).left,pn=Xa?G:(jt?ar:Ft).right;Z(Ir,Ft.top,pn-Ir,Ft.bottom)}else{var gn,er,zn,Ya;jt?(gn=V&&Gn&&Jt?W:Ft.left,er=V?G:dr(Bt,Yt,"before"),zn=V?W:dr(ir,Yt,"after"),Ya=V&&Qr&&Dr?G:ar.right):(gn=V?dr(Bt,Yt,"before"):W,er=!V&&Gn&&Jt?G:Ft.right,zn=!V&&Qr&&Dr?W:ar.left,Ya=V?dr(ir,Yt,"after"):G),Z(gn,Ft.top,er-gn,Ft.bottom),Ft.bottom<ar.top&&Z(W,Ft.bottom,null,ar.top),Z(zn,ar.top,Ya-zn,ar.bottom)}(!Rt||ji(Ft,Rt)<0)&&(Rt=Ft),ji(ar,Rt)<0&&(Rt=ar),(!Vt||ji(Ft,Vt)<0)&&(Vt=Ft),ji(ar,Vt)<0&&(Vt=ar)}),{start:Rt,end:Vt}}var me=t.from(),ce=t.to();if(me.line==ce.line)ie(me.line,me.ch,ce.ch);else{var Te=nt(i,me.line),Ae=nt(i,ce.line),Fe=$t(Te)==$t(Ae),je=ie(me.line,me.ch,Fe?Te.text.length+1:null).end,ze=ie(ce.line,Fe?0:null,ce.ch).start;Fe&&(je.top<ze.top-2?(Z(je.right,je.top,null,je.bottom),Z(W,ze.top,ze.left,ze.bottom)):Z(je.right,je.top,ze.left-je.right,je.bottom)),je.bottom<ze.top&&Z(W,je.bottom,null,ze.top)}n.appendChild(S)}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()||Mn(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,Mn(e))},100)}function wa(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(be(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(),P&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Sa(e)}function Mn(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(be(e,"blur",e,t),e.state.focused=!1,f(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],S=e.options.lineWrapping,I=void 0,W=0;if(i.hidden)continue;if(N&&_<8){var G=i.node.offsetTop+i.node.offsetHeight;I=G-n,n=G}else{var V=i.node.getBoundingClientRect();I=V.bottom-V.top,!S&&i.text.firstChild&&(W=i.text.firstChild.getBoundingClientRect().right-V.left-1)}var Z=i.line.height-I;if((Z>.005||Z<-.005)&&(fr(i.line,I),To(i.line),i.rest))for(var ie=0;ie<i.rest.length;ie++)To(i.rest[ie]);if(W>e.display.sizerWidth){var me=Math.ceil(W/Pn(e.display));me>e.display.maxLineLength&&(e.display.maxLineLength=me,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-Ni(e));var i=n&&n.bottom!=null?n.bottom:r+e.wrapper.clientHeight,S=wr(t,r),I=wr(t,i);if(n&&n.ensure){var W=n.ensure.from.line,G=n.ensure.to.line;W<S?(S=W,I=wr(t,lr(nt(t,W))+e.wrapper.clientHeight)):Math.min(G,t.lastLine())>=I&&(S=wr(t,lr(nt(t,G))-e.wrapper.clientHeight),I=G)}return{from:S,to:Math.max(I,S+1)}}function Ys(e,t){if(Oe(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&&!b){var S=o("div","\u200B",null,`position: absolute;
top: `+(t.top-n.viewOffset-Ni(e.display))+`px;
height: `+(t.bottom-t.top+Lr(e)+n.barHeight)+`px;
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(S),S.scrollIntoView(i),e.display.lineSpace.removeChild(S)}}function $s(e,t,n,r){r==null&&(r=0);var i;!e.options.lineWrapping&&t==n&&(t=t.ch?Re(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,n=t.sticky=="before"?Re(t.line,t.ch+1,"before"):t);for(var S=0;S<5;S++){var I=!1,W=br(e,t),G=!n||n==t?W:br(e,n);i={left:Math.min(W.left,G.left),top:Math.min(W.top,G.top)-r,right:Math.max(W.left,G.left),bottom:Math.max(W.bottom,G.bottom)+r};var V=Ca(e,i),Z=e.doc.scrollTop,ie=e.doc.scrollLeft;if(V.scrollTop!=null&&(ai(e,V.scrollTop),Math.abs(e.doc.scrollTop-Z)>1&&(I=!0)),V.scrollLeft!=null&&(fn(e,V.scrollLeft),Math.abs(e.doc.scrollLeft-ie)>1&&(I=!0)),!I)break}return i}function Qs(e,t){var n=Ca(e,t);n.scrollTop!=null&&ai(e,n.scrollTop),n.scrollLeft!=null&&fn(e,n.scrollLeft)}function Ca(e,t){var n=e.display,r=Rn(e.display);t.top<0&&(t.top=0);var i=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop,S=ha(e),I={};t.bottom-t.top>S&&(t.bottom=t.top+S);var W=e.doc.height+ca(n),G=t.top<r,V=t.bottom>W-r;if(t.top<i)I.scrollTop=G?0:t.top;else if(t.bottom>i+S){var Z=Math.min(t.top,(V?W:t.bottom)-S);Z!=i&&(I.scrollTop=Z)}var ie=e.options.fixedGutter?0:n.gutters.offsetWidth,me=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-ie,ce=sn(e)-n.gutters.offsetWidth,Te=t.right-t.left>ce;return Te&&(t.right=t.left+ce),t.left<10?I.scrollLeft=0:t.left<me?I.scrollLeft=Math.max(0,t.left+ie-(Te?0:10)):t.right>ce+me-3&&(I.scrollLeft=t.right+(Te?0:10)-ce),I}function La(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;L||Da(e,{top:t}),wo(e,t,!0),L&&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 fn(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,Oo(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+ca(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+Lr(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var cn=function(e,t,n){this.cm=n;var r=this.vert=o("div",[o("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=o("div",[o("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=i.tabIndex=-1,e(r),e(i),ve(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),ve(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,N&&_<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};cn.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 S=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+S)+"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}},cn.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},cn.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},cn.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 q,this.disableVert=new q},cn.prototype.enableZeroWidthBar=function(e,t,n){e.style.pointerEvents="auto";function r(){var i=e.getBoundingClientRect(),S=n=="vert"?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1);S!=e?e.style.pointerEvents="none":t.set(1e3,r)}t.set(1e3,r)},cn.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 _n(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 Lo={native:cn,null:si};function Ao(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&f(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Lo[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),ve(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"?fn(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 S=0;S<t.length;S++)nl(t[S]);for(var I=0;I<t.length;I++)il(t[I])}function el(e){var t=e.cm,n=t.display;ol(t),e.updateMaxLine&&Pr(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&&Aa(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+Lr(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&&fn(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var n=e.focus&&e.focus==R();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,n),(e.updatedDisplay||e.startHeight!=t.doc.height)&&_n(t,e.barMeasure),e.updatedDisplay&&Ra(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&&fn(t,e.scrollLeft,!0,!0),e.scrollToPos){var i=$s(t,ct(r,e.scrollToPos.from),ct(r,e.scrollToPos.to),e.scrollToPos.margin);Ys(t,i)}var S=e.maybeHiddenMarkers,I=e.maybeUnhiddenMarkers;if(S)for(var W=0;W<S.length;++W)S[W].lines.length||be(S[W],"hide");if(I)for(var G=0;G<I.length;++G)I[G].lines.length&&be(I[G],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&be(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,j(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var n=+new Date+e.options.workTime,r=Pe(e,t.highlightFrontier),i=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(S){if(r.line>=e.display.viewFrom){var I=S.styles,W=S.text.length>e.options.maxHighlightLength?mr(t.mode,r.state):null,G=Ai(e,S,r,!0);W&&(r.state=W),S.styles=G.styles;var V=S.styleClasses,Z=G.classes;Z?S.styleClasses=Z:V&&(S.styleClasses=null);for(var ie=!I||I.length!=S.styles.length||V!=Z&&(!V||!Z||V.bgClass!=Z.bgClass||V.textClass!=Z.textClass),me=0;!ie&&me<I.length;++me)ie=I[me]!=S.styles[me];ie&&i.push(r.line),S.stateAfter=r.save(),r.nextLine()}else S.text.length<=e.options.maxHighlightLength&&$n(e,S.text,r),S.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 S=0;S<i.length;S++)Kr(e,i[S],"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){ae(e,t)&&this.events.push(arguments)},Gi.prototype.finish=function(){for(var e=0;e<this.events.length;e++)be.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=Lr(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Lr(e)+"px",t.scrollbarsClipped=!0)}function sl(e){if(e.hasFocus())return null;var t=R();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==R())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 Aa(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;Ro(e)&&(Gr(e),t.dims=Ea(e));var i=r.first+r.size,S=Math.max(t.visible.from-e.options.viewportMargin,r.first),I=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFrom<S&&S-n.viewFrom<20&&(S=Math.max(r.first,n.viewFrom)),n.viewTo>I&&n.viewTo-I<20&&(I=Math.min(i,n.viewTo)),pr&&(S=Wr(e.doc,S),I=Ii(e.doc,I));var W=S!=n.viewFrom||I!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Vs(e,S,I),n.viewOffset=lr(nt(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var G=vo(e);if(!W&&G==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var V=sl(e);return G>4&&(n.lineDiv.style.display="none"),ul(e,n.updateLineNumbers,t.dims),G>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,ll(V),m(n.cursorDiv),m(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,W&&(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+ca(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(!Aa(e,t))break;Wi(e);var i=oi(e);ni(e),_n(e,i),Ra(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(Aa(e,n)){Wi(e),Do(e,n);var r=oi(e);ni(e),_n(e,r),Ra(e,r),n.finish()}}function ul(e,t,n){var r=e.display,i=e.options.lineNumbers,S=r.lineDiv,I=S.firstChild;function W(Te){var Ae=Te.nextSibling;return P&&l&&e.display.currentWheelTarget==Te?Te.style.display="none":Te.parentNode.removeChild(Te),Ae}for(var G=r.view,V=r.viewFrom,Z=0;Z<G.length;Z++){var ie=G[Z];if(!ie.hidden)if(!ie.node||ie.node.parentNode!=S){var me=Fs(e,ie,V,n);S.insertBefore(me,I)}else{for(;I!=ie.node;)I=W(I);var ce=i&&t!=null&&t<=V&&ie.lineNumber;ie.changes&&(ne(ie.changes,"gutter")>-1&&(ce=!1),Ja(e,ie,V,n)),ce&&(m(ie.lineNumber),ie.lineNumber.appendChild(document.createTextNode(yn(e.options,V)))),I=ie.node.nextSibling}V+=ie.size}for(;I;)I=W(I)}function Oa(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Ra(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+Lr(e)+"px"}function Oo(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,S=r+"px",I=0;I<n.length;I++)if(!n[I].hidden){e.options.fixedGutter&&(n[I].gutter&&(n[I].gutter.style.left=S),n[I].gutterBackground&&(n[I].gutterBackground.style.left=S));var W=n[I].alignable;if(W)for(var G=0;G<W.length;G++)W[G].style.left=S}e.options.fixedGutter&&(t.gutters.style.left=r+i+"px")}function Ro(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(o("div",[o("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),S=i.firstChild.offsetWidth,I=i.offsetWidth-S;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(S,r.lineGutter.offsetWidth-I)+1,r.lineNumWidth=r.lineNumInnerWidth+I,r.lineNumChars=r.lineNumInnerWidth?n.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",Oa(e.display),!0}return!1}function Pa(e,t){for(var n=[],r=!1,i=0;i<e.length;i++){var S=e[i],I=null;if(typeof S!="string"&&(I=S.style,S=S.className),S=="CodeMirror-linenumbers")if(t)r=!0;else continue;n.push({className:S,style:I})}return t&&!r&&n.push({className:"CodeMirror-linenumbers",style:null}),n}function Po(e){var t=e.gutters,n=e.gutterSpecs;m(t),e.lineGutter=null;for(var r=0;r<n.length;++r){var i=n[r],S=i.className,I=i.style,W=t.appendChild(o("div",null,"CodeMirror-gutter "+S));I&&(W.style.cssText=I),S=="CodeMirror-linenumbers"&&(e.lineGutter=W,W.style.width=(e.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",Oa(e)}function ui(e){Po(e.display),tr(e),Oo(e)}function dl(e,t,n,r){var i=this;this.input=n,i.scrollbarFiller=o("div",null,"CodeMirror-scrollbar-filler"),i.scrollbarFiller.setAttribute("cm-not-content","true"),i.gutterFiller=o("div",null,"CodeMirror-gutter-filler"),i.gutterFiller.setAttribute("cm-not-content","true"),i.lineDiv=x("div",null,"CodeMirror-code"),i.selectionDiv=o("div",null,null,"position: relative; z-index: 1"),i.cursorDiv=o("div",null,"CodeMirror-cursors"),i.measure=o("div",null,"CodeMirror-measure"),i.lineMeasure=o("div",null,"CodeMirror-measure"),i.lineSpace=x("div",[i.measure,i.lineMeasure,i.selectionDiv,i.cursorDiv,i.lineDiv],null,"position: relative; outline: none");var S=x("div",[i.lineSpace],"CodeMirror-lines");i.mover=o("div",[S],null,"position: relative"),i.sizer=o("div",[i.mover],"CodeMirror-sizer"),i.sizerWidth=null,i.heightForcer=o("div",null,null,"position: absolute; height: "+ue+"px; width: 1px;"),i.gutters=o("div",null,"CodeMirror-gutters"),i.lineGutter=null,i.scroller=o("div",[i.sizer,i.heightForcer,i.gutters],"CodeMirror-scroll"),i.scroller.setAttribute("tabIndex","-1"),i.wrapper=o("div",[i.scrollbarFiller,i.gutterFiller,i.scroller],"CodeMirror"),N&&_<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),!P&&!(L&&a)&&(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=Pa(r.gutters,r.lineNumbers),Po(i),n.init(i)}var zi=0,cr=null;N?cr=-.53:L?cr=15:c?cr=-.7:O&&(cr=-1/3);function Mo(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 fl(e){var t=Mo(e);return t.x*=cr,t.y*=cr,t}function ko(e,t){var n=Mo(t),r=n.x,i=n.y,S=e.display,I=S.scroller,W=I.scrollWidth>I.clientWidth,G=I.scrollHeight>I.clientHeight;if(!(r&&W||i&&G))return;if(i&&l&&P){e:for(var V=t.target,Z=S.view;V!=I;V=V.parentNode)for(var ie=0;ie<Z.length;ie++)if(Z[ie].node==V){e.display.currentWheelTarget=V;break e}}if(r&&!L&&!v&&cr!=null){i&&G&&ai(e,Math.max(0,I.scrollTop+i*cr)),fn(e,Math.max(0,I.scrollLeft+r*cr)),(!i||i&&G)&&Y(t),S.wheelStartX=null;return}if(i&&cr!=null){var me=i*cr,ce=e.doc.scrollTop,Te=ce+S.wrapper.clientHeight;me<0?ce=Math.max(0,ce+me-50):Te=Math.min(e.doc.height,Te+me+50),Da(e,{top:ce,bottom:Te})}zi<20&&(S.wheelStartX==null?(S.wheelStartX=I.scrollLeft,S.wheelStartY=I.scrollTop,S.wheelDX=r,S.wheelDY=i,setTimeout(function(){if(S.wheelStartX==null)return;var Ae=I.scrollLeft-S.wheelStartX,Fe=I.scrollTop-S.wheelStartY,je=Fe&&S.wheelDY&&Fe/S.wheelDY||Ae&&S.wheelDX&&Ae/S.wheelDX;if(S.wheelStartX=S.wheelStartY=null,!je)return;cr=(cr*zi+je)/(zi+1),++zi},200)):(S.wheelDX+=r,S.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(dt(t,r.from())>=0&&dt(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(me,ce){return dt(me.from(),ce.from())}),n=ne(t,i);for(var S=1;S<t.length;S++){var I=t[S],W=t[S-1],G=dt(W.to(),I.from());if(r&&!I.empty()?G>0:G>=0){var V=bn(W.from(),I.from()),Z=tn(W.to(),I.to()),ie=W.empty()?I.from()==I.head:W.from()==W.head;S<=n&&--n,t.splice(--S,2,new wt(ie?Z:V,ie?V:Z))}}return new hr(t,n)}function zr(e,t){return new hr([new wt(e,t||e)],0)}function Vr(e){return e.text?Re(e.from.line+e.text.length-1,ye(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function _o(e,t){if(dt(e,t.from)<0)return e;if(dt(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),Re(n,r)}function Ma(e,t){for(var n=[],r=0;r<e.sel.ranges.length;r++){var i=e.sel.ranges[r];n.push(new wt(_o(i.anchor,t),_o(i.head,t)))}return Er(e.cm,n,e.sel.primIndex)}function Io(e,t,n){return e.line==t.line?Re(n.line,e.ch-t.ch+n.ch):Re(n.line+(e.line-t.line),e.ch)}function cl(e,t,n){for(var r=[],i=Re(e.first,0),S=i,I=0;I<t.length;I++){var W=t[I],G=Io(W.from,i,S),V=Io(Vr(W),i,S);if(i=W.to,S=V,n=="around"){var Z=e.sel.ranges[I],ie=dt(Z.head,Z.anchor)<0;r[I]=new wt(ie?V:G,ie?G:V)}else r[I]=new wt(G,G)}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 Fo(e,t){return t.from.ch==0&&t.to.ch==0&&ye(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function _a(e,t,n,r){function i(ze){return n?n[ze]:null}function S(ze,We,Ze){la(ze,We,Ze,r),Dt(ze,"change",ze,t)}function I(ze,We){for(var Ze=[],ut=ze;ut<We;++ut)Ze.push(new Hr(V[ut],i(ut),r));return Ze}var W=t.from,G=t.to,V=t.text,Z=nt(e,W.line),ie=nt(e,G.line),me=ye(V),ce=i(V.length-1),Te=G.line-W.line;if(t.full)e.insert(0,I(0,V.length)),e.remove(V.length,e.size-V.length);else if(Fo(e,t)){var Ae=I(0,V.length-1);S(ie,ie.text,ce),Te&&e.remove(W.line,Te),Ae.length&&e.insert(W.line,Ae)}else if(Z==ie)if(V.length==1)S(Z,Z.text.slice(0,W.ch)+me+Z.text.slice(G.ch),ce);else{var Fe=I(1,V.length-1);Fe.push(new Hr(me+Z.text.slice(G.ch),ce,r)),S(Z,Z.text.slice(0,W.ch)+V[0],i(0)),e.insert(W.line+1,Fe)}else if(V.length==1)S(Z,Z.text.slice(0,W.ch)+V[0]+ie.text.slice(G.ch),i(0)),e.remove(W.line+1,Te);else{S(Z,Z.text.slice(0,W.ch)+V[0],i(0)),S(ie,me+ie.text.slice(G.ch),ce);var je=I(1,V.length-1);Te>1&&e.remove(W.line+1,Te-1),e.insert(W.line+1,je)}Dt(e,"change",e,t)}function Xr(e,t,n){function r(i,S,I){if(i.linked)for(var W=0;W<i.linked.length;++W){var G=i.linked[W];if(G.doc==S)continue;var V=I&&G.sharedHist;if(n&&!V)continue;t(G.doc,V),r(G.doc,i,V)}}r(e,null,!0)}function No(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,Ta(e),ka(e),Uo(e),e.options.lineWrapping||Pr(e),e.options.mode=t.modeOption,tr(e)}function Uo(e){(e.doc.direction=="rtl"?U:f)(e.display.lineDiv,"CodeMirror-rtl")}function hl(e){ur(e,function(){Uo(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=ye(e);if(t.ranges)e.pop();else break}}function ml(e,t){if(t)return Bo(e.done),ye(e.done);if(e.done.length&&!ye(e.done).ranges)return ye(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),ye(e.done)}function jo(e,t,n,r){var i=e.history;i.undone.length=0;var S=+new Date,I,W;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&i.lastModTime>S-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(I=ml(i,i.lastOp==r)))W=ye(I.changes),dt(t.from,t.to)==0&&dt(t.from,W.to)==0?W.to=Vr(t):I.changes.push(Ia(e,t));else{var G=ye(i.done);for((!G||!G.ranges)&&Xi(e.sel,i.done),I={changes:[Ia(e,t)],generation:i.generation},i.done.push(I);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=S,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,W||be(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,S=r&&r.origin;n==i.lastSelOp||S&&i.lastSelOrigin==S&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==S||pl(e,S,ye(i.done),t))?i.done[i.done.length-1]=t:Xi(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=S,i.lastSelOp=n,r&&r.clearRedo!==!1&&Bo(i.undone)}function Xi(e,t){var n=ye(t);n&&n.ranges&&n.equals(e)||t.push(e)}function Wo(e,t,n,r){var i=t["spans_"+e.id],S=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(I){I.markedSpans&&((i||(i=t["spans_"+e.id]={}))[S]=I.markedSpans),++S})}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=Rr(e,t);if(!n)return r;if(!r)return n;for(var i=0;i<n.length;++i){var S=n[i],I=r[i];if(S&&I){e:for(var W=0;W<I.length;++W){for(var G=I[W],V=0;V<S.length;++V)if(S[V].marker==G.marker)continue e;S.push(G)}}else I&&(n[i]=I)}return n}function In(e,t,n){for(var r=[],i=0;i<e.length;++i){var S=e[i];if(S.ranges){r.push(n?hr.prototype.deepCopy.call(S):S);continue}var I=S.changes,W=[];r.push({changes:W});for(var G=0;G<I.length;++G){var V=I[G],Z=void 0;if(W.push({from:V.from,to:V.to,text:V.text}),t)for(var ie in V)(Z=ie.match(/^spans_(\d+)$/))&&(ne(t,Number(Z[1]))>-1&&(ye(W)[ie]=V[ie],delete V[ie]))}}return r}function Fa(e,t,n,r){if(r){var i=e.anchor;if(n){var S=dt(t,i)<0;S!=dt(n,i)<0?(i=t,t=n):S!=dt(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([Fa(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),S=0;S<e.sel.ranges.length;S++)r[S]=Fa(e.sel.ranges[S],t[S],null,i);var I=Er(e.cm,r,e.sel.primIndex);Qt(e,I,n)}function Na(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 S=0;S<i.length;S++)this.ranges[S]=new wt(ct(e,i[S].anchor),ct(e,i[S].head))},origin:n&&n.origin};return be(e,"beforeSelectionChange",e,r),e.cm&&be(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=ye(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){(ae(e,"beforeSelectionChange")||e.cm&&ae(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,n));var r=n&&n.bias||(dt(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,le(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,S=0;S<t.ranges.length;S++){var I=t.ranges[S],W=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[S],G=Qi(e,I.anchor,W&&W.anchor,n,r),V=Qi(e,I.head,W&&W.head,n,r);(i||G!=I.anchor||V!=I.head)&&(i||(i=t.ranges.slice(0,S)),i[S]=new wt(G,V))}return i?Er(e.cm,i,t.primIndex):t}function Fn(e,t,n,r,i){var S=nt(e,t.line);if(S.markedSpans)for(var I=0;I<S.markedSpans.length;++I){var W=S.markedSpans[I],G=W.marker,V="selectLeft"in G?!G.selectLeft:G.inclusiveLeft,Z="selectRight"in G?!G.selectRight:G.inclusiveRight;if((W.from==null||(V?W.from<=t.ch:W.from<t.ch))&&(W.to==null||(Z?W.to>=t.ch:W.to>t.ch))){if(i&&(be(G,"beforeCursorEnter"),G.explicitlyCleared))if(S.markedSpans){--I;continue}else break;if(!G.atomic)continue;if(n){var ie=G.find(r<0?1:-1),me=void 0;if((r<0?Z:V)&&(ie=$o(e,ie,-r,ie&&ie.line==t.line?S:null)),ie&&ie.line==t.line&&(me=dt(ie,n))&&(r<0?me<0:me>0))return Fn(e,ie,t,r,i)}var ce=G.find(r<0?-1:1);return(r<0?V:Z)&&(ce=$o(e,ce,r,ce.line==t.line?S:null)),ce?Fn(e,ce,t,r,i):null}}return t}function Qi(e,t,n,r,i){var S=r||1,I=Fn(e,t,n,S,i)||!i&&Fn(e,t,n,S,!0)||Fn(e,t,n,-S,i)||!i&&Fn(e,t,n,-S,!0);return I||(e.cantEdit=!0,Re(e.first,0))}function $o(e,t,n,r){return n<0&&t.ch==0?t.line>e.first?ct(e,Re(t.line-1)):null:n>0&&t.ch==(r||nt(e,t.line)).text.length?t.line<e.first+e.size-1?Re(t.line+1,0):null:new Re(t.line,t.ch+n)}function Qo(e){e.setSelection(Re(e.firstLine(),0),Re(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,S,I,W){i&&(r.from=ct(e,i)),S&&(r.to=ct(e,S)),I&&(r.text=I),W!==void 0&&(r.origin=W)}),be(e,"beforeChange",e,r),e.cm&&be(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 Nn(e,t,n){if(e.cm){if(!e.cm.curOp)return Gt(e.cm,Nn)(e,t,n);if(e.cm.state.suppressEdits)return}if((ae(e,"beforeChange")||e.cm&&ae(e.cm,"beforeChange"))&&(t=Jo(e,t,!0),!t))return;var r=Pi&&!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]==""&&dt(t.from,t.to)==0)return;var n=Ma(e,t);jo(e,t,n,e.cm?e.cm.curOp.id:NaN),fi(e,t,n,Rr(e,t));var r=[];Xr(e,function(i,S){!S&&ne(r,i.history)==-1&&(rs(i.history,t),r.push(i.history)),fi(i,t,null,Rr(i,t))})}function Ji(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(r&&!n)return;for(var i=e.history,S,I=e.sel,W=t=="undo"?i.done:i.undone,G=t=="undo"?i.undone:i.done,V=0;V<W.length&&!(S=W[V],n?S.ranges&&!S.equals(e.sel):!S.ranges);V++);if(V==W.length)return;for(i.lastOrigin=i.lastSelOrigin=null;;)if(S=W.pop(),S.ranges){if(Xi(S,G),n&&!S.equals(e.sel)){Qt(e,S,{clearRedo:!1});return}I=S}else if(r){W.push(S);return}else break;var Z=[];Xi(I,G),G.push({changes:Z,generation:i.generation}),i.generation=S.generation||++i.maxGeneration;for(var ie=ae(e,"beforeChange")||e.cm&&ae(e.cm,"beforeChange"),me=function(Ae){var Fe=S.changes[Ae];if(Fe.origin=t,ie&&!Jo(e,Fe,!1))return W.length=0,{};Z.push(Ia(e,Fe));var je=Ae?Ma(e,Fe):ye(W);fi(e,Fe,je,Ho(e,Fe)),!Ae&&e.cm&&e.cm.scrollIntoView({from:Fe.from,to:Vr(Fe)});var ze=[];Xr(e,function(We,Ze){!Ze&&ne(ze,We.history)==-1&&(rs(We.history,Fe),ze.push(We.history)),fi(We,Fe,null,Ho(We,Fe))})},ce=S.changes.length-1;ce>=0;--ce){var Te=me(ce);if(Te)return Te.v}}function qo(e,t){if(t==0)return;if(e.first+=t,e.sel=new hr(Me(e.sel.ranges,function(i){return new wt(Re(i.anchor.line+t,i.anchor.ch),Re(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 fi(e,t,n,r){if(e.cm&&!e.cm.curOp)return Gt(e.cm,fi)(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:Re(e.first,0),to:Re(t.to.line+i,t.to.ch),text:[ye(t.text)],origin:t.origin}}var S=e.lastLine();t.to.line>S&&(t={from:t.from,to:Re(S,nt(e,S).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Sr(e,t.from,t.to),n||(n=Ma(e,t)),e.cm?El(e.cm,t,r):_a(e,t,r),$i(e,n,pe),e.cantEdit&&Qi(e,Re(e.firstLine(),0))&&(e.cantEdit=!1)}function El(e,t,n){var r=e.doc,i=e.display,S=t.from,I=t.to,W=!1,G=S.line;e.options.lineWrapping||(G=St($t(nt(r,S.line))),r.iter(G,I.line+1,function(ce){if(ce==i.maxLine)return W=!0,!0})),r.sel.contains(t.from,t.to)>-1&&le(e),_a(r,t,n,go(e)),e.options.lineWrapping||(r.iter(G,S.line+t.text.length,function(ce){var Te=Dn(ce);Te>i.maxLineLength&&(i.maxLine=ce,i.maxLineLength=Te,i.maxLineChanged=!0,W=!1)}),W&&(e.curOp.updateMaxLine=!0)),Ri(r,S.line),li(e,400);var V=t.text.length-(I.line-S.line)-1;t.full?tr(e):S.line==I.line&&t.text.length==1&&!Fo(e.doc,t)?Kr(e,S.line,"text"):tr(e,S.line,I.line+1,V);var Z=ae(e,"changes"),ie=ae(e,"change");if(ie||Z){var me={from:S,to:I,text:t.text,removed:t.removed,origin:t.origin};ie&&Dt(e,"change",e,me),Z&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(me)}e.display.selForContextMenu=null}function Un(e,t,n,r,i){var S;r||(r=n),dt(r,n)<0&&(S=[r,n],n=S[0],r=S[1]),typeof t=="string"&&(t=e.splitLines(t)),Nn(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 S=e[i],I=!0;if(S.ranges){S.copied||(S=e[i]=S.deepCopy(),S.copied=!0);for(var W=0;W<S.ranges.length;W++)es(S.ranges[W].anchor,t,n,r),es(S.ranges[W].head,t,n,r);continue}for(var G=0;G<S.changes.length;++G){var V=S.changes[G];if(n<V.from.line)V.from=Re(V.from.line+r,V.from.ch),V.to=Re(V.to.line+r,V.to.ch);else if(t<=V.to.line){I=!1;break}}I||(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 ci(e,t,n,r){var i=t,S=t;return typeof t=="number"?S=nt(e,Xn(e,t)):i=St(t),i==null?null:(r(S,i)&&e.cm&&Kr(e.cm,i,n),S)}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 S=Math.min(t,i-e),I=r.height;if(r.removeInner(e,S),this.height-=I-r.height,i==S&&(this.children.splice(n--,1),r.parent=null),(t-=S)==0)break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof hi))){var W=[];this.collapse(W),this.children=[new hi(W)],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],S=i.chunkSize();if(e<=S){if(i.insertInner(e,t,n),i.lines&&i.lines.length>50){for(var I=i.lines.length%25+25,W=I;W<i.lines.length;){var G=new hi(i.lines.slice(W,W+=25));i.height-=G.height,this.children.splice(++r,0,G),G.parent=this}i.lines=i.lines.slice(0,I),this.maybeSpill()}break}e-=S}},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=ne(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],S=i.chunkSize();if(e<S){var I=Math.min(t,S-e);if(i.iterN(e,I,n))return!0;if((t-=I)==0)break;e=0}else e-=S}}};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 S=ti(this);fr(n,Math.max(0,n.height-S)),e&&(ur(e,function(){ns(e,n,-S),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)||fr(r,r.height+i),n&&ur(n,function(){n.curOp.forceUpdate=!0,ns(n,r,i),Dt(n,"lineWidgetChanged",n,e,St(r))})},oe(pi);function ns(e,t,n){lr(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&La(e,n)}function xl(e,t,n,r){var i=new pi(e,n,r),S=e.cm;return S&&i.noHScroll&&(S.display.alignWidgets=!0),ci(e,t,"widget",function(I){var W=I.widgets||(I.widgets=[]);if(i.insertAt==null?W.push(i):W.splice(Math.min(W.length-1,Math.max(0,i.insertAt)),0,i),i.line=I,S&&!yr(e,I)){var G=lr(I)<e.scrollTop;fr(I,I.height+ti(i)),G&&La(S,i.height),S.curOp.forceUpdate=!0}return!0}),S&&Dt(S,"lineWidgetAdded",S,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),ae(this,"clear")){var n=this.find();n&&Dt(this,"clear",n.from,n.to)}for(var r=null,i=null,S=0;S<this.lines.length;++S){var I=this.lines[S],W=Nr(I.markedSpans,this);e&&!this.collapsed?Kr(e,St(I),"text"):e&&(W.to!=null&&(i=St(I)),W.from!=null&&(r=St(I))),I.markedSpans=Ur(I.markedSpans,W),W.from==null&&this.collapsed&&!yr(this.doc,I)&&e&&fr(I,Rn(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var G=0;G<this.lines.length;++G){var V=$t(this.lines[G]),Z=Dn(V);Z>e.display.maxLineLength&&(e.display.maxLine=V,e.display.maxLineLength=Z,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 S=this.lines[i],I=Nr(S.markedSpans,this);if(I.from!=null&&(n=Re(t?S:St(S),I.from),e==-1))return n;if(I.to!=null&&(r=Re(t?S:St(S),I.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,S=St(t.line),I=ma(r,S);if(I&&(so(I),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!yr(n.doc,i)&&n.height!=null){var W=n.height;n.height=null;var G=ti(n)-W;G&&fr(i,i.height+G)}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||ne(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Yr.prototype.detachLine=function(e){if(this.lines.splice(ne(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},oe(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 S=new Yr(e,i),I=dt(t,n);if(r&&F(r,S,!1),I>0||I==0&&S.clearWhenEmpty!==!1)return S;if(S.replacedWith&&(S.collapsed=!0,S.widgetNode=x("span",[S.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||S.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(S.widgetNode.insertLeft=!0)),S.collapsed){if(qn(e,t.line,t,n,S)||t.line!=n.line&&qn(e,n.line,t,n,S))throw new Error("Inserting collapsed marker partially overlapping an existing one");Mi()}S.addToHistory&&jo(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var W=t.line,G=e.cm,V;if(e.iter(W,n.line+1,function(ie){G&&S.collapsed&&!G.options.lineWrapping&&$t(ie)==G.display.maxLine&&(V=!0),S.collapsed&&W!=t.line&&fr(ie,0),Br(ie,new xn(S,W==t.line?t.ch:null,W==n.line?n.ch:null)),++W}),S.collapsed&&e.iter(t.line,n.line+1,function(ie){yr(e,ie)&&fr(ie,0)}),S.clearOnEnter&&ve(S,"beforeCursorEnter",function(){return S.clear()}),S.readOnly&&(Cr(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),S.collapsed&&(S.id=++is,S.atomic=!0),G){if(V&&(G.curOp.updateMaxLine=!0),S.collapsed)tr(G,t.line,n.line+1);else if(S.className||S.startStyle||S.endStyle||S.css||S.attributes||S.title)for(var Z=t.line;Z<=n.line;Z++)Kr(G,Z,"text");S.atomic&&Xo(G.doc),Dt(G,"markerAdded",G,S)}return S}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)},oe(gi);function Tl(e,t,n,r,i){r=F(r),r.shared=!1;var S=[Bn(e,t,n,r,i)],I=S[0],W=r.widgetNode;return Xr(e,function(G){W&&(r.widgetNode=W.cloneNode(!0)),S.push(Bn(G,ct(G,t),ct(G,n),r,i));for(var V=0;V<G.linked.length;++V)if(G.linked[V].isParent)return;I=ye(S)}),new gi(S,I)}function as(e){return e.findMarks(Re(e.first,0),e.clipPos(Re(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(),S=e.clipPos(i.from),I=e.clipPos(i.to);if(dt(S,I)){var W=Bn(e,S,I,r.primary,r.primary.type);r.markers.push(W),W.parent=r}}}function wl(e){for(var t=function(r){var i=e[r],S=[i.primary.doc];Xr(i.primary.doc,function(G){return S.push(G)});for(var I=0;I<i.markers.length;I++){var W=i.markers[I];ne(S,W.doc)==-1&&(W.parent=null,i.markers.splice(I--,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 S=Re(n,0);this.sel=zr(S),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)),_a(this,{from:S,to:S,text:e}),Qt(this,zr(S),pe)};rr.prototype=$e(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=Re(this.first,0),n=this.first+this.size-1;Nn(this,{from:t,to:Re(n,nt(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=ct(this,t),n=n?ct(this,n):t,Un(this,e,t,n,r)},getRange:function(e,t,n){var r=Sr(this,ct(this,e),ct(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 nt(this,e)},getLineNumber:function(e){return St(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=nt(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 ct(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,ct(this,typeof e=="number"?Re(e,t||0):e),null,n)}),setSelection:zt(function(e,t,n){Go(this,ct(this,e),ct(this,t||e),n)}),extendSelection:zt(function(e,t,n){Yi(this,ct(this,e),t&&ct(this,t),n)}),extendSelections:zt(function(e,t){Ko(this,Li(this,e),t)}),extendSelectionsBy:zt(function(e,t){var n=Me(this.sel.ranges,e);Ko(this,Li(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(ct(this,e[i].anchor),ct(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(ct(this,e),ct(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,S=0;S<i.ranges.length;S++){var I=i.ranges[S];r[S]={from:I.from(),to:I.to(),text:this.splitLines(e[S]),origin:n}}for(var W=t&&t!="end"&&cl(this,r,t),G=r.length-1;G>=0;G--)Nn(this,r[G]);W?zo(this,W):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 ci(this,e,"gutter",function(r){var i=r.gutterMarkers||(r.gutterMarkers={});return i[t]=n,!n&&Be(i)&&(r.gutterMarkers=null),!0})}),clearGutter:zt(function(e){var t=this;this.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&ci(t,n,"gutter",function(){return n.gutterMarkers[e]=null,Be(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=nt(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 ci(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 ci(this,e,t=="gutter"?"gutter":"class",function(r){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",S=r[i];if(S)if(n==null)r[i]=null;else{var I=S.match(T(n));if(!I)return!1;var W=I.index+I[0].length;r[i]=S.slice(0,I.index)+(!I.index||W==S.length?"":" ")+S.slice(W)||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,ct(this,e),ct(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=ct(this,e),Bn(this,e,e,n,"bookmark")},findMarksAt:function(e){e=ct(this,e);var t=[],n=nt(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=ct(this,e),t=ct(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,function(S){var I=S.markedSpans;if(I)for(var W=0;W<I.length;W++){var G=I[W];!(G.to!=null&&i==e.line&&e.ch>=G.to||G.from==null&&i!=e.line||G.from!=null&&i==t.line&&G.from>=t.ch)&&(!n||n(G.marker))&&r.push(G.marker.parent||G.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 S=i.text.length+r;if(S>e)return t=e,!0;e-=S,++n}),ct(this,Re(n,t))},indexFromPos:function(e){e=ct(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 Mt&&(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):it(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 Ll(e){var t=this;if(ss(t),Oe(t,e)||kr(t.display,e))return;Y(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,S=Array(i),I=0,W=function(){++I==i&&Gt(t,function(){n=ct(t.doc,n);var ce={from:n,to:n,text:t.doc.splitLines(S.filter(function(Te){return Te!=null}).join(t.doc.lineSeparator())),origin:"paste"};Nn(t.doc,ce),zo(t.doc,zr(ct(t.doc,n),ct(t.doc,Vr(ce))))})()},G=function(ce,Te){if(t.options.allowDropFileTypes&&ne(t.options.allowDropFileTypes,ce.type)==-1){W();return}var Ae=new FileReader;Ae.onerror=function(){return W()},Ae.onload=function(){var Fe=Ae.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(Fe)){W();return}S[Te]=Fe,W()},Ae.readAsText(ce)},V=0;V<r.length;V++)G(r[V],V);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 Z=e.dataTransfer.getData("Text");if(Z){var ie;if(t.state.draggingText&&!t.state.draggingText.copy&&(ie=t.listSelections()),$i(t.doc,zr(n,n)),ie)for(var me=0;me<ie.length;++me)Un(t.doc,"",ie[me].anchor,ie[me].head,"drag");t.replaceSelection(Z,"around","paste"),t.display.input.focus()}}catch(ce){}}}function Al(e,t){if(N&&(!e.state.draggingText||+new Date-os<100)){re(t);return}if(Oe(e,t)||kr(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!O){var n=o("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",v&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),v&&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=o("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),d(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 S=0;S<n.length;S++)e(n[S])})}var us=!1;function Ol(){if(us)return;Rl(),us=!0}function Rl(){var e;ve(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,ls(Pl)},100))}),ve(window,"blur",function(){return ls(Mn)})}function Pl(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 _r={};_r.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"},_r.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"},_r.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"},_r.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"]},_r.default=l?_r.macDefault:_r.pcDefault;function Ml(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var n,r,i,S,I=0;I<t.length-1;I++){var W=t[I];if(/^(cmd|meta|m)$/i.test(W))S=!0;else if(/^a(lt)?$/i.test(W))n=!0;else if(/^(c|ctrl|control)$/i.test(W))r=!0;else if(/^s(hift)?$/i.test(W))i=!0;else throw new Error("Unrecognized modifier name: "+W)}return n&&(e="Alt-"+e),r&&(e="Ctrl-"+e),S&&(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=Me(n.split(" "),Ml),S=0;S<i.length;S++){var I=void 0,W=void 0;S==i.length-1?(W=i.join(" "),I=r):(W=i.slice(0,S+1).join(" "),I="...");var G=t[W];if(!G)t[W]=I;else if(G!=I)throw new Error("Inconsistent bindings for "+W)}delete e[n]}for(var V in t)e[V]=t[V];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 S=0;S<t.fallthrough.length;S++){var I=jn(e,t.fallthrough[S],n,r);if(I)return I}}}function ds(e){var t=typeof e=="string"?e:$r[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function fs(e,t,n){var r=e;return t.altKey&&r!="Alt"&&(e="Alt-"+e),(h?t.metaKey:t.ctrlKey)&&r!="Ctrl"&&(e="Ctrl-"+e),(h?t.ctrlKey:t.metaKey)&&r!="Mod"&&(e="Cmd-"+e),!n&&t.shiftKey&&r!="Shift"&&(e="Shift-"+e),e}function cs(e,t){if(v&&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),fs(n,e,t))}function qi(e){return typeof e=="string"?_r[e]:e}function Wn(e,t){for(var n=e.doc.sel.ranges,r=[],i=0;i<n.length;i++){for(var S=t(n[i]);r.length&&dt(S.from,ye(r).to)<=0;){var I=r.pop();if(dt(I.from,S.from)<0){S.from=I.from;break}}r.push(S)}ur(e,function(){for(var W=r.length-1;W>=0;W--)Un(e.doc,"",r[W].from,r[W].to,"+delete");kn(e)})}function Ua(e,t,n){var r=Ce(e.text,t+n,n);return r<0||r>e.text.length?null:r}function Ba(e,t,n){var r=Ua(e,t.ch,n);return r==null?null:new Re(t.line,r,n<0?"after":"before")}function ja(e,t,n,r,i){if(e){t.doc.direction=="rtl"&&(i=-i);var S=Ye(n,t.doc.direction);if(S){var I=i<0?ye(S):S[0],W=i<0==(I.level==1),G=W?"after":"before",V;if(I.level>0||t.doc.direction=="rtl"){var Z=On(t,n);V=i<0?n.text.length-1:0;var ie=Ar(t,Z,V).top;V=Ke(function(me){return Ar(t,Z,me).top==ie},i<0==(I.level==1)?I.from:I.to-1,V),G=="before"&&(V=Ua(n,V,1))}else V=i<0?I.to:I.from;return new Re(r,V,G)}}return new Re(r,i<0?n.text.length:0,i<0?"before":"after")}function _l(e,t,n,r){var i=Ye(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 S=Ue(i,n.ch,n.sticky),I=i[S];if(e.doc.direction=="ltr"&&I.level%2==0&&(r>0?I.to>n.ch:I.from<n.ch))return Ba(t,n,r);var W=function(je,ze){return Ua(t,je instanceof Re?je.ch:je,ze)},G,V=function(je){return e.options.lineWrapping?(G=G||On(e,t),po(e,t,G,je)):{begin:0,end:t.text.length}},Z=V(n.sticky=="before"?W(n,-1):n.ch);if(e.doc.direction=="rtl"||I.level==1){var ie=I.level==1==r<0,me=W(n,ie?1:-1);if(me!=null&&(ie?me<=I.to&&me<=Z.end:me>=I.from&&me>=Z.begin)){var ce=ie?"before":"after";return new Re(n.line,me,ce)}}var Te=function(je,ze,We){for(var Ze=function(Rt,Vt){return Vt?new Re(n.line,W(Rt,1),"before"):new Re(n.line,Rt,"after")};je>=0&&je<i.length;je+=ze){var ut=i[je],ot=ze>0==(ut.level!=1),gt=ot?We.begin:W(We.end,-1);if(ut.from<=gt&&gt<ut.to)return Ze(gt,ot);if(gt=ot?ut.from:W(ut.to,-1),We.begin<=gt&&gt<We.end)return Ze(gt,ot)}},Ae=Te(S+r,r,Z);if(Ae)return Ae;var Fe=r>0?Z.end:W(Z.begin,-1);return Fe!=null&&!(r>0&&Fe==t.text.length)&&(Ae=Te(r>0?0:i.length-1,r,V(Fe)),Ae)?Ae: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=nt(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line<e.lastLine()?{from:t.head,to:Re(t.head.line+1,0)}:{from:t.head,to:Re(t.head.line,n)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return Wn(e,function(t){return{from:Re(t.from().line,0),to:ct(e.doc,Re(t.to().line+1,0))}})},delLineLeft:function(e){return Wn(e,function(t){return{from:Re(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(Re(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(Re(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")},de)},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")},de)},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},de)},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 S=n[i].from(),I=X(e.getLine(S.line),S.ch,r);t.push(se(r-I%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,S=nt(e.doc,i.line).text;if(S){if(i.ch==S.length&&(i=new Re(i.line,i.ch-1)),i.ch>0)i=new Re(i.line,i.ch+1),e.replaceRange(S.charAt(i.ch-1)+S.charAt(i.ch-2),Re(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var I=nt(e.doc,i.line-1).text;I&&(i=new Re(i.line,1),e.replaceRange(S.charAt(0)+e.doc.lineSeparator()+I.charAt(I.length-1),Re(i.line-1,I.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=nt(e.doc,t),r=$t(n);return r!=n&&(t=St(r)),ja(!0,e,r,t,1)}function Il(e,t){var n=nt(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=nt(e.doc,n.line),i=Ye(r,e.doc.direction);if(!i||i[0].level==0){var S=Math.max(n.ch,r.text.search(/\S/)),I=t.line==n.line&&t.ch<=S&&t.ch;return Re(n.line,I?0:S,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)!=xe}finally{e.display.shift=r,e.state.suppressEdits=!1}return i}function Fl(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 Nl=new q;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:Nl.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=Fl(e,t,r);return i=="multi"&&(e.state.keySeq=t),i=="handled"&&Dt(e,"keyHandled",e,t,n),(i=="handled"||i=="multi")&&(Y(n),Sa(e)),!!i}function gs(e,t){var n=cs(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 Ul(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=R(),Oe(t,e))return;N&&_<11&&e.keyCode==27&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=n==16||e.shiftKey;var r=gs(t,e);v&&(Wa=r?n:null,!r&&n==88&&!xt&&(l?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),L&&!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)&&(f(t,"CodeMirror-crosshair"),Ge(document,"keyup",n),Ge(document,"mouseover",n))}ve(document,"keyup",n),ve(document,"mouseover",n)}function ys(e){e.keyCode==16&&(this.doc.sel.shift=!1),Oe(this,e)}function bs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(kr(t.display,e)||Oe(t,e)||e.ctrlKey&&!e.altKey||l&&e.metaKey)return;var n=e.keyCode,r=e.charCode;if(v&&n==Wa){Wa=null,Y(e);return}if(v&&(!e.which||e.which<10)&&gs(t,e))return;var i=String.fromCharCode(r==null?n:r);if(i=="\b")return;if(Ul(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&&dt(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(Oe(t,e)||n.activeTouch&&n.input.supportsTouch())return;if(n.input.ensurePolled(),n.shift=e.shiftKey,kr(n,e)){P||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(Ka(t,e))return;var r=un(t,e),i=Ee(e),S=r?Wl(r,i):"single";if(window.focus(),i==1&&t.state.selectingText&&t.state.selectingText(e),r&&Hl(t,i,r,S,e))return;i==1?r?Gl(t,r,S,e):ge(e)==n.scroller&&Y(e):i==2?(r&&Yi(t.doc,r),setTimeout(function(){return n.input.focus()},20)):i==3&&(A?t.display.input.onContextMenu(e):xo(t))}function Hl(e,t,n,r,i){var S="Click";return r=="double"?S="Double"+S:r=="triple"&&(S="Triple"+S),S=(t==1?"Left":t==2?"Middle":"Right")+S,Ei(e,fs(S,i),i,function(I){if(typeof I=="string"&&(I=bi[I]),!I)return!1;var W=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),W=I(e,n)!=xe}finally{e.state.suppressEdits=!1}return W})}function Kl(e,t,n){var r=e.getOption("configureMouse"),i=r?r(e,t,n):{};if(i.unit==null){var S=u?n.shiftKey&&n.metaKey:n.altKey;i.unit=S?"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(j(Eo,e),0):e.curOp.focus=R();var i=Kl(e,n,r),S=e.doc.sel,I;e.options.dragDrop&&Ie&&!e.isReadOnly()&&n=="single"&&(I=S.contains(t))>-1&&(dt((I=S.ranges[I]).from(),t)<0||t.xRel>0)&&(dt(I.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,S=!1,I=Gt(e,function(V){P&&(i.scroller.draggable=!1),e.state.draggingText=!1,Ge(i.wrapper.ownerDocument,"mouseup",I),Ge(i.wrapper.ownerDocument,"mousemove",W),Ge(i.scroller,"dragstart",G),Ge(i.scroller,"drop",I),S||(Y(V),r.addNew||Yi(e.doc,n,null,null,r.extend),P&&!O||N&&_==9?setTimeout(function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()},20):i.input.focus())}),W=function(V){S=S||Math.abs(t.clientX-V.clientX)+Math.abs(t.clientY-V.clientY)>=10},G=function(){return S=!0};P&&(i.scroller.draggable=!0),e.state.draggingText=I,I.copy=!r.moveOnDrag,i.scroller.dragDrop&&i.scroller.dragDrop(),ve(i.wrapper.ownerDocument,"mouseup",I),ve(i.wrapper.ownerDocument,"mousemove",W),ve(i.scroller,"dragstart",G),ve(i.scroller,"drop",I),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(Re(t.line,0),ct(e.doc,Re(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,S=e.doc;Y(t);var I,W,G=S.sel,V=G.ranges;if(r.addNew&&!r.extend?(W=S.sel.contains(n),W>-1?I=V[W]:I=new wt(n,n)):(I=S.sel.primary(),W=S.sel.primIndex),r.unit=="rectangle")r.addNew||(I=new wt(n,n)),n=un(e,t,!0,!0),W=-1;else{var Z=xs(e,n,r.unit);r.extend?I=Fa(I,Z.anchor,Z.head,r.extend):I=Z}r.addNew?W==-1?(W=V.length,Qt(S,Er(e,V.concat([I]),W),{scroll:!1,origin:"*mouse"})):V.length>1&&V[W].empty()&&r.unit=="char"&&!r.extend?(Qt(S,Er(e,V.slice(0,W).concat(V.slice(W+1)),0),{scroll:!1,origin:"*mouse"}),G=S.sel):Na(S,W,I,he):(W=0,Qt(S,new hr([I],0),he),G=S.sel);var ie=n;function me(We){if(dt(ie,We)==0)return;if(ie=We,r.unit=="rectangle"){for(var Ze=[],ut=e.options.tabSize,ot=X(nt(S,n.line).text,n.ch,ut),gt=X(nt(S,We.line).text,We.ch,ut),Rt=Math.min(ot,gt),Vt=Math.max(ot,gt),_t=Math.min(n.line,We.line),dr=Math.min(e.lastLine(),Math.max(n.line,We.line));_t<=dr;_t++){var nr=nt(S,_t).text,Bt=fe(nr,Rt,ut);Rt==Vt?Ze.push(new wt(Re(_t,Bt),Re(_t,Bt))):nr.length>Bt&&Ze.push(new wt(Re(_t,Bt),Re(_t,fe(nr,Vt,ut))))}Ze.length||Ze.push(new wt(n,n)),Qt(S,Er(e,G.ranges.slice(0,W).concat(Ze),W),{origin:"*mouse",scroll:!1}),e.scrollIntoView(We)}else{var ir=I,Yt=xs(e,We,r.unit),Ht=ir.anchor,jt;dt(Yt.anchor,Ht)>0?(jt=Yt.head,Ht=bn(ir.from(),Yt.anchor)):(jt=Yt.anchor,Ht=tn(ir.to(),Yt.head));var Ft=G.ranges.slice(0);Ft[W]=Xl(e,new wt(ct(S,Ht),jt)),Qt(S,Er(e,Ft,W),he)}}var ce=i.wrapper.getBoundingClientRect(),Te=0;function Ae(We){var Ze=++Te,ut=un(e,We,!0,r.unit=="rectangle");if(!ut)return;if(dt(ut,ie)!=0){e.curOp.focus=R(),me(ut);var ot=Hi(i,S);(ut.line>=ot.to||ut.line<ot.from)&&setTimeout(Gt(e,function(){Te==Ze&&Ae(We)}),150)}else{var gt=We.clientY<ce.top?-20:We.clientY>ce.bottom?20:0;gt&&setTimeout(Gt(e,function(){if(Te!=Ze)return;i.scroller.scrollTop+=gt,Ae(We)}),50)}}function Fe(We){e.state.selectingText=!1,Te=Infinity,We&&(Y(We),i.input.focus()),Ge(i.wrapper.ownerDocument,"mousemove",je),Ge(i.wrapper.ownerDocument,"mouseup",ze),S.history.lastSelOrigin=null}var je=Gt(e,function(We){We.buttons===0||!Ee(We)?Fe(We):Ae(We)}),ze=Gt(e,Fe);e.state.selectingText=ze,ve(i.wrapper.ownerDocument,"mousemove",je),ve(i.wrapper.ownerDocument,"mouseup",ze)}function Xl(e,t){var n=t.anchor,r=t.head,i=nt(e.doc,n.line);if(dt(n,r)==0&&n.sticky==r.sticky)return t;var S=Ye(i);if(!S)return t;var I=Ue(S,n.ch,n.sticky),W=S[I];if(W.from!=n.ch&&W.to!=n.ch)return t;var G=I+(W.from==n.ch==(W.level!=1)?0:1);if(G==0||G==S.length)return t;var V;if(r.line!=n.line)V=(r.line-n.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var Z=Ue(S,r.ch,r.sticky),ie=Z-I||(r.ch-n.ch)*(W.level==1?-1:1);Z==G-1||Z==G?V=ie<0:V=ie>0}var me=S[G+(V?-1:0)],ce=V==(me.level==1),Te=ce?me.from:me.to,Ae=ce?"after":"before";return n.ch==Te&&n.sticky==Ae?t:new wt(new Re(n.line,Te,Ae),r)}function Ts(e,t,n,r){var i,S;if(t.touches)i=t.touches[0].clientX,S=t.touches[0].clientY;else try{i=t.clientX,S=t.clientY}catch(me){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&Y(t);var I=e.display,W=I.lineDiv.getBoundingClientRect();if(S>W.bottom||!ae(e,n))return J(t);S-=W.top-I.viewOffset;for(var G=0;G<e.display.gutterSpecs.length;++G){var V=I.gutters.childNodes[G];if(V&&V.getBoundingClientRect().right>=i){var Z=wr(e.doc,S),ie=e.display.gutterSpecs[G];return be(e,n,e,Z,ie.className,t),J(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(Oe(e,t,"contextmenu"))return;A||e.display.input.onContextMenu(t)}function Yl(e,t){return ae(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,S,I){e.defaults[r]=i,S&&(t[r]=I?function(W,G,V){V!=Hn&&S(W,G,V)}:S)}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 S=[],I=r.doc.first;r.doc.iter(function(G){for(var V=0;;){var Z=G.text.indexOf(i,V);if(Z==-1)break;V=Z+i.length,S.push(Re(I,Z))}I++});for(var W=S.length-1;W>=0;W--)Un(r.doc,i,S[W],Re(S[W].line,S[W].ch+i.length))}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(r,i,S){r.state.specialChars=new RegExp(i.source+(i.test(" ")?"":"| "),"g"),S!=Hn&&r.refresh()}),n("specialCharPlaceholder",rt,function(r){return r.refresh()},!0),n("electricChars",!0),n("inputStyle",a?"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",!C),n("wholeLineUpdateBefore",!0),n("theme","default",function(r){ws(r),ui(r)},!0),n("keyMap","default",function(r,i,S){var I=qi(i),W=S!=Hn&&qi(S);W&&W.detach&&W.detach(r,I),I.attach&&I.attach(r,W||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Jl,!0),n("gutters",[],function(r,i){r.display.gutterSpecs=Pa(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 _n(r)},!0),n("scrollbarStyle","native",function(r){Ao(r),_n(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=Pa(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"&&(Mn(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,S=t?ve:Ge;S(e.display.scroller,"dragstart",i.start),S(e.display.scroller,"dragenter",i.enter),S(e.display.scroller,"dragover",i.over),S(e.display.scroller,"dragleave",i.leave),S(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):(f(e.display.wrapper,"CodeMirror-wrap"),Pr(e)),Ta(e),tr(e),ri(e),setTimeout(function(){return _n(e)},100)}function Mt(e,t){var n=this;if(!(this instanceof Mt))return new Mt(e,t);this.options=t=t?F(t):{},F(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 Mt.inputStyles[t.inputStyle](this),S=this.display=new dl(e,r,i,t);S.wrapper.CodeMirror=this,ws(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Ao(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 q,keySeq:null,specialChars:null},t.autofocus&&!a&&S.input.focus(),N&&_<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Zl(this),Ol(),hn(this),this.curOp.forceUpdate=!0,No(this,r),t.autofocus&&!a||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&wa(n)},20):Mn(this);for(var I in ta)ta.hasOwnProperty(I)&&ta[I](this,t[I],Hn);Ro(this),t.finishInit&&t.finishInit(this);for(var W=0;W<Ga.length;++W)Ga[W](this);mn(this),P&&t.lineWrapping&&getComputedStyle(S.lineDiv).textRendering=="optimizelegibility"&&(S.lineDiv.style.textRendering="auto")}Mt.defaults=Cs,Mt.optionHandlers=ta;function Zl(e){var t=e.display;ve(t.scroller,"mousedown",Gt(e,Es)),N&&_<11?ve(t.scroller,"dblclick",Gt(e,function(G){if(Oe(e,G))return;var V=un(e,G);if(!V||Ka(e,G)||kr(e.display,G))return;Y(G);var Z=e.findWordAt(V);Yi(e.doc,Z.anchor,Z.head)})):ve(t.scroller,"dblclick",function(G){return Oe(e,G)||Y(G)}),ve(t.scroller,"contextmenu",function(G){return Ss(e,G)}),ve(t.input.getField(),"contextmenu",function(G){t.scroller.contains(G.target)||Ss(e,G)});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 S(G){if(G.touches.length!=1)return!1;var V=G.touches[0];return V.radiusX<=1&&V.radiusY<=1}function I(G,V){if(V.left==null)return!0;var Z=V.left-G.left,ie=V.top-G.top;return Z*Z+ie*ie>20*20}ve(t.scroller,"touchstart",function(G){if(!Oe(e,G)&&!S(G)&&!Ka(e,G)){t.input.ensurePolled(),clearTimeout(n);var V=+new Date;t.activeTouch={start:V,moved:!1,prev:V-r.end<=300?r:null},G.touches.length==1&&(t.activeTouch.left=G.touches[0].pageX,t.activeTouch.top=G.touches[0].pageY)}}),ve(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),ve(t.scroller,"touchend",function(G){var V=t.activeTouch;if(V&&!kr(t,G)&&V.left!=null&&!V.moved&&new Date-V.start<300){var Z=e.coordsChar(t.activeTouch,"page"),ie;!V.prev||I(V,V.prev)?ie=new wt(Z,Z):!V.prev.prev||I(V,V.prev.prev)?ie=e.findWordAt(Z):ie=new wt(Re(Z.line,0),ct(e.doc,Re(Z.line+1,0))),e.setSelection(ie.anchor,ie.head),e.focus(),Y(G)}i()}),ve(t.scroller,"touchcancel",i),ve(t.scroller,"scroll",function(){t.scroller.clientHeight&&(ai(e,t.scroller.scrollTop),fn(e,t.scroller.scrollLeft,!0),be(e,"scroll",e))}),ve(t.scroller,"mousewheel",function(G){return ko(e,G)}),ve(t.scroller,"DOMMouseScroll",function(G){return ko(e,G)}),ve(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(G){Oe(e,G)||re(G)},over:function(G){Oe(e,G)||(Dl(e,G),re(G))},start:function(G){return Al(e,G)},drop:Gt(e,Ll),leave:function(G){Oe(e,G)||ss(e)}};var W=t.input.getField();ve(W,"keyup",function(G){return ys.call(e,G)}),ve(W,"keydown",Gt(e,vs)),ve(W,"keypress",Gt(e,bs)),ve(W,"focus",function(G){return wa(e,G)}),ve(W,"blur",function(G){return Mn(e,G)})}var Ga=[];Mt.defineInitHook=function(e){return Ga.push(e)};function Si(e,t,n,r){var i=e.doc,S;n==null&&(n="add"),n=="smart"&&(i.mode.indent?S=Pe(e,t).state:n="prev");var I=e.options.tabSize,W=nt(i,t),G=X(W.text,null,I);W.stateAfter&&(W.stateAfter=null);var V=W.text.match(/^\s*/)[0],Z;if(!r&&!/\S/.test(W.text))Z=0,n="not";else if(n=="smart"&&(Z=i.mode.indent(S,W.text.slice(V.length),W.text),Z==xe||Z>150)){if(!r)return;n="prev"}n=="prev"?t>i.first?Z=X(nt(i,t-1).text,null,I):Z=0:n=="add"?Z=G+e.options.indentUnit:n=="subtract"?Z=G-e.options.indentUnit:typeof n=="number"&&(Z=G+n),Z=Math.max(0,Z);var ie="",me=0;if(e.options.indentWithTabs)for(var ce=Math.floor(Z/I);ce;--ce)me+=I,ie+=" ";if(me<Z&&(ie+=se(Z-me)),ie!=V)return Un(i,ie,Re(t,0),Re(t,V.length),"+input"),W.stateAfter=null,!0;for(var Te=0;Te<i.sel.ranges.length;Te++){var Ae=i.sel.ranges[Te];if(Ae.head.line==t&&Ae.head.ch<V.length){var Fe=Re(t,V.length);Na(i,Te,new wt(Fe,Fe));break}}}var xr=null;function ra(e){xr=e}function za(e,t,n,r,i){var S=e.doc;e.display.shift=!1,r||(r=S.sel);var I=+new Date-200,W=i=="paste"||e.state.pasteIncoming>I,G=it(t),V=null;if(W&&r.ranges.length>1)if(xr&&xr.text.join(`
`)==t){if(r.ranges.length%xr.text.length==0){V=[];for(var Z=0;Z<xr.text.length;Z++)V.push(S.splitLines(xr.text[Z]))}}else G.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(V=Me(G,function(je){return[je]}));for(var ie=e.curOp.updateInput,me=r.ranges.length-1;me>=0;me--){var ce=r.ranges[me],Te=ce.from(),Ae=ce.to();ce.empty()&&(n&&n>0?Te=Re(Te.line,Te.ch-n):e.state.overwrite&&!W?Ae=Re(Ae.line,Math.min(nt(S,Ae.line).text.length,Ae.ch+ye(G).length)):W&&xr&&xr.lineWise&&xr.text.join(`
`)==G.join(`
`)&&(Te=Ae=Re(Te.line,0)));var Fe={from:Te,to:Ae,text:V?V[me%V.length]:G,origin:i||(W?"paste":e.state.cutIncoming>I?"cut":"+input")};Nn(e.doc,Fe),Dt(e,"inputRead",e,Fe)}t&&!W&&As(e,t),kn(e),e.curOp.updateInput<2&&(e.curOp.updateInput=ie),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Ls(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 As(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 S=e.getModeAt(i.head),I=!1;if(S.electricChars){for(var W=0;W<S.electricChars.length;W++)if(t.indexOf(S.electricChars.charAt(W))>-1){I=Si(e,i.head.line,"smart");break}}else S.electricInput&&(S.electricInput.test(nt(e.doc,i.head.line).text.slice(0,i.head.ch))&&(I=Si(e,i.head.line,"smart")));I&&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,S={anchor:Re(i,0),head:Re(i+1,0)};n.push(S),t.push(e.getRange(S.anchor,S.head))}return{text:t,ranges:n}}function Os(e,t,n,r){e.setAttribute("autocorrect",n?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function Rs(){var e=o("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=o("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return P?e.style.width="1000px":e.setAttribute("wrap","off"),E&&(e.style.border="1px solid black"),Os(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 S=this.options,I=S[r];if(S[r]==i&&r!="mode")return;S[r]=i,t.hasOwnProperty(r)&&Gt(this,t[r])(this,i,I),be(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,S=0;S<i.length;++S)if(i[S]==r||i[S].name==r)return i.splice(S,1),!0},addOverlay:qt(function(r,i){var S=r.token?r:e.getMode(this.options,r);if(S.startState)throw new Error("Overlays may not be stateful.");ke(this.state.overlays,{mode:S,modeSpec:r,opaque:i&&i.opaque,priority:i&&i.priority||0},function(I){return I.priority}),this.state.modeGen++,tr(this)}),removeOverlay:qt(function(r){for(var i=this.state.overlays,S=0;S<i.length;++S){var I=i[S].modeSpec;if(I==r||typeof r=="string"&&I.name==r){i.splice(S,1),this.state.modeGen++,tr(this);return}}}),indentLine:qt(function(r,i,S){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,S)}),indentSelection:qt(function(r){for(var i=this.doc.sel.ranges,S=-1,I=0;I<i.length;I++){var W=i[I];if(W.empty())W.head.line>S&&(Si(this,W.head.line,r,!0),S=W.head.line,I==this.doc.sel.primIndex&&kn(this));else{var G=W.from(),V=W.to(),Z=Math.max(S,G.line);S=Math.min(this.lastLine(),V.line-(V.ch?0:1))+1;for(var ie=Z;ie<S;++ie)Si(this,ie,r);var me=this.doc.sel.ranges;G.ch==0&&i.length==me.length&&me[I].from().ch>0&&Na(this.doc,I,new wt(G,me[I].to()),pe)}}}),getTokenAt:function(r,i){return Fr(this,r,i)},getLineTokens:function(r,i){return Fr(this,Re(r),i,!0)},getTokenTypeAt:function(r){r=ct(this.doc,r);var i=Yn(this,nt(this.doc,r.line)),S=0,I=(i.length-1)/2,W=r.ch,G;if(W==0)G=i[2];else for(;;){var V=S+I>>1;if((V?i[V*2-1]:0)>=W)I=V;else if(i[V*2+1]<W)S=V+1;else{G=i[V*2+2];break}}var Z=G?G.indexOf("overlay "):-1;return Z<0?G:Z==0?null:G.slice(0,Z-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 S=[];if(!n.hasOwnProperty(i))return S;var I=n[i],W=this.getModeAt(r);if(typeof W[i]=="string")I[W[i]]&&S.push(I[W[i]]);else if(W[i])for(var G=0;G<W[i].length;G++){var V=I[W[i][G]];V&&S.push(V)}else W.helperType&&I[W.helperType]?S.push(I[W.helperType]):I[W.name]&&S.push(I[W.name]);for(var Z=0;Z<I._global.length;Z++){var ie=I._global[Z];ie.pred(W,this)&&ne(S,ie.val)==-1&&S.push(ie.val)}return S},getStateAfter:function(r,i){var S=this.doc;return r=Xn(S,r==null?S.first+S.size-1:r),Pe(this,r+1,i).state},cursorCoords:function(r,i){var S,I=this.doc.sel.primary();return r==null?S=I.head:typeof r=="object"?S=ct(this.doc,r):S=r?I.from():I.to(),br(this,S,i||"page")},charCoords:function(r,i){return ga(this,ct(this.doc,r),i||"page")},coordsChar:function(r,i){return r=co(this,r,i||"page"),ya(this,r.left,r.top)},lineAtHeight:function(r,i){return r=co(this,{top:r,left:0},i||"page").top,wr(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,i,S){var I=!1,W;if(typeof r=="number"){var G=this.doc.first+this.doc.size-1;r<this.doc.first?r=this.doc.first:r>G&&(r=G,I=!0),W=nt(this.doc,r)}else W=r;return Ui(this,W,{top:0,left:0},i||"page",S||I).top+(I?this.doc.height-lr(W):0)},defaultTextHeight:function(){return Rn(this.display)},defaultCharWidth:function(){return Pn(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,i,S,I,W){var G=this.display;r=br(this,ct(this.doc,r));var V=r.bottom,Z=r.left;if(i.style.position="absolute",i.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(i),G.sizer.appendChild(i),I=="over")V=r.top;else if(I=="above"||I=="near"){var ie=Math.max(G.wrapper.clientHeight,this.doc.height),me=Math.max(G.sizer.clientWidth,G.lineSpace.clientWidth);(I=="above"||r.bottom+i.offsetHeight>ie)&&r.top>i.offsetHeight?V=r.top-i.offsetHeight:r.bottom+i.offsetHeight<=ie&&(V=r.bottom),Z+i.offsetWidth>me&&(Z=me-i.offsetWidth)}i.style.top=V+"px",i.style.left=i.style.right="",W=="right"?(Z=G.sizer.clientWidth-i.offsetWidth,i.style.right="0px"):(W=="left"?Z=0:W=="middle"&&(Z=(G.sizer.clientWidth-i.offsetWidth)/2),i.style.left=Z+"px"),S&&Qs(this,{left:Z,top:V,right:Z+i.offsetWidth,bottom:V+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){As(this,r)}),findPosH:function(r,i,S,I){var W=1;i<0&&(W=-1,i=-i);for(var G=ct(this.doc,r),V=0;V<i&&!(G=Va(this.doc,G,W,S,I),G.hitSide);++V);return G},moveH:qt(function(r,i){var S=this;this.extendSelectionsBy(function(I){return S.display.shift||S.doc.extend||I.empty()?Va(S.doc,I.head,r,i,S.options.rtlMoveVisually):r<0?I.from():I.to()},de)}),deleteH:qt(function(r,i){var S=this.doc.sel,I=this.doc;S.somethingSelected()?I.replaceSelection("",null,"+delete"):Wn(this,function(W){var G=Va(I,W.head,r,i,!1);return r<0?{from:G,to:W.head}:{from:W.head,to:G}})}),findPosV:function(r,i,S,I){var W=1,G=I;i<0&&(W=-1,i=-i);for(var V=ct(this.doc,r),Z=0;Z<i;++Z){var ie=br(this,V,"div");if(G==null?G=ie.left:ie.left=G,V=Ps(this,ie,W,S),V.hitSide)break}return V},moveV:qt(function(r,i){var S=this,I=this.doc,W=[],G=!this.display.shift&&!I.extend&&I.sel.somethingSelected();if(I.extendSelectionsBy(function(Z){if(G)return r<0?Z.from():Z.to();var ie=br(S,Z.head,"div");Z.goalColumn!=null&&(ie.left=Z.goalColumn),W.push(ie.left);var me=Ps(S,ie,r,i);return i=="page"&&Z==I.sel.primary()&&La(S,ga(S,me,"div").top-ie.top),me},de),W.length)for(var V=0;V<I.sel.ranges.length;V++)I.sel.ranges[V].goalColumn=W[V]}),findWordAt:function(r){var i=this.doc,S=nt(i,r.line).text,I=r.ch,W=r.ch;if(S){var G=this.getHelper(r,"wordChars");(r.sticky=="before"||W==S.length)&&I?--I:++W;for(var V=S.charAt(I),Z=_e(V,G)?function(ie){return _e(ie,G)}:/\s/.test(V)?function(ie){return/\s/.test(ie)}:function(ie){return!/\s/.test(ie)&&!_e(ie)};I>0&&Z(S.charAt(I-1));)--I;for(;W<S.length&&Z(S.charAt(W));)++W}return new wt(Re(r.line,I),Re(r.line,W))},toggleOverwrite:function(r){if(r!=null&&r==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?U(this.display.cursorDiv,"CodeMirror-overwrite"):f(this.display.cursorDiv,"CodeMirror-overwrite"),be(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==R()},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-Lr(this)-this.display.barHeight,width:r.scrollWidth-Lr(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:Re(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 S=this,I=function(G){return typeof G=="number"||/^\d+$/.test(String(G))?G+"px":G};r!=null&&(this.display.wrapper.style.width=I(r)),i!=null&&(this.display.wrapper.style.height=I(i)),this.options.lineWrapping&&lo(this);var W=this.display.viewFrom;this.doc.iter(W,this.display.viewTo,function(G){if(G.widgets){for(var V=0;V<G.widgets.length;V++)if(G.widgets[V].noHScroll){Kr(S,W,"widget");break}}++W}),this.curOp.forceUpdate=!0,be(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),Oa(this.display),(r==null||Math.abs(r-Rn(this.display))>.5||this.options.lineWrapping)&&Ta(this),be(this,"refresh",this)}),swapDoc:qt(function(r){var i=this.doc;return i.cm=null,this.state.selectingText&&this.state.selectingText(),No(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}},oe(e),e.registerHelper=function(r,i,S){n.hasOwnProperty(r)||(n[r]=e[r]={_global:[]}),n[r][i]=S},e.registerGlobalHelper=function(r,i,S,I){e.registerHelper(r,i,I),n[r]._global.push({pred:S,val:I})}}function Va(e,t,n,r,i){var S=t,I=n,W=nt(e,t.line),G=i&&e.direction=="rtl"?-n:n;function V(){var ze=t.line+G;return ze<e.first||ze>=e.first+e.size?!1:(t=new Re(ze,t.ch,t.sticky),W=nt(e,ze))}function Z(ze){var We;if(r=="codepoint"){var Ze=W.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(Ze)?We=null:We=new Re(t.line,Math.max(0,Math.min(W.text.length,t.ch+n*(Ze>=55296&&Ze<56320?2:1))),-n)}else i?We=_l(e.cm,W,t,n):We=Ba(W,t,n);if(We==null)if(!ze&&V())t=ja(i,e.cm,W,t.line,G);else return!1;else t=We;return!0}if(r=="char"||r=="codepoint")Z();else if(r=="column")Z(!0);else if(r=="word"||r=="group")for(var ie=null,me=r=="group",ce=e.cm&&e.cm.getHelper(t,"wordChars"),Te=!0;!(n<0&&!Z(!Te));Te=!1){var Ae=W.text.charAt(t.ch)||`
`,Fe=_e(Ae,ce)?"w":me&&Ae==`
`?"n":!me||/\s/.test(Ae)?null:"p";if(me&&!Te&&!Fe&&(Fe="s"),ie&&ie!=Fe){n<0&&(n=1,Z(),t.sticky="after");break}if(Fe&&(ie=Fe),n>0&&!Z(!Te))break}var je=Qi(e,t,S,I,!0);return qr(S,je)&&(je.hitSide=!0),je}function Ps(e,t,n,r){var i=e.doc,S=t.left,I;if(r=="page"){var W=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),G=Math.max(W-.5*Rn(e.display),3);I=(n>0?t.bottom:t.top)+n*G}else r=="line"&&(I=n>0?t.bottom+3:t.top-3);for(var V;!(V=ya(e,S,I),!V.outside);){if(n<0?I<=0:I>=i.height){V.hitSide=!0;break}I+=n*5}return V}var Lt=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new q,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Lt.prototype.init=function(e){var t=this,n=this,r=n.cm,i=n.div=e.lineDiv;Os(i,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function S(W){for(var G=W.target;G;G=G.parentNode){if(G==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(G.className))break}return!1}ve(i,"paste",function(W){if(!S(W)||Oe(r,W)||Ls(W,r))return;_<=11&&setTimeout(Gt(r,function(){return t.updateFromDOM()}),20)}),ve(i,"compositionstart",function(W){t.composing={data:W.data,done:!1}}),ve(i,"compositionupdate",function(W){t.composing||(t.composing={data:W.data,done:!1})}),ve(i,"compositionend",function(W){t.composing&&(W.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),ve(i,"touchstart",function(){return n.forceCompositionEnd()}),ve(i,"input",function(){t.composing||t.readFromDOMSoon()});function I(W){if(!S(W)||Oe(r,W))return;if(r.somethingSelected())ra({lineWise:!1,text:r.getSelections()}),W.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var G=Ds(r);ra({lineWise:!0,text:G.text}),W.type=="cut"&&r.operation(function(){r.setSelections(G.ranges,0,pe),r.replaceSelection("",null,"cut")})}else return;if(W.clipboardData){W.clipboardData.clearData();var V=xr.text.join(`
`);if(W.clipboardData.setData("Text",V),W.clipboardData.getData("Text")==V){W.preventDefault();return}}var Z=Rs(),ie=Z.firstChild;r.display.lineSpace.insertBefore(Z,r.display.lineSpace.firstChild),ie.value=xr.text.join(`
`);var me=document.activeElement;z(ie),setTimeout(function(){r.display.lineSpace.removeChild(Z),me.focus(),me==i&&n.showPrimarySelection()},50)}ve(i,"copy",I),ve(i,"cut",I)},Lt.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Lt.prototype.prepareSelection=function(){var e=yo(this.cm,!1);return e.focus=document.activeElement==this.div,e},Lt.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},Lt.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Lt.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 S=na(t,e.anchorNode,e.anchorOffset),I=na(t,e.focusNode,e.focusOffset);if(S&&!S.bad&&I&&!I.bad&&dt(bn(S,I),r)==0&&dt(tn(S,I),i)==0)return;var W=t.display.view,G=r.line>=t.display.viewFrom&&Ms(t,r)||{node:W[0].measure.map[2],offset:0},V=i.line<t.display.viewTo&&Ms(t,i);if(!V){var Z=W[W.length-1].measure,ie=Z.maps?Z.maps[Z.maps.length-1]:Z.map;V={node:ie[ie.length-1],offset:ie[ie.length-2]-ie[ie.length-3]}}if(!G||!V){e.removeAllRanges();return}var me=e.rangeCount&&e.getRangeAt(0),ce;try{ce=y(G.node,G.offset,V.offset,V.node)}catch(Te){}ce&&(!L&&t.state.focused?(e.collapse(G.node,G.offset),ce.collapsed||(e.removeAllRanges(),e.addRange(ce))):(e.removeAllRanges(),e.addRange(ce)),me&&e.anchorNode==null?e.addRange(me):L&&this.startGracePeriod()),this.rememberSelection()},Lt.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)},Lt.prototype.showMultipleSelections=function(e){d(this.cm.display.cursorDiv,e.cursors),d(this.cm.display.selectionDiv,e.selection)},Lt.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},Lt.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return p(this.div,t)},Lt.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},Lt.prototype.blur=function(){this.div.blur()},Lt.prototype.getField=function(){return this.div},Lt.prototype.supportsTouch=function(){return!0},Lt.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)},Lt.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},Lt.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(s&&c&&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)})},Lt.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=Re(r.line-1,nt(e.doc,r.line-1).length)),i.ch==nt(e.doc,i.line).text.length&&i.line<e.lastLine()&&(i=Re(i.line+1,0)),r.line<t.viewFrom||i.line>t.viewTo-1)return!1;var S,I,W;r.line==t.viewFrom||(S=dn(e,r.line))==0?(I=St(t.view[0].line),W=t.view[0].node):(I=St(t.view[S].line),W=t.view[S-1].node.nextSibling);var G=dn(e,i.line),V,Z;if(G==t.view.length-1?(V=t.viewTo-1,Z=t.lineDiv.lastChild):(V=St(t.view[G+1].line)-1,Z=t.view[G+1].node.previousSibling),!W)return!1;for(var ie=e.doc.splitLines(tu(e,W,Z,I,V)),me=Sr(e.doc,Re(I,0),Re(V,nt(e.doc,V).text.length));ie.length>1&&me.length>1;)if(ye(ie)==ye(me))ie.pop(),me.pop(),V--;else if(ie[0]==me[0])ie.shift(),me.shift(),I++;else break;for(var ce=0,Te=0,Ae=ie[0],Fe=me[0],je=Math.min(Ae.length,Fe.length);ce<je&&Ae.charCodeAt(ce)==Fe.charCodeAt(ce);)++ce;for(var ze=ye(ie),We=ye(me),Ze=Math.min(ze.length-(ie.length==1?ce:0),We.length-(me.length==1?ce:0));Te<Ze&&ze.charCodeAt(ze.length-Te-1)==We.charCodeAt(We.length-Te-1);)++Te;if(ie.length==1&&me.length==1&&I==r.line)for(;ce&&ce>r.ch&&ze.charCodeAt(ze.length-Te-1)==We.charCodeAt(We.length-Te-1);)ce--,Te++;ie[ie.length-1]=ze.slice(0,ze.length-Te).replace(/^\u200b+/,""),ie[0]=ie[0].slice(ce).replace(/\u200b+$/,"");var ut=Re(I,ce),ot=Re(V,me.length?ye(me).length-Te:0);if(ie.length>1||ie[0]||dt(ut,ot))return Un(e.doc,ie,ut,ot,"+input"),!0},Lt.prototype.ensurePolled=function(){this.forceCompositionEnd()},Lt.prototype.reset=function(){this.forceCompositionEnd()},Lt.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},Lt.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)},Lt.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&ur(this.cm,function(){return tr(e.cm)})},Lt.prototype.setUneditable=function(e){e.contentEditable="false"},Lt.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)},Lt.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},Lt.prototype.onContextMenu=function(){},Lt.prototype.resetPosition=function(){},Lt.prototype.needsContentAttribute=!0;function Ms(e,t){var n=ma(e,t.line);if(!n||n.hidden)return null;var r=nt(e.doc,t.line),i=no(n,r,t.line),S=Ye(r,e.doc.direction),I="left";if(S){var W=Ue(S,t.ch);I=W%2?"right":"left"}var G=oo(i.map,t.ch,I);return G.offset=G.collapse=="right"?G.end:G.start,G}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 S="",I=!1,W=e.doc.lineSeparator(),G=!1;function V(ce){return function(Te){return Te.id==ce}}function Z(){I&&(S+=W,G&&(S+=W),I=G=!1)}function ie(ce){ce&&(Z(),S+=ce)}function me(ce){if(ce.nodeType==1){var Te=ce.getAttribute("cm-text");if(Te){ie(Te);return}var Ae=ce.getAttribute("cm-marker"),Fe;if(Ae){var je=e.findMarks(Re(r,0),Re(i+1,0),V(+Ae));je.length&&(Fe=je[0].find(0))&&ie(Sr(e.doc,Fe.from,Fe.to).join(W));return}if(ce.getAttribute("contenteditable")=="false")return;var ze=/^(pre|div|p|li|table|br)$/i.test(ce.nodeName);if(!/^br$/i.test(ce.nodeName)&&ce.textContent.length==0)return;ze&&Z();for(var We=0;We<ce.childNodes.length;We++)me(ce.childNodes[We]);/^(pre|p)$/i.test(ce.nodeName)&&(G=!0),ze&&(I=!0)}else ce.nodeType==3&&ie(ce.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(me(t),t==n);)t=t.nextSibling,G=!1;return S}function na(e,t,n){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[n],!r)return Kn(e.clipPos(Re(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 S=e.display.view[i];if(S.node==r)return ru(S,t,n)}}function ru(e,t,n){var r=e.text.firstChild,i=!1;if(!t||!p(r,t))return Kn(Re(St(e.line),0),!0);if(t==r&&(i=!0,t=r.childNodes[n],n=0,!t)){var S=e.rest?ye(e.rest):e.line;return Kn(Re(St(S),S.text.length),i)}var I=t.nodeType==3?t:null,W=t;for(!I&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(I=t.firstChild,n&&(n=I.nodeValue.length));W.parentNode!=r;)W=W.parentNode;var G=e.measure,V=G.maps;function Z(Fe,je,ze){for(var We=-1;We<(V?V.length:0);We++)for(var Ze=We<0?G.map:V[We],ut=0;ut<Ze.length;ut+=3){var ot=Ze[ut+2];if(ot==Fe||ot==je){var gt=St(We<0?e.line:e.rest[We]),Rt=Ze[ut]+ze;return(ze<0||ot!=Fe)&&(Rt=Ze[ut+(ze?1:0)]),Re(gt,Rt)}}}var ie=Z(I,W,n);if(ie)return Kn(ie,i);for(var me=W.nextSibling,ce=I?I.nodeValue.length-n:0;me;me=me.nextSibling){if(ie=Z(me,me.firstChild,0),ie)return Kn(Re(ie.line,ie.ch-ce),i);ce+=me.textContent.length}for(var Te=W.previousSibling,Ae=n;Te;Te=Te.previousSibling){if(ie=Z(Te,Te.firstChild,-1),ie)return Kn(Re(ie.line,ie.ch+Ae),i);Ae+=Te.textContent.length}}var Nt=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new q,this.hasSelection=!1,this.composing=null};Nt.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),E&&(i.style.width="0px"),ve(i,"input",function(){N&&_>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),ve(i,"paste",function(I){if(Oe(r,I)||Ls(I,r))return;r.state.pasteIncoming=+new Date,n.fastPoll()});function S(I){if(Oe(r,I))return;if(r.somethingSelected())ra({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var W=Ds(r);ra({lineWise:!0,text:W.text}),I.type=="cut"?r.setSelections(W.ranges,null,pe):(n.prevInput="",i.value=W.text.join(`
`),z(i))}else return;I.type=="cut"&&(r.state.cutIncoming=+new Date)}ve(i,"cut",S),ve(i,"copy",S),ve(e.scroller,"paste",function(I){if(kr(e,I)||Oe(r,I))return;if(!i.dispatchEvent){r.state.pasteIncoming=+new Date,n.focus();return}var W=new Event("paste");W.clipboardData=I.clipboardData,i.dispatchEvent(W)}),ve(e.lineSpace,"selectstart",function(I){kr(e,I)||Y(I)}),ve(i,"compositionstart",function(){var I=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:I,range:r.markText(I,r.getCursor("to"),{className:"CodeMirror-composing"})}}),ve(i,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},Nt.prototype.createField=function(e){this.wrapper=Rs(),this.textarea=this.wrapper.firstChild},Nt.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},Nt.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"),S=t.wrapper.getBoundingClientRect(),I=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+I.top-S.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+I.left-S.left))}return r},Nt.prototype.showSelection=function(e){var t=this.cm,n=t.display;d(n.cursorDiv,e.cursors),d(n.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Nt.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&&z(this.textarea),N&&_>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",N&&_>=9&&(this.hasSelection=null))},Nt.prototype.getField=function(){return this.textarea},Nt.prototype.supportsTouch=function(){return!1},Nt.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!a||R()!=this.textarea))try{this.textarea.focus()}catch(e){}},Nt.prototype.blur=function(){this.textarea.blur()},Nt.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Nt.prototype.receivedFocus=function(){this.slowPoll()},Nt.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()})},Nt.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)},Nt.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||Je(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&&_>=9&&this.hasSelection===i||l&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var S=i.charCodeAt(0);if(S==8203&&!r&&(r="\u200B"),S==8666)return this.reset(),this.cm.execCommand("undo")}for(var I=0,W=Math.min(r.length,i.length);I<W&&r.charCodeAt(I)==i.charCodeAt(I);)++I;return ur(t,function(){za(t,i.slice(I),r.length-I,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},Nt.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Nt.prototype.onKeyPress=function(){N&&_>=9&&(this.hasSelection=null),this.fastPoll()},Nt.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var S=un(n,e),I=r.scroller.scrollTop;if(!S||v)return;var W=n.options.resetSelectionOnContextMenu;W&&n.doc.sel.contains(S)==-1&&Gt(n,Qt)(n.doc,zr(S),pe);var G=i.style.cssText,V=t.wrapper.style.cssText,Z=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",i.style.cssText=`position: absolute; width: 30px; height: 30px;
top: `+(e.clientY-Z.top-5)+"px; left: "+(e.clientX-Z.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 ie;P&&(ie=window.scrollY),r.input.focus(),P&&window.scrollTo(null,ie),r.input.reset(),n.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=ce,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll);function me(){if(i.selectionStart!=null){var Ae=n.somethingSelected(),Fe="\u200B"+(Ae?i.value:"");i.value="\u21DA",i.value=Fe,t.prevInput=Ae?"":"\u200B",i.selectionStart=1,i.selectionEnd=Fe.length,r.selForContextMenu=n.doc.sel}}function ce(){if(t.contextMenuPending!=ce)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=V,i.style.cssText=G,N&&_<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=I),i.selectionStart!=null){(!N||N&&_<9)&&me();var Ae=0,Fe=function(){r.selForContextMenu==n.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&t.prevInput=="\u200B"?Gt(n,Qo)(n):Ae++<10?r.detectingSelectAll=setTimeout(Fe,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(Fe,200)}}if(N&&_>=9&&me(),A){re(e);var Te=function(){Ge(window,"mouseup",Te),setTimeout(ce,20)};ve(window,"mouseup",Te)}else setTimeout(ce,50)},Nt.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},Nt.prototype.setUneditable=function(){},Nt.prototype.needsContentAttribute=!1;function nu(e,t){if(t=t?F(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=R();t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function r(){e.value=W.getValue()}var i;if(e.form&&(ve(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var S=e.form;i=S.submit;try{var I=S.submit=function(){r(),S.submit=i,S.submit(),S.submit=I}}catch(G){}}t.finishInit=function(G){G.save=r,G.getTextArea=function(){return e},G.toTextArea=function(){G.toTextArea=isNaN,r(),e.parentNode.removeChild(G.getWrapperElement()),e.style.display="",e.form&&(Ge(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=i))}},e.style.display="none";var W=Mt(function(G){return e.parentNode.insertBefore(G,e.nextSibling)},t);return W}function iu(e){e.off=Ge,e.on=ve,e.wheelEventPixels=fl,e.Doc=rr,e.splitLines=it,e.countColumn=X,e.findColumn=fe,e.isWordChar=De,e.Pass=xe,e.signal=be,e.Line=Hr,e.changeEnd=Vr,e.scrollbarModel=Lo,e.Pos=Re,e.cmpPos=dt,e.modes=At,e.mimeModes=mt,e.resolveMode=Ut,e.getMode=Tr,e.modeExtensions=vr,e.extendMode=wi,e.copyState=mr,e.startState=Jr,e.innerMode=vn,e.commands=bi,e.keyMap=_r,e.keyName=cs,e.isModifierKey=ds,e.lookupKey=jn,e.normalizeKeyMap=kl,e.StringStream=kt,e.SharedTextMarker=gi,e.TextMarker=Yr,e.LineWidget=pi,e.e_preventDefault=Y,e.e_stopPropagation=$,e.e_stop=re,e.addClass=U,e.contains=p,e.rmClass=f,e.keyNames=$r}$l(Mt),ql(Mt);var au="iter insert remove copy getEditor constructor".split(" ");for(var ia in rr.prototype)rr.prototype.hasOwnProperty(ia)&&ne(au,ia)<0&&(Mt.prototype[ia]=function(e){return function(){return e.apply(this.doc,arguments)}}(rr.prototype[ia]));return oe(rr),Mt.inputStyles={textarea:Nt,contenteditable:Lt},Mt.defineMode=function(e){!Mt.defaults.mode&&e!="null"&&(Mt.defaults.mode=e),or.apply(this,arguments)},Mt.defineMIME=Kt,Mt.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Mt.defineMIME("text/plain","null"),Mt.defineExtension=function(e,t){Mt.prototype[e]=t},Mt.defineDocExtension=function(e,t){rr.prototype[e]=t},Mt.fromTextArea=nu,iu(Mt),Mt.version="5.58.2",Mt})},VwnK:function(at,qe,ee){"use strict";ee.r(qe);var Q=ee("+L6B"),K=ee("2/Rp"),L=ee("OaEy"),H=ee("2fM7"),k=ee("14J3"),M=ee("BMrR"),N=ee("5NDa"),_=ee("5rEg"),P=ee("jCWc"),D=ee("kPKH"),c=ee("jrin"),v=ee("miYZ"),O=ee("tsqr"),w=ee("k1fw"),b=ee("9og8"),E=ee("y8nQ"),s=ee("Vl3Y"),a=ee("tJVT"),l=ee("PpiC"),u=ee("WmNS"),C=ee.n(u),g=ee("cDcd"),h=ee.n(g),A=ee("9kvl"),T=ee("ErOA"),f=ee("xKgJ"),m=ee("Ot1p"),d=function(x){var y,p,R,U=x.user,B=x.globalSetting,z=x.loading,j=x.dispatch,F=x.restful,X=Object(l.a)(x,["user","globalSetting","loading","dispatch","restful"]),q=Object(g.useState)({content:"",message:"",status:0,contacts:[],address:"",data:[]}),ne=Object(a.a)(q,2),ue=ne[0],xe=ne[1],pe=Object(g.useState)(!0),he=Object(a.a)(pe,2),de=he[0],fe=he[1],te=X.match.params,se=s.a.useForm(),ye=Object(a.a)(se,1),Me=ye[0],ke=Object(g.useState)(`
##### \u7B80\u8981\u63CF\u8FF0
- \u7528\u6237\u6CE8\u518C\u63A5\u53E3
##### \u8BF7\u6C42URL
- \` http://xx.com/api/user/register \`
##### \u8BF7\u6C42\u65B9\u5F0F
- POST
##### \u53C2\u6570
|\u53C2\u6570\u540D|\u5FC5\u9009|\u7C7B\u578B|\u8BF4\u660E|
|:---- |:---|:----- |----- |
|username |\u662F |string |\u7528\u6237\u540D |
|password |\u662F |string | \u5BC6\u7801 |
|name |\u5426 |string | \u6635\u79F0 |
##### \u8FD4\u56DE\u793A\u4F8B
\`\`\`
{
"error_code": 0,
"data": {
"uid": "1",
"username": "12154545",
"name": "\u5434\u7CFB\u6302",
"groupid": 2 ,
"reg_time": "1436864169",
"last_login_time": "0",
}
}
\`\`\`
##### \u8FD4\u56DE\u53C2\u6570\u8BF4\u660E
|\u53C2\u6570\u540D|\u7C7B\u578B|\u8BF4\u660E|
|:----- |:-----|----- |
|groupid |int |\u7528\u6237\u7EC4id\uFF0C1\uFF1A\u8D85\u7EA7\u7BA1\u7406\u5458\uFF1B2\uFF1A\u666E\u901A\u7528\u6237 |
##### \u5907\u6CE8
- \u66F4\u591A\u8FD4\u56DE\u9519\u8BEF\u4EE3\u7801\u8BF7\u770B\u9996\u9875\u7684\u9519\u8BEF\u4EE3\u7801\u63CF\u8FF0
\u6B22\u8FCE\u4F7F\u7528\uFF01`),He=Object(a.a)(ke,2),$e=He[0],we=He[1];Object(g.useEffect)(function(){Me.resetFields()},[te.id]);var De=function(){var Be=Object(b.a)(C.a.mark(function Ne(Se){var Ce,Ke,Qe;return C.a.wrap(function(Ue){for(;;)switch(Ue.prev=Ue.next){case 0:return Ue.next=2,Me.getFieldsValue();case 2:return Ce=Ue.sent,Ke="/api/restfuls.json",te.id!=0&&(Ke="/api/restfuls/".concat(te.id,".json")),Ue.next=7,Object(T.a)(Ke,{method:te.id!=0?"put":"post",body:Object(w.a)(Object(w.a)({file_type:0},Ce),{},{parent_id:Ce.parent_id||""})});case 7:Qe=Ue.sent,Qe.status===0&&(O.b.success("\u6DFB\u52A0\u6210\u529F"),X.history.push("/ch/rest/".concat(Qe.data.id)));case 9:case"end":return Ue.stop()}},Ne)}));return function(Se){return Be.apply(this,arguments)}}(),_e=function(){var Be=Object(b.a)(C.a.mark(function Ne(){var Se;return C.a.wrap(function(Ke){for(;;)switch(Ke.prev=Ke.next){case 0:return Ke.next=2,j({type:"restful/getRestful"});case 2:if(!(te.id!=0)){Ke.next=8;break}return Ke.next=5,j({type:"restful/getRestfulDetail",payload:Object(w.a)({},te)});case 5:Se=Ke.sent,Me.setFieldsValue({description:Se==null?void 0:Se.description,name:Se==null?void 0:Se.name}),Object(f.o)()||X.history.replace("/403");case 8:case"end":return Ke.stop()}},Ne)}));return function(){return Be.apply(this,arguments)}}();return Object(g.useEffect)(function(){var Be,Ne;if((Be=F.restful)!==null&&Be!==void 0&&Be.data&&Me.setFieldsValue({parent_id:te.categoryId*1}),(Ne=F.restfulDetail)!==null&&Ne!==void 0&&Ne.description&&te.id!=0){var Se;we((Se=F.restfulDetail)===null||Se===void 0?void 0:Se.description)}},[F.restful,(y=F.restfulDetail)===null||y===void 0?void 0:y.description]),Object(g.useEffect)(function(){fe(!0),_e()},[te.id]),h.a.createElement("section",null,h.a.createElement("aside",{className:"edu-container mt30"},h.a.createElement(s.a,{onFinish:De,form:Me,initialValues:Object(c.a)({},"name","")},h.a.createElement(M.a,{className:"mt30"},h.a.createElement(D.a,{flex:"80px",className:"font14"},"\u76EE\u5F55\u540D\u79F0\uFF1A"),h.a.createElement(D.a,{flex:"1"},h.a.createElement(s.a.Item,{name:"name",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u76EE\u5F55\u540D\u79F0"}]},h.a.createElement(_.a,{placeholder:"\u8BF7\u8F93\u5165\u540D\u79F0\uFF0C\u6700\u5927\u9650\u523660\u4E2A\u5B57\u7B26 ",maxLength:60})))),h.a.createElement(M.a,{className:""},h.a.createElement(D.a,{flex:"80px",className:"font14"},"\u6240\u5C5E\u76EE\u5F55:"),h.a.createElement(D.a,{flex:"1"},h.a.createElement(s.a.Item,{name:"parent_id",rules:[{required:!0,message:"\u6240\u5C5E\u76EE\u5F55"}]},h.a.createElement(H.a,{showSearch:!0,style:{width:200},placeholder:"\u8BF7\u9009\u62E9\u76EE\u5F55",optionFilterProp:"children",filterOption:function(Ne,Se){return Se.children.toLowerCase().indexOf(Ne.toLowerCase())>=0}},h.a.createElement(H.a.Option,{value:0,key:9999},"\u6839\u76EE\u5F55"),F==null||((p=F.restful)===null||p===void 0||((R=p.data)===null||R===void 0))?void 0:R.map(function(Be,Ne){return h.a.createElement(H.a.Option,{value:Be.id,key:Ne},Be.title)}))))),h.a.createElement(s.a.Item,{name:"description",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u76EE\u5F55\u540D\u79F0"}]},h.a.createElement(m.a,{defaultValue:$e,watch:!0,height:600})),h.a.createElement(M.a,{align:"middle",justify:"center"},h.a.createElement(D.a,null,h.a.createElement(K.a,{style:{width:130},size:"large",type:"primary",htmlType:"submit"},"\u4FDD\u5B58"))),h.a.createElement("div",{className:"mt40"}))))};qe.default=Object(A.a)(function(o){var x=o.user,y=o.loading,p=o.globalSetting,R=o.restful;return{user:x,globalSetting:p,restful:R,loading:y.models.index}})(d)},Y1PL:function(at,qe,ee){"use strict";ee.r(qe),ee.d(qe,"ResizableTextArea",function(){return ne});var Q=ee("wx14"),K=ee("1OyB"),L=ee("vuIU"),H=ee("Ji7U"),k=ee("LK+K"),M=ee("cDcd"),N=ee("VTBJ"),_=ee("rePB"),P=ee("Zm9Q"),D=ee("Kwbf"),c=ee("c+Xe"),v=ee("m+aA"),O=ee("bdgK"),w=new Map;function b(pe){pe.forEach(function(he){var de,fe=he.target;(de=w.get(fe))===null||de===void 0||de.forEach(function(te){return te(fe)})})}var E=new O.default(b),s=null,a=null;function l(pe,he){w.has(pe)||(w.set(pe,new Set),E.observe(pe)),w.get(pe).add(he)}function u(pe,he){w.has(pe)&&(w.get(pe).delete(he),w.get(pe).size||(E.unobserve(pe),w.delete(pe)))}var C=function(pe){Object(H.a)(de,pe);var he=Object(k.a)(de);function de(){return Object(K.a)(this,de),he.apply(this,arguments)}return Object(L.a)(de,[{key:"render",value:function(){return this.props.children}}]),de}(M.Component),g=M.createContext(null);function h(pe){var he=pe.children,de=pe.onBatchResize,fe=M.useRef(0),te=M.useRef([]),se=M.useContext(g),ye=M.useCallback(function(Me,ke,He){fe.current+=1;var $e=fe.current;te.current.push({size:Me,element:ke,data:He}),Promise.resolve().then(function(){$e===fe.current&&(de==null||de(te.current),te.current=[])}),se==null||se(Me,ke,He)},[de,se]);return M.createElement(g.Provider,{value:ye},he)}function A(pe){var he=pe.children,de=pe.disabled,fe=M.useRef(null),te=M.useRef(null),se=M.useContext(g),ye=M.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),Me=M.isValidElement(he)&&Object(c.c)(he),ke=Me?he.ref:null,He=M.useMemo(function(){return Object(c.a)(ke,fe)},[ke,fe]),$e=M.useRef(pe);$e.current=pe;var we=M.useCallback(function(De){var _e=$e.current,Be=_e.onResize,Ne=_e.data,Se=De.getBoundingClientRect(),Ce=Se.width,Ke=Se.height,Qe=De.offsetWidth,Ve=De.offsetHeight,Ue=Math.floor(Ce),tt=Math.floor(Ke);if(ye.current.width!==Ue||ye.current.height!==tt||ye.current.offsetWidth!==Qe||ye.current.offsetHeight!==Ve){var Ye={width:Ue,height:tt,offsetWidth:Qe,offsetHeight:Ve};ye.current=Ye;var Xe=Qe===Math.round(Ce)?Ce:Qe,ve=Ve===Math.round(Ke)?Ke:Ve,et=Object(N.a)(Object(N.a)({},Ye),{},{offsetWidth:Xe,offsetHeight:ve});se==null||se(et,De,Ne),Be&&Promise.resolve().then(function(){Be(et,De)})}},[]);return M.useEffect(function(){var De=Object(v.a)(fe.current)||Object(v.a)(te.current);return De&&!de&&l(De,we),function(){return u(De,we)}},[fe.current,de]),M.createElement(C,{ref:te},Me?M.cloneElement(he,{ref:He}):he)}var T="rc-observer-key";function f(pe){var he=pe.children,de=Object(P.a)(he);return de.map(function(fe,te){var se=(fe==null?void 0:fe.key)||"".concat(T,"-").concat(te);return M.createElement(A,Object(Q.a)({},pe,{key:se}),fe)})}f.Collection=h;var m=f,d=ee("bT9E"),o=ee("TSYQ"),x=ee.n(o),y=`
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"],R={},U;function B(pe){var he=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,de=pe.getAttribute("id")||pe.getAttribute("data-reactid")||pe.getAttribute("name");if(he&&R[de])return R[de];var fe=window.getComputedStyle(pe),te=fe.getPropertyValue("box-sizing")||fe.getPropertyValue("-moz-box-sizing")||fe.getPropertyValue("-webkit-box-sizing"),se=parseFloat(fe.getPropertyValue("padding-bottom"))+parseFloat(fe.getPropertyValue("padding-top")),ye=parseFloat(fe.getPropertyValue("border-bottom-width"))+parseFloat(fe.getPropertyValue("border-top-width")),Me=p.map(function(He){return"".concat(He,":").concat(fe.getPropertyValue(He))}).join(";"),ke={sizingStyle:Me,paddingSize:se,borderSize:ye,boxSizing:te};return he&&de&&(R[de]=ke),ke}function z(pe){var he=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,de=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 te=B(pe,he),se=te.paddingSize,ye=te.borderSize,Me=te.boxSizing,ke=te.sizingStyle;U.setAttribute("style","".concat(ke,";").concat(y)),U.value=pe.value||pe.placeholder||"";var He=Number.MIN_SAFE_INTEGER,$e=Number.MAX_SAFE_INTEGER,we=U.scrollHeight,De;if(Me==="border-box"?we+=ye:Me==="content-box"&&(we-=se),de!==null||fe!==null){U.value=" ";var _e=U.scrollHeight-se;de!==null&&(He=_e*de,Me==="border-box"&&(He=He+se+ye),we=Math.max(He,we)),fe!==null&&($e=_e*fe,Me==="border-box"&&($e=$e+se+ye),De=we>$e?"":"hidden",we=Math.min($e,we))}return{height:we,minHeight:He,maxHeight:$e,overflowY:De,resize:"none"}}var j=ee("Gytx"),F=ee.n(j),X;(function(pe){pe[pe.NONE=0]="NONE",pe[pe.RESIZING=1]="RESIZING",pe[pe.RESIZED=2]="RESIZED"})(X||(X={}));var q=function(pe){Object(H.a)(de,pe);var he=Object(k.a)(de);function de(fe){var te;return Object(K.a)(this,de),te=he.call(this,fe),te.nextFrameActionId=void 0,te.resizeFrameId=void 0,te.textArea=void 0,te.saveTextArea=function(se){te.textArea=se},te.handleResize=function(se){var ye=te.state.resizeStatus,Me=te.props,ke=Me.autoSize,He=Me.onResize;if(ye!==X.NONE)return;typeof He=="function"&&He(se),ke&&te.resizeOnNextFrame()},te.resizeOnNextFrame=function(){cancelAnimationFrame(te.nextFrameActionId),te.nextFrameActionId=requestAnimationFrame(te.resizeTextarea)},te.resizeTextarea=function(){var se=te.props.autoSize;if(!se||!te.textArea)return;var ye=se.minRows,Me=se.maxRows,ke=z(te.textArea,!1,ye,Me);te.setState({textareaStyles:ke,resizeStatus:X.RESIZING},function(){cancelAnimationFrame(te.resizeFrameId),te.resizeFrameId=requestAnimationFrame(function(){te.setState({resizeStatus:X.RESIZED},function(){te.resizeFrameId=requestAnimationFrame(function(){te.setState({resizeStatus:X.NONE}),te.fixFirefoxAutoScroll()})})})})},te.renderTextArea=function(){var se=te.props,ye=se.prefixCls,Me=ye===void 0?"rc-textarea":ye,ke=se.autoSize,He=se.onResize,$e=se.className,we=se.disabled,De=te.state,_e=De.textareaStyles,Be=De.resizeStatus,Ne=Object(d.a)(te.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Se=x()(Me,$e,Object(_.a)({},"".concat(Me,"-disabled"),we));"value"in Ne&&(Ne.value=Ne.value||"");var Ce=Object(N.a)(Object(N.a)(Object(N.a)({},te.props.style),_e),Be===X.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return M.createElement(m,{onResize:te.handleResize,disabled:!(ke||He)},M.createElement("textarea",Object(Q.a)({},Ne,{className:Se,style:Ce,ref:te.saveTextArea})))},te.state={textareaStyles:{},resizeStatus:X.NONE},te}return Object(L.a)(de,[{key:"componentDidUpdate",value:function(te){(te.value!==this.props.value||!F()(te.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 te=this.textArea.selectionStart,se=this.textArea.selectionEnd;this.textArea.setSelectionRange(te,se)}}catch(ye){}}},{key:"render",value:function(){return this.renderTextArea()}}]),de}(M.Component),ne=q,ue=function(pe){Object(H.a)(de,pe);var he=Object(k.a)(de);function de(fe){var te;Object(K.a)(this,de),te=he.call(this,fe),te.resizableTextArea=void 0,te.focus=function(){te.resizableTextArea.textArea.focus()},te.saveTextArea=function(ye){te.resizableTextArea=ye},te.handleChange=function(ye){var Me=te.props.onChange;te.setValue(ye.target.value,function(){te.resizableTextArea.resizeTextarea()}),Me&&Me(ye)},te.handleKeyDown=function(ye){var Me=te.props,ke=Me.onPressEnter,He=Me.onKeyDown;ye.keyCode===13&&ke&&ke(ye),He&&He(ye)};var se=typeof fe.value=="undefined"||fe.value===null?fe.defaultValue:fe.value;return te.state={value:se},te}return Object(L.a)(de,[{key:"setValue",value:function(te,se){"value"in this.props||this.setState({value:te},se)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return M.createElement(ne,Object(Q.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(te){return"value"in te?{value:te.value}:null}}]),de}(M.Component),xe=qe.default=ue},ZpRC:function(at,qe,ee){"use strict";function Q(c){return typeof c=="object"&&c!=null&&c.nodeType===1}function K(c,v){return(!v||c!=="hidden")&&c!=="visible"&&c!=="clip"}function L(c,v){if(c.clientHeight<c.scrollHeight||c.clientWidth<c.scrollWidth){var O=getComputedStyle(c,null);return K(O.overflowY,v)||K(O.overflowX,v)||function(w){var b=function(E){if(!E.ownerDocument||!E.ownerDocument.defaultView)return null;try{return E.ownerDocument.defaultView.frameElement}catch(s){return null}}(w);return!!b&&(b.clientHeight<w.scrollHeight||b.clientWidth<w.scrollWidth)}(c)}return!1}function H(c,v,O,w,b,E,s,a){return E<c&&s>v||E>c&&s<v?0:E<=c&&a<=O||s>=v&&a>=O?E-c-w:s>v&&a<O||E<c&&a>O?s-v+b:0}var k=function(c,v){var O=window,w=v.scrollMode,b=v.block,E=v.inline,s=v.boundary,a=v.skipOverflowHiddenElements,l=typeof s=="function"?s:function(_e){return _e!==s};if(!Q(c))throw new TypeError("Invalid target");for(var u=document.scrollingElement||document.documentElement,C=[],g=c;Q(g)&&l(g);){if((g=g.parentElement)===u){C.push(g);break}g!=null&&g===document.body&&L(g)&&!L(document.documentElement)||g!=null&&L(g,a)&&C.push(g)}for(var h=O.visualViewport?O.visualViewport.width:innerWidth,A=O.visualViewport?O.visualViewport.height:innerHeight,T=window.scrollX||pageXOffset,f=window.scrollY||pageYOffset,m=c.getBoundingClientRect(),d=m.height,o=m.width,x=m.top,y=m.right,p=m.bottom,R=m.left,U=b==="start"||b==="nearest"?x:b==="end"?p:x+d/2,B=E==="center"?R+o/2:E==="end"?y:R,z=[],j=0;j<C.length;j++){var F=C[j],X=F.getBoundingClientRect(),q=X.height,ne=X.width,ue=X.top,xe=X.right,pe=X.bottom,he=X.left;if(w==="if-needed"&&x>=0&&R>=0&&p<=A&&y<=h&&x>=ue&&p<=pe&&R>=he&&y<=xe)return z;var de=getComputedStyle(F),fe=parseInt(de.borderLeftWidth,10),te=parseInt(de.borderTopWidth,10),se=parseInt(de.borderRightWidth,10),ye=parseInt(de.borderBottomWidth,10),Me=0,ke=0,He="offsetWidth"in F?F.offsetWidth-F.clientWidth-fe-se:0,$e="offsetHeight"in F?F.offsetHeight-F.clientHeight-te-ye:0;if(u===F)Me=b==="start"?U:b==="end"?U-A:b==="nearest"?H(f,f+A,A,te,ye,f+U,f+U+d,d):U-A/2,ke=E==="start"?B:E==="center"?B-h/2:E==="end"?B-h:H(T,T+h,h,fe,se,T+B,T+B+o,o),Me=Math.max(0,Me+f),ke=Math.max(0,ke+T);else{Me=b==="start"?U-ue-te:b==="end"?U-pe+ye+$e:b==="nearest"?H(ue,pe,q,te,ye+$e,U,U+d,d):U-(ue+q/2)+$e/2,ke=E==="start"?B-he-fe:E==="center"?B-(he+ne/2)+He/2:E==="end"?B-xe+se+He:H(he,xe,ne,fe,se+He,B,B+o,o);var we=F.scrollLeft,De=F.scrollTop;U+=De-(Me=Math.max(0,Math.min(De+Me,F.scrollHeight-q+$e))),B+=we-(ke=Math.max(0,Math.min(we+ke,F.scrollWidth-ne+He)))}z.push({el:F,top:Me,left:ke})}return z};function M(c){return c===Object(c)&&Object.keys(c).length!==0}function N(c,v){v===void 0&&(v="auto");var O="scrollBehavior"in document.body.style;c.forEach(function(w){var b=w.el,E=w.top,s=w.left;b.scroll&&O?b.scroll({top:E,left:s,behavior:v}):(b.scrollTop=E,b.scrollLeft=s)})}function _(c){return c===!1?{block:"end",inline:"nearest"}:M(c)?c:{block:"start",inline:"nearest"}}function P(c,v){var O=!c.ownerDocument.documentElement.contains(c);if(M(v)&&typeof v.behavior=="function")return v.behavior(O?[]:k(c,v));if(O)return;var w=_(v);return N(k(c,w),w.behavior)}var D=qe.a=P},aRTE:function(at,qe){at.exports={L:1,M:0,Q:3,H:2}},bT9E:function(at,qe,ee){"use strict";ee.d(qe,"a",function(){return K});var Q=ee("VTBJ");function K(L,H){var k=Object(Q.a)({},L);return Array.isArray(H)&&H.forEach(function(M){delete k[M]}),k}},c5Ni:function(at,qe,ee){},dQei:function(at,qe){for(var ee={glog:function(K){if(K<1)throw new Error("glog("+K+")");return ee.LOG_TABLE[K]},gexp:function(K){for(;K<0;)K+=255;for(;K>=256;)K-=255;return ee.EXP_TABLE[K]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)},Q=0;Q<8;Q++)ee.EXP_TABLE[Q]=1<<Q;for(var Q=8;Q<256;Q++)ee.EXP_TABLE[Q]=ee.EXP_TABLE[Q-4]^ee.EXP_TABLE[Q-5]^ee.EXP_TABLE[Q-6]^ee.EXP_TABLE[Q-8];for(var Q=0;Q<255;Q++)ee.LOG_TABLE[ee.EXP_TABLE[Q]]=Q;at.exports=ee},dWSS:function(at,qe,ee){var Q=ee("dQei");function K(L,H){if(L.length==null)throw new Error(L.length+"/"+H);for(var k=0;k<L.length&&L[k]==0;)k++;this.num=new Array(L.length-k+H);for(var M=0;M<L.length-k;M++)this.num[M]=L[M+k]}K.prototype={get:function(L){return this.num[L]},getLength:function(){return this.num.length},multiply:function(L){for(var H=new Array(this.getLength()+L.getLength()-1),k=0;k<this.getLength();k++)for(var M=0;M<L.getLength();M++)H[k+M]^=Q.gexp(Q.glog(this.get(k))+Q.glog(L.get(M)));return new K(H,0)},mod:function(L){if(this.getLength()-L.getLength()<0)return this;for(var H=Q.glog(this.get(0))-Q.glog(L.get(0)),k=new Array(this.getLength()),M=0;M<this.getLength();M++)k[M]=this.get(M);for(var M=0;M<L.getLength();M++)k[M]^=Q.gexp(Q.glog(L.get(M))+H);return new K(k,0).mod(L)}},at.exports=K},dejd:function(at,qe,ee){},dmUQ:function(at,qe,ee){"use strict";var Q=ee("Ff2n"),K=ee("rePB"),L=ee("1OyB"),H=ee("vuIU"),k=ee("Ji7U"),M=ee("md7G"),N=ee("foSv"),_=ee("cDcd"),P=ee.n(_),D=ee("TSYQ"),c=ee.n(D),v=ee("4IlW");function O(d,o){var x=Object.keys(d);if(Object.getOwnPropertySymbols){var y=Object.getOwnPropertySymbols(d);o&&(y=y.filter(function(p){return Object.getOwnPropertyDescriptor(d,p).enumerable})),x.push.apply(x,y)}return x}function w(d){for(var o=1;o<arguments.length;o++){var x=arguments[o]!=null?arguments[o]:{};o%2?O(Object(x),!0).forEach(function(y){Object(K.a)(d,y,x[y])}):Object.getOwnPropertyDescriptors?Object.defineProperties(d,Object.getOwnPropertyDescriptors(x)):O(Object(x)).forEach(function(y){Object.defineProperty(d,y,Object.getOwnPropertyDescriptor(x,y))})}return d}function b(d){var o=E();return function(){var y=Object(N.a)(d),p;if(o){var R=Object(N.a)(this).constructor;p=Reflect.construct(y,arguments,R)}else p=y.apply(this,arguments);return Object(M.a)(this,p)}}function E(){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(d){return!1}}function s(){}function a(d){d.preventDefault()}var l=function(o){return o.replace(/[^\w.-]+/g,"")},u=200,C=600,g=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,h=function(o){return o!=null},A=function(o,x){return x===o||typeof x=="number"&&typeof o=="number"&&isNaN(x)&&isNaN(o)},T=function(d){Object(k.a)(x,d);var o=b(x);function x(y){var p;Object(L.a)(this,x),p=o.call(this,y),p.onKeyDown=function(B){var z=p.props,j=z.onKeyDown,F=z.onPressEnter;if(B.keyCode===v.a.UP){var X=p.getRatio(B);p.up(B,X,null),p.stop()}else if(B.keyCode===v.a.DOWN){var q=p.getRatio(B);p.down(B,q,null),p.stop()}else B.keyCode===v.a.ENTER&&F&&F(B);if(p.recordCursorPosition(),p.lastKeyCode=B.keyCode,j){for(var ne=arguments.length,ue=new Array(ne>1?ne-1:0),xe=1;xe<ne;xe++)ue[xe-1]=arguments[xe];j.apply(void 0,[B].concat(ue))}},p.onKeyUp=function(B){var z=p.props.onKeyUp;if(p.stop(),p.recordCursorPosition(),z){for(var j=arguments.length,F=new Array(j>1?j-1:0),X=1;X<j;X++)F[X-1]=arguments[X];z.apply(void 0,[B].concat(F))}},p.onChange=function(B){var z=p.props.onChange;p.state.focused&&(p.inputting=!0),p.rawInput=p.props.parser(p.getValueFromEvent(B)),p.setState({inputValue:p.rawInput}),z(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 z=p.getCurrentValidValue(p.state.inputValue),j=p.setValue(z,s);if(B){var F=p.input.value,X=p.getInputDisplayValue({focus:!1,value:j});p.input.value=X&&Number(X),B.apply(void 0,arguments),p.input.value=F}},p.getRatio=function(B){var z=1;return B.metaKey||B.ctrlKey?z=.1:B.shiftKey&&(z=10),z},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(h(p.props.precision))return p.props.precision;var z=String(B);if(z.indexOf("e-")>=0)return parseInt(z.slice(z.indexOf("e-")+2),10);var j=0;return z.indexOf(".")>=0&&(j=z.length-z.indexOf(".")-1),j},p.getInputDisplayValue=function(B){var z=B||p.state,j=z.focused,F=z.inputValue,X=z.value,q;j?q=F:q=p.toPrecisionAsStep(X),q==null&&(q="");var ne=p.formatWrapper(q);return h(p.props.decimalSeparator)&&(ne=ne.toString().replace(".",p.props.decimalSeparator)),ne},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 z=p.input.value,j=z.lastIndexOf(B);if(j===-1)return!1;var F=p.cursorBefore.length;return p.lastKeyCode===v.a.DELETE&&p.cursorBefore.charAt(F-1)===B[0]?(p.fixCaret(F,F),!0):j+B.length===z.length?(p.fixCaret(j,j),!0):!1},p.partRestoreByAfter=function(B){return B===void 0?!1:Array.prototype.some.call(B,function(z,j){var F=B.substring(j);return p.restoreByAfter(F)})},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,z,j){p.pressingUpOrDown=!0,p.step("down",B,z,j)},p.up=function(B,z,j){p.pressingUpOrDown=!0,p.step("up",B,z,j)},p.saveInput=function(B){p.input=B};var R=y.value;R===void 0&&(R=y.defaultValue),p.state={focused:y.autoFocus};var U=p.getValidValue(p.toNumber(R));return p.state=w(w({},p.state),{},{inputValue:p.toPrecisionAsStep(U),value:U}),p}return Object(H.a)(x,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(p){var R=this.props,U=R.value,B=R.onChange,z=R.max,j=R.min,F=this.state.focused;if(p){if(!A(p.value,U)||!A(p.max,z)||!A(p.min,j)){var X=F?U:this.getValidValue(U),q;this.pressingUpOrDown?q=X:this.inputting?q=this.rawInput:q=this.toPrecisionAsStep(X),this.setState({value:X,inputValue:q})}var ne="value"in this.props?U:this.state.value;"max"in this.props&&p.max!==z&&typeof ne=="number"&&ne>z&&B&&B(z),"min"in this.props&&p.min!==j&&typeof ne=="number"&&ne<j&&B&&B(j)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var ue=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===v.a.BACKSPACE?ue=this.cursorStart-1:this.lastKeyCode===v.a.DELETE&&(ue=this.cursorStart):ue=this.input.value.length,this.fixCaret(ue,ue)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case v.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case v.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(xe){}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 R=p;return R===""?R="":this.isNotCompleteNumber(parseFloat(R))?R=this.state.value:R=this.getValidValue(R),this.toNumber(R)}},{key:"getValueFromEvent",value:function(p){var R=p.target.value.trim().replace(/。/g,".");return h(this.props.decimalSeparator)&&(R=R.replace(this.props.decimalSeparator,".")),R}},{key:"getValidValue",value:function(p){var R=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<R&&(B=R),B>U&&(B=U),B)}},{key:"setValue",value:function(p,R){var U=this.props.precision,B=this.isNotCompleteNumber(parseFloat(p))?null:parseFloat(p),z=this.state.value,j=z===void 0?null:z,F=this.state.inputValue,X=F===void 0?null:F,q=typeof B=="number"?B.toFixed(U):"".concat(B),ne=B!==j||q!=="".concat(X);return"value"in this.props?(X=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:X},R)):this.setState({value:B,inputValue:this.toPrecisionAsStep(p)},R),ne&&this.props.onChange(B),B}},{key:"getMaxPrecision",value:function(p){var R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,U=this.props,B=U.precision,z=U.step;if(h(B))return B;var j=this.getPrecision(R),F=this.getPrecision(z),X=this.getPrecision(p);return p?Math.max(X,j+F):j+F}},{key:"getPrecisionFactor",value:function(p){var R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,U=this.getMaxPrecision(p,R);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 R=Math.abs(this.getMaxPrecision(p));return isNaN(R)?p.toString():Number(p).toFixed(R)}},{key:"toNumber",value:function(p){var R=this.props.precision,U=this.state.focused,B=p&&p.length>16&&U;return this.isNotCompleteNumber(p)||B?p:h(R)?Math.round(p*Math.pow(10,R))/Math.pow(10,R):Number(p)}},{key:"upStep",value:function(p,R){var U=this.props.step,B=this.getPrecisionFactor(p,R),z=Math.abs(this.getMaxPrecision(p,R)),j=((B*p+B*U*R)/B).toFixed(z);return this.toNumber(j)}},{key:"downStep",value:function(p,R){var U=this.props.step,B=this.getPrecisionFactor(p,R),z=Math.abs(this.getMaxPrecision(p,R)),j=((B*p-B*U*R)/B).toFixed(z);return this.toNumber(j)}},{key:"step",value:function(p,R){var U=this,B=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,z=arguments.length>3?arguments[3]:void 0;this.stop(),R&&(R.persist(),R.preventDefault());var j=this.props;if(j.disabled)return;var F=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(F))return;var X=this["".concat(p,"Step")](F,B),q=X>j.max||X<j.min;if(X>j.max?X=j.max:X<j.min&&(X=j.min),this.setValue(X,null),this.setState({focused:!0},function(){U.pressingUpOrDown=!1}),q)return;this.autoStepTimer=setTimeout(function(){U[p](R,B,!0)},z?u:C)}},{key:"fixCaret",value:function(p,R){if(p===void 0||R===void 0||!this.input||!this.input.value)return;try{var U=this.input.selectionStart,B=this.input.selectionEnd;(p!==U||R!==B)&&this.input.setSelectionRange(p,R)}catch(z){}}},{key:"render",value:function(){var p,R=this.props,U=R.prefixCls,B=R.disabled,z=R.readOnly,j=R.useTouch,F=R.autoComplete,X=R.upHandler,q=R.downHandler,ne=R.className,ue=R.max,xe=R.min,pe=R.style,he=R.title,de=R.onMouseEnter,fe=R.onMouseLeave,te=R.onMouseOver,se=R.onMouseOut,ye=R.required,Me=R.onClick,ke=R.tabIndex,He=R.type,$e=R.placeholder,we=R.id,De=R.inputMode,_e=R.pattern,Be=R.step,Ne=R.maxLength,Se=R.autoFocus,Ce=R.name,Ke=R.onPaste,Qe=R.onInput,Ve=Object(Q.a)(R,["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"]),Ue=this.state,tt=Ue.value,Ye=Ue.focused,Xe=c()(U,(p={},Object(K.a)(p,ne,!!ne),Object(K.a)(p,"".concat(U,"-disabled"),B),Object(K.a)(p,"".concat(U,"-focused"),Ye),p)),ve={};Object.keys(Ve).forEach(function(re){(re.substr(0,5)==="data-"||re.substr(0,5)==="aria-"||re==="role")&&(ve[re]=Ve[re])});var et=!z&&!B,Ge=this.getInputDisplayValue(null),be=(tt||tt===0)&&(isNaN(tt)||Number(tt)>=ue),Oe=(tt||tt===0)&&(isNaN(tt)||Number(tt)<=xe),le=be||B||z,ae=Oe||B||z,oe=c()("".concat(U,"-handler"),"".concat(U,"-handler-up"),Object(K.a)({},"".concat(U,"-handler-up-disabled"),le)),Y=c()("".concat(U,"-handler"),"".concat(U,"-handler-down"),Object(K.a)({},"".concat(U,"-handler-down-disabled"),ae)),$=j?{onTouchStart:le?s:this.up,onTouchEnd:this.stop}:{onMouseDown:le?s:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},J=j?{onTouchStart:ae?s:this.down,onTouchEnd:this.stop}:{onMouseDown:ae?s:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return P.a.createElement("div",{className:Xe,style:pe,title:he,onMouseEnter:de,onMouseLeave:fe,onMouseOver:te,onMouseOut:se,onFocus:function(){return null},onBlur:function(){return null}},P.a.createElement("div",{className:"".concat(U,"-handler-wrap")},P.a.createElement("span",Object.assign({unselectable:"on"},$,{role:"button","aria-label":"Increase Value","aria-disabled":le,className:oe}),X||P.a.createElement("span",{unselectable:"on",className:"".concat(U,"-handler-up-inner"),onClick:a})),P.a.createElement("span",Object.assign({unselectable:"on"},J,{role:"button","aria-label":"Decrease Value","aria-disabled":ae,className:Y}),q||P.a.createElement("span",{unselectable:"on",className:"".concat(U,"-handler-down-inner"),onClick:a}))),P.a.createElement("div",{className:"".concat(U,"-input-wrap")},P.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":xe,"aria-valuemax":ue,"aria-valuenow":tt,required:ye,type:He,placeholder:$e,onPaste:Ke,onClick:Me,onMouseUp:this.onMouseUp,className:"".concat(U,"-input"),tabIndex:ke,autoComplete:F,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:et?this.onKeyDown:s,onKeyUp:et?this.onKeyUp:s,autoFocus:Se,maxLength:Ne,readOnly:z,disabled:B,max:ue,min:xe,step:Be,name:Ce,title:he,id:we,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(Ge),pattern:_e,inputMode:De,onInput:Qe},ve))))}}]),x}(P.a.Component);T.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:g,min:-g,step:1,style:{},onChange:s,onKeyDown:s,onPressEnter:s,onFocus:s,onBlur:s,parser:l,required:!1,autoComplete:"off"};var f=T,m=qe.a=f},f4xo:function(at,qe,ee){var Q=ee("nVVt");function K(L){this.mode=Q.MODE_8BIT_BYTE,this.data=L}K.prototype={getLength:function(L){return this.data.length},write:function(L){for(var H=0;H<this.data.length;H++)L.put(this.data.charCodeAt(H),8)}},at.exports=K},kSUc:function(at,qe,ee){},lZu9:function(at,qe,ee){(function(Q){Q(ee("VrN/"),ee("1eCo"),ee("8EBN"))})(function(Q){"use strict";Q.defineMode("markdown",function(K,L){var H=Q.getMode(K,"text/html"),k=H.name=="null";function M(j){if(Q.findModeByName){var F=Q.findModeByName(j);F&&(j=F.mime||F.mimes[0])}var X=Q.getMode(K,j);return X.name=="null"?null:X}L.highlightFormatting===void 0&&(L.highlightFormatting=!1),L.maxBlockquoteDepth===void 0&&(L.maxBlockquoteDepth=0),L.taskLists===void 0&&(L.taskLists=!1),L.strikethrough===void 0&&(L.strikethrough=!1),L.emoji===void 0&&(L.emoji=!1),L.fencedCodeBlockHighlighting===void 0&&(L.fencedCodeBlockHighlighting=!0),L.fencedCodeBlockDefaultMode===void 0&&(L.fencedCodeBlockDefaultMode="text/plain"),L.xml===void 0&&(L.xml=!0),L.tokenTypeOverrides===void 0&&(L.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 _ in N)N.hasOwnProperty(_)&&L.tokenTypeOverrides[_]&&(N[_]=L.tokenTypeOverrides[_]);var P=/^([*\-_])(?:\s*\1){2,}\s*$/,D=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,c=/^\[(x| )\](?=\s)/i,v=L.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,O=/^ {0,3}(?:\={1,}|-{2,})\s*$/,w=/^[^#!\[\]*_\\<>` "'(~:]+/,b=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,E=/^\s*\[[^\]]+?\]:.*$/,s=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\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]/,a=" ";function l(j,F,X){return F.f=F.inline=X,X(j,F)}function u(j,F,X){return F.f=F.block=X,X(j,F)}function C(j){return!j||!/\S/.test(j.string)}function g(j){if(j.linkTitle=!1,j.linkHref=!1,j.linkText=!1,j.em=!1,j.strong=!1,j.strikethrough=!1,j.quote=0,j.indentedCode=!1,j.f==A){var F=k;if(!F){var X=Q.innerMode(H,j.htmlState);F=X.mode.name=="xml"&&X.state.tagStart===null&&!X.state.context&&X.state.tokenize.isInText}F&&(j.f=d,j.block=h,j.htmlState=null)}return j.trailingSpace=0,j.trailingSpaceNewLine=!1,j.prevLine=j.thisLine,j.thisLine={stream:null},null}function h(j,F){var X=j.column()===F.indentation,q=C(F.prevLine.stream),ne=F.indentedCode,ue=F.prevLine.hr,xe=F.list!==!1,pe=(F.listStack[F.listStack.length-1]||0)+3;F.indentedCode=!1;var he=F.indentation;if(F.indentationDiff===null&&(F.indentationDiff=F.indentation,xe)){for(F.list=null;he<F.listStack[F.listStack.length-1];)F.listStack.pop(),F.listStack.length?F.indentation=F.listStack[F.listStack.length-1]:F.list=!1;F.list!==!1&&(F.indentationDiff=he-F.listStack[F.listStack.length-1])}var de=!q&&!ue&&!F.prevLine.header&&(!xe||!ne)&&!F.prevLine.fencedCodeEnd,fe=(F.list===!1||ue||q)&&F.indentation<=pe&&j.match(P),te=null;if(F.indentationDiff>=4&&(ne||F.prevLine.fencedCodeEnd||F.prevLine.header||q))return j.skipToEnd(),F.indentedCode=!0,N.code;if(j.eatSpace())return null;if(X&&F.indentation<=pe&&(te=j.match(v))&&te[1].length<=6)return F.quote=0,F.header=te[1].length,F.thisLine.header=!0,L.highlightFormatting&&(F.formatting="header"),F.f=F.inline,f(F);if(F.indentation<=pe&&j.eat(">"))return F.quote=X?1:F.quote+1,L.highlightFormatting&&(F.formatting="quote"),j.eatSpace(),f(F);if(!fe&&!F.setext&&X&&F.indentation<=pe&&(te=j.match(D))){var se=te[1]?"ol":"ul";return F.indentation=he+j.current().length,F.list=!0,F.quote=0,F.listStack.push(F.indentation),F.em=!1,F.strong=!1,F.code=!1,F.strikethrough=!1,L.taskLists&&j.match(c,!1)&&(F.taskList=!0),F.f=F.inline,L.highlightFormatting&&(F.formatting=["list","list-"+se]),f(F)}else{if(X&&F.indentation<=pe&&(te=j.match(b,!0)))return F.quote=0,F.fencedEndRE=new RegExp(te[1]+"+ *$"),F.localMode=L.fencedCodeBlockHighlighting&&M(te[2]||L.fencedCodeBlockDefaultMode),F.localMode&&(F.localState=Q.startState(F.localMode)),F.f=F.block=T,L.highlightFormatting&&(F.formatting="code-block"),F.code=-1,f(F);if(F.setext||(!de||!xe)&&!F.quote&&F.list===!1&&!F.code&&!fe&&!E.test(j.string)&&(te=j.lookAhead(1))&&(te=te.match(O)))return F.setext?(F.header=F.setext,F.setext=0,j.skipToEnd(),L.highlightFormatting&&(F.formatting="header")):(F.header=te[0].charAt(0)=="="?1:2,F.setext=F.header),F.thisLine.header=!0,F.f=F.inline,f(F);if(fe)return j.skipToEnd(),F.hr=!0,F.thisLine.hr=!0,N.hr;if(j.peek()==="[")return l(j,F,R)}return l(j,F,F.inline)}function A(j,F){var X=H.token(j,F.htmlState);if(!k){var q=Q.innerMode(H,F.htmlState);(q.mode.name=="xml"&&q.state.tagStart===null&&!q.state.context&&q.state.tokenize.isInText||F.md_inside&&j.current().indexOf(">")>-1)&&(F.f=d,F.block=h,F.htmlState=null)}return X}function T(j,F){var X=F.listStack[F.listStack.length-1]||0,q=F.indentation<X,ne=X+3;if(F.fencedEndRE&&F.indentation<=ne&&(q||j.match(F.fencedEndRE))){L.highlightFormatting&&(F.formatting="code-block");var ue;return q||(ue=f(F)),F.localMode=F.localState=null,F.block=h,F.f=d,F.fencedEndRE=null,F.code=0,F.thisLine.fencedCodeEnd=!0,q?u(j,F,F.block):ue}else return F.localMode?F.localMode.token(j,F.localState):(j.skipToEnd(),N.code)}function f(j){var F=[];if(j.formatting){F.push(N.formatting),typeof j.formatting=="string"&&(j.formatting=[j.formatting]);for(var X=0;X<j.formatting.length;X++)F.push(N.formatting+"-"+j.formatting[X]),j.formatting[X]==="header"&&F.push(N.formatting+"-"+j.formatting[X]+"-"+j.header),j.formatting[X]==="quote"&&(!L.maxBlockquoteDepth||L.maxBlockquoteDepth>=j.quote?F.push(N.formatting+"-"+j.formatting[X]+"-"+j.quote):F.push("error"))}if(j.taskOpen)return F.push("meta"),F.length?F.join(" "):null;if(j.taskClosed)return F.push("property"),F.length?F.join(" "):null;if(j.linkHref?F.push(N.linkHref,"url"):(j.strong&&F.push(N.strong),j.em&&F.push(N.em),j.strikethrough&&F.push(N.strikethrough),j.emoji&&F.push(N.emoji),j.linkText&&F.push(N.linkText),j.code&&F.push(N.code),j.image&&F.push(N.image),j.imageAltText&&F.push(N.imageAltText,"link"),j.imageMarker&&F.push(N.imageMarker)),j.header&&F.push(N.header,N.header+"-"+j.header),j.quote&&(F.push(N.quote),!L.maxBlockquoteDepth||L.maxBlockquoteDepth>=j.quote?F.push(N.quote+"-"+j.quote):F.push(N.quote+"-"+L.maxBlockquoteDepth)),j.list!==!1){var q=(j.listStack.length-1)%3;q?q===1?F.push(N.list2):F.push(N.list3):F.push(N.list1)}return j.trailingSpaceNewLine?F.push("trailing-space-new-line"):j.trailingSpace&&F.push("trailing-space-"+(j.trailingSpace%2?"a":"b")),F.length?F.join(" "):null}function m(j,F){return j.match(w,!0)?f(F):void 0}function d(j,F){var X=F.text(j,F);if(typeof X!="undefined")return X;if(F.list)return F.list=null,f(F);if(F.taskList){var q=j.match(c,!0)[1]===" ";return q?F.taskOpen=!0:F.taskClosed=!0,L.highlightFormatting&&(F.formatting="task"),F.taskList=!1,f(F)}if(F.taskOpen=!1,F.taskClosed=!1,F.header&&j.match(/^#+$/,!0))return L.highlightFormatting&&(F.formatting="header"),f(F);var ne=j.next();if(F.linkTitle){F.linkTitle=!1;var ue=ne;ne==="("&&(ue=")"),ue=(ue+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var xe="^\\s*(?:[^"+ue+"\\\\]+|\\\\\\\\|\\\\.)"+ue;if(j.match(new RegExp(xe),!0))return N.linkHref}if(ne==="`"){var pe=F.formatting;L.highlightFormatting&&(F.formatting="code"),j.eatWhile("`");var he=j.current().length;if(F.code==0&&(!F.quote||he==1))return F.code=he,f(F);if(he==F.code){var de=f(F);return F.code=0,de}else return F.formatting=pe,f(F)}else if(F.code)return f(F);if(ne==="\\"&&(j.next(),L.highlightFormatting)){var fe=f(F),te=N.formatting+"-escape";return fe?fe+" "+te:te}if(ne==="!"&&j.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return F.imageMarker=!0,F.image=!0,L.highlightFormatting&&(F.formatting="image"),f(F);if(ne==="["&&F.imageMarker&&j.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return F.imageMarker=!1,F.imageAltText=!0,L.highlightFormatting&&(F.formatting="image"),f(F);if(ne==="]"&&F.imageAltText){L.highlightFormatting&&(F.formatting="image");var fe=f(F);return F.imageAltText=!1,F.image=!1,F.inline=F.f=x,fe}if(ne==="["&&!F.image)return F.linkText&&j.match(/^.*?\]/)||(F.linkText=!0,L.highlightFormatting&&(F.formatting="link")),f(F);if(ne==="]"&&F.linkText){L.highlightFormatting&&(F.formatting="link");var fe=f(F);return F.linkText=!1,F.inline=F.f=j.match(/\(.*?\)| ?\[.*?\]/,!1)?x:d,fe}if(ne==="<"&&j.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){F.f=F.inline=o,L.highlightFormatting&&(F.formatting="link");var fe=f(F);return fe?fe+=" ":fe="",fe+N.linkInline}if(ne==="<"&&j.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){F.f=F.inline=o,L.highlightFormatting&&(F.formatting="link");var fe=f(F);return fe?fe+=" ":fe="",fe+N.linkEmail}if(L.xml&&ne==="<"&&j.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var se=j.string.indexOf(">",j.pos);if(se!=-1){var ye=j.string.substring(j.start,se);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(ye)&&(F.md_inside=!0)}return j.backUp(1),F.htmlState=Q.startState(H),u(j,F,A)}if(L.xml&&ne==="<"&&j.match(/^\/\w*?>/))return F.md_inside=!1,"tag";if(ne==="*"||ne==="_"){for(var Me=1,ke=j.pos==1?" ":j.string.charAt(j.pos-2);Me<3&&j.eat(ne);)Me++;var He=j.peek()||" ",$e=!/\s/.test(He)&&(!s.test(He)||/\s/.test(ke)||s.test(ke)),we=!/\s/.test(ke)&&(!s.test(ke)||/\s/.test(He)||s.test(He)),De=null,_e=null;if(Me%2&&(!F.em&&$e&&(ne==="*"||!we||s.test(ke))?De=!0:F.em==ne&&we&&(ne==="*"||!$e||s.test(He))&&(De=!1)),Me>1&&(!F.strong&&$e&&(ne==="*"||!we||s.test(ke))?_e=!0:F.strong==ne&&we&&(ne==="*"||!$e||s.test(He))&&(_e=!1)),_e!=null||De!=null){L.highlightFormatting&&(F.formatting=De==null?"strong":_e==null?"em":"strong em"),De===!0&&(F.em=ne),_e===!0&&(F.strong=ne);var de=f(F);return De===!1&&(F.em=!1),_e===!1&&(F.strong=!1),de}}else if(ne===" "&&(j.eat("*")||j.eat("_"))){if(j.peek()===" ")return f(F);j.backUp(1)}if(L.strikethrough){if(ne==="~"&&j.eatWhile(ne)){if(F.strikethrough){L.highlightFormatting&&(F.formatting="strikethrough");var de=f(F);return F.strikethrough=!1,de}else if(j.match(/^[^\s]/,!1))return F.strikethrough=!0,L.highlightFormatting&&(F.formatting="strikethrough"),f(F)}else if(ne===" "&&j.match(/^~~/,!0)){if(j.peek()===" ")return f(F);j.backUp(2)}}if(L.emoji&&ne===":"&&j.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){F.emoji=!0,L.highlightFormatting&&(F.formatting="emoji");var Be=f(F);return F.emoji=!1,Be}return ne===" "&&(j.match(/^ +$/,!1)?F.trailingSpace++:F.trailingSpace&&(F.trailingSpaceNewLine=!0)),f(F)}function o(j,F){var X=j.next();if(X===">"){F.f=F.inline=d,L.highlightFormatting&&(F.formatting="link");var q=f(F);return q?q+=" ":q="",q+N.linkInline}return j.match(/^[^>]+/,!0),N.linkInline}function x(j,F){if(j.eatSpace())return null;var X=j.next();return X==="("||X==="["?(F.f=F.inline=p(X==="("?")":"]"),L.highlightFormatting&&(F.formatting="link-string"),F.linkHref=!0,f(F)):"error"}var y={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function p(j){return function(F,X){var q=F.next();if(q===j){X.f=X.inline=d,L.highlightFormatting&&(X.formatting="link-string");var ne=f(X);return X.linkHref=!1,ne}return F.match(y[j]),X.linkHref=!0,f(X)}}function R(j,F){return j.match(/^([^\]\\]|\\.)*\]:/,!1)?(F.f=U,j.next(),L.highlightFormatting&&(F.formatting="link"),F.linkText=!0,f(F)):l(j,F,d)}function U(j,F){if(j.match(/^\]:/,!0)){F.f=F.inline=B,L.highlightFormatting&&(F.formatting="link");var X=f(F);return F.linkText=!1,X}return j.match(/^([^\]\\]|\\.)+/,!0),N.linkText}function B(j,F){return j.eatSpace()?null:(j.match(/^[^\s]+/,!0),j.peek()===void 0?F.linkTitle=!0:j.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),F.f=F.inline=d,N.linkHref+" url")}var z={startState:function(){return{f:h,prevLine:{stream:null},thisLine:{stream:null},block:h,htmlState:null,indentation:0,inline:d,text:m,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(j){return{f:j.f,prevLine:j.prevLine,thisLine:j.thisLine,block:j.block,htmlState:j.htmlState&&Q.copyState(H,j.htmlState),indentation:j.indentation,localMode:j.localMode,localState:j.localMode?Q.copyState(j.localMode,j.localState):null,inline:j.inline,text:j.text,formatting:!1,linkText:j.linkText,linkTitle:j.linkTitle,linkHref:j.linkHref,code:j.code,em:j.em,strong:j.strong,strikethrough:j.strikethrough,emoji:j.emoji,header:j.header,setext:j.setext,hr:j.hr,taskList:j.taskList,list:j.list,listStack:j.listStack.slice(0),quote:j.quote,indentedCode:j.indentedCode,trailingSpace:j.trailingSpace,trailingSpaceNewLine:j.trailingSpaceNewLine,md_inside:j.md_inside,fencedEndRE:j.fencedEndRE}},token:function(j,F){if(F.formatting=!1,j!=F.thisLine.stream){if(F.header=0,F.hr=!1,j.match(/^\s*$/,!0))return g(F),null;if(F.prevLine=F.thisLine,F.thisLine={stream:j},F.taskList=!1,F.trailingSpace=0,F.trailingSpaceNewLine=!1,!F.localState&&(F.f=F.block,F.f!=A)){var X=j.match(/^\s*/,!0)[0].replace(/\t/g,a).length;if(F.indentation=X,F.indentationDiff=null,X>0)return null}}return F.f(j,F)},innerMode:function(j){return j.block==A?{state:j.htmlState,mode:H}:j.localState?{state:j.localState,mode:j.localMode}:{state:j,mode:z}},indent:function(j,F,X){return j.block==A&&H.indent?H.indent(j.htmlState,F,X):j.localState&&j.localMode.indent?j.localMode.indent(j.localState,F,X):Q.Pass},blankLine:g,getType:f,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return z},"xml"),Q.defineMIME("text/markdown","markdown"),Q.defineMIME("text/x-markdown","markdown")})},nVVt:function(at,qe){at.exports={MODE_NUMBER:1<<0,MODE_ALPHA_NUM:1<<1,MODE_8BIT_BYTE:1<<2,MODE_KANJI:1<<3}},osHv:function(at,qe,ee){(function(Q){Q(ee("VrN/"))})(function(Q){"use strict";var K=Q.Pos;function L(s,a){return s.line-a.line||s.ch-a.ch}var H="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",k=H+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",M=new RegExp("<(/?)(["+H+"]["+k+"]*)","g");function N(s,a,l,u){this.line=a,this.ch=l,this.cm=s,this.text=s.getLine(a),this.min=u?Math.max(u.from,s.firstLine()):s.firstLine(),this.max=u?Math.min(u.to-1,s.lastLine()):s.lastLine()}function _(s,a){var l=s.cm.getTokenTypeAt(K(s.line,a));return l&&/\btag\b/.test(l)}function P(s){return s.line>=s.max?void 0:(s.ch=0,s.text=s.cm.getLine(++s.line),!0)}function D(s){return s.line<=s.min?void 0:(s.text=s.cm.getLine(--s.line),s.ch=s.text.length,!0)}function c(s){for(;;){var a=s.text.indexOf(">",s.ch);if(a==-1){if(P(s))continue;return}if(!_(s,a+1)){s.ch=a+1;continue}var l=s.text.lastIndexOf("/",a),u=l>-1&&!/\S/.test(s.text.slice(l+1,a));return s.ch=a+1,u?"selfClose":"regular"}}function v(s){for(;;){var a=s.ch?s.text.lastIndexOf("<",s.ch-1):-1;if(a==-1){if(D(s))continue;return}if(!_(s,a+1)){s.ch=a;continue}M.lastIndex=a,s.ch=a;var l=M.exec(s.text);if(l&&l.index==a)return l}}function O(s){for(;;){M.lastIndex=s.ch;var a=M.exec(s.text);if(!a){if(P(s))continue;return}if(!_(s,a.index+1)){s.ch=a.index+1;continue}return s.ch=a.index+a[0].length,a}}function w(s){for(;;){var a=s.ch?s.text.lastIndexOf(">",s.ch-1):-1;if(a==-1){if(D(s))continue;return}if(!_(s,a+1)){s.ch=a;continue}var l=s.text.lastIndexOf("/",a),u=l>-1&&!/\S/.test(s.text.slice(l+1,a));return s.ch=a+1,u?"selfClose":"regular"}}function b(s,a){for(var l=[];;){var u=O(s),C,g=s.line,h=s.ch-(u?u[0].length:0);if(!u||!(C=c(s)))return;if(C=="selfClose")continue;if(u[1]){for(var A=l.length-1;A>=0;--A)if(l[A]==u[2]){l.length=A;break}if(A<0&&(!a||a==u[2]))return{tag:u[2],from:K(g,h),to:K(s.line,s.ch)}}else l.push(u[2])}}function E(s,a){for(var l=[];;){var u=w(s);if(!u)return;if(u=="selfClose"){v(s);continue}var C=s.line,g=s.ch,h=v(s);if(!h)return;if(h[1])l.push(h[2]);else{for(var A=l.length-1;A>=0;--A)if(l[A]==h[2]){l.length=A;break}if(A<0&&(!a||a==h[2]))return{tag:h[2],from:K(s.line,s.ch),to:K(C,g)}}}}Q.registerHelper("fold","xml",function(s,a){for(var l=new N(s,a.line,0);;){var u=O(l);if(!u||l.line!=a.line)return;var C=c(l);if(!C)return;if(!u[1]&&C!="selfClose"){var g=K(l.line,l.ch),h=b(l,u[2]);return h&&L(h.from,g)>0?{from:g,to:h.from}:null}}}),Q.findMatchingTag=function(s,a,l){var u=new N(s,a.line,a.ch,l);if(u.text.indexOf(">")==-1&&u.text.indexOf("<")==-1)return;var C=c(u),g=C&&K(u.line,u.ch),h=C&&v(u);if(!C||!h||L(u,a)>0)return;var A={from:K(u.line,u.ch),to:g,tag:h[2]};return C=="selfClose"?{open:A,close:null,at:"open"}:h[1]?{open:E(u,h[2]),close:A,at:"close"}:(u=new N(s,g.line,g.ch,l),{open:A,close:b(u,h[2]),at:"open"})},Q.findEnclosingTag=function(s,a,l,u){for(var C=new N(s,a.line,a.ch,l);;){var g=E(C,u);if(!g)break;var h=new N(s,a.line,a.ch,l),A=b(h,g.tag);if(A)return{open:g,close:A}}},Q.scanForClosingTag=function(s,a,l,u){var C=new N(s,a.line,a.ch,u?{from:0,to:u}:null);return b(C,l)}})},"p77/":function(at,qe,ee){},rUJ1:function(at,qe){const ee=/[&<>"']/,Q=/[&<>"']/g,K=/[<>"']|&(?!#?\w+;)/,L=/[<>"']|&(?!#?\w+;)/g,H={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},k=T=>H[T];function M(T,f){if(f){if(ee.test(T))return T.replace(Q,k)}else if(K.test(T))return T.replace(L,k);return T}const N=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function _(T){return T.replace(N,(f,m)=>(m=m.toLowerCase(),m==="colon"?":":m.charAt(0)==="#"?m.charAt(1)==="x"?String.fromCharCode(parseInt(m.substring(2),16)):String.fromCharCode(+m.substring(1)):""))}const P=/(^|[^\[])\^/g;function D(T,f){T=T.source||T,f=f||"";const m={replace:(d,o)=>(o=o.source||o,o=o.replace(P,"$1"),T=T.replace(d,o),m),getRegex:()=>new RegExp(T,f)};return m}const c=/[^\w:]/g,v=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function O(T,f,m){if(T){let d;try{d=decodeURIComponent(_(m)).replace(c,"").toLowerCase()}catch(o){return null}if(d.indexOf("javascript:")===0||d.indexOf("vbscript:")===0||d.indexOf("data:")===0)return null}f&&!v.test(m)&&(m=a(f,m));try{m=encodeURI(m).replace(/%25/g,"%")}catch(d){return null}return m}const w={},b=/^[^:]+:\/*[^/]*$/,E=/^([^:]+:)[\s\S]*$/,s=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(T,f){w[" "+T]||(b.test(T)?w[" "+T]=T+"/":w[" "+T]=g(T,"/",!0)),T=w[" "+T];const m=T.indexOf(":")===-1;return f.substring(0,2)==="//"?m?f:T.replace(E,"$1")+f:f.charAt(0)==="/"?m?f:T.replace(s,"$1")+f:T+f}const l={exec:function(){}};function u(T){let f=1,m,d;for(;f<arguments.length;f++){m=arguments[f];for(d in m)Object.prototype.hasOwnProperty.call(m,d)&&(T[d]=m[d])}return T}function C(T,f){const m=T.replace(/\|/g,(x,y,p)=>{let R=!1,U=y;for(;--U>=0&&p[U]==="\\";)R=!R;return R?"|":" |"}),d=m.split(/ \|/);let o=0;if(d.length>f)d.splice(f);else for(;d.length<f;)d.push("");for(;o<d.length;o++)d[o]=d[o].trim().replace(/\\\|/g,"|");return d}function g(T,f,m){const d=T.length;if(d===0)return"";let o=0;for(;o<d;){const x=T.charAt(d-o-1);if(x===f&&!m)o++;else if(x!==f&&m)o++;else break}return T.substr(0,d-o)}function h(T,f){if(T.indexOf(f[1])===-1)return-1;const m=T.length;let d=0,o=0;for(;o<m;o++)if(T[o]==="\\")o++;else if(T[o]===f[0])d++;else if(T[o]===f[1]&&(d--,d<0))return o;return-1}function A(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")}at.exports={escape:M,unescape:_,edit:D,cleanUrl:O,resolveUrl:a,noopTest:l,merge:u,splitCells:C,rtrim:g,findClosingBracket:h,checkSanitizeDeprecation:A}},rcnY:function(at,qe,ee){var Q=ee("aRTE");function K(L,H){this.totalCount=L,this.dataCount=H}K.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]],K.getRSBlocks=function(L,H){var k=K.getRsBlockTable(L,H);if(k==null)throw new Error("bad rs block @ typeNumber:"+L+"/errorCorrectLevel:"+H);for(var M=k.length/3,N=new Array,_=0;_<M;_++)for(var P=k[_*3+0],D=k[_*3+1],c=k[_*3+2],v=0;v<P;v++)N.push(new K(D,c));return N},K.getRsBlockTable=function(L,H){switch(H){case Q.L:return K.RS_BLOCK_TABLE[(L-1)*4+0];case Q.M:return K.RS_BLOCK_TABLE[(L-1)*4+1];case Q.Q:return K.RS_BLOCK_TABLE[(L-1)*4+2];case Q.H:return K.RS_BLOCK_TABLE[(L-1)*4+3];default:return}},at.exports=K},ulZh:function(at,qe,ee){typeof window!="undefined"&&function(K,L){at.exports=L()}(this,function(){return function(Q){var K={};function L(H){if(K[H])return K[H].exports;var k=K[H]={i:H,l:!1,exports:{}};return Q[H].call(k.exports,k,k.exports,L),k.l=!0,k.exports}return L.m=Q,L.c=K,L.d=function(H,k,M){L.o(H,k)||Object.defineProperty(H,k,{enumerable:!0,get:M})},L.r=function(H){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(H,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(H,"__esModule",{value:!0})},L.t=function(H,k){if(k&1&&(H=L(H)),k&8)return H;if(k&4&&typeof H=="object"&&H&&H.__esModule)return H;var M=Object.create(null);if(L.r(M),Object.defineProperty(M,"default",{enumerable:!0,value:H}),k&2&&typeof H!="string")for(var N in H)L.d(M,N,function(_){return H[_]}.bind(null,N));return M},L.n=function(H){var k=H&&H.__esModule?function(){return H.default}:function(){return H};return L.d(k,"a",k),k},L.o=function(H,k){return Object.prototype.hasOwnProperty.call(H,k)},L.p="/dist/",L(L.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(Q,K,L){"use strict";var H=Object.prototype.hasOwnProperty,k="~";function M(){}Object.create&&(M.prototype=Object.create(null),new M().__proto__||(k=!1));function N(c,v,O){this.fn=c,this.context=v,this.once=O||!1}function _(c,v,O,w,b){if(typeof O!="function")throw new TypeError("The listener must be a function");var E=new N(O,w||c,b),s=k?k+v:v;return c._events[s]?c._events[s].fn?c._events[s]=[c._events[s],E]:c._events[s].push(E):(c._events[s]=E,c._eventsCount++),c}function P(c,v){--c._eventsCount===0?c._events=new M:delete c._events[v]}function D(){this._events=new M,this._eventsCount=0}D.prototype.eventNames=function(){var v=[],O,w;if(this._eventsCount===0)return v;for(w in O=this._events)H.call(O,w)&&v.push(k?w.slice(1):w);return Object.getOwnPropertySymbols?v.concat(Object.getOwnPropertySymbols(O)):v},D.prototype.listeners=function(v){var O=k?k+v:v,w=this._events[O];if(!w)return[];if(w.fn)return[w.fn];for(var b=0,E=w.length,s=new Array(E);b<E;b++)s[b]=w[b].fn;return s},D.prototype.listenerCount=function(v){var O=k?k+v:v,w=this._events[O];return w?w.fn?1:w.length:0},D.prototype.emit=function(v,O,w,b,E,s){var a=k?k+v:v;if(!this._events[a])return!1;var l=this._events[a],u=arguments.length,C,g;if(l.fn){l.once&&this.removeListener(v,l.fn,void 0,!0);switch(u){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,O),!0;case 3:return l.fn.call(l.context,O,w),!0;case 4:return l.fn.call(l.context,O,w,b),!0;case 5:return l.fn.call(l.context,O,w,b,E),!0;case 6:return l.fn.call(l.context,O,w,b,E,s),!0}for(g=1,C=new Array(u-1);g<u;g++)C[g-1]=arguments[g];l.fn.apply(l.context,C)}else{var h=l.length,A;for(g=0;g<h;g++){l[g].once&&this.removeListener(v,l[g].fn,void 0,!0);switch(u){case 1:l[g].fn.call(l[g].context);break;case 2:l[g].fn.call(l[g].context,O);break;case 3:l[g].fn.call(l[g].context,O,w);break;case 4:l[g].fn.call(l[g].context,O,w,b);break;default:if(!C)for(A=1,C=new Array(u-1);A<u;A++)C[A-1]=arguments[A];l[g].fn.apply(l[g].context,C)}}}return!0},D.prototype.on=function(v,O,w){return _(this,v,O,w,!1)},D.prototype.once=function(v,O,w){return _(this,v,O,w,!0)},D.prototype.removeListener=function(v,O,w,b){var E=k?k+v:v;if(!this._events[E])return this;if(!O)return P(this,E),this;var s=this._events[E];if(s.fn)s.fn===O&&(!b||s.once)&&(!w||s.context===w)&&P(this,E);else{for(var a=0,l=[],u=s.length;a<u;a++)(s[a].fn!==O||b&&!s[a].once||w&&s[a].context!==w)&&l.push(s[a]);l.length?this._events[E]=l.length===1?l[0]:l:P(this,E)}return this},D.prototype.removeAllListeners=function(v){var O;return v?(O=k?k+v:v,this._events[O]&&P(this,O)):(this._events=new M,this._eventsCount=0),this},D.prototype.off=D.prototype.removeListener,D.prototype.addListener=D.prototype.on,D.prefixed=k,D.EventEmitter=D,Q.exports=D},"./node_modules/url-toolkit/src/url-toolkit.js":function(Q,K,L){(function(H){var k=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,M=/^([^\/?#]*)([^]*)$/,N=/(?:\/|^)\.(?=\/)/g,_=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,P={buildAbsoluteURL:function(D,c,v){if(v=v||{},D=D.trim(),c=c.trim(),!c){if(!v.alwaysNormalize)return D;var O=P.parseURL(D);if(!O)throw new Error("Error trying to parse base URL.");return O.path=P.normalizePath(O.path),P.buildURLFromParts(O)}var w=P.parseURL(c);if(!w)throw new Error("Error trying to parse relative URL.");if(w.scheme)return v.alwaysNormalize?(w.path=P.normalizePath(w.path),P.buildURLFromParts(w)):c;var b=P.parseURL(D);if(!b)throw new Error("Error trying to parse base URL.");if(!b.netLoc&&b.path&&b.path[0]!=="/"){var E=M.exec(b.path);b.netLoc=E[1],b.path=E[2]}b.netLoc&&!b.path&&(b.path="/");var s={scheme:b.scheme,netLoc:w.netLoc,path:null,params:w.params,query:w.query,fragment:w.fragment};if(!w.netLoc&&(s.netLoc=b.netLoc,w.path[0]!=="/"))if(!w.path)s.path=b.path,w.params||(s.params=b.params,w.query||(s.query=b.query));else{var a=b.path,l=a.substring(0,a.lastIndexOf("/")+1)+w.path;s.path=P.normalizePath(l)}return s.path===null&&(s.path=v.alwaysNormalize?P.normalizePath(w.path):w.path),P.buildURLFromParts(s)},parseURL:function(D){var c=k.exec(D);return c?{scheme:c[1]||"",netLoc:c[2]||"",path:c[3]||"",params:c[4]||"",query:c[5]||"",fragment:c[6]||""}:null},normalizePath:function(D){for(D=D.split("").reverse().join("").replace(N,"");D.length!==(D=D.replace(_,"")).length;);return D.split("").reverse().join("")},buildURLFromParts:function(D){return D.scheme+D.netLoc+D.path+D.params+D.query+D.fragment}};Q.exports=P})(this)},"./node_modules/webworkify-webpack/index.js":function(Q,K,L){function H(v){var O={};function w(E){if(O[E])return O[E].exports;var s=O[E]={i:E,l:!1,exports:{}};return v[E].call(s.exports,s,s.exports,w),s.l=!0,s.exports}w.m=v,w.c=O,w.i=function(E){return E},w.d=function(E,s,a){w.o(E,s)||Object.defineProperty(E,s,{configurable:!1,enumerable:!0,get:a})},w.r=function(E){Object.defineProperty(E,"__esModule",{value:!0})},w.n=function(E){var s=E&&E.__esModule?function(){return E.default}:function(){return E};return w.d(s,"a",s),s},w.o=function(E,s){return Object.prototype.hasOwnProperty.call(E,s)},w.p="/",w.oe=function(E){throw console.error(E),E};var b=w(w.s=ENTRY_MODULE);return b.default||b}var k="[\\.|\\-|\\+|\\w|/|@]+",M="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+k+").*?\\)";function N(v){return(v+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function _(v){return!isNaN(1*v)}function P(v,O,w){var b={};b[w]=[];var E=O.toString(),s=E.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!s)return b;for(var a=s[1],l=new RegExp("(\\\\n|\\W)"+N(a)+M,"g"),u;u=l.exec(E);){if(u[3]==="dll-reference")continue;b[w].push(u[3])}for(l=new RegExp("\\("+N(a)+'\\("(dll-reference\\s('+k+'))"\\)\\)'+M,"g");u=l.exec(E);)v[u[2]]||(b[w].push(u[1]),v[u[2]]=L(u[1]).m),b[u[2]]=b[u[2]]||[],b[u[2]].push(u[4]);for(var C=Object.keys(b),g=0;g<C.length;g++)for(var h=0;h<b[C[g]].length;h++)_(b[C[g]][h])&&(b[C[g]][h]=1*b[C[g]][h]);return b}function D(v){var O=Object.keys(v);return O.reduce(function(w,b){return w||v[b].length>0},!1)}function c(v,O){for(var w={main:[O]},b={main:[]},E={main:{}};D(w);)for(var s=Object.keys(w),a=0;a<s.length;a++){var l=s[a],u=w[l],C=u.pop();if(E[l]=E[l]||{},E[l][C]||!v[l][C])continue;E[l][C]=!0,b[l]=b[l]||[],b[l].push(C);for(var g=P(v,v[l][C],l),h=Object.keys(g),A=0;A<h.length;A++)w[h[A]]=w[h[A]]||[],w[h[A]]=w[h[A]].concat(g[h[A]])}return b}Q.exports=function(v,O){O=O||{};var w={main:L.m},b=O.all?{main:Object.keys(w.main)}:c(w,v),E="";Object.keys(b).filter(function(C){return C!=="main"}).forEach(function(C){for(var g=0;b[C][g];)g++;b[C].push(g),w[C][g]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",E=E+"var "+C+" = ("+H.toString().replace("ENTRY_MODULE",JSON.stringify(g))+")({"+b[C].map(function(h){return""+JSON.stringify(h)+": "+w[C][h].toString()}).join(",")+`});
`}),E=E+"new (("+H.toString().replace("ENTRY_MODULE",JSON.stringify(v))+")({"+b.main.map(function(C){return""+JSON.stringify(C)+": "+w.main[C].toString()}).join(",")+"}))(self);";var s=new window.Blob([E],{type:"text/javascript"});if(O.bare)return s;var a=window.URL||window.webkitURL||window.mozURL||window.msURL,l=a.createObjectURL(s),u=new window.Worker(l);return u.objectURL=l,u}},"./src/config.ts":function(Q,K,L){"use strict";L.r(K),L.d(K,"hlsDefaultConfig",function(){return A}),L.d(K,"mergeConfig",function(){return f}),L.d(K,"enableStreamingMode",function(){return m});var H=L("./src/controller/abr-controller.ts"),k=L("./src/controller/audio-stream-controller.ts"),M=L("./src/controller/audio-track-controller.ts"),N=L("./src/controller/subtitle-stream-controller.ts"),_=L("./src/controller/subtitle-track-controller.ts"),P=L("./src/controller/buffer-controller.ts"),D=L("./src/controller/timeline-controller.ts"),c=L("./src/controller/cap-level-controller.ts"),v=L("./src/controller/fps-controller.ts"),O=L("./src/controller/eme-controller.ts"),w=L("./src/controller/cmcd-controller.ts"),b=L("./src/utils/xhr-loader.ts"),E=L("./src/utils/fetch-loader.ts"),s=L("./src/utils/cues.ts"),a=L("./src/utils/mediakeys-helper.ts"),l=L("./src/utils/logger.ts");function u(){return u=Object.assign||function(d){for(var o=1;o<arguments.length;o++){var x=arguments[o];for(var y in x)Object.prototype.hasOwnProperty.call(x,y)&&(d[y]=x[y])}return d},u.apply(this,arguments)}function C(d,o){var x=Object.keys(d);if(Object.getOwnPropertySymbols){var y=Object.getOwnPropertySymbols(d);o&&(y=y.filter(function(p){return Object.getOwnPropertyDescriptor(d,p).enumerable})),x.push.apply(x,y)}return x}function g(d){for(var o=1;o<arguments.length;o++){var x=arguments[o]!=null?arguments[o]:{};o%2?C(Object(x),!0).forEach(function(y){h(d,y,x[y])}):Object.getOwnPropertyDescriptors?Object.defineProperties(d,Object.getOwnPropertyDescriptors(x)):C(Object(x)).forEach(function(y){Object.defineProperty(d,y,Object.getOwnPropertyDescriptor(x,y))})}return d}function h(d,o,x){return o in d?Object.defineProperty(d,o,{value:x,enumerable:!0,configurable:!0,writable:!0}):d[o]=x,d}var A=g(g({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:b.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:H.default,bufferController:P.default,capLevelController:c.default,fpsController:v.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:a.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},T()),{},{subtitleStreamController:N.SubtitleStreamController,subtitleTrackController:_.default,timelineController:D.TimelineController,audioStreamController:k.default,audioTrackController:M.default,emeController:O.default,cmcdController:w.default});function T(){return{cueHandler:s.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 f(d,o){if((o.liveSyncDurationCount||o.liveMaxLatencyDurationCount)&&(o.liveSyncDuration||o.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(o.liveMaxLatencyDurationCount!==void 0&&(o.liveSyncDurationCount===void 0||o.liveMaxLatencyDurationCount<=o.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(o.liveMaxLatencyDuration!==void 0&&(o.liveSyncDuration===void 0||o.liveMaxLatencyDuration<=o.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return u({},d,o)}function m(d){var o=d.loader;if(o!==E.default&&o!==b.default)l.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),d.progressive=!1;else{var x=Object(E.fetchSupported)();x&&(d.loader=E.default,d.progressive=!0,d.enableSoftwareAES=!0,l.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(Q,K,L){"use strict";L.r(K);var H=L("./src/polyfills/number.ts"),k=L("./src/utils/ewma-bandwidth-estimator.ts"),M=L("./src/events.ts"),N=L("./src/utils/buffer-helper.ts"),_=L("./src/errors.ts"),P=L("./src/types/loader.ts"),D=L("./src/utils/logger.ts");function c(w,b){for(var E=0;E<b.length;E++){var s=b[E];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(w,s.key,s)}}function v(w,b,E){return b&&c(w.prototype,b),E&&c(w,E),w}var O=function(){function w(E){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=E;var s=E.config;this.bwEstimator=new k.default(s.abrEwmaSlowVoD,s.abrEwmaFastVoD,s.abrEwmaDefaultEstimate),this.registerListeners()}var b=w.prototype;return b.registerListeners=function(){var s=this.hls;s.on(M.Events.FRAG_LOADING,this.onFragLoading,this),s.on(M.Events.FRAG_LOADED,this.onFragLoaded,this),s.on(M.Events.FRAG_BUFFERED,this.onFragBuffered,this),s.on(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),s.on(M.Events.ERROR,this.onError,this)},b.unregisterListeners=function(){var s=this.hls;s.off(M.Events.FRAG_LOADING,this.onFragLoading,this),s.off(M.Events.FRAG_LOADED,this.onFragLoaded,this),s.off(M.Events.FRAG_BUFFERED,this.onFragBuffered,this),s.off(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),s.off(M.Events.ERROR,this.onError,this)},b.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},b.onFragLoading=function(s,a){var l=a.frag;if(l.type===P.PlaylistLevelType.MAIN&&!this.timer){var u;this.fragCurrent=l,this.partCurrent=(u=a.part)!=null?u:null,this.timer=self.setInterval(this.onCheck,100)}},b.onLevelLoaded=function(s,a){var l=this.hls.config;a.details.live?this.bwEstimator.update(l.abrEwmaSlowLive,l.abrEwmaFastLive):this.bwEstimator.update(l.abrEwmaSlowVoD,l.abrEwmaFastVoD)},b._abandonRulesCheck=function(){var s=this.fragCurrent,a=this.partCurrent,l=this.hls,u=l.autoLevelEnabled,C=l.config,g=l.media;if(!s||!g)return;var h=a?a.stats:s.stats,A=a?a.duration:s.duration;if(h.aborted){D.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!u||g.paused||!g.playbackRate||!g.readyState)return;var T=performance.now()-h.loading.start,f=Math.abs(g.playbackRate);if(T<=500*A/f)return;var m=l.levels,d=l.minAutoLevel,o=m[s.level],x=h.total||Math.max(h.loaded,Math.round(A*o.maxBitrate/8)),y=Math.max(1,h.bwEstimate?h.bwEstimate/8:h.loaded*1e3/T),p=(x-h.loaded)/y,R=g.currentTime,U=(N.BufferHelper.bufferInfo(g,R,C.maxBufferHole).end-R)/f;if(U>=2*A/f||p<=U)return;var B=Number.POSITIVE_INFINITY,z;for(z=s.level-1;z>d;z--){var j=m[z].maxBitrate;if(B=A*j/(8*.8*y),B<U)break}if(B>=p)return;var F=this.bwEstimator.getEstimate();D.logger.warn("Fragment "+s.sn+(a?" part "+a.index:"")+" of level "+s.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+z+`
Current BW estimate: `+(Object(H.isFiniteNumber)(F)?(F/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=z,this.bwEstimator.sample(T,h.loaded),this.clearTimer(),s.loader&&(this.fragCurrent=this.partCurrent=null,s.loader.abort()),l.trigger(M.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:s,part:a,stats:h})},b.onFragLoaded=function(s,a){var l=a.frag,u=a.part;if(l.type===P.PlaylistLevelType.MAIN&&Object(H.isFiniteNumber)(l.sn)){var C=u?u.stats:l.stats,g=u?u.duration:l.duration;if(this.clearTimer(),this.lastLoadedFragLevel=l.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var h=this.hls.levels[l.level],A=(h.loaded?h.loaded.bytes:0)+C.loaded,T=(h.loaded?h.loaded.duration:0)+g;h.loaded={bytes:A,duration:T},h.realBitrate=Math.round(8*A/T)}if(l.bitrateTest){var f={stats:C,frag:l,part:u,id:l.type};this.onFragBuffered(M.Events.FRAG_BUFFERED,f),l.bitrateTest=!1}}},b.onFragBuffered=function(s,a){var l=a.frag,u=a.part,C=u?u.stats:l.stats;if(C.aborted)return;if(l.type!==P.PlaylistLevelType.MAIN||l.sn==="initSegment")return;var g=C.parsing.end-C.loading.start;this.bwEstimator.sample(g,C.loaded),C.bwEstimate=this.bwEstimator.getEstimate(),l.bitrateTest?this.bitrateTestDelay=g/1e3:this.bitrateTestDelay=0},b.onError=function(s,a){switch(a.details){case _.ErrorDetails.FRAG_LOAD_ERROR:case _.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},b.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},b.getNextABRAutoLevel=function(){var s=this.fragCurrent,a=this.partCurrent,l=this.hls,u=l.maxAutoLevel,C=l.config,g=l.minAutoLevel,h=l.media,A=a?a.duration:s?s.duration:0,T=h?h.currentTime:0,f=h&&h.playbackRate!==0?Math.abs(h.playbackRate):1,m=this.bwEstimator?this.bwEstimator.getEstimate():C.abrEwmaDefaultEstimate,d=(N.BufferHelper.bufferInfo(h,T,C.maxBufferHole).end-T)/f,o=this.findBestLevel(m,g,u,d,C.abrBandWidthFactor,C.abrBandWidthUpFactor);if(o>=0)return o;D.logger.trace((d?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var x=A?Math.min(A,C.maxStarvationDelay):C.maxStarvationDelay,y=C.abrBandWidthFactor,p=C.abrBandWidthUpFactor;if(!d){var R=this.bitrateTestDelay;if(R){var U=A?Math.min(A,C.maxLoadingDelay):C.maxLoadingDelay;x=U-R,D.logger.trace("bitrate test took "+Math.round(1e3*R)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*x)+" ms"),y=p=1}}return o=this.findBestLevel(m,g,u,d+x,y,p),Math.max(o,0)},b.findBestLevel=function(s,a,l,u,C,g){for(var h,A=this.fragCurrent,T=this.partCurrent,f=this.lastLoadedFragLevel,m=this.hls.levels,d=m[f],o=!!(d!=null&&(h=d.details)!==null&&h!==void 0&&h.live),x=d==null?void 0:d.codecSet,y=T?T.duration:A?A.duration:0,p=l;p>=a;p--){var R=m[p];if(!R||x&&R.codecSet!==x)continue;var U=R.details,B=(T?U==null?void 0:U.partTarget:U==null?void 0:U.averagetargetduration)||y,z=void 0;p<=f?z=C*s:z=g*s;var j=m[p].maxBitrate,F=j*B/z;if(D.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+p+"/"+Math.round(z)+"/"+j+"/"+B+"/"+u+"/"+F),z>j&&(!F||o&&!this.bitrateTestDelay||F<u))return p}return-1},v(w,[{key:"nextAutoLevel",get:function(){var s=this._nextAutoLevel,a=this.bwEstimator;if(s!==-1&&(!a||!a.canEstimate()))return s;var l=this.getNextABRAutoLevel();return s!==-1&&(l=Math.min(s,l)),l},set:function(s){this._nextAutoLevel=s}}]),w}();K.default=O},"./src/controller/audio-stream-controller.ts":function(Q,K,L){"use strict";L.r(K);var H=L("./src/polyfills/number.ts"),k=L("./src/controller/base-stream-controller.ts"),M=L("./src/events.ts"),N=L("./src/utils/buffer-helper.ts"),_=L("./src/controller/fragment-tracker.ts"),P=L("./src/types/level.ts"),D=L("./src/types/loader.ts"),c=L("./src/loader/fragment.ts"),v=L("./src/demux/chunk-cache.ts"),O=L("./src/demux/transmuxer-interface.ts"),w=L("./src/types/transmuxer.ts"),b=L("./src/controller/fragment-finders.ts"),E=L("./src/utils/discontinuities.ts"),s=L("./src/errors.ts"),a=L("./src/utils/logger.ts");function l(){return l=Object.assign||function(A){for(var T=1;T<arguments.length;T++){var f=arguments[T];for(var m in f)Object.prototype.hasOwnProperty.call(f,m)&&(A[m]=f[m])}return A},l.apply(this,arguments)}function u(A,T){A.prototype=Object.create(T.prototype),A.prototype.constructor=A,C(A,T)}function C(A,T){return C=Object.setPrototypeOf||function(m,d){return m.__proto__=d,m},C(A,T)}var g=100,h=function(A){u(T,A);function T(m,d){var o;return o=A.call(this,m,d,"[audio-stream-controller]")||this,o.videoBuffer=null,o.videoTrackCC=-1,o.waitingVideoCC=-1,o.audioSwitch=!1,o.trackId=-1,o.waitingData=null,o.mainDetails=null,o.bufferFlushed=!1,o._registerListeners(),o}var f=T.prototype;return f.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},f._registerListeners=function(){var d=this.hls;d.on(M.Events.MEDIA_ATTACHED,this.onMediaAttached,this),d.on(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),d.on(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.on(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.on(M.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),d.on(M.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),d.on(M.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.on(M.Events.ERROR,this.onError,this),d.on(M.Events.BUFFER_RESET,this.onBufferReset,this),d.on(M.Events.BUFFER_CREATED,this.onBufferCreated,this),d.on(M.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),d.on(M.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),d.on(M.Events.FRAG_BUFFERED,this.onFragBuffered,this)},f._unregisterListeners=function(){var d=this.hls;d.off(M.Events.MEDIA_ATTACHED,this.onMediaAttached,this),d.off(M.Events.MEDIA_DETACHING,this.onMediaDetaching,this),d.off(M.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.off(M.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.off(M.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),d.off(M.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),d.off(M.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.off(M.Events.ERROR,this.onError,this),d.off(M.Events.BUFFER_RESET,this.onBufferReset,this),d.off(M.Events.BUFFER_CREATED,this.onBufferCreated,this),d.off(M.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),d.off(M.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),d.off(M.Events.FRAG_BUFFERED,this.onFragBuffered,this)},f.onInitPtsFound=function(d,o){var x=o.frag,y=o.id,p=o.initPTS;if(y==="main"){var R=x.cc;this.initPTS[x.cc]=p,this.log("InitPTS for cc: "+R+" found from main: "+p),this.videoTrackCC=R,this.state===k.State.WAITING_INIT_PTS&&this.tick()}},f.startLoad=function(d){if(!this.levels){this.startPosition=d,this.state=k.State.STOPPED;return}var o=this.lastCurrentTime;this.stopLoad(),this.setInterval(g),this.fragLoadError=0,o>0&&d===-1?(this.log("Override startPosition with lastCurrentTime @"+o.toFixed(3)),this.state=k.State.IDLE):(this.loadedmetadata=!1,this.state=k.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=d,this.tick()},f.doTick=function(){switch(this.state){case k.State.IDLE:this.doTickIdle();break;case k.State.WAITING_TRACK:{var d,o=this.levels,x=this.trackId,y=o==null||((d=o[x])===null||d===void 0)?void 0:d.details;if(y){if(this.waitForCdnTuneIn(y))break;this.state=k.State.WAITING_INIT_PTS}break}case k.State.FRAG_LOADING_WAITING_RETRY:{var p,R=performance.now(),U=this.retryDate;(!U||R>=U||(p=this.media)!==null&&p!==void 0&&p.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=k.State.IDLE);break}case k.State.WAITING_INIT_PTS:{var B=this.waitingData;if(B){var z=B.frag,j=B.part,F=B.cache,X=B.complete;if(this.initPTS[z.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=k.State.FRAG_LOADING;var q=F.flush(),ne={frag:z,part:j,payload:q,networkDetails:null};this._handleFragmentLoadProgress(ne),X&&A.prototype._handleFragmentLoadComplete.call(this,ne)}else if(this.videoTrackCC!==this.waitingVideoCC)a.logger.log("Waiting fragment cc ("+z.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var ue=this.getLoadPosition(),xe=N.BufferHelper.bufferInfo(this.mediaBuffer,ue,this.config.maxBufferHole),pe=Object(b.fragmentWithinToleranceTest)(xe.end,this.config.maxFragLookUpTolerance,z);pe<0&&(a.logger.log("Waiting fragment cc ("+z.cc+") @ "+z.start+" cancelled because another fragment at "+xe.end+" is needed"),this.clearWaitingFragment())}}else this.state=k.State.IDLE}}this.onTickEnd()},f.clearWaitingFragment=function(){var d=this.waitingData;d&&(this.fragmentTracker.removeFragment(d.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=k.State.IDLE)},f.onTickEnd=function(){var d=this.media;if(!d||!d.readyState)return;var o=this.mediaBuffer?this.mediaBuffer:d,x=o.buffered;!this.loadedmetadata&&x.length&&(this.loadedmetadata=!0),this.lastCurrentTime=d.currentTime},f.doTickIdle=function(){var d,o,x=this.hls,y=this.levels,p=this.media,R=this.trackId,U=x.config;if(!y||!y[R])return;if(!p&&(this.startFragRequested||!U.startFragPrefetch))return;var B=y[R],z=B.details;if(!z||z.live&&this.levelLastLoaded!==R||this.waitForCdnTuneIn(z)){this.state=k.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,c.ElementaryStreamTypes.AUDIO,D.PlaylistLevelType.AUDIO));var j=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,D.PlaylistLevelType.AUDIO);if(j===null)return;var F=j.len,X=this.getMaxBufferLength(),q=this.audioSwitch;if(F>=X&&!q)return;if(!q&&this._streamEnded(j,z)){x.trigger(M.Events.BUFFER_EOS,{type:"audio"}),this.state=k.State.ENDED;return}var ne=z.fragments,ue=ne[0].start,xe=j.end;if(q){var pe=this.getLoadPosition();xe=pe,z.PTSKnown&&pe<ue&&((j.end>ue||j.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),p.currentTime=ue+.05))}var he=this.getNextFragment(xe,z);if(!he){this.bufferFlushed=!0;return}((d=he.decryptdata)===null||d===void 0?void 0:d.keyFormat)==="identity"&&!((o=he.decryptdata)!==null&&o!==void 0&&o.key)?this.loadKey(he,z):this.loadFragment(he,z,xe)},f.getMaxBufferLength=function(){var d=A.prototype.getMaxBufferLength.call(this),o=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,D.PlaylistLevelType.MAIN);return o===null?d:Math.max(d,o.len)},f.onMediaDetaching=function(){this.videoBuffer=null,A.prototype.onMediaDetaching.call(this)},f.onAudioTracksUpdated=function(d,o){var x=o.audioTracks;this.resetTransmuxer(),this.levels=x.map(function(y){return new P.Level(y)})},f.onAudioTrackSwitching=function(d,o){var x=!!o.url;this.trackId=o.id;var y=this.fragCurrent;y!=null&&y.loader&&y.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),x?this.setInterval(g):this.resetTransmuxer(),x?(this.audioSwitch=!0,this.state=k.State.IDLE):this.state=k.State.STOPPED,this.tick()},f.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},f.onLevelLoaded=function(d,o){this.mainDetails=o.details},f.onAudioTrackLoaded=function(d,o){var x,y=this.levels,p=o.details,R=o.id;if(!y){this.warn("Audio tracks were reset while loading level "+R);return}this.log("Track "+R+" loaded ["+p.startSN+","+p.endSN+"],duration:"+p.totalduration);var U=y[R],B=0;if(p.live||(x=U.details)!==null&&x!==void 0&&x.live){var z=this.mainDetails;if(p.fragments[0]||(p.deltaUpdateFailed=!0),p.deltaUpdateFailed||!z)return;!U.details&&p.hasProgramDateTime&&z.hasProgramDateTime?(Object(E.alignMediaPlaylistByPDT)(p,z),B=p.fragments[0].start):B=this.alignPlaylists(p,U.details)}U.details=p,this.levelLastLoaded=R,!this.startFragRequested&&(this.mainDetails||!p.live)&&this.setStartPosition(U.details,B),this.state===k.State.WAITING_TRACK&&!this.waitForCdnTuneIn(p)&&(this.state=k.State.IDLE),this.tick()},f._handleFragmentLoadProgress=function(d){var o,x=d.frag,y=d.part,p=d.payload,R=this.config,U=this.trackId,B=this.levels;if(!B){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+x.sn+" of level "+x.level+" will not be buffered");return}var z=B[U];console.assert(z,"Audio track is defined on fragment load progress");var j=z.details;console.assert(j,"Audio track details are defined on fragment load progress");var F=R.defaultAudioCodec||z.audioCodec||"mp4a.40.2",X=this.transmuxer;X||(X=this.transmuxer=new O.default(this.hls,D.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var q=this.initPTS[x.cc],ne=(o=x.initSegment)===null||o===void 0?void 0:o.data;if(q!==void 0){var ue=!1,xe=y?y.index:-1,pe=xe!==-1,he=new w.ChunkMetadata(x.level,x.sn,x.stats.chunkCount,p.byteLength,xe,pe);X.push(p,ne,F,"",x,y,j.totalduration,ue,he,q)}else{a.logger.log("Unknown video PTS for cc "+x.cc+", waiting for video PTS before demuxing audio frag "+x.sn+" of ["+j.startSN+" ,"+j.endSN+"],track "+U);var de=this.waitingData=this.waitingData||{frag:x,part:y,cache:new v.default,complete:!1},fe=de.cache;fe.push(new Uint8Array(p)),this.waitingVideoCC=this.videoTrackCC,this.state=k.State.WAITING_INIT_PTS}},f._handleFragmentLoadComplete=function(d){if(this.waitingData){this.waitingData.complete=!0;return}A.prototype._handleFragmentLoadComplete.call(this,d)},f.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},f.onBufferCreated=function(d,o){var x=o.tracks.audio;x&&(this.mediaBuffer=x.buffer),o.tracks.video&&(this.videoBuffer=o.tracks.video.buffer)},f.onFragBuffered=function(d,o){var x=o.frag,y=o.part;if(x.type!==D.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(x)){this.warn("Fragment "+x.sn+(y?" p: "+y.index:"")+" of level "+x.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}x.sn!=="initSegment"&&(this.fragPrevious=x,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(M.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(x,y)},f.onError=function(d,o){switch(o.details){case s.ErrorDetails.FRAG_LOAD_ERROR:case s.ErrorDetails.FRAG_LOAD_TIMEOUT:case s.ErrorDetails.KEY_LOAD_ERROR:case s.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(D.PlaylistLevelType.AUDIO,o);break;case s.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case s.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==k.State.ERROR&&this.state!==k.State.STOPPED&&(this.state=o.fatal?k.State.ERROR:k.State.IDLE,this.warn(o.details+" while loading frag, switching to "+this.state+" state"));break;case s.ErrorDetails.BUFFER_FULL_ERROR:if(o.parent==="audio"&&(this.state===k.State.PARSING||this.state===k.State.PARSED)){var x=!0,y=this.getFwdBufferInfo(this.mediaBuffer,D.PlaylistLevelType.AUDIO);y&&y.len>.5&&(x=!this.reduceMaxBufferLength(y.len)),x&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,A.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},f.onBufferFlushed=function(d,o){var x=o.type;x===c.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},f._handleTransmuxComplete=function(d){var o,x="audio",y=this.hls,p=d.remuxResult,R=d.chunkMeta,U=this.getCurrentContext(R);if(!U){this.warn("The loading context changed while buffering fragment "+R.sn+" of level "+R.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(R.level);return}var B=U.frag,z=U.part,j=p.audio,F=p.text,X=p.id3,q=p.initSegment;if(this.fragContextChanged(B))return;if(this.state=k.State.PARSING,this.audioSwitch&&j&&this.completeAudioSwitch(),q!=null&&q.tracks&&(this._bufferInitSegment(q.tracks,B,R),y.trigger(M.Events.FRAG_PARSING_INIT_SEGMENT,{frag:B,id:x,tracks:q.tracks})),j){var ne=j.startPTS,ue=j.endPTS,xe=j.startDTS,pe=j.endDTS;z&&(z.elementaryStreams[c.ElementaryStreamTypes.AUDIO]={startPTS:ne,endPTS:ue,startDTS:xe,endDTS:pe}),B.setElementaryStreamInfo(c.ElementaryStreamTypes.AUDIO,ne,ue,xe,pe),this.bufferFragmentData(j,B,z,R)}if(X!=null&&(o=X.samples)!==null&&o!==void 0&&o.length){var he=l({frag:B,id:x},X);y.trigger(M.Events.FRAG_PARSING_METADATA,he)}if(F){var de=l({frag:B,id:x},F);y.trigger(M.Events.FRAG_PARSING_USERDATA,de)}},f._bufferInitSegment=function(d,o,x){if(this.state!==k.State.PARSING)return;d.video&&delete d.video;var y=d.audio;if(!y)return;y.levelCodec=y.codec,y.id="audio",this.log("Init audio buffer, container:"+y.container+", codecs[parsed]=["+y.codec+"]"),this.hls.trigger(M.Events.BUFFER_CODECS,d);var p=y.initSegment;if(p!=null&&p.byteLength){var R={type:"audio",frag:o,part:null,chunkMeta:x,parent:o.type,data:p};this.hls.trigger(M.Events.BUFFER_APPENDING,R)}this.tick()},f.loadFragment=function(d,o,x){var y=this.fragmentTracker.getState(d);this.fragCurrent=d,(this.audioSwitch||y===_.FragmentState.NOT_LOADED||y===_.FragmentState.PARTIAL)&&(d.sn==="initSegment"?this._loadInitSegment(d):o.live&&!Object(H.isFiniteNumber)(this.initPTS[d.cc])?(this.log("Waiting for video PTS in continuity counter "+d.cc+" of live stream before loading audio fragment "+d.sn+" of level "+this.trackId),this.state=k.State.WAITING_INIT_PTS):(this.startFragRequested=!0,A.prototype.loadFragment.call(this,d,o,x)))},f.completeAudioSwitch=function(){var d=this.hls,o=this.media,x=this.trackId;o&&(this.log("Switching audio track : flushing all audio"),A.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,d.trigger(M.Events.AUDIO_TRACK_SWITCHED,{id:x})},T}(k.default);K.default=h},"./src/controller/audio-track-controller.ts":function(Q,K,L){"use strict";L.r(K);var H=L("./src/events.ts"),k=L("./src/errors.ts"),M=L("./src/controller/base-playlist-controller.ts"),N=L("./src/types/loader.ts");function _(O,w){for(var b=0;b<w.length;b++){var E=w[b];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(O,E.key,E)}}function P(O,w,b){return w&&_(O.prototype,w),b&&_(O,b),O}function D(O,w){O.prototype=Object.create(w.prototype),O.prototype.constructor=O,c(O,w)}function c(O,w){return c=Object.setPrototypeOf||function(E,s){return E.__proto__=s,E},c(O,w)}var v=function(O){D(w,O);function w(E){var s;return s=O.call(this,E,"[audio-track-controller]")||this,s.tracks=[],s.groupId=null,s.tracksInGroup=[],s.trackId=-1,s.trackName="",s.selectDefaultTrack=!0,s.registerListeners(),s}var b=w.prototype;return b.registerListeners=function(){var s=this.hls;s.on(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.on(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),s.on(H.Events.LEVEL_LOADING,this.onLevelLoading,this),s.on(H.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),s.on(H.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),s.on(H.Events.ERROR,this.onError,this)},b.unregisterListeners=function(){var s=this.hls;s.off(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.off(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),s.off(H.Events.LEVEL_LOADING,this.onLevelLoading,this),s.off(H.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),s.off(H.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),s.off(H.Events.ERROR,this.onError,this)},b.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,O.prototype.destroy.call(this)},b.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},b.onManifestParsed=function(s,a){this.tracks=a.audioTracks||[]},b.onAudioTrackLoaded=function(s,a){var l=a.id,u=a.details,C=this.tracksInGroup[l];if(!C){this.warn("Invalid audio track id "+l);return}var g=C.details;C.details=a.details,this.log("audioTrack "+l+" loaded ["+u.startSN+"-"+u.endSN+"]"),l===this.trackId&&(this.retryCount=0,this.playlistLoaded(l,a,g))},b.onLevelLoading=function(s,a){this.switchLevel(a.level)},b.onLevelSwitching=function(s,a){this.switchLevel(a.level)},b.switchLevel=function(s){var a=this.hls.levels[s];if(!(a!=null&&a.audioGroupIds))return;var l=a.audioGroupIds[a.urlId];if(this.groupId!==l){this.groupId=l;var u=this.tracks.filter(function(g){return!l||g.groupId===l});this.selectDefaultTrack&&!u.some(function(g){return g.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=u;var C={audioTracks:u};this.log("Updating audio tracks, "+u.length+' track(s) found in "'+l+'" group-id'),this.hls.trigger(H.Events.AUDIO_TRACKS_UPDATED,C),this.selectInitialTrack()}},b.onError=function(s,a){if(O.prototype.onError.call(this,s,a),a.fatal||!a.context)return;a.context.type===N.PlaylistContextType.AUDIO_TRACK&&a.context.id===this.trackId&&a.context.groupId===this.groupId&&this.retryLoadingOrFail(a)},b.setAudioTrack=function(s){var a=this.tracksInGroup;if(s<0||s>=a.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var l=a[this.trackId];this.log("Now switching to audio-track index "+s);var u=a[s],C=u.id,g=u.groupId,h=g===void 0?"":g,A=u.name,T=u.type,f=u.url;if(this.trackId=s,this.trackName=A,this.selectDefaultTrack=!1,this.hls.trigger(H.Events.AUDIO_TRACK_SWITCHING,{id:C,groupId:h,name:A,type:T,url:f}),u.details&&!u.details.live)return;var m=this.switchParams(u.url,l==null?void 0:l.details);this.loadPlaylist(m)},b.selectInitialTrack=function(){var s=this.tracksInGroup;console.assert(s.length,"Initial audio track should be selected when tracks are known");var a=this.trackName,l=this.findTrackId(a)||this.findTrackId();l!==-1?this.setAudioTrack(l):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(H.Events.ERROR,{type:k.ErrorTypes.MEDIA_ERROR,details:k.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},b.findTrackId=function(s){for(var a=this.tracksInGroup,l=0;l<a.length;l++){var u=a[l];if((!this.selectDefaultTrack||u.default)&&(!s||s===u.name))return u.id}return-1},b.loadPlaylist=function(s){var a=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(a)){var l=a.id,u=a.groupId,C=a.url;if(s)try{C=s.addDirectives(C)}catch(g){this.warn("Could not construct new URL with HLS Delivery Directives: "+g)}this.log("loading audio-track playlist for id: "+l),this.clearTimer(),this.hls.trigger(H.Events.AUDIO_TRACK_LOADING,{url:C,id:l,groupId:u,deliveryDirectives:s||null})}},P(w,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(s){this.selectDefaultTrack=!1,this.setAudioTrack(s)}}]),w}(M.default);K.default=v},"./src/controller/base-playlist-controller.ts":function(Q,K,L){"use strict";L.r(K),L.d(K,"default",function(){return P});var H=L("./src/polyfills/number.ts"),k=L("./src/types/level.ts"),M=L("./src/controller/level-helper.ts"),N=L("./src/utils/logger.ts"),_=L("./src/errors.ts"),P=function(){function D(v,O){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,O+":"),this.warn=N.logger.warn.bind(N.logger,O+":"),this.hls=v}var c=D.prototype;return c.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},c.onError=function(O,w){w.fatal&&w.type===_.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},c.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},c.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},c.stopLoad=function(){this.canLoad=!1,this.clearTimer()},c.switchParams=function(O,w){var b=w==null?void 0:w.renditionReports;if(b)for(var E=0;E<b.length;E++){var s=b[E],a=""+s.URI;if(a===O.substr(-a.length)){var l=parseInt(s["LAST-MSN"]),u=parseInt(s["LAST-PART"]);if(w&&this.hls.config.lowLatencyMode){var C=Math.min(w.age-w.partTarget,w.targetduration);u!==void 0&&C>w.partTarget&&(u+=1)}if(Object(H.isFiniteNumber)(l))return new k.HlsUrlParameters(l,Object(H.isFiniteNumber)(u)?u:void 0,k.HlsSkip.No)}}},c.loadPlaylist=function(O){},c.shouldLoadTrack=function(O){return this.canLoad&&O&&!!O.url&&(!O.details||O.details.live)},c.playlistLoaded=function(O,w,b){var E=this,s=w.details,a=w.stats,l=a.loading.end?Math.max(0,self.performance.now()-a.loading.end):0;if(s.advancedDateTime=Date.now()-l,s.live||b!=null&&b.live){if(s.reloaded(b),b&&this.log("live playlist "+O+" "+(s.advanced?"REFRESHED "+s.lastPartSn+"-"+s.lastPartIndex:"MISSED")),b&&s.fragments.length>0&&Object(M.mergeDetails)(b,s),!this.canLoad||!s.live)return;var u,C=void 0,g=void 0;if(s.canBlockReload&&s.endSN&&s.advanced){var h=this.hls.config.lowLatencyMode,A=s.lastPartSn,T=s.endSN,f=s.lastPartIndex,m=f!==-1,d=A===T,o=h?0:f;m?(C=d?T+1:A,g=d?o:f+1):C=T+1;var x=s.age,y=x+s.ageHeader,p=Math.min(y-s.partTarget,s.targetduration*1.5);if(p>0){if(b&&p>b.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+b.tuneInGoal+" to: "+p+" with playlist age: "+s.age),p=0;else{var R=Math.floor(p/s.targetduration);if(C+=R,g!==void 0){var U=Math.round(p%s.targetduration/s.partTarget);g+=U}this.log("CDN Tune-in age: "+s.ageHeader+"s last advanced "+x.toFixed(2)+"s goal: "+p+" skip sn "+R+" to part "+g)}s.tuneInGoal=p}if(u=this.getDeliveryDirectives(s,w.deliveryDirectives,C,g),h||!d){this.loadPlaylist(u);return}}else u=this.getDeliveryDirectives(s,w.deliveryDirectives,C,g);var B=Object(M.computeReloadInterval)(s,a);C!==void 0&&s.canBlockReload&&(B-=s.partTarget||1),this.log("reload live playlist "+O+" in "+Math.round(B)+" ms"),this.timer=self.setTimeout(function(){return E.loadPlaylist(u)},B)}else this.clearTimer()},c.getDeliveryDirectives=function(O,w,b,E){var s=Object(k.getSkipValue)(O,b);return w!=null&&w.skip&&O.deltaUpdateFailed&&(b=w.msn,E=w.part,s=k.HlsSkip.No),new k.HlsUrlParameters(b,E,s)},c.retryLoadingOrFail=function(O){var w=this,b=this.hls.config,E=this.retryCount<b.levelLoadingMaxRetry;if(E){var s;if(this.retryCount++,O.details.indexOf("LoadTimeOut")>-1&&(s=O.context)!==null&&s!==void 0&&s.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+O.details+'"'),this.loadPlaylist();else{var a=Math.min(Math.pow(2,this.retryCount)*b.levelLoadingRetryDelay,b.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return w.loadPlaylist()},a),this.warn("retry playlist loading #"+this.retryCount+" in "+a+' ms after "'+O.details+'"')}}else this.warn('cannot recover from error "'+O.details+'"'),this.clearTimer(),O.fatal=!0;return E},D}()},"./src/controller/base-stream-controller.ts":function(Q,K,L){"use strict";L.r(K),L.d(K,"State",function(){return T}),L.d(K,"default",function(){return f});var H=L("./src/polyfills/number.ts"),k=L("./src/task-loop.ts"),M=L("./src/controller/fragment-tracker.ts"),N=L("./src/utils/buffer-helper.ts"),_=L("./src/utils/logger.ts"),P=L("./src/events.ts"),D=L("./src/errors.ts"),c=L("./src/types/transmuxer.ts"),v=L("./src/utils/mp4-tools.ts"),O=L("./src/utils/discontinuities.ts"),w=L("./src/controller/fragment-finders.ts"),b=L("./src/controller/level-helper.ts"),E=L("./src/loader/fragment-loader.ts"),s=L("./src/crypt/decrypter.ts"),a=L("./src/utils/time-ranges.ts"),l=L("./src/types/loader.ts");function u(m,d){for(var o=0;o<d.length;o++){var x=d[o];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(m,x.key,x)}}function C(m,d,o){return d&&u(m.prototype,d),o&&u(m,o),m}function g(m){if(m===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m}function h(m,d){m.prototype=Object.create(d.prototype),m.prototype.constructor=m,A(m,d)}function A(m,d){return A=Object.setPrototypeOf||function(x,y){return x.__proto__=y,x},A(m,d)}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"},f=function(m){h(d,m);function d(x,y,p){var R;return R=m.call(this)||this,R.hls=void 0,R.fragPrevious=null,R.fragCurrent=null,R.fragmentTracker=void 0,R.transmuxer=null,R._state=T.STOPPED,R.media=void 0,R.mediaBuffer=void 0,R.config=void 0,R.bitrateTest=!1,R.lastCurrentTime=0,R.nextLoadPosition=0,R.startPosition=0,R.loadedmetadata=!1,R.fragLoadError=0,R.retryDate=0,R.levels=null,R.fragmentLoader=void 0,R.levelLastLoaded=null,R.startFragRequested=!1,R.decrypter=void 0,R.initPTS=[],R.onvseeking=null,R.onvended=null,R.logPrefix="",R.log=void 0,R.warn=void 0,R.logPrefix=p,R.log=_.logger.log.bind(_.logger,p+":"),R.warn=_.logger.warn.bind(_.logger,p+":"),R.hls=x,R.fragmentLoader=new E.default(x.config),R.fragmentTracker=y,R.config=x.config,R.decrypter=new s.default(x,x.config),x.on(P.Events.KEY_LOADED,R.onKeyLoaded,g(R)),R}var o=d.prototype;return o.doTick=function(){this.onTickEnd()},o.onTickEnd=function(){},o.startLoad=function(y){},o.stopLoad=function(){this.fragmentLoader.abort();var y=this.fragCurrent;y&&this.fragmentTracker.removeFragment(y),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=T.STOPPED},o._streamEnded=function(y,p){var R=this.fragCurrent,U=this.fragmentTracker;if(!p.live&&R&&R.sn===p.endSN&&!y.nextStart){var B=U.getState(R);return B===M.FragmentState.PARTIAL||B===M.FragmentState.OK}return!1},o.onMediaAttached=function(y,p){var R=this.media=this.mediaBuffer=p.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),R.addEventListener("seeking",this.onvseeking),R.addEventListener("ended",this.onvended);var U=this.config;this.levels&&U.autoStartLoad&&this.state===T.STOPPED&&this.startLoad(U.startPosition)},o.onMediaDetaching=function(){var y=this.media;y!=null&&y.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),y&&(y.removeEventListener("seeking",this.onvseeking),y.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},o.onMediaSeeking=function(){var y=this.config,p=this.fragCurrent,R=this.media,U=this.mediaBuffer,B=this.state,z=R?R.currentTime:0,j=N.BufferHelper.bufferInfo(U||R,z,y.maxBufferHole);if(this.log("media seeking to "+(Object(H.isFiniteNumber)(z)?z.toFixed(3):z)+", state: "+B),B===T.ENDED)this.resetLoadingState();else if(p&&!j.len){var F=y.maxFragLookUpTolerance,X=p.start-F,q=p.start+p.duration+F,ne=z>q;(z<X||ne)&&(ne&&p.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),p.loader.abort()),this.resetLoadingState())}R&&(this.lastCurrentTime=z),!this.loadedmetadata&&!j.len&&(this.nextLoadPosition=this.startPosition=z),this.tickImmediate()},o.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},o.onKeyLoaded=function(y,p){if(this.state!==T.KEY_LOADING||p.frag!==this.fragCurrent||!this.levels)return;this.state=T.IDLE;var R=this.levels[p.frag.level].details;R&&this.loadFragment(p.frag,R,p.frag.start)},o.onHandlerDestroying=function(){this.stopLoad(),m.prototype.onHandlerDestroying.call(this)},o.onHandlerDestroyed=function(){this.state=T.STOPPED,this.hls.off(P.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,m.prototype.onHandlerDestroyed.call(this)},o.loadKey=function(y,p){this.log("Loading key for "+y.sn+" of ["+p.startSN+"-"+p.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+y.level),this.state=T.KEY_LOADING,this.fragCurrent=y,this.hls.trigger(P.Events.KEY_LOADING,{frag:y})},o.loadFragment=function(y,p,R){this._loadFragForPlayback(y,p,R)},o._loadFragForPlayback=function(y,p,R){var U=this,B=function(j){if(U.fragContextChanged(y)){U.warn("Fragment "+y.sn+(j.part?" p: "+j.part.index:"")+" of level "+y.level+" was dropped during download."),U.fragmentTracker.removeFragment(y);return}y.stats.chunkCount++,U._handleFragmentLoadProgress(j)};this._doFragLoad(y,p,R,B).then(function(z){if(!z)return;U.fragLoadError=0;var j=U.state;if(U.fragContextChanged(y)){(j===T.FRAG_LOADING||j===T.BACKTRACKING||!U.fragCurrent&&j===T.PARSING)&&(U.fragmentTracker.removeFragment(y),U.state=T.IDLE);return}if("payload"in z&&(U.log("Loaded fragment "+y.sn+" of level "+y.level),U.hls.trigger(P.Events.FRAG_LOADED,z),U.state===T.BACKTRACKING)){U.fragmentTracker.backtrack(y,z),U.resetFragmentLoading(y);return}U._handleFragmentLoadComplete(z)}).catch(function(z){U.warn(z),U.resetFragmentLoading(y)})},o.flushMainBuffer=function(y,p,R){if(R===void 0&&(R=null),!(y-p))return;var U={startOffset:y,endOffset:p,type:R};this.fragLoadError=0,this.hls.trigger(P.Events.BUFFER_FLUSHING,U)},o._loadInitSegment=function(y){var p=this;this._doFragLoad(y).then(function(R){if(!R||p.fragContextChanged(y)||!p.levels)throw new Error("init load aborted");return R}).then(function(R){var U=p.hls,B=R.payload,z=y.decryptdata;if(B&&B.byteLength>0&&z&&z.key&&z.iv&&z.method==="AES-128"){var j=self.performance.now();return p.decrypter.webCryptoDecrypt(new Uint8Array(B),z.key.buffer,z.iv.buffer).then(function(F){var X=self.performance.now();return U.trigger(P.Events.FRAG_DECRYPTED,{frag:y,payload:F,stats:{tstart:j,tdecrypt:X}}),R.payload=F,R})}return R}).then(function(R){var U=p.fragCurrent,B=p.hls,z=p.levels;if(!z)throw new Error("init load aborted, missing levels");var j=z[y.level].details;console.assert(j,"Level details are defined when init segment is loaded");var F=y.stats;p.state=T.IDLE,p.fragLoadError=0,y.data=new Uint8Array(R.payload),F.parsing.start=F.buffering.start=self.performance.now(),F.parsing.end=F.buffering.end=self.performance.now(),R.frag===U&&B.trigger(P.Events.FRAG_BUFFERED,{stats:F,frag:U,part:null,id:y.type}),p.tick()}).catch(function(R){p.warn(R),p.resetFragmentLoading(y)})},o.fragContextChanged=function(y){var p=this.fragCurrent;return!y||!p||y.level!==p.level||y.sn!==p.sn||y.urlId!==p.urlId},o.fragBufferedComplete=function(y,p){var R=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+y.type+" sn: "+y.sn+(p?" part: "+p.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+y.level+" "+a.default.toString(N.BufferHelper.getBuffered(R))),this.state=T.IDLE,this.tick()},o._handleFragmentLoadComplete=function(y){var p=this.transmuxer;if(!p)return;var R=y.frag,U=y.part,B=y.partsLoaded,z=!B||B.length===0||B.some(function(F){return!F}),j=new c.ChunkMetadata(R.level,R.sn,R.stats.chunkCount+1,0,U?U.index:-1,!z);p.flush(j)},o._handleFragmentLoadProgress=function(y){},o._doFragLoad=function(y,p,R,U){var B=this;if(R===void 0&&(R=null),!this.levels)throw new Error("frag load aborted, missing levels");if(R=Math.max(y.start,R||0),this.config.lowLatencyMode&&p){var z=p.partList;if(z&&U){R>y.end&&p.fragmentHint&&(y=p.fragmentHint);var j=this.getNextPart(z,y,R);if(j>-1){var F=z[j];return this.log("Loading part sn: "+y.sn+" p: "+F.index+" cc: "+y.cc+" of playlist ["+p.startSN+"-"+p.endSN+"] parts [0-"+j+"-"+(z.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+y.level+", target: "+parseFloat(R.toFixed(3))),this.nextLoadPosition=F.start+F.duration,this.state=T.FRAG_LOADING,this.hls.trigger(P.Events.FRAG_LOADING,{frag:y,part:z[j],targetBufferTime:R}),this.doFragPartsLoad(y,z,j,U).catch(function(X){return B.handleFragLoadError(X)})}else if(!y.url||this.loadedEndOfParts(z,R))return Promise.resolve(null)}}return this.log("Loading fragment "+y.sn+" cc: "+y.cc+" "+(p?"of ["+p.startSN+"-"+p.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+y.level+", target: "+parseFloat(R.toFixed(3))),Object(H.isFiniteNumber)(y.sn)&&!this.bitrateTest&&(this.nextLoadPosition=y.start+y.duration),this.state=T.FRAG_LOADING,this.hls.trigger(P.Events.FRAG_LOADING,{frag:y,targetBufferTime:R}),this.fragmentLoader.load(y,U).catch(function(X){return B.handleFragLoadError(X)})},o.doFragPartsLoad=function(y,p,R,U){var B=this;return new Promise(function(z,j){var F=[],X=function q(ne){var ue=p[ne];B.fragmentLoader.loadPart(y,ue,U).then(function(xe){F[ue.index]=xe;var pe=xe.part;B.hls.trigger(P.Events.FRAG_LOADED,xe);var he=p[ne+1];if(he&&he.fragment===y)q(ne+1);else return z({frag:y,part:pe,partsLoaded:F})}).catch(j)};X(R)})},o.handleFragLoadError=function(y){var p=y.data;return p&&p.details===D.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(p.frag,p.part):this.hls.trigger(P.Events.ERROR,p),null},o._handleTransmuxerFlush=function(y){var p=this.getCurrentContext(y);if(!p||this.state!==T.PARSING){this.fragCurrent||(this.state=T.IDLE);return}var R=p.frag,U=p.part,B=p.level,z=self.performance.now();R.stats.parsing.end=z,U&&(U.stats.parsing.end=z),this.updateLevelTiming(R,U,B,y.partial)},o.getCurrentContext=function(y){var p=this.levels,R=y.level,U=y.sn,B=y.part;if(!p||!p[R])return this.warn("Levels object was unset while buffering fragment "+U+" of level "+R+". The current chunk will not be buffered."),null;var z=p[R],j=B>-1?Object(b.getPartWith)(z,U,B):null,F=j?j.fragment:Object(b.getFragmentWithSN)(z,U,this.fragCurrent);return F?{frag:F,part:j,level:z}:null},o.bufferFragmentData=function(y,p,R,U){if(!y||this.state!==T.PARSING)return;var B=y.data1,z=y.data2,j=B;if(B&&z&&(j=Object(v.appendUint8Array)(B,z)),!j||!j.length)return;var F={type:y.type,frag:p,part:R,chunkMeta:U,parent:p.type,data:j};this.hls.trigger(P.Events.BUFFER_APPENDING,F),y.dropped&&y.independent&&!R&&this.flushBufferGap(p)},o.flushBufferGap=function(y){var p=this.media;if(!p)return;if(!N.BufferHelper.isBuffered(p,p.currentTime)){this.flushMainBuffer(0,y.start);return}var R=p.currentTime,U=N.BufferHelper.bufferInfo(p,R,0),B=y.duration,z=Math.min(this.config.maxFragLookUpTolerance*2,B*.25),j=Math.max(Math.min(y.start-z,U.end-z),R+z);y.start-j>z&&this.flushMainBuffer(j,y.start)},o.getFwdBufferInfo=function(y,p){var R=this.config,U=this.getLoadPosition();if(!Object(H.isFiniteNumber)(U))return null;var B=N.BufferHelper.bufferInfo(y,U,R.maxBufferHole);if(B.len===0&&B.nextStart!==void 0){var z=this.fragmentTracker.getBufferedFrag(U,p);if(z&&B.nextStart<z.end)return N.BufferHelper.bufferInfo(y,U,Math.max(B.nextStart,R.maxBufferHole))}return B},o.getMaxBufferLength=function(y){var p=this.config,R;return y?R=Math.max(8*p.maxBufferSize/y,p.maxBufferLength):R=p.maxBufferLength,Math.min(R,p.maxMaxBufferLength)},o.reduceMaxBufferLength=function(y){var p=this.config,R=y||p.maxBufferLength;return p.maxMaxBufferLength>=R?(p.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+p.maxMaxBufferLength+"s"),!0):!1},o.getNextFragment=function(y,p){var R,U,B=p.fragments,z=B.length;if(!z)return null;var j=this.config,F=B[0].start,X;if(p.live){var q=j.initialLiveManifestSize;if(z<q)return this.warn("Not enough fragments to start playback (have: "+z+", need: "+q+")"),null;!p.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(X=this.getInitialLiveFragment(p,B),this.startPosition=X?this.hls.liveSyncPosition||X.start:y)}else y<=F&&(X=B[0]);if(!X){var ne=j.lowLatencyMode?p.partEnd:p.fragmentEnd;X=this.getFragmentAtPosition(y,ne,p)}return(R=X)!==null&&R!==void 0&&R.initSegment&&!((U=X)!==null&&U!==void 0&&U.initSegment.data)&&!this.bitrateTest&&(X=X.initSegment),X},o.getNextPart=function(y,p,R){for(var U=-1,B=!1,z=!0,j=0,F=y.length;j<F;j++){var X=y[j];if(z=z&&!X.independent,U>-1&&R<X.start)break;var q=X.loaded;!q&&(B||X.independent||z)&&X.fragment===p&&(U=j),B=q}return U},o.loadedEndOfParts=function(y,p){var R=y[y.length-1];return R&&p>R.start&&R.loaded},o.getInitialLiveFragment=function(y,p){var R=this.fragPrevious,U=null;if(R){if(y.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+R.programDateTime),U=Object(w.findFragmentByPDT)(p,R.endProgramDateTime,this.config.maxFragLookUpTolerance)),!U){var B=R.sn+1;if(B>=y.startSN&&B<=y.endSN){var z=p[B-y.startSN];R.cc===z.cc&&(U=z,this.log("Live playlist, switching playlist, load frag with next SN: "+U.sn))}U||(U=Object(w.findFragWithCC)(p,R.cc),U&&this.log("Live playlist, switching playlist, load frag with same CC: "+U.sn))}}else{var j=this.hls.liveSyncPosition;j!==null&&(U=this.getFragmentAtPosition(j,this.bitrateTest?y.fragmentEnd:y.edge,y))}return U},o.getFragmentAtPosition=function(y,p,R){var U=this.config,B=this.fragPrevious,z=R.fragments,j=R.endSN,F=R.fragmentHint,X=U.maxFragLookUpTolerance,q=!!(U.lowLatencyMode&&R.partList&&F);q&&F&&!this.bitrateTest&&(z=z.concat(F),j=F.sn);var ne;if(y<p){var ue=y>p-X?0:X;ne=Object(w.findFragmentByPTS)(B,z,y,ue)}else ne=z[z.length-1];if(ne){var xe=ne.sn-R.startSN,pe=B&&ne.level===B.level,he=z[xe+1],de=this.fragmentTracker.getState(ne);if(de===M.FragmentState.BACKTRACKED){ne=null;for(var fe=xe;z[fe]&&this.fragmentTracker.getState(z[fe])===M.FragmentState.BACKTRACKED;)B?ne=z[fe--]:ne=z[--fe];ne||(ne=he)}else B&&ne.sn===B.sn&&!q&&(pe&&(ne.sn<j&&this.fragmentTracker.getState(he)!==M.FragmentState.OK?(this.log("SN "+ne.sn+" just loaded, load next one: "+he.sn),ne=he):ne=null))}return ne},o.synchronizeToLiveEdge=function(y){var p=this.config,R=this.media;if(!R)return;var U=this.hls.liveSyncPosition,B=R.currentTime,z=y.fragments[0].start,j=y.edge,F=B>=z-p.maxFragLookUpTolerance&&B<=j;if(U!==null&&R.duration>U&&(B<U||!F)){var X=p.liveMaxLatencyDuration!==void 0?p.liveMaxLatencyDuration:p.liveMaxLatencyDurationCount*y.targetduration;(!F&&R.readyState<4||B<j-X)&&(this.loadedmetadata||(this.nextLoadPosition=U),R.readyState&&(this.warn("Playback: "+B.toFixed(3)+" is located too far from the end of live sliding playlist: "+j+", reset currentTime to : "+U.toFixed(3)),R.currentTime=U))}},o.alignPlaylists=function(y,p){var R=this.levels,U=this.levelLastLoaded,B=this.fragPrevious,z=U!==null?R[U]:null,j=y.fragments.length;if(!j)return this.warn("No fragments in live playlist"),0;var F=y.fragments[0].start,X=!p,q=y.alignedSliding&&Object(H.isFiniteNumber)(F);if(X||!q&&!F){Object(O.alignStream)(B,z,y);var ne=y.fragments[0].start;return this.log("Live playlist sliding: "+ne.toFixed(2)+" start-sn: "+(p?p.startSN:"na")+"->"+y.startSN+" prev-sn: "+(B?B.sn:"na")+" fragments: "+j),ne}return F},o.waitForCdnTuneIn=function(y){var p=3;return y.live&&y.canBlockReload&&y.tuneInGoal>Math.max(y.partHoldBack,y.partTarget*p)},o.setStartPosition=function(y,p){var R=this.startPosition;if(R<p&&(R=-1),R===-1||this.lastCurrentTime===-1){var U=y.startTimeOffset;Object(H.isFiniteNumber)(U)?(R=p+U,U<0&&(R+=y.totalduration),R=Math.min(Math.max(p,R),p+y.totalduration),this.log("Start time offset "+U+" found in playlist, adjust startPosition to "+R),this.startPosition=R):y.live?R=this.hls.liveSyncPosition||p:this.startPosition=R=0,this.lastCurrentTime=R}this.nextLoadPosition=R},o.getLoadPosition=function(){var y=this.media,p=0;return this.loadedmetadata&&y?p=y.currentTime:this.nextLoadPosition&&(p=this.nextLoadPosition),p},o.handleFragLoadAborted=function(y,p){this.transmuxer&&y.sn!=="initSegment"&&y.stats.aborted&&(this.warn("Fragment "+y.sn+(p?" part"+p.index:"")+" of level "+y.level+" was aborted"),this.resetFragmentLoading(y))},o.resetFragmentLoading=function(y){(!this.fragCurrent||!this.fragContextChanged(y))&&(this.state=T.IDLE)},o.onFragmentOrKeyLoadError=function(y,p){if(p.fatal)return;var R=p.frag;if(!R||R.type!==y)return;var U=this.fragCurrent;console.assert(U&&R.sn===U.sn&&R.level===U.level&&R.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(R.level))return;var z=Math.min(Math.pow(2,this.fragLoadError)*B.fragLoadingRetryDelay,B.fragLoadingMaxRetryTimeout);this.warn("Fragment "+R.sn+" of "+y+" "+R.level+" failed to load, retrying in "+z+"ms"),this.retryDate=self.performance.now()+z,this.fragLoadError++,this.state=T.FRAG_LOADING_WAITING_RETRY}else p.levelRetry?(y===l.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=T.IDLE):(_.logger.error(p.details+" reaches max retry, redispatch as fatal ..."),p.fatal=!0,this.hls.stopLoad(),this.state=T.ERROR)},o.afterBufferFlushed=function(y,p,R){if(!y)return;var U=N.BufferHelper.getBuffered(y);this.fragmentTracker.detectEvictedFragments(p,U,R),this.state===T.ENDED&&this.resetLoadingState()},o.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=T.IDLE},o.resetLiveStartWhenNotLoaded=function(y){if(!this.loadedmetadata){this.startFragRequested=!1;var p=this.levels?this.levels[y].details:null;if(p!=null&&p.live)return this.startPosition=-1,this.setStartPosition(p,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},o.updateLevelTiming=function(y,p,R,U){var B=this,z=R.details;console.assert(!!z,"level.details must be defined");var j=Object.keys(y.elementaryStreams).reduce(function(F,X){var q=y.elementaryStreams[X];if(q){var ne=q.endPTS-q.startPTS;if(ne<=0)return B.warn("Could not parse fragment "+y.sn+" "+X+" duration reliably ("+ne+") resetting transmuxer to fallback to playlist timing"),B.resetTransmuxer(),F||!1;var ue=U?0:Object(b.updateFragPTSDTS)(z,y,q.startPTS,q.endPTS,q.startDTS,q.endDTS);return B.hls.trigger(P.Events.LEVEL_PTS_UPDATED,{details:z,level:R,drift:ue,type:X,frag:y,start:q.startPTS,end:q.endPTS}),!0}return F},!1);j?(this.state=T.PARSED,this.hls.trigger(P.Events.FRAG_PARSED,{frag:y,part:p})):this.resetLoadingState()},o.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},C(d,[{key:"state",get:function(){return this._state},set:function(y){var p=this._state;p!==y&&(this._state=y,this.log(p+"->"+y))}}]),d}(k.default)},"./src/controller/buffer-controller.ts":function(Q,K,L){"use strict";L.r(K),L.d(K,"default",function(){return w});var H=L("./src/polyfills/number.ts"),k=L("./src/events.ts"),M=L("./src/utils/logger.ts"),N=L("./src/errors.ts"),_=L("./src/utils/buffer-helper.ts"),P=L("./src/utils/mediasource-helper.ts"),D=L("./src/loader/fragment.ts"),c=L("./src/controller/buffer-operation-queue.ts"),v=Object(P.getMediaSource)(),O=/([ha]vc.)(?:\.[^.,]+)+/,w=function(){function b(s){var a=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=a.hls,u=a.media,C=a.mediaSource;M.logger.log("[buffer-controller]: Media source opened"),u&&(a.updateMediaElementDuration(),l.trigger(k.Events.MEDIA_ATTACHED,{media:u})),C&&C.removeEventListener("sourceopen",a._onMediaSourceOpen),a.checkPendingTracks()},this._onMediaSourceClose=function(){M.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){M.logger.log("[buffer-controller]: Media source ended")},this.hls=s,this._initSourceBuffer(),this.registerListeners()}var E=b.prototype;return E.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},E.destroy=function(){this.unregisterListeners(),this.details=null},E.registerListeners=function(){var a=this.hls;a.on(k.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),a.on(k.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.on(k.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.on(k.Events.BUFFER_RESET,this.onBufferReset,this),a.on(k.Events.BUFFER_APPENDING,this.onBufferAppending,this),a.on(k.Events.BUFFER_CODECS,this.onBufferCodecs,this),a.on(k.Events.BUFFER_EOS,this.onBufferEos,this),a.on(k.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),a.on(k.Events.LEVEL_UPDATED,this.onLevelUpdated,this),a.on(k.Events.FRAG_PARSED,this.onFragParsed,this),a.on(k.Events.FRAG_CHANGED,this.onFragChanged,this)},E.unregisterListeners=function(){var a=this.hls;a.off(k.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),a.off(k.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.off(k.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.off(k.Events.BUFFER_RESET,this.onBufferReset,this),a.off(k.Events.BUFFER_APPENDING,this.onBufferAppending,this),a.off(k.Events.BUFFER_CODECS,this.onBufferCodecs,this),a.off(k.Events.BUFFER_EOS,this.onBufferEos,this),a.off(k.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),a.off(k.Events.LEVEL_UPDATED,this.onLevelUpdated,this),a.off(k.Events.FRAG_PARSED,this.onFragParsed,this),a.off(k.Events.FRAG_CHANGED,this.onFragChanged,this)},E._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new c.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},E.onManifestParsed=function(a,l){var u=2;(l.audio&&!l.video||!l.altAudio)&&(u=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=u,this.details=null,M.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},E.onMediaAttaching=function(a,l){var u=this.media=l.media;if(u&&v){var C=this.mediaSource=new v;C.addEventListener("sourceopen",this._onMediaSourceOpen),C.addEventListener("sourceended",this._onMediaSourceEnded),C.addEventListener("sourceclose",this._onMediaSourceClose),u.src=self.URL.createObjectURL(C),this._objectUrl=u.src}},E.onMediaDetaching=function(){var a=this.media,l=this.mediaSource,u=this._objectUrl;if(l){if(M.logger.log("[buffer-controller]: media source detaching"),l.readyState==="open")try{l.endOfStream()}catch(C){M.logger.warn("[buffer-controller]: onMediaDetaching: "+C.message+" while calling endOfStream")}this.onBufferReset(),l.removeEventListener("sourceopen",this._onMediaSourceOpen),l.removeEventListener("sourceended",this._onMediaSourceEnded),l.removeEventListener("sourceclose",this._onMediaSourceClose),a&&(u&&self.URL.revokeObjectURL(u),a.src===u?(a.removeAttribute("src"),a.load()):M.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(k.Events.MEDIA_DETACHED,void 0)},E.onBufferReset=function(){var a=this;this.getSourceBufferTypes().forEach(function(l){var u=a.sourceBuffer[l];try{u&&(a.removeBufferListeners(l),a.mediaSource&&a.mediaSource.removeSourceBuffer(u),a.sourceBuffer[l]=void 0)}catch(C){M.logger.warn("[buffer-controller]: Failed to reset the "+l+" buffer",C)}}),this._initSourceBuffer()},E.onBufferCodecs=function(a,l){var u=this,C=this.getSourceBufferTypes().length;if(Object.keys(l).forEach(function(g){if(C){var h=u.tracks[g];if(h&&typeof h.buffer.changeType=="function"){var A=l[g],T=A.codec,f=A.levelCodec,m=A.container,d=(h.levelCodec||h.codec).replace(O,"$1"),o=(f||T).replace(O,"$1");if(d!==o){var x=m+";codecs="+(f||T);u.appendChangeType(g,x)}}}else u.pendingTracks[g]=l[g]}),C)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},E.appendChangeType=function(a,l){var u=this,C=this.operationQueue,g={execute:function(){var A=u.sourceBuffer[a];A&&(M.logger.log("[buffer-controller]: changing "+a+" sourceBuffer type to "+l),A.changeType(l)),C.shiftAndExecuteNext(a)},onStart:function(){},onComplete:function(){},onError:function(A){M.logger.warn("[buffer-controller]: Failed to change "+a+" SourceBuffer type",A)}};C.append(g,a)},E.onBufferAppending=function(a,l){var u=this,C=this.hls,g=this.operationQueue,h=this.tracks,A=l.data,T=l.type,f=l.frag,m=l.part,d=l.chunkMeta,o=d.buffering[T],x=self.performance.now();o.start=x;var y=f.stats.buffering,p=m?m.stats.buffering:null;y.start===0&&(y.start=x),p&&p.start===0&&(p.start=x);var R=h.audio,U=T==="audio"&&d.id===1&&(R==null?void 0:R.container)==="audio/mpeg",B={execute:function(){if(o.executeStart=self.performance.now(),U){var j=u.sourceBuffer[T];if(j){var F=f.start-j.timestampOffset;Math.abs(F)>=.1&&(M.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+f.start+" (delta: "+F+") sn: "+f.sn+")"),j.timestampOffset=f.start)}}u.appendExecutor(A,T)},onStart:function(){},onComplete:function(){var j=self.performance.now();o.executeEnd=o.end=j,y.first===0&&(y.first=j),p&&p.first===0&&(p.first=j);var F=u.sourceBuffer,X={};for(var q in F)X[q]=_.BufferHelper.getBuffered(F[q]);u.appendError=0,u.hls.trigger(k.Events.BUFFER_APPENDED,{type:T,frag:f,part:m,chunkMeta:d,parent:f.type,timeRanges:X})},onError:function(j){M.logger.error("[buffer-controller]: Error encountered while trying to append to the "+T+" SourceBuffer",j);var F={type:N.ErrorTypes.MEDIA_ERROR,parent:f.type,details:N.ErrorDetails.BUFFER_APPEND_ERROR,err:j,fatal:!1};j.code===DOMException.QUOTA_EXCEEDED_ERR?F.details=N.ErrorDetails.BUFFER_FULL_ERROR:(u.appendError++,F.details=N.ErrorDetails.BUFFER_APPEND_ERROR,u.appendError>C.config.appendErrorMaxRetry&&(M.logger.error("[buffer-controller]: Failed "+C.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),F.fatal=!0)),C.trigger(k.Events.ERROR,F)}};g.append(B,T)},E.onBufferFlushing=function(a,l){var u=this,C=this.operationQueue,g=function(A){return{execute:u.removeExecutor.bind(u,A,l.startOffset,l.endOffset),onStart:function(){},onComplete:function(){u.hls.trigger(k.Events.BUFFER_FLUSHED,{type:A})},onError:function(f){M.logger.warn("[buffer-controller]: Failed to remove from "+A+" SourceBuffer",f)}}};l.type?C.append(g(l.type),l.type):this.getSourceBufferTypes().forEach(function(h){C.append(g(h),h)})},E.onFragParsed=function(a,l){var u=this,C=l.frag,g=l.part,h=[],A=g?g.elementaryStreams:C.elementaryStreams;A[D.ElementaryStreamTypes.AUDIOVIDEO]?h.push("audiovideo"):(A[D.ElementaryStreamTypes.AUDIO]&&h.push("audio"),A[D.ElementaryStreamTypes.VIDEO]&&h.push("video"));var T=function(){var m=self.performance.now();C.stats.buffering.end=m,g&&(g.stats.buffering.end=m);var d=g?g.stats:C.stats;u.hls.trigger(k.Events.FRAG_BUFFERED,{frag:C,part:g,stats:d,id:C.type})};h.length===0&&M.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+C.type+" level: "+C.level+" sn: "+C.sn),this.blockBuffers(T,h)},E.onFragChanged=function(a,l){this.flushBackBuffer()},E.onBufferEos=function(a,l){var u=this,C=this.getSourceBufferTypes().reduce(function(g,h){var A=u.sourceBuffer[h];return(!l.type||l.type===h)&&(A&&!A.ended&&(A.ended=!0,M.logger.log("[buffer-controller]: "+h+" sourceBuffer now EOS"))),g&&!!(!A||A.ended)},!0);C&&this.blockBuffers(function(){var g=u.mediaSource;if(!g||g.readyState!=="open")return;g.endOfStream()})},E.onLevelUpdated=function(a,l){var u=l.details;if(!u.fragments.length)return;this.details=u,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},E.flushBackBuffer=function(){var a=this.hls,l=this.details,u=this.media,C=this.sourceBuffer;if(!u||l===null)return;var g=this.getSourceBufferTypes();if(!g.length)return;var h=l.live&&a.config.liveBackBufferLength!==null?a.config.liveBackBufferLength:a.config.backBufferLength;if(!Object(H.isFiniteNumber)(h)||h<0)return;var A=u.currentTime,T=l.levelTargetDuration,f=Math.max(h,T),m=Math.floor(A/T)*T-f;g.forEach(function(d){var o=C[d];if(o){var x=_.BufferHelper.getBuffered(o);x.length>0&&m>x.start(0)&&(a.trigger(k.Events.BACK_BUFFER_REACHED,{bufferEnd:m}),l.live&&a.trigger(k.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:m}),a.trigger(k.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:m,type:d}))}})},E.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var a=this.details,l=this.hls,u=this.media,C=this.mediaSource,g=a.fragments[0].start+a.totalduration,h=u.duration,A=Object(H.isFiniteNumber)(C.duration)?C.duration:0;a.live&&l.config.liveDurationInfinity?(M.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),C.duration=Infinity,this.updateSeekableRange(a)):(g>A&&g>h||!Object(H.isFiniteNumber)(h))&&(M.logger.log("[buffer-controller]: Updating Media Source duration to "+g.toFixed(3)),C.duration=g)},E.updateSeekableRange=function(a){var l=this.mediaSource,u=a.fragments,C=u.length;if(C&&a.live&&l!==null&&l!==void 0&&l.setLiveSeekableRange){var g=Math.max(0,u[0].start),h=Math.max(g,g+a.totalduration);l.setLiveSeekableRange(g,h)}},E.checkPendingTracks=function(){var a=this.bufferCodecEventsExpected,l=this.operationQueue,u=this.pendingTracks,C=Object.keys(u).length;if(C&&!a||C===2){this.createSourceBuffers(u),this.pendingTracks={};var g=this.getSourceBufferTypes();if(g.length===0){this.hls.trigger(k.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}g.forEach(function(h){l.executeNext(h)})}},E.createSourceBuffers=function(a){var l=this.sourceBuffer,u=this.mediaSource;if(!u)throw Error("createSourceBuffers called when mediaSource was null");var C=0;for(var g in a)if(!l[g]){var h=a[g];if(!h)throw Error("source buffer exists for track "+g+", however track does not");var A=h.levelCodec||h.codec,T=h.container+";codecs="+A;M.logger.log("[buffer-controller]: creating sourceBuffer("+T+")");try{var f=l[g]=u.addSourceBuffer(T),m=g;this.addBufferListener(m,"updatestart",this._onSBUpdateStart),this.addBufferListener(m,"updateend",this._onSBUpdateEnd),this.addBufferListener(m,"error",this._onSBUpdateError),this.tracks[g]={buffer:f,codec:A,container:h.container,levelCodec:h.levelCodec,id:h.id},C++}catch(d){M.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+d.message),this.hls.trigger(k.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:d,mimeType:T})}}C&&this.hls.trigger(k.Events.BUFFER_CREATED,{tracks:this.tracks})},E._onSBUpdateStart=function(a){var l=this.operationQueue,u=l.current(a);u.onStart()},E._onSBUpdateEnd=function(a){var l=this.operationQueue,u=l.current(a);u.onComplete(),l.shiftAndExecuteNext(a)},E._onSBUpdateError=function(a,l){M.logger.error("[buffer-controller]: "+a+" SourceBuffer error",l),this.hls.trigger(k.Events.ERROR,{type:N.ErrorTypes.MEDIA_ERROR,details:N.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var u=this.operationQueue.current(a);u&&u.onError(l)},E.removeExecutor=function(a,l,u){var C=this.media,g=this.mediaSource,h=this.operationQueue,A=this.sourceBuffer,T=A[a];if(!C||!g||!T){M.logger.warn("[buffer-controller]: Attempting to remove from the "+a+" SourceBuffer, but it does not exist"),h.shiftAndExecuteNext(a);return}var f=Object(H.isFiniteNumber)(C.duration)?C.duration:Infinity,m=Object(H.isFiniteNumber)(g.duration)?g.duration:Infinity,d=Math.max(0,l),o=Math.min(u,f,m);o>d?(M.logger.log("[buffer-controller]: Removing ["+d+","+o+"] from the "+a+" SourceBuffer"),console.assert(!T.updating,a+" sourceBuffer must not be updating"),T.remove(d,o)):h.shiftAndExecuteNext(a)},E.appendExecutor=function(a,l){var u=this.operationQueue,C=this.sourceBuffer,g=C[l];if(!g){M.logger.warn("[buffer-controller]: Attempting to append to the "+l+" SourceBuffer, but it does not exist"),u.shiftAndExecuteNext(l);return}g.ended=!1,console.assert(!g.updating,l+" sourceBuffer must not be updating"),g.appendBuffer(a)},E.blockBuffers=function(a,l){var u=this;if(l===void 0&&(l=this.getSourceBufferTypes()),!l.length){M.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(a);return}var C=this.operationQueue,g=l.map(function(h){return C.appendBlocker(h)});Promise.all(g).then(function(){a(),l.forEach(function(h){var A=u.sourceBuffer[h];(!A||!A.updating)&&C.shiftAndExecuteNext(h)})})},E.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},E.addBufferListener=function(a,l,u){var C=this.sourceBuffer[a];if(!C)return;var g=u.bind(this,a);this.listeners[a].push({event:l,listener:g}),C.addEventListener(l,g)},E.removeBufferListeners=function(a){var l=this.sourceBuffer[a];if(!l)return;this.listeners[a].forEach(function(u){l.removeEventListener(u.event,u.listener)})},b}()},"./src/controller/buffer-operation-queue.ts":function(Q,K,L){"use strict";L.r(K),L.d(K,"default",function(){return k});var H=L("./src/utils/logger.ts"),k=function(){function M(_){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=_}var N=M.prototype;return N.append=function(P,D){var c=this.queues[D];c.push(P),c.length===1&&this.buffers[D]&&this.executeNext(D)},N.insertAbort=function(P,D){var c=this.queues[D];c.unshift(P),this.executeNext(D)},N.appendBlocker=function(P){var D,c=new Promise(function(O){D=O}),v={execute:D,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(v,P),c},N.executeNext=function(P){var D=this.buffers,c=this.queues,v=D[P],O=c[P];if(O.length){var w=O[0];try{w.execute()}catch(b){H.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),w.onError(b),(!v||!v.updating)&&(O.shift(),this.executeNext(P))}}},N.shiftAndExecuteNext=function(P){this.queues[P].shift(),this.executeNext(P)},N.current=function(P){return this.queues[P][0]},M}()},"./src/controller/cap-level-controller.ts":function(Q,K,L){"use strict";L.r(K);var H=L("./src/events.ts");function k(_,P){for(var D=0;D<P.length;D++){var c=P[D];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(_,c.key,c)}}function M(_,P,D){return P&&k(_.prototype,P),D&&k(_,D),_}var N=function(){function _(D){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=D,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var P=_.prototype;return P.setStreamController=function(c){this.streamController=c},P.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},P.registerListeners=function(){var c=this.hls;c.on(H.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),c.on(H.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),c.on(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.on(H.Events.BUFFER_CODECS,this.onBufferCodecs,this),c.on(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},P.unregisterListener=function(){var c=this.hls;c.off(H.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),c.off(H.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),c.off(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.off(H.Events.BUFFER_CODECS,this.onBufferCodecs,this),c.off(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},P.onFpsDropLevelCapping=function(c,v){_.isLevelAllowed(v.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(v.droppedLevel)},P.onMediaAttaching=function(c,v){this.media=v.media instanceof HTMLVideoElement?v.media:null},P.onManifestParsed=function(c,v){var O=this.hls;this.restrictedLevels=[],this.firstLevel=v.firstLevel,O.config.capLevelToPlayerSize&&v.video&&this.startCapping()},P.onBufferCodecs=function(c,v){var O=this.hls;O.config.capLevelToPlayerSize&&v.video&&this.startCapping()},P.onMediaDetaching=function(){this.stopCapping()},P.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var c=this.hls.levels;if(c.length){var v=this.hls;v.autoLevelCapping=this.getMaxLevel(c.length-1),v.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=v.autoLevelCapping}}},P.getMaxLevel=function(c){var v=this,O=this.hls.levels;if(!O.length)return-1;var w=O.filter(function(b,E){return _.isLevelAllowed(E,v.restrictedLevels)&&E<=c});return this.clientRect=null,_.getMaxLevelByMediaSize(w,this.mediaWidth,this.mediaHeight)},P.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()},P.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},P.getDimensions=function(){if(this.clientRect)return this.clientRect;var c=this.media,v={width:0,height:0};if(c){var O=c.getBoundingClientRect();v.width=O.width,v.height=O.height,!v.width&&!v.height&&(v.width=O.right-O.left||c.width||0,v.height=O.bottom-O.top||c.height||0)}return this.clientRect=v,v},_.isLevelAllowed=function(c,v){return v===void 0&&(v=[]),v.indexOf(c)===-1},_.getMaxLevelByMediaSize=function(c,v,O){if(!c||!c.length)return-1;for(var w=function(l,u){return u?l.width!==u.width||l.height!==u.height:!0},b=c.length-1,E=0;E<c.length;E+=1){var s=c[E];if((s.width>=v||s.height>=O)&&w(s,c[E+1])){b=E;break}}return b},M(_,[{key:"mediaWidth",get:function(){return this.getDimensions().width*_.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*_.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var c=1;try{c=self.devicePixelRatio}catch(v){}return c}}]),_}();K.default=N},"./src/controller/cmcd-controller.ts":function(Q,K,L){"use strict";L.r(K),L.d(K,"default",function(){return w});var H=L("./src/events.ts"),k=L("./src/types/cmcd.ts"),M=L("./src/utils/buffer-helper.ts"),N=L("./src/utils/logger.ts");function _(b,E){for(var s=0;s<E.length;s++){var a=E[s];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(b,a.key,a)}}function P(b,E,s){return E&&_(b.prototype,E),s&&_(b,s),b}function D(b,E){var s=typeof Symbol!="undefined"&&b[Symbol.iterator]||b["@@iterator"];if(s)return(s=s.call(b)).next.bind(s);if(Array.isArray(b)||(s=c(b))||E&&b&&typeof b.length=="number"){s&&(b=s);var a=0;return function(){return a>=b.length?{done:!0}:{done:!1,value:b[a++]}}}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 c(b,E){if(!b)return;if(typeof b=="string")return v(b,E);var s=Object.prototype.toString.call(b).slice(8,-1);if(s==="Object"&&b.constructor&&(s=b.constructor.name),s==="Map"||s==="Set")return Array.from(b);if(s==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s))return v(b,E)}function v(b,E){(E==null||E>b.length)&&(E=b.length);for(var s=0,a=new Array(E);s<E;s++)a[s]=b[s];return a}function O(){return O=Object.assign||function(b){for(var E=1;E<arguments.length;E++){var s=arguments[E];for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(b[a]=s[a])}return b},O.apply(this,arguments)}var w=function(){function b(s){var a=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(){a.initialized&&(a.starved=!0),a.buffering=!0},this.onPlaying=function(){a.initialized||(a.initialized=!0),a.buffering=!1},this.applyPlaylistData=function(C){try{a.apply(C,{ot:k.CMCDObjectType.MANIFEST,su:!a.initialized})}catch(g){N.logger.warn("Could not generate manifest CMCD data.",g)}},this.applyFragmentData=function(C){try{var g=C.frag,h=a.hls.levels[g.level],A=a.getObjectType(g),T={d:g.duration*1e3,ot:A};(A===k.CMCDObjectType.VIDEO||A===k.CMCDObjectType.AUDIO||A==k.CMCDObjectType.MUXED)&&(T.br=h.bitrate/1e3,T.tb=a.getTopBandwidth(A),T.bl=a.getBufferLength(A)),a.apply(C,T)}catch(f){N.logger.warn("Could not generate segment CMCD data.",f)}},this.hls=s;var l=this.config=s.config,u=l.cmcd;u!=null&&(l.pLoader=this.createPlaylistLoader(),l.fLoader=this.createFragmentLoader(),this.sid=u.sessionId||b.uuid(),this.cid=u.contentId,this.useHeaders=u.useHeaders===!0,this.registerListeners())}var E=b.prototype;return E.registerListeners=function(){var a=this.hls;a.on(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.on(H.Events.MEDIA_DETACHED,this.onMediaDetached,this),a.on(H.Events.BUFFER_CREATED,this.onBufferCreated,this)},E.unregisterListeners=function(){var a=this.hls;a.off(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.off(H.Events.MEDIA_DETACHED,this.onMediaDetached,this),a.off(H.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},E.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},E.onMediaAttached=function(a,l){this.media=l.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},E.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},E.onBufferCreated=function(a,l){var u,C;this.audioBuffer=(u=l.tracks.audio)===null||u===void 0?void 0:u.buffer,this.videoBuffer=(C=l.tracks.video)===null||C===void 0?void 0:C.buffer},E.createData=function(){var a;return{v:k.CMCDVersion,sf:k.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(a=this.media)===null||a===void 0?void 0:a.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},E.apply=function(a,l){l===void 0&&(l={}),O(l,this.createData());var u=l.ot===k.CMCDObjectType.INIT||l.ot===k.CMCDObjectType.VIDEO||l.ot===k.CMCDObjectType.MUXED;if(this.starved&&u&&(l.bs=!0,l.su=!0,this.starved=!1),l.su==null&&(l.su=this.buffering),this.useHeaders){var C=b.toHeaders(l);if(!Object.keys(C).length)return;a.headers||(a.headers={}),O(a.headers,C)}else{var g=b.toQuery(l);if(!g)return;a.url=b.appendQueryToUri(a.url,g)}},E.getObjectType=function(a){var l=a.type;return l==="subtitle"?k.CMCDObjectType.TIMED_TEXT:a.sn==="initSegment"?k.CMCDObjectType.INIT:l==="audio"?k.CMCDObjectType.AUDIO:l==="main"?this.hls.audioTracks.length?k.CMCDObjectType.VIDEO:k.CMCDObjectType.MUXED:void 0},E.getTopBandwidth=function(a){for(var l=0,u=a===k.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,C=D(u),g;!(g=C()).done;){var h=g.value;h.bitrate>l&&(l=h.bitrate)}return l>0?l:NaN},E.getBufferLength=function(a){var l=this.hls.media,u=a===k.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!u||!l)return NaN;var C=M.BufferHelper.bufferInfo(u,l.currentTime,this.config.maxBufferHole);return C.len*1e3},E.createPlaylistLoader=function(){var a=this.config.pLoader,l=this.applyPlaylistData,u=a||this.config.loader;return function(){function C(h){this.loader=void 0,this.loader=new u(h)}var g=C.prototype;return g.destroy=function(){this.loader.destroy()},g.abort=function(){this.loader.abort()},g.load=function(A,T,f){l(A),this.loader.load(A,T,f)},P(C,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),C}()},E.createFragmentLoader=function(){var a=this.config.fLoader,l=this.applyFragmentData,u=a||this.config.loader;return function(){function C(h){this.loader=void 0,this.loader=new u(h)}var g=C.prototype;return g.destroy=function(){this.loader.destroy()},g.abort=function(){this.loader.abort()},g.load=function(A,T,f){l(A),this.loader.load(A,T,f)},P(C,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),C}()},b.uuid=function(){var a=URL.createObjectURL(new Blob),l=a.toString();return URL.revokeObjectURL(a),l.substr(l.lastIndexOf("/")+1)},b.serialize=function(a){for(var l=[],u=function(U){return!Number.isNaN(U)&&U!=null&&U!==""&&U!==!1},C=function(U){return Math.round(U)},g=function(U){return C(U/100)*100},h=function(U){return encodeURIComponent(U)},A={br:C,d:C,bl:g,dl:g,mtp:g,nor:h,rtp:g,tb:C},T=Object.keys(a||{}).sort(),f=D(T),m;!(m=f()).done;){var d=m.value,o=a[d];if(!u(o))continue;if(d==="v"&&o===1)continue;if(d=="pr"&&o===1)continue;var x=A[d];x&&(o=x(o));var y=typeof o,p=void 0;d==="ot"||d==="sf"||d==="st"?p=d+"="+o:y==="boolean"?p=d:y==="number"?p=d+"="+o:p=d+"="+JSON.stringify(o),l.push(p)}return l.join(",")},b.toHeaders=function(a){for(var l=Object.keys(a),u={},C=["Object","Request","Session","Status"],g=[{},{},{},{}],h={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},A=0,T=l;A<T.length;A++){var f=T[A],m=h[f]!=null?h[f]:1;g[m][f]=a[f]}for(var d=0;d<g.length;d++){var o=b.serialize(g[d]);o&&(u["CMCD-"+C[d]]=o)}return u},b.toQuery=function(a){return"CMCD="+encodeURIComponent(b.serialize(a))},b.appendQueryToUri=function(a,l){if(!l)return a;var u=a.includes("?")?"&":"?";return""+a+u+l},b}()},"./src/controller/eme-controller.ts":function(Q,K,L){"use strict";L.r(K);var H=L("./src/events.ts"),k=L("./src/errors.ts"),M=L("./src/utils/logger.ts"),N=L("./src/utils/mediakeys-helper.ts");function _(w,b){for(var E=0;E<b.length;E++){var s=b[E];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(w,s.key,s)}}function P(w,b,E){return b&&_(w.prototype,b),E&&_(w,E),w}var D=3,c=function(b,E,s){var a={audioCapabilities:[],videoCapabilities:[]};return b.forEach(function(l){a.audioCapabilities.push({contentType:'audio/mp4; codecs="'+l+'"',robustness:s.audioRobustness||""})}),E.forEach(function(l){a.videoCapabilities.push({contentType:'video/mp4; codecs="'+l+'"',robustness:s.videoRobustness||""})}),[a]},v=function(b,E,s,a){switch(b){case N.KeySystems.WIDEVINE:return c(E,s,a);default:throw new Error("Unknown key-system: "+b)}},O=function(){function w(E){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=E,this._config=E.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 b=w.prototype;return b.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},b._registerListeners=function(){this.hls.on(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(H.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(H.Events.MANIFEST_PARSED,this.onManifestParsed,this)},b._unregisterListeners=function(){this.hls.off(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(H.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(H.Events.MANIFEST_PARSED,this.onManifestParsed,this)},b.getLicenseServerUrl=function(s){switch(s){case N.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+s+'"')},b._attemptKeySystemAccess=function(s,a,l){var u=this,C=v(s,a,l,this._drmSystemOptions);M.logger.log("Requesting encrypted media key-system access");var g=this.requestMediaKeySystemAccess(s,C);this.mediaKeysPromise=g.then(function(h){return u._onMediaKeySystemAccessObtained(s,h)}),g.catch(function(h){M.logger.error('Failed to obtain key-system "'+s+'" access:',h)})},b._onMediaKeySystemAccessObtained=function(s,a){var l=this;M.logger.log('Access for key-system "'+s+'" obtained');var u={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:a,mediaKeySystemDomain:s};this._mediaKeysList.push(u);var C=Promise.resolve().then(function(){return a.createMediaKeys()}).then(function(g){return u.mediaKeys=g,M.logger.log('Media-keys created for key-system "'+s+'"'),l._onMediaKeysCreated(),g});return C.catch(function(g){M.logger.error("Failed to create media-keys:",g)}),C},b._onMediaKeysCreated=function(){var s=this;this._mediaKeysList.forEach(function(a){a.mediaKeysSession||(a.mediaKeysSession=a.mediaKeys.createSession(),s._onNewMediaKeySession(a.mediaKeysSession))})},b._onNewMediaKeySession=function(s){var a=this;M.logger.log("New key-system session "+s.sessionId),s.addEventListener("message",function(l){a._onKeySessionMessage(s,l.message)},!1)},b._onKeySessionMessage=function(s,a){M.logger.log("Got EME message event, creating license request"),this._requestLicense(a,function(l){M.logger.log("Received license data (length: "+(l&&l.byteLength)+"), updating key-session"),s.update(l)})},b.onMediaEncrypted=function(s){var a=this;if(M.logger.log('Media is encrypted using "'+s.initDataType+'" init data type'),!this.mediaKeysPromise){M.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(H.Events.ERROR,{type:k.ErrorTypes.KEY_SYSTEM_ERROR,details:k.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var l=function(C){if(!a._media)return;a._attemptSetMediaKeys(C),a._generateRequestWithPreferredKeySession(s.initDataType,s.initData)};this.mediaKeysPromise.then(l).catch(l)},b._attemptSetMediaKeys=function(s){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var a=this._mediaKeysList[0];if(!a||!a.mediaKeys){M.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(H.Events.ERROR,{type:k.ErrorTypes.KEY_SYSTEM_ERROR,details:k.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}M.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(a.mediaKeys),this._hasSetMediaKeys=!0}},b._generateRequestWithPreferredKeySession=function(s,a){var l=this,u=this._mediaKeysList[0];if(!u){M.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(H.Events.ERROR,{type:k.ErrorTypes.KEY_SYSTEM_ERROR,details:k.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(u.mediaKeysSessionInitialized){M.logger.warn("Key-Session already initialized but requested again");return}var C=u.mediaKeysSession;if(!C){M.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(H.Events.ERROR,{type:k.ErrorTypes.KEY_SYSTEM_ERROR,details:k.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!a){M.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(H.Events.ERROR,{type:k.ErrorTypes.KEY_SYSTEM_ERROR,details:k.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}M.logger.log('Generating key-session request for "'+s+'" init data type'),u.mediaKeysSessionInitialized=!0,C.generateRequest(s,a).then(function(){M.logger.debug("Key-session generation succeeded")}).catch(function(g){M.logger.error("Error generating key-session request:",g),l.hls.trigger(H.Events.ERROR,{type:k.ErrorTypes.KEY_SYSTEM_ERROR,details:k.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},b._createLicenseXhr=function(s,a,l){var u=new XMLHttpRequest;u.responseType="arraybuffer",u.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,u,s,a,l);var C=this._licenseXhrSetup;if(C)try{C.call(this.hls,u,s),C=void 0}catch(g){M.logger.error(g)}try{u.readyState||u.open("POST",s,!0),C&&C.call(this.hls,u,s)}catch(g){throw new Error("issue setting up KeySystem license XHR "+g)}return u},b._onLicenseRequestReadyStageChange=function(s,a,l,u){switch(s.readyState){case 4:if(s.status===200){this._requestLicenseFailureCount=0,M.logger.log("License request succeeded");var C=s.response,g=this._licenseResponseCallback;if(g)try{C=g.call(this.hls,s,a)}catch(A){M.logger.error(A)}u(C)}else{if(M.logger.error("License Request XHR failed ("+a+"). Status: "+s.status+" ("+s.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>D){this.hls.trigger(H.Events.ERROR,{type:k.ErrorTypes.KEY_SYSTEM_ERROR,details:k.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var h=D-this._requestLicenseFailureCount+1;M.logger.warn("Retrying license request, "+h+" attempts left"),this._requestLicense(l,u)}break}},b._generateLicenseRequestChallenge=function(s,a){switch(s.mediaKeySystemDomain){case N.KeySystems.WIDEVINE:return a}throw new Error("unsupported key-system: "+s.mediaKeySystemDomain)},b._requestLicense=function(s,a){M.logger.log("Requesting content license for key-system");var l=this._mediaKeysList[0];if(!l){M.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(H.Events.ERROR,{type:k.ErrorTypes.KEY_SYSTEM_ERROR,details:k.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var u=this.getLicenseServerUrl(l.mediaKeySystemDomain),C=this._createLicenseXhr(u,s,a);M.logger.log("Sending license request to URL: "+u);var g=this._generateLicenseRequestChallenge(l,s);C.send(g)}catch(h){M.logger.error("Failure requesting DRM license: "+h),this.hls.trigger(H.Events.ERROR,{type:k.ErrorTypes.KEY_SYSTEM_ERROR,details:k.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},b.onMediaAttached=function(s,a){if(!this._emeEnabled)return;var l=a.media;this._media=l,l.addEventListener("encrypted",this._onMediaEncrypted)},b.onMediaDetached=function(){var s=this._media,a=this._mediaKeysList;if(!s)return;s.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(a.map(function(l){if(l.mediaKeysSession)return l.mediaKeysSession.close().catch(function(){})})).then(function(){return s.setMediaKeys(null)}).catch(function(){})},b.onManifestParsed=function(s,a){if(!this._emeEnabled)return;var l=a.levels.map(function(C){return C.audioCodec}).filter(function(C){return!!C}),u=a.levels.map(function(C){return C.videoCodec}).filter(function(C){return!!C});this._attemptKeySystemAccess(N.KeySystems.WIDEVINE,l,u)},P(w,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),w}();K.default=O},"./src/controller/fps-controller.ts":function(Q,K,L){"use strict";L.r(K);var H=L("./src/events.ts"),k=L("./src/utils/logger.ts"),M=function(){function N(P){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=P,this.registerListeners()}var _=N.prototype;return _.setStreamController=function(D){this.streamController=D},_.registerListeners=function(){this.hls.on(H.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},_.unregisterListeners=function(){this.hls.off(H.Events.MEDIA_ATTACHING,this.onMediaAttaching)},_.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},_.onMediaAttaching=function(D,c){var v=this.hls.config;if(v.capLevelOnFPSDrop){var O=c.media instanceof self.HTMLVideoElement?c.media:null;this.media=O,O&&typeof O.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),v.fpsDroppedMonitoringPeriod)}},_.checkFPS=function(D,c,v){var O=performance.now();if(c){if(this.lastTime){var w=O-this.lastTime,b=v-this.lastDroppedFrames,E=c-this.lastDecodedFrames,s=1e3*b/w,a=this.hls;if(a.trigger(H.Events.FPS_DROP,{currentDropped:b,currentDecoded:E,totalDroppedFrames:v}),s>0&&b>a.config.fpsDroppedMonitoringThreshold*E){var l=a.currentLevel;k.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+l),l>0&&(a.autoLevelCapping===-1||a.autoLevelCapping>=l)&&(l=l-1,a.trigger(H.Events.FPS_DROP_LEVEL_CAPPING,{level:l,droppedLevel:a.currentLevel}),a.autoLevelCapping=l,this.streamController.nextLevelSwitch())}}this.lastTime=O,this.lastDroppedFrames=v,this.lastDecodedFrames=c}},_.checkFPSInterval=function(){var D=this.media;if(D)if(this.isVideoPlaybackQualityAvailable){var c=D.getVideoPlaybackQuality();this.checkFPS(D,c.totalVideoFrames,c.droppedVideoFrames)}else this.checkFPS(D,D.webkitDecodedFrameCount,D.webkitDroppedFrameCount)},N}();K.default=M},"./src/controller/fragment-finders.ts":function(Q,K,L){"use strict";L.r(K),L.d(K,"findFragmentByPDT",function(){return M}),L.d(K,"findFragmentByPTS",function(){return N}),L.d(K,"fragmentWithinToleranceTest",function(){return _}),L.d(K,"pdtWithinToleranceTest",function(){return P}),L.d(K,"findFragWithCC",function(){return D});var H=L("./src/polyfills/number.ts"),k=L("./src/utils/binary-search.ts");function M(c,v,O){if(v===null||!Array.isArray(c)||!c.length||!Object(H.isFiniteNumber)(v))return null;var w=c[0].programDateTime;if(v<(w||0))return null;var b=c[c.length-1].endProgramDateTime;if(v>=(b||0))return null;O=O||0;for(var E=0;E<c.length;++E){var s=c[E];if(P(v,O,s))return s}return null}function N(c,v,O,w){O===void 0&&(O=0),w===void 0&&(w=0);var b=null;if(c?b=v[c.sn-v[0].sn+1]||null:O===0&&v[0].start===0&&(b=v[0]),b&&_(O,w,b)===0)return b;var E=k.default.search(v,_.bind(null,O,w));return E||b}function _(c,v,O){c===void 0&&(c=0),v===void 0&&(v=0);var w=Math.min(v,O.duration+(O.deltaPTS?O.deltaPTS:0));return O.start+O.duration-w<=c?1:O.start-w>c&&O.start?-1:0}function P(c,v,O){var w=Math.min(v,O.duration+(O.deltaPTS?O.deltaPTS:0))*1e3,b=O.endProgramDateTime||0;return b-w>c}function D(c,v){return k.default.search(c,function(O){return O.cc<v?1:O.cc>v?-1:0})}},"./src/controller/fragment-tracker.ts":function(Q,K,L){"use strict";L.r(K),L.d(K,"FragmentState",function(){return M}),L.d(K,"FragmentTracker",function(){return N});var H=L("./src/events.ts"),k=L("./src/types/loader.ts"),M;(function(D){D.NOT_LOADED="NOT_LOADED",D.BACKTRACKED="BACKTRACKED",D.APPENDING="APPENDING",D.PARTIAL="PARTIAL",D.OK="OK"})(M||(M={}));var N=function(){function D(v){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=v,this._registerListeners()}var c=D.prototype;return c._registerListeners=function(){var O=this.hls;O.on(H.Events.BUFFER_APPENDED,this.onBufferAppended,this),O.on(H.Events.FRAG_BUFFERED,this.onFragBuffered,this),O.on(H.Events.FRAG_LOADED,this.onFragLoaded,this)},c._unregisterListeners=function(){var O=this.hls;O.off(H.Events.BUFFER_APPENDED,this.onBufferAppended,this),O.off(H.Events.FRAG_BUFFERED,this.onFragBuffered,this),O.off(H.Events.FRAG_LOADED,this.onFragLoaded,this)},c.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},c.getAppendedFrag=function(O,w){if(w===k.PlaylistLevelType.MAIN){var b=this.activeFragment,E=this.activeParts;if(!b)return null;if(E)for(var s=E.length;s--;){var a=E[s],l=a?a.end:b.appendedPTS;if(a.start<=O&&l!==void 0&&O<=l)return s>9&&(this.activeParts=E.slice(s-9)),a}else if(b.start<=O&&b.appendedPTS!==void 0&&O<=b.appendedPTS)return b}return this.getBufferedFrag(O,w)},c.getBufferedFrag=function(O,w){for(var b=this.fragments,E=Object.keys(b),s=E.length;s--;){var a=b[E[s]];if((a==null?void 0:a.body.type)===w&&a.buffered){var l=a.body;if(l.start<=O&&O<=l.end)return l}}return null},c.detectEvictedFragments=function(O,w,b){var E=this;Object.keys(this.fragments).forEach(function(s){var a=E.fragments[s];if(!a)return;if(!a.buffered){a.body.type===b&&E.removeFragment(a.body);return}var l=a.range[O];if(!l)return;l.time.some(function(u){var C=!E.isTimeBuffered(u.startPTS,u.endPTS,w);return C&&E.removeFragment(a.body),C})})},c.detectPartialFragments=function(O){var w=this,b=this.timeRanges,E=O.frag,s=O.part;if(!b||E.sn==="initSegment")return;var a=P(E),l=this.fragments[a];if(!l)return;Object.keys(b).forEach(function(u){var C=E.elementaryStreams[u];if(!C)return;var g=b[u],h=s!==null||C.partial===!0;l.range[u]=w.getBufferedTimes(E,s,h,g)}),l.backtrack=l.loaded=null,Object.keys(l.range).length?l.buffered=!0:this.removeFragment(l.body)},c.fragBuffered=function(O){var w=P(O),b=this.fragments[w];b&&(b.backtrack=b.loaded=null,b.buffered=!0)},c.getBufferedTimes=function(O,w,b,E){for(var s={time:[],partial:b},a=w?w.start:O.start,l=w?w.end:O.end,u=O.minEndPTS||l,C=O.maxStartPTS||a,g=0;g<E.length;g++){var h=E.start(g)-this.bufferPadding,A=E.end(g)+this.bufferPadding;if(C>=h&&u<=A){s.time.push({startPTS:Math.max(a,E.start(g)),endPTS:Math.min(l,E.end(g))});break}else if(a<A&&l>h)s.partial=!0,s.time.push({startPTS:Math.max(a,E.start(g)),endPTS:Math.min(l,E.end(g))});else if(l<=h)break}return s},c.getPartialFragment=function(O){var w=null,b,E,s,a=0,l=this.bufferPadding,u=this.fragments;return Object.keys(u).forEach(function(C){var g=u[C];if(!g)return;_(g)&&(E=g.body.start-l,s=g.body.end+l,O>=E&&O<=s&&(b=Math.min(O-E,s-O),a<=b&&(w=g.body,a=b)))}),w},c.getState=function(O){var w=P(O),b=this.fragments[w];return b?b.buffered?_(b)?M.PARTIAL:M.OK:b.backtrack?M.BACKTRACKED:M.APPENDING:M.NOT_LOADED},c.backtrack=function(O,w){var b=P(O),E=this.fragments[b];if(!E||E.backtrack)return null;var s=E.backtrack=w||E.loaded;return E.loaded=null,s},c.getBacktrackData=function(O){var w=P(O),b=this.fragments[w];if(b){var E,s=b.backtrack;if(s!=null&&(E=s.payload)!==null&&E!==void 0&&E.byteLength)return s;this.removeFragment(O)}return null},c.isTimeBuffered=function(O,w,b){for(var E,s,a=0;a<b.length;a++){if(E=b.start(a)-this.bufferPadding,s=b.end(a)+this.bufferPadding,O>=E&&w<=s)return!0;if(w<=E)return!1}return!1},c.onFragLoaded=function(O,w){var b=w.frag,E=w.part;if(b.sn==="initSegment"||b.bitrateTest||E)return;var s=P(b);this.fragments[s]={body:b,loaded:w,backtrack:null,buffered:!1,range:Object.create(null)}},c.onBufferAppended=function(O,w){var b=this,E=w.frag,s=w.part,a=w.timeRanges;if(E.type===k.PlaylistLevelType.MAIN)if(this.activeFragment=E,s){var l=this.activeParts;l||(this.activeParts=l=[]),l.push(s)}else this.activeParts=null;this.timeRanges=a,Object.keys(a).forEach(function(u){var C=a[u];if(b.detectEvictedFragments(u,C),!s)for(var g=0;g<C.length;g++)E.appendedPTS=Math.max(C.end(g),E.appendedPTS||0)})},c.onFragBuffered=function(O,w){this.detectPartialFragments(w)},c.hasFragment=function(O){var w=P(O);return!!this.fragments[w]},c.removeFragmentsInRange=function(O,w,b){var E=this;Object.keys(this.fragments).forEach(function(s){var a=E.fragments[s];if(!a)return;if(a.buffered){var l=a.body;l.type===b&&l.start<w&&l.end>O&&E.removeFragment(l)}})},c.removeFragment=function(O){var w=P(O);O.stats.loaded=0,O.clearElementaryStreamInfo(),delete this.fragments[w]},c.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},D}();function _(D){var c,v;return D.buffered&&(((c=D.range.video)===null||c===void 0?void 0:c.partial)||((v=D.range.audio)===null||v===void 0?void 0:v.partial))}function P(D){return D.type+"_"+D.level+"_"+D.urlId+"_"+D.sn}},"./src/controller/gap-controller.ts":function(Q,K,L){"use strict";L.r(K),L.d(K,"STALL_MINIMUM_DURATION_MS",function(){return _}),L.d(K,"MAX_START_GAP_JUMP",function(){return P}),L.d(K,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return D}),L.d(K,"SKIP_BUFFER_RANGE_START",function(){return c}),L.d(K,"default",function(){return v});var H=L("./src/utils/buffer-helper.ts"),k=L("./src/errors.ts"),M=L("./src/events.ts"),N=L("./src/utils/logger.ts"),_=250,P=2,D=.1,c=.05,v=function(){function O(b,E,s,a){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=b,this.media=E,this.fragmentTracker=s,this.hls=a}var w=O.prototype;return w.destroy=function(){this.hls=this.fragmentTracker=this.media=null},w.poll=function(E){var s=this.config,a=this.media,l=this.stalled,u=a.currentTime,C=a.seeking,g=this.seeking&&!C,h=!this.seeking&&C;if(this.seeking=C,u!==E){if(this.moved=!0,l!==null){if(this.stallReported){var A=self.performance.now()-l;N.logger.warn("playback not stuck anymore @"+u+", after "+Math.round(A)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((h||g)&&(this.stalled=null),a.paused||a.ended||a.playbackRate===0||!H.BufferHelper.getBuffered(a).length)return;var T=H.BufferHelper.bufferInfo(a,u,0),f=T.len>0,m=T.nextStart||0;if(!f&&!m)return;if(C){var d=T.len>P,o=!m||m-u>P&&!this.fragmentTracker.getPartialFragment(u);if(d||o)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var x,y=Math.max(m,T.start||0)-u,p=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,R=p==null||((x=p.details)===null||x===void 0)?void 0:x.live,U=R?p.details.targetduration*2:P;if(y>0&&y<=U){this._trySkipBufferHole(null);return}}var B=self.performance.now();if(l===null){this.stalled=B;return}var z=B-l;!C&&z>=_&&this._reportStall(T.len);var j=H.BufferHelper.bufferInfo(a,u,s.maxBufferHole);this._tryFixBufferStall(j,z)},w._tryFixBufferStall=function(E,s){var a=this.config,l=this.fragmentTracker,u=this.media,C=u.currentTime,g=l.getPartialFragment(C);if(g){var h=this._trySkipBufferHole(g);if(h)return}E.len>a.maxBufferHole&&s>a.highBufferWatchdogPeriod*1e3&&(N.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},w._reportStall=function(E){var s=this.hls,a=this.media,l=this.stallReported;l||(this.stallReported=!0,N.logger.warn("Playback stalling at @"+a.currentTime+" due to low buffer (buffer="+E+")"),s.trigger(M.Events.ERROR,{type:k.ErrorTypes.MEDIA_ERROR,details:k.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:E}))},w._trySkipBufferHole=function(E){for(var s=this.config,a=this.hls,l=this.media,u=l.currentTime,C=0,g=H.BufferHelper.getBuffered(l),h=0;h<g.length;h++){var A=g.start(h);if(u+s.maxBufferHole>=C&&u<A){var T=Math.max(A+c,l.currentTime+D);return N.logger.warn("skipping hole, adjusting currentTime from "+u+" to "+T),this.moved=!0,this.stalled=null,l.currentTime=T,E&&a.trigger(M.Events.ERROR,{type:k.ErrorTypes.MEDIA_ERROR,details:k.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+u+" to "+T,frag:E}),T}C=g.end(h)}return 0},w._tryNudgeBuffer=function(){var E=this.config,s=this.hls,a=this.media,l=a.currentTime,u=(this.nudgeRetry||0)+1;if(this.nudgeRetry=u,u<E.nudgeMaxRetry){var C=l+u*E.nudgeOffset;N.logger.warn("Nudging 'currentTime' from "+l+" to "+C),a.currentTime=C,s.trigger(M.Events.ERROR,{type:k.ErrorTypes.MEDIA_ERROR,details:k.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else N.logger.error("Playhead still not moving while enough data buffered @"+l+" after "+E.nudgeMaxRetry+" nudges"),s.trigger(M.Events.ERROR,{type:k.ErrorTypes.MEDIA_ERROR,details:k.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},O}()},"./src/controller/id3-track-controller.ts":function(Q,K,L){"use strict";L.r(K);var H=L("./src/events.ts"),k=L("./src/utils/texttrack-utils.ts"),M=L("./src/demux/id3.ts"),N=.25,_=function(){function P(c){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=c,this._registerListeners()}var D=P.prototype;return D.destroy=function(){this._unregisterListeners()},D._registerListeners=function(){var v=this.hls;v.on(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),v.on(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),v.on(H.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),v.on(H.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},D._unregisterListeners=function(){var v=this.hls;v.off(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),v.off(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),v.off(H.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),v.off(H.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},D.onMediaAttached=function(v,O){this.media=O.media},D.onMediaDetaching=function(){if(!this.id3Track)return;Object(k.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},D.getID3Track=function(v){if(!this.media)return;for(var O=0;O<v.length;O++){var w=v[O];if(w.kind==="metadata"&&w.label==="id3")return Object(k.sendAddTrackEvent)(w,this.media),w}return this.media.addTextTrack("metadata","id3")},D.onFragParsingMetadata=function(v,O){if(!this.media)return;var w=O.frag,b=O.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var E=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,s=0;s<b.length;s++){var a=M.getID3Frames(b[s].data);if(a){var l=b[s].pts,u=s<b.length-1?b[s+1].pts:w.end,C=u-l;C<=0&&(u=l+N);for(var g=0;g<a.length;g++){var h=a[g];if(!M.isTimeStampFrame(h)){var A=new E(l,u,"");A.value=h,this.id3Track.addCue(A)}}}}},D.onBufferFlushing=function(v,O){var w=O.startOffset,b=O.endOffset,E=O.type;if(!E||E==="audio"){var s=this.id3Track;s&&Object(k.removeCuesInRange)(s,w,b)}},P}();K.default=_},"./src/controller/latency-controller.ts":function(Q,K,L){"use strict";L.r(K),L.d(K,"default",function(){return P});var H=L("./src/errors.ts"),k=L("./src/events.ts"),M=L("./src/utils/logger.ts");function N(D,c){for(var v=0;v<c.length;v++){var O=c[v];O.enumerable=O.enumerable||!1,O.configurable=!0,"value"in O&&(O.writable=!0),Object.defineProperty(D,O.key,O)}}function _(D,c,v){return c&&N(D.prototype,c),v&&N(D,v),D}var P=function(){function D(v){var O=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 O.timeupdate()},this.hls=v,this.config=v.config,this.registerListeners()}var c=D.prototype;return c.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},c.registerListeners=function(){this.hls.on(k.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(k.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(k.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(k.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(k.Events.ERROR,this.onError,this)},c.unregisterListeners=function(){this.hls.off(k.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(k.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(k.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(k.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(k.Events.ERROR,this.onError)},c.onMediaAttached=function(O,w){this.media=w.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},c.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},c.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},c.onLevelUpdated=function(O,w){var b=w.details;this.levelDetails=b,b.advanced&&this.timeupdate(),!b.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},c.onError=function(O,w){if(w.details!==H.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,M.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},c.timeupdate=function(){var O=this.media,w=this.levelDetails;if(!O||!w)return;this.currentTime=O.currentTime;var b=this.computeLatency();if(b===null)return;this._latency=b;var E=this.config,s=E.lowLatencyMode,a=E.maxLiveSyncPlaybackRate;if(!s||a===1)return;var l=this.targetLatency;if(l===null)return;var u=b-l,C=Math.min(this.maxLatency,l+w.targetduration),g=u<C;if(w.live&&g&&u>.05&&this.forwardBufferLength>1){var h=Math.min(2,Math.max(1,a)),A=Math.round(2/(1+Math.exp(-.75*u-this.edgeStalled))*20)/20;O.playbackRate=Math.min(h,Math.max(1,A))}else O.playbackRate!==1&&O.playbackRate!==0&&(O.playbackRate=1)},c.estimateLiveEdge=function(){var O=this.levelDetails;return O===null?null:O.edge+O.age},c.computeLatency=function(){var O=this.estimateLiveEdge();return O===null?null:O-this.currentTime},_(D,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var O=this.config,w=this.levelDetails;return O.liveMaxLatencyDuration!==void 0?O.liveMaxLatencyDuration:w?O.liveMaxLatencyDurationCount*w.targetduration:0}},{key:"targetLatency",get:function(){var O=this.levelDetails;if(O===null)return null;var w=O.holdBack,b=O.partHoldBack,E=O.targetduration,s=this.config,a=s.liveSyncDuration,l=s.liveSyncDurationCount,u=s.lowLatencyMode,C=this.hls.userConfig,g=u&&b||w;(C.liveSyncDuration||C.liveSyncDurationCount||g===0)&&(g=a!==void 0?a:l*E);var h=E,A=1;return g+Math.min(this.stallCount*A,h)}},{key:"liveSyncPosition",get:function(){var O=this.estimateLiveEdge(),w=this.targetLatency,b=this.levelDetails;if(O===null||w===null||b===null)return null;var E=b.edge,s=O-w-this.edgeStalled,a=E-b.totalduration,l=E-(this.config.lowLatencyMode&&b.partTarget||b.targetduration);return Math.min(Math.max(a,s),l)}},{key:"drift",get:function(){var O=this.levelDetails;return O===null?1:O.drift}},{key:"edgeStalled",get:function(){var O=this.levelDetails;if(O===null)return 0;var w=(this.config.lowLatencyMode&&O.partTarget||O.targetduration)*3;return Math.max(O.age-w,0)}},{key:"forwardBufferLength",get:function(){var O=this.media,w=this.levelDetails;if(!O||!w)return 0;var b=O.buffered.length;return b?O.buffered.end(b-1):w.edge-this.currentTime}}]),D}()},"./src/controller/level-controller.ts":function(Q,K,L){"use strict";L.r(K),L.d(K,"default",function(){return s});var H=L("./src/types/level.ts"),k=L("./src/events.ts"),M=L("./src/errors.ts"),N=L("./src/utils/codecs.ts"),_=L("./src/controller/level-helper.ts"),P=L("./src/controller/base-playlist-controller.ts"),D=L("./src/types/loader.ts");function c(){return c=Object.assign||function(a){for(var l=1;l<arguments.length;l++){var u=arguments[l];for(var C in u)Object.prototype.hasOwnProperty.call(u,C)&&(a[C]=u[C])}return a},c.apply(this,arguments)}function v(a,l){for(var u=0;u<l.length;u++){var C=l[u];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(a,C.key,C)}}function O(a,l,u){return l&&v(a.prototype,l),u&&v(a,u),a}function w(a,l){a.prototype=Object.create(l.prototype),a.prototype.constructor=a,b(a,l)}function b(a,l){return b=Object.setPrototypeOf||function(C,g){return C.__proto__=g,C},b(a,l)}var E=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),s=function(a){w(l,a);function l(C){var g;return g=a.call(this,C,"[level-controller]")||this,g._levels=[],g._firstLevel=-1,g._startLevel=void 0,g.currentLevelIndex=-1,g.manualLevelIndex=-1,g.onParsedComplete=void 0,g._registerListeners(),g}var u=l.prototype;return u._registerListeners=function(){var g=this.hls;g.on(k.Events.MANIFEST_LOADED,this.onManifestLoaded,this),g.on(k.Events.LEVEL_LOADED,this.onLevelLoaded,this),g.on(k.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),g.on(k.Events.FRAG_LOADED,this.onFragLoaded,this),g.on(k.Events.ERROR,this.onError,this)},u._unregisterListeners=function(){var g=this.hls;g.off(k.Events.MANIFEST_LOADED,this.onManifestLoaded,this),g.off(k.Events.LEVEL_LOADED,this.onLevelLoaded,this),g.off(k.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),g.off(k.Events.FRAG_LOADED,this.onFragLoaded,this),g.off(k.Events.ERROR,this.onError,this)},u.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,a.prototype.destroy.call(this)},u.startLoad=function(){var g=this._levels;g.forEach(function(h){h.loadError=0}),a.prototype.startLoad.call(this)},u.onManifestLoaded=function(g,h){var A=[],T=[],f=[],m,d={},o,x=!1,y=!1,p=!1;if(h.levels.forEach(function(z){var j=z.attrs;x=x||!!(z.width&&z.height),y=y||!!z.videoCodec,p=p||!!z.audioCodec,E&&z.audioCodec&&z.audioCodec.indexOf("mp4a.40.34")!==-1&&(z.audioCodec=void 0);var F=z.bitrate+"-"+z.attrs.RESOLUTION+"-"+z.attrs.CODECS;o=d[F],o?o.url.push(z.url):(o=new H.Level(z),d[F]=o,A.push(o)),j&&(j.AUDIO&&Object(_.addGroupId)(o,"audio",j.AUDIO),j.SUBTITLES&&Object(_.addGroupId)(o,"text",j.SUBTITLES))}),(x||y)&&p&&(A=A.filter(function(z){var j=z.videoCodec,F=z.width,X=z.height;return!!j||!!(F&&X)})),A=A.filter(function(z){var j=z.audioCodec,F=z.videoCodec;return(!j||Object(N.isCodecSupportedInMp4)(j,"audio"))&&(!F||Object(N.isCodecSupportedInMp4)(F,"video"))}),h.audioTracks&&(T=h.audioTracks.filter(function(z){return!z.audioCodec||Object(N.isCodecSupportedInMp4)(z.audioCodec,"audio")}),Object(_.assignTrackIdsByGroup)(T)),h.subtitles&&(f=h.subtitles,Object(_.assignTrackIdsByGroup)(f)),A.length>0){m=A[0].bitrate,A.sort(function(z,j){return z.bitrate-j.bitrate}),this._levels=A;for(var R=0;R<A.length;R++)if(A[R].bitrate===m){this._firstLevel=R,this.log("manifest loaded, "+A.length+" level(s) found, first bitrate: "+m);break}var U=p&&!y,B={levels:A,audioTracks:T,subtitleTracks:f,firstLevel:this._firstLevel,stats:h.stats,audio:p,video:y,altAudio:!U&&T.some(function(z){return!!z.url})};this.hls.trigger(k.Events.MANIFEST_PARSED,B),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(k.Events.ERROR,{type:M.ErrorTypes.MEDIA_ERROR,details:M.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:h.url,reason:"no level with compatible codecs found in manifest"})},u.onError=function(g,h){if(a.prototype.onError.call(this,g,h),h.fatal)return;var A=h.context,T=this._levels[this.currentLevelIndex];if(A&&(A.type===D.PlaylistContextType.AUDIO_TRACK&&T.audioGroupIds&&A.groupId===T.audioGroupIds[T.urlId]||A.type===D.PlaylistContextType.SUBTITLE_TRACK&&T.textGroupIds&&A.groupId===T.textGroupIds[T.urlId])){this.redundantFailover(this.currentLevelIndex);return}var f=!1,m=!0,d;switch(h.details){case M.ErrorDetails.FRAG_LOAD_ERROR:case M.ErrorDetails.FRAG_LOAD_TIMEOUT:case M.ErrorDetails.KEY_LOAD_ERROR:case M.ErrorDetails.KEY_LOAD_TIMEOUT:if(h.frag){var o=this._levels[h.frag.level];o?(o.fragmentError++,o.fragmentError>this.hls.config.fragLoadingMaxRetry&&(d=h.frag.level)):d=h.frag.level}break;case M.ErrorDetails.LEVEL_LOAD_ERROR:case M.ErrorDetails.LEVEL_LOAD_TIMEOUT:A&&(A.deliveryDirectives&&(m=!1),d=A.level),f=!0;break;case M.ErrorDetails.REMUX_ALLOC_ERROR:d=h.level,f=!0;break}d!==void 0&&this.recoverLevel(h,d,f,m)},u.recoverLevel=function(g,h,A,T){var f=g.details,m=this._levels[h];if(m.loadError++,A){var d=this.retryLoadingOrFail(g);if(d)g.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(T){var o=m.url.length;if(o>1&&m.loadError<o)g.levelRetry=!0,this.redundantFailover(h);else if(this.manualLevelIndex===-1){var x=h===0?this._levels.length-1:h-1;this.currentLevelIndex!==x&&this._levels[x].loadError===0&&(this.warn(f+": switch to "+x),g.levelRetry=!0,this.hls.nextAutoLevel=x)}}},u.redundantFailover=function(g){var h=this._levels[g],A=h.url.length;if(A>1){var T=(h.urlId+1)%A;this.warn("Switching to redundant URL-id "+T),this._levels.forEach(function(f){f.urlId=T}),this.level=g}},u.onFragLoaded=function(g,h){var A=h.frag;if(A!==void 0&&A.type===D.PlaylistLevelType.MAIN){var T=this._levels[A.level];T!==void 0&&(T.fragmentError=0,T.loadError=0)}},u.onLevelLoaded=function(g,h){var A,T=h.level,f=h.details,m=this._levels[T];if(!m){var d;this.warn("Invalid level index "+T),(d=h.deliveryDirectives)!==null&&d!==void 0&&d.skip&&(f.deltaUpdateFailed=!0);return}T===this.currentLevelIndex?(m.fragmentError===0&&(m.loadError=0,this.retryCount=0),this.playlistLoaded(T,h,m.details)):(A=h.deliveryDirectives)!==null&&A!==void 0&&A.skip&&(f.deltaUpdateFailed=!0)},u.onAudioTrackSwitched=function(g,h){var A=this.hls.levels[this.currentLevelIndex];if(!A)return;if(A.audioGroupIds){for(var T=-1,f=this.hls.audioTracks[h.id].groupId,m=0;m<A.audioGroupIds.length;m++)if(A.audioGroupIds[m]===f){T=m;break}T!==A.urlId&&(A.urlId=T,this.startLoad())}},u.loadPlaylist=function(g){var h=this.currentLevelIndex,A=this._levels[h];if(this.canLoad&&A&&A.url.length>0){var T=A.urlId,f=A.url[T];if(g)try{f=g.addDirectives(f)}catch(m){this.warn("Could not construct new URL with HLS Delivery Directives: "+m)}this.log("Attempt loading level index "+h+(g?" at sn "+g.msn+" part "+g.part:"")+" with URL-id "+T+" "+f),this.clearTimer(),this.hls.trigger(k.Events.LEVEL_LOADING,{url:f,level:h,id:T,deliveryDirectives:g||null})}},u.removeLevel=function(g,h){var A=function(m,d){return d!==h},T=this._levels.filter(function(f,m){return m!==g?!0:f.url.length>1&&h!==void 0?(f.url=f.url.filter(A),f.audioGroupIds&&(f.audioGroupIds=f.audioGroupIds.filter(A)),f.textGroupIds&&(f.textGroupIds=f.textGroupIds.filter(A)),f.urlId=0,!0):!1}).map(function(f,m){var d=f.details;return d!=null&&d.fragments&&d.fragments.forEach(function(o){o.level=m}),f});this._levels=T,this.hls.trigger(k.Events.LEVELS_UPDATED,{levels:T})},O(l,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(g){var h,A=this._levels;if(A.length===0)return;if(this.currentLevelIndex===g&&(h=A[g])!==null&&h!==void 0&&h.details)return;if(g<0||g>=A.length){var T=g<0;if(this.hls.trigger(k.Events.ERROR,{type:M.ErrorTypes.OTHER_ERROR,details:M.ErrorDetails.LEVEL_SWITCH_ERROR,level:g,fatal:T,reason:"invalid level idx"}),T)return;g=Math.min(g,A.length-1)}this.clearTimer();var f=this.currentLevelIndex,m=A[f],d=A[g];this.log("switching to level "+g+" from "+f),this.currentLevelIndex=g;var o=c({},d,{level:g,maxBitrate:d.maxBitrate,uri:d.uri,urlId:d.urlId});delete o._urlId,this.hls.trigger(k.Events.LEVEL_SWITCHING,o);var x=d.details;if(!x||x.live){var y=this.switchParams(d.uri,m==null?void 0:m.details);this.loadPlaylist(y)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(g){this.manualLevelIndex=g,this._startLevel===void 0&&(this._startLevel=g),g!==-1&&(this.level=g)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(g){this._firstLevel=g}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var g=this.hls.config.startLevel;return g!==void 0?g:this._firstLevel}else return this._startLevel},set:function(g){this._startLevel=g}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(g){this.level=g,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=g)}}]),l}(P.default)},"./src/controller/level-helper.ts":function(Q,K,L){"use strict";L.r(K),L.d(K,"addGroupId",function(){return M}),L.d(K,"assignTrackIdsByGroup",function(){return N}),L.d(K,"updatePTS",function(){return _}),L.d(K,"updateFragPTSDTS",function(){return D}),L.d(K,"mergeDetails",function(){return c}),L.d(K,"mapPartIntersection",function(){return v}),L.d(K,"mapFragmentIntersection",function(){return O}),L.d(K,"adjustSliding",function(){return w}),L.d(K,"addSliding",function(){return b}),L.d(K,"computeReloadInterval",function(){return E}),L.d(K,"getFragmentWithSN",function(){return s}),L.d(K,"getPartWith",function(){return a});var H=L("./src/polyfills/number.ts"),k=L("./src/utils/logger.ts");function M(l,u,C){switch(u){case"audio":l.audioGroupIds||(l.audioGroupIds=[]),l.audioGroupIds.push(C);break;case"text":l.textGroupIds||(l.textGroupIds=[]),l.textGroupIds.push(C);break}}function N(l){var u={};l.forEach(function(C){var g=C.groupId||"";C.id=u[g]=u[g]||0,u[g]++})}function _(l,u,C){var g=l[u],h=l[C];P(g,h)}function P(l,u){var C=u.startPTS;if(Object(H.isFiniteNumber)(C)){var g=0,h;u.sn>l.sn?(g=C-l.start,h=l):(g=l.start-C,h=u),h.duration!==g&&(h.duration=g)}else if(u.sn>l.sn){var A=l.cc===u.cc;A&&l.minEndPTS?u.start=l.start+(l.minEndPTS-l.start):u.start=l.start+l.duration}else u.start=Math.max(l.start-u.duration,0)}function D(l,u,C,g,h,A){var T=g-C;T<=0&&(k.logger.warn("Fragment should have a positive duration",u),g=C+u.duration,A=h+u.duration);var f=C,m=g,d=u.startPTS,o=u.endPTS;if(Object(H.isFiniteNumber)(d)){var x=Math.abs(d-C);Object(H.isFiniteNumber)(u.deltaPTS)?u.deltaPTS=Math.max(x,u.deltaPTS):u.deltaPTS=x,f=Math.max(C,d),C=Math.min(C,d),h=Math.min(h,u.startDTS),m=Math.min(g,o),g=Math.max(g,o),A=Math.max(A,u.endDTS)}u.duration=g-C;var y=C-u.start;u.appendedPTS=g,u.start=u.startPTS=C,u.maxStartPTS=f,u.startDTS=h,u.endPTS=g,u.minEndPTS=m,u.endDTS=A;var p=u.sn;if(!l||p<l.startSN||p>l.endSN)return 0;var R,U=p-l.startSN,B=l.fragments;for(B[U]=u,R=U;R>0;R--)P(B[R],B[R-1]);for(R=U;R<B.length-1;R++)P(B[R],B[R+1]);return l.fragmentHint&&P(B[B.length-1],l.fragmentHint),l.PTSKnown=l.alignedSliding=!0,y}function c(l,u){for(var C=null,g=l.fragments,h=g.length-1;h>=0;h--){var A=g[h].initSegment;if(A){C=A;break}}l.fragmentHint&&delete l.fragmentHint.endPTS;var T=0,f;if(O(l,u,function(R,U){R.relurl&&(T=R.cc-U.cc),Object(H.isFiniteNumber)(R.startPTS)&&Object(H.isFiniteNumber)(R.endPTS)&&(U.start=U.startPTS=R.startPTS,U.startDTS=R.startDTS,U.appendedPTS=R.appendedPTS,U.maxStartPTS=R.maxStartPTS,U.endPTS=R.endPTS,U.endDTS=R.endDTS,U.minEndPTS=R.minEndPTS,U.duration=R.endPTS-R.startPTS,U.duration&&(f=U),u.PTSKnown=u.alignedSliding=!0),U.elementaryStreams=R.elementaryStreams,U.loader=R.loader,U.stats=R.stats,U.urlId=R.urlId,R.initSegment&&(U.initSegment=R.initSegment,C=R.initSegment)}),C){var m=u.fragmentHint?u.fragments.concat(u.fragmentHint):u.fragments;m.forEach(function(R){var U;(!R.initSegment||R.initSegment.relurl===((U=C)===null||U===void 0?void 0:U.relurl))&&(R.initSegment=C)})}if(u.skippedSegments&&(u.deltaUpdateFailed=u.fragments.some(function(R){return!R}),u.deltaUpdateFailed)){k.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var d=u.skippedSegments;d--;)u.fragments.shift();u.startSN=u.fragments[0].sn,u.startCC=u.fragments[0].cc}var o=u.fragments;if(T){k.logger.warn("discontinuity sliding from playlist, take drift into account");for(var x=0;x<o.length;x++)o[x].cc+=T}u.skippedSegments&&(u.startCC=u.fragments[0].cc),v(l.partList,u.partList,function(R,U){U.elementaryStreams=R.elementaryStreams,U.stats=R.stats}),f?D(u,f,f.startPTS,f.endPTS,f.startDTS,f.endDTS):w(l,u),o.length&&(u.totalduration=u.edge-o[0].start),u.driftStartTime=l.driftStartTime,u.driftStart=l.driftStart;var y=u.advancedDateTime;if(u.advanced&&y){var p=u.edge;u.driftStart||(u.driftStartTime=y,u.driftStart=p),u.driftEndTime=y,u.driftEnd=p}else u.driftEndTime=l.driftEndTime,u.driftEnd=l.driftEnd,u.advancedDateTime=l.advancedDateTime}function v(l,u,C){if(l&&u)for(var g=0,h=0,A=l.length;h<=A;h++){var T=l[h],f=u[h+g];T&&f&&T.index===f.index&&T.fragment.sn===f.fragment.sn?C(T,f):g--}}function O(l,u,C){for(var g=u.skippedSegments,h=Math.max(l.startSN,u.startSN)-u.startSN,A=(l.fragmentHint?1:0)+(g?u.endSN:Math.min(l.endSN,u.endSN))-u.startSN,T=u.startSN-l.startSN,f=u.fragmentHint?u.fragments.concat(u.fragmentHint):u.fragments,m=l.fragmentHint?l.fragments.concat(l.fragmentHint):l.fragments,d=h;d<=A;d++){var o=m[T+d],x=f[d];g&&!x&&d<g&&(x=u.fragments[d]=o),o&&x&&C(o,x)}}function w(l,u){var C=u.startSN+u.skippedSegments-l.startSN,g=l.fragments;if(C<0||C>=g.length)return;b(u,g[C].start)}function b(l,u){if(u){for(var C=l.fragments,g=l.skippedSegments;g<C.length;g++)C[g].start+=u;l.fragmentHint&&(l.fragmentHint.start+=u)}}function E(l,u){var C=1e3*l.levelTargetDuration,g=C/2,h=l.age,A=h>0&&h<C*3,T=u.loading.end-u.loading.start,f,m=l.availabilityDelay;if(l.updated===!1)if(A){var d=333*l.misses;f=Math.max(Math.min(g,T*2),d),l.availabilityDelay=(l.availabilityDelay||0)+f}else f=g;else A?(m=Math.min(m||C/2,h),l.availabilityDelay=m,f=m+C-h):f=C-T;return Math.round(f)}function s(l,u,C){if(!l||!l.details)return null;var g=l.details,h=g.fragments[u-g.startSN];return h||(h=g.fragmentHint,h&&h.sn===u?h:u<g.startSN&&C&&C.sn===u?C:null)}function a(l,u,C){if(!l||!l.details)return null;var g=l.details.partList;if(g)for(var h=g.length;h--;){var A=g[h];if(A.index===C&&A.fragment.sn===u)return A}return null}},"./src/controller/stream-controller.ts":function(Q,K,L){"use strict";L.r(K),L.d(K,"default",function(){return g});var H=L("./src/polyfills/number.ts"),k=L("./src/controller/base-stream-controller.ts"),M=L("./src/is-supported.ts"),N=L("./src/events.ts"),_=L("./src/utils/buffer-helper.ts"),P=L("./src/controller/fragment-tracker.ts"),D=L("./src/types/loader.ts"),c=L("./src/loader/fragment.ts"),v=L("./src/demux/transmuxer-interface.ts"),O=L("./src/types/transmuxer.ts"),w=L("./src/controller/gap-controller.ts"),b=L("./src/errors.ts"),E=L("./src/utils/logger.ts");function s(h,A){for(var T=0;T<A.length;T++){var f=A[T];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(h,f.key,f)}}function a(h,A,T){return A&&s(h.prototype,A),T&&s(h,T),h}function l(h,A){h.prototype=Object.create(A.prototype),h.prototype.constructor=h,u(h,A)}function u(h,A){return u=Object.setPrototypeOf||function(f,m){return f.__proto__=m,f},u(h,A)}var C=100,g=function(h){l(A,h);function A(f,m){var d;return d=h.call(this,f,m,"[stream-controller]")||this,d.audioCodecSwap=!1,d.gapController=null,d.level=-1,d._forceStartLoad=!1,d.altAudio=!1,d.audioOnly=!1,d.fragPlaying=null,d.onvplaying=null,d.onvseeked=null,d.fragLastKbps=0,d.stalled=!1,d.couldBacktrack=!1,d.audioCodecSwitch=!1,d.videoBuffer=null,d._registerListeners(),d}var T=A.prototype;return T._registerListeners=function(){var m=this.hls;m.on(N.Events.MEDIA_ATTACHED,this.onMediaAttached,this),m.on(N.Events.MEDIA_DETACHING,this.onMediaDetaching,this),m.on(N.Events.MANIFEST_LOADING,this.onManifestLoading,this),m.on(N.Events.MANIFEST_PARSED,this.onManifestParsed,this),m.on(N.Events.LEVEL_LOADING,this.onLevelLoading,this),m.on(N.Events.LEVEL_LOADED,this.onLevelLoaded,this),m.on(N.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),m.on(N.Events.ERROR,this.onError,this),m.on(N.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),m.on(N.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),m.on(N.Events.BUFFER_CREATED,this.onBufferCreated,this),m.on(N.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),m.on(N.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),m.on(N.Events.FRAG_BUFFERED,this.onFragBuffered,this)},T._unregisterListeners=function(){var m=this.hls;m.off(N.Events.MEDIA_ATTACHED,this.onMediaAttached,this),m.off(N.Events.MEDIA_DETACHING,this.onMediaDetaching,this),m.off(N.Events.MANIFEST_LOADING,this.onManifestLoading,this),m.off(N.Events.MANIFEST_PARSED,this.onManifestParsed,this),m.off(N.Events.LEVEL_LOADED,this.onLevelLoaded,this),m.off(N.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),m.off(N.Events.ERROR,this.onError,this),m.off(N.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),m.off(N.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),m.off(N.Events.BUFFER_CREATED,this.onBufferCreated,this),m.off(N.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),m.off(N.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),m.off(N.Events.FRAG_BUFFERED,this.onFragBuffered,this)},T.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},T.startLoad=function(m){if(this.levels){var d=this.lastCurrentTime,o=this.hls;if(this.stopLoad(),this.setInterval(C),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var x=o.startLevel;x===-1&&(o.config.testBandwidth?(x=0,this.bitrateTest=!0):x=o.nextAutoLevel),this.level=o.nextLoadLevel=x,this.loadedmetadata=!1}d>0&&m===-1&&(this.log("Override startPosition with lastCurrentTime @"+d.toFixed(3)),m=d),this.state=k.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=m,this.tick()}else this._forceStartLoad=!0,this.state=k.State.STOPPED},T.stopLoad=function(){this._forceStartLoad=!1,h.prototype.stopLoad.call(this)},T.doTick=function(){switch(this.state){case k.State.IDLE:this.doTickIdle();break;case k.State.WAITING_LEVEL:{var m,d=this.levels,o=this.level,x=d==null||((m=d[o])===null||m===void 0)?void 0:m.details;if(x&&(!x.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(x))break;this.state=k.State.IDLE;break}break}case k.State.FRAG_LOADING_WAITING_RETRY:{var y,p=self.performance.now(),R=this.retryDate;(!R||p>=R||(y=this.media)!==null&&y!==void 0&&y.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=k.State.IDLE)}break;default:break}this.onTickEnd()},T.onTickEnd=function(){h.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},T.doTickIdle=function(){var m,d,o=this.hls,x=this.levelLastLoaded,y=this.levels,p=this.media,R=o.config,U=o.nextLoadLevel;if(x===null||!p&&(this.startFragRequested||!R.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!y||!y[U])return;var B=y[U];this.level=o.nextLoadLevel=U;var z=B.details;if(!z||this.state===k.State.WAITING_LEVEL||z.live&&this.levelLastLoaded!==U){this.state=k.State.WAITING_LEVEL;return}var j=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:p,D.PlaylistLevelType.MAIN);if(j===null)return;var F=j.len,X=this.getMaxBufferLength(B.maxBitrate);if(F>=X)return;if(this._streamEnded(j,z)){var q={};this.altAudio&&(q.type="video"),this.hls.trigger(N.Events.BUFFER_EOS,q),this.state=k.State.ENDED;return}var ne=j.end,ue=this.getNextFragment(ne,z);if(this.couldBacktrack&&!this.fragPrevious&&ue&&ue.sn!=="initSegment"){var xe=ue.sn-z.startSN;xe>1&&(ue=z.fragments[xe-1],this.fragmentTracker.removeFragment(ue))}if(ue&&this.fragmentTracker.getState(ue)===P.FragmentState.OK&&this.nextLoadPosition>ne){var pe=this.audioOnly&&!this.altAudio?c.ElementaryStreamTypes.AUDIO:c.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(p,pe,D.PlaylistLevelType.MAIN),ue=this.getNextFragment(this.nextLoadPosition,z)}if(!ue)return;ue.initSegment&&!ue.initSegment.data&&!this.bitrateTest&&(ue=ue.initSegment),((m=ue.decryptdata)===null||m===void 0?void 0:m.keyFormat)==="identity"&&!((d=ue.decryptdata)!==null&&d!==void 0&&d.key)?this.loadKey(ue,z):this.loadFragment(ue,z,ne)},T.loadFragment=function(m,d,o){var x,y=this.fragmentTracker.getState(m);if(this.fragCurrent=m,y===P.FragmentState.BACKTRACKED){var p=this.fragmentTracker.getBacktrackData(m);if(p){this._handleFragmentLoadProgress(p),this._handleFragmentLoadComplete(p);return}else y=P.FragmentState.NOT_LOADED}y===P.FragmentState.NOT_LOADED||y===P.FragmentState.PARTIAL?m.sn==="initSegment"?this._loadInitSegment(m):this.bitrateTest?(m.bitrateTest=!0,this.log("Fragment "+m.sn+" of level "+m.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(m)):(this.startFragRequested=!0,h.prototype.loadFragment.call(this,m,d,o)):y===P.FragmentState.APPENDING?this.reduceMaxBufferLength(m.duration)&&this.fragmentTracker.removeFragment(m):((x=this.media)===null||x===void 0?void 0:x.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},T.getAppendedFrag=function(m){var d=this.fragmentTracker.getAppendedFrag(m,D.PlaylistLevelType.MAIN);return d&&"fragment"in d?d.fragment:d},T.getBufferedFrag=function(m){return this.fragmentTracker.getBufferedFrag(m,D.PlaylistLevelType.MAIN)},T.followingBufferedFrag=function(m){return m?this.getBufferedFrag(m.end+.5):null},T.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},T.nextLevelSwitch=function(){var m=this.levels,d=this.media;if(d!=null&&d.readyState){var o,x=this.getAppendedFrag(d.currentTime);if(x&&x.start>1&&this.flushMainBuffer(0,x.start-1),!d.paused&&m){var y=this.hls.nextLoadLevel,p=m[y],R=this.fragLastKbps;R&&this.fragCurrent?o=this.fragCurrent.duration*p.maxBitrate/(1e3*R)+1:o=0}else o=0;var U=this.getBufferedFrag(d.currentTime+o);if(U){var B=this.followingBufferedFrag(U);if(B){this.abortCurrentFrag();var z=B.maxStartPTS?B.maxStartPTS:B.start,j=B.duration,F=Math.max(U.end,z+Math.min(Math.max(j-this.config.maxFragLookUpTolerance,j*.5),j*.75));this.flushMainBuffer(F,Number.POSITIVE_INFINITY)}}}},T.abortCurrentFrag=function(){var m=this.fragCurrent;this.fragCurrent=null,m!=null&&m.loader&&m.loader.abort(),this.state===k.State.KEY_LOADING&&(this.state=k.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},T.flushMainBuffer=function(m,d){h.prototype.flushMainBuffer.call(this,m,d,this.altAudio?"video":null)},T.onMediaAttached=function(m,d){h.prototype.onMediaAttached.call(this,m,d);var o=d.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),o.addEventListener("playing",this.onvplaying),o.addEventListener("seeked",this.onvseeked),this.gapController=new w.default(this.config,o,this.fragmentTracker,this.hls)},T.onMediaDetaching=function(){var m=this.media;m&&(m.removeEventListener("playing",this.onvplaying),m.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),h.prototype.onMediaDetaching.call(this)},T.onMediaPlaying=function(){this.tick()},T.onMediaSeeked=function(){var m=this.media,d=m?m.currentTime:null;Object(H.isFiniteNumber)(d)&&this.log("Media seeked to "+d.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(m,d){var o=!1,x=!1,y;d.levels.forEach(function(p){y=p.audioCodec,y&&(y.indexOf("mp4a.40.2")!==-1&&(o=!0),y.indexOf("mp4a.40.5")!==-1&&(x=!0))}),this.audioCodecSwitch=o&&x&&!Object(M.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=d.levels,this.startFragRequested=!1},T.onLevelLoading=function(m,d){var o=this.levels;if(!o||this.state!==k.State.IDLE)return;var x=o[d.level];(!x.details||x.details.live&&this.levelLastLoaded!==d.level||this.waitForCdnTuneIn(x.details))&&(this.state=k.State.WAITING_LEVEL)},T.onLevelLoaded=function(m,d){var o,x=this.levels,y=d.level,p=d.details,R=p.totalduration;if(!x){this.warn("Levels were reset while loading level "+y);return}this.log("Level "+y+" loaded ["+p.startSN+","+p.endSN+"], cc ["+p.startCC+", "+p.endCC+"] duration:"+R);var U=this.fragCurrent;U&&(this.state===k.State.FRAG_LOADING||this.state===k.State.FRAG_LOADING_WAITING_RETRY)&&(U.level!==d.level&&U.loader&&(this.state=k.State.IDLE,U.loader.abort()));var B=x[y],z=0;if(p.live||(o=B.details)!==null&&o!==void 0&&o.live){if(p.fragments[0]||(p.deltaUpdateFailed=!0),p.deltaUpdateFailed)return;z=this.alignPlaylists(p,B.details)}if(B.details=p,this.levelLastLoaded=y,this.hls.trigger(N.Events.LEVEL_UPDATED,{details:p,level:y}),this.state===k.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(p))return;this.state=k.State.IDLE}this.startFragRequested?p.live&&this.synchronizeToLiveEdge(p):this.setStartPosition(p,z),this.tick()},T._handleFragmentLoadProgress=function(m){var d,o=m.frag,x=m.part,y=m.payload,p=this.levels;if(!p){this.warn("Levels were reset while fragment load was in progress. Fragment "+o.sn+" of level "+o.level+" will not be buffered");return}var R=p[o.level],U=R.details;if(!U){this.warn("Dropping fragment "+o.sn+" of level "+o.level+" after level details were reset");return}var B=R.videoCodec,z=U.PTSKnown||!U.live,j=(d=o.initSegment)===null||d===void 0?void 0:d.data,F=this._getAudioCodec(R),X=this.transmuxer=this.transmuxer||new v.default(this.hls,D.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),q=x?x.index:-1,ne=q!==-1,ue=new O.ChunkMetadata(o.level,o.sn,o.stats.chunkCount,y.byteLength,q,ne),xe=this.initPTS[o.cc];X.push(y,j,F,B,o,x,U.totalduration,z,ue,xe)},T.onAudioTrackSwitching=function(m,d){var o=this.altAudio,x=!!d.url,y=d.id;if(!x){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 R=this.hls;o&&R.trigger(N.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),R.trigger(N.Events.AUDIO_TRACK_SWITCHED,{id:y})}},T.onAudioTrackSwitched=function(m,d){var o=d.id,x=!!this.hls.audioTracks[o].url;if(x){var y=this.videoBuffer;y&&this.mediaBuffer!==y&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=y)}this.altAudio=x,this.tick()},T.onBufferCreated=function(m,d){var o=d.tracks,x,y,p=!1;for(var R in o){var U=o[R];if(U.id==="main"){if(y=R,x=U,R==="video"){var B=o[R];B&&(this.videoBuffer=B.buffer)}}else p=!0}p&&x?(this.log("Alternate track found, use "+y+".buffered to schedule main fragment loading"),this.mediaBuffer=x.buffer):this.mediaBuffer=this.media},T.onFragBuffered=function(m,d){var o=d.frag,x=d.part;if(o&&o.type!==D.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(o)){this.warn("Fragment "+o.sn+(x?" p: "+x.index:"")+" of level "+o.level+" finished buffering, but was aborted. state: "+this.state),this.state===k.State.PARSED&&(this.state=k.State.IDLE);return}var y=x?x.stats:o.stats;this.fragLastKbps=Math.round(8*y.total/(y.buffering.end-y.loading.first)),o.sn!=="initSegment"&&(this.fragPrevious=o),this.fragBufferedComplete(o,x)},T.onError=function(m,d){switch(d.details){case b.ErrorDetails.FRAG_LOAD_ERROR:case b.ErrorDetails.FRAG_LOAD_TIMEOUT:case b.ErrorDetails.KEY_LOAD_ERROR:case b.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(D.PlaylistLevelType.MAIN,d);break;case b.ErrorDetails.LEVEL_LOAD_ERROR:case b.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==k.State.ERROR&&(d.fatal?(this.warn(""+d.details),this.state=k.State.ERROR):!d.levelRetry&&this.state===k.State.WAITING_LEVEL&&(this.state=k.State.IDLE));break;case b.ErrorDetails.BUFFER_FULL_ERROR:if(d.parent==="main"&&(this.state===k.State.PARSING||this.state===k.State.PARSED)){var o=!0,x=this.getFwdBufferInfo(this.media,D.PlaylistLevelType.MAIN);x&&x.len>.5&&(o=!this.reduceMaxBufferLength(x.len)),o&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},T.checkBuffer=function(){var m=this.media,d=this.gapController;if(!m||!d||!m.readyState)return;var o=_.BufferHelper.getBuffered(m);!this.loadedmetadata&&o.length?(this.loadedmetadata=!0,this.seekToStartPos()):d.poll(this.lastCurrentTime),this.lastCurrentTime=m.currentTime},T.onFragLoadEmergencyAborted=function(){this.state=k.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},T.onBufferFlushed=function(m,d){var o=d.type;if(o!==c.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var x=(o===c.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(x,o,D.PlaylistLevelType.MAIN)}},T.onLevelsUpdated=function(m,d){this.levels=d.levels},T.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},T.seekToStartPos=function(){var m=this.media,d=m.currentTime,o=this.startPosition;if(o>=0&&d<o){if(m.seeking){E.logger.log("could not seek to "+o+", already seeking at "+d);return}var x=_.BufferHelper.getBuffered(m),y=x.length?x.start(0):0,p=y-o;p>0&&(p<this.config.maxBufferHole||p<this.config.maxFragLookUpTolerance)&&(E.logger.log("adjusting start position by "+p+" to match buffer start"),o+=p,this.startPosition=o),this.log("seek to target start position "+o+" from current time "+d),m.currentTime=o}},T._getAudioCodec=function(m){var d=this.config.defaultAudioCodec||m.audioCodec;return this.audioCodecSwap&&d&&(this.log("Swapping audio codec"),d.indexOf("mp4a.40.5")!==-1?d="mp4a.40.2":d="mp4a.40.5"),d},T._loadBitrateTestFrag=function(m){var d=this;this._doFragLoad(m).then(function(o){var x=d.hls;if(!o||x.nextLoadLevel||d.fragContextChanged(m))return;d.fragLoadError=0,d.state=k.State.IDLE,d.startFragRequested=!1,d.bitrateTest=!1;var y=m.stats;y.parsing.start=y.parsing.end=y.buffering.start=y.buffering.end=self.performance.now(),x.trigger(N.Events.FRAG_LOADED,o)})},T._handleTransmuxComplete=function(m){var d,o="main",x=this.hls,y=m.remuxResult,p=m.chunkMeta,R=this.getCurrentContext(p);if(!R){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=R.frag,B=R.part,z=R.level,j=y.video,F=y.text,X=y.id3,q=y.initSegment,ne=this.altAudio?void 0:y.audio;if(this.fragContextChanged(U))return;if(this.state=k.State.PARSING,q){q.tracks&&(this._bufferInitSegment(z,q.tracks,U,p),x.trigger(N.Events.FRAG_PARSING_INIT_SEGMENT,{frag:U,id:o,tracks:q.tracks}));var ue=q.initPTS,xe=q.timescale;Object(H.isFiniteNumber)(ue)&&(this.initPTS[U.cc]=ue,x.trigger(N.Events.INIT_PTS_FOUND,{frag:U,id:o,initPTS:ue,timescale:xe}))}if(j&&y.independent!==!1){if(z.details){var pe=j.startPTS,he=j.endPTS,de=j.startDTS,fe=j.endDTS;if(B)B.elementaryStreams[j.type]={startPTS:pe,endPTS:he,startDTS:de,endDTS:fe};else if(j.firstKeyFrame&&j.independent&&(this.couldBacktrack=!0),j.dropped&&j.independent){var te=this.getLoadPosition()+this.config.maxBufferHole;if(te<pe){this.backtrack(U);return}U.setElementaryStreamInfo(j.type,U.start,he,U.start,fe,!0)}U.setElementaryStreamInfo(j.type,pe,he,de,fe),this.bufferFragmentData(j,U,B,p)}}else if(y.independent===!1){this.backtrack(U);return}if(ne){var se=ne.startPTS,ye=ne.endPTS,Me=ne.startDTS,ke=ne.endDTS;B&&(B.elementaryStreams[c.ElementaryStreamTypes.AUDIO]={startPTS:se,endPTS:ye,startDTS:Me,endDTS:ke}),U.setElementaryStreamInfo(c.ElementaryStreamTypes.AUDIO,se,ye,Me,ke),this.bufferFragmentData(ne,U,B,p)}if(X!=null&&(d=X.samples)!==null&&d!==void 0&&d.length){var He={frag:U,id:o,samples:X.samples};x.trigger(N.Events.FRAG_PARSING_METADATA,He)}if(F){var $e={frag:U,id:o,samples:F.samples};x.trigger(N.Events.FRAG_PARSING_USERDATA,$e)}},T._bufferInitSegment=function(m,d,o,x){var y=this;if(this.state!==k.State.PARSING)return;this.audioOnly=!!d.audio&&!d.video,this.altAudio&&!this.audioOnly&&delete d.audio;var p=d.audio,R=d.video,U=d.audiovideo;if(p){var B=m.audioCodec,z=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(B&&(B.indexOf("mp4a.40.5")!==-1?B="mp4a.40.2":B="mp4a.40.5"),p.metadata.channelCount!==1&&z.indexOf("firefox")===-1&&(B="mp4a.40.5")),z.indexOf("android")!==-1&&p.container!=="audio/mpeg"&&(B="mp4a.40.2",this.log("Android: force audio codec to "+B)),m.audioCodec&&m.audioCodec!==B&&this.log('Swapping manifest audio codec "'+m.audioCodec+'" for "'+B+'"'),p.levelCodec=B,p.id="main",this.log("Init audio buffer, container:"+p.container+", codecs[selected/level/parsed]=["+(B||"")+"/"+(m.audioCodec||"")+"/"+p.codec+"]")}R&&(R.levelCodec=m.videoCodec,R.id="main",this.log("Init video buffer, container:"+R.container+", codecs[level/parsed]=["+(m.videoCodec||"")+"/"+R.codec+"]")),U&&this.log("Init audiovideo buffer, container:"+U.container+", codecs[level/parsed]=["+(m.attrs.CODECS||"")+"/"+U.codec+"]"),this.hls.trigger(N.Events.BUFFER_CODECS,d),Object.keys(d).forEach(function(j){var F=d[j],X=F.initSegment;X!=null&&X.byteLength&&y.hls.trigger(N.Events.BUFFER_APPENDING,{type:j,data:X,frag:o,part:null,chunkMeta:x,parent:o.type})}),this.tick()},T.backtrack=function(m){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(m);var d=this.fragmentTracker.backtrack(m);this.fragPrevious=null,this.nextLoadPosition=m.start,d?this.resetFragmentLoading(m):this.state=k.State.BACKTRACKING},T.checkFragmentChanged=function(){var m=this.media,d=null;if(m&&m.readyState>1&&m.seeking===!1){var o=m.currentTime;if(_.BufferHelper.isBuffered(m,o)?d=this.getAppendedFrag(o):_.BufferHelper.isBuffered(m,o+.1)&&(d=this.getAppendedFrag(o+.1)),d){var x=this.fragPlaying,y=d.level;(!x||d.sn!==x.sn||x.level!==y||d.urlId!==x.urlId)&&(this.hls.trigger(N.Events.FRAG_CHANGED,{frag:d}),(!x||x.level!==y)&&this.hls.trigger(N.Events.LEVEL_SWITCHED,{level:y}),this.fragPlaying=d)}}},a(A,[{key:"nextLevel",get:function(){var m=this.nextBufferedFrag;return m?m.level:-1}},{key:"currentLevel",get:function(){var m=this.media;if(m){var d=this.getAppendedFrag(m.currentTime);if(d)return d.level}return-1}},{key:"nextBufferedFrag",get:function(){var m=this.media;if(m){var d=this.getAppendedFrag(m.currentTime);return this.followingBufferedFrag(d)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),A}(k.default)},"./src/controller/subtitle-stream-controller.ts":function(Q,K,L){"use strict";L.r(K),L.d(K,"SubtitleStreamController",function(){return l});var H=L("./src/events.ts"),k=L("./src/utils/logger.ts"),M=L("./src/utils/buffer-helper.ts"),N=L("./src/controller/fragment-finders.ts"),_=L("./src/utils/discontinuities.ts"),P=L("./src/controller/level-helper.ts"),D=L("./src/controller/fragment-tracker.ts"),c=L("./src/controller/base-stream-controller.ts"),v=L("./src/types/loader.ts"),O=L("./src/types/level.ts");function w(u,C){for(var g=0;g<C.length;g++){var h=C[g];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(u,h.key,h)}}function b(u,C,g){return C&&w(u.prototype,C),g&&w(u,g),u}function E(u,C){u.prototype=Object.create(C.prototype),u.prototype.constructor=u,s(u,C)}function s(u,C){return s=Object.setPrototypeOf||function(h,A){return h.__proto__=A,h},s(u,C)}var a=500,l=function(u){E(C,u);function C(h,A){var T;return T=u.call(this,h,A,"[subtitle-stream-controller]")||this,T.levels=[],T.currentTrackId=-1,T.tracksBuffered=[],T.mainDetails=null,T._registerListeners(),T}var g=C.prototype;return g.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},g._registerListeners=function(){var A=this.hls;A.on(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),A.on(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),A.on(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),A.on(H.Events.LEVEL_LOADED,this.onLevelLoaded,this),A.on(H.Events.ERROR,this.onError,this),A.on(H.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),A.on(H.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),A.on(H.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),A.on(H.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),A.on(H.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},g._unregisterListeners=function(){var A=this.hls;A.off(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),A.off(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),A.off(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),A.off(H.Events.LEVEL_LOADED,this.onLevelLoaded,this),A.off(H.Events.ERROR,this.onError,this),A.off(H.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),A.off(H.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),A.off(H.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),A.off(H.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),A.off(H.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},g.startLoad=function(){this.stopLoad(),this.state=c.State.IDLE,this.setInterval(a),this.tick()},g.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},g.onLevelLoaded=function(A,T){this.mainDetails=T.details},g.onSubtitleFragProcessed=function(A,T){var f=T.frag,m=T.success;if(this.fragPrevious=f,this.state=c.State.IDLE,!m)return;var d=this.tracksBuffered[this.currentTrackId];if(!d)return;for(var o,x=f.start,y=0;y<d.length;y++)if(x>=d[y].start&&x<=d[y].end){o=d[y];break}var p=f.start+f.duration;o?o.end=p:(o={start:x,end:p},d.push(o)),this.fragmentTracker.fragBuffered(f)},g.onBufferFlushing=function(A,T){var f=T.startOffset,m=T.endOffset;if(f===0&&m!==Number.POSITIVE_INFINITY){var d=this.currentTrackId,o=this.levels;if(!o.length||!o[d]||!o[d].details)return;var x=o[d].details,y=x.targetduration,p=m-y;if(p<=0)return;T.endOffsetSubtitles=Math.max(0,p),this.tracksBuffered.forEach(function(R){for(var U=0;U<R.length;){if(R[U].end<=p){R.shift();continue}else if(R[U].start<p)R[U].start=p;else break;U++}}),this.fragmentTracker.removeFragmentsInRange(f,p,v.PlaylistLevelType.SUBTITLE)}},g.onError=function(A,T){var f,m=T.frag;if(!m||m.type!==v.PlaylistLevelType.SUBTITLE)return;(f=this.fragCurrent)!==null&&f!==void 0&&f.loader&&this.fragCurrent.loader.abort(),this.state=c.State.IDLE},g.onSubtitleTracksUpdated=function(A,T){var f=this,m=T.subtitleTracks;this.tracksBuffered=[],this.levels=m.map(function(d){return new O.Level(d)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(d){f.tracksBuffered[d.id]=[]}),this.mediaBuffer=null},g.onSubtitleTrackSwitch=function(A,T){if(this.currentTrackId=T.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var f=this.levels[this.currentTrackId];f!=null&&f.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,f&&this.setInterval(a)},g.onSubtitleTrackLoaded=function(A,T){var f,m=T.details,d=T.id,o=this.currentTrackId,x=this.levels;if(!x.length)return;var y=x[o];if(d>=x.length||d!==o||!y)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,m.live||(f=y.details)!==null&&f!==void 0&&f.live){var p=this.mainDetails;if(m.deltaUpdateFailed||!p)return;var R=p.fragments[0];if(!y.details)m.hasProgramDateTime&&p.hasProgramDateTime?Object(_.alignMediaPlaylistByPDT)(m,p):R&&Object(P.addSliding)(m,R.start);else{var U=this.alignPlaylists(m,y.details);U===0&&R&&Object(P.addSliding)(m,R.start)}}if(y.details=m,this.levelLastLoaded=d,this.tick(),m.live&&!this.fragCurrent&&this.media&&this.state===c.State.IDLE){var B=Object(N.findFragmentByPTS)(null,m.fragments,this.media.currentTime,0);B||(this.warn("Subtitle playlist not aligned with playback"),y.details=void 0)}},g._handleFragmentLoadComplete=function(A){var T=A.frag,f=A.payload,m=T.decryptdata,d=this.hls;if(this.fragContextChanged(T))return;if(f&&f.byteLength>0&&m&&m.key&&m.iv&&m.method==="AES-128"){var o=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(f),m.key.buffer,m.iv.buffer).then(function(x){var y=performance.now();d.trigger(H.Events.FRAG_DECRYPTED,{frag:T,payload:x,stats:{tstart:o,tdecrypt:y}})})}},g.doTick=function(){if(!this.media){this.state=c.State.IDLE;return}if(this.state===c.State.IDLE){var A,T=this.currentTrackId,f=this.levels;if(!f.length||!f[T]||!f[T].details)return;var m=f[T].details,d=m.targetduration,o=this.config,x=this.media,y=M.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,x.currentTime-d,o.maxBufferHole),p=y.end,R=y.len,U=this.getMaxBufferLength()+d;if(R>U)return;console.assert(m,"Subtitle track details are defined on idle subtitle stream controller tick");var B=m.fragments,z=B.length,j=m.edge,F,X=this.fragPrevious;if(p<j){var q=o.maxFragLookUpTolerance;X&&m.hasProgramDateTime&&(F=Object(N.findFragmentByPDT)(B,X.endProgramDateTime,q)),F||(F=Object(N.findFragmentByPTS)(X,B,p,q),!F&&X&&X.start<B[0].start&&(F=B[0]))}else F=B[z-1];(A=F)!==null&&A!==void 0&&A.encrypted?(k.logger.log("Loading key for "+F.sn),this.state=c.State.KEY_LOADING,this.hls.trigger(H.Events.KEY_LOADING,{frag:F})):F&&this.fragmentTracker.getState(F)===D.FragmentState.NOT_LOADED&&this.loadFragment(F,m,p)}},g.loadFragment=function(A,T,f){this.fragCurrent=A,u.prototype.loadFragment.call(this,A,T,f)},b(C,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),C}(c.default)},"./src/controller/subtitle-track-controller.ts":function(Q,K,L){"use strict";L.r(K);var H=L("./src/events.ts"),k=L("./src/utils/texttrack-utils.ts"),M=L("./src/controller/base-playlist-controller.ts"),N=L("./src/types/loader.ts");function _(w,b){for(var E=0;E<b.length;E++){var s=b[E];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(w,s.key,s)}}function P(w,b,E){return b&&_(w.prototype,b),E&&_(w,E),w}function D(w,b){w.prototype=Object.create(b.prototype),w.prototype.constructor=w,c(w,b)}function c(w,b){return c=Object.setPrototypeOf||function(s,a){return s.__proto__=a,s},c(w,b)}var v=function(w){D(b,w);function b(s){var a;return a=w.call(this,s,"[subtitle-track-controller]")||this,a.media=null,a.tracks=[],a.groupId=null,a.tracksInGroup=[],a.trackId=-1,a.selectDefaultTrack=!0,a.queuedDefaultTrack=-1,a.trackChangeListener=function(){return a.onTextTracksChanged()},a.asyncPollTrackChange=function(){return a.pollTrackChange(0)},a.useTextTrackPolling=!1,a.subtitlePollingInterval=-1,a.subtitleDisplay=!0,a.registerListeners(),a}var E=b.prototype;return E.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,w.prototype.destroy.call(this)},E.registerListeners=function(){var a=this.hls;a.on(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.on(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.on(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.on(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.on(H.Events.LEVEL_LOADING,this.onLevelLoading,this),a.on(H.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),a.on(H.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),a.on(H.Events.ERROR,this.onError,this)},E.unregisterListeners=function(){var a=this.hls;a.off(H.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.off(H.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.off(H.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.off(H.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.off(H.Events.LEVEL_LOADING,this.onLevelLoading,this),a.off(H.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),a.off(H.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),a.off(H.Events.ERROR,this.onError,this)},E.onMediaAttached=function(a,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)},E.pollTrackChange=function(a){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,a)},E.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 a=O(this.media.textTracks);a.forEach(function(l){Object(k.clearCurrentCues)(l)}),this.subtitleTrack=-1,this.media=null},E.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},E.onManifestParsed=function(a,l){this.tracks=l.subtitleTracks},E.onSubtitleTrackLoaded=function(a,l){var u=l.id,C=l.details,g=this.trackId,h=this.tracksInGroup[g];if(!h){this.warn("Invalid subtitle track id "+u);return}var A=h.details;h.details=l.details,this.log("subtitle track "+u+" loaded ["+C.startSN+"-"+C.endSN+"]"),u===this.trackId&&(this.retryCount=0,this.playlistLoaded(u,l,A))},E.onLevelLoading=function(a,l){this.switchLevel(l.level)},E.onLevelSwitching=function(a,l){this.switchLevel(l.level)},E.switchLevel=function(a){var l=this.hls.levels[a];if(!(l!=null&&l.textGroupIds))return;var u=l.textGroupIds[l.urlId];if(this.groupId!==u){var C=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,g=this.tracks.filter(function(T){return!u||T.groupId===u});this.tracksInGroup=g;var h=this.findTrackId(C==null?void 0:C.name)||this.findTrackId();this.groupId=u;var A={subtitleTracks:g};this.log("Updating subtitle tracks, "+g.length+' track(s) found in "'+u+'" group-id'),this.hls.trigger(H.Events.SUBTITLE_TRACKS_UPDATED,A),h!==-1&&this.setSubtitleTrack(h,C)}},E.findTrackId=function(a){for(var l=this.tracksInGroup,u=0;u<l.length;u++){var C=l[u];if((!this.selectDefaultTrack||C.default)&&(!a||a===C.name))return C.id}return-1},E.onError=function(a,l){if(w.prototype.onError.call(this,a,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)},E.loadPlaylist=function(a){var l=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(l)){var u=l.id,C=l.groupId,g=l.url;if(a)try{g=a.addDirectives(g)}catch(h){this.warn("Could not construct new URL with HLS Delivery Directives: "+h)}this.log("Loading subtitle playlist for id "+u),this.hls.trigger(H.Events.SUBTITLE_TRACK_LOADING,{url:g,id:u,groupId:C,deliveryDirectives:a||null})}},E.toggleTrackModes=function(a){var l=this,u=this.media,C=this.subtitleDisplay,g=this.trackId;if(!u)return;var h=O(u.textTracks),A=h.filter(function(m){return m.groupId===l.groupId});if(a===-1)[].slice.call(h).forEach(function(m){m.mode="disabled"});else{var T=A[g];T&&(T.mode="disabled")}var f=A[a];f&&(f.mode=C?"showing":"hidden")},E.setSubtitleTrack=function(a,l){var u,C=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=a;return}if(this.trackId!==a&&this.toggleTrackModes(a),this.trackId===a&&(a===-1||(u=C[a])!==null&&u!==void 0&&u.details)||a<-1||a>=C.length)return;this.clearTimer();var g=C[a];if(this.log("Switching to subtitle track "+a),this.trackId=a,g){var h=g.id,A=g.groupId,T=A===void 0?"":A,f=g.name,m=g.type,d=g.url;this.hls.trigger(H.Events.SUBTITLE_TRACK_SWITCH,{id:h,groupId:T,name:f,type:m,url:d});var o=this.switchParams(g.url,l==null?void 0:l.details);this.loadPlaylist(o)}else this.hls.trigger(H.Events.SUBTITLE_TRACK_SWITCH,{id:a})},E.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var a=-1,l=O(this.media.textTracks),u=0;u<l.length;u++)if(l[u].mode==="hidden")a=u;else if(l[u].mode==="showing"){a=u;break}this.subtitleTrack!==a&&(this.subtitleTrack=a)},P(b,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(a){this.selectDefaultTrack=!1;var l=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(a,l)}}]),b}(M.default);function O(w){for(var b=[],E=0;E<w.length;E++){var s=w[E];s.kind==="subtitles"&&s.label&&b.push(w[E])}return b}K.default=v},"./src/controller/timeline-controller.ts":function(Q,K,L){"use strict";L.r(K),L.d(K,"TimelineController",function(){return O});var H=L("./src/polyfills/number.ts"),k=L("./src/events.ts"),M=L("./src/utils/cea-608-parser.ts"),N=L("./src/utils/output-filter.ts"),_=L("./src/utils/webvtt-parser.ts"),P=L("./src/utils/texttrack-utils.ts"),D=L("./src/utils/imsc1-ttml-parser.ts"),c=L("./src/types/loader.ts"),v=L("./src/utils/logger.ts"),O=function(){function s(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=E(),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 u=new N.default(this,"textTrack1"),C=new N.default(this,"textTrack2"),g=new N.default(this,"textTrack3"),h=new N.default(this,"textTrack4");this.cea608Parser1=new M.default(1,u,C),this.cea608Parser2=new M.default(3,g,h)}l.on(k.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),l.on(k.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.on(k.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.on(k.Events.MANIFEST_LOADED,this.onManifestLoaded,this),l.on(k.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),l.on(k.Events.FRAG_LOADING,this.onFragLoading,this),l.on(k.Events.FRAG_LOADED,this.onFragLoaded,this),l.on(k.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),l.on(k.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),l.on(k.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),l.on(k.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),l.on(k.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var a=s.prototype;return a.destroy=function(){var u=this.hls;u.off(k.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),u.off(k.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.off(k.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.off(k.Events.MANIFEST_LOADED,this.onManifestLoaded,this),u.off(k.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),u.off(k.Events.FRAG_LOADING,this.onFragLoading,this),u.off(k.Events.FRAG_LOADED,this.onFragLoaded,this),u.off(k.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),u.off(k.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),u.off(k.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),u.off(k.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),u.off(k.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},a.addCues=function(u,C,g,h,A){for(var T=!1,f=A.length;f--;){var m=A[f],d=b(m[0],m[1],C,g);if(d>=0&&(m[0]=Math.min(m[0],C),m[1]=Math.max(m[1],g),T=!0,d/(g-C)>.5))return}if(T||A.push([C,g]),this.config.renderTextTracksNatively){var o=this.captionsTracks[u];this.Cues.newCue(o,C,g,h)}else{var x=this.Cues.newCue(null,C,g,h);this.hls.trigger(k.Events.CUES_PARSED,{type:"captions",cues:x,track:u})}},a.onInitPtsFound=function(u,C){var g=this,h=C.frag,A=C.id,T=C.initPTS,f=C.timescale,m=this.unparsedVttFrags;A==="main"&&(this.initPTS[h.cc]=T,this.timescale[h.cc]=f),m.length&&(this.unparsedVttFrags=[],m.forEach(function(d){g.onFragLoaded(k.Events.FRAG_LOADED,d)}))},a.getExistingTrack=function(u){var C=this.media;if(C)for(var g=0;g<C.textTracks.length;g++){var h=C.textTracks[g];if(h[u])return h}return null},a.createCaptionsTrack=function(u){this.config.renderTextTracksNatively?this.createNativeTrack(u):this.createNonNativeTrack(u)},a.createNativeTrack=function(u){if(this.captionsTracks[u])return;var C=this.captionsProperties,g=this.captionsTracks,h=this.media,A=C[u],T=A.label,f=A.languageCode,m=this.getExistingTrack(u);if(m)g[u]=m,Object(P.clearCurrentCues)(g[u]),Object(P.sendAddTrackEvent)(g[u],h);else{var d=this.createTextTrack("captions",T,f);d&&(d[u]=!0,g[u]=d)}},a.createNonNativeTrack=function(u){if(this.nonNativeCaptionsTracks[u])return;var C=this.captionsProperties[u];if(!C)return;var g=C.label,h={_id:u,label:g,kind:"captions",default:C.media?!!C.media.default:!1,closedCaptions:C.media};this.nonNativeCaptionsTracks[u]=h,this.hls.trigger(k.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[h]})},a.createTextTrack=function(u,C,g){var h=this.media;return h?h.addTextTrack(u,C,g):void 0},a.onMediaAttaching=function(u,C){this.media=C.media,this._cleanTracks()},a.onMediaDetaching=function(){var u=this.captionsTracks;Object.keys(u).forEach(function(C){Object(P.clearCurrentCues)(u[C]),delete u[C]}),this.nonNativeCaptionsTracks={}},a.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=E(),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())},a._cleanTracks=function(){var u=this.media;if(!u)return;var C=u.textTracks;if(C)for(var g=0;g<C.length;g++)Object(P.clearCurrentCues)(C[g])},a.onSubtitleTracksUpdated=function(u,C){var g=this;this.textTracks=[];var h=C.subtitleTracks||[],A=h.some(function(d){return d.textCodec===D.IMSC1_CODEC});if(this.config.enableWebVTT||A&&this.config.enableIMSC1){var T=this.tracks&&h&&this.tracks.length===h.length;if(this.tracks=h||[],this.config.renderTextTracksNatively){var f=this.media?this.media.textTracks:[];this.tracks.forEach(function(d,o){var x;if(o<f.length){for(var y=null,p=0;p<f.length;p++)if(w(f[p],d)){y=f[p];break}y&&(x=y)}x?Object(P.clearCurrentCues)(x):(x=g.createTextTrack("subtitles",d.name,d.lang),x&&(x.mode="disabled")),x&&(x.groupId=d.groupId,g.textTracks.push(x))})}else if(!T&&this.tracks&&this.tracks.length){var m=this.tracks.map(function(d){return{label:d.name,kind:d.type.toLowerCase(),default:d.default,subtitleTrack:d}});this.hls.trigger(k.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:m})}}},a.onManifestLoaded=function(u,C){var g=this;this.config.enableCEA708Captions&&C.captions&&C.captions.forEach(function(h){var A=/(?:CC|SERVICE)([1-4])/.exec(h.instreamId);if(!A)return;var T="textTrack"+A[1],f=g.captionsProperties[T];if(!f)return;f.label=h.name,h.lang&&(f.languageCode=h.lang),f.media=h})},a.onFragLoading=function(u,C){var g=this.cea608Parser1,h=this.cea608Parser2,A=this.lastSn,T=this.lastPartIndex;if(!this.enabled||!(g&&h))return;if(C.frag.type===c.PlaylistLevelType.MAIN){var f,m,d=C.frag.sn,o=(f=C==null||((m=C.part)===null||m===void 0)?void 0:m.index)!=null?f:-1;d===A+1||d===A&&o===T+1||(g.reset(),h.reset()),this.lastSn=d,this.lastPartIndex=o}},a.onFragLoaded=function(u,C){var g=C.frag,h=C.payload,A=this.initPTS,T=this.unparsedVttFrags;if(g.type===c.PlaylistLevelType.SUBTITLE)if(h.byteLength){if(!Object(H.isFiniteNumber)(A[g.cc])){T.push(C),A.length&&this.hls.trigger(k.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:g,error:new Error("Missing initial subtitle PTS")});return}var f=g.decryptdata;if(f==null||f.key==null||f.method!=="AES-128"){var m=this.tracks[g.level],d=this.vttCCs;d[g.cc]||(d[g.cc]={start:g.start,prevCC:this.prevCC,new:!0},this.prevCC=g.cc),m&&m.textCodec===D.IMSC1_CODEC?this._parseIMSC1(g,h):this._parseVTTs(g,h,d)}}else this.hls.trigger(k.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:g,error:new Error("Empty subtitle payload")})},a._parseIMSC1=function(u,C){var g=this,h=this.hls;Object(D.parseIMSC1)(C,this.initPTS[u.cc],this.timescale[u.cc],function(A){g._appendCues(A,u.level),h.trigger(k.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:u})},function(A){v.logger.log("Failed to parse IMSC1: "+A),h.trigger(k.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:u,error:A})})},a._parseVTTs=function(u,C,g){var h=this,A=this.hls;Object(_.parseWebVTT)(C,this.initPTS[u.cc],this.timescale[u.cc],g,u.cc,u.start,function(T){h._appendCues(T,u.level),A.trigger(k.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:u})},function(T){h._fallbackToIMSC1(u,C),v.logger.log("Failed to parse VTT cue: "+T),A.trigger(k.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:u,error:T})})},a._fallbackToIMSC1=function(u,C){var g=this,h=this.tracks[u.level];h.textCodec||Object(D.parseIMSC1)(C,this.initPTS[u.cc],this.timescale[u.cc],function(){h.textCodec=D.IMSC1_CODEC,g._parseIMSC1(u,C)},function(){h.textCodec="wvtt"})},a._appendCues=function(u,C){var g=this.hls;if(this.config.renderTextTracksNatively){var h=this.textTracks[C];if(h.mode==="disabled")return;u.forEach(function(f){return Object(P.addCueToTrack)(h,f)})}else{var A=this.tracks[C],T=A.default?"default":"subtitles"+C;g.trigger(k.Events.CUES_PARSED,{type:"subtitles",cues:u,track:T})}},a.onFragDecrypted=function(u,C){var g=C.frag;if(g.type===c.PlaylistLevelType.SUBTITLE){if(!Object(H.isFiniteNumber)(this.initPTS[g.cc])){this.unparsedVttFrags.push(C);return}this.onFragLoaded(k.Events.FRAG_LOADED,C)}},a.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},a.onFragParsingUserdata=function(u,C){var g=this.cea608Parser1,h=this.cea608Parser2;if(!this.enabled||!(g&&h))return;for(var A=0;A<C.samples.length;A++){var T=C.samples[A].bytes;if(T){var f=this.extractCea608Data(T);g.addData(C.samples[A].pts,f[0]),h.addData(C.samples[A].pts,f[1])}}},a.onBufferFlushing=function(u,C){var g=C.startOffset,h=C.endOffset,A=C.endOffsetSubtitles,T=C.type,f=this.media;if(!f||f.currentTime<h)return;if(!T||T==="video"){var m=this.captionsTracks;Object.keys(m).forEach(function(o){return Object(P.removeCuesInRange)(m[o],g,h)})}if(this.config.renderTextTracksNatively&&(g===0&&A!==void 0)){var d=this.textTracks;Object.keys(d).forEach(function(o){return Object(P.removeCuesInRange)(d[o],g,A)})}},a.extractCea608Data=function(u){for(var C=u[0]&31,g=2,h=[[],[]],A=0;A<C;A++){var T=u[g++],f=127&u[g++],m=127&u[g++],d=(4&T)!==0,o=3&T;if(f===0&&m===0)continue;d&&((o===0||o===1)&&(h[o].push(f),h[o].push(m)))}return h},s}();function w(s,a){return s&&s.label===a.name&&!(s.textTrack1||s.textTrack2)}function b(s,a,l,u){return Math.min(a,u)-Math.max(s,l)}function E(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(Q,K,L){"use strict";L.r(K),L.d(K,"default",function(){return H});var H=function(){function k(N,_){this.subtle=void 0,this.aesIV=void 0,this.subtle=N,this.aesIV=_}var M=k.prototype;return M.decrypt=function(_,P){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},P,_)},k}()},"./src/crypt/aes-decryptor.ts":function(Q,K,L){"use strict";L.r(K),L.d(K,"removePadding",function(){return k}),L.d(K,"default",function(){return M});var H=L("./src/utils/typed-array.ts");function k(N){var _=N.byteLength,P=_&&new DataView(N.buffer).getUint8(_-1);return P?Object(H.sliceUint8)(N,0,_-P):N}var M=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 _=N.prototype;return _.uint8ArrayToUint32Array_=function(D){for(var c=new DataView(D),v=new Uint32Array(4),O=0;O<4;O++)v[O]=c.getUint32(O*4);return v},_.initTable=function(){var D=this.sBox,c=this.invSBox,v=this.subMix,O=v[0],w=v[1],b=v[2],E=v[3],s=this.invSubMix,a=s[0],l=s[1],u=s[2],C=s[3],g=new Uint32Array(256),h=0,A=0,T=0;for(T=0;T<256;T++)T<128?g[T]=T<<1:g[T]=T<<1^283;for(T=0;T<256;T++){var f=A^A<<1^A<<2^A<<3^A<<4;f=f>>>8^f&255^99,D[h]=f,c[f]=h;var m=g[h],d=g[m],o=g[d],x=g[f]*257^f*16843008;O[h]=x<<24|x>>>8,w[h]=x<<16|x>>>16,b[h]=x<<8|x>>>24,E[h]=x,x=o*16843009^d*65537^m*257^h*16843008,a[f]=x<<24|x>>>8,l[f]=x<<16|x>>>16,u[f]=x<<8|x>>>24,C[f]=x,h?(h=m^g[g[g[o^m]]],A^=g[g[A]]):h=A=1}},_.expandKey=function(D){for(var c=this.uint8ArrayToUint32Array_(D),v=!0,O=0;O<c.length&&v;)v=c[O]===this.key[O],O++;if(v)return;this.key=c;var w=this.keySize=c.length;if(w!==4&&w!==6&&w!==8)throw new Error("Invalid aes key size="+w);var b=this.ksRows=(w+6+1)*4,E,s,a=this.keySchedule=new Uint32Array(b),l=this.invKeySchedule=new Uint32Array(b),u=this.sBox,C=this.rcon,g=this.invSubMix,h=g[0],A=g[1],T=g[2],f=g[3],m,d;for(E=0;E<b;E++){if(E<w){m=a[E]=c[E];continue}d=m,E%w===0?(d=d<<8|d>>>24,d=u[d>>>24]<<24|u[d>>>16&255]<<16|u[d>>>8&255]<<8|u[d&255],d^=C[E/w|0]<<24):w>6&&E%w===4&&(d=u[d>>>24]<<24|u[d>>>16&255]<<16|u[d>>>8&255]<<8|u[d&255]),a[E]=m=(a[E-w]^d)>>>0}for(s=0;s<b;s++)E=b-s,s&3?d=a[E]:d=a[E-4],s<4||E<=4?l[s]=d:l[s]=h[u[d>>>24]]^A[u[d>>>16&255]]^T[u[d>>>8&255]]^f[u[d&255]],l[s]=l[s]>>>0},_.networkToHostOrderSwap=function(D){return D<<24|(D&65280)<<8|(D&16711680)>>8|D>>>24},_.decrypt=function(D,c,v){for(var O=this.keySize+6,w=this.invKeySchedule,b=this.invSBox,E=this.invSubMix,s=E[0],a=E[1],l=E[2],u=E[3],C=this.uint8ArrayToUint32Array_(v),g=C[0],h=C[1],A=C[2],T=C[3],f=new Int32Array(D),m=new Int32Array(f.length),d,o,x,y,p,R,U,B,z,j,F,X,q,ne,ue=this.networkToHostOrderSwap;c<f.length;){for(z=ue(f[c]),j=ue(f[c+1]),F=ue(f[c+2]),X=ue(f[c+3]),p=z^w[0],R=X^w[1],U=F^w[2],B=j^w[3],q=4,ne=1;ne<O;ne++)d=s[p>>>24]^a[R>>16&255]^l[U>>8&255]^u[B&255]^w[q],o=s[R>>>24]^a[U>>16&255]^l[B>>8&255]^u[p&255]^w[q+1],x=s[U>>>24]^a[B>>16&255]^l[p>>8&255]^u[R&255]^w[q+2],y=s[B>>>24]^a[p>>16&255]^l[R>>8&255]^u[U&255]^w[q+3],p=d,R=o,U=x,B=y,q=q+4;d=b[p>>>24]<<24^b[R>>16&255]<<16^b[U>>8&255]<<8^b[B&255]^w[q],o=b[R>>>24]<<24^b[U>>16&255]<<16^b[B>>8&255]<<8^b[p&255]^w[q+1],x=b[U>>>24]<<24^b[B>>16&255]<<16^b[p>>8&255]<<8^b[R&255]^w[q+2],y=b[B>>>24]<<24^b[p>>16&255]<<16^b[R>>8&255]<<8^b[U&255]^w[q+3],m[c]=ue(d^g),m[c+1]=ue(y^h),m[c+2]=ue(x^A),m[c+3]=ue(o^T),g=z,h=j,A=F,T=X,c=c+4}return m.buffer},N}()},"./src/crypt/decrypter.ts":function(Q,K,L){"use strict";L.r(K),L.d(K,"default",function(){return c});var H=L("./src/crypt/aes-crypto.ts"),k=L("./src/crypt/fast-aes-key.ts"),M=L("./src/crypt/aes-decryptor.ts"),N=L("./src/utils/logger.ts"),_=L("./src/utils/mp4-tools.ts"),P=L("./src/utils/typed-array.ts"),D=16,c=function(){function v(w,b,E){var s=E===void 0?{}:E,a=s.removePKCS7Padding,l=a===void 0?!0:a;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=b,this.removePKCS7Padding=l,l)try{var u=self.crypto;u&&(this.subtle=u.subtle||u.webkitSubtle)}catch(C){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var O=v.prototype;return O.destroy=function(){this.observer=null},O.isSync=function(){return this.config.enableSoftwareAES},O.flush=function(){var b=this.currentResult;if(!b){this.reset();return}var E=new Uint8Array(b);return this.reset(),this.removePKCS7Padding?Object(M.removePadding)(E):E},O.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},O.decrypt=function(b,E,s,a){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(b),E,s);var l=this.flush();l&&a(l.buffer)}else this.webCryptoDecrypt(new Uint8Array(b),E,s).then(a)},O.softwareDecrypt=function(b,E,s){var a=this.currentIV,l=this.currentResult,u=this.remainderData;this.logOnce("JS AES decrypt"),u&&(b=Object(_.appendUint8Array)(u,b),this.remainderData=null);var C=this.getValidChunk(b);if(!C.length)return null;a&&(s=a);var g=this.softwareDecrypter;g||(g=this.softwareDecrypter=new M.default),g.expandKey(E);var h=l;return this.currentResult=g.decrypt(C.buffer,0,s),this.currentIV=Object(P.sliceUint8)(C,-16).buffer,h||null},O.webCryptoDecrypt=function(b,E,s){var a=this,l=this.subtle;return(this.key!==E||!this.fastAesKey)&&(this.key=E,this.fastAesKey=new k.default(l,E)),this.fastAesKey.expandKey().then(function(u){if(!l)return Promise.reject(new Error("web crypto not initialized"));var C=new H.default(l,s);return C.decrypt(b.buffer,u)}).catch(function(u){return a.onWebCryptoError(u,b,E,s)})},O.onWebCryptoError=function(b,E,s,a){return N.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",b),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(E,s,a)},O.getValidChunk=function(b){var E=b,s=b.length-b.length%D;return s!==b.length&&(E=Object(P.sliceUint8)(b,0,s),this.remainderData=Object(P.sliceUint8)(b,s)),E},O.logOnce=function(b){if(!this.logEnabled)return;N.logger.log("[decrypter.ts]: "+b),this.logEnabled=!1},v}()},"./src/crypt/fast-aes-key.ts":function(Q,K,L){"use strict";L.r(K),L.d(K,"default",function(){return H});var H=function(){function k(N,_){this.subtle=void 0,this.key=void 0,this.subtle=N,this.key=_}var M=k.prototype;return M.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},k}()},"./src/demux/aacdemuxer.ts":function(Q,K,L){"use strict";L.r(K);var H=L("./src/demux/base-audio-demuxer.ts"),k=L("./src/demux/adts.ts"),M=L("./src/utils/logger.ts"),N=L("./src/demux/id3.ts");function _(c,v){c.prototype=Object.create(v.prototype),c.prototype.constructor=c,P(c,v)}function P(c,v){return P=Object.setPrototypeOf||function(w,b){return w.__proto__=b,w},P(c,v)}var D=function(c){_(v,c);function v(w,b){var E;return E=c.call(this)||this,E.observer=void 0,E.config=void 0,E.observer=w,E.config=b,E}var O=v.prototype;return O.resetInitSegment=function(b,E,s){c.prototype.resetInitSegment.call(this,b,E,s),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:b,duration:s,inputTimeScale:9e4,dropped:0}},v.probe=function(b){if(!b)return!1;for(var E=N.getID3Data(b,0)||[],s=E.length,a=b.length;s<a;s++)if(k.probe(b,s))return M.logger.log("ADTS sync word found !"),!0;return!1},O.canParse=function(b,E){return k.canParse(b,E)},O.appendFrame=function(b,E,s){k.initTrackConfig(b,this.observer,E,s,b.manifestCodec);var a=k.appendFrame(b,E,s,this.initPTS,this.frameIndex);if(a&&a.missing===0)return a},v}(H.default);D.minProbeByteLength=9,K.default=D},"./src/demux/adts.ts":function(Q,K,L){"use strict";L.r(K),L.d(K,"getAudioConfig",function(){return N}),L.d(K,"isHeaderPattern",function(){return _}),L.d(K,"getHeaderLength",function(){return P}),L.d(K,"getFullFrameLength",function(){return D}),L.d(K,"canGetFrameLength",function(){return c}),L.d(K,"isHeader",function(){return v}),L.d(K,"canParse",function(){return O}),L.d(K,"probe",function(){return w}),L.d(K,"initTrackConfig",function(){return b}),L.d(K,"getFrameDuration",function(){return E}),L.d(K,"parseFrameHeader",function(){return s}),L.d(K,"appendFrame",function(){return a});var H=L("./src/utils/logger.ts"),k=L("./src/errors.ts"),M=L("./src/events.ts");function N(l,u,C,g){var h,A,T,f,m=navigator.userAgent.toLowerCase(),d=g,o=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];h=((u[C+2]&192)>>>6)+1;var x=(u[C+2]&60)>>>2;if(x>o.length-1){l.trigger(M.Events.ERROR,{type:k.ErrorTypes.MEDIA_ERROR,details:k.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+x});return}return T=(u[C+2]&1)<<2,T|=(u[C+3]&192)>>>6,H.logger.log("manifest codec:"+g+", ADTS type:"+h+", samplingIndex:"+x),/firefox/i.test(m)?x>=6?(h=5,f=new Array(4),A=x-3):(h=2,f=new Array(2),A=x):m.indexOf("android")!==-1?(h=2,f=new Array(2),A=x):(h=5,f=new Array(4),g&&(g.indexOf("mp4a.40.29")!==-1||g.indexOf("mp4a.40.5")!==-1)||!g&&x>=6?A=x-3:((g&&g.indexOf("mp4a.40.2")!==-1&&(x>=6&&T===1||/vivaldi/i.test(m))||!g&&T===1)&&(h=2,f=new Array(2)),A=x)),f[0]=h<<3,f[0]|=(x&14)>>1,f[1]|=(x&1)<<7,f[1]|=T<<3,h===5&&(f[1]|=(A&14)>>1,f[2]=(A&1)<<7,f[2]|=2<<2,f[3]=0),{config:f,samplerate:o[x],channelCount:T,codec:"mp4a.40."+h,manifestCodec:d}}function _(l,u){return l[u]===255&&(l[u+1]&246)===240}function P(l,u){return l[u+1]&1?7:9}function D(l,u){return(l[u+3]&3)<<11|l[u+4]<<3|(l[u+5]&224)>>>5}function c(l,u){return u+5<l.length}function v(l,u){return u+1<l.length&&_(l,u)}function O(l,u){return c(l,u)&&_(l,u)&&D(l,u)<=l.length-u}function w(l,u){if(v(l,u)){var C=P(l,u);if(u+C>=l.length)return!1;var g=D(l,u);if(g<=C)return!1;var h=u+g;return h===l.length||v(l,h)}return!1}function b(l,u,C,g,h){if(!l.samplerate){var A=N(u,C,g,h);if(!A)return;l.config=A.config,l.samplerate=A.samplerate,l.channelCount=A.channelCount,l.codec=A.codec,l.manifestCodec=A.manifestCodec,H.logger.log("parsed codec:"+l.codec+", rate:"+A.samplerate+", channels:"+A.channelCount)}}function E(l){return 1024*9e4/l}function s(l,u,C,g,h){var A=P(l,u),T=D(l,u);if(T-=A,T>0){var f=C+g*h;return{headerLength:A,frameLength:T,stamp:f}}}function a(l,u,C,g,h){var A=E(l.samplerate),T=s(u,C,g,h,A);if(T){var f=T.frameLength,m=T.headerLength,d=T.stamp,o=m+f,x=Math.max(0,C+o-u.length),y;x?(y=new Uint8Array(o-m),y.set(u.subarray(C+m,u.length),0)):y=u.subarray(C+m,C+o);var p={unit:y,pts:d};return x||l.samples.push(p),{sample:p,length:o,missing:x}}}},"./src/demux/base-audio-demuxer.ts":function(Q,K,L){"use strict";L.r(K),L.d(K,"initPTSFn",function(){return D});var H=L("./src/polyfills/number.ts"),k=L("./src/demux/id3.ts"),M=L("./src/demux/dummy-demuxed-track.ts"),N=L("./src/utils/mp4-tools.ts"),_=L("./src/utils/typed-array.ts"),P=function(){function c(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var v=c.prototype;return v.resetInitSegment=function(w,b,E){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},v.resetTimeStamp=function(){},v.resetContiguity=function(){},v.canParse=function(w,b){return!1},v.appendFrame=function(w,b,E){},v.demux=function(w,b){this.cachedData&&(w=Object(N.appendUint8Array)(this.cachedData,w),this.cachedData=null);var E=k.getID3Data(w,0),s=E?E.length:0,a,l,u=this._audioTrack,C=this._id3Track,g=E?k.getTimeStamp(E):void 0,h=w.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=D(g,b)),E&&E.length>0&&C.samples.push({pts:this.initPTS,dts:this.initPTS,data:E}),l=this.initPTS;s<h;){if(this.canParse(w,s)){var A=this.appendFrame(u,w,s);A?(this.frameIndex++,l=A.sample.pts,s+=A.length,a=s):s=h}else k.canParse(w,s)?(E=k.getID3Data(w,s),C.samples.push({pts:l,dts:l,data:E}),s+=E.length,a=s):s++;if(s===h&&a!==h){var T=Object(_.sliceUint8)(w,a);this.cachedData?this.cachedData=Object(N.appendUint8Array)(this.cachedData,T):this.cachedData=T}}return{audioTrack:u,avcTrack:Object(M.dummyTrack)(),id3Track:C,textTrack:Object(M.dummyTrack)()}},v.demuxSampleAes=function(w,b,E){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},v.flush=function(w){var b=this.cachedData;return b&&(this.cachedData=null,this.demux(b,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(M.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(M.dummyTrack)()}},v.destroy=function(){},c}(),D=function(v,O){return Object(H.isFiniteNumber)(v)?v*90:O*9e4};K.default=P},"./src/demux/chunk-cache.ts":function(Q,K,L){"use strict";L.r(K),L.d(K,"default",function(){return H});var H=function(){function M(){this.chunks=[],this.dataLength=0}var N=M.prototype;return N.push=function(P){this.chunks.push(P),this.dataLength+=P.length},N.flush=function(){var P=this.chunks,D=this.dataLength,c;if(P.length)P.length===1?c=P[0]:c=k(P,D);else return new Uint8Array(0);return this.reset(),c},N.reset=function(){this.chunks.length=0,this.dataLength=0},M}();function k(M,N){for(var _=new Uint8Array(N),P=0,D=0;D<M.length;D++){var c=M[D];_.set(c,P),P+=c.length}return _}},"./src/demux/dummy-demuxed-track.ts":function(Q,K,L){"use strict";L.r(K),L.d(K,"dummyTrack",function(){return H});function H(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(Q,K,L){"use strict";L.r(K);var H=L("./src/utils/logger.ts"),k=function(){function M(_){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=_,this.bytesAvailable=_.byteLength,this.word=0,this.bitsAvailable=0}var N=M.prototype;return N.loadWord=function(){var P=this.data,D=this.bytesAvailable,c=P.byteLength-D,v=new Uint8Array(4),O=Math.min(4,D);if(O===0)throw new Error("no bytes available");v.set(P.subarray(c,c+O)),this.word=new DataView(v.buffer).getUint32(0),this.bitsAvailable=O*8,this.bytesAvailable-=O},N.skipBits=function(P){var D;this.bitsAvailable>P?(this.word<<=P,this.bitsAvailable-=P):(P-=this.bitsAvailable,D=P>>3,P-=D>>3,this.bytesAvailable-=D,this.loadWord(),this.word<<=P,this.bitsAvailable-=P)},N.readBits=function(P){var D=Math.min(this.bitsAvailable,P),c=this.word>>>32-D;return P>32&&H.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=D,this.bitsAvailable>0?this.word<<=D:this.bytesAvailable>0&&this.loadWord(),D=P-D,D>0&&this.bitsAvailable?c<<D|this.readBits(D):c},N.skipLZ=function(){var P;for(P=0;P<this.bitsAvailable;++P)if((this.word&2147483648>>>P)!==0)return this.word<<=P,this.bitsAvailable-=P,P;return this.loadWord(),P+this.skipLZ()},N.skipUEG=function(){this.skipBits(1+this.skipLZ())},N.skipEG=function(){this.skipBits(1+this.skipLZ())},N.readUEG=function(){var P=this.skipLZ();return this.readBits(P+1)-1},N.readEG=function(){var P=this.readUEG();return 1&P?1+P>>>1:-1*(P>>>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(P){for(var D=8,c=8,v,O=0;O<P;O++)c!==0&&(v=this.readEG(),c=(D+v+256)%256),D=c===0?D:c},N.readSPS=function(){var P=0,D=0,c=0,v=0,O,w,b,E=this.readUByte.bind(this),s=this.readBits.bind(this),a=this.readUEG.bind(this),l=this.readBoolean.bind(this),u=this.skipBits.bind(this),C=this.skipEG.bind(this),g=this.skipUEG.bind(this),h=this.skipScalingList.bind(this);E();var A=E();if(s(5),u(3),E(),g(),A===100||A===110||A===122||A===244||A===44||A===83||A===86||A===118||A===128){var T=a();if(T===3&&u(1),g(),g(),u(1),l())for(w=T!==3?8:12,b=0;b<w;b++)l()&&(b<6?h(16):h(64))}g();var f=a();if(f===0)a();else if(f===1)for(u(1),C(),C(),O=a(),b=0;b<O;b++)C();g(),u(1);var m=a(),d=a(),o=s(1);o===0&&u(1),u(1),l()&&(P=a(),D=a(),c=a(),v=a());var x=[1,1];if(l()&&l()){var y=E();switch(y){case 1:x=[1,1];break;case 2:x=[12,11];break;case 3:x=[10,11];break;case 4:x=[16,11];break;case 5:x=[40,33];break;case 6:x=[24,11];break;case 7:x=[20,11];break;case 8:x=[32,11];break;case 9:x=[80,33];break;case 10:x=[18,11];break;case 11:x=[15,11];break;case 12:x=[64,33];break;case 13:x=[160,99];break;case 14:x=[4,3];break;case 15:x=[3,2];break;case 16:x=[2,1];break;case 255:{x=[E()<<8|E(),E()<<8|E()];break}}}return{width:Math.ceil((m+1)*16-P*2-D*2),height:(2-o)*(d+1)*16-(o?2:4)*(c+v),pixelRatio:x}},N.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},M}();K.default=k},"./src/demux/id3.ts":function(Q,K,L){"use strict";L.r(K),L.d(K,"isHeader",function(){return H}),L.d(K,"isFooter",function(){return k}),L.d(K,"getID3Data",function(){return M}),L.d(K,"canParse",function(){return _}),L.d(K,"getTimeStamp",function(){return P}),L.d(K,"isTimeStampFrame",function(){return D}),L.d(K,"getID3Frames",function(){return v}),L.d(K,"decodeFrame",function(){return O}),L.d(K,"utf8ArrayToStr",function(){return a}),L.d(K,"testables",function(){return l});var H=function(h,A){return A+10<=h.length&&(h[A]===73&&h[A+1]===68&&h[A+2]===51&&(h[A+3]<255&&h[A+4]<255&&(h[A+6]<128&&h[A+7]<128&&h[A+8]<128&&h[A+9]<128)))},k=function(h,A){return A+10<=h.length&&(h[A]===51&&h[A+1]===68&&h[A+2]===73&&(h[A+3]<255&&h[A+4]<255&&(h[A+6]<128&&h[A+7]<128&&h[A+8]<128&&h[A+9]<128)))},M=function(h,A){for(var T=A,f=0;H(h,A);){f+=10;var m=N(h,A+6);f+=m,k(h,A+10)&&(f+=10),A+=f}return f>0?h.subarray(T,T+f):void 0},N=function(h,A){var T=0;return T=(h[A]&127)<<21,T|=(h[A+1]&127)<<14,T|=(h[A+2]&127)<<7,T|=h[A+3]&127,T},_=function(h,A){return H(h,A)&&N(h,A+6)+10<=h.length-A},P=function(h){for(var A=v(h),T=0;T<A.length;T++){var f=A[T];if(D(f))return s(f)}return},D=function(h){return h&&h.key==="PRIV"&&h.info==="com.apple.streaming.transportStreamTimestamp"},c=function(h){var A=String.fromCharCode(h[0],h[1],h[2],h[3]),T=N(h,4),f=10;return{type:A,size:T,data:h.subarray(f,f+T)}},v=function(h){for(var A=0,T=[];H(h,A);){var f=N(h,A+6);A+=10;for(var m=A+f;A+8<m;){var d=c(h.subarray(A)),o=O(d);o&&T.push(o),A+=d.size+10}k(h,A)&&(A+=10)}return T},O=function(h){return h.type==="PRIV"?w(h):h.type[0]==="W"?E(h):b(h)},w=function(h){if(h.size<2)return;var A=a(h.data,!0),T=new Uint8Array(h.data.subarray(A.length+1));return{key:h.type,info:A,data:T.buffer}},b=function(h){if(h.size<2)return;if(h.type==="TXXX"){var A=1,T=a(h.data.subarray(A),!0);A+=T.length+1;var f=a(h.data.subarray(A));return{key:h.type,info:T,data:f}}var m=a(h.data.subarray(1));return{key:h.type,data:m}},E=function(h){if(h.type==="WXXX"){if(h.size<2)return;var A=1,T=a(h.data.subarray(A),!0);A+=T.length+1;var f=a(h.data.subarray(A));return{key:h.type,info:T,data:f}}var m=a(h.data);return{key:h.type,data:m}},s=function(h){if(h.data.byteLength===8){var A=new Uint8Array(h.data),T=A[3]&1,f=(A[4]<<23)+(A[5]<<15)+(A[6]<<7)+A[7];return f/=45,T&&(f+=4772185884e-2),Math.round(f)}return},a=function(h,A){A===void 0&&(A=!1);var T=C();if(T){var f=T.decode(h);if(A){var m=f.indexOf("\0");return m!==-1?f.substring(0,m):f}return f.replace(/\0/g,"")}for(var d=h.length,o,x,y,p="",R=0;R<d;){if(o=h[R++],o===0&&A)return p;if(o===0||o===3)continue;switch(o>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:p+=String.fromCharCode(o);break;case 12:case 13:x=h[R++],p+=String.fromCharCode((o&31)<<6|x&63);break;case 14:x=h[R++],y=h[R++],p+=String.fromCharCode((o&15)<<12|(x&63)<<6|(y&63)<<0);break;default:}}return p},l={decodeTextFrame:b},u;function C(){return!u&&typeof self.TextDecoder!="undefined"&&(u=new self.TextDecoder("utf-8")),u}},"./src/demux/mp3demuxer.ts":function(Q,K,L){"use strict";L.r(K);var H=L("./src/demux/base-audio-demuxer.ts"),k=L("./src/demux/id3.ts"),M=L("./src/utils/logger.ts"),N=L("./src/demux/mpegaudio.ts");function _(c,v){c.prototype=Object.create(v.prototype),c.prototype.constructor=c,P(c,v)}function P(c,v){return P=Object.setPrototypeOf||function(w,b){return w.__proto__=b,w},P(c,v)}var D=function(c){_(v,c);function v(){return c.apply(this,arguments)||this}var O=v.prototype;return O.resetInitSegment=function(b,E,s){c.prototype.resetInitSegment.call(this,b,E,s),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:b,duration:s,inputTimeScale:9e4,dropped:0}},v.probe=function(b){if(!b)return!1;for(var E=k.getID3Data(b,0)||[],s=E.length,a=b.length;s<a;s++)if(N.probe(b,s))return M.logger.log("MPEG Audio sync word found !"),!0;return!1},O.canParse=function(b,E){return N.canParse(b,E)},O.appendFrame=function(b,E,s){return this.initPTS===null?void 0:N.appendFrame(b,E,s,this.initPTS,this.frameIndex)},v}(H.default);D.minProbeByteLength=4,K.default=D},"./src/demux/mp4demuxer.ts":function(Q,K,L){"use strict";L.r(K);var H=L("./src/utils/mp4-tools.ts"),k=L("./src/demux/dummy-demuxed-track.ts"),M=function(){function N(P,D){this.remainderData=null,this.config=void 0,this.config=D}var _=N.prototype;return _.resetTimeStamp=function(){},_.resetInitSegment=function(){},_.resetContiguity=function(){},N.probe=function(D){return Object(H.findBox)({data:D,start:0,end:Math.min(D.length,16384)},["moof"]).length>0},_.demux=function(D){var c=D,v=Object(k.dummyTrack)();if(this.config.progressive){this.remainderData&&(c=Object(H.appendUint8Array)(this.remainderData,D));var O=Object(H.segmentValidRange)(c);this.remainderData=O.remainder,v.samples=O.valid||new Uint8Array}else v.samples=c;return{audioTrack:Object(k.dummyTrack)(),avcTrack:v,id3Track:Object(k.dummyTrack)(),textTrack:Object(k.dummyTrack)()}},_.flush=function(){var D=Object(k.dummyTrack)();return D.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(k.dummyTrack)(),avcTrack:D,id3Track:Object(k.dummyTrack)(),textTrack:Object(k.dummyTrack)()}},_.demuxSampleAes=function(D,c,v){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},_.destroy=function(){},N}();M.minProbeByteLength=1024,K.default=M},"./src/demux/mpegaudio.ts":function(Q,K,L){"use strict";L.r(K),L.d(K,"appendFrame",function(){return P}),L.d(K,"parseHeader",function(){return D}),L.d(K,"isHeaderPattern",function(){return c}),L.d(K,"isHeader",function(){return v}),L.d(K,"canParse",function(){return O}),L.d(K,"probe",function(){return w});var H=null,k=[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],M=[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]],_=[0,1,1,4];function P(b,E,s,a,l){if(s+24>E.length)return;var u=D(E,s);if(u&&s+u.frameLength<=E.length){var C=u.samplesPerFrame*9e4/u.sampleRate,g=a+l*C,h={unit:E.subarray(s,s+u.frameLength),pts:g,dts:g};return b.config=[],b.channelCount=u.channelCount,b.samplerate=u.sampleRate,b.samples.push(h),{sample:h,length:u.frameLength,missing:0}}}function D(b,E){var s=b[E+1]>>3&3,a=b[E+1]>>1&3,l=b[E+2]>>4&15,u=b[E+2]>>2&3;if(s!==1&&l!==0&&l!==15&&u!==3){var C=b[E+2]>>1&1,g=b[E+3]>>6,h=s===3?3-a:a===3?3:4,A=k[h*14+l-1]*1e3,T=s===3?0:s===2?1:2,f=M[T*3+u],m=g===3?1:2,d=N[s][a],o=_[a],x=d*8*o,y=Math.floor(d*A/f+C)*o;if(H===null){var p=navigator.userAgent||"",R=p.match(/Chrome\/(\d+)/i);H=R?parseInt(R[1]):0}var U=!!H&&H<=87;return U&&a===2&&A>=224e3&&g===0&&(b[E+3]=b[E+3]|128),{sampleRate:f,channelCount:m,frameLength:y,samplesPerFrame:x}}}function c(b,E){return b[E]===255&&(b[E+1]&224)===224&&(b[E+1]&6)!==0}function v(b,E){return E+1<b.length&&c(b,E)}function O(b,E){var s=4;return c(b,E)&&s<=b.length-E}function w(b,E){if(E+1<b.length&&c(b,E)){var s=4,a=D(b,E),l=s;a!=null&&a.frameLength&&(l=a.frameLength);var u=E+l;return u===b.length||v(b,u)}return!1}},"./src/demux/sample-aes.ts":function(Q,K,L){"use strict";L.r(K);var H=L("./src/crypt/decrypter.ts"),k=L("./src/demux/tsdemuxer.ts"),M=function(){function N(P,D,c){this.keyData=void 0,this.decrypter=void 0,this.keyData=c,this.decrypter=new H.default(P,D,{removePKCS7Padding:!1})}var _=N.prototype;return _.decryptBuffer=function(D,c){this.decrypter.decrypt(D,this.keyData.key.buffer,this.keyData.iv.buffer,c)},_.decryptAacSample=function(D,c,v,O){var w=D[c].unit,b=w.subarray(16,w.length-w.length%16),E=b.buffer.slice(b.byteOffset,b.byteOffset+b.length),s=this;this.decryptBuffer(E,function(a){var l=new Uint8Array(a);w.set(l,16),O||s.decryptAacSamples(D,c+1,v)})},_.decryptAacSamples=function(D,c,v){for(;;c++){if(c>=D.length){v();return}if(D[c].unit.length<32)continue;var O=this.decrypter.isSync();if(this.decryptAacSample(D,c,v,O),!O)return}},_.getAvcEncryptedData=function(D){for(var c=Math.floor((D.length-48)/160)*16+16,v=new Int8Array(c),O=0,w=32;w<=D.length-16;w+=160,O+=16)v.set(D.subarray(w,w+16),O);return v},_.getAvcDecryptedUnit=function(D,c){for(var v=new Uint8Array(c),O=0,w=32;w<=D.length-16;w+=160,O+=16)D.set(v.subarray(O,O+16),w);return D},_.decryptAvcSample=function(D,c,v,O,w,b){var E=Object(k.discardEPB)(w.data),s=this.getAvcEncryptedData(E),a=this;this.decryptBuffer(s.buffer,function(l){w.data=a.getAvcDecryptedUnit(E,l),b||a.decryptAvcSamples(D,c,v+1,O)})},_.decryptAvcSamples=function(D,c,v,O){if(D instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;c++,v=0){if(c>=D.length){O();return}for(var w=D[c].units;!(v>=w.length);v++){var b=w[v];if(b.data.length<=48||b.type!==1&&b.type!==5)continue;var E=this.decrypter.isSync();if(this.decryptAvcSample(D,c,v,O,b,E),!E)return}}},N}();K.default=M},"./src/demux/transmuxer-interface.ts":function(Q,K,L){"use strict";L.r(K),L.d(K,"default",function(){return w});var H=L("./node_modules/webworkify-webpack/index.js"),k=L.n(H),M=L("./src/events.ts"),N=L("./src/demux/transmuxer.ts"),_=L("./src/utils/logger.ts"),P=L("./src/errors.ts"),D=L("./src/utils/mediasource-helper.ts"),c=L("./node_modules/eventemitter3/index.js"),v=L.n(c),O=Object(D.getMediaSource)()||{isTypeSupported:function(){return!1}},w=function(){function b(s,a,l,u){var C=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=s,this.id=a,this.onTransmuxComplete=l,this.onFlush=u;var g=s.config,h=function(d,o){o=o||{},o.frag=C.frag,o.id=C.id,s.trigger(d,o)};this.observer=new c.EventEmitter,this.observer.on(M.Events.FRAG_DECRYPTED,h),this.observer.on(M.Events.ERROR,h);var A={mp4:O.isTypeSupported("video/mp4"),mpeg:O.isTypeSupported("audio/mpeg"),mp3:O.isTypeSupported('audio/mp4; codecs="mp3"')},T=navigator.vendor;if(g.enableWorker&&typeof Worker!="undefined"){_.logger.log("demuxing in webworker");var f;try{f=this.worker=H("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),f.addEventListener("message",this.onwmsg),f.onerror=function(m){s.trigger(M.Events.ERROR,{type:P.ErrorTypes.OTHER_ERROR,details:P.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(m.message+" ("+m.filename+":"+m.lineno+")")})},f.postMessage({cmd:"init",typeSupported:A,vendor:T,id:a,config:JSON.stringify(g)})}catch(m){_.logger.warn("Error in worker:",m),_.logger.error("Error while initializing DemuxerWorker, fallback to inline"),f&&self.URL.revokeObjectURL(f.objectURL),this.transmuxer=new N.default(this.observer,A,g,T,a),this.worker=null}}else this.transmuxer=new N.default(this.observer,A,g,T,a)}var E=b.prototype;return E.destroy=function(){var a=this.worker;if(a)a.removeEventListener("message",this.onwmsg),a.terminate(),this.worker=null;else{var l=this.transmuxer;l&&(l.destroy(),this.transmuxer=null)}var u=this.observer;u&&u.removeAllListeners(),this.observer=null},E.push=function(a,l,u,C,g,h,A,T,f,m){var d=this;f.transmuxing.start=self.performance.now();var o=this.transmuxer,x=this.worker,y=h?h.start:g.start,p=g.decryptdata,R=this.frag,U=!(R&&g.cc===R.cc),B=!(R&&f.level===R.level),z=R?f.sn-R.sn:-1,j=this.part?f.part-this.part.index:1,F=!B&&(z===1||z===0&&j===1),X=self.performance.now();(B||z||g.stats.parsing.start===0)&&(g.stats.parsing.start=X),h&&(j||!F)&&(h.stats.parsing.start=X);var q=new N.TransmuxState(U,F,T,B,y);if(!F||U){_.logger.log("[transmuxer-interface, "+g.type+"]: Starting new transmux session for sn: "+f.sn+" p: "+f.part+" level: "+f.level+" id: "+f.id+`
discontinuity: `+U+`
trackSwitch: `+B+`
contiguous: `+F+`
accurateTimeOffset: `+T+`
timeOffset: `+y);var ne=new N.TransmuxConfig(u,C,l,A,m);this.configureTransmuxer(ne)}if(this.frag=g,this.part=h,x)x.postMessage({cmd:"demux",data:a,decryptdata:p,chunkMeta:f,state:q},a instanceof ArrayBuffer?[a]:[]);else if(o){var ue=o.push(a,p,f,q);Object(N.isPromise)(ue)?ue.then(function(xe){d.handleTransmuxComplete(xe)}):this.handleTransmuxComplete(ue)}},E.flush=function(a){var l=this;a.transmuxing.start=self.performance.now();var u=this.transmuxer,C=this.worker;if(C)C.postMessage({cmd:"flush",chunkMeta:a});else if(u){var g=u.flush(a);Object(N.isPromise)(g)?g.then(function(h){l.handleFlushResult(h,a)}):this.handleFlushResult(g,a)}},E.handleFlushResult=function(a,l){var u=this;a.forEach(function(C){u.handleTransmuxComplete(C)}),this.onFlush(l)},E.onWorkerMessage=function(a){var l=a.data,u=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,u.trigger(l.event,l.data);break}}},E.configureTransmuxer=function(a){var l=this.worker,u=this.transmuxer;l?l.postMessage({cmd:"configure",config:a}):u&&u.configure(a)},E.handleTransmuxComplete=function(a){a.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(a)},b}()},"./src/demux/transmuxer-worker.ts":function(Q,K,L){"use strict";L.r(K),L.d(K,"default",function(){return P});var H=L("./src/demux/transmuxer.ts"),k=L("./src/events.ts"),M=L("./src/utils/logger.ts"),N=L("./node_modules/eventemitter3/index.js"),_=L.n(N);function P(w){var b=new N.EventEmitter,E=function(a,l){w.postMessage({event:a,data:l})};b.on(k.Events.FRAG_DECRYPTED,E),b.on(k.Events.ERROR,E),w.addEventListener("message",function(s){var a=s.data;switch(a.cmd){case"init":{var l=JSON.parse(a.config);w.transmuxer=new H.default(b,a.typeSupported,l,a.vendor,a.id),Object(M.enableLogs)(l.debug),E("init",null);break}case"configure":{w.transmuxer.configure(a.config);break}case"demux":{var u=w.transmuxer.push(a.data,a.decryptdata,a.chunkMeta,a.state);Object(H.isPromise)(u)?u.then(function(h){D(w,h)}):D(w,u);break}case"flush":{var C=a.chunkMeta,g=w.transmuxer.flush(C);Object(H.isPromise)(g)?g.then(function(h){v(w,h,C)}):v(w,g,C);break}default:break}})}function D(w,b){if(O(b.remuxResult))return;var E=[],s=b.remuxResult,a=s.audio,l=s.video;a&&c(E,a),l&&c(E,l),w.postMessage({event:"transmuxComplete",data:b},E)}function c(w,b){b.data1&&w.push(b.data1.buffer),b.data2&&w.push(b.data2.buffer)}function v(w,b,E){b.forEach(function(s){D(w,s)}),w.postMessage({event:"flush",data:E})}function O(w){return!w.audio&&!w.video&&!w.text&&!w.id3&&!w.initSegment}},"./src/demux/transmuxer.ts":function(Q,K,L){"use strict";L.r(K),L.d(K,"default",function(){return l}),L.d(K,"isPromise",function(){return g}),L.d(K,"TransmuxConfig",function(){return h}),L.d(K,"TransmuxState",function(){return A});var H=L("./src/events.ts"),k=L("./src/errors.ts"),M=L("./src/crypt/decrypter.ts"),N=L("./src/demux/aacdemuxer.ts"),_=L("./src/demux/mp4demuxer.ts"),P=L("./src/demux/tsdemuxer.ts"),D=L("./src/demux/mp3demuxer.ts"),c=L("./src/remux/mp4-remuxer.ts"),v=L("./src/remux/passthrough-remuxer.ts"),O=L("./src/demux/chunk-cache.ts"),w=L("./src/utils/mp4-tools.ts"),b=L("./src/utils/logger.ts"),E;try{E=self.performance.now.bind(self.performance)}catch(T){b.logger.debug("Unable to use Performance API on this environment"),E=self.Date.now}var s=[{demux:P.default,remux:c.default},{demux:_.default,remux:v.default},{demux:N.default,remux:c.default},{demux:D.default,remux:c.default}],a=1024;s.forEach(function(T){var f=T.demux;a=Math.max(a,f.minProbeByteLength)});var l=function(){function T(m,d,o,x,y){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 O.default,this.observer=m,this.typeSupported=d,this.config=o,this.vendor=x,this.id=y}var f=T.prototype;return f.configure=function(d){this.transmuxConfig=d,this.decrypter&&this.decrypter.reset()},f.push=function(d,o,x,y){var p=this,R=x.transmuxing;R.executeStart=E();var U=new Uint8Array(d),B=this.cache,z=this.config,j=this.currentTransmuxState,F=this.transmuxConfig;y&&(this.currentTransmuxState=y);var X=u(U,o);if(X&&X.method==="AES-128"){var q=this.getDecrypter();if(z.enableSoftwareAES){var ne=q.softwareDecrypt(U,X.key.buffer,X.iv.buffer);if(!ne)return R.executeEnd=E(),C(x);U=new Uint8Array(ne)}else return this.decryptionPromise=q.webCryptoDecrypt(U,X.key.buffer,X.iv.buffer).then(function(De){var _e=p.push(De,null,x);return p.decryptionPromise=null,_e}),this.decryptionPromise}var ue=y||j,xe=ue.contiguous,pe=ue.discontinuity,he=ue.trackSwitch,de=ue.accurateTimeOffset,fe=ue.timeOffset,te=F.audioCodec,se=F.videoCodec,ye=F.defaultInitPts,Me=F.duration,ke=F.initSegmentData;if((pe||he)&&this.resetInitSegment(ke,te,se,Me),pe&&this.resetInitialTimestamp(ye),xe||this.resetContiguity(),this.needsProbing(U,pe,he)){if(B.dataLength){var He=B.flush();U=Object(w.appendUint8Array)(He,U)}this.configureTransmuxer(U,F)}var $e=this.transmux(U,X,fe,de,x),we=this.currentTransmuxState;return we.contiguous=!0,we.discontinuity=!1,we.trackSwitch=!1,R.executeEnd=E(),$e},f.flush=function(d){var o=this,x=d.transmuxing;x.executeStart=E();var y=this.decrypter,p=this.cache,R=this.currentTransmuxState,U=this.decryptionPromise;if(U)return U.then(function(){return o.flush(d)});var B=[],z=R.timeOffset;if(y){var j=y.flush();j&&B.push(this.push(j,null,d))}var F=p.dataLength;p.reset();var X=this.demuxer,q=this.remuxer;if(!X||!q)return F>=a&&this.observer.emit(H.Events.ERROR,H.Events.ERROR,{type:k.ErrorTypes.MEDIA_ERROR,details:k.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),x.executeEnd=E(),[C(d)];var ne=X.flush(z);return g(ne)?ne.then(function(ue){return o.flushRemux(B,ue,d),B}):(this.flushRemux(B,ne,d),B)},f.flushRemux=function(d,o,x){var y=o.audioTrack,p=o.avcTrack,R=o.id3Track,U=o.textTrack,B=this.currentTransmuxState,z=B.accurateTimeOffset,j=B.timeOffset;b.logger.log("[transmuxer.ts]: Flushed fragment "+x.sn+(x.part>-1?" p: "+x.part:"")+" of level "+x.level);var F=this.remuxer.remux(y,p,R,U,j,z,!0,this.id);d.push({remuxResult:F,chunkMeta:x}),x.transmuxing.executeEnd=E()},f.resetInitialTimestamp=function(d){var o=this.demuxer,x=this.remuxer;if(!o||!x)return;o.resetTimeStamp(d),x.resetTimeStamp(d)},f.resetContiguity=function(){var d=this.demuxer,o=this.remuxer;if(!d||!o)return;d.resetContiguity(),o.resetNextTimestamp()},f.resetInitSegment=function(d,o,x,y){var p=this.demuxer,R=this.remuxer;if(!p||!R)return;p.resetInitSegment(o,x,y),R.resetInitSegment(d,o,x)},f.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},f.transmux=function(d,o,x,y,p){var R;return o&&o.method==="SAMPLE-AES"?R=this.transmuxSampleAes(d,o,x,y,p):R=this.transmuxUnencrypted(d,x,y,p),R},f.transmuxUnencrypted=function(d,o,x,y){var p=this.demuxer.demux(d,o,!1,!this.config.progressive),R=p.audioTrack,U=p.avcTrack,B=p.id3Track,z=p.textTrack,j=this.remuxer.remux(R,U,B,z,o,x,!1,this.id);return{remuxResult:j,chunkMeta:y}},f.transmuxSampleAes=function(d,o,x,y,p){var R=this;return this.demuxer.demuxSampleAes(d,o,x).then(function(U){var B=R.remuxer.remux(U.audioTrack,U.avcTrack,U.id3Track,U.textTrack,x,y,!1,R.id);return{remuxResult:B,chunkMeta:p}})},f.configureTransmuxer=function(d,o){for(var x=this.config,y=this.observer,p=this.typeSupported,R=this.vendor,U=o.audioCodec,B=o.defaultInitPts,z=o.duration,j=o.initSegmentData,F=o.videoCodec,X,q=0,ne=s.length;q<ne;q++)if(s[q].demux.probe(d)){X=s[q];break}X||(b.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),X={demux:_.default,remux:v.default});var ue=this.demuxer,xe=this.remuxer,pe=X.remux,he=X.demux;(!xe||!(xe instanceof pe))&&(this.remuxer=new pe(y,x,p,R)),(!ue||!(ue instanceof he))&&(this.demuxer=new he(y,x,p),this.probe=he.probe),this.resetInitSegment(j,U,F,z),this.resetInitialTimestamp(B)},f.needsProbing=function(d,o,x){return!this.demuxer||!this.remuxer||o||x},f.getDecrypter=function(){var d=this.decrypter;return d||(d=this.decrypter=new M.default(this.observer,this.config)),d},T}();function u(T,f){var m=null;return T.byteLength>0&&f!=null&&f.key!=null&&f.iv!==null&&f.method!=null&&(m=f),m}var C=function(f){return{remuxResult:{},chunkMeta:f}};function g(T){return"then"in T&&T.then instanceof Function}var h=function(f,m,d,o,x){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=f,this.videoCodec=m,this.initSegmentData=d,this.duration=o,this.defaultInitPts=x},A=function(f,m,d,o,x){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=f,this.contiguous=m,this.accurateTimeOffset=d,this.trackSwitch=o,this.timeOffset=x}},"./src/demux/tsdemuxer.ts":function(Q,K,L){"use strict";L.r(K),L.d(K,"discardEPB",function(){return C});var H=L("./src/demux/adts.ts"),k=L("./src/demux/mpegaudio.ts"),M=L("./src/demux/exp-golomb.ts"),N=L("./src/demux/id3.ts"),_=L("./src/demux/sample-aes.ts"),P=L("./src/events.ts"),D=L("./src/utils/mp4-tools.ts"),c=L("./src/utils/logger.ts"),v=L("./src/errors.ts"),O={video:1,audio:2,id3:3,text:4},w=function(){function g(A,T,f){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=A,this.config=T,this.typeSupported=f}g.probe=function(T){var f=g.syncOffset(T);return f<0?!1:(f&&c.logger.warn("MPEG2-TS detected but first sync word found @ offset "+f+", junk ahead ?"),!0)},g.syncOffset=function(T){for(var f=Math.min(1e3,T.length-3*188),m=0;m<f;){if(T[m]===71&&T[m+188]===71&&T[m+2*188]===71)return m;m++}return-1},g.createTrack=function(T,f){return{container:T==="video"||T==="audio"?"video/mp2t":void 0,type:T,id:O[T],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:T==="audio"?f:void 0}};var h=g.prototype;return h.resetInitSegment=function(T,f,m){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=g.createTrack("video",m),this._audioTrack=g.createTrack("audio",m),this._id3Track=g.createTrack("id3",m),this._txtTrack=g.createTrack("text",m),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=T,this.videoCodec=f,this._duration=m},h.resetTimeStamp=function(){},h.resetContiguity=function(){var T=this._audioTrack,f=this._avcTrack,m=this._id3Track;T&&(T.pesData=null),f&&(f.pesData=null),m&&(m.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},h.demux=function(T,f,m,d){m===void 0&&(m=!1),d===void 0&&(d=!1),m||(this.sampleAes=null);var o,x=this._avcTrack,y=this._audioTrack,p=this._id3Track,R=x.pid,U=x.pesData,B=y.pid,z=p.pid,j=y.pesData,F=p.pesData,X=!1,q=this.pmtParsed,ne=this._pmtId,ue=T.length;if(this.remainderData&&(T=Object(D.appendUint8Array)(this.remainderData,T),ue=T.length,this.remainderData=null),ue<188&&!d)return this.remainderData=T,{audioTrack:y,avcTrack:x,id3Track:p,textTrack:this._txtTrack};var xe=Math.max(0,g.syncOffset(T));ue-=(ue+xe)%188,ue<T.byteLength&&!d&&(this.remainderData=new Uint8Array(T.buffer,ue,T.buffer.byteLength-ue));for(var pe=xe;pe<ue;pe+=188)if(T[pe]===71){var he=!!(T[pe+1]&64),de=((T[pe+1]&31)<<8)+T[pe+2],fe=(T[pe+3]&48)>>4,te=void 0;if(fe>1){if(te=pe+5+T[pe+4],te===pe+188)continue}else te=pe+4;switch(de){case R:he&&(U&&(o=a(U))&&this.parseAVCPES(o,!1),U={data:[],size:0}),U&&(U.data.push(T.subarray(te,pe+188)),U.size+=pe+188-te);break;case B:he&&(j&&(o=a(j))&&(y.isAAC?this.parseAACPES(o):this.parseMPEGPES(o)),j={data:[],size:0}),j&&(j.data.push(T.subarray(te,pe+188)),j.size+=pe+188-te);break;case z:he&&(F&&(o=a(F))&&this.parseID3PES(o),F={data:[],size:0}),F&&(F.data.push(T.subarray(te,pe+188)),F.size+=pe+188-te);break;case 0:he&&(te+=T[te]+1),ne=this._pmtId=E(T,te);break;case ne:{he&&(te+=T[te]+1);var se=s(T,te,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,m);R=se.avc,R>0&&(x.pid=R),B=se.audio,B>0&&(y.pid=B,y.isAAC=se.isAAC),z=se.id3,z>0&&(p.pid=z),X&&!q&&(c.logger.log("reparse from beginning"),X=!1,pe=xe-188),q=this.pmtParsed=!0;break}case 17:case 8191:break;default:X=!0;break}}else this.observer.emit(P.Events.ERROR,P.Events.ERROR,{type:v.ErrorTypes.MEDIA_ERROR,details:v.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});x.pesData=U,y.pesData=j,p.pesData=F;var ye={audioTrack:y,avcTrack:x,id3Track:p,textTrack:this._txtTrack};return d&&this.extractRemainingSamples(ye),ye},h.flush=function(){var T=this.remainderData;this.remainderData=null;var f;return T?f=this.demux(T,-1,!1,!0):f={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(f),this.sampleAes?this.decrypt(f,this.sampleAes):f},h.extractRemainingSamples=function(T){var f=T.audioTrack,m=T.avcTrack,d=T.id3Track,o=m.pesData,x=f.pesData,y=d.pesData,p;o&&(p=a(o))?(this.parseAVCPES(p,!0),m.pesData=null):m.pesData=o,x&&(p=a(x))?(f.isAAC?this.parseAACPES(p):this.parseMPEGPES(p),f.pesData=null):(x!=null&&x.size&&c.logger.log("last AAC PES packet truncated,might overlap between fragments"),f.pesData=x),y&&(p=a(y))?(this.parseID3PES(p),d.pesData=null):d.pesData=y},h.demuxSampleAes=function(T,f,m){var d=this.demux(T,m,!0,!this.config.progressive),o=this.sampleAes=new _.default(this.observer,this.config,f);return this.decrypt(d,o)},h.decrypt=function(T,f){return new Promise(function(m){var d=T.audioTrack,o=T.avcTrack;d.samples&&d.isAAC?f.decryptAacSamples(d.samples,0,function(){o.samples?f.decryptAvcSamples(o.samples,0,0,function(){m(T)}):m(T)}):o.samples&&f.decryptAvcSamples(o.samples,0,0,function(){m(T)})})},h.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},h.parseAVCPES=function(T,f){var m=this,d=this._avcTrack,o=this.parseAVCNALu(T.data),x=!1,y=this.avcSample,p,R=!1;T.data=null,y&&o.length&&!d.audFound&&(l(y,d),y=this.avcSample=b(!1,T.pts,T.dts,"")),o.forEach(function(U){switch(U.type){case 1:{p=!0,y||(y=m.avcSample=b(!0,T.pts,T.dts,"")),x&&(y.debug+="NDR "),y.frame=!0;var B=U.data;if(R&&B.length>4){var z=new M.default(B).readSliceType();(z===2||z===4||z===7||z===9)&&(y.key=!0)}break}case 5:p=!0,y||(y=m.avcSample=b(!0,T.pts,T.dts,"")),x&&(y.debug+="IDR "),y.key=!0,y.frame=!0;break;case 6:{p=!0,x&&y&&(y.debug+="SEI ");var j=new M.default(C(U.data));j.readUByte();for(var F=0,X=0,q=!1,ne=0;!q&&j.bytesAvailable>1;){F=0;do ne=j.readUByte(),F+=ne;while(ne===255);X=0;do ne=j.readUByte(),X+=ne;while(ne===255);if(F===4&&j.bytesAvailable!==0){q=!0;var ue=j.readUByte();if(ue===181){var xe=j.readUShort();if(xe===49){var pe=j.readUInt();if(pe===1195456820){var he=j.readUByte();if(he===3){for(var de=j.readUByte(),fe=j.readUByte(),te=31&de,se=[de,fe],ye=0;ye<te;ye++)se.push(j.readUByte()),se.push(j.readUByte()),se.push(j.readUByte());u(m._txtTrack.samples,{type:3,pts:T.pts,bytes:se})}}}}}else if(F===5&&j.bytesAvailable!==0){if(q=!0,X>16){for(var Me=[],ke=0;ke<16;ke++)Me.push(j.readUByte().toString(16)),(ke===3||ke===5||ke===7||ke===9)&&Me.push("-");for(var He=X-16,$e=new Uint8Array(He),we=0;we<He;we++)$e[we]=j.readUByte();u(m._txtTrack.samples,{pts:T.pts,payloadType:F,uuid:Me.join(""),userData:Object(N.utf8ArrayToStr)($e),userDataBytes:$e})}}else if(X<j.bytesAvailable)for(var De=0;De<X;De++)j.readUByte()}break}case 7:if(p=!0,R=!0,x&&y&&(y.debug+="SPS "),!d.sps){var _e=new M.default(U.data),Be=_e.readSPS();d.width=Be.width,d.height=Be.height,d.pixelRatio=Be.pixelRatio,d.sps=[U.data],d.duration=m._duration;for(var Ne=U.data.subarray(1,4),Se="avc1.",Ce=0;Ce<3;Ce++){var Ke=Ne[Ce].toString(16);Ke.length<2&&(Ke="0"+Ke),Se+=Ke}d.codec=Se}break;case 8:p=!0,x&&y&&(y.debug+="PPS "),d.pps||(d.pps=[U.data]);break;case 9:p=!1,d.audFound=!0,y&&l(y,d),y=m.avcSample=b(!1,T.pts,T.dts,x?"AUD ":"");break;case 12:p=!1;break;default:p=!1,y&&(y.debug+="unknown NAL "+U.type+" ");break}if(y&&p){var Qe=y.units;Qe.push(U)}}),f&&y&&(l(y,d),this.avcSample=null)},h.getLastNalUnit=function(){var T,f=this.avcSample,m;if(!f||f.units.length===0){var d=this._avcTrack.samples;f=d[d.length-1]}if((T=f)!==null&&T!==void 0&&T.units){var o=f.units;m=o[o.length-1]}return m},h.parseAVCNALu=function(T){var f=T.byteLength,m=this._avcTrack,d=m.naluState||0,o=d,x=[],y=0,p,R,U,B=-1,z=0;for(d===-1&&(B=0,z=T[0]&31,d=0,y=1);y<f;){if(p=T[y++],!d){d=p?0:1;continue}if(d===1){d=p?0:2;continue}if(!p)d=3;else if(p===1){if(B>=0){var j={data:T.subarray(B,y-d-1),type:z};x.push(j)}else{var F=this.getLastNalUnit();if(F&&(o&&y<=4-o&&(F.state&&(F.data=F.data.subarray(0,F.data.byteLength-o))),R=y-d-1,R>0)){var X=new Uint8Array(F.data.byteLength+R);X.set(F.data,0),X.set(T.subarray(0,R),F.data.byteLength),F.data=X,F.state=0}}y<f?(U=T[y]&31,B=y,z=U,d=0):d=-1}else d=0}if(B>=0&&d>=0){var q={data:T.subarray(B,f),type:z,state:d};x.push(q)}if(x.length===0){var ne=this.getLastNalUnit();if(ne){var ue=new Uint8Array(ne.data.byteLength+T.byteLength);ue.set(ne.data,0),ue.set(T,ne.data.byteLength),ne.data=ue}}return m.naluState=d,x},h.parseAACPES=function(T){var f=0,m=this._audioTrack,d=this.aacOverFlow,o=T.data;if(d){this.aacOverFlow=null;var x=d.sample.unit.byteLength,y=Math.min(d.missing,x),p=x-y;d.sample.unit.set(o.subarray(0,y),p),m.samples.push(d.sample),f=d.missing}var R,U;for(R=f,U=o.length;R<U-1&&!H.isHeader(o,R);R++);if(R!==f){var B,z;if(R<U-1?(B="AAC PES did not start with ADTS header,offset:"+R,z=!1):(B="no ADTS header found in AAC PES",z=!0),c.logger.warn("parsing error:"+B),this.observer.emit(P.Events.ERROR,P.Events.ERROR,{type:v.ErrorTypes.MEDIA_ERROR,details:v.ErrorDetails.FRAG_PARSING_ERROR,fatal:z,reason:B}),z)return}H.initTrackConfig(m,this.observer,o,R,this.audioCodec);var j;if(T.pts!==void 0)j=T.pts;else if(d){var F=H.getFrameDuration(m.samplerate);j=d.sample.pts+F}else{c.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var X=0;R<U;)if(H.isHeader(o,R)){if(R+5<U){var q=H.appendFrame(m,o,R,j,X);if(q)if(q.missing)this.aacOverFlow=q;else{R+=q.length,X++;continue}}break}else R++},h.parseMPEGPES=function(T){var f=T.data,m=f.length,d=0,o=0,x=T.pts;if(x===void 0){c.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;o<m;)if(k.isHeader(f,o)){var y=k.appendFrame(this._audioTrack,f,o,x,d);if(y)o+=y.length,d++;else break}else o++},h.parseID3PES=function(T){if(T.pts===void 0){c.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(T)},g}();w.minProbeByteLength=188;function b(g,h,A,T){return{key:g,frame:!1,pts:h,dts:A,units:[],debug:T,length:0}}function E(g,h){return(g[h+10]&31)<<8|g[h+11]}function s(g,h,A,T){var f={audio:-1,avc:-1,id3:-1,isAAC:!0},m=(g[h+1]&15)<<8|g[h+2],d=h+3+m-4,o=(g[h+10]&15)<<8|g[h+11];for(h+=12+o;h<d;){var x=(g[h+1]&31)<<8|g[h+2];switch(g[h]){case 207:if(!T){c.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:f.audio===-1&&(f.audio=x);break;case 21:f.id3===-1&&(f.id3=x);break;case 219:if(!T){c.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:f.avc===-1&&(f.avc=x);break;case 3:case 4:A?f.audio===-1&&(f.audio=x,f.isAAC=!1):c.logger.log("MPEG audio found, not supported in this browser");break;case 36:c.logger.warn("Unsupported HEVC stream type found");break;default:break}h+=((g[h+3]&15)<<8|g[h+4])+5}return f}function a(g){var h=0,A,T,f,m,d,o=g.data;if(!g||g.size===0)return null;for(;o[0].length<19&&o.length>1;){var x=new Uint8Array(o[0].length+o[1].length);x.set(o[0]),x.set(o[1],o[0].length),o[0]=x,o.splice(1,1)}A=o[0];var y=(A[0]<<16)+(A[1]<<8)+A[2];if(y===1){if(T=(A[4]<<8)+A[5],T&&T>g.size-6)return null;var p=A[7];p&192&&(m=(A[9]&14)*536870912+(A[10]&255)*4194304+(A[11]&254)*16384+(A[12]&255)*128+(A[13]&254)/2,p&64?(d=(A[14]&14)*536870912+(A[15]&255)*4194304+(A[16]&254)*16384+(A[17]&255)*128+(A[18]&254)/2,m-d>60*9e4&&(c.logger.warn(Math.round((m-d)/9e4)+"s delta between PTS and DTS, align them"),m=d)):d=m),f=A[8];var R=f+9;if(g.size<=R)return null;g.size-=R;for(var U=new Uint8Array(g.size),B=0,z=o.length;B<z;B++){A=o[B];var j=A.byteLength;if(R)if(R>j){R-=j;continue}else A=A.subarray(R),j-=R,R=0;U.set(A,h),h+=j}return T&&(T-=f+3),{data:U,pts:m,dts:d,len:T}}return null}function l(g,h){if(g.units.length&&g.frame){if(g.pts===void 0){var A=h.samples,T=A.length;if(T){var f=A[T-1];g.pts=f.pts,g.dts=f.dts}else{h.dropped++;return}}h.samples.push(g)}g.debug.length&&c.logger.log(g.pts+"/"+g.dts+":"+g.debug)}function u(g,h){var A=g.length;if(A>0){if(h.pts>=g[A-1].pts)g.push(h);else for(var T=A-1;T>=0;T--)if(h.pts<g[T].pts){g.splice(T,0,h);break}}else g.push(h)}function C(g){for(var h=g.byteLength,A=[],T=1;T<h-2;)g[T]===0&&g[T+1]===0&&g[T+2]===3?(A.push(T+2),T+=2):T++;if(A.length===0)return g;var f=h-A.length,m=new Uint8Array(f),d=0;for(T=0;T<f;d++,T++)d===A[0]&&(d++,A.shift()),m[T]=g[d];return m}K.default=w},"./src/errors.ts":function(Q,K,L){"use strict";L.r(K),L.d(K,"ErrorTypes",function(){return H}),L.d(K,"ErrorDetails",function(){return k});var H;(function(M){M.NETWORK_ERROR="networkError",M.MEDIA_ERROR="mediaError",M.KEY_SYSTEM_ERROR="keySystemError",M.MUX_ERROR="muxError",M.OTHER_ERROR="otherError"})(H||(H={}));var k;(function(M){M.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",M.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",M.KEY_SYSTEM_NO_SESSION="keySystemNoSession",M.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",M.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",M.MANIFEST_LOAD_ERROR="manifestLoadError",M.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",M.MANIFEST_PARSING_ERROR="manifestParsingError",M.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",M.LEVEL_EMPTY_ERROR="levelEmptyError",M.LEVEL_LOAD_ERROR="levelLoadError",M.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",M.LEVEL_SWITCH_ERROR="levelSwitchError",M.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",M.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",M.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",M.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",M.FRAG_LOAD_ERROR="fragLoadError",M.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",M.FRAG_DECRYPT_ERROR="fragDecryptError",M.FRAG_PARSING_ERROR="fragParsingError",M.REMUX_ALLOC_ERROR="remuxAllocError",M.KEY_LOAD_ERROR="keyLoadError",M.KEY_LOAD_TIMEOUT="keyLoadTimeOut",M.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",M.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",M.BUFFER_APPEND_ERROR="bufferAppendError",M.BUFFER_APPENDING_ERROR="bufferAppendingError",M.BUFFER_STALLED_ERROR="bufferStalledError",M.BUFFER_FULL_ERROR="bufferFullError",M.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",M.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",M.INTERNAL_EXCEPTION="internalException",M.INTERNAL_ABORTED="aborted",M.UNKNOWN="unknown"})(k||(k={}))},"./src/events.ts":function(Q,K,L){"use strict";L.r(K),L.d(K,"Events",function(){return H});var H;(function(k){k.MEDIA_ATTACHING="hlsMediaAttaching",k.MEDIA_ATTACHED="hlsMediaAttached",k.MEDIA_DETACHING="hlsMediaDetaching",k.MEDIA_DETACHED="hlsMediaDetached",k.BUFFER_RESET="hlsBufferReset",k.BUFFER_CODECS="hlsBufferCodecs",k.BUFFER_CREATED="hlsBufferCreated",k.BUFFER_APPENDING="hlsBufferAppending",k.BUFFER_APPENDED="hlsBufferAppended",k.BUFFER_EOS="hlsBufferEos",k.BUFFER_FLUSHING="hlsBufferFlushing",k.BUFFER_FLUSHED="hlsBufferFlushed",k.MANIFEST_LOADING="hlsManifestLoading",k.MANIFEST_LOADED="hlsManifestLoaded",k.MANIFEST_PARSED="hlsManifestParsed",k.LEVEL_SWITCHING="hlsLevelSwitching",k.LEVEL_SWITCHED="hlsLevelSwitched",k.LEVEL_LOADING="hlsLevelLoading",k.LEVEL_LOADED="hlsLevelLoaded",k.LEVEL_UPDATED="hlsLevelUpdated",k.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",k.LEVELS_UPDATED="hlsLevelsUpdated",k.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",k.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",k.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",k.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",k.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",k.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",k.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",k.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",k.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",k.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",k.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",k.CUES_PARSED="hlsCuesParsed",k.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",k.INIT_PTS_FOUND="hlsInitPtsFound",k.FRAG_LOADING="hlsFragLoading",k.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",k.FRAG_LOADED="hlsFragLoaded",k.FRAG_DECRYPTED="hlsFragDecrypted",k.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",k.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",k.FRAG_PARSING_METADATA="hlsFragParsingMetadata",k.FRAG_PARSED="hlsFragParsed",k.FRAG_BUFFERED="hlsFragBuffered",k.FRAG_CHANGED="hlsFragChanged",k.FPS_DROP="hlsFpsDrop",k.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",k.ERROR="hlsError",k.DESTROYING="hlsDestroying",k.KEY_LOADING="hlsKeyLoading",k.KEY_LOADED="hlsKeyLoaded",k.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",k.BACK_BUFFER_REACHED="hlsBackBufferReached"})(H||(H={}))},"./src/hls.ts":function(Q,K,L){"use strict";L.r(K),L.d(K,"default",function(){return g});var H=L("./node_modules/url-toolkit/src/url-toolkit.js"),k=L.n(H),M=L("./src/loader/playlist-loader.ts"),N=L("./src/loader/key-loader.ts"),_=L("./src/controller/id3-track-controller.ts"),P=L("./src/controller/latency-controller.ts"),D=L("./src/controller/level-controller.ts"),c=L("./src/controller/fragment-tracker.ts"),v=L("./src/controller/stream-controller.ts"),O=L("./src/is-supported.ts"),w=L("./src/utils/logger.ts"),b=L("./src/config.ts"),E=L("./node_modules/eventemitter3/index.js"),s=L.n(E),a=L("./src/events.ts"),l=L("./src/errors.ts");function u(h,A){for(var T=0;T<A.length;T++){var f=A[T];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(h,f.key,f)}}function C(h,A,T){return A&&u(h.prototype,A),T&&u(h,T),h}var g=function(){h.isSupported=function(){return Object(O.isSupported)()};function h(T){T===void 0&&(T={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new E.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 f=this.config=Object(b.mergeConfig)(h.DefaultConfig,T);this.userConfig=T,Object(w.enableLogs)(f.debug),this._autoLevelCapping=-1,f.progressive&&Object(b.enableStreamingMode)(f);var m=f.abrController,d=f.bufferController,o=f.capLevelController,x=f.fpsController,y=this.abrController=new m(this),p=this.bufferController=new d(this),R=this.capLevelController=new o(this),U=new x(this),B=new M.default(this),z=new N.default(this),j=new _.default(this),F=this.levelController=new D.default(this),X=new c.FragmentTracker(this),q=this.streamController=new v.default(this,X);R.setStreamController(q),U.setStreamController(q);var ne=[F,q];this.networkControllers=ne;var ue=[B,z,y,p,R,U,j,X];this.audioTrackController=this.createController(f.audioTrackController,null,ne),this.createController(f.audioStreamController,X,ne),this.subtitleTrackController=this.createController(f.subtitleTrackController,null,ne),this.createController(f.subtitleStreamController,X,ne),this.createController(f.timelineController,null,ue),this.emeController=this.createController(f.emeController,null,ue),this.cmcdController=this.createController(f.cmcdController,null,ue),this.latencyController=this.createController(P.default,null,ue),this.coreComponents=ue}var A=h.prototype;return A.createController=function(f,m,d){if(f){var o=m?new f(this,m):new f(this);return d&&d.push(o),o}return null},A.on=function(f,m,d){d===void 0&&(d=this),this._emitter.on(f,m,d)},A.once=function(f,m,d){d===void 0&&(d=this),this._emitter.once(f,m,d)},A.removeAllListeners=function(f){this._emitter.removeAllListeners(f)},A.off=function(f,m,d,o){d===void 0&&(d=this),this._emitter.off(f,m,d,o)},A.listeners=function(f){return this._emitter.listeners(f)},A.emit=function(f,m,d){return this._emitter.emit(f,m,d)},A.trigger=function(f,m){if(this.config.debug)return this.emit(f,f,m);try{return this.emit(f,f,m)}catch(d){w.logger.error("An internal error happened while handling event "+f+'. Error message: "'+d.message+'". Here is a stacktrace:',d),this.trigger(a.Events.ERROR,{type:l.ErrorTypes.OTHER_ERROR,details:l.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:f,error:d})}return!1},A.listenerCount=function(f){return this._emitter.listenerCount(f)},A.destroy=function(){w.logger.log("destroy"),this.trigger(a.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(f){return f.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(f){return f.destroy()}),this.coreComponents.length=0},A.attachMedia=function(f){w.logger.log("attachMedia"),this._media=f,this.trigger(a.Events.MEDIA_ATTACHING,{media:f})},A.detachMedia=function(){w.logger.log("detachMedia"),this.trigger(a.Events.MEDIA_DETACHING,void 0),this._media=null},A.loadSource=function(f){this.stopLoad();var m=this.media,d=this.url,o=this.url=H.buildAbsoluteURL(self.location.href,f,{alwaysNormalize:!0});w.logger.log("loadSource:"+o),m&&d&&d!==o&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(m)),this.trigger(a.Events.MANIFEST_LOADING,{url:f})},A.startLoad=function(f){f===void 0&&(f=-1),w.logger.log("startLoad("+f+")"),this.networkControllers.forEach(function(m){m.startLoad(f)})},A.stopLoad=function(){w.logger.log("stopLoad"),this.networkControllers.forEach(function(f){f.stopLoad()})},A.swapAudioCodec=function(){w.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},A.recoverMediaError=function(){w.logger.log("recoverMediaError");var f=this._media;this.detachMedia(),f&&this.attachMedia(f)},A.removeLevel=function(f,m){m===void 0&&(m=0),this.levelController.removeLevel(f,m)},C(h,[{key:"levels",get:function(){var f=this.levelController.levels;return f||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(f){w.logger.log("set currentLevel:"+f),this.loadLevel=f,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(f){w.logger.log("set nextLevel:"+f),this.levelController.manualLevel=f,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(f){w.logger.log("set loadLevel:"+f),this.levelController.manualLevel=f}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(f){this.levelController.nextLoadLevel=f}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(f){w.logger.log("set firstLevel:"+f),this.levelController.firstLevel=f}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(f){w.logger.log("set startLevel:"+f),f!==-1&&(f=Math.max(f,this.minAutoLevel)),this.levelController.startLevel=f}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(f){var m=!!f;m!==this.config.capLevelToPlayerSize&&(m?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=m)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(f){this._autoLevelCapping!==f&&(w.logger.log("set autoLevelCapping:"+f),this._autoLevelCapping=f)}},{key:"bandwidthEstimate",get:function(){var f=this.abrController.bwEstimator;return f?f.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var f=this.levels,m=this.config.minAutoBitrate;if(!f)return 0;for(var d=f.length,o=0;o<d;o++)if(f[o].maxBitrate>m)return o;return 0}},{key:"maxAutoLevel",get:function(){var f=this.levels,m=this.autoLevelCapping,d;return m===-1&&f&&f.length?d=f.length-1:d=m,d}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(f){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,f)}},{key:"audioTracks",get:function(){var f=this.audioTrackController;return f?f.audioTracks:[]}},{key:"audioTrack",get:function(){var f=this.audioTrackController;return f?f.audioTrack:-1},set:function(f){var m=this.audioTrackController;m&&(m.audioTrack=f)}},{key:"subtitleTracks",get:function(){var f=this.subtitleTrackController;return f?f.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var f=this.subtitleTrackController;return f?f.subtitleTrack:-1},set:function(f){var m=this.subtitleTrackController;m&&(m.subtitleTrack=f)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var f=this.subtitleTrackController;return f?f.subtitleDisplay:!1},set:function(f){var m=this.subtitleTrackController;m&&(m.subtitleDisplay=f)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(f){this.config.lowLatencyMode=f}},{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 a.Events}},{key:"ErrorTypes",get:function(){return l.ErrorTypes}},{key:"ErrorDetails",get:function(){return l.ErrorDetails}},{key:"DefaultConfig",get:function(){return h.defaultConfig?h.defaultConfig:b.hlsDefaultConfig},set:function(f){h.defaultConfig=f}}]),h}();g.defaultConfig=void 0},"./src/is-supported.ts":function(Q,K,L){"use strict";L.r(K),L.d(K,"isSupported",function(){return M}),L.d(K,"changeTypeSupported",function(){return N});var H=L("./src/utils/mediasource-helper.ts");function k(){return self.SourceBuffer||self.WebKitSourceBuffer}function M(){var _=Object(H.getMediaSource)();if(!_)return!1;var P=k(),D=_&&typeof _.isTypeSupported=="function"&&_.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),c=!P||P.prototype&&typeof P.prototype.appendBuffer=="function"&&typeof P.prototype.remove=="function";return!!D&&!!c}function N(){var _,P=k();return typeof(P==null||((_=P.prototype)===null||_===void 0)?void 0:_.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(Q,K,L){"use strict";L.r(K),L.d(K,"default",function(){return w}),L.d(K,"LoadError",function(){return E});var H=L("./src/polyfills/number.ts"),k=L("./src/errors.ts");function M(s,a){s.prototype=Object.create(a.prototype),s.prototype.constructor=s,c(s,a)}function N(s){var a=typeof Map=="function"?new Map:void 0;return N=function(u){if(u===null||!D(u))return u;if(typeof u!="function")throw new TypeError("Super expression must either be null or a function");if(typeof a!="undefined"){if(a.has(u))return a.get(u);a.set(u,C)}function C(){return _(u,arguments,v(this).constructor)}return C.prototype=Object.create(u.prototype,{constructor:{value:C,enumerable:!1,writable:!0,configurable:!0}}),c(C,u)},N(s)}function _(s,a,l){return P()?_=Reflect.construct:_=function(C,g,h){var A=[null];A.push.apply(A,g);var T=Function.bind.apply(C,A),f=new T;return h&&c(f,h.prototype),f},_.apply(null,arguments)}function P(){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 D(s){return Function.toString.call(s).indexOf("[native code]")!==-1}function c(s,a){return c=Object.setPrototypeOf||function(u,C){return u.__proto__=C,u},c(s,a)}function v(s){return v=Object.setPrototypeOf?Object.getPrototypeOf:function(l){return l.__proto__||Object.getPrototypeOf(l)},v(s)}var O=Math.pow(2,17),w=function(){function s(l){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=l}var a=s.prototype;return a.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},a.abort=function(){this.loader&&this.loader.abort()},a.load=function(u,C){var g=this,h=u.url;if(!h)return Promise.reject(new E({type:k.ErrorTypes.NETWORK_ERROR,details:k.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:u,networkDetails:null},"Fragment does not have a "+(h?"part list":"url")));this.abort();var A=this.config,T=A.fLoader,f=A.loader;return new Promise(function(m,d){g.loader&&g.loader.destroy();var o=g.loader=u.loader=T?new T(A):new f(A),x=b(u),y={timeout:A.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:A.fragLoadingMaxRetryTimeout,highWaterMark:O};u.stats=o.stats,o.load(x,y,{onSuccess:function(R,U,B,z){g.resetLoader(u,o),m({frag:u,part:null,payload:R.data,networkDetails:z})},onError:function(R,U,B){g.resetLoader(u,o),d(new E({type:k.ErrorTypes.NETWORK_ERROR,details:k.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:u,response:R,networkDetails:B}))},onAbort:function(R,U,B){g.resetLoader(u,o),d(new E({type:k.ErrorTypes.NETWORK_ERROR,details:k.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:u,networkDetails:B}))},onTimeout:function(R,U,B){g.resetLoader(u,o),d(new E({type:k.ErrorTypes.NETWORK_ERROR,details:k.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:u,networkDetails:B}))},onProgress:function(R,U,B,z){C&&C({frag:u,part:null,payload:B,networkDetails:z})}})})},a.loadPart=function(u,C,g){var h=this;this.abort();var A=this.config,T=A.fLoader,f=A.loader;return new Promise(function(m,d){h.loader&&h.loader.destroy();var o=h.loader=u.loader=T?new T(A):new f(A),x=b(u,C),y={timeout:A.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:A.fragLoadingMaxRetryTimeout,highWaterMark:O};C.stats=o.stats,o.load(x,y,{onSuccess:function(R,U,B,z){h.resetLoader(u,o),h.updateStatsFromPart(u,C);var j={frag:u,part:C,payload:R.data,networkDetails:z};g(j),m(j)},onError:function(R,U,B){h.resetLoader(u,o),d(new E({type:k.ErrorTypes.NETWORK_ERROR,details:k.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:u,part:C,response:R,networkDetails:B}))},onAbort:function(R,U,B){u.stats.aborted=C.stats.aborted,h.resetLoader(u,o),d(new E({type:k.ErrorTypes.NETWORK_ERROR,details:k.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:u,part:C,networkDetails:B}))},onTimeout:function(R,U,B){h.resetLoader(u,o),d(new E({type:k.ErrorTypes.NETWORK_ERROR,details:k.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:u,part:C,networkDetails:B}))}})})},a.updateStatsFromPart=function(u,C){var g=u.stats,h=C.stats,A=h.total;if(g.loaded+=h.loaded,A){var T=Math.round(u.duration/C.duration),f=Math.min(Math.round(g.loaded/A),T),m=T-f,d=m*Math.round(g.loaded/f);g.total=g.loaded+d}else g.total=Math.max(g.loaded,g.total);var o=g.loading,x=h.loading;o.start?o.first+=x.first-x.start:(o.start=x.start,o.first=x.first),o.end=x.end},a.resetLoader=function(u,C){u.loader=null,this.loader===C&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),C.destroy()},s}();function b(s,a){a===void 0&&(a=null);var l=a||s,u={frag:s,part:a,responseType:"arraybuffer",url:l.url,headers:{},rangeStart:0,rangeEnd:0},C=l.byteRangeStartOffset,g=l.byteRangeEndOffset;return Object(H.isFiniteNumber)(C)&&Object(H.isFiniteNumber)(g)&&(u.rangeStart=C,u.rangeEnd=g),u}var E=function(s){M(a,s);function a(l){for(var u,C=arguments.length,g=new Array(C>1?C-1:0),h=1;h<C;h++)g[h-1]=arguments[h];return u=s.call.apply(s,[this].concat(g))||this,u.data=void 0,u.data=l,u}return a}(N(Error))},"./src/loader/fragment.ts":function(Q,K,L){"use strict";L.r(K),L.d(K,"ElementaryStreamTypes",function(){return w}),L.d(K,"BaseSegment",function(){return b}),L.d(K,"Fragment",function(){return E}),L.d(K,"Part",function(){return s});var H=L("./src/polyfills/number.ts"),k=L("./node_modules/url-toolkit/src/url-toolkit.js"),M=L.n(k),N=L("./src/utils/logger.ts"),_=L("./src/loader/level-key.ts"),P=L("./src/loader/load-stats.ts");function D(a,l){a.prototype=Object.create(l.prototype),a.prototype.constructor=a,c(a,l)}function c(a,l){return c=Object.setPrototypeOf||function(C,g){return C.__proto__=g,C},c(a,l)}function v(a,l){for(var u=0;u<l.length;u++){var C=l[u];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(a,C.key,C)}}function O(a,l,u){return l&&v(a.prototype,l),u&&v(a,u),a}var w;(function(a){a.AUDIO="audio",a.VIDEO="video",a.AUDIOVIDEO="audiovideo"})(w||(w={}));var b=function(){function a(u){var C;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(C={},C[w.AUDIO]=null,C[w.VIDEO]=null,C[w.AUDIOVIDEO]=null,C),this.baseurl=u}var l=a.prototype;return l.setByteRange=function(C,g){var h=C.split("@",2),A=[];h.length===1?A[0]=g?g.byteRangeEndOffset:0:A[0]=parseInt(h[1]),A[1]=parseInt(h[0])+A[0],this._byteRange=A},O(a,[{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(k.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(C){this._url=C}}]),a}(),E=function(a){D(l,a);function l(C,g){var h;return h=a.call(this,g)||this,h._decryptdata=null,h.rawProgramDateTime=null,h.programDateTime=null,h.tagList=[],h.duration=0,h.sn=0,h.levelkey=void 0,h.type=void 0,h.loader=null,h.level=-1,h.cc=0,h.startPTS=void 0,h.endPTS=void 0,h.appendedPTS=void 0,h.startDTS=void 0,h.endDTS=void 0,h.start=0,h.deltaPTS=void 0,h.maxStartPTS=void 0,h.minEndPTS=void 0,h.stats=new P.LoadStats,h.urlId=0,h.data=void 0,h.bitrateTest=!1,h.title=null,h.initSegment=null,h.type=C,h}var u=l.prototype;return u.createInitializationVector=function(g){for(var h=new Uint8Array(16),A=12;A<16;A++)h[A]=g>>8*(15-A)&255;return h},u.setDecryptDataFromLevelKey=function(g,h){var A=g;return(g==null?void 0:g.method)==="AES-128"&&g.uri&&!g.iv&&(A=_.LevelKey.fromURI(g.uri),A.method=g.method,A.iv=this.createInitializationVector(h),A.keyFormat="identity"),A},u.setElementaryStreamInfo=function(g,h,A,T,f,m){m===void 0&&(m=!1);var d=this.elementaryStreams,o=d[g];if(!o){d[g]={startPTS:h,endPTS:A,startDTS:T,endDTS:f,partial:m};return}o.startPTS=Math.min(o.startPTS,h),o.endPTS=Math.max(o.endPTS,A),o.startDTS=Math.min(o.startDTS,T),o.endDTS=Math.max(o.endDTS,f)},u.clearElementaryStreamInfo=function(){var g=this.elementaryStreams;g[w.AUDIO]=null,g[w.VIDEO]=null,g[w.AUDIOVIDEO]=null},O(l,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var g=this.sn;typeof g!="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'),g=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,g)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(H.isFiniteNumber)(this.programDateTime))return null;var g=Object(H.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+g*1e3}},{key:"encrypted",get:function(){var g;return!!((g=this.decryptdata)!==null&&g!==void 0&&g.keyFormat&&this.decryptdata.uri)}}]),l}(b),s=function(a){D(l,a);function l(u,C,g,h,A){var T;T=a.call(this,g)||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 P.LoadStats,T.duration=u.decimalFloatingPoint("DURATION"),T.gap=u.bool("GAP"),T.independent=u.bool("INDEPENDENT"),T.relurl=u.enumeratedString("URI"),T.fragment=C,T.index=h;var f=u.enumeratedString("BYTERANGE");return f&&T.setByteRange(f,A),A&&(T.fragOffset=A.fragOffset+A.duration),T}return O(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 C=this.elementaryStreams;return!!(C.audio||C.video||C.audiovideo)}}]),l}(b)},"./src/loader/key-loader.ts":function(Q,K,L){"use strict";L.r(K),L.d(K,"default",function(){return N});var H=L("./src/events.ts"),k=L("./src/errors.ts"),M=L("./src/utils/logger.ts"),N=function(){function _(D){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=D,this._registerListeners()}var P=_.prototype;return P._registerListeners=function(){this.hls.on(H.Events.KEY_LOADING,this.onKeyLoading,this)},P._unregisterListeners=function(){this.hls.off(H.Events.KEY_LOADING,this.onKeyLoading)},P.destroy=function(){this._unregisterListeners();for(var c in this.loaders){var v=this.loaders[c];v&&v.destroy()}this.loaders={}},P.onKeyLoading=function(c,v){var O=v.frag,w=O.type,b=this.loaders[w];if(!O.decryptdata){M.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var E=O.decryptdata.uri;if(E!==this.decrypturl||this.decryptkey===null){var s=this.hls.config;if(b&&(M.logger.warn("abort previous key loader for type:"+w),b.abort()),!E){M.logger.warn("key uri is falsy");return}var a=s.loader,l=O.loader=this.loaders[w]=new a(s);this.decrypturl=E,this.decryptkey=null;var u={url:E,frag:O,responseType:"arraybuffer"},C={timeout:s.fragLoadingTimeOut,maxRetry:0,retryDelay:s.fragLoadingRetryDelay,maxRetryDelay:s.fragLoadingMaxRetryTimeout,highWaterMark:0},g={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};l.load(u,C,g)}else this.decryptkey&&(O.decryptdata.key=this.decryptkey,this.hls.trigger(H.Events.KEY_LOADED,{frag:O}))},P.loadsuccess=function(c,v,O){var w=O.frag;if(!w.decryptdata){M.logger.error("after key load, decryptdata unset");return}this.decryptkey=w.decryptdata.key=new Uint8Array(c.data),w.loader=null,delete this.loaders[w.type],this.hls.trigger(H.Events.KEY_LOADED,{frag:w})},P.loaderror=function(c,v){var O=v.frag,w=O.loader;w&&w.abort(),delete this.loaders[O.type],this.hls.trigger(H.Events.ERROR,{type:k.ErrorTypes.NETWORK_ERROR,details:k.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:O,response:c})},P.loadtimeout=function(c,v){var O=v.frag,w=O.loader;w&&w.abort(),delete this.loaders[O.type],this.hls.trigger(H.Events.ERROR,{type:k.ErrorTypes.NETWORK_ERROR,details:k.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:O})},_}()},"./src/loader/level-details.ts":function(Q,K,L){"use strict";L.r(K),L.d(K,"LevelDetails",function(){return _});var H=L("./src/polyfills/number.ts");function k(P,D){for(var c=0;c<D.length;c++){var v=D[c];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(P,v.key,v)}}function M(P,D,c){return D&&k(P.prototype,D),c&&k(P,c),P}var N=10,_=function(){function P(c){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=c}var D=P.prototype;return D.reloaded=function(v){if(!v){this.advanced=!0,this.updated=!0;return}var O=this.lastPartSn-v.lastPartSn,w=this.lastPartIndex-v.lastPartIndex;this.updated=this.endSN!==v.endSN||!!w||!!O,this.advanced=this.endSN>v.endSN||O>0||O===0&&w>0,this.updated||this.advanced?this.misses=Math.floor(v.misses*.6):this.misses=v.misses+1,this.availabilityDelay=v.availabilityDelay},M(P,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(H.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||N}},{key:"drift",get:function(){var v=this.driftEndTime-this.driftStartTime;if(v>0){var O=this.driftEnd-this.driftStart;return O*1e3/v}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var v;return(v=this.partList)!==null&&v!==void 0&&v.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var v;return(v=this.fragments)!==null&&v!==void 0&&v.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 v;return(v=this.partList)!==null&&v!==void 0&&v.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var v;return(v=this.partList)!==null&&v!==void 0&&v.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),P}()},"./src/loader/level-key.ts":function(Q,K,L){"use strict";L.r(K),L.d(K,"LevelKey",function(){return _});var H=L("./node_modules/url-toolkit/src/url-toolkit.js"),k=L.n(H);function M(P,D){for(var c=0;c<D.length;c++){var v=D[c];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(P,v.key,v)}}function N(P,D,c){return D&&M(P.prototype,D),c&&M(P,c),P}var _=function(){P.fromURL=function(c,v){return new P(c,v)},P.fromURI=function(c){return new P(c)};function P(D,c){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,c?this._uri=Object(H.buildAbsoluteURL)(D,c,{alwaysNormalize:!0}):this._uri=D}return N(P,[{key:"uri",get:function(){return this._uri}}]),P}()},"./src/loader/load-stats.ts":function(Q,K,L){"use strict";L.r(K),L.d(K,"LoadStats",function(){return H});var H=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(Q,K,L){"use strict";L.r(K),L.d(K,"default",function(){return l});var H=L("./src/polyfills/number.ts"),k=L("./node_modules/url-toolkit/src/url-toolkit.js"),M=L.n(k),N=L("./src/loader/fragment.ts"),_=L("./src/loader/level-details.ts"),P=L("./src/loader/level-key.ts"),D=L("./src/utils/attr-list.ts"),c=L("./src/utils/logger.ts"),v=L("./src/utils/codecs.ts"),O=/#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,b=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),E=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("|")),s=/\.(mp4|m4s|m4v|m4a)$/i;function a(A){var T,f;return s.test((T=(f=k.parseURL(A))===null||f===void 0?void 0:f.path)!=null?T:"")}var l=function(){function A(){}return A.findGroup=function(f,m){for(var d=0;d<f.length;d++){var o=f[d];if(o.id===m)return o}},A.convertAVC1ToAVCOTI=function(f){var m=f.split(".");if(m.length>2){var d=m.shift()+".";return d+=parseInt(m.shift()).toString(16),d+=("000"+parseInt(m.shift()).toString(16)).substr(-4),d}return f},A.resolve=function(f,m){return k.buildAbsoluteURL(m,f,{alwaysNormalize:!0})},A.parseMasterPlaylist=function(f,m){var d=[],o={},x=!1;O.lastIndex=0;for(var y;(y=O.exec(f))!=null;)if(y[1]){var p=new D.AttrList(y[1]),R={attrs:p,bitrate:p.decimalInteger("AVERAGE-BANDWIDTH")||p.decimalInteger("BANDWIDTH"),name:p.NAME,url:A.resolve(y[2],m)},U=p.decimalResolution("RESOLUTION");U&&(R.width=U.width,R.height=U.height),u((p.CODECS||"").split(/[ ,]+/).filter(function(z){return z}),R),R.videoCodec&&R.videoCodec.indexOf("avc1")!==-1&&(R.videoCodec=A.convertAVC1ToAVCOTI(R.videoCodec)),d.push(R)}else if(y[3]){var B=new D.AttrList(y[3]);B["DATA-ID"]&&(x=!0,o[B["DATA-ID"]]=B)}return{levels:d,sessionData:x?o:null}},A.parseMasterPlaylistMedia=function(f,m,d,o){o===void 0&&(o=[]);var x,y=[],p=0;for(w.lastIndex=0;(x=w.exec(f))!==null;){var R=new D.AttrList(x[1]);if(R.TYPE===d){var U={attrs:R,bitrate:0,id:p++,groupId:R["GROUP-ID"],instreamId:R["INSTREAM-ID"],name:R.NAME||R.LANGUAGE||"",type:d,default:R.bool("DEFAULT"),autoselect:R.bool("AUTOSELECT"),forced:R.bool("FORCED"),lang:R.LANGUAGE,url:R.URI?A.resolve(R.URI,m):""};if(o.length){var B=A.findGroup(o,U.groupId)||o[0];C(U,B,"audioCodec"),C(U,B,"textCodec")}y.push(U)}}return y},A.parseLevelPlaylist=function(f,m,d,o,x){var y=new _.LevelDetails(m),p=y.fragments,R=null,U=0,B=0,z=0,j=0,F=null,X=new N.Fragment(o,m),q,ne,ue,xe=-1,pe=!1;for(b.lastIndex=0,y.m3u8=f;(q=b.exec(f))!==null;){pe&&(pe=!1,X=new N.Fragment(o,m),X.start=z,X.sn=U,X.cc=j,X.level=d,R&&(X.initSegment=R,X.rawProgramDateTime=R.rawProgramDateTime));var he=q[1];if(he){X.duration=parseFloat(he);var de=(" "+q[2]).slice(1);X.title=de||null,X.tagList.push(de?["INF",he,de]:["INF",he])}else if(q[3])Object(H.isFiniteNumber)(X.duration)&&(X.start=z,ue&&(X.levelkey=ue),X.sn=U,X.level=d,X.cc=j,X.urlId=x,p.push(X),X.relurl=(" "+q[3]).slice(1),h(X,F),F=X,z+=X.duration,U++,B=0,pe=!0);else if(q[4]){var fe=(" "+q[4]).slice(1);F?X.setByteRange(fe,F):X.setByteRange(fe)}else if(q[5])X.rawProgramDateTime=(" "+q[5]).slice(1),X.tagList.push(["PROGRAM-DATE-TIME",X.rawProgramDateTime]),xe===-1&&(xe=p.length);else{if(q=q[0].match(E),!q){c.logger.warn("No matches on slow regex match for level playlist!");continue}for(ne=1;ne<q.length&&!(typeof q[ne]!="undefined");ne++);var te=(" "+q[ne]).slice(1),se=(" "+q[ne+1]).slice(1),ye=q[ne+2]?(" "+q[ne+2]).slice(1):"";switch(te){case"PLAYLIST-TYPE":y.type=se.toUpperCase();break;case"MEDIA-SEQUENCE":U=y.startSN=parseInt(se);break;case"SKIP":{var Me=new D.AttrList(se),ke=Me.decimalInteger("SKIPPED-SEGMENTS");if(Object(H.isFiniteNumber)(ke)){y.skippedSegments=ke;for(var He=ke;He--;)p.unshift(null);U+=ke}var $e=Me.enumeratedString("RECENTLY-REMOVED-DATERANGES");$e&&(y.recentlyRemovedDateranges=$e.split(" "));break}case"TARGETDURATION":y.targetduration=parseFloat(se);break;case"VERSION":y.version=parseInt(se);break;case"EXTM3U":break;case"ENDLIST":y.live=!1;break;case"#":(se||ye)&&X.tagList.push(ye?[se,ye]:[se]);break;case"DIS":j++;case"GAP":X.tagList.push([te]);break;case"BITRATE":X.tagList.push([te,se]);break;case"DISCONTINUITY-SEQ":j=parseInt(se);break;case"KEY":{var we,De=new D.AttrList(se),_e=De.enumeratedString("METHOD"),Be=De.URI,Ne=De.hexadecimalInteger("IV"),Se=De.enumeratedString("KEYFORMATVERSIONS"),Ce=De.enumeratedString("KEYID"),Ke=(we=De.enumeratedString("KEYFORMAT"))!=null?we:"identity",Qe=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(Qe.indexOf(Ke)>-1){c.logger.warn("Keyformat "+Ke+" is not supported from the manifest");continue}else if(Ke!=="identity")continue;_e&&(ue=P.LevelKey.fromURL(m,Be),Be&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(_e)>=0&&(ue.method=_e,ue.keyFormat=Ke,Ce&&(ue.keyID=Ce),Se&&(ue.keyFormatVersions=Se),ue.iv=Ne));break}case"START":{var Ve=new D.AttrList(se),Ue=Ve.decimalFloatingPoint("TIME-OFFSET");Object(H.isFiniteNumber)(Ue)&&(y.startTimeOffset=Ue);break}case"MAP":{var tt=new D.AttrList(se);X.relurl=tt.URI,tt.BYTERANGE&&X.setByteRange(tt.BYTERANGE),X.level=d,X.sn="initSegment",ue&&(X.levelkey=ue),X.initSegment=null,R=X,pe=!0;break}case"SERVER-CONTROL":{var Ye=new D.AttrList(se);y.canBlockReload=Ye.bool("CAN-BLOCK-RELOAD"),y.canSkipUntil=Ye.optionalFloat("CAN-SKIP-UNTIL",0),y.canSkipDateRanges=y.canSkipUntil>0&&Ye.bool("CAN-SKIP-DATERANGES"),y.partHoldBack=Ye.optionalFloat("PART-HOLD-BACK",0),y.holdBack=Ye.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var Xe=new D.AttrList(se);y.partTarget=Xe.decimalFloatingPoint("PART-TARGET");break}case"PART":{var ve=y.partList;ve||(ve=y.partList=[]);var et=B>0?ve[ve.length-1]:void 0,Ge=B++,be=new N.Part(new D.AttrList(se),X,m,Ge,et);ve.push(be),X.duration+=be.duration;break}case"PRELOAD-HINT":{var Oe=new D.AttrList(se);y.preloadHint=Oe;break}case"RENDITION-REPORT":{var le=new D.AttrList(se);y.renditionReports=y.renditionReports||[],y.renditionReports.push(le);break}default:c.logger.warn("line parsed but not handled: "+q);break}}}F&&!F.relurl?(p.pop(),z-=F.duration,y.partList&&(y.fragmentHint=F)):y.partList&&(h(X,F),X.cc=j,y.fragmentHint=X);var ae=p.length,oe=p[0],Y=p[ae-1];if(z+=y.skippedSegments*y.targetduration,z>0&&ae&&Y){y.averagetargetduration=z/ae;var $=Y.sn;y.endSN=$!=="initSegment"?$:0,oe&&(y.startCC=oe.cc,oe.initSegment||y.fragments.every(function(J){return J.relurl&&a(J.relurl)})&&(c.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),X=new N.Fragment(o,m),X.relurl=Y.relurl,X.level=d,X.sn="initSegment",oe.initSegment=X,y.needSidxRanges=!0))}else y.endSN=0,y.startCC=0;return y.fragmentHint&&(z+=y.fragmentHint.duration),y.totalduration=z,y.endCC=j,xe>0&&g(p,xe),y},A}();function u(A,T){["video","audio","text"].forEach(function(f){var m=A.filter(function(o){return Object(v.isCodecType)(o,f)});if(m.length){var d=m.filter(function(o){return o.lastIndexOf("avc1",0)===0||o.lastIndexOf("mp4a",0)===0});T[f+"Codec"]=d.length>0?d[0]:m[0],A=A.filter(function(o){return m.indexOf(o)===-1})}}),T.unknownCodecs=A}function C(A,T,f){var m=T[f];m&&(A[f]=m)}function g(A,T){for(var f=A[T],m=T;m--;){var d=A[m];if(!d)return;d.programDateTime=f.programDateTime-d.duration*1e3,f=d}}function h(A,T){A.rawProgramDateTime?A.programDateTime=Date.parse(A.rawProgramDateTime):T!=null&&T.programDateTime&&(A.programDateTime=T.endProgramDateTime),Object(H.isFiniteNumber)(A.programDateTime)||(A.programDateTime=null,A.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(Q,K,L){"use strict";L.r(K);var H=L("./src/polyfills/number.ts"),k=L("./src/events.ts"),M=L("./src/errors.ts"),N=L("./src/utils/logger.ts"),_=L("./src/utils/mp4-tools.ts"),P=L("./src/loader/m3u8-parser.ts"),D=L("./src/types/loader.ts"),c=L("./src/utils/attr-list.ts");function v(b){var E=b.type;switch(E){case D.PlaylistContextType.AUDIO_TRACK:return D.PlaylistLevelType.AUDIO;case D.PlaylistContextType.SUBTITLE_TRACK:return D.PlaylistLevelType.SUBTITLE;default:return D.PlaylistLevelType.MAIN}}function O(b,E){var s=b.url;return(s===void 0||s.indexOf("data:")===0)&&(s=E.url),s}var w=function(){function b(s){this.hls=void 0,this.loaders=Object.create(null),this.hls=s,this.registerListeners()}var E=b.prototype;return E.registerListeners=function(){var a=this.hls;a.on(k.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.on(k.Events.LEVEL_LOADING,this.onLevelLoading,this),a.on(k.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),a.on(k.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},E.unregisterListeners=function(){var a=this.hls;a.off(k.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.off(k.Events.LEVEL_LOADING,this.onLevelLoading,this),a.off(k.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),a.off(k.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},E.createInternalLoader=function(a){var l=this.hls.config,u=l.pLoader,C=l.loader,g=u||C,h=new g(l);return a.loader=h,this.loaders[a.type]=h,h},E.getInternalLoader=function(a){return this.loaders[a.type]},E.resetInternalLoader=function(a){this.loaders[a]&&delete this.loaders[a]},E.destroyInternalLoaders=function(){for(var a in this.loaders){var l=this.loaders[a];l&&l.destroy(),this.resetInternalLoader(a)}},E.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},E.onManifestLoading=function(a,l){var u=l.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:D.PlaylistContextType.MANIFEST,url:u,deliveryDirectives:null})},E.onLevelLoading=function(a,l){var u=l.id,C=l.level,g=l.url,h=l.deliveryDirectives;this.load({id:u,groupId:null,level:C,responseType:"text",type:D.PlaylistContextType.LEVEL,url:g,deliveryDirectives:h})},E.onAudioTrackLoading=function(a,l){var u=l.id,C=l.groupId,g=l.url,h=l.deliveryDirectives;this.load({id:u,groupId:C,level:null,responseType:"text",type:D.PlaylistContextType.AUDIO_TRACK,url:g,deliveryDirectives:h})},E.onSubtitleTrackLoading=function(a,l){var u=l.id,C=l.groupId,g=l.url,h=l.deliveryDirectives;this.load({id:u,groupId:C,level:null,responseType:"text",type:D.PlaylistContextType.SUBTITLE_TRACK,url:g,deliveryDirectives:h})},E.load=function(a){var l,u=this.hls.config,C=this.getInternalLoader(a);if(C){var g=C.context;if(g&&g.url===a.url){N.logger.trace("[playlist-loader]: playlist request ongoing");return}N.logger.log("[playlist-loader]: aborting previous loader for type: "+a.type),C.abort()}var h,A,T,f;switch(a.type){case D.PlaylistContextType.MANIFEST:h=u.manifestLoadingMaxRetry,A=u.manifestLoadingTimeOut,T=u.manifestLoadingRetryDelay,f=u.manifestLoadingMaxRetryTimeout;break;case D.PlaylistContextType.LEVEL:case D.PlaylistContextType.AUDIO_TRACK:case D.PlaylistContextType.SUBTITLE_TRACK:h=0,A=u.levelLoadingTimeOut;break;default:h=u.levelLoadingMaxRetry,A=u.levelLoadingTimeOut,T=u.levelLoadingRetryDelay,f=u.levelLoadingMaxRetryTimeout;break}if(C=this.createInternalLoader(a),(l=a.deliveryDirectives)!==null&&l!==void 0&&l.part){var m;if(a.type===D.PlaylistContextType.LEVEL&&a.level!==null?m=this.hls.levels[a.level].details:a.type===D.PlaylistContextType.AUDIO_TRACK&&a.id!==null?m=this.hls.audioTracks[a.id].details:a.type===D.PlaylistContextType.SUBTITLE_TRACK&&a.id!==null&&(m=this.hls.subtitleTracks[a.id].details),m){var d=m.partTarget,o=m.targetduration;d&&o&&(A=Math.min(Math.max(d*3,o*.8)*1e3,A))}}var x={timeout:A,maxRetry:h,retryDelay:T,maxRetryDelay:f,highWaterMark:0},y={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};C.load(a,x,y)},E.loadsuccess=function(a,l,u,C){if(C===void 0&&(C=null),u.isSidxRequest){this.handleSidxRequest(a,u),this.handlePlaylistLoaded(a,l,u,C);return}this.resetInternalLoader(u.type);var g=a.data;if(g.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(a,u,"no EXTM3U delimiter",C);return}l.parsing.start=performance.now(),g.indexOf("#EXTINF:")>0||g.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(a,l,u,C):this.handleMasterPlaylist(a,l,u,C)},E.loaderror=function(a,l,u){u===void 0&&(u=null),this.handleNetworkError(l,u,!1,a)},E.loadtimeout=function(a,l,u){u===void 0&&(u=null),this.handleNetworkError(l,u,!0)},E.handleMasterPlaylist=function(a,l,u,C){var g=this.hls,h=a.data,A=O(a,u),T=P.default.parseMasterPlaylist(h,A),f=T.levels,m=T.sessionData;if(!f.length){this.handleManifestParsingError(a,u,"no level found in manifest",C);return}var d=f.map(function(U){return{id:U.attrs.AUDIO,audioCodec:U.audioCodec}}),o=f.map(function(U){return{id:U.attrs.SUBTITLES,textCodec:U.textCodec}}),x=P.default.parseMasterPlaylistMedia(h,A,"AUDIO",d),y=P.default.parseMasterPlaylistMedia(h,A,"SUBTITLES",o),p=P.default.parseMasterPlaylistMedia(h,A,"CLOSED-CAPTIONS");if(x.length){var R=x.some(function(U){return!U.url});!R&&f[0].audioCodec&&!f[0].attrs.AUDIO&&(N.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),x.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new c.AttrList({}),bitrate:0,url:""}))}g.trigger(k.Events.MANIFEST_LOADED,{levels:f,audioTracks:x,subtitles:y,captions:p,url:A,stats:l,networkDetails:C,sessionData:m})},E.handleTrackOrLevelPlaylist=function(a,l,u,C){var g=this.hls,h=u.id,A=u.level,T=u.type,f=O(a,u),m=Object(H.isFiniteNumber)(h)?h:0,d=Object(H.isFiniteNumber)(A)?A:m,o=v(u),x=P.default.parseLevelPlaylist(a.data,f,d,o,m);if(!x.fragments.length){g.trigger(k.Events.ERROR,{type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:f,reason:"no fragments found in level",level:typeof u.level=="number"?u.level:void 0});return}if(T===D.PlaylistContextType.MANIFEST){var y={attrs:new c.AttrList({}),bitrate:0,details:x,name:"",url:f};g.trigger(k.Events.MANIFEST_LOADED,{levels:[y],audioTracks:[],url:f,stats:l,networkDetails:C,sessionData:null})}if(l.parsing.end=performance.now(),x.needSidxRanges){var p,R=(p=x.fragments[0].initSegment)===null||p===void 0?void 0:p.url;this.load({url:R,isSidxRequest:!0,type:T,level:A,levelDetails:x,id:h,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}u.levelDetails=x,this.handlePlaylistLoaded(a,l,u,C)},E.handleSidxRequest=function(a,l){var u=Object(_.parseSegmentIndex)(new Uint8Array(a.data));if(!u)return;var C=u.references,g=l.levelDetails;C.forEach(function(h,A){var T=h.info,f=g.fragments[A];f.byteRange.length===0&&f.setByteRange(String(1+T.end-T.start)+"@"+String(T.start)),f.initSegment&&f.initSegment.setByteRange(String(u.moovEndOffset)+"@0")})},E.handleManifestParsingError=function(a,l,u,C){this.hls.trigger(k.Events.ERROR,{type:M.ErrorTypes.NETWORK_ERROR,details:M.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:l.type===D.PlaylistContextType.MANIFEST,url:a.url,reason:u,response:a,context:l,networkDetails:C})},E.handleNetworkError=function(a,l,u,C){u===void 0&&(u=!1),N.logger.warn("[playlist-loader]: A network "+(u?"timeout":"error")+" occurred while loading "+a.type+" level: "+a.level+" id: "+a.id+' group-id: "'+a.groupId+'"');var g=M.ErrorDetails.UNKNOWN,h=!1,A=this.getInternalLoader(a);switch(a.type){case D.PlaylistContextType.MANIFEST:g=u?M.ErrorDetails.MANIFEST_LOAD_TIMEOUT:M.ErrorDetails.MANIFEST_LOAD_ERROR,h=!0;break;case D.PlaylistContextType.LEVEL:g=u?M.ErrorDetails.LEVEL_LOAD_TIMEOUT:M.ErrorDetails.LEVEL_LOAD_ERROR,h=!1;break;case D.PlaylistContextType.AUDIO_TRACK:g=u?M.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:M.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,h=!1;break;case D.PlaylistContextType.SUBTITLE_TRACK:g=u?M.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:M.ErrorDetails.SUBTITLE_LOAD_ERROR,h=!1;break}A&&this.resetInternalLoader(a.type);var T={type:M.ErrorTypes.NETWORK_ERROR,details:g,fatal:h,url:a.url,loader:A,context:a,networkDetails:l};C&&(T.response=C),this.hls.trigger(k.Events.ERROR,T)},E.handlePlaylistLoaded=function(a,l,u,C){var g=u.type,h=u.level,A=u.id,T=u.groupId,f=u.loader,m=u.levelDetails,d=u.deliveryDirectives;if(!(m!=null&&m.targetduration)){this.handleManifestParsingError(a,u,"invalid target duration",C);return}if(!f)return;m.live&&(f.getCacheAge&&(m.ageHeader=f.getCacheAge()||0),(!f.getCacheAge||isNaN(m.ageHeader))&&(m.ageHeader=0));switch(g){case D.PlaylistContextType.MANIFEST:case D.PlaylistContextType.LEVEL:this.hls.trigger(k.Events.LEVEL_LOADED,{details:m,level:h||0,id:A||0,stats:l,networkDetails:C,deliveryDirectives:d});break;case D.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(k.Events.AUDIO_TRACK_LOADED,{details:m,id:A||0,groupId:T||"",stats:l,networkDetails:C,deliveryDirectives:d});break;case D.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(k.Events.SUBTITLE_TRACK_LOADED,{details:m,id:A||0,groupId:T||"",stats:l,networkDetails:C,deliveryDirectives:d});break}},b}();K.default=w},"./src/polyfills/number.ts":function(Q,K,L){"use strict";L.r(K),L.d(K,"isFiniteNumber",function(){return H}),L.d(K,"MAX_SAFE_INTEGER",function(){return k});var H=Number.isFinite||function(M){return typeof M=="number"&&isFinite(M)},k=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(Q,K,L){"use strict";L.r(K);var H=function(){function k(){}return k.getSilentFrame=function(N,_){switch(N){case"mp4a.40.2":if(_===1)return new Uint8Array([0,200,0,128,35,128]);if(_===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(_===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(_===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(_===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(_===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(_===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(_===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(_===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},k}();K.default=H},"./src/remux/mp4-generator.ts":function(Q,K,L){"use strict";L.r(K);var H=Math.pow(2,32)-1,k=function(){function M(){}return M.init=function(){M.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 _;for(_ in M.types)M.types.hasOwnProperty(_)&&(M.types[_]=[_.charCodeAt(0),_.charCodeAt(1),_.charCodeAt(2),_.charCodeAt(3)]);var P=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]),D=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]);M.HDLR_TYPES={video:P,audio:D};var c=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),v=new Uint8Array([0,0,0,0,0,0,0,0]);M.STTS=M.STSC=M.STCO=v,M.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),M.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),M.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),M.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var O=new Uint8Array([105,115,111,109]),w=new Uint8Array([97,118,99,49]),b=new Uint8Array([0,0,0,1]);M.FTYP=M.box(M.types.ftyp,O,b,O,w),M.DINF=M.box(M.types.dinf,M.box(M.types.dref,c))},M.box=function(_){for(var P=8,D=arguments.length,c=new Array(D>1?D-1:0),v=1;v<D;v++)c[v-1]=arguments[v];for(var O=c.length,w=O;O--;)P+=c[O].byteLength;var b=new Uint8Array(P);for(b[0]=P>>24&255,b[1]=P>>16&255,b[2]=P>>8&255,b[3]=P&255,b.set(_,4),O=0,P=8;O<w;O++)b.set(c[O],P),P+=c[O].byteLength;return b},M.hdlr=function(_){return M.box(M.types.hdlr,M.HDLR_TYPES[_])},M.mdat=function(_){return M.box(M.types.mdat,_)},M.mdhd=function(_,P){P*=_;var D=Math.floor(P/(H+1)),c=Math.floor(P%(H+1));return M.box(M.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,_>>24&255,_>>16&255,_>>8&255,_&255,D>>24,D>>16&255,D>>8&255,D&255,c>>24,c>>16&255,c>>8&255,c&255,85,196,0,0]))},M.mdia=function(_){return M.box(M.types.mdia,M.mdhd(_.timescale,_.duration),M.hdlr(_.type),M.minf(_))},M.mfhd=function(_){return M.box(M.types.mfhd,new Uint8Array([0,0,0,0,_>>24,_>>16&255,_>>8&255,_&255]))},M.minf=function(_){return _.type==="audio"?M.box(M.types.minf,M.box(M.types.smhd,M.SMHD),M.DINF,M.stbl(_)):M.box(M.types.minf,M.box(M.types.vmhd,M.VMHD),M.DINF,M.stbl(_))},M.moof=function(_,P,D){return M.box(M.types.moof,M.mfhd(_),M.traf(D,P))},M.moov=function(_){for(var P=_.length,D=[];P--;)D[P]=M.trak(_[P]);return M.box.apply(null,[M.types.moov,M.mvhd(_[0].timescale,_[0].duration)].concat(D).concat(M.mvex(_)))},M.mvex=function(_){for(var P=_.length,D=[];P--;)D[P]=M.trex(_[P]);return M.box.apply(null,[M.types.mvex].concat(D))},M.mvhd=function(_,P){P*=_;var D=Math.floor(P/(H+1)),c=Math.floor(P%(H+1)),v=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,_>>24&255,_>>16&255,_>>8&255,_&255,D>>24,D>>16&255,D>>8&255,D&255,c>>24,c>>16&255,c>>8&255,c&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 M.box(M.types.mvhd,v)},M.sdtp=function(_){var P=_.samples||[],D=new Uint8Array(4+P.length),c,v;for(c=0;c<P.length;c++)v=P[c].flags,D[c+4]=v.dependsOn<<4|v.isDependedOn<<2|v.hasRedundancy;return M.box(M.types.sdtp,D)},M.stbl=function(_){return M.box(M.types.stbl,M.stsd(_),M.box(M.types.stts,M.STTS),M.box(M.types.stsc,M.STSC),M.box(M.types.stsz,M.STSZ),M.box(M.types.stco,M.STCO))},M.avc1=function(_){var P=[],D=[],c,v,O;for(c=0;c<_.sps.length;c++)v=_.sps[c],O=v.byteLength,P.push(O>>>8&255),P.push(O&255),P=P.concat(Array.prototype.slice.call(v));for(c=0;c<_.pps.length;c++)v=_.pps[c],O=v.byteLength,D.push(O>>>8&255),D.push(O&255),D=D.concat(Array.prototype.slice.call(v));var w=M.box(M.types.avcC,new Uint8Array([1,P[3],P[4],P[5],252|3,224|_.sps.length].concat(P).concat([_.pps.length]).concat(D))),b=_.width,E=_.height,s=_.pixelRatio[0],a=_.pixelRatio[1];return M.box(M.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,b>>8&255,b&255,E>>8&255,E&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,M.box(M.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),M.box(M.types.pasp,new Uint8Array([s>>24,s>>16&255,s>>8&255,s&255,a>>24,a>>16&255,a>>8&255,a&255])))},M.esds=function(_){var P=_.config.length;return new Uint8Array([0,0,0,0,3,23+P,0,1,0,4,15+P,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([P]).concat(_.config).concat([6,1,2]))},M.mp4a=function(_){var P=_.samplerate;return M.box(M.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,_.channelCount,0,16,0,0,0,0,P>>8&255,P&255,0,0]),M.box(M.types.esds,M.esds(_)))},M.mp3=function(_){var P=_.samplerate;return M.box(M.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,_.channelCount,0,16,0,0,0,0,P>>8&255,P&255,0,0]))},M.stsd=function(_){return _.type==="audio"?!_.isAAC&&_.codec==="mp3"?M.box(M.types.stsd,M.STSD,M.mp3(_)):M.box(M.types.stsd,M.STSD,M.mp4a(_)):M.box(M.types.stsd,M.STSD,M.avc1(_))},M.tkhd=function(_){var P=_.id,D=_.duration*_.timescale,c=_.width,v=_.height,O=Math.floor(D/(H+1)),w=Math.floor(D%(H+1));return M.box(M.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,P>>24&255,P>>16&255,P>>8&255,P&255,0,0,0,0,O>>24,O>>16&255,O>>8&255,O&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,c>>8&255,c&255,0,0,v>>8&255,v&255,0,0]))},M.traf=function(_,P){var D=M.sdtp(_),c=_.id,v=Math.floor(P/(H+1)),O=Math.floor(P%(H+1));return M.box(M.types.traf,M.box(M.types.tfhd,new Uint8Array([0,0,0,0,c>>24,c>>16&255,c>>8&255,c&255])),M.box(M.types.tfdt,new Uint8Array([1,0,0,0,v>>24,v>>16&255,v>>8&255,v&255,O>>24,O>>16&255,O>>8&255,O&255])),M.trun(_,D.length+16+20+8+16+8+8),D)},M.trak=function(_){return _.duration=_.duration||4294967295,M.box(M.types.trak,M.tkhd(_),M.mdia(_))},M.trex=function(_){var P=_.id;return M.box(M.types.trex,new Uint8Array([0,0,0,0,P>>24,P>>16&255,P>>8&255,P&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},M.trun=function(_,P){var D=_.samples||[],c=D.length,v=12+16*c,O=new Uint8Array(v),w,b,E,s,a,l;for(P+=8+v,O.set([0,0,15,1,c>>>24&255,c>>>16&255,c>>>8&255,c&255,P>>>24&255,P>>>16&255,P>>>8&255,P&255],0),w=0;w<c;w++)b=D[w],E=b.duration,s=b.size,a=b.flags,l=b.cts,O.set([E>>>24&255,E>>>16&255,E>>>8&255,E&255,s>>>24&255,s>>>16&255,s>>>8&255,s&255,a.isLeading<<2|a.dependsOn,a.isDependedOn<<6|a.hasRedundancy<<4|a.paddingValue<<1|a.isNonSync,a.degradPrio&240<<8,a.degradPrio&15,l>>>24&255,l>>>16&255,l>>>8&255,l&255],12+16*w);return M.box(M.types.trun,O)},M.initSegment=function(_){M.types||M.init();var P=M.moov(_),D=new Uint8Array(M.FTYP.byteLength+P.byteLength);return D.set(M.FTYP),D.set(P,M.FTYP.byteLength),D},M}();k.types=void 0,k.HDLR_TYPES=void 0,k.STTS=void 0,k.STSC=void 0,k.STCO=void 0,k.STSZ=void 0,k.VMHD=void 0,k.SMHD=void 0,k.STSD=void 0,k.FTYP=void 0,k.DINF=void 0,K.default=k},"./src/remux/mp4-remuxer.ts":function(Q,K,L){"use strict";L.r(K),L.d(K,"default",function(){return l}),L.d(K,"normalizePts",function(){return u});var H=L("./src/polyfills/number.ts"),k=L("./src/remux/aac-helper.ts"),M=L("./src/remux/mp4-generator.ts"),N=L("./src/events.ts"),_=L("./src/errors.ts"),P=L("./src/utils/logger.ts"),D=L("./src/types/loader.ts"),c=L("./src/utils/timescale-conversion.ts");function v(){return v=Object.assign||function(A){for(var T=1;T<arguments.length;T++){var f=arguments[T];for(var m in f)Object.prototype.hasOwnProperty.call(f,m)&&(A[m]=f[m])}return A},v.apply(this,arguments)}var O=10*1e3,w=1024,b=1152,E=null,s=null,a=!1,l=function(){function A(f,m,d,o){if(o===void 0&&(o=""),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=f,this.config=m,this.typeSupported=d,this.ISGenerated=!1,E===null){var x=navigator.userAgent||"",y=x.match(/Chrome\/(\d+)/i);E=y?parseInt(y[1]):0}if(s===null){var p=navigator.userAgent.match(/Safari\/(\d+)/i);s=p?parseInt(p[1]):0}a=!!E&&E<75||!!s&&s<600}var T=A.prototype;return T.destroy=function(){},T.resetTimeStamp=function(m){P.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=m},T.resetNextTimestamp=function(){P.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},T.resetInitSegment=function(){P.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},T.getVideoStartPts=function(m){var d=!1,o=m.reduce(function(x,y){var p=y.pts-x;return p<-4294967296?(d=!0,u(x,y.pts)):p>0?x:y.pts},m[0].pts);return d&&P.logger.debug("PTS rollover detected"),o},T.remux=function(m,d,o,x,y,p,R,U){var B,z,j,F,X,q,ne=y,ue=y,xe=m.pid>-1,pe=d.pid>-1,he=d.samples.length,de=m.samples.length>0,fe=he>1,te=(!xe||de)&&(!pe||fe)||this.ISGenerated||R;if(te){this.ISGenerated||(j=this.generateIS(m,d,y));var se=this.isVideoContiguous,ye=-1;if(fe&&(ye=C(d.samples),!se&&this.config.forceKeyFrameOnDiscontinuity))if(q=!0,ye>0){P.logger.warn("[mp4-remuxer]: Dropped "+ye+" out of "+he+" video samples due to a missing keyframe");var Me=this.getVideoStartPts(d.samples);d.samples=d.samples.slice(ye),d.dropped+=ye,ue+=(d.samples[0].pts-Me)/(d.timescale||9e4)}else ye===-1&&(P.logger.warn("[mp4-remuxer]: No keyframe found out of "+he+" video samples"),q=!1);if(this.ISGenerated){if(de&&fe){var ke=this.getVideoStartPts(d.samples),He=u(m.samples[0].pts,ke)-ke,$e=He/d.inputTimeScale;ne+=Math.max(0,$e),ue+=Math.max(0,-$e)}if(de){if(m.samplerate||(P.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),j=this.generateIS(m,d,y)),z=this.remuxAudio(m,ne,this.isAudioContiguous,p,pe||fe||U===D.PlaylistLevelType.AUDIO?ue:void 0),fe){var we=z?z.endPTS-z.startPTS:0;d.inputTimeScale||(P.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),j=this.generateIS(m,d,y)),B=this.remuxVideo(d,ue,se,we)}}else fe&&(B=this.remuxVideo(d,ue,se,0));B&&(B.firstKeyFrame=ye,B.independent=ye!==-1)}}return this.ISGenerated&&(o.samples.length&&(X=this.remuxID3(o,y)),x.samples.length&&(F=this.remuxText(x,y))),{audio:z,video:B,initSegment:j,independent:q,text:F,id3:X}},T.generateIS=function(m,d,o){var x=m.samples,y=d.samples,p=this.typeSupported,R={},U=!Object(H.isFiniteNumber)(this._initPTS),B="audio/mp4",z,j,F;if(U&&(z=j=Infinity),m.config&&x.length&&(m.timescale=m.samplerate,m.isAAC||(p.mpeg?(B="audio/mpeg",m.codec=""):p.mp3&&(m.codec="mp3")),R.audio={id:"audio",container:B,codec:m.codec,initSegment:!m.isAAC&&p.mpeg?new Uint8Array(0):M.default.initSegment([m]),metadata:{channelCount:m.channelCount}},U&&(F=m.inputTimeScale,z=j=x[0].pts-Math.round(F*o))),d.sps&&d.pps&&y.length&&(d.timescale=d.inputTimeScale,R.video={id:"main",container:"video/mp4",codec:d.codec,initSegment:M.default.initSegment([d]),metadata:{width:d.width,height:d.height}},U)){F=d.inputTimeScale;var X=this.getVideoStartPts(y),q=Math.round(F*o);j=Math.min(j,u(y[0].dts,X)-q),z=Math.min(z,X-q)}if(Object.keys(R).length)return this.ISGenerated=!0,U&&(this._initPTS=z,this._initDTS=j),{tracks:R,initPTS:z,timescale:F}},T.remuxVideo=function(m,d,o,x){var y=m.inputTimeScale,p=m.samples,R=[],U=p.length,B=this._initPTS,z=this.nextAvcDts,j=8,F,X,q,ne=Number.POSITIVE_INFINITY,ue=Number.NEGATIVE_INFINITY,xe=0,pe=!1;if(!o||z===null){var he=d*y,de=p[0].pts-u(p[0].dts,p[0].pts);z=he-de}for(var fe=0;fe<U;fe++){var te=p[fe];if(te.pts=u(te.pts-B,z),te.dts=u(te.dts-B,z),te.dts>te.pts){var se=9e4*.2;xe=Math.max(Math.min(xe,te.pts-te.dts),-1*se)}te.dts<p[fe>0?fe-1:fe].dts&&(pe=!0)}pe&&p.sort(function(pt,it){var Je=pt.dts-it.dts,xt=pt.pts-it.pts;return Je||xt}),X=p[0].dts,q=p[p.length-1].dts;var ye=Math.round((q-X)/(U-1));if(xe<0){if(xe<ye*-2){P.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(c.toMsFromMpegTsClock)(-ye,!0)+" ms");for(var Me=xe,ke=0;ke<U;ke++)p[ke].dts=Me=Math.max(Me,p[ke].pts-ye),p[ke].pts=Math.max(Me,p[ke].pts)}else{P.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(c.toMsFromMpegTsClock)(xe,!0)+" ms to overcome this issue");for(var He=0;He<U;He++)p[He].dts=p[He].dts+xe}X=p[0].dts}if(o){var $e=X-z,we=$e>ye,De=$e<-1;if(we||De){we?P.logger.warn("AVC: "+Object(c.toMsFromMpegTsClock)($e,!0)+" ms ("+$e+"dts) hole between fragments detected, filling it"):P.logger.warn("AVC: "+Object(c.toMsFromMpegTsClock)(-$e,!0)+" ms ("+$e+"dts) overlapping between fragments detected"),X=z;var _e=p[0].pts-$e;p[0].dts=X,p[0].pts=_e,P.logger.log("Video: First PTS/DTS adjusted: "+Object(c.toMsFromMpegTsClock)(_e,!0)+"/"+Object(c.toMsFromMpegTsClock)(X,!0)+", delta: "+Object(c.toMsFromMpegTsClock)($e,!0)+" ms")}}a&&(X=Math.max(0,X));for(var Be=0,Ne=0,Se=0;Se<U;Se++){for(var Ce=p[Se],Ke=Ce.units,Qe=Ke.length,Ve=0,Ue=0;Ue<Qe;Ue++)Ve+=Ke[Ue].data.length;Ne+=Ve,Be+=Qe,Ce.length=Ve,Ce.dts=Math.max(Ce.dts,X),Ce.pts=Math.max(Ce.pts,Ce.dts,0),ne=Math.min(Ce.pts,ne),ue=Math.max(Ce.pts,ue)}q=p[U-1].dts;var tt=Ne+4*Be+8,Ye;try{Ye=new Uint8Array(tt)}catch(pt){this.observer.emit(N.Events.ERROR,N.Events.ERROR,{type:_.ErrorTypes.MUX_ERROR,details:_.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:tt,reason:"fail allocating video mdat "+tt});return}var Xe=new DataView(Ye.buffer);Xe.setUint32(0,tt),Ye.set(M.default.types.mdat,4);for(var ve=0;ve<U;ve++){for(var et=p[ve],Ge=et.units,be=0,Oe=0,le=Ge.length;Oe<le;Oe++){var ae=Ge[Oe],oe=ae.data,Y=ae.data.byteLength;Xe.setUint32(j,Y),j+=4,Ye.set(oe,j),j+=Y,be+=4+Y}if(ve<U-1)F=p[ve+1].dts-et.dts;else{var $=this.config,J=et.dts-p[ve>0?ve-1:ve].dts;if($.stretchShortVideoTrack&&this.nextAudioPts!==null){var re=Math.floor($.maxBufferHole*y),ge=(x?ne+x*y:this.nextAudioPts)-et.pts;ge>re?(F=ge-J,F<0&&(F=J),P.logger.log("[mp4-remuxer]: It is approximately "+ge/90+" ms to the next segment; using duration "+F/90+" ms for the last video frame.")):F=J}else F=J}var Ee=Math.round(et.pts-et.dts);R.push(new g(et.key,F,be,Ee))}if(R.length&&E&&E<70){var Ie=R[0].flags;Ie.dependsOn=2,Ie.isNonSync=0}console.assert(F!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=z=q+F,this.isVideoContiguous=!0;var st=M.default.moof(m.sequenceNumber++,X,v({},m,{samples:R})),ht="video",Le={data1:st,data2:Ye,startPTS:ne/y,endPTS:(ue+F)/y,startDTS:X/y,endDTS:z/y,type:ht,hasAudio:!1,hasVideo:!0,nb:R.length,dropped:m.dropped};return m.samples=[],m.dropped=0,console.assert(Ye.length,"MDAT length must not be zero"),Le},T.remuxAudio=function(m,d,o,x,y){var p=m.inputTimeScale,R=m.samplerate?m.samplerate:p,U=p/R,B=m.isAAC?w:b,z=B*U,j=this._initPTS,F=!m.isAAC&&this.typeSupported.mpeg,X=[],q=m.samples,ne=F?0:8,ue=this.nextAudioPts||-1,xe=d*p;if(this.isAudioContiguous=o=o||q.length&&ue>0&&(x&&Math.abs(xe-ue)<9e3||Math.abs(u(q[0].pts-j,xe)-ue)<20*z),q.forEach(function(oe){oe.pts=u(oe.pts-j,xe)}),!o||ue<0){if(q=q.filter(function(oe){return oe.pts>=0}),!q.length)return;y===0?ue=0:x?ue=Math.max(0,xe):ue=q[0].pts}if(m.isAAC)for(var pe=y!==void 0,he=this.config.maxAudioFramesDrift,de=0,fe=ue;de<q.length;de++){var te=q[de],se=te.pts,ye=se-fe,Me=Math.abs(1e3*ye/p);if(ye<=-he*z&&pe)de===0&&(P.logger.warn("Audio frame @ "+(se/p).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*ye/p)+" ms."),this.nextAudioPts=ue=fe=se);else if(ye>=he*z&&Me<O&&pe){var ke=Math.round(ye/z);fe=se-ke*z,fe<0&&(ke--,fe+=z),de===0&&(this.nextAudioPts=ue=fe),P.logger.warn("[mp4-remuxer]: Injecting "+ke+" audio frame @ "+(fe/p).toFixed(3)+"s due to "+Math.round(1e3*ye/p)+" ms gap.");for(var He=0;He<ke;He++){var $e=Math.max(fe,0),we=k.default.getSilentFrame(m.manifestCodec||m.codec,m.channelCount);we||(P.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),we=te.unit.subarray()),q.splice(de,0,{unit:we,pts:$e}),fe+=z,de++}}te.pts=fe,fe+=z}for(var De=null,_e=null,Be,Ne=0,Se=q.length;Se--;)Ne+=q[Se].unit.byteLength;for(var Ce=0,Ke=q.length;Ce<Ke;Ce++){var Qe=q[Ce],Ve=Qe.unit,Ue=Qe.pts;if(_e!==null){var tt=X[Ce-1];tt.duration=Math.round((Ue-_e)/U)}else if(o&&m.isAAC&&(Ue=ue),De=Ue,Ne>0){Ne+=ne;try{Be=new Uint8Array(Ne)}catch(oe){this.observer.emit(N.Events.ERROR,N.Events.ERROR,{type:_.ErrorTypes.MUX_ERROR,details:_.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Ne,reason:"fail allocating audio mdat "+Ne});return}if(!F){var Ye=new DataView(Be.buffer);Ye.setUint32(0,Ne),Be.set(M.default.types.mdat,4)}}else return;Be.set(Ve,ne);var Xe=Ve.byteLength;ne+=Xe,X.push(new g(!0,B,Xe,0)),_e=Ue}var ve=X.length;if(!ve)return;var et=X[X.length-1];this.nextAudioPts=ue=_e+U*et.duration;var Ge=F?new Uint8Array(0):M.default.moof(m.sequenceNumber++,De/U,v({},m,{samples:X}));m.samples=[];var be=De/p,Oe=ue/p,le="audio",ae={data1:Ge,data2:Be,startPTS:be,endPTS:Oe,startDTS:be,endDTS:Oe,type:le,hasAudio:!0,hasVideo:!1,nb:ve};return this.isAudioContiguous=!0,console.assert(Be.length,"MDAT length must not be zero"),ae},T.remuxEmptyAudio=function(m,d,o,x){var y=m.inputTimeScale,p=m.samplerate?m.samplerate:y,R=y/p,U=this.nextAudioPts,B=(U!==null?U:x.startDTS*y)+this._initDTS,z=x.endDTS*y+this._initDTS,j=R*w,F=Math.ceil((z-B)/j),X=k.default.getSilentFrame(m.manifestCodec||m.codec,m.channelCount);if(P.logger.warn("[mp4-remuxer]: remux empty Audio"),!X){P.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var q=[],ne=0;ne<F;ne++){var ue=B+ne*j;q.push({unit:X,pts:ue,dts:ue})}return m.samples=q,this.remuxAudio(m,d,o,!1)},T.remuxID3=function(m,d){var o=m.samples.length;if(!o)return;for(var x=m.inputTimeScale,y=this._initPTS,p=this._initDTS,R=0;R<o;R++){var U=m.samples[R];U.pts=u(U.pts-y,d*x)/x,U.dts=u(U.dts-p,d*x)/x}var B=m.samples;return m.samples=[],{samples:B}},T.remuxText=function(m,d){var o=m.samples.length;if(!o)return;for(var x=m.inputTimeScale,y=this._initPTS,p=0;p<o;p++){var R=m.samples[p];R.pts=u(R.pts-y,d*x)/x}m.samples.sort(function(B,z){return B.pts-z.pts});var U=m.samples;return m.samples=[],{samples:U}},A}();function u(A,T){var f;if(T===null)return A;for(T<A?f=-8589934592:f=8589934592;Math.abs(A-T)>4294967296;)A+=f;return A}function C(A){for(var T=0;T<A.length;T++)if(A[T].key)return T;return-1}var g=function(T,f,m,d){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=f,this.size=m,this.cts=d,this.flags=new h(T)},h=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(Q,K,L){"use strict";L.r(K);var H=L("./src/polyfills/number.ts"),k=L("./src/utils/mp4-tools.ts"),M=L("./src/loader/fragment.ts"),N=L("./src/utils/logger.ts"),_=function(){function c(){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 v=c.prototype;return v.destroy=function(){},v.resetTimeStamp=function(w){this.initPTS=w,this.lastEndDTS=null},v.resetNextTimestamp=function(){this.lastEndDTS=null},v.resetInitSegment=function(w,b,E){this.audioCodec=b,this.videoCodec=E,this.generateInitSegment(w),this.emitInitSegment=!0},v.generateInitSegment=function(w){var b=this.audioCodec,E=this.videoCodec;if(!w||!w.byteLength){this.initTracks=void 0,this.initData=void 0;return}var s=this.initData=Object(k.parseInitSegment)(w);b||(b=D(s.audio,M.ElementaryStreamTypes.AUDIO)),E||(E=D(s.video,M.ElementaryStreamTypes.VIDEO));var a={};s.audio&&s.video?a.audiovideo={container:"video/mp4",codec:b+","+E,initSegment:w,id:"main"}:s.audio?a.audio={container:"audio/mp4",codec:b,initSegment:w,id:"audio"}:s.video?a.video={container:"video/mp4",codec:E,initSegment:w,id:"main"}:N.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=a},v.remux=function(w,b,E,s,a){var l=this.initPTS,u=this.lastEndDTS,C={audio:void 0,video:void 0,text:s,id3:E,initSegment:void 0};Object(H.isFiniteNumber)(u)||(u=this.lastEndDTS=a||0);var g=b.samples;if(!g||!g.length)return C;var h={initPTS:void 0,timescale:1},A=this.initData;if((!A||!A.length)&&(this.generateInitSegment(g),A=this.initData),!A||!A.length)return N.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),C;this.emitInitSegment&&(h.tracks=this.initTracks,this.emitInitSegment=!1),Object(H.isFiniteNumber)(l)||(this.initPTS=h.initPTS=l=P(A,g,u));var T=Object(k.getDuration)(g,A),f=u,m=T+f;Object(k.offsetStartDTS)(A,g,l),T>0?this.lastEndDTS=m:(N.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var d=!!A.audio,o=!!A.video,x="";d&&(x+="audio"),o&&(x+="video");var y={data1:g,startPTS:f,startDTS:f,endPTS:m,endDTS:m,type:x,hasAudio:d,hasVideo:o,nb:1,dropped:0};return C.audio=y.type==="audio"?y:void 0,C.video=y.type!=="audio"?y:void 0,C.text=s,C.id3=E,C.initSegment=h,C},c}(),P=function(v,O,w){return Object(k.getStartDTS)(v,O)-w};function D(c,v){var O=c==null?void 0:c.codec;return O&&O.length>4?O:O==="hvc1"?"hvc1.1.c.L120.90":O==="av01"?"av01.0.04M.08":O==="avc1"||v===M.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}K.default=_},"./src/task-loop.ts":function(Q,K,L){"use strict";L.r(K),L.d(K,"default",function(){return H});var H=function(){function k(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var M=k.prototype;return M.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},M.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},M.onHandlerDestroyed=function(){},M.hasInterval=function(){return!!this._tickInterval},M.hasNextTick=function(){return!!this._tickTimer},M.setInterval=function(_){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,_),!0)},M.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},M.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},M.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},M.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},M.doTick=function(){},k}()},"./src/types/cmcd.ts":function(Q,K,L){"use strict";L.r(K),L.d(K,"CMCDVersion",function(){return H}),L.d(K,"CMCDObjectType",function(){return k}),L.d(K,"CMCDStreamingFormat",function(){return M}),L.d(K,"CMCDStreamType",function(){return N});var H=1,k;(function(_){_.MANIFEST="m",_.AUDIO="a",_.VIDEO="v",_.MUXED="av",_.INIT="i",_.CAPTION="c",_.TIMED_TEXT="tt",_.KEY="k",_.OTHER="o"})(k||(k={}));var M;(function(_){_.DASH="d",_.HLS="h",_.SMOOTH="s",_.OTHER="o"})(M||(M={}));var N;(function(_){_.VOD="v",_.LIVE="l"})(N||(N={}))},"./src/types/level.ts":function(Q,K,L){"use strict";L.r(K),L.d(K,"HlsSkip",function(){return M}),L.d(K,"getSkipValue",function(){return N}),L.d(K,"HlsUrlParameters",function(){return _}),L.d(K,"Level",function(){return P});function H(D,c){for(var v=0;v<c.length;v++){var O=c[v];O.enumerable=O.enumerable||!1,O.configurable=!0,"value"in O&&(O.writable=!0),Object.defineProperty(D,O.key,O)}}function k(D,c,v){return c&&H(D.prototype,c),v&&H(D,v),D}var M;(function(D){D.No="",D.Yes="YES",D.v2="v2"})(M||(M={}));function N(D,c){var v=D.canSkipUntil,O=D.canSkipDateRanges,w=D.endSN,b=c!==void 0?c-w:0;return v&&b<v?O?M.v2:M.Yes:M.No}var _=function(){function D(v,O,w){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=v,this.part=O,this.skip=w}var c=D.prototype;return c.addDirectives=function(O){var w=new self.URL(O);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()},D}(),P=function(){function D(c){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=[c.url],this.attrs=c.attrs,this.bitrate=c.bitrate,c.details&&(this.details=c.details),this.id=c.id||0,this.name=c.name,this.width=c.width||0,this.height=c.height||0,this.audioCodec=c.audioCodec,this.videoCodec=c.videoCodec,this.unknownCodecs=c.unknownCodecs,this.codecSet=[c.videoCodec,c.audioCodec].filter(function(v){return v}).join(",").replace(/\.[^.,]+/g,"")}return k(D,[{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(v){var O=v%this.url.length;this._urlId!==O&&(this.details=void 0,this._urlId=O)}}]),D}()},"./src/types/loader.ts":function(Q,K,L){"use strict";L.r(K),L.d(K,"PlaylistContextType",function(){return H}),L.d(K,"PlaylistLevelType",function(){return k});var H;(function(M){M.MANIFEST="manifest",M.LEVEL="level",M.AUDIO_TRACK="audioTrack",M.SUBTITLE_TRACK="subtitleTrack"})(H||(H={}));var k;(function(M){M.MAIN="main",M.AUDIO="audio",M.SUBTITLE="subtitle"})(k||(k={}))},"./src/types/transmuxer.ts":function(Q,K,L){"use strict";L.r(K),L.d(K,"ChunkMetadata",function(){return H});var H=function(N,_,P,D,c,v){D===void 0&&(D=0),c===void 0&&(c=-1),v===void 0&&(v=!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=k(),this.buffering={audio:k(),video:k(),audiovideo:k()},this.level=N,this.sn=_,this.id=P,this.size=D,this.part=c,this.partial=v};function k(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(Q,K,L){"use strict";L.r(K),L.d(K,"AttrList",function(){return M});var H=/^(\d+)x(\d+)$/,k=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,M=function(){function N(P){typeof P=="string"&&(P=N.parseAttrList(P));for(var D in P)P.hasOwnProperty(D)&&(this[D]=P[D])}var _=N.prototype;return _.decimalInteger=function(D){var c=parseInt(this[D],10);return c>Number.MAX_SAFE_INTEGER?Infinity:c},_.hexadecimalInteger=function(D){if(this[D]){var c=(this[D]||"0x").slice(2);c=(c.length&1?"0":"")+c;for(var v=new Uint8Array(c.length/2),O=0;O<c.length/2;O++)v[O]=parseInt(c.slice(O*2,O*2+2),16);return v}else return null},_.hexadecimalIntegerAsNumber=function(D){var c=parseInt(this[D],16);return c>Number.MAX_SAFE_INTEGER?Infinity:c},_.decimalFloatingPoint=function(D){return parseFloat(this[D])},_.optionalFloat=function(D,c){var v=this[D];return v?parseFloat(v):c},_.enumeratedString=function(D){return this[D]},_.bool=function(D){return this[D]==="YES"},_.decimalResolution=function(D){var c=H.exec(this[D]);return c===null?void 0:{width:parseInt(c[1],10),height:parseInt(c[2],10)}},N.parseAttrList=function(D){var c,v={},O='"';for(k.lastIndex=0;(c=k.exec(D))!==null;){var w=c[2];w.indexOf(O)===0&&w.lastIndexOf(O)===w.length-1&&(w=w.slice(1,-1)),v[c[1]]=w}return v},N}()},"./src/utils/binary-search.ts":function(Q,K,L){"use strict";L.r(K);var H={search:function(M,N){for(var _=0,P=M.length-1,D=null,c=null;_<=P;){D=(_+P)/2|0,c=M[D];var v=N(c);if(v>0)_=D+1;else if(v<0)P=D-1;else return c}return null}};K.default=H},"./src/utils/buffer-helper.ts":function(Q,K,L){"use strict";L.r(K),L.d(K,"BufferHelper",function(){return M});var H=L("./src/utils/logger.ts"),k={length:0,start:function(){return 0},end:function(){return 0}},M=function(){function N(){}return N.isBuffered=function(P,D){try{if(P){for(var c=N.getBuffered(P),v=0;v<c.length;v++)if(D>=c.start(v)&&D<=c.end(v))return!0}}catch(O){}return!1},N.bufferInfo=function(P,D,c){try{if(P){var v=N.getBuffered(P),O=[],w;for(w=0;w<v.length;w++)O.push({start:v.start(w),end:v.end(w)});return this.bufferedInfo(O,D,c)}}catch(b){}return{len:0,start:D,end:D,nextStart:void 0}},N.bufferedInfo=function(P,D,c){D=Math.max(0,D),P.sort(function(h,A){var T=h.start-A.start;return T||A.end-h.end});var v=[];if(c)for(var O=0;O<P.length;O++){var w=v.length;if(w){var b=v[w-1].end;P[O].start-b<c?P[O].end>b&&(v[w-1].end=P[O].end):v.push(P[O])}else v.push(P[O])}else v=P;for(var E=0,s,a=D,l=D,u=0;u<v.length;u++){var C=v[u].start,g=v[u].end;if(D+c>=C&&D<g)a=C,l=g,E=l-D;else if(D+c<C){s=C;break}}return{len:E,start:a||0,end:l||0,nextStart:s}},N.getBuffered=function(P){try{return P.buffered}catch(D){return H.logger.log("failed to get media.buffered",D),k}},N}()},"./src/utils/cea-608-parser.ts":function(Q,K,L){"use strict";L.r(K),L.d(K,"Row",function(){return l}),L.d(K,"CaptionScreen",function(){return u});var H=L("./src/utils/logger.ts"),k={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},M=function(m){var d=m;return k.hasOwnProperty(m)&&(d=k[m]),String.fromCharCode(d)},N=15,_=100,P={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},D={17:2,18:4,21:6,22:8,23:10,19:13,20:15},c={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},v={25:2,26:4,29:6,30:8,31:10,27:13,28:15},O=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],w;(function(f){f[f.ERROR=0]="ERROR",f[f.TEXT=1]="TEXT",f[f.WARNING=2]="WARNING",f[f.INFO=2]="INFO",f[f.DEBUG=3]="DEBUG",f[f.DATA=3]="DATA"})(w||(w={}));var b=function(){function f(){this.time=null,this.verboseLevel=w.ERROR}var m=f.prototype;return m.log=function(o,x){this.verboseLevel>=o&&H.logger.log(this.time+" ["+o+"] "+x)},f}(),E=function(m){for(var d=[],o=0;o<m.length;o++)d.push(m[o].toString(16));return d},s=function(){function f(d,o,x,y,p){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=d||"white",this.underline=o||!1,this.italics=x||!1,this.background=y||"black",this.flash=p||!1}var m=f.prototype;return m.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},m.setStyles=function(o){for(var x=["foreground","underline","italics","background","flash"],y=0;y<x.length;y++){var p=x[y];o.hasOwnProperty(p)&&(this[p]=o[p])}},m.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},m.equals=function(o){return this.foreground===o.foreground&&this.underline===o.underline&&this.italics===o.italics&&this.background===o.background&&this.flash===o.flash},m.copy=function(o){this.foreground=o.foreground,this.underline=o.underline,this.italics=o.italics,this.background=o.background,this.flash=o.flash},m.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},f}(),a=function(){function f(d,o,x,y,p,R){this.uchar=void 0,this.penState=void 0,this.uchar=d||" ",this.penState=new s(o,x,y,p,R)}var m=f.prototype;return m.reset=function(){this.uchar=" ",this.penState.reset()},m.setChar=function(o,x){this.uchar=o,this.penState.copy(x)},m.setPenState=function(o){this.penState.copy(o)},m.equals=function(o){return this.uchar===o.uchar&&this.penState.equals(o.penState)},m.copy=function(o){this.uchar=o.uchar,this.penState.copy(o.penState)},m.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},f}(),l=function(){function f(d){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var o=0;o<_;o++)this.chars.push(new a);this.logger=d,this.pos=0,this.currPenState=new s}var m=f.prototype;return m.equals=function(o){for(var x=!0,y=0;y<_;y++)if(!this.chars[y].equals(o.chars[y])){x=!1;break}return x},m.copy=function(o){for(var x=0;x<_;x++)this.chars[x].copy(o.chars[x])},m.isEmpty=function(){for(var o=!0,x=0;x<_;x++)if(!this.chars[x].isEmpty()){o=!1;break}return o},m.setCursor=function(o){this.pos!==o&&(this.pos=o),this.pos<0?(this.logger.log(w.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>_&&(this.logger.log(w.DEBUG,"Too large cursor position "+this.pos),this.pos=_)},m.moveCursor=function(o){var x=this.pos+o;if(o>1)for(var y=this.pos+1;y<x+1;y++)this.chars[y].setPenState(this.currPenState);this.setCursor(x)},m.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},m.insertChar=function(o){o>=144&&this.backSpace();var x=M(o);if(this.pos>=_){this.logger.log(w.ERROR,"Cannot insert "+o.toString(16)+" ("+x+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(x,this.currPenState),this.moveCursor(1)},m.clearFromPos=function(o){var x;for(x=o;x<_;x++)this.chars[x].reset()},m.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},m.clearToEndOfRow=function(){this.clearFromPos(this.pos)},m.getTextString=function(){for(var o=[],x=!0,y=0;y<_;y++){var p=this.chars[y].uchar;p!==" "&&(x=!1),o.push(p)}return x?"":o.join("")},m.setPenStyles=function(o){this.currPenState.setStyles(o);var x=this.chars[this.pos];x.setPenState(this.currPenState)},f}(),u=function(){function f(d){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var o=0;o<N;o++)this.rows.push(new l(d));this.logger=d,this.currRow=N-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var m=f.prototype;return m.reset=function(){for(var o=0;o<N;o++)this.rows[o].clear();this.currRow=N-1},m.equals=function(o){for(var x=!0,y=0;y<N;y++)if(!this.rows[y].equals(o.rows[y])){x=!1;break}return x},m.copy=function(o){for(var x=0;x<N;x++)this.rows[x].copy(o.rows[x])},m.isEmpty=function(){for(var o=!0,x=0;x<N;x++)if(!this.rows[x].isEmpty()){o=!1;break}return o},m.backSpace=function(){var o=this.rows[this.currRow];o.backSpace()},m.clearToEndOfRow=function(){var o=this.rows[this.currRow];o.clearToEndOfRow()},m.insertChar=function(o){var x=this.rows[this.currRow];x.insertChar(o)},m.setPen=function(o){var x=this.rows[this.currRow];x.setPenStyles(o)},m.moveCursor=function(o){var x=this.rows[this.currRow];x.moveCursor(o)},m.setCursor=function(o){this.logger.log(w.INFO,"setCursor: "+o);var x=this.rows[this.currRow];x.setCursor(o)},m.setPAC=function(o){this.logger.log(w.INFO,"pacData = "+JSON.stringify(o));var x=o.row-1;if(this.nrRollUpRows&&x<this.nrRollUpRows-1&&(x=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==x){for(var y=0;y<N;y++)this.rows[y].clear();var p=this.currRow+1-this.nrRollUpRows,R=this.lastOutputScreen;if(R){var U=R.rows[p].cueStartTime,B=this.logger.time;if(U&&B!==null&&U<B)for(var z=0;z<this.nrRollUpRows;z++)this.rows[x-this.nrRollUpRows+z+1].copy(R.rows[p+z])}}this.currRow=x;var j=this.rows[this.currRow];if(o.indent!==null){var F=o.indent,X=Math.max(F-1,0);j.setCursor(o.indent),o.color=j.chars[X].penState.foreground}var q={foreground:o.color,underline:o.underline,italics:o.italics,background:"black",flash:!1};this.setPen(q)},m.setBkgData=function(o){this.logger.log(w.INFO,"bkgData = "+JSON.stringify(o)),this.backSpace(),this.setPen(o),this.insertChar(32)},m.setRollUpRows=function(o){this.nrRollUpRows=o},m.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 o=this.currRow+1-this.nrRollUpRows,x=this.rows.splice(o,1)[0];x.clear(),this.rows.splice(this.currRow,0,x),this.logger.log(w.INFO,"Rolling up")},m.getDisplayText=function(o){o=o||!1;for(var x=[],y="",p=-1,R=0;R<N;R++){var U=this.rows[R].getTextString();U&&(p=R+1,o?x.push("Row "+p+": '"+U+"'"):x.push(U.trim()))}return x.length>0&&(o?y="["+x.join(" | ")+"]":y=x.join(`
`)),y},m.getTextAndFormat=function(){return this.rows},f}(),C=function(){function f(d,o,x){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=d,this.outputFilter=o,this.mode=null,this.verbose=0,this.displayedMemory=new u(x),this.nonDisplayedMemory=new u(x),this.lastOutputScreen=new u(x),this.currRollUpRow=this.displayedMemory.rows[N-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=x}var m=f.prototype;return m.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},m.getHandler=function(){return this.outputFilter},m.setHandler=function(o){this.outputFilter=o},m.setPAC=function(o){this.writeScreen.setPAC(o)},m.setBkgData=function(o){this.writeScreen.setBkgData(o)},m.setMode=function(o){if(o===this.mode)return;this.mode=o,this.logger.log(w.INFO,"MODE="+o),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=o},m.insertChars=function(o){for(var x=0;x<o.length;x++)this.writeScreen.insertChar(o[x]);var y=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(w.INFO,y+": "+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())},m.ccRCL=function(){this.logger.log(w.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},m.ccBS=function(){if(this.logger.log(w.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},m.ccAOF=function(){},m.ccAON=function(){},m.ccDER=function(){this.logger.log(w.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},m.ccRU=function(o){this.logger.log(w.INFO,"RU("+o+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(o)},m.ccFON=function(){this.logger.log(w.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},m.ccRDC=function(){this.logger.log(w.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},m.ccTR=function(){this.logger.log(w.INFO,"TR"),this.setMode("MODE_TEXT")},m.ccRTD=function(){this.logger.log(w.INFO,"RTD"),this.setMode("MODE_TEXT")},m.ccEDM=function(){this.logger.log(w.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},m.ccCR=function(){this.logger.log(w.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},m.ccENM=function(){this.logger.log(w.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},m.ccEOC=function(){if(this.logger.log(w.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var o=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=o,this.writeScreen=this.nonDisplayedMemory,this.logger.log(w.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},m.ccTO=function(o){this.logger.log(w.INFO,"TO("+o+") - Tab Offset"),this.writeScreen.moveCursor(o)},m.ccMIDROW=function(o){var x={flash:!1};if(x.underline=o%2===1,x.italics=o>=46,x.italics)x.foreground="white";else{var y=Math.floor(o/2)-16,p=["white","green","blue","cyan","red","yellow","magenta"];x.foreground=p[y]}this.logger.log(w.INFO,"MIDROW: "+JSON.stringify(x)),this.writeScreen.setPen(x)},m.outputDataUpdate=function(o){o===void 0&&(o=!1);var x=this.logger.time;if(x===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=x:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,x,this.lastOutputScreen),o&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:x),this.lastOutputScreen.copy(this.displayedMemory))},m.cueSplitAtTime=function(o){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,o,this.displayedMemory),this.cueStartTime=o))},f}(),g=function(){function f(d,o,x){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var y=new b;this.channels=[null,new C(d,o,y),new C(d+1,x,y)],this.cmdHistory=T(),this.logger=y}var m=f.prototype;return m.getHandler=function(o){return this.channels[o].getHandler()},m.setHandler=function(o,x){this.channels[o].setHandler(x)},m.addData=function(o,x){var y,p,R,U=!1;this.logger.time=o;for(var B=0;B<x.length;B+=2){if(p=x[B]&127,R=x[B+1]&127,p===0&&R===0)continue;if(this.logger.log(w.DATA,"["+E([x[B],x[B+1]])+"] -> ("+E([p,R])+")"),y=this.parseCmd(p,R),y||(y=this.parseMidrow(p,R)),y||(y=this.parsePAC(p,R)),y||(y=this.parseBackgroundAttributes(p,R)),!y&&(U=this.parseChars(p,R),U)){var z=this.currentChannel;if(z&&z>0){var j=this.channels[z];j.insertChars(U)}else this.logger.log(w.WARNING,"No channel found yet. TEXT-MODE?")}!y&&!U&&this.logger.log(w.WARNING,"Couldn't parse cleaned data "+E([p,R])+" orig: "+E([x[B],x[B+1]]))}},m.parseCmd=function(o,x){var y=this.cmdHistory,p=(o===20||o===28||o===21||o===29)&&x>=32&&x<=47,R=(o===23||o===31)&&x>=33&&x<=35;if(!(p||R))return!1;if(A(o,x,y))return h(null,null,y),this.logger.log(w.DEBUG,"Repeated command ("+E([o,x])+") is dropped"),!0;var U=o===20||o===21||o===23?1:2,B=this.channels[U];return o===20||o===21||o===28||o===29?x===32?B.ccRCL():x===33?B.ccBS():x===34?B.ccAOF():x===35?B.ccAON():x===36?B.ccDER():x===37?B.ccRU(2):x===38?B.ccRU(3):x===39?B.ccRU(4):x===40?B.ccFON():x===41?B.ccRDC():x===42?B.ccTR():x===43?B.ccRTD():x===44?B.ccEDM():x===45?B.ccCR():x===46?B.ccENM():x===47&&B.ccEOC():B.ccTO(x-32),h(o,x,y),this.currentChannel=U,!0},m.parseMidrow=function(o,x){var y=0;if((o===17||o===25)&&x>=32&&x<=47){if(o===17?y=1:y=2,y!==this.currentChannel)return this.logger.log(w.ERROR,"Mismatch channel in midrow parsing"),!1;var p=this.channels[y];return p?(p.ccMIDROW(x),this.logger.log(w.DEBUG,"MIDROW ("+E([o,x])+")"),!0):!1}return!1},m.parsePAC=function(o,x){var y,p=this.cmdHistory,R=(o>=17&&o<=23||o>=25&&o<=31)&&x>=64&&x<=127,U=(o===16||o===24)&&x>=64&&x<=95;if(!(R||U))return!1;if(A(o,x,p))return h(null,null,p),!0;var B=o<=23?1:2;x>=64&&x<=95?y=B===1?P[o]:c[o]:y=B===1?D[o]:v[o];var z=this.channels[B];return z?(z.setPAC(this.interpretPAC(y,x)),h(o,x,p),this.currentChannel=B,!0):!1},m.interpretPAC=function(o,x){var y,p={color:null,italics:!1,indent:null,underline:!1,row:o};return x>95?y=x-96:y=x-64,p.underline=(y&1)===1,y<=13?p.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(y/2)]:y<=15?(p.italics=!0,p.color="white"):p.indent=Math.floor((y-16)/2)*4,p},m.parseChars=function(o,x){var y,p=null,R=null;if(o>=25?(y=2,R=o-8):(y=1,R=o),R>=17&&R<=19){var U;R===17?U=x+80:R===18?U=x+112:U=x+144,this.logger.log(w.INFO,"Special char '"+M(U)+"' in channel "+y),p=[U]}else o>=32&&o<=127&&(p=x===0?[o]:[o,x]);if(p){var B=E(p);this.logger.log(w.DEBUG,"Char codes = "+B.join(",")),h(o,x,this.cmdHistory)}return p},m.parseBackgroundAttributes=function(o,x){var y=(o===16||o===24)&&x>=32&&x<=47,p=(o===23||o===31)&&x>=45&&x<=47;if(!(y||p))return!1;var R,U={};o===16||o===24?(R=Math.floor((x-32)/2),U.background=O[R],x%2===1&&(U.background=U.background+"_semi")):x===45?U.background="transparent":(U.foreground="black",x===47&&(U.underline=!0));var B=o<=23?1:2,z=this.channels[B];return z.setBkgData(U),h(o,x,this.cmdHistory),!0},m.reset=function(){for(var o=0;o<Object.keys(this.channels).length;o++){var x=this.channels[o];x&&x.reset()}this.cmdHistory=T()},m.cueSplitAtTime=function(o){for(var x=0;x<this.channels.length;x++){var y=this.channels[x];y&&y.cueSplitAtTime(o)}},f}();function h(f,m,d){d.a=f,d.b=m}function A(f,m,d){return d.a===f&&d.b===m}function T(){return{a:null,b:null}}K.default=g},"./src/utils/codecs.ts":function(Q,K,L){"use strict";L.r(K),L.d(K,"isCodecType",function(){return k}),L.d(K,"isCodecSupportedInMp4",function(){return M});var H={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 k(N,_){var P=H[_];return!!P&&P[N.slice(0,4)]===!0}function M(N,_){return MediaSource.isTypeSupported((_||"video")+'/mp4;codecs="'+N+'"')}},"./src/utils/cues.ts":function(Q,K,L){"use strict";L.r(K);var H=L("./src/utils/vttparser.ts"),k=L("./src/utils/webvtt-parser.ts"),M=L("./src/utils/texttrack-utils.ts"),N=/\s/,_={newCue:function(D,c,v,O){for(var w=[],b,E,s,a,l,u=self.VTTCue||self.TextTrackCue,C=0;C<O.rows.length;C++)if(b=O.rows[C],s=!0,a=0,l="",!b.isEmpty()){for(var g=0;g<b.chars.length;g++)N.test(b.chars[g].uchar)&&s?a++:(l+=b.chars[g].uchar,s=!1);b.cueStartTime=c,c===v&&(v+=1e-4),a>=16?a--:a++;var h=Object(H.fixLineBreaks)(l.trim()),A=Object(k.generateCueId)(c,v,h);(!D||!D.cues||!D.cues.getCueById(A))&&(E=new u(c,v,h),E.id=A,E.line=C+1,E.align="left",E.position=10+Math.min(80,Math.floor(a*8/32)*10),w.push(E))}return D&&w.length&&(w.sort(function(T,f){return T.line==="auto"||f.line==="auto"?0:T.line>8&&f.line>8?f.line-T.line:T.line-f.line}),w.forEach(function(T){return Object(M.addCueToTrack)(D,T)})),w}};K.default=_},"./src/utils/discontinuities.ts":function(Q,K,L){"use strict";L.r(K),L.d(K,"findFirstFragWithCC",function(){return N}),L.d(K,"shouldAlignOnDiscontinuities",function(){return _}),L.d(K,"findDiscontinuousReferenceFrag",function(){return P}),L.d(K,"adjustSlidingStart",function(){return c}),L.d(K,"alignStream",function(){return v}),L.d(K,"alignPDT",function(){return w}),L.d(K,"alignFragmentByPDTDelta",function(){return b}),L.d(K,"alignMediaPlaylistByPDT",function(){return E});var H=L("./src/polyfills/number.ts"),k=L("./src/utils/logger.ts"),M=L("./src/controller/level-helper.ts");function N(s,a){for(var l=null,u=0,C=s.length;u<C;u++){var g=s[u];if(g&&g.cc===a){l=g;break}}return l}function _(s,a,l){return!!(a.details&&(l.endCC>l.startCC||s&&s.cc<l.startCC))}function P(s,a){var l=s.fragments,u=a.fragments;if(!u.length||!l.length){k.logger.log("No fragments to align");return}var C=N(l,u[0].cc);if(!C||C&&!C.startPTS){k.logger.log("No frag in previous level to align on");return}return C}function D(s,a){if(s){var l=s.start+a;s.start=s.startPTS=l,s.endPTS=l+s.duration}}function c(s,a){for(var l=a.fragments,u=0,C=l.length;u<C;u++)D(l[u],s);a.fragmentHint&&D(a.fragmentHint,s),a.alignedSliding=!0}function v(s,a,l){if(!a)return;O(s,l,a),!l.alignedSliding&&a.details&&w(l,a.details),!l.alignedSliding&&a.details&&!l.skippedSegments&&Object(M.adjustSliding)(a.details,l)}function O(s,a,l){if(_(s,l,a)){var u=P(l.details,a);u&&Object(H.isFiniteNumber)(u.start)&&(k.logger.log("Adjusting PTS using last level due to CC increase within current level "+a.url),c(u.start,a))}}function w(s,a){if(!a.fragments.length||!s.hasProgramDateTime||!a.hasProgramDateTime)return;var l=a.fragments[0].programDateTime,u=s.fragments[0].programDateTime,C=(u-l)/1e3+a.fragments[0].start;C&&Object(H.isFiniteNumber)(C)&&(k.logger.log("Adjusting PTS using programDateTime delta "+(u-l)+"ms, sliding:"+C.toFixed(3)+" "+s.url+" "),c(C,s))}function b(s,a){var l=s.programDateTime;if(!l)return;var u=(l-a)/1e3;s.start=s.startPTS=u,s.endPTS=u+s.duration}function E(s,a){if(!a.fragments.length||!s.hasProgramDateTime||!a.hasProgramDateTime)return;var l=a.fragments[0].programDateTime,u=a.fragments[0].start,C=l-u*1e3;s.fragments.forEach(function(g){b(g,C)}),s.fragmentHint&&b(s.fragmentHint,C),s.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(Q,K,L){"use strict";L.r(K);var H=L("./src/utils/ewma.ts"),k=function(){function M(_,P,D){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=D,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new H.default(_),this.fast_=new H.default(P)}var N=M.prototype;return N.update=function(P,D){var c=this.slow_,v=this.fast_;this.slow_.halfLife!==P&&(this.slow_=new H.default(P,c.getEstimate(),c.getTotalWeight())),this.fast_.halfLife!==D&&(this.fast_=new H.default(D,v.getEstimate(),v.getTotalWeight()))},N.sample=function(P,D){P=Math.max(P,this.minDelayMs_);var c=8*D,v=P/1e3,O=c/v;this.fast_.sample(v,O),this.slow_.sample(v,O)},N.canEstimate=function(){var P=this.fast_;return P&&P.getTotalWeight()>=this.minWeight_},N.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},N.destroy=function(){},M}();K.default=k},"./src/utils/ewma.ts":function(Q,K,L){"use strict";L.r(K);var H=function(){function k(N,_,P){_===void 0&&(_=0),P===void 0&&(P=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_=_,this.totalWeight_=P}var M=k.prototype;return M.sample=function(_,P){var D=Math.pow(this.alpha_,_);this.estimate_=P*(1-D)+D*this.estimate_,this.totalWeight_+=_},M.getTotalWeight=function(){return this.totalWeight_},M.getEstimate=function(){if(this.alpha_){var _=1-Math.pow(this.alpha_,this.totalWeight_);if(_)return this.estimate_/_}return this.estimate_},k}();K.default=H},"./src/utils/fetch-loader.ts":function(Q,K,L){"use strict";L.r(K),L.d(K,"fetchSupported",function(){return b});var H=L("./src/polyfills/number.ts"),k=L("./src/loader/load-stats.ts"),M=L("./src/demux/chunk-cache.ts");function N(u,C){u.prototype=Object.create(C.prototype),u.prototype.constructor=u,v(u,C)}function _(u){var C=typeof Map=="function"?new Map:void 0;return _=function(h){if(h===null||!c(h))return h;if(typeof h!="function")throw new TypeError("Super expression must either be null or a function");if(typeof C!="undefined"){if(C.has(h))return C.get(h);C.set(h,A)}function A(){return P(h,arguments,O(this).constructor)}return A.prototype=Object.create(h.prototype,{constructor:{value:A,enumerable:!1,writable:!0,configurable:!0}}),v(A,h)},_(u)}function P(u,C,g){return D()?P=Reflect.construct:P=function(A,T,f){var m=[null];m.push.apply(m,T);var d=Function.bind.apply(A,m),o=new d;return f&&v(o,f.prototype),o},P.apply(null,arguments)}function D(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(u){return!1}}function c(u){return Function.toString.call(u).indexOf("[native code]")!==-1}function v(u,C){return v=Object.setPrototypeOf||function(h,A){return h.__proto__=A,h},v(u,C)}function O(u){return O=Object.setPrototypeOf?Object.getPrototypeOf:function(g){return g.__proto__||Object.getPrototypeOf(g)},O(u)}function w(){return w=Object.assign||function(u){for(var C=1;C<arguments.length;C++){var g=arguments[C];for(var h in g)Object.prototype.hasOwnProperty.call(g,h)&&(u[h]=g[h])}return u},w.apply(this,arguments)}function b(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(u){}return!1}var E=function(){function u(g){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=g.fetchSetup||a,this.controller=new self.AbortController,this.stats=new k.LoadStats}var C=u.prototype;return C.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},C.abortInternal=function(){var h=this.response;(!h||!h.ok)&&(this.stats.aborted=!0,this.controller.abort())},C.abort=function(){var h;this.abortInternal(),(h=this.callbacks)!==null&&h!==void 0&&h.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},C.load=function(h,A,T){var f=this,m=this.stats;if(m.loading.start)throw new Error("Loader can only be used once.");m.loading.start=self.performance.now();var d=s(h,this.controller.signal),o=T.onProgress,x=h.responseType==="arraybuffer",y=x?"byteLength":"length";this.context=h,this.config=A,this.callbacks=T,this.request=this.fetchSetup(h,d),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){f.abortInternal(),T.onTimeout(m,h,f.response)},A.timeout),self.fetch(this.request).then(function(p){if(f.response=f.loader=p,!p.ok){var R=p.status,U=p.statusText;throw new l(U||"fetch, bad network response",R,p)}return m.loading.first=Math.max(self.performance.now(),m.loading.start),m.total=parseInt(p.headers.get("Content-Length")||"0"),o&&Object(H.isFiniteNumber)(A.highWaterMark)?f.loadProgressively(p,m,h,A.highWaterMark,o):x?p.arrayBuffer():p.text()}).then(function(p){var R=f.response;self.clearTimeout(f.requestTimeout),m.loading.end=Math.max(self.performance.now(),m.loading.first),m.loaded=m.total=p[y];var U={url:R.url,data:p};o&&!Object(H.isFiniteNumber)(A.highWaterMark)&&o(m,h,p,R),T.onSuccess(U,m,h,R)}).catch(function(p){if(self.clearTimeout(f.requestTimeout),m.aborted)return;var R=p.code||0;T.onError({code:R,text:p.message},h,p.details)})},C.getCacheAge=function(){var h=null;if(this.response){var A=this.response.headers.get("age");h=A?parseFloat(A):null}return h},C.loadProgressively=function(h,A,T,f,m){f===void 0&&(f=0);var d=new M.default,o=h.body.getReader(),x=function y(){return o.read().then(function(p){if(p.done)return d.dataLength&&m(A,T,d.flush(),h),Promise.resolve(new ArrayBuffer(0));var R=p.value,U=R.length;return A.loaded+=U,U<f||d.dataLength?(d.push(R),d.dataLength>=f&&m(A,T,d.flush(),h)):m(A,T,R,h),y()}).catch(function(){return Promise.reject()})};return x()},u}();function s(u,C){var g={method:"GET",mode:"cors",credentials:"same-origin",signal:C,headers:new self.Headers(w({},u.headers))};return u.rangeEnd&&g.headers.set("Range","bytes="+u.rangeStart+"-"+String(u.rangeEnd-1)),g}function a(u,C){return new self.Request(u.url,C)}var l=function(u){N(C,u);function C(g,h,A){var T;return T=u.call(this,g)||this,T.code=void 0,T.details=void 0,T.code=h,T.details=A,T}return C}(_(Error));K.default=E},"./src/utils/imsc1-ttml-parser.ts":function(Q,K,L){"use strict";L.r(K),L.d(K,"IMSC1_CODEC",function(){return c}),L.d(K,"parseIMSC1",function(){return b});var H=L("./src/utils/mp4-tools.ts"),k=L("./src/utils/vttparser.ts"),M=L("./src/utils/vttcue.ts"),N=L("./src/demux/id3.ts"),_=L("./src/utils/timescale-conversion.ts"),P=L("./src/utils/webvtt-parser.ts");function D(){return D=Object.assign||function(f){for(var m=1;m<arguments.length;m++){var d=arguments[m];for(var o in d)Object.prototype.hasOwnProperty.call(d,o)&&(f[o]=d[o])}return f},D.apply(this,arguments)}var c="stpp.ttml.im1t",v=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,O=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,w={left:"start",center:"center",right:"end",start:"start",end:"end"};function b(f,m,d,o,x){var y=Object(H.findBox)(new Uint8Array(f),["mdat"]);if(y.length===0){x(new Error("Could not parse IMSC1 mdat"));return}var p=y[0],R=Object(N.utf8ArrayToStr)(new Uint8Array(f,p.start,p.end-p.start)),U=Object(_.toTimescaleFromScale)(m,1,d);try{o(E(R,U))}catch(B){x(B)}}function E(f,m){var d=new DOMParser,o=d.parseFromString(f,"text/xml"),x=o.getElementsByTagName("tt")[0];if(!x)throw new Error("Invalid ttml");var y={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},p=Object.keys(y).reduce(function(j,F){return j[F]=x.getAttribute("ttp:"+F)||y[F],j},{}),R=x.getAttribute("xml:space")!=="preserve",U=a(s(x,"styling","style")),B=a(s(x,"layout","region")),z=s(x,"body","[begin]");return[].map.call(z,function(j){var F=l(j,R);if(!F||!j.hasAttribute("begin"))return null;var X=h(j.getAttribute("begin"),p),q=h(j.getAttribute("dur"),p),ne=h(j.getAttribute("end"),p);if(X===null)throw g(j);if(ne===null){if(q===null)throw g(j);ne=X+q}var ue=new M.default(X-m,ne-m,F);ue.id=Object(P.generateCueId)(ue.startTime,ue.endTime,ue.text);var xe=B[j.getAttribute("region")],pe=U[j.getAttribute("style")];ue.position=10,ue.size=80;var he=u(xe,pe),de=he.textAlign;if(de){var fe=w[de];fe&&(ue.lineAlign=fe),ue.align=de}return D(ue,he),ue}).filter(function(j){return j!==null})}function s(f,m,d){var o=f.getElementsByTagName(m)[0];return o?[].slice.call(o.querySelectorAll(d)):[]}function a(f){return f.reduce(function(m,d){var o=d.getAttribute("xml:id");return o&&(m[o]=d),m},{})}function l(f,m){return[].slice.call(f.childNodes).reduce(function(d,o,x){var y;return o.nodeName==="br"&&x?d+`
`:(y=o.childNodes)!==null&&y!==void 0&&y.length?l(o,m):m?d+o.textContent.trim().replace(/\s+/g," "):d+o.textContent},"")}function u(f,m){var d="http://www.w3.org/ns/ttml#styling",o=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return o.reduce(function(x,y){var p=C(m,d,y)||C(f,d,y);return p&&(x[y]=p),x},{})}function C(f,m,d){return f.hasAttributeNS(m,d)?f.getAttributeNS(m,d):null}function g(f){return new Error("Could not parse ttml timestamp "+f)}function h(f,m){if(!f)return null;var d=Object(k.parseTimeStamp)(f);return d===null&&(v.test(f)?d=A(f,m):O.test(f)&&(d=T(f,m))),d}function A(f,m){var d=v.exec(f),o=(d[4]|0)+(d[5]|0)/m.subFrameRate;return(d[1]|0)*3600+(d[2]|0)*60+(d[3]|0)+o/m.frameRate}function T(f,m){var d=O.exec(f),o=Number(d[1]),x=d[2];switch(x){case"h":return o*3600;case"m":return o*60;case"ms":return o*1e3;case"f":return o/m.frameRate;case"t":return o/m.tickRate}return o}},"./src/utils/logger.ts":function(Q,K,L){"use strict";L.r(K),L.d(K,"enableLogs",function(){return P}),L.d(K,"logger",function(){return D});var H=function(){},k={trace:H,debug:H,log:H,warn:H,info:H,error:H},M=k;function N(c){var v=self.console[c];return v?v.bind(self.console,"["+c+"] >"):H}function _(c){for(var v=arguments.length,O=new Array(v>1?v-1:0),w=1;w<v;w++)O[w-1]=arguments[w];O.forEach(function(b){M[b]=c[b]?c[b].bind(c):N(b)})}function P(c){if(self.console&&c===!0||typeof c=="object"){_(c,"debug","log","info","warn","error");try{M.log()}catch(v){M=k}}else M=k}var D=M},"./src/utils/mediakeys-helper.ts":function(Q,K,L){"use strict";L.r(K),L.d(K,"KeySystems",function(){return H}),L.d(K,"requestMediaKeySystemAccess",function(){return k});var H;(function(M){M.WIDEVINE="com.widevine.alpha",M.PLAYREADY="com.microsoft.playready"})(H||(H={}));var k=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(Q,K,L){"use strict";L.r(K),L.d(K,"getMediaSource",function(){return H});function H(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(Q,K,L){"use strict";L.r(K),L.d(K,"bin2str",function(){return _}),L.d(K,"readUint16",function(){return P}),L.d(K,"readUint32",function(){return D}),L.d(K,"writeUint32",function(){return c}),L.d(K,"findBox",function(){return v}),L.d(K,"parseSegmentIndex",function(){return O}),L.d(K,"parseInitSegment",function(){return w}),L.d(K,"getStartDTS",function(){return b}),L.d(K,"getDuration",function(){return E}),L.d(K,"computeRawDurationFromSamples",function(){return s}),L.d(K,"offsetStartDTS",function(){return a}),L.d(K,"segmentValidRange",function(){return l}),L.d(K,"appendUint8Array",function(){return u});var H=L("./src/utils/typed-array.ts"),k=L("./src/loader/fragment.ts"),M=Math.pow(2,32)-1,N=[].push;function _(C){return String.fromCharCode.apply(null,C)}function P(C,g){"data"in C&&(g+=C.start,C=C.data);var h=C[g]<<8|C[g+1];return h<0?65536+h:h}function D(C,g){"data"in C&&(g+=C.start,C=C.data);var h=C[g]<<24|C[g+1]<<16|C[g+2]<<8|C[g+3];return h<0?4294967296+h:h}function c(C,g,h){"data"in C&&(g+=C.start,C=C.data),C[g]=h>>24,C[g+1]=h>>16&255,C[g+2]=h>>8&255,C[g+3]=h&255}function v(C,g){var h=[];if(!g.length)return h;var A,T,f;"data"in C?(A=C.data,T=C.start,f=C.end):(A=C,T=0,f=A.byteLength);for(var m=T;m<f;){var d=D(A,m),o=_(A.subarray(m+4,m+8)),x=d>1?m+d:f;if(o===g[0])if(g.length===1)h.push({data:A,start:m+8,end:x});else{var y=v({data:A,start:m+8,end:x},g.slice(1));y.length&&N.apply(h,y)}m=x}return h}function O(C){var g=v(C,["moov"]),h=g[0],A=h?h.end:null,T=v(C,["sidx"]);if(!T||!T[0])return null;var f=[],m=T[0],d=m.data[0],o=d===0?8:16,x=D(m,o);o+=4;var y=0,p=0;d===0?o+=8:o+=16,o+=2;var R=m.end+p,U=P(m,o);o+=2;for(var B=0;B<U;B++){var z=o,j=D(m,z);z+=4;var F=j&2147483647,X=(j&2147483648)>>>31;if(X===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var q=D(m,z);z+=4,f.push({referenceSize:F,subsegmentDuration:q,info:{duration:q/x,start:R,end:R+F-1}}),R+=F,z+=4,o=z}return{earliestPresentationTime:y,timescale:x,version:d,referencesCount:U,references:f,moovEndOffset:A}}function w(C){for(var g=[],h=v(C,["moov","trak"]),A=0;A<h.length;A++){var T=h[A],f=v(T,["tkhd"])[0];if(f){var m=f.data[f.start],d=m===0?12:20,o=D(f,d),x=v(T,["mdia","mdhd"])[0];if(x){m=x.data[x.start],d=m===0?12:20;var y=D(x,d),p=v(T,["mdia","hdlr"])[0];if(p){var R=_(p.data.subarray(p.start+8,p.start+12)),U={soun:k.ElementaryStreamTypes.AUDIO,vide:k.ElementaryStreamTypes.VIDEO}[R];if(U){var B=v(T,["mdia","minf","stbl","stsd"])[0],z=void 0;B&&(z=_(B.data.subarray(B.start+12,B.start+16))),g[o]={timescale:y,type:U},g[U]={timescale:y,id:o,codec:z}}}}}}var j=v(C,["moov","mvex","trex"]);return j.forEach(function(F){var X=D(F,4),q=g[X];q&&(q.default={duration:D(F,12),flags:D(F,20)})}),g}function b(C,g){return v(g,["moof","traf"]).reduce(function(h,A){var T=v(A,["tfdt"])[0],f=T.data[T.start],m=v(A,["tfhd"]).reduce(function(d,o){var x=D(o,4),y=C[x];if(y){var p=D(T,4);f===1&&(p*=Math.pow(2,32),p+=D(T,8));var R=y.timescale||9e4,U=p/R;if(isFinite(U)&&(d===null||U<d))return U}return d},null);return m!==null&&isFinite(m)&&(h===null||m<h)?m:h},null)||0}function E(C,g){for(var h=0,A=0,T=0,f=v(C,["moof","traf"]),m=0;m<f.length;m++){var d=f[m],o=v(d,["tfhd"])[0],x=D(o,4),y=g[x];if(!y)continue;var p=y.default,R=D(o,0)|(p==null?void 0:p.flags),U=p==null?void 0:p.duration;R&8&&(R&2?U=D(o,12):U=D(o,8));for(var B=y.timescale||9e4,z=v(d,["trun"]),j=0;j<z.length;j++){if(U){var F=D(z[j],4);h=U*F}else h=s(z[j]);y.type===k.ElementaryStreamTypes.VIDEO?A+=h/B:y.type===k.ElementaryStreamTypes.AUDIO&&(T+=h/B)}}if(A===0&&T===0){var X=O(C);if(X!=null&&X.references)return X.references.reduce(function(q,ne){return q+ne.info.duration||0},0)}return A||T}function s(C){var g=D(C,0),h=8;g&1&&(h+=4),g&4&&(h+=4);for(var A=0,T=D(C,4),f=0;f<T;f++){if(g&256){var m=D(C,h);A+=m,h+=4}g&512&&(h+=4),g&1024&&(h+=4),g&2048&&(h+=4)}return A}function a(C,g,h){v(g,["moof","traf"]).forEach(function(A){v(A,["tfhd"]).forEach(function(T){var f=D(T,4),m=C[f];if(!m)return;var d=m.timescale||9e4;v(A,["tfdt"]).forEach(function(o){var x=o.data[o.start],y=D(o,4);if(x===0)c(o,4,y-h*d);else{y*=Math.pow(2,32),y+=D(o,8),y-=h*d,y=Math.max(y,0);var p=Math.floor(y/(M+1)),R=Math.floor(y%(M+1));c(o,4,p),c(o,8,R)}})})})}function l(C){var g={valid:null,remainder:null},h=v(C,["moof"]);if(h){if(h.length<2)return g.remainder=C,g}else return g;var A=h[h.length-1];return g.valid=Object(H.sliceUint8)(C,0,A.start-8),g.remainder=Object(H.sliceUint8)(C,A.start-8),g}function u(C,g){var h=new Uint8Array(C.length+g.length);return h.set(C),h.set(g,C.length),h}},"./src/utils/output-filter.ts":function(Q,K,L){"use strict";L.r(K),L.d(K,"default",function(){return H});var H=function(){function k(N,_){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=N,this.trackName=_}var M=k.prototype;return M.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},M.newCue=function(_,P,D){(this.startTime===null||this.startTime>_)&&(this.startTime=_),this.endTime=P,this.screen=D,this.timelineController.createCaptionsTrack(this.trackName)},M.reset=function(){this.cueRanges=[]},k}()},"./src/utils/texttrack-utils.ts":function(Q,K,L){"use strict";L.r(K),L.d(K,"sendAddTrackEvent",function(){return k}),L.d(K,"addCueToTrack",function(){return M}),L.d(K,"clearCurrentCues",function(){return N}),L.d(K,"removeCuesInRange",function(){return _}),L.d(K,"getCuesInRange",function(){return D});var H=L("./src/utils/logger.ts");function k(c,v){var O;try{O=new Event("addtrack")}catch(w){O=document.createEvent("Event"),O.initEvent("addtrack",!1,!1)}O.track=c,v.dispatchEvent(O)}function M(c,v){var O=c.mode;if(O==="disabled"&&(c.mode="hidden"),c.cues&&!c.cues.getCueById(v.id))try{if(c.addCue(v),!c.cues.getCueById(v.id))throw new Error("addCue is failed for: "+v)}catch(b){H.logger.debug("[texttrack-utils]: "+b);var w=new self.TextTrackCue(v.startTime,v.endTime,v.text);w.id=v.id,c.addCue(w)}O==="disabled"&&(c.mode=O)}function N(c){var v=c.mode;if(v==="disabled"&&(c.mode="hidden"),c.cues)for(var O=c.cues.length;O--;)c.removeCue(c.cues[O]);v==="disabled"&&(c.mode=v)}function _(c,v,O){var w=c.mode;if(w==="disabled"&&(c.mode="hidden"),c.cues&&c.cues.length>0)for(var b=D(c.cues,v,O),E=0;E<b.length;E++)c.removeCue(b[E]);w==="disabled"&&(c.mode=w)}function P(c,v){if(v<c[0].startTime)return 0;var O=c.length-1;if(v>c[O].endTime)return-1;for(var w=0,b=O;w<=b;){var E=Math.floor((b+w)/2);if(v<c[E].startTime)b=E-1;else if(v>c[E].startTime&&w<O)w=E+1;else return E}return c[w].startTime-v<v-c[b].startTime?w:b}function D(c,v,O){var w=[],b=P(c,v);if(b>-1)for(var E=b,s=c.length;E<s;E++){var a=c[E];if(a.startTime>=v&&a.endTime<=O)w.push(a);else if(a.startTime>O)return w}return w}},"./src/utils/time-ranges.ts":function(Q,K,L){"use strict";L.r(K);var H={toString:function(M){for(var N="",_=M.length,P=0;P<_;P++)N+="["+M.start(P).toFixed(3)+","+M.end(P).toFixed(3)+"]";return N}};K.default=H},"./src/utils/timescale-conversion.ts":function(Q,K,L){"use strict";L.r(K),L.d(K,"toTimescaleFromBase",function(){return k}),L.d(K,"toTimescaleFromScale",function(){return M}),L.d(K,"toMsFromMpegTsClock",function(){return N}),L.d(K,"toMpegTsClockFromTimescale",function(){return _});var H=9e4;function k(P,D,c,v){c===void 0&&(c=1),v===void 0&&(v=!1);var O=P*D*c;return v?Math.round(O):O}function M(P,D,c,v){return c===void 0&&(c=1),v===void 0&&(v=!1),k(P,D,1/c,v)}function N(P,D){return D===void 0&&(D=!1),k(P,1e3,1/H,D)}function _(P,D){return D===void 0&&(D=1),k(P,H,1/D)}},"./src/utils/typed-array.ts":function(Q,K,L){"use strict";L.r(K),L.d(K,"sliceUint8",function(){return H});function H(k,M,N){return Uint8Array.prototype.slice?k.slice(M,N):new Uint8Array(Array.prototype.slice.call(k,M,N))}},"./src/utils/vttcue.ts":function(Q,K,L){"use strict";L.r(K),K.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var H=["","lr","rl"],k=["start","middle","end","left","right"];function M(c,v){if(typeof v!="string")return!1;if(!Array.isArray(c))return!1;var O=v.toLowerCase();return~c.indexOf(O)?O:!1}function N(c){return M(H,c)}function _(c){return M(k,c)}function P(c){for(var v=arguments.length,O=new Array(v>1?v-1:0),w=1;w<v;w++)O[w-1]=arguments[w];for(var b=1;b<arguments.length;b++){var E=arguments[b];for(var s in E)c[s]=E[s]}return c}function D(c,v,O){var w=this,b={enumerable:!0};w.hasBeenReset=!1;var E="",s=!1,a=c,l=v,u=O,C=null,g="",h=!0,A="auto",T="start",f=50,m="middle",d=50,o="middle";Object.defineProperty(w,"id",P({},b,{get:function(){return E},set:function(y){E=""+y}})),Object.defineProperty(w,"pauseOnExit",P({},b,{get:function(){return s},set:function(y){s=!!y}})),Object.defineProperty(w,"startTime",P({},b,{get:function(){return a},set:function(y){if(typeof y!="number")throw new TypeError("Start time must be set to a number.");a=y,this.hasBeenReset=!0}})),Object.defineProperty(w,"endTime",P({},b,{get:function(){return l},set:function(y){if(typeof y!="number")throw new TypeError("End time must be set to a number.");l=y,this.hasBeenReset=!0}})),Object.defineProperty(w,"text",P({},b,{get:function(){return u},set:function(y){u=""+y,this.hasBeenReset=!0}})),Object.defineProperty(w,"region",P({},b,{get:function(){return C},set:function(y){C=y,this.hasBeenReset=!0}})),Object.defineProperty(w,"vertical",P({},b,{get:function(){return g},set:function(y){var p=N(y);if(p===!1)throw new SyntaxError("An invalid or illegal string was specified.");g=p,this.hasBeenReset=!0}})),Object.defineProperty(w,"snapToLines",P({},b,{get:function(){return h},set:function(y){h=!!y,this.hasBeenReset=!0}})),Object.defineProperty(w,"line",P({},b,{get:function(){return A},set:function(y){if(typeof y!="number"&&y!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");A=y,this.hasBeenReset=!0}})),Object.defineProperty(w,"lineAlign",P({},b,{get:function(){return T},set:function(y){var p=_(y);if(!p)throw new SyntaxError("An invalid or illegal string was specified.");T=p,this.hasBeenReset=!0}})),Object.defineProperty(w,"position",P({},b,{get:function(){return f},set:function(y){if(y<0||y>100)throw new Error("Position must be between 0 and 100.");f=y,this.hasBeenReset=!0}})),Object.defineProperty(w,"positionAlign",P({},b,{get:function(){return m},set:function(y){var p=_(y);if(!p)throw new SyntaxError("An invalid or illegal string was specified.");m=p,this.hasBeenReset=!0}})),Object.defineProperty(w,"size",P({},b,{get:function(){return d},set:function(y){if(y<0||y>100)throw new Error("Size must be between 0 and 100.");d=y,this.hasBeenReset=!0}})),Object.defineProperty(w,"align",P({},b,{get:function(){return o},set:function(y){var p=_(y);if(!p)throw new SyntaxError("An invalid or illegal string was specified.");o=p,this.hasBeenReset=!0}})),w.displayState=void 0}return D.prototype.getCueAsHTML=function(){var c=self.WebVTT;return c.convertCueToDOMTree(self,this.text)},D}()},"./src/utils/vttparser.ts":function(Q,K,L){"use strict";L.r(K),L.d(K,"parseTimeStamp",function(){return M}),L.d(K,"fixLineBreaks",function(){return v}),L.d(K,"VTTParser",function(){return O});var H=L("./src/utils/vttcue.ts"),k=function(){function w(){}var b=w.prototype;return b.decode=function(s,a){if(!s)return"";if(typeof s!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(s))},w}();function M(w){function b(s,a,l,u){return(s|0)*3600+(a|0)*60+(l|0)+parseFloat(u||0)}var E=w.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return E?parseFloat(E[2])>59?b(E[2],E[3],0,E[4]):b(E[1],E[2],E[3],E[4]):null}var N=function(){function w(){this.values=Object.create(null)}var b=w.prototype;return b.set=function(s,a){!this.get(s)&&a!==""&&(this.values[s]=a)},b.get=function(s,a,l){return l?this.has(s)?this.values[s]:a[l]:this.has(s)?this.values[s]:a},b.has=function(s){return s in this.values},b.alt=function(s,a,l){for(var u=0;u<l.length;++u)if(a===l[u]){this.set(s,a);break}},b.integer=function(s,a){/^-?\d+$/.test(a)&&this.set(s,parseInt(a,10))},b.percent=function(s,a){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(a)){var l=parseFloat(a);if(l>=0&&l<=100)return this.set(s,l),!0}return!1},w}();function _(w,b,E,s){var a=s?w.split(s):[w];for(var l in a){if(typeof a[l]!="string")continue;var u=a[l].split(E);if(u.length!==2)continue;var C=u[0],g=u[1];b(C,g)}}var P=new H.default(0,0,""),D=P.align==="middle"?"middle":"center";function c(w,b,E){var s=w;function a(){var C=M(w);if(C===null)throw new Error("Malformed timestamp: "+s);return w=w.replace(/^[^\sa-zA-Z-]+/,""),C}function l(C,g){var h=new N;_(C,function(f,m){var d;switch(f){case"region":for(var o=E.length-1;o>=0;o--)if(E[o].id===m){h.set(f,E[o].region);break}break;case"vertical":h.alt(f,m,["rl","lr"]);break;case"line":d=m.split(","),h.integer(f,d[0]),h.percent(f,d[0])&&h.set("snapToLines",!1),h.alt(f,d[0],["auto"]),d.length===2&&h.alt("lineAlign",d[1],["start",D,"end"]);break;case"position":d=m.split(","),h.percent(f,d[0]),d.length===2&&h.alt("positionAlign",d[1],["start",D,"end","line-left","line-right","auto"]);break;case"size":h.percent(f,m);break;case"align":h.alt(f,m,["start",D,"end","left","right"]);break}},/:/,/\s/),g.region=h.get("region",null),g.vertical=h.get("vertical","");var A=h.get("line","auto");A==="auto"&&P.line===-1&&(A=-1),g.line=A,g.lineAlign=h.get("lineAlign","start"),g.snapToLines=h.get("snapToLines",!0),g.size=h.get("size",100),g.align=h.get("align",D);var T=h.get("position","auto");T==="auto"&&P.position===50&&(T=g.align==="start"||g.align==="left"?0:g.align==="end"||g.align==="right"?100:50),g.position=T}function u(){w=w.replace(/^\s+/,"")}if(u(),b.startTime=a(),u(),w.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+s);w=w.substr(3),u(),b.endTime=a(),u(),l(w,b)}function v(w){return w.replace(/<br(?: \/)?>/gi,`
`)}var O=function(){function w(){this.state="INITIAL",this.buffer="",this.decoder=new k,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var b=w.prototype;return b.parse=function(s){var a=this;s&&(a.buffer+=a.decoder.decode(s,{stream:!0}));function l(){var T=a.buffer,f=0;for(T=v(T);f<T.length&&T[f]!=="\r"&&T[f]!==`
`;)++f;var m=T.substr(0,f);return T[f]==="\r"&&++f,T[f]===`
`&&++f,a.buffer=T.substr(f),m}function u(T){_(T,function(f,m){},/:/)}try{var C="";if(a.state==="INITIAL"){if(!/\r\n|\n/.test(a.buffer))return this;C=l();var g=C.match(/^()?WEBVTT([ \t].*)?$/);if(!g||!g[0])throw new Error("Malformed WebVTT signature.");a.state="HEADER"}for(var h=!1;a.buffer;){if(!/\r\n|\n/.test(a.buffer))return this;h?h=!1:C=l();switch(a.state){case"HEADER":/:/.test(C)?u(C):C||(a.state="ID");continue;case"NOTE":C||(a.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(C)){a.state="NOTE";break}if(!C)continue;if(a.cue=new H.default(0,0,""),a.state="CUE",C.indexOf("-->")===-1){a.cue.id=C;continue}case"CUE":if(!a.cue){a.state="BADCUE";continue}try{c(C,a.cue,a.regionList)}catch(T){a.cue=null,a.state="BADCUE";continue}a.state="CUETEXT";continue;case"CUETEXT":{var A=C.indexOf("-->")!==-1;if(!C||A&&(h=!0)){a.oncue&&a.cue&&a.oncue(a.cue),a.cue=null,a.state="ID";continue}if(a.cue===null)continue;a.cue.text&&(a.cue.text+=`
`),a.cue.text+=C}continue;case"BADCUE":C||(a.state="ID")}}}catch(T){a.state==="CUETEXT"&&a.cue&&a.oncue&&a.oncue(a.cue),a.cue=null,a.state=a.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},b.flush=function(){var s=this;try{if((s.cue||s.state==="HEADER")&&(s.buffer+=`
`,s.parse()),s.state==="INITIAL"||s.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(a){s.onparsingerror&&s.onparsingerror(a)}return s.onflush&&s.onflush(),this},w}()},"./src/utils/webvtt-parser.ts":function(Q,K,L){"use strict";L.r(K),L.d(K,"generateCueId",function(){return O}),L.d(K,"parseWebVTT",function(){return b});var H=L("./src/polyfills/number.ts"),k=L("./src/utils/vttparser.ts"),M=L("./src/demux/id3.ts"),N=L("./src/utils/timescale-conversion.ts"),_=L("./src/remux/mp4-remuxer.ts"),P=/\r\n|\n\r|\n|\r/g,D=function(s,a,l){return l===void 0&&(l=0),s.substr(l,a.length)===a},c=function(s){var a=parseInt(s.substr(-3)),l=parseInt(s.substr(-6,2)),u=parseInt(s.substr(-9,2)),C=s.length>9?parseInt(s.substr(0,s.indexOf(":"))):0;if(!Object(H.isFiniteNumber)(a)||!Object(H.isFiniteNumber)(l)||!Object(H.isFiniteNumber)(u)||!Object(H.isFiniteNumber)(C))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+s);return a+=1e3*l,a+=60*1e3*u,a+=60*60*1e3*C,a},v=function(s){for(var a=5381,l=s.length;l;)a=a*33^s.charCodeAt(--l);return(a>>>0).toString()};function O(E,s,a){return v(E.toString())+v(s.toString())+v(a)}var w=function(s,a,l){var u=s[a],C=s[u.prevCC];if(!C||!C.new&&u.new){s.ccOffset=s.presentationOffset=u.start,u.new=!1;return}for(;(g=C)!==null&&g!==void 0&&g.new;){var g;s.ccOffset+=u.start-C.start,u.new=!1,u=C,C=s[u.prevCC]}s.presentationOffset=l};function b(E,s,a,l,u,C,g,h){var A=new k.VTTParser,T=Object(M.utf8ArrayToStr)(new Uint8Array(E)).trim().replace(P,`
`).split(`
`),f=[],m=Object(N.toMpegTsClockFromTimescale)(s,a),d="00:00.000",o=0,x=0,y,p=!0,R=!1;A.oncue=function(U){var B=l[u],z=l.ccOffset,j=(o-m)/9e4;if(B!=null&&B.new&&(x!==void 0?z=l.ccOffset=B.start:w(l,u,j)),j&&(z=j-l.presentationOffset),R){var F=U.endTime-U.startTime,X=Object(_.normalizePts)((U.startTime+z-x)*9e4,C*9e4)/9e4;U.startTime=X,U.endTime=X+F}var q=U.text.trim();U.text=decodeURIComponent(encodeURIComponent(q)),U.id||(U.id=O(U.startTime,U.endTime,q)),U.endTime>0&&f.push(U)},A.onparsingerror=function(U){y=U},A.onflush=function(){if(y){h(y);return}g(f)},T.forEach(function(U){if(p)if(D(U,"X-TIMESTAMP-MAP=")){p=!1,R=!0,U.substr(16).split(",").forEach(function(B){D(B,"LOCAL:")?d=B.substr(6):D(B,"MPEGTS:")&&(o=parseInt(B.substr(7)))});try{x=c(d)/1e3}catch(B){R=!1,y=B}return}else U===""&&(p=!1);A.parse(U+`
`)}),A.flush()}},"./src/utils/xhr-loader.ts":function(Q,K,L){"use strict";L.r(K);var H=L("./src/utils/logger.ts"),k=L("./src/loader/load-stats.ts"),M=/^age:\s*[\d.]+\s*$/m,N=function(){function _(D){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=D?D.xhrSetup:null,this.stats=new k.LoadStats,this.retryDelay=0}var P=_.prototype;return P.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},P.abortInternal=function(){var c=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),c&&(c.onreadystatechange=null,c.onprogress=null,c.readyState!==4&&(this.stats.aborted=!0,c.abort()))},P.abort=function(){var c;this.abortInternal(),(c=this.callbacks)!==null&&c!==void 0&&c.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},P.load=function(c,v,O){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=c,this.config=v,this.callbacks=O,this.retryDelay=v.retryDelay,this.loadInternal()},P.loadInternal=function(){var c=this.config,v=this.context;if(!c)return;var O=this.loader=new self.XMLHttpRequest,w=this.stats;w.loading.first=0,w.loaded=0;var b=this.xhrSetup;try{if(b)try{b(O,v.url)}catch(a){O.open("GET",v.url,!0),b(O,v.url)}O.readyState||O.open("GET",v.url,!0);var E=this.context.headers;if(E)for(var s in E)O.setRequestHeader(s,E[s])}catch(a){this.callbacks.onError({code:O.status,text:a.message},v,O);return}v.rangeEnd&&O.setRequestHeader("Range","bytes="+v.rangeStart+"-"+(v.rangeEnd-1)),O.onreadystatechange=this.readystatechange.bind(this),O.onprogress=this.loadprogress.bind(this),O.responseType=v.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),c.timeout),O.send()},P.readystatechange=function(){var c=this.context,v=this.loader,O=this.stats;if(!c||!v)return;var w=v.readyState,b=this.config;if(O.aborted)return;if(w>=2)if(self.clearTimeout(this.requestTimeout),O.loading.first===0&&(O.loading.first=Math.max(self.performance.now(),O.loading.start)),w===4){v.onreadystatechange=null,v.onprogress=null;var E=v.status;if(E>=200&&E<300){O.loading.end=Math.max(self.performance.now(),O.loading.first);var s,a;if(c.responseType==="arraybuffer"?(s=v.response,a=s.byteLength):(s=v.responseText,a=s.length),O.loaded=O.total=a,!this.callbacks)return;var l=this.callbacks.onProgress;if(l&&l(O,c,s,v),!this.callbacks)return;var u={url:v.responseURL,data:s};this.callbacks.onSuccess(u,O,c,v)}else O.retry>=b.maxRetry||E>=400&&E<499?(H.logger.error(E+" while loading "+c.url),this.callbacks.onError({code:E,text:v.statusText},c,v)):(H.logger.warn(E+" while loading "+c.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,b.maxRetryDelay),O.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),b.timeout)},P.loadtimeout=function(){H.logger.warn("timeout while loading "+this.context.url);var c=this.callbacks;c&&(this.abortInternal(),c.onTimeout(this.stats,this.context,this.loader))},P.loadprogress=function(c){var v=this.stats;v.loaded=c.loaded,c.lengthComputable&&(v.total=c.total)},P.getCacheAge=function(){var c=null;if(this.loader&&M.test(this.loader.getAllResponseHeaders())){var v=this.loader.getResponseHeader("age");c=v?parseFloat(v):null}return c},_}();K.default=N}}).default})},wU8J:function(at,qe){function ee(){this.buffer=new Array,this.length=0}ee.prototype={get:function(Q){var K=Math.floor(Q/8);return(this.buffer[K]>>>7-Q%8&1)==1},put:function(Q,K){for(var L=0;L<K;L++)this.putBit((Q>>>K-L-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(Q){var K=Math.floor(this.length/8);this.buffer.length<=K&&this.buffer.push(0),Q&&(this.buffer[K]|=128>>>this.length%8),this.length++}},at.exports=ee}}]);