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__Three.f96d38f9.async.js

143 lines
750 KiB

(window.webpackJsonp=window.webpackJsonp||[]).push([[254,5,6,7],{"+NIl":function(ft,rt,ne){(function(re){re(ne("VrN/"))})(function(re){"use strict";re.defineMode("stex",function(X,L){"use strict";function z(C,T){C.cmdState.push(T)}function I(C){return C.cmdState.length>0?C.cmdState[C.cmdState.length-1]:null}function R(C){var T=C.cmdState.pop();T&&T.closeBracket()}function B(C){for(var T=C.cmdState,m=T.length-1;m>=0;m--){var u=T[m];if(u.name=="DEFAULT")continue;return u}return{styleIdentifier:function(){return null}}}function U(C,T,m){return function(){this.name=C,this.bracketNo=0,this.style=T,this.styles=m,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=U("importmodule","tag",["string","builtin"]),P.documentclass=U("documentclass","tag",["","atom"]),P.usepackage=U("usepackage","tag",["atom"]),P.begin=U("begin","tag",["atom"]),P.end=U("end","tag",["atom"]),P.label=U("label","tag",["atom"]),P.ref=U("ref","tag",["atom"]),P.eqref=U("eqref","tag",["atom"]),P.cite=U("cite","tag",["atom"]),P.bibitem=U("bibitem","tag",["atom"]),P.Bibitem=U("Bibitem","tag",["atom"]),P.RBibitem=U("RBibitem","tag",["atom"]),P.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function D(C,T){C.f=T}function v(C,T){var m;if(C.match(/^\\[a-zA-Z@]+/)){var u=C.current().slice(1);return m=P.hasOwnProperty(u)?P[u]:P.DEFAULT,m=new m,z(T,m),D(T,_),m.style}if(C.match(/^\\[$&%#{}_]/))return"tag";if(C.match(/^\\[,;!\/\\]/))return"tag";if(C.match("\\["))return D(T,function(l,s){return S(l,s,"\\]")}),"keyword";if(C.match("\\("))return D(T,function(l,s){return S(l,s,"\\)")}),"keyword";if(C.match("$$"))return D(T,function(l,s){return S(l,s,"$$")}),"keyword";if(C.match("$"))return D(T,function(l,s){return S(l,s,"$")}),"keyword";var o=C.next();if(o=="%")return C.skipToEnd(),"comment";if(o=="}"||o=="]"){if(m=I(T),m)m.closeBracket(o),D(T,_);else return"error";return"bracket"}else return o=="{"||o=="["?(m=P.DEFAULT,m=new m,z(T,m),"bracket"):/\d/.test(o)?(C.eatWhile(/[\w.%]/),"atom"):(C.eatWhile(/[\w\-_]/),m=B(T),m.name=="begin"&&(m.argument=C.current()),m.styleIdentifier())}function S(C,T,m){if(C.eatSpace())return null;if(m&&C.match(m))return D(T,v),"keyword";if(C.match(/^\\[a-zA-Z@]+/))return"tag";if(C.match(/^[a-zA-Z]+/))return"variable-2";if(C.match(/^\\[$&%#{}_]/))return"tag";if(C.match(/^\\[,;!\/]/))return"tag";if(C.match(/^[\^_&]/))return"tag";if(C.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(C.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var u=C.next();return u=="{"||u=="}"||u=="["||u=="]"||u=="("||u==")"?"bracket":u=="%"?(C.skipToEnd(),"comment"):"error"}function _(C,T){var m=C.peek(),u;return m=="{"||m=="["?(u=I(T),u.openBracket(m),C.eat(m),D(T,v),"bracket"):/[ \t\r]/.test(m)?(C.eat(m),null):(D(T,v),R(T),v(C,T))}return{startState:function(){var C=L.inMathMode?function(T,m){return S(T,m)}:v;return{cmdState:[],f:C}},copyState:function(C){return{cmdState:C.cmdState.slice(),f:C.f}},token:function(C,T){return T.f(C,T)},blankLine:function(C){C.f=v,C.cmdState.length=0},lineComment:"%"}}),re.defineMIME("text/x-stex","stex"),re.defineMIME("text/x-latex","stex")})},"+ua5":function(ft,rt,ne){},"19Vz":function(ft,rt,ne){(function(re){re(ne("VrN/"))})(function(re){re.defineOption("placeholder","",function(U,P,D){var v=D&&D!=re.Init;if(P&&!v)U.on("blur",I),U.on("change",R),U.on("swapDoc",R),re.on(U.getInputField(),"compositionupdate",U.state.placeholderCompose=function(){z(U)}),R(U);else if(!P&&v){U.off("blur",I),U.off("change",R),U.off("swapDoc",R),re.off(U.getInputField(),"compositionupdate",U.state.placeholderCompose),X(U);var S=U.getWrapperElement();S.className=S.className.replace(" CodeMirror-empty","")}P&&!U.hasFocus()&&I(U)});function X(U){U.state.placeholder&&(U.state.placeholder.parentNode.removeChild(U.state.placeholder),U.state.placeholder=null)}function L(U){X(U);var P=U.state.placeholder=document.createElement("pre");P.style.cssText="height: 0; overflow: visible",P.style.direction=U.getOption("direction"),P.className="CodeMirror-placeholder CodeMirror-line-like";var D=U.getOption("placeholder");typeof D=="string"&&(D=document.createTextNode(D)),P.appendChild(D),U.display.lineSpace.insertBefore(P,U.display.lineSpace.firstChild)}function z(U){setTimeout(function(){var P=!1,D=U.getInputField();D.nodeName=="TEXTAREA"?P=!D.value:U.lineCount()==1&&(P=!/[^\u200b]/.test(D.querySelector(".CodeMirror-line").textContent)),P?L(U):X(U)},20)}function I(U){B(U)&&L(U)}function R(U){var P=U.getWrapperElement(),D=B(U);P.className=P.className.replace(" CodeMirror-empty","")+(D?" CodeMirror-empty":""),D?L(U):X(U)}function B(U){return U.lineCount()===1&&U.getLine(0)===""}})},"1eCo":function(ft,rt,ne){(function(re){re(ne("VrN/"))})(function(re){"use strict";var X={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};re.defineMode("xml",function(z,I){var R=z.indentUnit,B={},U=I.htmlMode?X:L;for(var P in U)B[P]=U[P];for(var P in I)B[P]=I[P];var D,v;function S(a,b){function g(F){return b.tokenize=F,F(a,b)}var E=a.next();if(E=="<")return a.eat("!")?a.eat("[")?a.match("CDATA[")?g(T("atom","]]>")):null:a.match("--")?g(T("comment","-->")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),g(m(1))):null:a.eat("?")?(a.eatWhile(/[\w\._\-]/),b.tokenize=T("meta","?>"),"meta"):(D=a.eat("/")?"closeTag":"openTag",b.tokenize=_,"tag bracket");if(E=="&"){var M;return a.eat("#")?a.eat("x")?M=a.eatWhile(/[a-fA-F\d]/)&&a.eat(";"):M=a.eatWhile(/[\d]/)&&a.eat(";"):M=a.eatWhile(/[\w\.\-:]/)&&a.eat(";"),M?"atom":"error"}else return a.eatWhile(/[^&<]/),null}S.isInText=!0;function _(a,b){var g=a.next();if(g==">"||g=="/"&&a.eat(">"))return b.tokenize=S,D=g==">"?"endTag":"selfcloseTag","tag bracket";if(g=="=")return D="equals",null;if(g=="<"){b.tokenize=S,b.state=s,b.tagName=b.tagStart=null;var E=b.tokenize(a,b);return E?E+" tag error":"tag error"}else return/[\'\"]/.test(g)?(b.tokenize=C(g),b.stringStartCol=a.column(),b.tokenize(a,b)):(a.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function C(a){var b=function(g,E){for(;!g.eol();)if(g.next()==a){E.tokenize=_;break}return"string"};return b.isInAttribute=!0,b}function T(a,b){return function(g,E){for(;!g.eol();){if(g.match(b)){E.tokenize=S;break}g.next()}return a}}function m(a){return function(b,g){for(var E;(E=b.next())!=null;){if(E=="<")return g.tokenize=m(a+1),g.tokenize(b,g);if(E==">")if(a==1){g.tokenize=S;break}else return g.tokenize=m(a-1),g.tokenize(b,g)}return"meta"}}function u(a,b,g){this.prev=a.context,this.tagName=b,this.indent=a.indented,this.startOfLine=g,(B.doNotIndent.hasOwnProperty(b)||a.context&&a.context.noIndent)&&(this.noIndent=!0)}function o(a){a.context&&(a.context=a.context.prev)}function l(a,b){for(var g;;){if(!a.context)return;if(g=a.context.tagName,!B.contextGrabbers.hasOwnProperty(g)||!B.contextGrabbers[g].hasOwnProperty(b))return;o(a)}}function s(a,b,g){return a=="openTag"?(g.tagStart=b.column(),w):a=="closeTag"?p:s}function w(a,b,g){return a=="word"?(g.tagName=b.current(),v="tag",y):B.allowMissingTagName&&a=="endTag"?(v="tag bracket",y(a,b,g)):(v="error",w)}function p(a,b,g){if(a=="word"){var E=b.current();return g.context&&g.context.tagName!=E&&B.implicitlyClosed.hasOwnProperty(g.context.tagName)&&o(g),g.context&&g.context.tagName==E||B.matchClosing===!1?(v="tag",c):(v="tag error",A)}else return B.allowMissingTagName&&a=="endTag"?(v="tag bracket",c(a,b,g)):(v="error",A)}function c(a,b,g){return a!="endTag"?(v="error",c):(o(g),s)}function A(a,b,g){return v="error",c(a,b,g)}function y(a,b,g){if(a=="word")return v="attribute",f;if(a=="endTag"||a=="selfcloseTag"){var E=g.tagName,M=g.tagStart;return g.tagName=g.tagStart=null,a=="selfcloseTag"||B.autoSelfClosers.hasOwnProperty(E)?l(g,E):(l(g,E),g.context=new u(g,E,M==g.indented)),s}return v="error",y}function f(a,b,g){return a=="equals"?h:(B.allowMissing||(v="error"),y(a,b,g))}function h(a,b,g){return a=="string"?d:a=="word"&&B.allowUnquoted?(v="string",y):(v="error",y(a,b,g))}function d(a,b,g){return a=="string"?d:y(a,b,g)}return{startState:function(a){var b={tokenize:S,state:s,indented:a||0,tagName:null,tagStart:null,context:null};return a!=null&&(b.baseIndent=a),b},token:function(a,b){if(!b.tagName&&a.sol()&&(b.indented=a.indentation()),a.eatSpace())return null;D=null;var g=b.tokenize(a,b);return(g||D)&&g!="comment"&&(v=null,b.state=b.state(D||g,a,b),v&&(g=v=="error"?g+" error":v)),g},indent:function(a,b,g){var E=a.context;if(a.tokenize.isInAttribute)return a.tagStart==a.indented?a.stringStartCol+1:a.indented+R;if(E&&E.noIndent)return re.Pass;if(a.tokenize!=_&&a.tokenize!=S)return g?g.match(/^(\s*)/)[0].length:0;if(a.tagName)return B.multilineTagIndentPastTag!==!1?a.tagStart+a.tagName.length+2:a.tagStart+R*(B.multilineTagIndentFactor||1);if(B.alignCDATA&&/<!\[CDATA\[/.test(b))return 0;var M=b&&/^<(\/)?([\w_:\.-]*)/.exec(b);if(M&&M[1])for(;E;)if(E.tagName==M[2]){E=E.prev;break}else if(B.implicitlyClosed.hasOwnProperty(E.tagName))E=E.prev;else break;else if(M)for(;E;){var F=B.contextGrabbers[E.tagName];if(F&&F.hasOwnProperty(M[2]))E=E.prev;else break}for(;E&&E.prev&&!E.startOfLine;)E=E.prev;return E?E.indent+R:a.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:B.htmlMode?"html":"xml",helperType:B.htmlMode?"html":"xml",skipAttribute:function(a){a.state==h&&(a.state=y)},xmlCurrentTag:function(a){return a.tagName?{name:a.tagName,close:a.type=="closeTag"}:null},xmlCurrentContext:function(a){for(var b=[],g=a.context;g;g=g.prev)g.tagName&&b.push(g.tagName);return b.reverse()}}}),re.defineMIME("text/xml","xml"),re.defineMIME("application/xml","xml"),re.mimeModes.hasOwnProperty("text/html")||re.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"7Cbv":function(ft,rt,ne){"use strict";var re=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),X=new Uint8Array(16);function L(){if(!re)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return re(X)}var z=/^(?:[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 I(_){return typeof _=="string"&&z.test(_)}for(var R=I,B=[],U=0;U<256;++U)B.push((U+256).toString(16).substr(1));function P(_){var C=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,T=(B[_[C+0]]+B[_[C+1]]+B[_[C+2]]+B[_[C+3]]+"-"+B[_[C+4]]+B[_[C+5]]+"-"+B[_[C+6]]+B[_[C+7]]+"-"+B[_[C+8]]+B[_[C+9]]+"-"+B[_[C+10]]+B[_[C+11]]+B[_[C+12]]+B[_[C+13]]+B[_[C+14]]+B[_[C+15]]).toLowerCase();if(!R(T))throw TypeError("Stringified UUID is invalid");return T}var D=P;function v(_,C,T){_=_||{};var m=_.random||(_.rng||L)();if(m[6]=m[6]&15|64,m[8]=m[8]&63|128,C){T=T||0;for(var u=0;u<16;++u)C[T+u]=m[u];return C}return D(m)}var S=rt.a=v},"7ahc":function(ft,rt,ne){"use strict";ne.d(rt,"a",function(){return w});var re=ne("k1fw"),X=ne("0Owb"),L=ne("+L6B"),z=ne("2/Rp"),I=ne("y8nQ"),R=ne("Vl3Y"),B=ne("tJVT"),U=ne("OaEy"),P=ne("2fM7"),D=ne("cDcd"),v=ne.n(D),S=ne("VrN/"),_=ne.n(S),C=ne("p77/"),T=ne.n(C),m=ne("c5Ni"),u=ne.n(m),o=P.a.Option,l={labelCol:{span:4},wrapperCol:{span:20}},s={asp:["ASP","vbscript"],actionscript:["ActionScript(3.0)/Flash/Flex","clike"],bash:["Bash/Bat","shell"],css:["CSS","css"],c:["C","clike"],cpp:["C++","clike"],csharp:["C#","clike"],coffeescript:["CoffeeScript","coffeescript"],d:["D","d"],dart:["Dart","dart"],delphi:["Delphi/Pascal","pascal"],erlang:["Erlang","erlang"],go:["Golang","go"],groovy:["Groovy","groovy"],html:["HTML","text/html"],java:["Java","clike"],json:["JSON","text/json"],javascript:["Javascript","javascript"],lua:["Lua","lua"],less:["LESS","css"],markdown:["Markdown","gfm"],"objective-c":["Objective-C","clike"],php:["PHP","php"],perl:["Perl","perl"],python:["Python","python"],r:["R","r"],rst:["reStructedText","rst"],ruby:["Ruby","ruby"],sql:["SQL","sql"],sass:["SASS/SCSS","sass"],shell:["Shell","shell"],scala:["Scala","clike"],swift:["Swift","clike"],vb:["VB/VBScript","vb"],xml:["XML","text/xml"],yaml:["YAML","yaml"]};rt.b=function(p){var c=p.callback,A=p.onCancel,y=Object(D.useState)("python"),f=Object(B.a)(y,2),h=f[0],d=f[1];function a(g){d(s[g][1])}function b(g){c(g)}return v.a.createElement(R.a,Object(X.a)({},l,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:b}),v.a.createElement(R.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},v.a.createElement(P.a,{onChange:a},Object.keys(s).map(function(g){return v.a.createElement(o,{key:g,value:g},s[g][0])}))),v.a.createElement(R.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},v.a.createElement(w,{mode:h})),v.a.createElement("div",{className:"flex-container flex-end"},v.a.createElement(z.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),v.a.createElement(z.a,{type:"ghost",onClick:A},"\u53D6\u6D88")))};function w(p){var c=p.value,A=p.onChange,y=p.mode,f=p.options,h=f===void 0?{}:f,d=Object(D.useRef)(),a=Object(D.useState)(),b=Object(B.a)(a,2),g=b[0],E=b[1];return Object(D.useEffect)(function(){if(g){function M(F){var j=F.getValue();A&&A(j)}return g.on("change",M),function(){g.off("change",M)}}},[g,A]),Object(D.useEffect)(function(){g&&g.setOption("mode",y)},[g,y]),Object(D.useEffect)(function(){g&&((c!==g.getValue()||c==="")&&setTimeout(function(){g.setValue(c||" ")},300))},[g,c]),Object(D.useEffect)(function(){if(d.current&&!g){var M=_.a.fromTextArea(d.current,Object(re.a)({mode:y,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},h));E(M)}},[d.current,g]),v.a.createElement("div",{className:"my-codemirror-container"},v.a.createElement("textarea",{ref:d}))}},"8EBN":function(ft,rt,ne){(function(re){re(ne("VrN/"))})(function(re){"use strict";re.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 X=0;X<re.modeInfo.length;X++){var L=re.modeInfo[X];L.mimes&&(L.mime=L.mimes[0])}re.findModeByMIME=function(z){z=z.toLowerCase();for(var I=0;I<re.modeInfo.length;I++){var R=re.modeInfo[I];if(R.mime==z)return R;if(R.mimes){for(var B=0;B<R.mimes.length;B++)if(R.mimes[B]==z)return R}}if(/\+xml$/.test(z))return re.findModeByMIME("application/xml");if(/\+json$/.test(z))return re.findModeByMIME("application/json")},re.findModeByExtension=function(z){z=z.toLowerCase();for(var I=0;I<re.modeInfo.length;I++){var R=re.modeInfo[I];if(R.ext){for(var B=0;B<R.ext.length;B++)if(R.ext[B]==z)return R}}},re.findModeByFileName=function(z){for(var I=0;I<re.modeInfo.length;I++){var R=re.modeInfo[I];if(R.file&&R.file.test(z))return R}var B=z.lastIndexOf("."),U=B>-1&&z.substring(B+1,z.length);if(U)return re.findModeByExtension(U)},re.findModeByName=function(z){z=z.toLowerCase();for(var I=0;I<re.modeInfo.length;I++){var R=re.modeInfo[I];if(R.name.toLowerCase()==z)return R;if(R.alias){for(var B=0;B<R.alias.length;B++)if(R.alias[B].toLowerCase()==z)return R}}}})},"8hTe":function(ft,rt,ne){ft.exports={button:"button___1wy9m"}},"9Bee":function(ft,rt,ne){"use strict";var re=ne("DYRE"),X=ne("zeV3"),L=ne("+L6B"),z=ne("2/Rp"),I=ne("k1fw"),R=ne("tJVT"),B=ne("cDcd"),U=ne.n(B),P=ne("vg9a"),D=ne("DlQD"),v=ne.n(D),S=ne("rUJ1");function _(ge,me){var le=ge.match(/^(\s+)(?:```)/);if(le===null)return me;var ie=le[1];return me.split(`
`).map(function(he){var $=he.match(/^\s+/);if($===null)return he;var te=Object(R.a)($,1),Z=te[0];return Z.length>=ie.length?he.slice(ie.length):he}).join(`
`)}var C=[],T=["<ul>"],m=new v.a.Renderer,u=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function o(){C.length=0,T=["<ul>"]}var l={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function s(ge,me,le,ie){if(me>=ge.length||ge[me].level<=le)return me;var he=ge[me];ie.push("<li><a href='#"+he.anchor+"'>"+he.text+"</a>"),me++;var $=[];return me=s(ge,me,he.level,$),$.length>0&&(ie.push("<ul>"),$.forEach(function(te){ie.push(te)}),ie.push("</ul>")),ie.push("</li>"),me=s(ge,me,le,ie),me}function w(){return s(C,0,0,T),T.push("</ul>"),T.join("")}var p={heading:function(me){var le=u.exec(me);if(le)return{type:"heading",raw:le[0],depth:le[1].length,text:le[2]}},fences:function(me){var le=this.rules.block.fences.exec(me);if(le){var ie=le[0],he=_(ie,le[3]||""),$=le[2]?le[2].trim():le[2];if(["latex","katex","math"].indexOf($)>=0){var te=y(),Z=he;he=te,f[te]={type:"block",expression:Z}}return{type:"code",raw:ie,lang:$,text:he}}}},c=/(?:\${2})([^\n`]+?)(?:\${2})/gi,A=0,y=function(){return"__special_katext_id_".concat(A++,"__")},f={};function h(){return f}function d(){A=0,f={}}function a(ge){return ge=ge.replace(c,function(me,le){var ie=y();return f[ie]={type:"inline",expression:le},ie}),ge}var b=m.listitem;m.listitem=function(ge){return b(a(ge))};var g=m.paragraph;m.paragraph=function(ge){return g(a(ge))};var E=m.tablecell;m.tablecell=function(ge,me){return E(a(ge),me)},m.code=function(ge,me,le){var ie=(me||"").match(/\S*/)[0];return ie?["latex","katex","math"].indexOf(ie)>=0?"<p class='editormd-tex'>".concat(ge,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(me,'">').concat(le?ge:Object(S.escape)(ge,!0),`</code></pre>
`):'<pre class="prettyprint linenums"><code>'+(le?ge:Object(S.escape)(ge,!0))+"</code></pre>"},m.heading=function(ge,me,le){var ie=this.options.headerPrefix+le.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return C.push({anchor:ie,level:me,text:ge}),"<h"+me+' id="'+ie+'">'+ge+"</h"+me+">"},v.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),v.a.use({tokenizer:p,renderer:m});var M=v.a,F=ne("SJMd"),j=ne("ulZh"),W=ne.n(j),O=ne("m3rI"),k=ne("Oy/b"),K=ne("p5ED"),Y=ne("8hTe"),q=ne.n(Y),oe=/<pre[^>]*>/g;function Te(ge){var me=document.createElement("div");return me.innerHTML=ge,me.childNodes.length===0?"":me.childNodes[0].nodeValue}var ve=rt.a=function(ge){var me=ge.value,le=me===void 0?"":me,ie=ge.edit,he=ie===void 0?!1:ie,$=ge.className,te=ge.showTextOnly,Z=ge.showLines,be=ge.replaces,Ae=ge.zoomImg,ye=ge.hasMask,we=ge.style,De=we===void 0?{}:we,Re=ge.stylesPrev,Me=Re===void 0?{}:Re,ke=String(le),Oe=Object(B.useRef)(),ze=Object(B.useRef)(),Ze=Object(B.useState)(""),je=Object(R.a)(Ze,2),Xe=je[0],et=je[1],We=Object(B.useState)("office"),Be=Object(R.a)(We,2),Se=Be[0],qe=Be[1],Je=Object(B.useMemo)(function(){try{var ce=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Q=/\"\/api\/attachments\/|\"\/attachments\/download\//g,J=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;ke=ke.replace(ce,"("+O.a.API_SERVER+"/api/attachments/").replace(Q,'"'+O.a.API_SERVER+"/api/attachments/").replace(J,'"'+O.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(Le){}var ee=M(ke),se=h();if(ke.match(/\[TOC\]/)&&(ee=ee.replace("<p>[TOC]</p>",w()),o()),ee=ee.replace(/(__special_katext_id_\d+__)/g,function(Le,Ce){var Ie=se[Ce],Ve=Ie.type,Ge=Ie.expression;return Object(k.renderToString)(Te(Ge)||"",{displayMode:Ve==="block",throwOnError:!1,output:"html"})}),ee=ee.replace(/▁/g,"\u2581\u2581\u2581"),d(),te){var fe=document.createElement("div");return fe.innerHTML=ee,fe.innerText}return setTimeout(function(){return pe()},500),ee},[ke]),_e=Object(B.useRef)();l.WebkitLineClamp=Z,Z&&(De=Object(I.a)(Object(I.a)({},De),l));function Ne(ce){var Q=ce.target;if(Q.tagName.toUpperCase()==="IMG"){if(Ae){var J=Q.getAttribute("src");et(J),qe("image")}}else if(Q.tagName.toUpperCase()==="A"){var ee=Q.getAttribute("href");if(ee.indexOf("office")>-1)ce.preventDefault(),et(ee),qe("office");else if(ee.indexOf("application/pdf")>-1)ce.preventDefault(),et(ee),qe("pdf");else if(ee.indexOf("text/html")>-1)ce.preventDefault(),et(ee),qe("html");else if(ee.startsWith("#")){ce.preventDefault();var se=document.getElementById(ee.replace("#",""));se&&se.scrollIntoView(!0)}}}var pe=function(){var Q,J=(Q=_e.current)===null||Q===void 0?void 0:Q.querySelectorAll("video");J==null||J.forEach(function(ee){if(ee.oncontextmenu=function(){return!1},ee.src.indexOf(".m3u8")>-1&&!ee.canPlayType("application/vnd.apple.mpegurl")){if(W.a.isSupported()){var se=new W.a;se.loadSource(ee.src),se.attachMedia(ee)}}})};Object(B.useEffect)(function(){if(_e.current&&Je&&(Je.match(oe)&&window.PR.prettyPrint()),_e.current)return _e.current.addEventListener("click",Ne),function(){_e.current.removeEventListener("click",Ne),d(),o()}},[Je,_e.current,Ne]);var de=function(Q){if(!he)return;Q.target.nodeName==="IMG"?(Oe.current.style.display="flex",Oe.current.style.width=Q.target.clientWidth+"px",Oe.current.style.height=Q.target.clientHeight+"px",Oe.current.style.top=Q.target.offsetTop+"px",Oe.current.style.left=Q.target.offsetLeft+"px",ze.current.src=Q.target.getAttribute("src")):Oe.current.style.display="none"};return U.a.createElement("div",{style:{position:"relative"}},U.a.createElement("div",{ref:_e,style:Object(I.a)({},De),className:"".concat($||""," markdown-body ").concat(q.a.mdBody),onMouseOver:de,dangerouslySetInnerHTML:{__html:Je}}),U.a.createElement("div",{ref:Oe,className:q.a.button},U.a.createElement(X.a,null,U.a.createElement(z.a,{onClick:function(){return openCrop()}},"\u88C1\u526A"),U.a.createElement(z.a,{onClick:function(){return openEditor()}},"\u7F16\u8F91"))),U.a.createElement("img",{ref:ze,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1,top:"-10000px"}}),U.a.createElement(K.a,{close:!0,data:Xe,type:Xe!=null&&Xe.length?Se:"",style:Object(I.a)({},Me),onClose:function(){return et("")}}))}},"9VGf":function(ft,rt,ne){"use strict";ne.d(rt,"a",function(){return L});var re=ne("cDcd"),X=ne.n(re);function L(z,I){var R=Object(re.useRef)();Object(re.useEffect)(function(){R.current=z}),Object(re.useEffect)(function(){function B(){R.current()}if(I!==null){var U=setInterval(B,I);return function(){return clearInterval(U)}}},[I])}},BU3w:function(ft,rt,ne){"use strict";ne.d(rt,"a",function(){return R});var re=ne("MNnm"),X="rc-util-key";function L(B){if(B.attachTo)return B.attachTo;var U=document.querySelector("head");return U||document.body}function z(B){var U,P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(re.a)())return null;var D=document.createElement("style");if((U=P.csp)===null||U===void 0?void 0:U.nonce){var v;D.nonce=(v=P.csp)===null||v===void 0?void 0:v.nonce}D.innerHTML=B;var S=L(P),_=S.firstChild;return P.prepend&&S.prepend?S.prepend(D):P.prepend&&_?S.insertBefore(D,_):S.appendChild(D),D}var I=new Map;function R(B,U){var P=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},D=L(P);if(!I.has(D)){var v=z("",P),S=v.parentNode;I.set(D,S),S.removeChild(v)}var _=Array.from(I.get(D).children).find(function(o){return o.tagName==="STYLE"&&o[X]===U});if(_){var C,T;if(((C=P.csp)===null||C===void 0?void 0:C.nonce)&&_.nonce!==((T=P.csp)===null||T===void 0?void 0:T.nonce)){var m;_.nonce=(m=P.csp)===null||m===void 0?void 0:m.nonce}return _.innerHTML!==B&&(_.innerHTML=B),_}var u=z(B,P);return u[X]=U,u}},Bd2K:function(ft,rt,ne){(function(re){re(ne("VrN/"),ne("osHv"))})(function(re){re.defineOption("autoCloseTags",!1,function(P,D,v){if(v!=re.Init&&v&&P.removeKeyMap("autoCloseTags"),!D)return;var S={name:"autoCloseTags"};(typeof D!="object"||D.whenClosing!==!1)&&(S["'/'"]=function(_){return R(_)}),(typeof D!="object"||D.whenOpening!==!1)&&(S["'>'"]=function(_){return z(_)}),P.addKeyMap(S)});var X=["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 z(P){if(P.getOption("disableInput"))return re.Pass;for(var D=P.listSelections(),v=[],S=P.getOption("autoCloseTags"),_=0;_<D.length;_++){if(!D[_].empty())return re.Pass;var C=D[_].head,T=P.getTokenAt(C),m=re.innerMode(P.getMode(),T.state),u=m.state,o=m.mode.xmlCurrentTag&&m.mode.xmlCurrentTag(u),l=o&&o.name;if(!l)return re.Pass;var s=m.mode.configuration=="html",w=typeof S=="object"&&S.dontCloseTags||s&&X,p=typeof S=="object"&&S.indentTags||s&&L;T.end>C.ch&&(l=l.slice(0,l.length-T.end+C.ch));var c=l.toLowerCase();if(!l||T.type=="string"&&(T.end!=C.ch||!/[\"\']/.test(T.string.charAt(T.string.length-1))||T.string.length==1)||T.type=="tag"&&o.close||T.string.indexOf("/")==C.ch-T.start-1||w&&B(w,c)>-1||U(P,m.mode.xmlCurrentContext&&m.mode.xmlCurrentContext(u)||[],l,C,!0))return re.Pass;var A=typeof S=="object"&&S.emptyTags;if(A&&B(A,l)>-1){v[_]={text:"/>",newPos:re.Pos(C.line,C.ch+2)};continue}var y=p&&B(p,c)>-1;v[_]={indent:y,text:">"+(y?`
`:"")+"</"+l+">",newPos:y?re.Pos(C.line+1,0):re.Pos(C.line,C.ch+1)}}for(var f=typeof S=="object"&&S.dontIndentOnAutoClose,_=D.length-1;_>=0;_--){var h=v[_];P.replaceRange(h.text,D[_].head,D[_].anchor,"+insert");var d=P.listSelections().slice(0);d[_]={head:h.newPos,anchor:h.newPos},P.setSelections(d),!f&&h.indent&&(P.indentLine(h.newPos.line,null,!0),P.indentLine(h.newPos.line+1,null,!0))}}function I(P,D){for(var v=P.listSelections(),S=[],_=D?"/":"</",C=P.getOption("autoCloseTags"),T=typeof C=="object"&&C.dontIndentOnSlash,m=0;m<v.length;m++){if(!v[m].empty())return re.Pass;var u=v[m].head,o=P.getTokenAt(u),l=re.innerMode(P.getMode(),o.state),s=l.state;if(D&&(o.type=="string"||o.string.charAt(0)!="<"||o.start!=u.ch-1))return re.Pass;var w,p=l.mode.name!="xml"&&P.getMode().name=="htmlmixed";if(p&&l.mode.name=="javascript")w=_+"script";else if(p&&l.mode.name=="css")w=_+"style";else{var c=l.mode.xmlCurrentContext&&l.mode.xmlCurrentContext(s);if(!c||c.length&&U(P,c,c[c.length-1],u))return re.Pass;w=_+c[c.length-1]}P.getLine(u.line).charAt(o.end)!=">"&&(w+=">"),S[m]=w}if(P.replaceSelections(S),v=P.listSelections(),!T)for(var m=0;m<v.length;m++)(m==v.length-1||v[m].head.line<v[m+1].head.line)&&P.indentLine(v[m].head.line)}function R(P){return P.getOption("disableInput")?re.Pass:I(P,!0)}re.commands.closeTag=function(P){return I(P)};function B(P,D){if(P.indexOf)return P.indexOf(D);for(var v=0,S=P.length;v<S;++v)if(P[v]==D)return v;return-1}function U(P,D,v,S,_){if(!re.scanForClosingTag)return!1;var C=Math.min(P.lastLine()+1,S.line+500),T=re.scanForClosingTag(P,S,null,C);if(!T||T.tag!=v)return!1;for(var m=_?1:0,u=D.length-1;u>=0&&D[u]==v;u--)++m;S=T.to;for(var u=1;u<m;u++){var o=re.scanForClosingTag(P,S,null,C);if(!o||o.tag!=v)return!1;S=o.to}return!0}})},BjJ7:function(ft,rt,ne){"use strict";ne.d(rt,"d",function(){return X}),ne.d(rt,"c",function(){return L}),ne.d(rt,"e",function(){return z}),ne.d(rt,"b",function(){return I}),ne.d(rt,"a",function(){return B});var re=ne("m3rI");function X(U){var P=!0;if(U.length>0){for(var D=0;D<U.length;D++)if(U[D].compile_success==0||!U[D].compile_success){P=!1;break}}else P=!1;return P}function L(U){for(var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",D=[],v=0;v<U.length;v++){var S=U[v],_=P?"".concat(P,"/").concat(S.name):"".concat(S.name);D.push({title:S.name,isLeaf:!(S.type==="tree"),key:_})}return D}function z(U,P,D){for(var v=0;v<U.length;v++){var S=U[v];if(S.key===P){S.children=D;break}S.children&&z(S.children,P,D)}return U}function I(U,P,D){var v;return function(){var S=this,_=arguments,C=function(){v=null,D||U.apply(S,_)},T=D&&!v;clearTimeout(v),v=setTimeout(C,P),T&&U.apply(S,_)}}var R=!0,B=re.a.API_SERVER},"C+DQ":function(ft,rt,ne){},DlQD:function(ft,rt,ne){(function(re,X){ft.exports=X()})(this,function(){"use strict";function re(pe,de){for(var ce=0;ce<de.length;ce++){var Q=de[ce];Q.enumerable=Q.enumerable||!1,Q.configurable=!0,"value"in Q&&(Q.writable=!0),Object.defineProperty(pe,Q.key,Q)}}function X(pe,de,ce){return de&&re(pe.prototype,de),ce&&re(pe,ce),pe}function L(pe,de){if(!pe)return;if(typeof pe=="string")return z(pe,de);var ce=Object.prototype.toString.call(pe).slice(8,-1);if(ce==="Object"&&pe.constructor&&(ce=pe.constructor.name),ce==="Map"||ce==="Set")return Array.from(pe);if(ce==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(ce))return z(pe,de)}function z(pe,de){(de==null||de>pe.length)&&(de=pe.length);for(var ce=0,Q=new Array(de);ce<de;ce++)Q[ce]=pe[ce];return Q}function I(pe,de){var ce;if(typeof Symbol=="undefined"||pe[Symbol.iterator]==null){if(Array.isArray(pe)||(ce=L(pe))||de&&pe&&typeof pe.length=="number"){ce&&(pe=ce);var Q=0;return function(){return Q>=pe.length?{done:!0}:{done:!1,value:pe[Q++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}return ce=pe[Symbol.iterator](),ce.next.bind(ce)}function R(pe,de){return de={exports:{}},pe(de,de.exports),de.exports}var B=R(function(pe){function de(){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 ce(Q){pe.exports.defaults=Q}pe.exports={defaults:de(),getDefaults:de,changeDefaults:ce}}),U=B.defaults,P=B.getDefaults,D=B.changeDefaults,v=/[&<>"']/,S=/[&<>"']/g,_=/[<>"']|&(?!#?\w+;)/,C=/[<>"']|&(?!#?\w+;)/g,T={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},m=function(de){return T[de]};function u(pe,de){if(de){if(v.test(pe))return pe.replace(S,m)}else if(_.test(pe))return pe.replace(C,m);return pe}var o=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function l(pe){return pe.replace(o,function(de,ce){return ce=ce.toLowerCase(),ce==="colon"?":":ce.charAt(0)==="#"?ce.charAt(1)==="x"?String.fromCharCode(parseInt(ce.substring(2),16)):String.fromCharCode(+ce.substring(1)):""})}var s=/(^|[^\[])\^/g;function w(pe,de){pe=pe.source||pe,de=de||"";var ce={replace:function(J,ee){return ee=ee.source||ee,ee=ee.replace(s,"$1"),pe=pe.replace(J,ee),ce},getRegex:function(){return new RegExp(pe,de)}};return ce}var p=/[^\w:]/g,c=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function A(pe,de,ce){if(pe){var Q;try{Q=decodeURIComponent(l(ce)).replace(p,"").toLowerCase()}catch(J){return null}if(Q.indexOf("javascript:")===0||Q.indexOf("vbscript:")===0||Q.indexOf("data:")===0)return null}de&&!c.test(ce)&&(ce=a(de,ce));try{ce=encodeURI(ce).replace(/%25/g,"%")}catch(J){return null}return ce}var y={},f=/^[^:]+:\/*[^/]*$/,h=/^([^:]+:)[\s\S]*$/,d=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(pe,de){y[" "+pe]||(f.test(pe)?y[" "+pe]=pe+"/":y[" "+pe]=M(pe,"/",!0)),pe=y[" "+pe];var ce=pe.indexOf(":")===-1;return de.substring(0,2)==="//"?ce?de:pe.replace(h,"$1")+de:de.charAt(0)==="/"?ce?de:pe.replace(d,"$1")+de:pe+de}var b={exec:function(){}};function g(pe){for(var de=1,ce,Q;de<arguments.length;de++){ce=arguments[de];for(Q in ce)Object.prototype.hasOwnProperty.call(ce,Q)&&(pe[Q]=ce[Q])}return pe}function E(pe,de){var ce=pe.replace(/\|/g,function(ee,se,fe){for(var Le=!1,Ce=se;--Ce>=0&&fe[Ce]==="\\";)Le=!Le;return Le?"|":" |"}),Q=ce.split(/ \|/),J=0;if(Q.length>de)Q.splice(de);else for(;Q.length<de;)Q.push("");for(;J<Q.length;J++)Q[J]=Q[J].trim().replace(/\\\|/g,"|");return Q}function M(pe,de,ce){var Q=pe.length;if(Q===0)return"";for(var J=0;J<Q;){var ee=pe.charAt(Q-J-1);if(ee===de&&!ce)J++;else if(ee!==de&&ce)J++;else break}return pe.substr(0,Q-J)}function F(pe,de){if(pe.indexOf(de[1])===-1)return-1;for(var ce=pe.length,Q=0,J=0;J<ce;J++)if(pe[J]==="\\")J++;else if(pe[J]===de[0])Q++;else if(pe[J]===de[1]&&(Q--,Q<0))return J;return-1}function j(pe){pe&&pe.sanitize&&!pe.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}var W={escape:u,unescape:l,edit:w,cleanUrl:A,resolveUrl:a,noopTest:b,merge:g,splitCells:E,rtrim:M,findClosingBracket:F,checkSanitizeDeprecation:j},O=B.defaults,k=W.rtrim,K=W.splitCells,Y=W.escape,q=W.findClosingBracket;function oe(pe,de,ce){var Q=de.href,J=de.title?Y(de.title):null,ee=pe[1].replace(/\\([\[\]])/g,"$1");return pe[0].charAt(0)!=="!"?{type:"link",raw:ce,href:Q,title:J,text:ee}:{type:"image",raw:ce,href:Q,title:J,text:Y(ee)}}function Te(pe,de){var ce=pe.match(/^(\s+)(?:```)/);if(ce===null)return de;var Q=ce[1];return de.split(`
`).map(function(J){var ee=J.match(/^\s+/);if(ee===null)return J;var se=ee[0];return se.length>=Q.length?J.slice(Q.length):J}).join(`
`)}var ve=function(){function pe(ce){this.options=ce||O}var de=pe.prototype;return de.space=function(Q){var J=this.rules.block.newline.exec(Q);if(J)return J[0].length>1?{type:"space",raw:J[0]}:{raw:`
`}},de.code=function(Q,J){var ee=this.rules.block.code.exec(Q);if(ee){var se=J[J.length-1];if(se&&se.type==="paragraph")return{raw:ee[0],text:ee[0].trimRight()};var fe=ee[0].replace(/^ {4}/gm,"");return{type:"code",raw:ee[0],codeBlockStyle:"indented",text:this.options.pedantic?fe:k(fe,`
`)}}},de.fences=function(Q){var J=this.rules.block.fences.exec(Q);if(J){var ee=J[0],se=Te(ee,J[3]||"");return{type:"code",raw:ee,lang:J[2]?J[2].trim():J[2],text:se}}},de.heading=function(Q){var J=this.rules.block.heading.exec(Q);if(J)return{type:"heading",raw:J[0],depth:J[1].length,text:J[2]}},de.nptable=function(Q){var J=this.rules.block.nptable.exec(Q);if(J){var ee={type:"table",header:K(J[1].replace(/^ *| *\| *$/g,"")),align:J[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:J[3]?J[3].replace(/\n$/,"").split(`
`):[],raw:J[0]};if(ee.header.length===ee.align.length){var se=ee.align.length,fe;for(fe=0;fe<se;fe++)/^ *-+: *$/.test(ee.align[fe])?ee.align[fe]="right":/^ *:-+: *$/.test(ee.align[fe])?ee.align[fe]="center":/^ *:-+ *$/.test(ee.align[fe])?ee.align[fe]="left":ee.align[fe]=null;for(se=ee.cells.length,fe=0;fe<se;fe++)ee.cells[fe]=K(ee.cells[fe],ee.header.length);return ee}}},de.hr=function(Q){var J=this.rules.block.hr.exec(Q);if(J)return{type:"hr",raw:J[0]}},de.blockquote=function(Q){var J=this.rules.block.blockquote.exec(Q);if(J){var ee=J[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:J[0],text:ee}}},de.list=function(Q){var J=this.rules.block.list.exec(Q);if(J){for(var ee=J[0],se=J[2],fe=se.length>1,Le=se[se.length-1]===")",Ce={type:"list",raw:ee,ordered:fe,start:fe?+se.slice(0,-1):"",loose:!1,items:[]},Ie=J[0].match(this.rules.block.item),Ve=!1,Ge,gt,ct,st,wt,ot,yt,xt=Ie.length,Ye=0;Ye<xt;Ye++)Ge=Ie[Ye],ee=Ge,gt=Ge.length,Ge=Ge.replace(/^ *([*+-]|\d+[.)]) */,""),~Ge.indexOf(`
`)&&(gt-=Ge.length,Ge=this.options.pedantic?Ge.replace(/^ {1,4}/gm,""):Ge.replace(new RegExp("^ {1,"+gt+"}","gm"),"")),Ye!==xt-1&&(ct=this.rules.block.bullet.exec(Ie[Ye+1])[0],(fe?ct.length===1||!Le&&ct[ct.length-1]===")":ct.length>1||this.options.smartLists&&ct!==se)&&(st=Ie.slice(Ye+1).join(`
`),Ce.raw=Ce.raw.substring(0,Ce.raw.length-st.length),Ye=xt-1)),wt=Ve||/\n\n(?!\s*$)/.test(Ge),Ye!==xt-1&&(Ve=Ge.charAt(Ge.length-1)===`
`,wt||(wt=Ve)),wt&&(Ce.loose=!0),ot=/^\[[ xX]\] /.test(Ge),yt=void 0,ot&&(yt=Ge[1]!==" ",Ge=Ge.replace(/^\[[ xX]\] +/,"")),Ce.items.push({type:"list_item",raw:ee,task:ot,checked:yt,loose:wt,text:Ge});return Ce}},de.html=function(Q){var J=this.rules.block.html.exec(Q);if(J)return{type:this.options.sanitize?"paragraph":"html",raw:J[0],pre:!this.options.sanitizer&&(J[1]==="pre"||J[1]==="script"||J[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(J[0]):Y(J[0]):J[0]}},de.def=function(Q){var J=this.rules.block.def.exec(Q);if(J){J[3]&&(J[3]=J[3].substring(1,J[3].length-1));var ee=J[1].toLowerCase().replace(/\s+/g," ");return{tag:ee,raw:J[0],href:J[2],title:J[3]}}},de.table=function(Q){var J=this.rules.block.table.exec(Q);if(J){var ee={type:"table",header:K(J[1].replace(/^ *| *\| *$/g,"")),align:J[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:J[3]?J[3].replace(/\n$/,"").split(`
`):[]};if(ee.header.length===ee.align.length){ee.raw=J[0];var se=ee.align.length,fe;for(fe=0;fe<se;fe++)/^ *-+: *$/.test(ee.align[fe])?ee.align[fe]="right":/^ *:-+: *$/.test(ee.align[fe])?ee.align[fe]="center":/^ *:-+ *$/.test(ee.align[fe])?ee.align[fe]="left":ee.align[fe]=null;for(se=ee.cells.length,fe=0;fe<se;fe++)ee.cells[fe]=K(ee.cells[fe].replace(/^ *\| *| *\| *$/g,""),ee.header.length);return ee}}},de.lheading=function(Q){var J=this.rules.block.lheading.exec(Q);if(J)return{type:"heading",raw:J[0],depth:J[2].charAt(0)==="="?1:2,text:J[1]}},de.paragraph=function(Q){var J=this.rules.block.paragraph.exec(Q);if(J)return{type:"paragraph",raw:J[0],text:J[1].charAt(J[1].length-1)===`
`?J[1].slice(0,-1):J[1]}},de.text=function(Q,J){var ee=this.rules.block.text.exec(Q);if(ee){var se=J[J.length-1];return se&&se.type==="text"?{raw:ee[0],text:ee[0]}:{type:"text",raw:ee[0],text:ee[0]}}},de.escape=function(Q){var J=this.rules.inline.escape.exec(Q);if(J)return{type:"escape",raw:J[0],text:Y(J[1])}},de.tag=function(Q,J,ee){var se=this.rules.inline.tag.exec(Q);if(se)return!J&&/^<a /i.test(se[0])?J=!0:J&&/^<\/a>/i.test(se[0])&&(J=!1),!ee&&/^<(pre|code|kbd|script)(\s|>)/i.test(se[0])?ee=!0:ee&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(se[0])&&(ee=!1),{type:this.options.sanitize?"text":"html",raw:se[0],inLink:J,inRawBlock:ee,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(se[0]):Y(se[0]):se[0]}},de.link=function(Q){var J=this.rules.inline.link.exec(Q);if(J){var ee=q(J[2],"()");if(ee>-1){var se=J[0].indexOf("!")===0?5:4,fe=se+J[1].length+ee;J[2]=J[2].substring(0,ee),J[0]=J[0].substring(0,fe).trim(),J[3]=""}var Le=J[2],Ce="";if(this.options.pedantic){var Ie=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Le);Ie?(Le=Ie[1],Ce=Ie[3]):Ce=""}else Ce=J[3]?J[3].slice(1,-1):"";Le=Le.trim().replace(/^<([\s\S]*)>$/,"$1");var Ve=oe(J,{href:Le&&Le.replace(this.rules.inline._escapes,"$1"),title:Ce&&Ce.replace(this.rules.inline._escapes,"$1")},J[0]);return Ve}},de.reflink=function(Q,J){var ee;if((ee=this.rules.inline.reflink.exec(Q))||(ee=this.rules.inline.nolink.exec(Q))){var se=(ee[2]||ee[1]).replace(/\s+/g," ");if(se=J[se.toLowerCase()],!se||!se.href){var fe=ee[0].charAt(0);return{type:"text",raw:fe,text:fe}}var Le=oe(ee,se,ee[0]);return Le}},de.strong=function(Q,J,ee){ee===void 0&&(ee="");var se=this.rules.inline.strong.start.exec(Q);if(se&&(!se[1]||se[1]&&(ee===""||this.rules.inline.punctuation.exec(ee)))){J=J.slice(-1*Q.length);var fe=se[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;fe.lastIndex=0;for(var Le;(se=fe.exec(J))!=null;)if(Le=this.rules.inline.strong.middle.exec(J.slice(0,se.index+3)),Le)return{type:"strong",raw:Q.slice(0,Le[0].length),text:Q.slice(2,Le[0].length-2)}}},de.em=function(Q,J,ee){ee===void 0&&(ee="");var se=this.rules.inline.em.start.exec(Q);if(se&&(!se[1]||se[1]&&(ee===""||this.rules.inline.punctuation.exec(ee)))){J=J.slice(-1*Q.length);var fe=se[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;fe.lastIndex=0;for(var Le;(se=fe.exec(J))!=null;)if(Le=this.rules.inline.em.middle.exec(J.slice(0,se.index+2)),Le)return{type:"em",raw:Q.slice(0,Le[0].length),text:Q.slice(1,Le[0].length-1)}}},de.codespan=function(Q){var J=this.rules.inline.code.exec(Q);if(J){var ee=J[2].replace(/\n/g," "),se=/[^ ]/.test(ee),fe=ee.startsWith(" ")&&ee.endsWith(" ");return se&&fe&&(ee=ee.substring(1,ee.length-1)),ee=Y(ee,!0),{type:"codespan",raw:J[0],text:ee}}},de.br=function(Q){var J=this.rules.inline.br.exec(Q);if(J)return{type:"br",raw:J[0]}},de.del=function(Q){var J=this.rules.inline.del.exec(Q);if(J)return{type:"del",raw:J[0],text:J[1]}},de.autolink=function(Q,J){var ee=this.rules.inline.autolink.exec(Q);if(ee){var se,fe;return ee[2]==="@"?(se=Y(this.options.mangle?J(ee[1]):ee[1]),fe="mailto:"+se):(se=Y(ee[1]),fe=se),{type:"link",raw:ee[0],text:se,href:fe,tokens:[{type:"text",raw:se,text:se}]}}},de.url=function(Q,J){var ee;if(ee=this.rules.inline.url.exec(Q)){var se,fe;if(ee[2]==="@")se=Y(this.options.mangle?J(ee[0]):ee[0]),fe="mailto:"+se;else{var Le;do Le=ee[0],ee[0]=this.rules.inline._backpedal.exec(ee[0])[0];while(Le!==ee[0]);se=Y(ee[0]),ee[1]==="www."?fe="http://"+se:fe=se}return{type:"link",raw:ee[0],text:se,href:fe,tokens:[{type:"text",raw:se,text:se}]}}},de.inlineText=function(Q,J,ee){var se=this.rules.inline.text.exec(Q);if(se){var fe;return J?fe=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(se[0]):Y(se[0]):se[0]:fe=Y(this.options.smartypants?ee(se[0]):se[0]),{type:"text",raw:se[0],text:fe}}},pe}(),ge=W.noopTest,me=W.edit,le=W.merge,ie={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:ge,table:ge,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};ie._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,ie._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,ie.def=me(ie.def).replace("label",ie._label).replace("title",ie._title).getRegex(),ie.bullet=/(?:[*+-]|\d{1,9}[.)])/,ie.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,ie.item=me(ie.item,"gm").replace(/bull/g,ie.bullet).getRegex(),ie.list=me(ie.list).replace(/bull/g,ie.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+ie.def.source+")").getRegex(),ie._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",ie._comment=/<!--(?!-?>)[\s\S]*?-->/,ie.html=me(ie.html,"i").replace("comment",ie._comment).replace("tag",ie._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ie.paragraph=me(ie._paragraph).replace("hr",ie.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",ie._tag).getRegex(),ie.blockquote=me(ie.blockquote).replace("paragraph",ie.paragraph).getRegex(),ie.normal=le({},ie),ie.gfm=le({},ie.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*|$)"}),ie.gfm.nptable=me(ie.gfm.nptable).replace("hr",ie.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",ie._tag).getRegex(),ie.gfm.table=me(ie.gfm.table).replace("hr",ie.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",ie._tag).getRegex(),ie.pedantic=le({},ie.normal,{html:me(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ie._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:ge,paragraph:me(ie.normal._paragraph).replace("hr",ie.hr).replace("heading",` *#{1,6} *[^
]`).replace("lheading",ie.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var he={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:ge,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:ge,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};he._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",he.punctuation=me(he.punctuation).replace(/punctuation/g,he._punctuation).getRegex(),he._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",he._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",he.em.start=me(he.em.start).replace(/punctuation/g,he._punctuation).getRegex(),he.em.middle=me(he.em.middle).replace(/punctuation/g,he._punctuation).replace(/overlapSkip/g,he._overlapSkip).getRegex(),he.em.endAst=me(he.em.endAst,"g").replace(/punctuation/g,he._punctuation).getRegex(),he.em.endUnd=me(he.em.endUnd,"g").replace(/punctuation/g,he._punctuation).getRegex(),he.strong.start=me(he.strong.start).replace(/punctuation/g,he._punctuation).getRegex(),he.strong.middle=me(he.strong.middle).replace(/punctuation/g,he._punctuation).replace(/blockSkip/g,he._blockSkip).getRegex(),he.strong.endAst=me(he.strong.endAst,"g").replace(/punctuation/g,he._punctuation).getRegex(),he.strong.endUnd=me(he.strong.endUnd,"g").replace(/punctuation/g,he._punctuation).getRegex(),he.blockSkip=me(he._blockSkip,"g").getRegex(),he.overlapSkip=me(he._overlapSkip,"g").getRegex(),he._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,he._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,he._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])?)+(?![-_])/,he.autolink=me(he.autolink).replace("scheme",he._scheme).replace("email",he._email).getRegex(),he._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,he.tag=me(he.tag).replace("comment",ie._comment).replace("attribute",he._attribute).getRegex(),he._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,he._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,he._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,he.link=me(he.link).replace("label",he._label).replace("href",he._href).replace("title",he._title).getRegex(),he.reflink=me(he.reflink).replace("label",he._label).getRegex(),he.reflinkSearch=me(he.reflinkSearch,"g").replace("reflink",he.reflink).replace("nolink",he.nolink).getRegex(),he.normal=le({},he),he.pedantic=le({},he.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:me(/^!?\[(label)\]\((.*?)\)/).replace("label",he._label).getRegex(),reflink:me(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",he._label).getRegex()}),he.gfm=le({},he.normal,{escape:me(he.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),he.gfm.url=me(he.gfm.url,"i").replace("email",he.gfm._extended_email).getRegex(),he.breaks=le({},he.gfm,{br:me(he.br).replace("{2,}","*").getRegex(),text:me(he.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var $={block:ie,inline:he},te=B.defaults,Z=$.block,be=$.inline;function Ae(pe){return pe.replace(/---/g,"\u2014").replace(/--/g,"\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1\u201C").replace(/"/g,"\u201D").replace(/\.{3}/g,"\u2026")}function ye(pe){var de="",ce,Q,J=pe.length;for(ce=0;ce<J;ce++)Q=pe.charCodeAt(ce),Math.random()>.5&&(Q="x"+Q.toString(16)),de+="&#"+Q+";";return de}var we=function(){function pe(ce){this.tokens=[],this.tokens.links=Object.create(null),this.options=ce||te,this.options.tokenizer=this.options.tokenizer||new ve,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var Q={block:Z.normal,inline:be.normal};this.options.pedantic?(Q.block=Z.pedantic,Q.inline=be.pedantic):this.options.gfm&&(Q.block=Z.gfm,this.options.breaks?Q.inline=be.breaks:Q.inline=be.gfm),this.tokenizer.rules=Q}pe.lex=function(Q,J){var ee=new pe(J);return ee.lex(Q)};var de=pe.prototype;return de.lex=function(Q){return Q=Q.replace(/\r\n|\r/g,`
`).replace(/\t/g," "),this.blockTokens(Q,this.tokens,!0),this.inline(this.tokens),this.tokens},de.blockTokens=function(Q,J,ee){J===void 0&&(J=[]),ee===void 0&&(ee=!0),Q=Q.replace(/^ +$/gm,"");for(var se,fe,Le,Ce;Q;){if(se=this.tokenizer.space(Q)){Q=Q.substring(se.raw.length),se.type&&J.push(se);continue}if(se=this.tokenizer.code(Q,J)){Q=Q.substring(se.raw.length),se.type?J.push(se):(Ce=J[J.length-1],Ce.raw+=`
`+se.raw,Ce.text+=`
`+se.text);continue}if(se=this.tokenizer.fences(Q)){Q=Q.substring(se.raw.length),J.push(se);continue}if(se=this.tokenizer.heading(Q)){Q=Q.substring(se.raw.length),J.push(se);continue}if(se=this.tokenizer.nptable(Q)){Q=Q.substring(se.raw.length),J.push(se);continue}if(se=this.tokenizer.hr(Q)){Q=Q.substring(se.raw.length),J.push(se);continue}if(se=this.tokenizer.blockquote(Q)){Q=Q.substring(se.raw.length),se.tokens=this.blockTokens(se.text,[],ee),J.push(se);continue}if(se=this.tokenizer.list(Q)){for(Q=Q.substring(se.raw.length),Le=se.items.length,fe=0;fe<Le;fe++)se.items[fe].tokens=this.blockTokens(se.items[fe].text,[],!1);J.push(se);continue}if(se=this.tokenizer.html(Q)){Q=Q.substring(se.raw.length),J.push(se);continue}if(ee&&(se=this.tokenizer.def(Q))){Q=Q.substring(se.raw.length),this.tokens.links[se.tag]||(this.tokens.links[se.tag]={href:se.href,title:se.title});continue}if(se=this.tokenizer.table(Q)){Q=Q.substring(se.raw.length),J.push(se);continue}if(se=this.tokenizer.lheading(Q)){Q=Q.substring(se.raw.length),J.push(se);continue}if(ee&&(se=this.tokenizer.paragraph(Q))){Q=Q.substring(se.raw.length),J.push(se);continue}if(se=this.tokenizer.text(Q,J)){Q=Q.substring(se.raw.length),se.type?J.push(se):(Ce=J[J.length-1],Ce.raw+=`
`+se.raw,Ce.text+=`
`+se.text);continue}if(Q){var Ie="Infinite loop on byte: "+Q.charCodeAt(0);if(this.options.silent){console.error(Ie);break}else throw new Error(Ie)}}return J},de.inline=function(Q){var J,ee,se,fe,Le,Ce,Ie=Q.length;for(J=0;J<Ie;J++){Ce=Q[J];switch(Ce.type){case"paragraph":case"text":case"heading":{Ce.tokens=[],this.inlineTokens(Ce.text,Ce.tokens);break}case"table":{for(Ce.tokens={header:[],cells:[]},fe=Ce.header.length,ee=0;ee<fe;ee++)Ce.tokens.header[ee]=[],this.inlineTokens(Ce.header[ee],Ce.tokens.header[ee]);for(fe=Ce.cells.length,ee=0;ee<fe;ee++)for(Le=Ce.cells[ee],Ce.tokens.cells[ee]=[],se=0;se<Le.length;se++)Ce.tokens.cells[ee][se]=[],this.inlineTokens(Le[se],Ce.tokens.cells[ee][se]);break}case"blockquote":{this.inline(Ce.tokens);break}case"list":{for(fe=Ce.items.length,ee=0;ee<fe;ee++)this.inline(Ce.items[ee].tokens);break}}}return Q},de.inlineTokens=function(Q,J,ee,se,fe){J===void 0&&(J=[]),ee===void 0&&(ee=!1),se===void 0&&(se=!1),fe===void 0&&(fe="");var Le,Ce=Q,Ie;if(this.tokens.links){var Ve=Object.keys(this.tokens.links);if(Ve.length>0)for(;(Ie=this.tokenizer.rules.inline.reflinkSearch.exec(Ce))!=null;)Ve.includes(Ie[0].slice(Ie[0].lastIndexOf("[")+1,-1))&&(Ce=Ce.slice(0,Ie.index)+"["+"a".repeat(Ie[0].length-2)+"]"+Ce.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(Ie=this.tokenizer.rules.inline.blockSkip.exec(Ce))!=null;)Ce=Ce.slice(0,Ie.index)+"["+"a".repeat(Ie[0].length-2)+"]"+Ce.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;Q;){if(Le=this.tokenizer.escape(Q)){Q=Q.substring(Le.raw.length),J.push(Le);continue}if(Le=this.tokenizer.tag(Q,ee,se)){Q=Q.substring(Le.raw.length),ee=Le.inLink,se=Le.inRawBlock,J.push(Le);continue}if(Le=this.tokenizer.link(Q)){Q=Q.substring(Le.raw.length),Le.type==="link"&&(Le.tokens=this.inlineTokens(Le.text,[],!0,se)),J.push(Le);continue}if(Le=this.tokenizer.reflink(Q,this.tokens.links)){Q=Q.substring(Le.raw.length),Le.type==="link"&&(Le.tokens=this.inlineTokens(Le.text,[],!0,se)),J.push(Le);continue}if(Le=this.tokenizer.strong(Q,Ce,fe)){Q=Q.substring(Le.raw.length),Le.tokens=this.inlineTokens(Le.text,[],ee,se),J.push(Le);continue}if(Le=this.tokenizer.em(Q,Ce,fe)){Q=Q.substring(Le.raw.length),Le.tokens=this.inlineTokens(Le.text,[],ee,se),J.push(Le);continue}if(Le=this.tokenizer.codespan(Q)){Q=Q.substring(Le.raw.length),J.push(Le);continue}if(Le=this.tokenizer.br(Q)){Q=Q.substring(Le.raw.length),J.push(Le);continue}if(Le=this.tokenizer.del(Q)){Q=Q.substring(Le.raw.length),Le.tokens=this.inlineTokens(Le.text,[],ee,se),J.push(Le);continue}if(Le=this.tokenizer.autolink(Q,ye)){Q=Q.substring(Le.raw.length),J.push(Le);continue}if(!ee&&(Le=this.tokenizer.url(Q,ye))){Q=Q.substring(Le.raw.length),J.push(Le);continue}if(Le=this.tokenizer.inlineText(Q,se,Ae)){Q=Q.substring(Le.raw.length),fe=Le.raw.slice(-1),J.push(Le);continue}if(Q){var Ge="Infinite loop on byte: "+Q.charCodeAt(0);if(this.options.silent){console.error(Ge);break}else throw new Error(Ge)}}return J},X(pe,null,[{key:"rules",get:function(){return{block:Z,inline:be}}}]),pe}(),De=B.defaults,Re=W.cleanUrl,Me=W.escape,ke=function(){function pe(ce){this.options=ce||De}var de=pe.prototype;return de.code=function(Q,J,ee){var se=(J||"").match(/\S*/)[0];if(this.options.highlight){var fe=this.options.highlight(Q,se);fe!=null&&fe!==Q&&(ee=!0,Q=fe)}return se?'<pre><code class="'+this.options.langPrefix+Me(se,!0)+'">'+(ee?Q:Me(Q,!0))+`</code></pre>
`:"<pre><code>"+(ee?Q:Me(Q,!0))+`</code></pre>
`},de.blockquote=function(Q){return`<blockquote>
`+Q+`</blockquote>
`},de.html=function(Q){return Q},de.heading=function(Q,J,ee,se){return this.options.headerIds?"<h"+J+' id="'+this.options.headerPrefix+se.slug(ee)+'">'+Q+"</h"+J+`>
`:"<h"+J+">"+Q+"</h"+J+`>
`},de.hr=function(){return this.options.xhtml?`<hr/>
`:`<hr>
`},de.list=function(Q,J,ee){var se=J?"ol":"ul",fe=J&&ee!==1?' start="'+ee+'"':"";return"<"+se+fe+`>
`+Q+"</"+se+`>
`},de.listitem=function(Q){return"<li>"+Q+`</li>
`},de.checkbox=function(Q){return"<input "+(Q?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},de.paragraph=function(Q){return"<p>"+Q+`</p>
`},de.table=function(Q,J){return J&&(J="<tbody>"+J+"</tbody>"),`<table>
<thead>
`+Q+`</thead>
`+J+`</table>
`},de.tablerow=function(Q){return`<tr>
`+Q+`</tr>
`},de.tablecell=function(Q,J){var ee=J.header?"th":"td",se=J.align?"<"+ee+' align="'+J.align+'">':"<"+ee+">";return se+Q+"</"+ee+`>
`},de.strong=function(Q){return"<strong>"+Q+"</strong>"},de.em=function(Q){return"<em>"+Q+"</em>"},de.codespan=function(Q){return"<code>"+Q+"</code>"},de.br=function(){return this.options.xhtml?"<br/>":"<br>"},de.del=function(Q){return"<del>"+Q+"</del>"},de.link=function(Q,J,ee){if(Q=Re(this.options.sanitize,this.options.baseUrl,Q),Q===null)return ee;var se='<a href="'+Me(Q)+'"';return J&&(se+=' title="'+J+'"'),se+=">"+ee+"</a>",se},de.image=function(Q,J,ee){if(Q=Re(this.options.sanitize,this.options.baseUrl,Q),Q===null)return ee;var se='<img src="'+Q+'" alt="'+ee+'"';return J&&(se+=' title="'+J+'"'),se+=this.options.xhtml?"/>":">",se},de.text=function(Q){return Q},pe}(),Oe=function(){function pe(){}var de=pe.prototype;return de.strong=function(Q){return Q},de.em=function(Q){return Q},de.codespan=function(Q){return Q},de.del=function(Q){return Q},de.html=function(Q){return Q},de.text=function(Q){return Q},de.link=function(Q,J,ee){return""+ee},de.image=function(Q,J,ee){return""+ee},de.br=function(){return""},pe}(),ze=function(){function pe(){this.seen={}}var de=pe.prototype;return de.slug=function(Q){var J=Q.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(J)){var ee=J;do this.seen[ee]++,J=ee+"-"+this.seen[ee];while(this.seen.hasOwnProperty(J))}return this.seen[J]=0,J},pe}(),Ze=B.defaults,je=W.unescape,Xe=function(){function pe(ce){this.options=ce||Ze,this.options.renderer=this.options.renderer||new ke,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Oe,this.slugger=new ze}pe.parse=function(Q,J){var ee=new pe(J);return ee.parse(Q)};var de=pe.prototype;return de.parse=function(Q,J){J===void 0&&(J=!0);var ee="",se,fe,Le,Ce,Ie,Ve,Ge,gt,ct,st,wt,ot,yt,xt,Ye,fr,sr,lr,_t=Q.length;for(se=0;se<_t;se++){st=Q[se];switch(st.type){case"space":continue;case"hr":{ee+=this.renderer.hr();continue}case"heading":{ee+=this.renderer.heading(this.parseInline(st.tokens),st.depth,je(this.parseInline(st.tokens,this.textRenderer)),this.slugger);continue}case"code":{ee+=this.renderer.code(st.text,st.lang,st.escaped);continue}case"table":{for(gt="",Ge="",Ce=st.header.length,fe=0;fe<Ce;fe++)Ge+=this.renderer.tablecell(this.parseInline(st.tokens.header[fe]),{header:!0,align:st.align[fe]});for(gt+=this.renderer.tablerow(Ge),ct="",Ce=st.cells.length,fe=0;fe<Ce;fe++){for(Ve=st.tokens.cells[fe],Ge="",Ie=Ve.length,Le=0;Le<Ie;Le++)Ge+=this.renderer.tablecell(this.parseInline(Ve[Le]),{header:!1,align:st.align[Le]});ct+=this.renderer.tablerow(Ge)}ee+=this.renderer.table(gt,ct);continue}case"blockquote":{ct=this.parse(st.tokens),ee+=this.renderer.blockquote(ct);continue}case"list":{for(wt=st.ordered,ot=st.start,yt=st.loose,Ce=st.items.length,ct="",fe=0;fe<Ce;fe++)Ye=st.items[fe],fr=Ye.checked,sr=Ye.task,xt="",Ye.task&&(lr=this.renderer.checkbox(fr),yt?Ye.tokens.length>0&&Ye.tokens[0].type==="text"?(Ye.tokens[0].text=lr+" "+Ye.tokens[0].text,Ye.tokens[0].tokens&&Ye.tokens[0].tokens.length>0&&Ye.tokens[0].tokens[0].type==="text"&&(Ye.tokens[0].tokens[0].text=lr+" "+Ye.tokens[0].tokens[0].text)):Ye.tokens.unshift({type:"text",text:lr}):xt+=lr),xt+=this.parse(Ye.tokens,yt),ct+=this.renderer.listitem(xt,sr,fr);ee+=this.renderer.list(ct,wt,ot);continue}case"html":{ee+=this.renderer.html(st.text);continue}case"paragraph":{ee+=this.renderer.paragraph(this.parseInline(st.tokens));continue}case"text":{for(ct=st.tokens?this.parseInline(st.tokens):st.text;se+1<_t&&Q[se+1].type==="text";)st=Q[++se],ct+=`
`+(st.tokens?this.parseInline(st.tokens):st.text);ee+=J?this.renderer.paragraph(ct):ct;continue}default:{var ur='Token with "'+st.type+'" type was not found.';if(this.options.silent){console.error(ur);return}else throw new Error(ur)}}}return ee},de.parseInline=function(Q,J){J=J||this.renderer;var ee="",se,fe,Le=Q.length;for(se=0;se<Le;se++){fe=Q[se];switch(fe.type){case"escape":{ee+=J.text(fe.text);break}case"html":{ee+=J.html(fe.text);break}case"link":{ee+=J.link(fe.href,fe.title,this.parseInline(fe.tokens,J));break}case"image":{ee+=J.image(fe.href,fe.title,fe.text);break}case"strong":{ee+=J.strong(this.parseInline(fe.tokens,J));break}case"em":{ee+=J.em(this.parseInline(fe.tokens,J));break}case"codespan":{ee+=J.codespan(fe.text);break}case"br":{ee+=J.br();break}case"del":{ee+=J.del(this.parseInline(fe.tokens,J));break}case"text":{ee+=J.text(fe.text);break}default:{var Ce='Token with "'+fe.type+'" type was not found.';if(this.options.silent){console.error(Ce);return}else throw new Error(Ce)}}}return ee},pe}(),et=W.merge,We=W.checkSanitizeDeprecation,Be=W.escape,Se=B.getDefaults,qe=B.changeDefaults,Je=B.defaults;function _e(pe,de,ce){if(typeof pe=="undefined"||pe===null)throw new Error("marked(): input parameter is undefined or null");if(typeof pe!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(pe)+", string expected");if(typeof de=="function"&&(ce=de,de=null),de=et({},_e.defaults,de||{}),We(de),ce){var Q=de.highlight,J;try{J=we.lex(pe,de)}catch(Le){return ce(Le)}var ee=function(Ce){var Ie;if(!Ce)try{Ie=Xe.parse(J,de)}catch(Ve){Ce=Ve}return de.highlight=Q,Ce?ce(Ce):ce(null,Ie)};if(!Q||Q.length<3)return ee();if(delete de.highlight,!J.length)return ee();var se=0;_e.walkTokens(J,function(Le){Le.type==="code"&&(se++,setTimeout(function(){Q(Le.text,Le.lang,function(Ce,Ie){if(Ce)return ee(Ce);Ie!=null&&Ie!==Le.text&&(Le.text=Ie,Le.escaped=!0),se--,se===0&&ee()})},0))}),se===0&&ee();return}try{var fe=we.lex(pe,de);return de.walkTokens&&_e.walkTokens(fe,de.walkTokens),Xe.parse(fe,de)}catch(Le){if(Le.message+=`
Please report this to https://github.com/markedjs/marked.`,de.silent)return"<p>An error occurred:</p><pre>"+Be(Le.message+"",!0)+"</pre>";throw Le}}_e.options=_e.setOptions=function(pe){return et(_e.defaults,pe),qe(_e.defaults),_e},_e.getDefaults=Se,_e.defaults=Je,_e.use=function(pe){var de=et({},pe);if(pe.renderer&&function(){var Q=_e.defaults.renderer||new ke,J=function(fe){var Le=Q[fe];Q[fe]=function(){for(var Ce=arguments.length,Ie=new Array(Ce),Ve=0;Ve<Ce;Ve++)Ie[Ve]=arguments[Ve];var Ge=pe.renderer[fe].apply(Q,Ie);return Ge===!1&&(Ge=Le.apply(Q,Ie)),Ge}};for(var ee in pe.renderer)J(ee);de.renderer=Q}(),pe.tokenizer&&function(){var Q=_e.defaults.tokenizer||new ve,J=function(fe){var Le=Q[fe];Q[fe]=function(){for(var Ce=arguments.length,Ie=new Array(Ce),Ve=0;Ve<Ce;Ve++)Ie[Ve]=arguments[Ve];var Ge=pe.tokenizer[fe].apply(Q,Ie);return Ge===!1&&(Ge=Le.apply(Q,Ie)),Ge}};for(var ee in pe.tokenizer)J(ee);de.tokenizer=Q}(),pe.walkTokens){var ce=_e.defaults.walkTokens;de.walkTokens=function(Q){pe.walkTokens(Q),ce&&ce(Q)}}_e.setOptions(de)},_e.walkTokens=function(pe,de){for(var ce=I(pe),Q;!(Q=ce()).done;){var J=Q.value;de(J);switch(J.type){case"table":{for(var ee=I(J.tokens.header),se;!(se=ee()).done;){var fe=se.value;_e.walkTokens(fe,de)}for(var Le=I(J.tokens.cells),Ce;!(Ce=Le()).done;)for(var Ie=Ce.value,Ve=I(Ie),Ge;!(Ge=Ve()).done;){var gt=Ge.value;_e.walkTokens(gt,de)}break}case"list":{_e.walkTokens(J.items,de);break}default:J.tokens&&_e.walkTokens(J.tokens,de)}}},_e.Parser=Xe,_e.parser=Xe.parse,_e.Renderer=ke,_e.TextRenderer=Oe,_e.Lexer=we,_e.lexer=we.lex,_e.Tokenizer=ve,_e.Slugger=ze,_e.parse=_e;var Ne=_e;return Ne})},ELLl:function(ft,rt,ne){(function(re){re(ne("VrN/"))})(function(re){var X={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},L=re.Pos;re.defineOption("autoCloseBrackets",!1,function(T,m,u){u&&u!=re.Init&&(T.removeKeyMap(I),T.state.closeBrackets=null),m&&(R(z(m,"pairs")),T.state.closeBrackets=m,T.addKeyMap(I))});function z(T,m){return m=="pairs"&&typeof T=="string"?T:typeof T=="object"&&T[m]!=null?T[m]:X[m]}var I={Backspace:P,Enter:D};function R(T){for(var m=0;m<T.length;m++){var u=T.charAt(m),o="'"+u+"'";I[o]||(I[o]=B(u))}}R(X.pairs+"`");function B(T){return function(m){return S(m,T)}}function U(T){var m=T.state.closeBrackets;if(!m||m.override)return m;var u=T.getModeAt(T.getCursor());return u.closeBrackets||m}function P(T){var m=U(T);if(!m||T.getOption("disableInput"))return re.Pass;for(var u=z(m,"pairs"),o=T.listSelections(),l=0;l<o.length;l++){if(!o[l].empty())return re.Pass;var s=_(T,o[l].head);if(!s||u.indexOf(s)%2!=0)return re.Pass}for(var l=o.length-1;l>=0;l--){var w=o[l].head;T.replaceRange("",L(w.line,w.ch-1),L(w.line,w.ch+1),"+delete")}}function D(T){var m=U(T),u=m&&z(m,"explode");if(!u||T.getOption("disableInput"))return re.Pass;for(var o=T.listSelections(),l=0;l<o.length;l++){if(!o[l].empty())return re.Pass;var s=_(T,o[l].head);if(!s||u.indexOf(s)%2!=0)return re.Pass}T.operation(function(){var w=T.lineSeparator()||`
`;T.replaceSelection(w+w,null),T.execCommand("goCharLeft"),o=T.listSelections();for(var p=0;p<o.length;p++){var c=o[p].head.line;T.indentLine(c,null,!0),T.indentLine(c+1,null,!0)}})}function v(T){var m=re.cmpPos(T.anchor,T.head)>0;return{anchor:new L(T.anchor.line,T.anchor.ch+(m?-1:1)),head:new L(T.head.line,T.head.ch+(m?1:-1))}}function S(T,m){var u=U(T);if(!u||T.getOption("disableInput"))return re.Pass;var o=z(u,"pairs"),l=o.indexOf(m);if(l==-1)return re.Pass;for(var s=z(u,"closeBefore"),w=z(u,"triples"),p=o.charAt(l+1)==m,c=T.listSelections(),A=l%2==0,y,f=0;f<c.length;f++){var h=c[f],d=h.head,a,b=T.getRange(d,L(d.line,d.ch+1));if(A&&!h.empty())a="surround";else if((p||!A)&&b==m)p&&C(T,d)?a="both":w.indexOf(m)>=0&&T.getRange(d,L(d.line,d.ch+3))==m+m+m?a="skipThree":a="skip";else if(p&&d.ch>1&&w.indexOf(m)>=0&&T.getRange(L(d.line,d.ch-2),d)==m+m){if(d.ch>2&&/\bstring/.test(T.getTokenTypeAt(L(d.line,d.ch-2))))return re.Pass;a="addFour"}else if(p){var g=d.ch==0?" ":T.getRange(L(d.line,d.ch-1),d);if(!re.isWordChar(b)&&g!=m&&!re.isWordChar(g))a="both";else return re.Pass}else if(A&&(b.length===0||/\s/.test(b)||s.indexOf(b)>-1))a="both";else return re.Pass;if(!y)y=a;else if(y!=a)return re.Pass}var E=l%2?o.charAt(l-1):m,M=l%2?m:o.charAt(l+1);T.operation(function(){if(y=="skip")T.execCommand("goCharRight");else if(y=="skipThree")for(var F=0;F<3;F++)T.execCommand("goCharRight");else if(y=="surround"){for(var j=T.getSelections(),F=0;F<j.length;F++)j[F]=E+j[F]+M;T.replaceSelections(j,"around"),j=T.listSelections().slice();for(var F=0;F<j.length;F++)j[F]=v(j[F]);T.setSelections(j)}else y=="both"?(T.replaceSelection(E+M,null),T.triggerElectric(E+M),T.execCommand("goCharLeft")):y=="addFour"&&(T.replaceSelection(E+E+E+E,"before"),T.execCommand("goCharRight"))})}function _(T,m){var u=T.getRange(L(m.line,m.ch-1),L(m.line,m.ch+1));return u.length==2?u:null}function C(T,m){var u=T.getTokenAt(L(m.line,m.ch+1));return/\bstring/.test(u.type)&&u.start==m.ch&&(m.ch==0||!/\bstring/.test(T.getTokenTypeAt(m)))}})},GfqC:function(ft,rt,ne){"use strict";var re=ne("cDcd"),X=ne.n(re),L=ne("TSYQ"),z=ne.n(L);function I(W,O){var k="cannot "+W.method+" "+W.action+" "+O.status+"'",K=new Error(k);return K.status=O.status,K.method=W.method,K.url=W.action,K}function R(W){var O=W.responseText||W.response;if(!O)return O;try{return JSON.parse(O)}catch(k){return O}}function B(W){var O=new XMLHttpRequest;W.onProgress&&O.upload&&(O.upload.onprogress=function(q){q.total>0&&(q.percent=q.loaded/q.total*100),W.onProgress(q)});var k=new FormData;W.data&&Object.keys(W.data).forEach(function(Y){var q=W.data[Y];if(Array.isArray(q)){q.forEach(function(oe){k.append(Y+"[]",oe)});return}k.append(Y,W.data[Y])}),W.file instanceof Blob?k.append(W.filename,W.file,W.file.name):k.append(W.filename,W.file),O.onerror=function(q){W.onError(q)},O.onload=function(){return O.status<200||O.status>=300?W.onError(I(W,O),R(O)):W.onSuccess(R(O),O)},O.open(W.method,W.action,!0),W.withCredentials&&"withCredentials"in O&&(O.withCredentials=!0);var K=W.headers||{};return K["X-Requested-With"]!==null&&O.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(K).forEach(function(Y){K[Y]!==null&&O.setRequestHeader(Y,K[Y])}),O.send(k),{abort:function(){O.abort()}}}var U=+new Date,P=0;function D(){return"rc-upload-"+U+"-"+ ++P}function v(W,O){return W.indexOf(O,W.length-O.length)!==-1}var S=function(W,O){if(W&&O){var k=Array.isArray(O)?O:O.split(","),K=W.name||"",Y=W.type||"",q=Y.replace(/\/.*$/,"");return k.some(function(oe){var Te=oe.trim();return Te.charAt(0)==="."?v(K.toLowerCase(),Te.toLowerCase()):/\/\*$/.test(Te)?q===Te.replace(/\/.*$/,""):Y===Te})}return!0};function _(W,O){var k=W.createReader(),K=[];function Y(){k.readEntries(function(q){var oe=Array.prototype.slice.apply(q);K=K.concat(oe);var Te=!oe.length;Te?O(K):Y()})}Y()}var C=function(O,k,K){var Y=function q(oe,Te){Te=Te||"",oe.isFile?oe.file(function(ve){K(ve)&&(oe.fullPath&&!ve.webkitRelativePath&&(Object.defineProperties(ve,{webkitRelativePath:{writable:!0}}),ve.webkitRelativePath=oe.fullPath.replace(/^\//,""),Object.defineProperties(ve,{webkitRelativePath:{writable:!1}})),k([ve]))}):oe.isDirectory&&_(oe,function(ve){ve.forEach(function(ge){q(ge,""+Te+oe.name+"/")})})};O.forEach(function(q){Y(q.webkitGetAsEntry())})},T=C,m=Object.assign||function(W){for(var O=1;O<arguments.length;O++){var k=arguments[O];for(var K in k)Object.prototype.hasOwnProperty.call(k,K)&&(W[K]=k[K])}return W},u=function(){function W(O,k){var K=[],Y=!0,q=!1,oe=void 0;try{for(var Te=O[Symbol.iterator](),ve;!(Y=(ve=Te.next()).done)&&!(K.push(ve.value),k&&K.length===k);Y=!0);}catch(ge){q=!0,oe=ge}finally{try{!Y&&Te.return&&Te.return()}finally{if(q)throw oe}}return K}return function(O,k){if(Array.isArray(O))return O;if(Symbol.iterator in Object(O))return W(O,k);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),o=function(){function W(O,k){for(var K=0;K<k.length;K++){var Y=k[K];Y.enumerable=Y.enumerable||!1,Y.configurable=!0,"value"in Y&&(Y.writable=!0),Object.defineProperty(O,Y.key,Y)}}return function(O,k,K){return k&&W(O.prototype,k),K&&W(O,K),O}}();function l(W,O,k){return O in W?Object.defineProperty(W,O,{value:k,enumerable:!0,configurable:!0,writable:!0}):W[O]=k,W}function s(W,O){var k={};for(var K in W){if(O.indexOf(K)>=0)continue;if(!Object.prototype.hasOwnProperty.call(W,K))continue;k[K]=W[K]}return k}function w(W,O){if(!(W instanceof O))throw new TypeError("Cannot call a class as a function")}function p(W,O){if(!W)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return O&&(typeof O=="object"||typeof O=="function")?O:W}function c(W,O){if(typeof O!="function"&&O!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof O);W.prototype=Object.create(O&&O.prototype,{constructor:{value:W,enumerable:!1,writable:!0,configurable:!0}}),O&&(Object.setPrototypeOf?Object.setPrototypeOf(W,O):W.__proto__=O)}var A=function(O){return Object.keys(O).reduce(function(k,K){return(K.substr(0,5)==="data-"||K.substr(0,5)==="aria-"||K==="role")&&(k[K]=O[K]),k},{})},y=function(W){c(O,W);function O(){var k,K,Y,q;w(this,O);for(var oe=arguments.length,Te=Array(oe),ve=0;ve<oe;ve++)Te[ve]=arguments[ve];return q=(K=(Y=p(this,(k=O.__proto__||Object.getPrototypeOf(O)).call.apply(k,[this].concat(Te))),Y),Y.state={uid:D()},Y.reqs={},Y.onChange=function(ge){var me=ge.target.files;Y.uploadFiles(me),Y.reset()},Y.onClick=function(ge){var me=Y.fileInput;if(!me)return;var le=Y.props,ie=le.children,he=le.onClick;ie&&ie.type==="button"&&(me.parentNode.focus(),me.parentNode.querySelector("button").blur()),me.click(),he&&he(ge)},Y.onKeyDown=function(ge){ge.key==="Enter"&&Y.onClick()},Y.onFileDrop=function(ge){var me=Y.props.multiple;if(ge.preventDefault(),ge.type==="dragover")return;if(Y.props.directory)T(Array.prototype.slice.call(ge.dataTransfer.items),Y.uploadFiles,function(ie){return S(ie,Y.props.accept)});else{var le=Array.prototype.slice.call(ge.dataTransfer.files).filter(function(ie){return S(ie,Y.props.accept)});me===!1&&(le=le.slice(0,1)),Y.uploadFiles(le)}},Y.uploadFiles=function(ge){var me=Array.prototype.slice.call(ge);me.map(function(le){return le.uid=D(),le}).forEach(function(le){Y.upload(le,me)})},Y.saveFileInput=function(ge){Y.fileInput=ge},K),p(Y,q)}return o(O,[{key:"componentDidMount",value:function(){this._isMounted=!0}},{key:"componentWillUnmount",value:function(){this._isMounted=!1,this.abort()}},{key:"upload",value:function(K,Y){var q=this,oe=this.props;if(!oe.beforeUpload)return setTimeout(function(){return q.post(K)},0);var Te=oe.beforeUpload(K,Y);Te&&Te.then?Te.then(function(ve){var ge=Object.prototype.toString.call(ve);return ge==="[object File]"||ge==="[object Blob]"?q.post(ve):q.post(K)}).catch(function(ve){console.log(ve)}):Te!==!1&&setTimeout(function(){return q.post(K)},0);return}},{key:"post",value:function(K){var Y=this;if(!this._isMounted)return;var q=this.props,oe=q.onStart,Te=q.onProgress,ve=q.transformFile,ge=ve===void 0?function(me){return me}:ve;new Promise(function(me){var le=q.action;return typeof le=="function"&&(le=le(K)),me(le)}).then(function(me){var le=K.uid,ie=q.customRequest||B,he=Promise.resolve(ge(K)).then(function($){var te=q.data;return typeof te=="function"&&(te=te($)),Promise.all([$,te])}).catch(function($){console.error($)});he.then(function($){var te=u($,2),Z=te[0],be=te[1],Ae={action:me,filename:q.name,data:be,file:Z,headers:q.headers,withCredentials:q.withCredentials,method:q.method||"post",onProgress:Te?function(ye){Te(ye,K)}:null,onSuccess:function(we,De){delete Y.reqs[le],q.onSuccess(we,K,De)},onError:function(we,De){delete Y.reqs[le],q.onError(we,De,K)}};oe(K),Y.reqs[le]=ie(Ae)})})}},{key:"reset",value:function(){this.setState({uid:D()})}},{key:"abort",value:function(K){var Y=this.reqs;if(K){var q=K;K&&K.uid&&(q=K.uid),Y[q]&&Y[q].abort&&Y[q].abort(),delete Y[q]}else Object.keys(Y).forEach(function(oe){Y[oe]&&Y[oe].abort&&Y[oe].abort(),delete Y[oe]})}},{key:"render",value:function(){var K,Y=this.props,q=Y.component,oe=Y.prefixCls,Te=Y.className,ve=Y.disabled,ge=Y.id,me=Y.style,le=Y.multiple,ie=Y.accept,he=Y.children,$=Y.directory,te=Y.openFileDialogOnClick,Z=Y.onMouseEnter,be=Y.onMouseLeave,Ae=s(Y,["component","prefixCls","className","disabled","id","style","multiple","accept","children","directory","openFileDialogOnClick","onMouseEnter","onMouseLeave"]),ye=z()((K={},l(K,oe,!0),l(K,oe+"-disabled",ve),l(K,Te,Te),K)),we=ve?{}:{onClick:te?this.onClick:function(){},onKeyDown:te?this.onKeyDown:function(){},onMouseEnter:Z,onMouseLeave:be,onDrop:this.onFileDrop,onDragOver:this.onFileDrop,tabIndex:"0"};return X.a.createElement(q,m({},we,{className:ye,role:"button",style:me}),X.a.createElement("input",m({},A(Ae),{id:ge,type:"file",ref:this.saveFileInput,onClick:function(Re){return Re.stopPropagation()},key:this.state.uid,style:{display:"none"},accept:ie,directory:$?"directory":null,webkitdirectory:$?"webkitdirectory":null,multiple:le,onChange:this.onChange})),he)}}]),O}(re.Component),f=y,h=Object.assign||function(W){for(var O=1;O<arguments.length;O++){var k=arguments[O];for(var K in k)Object.prototype.hasOwnProperty.call(k,K)&&(W[K]=k[K])}return W},d=function(){function W(O,k){for(var K=0;K<k.length;K++){var Y=k[K];Y.enumerable=Y.enumerable||!1,Y.configurable=!0,"value"in Y&&(Y.writable=!0),Object.defineProperty(O,Y.key,Y)}}return function(O,k,K){return k&&W(O.prototype,k),K&&W(O,K),O}}();function a(W,O){if(!(W instanceof O))throw new TypeError("Cannot call a class as a function")}function b(W,O){if(!W)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return O&&(typeof O=="object"||typeof O=="function")?O:W}function g(W,O){if(typeof O!="function"&&O!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof O);W.prototype=Object.create(O&&O.prototype,{constructor:{value:W,enumerable:!1,writable:!0,configurable:!0}}),O&&(Object.setPrototypeOf?Object.setPrototypeOf(W,O):W.__proto__=O)}function E(){}var M=function(W){g(O,W);function O(){var k,K,Y,q;a(this,O);for(var oe=arguments.length,Te=Array(oe),ve=0;ve<oe;ve++)Te[ve]=arguments[ve];return q=(K=(Y=b(this,(k=O.__proto__||Object.getPrototypeOf(O)).call.apply(k,[this].concat(Te))),Y),Y.saveUploader=function(ge){Y.uploader=ge},K),b(Y,q)}return d(O,[{key:"abort",value:function(K){this.uploader.abort(K)}},{key:"render",value:function(){return X.a.createElement(f,h({},this.props,{ref:this.saveUploader}))}}]),O}(re.Component);M.defaultProps={component:"span",prefixCls:"rc-upload",data:{},headers:{},name:"file",multipart:!1,onStart:E,onError:E,onSuccess:E,multiple:!1,beforeUpload:null,customRequest:null,withCredentials:!1,openFileDialogOnClick:!0};var F=M,j=rt.a=F},HmJG:function(ft,rt,ne){},LdHM:function(ft,rt,ne){"use strict";ne.d(rt,"b",function(){return s}),ne.d(rt,"a",function(){return p});var re=ne("1OyB"),X=ne("vuIU"),L=ne("Ji7U"),z=ne("LK+K"),I=ne("cDcd"),R=ne("rePB"),B=ne("Ff2n"),U=ne("ODXe"),P=ne("4IlW"),D=ne("bX4T"),v=ne("YrtM"),S=ne("TSYQ"),_=ne.n(S),C=ne("+nKL"),T=ne("8OUc"),m=function(K,Y){var q=K.prefixCls,oe=K.id,Te=K.flattenOptions,ve=K.childrenAsData,ge=K.values,me=K.searchValue,le=K.multiple,ie=K.defaultActiveFirstOption,he=K.height,$=K.itemHeight,te=K.notFoundContent,Z=K.open,be=K.menuItemSelectedIcon,Ae=K.virtual,ye=K.onSelect,we=K.onToggleOpen,De=K.onActiveValue,Re=K.onScroll,Me=K.onMouseEnter,ke="".concat(q,"-item"),Oe=Object(v.a)(function(){return Te},[Z,Te],function(Ne,pe){return pe[0]&&Ne[1]!==pe[1]}),ze=I.useRef(null),Ze=function(pe){pe.preventDefault()},je=function(pe){ze.current&&ze.current.scrollTo({index:pe})},Xe=function(pe){for(var de=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,ce=Oe.length,Q=0;Q<ce;Q+=1){var J=(pe+Q*de+ce)%ce,ee=Oe[J],se=ee.group,fe=ee.data;if(!se&&!fe.disabled)return J}return-1},et=I.useState(function(){return Xe(0)}),We=Object(U.a)(et,2),Be=We[0],Se=We[1],qe=function(pe){Se(pe);var de=Oe[pe];if(!de){De(null,-1);return}De(de.data.value,pe)};I.useEffect(function(){qe(ie!==!1?Xe(0):-1)},[Oe.length,me]),I.useEffect(function(){var Ne=setTimeout(function(){if(!le&&Z&&ge.size===1){var pe=Array.from(ge)[0],de=Oe.findIndex(function(ce){var Q=ce.data;return Q.value===pe});qe(de),je(de)}});return function(){return clearTimeout(Ne)}},[Z]);var Je=function(pe){pe!==void 0&&ye(pe,{selected:!ge.has(pe)}),le||we(!1)};if(I.useImperativeHandle(Y,function(){return{onKeyDown:function(pe){var de=pe.which;switch(de){case P.a.UP:case P.a.DOWN:{var ce=0;if(de===P.a.UP?ce=-1:de===P.a.DOWN&&(ce=1),ce!==0){var Q=Xe(Be+ce,ce);je(Q),qe(Q)}break}case P.a.ENTER:{var J=Oe[Be];J&&!J.data.disabled?Je(J.data.value):Je(void 0),Z&&pe.preventDefault();break}case P.a.ESC:we(!1)}},onKeyUp:function(){},scrollTo:function(pe){je(pe)}}}),Oe.length===0)return I.createElement("div",{role:"listbox",id:"".concat(oe,"_list"),className:"".concat(ke,"-empty"),onMouseDown:Ze},te);function _e(Ne){var pe=Oe[Ne];if(!pe)return null;var de=pe.data||{},ce=de.value,Q=de.label,J=de.children,ee=Object(D.a)(de,!0),se=ve?J:Q;return pe?I.createElement("div",Object.assign({"aria-label":typeof se=="string"?se:null},ee,{key:Ne,role:"option",id:"".concat(oe,"_list_").concat(Ne),"aria-selected":ge.has(ce)}),ce):null}return I.createElement(I.Fragment,null,I.createElement("div",{role:"listbox",id:"".concat(oe,"_list"),style:{height:0,width:0,overflow:"hidden"}},_e(Be-1),_e(Be),_e(Be+1)),I.createElement(C.a,{itemKey:"key",ref:ze,data:Oe,height:he,itemHeight:$,fullHeight:!1,onMouseDown:Ze,onScroll:Re,virtual:Ae,onMouseEnter:Me},function(Ne,pe){var de,ce=Ne.group,Q=Ne.groupOption,J=Ne.data,ee=J.label,se=J.key;if(ce)return I.createElement("div",{className:_()(ke,"".concat(ke,"-group"))},ee!==void 0?ee:se);var fe=J.disabled,Le=J.value,Ce=J.title,Ie=J.children,Ve=J.style,Ge=J.className,gt=Object(B.a)(J,["disabled","value","title","children","style","className"]),ct=ge.has(Le),st="".concat(ke,"-option"),wt=_()(ke,st,Ge,(de={},Object(R.a)(de,"".concat(st,"-grouped"),Q),Object(R.a)(de,"".concat(st,"-active"),Be===pe&&!fe),Object(R.a)(de,"".concat(st,"-disabled"),fe),Object(R.a)(de,"".concat(st,"-selected"),ct),de)),ot=ve?Ie:ee,yt=!be||typeof be=="function"||ct;return I.createElement("div",Object.assign({},gt,{"aria-selected":ct,className:wt,title:Ce,onMouseMove:function(){if(Be===pe||fe)return;qe(pe)},onClick:function(){fe||Je(Le)},style:Ve}),I.createElement("div",{className:"".concat(st,"-content")},ot||Le),I.isValidElement(be)||ct,yt&&I.createElement(T.a,{className:"".concat(ke,"-option-state"),customizeIcon:be,customizeIconProps:{isSelected:ct}},ct?"\u2713":null))}))},u=I.forwardRef(m);u.displayName="OptionList";var o=u,l=function(){return null};l.isSelectOption=!0;var s=l,w=function(){return null};w.isSelectOptGroup=!0;var p=w,c=ne("VTBJ"),A=ne("Zm9Q");function y(k){var K=k.key,Y=k.props,q=Y.children,oe=Y.value,Te=Object(B.a)(Y,["children","value"]);return Object(c.a)({key:K,value:oe!==void 0?oe:K,children:q},Te)}function f(k){var K=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(A.a)(k).map(function(Y,q){if(!I.isValidElement(Y)||!Y.type)return null;var oe=Y.type.isSelectOptGroup,Te=Y.key,ve=Y.props,ge=ve.children,me=Object(B.a)(ve,["children"]);return K||!oe?y(Y):Object(c.a)(Object(c.a)({key:"__RC_SELECT_GRP__".concat(Te===null?q:Te,"__"),label:Te},me),{},{options:f(ge)})}).filter(function(Y){return Y})}var h=ne("2Qr1"),d=ne("qNPg"),a=ne("U8pU"),b=ne("Kwbf"),g=ne("WKfj");function E(k){var K=k.mode,Y=k.options,q=k.children,oe=k.backfill,Te=k.allowClear,ve=k.placeholder,ge=k.getInputElement,me=k.showSearch,le=k.onSearch,ie=k.defaultOpen,he=k.autoFocus,$=k.labelInValue,te=k.value,Z=k.inputValue,be=k.optionLabelProp,Ae=K==="multiple"||K==="tags",ye=me!==void 0?me:Ae||K==="combobox",we=Y||f(q);if(Object(b.a)(K!=="tags"||we.every(function(ke){return!ke.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),K==="tags"||K==="combobox"){var De=we.some(function(ke){return ke.options?ke.options.some(function(Oe){return typeof("value"in Oe?Oe.value:Oe.key)=="number"}):typeof("value"in ke?ke.value:ke.key)=="number"});Object(b.a)(!De,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(b.a)(K!=="combobox"||!be,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(b.a)(K==="combobox"||!oe,"`backfill` only works with `combobox` mode."),Object(b.a)(K==="combobox"||!ge,"`getInputElement` only work with `combobox` mode."),Object(b.b)(K!=="combobox"||!ge||!Te||!ve,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),le&&!ye&&K!=="combobox"&&K!=="tags"&&Object(b.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(b.b)(!ie||he,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),te!=null){var Re=Object(g.d)(te);Object(b.a)(!$||Re.every(function(ke){return Object(a.a)(ke)==="object"&&("key"in ke||"value"in ke)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(b.a)(!Ae||Array.isArray(te),"`value` should be array when `mode` is `multiple` or `tags`")}if(q){var Me=null;Object(A.a)(q).some(function(ke){if(!I.isValidElement(ke)||!ke.type)return!1;var Oe=ke.type;if(Oe.isSelectOption)return!1;if(Oe.isSelectOptGroup){var ze=Object(A.a)(ke.props.children).every(function(Ze){return!I.isValidElement(Ze)||!ke.type||Ze.type.isSelectOption?!0:(Me=Ze.type,!1)});return!ze}return Me=Oe,!0}),Me&&Object(b.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(Me.displayName||Me.name||Me,"`.")),Object(b.a)(Z===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var M=E,F=Object(d.a)({prefixCls:"rc-select",components:{optionList:o},convertChildrenToData:f,flattenOptions:h.d,getLabeledValue:h.e,filterOptions:h.b,isValueDisabled:h.g,findValueOption:h.c,warningProps:M,fillOptionsWithMissingValue:h.a}),j=function(k){Object(L.a)(Y,k);var K=Object(z.a)(Y);function Y(){var q;return Object(re.a)(this,Y),q=K.apply(this,arguments),q.selectRef=I.createRef(),q.focus=function(){q.selectRef.current.focus()},q.blur=function(){q.selectRef.current.blur()},q}return Object(X.a)(Y,[{key:"render",value:function(){return I.createElement(F,Object.assign({ref:this.selectRef},this.props))}}]),Y}(I.Component);j.Option=s,j.OptGroup=p;var W=j,O=rt.c=W},M8RZ:function(ft,rt,ne){"use strict";ne.d(rt,"a",function(){return P});var re=ne("fWQN"),X=ne("mtLc"),L=ne("yKVA"),z=ne("879j"),I=ne("cDcd"),R=ne.n(I),B=ne("faye"),U=ne.n(B),P=function(D){Object(L.a)(S,D);var v=Object(z.a)(S);function S(_){var C;Object(re.a)(this,S),C=v.call(this,_);var T=window.document;return C.node=T.createElement("div"),T.body.appendChild(C.node),C}return Object(X.a)(S,[{key:"render",value:function(){var C=this.props.children;return Object(B.createPortal)(C,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),S}(R.a.Component)},Ot1p:function(ft,rt,ne){"use strict";var re=ne("2qtc"),X=ne("kLXV"),L=ne("rAM+"),z=ne("miYZ"),I=ne("tsqr"),R=ne("9og8"),B=ne("tJVT"),U=ne("jrin"),P=ne("WmNS"),D=ne.n(P),v=ne("cDcd"),S=ne.n(v),_=ne("VrN/"),C=ne.n(_),T=ne("bdgK"),m=ne("p77/"),u=ne("Bd2K"),o=ne("ELLl"),l=ne("19Vz"),s=ne("lZu9"),w=ne("+NIl"),p=ne("kSUc"),c=ne("9Bee"),A=function(fe){var Le=fe.value,Ce=Le===void 0?"":Le,Ie=fe.className,Ve=fe.showTextOnly,Ge=fe.showLines,gt=fe.style,ct=gt===void 0?{}:gt,st=Object(v.useMemo)(function(){return""},[Ce]);return S.a.createElement(S.a.Fragment,null,S.a.createElement("div",{dangerouslySetInnerHTML:{__html:st}}))},y=ne("0Owb"),f=ne("dejd"),h=ne("C+DQ"),d=ne("1vsH"),a=ne("m3rI"),b=[{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 g(fe){var Le=fe.onActionCallback,Ce=fe.title,Ie=fe.icon,Ve=fe.actionName,Ge=fe.className,gt=Ge===void 0?"":Ge,ct=fe.children;function st(){Le(Ve)}return S.a.createElement("a",{title:Ce,className:gt,onClick:st},S.a.createElement("i",{className:"md-iconfont ".concat(Ie)}),ct)}var E=function(fe){var Le=fe.watch,Ce=fe.showNullButton,Ie=fe.onActionCallback,Ve=fe.fullScreen,Ge=fe.insertTemp,gt=fe.hidetoolBar,ct=fe.uuid,st=fe.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(d.G)("_educoder_session_login"),"&_educoder_session=").concat(Object(d.G)("_educoder_session"),"&key=").concat(ct,"&api=").concat(encodeURIComponent(a.a.PROXY_SERVER)));var wt=[].concat(b,[{title:"".concat(Le?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(Le?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return S.a.createElement("ul",{className:"markdown-toolbar-container"},!gt&&wt.map(function(ot,yt){return S.a.createElement("li",{key:yt},ot.actionName?S.a.createElement(g,Object(y.a)({},ot,{onActionCallback:Ie})):S.a.createElement("span",{className:"v-line"}))}),Ce?S.a.createElement("li",null,S.a.createElement(g,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:Ie},S.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,Ge&&S.a.createElement("li",null,S.a.createElement(g,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(Ge),onActionCallback:Ie},S.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),S.a.createElement("li",{className:"btn-full-screen"},S.a.createElement(g,{icon:"".concat(Ve?"icon-shrink":"icon-enlarge"),title:Ve?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:Ie})))},M=ne("M8RZ"),F=ne("+L6B"),j=ne("2/Rp"),W=ne("y8nQ"),O=ne("Vl3Y"),k=ne("5NDa"),K=ne("5rEg"),Y={labelCol:{span:4},wrapperCol:{span:20}},q=function(fe){var Le=fe.callback,Ce=fe.onCancel;function Ie(Ve){Le(Ve)}return S.a.createElement(O.a,Object(y.a)({},Y,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:Ie}),S.a.createElement(O.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},S.a.createElement(K.a,null)),S.a.createElement(O.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},S.a.createElement(K.a,null)),S.a.createElement("div",{className:"flex-container flex-end"},S.a.createElement(j.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),S.a.createElement(j.a,{type:"ghost",onClick:Ce},"\u53D6\u6D88")))},oe=ne("7ahc"),Te=ne("HmJG"),ve=ne("BjJ7"),ge=O.a.useForm,me={width:280,marginRight:10},le={labelCol:{span:5},wrapperCol:{span:19}},ie=function(fe){var Le=fe.callback,Ce=fe.onCancel,Ie=ge(),Ve=Object(B.a)(Ie,1),Ge=Ve[0];function gt(wt){Le(wt)}function ct(wt,ot){if(wt.status===-1){I.b.error(wt.message);return}Ge.setFieldsValue({src:"/api/attachments/".concat(wt.id),type:ot.type})}function st(wt){var ot=wt.target.files[0];$(ot,ct)}return S.a.createElement(O.a,Object(y.a)({form:Ge},le,{className:"upload-image-panel",onFinish:gt}),S.a.createElement(O.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},S.a.createElement("div",{className:"flex-container"},S.a.createElement(O.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},S.a.createElement(K.a,{style:me})),S.a.createElement(he,{onFileChange:st}))),S.a.createElement(O.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},S.a.createElement(K.a,{style:{width:264}})),S.a.createElement(O.a.Item,{style:{textAlign:"right"}},S.a.createElement(j.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),S.a.createElement(j.a,{type:"ghost",onClick:Ce},"\u53D6\u6D88")))};function he(fe){var Le=fe.onFileChange;return S.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",S.a.createElement("input",{type:"file",onChange:Le}))}function $(fe,Le){if(!fe)throw new String("\u6CA1\u6709\u6587\u4EF6");var Ce=new FormData;Ce.append("editormd-image-file",fe),Ce.append("file_param_name","editormd-image-file"),Ce.append("byxhr","true");var Ie=new window.XMLHttpRequest;Ie.withCredentials=!0,Ie.addEventListener("load",function(Ve){Le(JSON.parse(Ve.target.responseText),fe)},!1),Ie.addEventListener("error",function(Ve){console.error(Ve)},!1),Ie.open("POST","".concat(ve.a,"/api/attachments.json")),Ie.send(Ce)}var te=ne("giR+"),Z=ne("fyUT"),be=ne("7Kak"),Ae=ne("9yH6"),ye=Ae.a.Group,we={margin:"0 8px"},De=function(fe){var Le=fe.callback,Ce=fe.onCancel;function Ie(Ve){Le(Ve)}return S.a.createElement(O.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:Ie},S.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},S.a.createElement("span",{style:we},"\u5355\u5143\u683C\u6570\uFF1A"),S.a.createElement("span",{style:we},"\u884C\u6570"),S.a.createElement(O.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},S.a.createElement(Z.a,null)),S.a.createElement("span",{style:we},"\u5217\u6570"),S.a.createElement(O.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},S.a.createElement(Z.a,null))),S.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},S.a.createElement("span",{style:we},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),S.a.createElement(O.a.Item,{name:"align"},S.a.createElement(ye,null,S.a.createElement(Ae.a,{value:"default"},S.a.createElement("i",{className:"fa fa-align-justify"})),S.a.createElement(Ae.a,{value:"left"},S.a.createElement("i",{className:"fa fa-align-left"})),S.a.createElement(Ae.a,{value:"center"},S.a.createElement("i",{className:"fa fa-align-center"})),S.a.createElement(Ae.a,{value:"right"},S.a.createElement("i",{className:"fa fa-align-right"}))))),S.a.createElement("div",{className:"flex-container flex-end"},S.a.createElement(j.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),S.a.createElement(j.a,{type:"ghost",onClick:Ce},"\u53D6\u6D88")))},Re=ne("ErOA"),Me=ne("7Cbv"),ke="link",Oe="upload-image",ze="code-block",Ze="add-table",je="------------",Xe={default:je,left:":".concat(je),center:":".concat(je,":"),right:"".concat(je,":")},et=ne("9VGf"),We,Be;function Se(){}var qe=0,Je=1e4,_e="\u2581",Ne=`
**\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 pe(fe){return/^\d+$/.test(fe)?"".concat(fe,"px"):fe}var de=navigator.platform.toUpperCase().indexOf("MAC")>=0,ce=de?"Cmd":"Ctrl",Q=["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"],J=(We={},Object(U.a)(We,ce+"-B","bold"),Object(U.a)(We,ce+"-I","italic"),We),ee=(Be={},Object(U.a)(Be,ke,"\u6DFB\u52A0\u94FE\u63A5"),Object(U.a)(Be,ze,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(U.a)(Be,Oe,"\u6DFB\u52A0\u6587\u4EF6"),Object(U.a)(Be,Ze,"\u6DFB\u52A0\u8868\u683C"),Be),se=rt.a=function(fe){var Le=fe.defaultValue,Ce=Le===void 0?"":Le,Ie=fe.onChange,Ve=fe.width,Ge=Ve===void 0?"100%":Ve,gt=fe.height,ct=gt===void 0?400:gt,st=fe.miniToolbar,wt=st===void 0?!1:st,ot=fe.isFocus,yt=ot===void 0?!1:ot,xt=fe.watch,Ye=fe.insertTemp,fr=fe.mode,sr=fr===void 0?"markdown":fr,lr=fe.id,_t=lr===void 0?"markdown-editor-id":lr,ur=fe.showResizeBar,pn=ur===void 0?!1:ur,yr=fe.noStorage,br=yr===void 0?!1:yr,Gn=fe.showNullButton,Mt=Gn===void 0?!1:Gn,it=fe.hidetoolBar,Pr=it===void 0?!1:it,gn=fe.fullScreen,qt=gn===void 0?!1:gn,Ct=fe.onBlur,Er=fe.onCMBeforeChange,Mr=fe.onFullScreen,vn=fe.className,Fe=vn===void 0?"":vn,ht=fe.disablePaste,zn=ht===void 0?!1:ht,yn=fe.placeholder,bn=yn===void 0?"":yn,Zr=fe.values,En=Zr===void 0?"":Zr,pt=Object(v.useState)(null),Li=Object(B.a)(pt,2),He=Li[0],xn=Li[1],gr=Object(v.useState)(Ce),Xn=Object(B.a)(gr,2),qr=Xn[0],xr=Xn[1],Vn=Object(v.useState)(xt),Yn=Object(B.a)(Vn,2),Tr=Yn[0],$n=Yn[1],Di=Object(v.useState)(qt),Qn=Object(B.a)(Di,2),Sr=Qn[0],Oi=Qn[1],aa=Object(v.useState)(""),Jn=Object(B.a)(aa,2),Qt=Jn[0],Hr=Jn[1],oa=Object(v.useState)(0),en=Object(B.a)(oa,2),wr=en[0],Zn=en[1],sa=Object(v.useState)(ct),Ri=Object(B.a)(sa,2),_i=Ri[0],Tn=Ri[1],ki=Object(v.useState)(!1),Pi=Object(B.a)(ki,2),la=Pi[0],Sn=Pi[1],tn=Object(v.useRef)(Object(Me.a)()),rn=Object(v.useRef)(!1),wn=Object(v.useRef)(),Ir=Object(v.useRef)(),Ur=Object(v.useRef)(),Nr=Object(v.useRef)(),Cn=Object(v.useRef)(),Mi=function(){var at=Object(R.a)(D.a.mark(function mt(){var ut,bt;return D.a.wrap(function(Ot){for(;;)switch(Ot.prev=Ot.next){case 0:return Ot.next=2,Object(Re.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:tn.current}});case 2:bt=Ot.sent,bt!=null&&(ut=bt.attachments)!==null&&ut!==void 0&&ut.length&&(console.log("cm:",He,Ir),bt.attachments.map(function(Tt){Tt.content_type.indexOf("image")>-1?He.replaceSelection("![,](/api/attachments/".concat(Tt.id,"?type=").concat(Tt.content_type,")")):Tt.content_type.indexOf("video")>-1?He.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):Tt.content_type.indexOf("pdf")>-1?He.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Tt.id,"?type=").concat(Tt.content_type,'&disposition=inline" target="_blank">').concat(Tt.name,"</a>")):He.replaceSelection("[".concat(Tt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(Tt.id,"?type=").concat(Tt.content_type,")"))}));case 4:case"end":return Ot.stop()}},mt)}));return function(){return at.apply(this,arguments)}}();Object(v.useEffect)(function(){xr(En),He==null||He.setValue(En)},[En]),Object(v.useEffect)(function(){Mr==null||Mr(Sr)},[Sr]),Object(v.useEffect)(function(){if(Ir.current){var at=C.a.fromTextArea(Ir.current,{mode:sr,lineNumbers:!wt,lineWrapping:!0,value:Ce,autoCloseTags:!0,autoCloseBrackets:!0});yt&&at.focus();function mt(ut,bt){if(zn){bt.preventDefault();return}var St=bt.clipboardData;if(St){var Ot=St.types.toString(),Tt=St.items;if(Ot==="Files"||St.types.indexOf("Files")>-1){if(bt.preventDefault(),sr=="stex")return;try{var Bt,er=Tt[1];((Bt=Tt[0])===null||Bt===void 0?void 0:Bt.kind)==="file"&&(er=Tt[0]);var Et=er.getAsFile(),Fr=Et.name.split(".").pop();$(Et,function(At){if(At.id){var tr,Vt,vr;(Et==null||((tr=Et.type)===null||tr===void 0)?void 0:tr.indexOf("image"))>-1?at.replaceSelection("![,](/api/attachments/".concat(At.id,"?type=").concat(At.content_type,")")):(Et==null||((Vt=Et.type)===null||Vt===void 0)?void 0:Vt.indexOf("video"))>-1?at.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(At.id,'"></video>')):(Et==null||((vr=Et.type)===null||vr===void 0)?void 0:vr.indexOf("pdf"))>-1?at.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(At.id,"?type=").concat(Et.type,'&disposition=inline" target="_blank">').concat(Et.name,"</a>")):Q.includes(Fr)?at.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(At.id,'?type=office&disposition=inline" target="_blank">').concat(Et.name,"</a>")):at.replaceSelection("[".concat(Et.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(At.id,"?type=").concat(At.content_type,")"))}else(At==null?void 0:At.status)===401&&(document.location.href="/user/login")})}catch(At){I.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return at.on("paste",mt),at.on("dragleave",function(ut,bt){Ur.current.classList.remove("mouse-hover-md")}),at.on("dragover",function(ut,bt){Ur.current.classList.add("mouse-hover-md")}),at.on("drop",function(ut,bt){Ur.current.classList.add("mouse-hover-md");var St;if(St=bt.dataTransfer.files,St.length>0){bt.preventDefault(),bt.stopPropagation();for(var Ot=function(er){var Et=St[er],Fr=Et.name.split(".").pop();$(Et,function(At){if(At.id){var tr,Vt,vr;(Et==null||((tr=Et.type)===null||tr===void 0)?void 0:tr.indexOf("image"))>-1?at.replaceSelection("![,](/api/attachments/".concat(At.id,"?type=").concat(At.content_type,")")):(Et==null||((Vt=Et.type)===null||Vt===void 0)?void 0:Vt.indexOf("video"))>-1?at.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(At.id,'"></video>')):(Et==null||((vr=Et.type)===null||vr===void 0)?void 0:vr.indexOf("pdf"))>-1?at.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(At.id,"?type=").concat(Et.type,'&disposition=inline" target="_blank">').concat(Et.name,"</a>")):Q.includes(Fr)?at.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(At.id,'?type=office&disposition=inline" target="_blank">').concat(Et.name,"</a>")):at.replaceSelection("[".concat(Et.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(At.id,"?type=").concat(At.content_type,")"))}else(At==null?void 0:At.status)===401&&(document.location.href="/user/login")})},Tt=0;Tt<St.length;Tt++)Ot(Tt)}}),xn(at),function(){at.off("paste",mt)}}},[]);var hr=Object(v.useCallback)(function(){if(Ur.current)try{}catch(at){console.log(at,"---- to set md editor body height")}},[_i,Ur,Sr]);Object(v.useEffect)(function(){function at(){var ut=new T.default(function(bt){var St=Object(L.a)(bt),Ot;try{for(St.s();!(Ot=St.n()).done;){var Tt=Ot.value;(Tt.target.offsetHeight>0||Tt.target.offsetWidth>0)&&(hr(),He.setSize("100%","100%"),He.refresh())}}catch(Bt){St.e(Bt)}finally{St.f()}});return ut.observe(Ir.current.parentElement),ut}if(He){var mt=at();return function(){mt.unobserve(Ir.current.parentElement)}}},[He,hr]),Object(v.useEffect)(function(){if(He){for(var at=[],mt=function(){var Tt=bt[ut];St=Object(B.a)(Tt,2);var Bt=St[0],er=St[1],Et=Object(U.a)({},Bt,function(){Ii(er)});at.push(Et),He.addKeyMap(Et)},ut=0,bt=Object.entries(J);ut<bt.length;ut++){var St;mt()}return wn.current=setInterval(function(){rn.current&&Mi()},4e3),function(){clearInterval(wn.current);var Ot=Object(L.a)(at),Tt;try{for(Ot.s();!(Tt=Ot.n()).done;){var Bt=Tt.value;He.removeKeyMap(Bt)}}catch(er){Ot.e(er)}finally{Ot.f()}}}},[He]),Object(v.useEffect)(function(){qt!==Sr&&Oi(qt)},[qt]),Object(et.a)(function(){if(!br&&wr>0){var at=new Date().getTime(),mt=window.sessionStorage.getItem(_t);at>=wr+Je&&(!mt||mt!==qr)&&(window.sessionStorage.setItem(_t,qr),Sn(!0))}},Je),Object(v.useEffect)(function(){$n(xt)},[He,xt]),Object(v.useEffect)(function(){He&&(yt&&He.focus())},[He,yt]),Object(v.useEffect)(function(){if(Tr&&He){var at=He.getScrollerElement();function mt(ut){var bt=ut.target;if(Cn.current){var St=bt.scrollTop/bt.scrollHeight;Cn.current.scrollTop=Cn.current.scrollHeight*St}}return at.addEventListener("scroll",mt),function(){at.removeEventListener("scroll",mt)}}},[He,Tr]),Object(v.useEffect)(function(){if(He&&Er){function at(mt,ut){Er(mt,ut)}return He.on("beforeChange",at),function(){He.off("beforeChange",at)}}},[He,Er]),Object(v.useEffect)(function(){if(He&&Ct){function at(){Ct(He.getValue())}return He.on("blur",at),function(){He.off("blur",at)}}},[He,Ct]),Object(v.useEffect)(function(){if(He){function at(mt){var ut=mt.getValue();xr(ut),Zn(new Date().getTime()),mt.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),Ie&&Ie(ut)}return He.on("change",at),function(){He.off("change",at)}}},[He,Ie]),Object(v.useEffect)(function(){He&&(Ce==null?(He.setValue(""),xr("")):Ce!==He.getValue()&&(He.setValue(Ce),xr(Ce),He.setCursor(He.lineCount(),0)))},[He,Ce]);var Ii=Object(v.useCallback)(function(at){var mt=He.getCursor(),ut=He.getSelection(),bt=ut.split(`
`);switch(at){case"bold":return He.replaceSelection("**"+ut+"**"),ut===""&&He.setCursor(mt.line,mt.ch+2),He.focus();case"italic":return He.replaceSelection("*"+ut+"*"),ut===""&&He.setCursor(mt.line,mt.ch+1),He.focus();case"code":return He.replaceSelection("`"+ut+"`"),ut===""&&He.setCursor(mt.line,mt.ch+1),He.focus();case"inline-latex":return He.replaceSelection("`$$"+ut+"$$`"),ut===""&&He.setCursor(mt.line,mt.ch+3),He.focus();case"latex":return He.replaceSelection("```latex\n"+ut+"\n```"),He.setCursor(mt.line+1,ut.length+1),He.focus();case"line-break":return He.replaceSelection(`<br/>
`),He.focus();case"list-ul":return ut===""?He.replaceSelection("- "+ut):He.replaceSelection(bt.map(function(St){return St===""?"":"- ".concat(St)}).join(`
`)),He.focus();case"list-ol":return ut===""?He.replaceSelection("1. "+ut):He.replaceSelection(bt.map(function(St,Ot){return St===""?"":"".concat(Ot+1,". ").concat(St)}).join(`
`)),He.focus();case"add-null-ch":return ut===""&&He.setCursor(mt.line,mt.ch+1),He.replaceSelection(_e),He.focus();case"inster-template-1":return ut===""&&He.setCursor(mt.line,mt.ch),He.replaceSelection(Ne),He.focus();case"eraser":return He.setValue(""),He.focus();case"trigger-watch":return $n(!Tr),He.focus();case"trigger-full-screen":return Oi(!Sr),He.focus();case ke:Hr(ke);return;case ze:Hr(ze);return;case Oe:Hr(Oe);return;case Ze:Hr(Ze);return;default:throw new Error}},[He,Tr,Sr]),An=Object(v.useCallback)(function(at){Hr("");switch(Qt){case ke:var mt=at.title,ut=at.link;return He.replaceSelection("[".concat(mt,"](").concat(ut,")")),He.focus();case ze:var bt=at.language,St=at.content;return He.replaceSelection(["```"+bt,St,"```"].join(`
`)),He.focus();case Oe:var Ot=at.src,Tt=at.alt;return Tt?He.replaceSelection("![ ".concat(Tt," ]( ").concat(Ot,' "').concat(Tt,'" )')):He.replaceSelection("![,](".concat(Ot,")")),He.focus();case Ze:for(var Bt=at.row,er=at.col,Et=at.align,Fr=`
`,At=0;At<Bt;At++){for(var tr=[],Vt=[],vr=0;vr<er;vr++)At===1&&Vt.push(Xe[Et]),tr.push(" ");At===1&&(Fr+="| ".concat(Vt.join(" | "),` |
`)),Fr+="| ".concat(tr.join(er===1?"":" | "),` |
`)}return He.replaceSelection(Fr+`
`),He.focus();default:throw new Error}},[He,Qt]),qn=Object(v.useMemo)(function(){switch(Qt){case ke:return S.a.createElement(q,{callback:An,onCancel:Kr});case ze:return S.a.createElement(oe.b,{callback:An,onCancel:Kr});case Oe:return S.a.createElement(ie,{callback:An,onCancel:Kr});case Ze:return S.a.createElement(De,{callback:An,onCancel:Kr});default:return null}},[Qt]);function Kr(){Hr("")}Object(v.useEffect)(function(){if(Nr.current){var at=Nr.current,mt=!1,ut=0;function bt(Tt){mt=!0,ut=Tt.pageY}function St(){mt=!1}function Ot(Tt){if(mt){var Bt=Tt.pageY-ut;Bt<0&&(Bt=0),Bt>300&&(Bt=300);var er=ct+Bt+"px";Tn(er)}}return at.addEventListener("mousedown",bt),document.addEventListener("mousemove",Ot),document.addEventListener("mouseup",St),function(){at.removeEventListener("mousedown",bt),document.removeEventListener("mousemove",Ot),document.removeEventListener("mouseup",St)}}},[He,Nr]),Object(v.useEffect)(function(){Tn(ct)},[ct]);var Or=pe(Ge),ei=pe(_i),Cr={width:Or,height:ei},ti=Object(v.useMemo)(function(){if(wr){var at=new Date(wr),mt=at.getHours(),ut=at.getMinutes(),bt=at.getSeconds();return mt=mt<10?"0"+mt:mt,ut=ut<10?"0"+ut:ut,bt=bt<10?"0"+bt:bt,"".concat(mt,":").concat(ut,":").concat(bt)}return 0},[wr]);function Ui(){window.sessionStorage.removeItem(_t),Sn(!1),Zn(0)}function nn(){Sn(!1),Zn(0),He.setValue(window.sessionStorage.getItem(_t))}function ua(at,mt){var ut=He.getValue();ut=ut.replace(at,mt),xr(ut),He==null||He.setValue(ut)}return S.a.createElement(v.Fragment,null,S.a.createElement("div",{className:"markdown-editor-wrapper",ref:Ur},S.a.createElement("div",{className:"markdown-editor-container ".concat(Fe," ").concat(Tr?"on-preview":""," ").concat(wt?"mini":""," ").concat(Sr?"full-screen":""),style:Cr},S.a.createElement(E,{insertTemp:Ye,watch:Tr,fullScreen:Sr,showNullButton:Mt,onActionCallback:Ii,hidetoolBar:Pr,uuid:tn.current,setOpenPhones:function(){rn.current=!0}}),S.a.createElement("div",{className:"markdown-editor-body"},S.a.createElement("div",{className:"codemirror-container"},S.a.createElement("textarea",{ref:Ir,placeholder:bn})),Tr?S.a.createElement("div",{ref:Cn,className:"preview-container"},sr==="stex"&&S.a.createElement(A,{value:qr}),sr!=="stex"&&S.a.createElement(c.a,{edit:!0,value:qr,replaces:ua})):null))),pn?S.a.createElement("a",{ref:Nr,className:"editor-resize"}):null,S.a.createElement(M.a,null,ee[Qt]?S.a.createElement(X.a,{centered:!0,title:ee[Qt],visible:!0,onCancel:Kr,footer:null,className:"markdown-popup-form"},qn):null))}},SJMd:function(ft,rt){/**
* @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 ne,re,X,L=!1,z,I;window.PR_SHOULD_USE_CONTINUATION=!0;var R,B;(function(){var U=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"],v=[D,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],S=[v,"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"],_=[v,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],C=[v,"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"],T="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",m=[v,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],u="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",o=[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"],s=[P,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],w=[S,C,_,m,u,o,l,s],p=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,c="str",A="kwd",y="com",f="typ",h="lit",d="pun",a="pln",b="tag",g="dec",E="src",M="atn",F="atv",j="nocode",W="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function O(ye){for(var we=0,De=!1,Re=!1,Me=0,ke=ye.length;Me<ke;++Me){var Oe=ye[Me];if(Oe.ignoreCase)Re=!0;else if(/[a-z]/i.test(Oe.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){De=!0,Re=!1;break}}var ze={b:8,t:9,n:10,v:11,f:12,r:13};function Ze(Be){var Se=Be.charCodeAt(0);if(Se!==92)return Se;var qe=Be.charAt(1);return Se=ze[qe],Se||("0"<=qe&&qe<="7"?parseInt(Be.substring(1),8):qe==="u"||qe==="x"?parseInt(Be.substring(2),16):Be.charCodeAt(1))}function je(Be){if(Be<32)return(Be<16?"\\x0":"\\x")+Be.toString(16);var Se=String.fromCharCode(Be);return Se==="\\"||Se==="-"||Se==="]"||Se==="^"?"\\"+Se:Se}function Xe(Be){var Se=Be.substring(1,Be.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")),qe=[],Je=Se[0]==="^",_e=["["];Je&&_e.push("^");for(var Ne=Je?1:0,pe=Se.length;Ne<pe;++Ne){var de=Se[Ne];if(/\\[bdsw]/i.test(de))_e.push(de);else{var ce=Ze(de),Q;Ne+2<pe&&Se[Ne+1]==="-"?(Q=Ze(Se[Ne+2]),Ne+=2):Q=ce,qe.push([ce,Q]),Q<65||ce>122||(Q<65||ce>90||qe.push([Math.max(65,ce)|32,Math.min(Q,90)|32]),Q<97||ce>122||qe.push([Math.max(97,ce)&~32,Math.min(Q,122)&~32]))}}qe.sort(function(fe,Le){return fe[0]-Le[0]||Le[1]-fe[1]});for(var J=[],ee=[],Ne=0;Ne<qe.length;++Ne){var se=qe[Ne];se[0]<=ee[1]+1?ee[1]=Math.max(ee[1],se[1]):J.push(ee=se)}for(var Ne=0;Ne<J.length;++Ne){var se=J[Ne];_e.push(je(se[0])),se[1]>se[0]&&(se[1]+1>se[0]&&_e.push("-"),_e.push(je(se[1])))}return _e.push("]"),_e.join("")}function et(Be){for(var Se=Be.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")),qe=Se.length,Je=[],_e=0,Ne=0;_e<qe;++_e){var pe=Se[_e];if(pe==="(")++Ne;else if(pe.charAt(0)==="\\"){var de=+pe.substring(1);de&&(de<=Ne?Je[de]=-1:Se[_e]=je(de))}}for(var _e=1;_e<Je.length;++_e)Je[_e]===-1&&(Je[_e]=++we);for(var _e=0,Ne=0;_e<qe;++_e){var pe=Se[_e];if(pe==="(")++Ne,Je[Ne]||(Se[_e]="(?:");else if(pe.charAt(0)==="\\"){var de=+pe.substring(1);de&&de<=Ne&&(Se[_e]="\\"+Je[de])}}for(var _e=0;_e<qe;++_e)Se[_e]==="^"&&Se[_e+1]!=="^"&&(Se[_e]="");if(Be.ignoreCase&&De)for(var _e=0;_e<qe;++_e){var pe=Se[_e],ce=pe.charAt(0);pe.length>=2&&ce==="["?Se[_e]=Xe(pe):ce!=="\\"&&(Se[_e]=pe.replace(/[a-zA-Z]/g,function(ee){var se=ee.charCodeAt(0);return"["+String.fromCharCode(se&~32,se|32)+"]"}))}return Se.join("")}for(var We=[],Me=0,ke=ye.length;Me<ke;++Me){var Oe=ye[Me];if(Oe.global||Oe.multiline)throw new Error(""+Oe);We.push("(?:"+et(Oe)+")")}return new RegExp(We.join("|"),Re?"gi":"g")}function k(ye,we){var De=/(?:^|\s)nocode(?:\s|$)/,Re=[],Me=0,ke=[],Oe=0;function ze(Ze){var je=Ze.nodeType;if(je==1){if(De.test(Ze.className))return;for(var Xe=Ze.firstChild;Xe;Xe=Xe.nextSibling)ze(Xe);var et=Ze.nodeName.toLowerCase();(et==="br"||et==="li")&&(Re[Oe]=`
`,ke[Oe<<1]=Me++,ke[Oe++<<1|1]=Ze)}else if(je==3||je==4){var We=Ze.nodeValue;We.length&&(we?We=We.replace(/\r\n?/g,`
`):We=We.replace(/[ \t\r\n]+/g," "),Re[Oe]=We,ke[Oe<<1]=Me,Me+=We.length,ke[Oe++<<1|1]=Ze)}}return ze(ye),{sourceCode:Re.join("").replace(/\n$/,""),spans:ke}}function K(ye,we,De,Re,Me){if(!De)return;var ke={sourceNode:ye,pre:1,langExtension:null,numberLines:null,sourceCode:De,spans:null,basePos:we,decorations:null};Re(ke),Me.push.apply(Me,ke.decorations)}var Y=/\S/;function q(ye){for(var we=void 0,De=ye.firstChild;De;De=De.nextSibling){var Re=De.nodeType;we=Re===1?we?ye:De:Re===3&&Y.test(De.nodeValue)?ye:we}return we===ye?void 0:we}function oe(ye,we){var De={},Re;(function(){for(var Oe=ye.concat(we),ze=[],Ze={},je=0,Xe=Oe.length;je<Xe;++je){var et=Oe[je],We=et[3];if(We)for(var Be=We.length;--Be>=0;)De[We.charAt(Be)]=et;var Se=et[1],qe=""+Se;Ze.hasOwnProperty(qe)||(ze.push(Se),Ze[qe]=null)}ze.push(/[\0-\uffff]/),Re=O(ze)})();var Me=we.length,ke=function(Oe){for(var ze=Oe.sourceCode,Ze=Oe.basePos,je=Oe.sourceNode,Xe=[Ze,a],et=0,We=ze.match(Re)||[],Be={},Se=0,qe=We.length;Se<qe;++Se){var Je=We[Se],_e=Be[Je],Ne=void 0,pe;if(typeof _e=="string")pe=!1;else{var de=De[Je.charAt(0)];if(de)Ne=Je.match(de[1]),_e=de[0];else{for(var ce=0;ce<Me;++ce)if(de=we[ce],Ne=Je.match(de[1]),Ne){_e=de[0];break}Ne||(_e=a)}pe=_e.length>=5&&_e.substring(0,5)==="lang-",pe&&!(Ne&&typeof Ne[1]=="string")&&(pe=!1,_e=E),pe||(Be[Je]=_e)}var Q=et;if(et+=Je.length,!pe)Xe.push(Ze+Q,_e);else{var J=Ne[1],ee=Je.indexOf(J),se=ee+J.length;Ne[2]&&(se=Je.length-Ne[2].length,ee=se-J.length);var fe=_e.substring(5);K(je,Ze+Q,Je.substring(0,ee),ke,Xe),K(je,Ze+Q+ee,J,he(fe,J),Xe),K(je,Ze+Q+se,Je.substring(se),ke,Xe)}}Oe.decorations=Xe};return ke}function Te(ye){var we=[],De=[];ye.tripleQuotedStrings?we.push([c,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):ye.multiLineStrings?we.push([c,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):we.push([c,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),ye.verbatimStrings&&De.push([c,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Re=ye.hashComments;Re&&(ye.cStyleComments?(Re>1?we.push([y,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):we.push([y,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),De.push([c,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):we.push([y,/^#[^\r\n]*/,null,"#"])),ye.cStyleComments&&(De.push([y,/^\/\/[^\r\n]*/,null]),De.push([y,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Me=ye.regexLiterals;if(Me){var ke=Me>1?"":`
\r`,Oe=ke?".":"[\\S\\s]",ze="/(?=[^/*"+ke+"])(?:[^/\\x5B\\x5C"+ke+"]|\\x5C"+Oe+"|\\x5B(?:[^\\x5C\\x5D"+ke+"]|\\x5C"+Oe+")*(?:\\x5D|$))+/";De.push(["lang-regex",RegExp("^"+W+"("+ze+")")])}var Ze=ye.types;Ze&&De.push([f,Ze]);var je=(""+ye.keywords).replace(/^ | $/g,"");je.length&&De.push([A,new RegExp("^(?:"+je.replace(/[\s,]+/g,"|")+")\\b"),null]),we.push([a,/^\s+/,null,` \r
\xA0`]);var Xe="^.[^\\s\\w.$@'\"`/\\\\]*";return ye.regexLiterals&&(Xe+="(?!s*/)"),De.push([h,/^@[a-z_$][a-z_$@0-9]*/i,null],[f,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[a,/^[a-z_$][a-z_$@0-9]*/i,null],[h,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[a,/^\\[\s\S]?/,null],[d,new RegExp(Xe),null]),oe(we,De)}var ve=Te({keywords:w,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function ge(ye,we,De){for(var Re=/(?:^|\s)nocode(?:\s|$)/,Me=/\r\n?|\n/,ke=ye.ownerDocument,Oe=ke.createElement("li");ye.firstChild;)Oe.appendChild(ye.firstChild);var ze=[Oe];function Ze(Se){var qe=Se.nodeType;if(qe==1&&!Re.test(Se.className))if(Se.nodeName==="br")je(Se),Se.parentNode&&Se.parentNode.removeChild(Se);else for(var Je=Se.firstChild;Je;Je=Je.nextSibling)Ze(Je);else if((qe==3||qe==4)&&De){var _e=Se.nodeValue,Ne=_e.match(Me);if(Ne){var pe=_e.substring(0,Ne.index);Se.nodeValue=pe;var de=_e.substring(Ne.index+Ne[0].length);if(de){var ce=Se.parentNode;ce.insertBefore(ke.createTextNode(de),Se.nextSibling)}je(Se),pe||Se.parentNode.removeChild(Se)}}}function je(Se){for(;!Se.nextSibling;)if(Se=Se.parentNode,!Se)return;function qe(Ne,pe){var de=pe?Ne.cloneNode(!1):Ne,ce=Ne.parentNode;if(ce){var Q=qe(ce,1),J=Ne.nextSibling;Q.appendChild(de);for(var ee=J;ee;ee=J)J=ee.nextSibling,Q.appendChild(ee)}return de}for(var Je=qe(Se.nextSibling,0),_e;(_e=Je.parentNode)&&_e.nodeType===1;)Je=_e;ze.push(Je)}for(var Xe=0;Xe<ze.length;++Xe)Ze(ze[Xe]);we===(we|0)&&ze[0].setAttribute("value",we);var et=ke.createElement("ol");et.className="linenums";for(var We=Math.max(0,we-1|0)||0,Xe=0,Be=ze.length;Xe<Be;++Xe)Oe=ze[Xe],Oe.className="L"+(Xe+We)%10,Oe.firstChild||Oe.appendChild(ke.createTextNode("\xA0")),et.appendChild(Oe);ye.appendChild(et)}function me(ye){var we=/\bMSIE\s(\d+)/.exec(navigator.userAgent);we=we&&+we[1]<=8;var De=/\n/g,Re=ye.sourceCode,Me=Re.length,ke=0,Oe=ye.spans,ze=Oe.length,Ze=0,je=ye.decorations,Xe=je.length,et=0;je[Xe]=Me;var We,Be;for(Be=We=0;Be<Xe;)je[Be]!==je[Be+2]?(je[We++]=je[Be++],je[We++]=je[Be++]):Be+=2;for(Xe=We,Be=We=0;Be<Xe;){for(var Se=je[Be],qe=je[Be+1],Je=Be+2;Je+2<=Xe&&je[Je+1]===qe;)Je+=2;je[We++]=Se,je[We++]=qe,Be=Je}Xe=je.length=We;var _e=ye.sourceNode,Ne="";_e&&(Ne=_e.style.display,_e.style.display="none");try{for(var pe=null;Ze<ze;){var de=Oe[Ze],ce=Oe[Ze+2]||Me,Q=je[et+2]||Me,Je=Math.min(ce,Q),J=Oe[Ze+1],ee;if(J.nodeType!==1&&(ee=Re.substring(ke,Je))){we&&(ee=ee.replace(De,"\r")),J.nodeValue=ee;var se=J.ownerDocument,fe=se.createElement("span");fe.className=je[et+1];var Le=J.parentNode;Le.replaceChild(fe,J),fe.appendChild(J),ke<ce&&(Oe[Ze+1]=J=se.createTextNode(Re.substring(Je,ce)),Le.insertBefore(J,fe.nextSibling))}ke=Je,ke>=ce&&(Ze+=2),ke>=Q&&(et+=2)}}finally{_e&&(_e.style.display=Ne)}}var le={};function ie(ye,we){for(var De=we.length;--De>=0;){var Re=we[De];le.hasOwnProperty(Re)?U.console&&console.warn("cannot override language handler %s",Re):le[Re]=ye}}function he(ye,we){return ye&&le.hasOwnProperty(ye)||(ye=/^\s*</.test(we)?"default-markup":"default-code"),le[ye]}ie(ve,["default-code"]),ie(oe([],[[a,/^[^<?]+/],[g,/^<!\w[^>]*(?:>|$)/],[y,/^<\!--[\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"]),ie(oe([[a,/^[\s]+/,null,` \r
`],[F,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[b,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[M,/^(?!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"]),ie(oe([],[[F,/^[\s\S]+/]]),["uq.val"]),ie(Te({keywords:S,hashComments:!0,cStyleComments:!0,types:p}),["c","cc","cpp","cxx","cyc","m"]),ie(Te({keywords:"null,true,false"}),["json"]),ie(Te({keywords:C,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:p}),["cs"]),ie(Te({keywords:_,cStyleComments:!0}),["java"]),ie(Te({keywords:s,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),ie(Te({keywords:o,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),ie(Te({keywords:u,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),ie(Te({keywords:l,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),ie(Te({keywords:m,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),ie(Te({keywords:T,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),ie(oe([],[[c,/^[\s\S]+/]]),["regex"]);function $(ye){var we=ye.langExtension;try{var De=k(ye.sourceNode,ye.pre),Re=De.sourceCode;ye.sourceCode=Re,ye.spans=De.spans,ye.basePos=0,he(we,Re)(ye),me(ye)}catch(Me){U.console&&console.log(Me&&Me.stack||Me)}}function te(ye,we,De){var Re=De||!1,Me=we||null,ke=document.createElement("div");ke.innerHTML="<pre>"+ye+"</pre>",ke=ke.firstChild,Re&&ge(ke,Re,!0);var Oe={langExtension:Me,numberLines:Re,sourceNode:ke,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return $(Oe),ke.innerHTML}function Z(ye,we){var De=we||document.body,Re=De.ownerDocument||document;function Me(de){return De.getElementsByTagName(de)}for(var ke=[Me("pre"),Me("code"),Me("xmp")],Oe=[],ze=0;ze<ke.length;++ze)for(var Ze=0,je=ke[ze].length;Ze<je;++Ze)Oe.push(ke[ze][Ze]);ke=null;var Xe=Date;Xe.now||(Xe={now:function(){return+new Date}});var et=0,We=/\blang(?:uage)?-([\w.]+)(?!\S)/,Be=/\bprettyprint\b/,Se=/\bprettyprinted\b/,qe=/pre|xmp/i,Je=/^code$/i,_e=/^(?:pre|code|xmp)$/i,Ne={};function pe(){for(var de=U.PR_SHOULD_USE_CONTINUATION?Xe.now()+250:Infinity;et<Oe.length&&Xe.now()<de;et++){for(var ce=Oe[et],Q=Ne,J=ce;J=J.previousSibling;){var ee=J.nodeType,se=(ee===7||ee===8)&&J.nodeValue;if(se?!/^\??prettify\b/.test(se):ee!==3||/\S/.test(J.nodeValue))break;if(se){Q={},se.replace(/\b(\w+)=([\w:.%+-]+)/g,function(xt,Ye,fr){Q[Ye]=fr});break}}var fe=ce.className;if((Q!==Ne||Be.test(fe))&&!Se.test(fe)){for(var Le=!1,Ce=ce.parentNode;Ce;Ce=Ce.parentNode){var Ie=Ce.tagName;if(_e.test(Ie)&&Ce.className&&Be.test(Ce.className)){Le=!0;break}}if(!Le){ce.className+=" prettyprinted";var Ve=Q.lang;if(!Ve){Ve=fe.match(We);var Ge;!Ve&&(Ge=q(ce))&&Je.test(Ge.tagName)&&(Ve=Ge.className.match(We)),Ve&&(Ve=Ve[1])}var gt;if(qe.test(ce.tagName))gt=1;else{var ct=ce.currentStyle,st=Re.defaultView,wt=ct?ct.whiteSpace:st&&st.getComputedStyle?st.getComputedStyle(ce,null).getPropertyValue("white-space"):0;gt=wt&&wt.substring(0,3)==="pre"}var ot=Q.linenums;(ot=ot==="true"||+ot)||(ot=fe.match(/\blinenums\b(?::(\d+))?/),ot=ot?ot[1]&&ot[1].length?+ot[1]:!0:!1),ot&&ge(ce,ot,gt);var yt={langExtension:Ve,sourceNode:ce,numberLines:ot,pre:gt,sourceCode:null,basePos:null,spans:null,decorations:null};$(yt)}}}et<Oe.length?U.setTimeout(pe,250):typeof ye=="function"&&ye()}pe()}var be=U.PR={createSimpleLexer:oe,registerLangHandler:ie,sourceDecorator:Te,PR_ATTRIB_NAME:M,PR_ATTRIB_VALUE:F,PR_COMMENT:y,PR_DECLARATION:g,PR_KEYWORD:A,PR_LITERAL:h,PR_NOCODE:j,PR_PLAIN:a,PR_PUNCTUATION:d,PR_SOURCE:E,PR_STRING:c,PR_TAG:b,PR_TYPE:f,prettyPrintOne:L?U.prettyPrintOne=te:R=te,prettyPrint:B=L?U.prettyPrint=Z:B=Z},Ae=U.define;typeof Ae=="function"&&Ae.amd&&Ae("google-code-prettify",[],function(){return be})})()},"T+//":function(ft,rt,ne){"use strict";ne.r(rt);var re=ne("Q9mQ"),X=ne("diRs"),L=ne("2qtc"),z=ne("kLXV"),I=ne("miYZ"),R=ne("tsqr"),B=ne("9og8"),U=ne("tJVT"),P=ne("B9cy"),D=ne("Ol7k"),v=ne("lUTK"),S=ne("BvKs"),_=ne("WmNS"),C=ne.n(_),T=ne("cDcd"),m=ne.n(T),u=ne("m3rI"),o=ne("p0QG"),l=ne.n(o),s=ne("ErOA"),w=ne("9kvl"),p=ne("RCxd"),c=ne("xGfz"),A=ne("xKgJ"),y=ne("5NDa"),f=ne("5rEg");function h(le){var ie=le.user,he=le.CategoryId,$=le.IsShow,te=le.setIsShow,Z=le.dispatch,be=le.init,Ae=Object(T.useState)(),ye=Object(U.a)(Ae,2),we=ye[0],De=ye[1];return m.a.createElement(z.a,{title:he?"\u65B0\u5EFA\u4E09\u7EA7\u7C7B\u76EE":"\u65B0\u5EFA\u4E8C\u7EA7\u7C7B\u76EE",width:424,onCancel:function(){te(!1)},onOk:Object(B.a)(C.a.mark(function Re(){var Me;return C.a.wrap(function(Oe){for(;;)switch(Oe.prev=Oe.next){case 0:if(we){Oe.next=3;break}return R.b.error("\u680F\u76EE\u540D\u4E0D\u80FD\u4E3A\u7A7A"),Oe.abrupt("return");case 3:return Oe.next=5,Object(s.a)("/api/programas.json",{method:"post",body:{name:we,parent_id:he}});case 5:Me=Oe.sent,Me.status===0&&(R.b.info("\u521B\u5EFA\u6210\u529F"),te(!1),De(""),be());case 7:case"end":return Oe.stop()}},Re)})),visible:$},m.a.createElement(f.a,{value:we,onChange:function(Me){return De(Me.target.value)},placeholder:"\u8BF7\u8F93\u5165\u4E0D\u8D85\u8FC710\u4E2A\u6C49\u5B57\u7684\u540D\u79F0",maxLength:10}))}var d=Object(w.a)(function(le){var ie=le.user;return{user:ie}})(h);function a(le){var ie=le.user,he=le.CategoryId,$=le.name,te=le.IsShow,Z=le.setIsShow,be=le.dispatch,Ae=le.init,ye=Object(T.useState)(),we=Object(U.a)(ye,2),De=we[0],Re=we[1];return Object(T.useEffect)(function(){Re($)},[$]),m.a.createElement(z.a,{title:"\u76EE\u5F55\u91CD\u547D\u540D",width:424,onCancel:function(){Z(!1)},onOk:Object(B.a)(C.a.mark(function Me(){var ke;return C.a.wrap(function(ze){for(;;)switch(ze.prev=ze.next){case 0:if(De){ze.next=3;break}return R.b.error("\u680F\u76EE\u540D\u4E0D\u80FD\u4E3A\u7A7A"),ze.abrupt("return");case 3:return ze.next=5,Object(s.a)("/api/programas/".concat(he,"/rename.json"),{method:"put",body:{name:De,id:he}});case 5:ke=ze.sent,ke.status===0&&(R.b.info("\u4FEE\u6539\u6210\u529F"),Z(!1),Re(""),Ae());case 7:case"end":return ze.stop()}},Me)})),visible:te},m.a.createElement(f.a,{value:De,onChange:function(ke){return Re(ke.target.value)},placeholder:"\u8BF7\u8F93\u5165\u4E0D\u8D85\u8FC710\u4E2A\u6C49\u5B57\u7684\u540D\u79F0",maxLength:10}))}var b=Object(w.a)(function(le){var ie=le.user;return{user:ie}})(a),g=ne("+L6B"),E=ne("2/Rp"),M=ne("9Bee");function F(le){var ie,he,$,te,Z=le.user,be=le.ItemData,Ae=le.setIssee,ye=le.dispatch,we=le.init;return m.a.createElement("div",null,m.a.createElement("div",{style:{textAlign:"right"}},Object(A.v)()&&m.a.createElement(E.a,{onClick:function(){return Ae(!1)}},"\u7F16\u8F91")),m.a.createElement(M.a,{value:be.content}),(be==null||((ie=be.attachment)===null||ie===void 0)?void 0:ie.id)&&m.a.createElement("div",null,m.a.createElement("a",{href:be==null||((he=be.attachment)===null||he===void 0)?void 0:he.url,target:"_self",download:be==null||(($=be.attachment)===null||$===void 0)?void 0:$.title},m.a.createElement("i",{style:{color:"#29BD8B"},className:"font-14 color-green iconfont icon-fujian mr8"}),m.a.createElement("span",{style:{color:"#000000"}},be==null||((te=be.attachment)===null||te===void 0)?void 0:te.title))))}var j=Object(w.a)(function(le){var ie=le.user;return{user:ie}})(F),W=ne("DZo9"),O=ne("8z0m"),k=ne("Ot1p"),K=ne("hJwl");function Y(le){var ie=le.user,he=le.ItemData,$=le.setIssee,te=le.CategoryId,Z=le.dispatch,be=le.init,Ae=Object(T.useState)([]),ye=Object(U.a)(Ae,2),we=ye[0],De=ye[1],Re=Object(T.useState)(he.content),Me=Object(U.a)(Re,2),ke=Me[0],Oe=Me[1];function ze(){var We,Be=[];return he==null||((We=he.attachments)===null||We===void 0)||We.map(function(Se){var qe={uid:Se==null?void 0:Se.id,name:Se.title,response:{id:Se.id}};Be.push(qe)}),Be}var Ze={name:"file",multiple:!0,action:u.a.API_SERVER+"/api/attachments.json",defaultFileList:ze(),onRemove:function(Be){Object(K.t)({id:Be.uid})},onChange:function(Be){console.log("info",Be);var Se=Be.file.status;Se!=="uploading",Se==="removed"&&De(Be.fileList),Se==="done"?(De(Be.fileList),R.b.success("".concat(Be.file.name," \u6587\u4EF6\u4E0A\u4F20\u6210\u529F"))):Se==="error"&&R.b.error("".concat(Be.file.name," \u6587\u4EF6\u4E0A\u4F20\u5931\u8D25"))},beforeUpload:function(Be){var Se=Be.size/1024/1024<150;return Se||R.b.info("\u6587\u4EF6\u5927\u5C0F\u5FC5\u987B\u5C0F\u4E8E150MB"),Se}};function je(){return Xe.apply(this,arguments)}function Xe(){return Xe=Object(B.a)(C.a.mark(function We(){var Be;return C.a.wrap(function(qe){for(;;)switch(qe.prev=qe.next){case 0:return qe.next=2,Object(s.a)("/api/programas/".concat(te,"/update_content.json"),{method:"put",body:{id:te,content:ke,attachment_id:et(we)}});case 2:Be=qe.sent,Be&&(R.b.info("\u63D0\u4EA4\u6210\u529F"),$(!0));case 4:case"end":return qe.stop()}},We)})),Xe.apply(this,arguments)}function et(We){var Be;return We&&We.map(function(Se){Be=Se.response.id}),Be}return m.a.createElement("div",null,m.a.createElement(k.a,{defaultValue:ke,onChange:function(Be){return Oe(Be)}}),m.a.createElement(O.a,Ze,m.a.createElement(E.a,{className:"uploadBtn"},"\u4E0A\u4F20\u9644\u4EF6"),"(\u5355\u4E2A\u6587\u4EF6150M\u4EE5\u5185)"),m.a.createElement("p",{style:{marginTop:"10px"}},m.a.createElement(E.a,{style:{width:"90px"},onClick:function(){return je()}},"\u63D0\u4EA4"),m.a.createElement(E.a,{style:{marginLeft:"30px",width:"90px"},type:"primary",onClick:function(){return $(!0)}},"\u53D6\u6D88")))}var q=Object(w.a)(function(le){var ie=le.user;return{user:ie}})(Y),oe=S.a.SubMenu,Te=D.a.Content,ve=D.a.Sider;function ge(le){var ie,he=le.user,$=le.dispatch,te=le.globalSetting,Z=Object(T.useState)(),be=Object(U.a)(Z,2),Ae=be[0],ye=be[1],we=Object(T.useState)(!1),De=Object(U.a)(we,2),Re=De[0],Me=De[1],ke=Object(T.useState)(),Oe=Object(U.a)(ke,2),ze=Oe[0],Ze=Oe[1],je=Object(T.useState)(),Xe=Object(U.a)(je,2),et=Xe[0],We=Xe[1],Be=Object(T.useState)(!1),Se=Object(U.a)(Be,2),qe=Se[0],Je=Se[1],_e=Object(T.useState)(""),Ne=Object(U.a)(_e,2),pe=Ne[0],de=Ne[1],ce=Object(T.useState)(""),Q=Object(U.a)(ce,2),J=Q[0],ee=Q[1],se=Object(T.useState)(!0),fe=Object(U.a)(se,2),Le=fe[0],Ce=fe[1];Object(T.useEffect)(function(){Ie()},[]),console.log("globalSetting",te);function Ie(){return Ve.apply(this,arguments)}function Ve(){return Ve=Object(B.a)(C.a.mark(function ot(){var yt;return C.a.wrap(function(Ye){for(;;)switch(Ye.prev=Ye.next){case 0:return Ye.next=2,Object(s.a)("/api/programas.json",{method:"get"});case 2:yt=Ye.sent,yt&&Ze(yt==null?void 0:yt.programas);case 4:case"end":return Ye.stop()}},ot)})),Ve.apply(this,arguments)}var Ge=function(){var ot=Object(B.a)(C.a.mark(function yt(xt,Ye,fr){var sr;return C.a.wrap(function(_t){for(;;)switch(_t.prev=_t.next){case 0:_t.t0=xt,_t.next=_t.t0===1?3:_t.t0===2?6:_t.t0===3?10:_t.t0===4?15:17;break;case 3:return We(Ye==null?void 0:Ye.id),Me(!0),_t.abrupt("break",17);case 6:return We(Ye==null?void 0:Ye.id),Je(!0),de(Ye==null?void 0:Ye.name),_t.abrupt("break",17);case 10:return _t.next=12,Object(s.a)("/api/programas/".concat(Ye==null?void 0:Ye.id,"/top.json"),{method:"post",body:{id:Ye==null?void 0:Ye.id}});case 12:return sr=_t.sent,sr.status===0&&Ie(),_t.abrupt("break",17);case 15:return gt(m.a.createElement("p",null,"\u5220\u9664\u4E4B\u540E\u4E0D\u80FD\u6062\u590D,",m.a.createElement("br",null),"\u662F\u5426\u786E\u8BA4\u5220\u9664?"),Object(B.a)(C.a.mark(function ur(){var pn;return C.a.wrap(function(br){for(;;)switch(br.prev=br.next){case 0:return br.next=2,Object(s.a)("/api/programas/".concat(Ye==null?void 0:Ye.id,".json"),{method:"delete",body:{id:Ye==null?void 0:Ye.id}});case 2:pn=br.sent,pn.status===0&&(R.b.info("\u5220\u9664\u6210\u529F"),Ie());case 4:case"end":return br.stop()}},ur)}))),_t.abrupt("break",17);case 17:case"end":return _t.stop()}},yt)}));return function(xt,Ye,fr){return ot.apply(this,arguments)}}(),gt=function(yt,xt){z.a.confirm({centered:!0,title:"\u63D0\u793A",icon:m.a.createElement(p.a,null),content:yt,okText:"\u786E\u8BA4",onOk:function(){return xt()},cancelText:"\u53D6\u6D88"})},ct=function(yt,xt){return m.a.createElement("div",{className:l.a.leftMenuActions},xt===1&&m.a.createElement("p",{className:"current",onClick:function(){return Ge(1,yt,xt)}},"\u65B0\u5EFA"),m.a.createElement("p",{className:"current",onClick:function(){return Ge(2,yt,xt)}},"\u91CD\u547D\u540D"),m.a.createElement("p",{className:"current",onClick:function(){return Ge(3,yt,xt)}},"\u7F6E\u9876"),m.a.createElement("p",{className:"current",onClick:function(){return Ge(4,yt,xt)}},"\u5220\u9664"))};function st(){return wt.apply(this,arguments)}function wt(){return wt=Object(B.a)(C.a.mark(function ot(){var yt;return C.a.wrap(function(Ye){for(;;)switch(Ye.prev=Ye.next){case 0:return Ye.next=2,Object(s.a)("/api/programas/".concat(et,"/content.json"),{method:"get",params:{id:et}});case 2:yt=Ye.sent,yt&&ee(yt);case 4:case"end":return Ye.stop()}},ot)})),wt.apply(this,arguments)}return m.a.createElement("div",{style:{marginBottom:"40px"}},m.a.createElement("img",{style:{width:"100%"},src:u.a.IMG_SERVER+"/".concat(te==null||((ie=te.setting)===null||ie===void 0)?void 0:ie.shixun_banner_url)}),m.a.createElement("div",{className:"edu-container minH500",style:{display:"flex",width:"1200px"}},m.a.createElement(ve,{width:244,className:l.a.leftMenus,style:{background:"none",marginTop:"20px",height:"auto"}},m.a.createElement(S.a,{mode:"inline"},ze==null?void 0:ze.map(function(ot,yt){if((ot==null?void 0:ot.children.length)>0){var xt;return m.a.createElement(oe,{title:m.a.createElement("span",{className:"font16"},m.a.createElement("span",null,ot.name),!Object(A.v)()&&m.a.createElement("span",null),Object(A.v)()&&m.a.createElement(X.a,{placement:"right",content:function(){return ct(ot,1)},trigger:"hover"},m.a.createElement("span",{className:["iconfont icon-sandian",l.a.actions].join(" ")})))},ot==null||((xt=ot.children)===null||xt===void 0)?void 0:xt.map(function(Ye,fr){return m.a.createElement(S.a.Item,{className:l.a===null||l.a===void 0?void 0:l.a.SubMentItem,onClick:function(){We(Ye==null?void 0:Ye.id),et=Ye==null?void 0:Ye.id,st()}},m.a.createElement("span",{style:{flex:"1"}},Ye==null?void 0:Ye.name),Object(A.v)()&&m.a.createElement(X.a,{placement:"right",content:function(){return ct(Ye,2)},trigger:"hover"},m.a.createElement("span",{className:["iconfont icon-sandian",l.a.actions].join(" ")})))}))}else return m.a.createElement(S.a.Item,{className:l.a===null||l.a===void 0?void 0:l.a.SubMentItem,onClick:function(){We(ot==null?void 0:ot.id),et=ot==null?void 0:ot.id,st()}},m.a.createElement("span",{style:{flex:"1"}},ot==null?void 0:ot.name),Object(A.v)()&&m.a.createElement(X.a,{placement:"right",content:function(){return ct(ot,1)},trigger:"hover"},m.a.createElement("span",{className:["iconfont icon-sandian",l.a.actions].join(" ")})))}),m.a.createElement(S.a.Item,{onClick:function(){We(""),et="",Me(!0)},style:{color:"#0152d9",fontSize:"16px",height:"40px",display:"flex",alignItems:"center"},icon:m.a.createElement(c.a,{style:{color:"#0152d9",fontSize:"16px"}})},"\u65B0\u589E\u4E8C\u7EA7\u7C7B\u76EE"))),m.a.createElement("div",{style:{width:"937px",marginLeft:"17px",background:"#fff",padding:"20px"}},Le&&m.a.createElement(j,{ItemData:J,setIssee:Ce}),Le===!1&&m.a.createElement(q,{ItemData:J,setIssee:Ce,CategoryId:et}))),m.a.createElement(d,{CategoryId:et,IsShow:Re,setIsShow:Me,init:Ie}),m.a.createElement(b,{CategoryId:et,name:pe,IsShow:qe,setIsShow:Je,init:Ie}))}var me=rt.default=Object(w.a)(function(le){var ie=le.user,he=le.globalSetting;return{user:ie,globalSetting:he}})(ge)},"VrN/":function(ft,rt,ne){(function(re,X){ft.exports=X()})(this,function(){"use strict";var re=navigator.userAgent,X=navigator.platform,L=/gecko\/\d/i.test(re),z=/MSIE \d/.test(re),I=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(re),R=/Edge\/(\d+)/.exec(re),B=z||I||R,U=B&&(z?document.documentMode||6:+(R||I)[1]),P=!R&&/WebKit\//.test(re),D=P&&/Qt\/\d+\.\d+/.test(re),v=!R&&/Chrome\//.test(re),S=/Opera\//.test(re),_=/Apple Computer/.test(navigator.vendor),C=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(re),T=/PhantomJS/.test(re),m=!R&&/AppleWebKit/.test(re)&&/Mobile\/\w+/.test(re),u=/Android/.test(re),o=m||u||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(re),l=m||/Mac/.test(X),s=/\bCrOS\b/.test(re),w=/win/i.test(X),p=S&&re.match(/Version\/(\d*\.\d*)/);p&&(p=Number(p[1])),p&&p>=15&&(S=!1,P=!0);var c=l&&(D||S&&(p==null||p<12.11)),A=L||B&&U>=9;function y(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var f=function(e,t){var n=e.className,r=y(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 h(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function d(e,t){return h(e).appendChild(t)}function a(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),typeof t=="string")i.appendChild(document.createTextNode(t));else if(t)for(var x=0;x<t.length;++x)i.appendChild(t[x]);return i}function b(e,t,n,r){var i=a(e,t,n,r);return i.setAttribute("role","presentation"),i}var g;document.createRange?g=function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:g=function(e,t,n){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch(i){return r}return r.collapse(!0),r.moveEnd("character",n),r.moveStart("character",t),r};function E(e,t){if(t.nodeType==3&&(t=t.parentNode),e.contains)return e.contains(t);do if(t.nodeType==11&&(t=t.host),t==e)return!0;while(t=t.parentNode)}function M(){var e;try{e=document.activeElement}catch(t){e=document.body||null}for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e}function F(e,t){var n=e.className;y(t).test(n)||(e.className+=(n?" ":"")+t)}function j(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!y(n[r]).test(t)&&(t+=" "+n[r]);return t}var W=function(e){e.select()};m?W=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:B&&(W=function(e){try{e.select()}catch(t){}});function O(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function k(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 K(e,t,n,r,i){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var x=r||0,N=i||0;;){var H=e.indexOf(" ",x);if(H<0||H>=t)return N+(t-x);N+=H-x,N+=n-N%n,x=H+1}}var Y=function(){this.id=null,this.f=null,this.time=0,this.handler=O(this.onTimeout,this)};Y.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},Y.prototype.set=function(e,t){this.f=t;var n=+new Date+e;(!this.id||n<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=n)};function q(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}var oe=50,Te={toString:function(){return"CodeMirror.Pass"}},ve={scroll:!1},ge={origin:"*mouse"},me={origin:"+move"};function le(e,t,n){for(var r=0,i=0;;){var x=e.indexOf(" ",r);x==-1&&(x=e.length);var N=x-r;if(x==e.length||i+N>=t)return r+Math.min(N,t-i);if(i+=x-r,i+=n-i%n,r=x+1,i>=t)return r}}var ie=[""];function he(e){for(;ie.length<=e;)ie.push($(ie)+" ");return ie[e]}function $(e){return e[e.length-1]}function te(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function Z(e,t,n){for(var r=0,i=n(t);r<e.length&&n(e[r])<=i;)r++;e.splice(r,0,t)}function be(){}function Ae(e,t){var n;return Object.create?n=Object.create(e):(be.prototype=e,n=new be),t&&k(t,n),n}var ye=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function we(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||ye.test(e))}function De(e,t){return t?t.source.indexOf("\\w")>-1&&we(e)?!0:t.test(e):we(e)}function Re(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var Me=/[\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 ke(e){return e.charCodeAt(0)>=768&&Me.test(e)}function Oe(e,t,n){for(;(n<0?t>0:t<e.length)&&ke(e.charAt(t));)t+=n;return t}function ze(e,t,n){for(var r=t>n?-1:1;;){if(t==n)return t;var i=(t+n)/2,x=r<0?Math.ceil(i):Math.floor(i);if(x==t)return e(x)?t:n;e(x)?n=x:t=x+r}}function Ze(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var i=!1,x=0;x<e.length;++x){var N=e[x];(N.from<n&&N.to>t||t==n&&N.to==t)&&(r(Math.max(N.from,t),Math.min(N.to,n),N.level==1?"rtl":"ltr",x),i=!0)}i||r(t,n,"ltr")}var je=null;function Xe(e,t,n){var r;je=null;for(var i=0;i<e.length;++i){var x=e[i];if(x.from<t&&x.to>t)return i;x.to==t&&(x.from!=x.to&&n=="before"?r=i:je=i),x.from==t&&(x.from!=x.to&&n!="before"?r=i:je=i)}return r!=null?r:je}var et=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]/,x=/[LRr]/,N=/[Lb1n]/,H=/[1n]/;function G(V,ae,ue){this.level=V,this.from=ae,this.to=ue}return function(V,ae){var ue=ae=="ltr"?"L":"R";if(V.length==0||ae=="ltr"&&!r.test(V))return!1;for(var xe=V.length,Ee=[],Pe=0;Pe<xe;++Pe)Ee.push(n(V.charCodeAt(Pe)));for(var Ue=0,Ke=ue;Ue<xe;++Ue){var $e=Ee[Ue];$e=="m"?Ee[Ue]=Ke:Ke=$e}for(var tt=0,Qe=ue;tt<xe;++tt){var nt=Ee[tt];nt=="1"&&Qe=="r"?Ee[tt]="n":x.test(nt)&&(Qe=nt,nt=="r"&&(Ee[tt]="R"))}for(var dt=1,lt=Ee[0];dt<xe-1;++dt){var vt=Ee[dt];vt=="+"&&lt=="1"&&Ee[dt+1]=="1"?Ee[dt]="1":vt==","&&lt==Ee[dt+1]&&(lt=="1"||lt=="n")&&(Ee[dt]=lt),lt=vt}for(var Rt=0;Rt<xe;++Rt){var Kt=Ee[Rt];if(Kt==",")Ee[Rt]="N";else if(Kt=="%"){var Pt=void 0;for(Pt=Rt+1;Pt<xe&&Ee[Pt]=="%";++Pt);for(var cr=Rt&&Ee[Rt-1]=="!"||Pt<xe&&Ee[Pt]=="1"?"1":"N",ir=Rt;ir<Pt;++ir)Ee[ir]=cr;Rt=Pt-1}}for(var Nt=0,ar=ue;Nt<xe;++Nt){var Xt=Ee[Nt];ar=="L"&&Xt=="1"?Ee[Nt]="L":x.test(Xt)&&(ar=Xt)}for(var jt=0;jt<xe;++jt)if(i.test(Ee[jt])){var Ft=void 0;for(Ft=jt+1;Ft<xe&&i.test(Ee[Ft]);++Ft);for(var It=(jt?Ee[jt-1]:ue)=="L",or=(Ft<xe?Ee[Ft]:ue)=="L",Hn=It==or?It?"L":"R":ue,Jr=jt;Jr<Ft;++Jr)Ee[Jr]=Hn;jt=Ft-1}for(var $t=[],kr,Gt=0;Gt<xe;)if(N.test(Ee[Gt])){var Xa=Gt;for(++Gt;Gt<xe&&N.test(Ee[Gt]);++Gt);$t.push(new G(0,Xa,Gt))}else{var Wr=Gt,hn=$t.length,mn=ae=="rtl"?1:0;for(++Gt;Gt<xe&&Ee[Gt]!="L";++Gt);for(var Zt=Wr;Zt<Gt;)if(H.test(Ee[Zt])){Wr<Zt&&($t.splice(hn,0,new G(1,Wr,Zt)),hn+=mn);var Kn=Zt;for(++Zt;Zt<Gt&&H.test(Ee[Zt]);++Zt);$t.splice(hn,0,new G(2,Kn,Zt)),hn+=mn,Wr=Zt}else++Zt;Wr<Gt&&$t.splice(hn,0,new G(1,Wr,Gt))}return ae=="ltr"&&($t[0].level==1&&(kr=V.match(/^\s+/))&&($t[0].from=kr[0].length,$t.unshift(new G(0,0,kr[0].length))),$($t).level==1&&(kr=V.match(/\s+$/))&&($($t).to-=kr[0].length,$t.push(new G(0,xe-kr[0].length,xe)))),ae=="rtl"?$t.reverse():$t}}();function We(e,t){var n=e.order;return n==null&&(n=e.order=et(e.text,t)),n}var Be=[],Se=function(e,t,n){if(e.addEventListener)e.addEventListener(t,n,!1);else if(e.attachEvent)e.attachEvent("on"+t,n);else{var r=e._handlers||(e._handlers={});r[t]=(r[t]||Be).concat(n)}};function qe(e,t){return e._handlers&&e._handlers[t]||Be}function Je(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,!1);else if(e.detachEvent)e.detachEvent("on"+t,n);else{var r=e._handlers,i=r&&r[t];if(i){var x=q(i,n);x>-1&&(r[t]=i.slice(0,x).concat(i.slice(x+1)))}}}function _e(e,t){var n=qe(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 Ne(e,t,n){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),_e(e,n||t.type,e,t),ee(t)||t.codemirrorIgnore}function pe(e){var t=e._handlers&&e._handlers.cursorActivity;if(!t)return;for(var n=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),r=0;r<t.length;++r)q(n,t[r])==-1&&n.push(t[r])}function de(e,t){return qe(e,t).length>0}function ce(e){e.prototype.on=function(t,n){Se(this,t,n)},e.prototype.off=function(t,n){Je(this,t,n)}}function Q(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function J(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function ee(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function se(e){Q(e),J(e)}function fe(e){return e.target||e.srcElement}function Le(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 Ce=function(){if(B&&U<9)return!1;var e=a("div");return"draggable"in e||"dragDrop"in e}(),Ie;function Ve(e){if(Ie==null){var t=a("span","\u200B");d(e,a("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(Ie=t.offsetWidth<=1&&t.offsetHeight>2&&!(B&&U<8))}var n=Ie?a("span","\u200B"):a("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var Ge;function gt(e){if(Ge!=null)return Ge;var t=d(e,document.createTextNode("A\u062EA")),n=g(t,0,1).getBoundingClientRect(),r=g(t,1,2).getBoundingClientRect();return h(e),!n||n.left==n.right?!1:Ge=r.right-n.right<3}var ct=`
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 x=e.slice(t,e.charAt(i-1)=="\r"?i-1:i),N=x.indexOf("\r");N!=-1?(n.push(x.slice(0,N)),t+=N+1):(n.push(x),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},st=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(n){}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},wt=function(){var e=a("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),ot=null;function yt(e){if(ot!=null)return ot;var t=d(e,a("span","x")),n=t.getBoundingClientRect(),r=g(t,0,1).getBoundingClientRect();return ot=Math.abs(n.left-r.left)>1}var xt={},Ye={};function fr(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),xt[e]=t}function sr(e,t){Ye[e]=t}function lr(e){if(typeof e=="string"&&Ye.hasOwnProperty(e))e=Ye[e];else if(e&&typeof e.name=="string"&&Ye.hasOwnProperty(e.name)){var t=Ye[e.name];typeof t=="string"&&(t={name:t}),e=Ae(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return lr("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return lr("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function _t(e,t){t=lr(t);var n=xt[t.name];if(!n)return _t(e,"text/plain");var r=n(e,t);if(ur.hasOwnProperty(t.name)){var i=ur[t.name];for(var x in i){if(!i.hasOwnProperty(x))continue;r.hasOwnProperty(x)&&(r["_"+x]=r[x]),r[x]=i[x]}}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var N in t.modeProps)r[N]=t.modeProps[N];return r}var ur={};function pn(e,t){var n=ur.hasOwnProperty(e)?ur[e]:ur[e]={};k(t,n)}function yr(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 br(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 Gn(e,t,n){return e.startState?e.startState(t,n):!0}var Mt=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};Mt.prototype.eol=function(){return this.pos>=this.string.length},Mt.prototype.sol=function(){return this.pos==this.lineStart},Mt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Mt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Mt.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},Mt.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Mt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Mt.prototype.skipToEnd=function(){this.pos=this.string.length},Mt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Mt.prototype.backUp=function(e){this.pos-=e},Mt.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=K(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?K(this.string,this.lineStart,this.tabSize):0)},Mt.prototype.indentation=function(){return K(this.string,null,this.tabSize)-(this.lineStart?K(this.string,this.lineStart,this.tabSize):0)},Mt.prototype.match=function(e,t,n){if(typeof e=="string"){var r=function(N){return n?N.toLowerCase():N},i=this.string.substr(this.pos,e.length);if(r(i)==r(e))return t!==!1&&(this.pos+=e.length),!0}else{var x=this.string.slice(this.pos).match(e);return x&&x.index>0?null:(x&&t!==!1&&(this.pos+=x[0].length),x)}},Mt.prototype.current=function(){return this.string.slice(this.start,this.pos)},Mt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Mt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Mt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function it(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],x=i.chunkSize();if(t<x){n=i;break}t-=x}return n.lines[t]}function Pr(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,function(x){var N=x.text;i==n.line&&(N=N.slice(0,n.ch)),i==t.line&&(N=N.slice(t.ch)),r.push(N),++i}),r}function gn(e,t,n){var r=[];return e.iter(t,n,function(i){r.push(i.text)}),r}function qt(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function Ct(e){if(e.parent==null)return null;for(var t=e.parent,n=q(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var i=0;!(r.children[i]==t);++i)n+=r.children[i].chunkSize();return n+t.first}function Er(e,t){var n=e.first;e:do{for(var r=0;r<e.children.length;++r){var i=e.children[r],x=i.height;if(t<x){e=i;continue e}t-=x,n+=i.chunkSize()}return n}while(!e.lines);for(var N=0;N<e.lines.length;++N){var H=e.lines[N],G=H.height;if(t<G)break;t-=G}return n+N}function Mr(e,t){return t>=e.first&&t<e.first+e.size}function vn(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function Fe(e,t,n){if(n===void 0&&(n=null),!(this instanceof Fe))return new Fe(e,t,n);this.line=e,this.ch=t,this.sticky=n}function ht(e,t){return e.line-t.line||e.ch-t.ch}function zn(e,t){return e.sticky==t.sticky&&ht(e,t)==0}function yn(e){return Fe(e.line,e.ch)}function bn(e,t){return ht(e,t)<0?t:e}function Zr(e,t){return ht(e,t)<0?e:t}function En(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function pt(e,t){if(t.line<e.first)return Fe(e.first,0);var n=e.first+e.size-1;return t.line>n?Fe(n,it(e,n).text.length):Li(t,it(e,t.line).text.length)}function Li(e,t){var n=e.ch;return n==null||n>t?Fe(e.line,t):n<0?Fe(e.line,0):e}function He(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=pt(e,t[r]);return n}var xn=function(e,t){this.state=e,this.lookAhead=t},gr=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};gr.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},gr.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}},gr.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},gr.fromSaved=function(e,t,n){return t instanceof xn?new gr(e,yr(e.mode,t.state),n,t.lookAhead):new gr(e,yr(e.mode,t),n)},gr.prototype.save=function(e){var t=e!==!1?yr(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new xn(t,this.maxLookAhead):t};function Xn(e,t,n,r){var i=[e.state.modeGen],x={};Sr(e,t.text,e.doc.mode,n,function(V,ae){return i.push(V,ae)},x,r);for(var N=n.state,H=function(V){n.baseTokens=i;var ae=e.state.overlays[V],ue=1,xe=0;n.state=!0,Sr(e,t.text,ae.mode,n,function(Ee,Pe){for(var Ue=ue;xe<Ee;){var Ke=i[ue];Ke>Ee&&i.splice(ue,1,Ee,i[ue+1],Ke),ue+=2,xe=Math.min(Ee,Ke)}if(!Pe)return;if(ae.opaque)i.splice(Ue,ue-Ue,Ee,"overlay "+Pe),ue=Ue+2;else for(;Ue<ue;Ue+=2){var $e=i[Ue+1];i[Ue+1]=($e?$e+" ":"")+"overlay "+Pe}},x),n.state=N,n.baseTokens=null,n.baseTokenPos=1},G=0;G<e.state.overlays.length;++G)H(G);return{styles:i,classes:x.bgClass||x.textClass?x:null}}function qr(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=xr(e,Ct(t)),i=t.text.length>e.options.maxHighlightLength&&yr(e.doc.mode,r.state),x=Xn(e,t,r);i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=x.styles,x.classes?t.styleClasses=x.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 xr(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new gr(r,!0,t);var x=Oi(e,t,n),N=x>r.first&&it(r,x-1).stateAfter,H=N?gr.fromSaved(r,N,x):new gr(r,Gn(r.mode),x);return r.iter(x,t,function(G){Vn(e,G.text,H);var V=H.line;G.stateAfter=V==t-1||V%5==0||V>=i.viewFrom&&V<i.viewTo?H.save():null,H.nextLine()}),n&&(r.modeFrontier=H.line),H}function Vn(e,t,n,r){var i=e.doc.mode,x=new Mt(t,e.options.tabSize,n);for(x.start=x.pos=r||0,t==""&&Yn(i,n.state);!x.eol();)Tr(i,x,n.state),x.start=x.pos}function Yn(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var n=br(e,t);if(n.mode.blankLine)return n.mode.blankLine(n.state)}function Tr(e,t,n,r){for(var i=0;i<10;i++){r&&(r[0]=br(e,n).mode);var x=e.token(t,n);if(t.pos>t.start)return x}throw new Error("Mode "+e.name+" failed to advance stream.")}var $n=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function Di(e,t,n,r){var i=e.doc,x=i.mode,N;t=pt(i,t);var H=it(i,t.line),G=xr(e,t.line,n),V=new Mt(H.text,e.options.tabSize,G),ae;for(r&&(ae=[]);(r||V.pos<t.ch)&&!V.eol();)V.start=V.pos,N=Tr(x,V,G.state),r&&ae.push(new $n(V,N,yr(i.mode,G.state)));return r?ae:new $n(V,N,G.state)}function Qn(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 Sr(e,t,n,r,i,x,N){var H=n.flattenSpans;H==null&&(H=e.options.flattenSpans);var G=0,V=null,ae=new Mt(t,e.options.tabSize,r),ue,xe=e.options.addModeClass&&[null];for(t==""&&Qn(Yn(n,r.state),x);!ae.eol();){if(ae.pos>e.options.maxHighlightLength?(H=!1,N&&Vn(e,t,r,ae.pos),ae.pos=t.length,ue=null):ue=Qn(Tr(n,ae,r.state,xe),x),xe){var Ee=xe[0].name;Ee&&(ue="m-"+(ue?Ee+" "+ue:Ee))}if(!H||V!=ue){for(;G<ae.start;)G=Math.min(ae.start,G+5e3),i(G,V);V=ue}ae.start=ae.pos}for(;G<ae.pos;){var Pe=Math.min(ae.pos,G+5e3);i(Pe,V),G=Pe}}function Oi(e,t,n){for(var r,i,x=e.doc,N=n?-1:t-(e.doc.mode.innerMode?1e3:100),H=t;H>N;--H){if(H<=x.first)return x.first;var G=it(x,H-1),V=G.stateAfter;if(V&&(!n||H+(V instanceof xn?V.lookAhead:0)<=x.modeFrontier))return H;var ae=K(G.text,null,e.options.tabSize);(i==null||r>ae)&&(i=H-1,r=ae)}return i}function aa(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=it(e,r).stateAfter;if(i&&(!(i instanceof xn)||r+i.lookAhead<t)){n=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}var Jn=!1,Qt=!1;function Hr(){Jn=!0}function oa(){Qt=!0}function en(e,t,n){this.marker=e,this.from=t,this.to=n}function wr(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function Zn(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n||(n=[])).push(e[r]);return n}function sa(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function Ri(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var x=e[i],N=x.marker,H=x.from==null||(N.inclusiveLeft?x.from<=t:x.from<t);if(H||x.from==t&&N.type=="bookmark"&&(!n||!x.marker.insertLeft)){var G=x.to==null||(N.inclusiveRight?x.to>=t:x.to>t);(r||(r=[])).push(new en(N,x.from,G?null:x.to))}}return r}function _i(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var x=e[i],N=x.marker,H=x.to==null||(N.inclusiveRight?x.to>=t:x.to>t);if(H||x.from==t&&N.type=="bookmark"&&(!n||x.marker.insertLeft)){var G=x.from==null||(N.inclusiveLeft?x.from<=t:x.from<t);(r||(r=[])).push(new en(N,G?null:x.from-t,x.to==null?null:x.to-t))}}return r}function Tn(e,t){if(t.full)return null;var n=Mr(e,t.from.line)&&it(e,t.from.line).markedSpans,r=Mr(e,t.to.line)&&it(e,t.to.line).markedSpans;if(!n&&!r)return null;var i=t.from.ch,x=t.to.ch,N=ht(t.from,t.to)==0,H=Ri(n,i,N),G=_i(r,x,N),V=t.text.length==1,ae=$(t.text).length+(V?i:0);if(H)for(var ue=0;ue<H.length;++ue){var xe=H[ue];if(xe.to==null){var Ee=wr(G,xe.marker);Ee?V&&(xe.to=Ee.to==null?null:Ee.to+ae):xe.to=i}}if(G)for(var Pe=0;Pe<G.length;++Pe){var Ue=G[Pe];if(Ue.to!=null&&(Ue.to+=ae),Ue.from==null){var Ke=wr(H,Ue.marker);Ke||(Ue.from=ae,V&&(H||(H=[])).push(Ue))}else Ue.from+=ae,V&&(H||(H=[])).push(Ue)}H&&(H=ki(H)),G&&G!=H&&(G=ki(G));var $e=[H];if(!V){var tt=t.text.length-2,Qe;if(tt>0&&H)for(var nt=0;nt<H.length;++nt)H[nt].to==null&&(Qe||(Qe=[])).push(new en(H[nt].marker,null,null));for(var dt=0;dt<tt;++dt)$e.push(Qe);$e.push(G)}return $e}function ki(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 Pi(e,t,n){var r=null;if(e.iter(t.line,n.line+1,function(Ee){if(Ee.markedSpans)for(var Pe=0;Pe<Ee.markedSpans.length;++Pe){var Ue=Ee.markedSpans[Pe].marker;Ue.readOnly&&(!r||q(r,Ue)==-1)&&(r||(r=[])).push(Ue)}}),!r)return null;for(var i=[{from:t,to:n}],x=0;x<r.length;++x)for(var N=r[x],H=N.find(0),G=0;G<i.length;++G){var V=i[G];if(ht(V.to,H.from)<0||ht(V.from,H.to)>0)continue;var ae=[G,1],ue=ht(V.from,H.from),xe=ht(V.to,H.to);(ue<0||!N.inclusiveLeft&&!ue)&&ae.push({from:V.from,to:H.from}),(xe>0||!N.inclusiveRight&&!xe)&&ae.push({from:H.to,to:V.to}),i.splice.apply(i,ae),G+=ae.length-3}return i}function la(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 Sn(e,t){if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}function tn(e){return e.inclusiveLeft?-1:0}function rn(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(),x=ht(r.from,i.from)||tn(e)-tn(t);if(x)return-x;var N=ht(r.to,i.to)||rn(e)-rn(t);return N||t.id-e.id}function Ir(e,t){var n=Qt&&e.markedSpans,r;if(n)for(var i=void 0,x=0;x<n.length;++x)i=n[x],i.marker.collapsed&&(t?i.from:i.to)==null&&(!r||wn(r,i.marker)<0)&&(r=i.marker);return r}function Ur(e){return Ir(e,!0)}function Nr(e){return Ir(e,!1)}function Cn(e,t){var n=Qt&&e.markedSpans,r;if(n)for(var i=0;i<n.length;++i){var x=n[i];x.marker.collapsed&&(x.from==null||x.from<t)&&(x.to==null||x.to>t)&&(!r||wn(r,x.marker)<0)&&(r=x.marker)}return r}function Mi(e,t,n,r,i){var x=it(e,t),N=Qt&&x.markedSpans;if(N)for(var H=0;H<N.length;++H){var G=N[H];if(!G.marker.collapsed)continue;var V=G.marker.find(0),ae=ht(V.from,n)||tn(G.marker)-tn(i),ue=ht(V.to,r)||rn(G.marker)-rn(i);if(ae>=0&&ue<=0||ae<=0&&ue>=0)continue;if(ae<=0&&(G.marker.inclusiveRight&&i.inclusiveLeft?ht(V.to,n)>=0:ht(V.to,n)>0)||ae>=0&&(G.marker.inclusiveRight&&i.inclusiveLeft?ht(V.from,r)<=0:ht(V.from,r)<0))return!0}}function hr(e){for(var t;t=Ur(e);)e=t.find(-1,!0).line;return e}function Ii(e){for(var t;t=Nr(e);)e=t.find(1,!0).line;return e}function An(e){for(var t,n;t=Nr(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function qn(e,t){var n=it(e,t),r=hr(n);return n==r?t:Ct(r)}function Kr(e,t){if(t>e.lastLine())return t;var n=it(e,t),r;if(!Or(e,n))return t;for(;r=Nr(n);)n=r.find(1,!0).line;return Ct(n)+1}function Or(e,t){var n=Qt&&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&&ei(e,t,r))return!0}}function ei(e,t,n){if(n.to==null){var r=n.marker.find(1,!0);return ei(e,r.line,wr(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var i=void 0,x=0;x<t.markedSpans.length;++x)if(i=t.markedSpans[x],i.marker.collapsed&&!i.marker.widgetNode&&i.from==n.to&&(i.to==null||i.to!=n.from)&&(i.marker.inclusiveLeft||n.marker.inclusiveRight)&&ei(e,t,i))return!0}function Cr(e){e=hr(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 x=n.parent;x;n=x,x=n.parent)for(var N=0;N<x.children.length;++N){var H=x.children[N];if(H==n)break;t+=H.height}return t}function ti(e){if(e.height==0)return 0;for(var t=e.text.length,n,r=e;n=Ur(r);){var i=n.find(0,!0);r=i.from.line,t+=i.from.ch-i.to.ch}for(r=e;n=Nr(r);){var x=n.find(0,!0);t-=r.text.length-x.from.ch,r=x.to.line,t+=r.text.length-x.to.ch}return t}function Ui(e){var t=e.display,n=e.doc;t.maxLine=it(n,n.first),t.maxLineLength=ti(t.maxLine),t.maxLineChanged=!0,n.iter(function(r){var i=ti(r);i>t.maxLineLength&&(t.maxLineLength=i,t.maxLine=r)})}var nn=function(e,t,n){this.text=e,Sn(this,t),this.height=n?n(this):1};nn.prototype.lineNo=function(){return Ct(this)},ce(nn);function ua(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),la(e),Sn(e,n);var i=r?r(e):1;i!=e.height&&qt(e,i)}function at(e){e.parent=null,la(e)}var mt={},ut={};function bt(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?ut:mt;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function St(e,t){var n=b("span",null,null,P?"padding-right: .1px":null),r={pre:b("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 x=i?t.rest[i-1]:t.line,N=void 0;r.pos=0,r.addToken=Tt,gt(e.display.measure)&&(N=We(x,e.doc.direction))&&(r.addToken=er(r.addToken,N)),r.map=[];var H=t!=e.display.externalMeasured&&Ct(x);Fr(x,r,qr(e,x,H)),x.styleClasses&&(x.styleClasses.bgClass&&(r.bgClass=j(x.styleClasses.bgClass,r.bgClass||"")),x.styleClasses.textClass&&(r.textClass=j(x.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(Ve(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 _e(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=j(r.pre.className,r.textClass||"")),r}function Ot(e){var t=a("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Tt(e,t,n,r,i,x,N){if(!t)return;var H=e.splitSpaces?Bt(t,e.trailingSpace):t,G=e.cm.state.specialChars,V=!1,ae;if(!G.test(t))e.col+=t.length,ae=document.createTextNode(H),e.map.push(e.pos,e.pos+t.length,ae),B&&U<9&&(V=!0),e.pos+=t.length;else{ae=document.createDocumentFragment();for(var ue=0;;){G.lastIndex=ue;var xe=G.exec(t),Ee=xe?xe.index-ue:t.length-ue;if(Ee){var Pe=document.createTextNode(H.slice(ue,ue+Ee));B&&U<9?ae.appendChild(a("span",[Pe])):ae.appendChild(Pe),e.map.push(e.pos,e.pos+Ee,Pe),e.col+=Ee,e.pos+=Ee}if(!xe)break;ue+=Ee+1;var Ue=void 0;if(xe[0]==" "){var Ke=e.cm.options.tabSize,$e=Ke-e.col%Ke;Ue=ae.appendChild(a("span",he($e),"cm-tab")),Ue.setAttribute("role","presentation"),Ue.setAttribute("cm-text"," "),e.col+=$e}else xe[0]=="\r"||xe[0]==`
`?(Ue=ae.appendChild(a("span",xe[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Ue.setAttribute("cm-text",xe[0]),e.col+=1):(Ue=e.cm.options.specialCharPlaceholder(xe[0]),Ue.setAttribute("cm-text",xe[0]),B&&U<9?ae.appendChild(a("span",[Ue])):ae.appendChild(Ue),e.col+=1);e.map.push(e.pos,e.pos+1,Ue),e.pos++}}if(e.trailingSpace=H.charCodeAt(t.length-1)==32,n||r||i||V||x||N){var tt=n||"";r&&(tt+=r),i&&(tt+=i);var Qe=a("span",[ae],tt,x);if(N)for(var nt in N)N.hasOwnProperty(nt)&&nt!="style"&&nt!="class"&&Qe.setAttribute(nt,N[nt]);return e.content.appendChild(Qe)}e.content.appendChild(ae)}function Bt(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",i=0;i<e.length;i++){var x=e.charAt(i);x==" "&&n&&(i==e.length-1||e.charCodeAt(i+1)==32)&&(x="\xA0"),r+=x,n=x==" "}return r}function er(e,t){return function(n,r,i,x,N,H,G){i=i?i+" cm-force-border":"cm-force-border";for(var V=n.pos,ae=V+r.length;;){for(var ue=void 0,xe=0;xe<t.length&&!(ue=t[xe],ue.to>V&&ue.from<=V);xe++);if(ue.to>=ae)return e(n,r,i,x,N,H,G);e(n,r.slice(0,ue.to-V),i,x,null,H,G),x=null,r=r.slice(ue.to-V),V=ue.to}}}function Et(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 Fr(e,t,n){var r=e.markedSpans,i=e.text,x=0;if(!r){for(var N=1;N<n.length;N+=2)t.addToken(t,i.slice(x,x=n[N]),bt(n[N+1],t.cm.options));return}for(var H=i.length,G=0,V=1,ae="",ue,xe,Ee=0,Pe,Ue,Ke,$e,tt;;){if(Ee==G){Pe=Ue=Ke=xe="",tt=null,$e=null,Ee=Infinity;for(var Qe=[],nt=void 0,dt=0;dt<r.length;++dt){var lt=r[dt],vt=lt.marker;if(vt.type=="bookmark"&&lt.from==G&&vt.widgetNode)Qe.push(vt);else if(lt.from<=G&&(lt.to==null||lt.to>G||vt.collapsed&&lt.to==G&&lt.from==G)){if(lt.to!=null&&lt.to!=G&&Ee>lt.to&&(Ee=lt.to,Ue=""),vt.className&&(Pe+=" "+vt.className),vt.css&&(xe=(xe?xe+";":"")+vt.css),vt.startStyle&&lt.from==G&&(Ke+=" "+vt.startStyle),vt.endStyle&&lt.to==Ee&&(nt||(nt=[])).push(vt.endStyle,lt.to),vt.title&&((tt||(tt={})).title=vt.title),vt.attributes)for(var Rt in vt.attributes)(tt||(tt={}))[Rt]=vt.attributes[Rt];vt.collapsed&&(!$e||wn($e.marker,vt)<0)&&($e=lt)}else lt.from>G&&Ee>lt.from&&(Ee=lt.from)}if(nt)for(var Kt=0;Kt<nt.length;Kt+=2)nt[Kt+1]==Ee&&(Ue+=" "+nt[Kt]);if(!$e||$e.from==G)for(var Pt=0;Pt<Qe.length;++Pt)Et(t,0,Qe[Pt]);if($e&&($e.from||0)==G){if(Et(t,($e.to==null?H+1:$e.to)-G,$e.marker,$e.from==null),$e.to==null)return;$e.to==G&&($e=!1)}}if(G>=H)break;for(var cr=Math.min(H,Ee);;){if(ae){var ir=G+ae.length;if(!$e){var Nt=ir>cr?ae.slice(0,cr-G):ae;t.addToken(t,Nt,ue?ue+Pe:Pe,Ke,G+Nt.length==Ee?Ue:"",xe,tt)}if(ir>=cr){ae=ae.slice(cr-G),G=cr;break}G=ir,Ke=""}ae=i.slice(x,x=n[V++]),ue=bt(n[V++],t.cm.options)}}}function At(e,t,n){this.line=t,this.rest=An(t),this.size=this.rest?Ct($(this.rest))-n+1:1,this.node=this.text=null,this.hidden=Or(e,t)}function tr(e,t,n){for(var r=[],i,x=t;x<n;x=i){var N=new At(e.doc,it(e.doc,x),x);i=x+N.size,r.push(N)}return r}var Vt=null;function vr(e){Vt?Vt.ops.push(e):e.ownsGroup=Vt={ops:[e],delayedCallbacks:[]}}function Rs(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 _s(e,t){var n=e.ownsGroup;if(!n)return;try{Rs(n)}finally{Vt=null,t(n)}}var ri=null;function zt(e,t){var n=qe(e,t);if(!n.length)return;var r=Array.prototype.slice.call(arguments,2),i;Vt?i=Vt.delayedCallbacks:ri?i=ri:(i=ri=[],setTimeout(ks,0));for(var x=function(H){i.push(function(){return n[H].apply(null,r)})},N=0;N<n.length;++N)x(N)}function ks(){var e=ri;ri=null;for(var t=0;t<e.length;++t)e[t]()}function Ya(e,t,n,r){for(var i=0;i<t.changes.length;i++){var x=t.changes[i];x=="text"?Ms(e,t):x=="gutter"?Qa(e,t,n,r):x=="class"?da(e,t):x=="widget"&&Is(e,t,r)}t.changes=null}function ni(e){return e.node==e.text&&(e.node=a("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),B&&U<8&&(e.node.style.zIndex=2)),e.node}function Ps(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=ni(t);t.background=r.insertBefore(a("div",null,n),r.firstChild),e.display.input.setUneditable(t.background)}}function $a(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):St(e,t)}function Ms(e,t){var n=t.text.className,r=$a(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,da(e,t)):n&&(t.text.className=n)}function da(e,t){Ps(e,t),t.line.wrapClass?ni(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=ni(t);t.gutterBackground=a("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),i.insertBefore(t.gutterBackground,t.text)}var x=t.line.gutterMarkers;if(e.options.lineNumbers||x){var N=ni(t),H=t.gutter=a("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(H),N.insertBefore(H,t.text),t.line.gutterClass&&(H.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!x||!x["CodeMirror-linenumbers"])&&(t.lineNumber=H.appendChild(a("div",vn(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),x)for(var G=0;G<e.display.gutterSpecs.length;++G){var V=e.display.gutterSpecs[G].className,ae=x.hasOwnProperty(V)&&x[V];ae&&H.appendChild(a("div",[ae],"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=y("CodeMirror-linewidget"),i=t.node.firstChild,x=void 0;i;i=x)x=i.nextSibling,r.test(i.className)&&t.node.removeChild(i);Ja(e,t,n)}function Us(e,t,n,r){var i=$a(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),da(e,t),Qa(e,t,n,r),Ja(e,t,r),t.node}function Ja(e,t,n){if(Za(e,t.line,t,n,!0),t.rest)for(var r=0;r<t.rest.length;r++)Za(e,t.rest[r],t,n,!1)}function Za(e,t,n,r,i){if(!t.widgets)return;for(var x=ni(n),N=0,H=t.widgets;N<H.length;++N){var G=H[N],V=a("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?x.insertBefore(V,n.gutter||n.text):x.appendChild(V),zt(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 ii(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!E(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,a("div",[e.node],null,n))}return e.height=e.node.parentNode.offsetHeight}function Br(e,t){for(var n=fe(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 qa(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=d(e.measure,a("pre","x","CodeMirror-line-like")),n=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r={left:parseInt(n.paddingLeft),right:parseInt(n.paddingRight)};return!isNaN(r.left)&&!isNaN(r.right)&&(e.cachedPaddingH=r),r}function Rr(e){return oe-e.display.nativeBarWidth}function an(e){return e.display.scroller.clientWidth-Rr(e)-e.display.barWidth}function fa(e){return e.display.scroller.clientHeight-Rr(e)-e.display.barHeight}function Fs(e,t,n){var r=e.options.lineWrapping,i=r&&an(e);if(!t.measure.heights||r&&t.measure.width!=i){var x=t.measure.heights=[];if(r){t.measure.width=i;for(var N=t.text.firstChild.getClientRects(),H=0;H<N.length-1;H++){var G=N[H],V=N[H+1];Math.abs(G.bottom-V.bottom)>2&&x.push((G.bottom+V.top)/2-n.top)}}x.push(n.bottom-n.top)}}function eo(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(Ct(e.rest[i])>n)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Bs(e,t){t=hr(t);var n=Ct(t),r=e.display.externalMeasured=new At(e.doc,t,n);r.lineN=n;var i=r.built=St(e,r);return r.text=i.pre,d(e.display.lineMeasure,i.pre),r}function to(e,t,n,r){return _r(e,Ln(e,t),n,r)}function ha(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[ln(e,t)];var n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size)return n}function Ln(e,t){var n=Ct(t),r=ha(e,n);r&&!r.text?r=null:r&&r.changes&&(Ya(e,r,n,ba(e)),e.curOp.forceUpdate=!0),r||(r=Bs(e,t));var i=eo(r,t,n);return{line:t,view:r,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function _r(e,t,n,r,i){t.before&&(n=-1);var x=n+(r||""),N;return t.cache.hasOwnProperty(x)?N=t.cache[x]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Fs(e,t.view,t.rect),t.hasHeights=!0),N=Ws(e,t,n,r),N.bogus||(t.cache[x]=N)),{left:N.left,right:N.right,top:i?N.rtop:N.top,bottom:i?N.rbottom:N.bottom}}var ro={left:0,right:0,top:0,bottom:0};function no(e,t,n){for(var r,i,x,N,H,G,V=0;V<e.length;V+=3)if(H=e[V],G=e[V+1],t<H?(i=0,x=1,N="left"):t<G?(i=t-H,x=i+1):(V==e.length-3||t==G&&e[V+3]>t)&&(x=G-H,i=x-1,t>=G&&(N="right")),i!=null){if(r=e[V+2],H==G&&n==(r.insertLeft?"left":"right")&&(N=n),n=="left"&&i==0)for(;V&&e[V-2]==e[V-3]&&e[V-1].insertLeft;)r=e[(V-=3)+2],N="left";if(n=="right"&&i==G-H)for(;V<e.length-3&&e[V+3]==e[V+4]&&!e[V+5].insertLeft;)r=e[(V+=3)+2],N="right";break}return{node:r,start:i,end:x,collapse:N,coverStart:H,coverEnd:G}}function js(e,t){var n=ro;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=no(t.map,n,r),x=i.node,N=i.start,H=i.end,G=i.collapse,V;if(x.nodeType==3){for(var ae=0;ae<4;ae++){for(;N&&ke(t.line.text.charAt(i.coverStart+N));)--N;for(;i.coverStart+H<i.coverEnd&&ke(t.line.text.charAt(i.coverStart+H));)++H;if(B&&U<9&&N==0&&H==i.coverEnd-i.coverStart?V=x.parentNode.getBoundingClientRect():V=js(g(x,N,H).getClientRects(),r),V.left||V.right||N==0)break;H=N,N=N-1,G="right"}B&&U<11&&(V=Hs(e.display.measure,V))}else{N>0&&(G=r="right");var ue;e.options.lineWrapping&&(ue=x.getClientRects()).length>1?V=ue[r=="right"?ue.length-1:0]:V=x.getBoundingClientRect()}if(B&&U<9&&!N&&(!V||!V.left&&!V.right)){var xe=x.parentNode.getClientRects()[0];xe?V={left:xe.left,right:xe.left+On(e.display),top:xe.top,bottom:xe.bottom}:V=ro}for(var Ee=V.top-t.rect.top,Pe=V.bottom-t.rect.top,Ue=(Ee+Pe)/2,Ke=t.view.measure.heights,$e=0;$e<Ke.length-1&&!(Ue<Ke[$e]);$e++);var tt=$e?Ke[$e-1]:0,Qe=Ke[$e],nt={left:(G=="right"?V.right:V.left)-t.rect.left,right:(G=="left"?V.left:V.right)-t.rect.left,top:tt,bottom:Qe};return!V.left&&!V.right&&(nt.bogus=!0),e.options.singleCursorHeightPerLine||(nt.rtop=Ee,nt.rbottom=Pe),nt}function Hs(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!yt(e))return t;var n=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*n,right:t.right*n,top:t.top*r,bottom:t.bottom*r}}function io(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 ao(e){e.display.externalMeasure=null,h(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)io(e.display.view[t])}function ai(e){ao(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function oo(){return v&&u?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function so(){return v&&u?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function ma(e){var t=0;if(e.widgets)for(var n=0;n<e.widgets.length;++n)e.widgets[n].above&&(t+=ii(e.widgets[n]));return t}function Fi(e,t,n,r,i){if(!i){var x=ma(t);n.top+=x,n.bottom+=x}if(r=="line")return n;r||(r="local");var N=Cr(t);if(r=="local"?N+=Ni(e.display):N-=e.display.viewOffset,r=="page"||r=="window"){var H=e.display.lineSpace.getBoundingClientRect();N+=H.top+(r=="window"?0:so());var G=H.left+(r=="window"?0:oo());n.left+=G,n.right+=G}return n.top+=N,n.bottom+=N,n}function lo(e,t,n){if(n=="div")return t;var r=t.left,i=t.top;if(n=="page")r-=oo(),i-=so();else if(n=="local"||!n){var x=e.display.sizer.getBoundingClientRect();r+=x.left,i+=x.top}var N=e.display.lineSpace.getBoundingClientRect();return{left:r-N.left,top:i-N.top}}function pa(e,t,n,r,i){return r||(r=it(e.doc,t.line)),Fi(e,r,to(e,r,t.ch,i),n)}function Ar(e,t,n,r,i,x){r=r||it(e.doc,t.line),i||(i=Ln(e,r));function N(Pe,Ue){var Ke=_r(e,i,Pe,Ue?"right":"left",x);return Ue?Ke.left=Ke.right:Ke.right=Ke.left,Fi(e,r,Ke,n)}var H=We(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"),!H)return N(V=="before"?G-1:G,V=="before");function ae(Pe,Ue,Ke){var $e=H[Ue],tt=$e.level==1;return N(Ke?Pe-1:Pe,tt!=Ke)}var ue=Xe(H,G,V),xe=je,Ee=ae(G,ue,V=="before");return xe!=null&&(Ee.other=ae(G,xe,V!="before")),Ee}function uo(e,t){var n=0;t=pt(e.doc,t),e.options.lineWrapping||(n=On(e.display)*t.ch);var r=it(e.doc,t.line),i=Cr(r)+Ni(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function ga(e,t,n,r,i){var x=Fe(e,t,n);return x.xRel=i,r&&(x.outside=r),x}function va(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return ga(r.first,0,null,-1,-1);var i=Er(r,n),x=r.first+r.size-1;if(i>x)return ga(r.first+r.size-1,it(r,x).text.length,null,1,1);t<0&&(t=0);for(var N=it(r,i);;){var H=Ks(e,N,i,t,n),G=Cn(N,H.ch+(H.xRel>0||H.outside>0?1:0));if(!G)return H;var V=G.find(1);if(V.line==i)return V;N=it(r,i=V.line)}}function co(e,t,n,r){r-=ma(t);var i=t.text.length,x=ze(function(N){return _r(e,n,N-1).bottom<=r},i,0);return i=ze(function(N){return _r(e,n,N).top>r},x,i),{begin:x,end:i}}function fo(e,t,n,r){n||(n=Ln(e,t));var i=Fi(e,t,_r(e,n,r),"line").top;return co(e,t,n,i)}function ya(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-=Cr(t);var x=Ln(e,t),N=ma(t),H=0,G=t.text.length,V=!0,ae=We(t,e.doc.direction);if(ae){var ue=(e.options.lineWrapping?zs:Gs)(e,t,n,x,ae,r,i);V=ue.level!=1,H=V?ue.from:ue.to-1,G=V?ue.to:ue.from-1}var xe=null,Ee=null,Pe=ze(function(dt){var lt=_r(e,x,dt);return lt.top+=N,lt.bottom+=N,ya(lt,r,i,!1)?(lt.top<=i&&lt.left<=r&&(xe=dt,Ee=lt),!0):!1},H,G),Ue,Ke,$e=!1;if(Ee){var tt=r-Ee.left<Ee.right-r,Qe=tt==V;Pe=xe+(Qe?0:1),Ke=Qe?"after":"before",Ue=tt?Ee.left:Ee.right}else{!V&&(Pe==G||Pe==H)&&Pe++,Ke=Pe==0?"after":Pe==t.text.length?"before":_r(e,x,Pe-(V?1:0)).bottom+N<=i==V?"after":"before";var nt=Ar(e,Fe(n,Pe,Ke),"line",t,x);Ue=nt.left,$e=i<nt.top?-1:i>=nt.bottom?1:0}return Pe=Oe(t.text,Pe,1),ga(n,Pe,Ke,$e,r-Ue)}function Gs(e,t,n,r,i,x,N){var H=ze(function(ue){var xe=i[ue],Ee=xe.level!=1;return ya(Ar(e,Fe(n,Ee?xe.to:xe.from,Ee?"before":"after"),"line",t,r),x,N,!0)},0,i.length-1),G=i[H];if(H>0){var V=G.level!=1,ae=Ar(e,Fe(n,V?G.from:G.to,V?"after":"before"),"line",t,r);ya(ae,x,N,!0)&&ae.top>N&&(G=i[H-1])}return G}function zs(e,t,n,r,i,x,N){var H=co(e,t,r,N),G=H.begin,V=H.end;/\s/.test(t.text.charAt(V-1))&&V--;for(var ae=null,ue=null,xe=0;xe<i.length;xe++){var Ee=i[xe];if(Ee.from>=V||Ee.to<=G)continue;var Pe=Ee.level!=1,Ue=_r(e,r,Pe?Math.min(V,Ee.to)-1:Math.max(G,Ee.from)).right,Ke=Ue<x?x-Ue+1e9:Ue-x;(!ae||ue>Ke)&&(ae=Ee,ue=Ke)}return ae||(ae=i[i.length-1]),ae.from<G&&(ae={from:G,to:ae.to,level:ae.level}),ae.to>V&&(ae={from:ae.from,to:V,level:ae.level}),ae}var on;function Dn(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(on==null){on=a("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)on.appendChild(document.createTextNode("x")),on.appendChild(a("br"));on.appendChild(document.createTextNode("x"))}d(e.measure,on);var n=on.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),h(e.measure),n||1}function On(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=a("span","xxxxxxxxxx"),n=a("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 ba(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,x=t.gutters.firstChild,N=0;x;x=x.nextSibling,++N){var H=e.display.gutterSpecs[N].className;n[H]=x.offsetLeft+x.clientLeft+i,r[H]=x.clientWidth}return{fixedPos:Ea(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Ea(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function ho(e){var t=Dn(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/On(e.display)-3);return function(i){if(Or(e.doc,i))return 0;var x=0;if(i.widgets)for(var N=0;N<i.widgets.length;N++)i.widgets[N].height&&(x+=i.widgets[N].height);return n?x+(Math.ceil(i.text.length/r)||1)*t:x+t}}function xa(e){var t=e.doc,n=ho(e);t.iter(function(r){var i=n(r);i!=r.height&&qt(r,i)})}function sn(e,t,n,r){var i=e.display;if(!n&&fe(t).getAttribute("cm-not-content")=="true")return null;var x,N,H=i.lineSpace.getBoundingClientRect();try{x=t.clientX-H.left,N=t.clientY-H.top}catch(ue){return null}var G=va(e,x,N),V;if(r&&G.xRel>0&&(V=it(e.doc,G.line).text).length==G.ch){var ae=K(V,V.length,e.options.tabSize)-V.length;G=Fe(G.line,Math.max(0,Math.round((x-qa(e.display).left)/On(e.display))-ae))}return G}function ln(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 rr(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)Qt&&qn(e.doc,t)<i.viewTo&&zr(e);else if(n<=i.viewFrom)Qt&&Kr(e.doc,n+r)>i.viewFrom?zr(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)zr(e);else if(t<=i.viewFrom){var x=Bi(e,n,n+r,1);x?(i.view=i.view.slice(x.index),i.viewFrom=x.lineN,i.viewTo+=r):zr(e)}else if(n>=i.viewTo){var N=Bi(e,t,t,-1);N?(i.view=i.view.slice(0,N.index),i.viewTo=N.lineN):zr(e)}else{var H=Bi(e,t,t,-1),G=Bi(e,n,n+r,1);H&&G?(i.view=i.view.slice(0,H.index).concat(tr(e,H.lineN,G.lineN)).concat(i.view.slice(G.index)),i.viewTo+=r):zr(e)}var V=i.externalMeasured;V&&(n<V.lineN?V.lineN+=r:t<V.lineN+V.size&&(i.externalMeasured=null))}function Gr(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 x=r.view[ln(e,t)];if(x.node==null)return;var N=x.changes||(x.changes=[]);q(N,n)==-1&&N.push(n)}function zr(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=ln(e,t),x,N=e.display.view;if(!Qt||n==e.doc.first+e.doc.size)return{index:i,lineN:n};for(var H=e.display.viewFrom,G=0;G<i;G++)H+=N[G].size;if(H!=t){if(r>0){if(i==N.length-1)return null;x=H+N[i].size-t,i++}else x=H-t;t+=x,n+=x}for(;qn(e.doc,n)!=n;){if(i==(r<0?0:N.length-1))return null;n+=r*N[i-(r<0?1:0)].size,i+=r}return{index:i,lineN:n}}function Xs(e,t,n){var r=e.display,i=r.view;i.length==0||t>=r.viewTo||n<=r.viewFrom?(r.view=tr(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=tr(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(ln(e,t))),r.viewFrom=t,r.viewTo<n?r.view=r.view.concat(tr(e,r.viewTo,n)):r.viewTo>n&&(r.view=r.view.slice(0,ln(e,n)))),r.viewTo=n}function mo(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 oi(e){e.display.input.showSelection(e.display.input.prepareSelection())}function po(e,t){t===void 0&&(t=!0);for(var n=e.doc,r={},i=r.cursors=document.createDocumentFragment(),x=r.selection=document.createDocumentFragment(),N=0;N<n.sel.ranges.length;N++){if(!t&&N==n.sel.primIndex)continue;var H=n.sel.ranges[N];if(H.from().line>=e.display.viewTo||H.to().line<e.display.viewFrom)continue;var G=H.empty();(G||e.options.showCursorWhenSelecting)&&go(e,H.head,i),G||Vs(e,H,x)}return r}function go(e,t,n){var r=Ar(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),i=n.appendChild(a("div","\xA0","CodeMirror-cursor"));if(i.style.left=r.left+"px",i.style.top=r.top+"px",i.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px",r.other){var x=n.appendChild(a("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));x.style.display="",x.style.left=r.other.left+"px",x.style.top=r.other.top+"px",x.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function ji(e,t){return e.top-t.top||e.left-t.left}function Vs(e,t,n){var r=e.display,i=e.doc,x=document.createDocumentFragment(),N=qa(e.display),H=N.left,G=Math.max(r.sizerWidth,an(e)-r.sizer.offsetLeft)-N.right,V=i.direction=="ltr";function ae(Qe,nt,dt,lt){nt<0&&(nt=0),nt=Math.round(nt),lt=Math.round(lt),x.appendChild(a("div",null,"CodeMirror-selected","position: absolute; left: "+Qe+`px;
top: `+nt+"px; width: "+(dt==null?G-Qe:dt)+`px;
height: `+(lt-nt)+"px"))}function ue(Qe,nt,dt){var lt=it(i,Qe),vt=lt.text.length,Rt,Kt;function Pt(Nt,ar){return pa(e,Fe(Qe,Nt),"div",lt,ar)}function cr(Nt,ar,Xt){var jt=fo(e,lt,null,Nt),Ft=ar=="ltr"==(Xt=="after")?"left":"right",It=Xt=="after"?jt.begin:jt.end-(/\s/.test(lt.text.charAt(jt.end-1))?2:1);return Pt(It,Ft)[Ft]}var ir=We(lt,i.direction);return Ze(ir,nt||0,dt==null?vt:dt,function(Nt,ar,Xt,jt){var Ft=Xt=="ltr",It=Pt(Nt,Ft?"left":"right"),or=Pt(ar-1,Ft?"right":"left"),Hn=nt==null&&Nt==0,Jr=dt==null&&ar==vt,$t=jt==0,kr=!ir||jt==ir.length-1;if(or.top-It.top<=3){var Gt=(V?Hn:Jr)&&$t,Xa=(V?Jr:Hn)&&kr,Wr=Gt?H:(Ft?It:or).left,hn=Xa?G:(Ft?or:It).right;ae(Wr,It.top,hn-Wr,It.bottom)}else{var mn,Zt,Kn,Va;Ft?(mn=V&&Hn&&$t?H:It.left,Zt=V?G:cr(Nt,Xt,"before"),Kn=V?H:cr(ar,Xt,"after"),Va=V&&Jr&&kr?G:or.right):(mn=V?cr(Nt,Xt,"before"):H,Zt=!V&&Hn&&$t?G:It.right,Kn=!V&&Jr&&kr?H:or.left,Va=V?cr(ar,Xt,"after"):G),ae(mn,It.top,Zt-mn,It.bottom),It.bottom<or.top&&ae(H,It.bottom,null,or.top),ae(Kn,or.top,Va-Kn,or.bottom)}(!Rt||ji(It,Rt)<0)&&(Rt=It),ji(or,Rt)<0&&(Rt=or),(!Kt||ji(It,Kt)<0)&&(Kt=It),ji(or,Kt)<0&&(Kt=or)}),{start:Rt,end:Kt}}var xe=t.from(),Ee=t.to();if(xe.line==Ee.line)ue(xe.line,xe.ch,Ee.ch);else{var Pe=it(i,xe.line),Ue=it(i,Ee.line),Ke=hr(Pe)==hr(Ue),$e=ue(xe.line,xe.ch,Ke?Pe.text.length+1:null).end,tt=ue(Ee.line,Ke?0:null,Ee.ch).start;Ke&&($e.top<tt.top-2?(ae($e.right,$e.top,null,$e.bottom),ae(H,tt.top,tt.left,tt.bottom)):ae($e.right,$e.top,tt.left-$e.right,$e.bottom)),$e.bottom<tt.top&&ae(H,$e.bottom,null,tt.top)}n.appendChild(x)}function Ta(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()||Rn(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function vo(e){e.state.focused||(e.display.input.focus(),Sa(e))}function yo(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Rn(e))},100)}function Sa(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(_e(e,"focus",e,t),e.state.focused=!0,F(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),P&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Ta(e)}function Rn(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(_e(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],x=e.options.lineWrapping,N=void 0,H=0;if(i.hidden)continue;if(B&&U<8){var G=i.node.offsetTop+i.node.offsetHeight;N=G-n,n=G}else{var V=i.node.getBoundingClientRect();N=V.bottom-V.top,!x&&i.text.firstChild&&(H=i.text.firstChild.getBoundingClientRect().right-V.left-1)}var ae=i.line.height-N;if((ae>.005||ae<-.005)&&(qt(i.line,N),bo(i.line),i.rest))for(var ue=0;ue<i.rest.length;ue++)bo(i.rest[ue]);if(H>e.display.sizerWidth){var xe=Math.ceil(H/On(e.display));xe>e.display.maxLineLength&&(e.display.maxLineLength=xe,e.display.maxLine=i.line,e.display.maxLineChanged=!0)}}}function bo(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,x=Er(t,r),N=Er(t,i);if(n&&n.ensure){var H=n.ensure.from.line,G=n.ensure.to.line;H<x?(x=H,N=Er(t,Cr(it(t,H))+e.wrapper.clientHeight)):Math.min(G,t.lastLine())>=N&&(x=Er(t,Cr(it(t,G))-e.wrapper.clientHeight),N=G)}return{from:x,to:Math.max(N,x+1)}}function Ys(e,t){if(Ne(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&&!T){var x=a("div","\u200B",null,`position: absolute;
top: `+(t.top-n.viewOffset-Ni(e.display))+`px;
height: `+(t.bottom-t.top+Rr(e)+n.barHeight)+`px;
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(x),x.scrollIntoView(i),e.display.lineSpace.removeChild(x)}}function $s(e,t,n,r){r==null&&(r=0);var i;!e.options.lineWrapping&&t==n&&(t=t.ch?Fe(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,n=t.sticky=="before"?Fe(t.line,t.ch+1,"before"):t);for(var x=0;x<5;x++){var N=!1,H=Ar(e,t),G=!n||n==t?H:Ar(e,n);i={left:Math.min(H.left,G.left),top:Math.min(H.top,G.top)-r,right:Math.max(H.left,G.left),bottom:Math.max(H.bottom,G.bottom)+r};var V=wa(e,i),ae=e.doc.scrollTop,ue=e.doc.scrollLeft;if(V.scrollTop!=null&&(li(e,V.scrollTop),Math.abs(e.doc.scrollTop-ae)>1&&(N=!0)),V.scrollLeft!=null&&(un(e,V.scrollLeft),Math.abs(e.doc.scrollLeft-ue)>1&&(N=!0)),!N)break}return i}function Qs(e,t){var n=wa(e,t);n.scrollTop!=null&&li(e,n.scrollTop),n.scrollLeft!=null&&un(e,n.scrollLeft)}function wa(e,t){var n=e.display,r=Dn(e.display);t.top<0&&(t.top=0);var i=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop,x=fa(e),N={};t.bottom-t.top>x&&(t.bottom=t.top+x);var H=e.doc.height+ca(n),G=t.top<r,V=t.bottom>H-r;if(t.top<i)N.scrollTop=G?0:t.top;else if(t.bottom>i+x){var ae=Math.min(t.top,(V?H:t.bottom)-x);ae!=i&&(N.scrollTop=ae)}var ue=e.options.fixedGutter?0:n.gutters.offsetWidth,xe=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-ue,Ee=an(e)-n.gutters.offsetWidth,Pe=t.right-t.left>Ee;return Pe&&(t.right=t.left+Ee),t.left<10?N.scrollLeft=0:t.left<xe?N.scrollLeft=Math.max(0,t.left+ue-(Pe?0:10)):t.right>Ee+xe-3&&(N.scrollLeft=t.right+(Pe?0:10)-Ee),N}function Ca(e,t){if(t==null)return;Ki(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function _n(e){Ki(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function si(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=uo(e,t.from),r=uo(e,t.to);Eo(e,n,r,t.margin)}}function Eo(e,t,n,r){var i=wa(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});si(e,i.scrollLeft,i.scrollTop)}function li(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;L||La(e,{top:t}),xo(e,t,!0),L&&La(e),ci(e,100)}function xo(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 un(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,Ao(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function ui(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+Rr(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var dn=function(e,t,n){this.cm=n;var r=this.vert=a("div",[a("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=a("div",[a("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=i.tabIndex=-1,e(r),e(i),Se(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),Se(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,B&&U<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};dn.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 x=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+x)+"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}},dn.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},dn.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},dn.prototype.zeroWidthHack=function(){var e=l&&!C?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new Y,this.disableVert=new Y},dn.prototype.enableZeroWidthBar=function(e,t,n){e.style.pointerEvents="auto";function r(){var i=e.getBoundingClientRect(),x=n=="vert"?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1);x!=e?e.style.pointerEvents="none":t.set(1e3,r)}t.set(1e3,r)},dn.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var di=function(){};di.prototype.update=function(){return{bottom:0,right:0}},di.prototype.setScrollLeft=function(){},di.prototype.setScrollTop=function(){},di.prototype.clear=function(){};function kn(e,t){t||(t=ui(e));var n=e.display.barWidth,r=e.display.barHeight;To(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),To(e,ui(e)),n=e.display.barWidth,r=e.display.barHeight}function To(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 So={native:dn,null:di};function wo(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&f(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new So[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Se(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,n){n=="horizontal"?un(e,t):li(e,t)},e),e.display.scrollbars.addClass&&F(e.display.wrapper,e.display.scrollbars.addClass)}var Zs=0;function cn(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},vr(e.curOp)}function fn(e){var t=e.curOp;t&&_s(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 x=0;x<t.length;x++)nl(t[x]);for(var N=0;N<t.length;N++)il(t[N])}function el(e){var t=e.cm,n=t.display;ol(t),e.updateMaxLine&&Ui(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=ui(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=to(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+Rr(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-an(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&&un(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var n=e.focus&&e.focus==M();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,n),(e.updatedDisplay||e.startHeight!=t.doc.height)&&kn(t,e.barMeasure),e.updatedDisplay&&Oa(t,e.barMeasure),e.selectionChanged&&Ta(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),n&&vo(e.cm)}function il(e){var t=e.cm,n=t.display,r=t.doc;if(e.updatedDisplay&&Co(t,e.update),n.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(n.wheelStartX=n.wheelStartY=null),e.scrollTop!=null&&xo(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&un(t,e.scrollLeft,!0,!0),e.scrollToPos){var i=$s(t,pt(r,e.scrollToPos.from),pt(r,e.scrollToPos.to),e.scrollToPos.margin);Ys(t,i)}var x=e.maybeHiddenMarkers,N=e.maybeUnhiddenMarkers;if(x)for(var H=0;H<x.length;++H)x[H].lines.length||_e(x[H],"hide");if(N)for(var G=0;G<N.length;++G)N[G].lines.length&&_e(N[G],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&_e(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function dr(e,t){if(e.curOp)return t();cn(e);try{return t()}finally{fn(e)}}function Wt(e,t){return function(){if(e.curOp)return t.apply(e,arguments);cn(e);try{return t.apply(e,arguments)}finally{fn(e)}}}function Jt(e){return function(){if(this.curOp)return e.apply(this,arguments);cn(this);try{return e.apply(this,arguments)}finally{fn(this)}}}function Ht(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);cn(t);try{return e.apply(this,arguments)}finally{fn(t)}}}function ci(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,O(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var n=+new Date+e.options.workTime,r=xr(e,t.highlightFrontier),i=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(x){if(r.line>=e.display.viewFrom){var N=x.styles,H=x.text.length>e.options.maxHighlightLength?yr(t.mode,r.state):null,G=Xn(e,x,r,!0);H&&(r.state=H),x.styles=G.styles;var V=x.styleClasses,ae=G.classes;ae?x.styleClasses=ae:V&&(x.styleClasses=null);for(var ue=!N||N.length!=x.styles.length||V!=ae&&(!V||!ae||V.bgClass!=ae.bgClass||V.textClass!=ae.textClass),xe=0;!ue&&xe<N.length;++xe)ue=N[xe]!=x.styles[xe];ue&&i.push(r.line),x.stateAfter=r.save(),r.nextLine()}else x.text.length<=e.options.maxHighlightLength&&Vn(e,x.text,r),x.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>n)return ci(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&dr(e,function(){for(var x=0;x<i.length;x++)Gr(e,i[x],"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=an(e),this.force=n,this.dims=ba(e),this.events=[]};Gi.prototype.signal=function(e,t){de(e,t)&&this.events.push(arguments)},Gi.prototype.finish=function(){for(var e=0;e<this.events.length;e++)_e.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=Rr(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Rr(e)+"px",t.scrollbarsClipped=!0)}function sl(e){if(e.hasFocus())return null;var t=M();if(!t||!E(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&E(e.display.lineDiv,r.anchorNode)&&(n.anchorNode=r.anchorNode,n.anchorOffset=r.anchorOffset,n.focusNode=r.focusNode,n.focusOffset=r.focusOffset)}return n}function ll(e){if(!e||!e.activeElt||e.activeElt==M())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&E(document.body,e.anchorNode)&&E(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 zr(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&&mo(e)==0)return!1;Lo(e)&&(zr(e),t.dims=ba(e));var i=r.first+r.size,x=Math.max(t.visible.from-e.options.viewportMargin,r.first),N=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFrom<x&&x-n.viewFrom<20&&(x=Math.max(r.first,n.viewFrom)),n.viewTo>N&&n.viewTo-N<20&&(N=Math.min(i,n.viewTo)),Qt&&(x=qn(e.doc,x),N=Kr(e.doc,N));var H=x!=n.viewFrom||N!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Xs(e,x,N),n.viewOffset=Cr(it(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var G=mo(e);if(!H&&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),h(n.cursorDiv),h(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,H&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,ci(e,400)),n.updateLineNumbers=null,!0}function Co(e,t){for(var n=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==an(e)){if(n&&n.top!=null&&(n={top:Math.min(e.doc.height+ca(e.display)-fa(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=ui(e);oi(e),kn(e,i),Oa(e,i),t.force=!1}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function La(e,t){var n=new Gi(e,t);if(Aa(e,n)){Wi(e),Co(e,n);var r=ui(e);oi(e),kn(e,r),Oa(e,r),n.finish()}}function ul(e,t,n){var r=e.display,i=e.options.lineNumbers,x=r.lineDiv,N=x.firstChild;function H(Pe){var Ue=Pe.nextSibling;return P&&l&&e.display.currentWheelTarget==Pe?Pe.style.display="none":Pe.parentNode.removeChild(Pe),Ue}for(var G=r.view,V=r.viewFrom,ae=0;ae<G.length;ae++){var ue=G[ae];if(!ue.hidden)if(!ue.node||ue.node.parentNode!=x){var xe=Us(e,ue,V,n);x.insertBefore(xe,N)}else{for(;N!=ue.node;)N=H(N);var Ee=i&&t!=null&&t<=V&&ue.lineNumber;ue.changes&&(q(ue.changes,"gutter")>-1&&(Ee=!1),Ya(e,ue,V,n)),Ee&&(h(ue.lineNumber),ue.lineNumber.appendChild(document.createTextNode(vn(e.options,V)))),N=ue.node.nextSibling}V+=ue.size}for(;N;)N=H(N)}function Da(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Oa(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+Rr(e)+"px"}function Ao(e){var t=e.display,n=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var r=Ea(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,x=r+"px",N=0;N<n.length;N++)if(!n[N].hidden){e.options.fixedGutter&&(n[N].gutter&&(n[N].gutter.style.left=x),n[N].gutterBackground&&(n[N].gutterBackground.style.left=x));var H=n[N].alignable;if(H)for(var G=0;G<H.length;G++)H[G].style.left=x}e.options.fixedGutter&&(t.gutters.style.left=r+i+"px")}function Lo(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=vn(e.options,t.first+t.size-1),r=e.display;if(n.length!=r.lineNumChars){var i=r.measure.appendChild(a("div",[a("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),x=i.firstChild.offsetWidth,N=i.offsetWidth-x;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(x,r.lineGutter.offsetWidth-N)+1,r.lineNumWidth=r.lineNumInnerWidth+N,r.lineNumChars=r.lineNumInnerWidth?n.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",Da(e.display),!0}return!1}function Ra(e,t){for(var n=[],r=!1,i=0;i<e.length;i++){var x=e[i],N=null;if(typeof x!="string"&&(N=x.style,x=x.className),x=="CodeMirror-linenumbers")if(t)r=!0;else continue;n.push({className:x,style:N})}return t&&!r&&n.push({className:"CodeMirror-linenumbers",style:null}),n}function Do(e){var t=e.gutters,n=e.gutterSpecs;h(t),e.lineGutter=null;for(var r=0;r<n.length;++r){var i=n[r],x=i.className,N=i.style,H=t.appendChild(a("div",null,"CodeMirror-gutter "+x));N&&(H.style.cssText=N),x=="CodeMirror-linenumbers"&&(e.lineGutter=H,H.style.width=(e.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",Da(e)}function fi(e){Do(e.display),rr(e),Ao(e)}function dl(e,t,n,r){var i=this;this.input=n,i.scrollbarFiller=a("div",null,"CodeMirror-scrollbar-filler"),i.scrollbarFiller.setAttribute("cm-not-content","true"),i.gutterFiller=a("div",null,"CodeMirror-gutter-filler"),i.gutterFiller.setAttribute("cm-not-content","true"),i.lineDiv=b("div",null,"CodeMirror-code"),i.selectionDiv=a("div",null,null,"position: relative; z-index: 1"),i.cursorDiv=a("div",null,"CodeMirror-cursors"),i.measure=a("div",null,"CodeMirror-measure"),i.lineMeasure=a("div",null,"CodeMirror-measure"),i.lineSpace=b("div",[i.measure,i.lineMeasure,i.selectionDiv,i.cursorDiv,i.lineDiv],null,"position: relative; outline: none");var x=b("div",[i.lineSpace],"CodeMirror-lines");i.mover=a("div",[x],null,"position: relative"),i.sizer=a("div",[i.mover],"CodeMirror-sizer"),i.sizerWidth=null,i.heightForcer=a("div",null,null,"position: absolute; height: "+oe+"px; width: 1px;"),i.gutters=a("div",null,"CodeMirror-gutters"),i.lineGutter=null,i.scroller=a("div",[i.sizer,i.heightForcer,i.gutters],"CodeMirror-scroll"),i.scroller.setAttribute("tabIndex","-1"),i.wrapper=a("div",[i.scrollbarFiller,i.gutterFiller,i.scroller],"CodeMirror"),B&&U<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),!P&&!(L&&o)&&(i.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(i.wrapper):e(i.wrapper)),i.viewFrom=i.viewTo=t.first,i.reportedViewFrom=i.reportedViewTo=t.first,i.view=[],i.renderedView=null,i.externalMeasured=null,i.viewOffset=0,i.lastWrapHeight=i.lastWrapWidth=0,i.updateLineNumbers=null,i.nativeBarWidth=i.barHeight=i.barWidth=0,i.scrollbarsClipped=!1,i.lineNumWidth=i.lineNumInnerWidth=i.lineNumChars=null,i.alignWidgets=!1,i.cachedCharWidth=i.cachedTextHeight=i.cachedPaddingH=null,i.maxLine=null,i.maxLineLength=0,i.maxLineChanged=!1,i.wheelDX=i.wheelDY=i.wheelStartX=i.wheelStartY=null,i.shift=!1,i.selForContextMenu=null,i.activeTouch=null,i.gutterSpecs=Ra(r.gutters,r.lineNumbers),Do(i),n.init(i)}var zi=0,mr=null;B?mr=-.53:L?mr=15:v?mr=-.7:_&&(mr=-1/3);function Oo(e){var t=e.wheelDeltaX,n=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),n==null&&e.detail&&e.axis==e.VERTICAL_AXIS?n=e.detail:n==null&&(n=e.wheelDelta),{x:t,y:n}}function cl(e){var t=Oo(e);return t.x*=mr,t.y*=mr,t}function Ro(e,t){var n=Oo(t),r=n.x,i=n.y,x=e.display,N=x.scroller,H=N.scrollWidth>N.clientWidth,G=N.scrollHeight>N.clientHeight;if(!(r&&H||i&&G))return;if(i&&l&&P){e:for(var V=t.target,ae=x.view;V!=N;V=V.parentNode)for(var ue=0;ue<ae.length;ue++)if(ae[ue].node==V){e.display.currentWheelTarget=V;break e}}if(r&&!L&&!S&&mr!=null){i&&G&&li(e,Math.max(0,N.scrollTop+i*mr)),un(e,Math.max(0,N.scrollLeft+r*mr)),(!i||i&&G)&&Q(t),x.wheelStartX=null;return}if(i&&mr!=null){var xe=i*mr,Ee=e.doc.scrollTop,Pe=Ee+x.wrapper.clientHeight;xe<0?Ee=Math.max(0,Ee+xe-50):Pe=Math.min(e.doc.height,Pe+xe+50),La(e,{top:Ee,bottom:Pe})}zi<20&&(x.wheelStartX==null?(x.wheelStartX=N.scrollLeft,x.wheelStartY=N.scrollTop,x.wheelDX=r,x.wheelDY=i,setTimeout(function(){if(x.wheelStartX==null)return;var Ue=N.scrollLeft-x.wheelStartX,Ke=N.scrollTop-x.wheelStartY,$e=Ke&&x.wheelDY&&Ke/x.wheelDY||Ue&&x.wheelDX&&Ue/x.wheelDX;if(x.wheelStartX=x.wheelStartY=null,!$e)return;mr=(mr*zi+$e)/(zi+1),++zi},200)):(x.wheelDX+=r,x.wheelDY+=i))}var pr=function(e,t){this.ranges=e,this.primIndex=t};pr.prototype.primary=function(){return this.ranges[this.primIndex]},pr.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(!zn(n.anchor,r.anchor)||!zn(n.head,r.head))return!1}return!0},pr.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new Lt(yn(this.ranges[t].anchor),yn(this.ranges[t].head));return new pr(e,this.primIndex)},pr.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},pr.prototype.contains=function(e,t){t||(t=e);for(var n=0;n<this.ranges.length;n++){var r=this.ranges[n];if(ht(t,r.from())>=0&&ht(e,r.to())<=0)return n}return-1};var Lt=function(e,t){this.anchor=e,this.head=t};Lt.prototype.from=function(){return Zr(this.anchor,this.head)},Lt.prototype.to=function(){return bn(this.anchor,this.head)},Lt.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Lr(e,t,n){var r=e&&e.options.selectionsMayTouch,i=t[n];t.sort(function(xe,Ee){return ht(xe.from(),Ee.from())}),n=q(t,i);for(var x=1;x<t.length;x++){var N=t[x],H=t[x-1],G=ht(H.to(),N.from());if(r&&!N.empty()?G>0:G>=0){var V=Zr(H.from(),N.from()),ae=bn(H.to(),N.to()),ue=H.empty()?N.from()==N.head:H.from()==H.head;x<=n&&--n,t.splice(--x,2,new Lt(ue?ae:V,ue?V:ae))}}return new pr(t,n)}function Xr(e,t){return new pr([new Lt(e,t||e)],0)}function Vr(e){return e.text?Fe(e.from.line+e.text.length-1,$(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function _o(e,t){if(ht(e,t.from)<0)return e;if(ht(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),Fe(n,r)}function _a(e,t){for(var n=[],r=0;r<e.sel.ranges.length;r++){var i=e.sel.ranges[r];n.push(new Lt(_o(i.anchor,t),_o(i.head,t)))}return Lr(e.cm,n,e.sel.primIndex)}function ko(e,t,n){return e.line==t.line?Fe(n.line,e.ch-t.ch+n.ch):Fe(n.line+(e.line-t.line),e.ch)}function fl(e,t,n){for(var r=[],i=Fe(e.first,0),x=i,N=0;N<t.length;N++){var H=t[N],G=ko(H.from,i,x),V=ko(Vr(H),i,x);if(i=H.to,x=V,n=="around"){var ae=e.sel.ranges[N],ue=ht(ae.head,ae.anchor)<0;r[N]=new Lt(ue?V:G,ue?G:V)}else r[N]=new Lt(G,G)}return new pr(r,e.sel.primIndex)}function ka(e){e.doc.mode=_t(e.options,e.doc.modeOption),hi(e)}function hi(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,ci(e,100),e.state.modeGen++,e.curOp&&rr(e)}function Po(e,t){return t.from.ch==0&&t.to.ch==0&&$(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Pa(e,t,n,r){function i(tt){return n?n[tt]:null}function x(tt,Qe,nt){ua(tt,Qe,nt,r),zt(tt,"change",tt,t)}function N(tt,Qe){for(var nt=[],dt=tt;dt<Qe;++dt)nt.push(new nn(V[dt],i(dt),r));return nt}var H=t.from,G=t.to,V=t.text,ae=it(e,H.line),ue=it(e,G.line),xe=$(V),Ee=i(V.length-1),Pe=G.line-H.line;if(t.full)e.insert(0,N(0,V.length)),e.remove(V.length,e.size-V.length);else if(Po(e,t)){var Ue=N(0,V.length-1);x(ue,ue.text,Ee),Pe&&e.remove(H.line,Pe),Ue.length&&e.insert(H.line,Ue)}else if(ae==ue)if(V.length==1)x(ae,ae.text.slice(0,H.ch)+xe+ae.text.slice(G.ch),Ee);else{var Ke=N(1,V.length-1);Ke.push(new nn(xe+ae.text.slice(G.ch),Ee,r)),x(ae,ae.text.slice(0,H.ch)+V[0],i(0)),e.insert(H.line+1,Ke)}else if(V.length==1)x(ae,ae.text.slice(0,H.ch)+V[0]+ue.text.slice(G.ch),i(0)),e.remove(H.line+1,Pe);else{x(ae,ae.text.slice(0,H.ch)+V[0],i(0)),x(ue,xe+ue.text.slice(G.ch),Ee);var $e=N(1,V.length-1);Pe>1&&e.remove(H.line+1,Pe-1),e.insert(H.line+1,$e)}zt(e,"change",e,t)}function Yr(e,t,n){function r(i,x,N){if(i.linked)for(var H=0;H<i.linked.length;++H){var G=i.linked[H];if(G.doc==x)continue;var V=N&&G.sharedHist;if(n&&!V)continue;t(G.doc,V),r(G.doc,i,V)}}r(e,null,!0)}function Mo(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,xa(e),ka(e),Io(e),e.options.lineWrapping||Ui(e),e.options.mode=t.modeOption,rr(e)}function Io(e){(e.doc.direction=="rtl"?F:f)(e.display.lineDiv,"CodeMirror-rtl")}function hl(e){dr(e,function(){Io(e),rr(e)})}function Xi(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 Ma(e,t){var n={from:yn(t.from),to:Vr(t),text:Pr(e,t.from,t.to)};return Fo(e,n,t.from.line,t.to.line+1),Yr(e,function(r){return Fo(r,n,t.from.line,t.to.line+1)},!0),n}function Uo(e){for(;e.length;){var t=$(e);if(t.ranges)e.pop();else break}}function ml(e,t){if(t)return Uo(e.done),$(e.done);if(e.done.length&&!$(e.done).ranges)return $(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),$(e.done)}function No(e,t,n,r){var i=e.history;i.undone.length=0;var x=+new Date,N,H;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&i.lastModTime>x-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(N=ml(i,i.lastOp==r)))H=$(N.changes),ht(t.from,t.to)==0&&ht(t.from,H.to)==0?H.to=Vr(t):N.changes.push(Ma(e,t));else{var G=$(i.done);for((!G||!G.ranges)&&Vi(e.sel,i.done),N={changes:[Ma(e,t)],generation:i.generation},i.done.push(N);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(n),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=x,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,H||_e(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,x=r&&r.origin;n==i.lastSelOp||x&&i.lastSelOrigin==x&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==x||pl(e,x,$(i.done),t))?i.done[i.done.length-1]=t:Vi(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=x,i.lastSelOp=n,r&&r.clearRedo!==!1&&Uo(i.undone)}function Vi(e,t){var n=$(t);n&&n.ranges&&n.equals(e)||t.push(e)}function Fo(e,t,n,r){var i=t["spans_"+e.id],x=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(N){N.markedSpans&&((i||(i=t["spans_"+e.id]={}))[x]=N.markedSpans),++x})}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 Bo(e,t){var n=yl(e,t),r=Tn(e,t);if(!n)return r;if(!r)return n;for(var i=0;i<n.length;++i){var x=n[i],N=r[i];if(x&&N){e:for(var H=0;H<N.length;++H){for(var G=N[H],V=0;V<x.length;++V)if(x[V].marker==G.marker)continue e;x.push(G)}}else N&&(n[i]=N)}return n}function Pn(e,t,n){for(var r=[],i=0;i<e.length;++i){var x=e[i];if(x.ranges){r.push(n?pr.prototype.deepCopy.call(x):x);continue}var N=x.changes,H=[];r.push({changes:H});for(var G=0;G<N.length;++G){var V=N[G],ae=void 0;if(H.push({from:V.from,to:V.to,text:V.text}),t)for(var ue in V)(ae=ue.match(/^spans_(\d+)$/))&&(q(t,Number(ae[1]))>-1&&($(H)[ue]=V[ue],delete V[ue]))}}return r}function Ia(e,t,n,r){if(r){var i=e.anchor;if(n){var x=ht(t,i)<0;x!=ht(n,i)<0?(i=t,t=n):x!=ht(t,n)<0&&(t=n)}return new Lt(i,t)}else return new Lt(n||t,t)}function Yi(e,t,n,r,i){i==null&&(i=e.cm&&(e.cm.display.shift||e.extend)),Yt(e,new pr([Ia(e.sel.primary(),t,n,i)],0),r)}function jo(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),x=0;x<e.sel.ranges.length;x++)r[x]=Ia(e.sel.ranges[x],t[x],null,i);var N=Lr(e.cm,r,e.sel.primIndex);Yt(e,N,n)}function Ua(e,t,n,r){var i=e.sel.ranges.slice(0);i[t]=n,Yt(e,Lr(e.cm,i,e.sel.primIndex),r)}function Wo(e,t,n,r){Yt(e,Xr(t,n),r)}function bl(e,t,n){var r={ranges:t.ranges,update:function(i){this.ranges=[];for(var x=0;x<i.length;x++)this.ranges[x]=new Lt(pt(e,i[x].anchor),pt(e,i[x].head))},origin:n&&n.origin};return _e(e,"beforeSelectionChange",e,r),e.cm&&_e(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?Lr(e.cm,r.ranges,r.ranges.length-1):t}function Ho(e,t,n){var r=e.history.done,i=$(r);i&&i.ranges?(r[r.length-1]=t,$i(e,t,n)):Yt(e,t,n)}function Yt(e,t,n){$i(e,t,n),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function $i(e,t,n){(de(e,"beforeSelectionChange")||e.cm&&de(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,n));var r=n&&n.bias||(ht(t.primary().head,e.sel.primary().head)<0?-1:1);Ko(e,zo(e,t,r,!0)),!(n&&n.scroll===!1)&&e.cm&&_n(e.cm)}function Ko(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,pe(e.cm)),zt(e,"cursorActivity",e)}function Go(e){Ko(e,zo(e,e.sel,null,!1))}function zo(e,t,n,r){for(var i,x=0;x<t.ranges.length;x++){var N=t.ranges[x],H=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[x],G=Qi(e,N.anchor,H&&H.anchor,n,r),V=Qi(e,N.head,H&&H.head,n,r);(i||G!=N.anchor||V!=N.head)&&(i||(i=t.ranges.slice(0,x)),i[x]=new Lt(G,V))}return i?Lr(e.cm,i,t.primIndex):t}function Mn(e,t,n,r,i){var x=it(e,t.line);if(x.markedSpans)for(var N=0;N<x.markedSpans.length;++N){var H=x.markedSpans[N],G=H.marker,V="selectLeft"in G?!G.selectLeft:G.inclusiveLeft,ae="selectRight"in G?!G.selectRight:G.inclusiveRight;if((H.from==null||(V?H.from<=t.ch:H.from<t.ch))&&(H.to==null||(ae?H.to>=t.ch:H.to>t.ch))){if(i&&(_e(G,"beforeCursorEnter"),G.explicitlyCleared))if(x.markedSpans){--N;continue}else break;if(!G.atomic)continue;if(n){var ue=G.find(r<0?1:-1),xe=void 0;if((r<0?ae:V)&&(ue=Xo(e,ue,-r,ue&&ue.line==t.line?x:null)),ue&&ue.line==t.line&&(xe=ht(ue,n))&&(r<0?xe<0:xe>0))return Mn(e,ue,t,r,i)}var Ee=G.find(r<0?-1:1);return(r<0?V:ae)&&(Ee=Xo(e,Ee,r,Ee.line==t.line?x:null)),Ee?Mn(e,Ee,t,r,i):null}}return t}function Qi(e,t,n,r,i){var x=r||1,N=Mn(e,t,n,x,i)||!i&&Mn(e,t,n,x,!0)||Mn(e,t,n,-x,i)||!i&&Mn(e,t,n,-x,!0);return N||(e.cantEdit=!0,Fe(e.first,0))}function Xo(e,t,n,r){return n<0&&t.ch==0?t.line>e.first?pt(e,Fe(t.line-1)):null:n>0&&t.ch==(r||it(e,t.line)).text.length?t.line<e.first+e.size-1?Fe(t.line+1,0):null:new Fe(t.line,t.ch+n)}function Vo(e){e.setSelection(Fe(e.firstLine(),0),Fe(e.lastLine()),ve)}function Yo(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,x,N,H){i&&(r.from=pt(e,i)),x&&(r.to=pt(e,x)),N&&(r.text=N),H!==void 0&&(r.origin=H)}),_e(e,"beforeChange",e,r),e.cm&&_e(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 In(e,t,n){if(e.cm){if(!e.cm.curOp)return Wt(e.cm,In)(e,t,n);if(e.cm.state.suppressEdits)return}if((de(e,"beforeChange")||e.cm&&de(e.cm,"beforeChange"))&&(t=Yo(e,t,!0),!t))return;var r=Jn&&!n&&Pi(e,t.from,t.to);if(r)for(var i=r.length-1;i>=0;--i)$o(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else $o(e,t)}function $o(e,t){if(t.text.length==1&&t.text[0]==""&&ht(t.from,t.to)==0)return;var n=_a(e,t);No(e,t,n,e.cm?e.cm.curOp.id:NaN),mi(e,t,n,Tn(e,t));var r=[];Yr(e,function(i,x){!x&&q(r,i.history)==-1&&(qo(i.history,t),r.push(i.history)),mi(i,t,null,Tn(i,t))})}function Ji(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(r&&!n)return;for(var i=e.history,x,N=e.sel,H=t=="undo"?i.done:i.undone,G=t=="undo"?i.undone:i.done,V=0;V<H.length&&!(x=H[V],n?x.ranges&&!x.equals(e.sel):!x.ranges);V++);if(V==H.length)return;for(i.lastOrigin=i.lastSelOrigin=null;;)if(x=H.pop(),x.ranges){if(Vi(x,G),n&&!x.equals(e.sel)){Yt(e,x,{clearRedo:!1});return}N=x}else if(r){H.push(x);return}else break;var ae=[];Vi(N,G),G.push({changes:ae,generation:i.generation}),i.generation=x.generation||++i.maxGeneration;for(var ue=de(e,"beforeChange")||e.cm&&de(e.cm,"beforeChange"),xe=function(Ue){var Ke=x.changes[Ue];if(Ke.origin=t,ue&&!Yo(e,Ke,!1))return H.length=0,{};ae.push(Ma(e,Ke));var $e=Ue?_a(e,Ke):$(H);mi(e,Ke,$e,Bo(e,Ke)),!Ue&&e.cm&&e.cm.scrollIntoView({from:Ke.from,to:Vr(Ke)});var tt=[];Yr(e,function(Qe,nt){!nt&&q(tt,Qe.history)==-1&&(qo(Qe.history,Ke),tt.push(Qe.history)),mi(Qe,Ke,null,Bo(Qe,Ke))})},Ee=x.changes.length-1;Ee>=0;--Ee){var Pe=xe(Ee);if(Pe)return Pe.v}}function Qo(e,t){if(t==0)return;if(e.first+=t,e.sel=new pr(te(e.sel.ranges,function(i){return new Lt(Fe(i.anchor.line+t,i.anchor.ch),Fe(i.head.line+t,i.head.ch))}),e.sel.primIndex),e.cm){rr(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;r<n.viewTo;r++)Gr(e.cm,r,"gutter")}}function mi(e,t,n,r){if(e.cm&&!e.cm.curOp)return Wt(e.cm,mi)(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:Fe(e.first,0),to:Fe(t.to.line+i,t.to.ch),text:[$(t.text)],origin:t.origin}}var x=e.lastLine();t.to.line>x&&(t={from:t.from,to:Fe(x,it(e,x).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Pr(e,t.from,t.to),n||(n=_a(e,t)),e.cm?El(e.cm,t,r):Pa(e,t,r),$i(e,n,ve),e.cantEdit&&Qi(e,Fe(e.firstLine(),0))&&(e.cantEdit=!1)}function El(e,t,n){var r=e.doc,i=e.display,x=t.from,N=t.to,H=!1,G=x.line;e.options.lineWrapping||(G=Ct(hr(it(r,x.line))),r.iter(G,N.line+1,function(Ee){if(Ee==i.maxLine)return H=!0,!0})),r.sel.contains(t.from,t.to)>-1&&pe(e),Pa(r,t,n,ho(e)),e.options.lineWrapping||(r.iter(G,x.line+t.text.length,function(Ee){var Pe=ti(Ee);Pe>i.maxLineLength&&(i.maxLine=Ee,i.maxLineLength=Pe,i.maxLineChanged=!0,H=!1)}),H&&(e.curOp.updateMaxLine=!0)),aa(r,x.line),ci(e,400);var V=t.text.length-(N.line-x.line)-1;t.full?rr(e):x.line==N.line&&t.text.length==1&&!Po(e.doc,t)?Gr(e,x.line,"text"):rr(e,x.line,N.line+1,V);var ae=de(e,"changes"),ue=de(e,"change");if(ue||ae){var xe={from:x,to:N,text:t.text,removed:t.removed,origin:t.origin};ue&&zt(e,"change",e,xe),ae&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(xe)}e.display.selForContextMenu=null}function Un(e,t,n,r,i){var x;r||(r=n),ht(r,n)<0&&(x=[r,n],n=x[0],r=x[1]),typeof t=="string"&&(t=e.splitLines(t)),In(e,{from:n,to:r,text:t,origin:i})}function Jo(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function Zo(e,t,n,r){for(var i=0;i<e.length;++i){var x=e[i],N=!0;if(x.ranges){x.copied||(x=e[i]=x.deepCopy(),x.copied=!0);for(var H=0;H<x.ranges.length;H++)Jo(x.ranges[H].anchor,t,n,r),Jo(x.ranges[H].head,t,n,r);continue}for(var G=0;G<x.changes.length;++G){var V=x.changes[G];if(n<V.from.line)V.from=Fe(V.from.line+r,V.from.ch),V.to=Fe(V.to.line+r,V.to.ch);else if(t<=V.to.line){N=!1;break}}N||(e.splice(0,i+1),i=0)}}function qo(e,t){var n=t.from.line,r=t.to.line,i=t.text.length-(r-n)-1;Zo(e.done,n,r,i),Zo(e.undone,n,r,i)}function pi(e,t,n,r){var i=t,x=t;return typeof t=="number"?x=it(e,En(e,t)):i=Ct(t),i==null?null:(r(x,i)&&e.cm&&Gr(e.cm,i,n),x)}function gi(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}gi.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,at(i),zt(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 vi(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}vi.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 x=Math.min(t,i-e),N=r.height;if(r.removeInner(e,x),this.height-=N-r.height,i==x&&(this.children.splice(n--,1),r.parent=null),(t-=x)==0)break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof gi))){var H=[];this.collapse(H),this.children=[new gi(H)],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],x=i.chunkSize();if(e<=x){if(i.insertInner(e,t,n),i.lines&&i.lines.length>50){for(var N=i.lines.length%25+25,H=N;H<i.lines.length;){var G=new gi(i.lines.slice(H,H+=25));i.height-=G.height,this.children.splice(++r,0,G),G.parent=this}i.lines=i.lines.slice(0,N),this.maybeSpill()}break}e-=x}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),n=new vi(t);if(e.parent){e.size-=n.size,e.height-=n.height;var i=q(e.parent.children,e);e.parent.children.splice(i+1,0,n)}else{var r=new vi(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],x=i.chunkSize();if(e<x){var N=Math.min(t,x-e);if(i.iterN(e,N,n))return!0;if((t-=N)==0)break;e=0}else e-=x}}};var yi=function(e,t,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.doc=e,this.node=t};yi.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,r=Ct(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 x=ii(this);qt(n,Math.max(0,n.height-x)),e&&(dr(e,function(){es(e,n,-x),Gr(e,r,"widget")}),zt(e,"lineWidgetCleared",e,this,r))},yi.prototype.changed=function(){var e=this,t=this.height,n=this.doc.cm,r=this.line;this.height=null;var i=ii(this)-t;if(!i)return;Or(this.doc,r)||qt(r,r.height+i),n&&dr(n,function(){n.curOp.forceUpdate=!0,es(n,r,i),zt(n,"lineWidgetChanged",n,e,Ct(r))})},ce(yi);function es(e,t,n){Cr(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Ca(e,n)}function xl(e,t,n,r){var i=new yi(e,n,r),x=e.cm;return x&&i.noHScroll&&(x.display.alignWidgets=!0),pi(e,t,"widget",function(N){var H=N.widgets||(N.widgets=[]);if(i.insertAt==null?H.push(i):H.splice(Math.min(H.length-1,Math.max(0,i.insertAt)),0,i),i.line=N,x&&!Or(e,N)){var G=Cr(N)<e.scrollTop;qt(N,N.height+ii(i)),G&&Ca(x,i.height),x.curOp.forceUpdate=!0}return!0}),x&&zt(x,"lineWidgetAdded",x,i,typeof t=="number"?t:Ct(t)),i}var ts=0,$r=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++ts};$r.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&cn(e),de(this,"clear")){var n=this.find();n&&zt(this,"clear",n.from,n.to)}for(var r=null,i=null,x=0;x<this.lines.length;++x){var N=this.lines[x],H=wr(N.markedSpans,this);e&&!this.collapsed?Gr(e,Ct(N),"text"):e&&(H.to!=null&&(i=Ct(N)),H.from!=null&&(r=Ct(N))),N.markedSpans=Zn(N.markedSpans,H),H.from==null&&this.collapsed&&!Or(this.doc,N)&&e&&qt(N,Dn(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var G=0;G<this.lines.length;++G){var V=hr(this.lines[G]),ae=ti(V);ae>e.display.maxLineLength&&(e.display.maxLine=V,e.display.maxLineLength=ae,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&rr(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Go(e.doc)),e&&zt(e,"markerCleared",e,this,r,i),t&&fn(e),this.parent&&this.parent.clear()},$r.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var n,r,i=0;i<this.lines.length;++i){var x=this.lines[i],N=wr(x.markedSpans,this);if(N.from!=null&&(n=Fe(t?x:Ct(x),N.from),e==-1))return n;if(N.to!=null&&(r=Fe(t?x:Ct(x),N.to),e==1))return r}return n&&{from:n,to:r}},$r.prototype.changed=function(){var e=this,t=this.find(-1,!0),n=this,r=this.doc.cm;if(!t||!r)return;dr(r,function(){var i=t.line,x=Ct(t.line),N=ha(r,x);if(N&&(io(N),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!Or(n.doc,i)&&n.height!=null){var H=n.height;n.height=null;var G=ii(n)-H;G&&qt(i,i.height+G)}zt(r,"markerChanged",r,e)})},$r.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||q(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},$r.prototype.detachLine=function(e){if(this.lines.splice(q(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},ce($r);function Nn(e,t,n,r,i){if(r&&r.shared)return Tl(e,t,n,r,i);if(e.cm&&!e.cm.curOp)return Wt(e.cm,Nn)(e,t,n,r,i);var x=new $r(e,i),N=ht(t,n);if(r&&k(r,x,!1),N>0||N==0&&x.clearWhenEmpty!==!1)return x;if(x.replacedWith&&(x.collapsed=!0,x.widgetNode=b("span",[x.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||x.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(x.widgetNode.insertLeft=!0)),x.collapsed){if(Mi(e,t.line,t,n,x)||t.line!=n.line&&Mi(e,n.line,t,n,x))throw new Error("Inserting collapsed marker partially overlapping an existing one");oa()}x.addToHistory&&No(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var H=t.line,G=e.cm,V;if(e.iter(H,n.line+1,function(ue){G&&x.collapsed&&!G.options.lineWrapping&&hr(ue)==G.display.maxLine&&(V=!0),x.collapsed&&H!=t.line&&qt(ue,0),sa(ue,new en(x,H==t.line?t.ch:null,H==n.line?n.ch:null)),++H}),x.collapsed&&e.iter(t.line,n.line+1,function(ue){Or(e,ue)&&qt(ue,0)}),x.clearOnEnter&&Se(x,"beforeCursorEnter",function(){return x.clear()}),x.readOnly&&(Hr(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),x.collapsed&&(x.id=++ts,x.atomic=!0),G){if(V&&(G.curOp.updateMaxLine=!0),x.collapsed)rr(G,t.line,n.line+1);else if(x.className||x.startStyle||x.endStyle||x.css||x.attributes||x.title)for(var ae=t.line;ae<=n.line;ae++)Gr(G,ae,"text");x.atomic&&Go(G.doc),zt(G,"markerAdded",G,x)}return x}var bi=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};bi.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();zt(this,"clear")},bi.prototype.find=function(e,t){return this.primary.find(e,t)},ce(bi);function Tl(e,t,n,r,i){r=k(r),r.shared=!1;var x=[Nn(e,t,n,r,i)],N=x[0],H=r.widgetNode;return Yr(e,function(G){H&&(r.widgetNode=H.cloneNode(!0)),x.push(Nn(G,pt(G,t),pt(G,n),r,i));for(var V=0;V<G.linked.length;++V)if(G.linked[V].isParent)return;N=$(x)}),new bi(x,N)}function rs(e){return e.findMarks(Fe(e.first,0),e.clipPos(Fe(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(),x=e.clipPos(i.from),N=e.clipPos(i.to);if(ht(x,N)){var H=Nn(e,x,N,r.primary,r.primary.type);r.markers.push(H),H.parent=r}}}function wl(e){for(var t=function(r){var i=e[r],x=[i.primary.doc];Yr(i.primary.doc,function(G){return x.push(G)});for(var N=0;N<i.markers.length;N++){var H=i.markers[N];q(x,H.doc)==-1&&(H.parent=null,i.markers.splice(N--,1))}},n=0;n<e.length;n++)t(n)}var Cl=0,nr=function(e,t,n,r,i){if(!(this instanceof nr))return new nr(e,t,n,r,i);n==null&&(n=0),vi.call(this,[new gi([new nn("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var x=Fe(n,0);this.sel=Xr(x),this.history=new Xi(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)),Pa(this,{from:x,to:x,text:e}),Yt(this,Xr(x),ve)};nr.prototype=Ae(vi.prototype,{constructor:nr,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=gn(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:Ht(function(e){var t=Fe(this.first,0),n=this.first+this.size-1;In(this,{from:t,to:Fe(n,it(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&si(this.cm,0,0),Yt(this,Xr(t),ve)}),replaceRange:function(e,t,n,r){t=pt(this,t),n=n?pt(this,n):t,Un(this,e,t,n,r)},getRange:function(e,t,n){var r=Pr(this,pt(this,e),pt(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(Mr(this,e))return it(this,e)},getLineNumber:function(e){return Ct(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=it(this,e)),hr(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return pt(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:Ht(function(e,t,n){Wo(this,pt(this,typeof e=="number"?Fe(e,t||0):e),null,n)}),setSelection:Ht(function(e,t,n){Wo(this,pt(this,e),pt(this,t||e),n)}),extendSelection:Ht(function(e,t,n){Yi(this,pt(this,e),t&&pt(this,t),n)}),extendSelections:Ht(function(e,t){jo(this,He(this,e),t)}),extendSelectionsBy:Ht(function(e,t){var n=te(this.sel.ranges,e);jo(this,He(this,n),t)}),setSelections:Ht(function(e,t,n){if(!e.length)return;for(var r=[],i=0;i<e.length;i++)r[i]=new Lt(pt(this,e[i].anchor),pt(this,e[i].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),Yt(this,Lr(this.cm,r,t),n)}),addSelection:Ht(function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new Lt(pt(this,e),pt(this,t||e))),Yt(this,Lr(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=Pr(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=Pr(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:Ht(function(e,t,n){for(var r=[],i=this.sel,x=0;x<i.ranges.length;x++){var N=i.ranges[x];r[x]={from:N.from(),to:N.to(),text:this.splitLines(e[x]),origin:n}}for(var H=t&&t!="end"&&fl(this,r,t),G=r.length-1;G>=0;G--)In(this,r[G]);H?Ho(this,H):this.cm&&_n(this.cm)}),undo:Ht(function(){Ji(this,"undo")}),redo:Ht(function(){Ji(this,"redo")}),undoSelection:Ht(function(){Ji(this,"undo",!0)}),redoSelection:Ht(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 Xi(this.history.maxGeneration),Yr(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:Pn(this.history.done),undone:Pn(this.history.undone)}},setHistory:function(e){var t=this.history=new Xi(this.history.maxGeneration);t.done=Pn(e.done.slice(0),null,!0),t.undone=Pn(e.undone.slice(0),null,!0)},setGutterMarker:Ht(function(e,t,n){return pi(this,e,"gutter",function(r){var i=r.gutterMarkers||(r.gutterMarkers={});return i[t]=n,!n&&Re(i)&&(r.gutterMarkers=null),!0})}),clearGutter:Ht(function(e){var t=this;this.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&pi(t,n,"gutter",function(){return n.gutterMarkers[e]=null,Re(n.gutterMarkers)&&(n.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!Mr(this,e))return null;if(t=e,e=it(this,e),!e)return null}else if(t=Ct(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:Ht(function(e,t,n){return pi(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(y(n).test(r[i]))return!1;r[i]+=" "+n}return!0})}),removeLineClass:Ht(function(e,t,n){return pi(this,e,t=="gutter"?"gutter":"class",function(r){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",x=r[i];if(x)if(n==null)r[i]=null;else{var N=x.match(y(n));if(!N)return!1;var H=N.index+N[0].length;r[i]=x.slice(0,N.index)+(!N.index||H==x.length?"":" ")+x.slice(H)||null}else return!1;return!0})}),addLineWidget:Ht(function(e,t,n){return xl(this,e,t,n)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return Nn(this,pt(this,e),pt(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=pt(this,e),Nn(this,e,e,n,"bookmark")},findMarksAt:function(e){e=pt(this,e);var t=[],n=it(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=pt(this,e),t=pt(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,function(x){var N=x.markedSpans;if(N)for(var H=0;H<N.length;H++){var G=N[H];!(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 x=i.text.length+r;if(x>e)return t=e,!0;e-=x,++n}),pt(this,Fe(n,t))},indexFromPos:function(e){e=pt(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 nr(gn(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 nr(gn(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,rs(this)),r},unlinkDoc:function(e){if(e instanceof kt&&(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(rs(this));break}if(e.history==this.history){var r=[e.id];Yr(e,function(i){return r.push(i.id)},!0),e.history=new Xi(null),e.history.done=Pn(this.history.done,r),e.history.undone=Pn(this.history.undone,r)}},iterLinkedDocs:function(e){Yr(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):ct(e)},lineSeparator:function(){return this.lineSep||`
`},setDirection:Ht(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)})}),nr.prototype.eachLine=nr.prototype.iter;var ns=0;function Al(e){var t=this;if(is(t),Ne(t,e)||Br(t.display,e))return;Q(e),B&&(ns=+new Date);var n=sn(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,x=Array(i),N=0,H=function(){++N==i&&Wt(t,function(){n=pt(t.doc,n);var Ee={from:n,to:n,text:t.doc.splitLines(x.filter(function(Pe){return Pe!=null}).join(t.doc.lineSeparator())),origin:"paste"};In(t.doc,Ee),Ho(t.doc,Xr(pt(t.doc,n),pt(t.doc,Vr(Ee))))})()},G=function(Ee,Pe){if(t.options.allowDropFileTypes&&q(t.options.allowDropFileTypes,Ee.type)==-1){H();return}var Ue=new FileReader;Ue.onerror=function(){return H()},Ue.onload=function(){var Ke=Ue.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(Ke)){H();return}x[Pe]=Ke,H()},Ue.readAsText(Ee)},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 ae=e.dataTransfer.getData("Text");if(ae){var ue;if(t.state.draggingText&&!t.state.draggingText.copy&&(ue=t.listSelections()),$i(t.doc,Xr(n,n)),ue)for(var xe=0;xe<ue.length;++xe)Un(t.doc,"",ue[xe].anchor,ue[xe].head,"drag");t.replaceSelection(ae,"around","paste"),t.display.input.focus()}}catch(Ee){}}}function Ll(e,t){if(B&&(!e.state.draggingText||+new Date-ns<100)){se(t);return}if(Ne(e,t)||Br(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!_){var n=a("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",S&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),S&&n.parentNode.removeChild(n)}}function Dl(e,t){var n=sn(e,t);if(!n)return;var r=document.createDocumentFragment();go(e,n,r),e.display.dragCursor||(e.display.dragCursor=a("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),d(e.display.dragCursor,r)}function is(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function as(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 x=0;x<n.length;x++)e(n[x])})}var os=!1;function Ol(){if(os)return;Rl(),os=!0}function Rl(){var e;Se(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,as(_l)},100))}),Se(window,"blur",function(){return as(Rn)})}function _l(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var Qr={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"},Ei=0;Ei<10;Ei++)Qr[Ei+48]=Qr[Ei+96]=String(Ei);for(var Zi=65;Zi<=90;Zi++)Qr[Zi]=String.fromCharCode(Zi);for(var xi=1;xi<=12;xi++)Qr[xi+111]=Qr[xi+63235]="F"+xi;var jr={};jr.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"},jr.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"},jr.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"},jr.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"]},jr.default=l?jr.macDefault:jr.pcDefault;function kl(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var n,r,i,x,N=0;N<t.length-1;N++){var H=t[N];if(/^(cmd|meta|m)$/i.test(H))x=!0;else if(/^a(lt)?$/i.test(H))n=!0;else if(/^(c|ctrl|control)$/i.test(H))r=!0;else if(/^s(hift)?$/i.test(H))i=!0;else throw new Error("Unrecognized modifier name: "+H)}return n&&(e="Alt-"+e),r&&(e="Ctrl-"+e),x&&(e="Cmd-"+e),i&&(e="Shift-"+e),e}function Pl(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=te(n.split(" "),kl),x=0;x<i.length;x++){var N=void 0,H=void 0;x==i.length-1?(H=i.join(" "),N=r):(H=i.slice(0,x+1).join(" "),N="...");var G=t[H];if(!G)t[H]=N;else if(G!=N)throw new Error("Inconsistent bindings for "+H)}delete e[n]}for(var V in t)e[V]=t[V];return e}function Fn(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 Fn(e,t.fallthrough,n,r);for(var x=0;x<t.fallthrough.length;x++){var N=Fn(e,t.fallthrough[x],n,r);if(N)return N}}}function ss(e){var t=typeof e=="string"?e:Qr[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function ls(e,t,n){var r=e;return t.altKey&&r!="Alt"&&(e="Alt-"+e),(c?t.metaKey:t.ctrlKey)&&r!="Ctrl"&&(e="Ctrl-"+e),(c?t.ctrlKey:t.metaKey)&&r!="Mod"&&(e="Cmd-"+e),!n&&t.shiftKey&&r!="Shift"&&(e="Shift-"+e),e}function us(e,t){if(S&&e.keyCode==34&&e.char)return!1;var n=Qr[e.keyCode];return n==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(n=e.code),ls(n,e,t))}function qi(e){return typeof e=="string"?jr[e]:e}function Bn(e,t){for(var n=e.doc.sel.ranges,r=[],i=0;i<n.length;i++){for(var x=t(n[i]);r.length&&ht(x.from,$(r).to)<=0;){var N=r.pop();if(ht(N.from,x.from)<0){x.from=N.from;break}}r.push(x)}dr(e,function(){for(var H=r.length-1;H>=0;H--)Un(e.doc,"",r[H].from,r[H].to,"+delete");_n(e)})}function Na(e,t,n){var r=Oe(e.text,t+n,n);return r<0||r>e.text.length?null:r}function Fa(e,t,n){var r=Na(e,t.ch,n);return r==null?null:new Fe(t.line,r,n<0?"after":"before")}function Ba(e,t,n,r,i){if(e){t.doc.direction=="rtl"&&(i=-i);var x=We(n,t.doc.direction);if(x){var N=i<0?$(x):x[0],H=i<0==(N.level==1),G=H?"after":"before",V;if(N.level>0||t.doc.direction=="rtl"){var ae=Ln(t,n);V=i<0?n.text.length-1:0;var ue=_r(t,ae,V).top;V=ze(function(xe){return _r(t,ae,xe).top==ue},i<0==(N.level==1)?N.from:N.to-1,V),G=="before"&&(V=Na(n,V,1))}else V=i<0?N.to:N.from;return new Fe(r,V,G)}}return new Fe(r,i<0?n.text.length:0,i<0?"before":"after")}function Ml(e,t,n,r){var i=We(t,e.doc.direction);if(!i)return Fa(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 x=Xe(i,n.ch,n.sticky),N=i[x];if(e.doc.direction=="ltr"&&N.level%2==0&&(r>0?N.to>n.ch:N.from<n.ch))return Fa(t,n,r);var H=function($e,tt){return Na(t,$e instanceof Fe?$e.ch:$e,tt)},G,V=function($e){return e.options.lineWrapping?(G=G||Ln(e,t),fo(e,t,G,$e)):{begin:0,end:t.text.length}},ae=V(n.sticky=="before"?H(n,-1):n.ch);if(e.doc.direction=="rtl"||N.level==1){var ue=N.level==1==r<0,xe=H(n,ue?1:-1);if(xe!=null&&(ue?xe<=N.to&&xe<=ae.end:xe>=N.from&&xe>=ae.begin)){var Ee=ue?"before":"after";return new Fe(n.line,xe,Ee)}}var Pe=function($e,tt,Qe){for(var nt=function(Rt,Kt){return Kt?new Fe(n.line,H(Rt,1),"before"):new Fe(n.line,Rt,"after")};$e>=0&&$e<i.length;$e+=tt){var dt=i[$e],lt=tt>0==(dt.level!=1),vt=lt?Qe.begin:H(Qe.end,-1);if(dt.from<=vt&&vt<dt.to)return nt(vt,lt);if(vt=lt?dt.from:H(dt.to,-1),Qe.begin<=vt&&vt<Qe.end)return nt(vt,lt)}},Ue=Pe(x+r,r,ae);if(Ue)return Ue;var Ke=r>0?ae.end:H(ae.begin,-1);return Ke!=null&&!(r>0&&Ke==t.text.length)&&(Ue=Pe(r>0?0:i.length-1,r,V(Ke)),Ue)?Ue:null}var Ti={selectAll:Vo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),ve)},killLine:function(e){return Bn(e,function(t){if(t.empty()){var n=it(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line<e.lastLine()?{from:t.head,to:Fe(t.head.line+1,0)}:{from:t.head,to:Fe(t.head.line,n)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return Bn(e,function(t){return{from:Fe(t.from().line,0),to:pt(e.doc,Fe(t.to().line+1,0))}})},delLineLeft:function(e){return Bn(e,function(t){return{from:Fe(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return Bn(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 Bn(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(Fe(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(Fe(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return ds(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return cs(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")},me)},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")},me)},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/)?cs(e,t.head):r},me)},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 x=n[i].from(),N=K(e.getLine(x.line),x.ch,r);t.push(he(r-N%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return dr(e,function(){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++){if(!t[r].empty())continue;var i=t[r].head,x=it(e.doc,i.line).text;if(x){if(i.ch==x.length&&(i=new Fe(i.line,i.ch-1)),i.ch>0)i=new Fe(i.line,i.ch+1),e.replaceRange(x.charAt(i.ch-1)+x.charAt(i.ch-2),Fe(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var N=it(e.doc,i.line-1).text;N&&(i=new Fe(i.line,1),e.replaceRange(x.charAt(0)+e.doc.lineSeparator()+N.charAt(N.length-1),Fe(i.line-1,N.length-1),i,"+transpose"))}}n.push(new Lt(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){return dr(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);_n(e)})},openLine:function(e){return e.replaceSelection(`
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function ds(e,t){var n=it(e.doc,t),r=hr(n);return r!=n&&(t=Ct(r)),Ba(!0,e,r,t,1)}function Il(e,t){var n=it(e.doc,t),r=Ii(n);return r!=n&&(t=Ct(r)),Ba(!0,e,n,t,-1)}function cs(e,t){var n=ds(e,t.line),r=it(e.doc,n.line),i=We(r,e.doc.direction);if(!i||i[0].level==0){var x=Math.max(n.ch,r.text.search(/\S/)),N=t.line==n.line&&t.ch<=x&&t.ch;return Fe(n.line,N?0:x,n.sticky)}return n}function ea(e,t,n){if(typeof t=="string"&&(t=Ti[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)!=Te}finally{e.display.shift=r,e.state.suppressEdits=!1}return i}function Ul(e,t,n){for(var r=0;r<e.state.keyMaps.length;r++){var i=Fn(t,e.state.keyMaps[r],n,e);if(i)return i}return e.options.extraKeys&&Fn(t,e.options.extraKeys,n,e)||Fn(t,e.options.keyMap,n,e)}var Nl=new Y;function Si(e,t,n,r){var i=e.state.keySeq;if(i){if(ss(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())}),fs(e,i+" "+t,n,r))return!0}return fs(e,t,n,r)}function fs(e,t,n,r){var i=Ul(e,t,r);return i=="multi"&&(e.state.keySeq=t),i=="handled"&&zt(e,"keyHandled",e,t,n),(i=="handled"||i=="multi")&&(Q(n),Ta(e)),!!i}function hs(e,t){var n=us(t,!0);return n?t.shiftKey&&!e.state.keySeq?Si(e,"Shift-"+n,t,function(r){return ea(e,r,!0)})||Si(e,n,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return ea(e,r)}):Si(e,n,t,function(r){return ea(e,r)}):!1}function Fl(e,t,n){return Si(e,"'"+n+"'",t,function(r){return ea(e,r,!0)})}var ja=null;function ms(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=M(),Ne(t,e))return;B&&U<11&&e.keyCode==27&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=n==16||e.shiftKey;var r=hs(t,e);S&&(ja=r?n:null,!r&&n==88&&!wt&&(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;F(t,"CodeMirror-crosshair");function n(r){(r.keyCode==18||!r.altKey)&&(f(t,"CodeMirror-crosshair"),Je(document,"keyup",n),Je(document,"mouseover",n))}Se(document,"keyup",n),Se(document,"mouseover",n)}function ps(e){e.keyCode==16&&(this.doc.sel.shift=!1),Ne(this,e)}function gs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(Br(t.display,e)||Ne(t,e)||e.ctrlKey&&!e.altKey||l&&e.metaKey)return;var n=e.keyCode,r=e.charCode;if(S&&n==ja){ja=null,Q(e);return}if(S&&(!e.which||e.which<10)&&hs(t,e))return;var i=String.fromCharCode(r==null?n:r);if(i=="\b")return;if(Fl(t,e,i))return;t.display.input.onKeyPress(e)}var jl=400,Wa=function(e,t,n){this.time=e,this.pos=t,this.button=n};Wa.prototype.compare=function(e,t,n){return this.time+jl>e&&ht(t,this.pos)==0&&n==this.button};var wi,Ci;function Wl(e,t){var n=+new Date;return Ci&&Ci.compare(n,e,t)?(wi=Ci=null,"triple"):wi&&wi.compare(n,e,t)?(Ci=new Wa(n,e,t),wi=null,"double"):(wi=new Wa(n,e,t),Ci=null,"single")}function vs(e){var t=this,n=t.display;if(Ne(t,e)||n.activeTouch&&n.input.supportsTouch())return;if(n.input.ensurePolled(),n.shift=e.shiftKey,Br(n,e)){P||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(Ha(t,e))return;var r=sn(t,e),i=Le(e),x=r?Wl(r,i):"single";if(window.focus(),i==1&&t.state.selectingText&&t.state.selectingText(e),r&&Hl(t,i,r,x,e))return;i==1?r?Gl(t,r,x,e):fe(e)==n.scroller&&Q(e):i==2?(r&&Yi(t.doc,r),setTimeout(function(){return n.input.focus()},20)):i==3&&(A?t.display.input.onContextMenu(e):yo(t))}function Hl(e,t,n,r,i){var x="Click";return r=="double"?x="Double"+x:r=="triple"&&(x="Triple"+x),x=(t==1?"Left":t==2?"Middle":"Right")+x,Si(e,ls(x,i),i,function(N){if(typeof N=="string"&&(N=Ti[N]),!N)return!1;var H=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),H=N(e,n)!=Te}finally{e.state.suppressEdits=!1}return H})}function Kl(e,t,n){var r=e.getOption("configureMouse"),i=r?r(e,t,n):{};if(i.unit==null){var x=s?n.shiftKey&&n.metaKey:n.altKey;i.unit=x?"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){B?setTimeout(O(vo,e),0):e.curOp.focus=M();var i=Kl(e,n,r),x=e.doc.sel,N;e.options.dragDrop&&Ce&&!e.isReadOnly()&&n=="single"&&(N=x.contains(t))>-1&&(ht((N=x.ranges[N]).from(),t)<0||t.xRel>0)&&(ht(N.to(),t)>0||t.xRel<0)?zl(e,r,t,i):Xl(e,r,t,i)}function zl(e,t,n,r){var i=e.display,x=!1,N=Wt(e,function(V){P&&(i.scroller.draggable=!1),e.state.draggingText=!1,Je(i.wrapper.ownerDocument,"mouseup",N),Je(i.wrapper.ownerDocument,"mousemove",H),Je(i.scroller,"dragstart",G),Je(i.scroller,"drop",N),x||(Q(V),r.addNew||Yi(e.doc,n,null,null,r.extend),P&&!_||B&&U==9?setTimeout(function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()},20):i.input.focus())}),H=function(V){x=x||Math.abs(t.clientX-V.clientX)+Math.abs(t.clientY-V.clientY)>=10},G=function(){return x=!0};P&&(i.scroller.draggable=!0),e.state.draggingText=N,N.copy=!r.moveOnDrag,i.scroller.dragDrop&&i.scroller.dragDrop(),Se(i.wrapper.ownerDocument,"mouseup",N),Se(i.wrapper.ownerDocument,"mousemove",H),Se(i.scroller,"dragstart",G),Se(i.scroller,"drop",N),yo(e),setTimeout(function(){return i.input.focus()},20)}function ys(e,t,n){if(n=="char")return new Lt(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new Lt(Fe(t.line,0),pt(e.doc,Fe(t.line+1,0)));var r=n(e,t);return new Lt(r.from,r.to)}function Xl(e,t,n,r){var i=e.display,x=e.doc;Q(t);var N,H,G=x.sel,V=G.ranges;if(r.addNew&&!r.extend?(H=x.sel.contains(n),H>-1?N=V[H]:N=new Lt(n,n)):(N=x.sel.primary(),H=x.sel.primIndex),r.unit=="rectangle")r.addNew||(N=new Lt(n,n)),n=sn(e,t,!0,!0),H=-1;else{var ae=ys(e,n,r.unit);r.extend?N=Ia(N,ae.anchor,ae.head,r.extend):N=ae}r.addNew?H==-1?(H=V.length,Yt(x,Lr(e,V.concat([N]),H),{scroll:!1,origin:"*mouse"})):V.length>1&&V[H].empty()&&r.unit=="char"&&!r.extend?(Yt(x,Lr(e,V.slice(0,H).concat(V.slice(H+1)),0),{scroll:!1,origin:"*mouse"}),G=x.sel):Ua(x,H,N,ge):(H=0,Yt(x,new pr([N],0),ge),G=x.sel);var ue=n;function xe(Qe){if(ht(ue,Qe)==0)return;if(ue=Qe,r.unit=="rectangle"){for(var nt=[],dt=e.options.tabSize,lt=K(it(x,n.line).text,n.ch,dt),vt=K(it(x,Qe.line).text,Qe.ch,dt),Rt=Math.min(lt,vt),Kt=Math.max(lt,vt),Pt=Math.min(n.line,Qe.line),cr=Math.min(e.lastLine(),Math.max(n.line,Qe.line));Pt<=cr;Pt++){var ir=it(x,Pt).text,Nt=le(ir,Rt,dt);Rt==Kt?nt.push(new Lt(Fe(Pt,Nt),Fe(Pt,Nt))):ir.length>Nt&&nt.push(new Lt(Fe(Pt,Nt),Fe(Pt,le(ir,Kt,dt))))}nt.length||nt.push(new Lt(n,n)),Yt(x,Lr(e,G.ranges.slice(0,H).concat(nt),H),{origin:"*mouse",scroll:!1}),e.scrollIntoView(Qe)}else{var ar=N,Xt=ys(e,Qe,r.unit),jt=ar.anchor,Ft;ht(Xt.anchor,jt)>0?(Ft=Xt.head,jt=Zr(ar.from(),Xt.anchor)):(Ft=Xt.anchor,jt=bn(ar.to(),Xt.head));var It=G.ranges.slice(0);It[H]=Vl(e,new Lt(pt(x,jt),Ft)),Yt(x,Lr(e,It,H),ge)}}var Ee=i.wrapper.getBoundingClientRect(),Pe=0;function Ue(Qe){var nt=++Pe,dt=sn(e,Qe,!0,r.unit=="rectangle");if(!dt)return;if(ht(dt,ue)!=0){e.curOp.focus=M(),xe(dt);var lt=Hi(i,x);(dt.line>=lt.to||dt.line<lt.from)&&setTimeout(Wt(e,function(){Pe==nt&&Ue(Qe)}),150)}else{var vt=Qe.clientY<Ee.top?-20:Qe.clientY>Ee.bottom?20:0;vt&&setTimeout(Wt(e,function(){if(Pe!=nt)return;i.scroller.scrollTop+=vt,Ue(Qe)}),50)}}function Ke(Qe){e.state.selectingText=!1,Pe=Infinity,Qe&&(Q(Qe),i.input.focus()),Je(i.wrapper.ownerDocument,"mousemove",$e),Je(i.wrapper.ownerDocument,"mouseup",tt),x.history.lastSelOrigin=null}var $e=Wt(e,function(Qe){Qe.buttons===0||!Le(Qe)?Ke(Qe):Ue(Qe)}),tt=Wt(e,Ke);e.state.selectingText=tt,Se(i.wrapper.ownerDocument,"mousemove",$e),Se(i.wrapper.ownerDocument,"mouseup",tt)}function Vl(e,t){var n=t.anchor,r=t.head,i=it(e.doc,n.line);if(ht(n,r)==0&&n.sticky==r.sticky)return t;var x=We(i);if(!x)return t;var N=Xe(x,n.ch,n.sticky),H=x[N];if(H.from!=n.ch&&H.to!=n.ch)return t;var G=N+(H.from==n.ch==(H.level!=1)?0:1);if(G==0||G==x.length)return t;var V;if(r.line!=n.line)V=(r.line-n.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var ae=Xe(x,r.ch,r.sticky),ue=ae-N||(r.ch-n.ch)*(H.level==1?-1:1);ae==G-1||ae==G?V=ue<0:V=ue>0}var xe=x[G+(V?-1:0)],Ee=V==(xe.level==1),Pe=Ee?xe.from:xe.to,Ue=Ee?"after":"before";return n.ch==Pe&&n.sticky==Ue?t:new Lt(new Fe(n.line,Pe,Ue),r)}function bs(e,t,n,r){var i,x;if(t.touches)i=t.touches[0].clientX,x=t.touches[0].clientY;else try{i=t.clientX,x=t.clientY}catch(xe){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&Q(t);var N=e.display,H=N.lineDiv.getBoundingClientRect();if(x>H.bottom||!de(e,n))return ee(t);x-=H.top-N.viewOffset;for(var G=0;G<e.display.gutterSpecs.length;++G){var V=N.gutters.childNodes[G];if(V&&V.getBoundingClientRect().right>=i){var ae=Er(e.doc,x),ue=e.display.gutterSpecs[G];return _e(e,n,e,ae,ue.className,t),ee(t)}}}function Ha(e,t){return bs(e,t,"gutterClick",!0)}function Es(e,t){if(Br(e.display,t)||Yl(e,t))return;if(Ne(e,t,"contextmenu"))return;A||e.display.input.onContextMenu(t)}function Yl(e,t){return de(e,"gutterContextMenu")?bs(e,t,"gutterContextMenu",!1):!1}function xs(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),ai(e)}var jn={toString:function(){return"CodeMirror.Init"}},Ts={},ta={};function $l(e){var t=e.optionHandlers;function n(r,i,x,N){e.defaults[r]=i,x&&(t[r]=N?function(H,G,V){V!=jn&&x(H,G,V)}:x)}e.defineOption=n,e.Init=jn,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){hi(r),ai(r),rr(r)},!0),n("lineSeparator",null,function(r,i){if(r.doc.lineSep=i,!i)return;var x=[],N=r.doc.first;r.doc.iter(function(G){for(var V=0;;){var ae=G.text.indexOf(i,V);if(ae==-1)break;V=ae+i.length,x.push(Fe(N,ae))}N++});for(var H=x.length-1;H>=0;H--)Un(r.doc,i,x[H],Fe(x[H].line,x[H].ch+i.length))}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(r,i,x){r.state.specialChars=new RegExp(i.source+(i.test(" ")?"":"| "),"g"),x!=jn&&r.refresh()}),n("specialCharPlaceholder",Ot,function(r){return r.refresh()},!0),n("electricChars",!0),n("inputStyle",o?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),n("spellcheck",!1,function(r,i){return r.getInputField().spellcheck=i},!0),n("autocorrect",!1,function(r,i){return r.getInputField().autocorrect=i},!0),n("autocapitalize",!1,function(r,i){return r.getInputField().autocapitalize=i},!0),n("rtlMoveVisually",!w),n("wholeLineUpdateBefore",!0),n("theme","default",function(r){xs(r),fi(r)},!0),n("keyMap","default",function(r,i,x){var N=qi(i),H=x!=jn&&qi(x);H&&H.detach&&H.detach(r,N),N.attach&&N.attach(r,H||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Jl,!0),n("gutters",[],function(r,i){r.display.gutterSpecs=Ra(i,r.options.lineNumbers),fi(r)},!0),n("fixedGutter",!0,function(r,i){r.display.gutters.style.left=i?Ea(r.display)+"px":"0",r.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(r){return kn(r)},!0),n("scrollbarStyle","native",function(r){wo(r),kn(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)},!0),n("lineNumbers",!1,function(r,i){r.display.gutterSpecs=Ra(r.options.gutters,i),fi(r)},!0),n("firstLineNumber",1,fi,!0),n("lineNumberFormatter",function(r){return r},fi,!0),n("showCursorWhenSelecting",!1,oi,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,function(r,i){i=="nocursor"&&(Rn(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,oi,!0),n("singleCursorHeightPerLine",!0,oi,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,hi,!0),n("addModeClass",!1,hi,!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,hi,!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!=jn;if(!t!=!r){var i=e.display.dragFunctions,x=t?Se:Je;x(e.display.scroller,"dragstart",i.start),x(e.display.scroller,"dragenter",i.enter),x(e.display.scroller,"dragover",i.over),x(e.display.scroller,"dragleave",i.leave),x(e.display.scroller,"drop",i.drop)}}function Jl(e){e.options.lineWrapping?(F(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(f(e.display.wrapper,"CodeMirror-wrap"),Ui(e)),xa(e),rr(e),ai(e),setTimeout(function(){return kn(e)},100)}function kt(e,t){var n=this;if(!(this instanceof kt))return new kt(e,t);this.options=t=t?k(t):{},k(Ts,t,!1);var r=t.value;typeof r=="string"?r=new nr(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var i=new kt.inputStyles[t.inputStyle](this),x=this.display=new dl(e,r,i,t);x.wrapper.CodeMirror=this,xs(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),wo(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 Y,keySeq:null,specialChars:null},t.autofocus&&!o&&x.input.focus(),B&&U<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Zl(this),Ol(),cn(this),this.curOp.forceUpdate=!0,Mo(this,r),t.autofocus&&!o||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&Sa(n)},20):Rn(this);for(var N in ta)ta.hasOwnProperty(N)&&ta[N](this,t[N],jn);Lo(this),t.finishInit&&t.finishInit(this);for(var H=0;H<Ka.length;++H)Ka[H](this);fn(this),P&&t.lineWrapping&&getComputedStyle(x.lineDiv).textRendering=="optimizelegibility"&&(x.lineDiv.style.textRendering="auto")}kt.defaults=Ts,kt.optionHandlers=ta;function Zl(e){var t=e.display;Se(t.scroller,"mousedown",Wt(e,vs)),B&&U<11?Se(t.scroller,"dblclick",Wt(e,function(G){if(Ne(e,G))return;var V=sn(e,G);if(!V||Ha(e,G)||Br(e.display,G))return;Q(G);var ae=e.findWordAt(V);Yi(e.doc,ae.anchor,ae.head)})):Se(t.scroller,"dblclick",function(G){return Ne(e,G)||Q(G)}),Se(t.scroller,"contextmenu",function(G){return Es(e,G)}),Se(t.input.getField(),"contextmenu",function(G){t.scroller.contains(G.target)||Es(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 x(G){if(G.touches.length!=1)return!1;var V=G.touches[0];return V.radiusX<=1&&V.radiusY<=1}function N(G,V){if(V.left==null)return!0;var ae=V.left-G.left,ue=V.top-G.top;return ae*ae+ue*ue>20*20}Se(t.scroller,"touchstart",function(G){if(!Ne(e,G)&&!x(G)&&!Ha(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)}}),Se(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Se(t.scroller,"touchend",function(G){var V=t.activeTouch;if(V&&!Br(t,G)&&V.left!=null&&!V.moved&&new Date-V.start<300){var ae=e.coordsChar(t.activeTouch,"page"),ue;!V.prev||N(V,V.prev)?ue=new Lt(ae,ae):!V.prev.prev||N(V,V.prev.prev)?ue=e.findWordAt(ae):ue=new Lt(Fe(ae.line,0),pt(e.doc,Fe(ae.line+1,0))),e.setSelection(ue.anchor,ue.head),e.focus(),Q(G)}i()}),Se(t.scroller,"touchcancel",i),Se(t.scroller,"scroll",function(){t.scroller.clientHeight&&(li(e,t.scroller.scrollTop),un(e,t.scroller.scrollLeft,!0),_e(e,"scroll",e))}),Se(t.scroller,"mousewheel",function(G){return Ro(e,G)}),Se(t.scroller,"DOMMouseScroll",function(G){return Ro(e,G)}),Se(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(G){Ne(e,G)||se(G)},over:function(G){Ne(e,G)||(Dl(e,G),se(G))},start:function(G){return Ll(e,G)},drop:Wt(e,Al),leave:function(G){Ne(e,G)||is(e)}};var H=t.input.getField();Se(H,"keyup",function(G){return ps.call(e,G)}),Se(H,"keydown",Wt(e,ms)),Se(H,"keypress",Wt(e,gs)),Se(H,"focus",function(G){return Sa(e,G)}),Se(H,"blur",function(G){return Rn(e,G)})}var Ka=[];kt.defineInitHook=function(e){return Ka.push(e)};function Ai(e,t,n,r){var i=e.doc,x;n==null&&(n="add"),n=="smart"&&(i.mode.indent?x=xr(e,t).state:n="prev");var N=e.options.tabSize,H=it(i,t),G=K(H.text,null,N);H.stateAfter&&(H.stateAfter=null);var V=H.text.match(/^\s*/)[0],ae;if(!r&&!/\S/.test(H.text))ae=0,n="not";else if(n=="smart"&&(ae=i.mode.indent(x,H.text.slice(V.length),H.text),ae==Te||ae>150)){if(!r)return;n="prev"}n=="prev"?t>i.first?ae=K(it(i,t-1).text,null,N):ae=0:n=="add"?ae=G+e.options.indentUnit:n=="subtract"?ae=G-e.options.indentUnit:typeof n=="number"&&(ae=G+n),ae=Math.max(0,ae);var ue="",xe=0;if(e.options.indentWithTabs)for(var Ee=Math.floor(ae/N);Ee;--Ee)xe+=N,ue+=" ";if(xe<ae&&(ue+=he(ae-xe)),ue!=V)return Un(i,ue,Fe(t,0),Fe(t,V.length),"+input"),H.stateAfter=null,!0;for(var Pe=0;Pe<i.sel.ranges.length;Pe++){var Ue=i.sel.ranges[Pe];if(Ue.head.line==t&&Ue.head.ch<V.length){var Ke=Fe(t,V.length);Ua(i,Pe,new Lt(Ke,Ke));break}}}var Dr=null;function ra(e){Dr=e}function Ga(e,t,n,r,i){var x=e.doc;e.display.shift=!1,r||(r=x.sel);var N=+new Date-200,H=i=="paste"||e.state.pasteIncoming>N,G=ct(t),V=null;if(H&&r.ranges.length>1)if(Dr&&Dr.text.join(`
`)==t){if(r.ranges.length%Dr.text.length==0){V=[];for(var ae=0;ae<Dr.text.length;ae++)V.push(x.splitLines(Dr.text[ae]))}}else G.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(V=te(G,function($e){return[$e]}));for(var ue=e.curOp.updateInput,xe=r.ranges.length-1;xe>=0;xe--){var Ee=r.ranges[xe],Pe=Ee.from(),Ue=Ee.to();Ee.empty()&&(n&&n>0?Pe=Fe(Pe.line,Pe.ch-n):e.state.overwrite&&!H?Ue=Fe(Ue.line,Math.min(it(x,Ue.line).text.length,Ue.ch+$(G).length)):H&&Dr&&Dr.lineWise&&Dr.text.join(`
`)==G.join(`
`)&&(Pe=Ue=Fe(Pe.line,0)));var Ke={from:Pe,to:Ue,text:V?V[xe%V.length]:G,origin:i||(H?"paste":e.state.cutIncoming>N?"cut":"+input")};In(e.doc,Ke),zt(e,"inputRead",e,Ke)}t&&!H&&ws(e,t),_n(e),e.curOp.updateInput<2&&(e.curOp.updateInput=ue),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Ss(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&dr(t,function(){return Ga(t,n,0,null,"paste")}),!0}function ws(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 x=e.getModeAt(i.head),N=!1;if(x.electricChars){for(var H=0;H<x.electricChars.length;H++)if(t.indexOf(x.electricChars.charAt(H))>-1){N=Ai(e,i.head.line,"smart");break}}else x.electricInput&&(x.electricInput.test(it(e.doc,i.head.line).text.slice(0,i.head.ch))&&(N=Ai(e,i.head.line,"smart")));N&&zt(e,"electricInput",e,i.head.line)}}function Cs(e){for(var t=[],n=[],r=0;r<e.doc.sel.ranges.length;r++){var i=e.doc.sel.ranges[r].head.line,x={anchor:Fe(i,0),head:Fe(i+1,0)};n.push(x),t.push(e.getRange(x.anchor,x.head))}return{text:t,ranges:n}}function As(e,t,n,r){e.setAttribute("autocorrect",n?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function Ls(){var e=a("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=a("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return P?e.style.width="1000px":e.setAttribute("wrap","off"),m&&(e.style.border="1px solid black"),As(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 x=this.options,N=x[r];if(x[r]==i&&r!="mode")return;x[r]=i,t.hasOwnProperty(r)&&Wt(this,t[r])(this,i,N),_e(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,x=0;x<i.length;++x)if(i[x]==r||i[x].name==r)return i.splice(x,1),!0},addOverlay:Jt(function(r,i){var x=r.token?r:e.getMode(this.options,r);if(x.startState)throw new Error("Overlays may not be stateful.");Z(this.state.overlays,{mode:x,modeSpec:r,opaque:i&&i.opaque,priority:i&&i.priority||0},function(N){return N.priority}),this.state.modeGen++,rr(this)}),removeOverlay:Jt(function(r){for(var i=this.state.overlays,x=0;x<i.length;++x){var N=i[x].modeSpec;if(N==r||typeof r=="string"&&N.name==r){i.splice(x,1),this.state.modeGen++,rr(this);return}}}),indentLine:Jt(function(r,i,x){typeof i!="string"&&typeof i!="number"&&(i==null?i=this.options.smartIndent?"smart":"prev":i=i?"add":"subtract"),Mr(this.doc,r)&&Ai(this,r,i,x)}),indentSelection:Jt(function(r){for(var i=this.doc.sel.ranges,x=-1,N=0;N<i.length;N++){var H=i[N];if(H.empty())H.head.line>x&&(Ai(this,H.head.line,r,!0),x=H.head.line,N==this.doc.sel.primIndex&&_n(this));else{var G=H.from(),V=H.to(),ae=Math.max(x,G.line);x=Math.min(this.lastLine(),V.line-(V.ch?0:1))+1;for(var ue=ae;ue<x;++ue)Ai(this,ue,r);var xe=this.doc.sel.ranges;G.ch==0&&i.length==xe.length&&xe[N].from().ch>0&&Ua(this.doc,N,new Lt(G,xe[N].to()),ve)}}}),getTokenAt:function(r,i){return Di(this,r,i)},getLineTokens:function(r,i){return Di(this,Fe(r),i,!0)},getTokenTypeAt:function(r){r=pt(this.doc,r);var i=qr(this,it(this.doc,r.line)),x=0,N=(i.length-1)/2,H=r.ch,G;if(H==0)G=i[2];else for(;;){var V=x+N>>1;if((V?i[V*2-1]:0)>=H)N=V;else if(i[V*2+1]<H)x=V+1;else{G=i[V*2+2];break}}var ae=G?G.indexOf("overlay "):-1;return ae<0?G:ae==0?null:G.slice(0,ae-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 x=[];if(!n.hasOwnProperty(i))return x;var N=n[i],H=this.getModeAt(r);if(typeof H[i]=="string")N[H[i]]&&x.push(N[H[i]]);else if(H[i])for(var G=0;G<H[i].length;G++){var V=N[H[i][G]];V&&x.push(V)}else H.helperType&&N[H.helperType]?x.push(N[H.helperType]):N[H.name]&&x.push(N[H.name]);for(var ae=0;ae<N._global.length;ae++){var ue=N._global[ae];ue.pred(H,this)&&q(x,ue.val)==-1&&x.push(ue.val)}return x},getStateAfter:function(r,i){var x=this.doc;return r=En(x,r==null?x.first+x.size-1:r),xr(this,r+1,i).state},cursorCoords:function(r,i){var x,N=this.doc.sel.primary();return r==null?x=N.head:typeof r=="object"?x=pt(this.doc,r):x=r?N.from():N.to(),Ar(this,x,i||"page")},charCoords:function(r,i){return pa(this,pt(this.doc,r),i||"page")},coordsChar:function(r,i){return r=lo(this,r,i||"page"),va(this,r.left,r.top)},lineAtHeight:function(r,i){return r=lo(this,{top:r,left:0},i||"page").top,Er(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,i,x){var N=!1,H;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,N=!0),H=it(this.doc,r)}else H=r;return Fi(this,H,{top:0,left:0},i||"page",x||N).top+(N?this.doc.height-Cr(H):0)},defaultTextHeight:function(){return Dn(this.display)},defaultCharWidth:function(){return On(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,i,x,N,H){var G=this.display;r=Ar(this,pt(this.doc,r));var V=r.bottom,ae=r.left;if(i.style.position="absolute",i.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(i),G.sizer.appendChild(i),N=="over")V=r.top;else if(N=="above"||N=="near"){var ue=Math.max(G.wrapper.clientHeight,this.doc.height),xe=Math.max(G.sizer.clientWidth,G.lineSpace.clientWidth);(N=="above"||r.bottom+i.offsetHeight>ue)&&r.top>i.offsetHeight?V=r.top-i.offsetHeight:r.bottom+i.offsetHeight<=ue&&(V=r.bottom),ae+i.offsetWidth>xe&&(ae=xe-i.offsetWidth)}i.style.top=V+"px",i.style.left=i.style.right="",H=="right"?(ae=G.sizer.clientWidth-i.offsetWidth,i.style.right="0px"):(H=="left"?ae=0:H=="middle"&&(ae=(G.sizer.clientWidth-i.offsetWidth)/2),i.style.left=ae+"px"),x&&Qs(this,{left:ae,top:V,right:ae+i.offsetWidth,bottom:V+i.offsetHeight})},triggerOnKeyDown:Jt(ms),triggerOnKeyPress:Jt(gs),triggerOnKeyUp:ps,triggerOnMouseDown:Jt(vs),execCommand:function(r){if(Ti.hasOwnProperty(r))return Ti[r].call(null,this)},triggerElectric:Jt(function(r){ws(this,r)}),findPosH:function(r,i,x,N){var H=1;i<0&&(H=-1,i=-i);for(var G=pt(this.doc,r),V=0;V<i&&!(G=za(this.doc,G,H,x,N),G.hitSide);++V);return G},moveH:Jt(function(r,i){var x=this;this.extendSelectionsBy(function(N){return x.display.shift||x.doc.extend||N.empty()?za(x.doc,N.head,r,i,x.options.rtlMoveVisually):r<0?N.from():N.to()},me)}),deleteH:Jt(function(r,i){var x=this.doc.sel,N=this.doc;x.somethingSelected()?N.replaceSelection("",null,"+delete"):Bn(this,function(H){var G=za(N,H.head,r,i,!1);return r<0?{from:G,to:H.head}:{from:H.head,to:G}})}),findPosV:function(r,i,x,N){var H=1,G=N;i<0&&(H=-1,i=-i);for(var V=pt(this.doc,r),ae=0;ae<i;++ae){var ue=Ar(this,V,"div");if(G==null?G=ue.left:ue.left=G,V=Ds(this,ue,H,x),V.hitSide)break}return V},moveV:Jt(function(r,i){var x=this,N=this.doc,H=[],G=!this.display.shift&&!N.extend&&N.sel.somethingSelected();if(N.extendSelectionsBy(function(ae){if(G)return r<0?ae.from():ae.to();var ue=Ar(x,ae.head,"div");ae.goalColumn!=null&&(ue.left=ae.goalColumn),H.push(ue.left);var xe=Ds(x,ue,r,i);return i=="page"&&ae==N.sel.primary()&&Ca(x,pa(x,xe,"div").top-ue.top),xe},me),H.length)for(var V=0;V<N.sel.ranges.length;V++)N.sel.ranges[V].goalColumn=H[V]}),findWordAt:function(r){var i=this.doc,x=it(i,r.line).text,N=r.ch,H=r.ch;if(x){var G=this.getHelper(r,"wordChars");(r.sticky=="before"||H==x.length)&&N?--N:++H;for(var V=x.charAt(N),ae=De(V,G)?function(ue){return De(ue,G)}:/\s/.test(V)?function(ue){return/\s/.test(ue)}:function(ue){return!/\s/.test(ue)&&!De(ue)};N>0&&ae(x.charAt(N-1));)--N;for(;H<x.length&&ae(x.charAt(H));)++H}return new Lt(Fe(r.line,N),Fe(r.line,H))},toggleOverwrite:function(r){if(r!=null&&r==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?F(this.display.cursorDiv,"CodeMirror-overwrite"):f(this.display.cursorDiv,"CodeMirror-overwrite"),_e(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==M()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:Jt(function(r,i){si(this,r,i)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-Rr(this)-this.display.barHeight,width:r.scrollWidth-Rr(this)-this.display.barWidth,clientHeight:fa(this),clientWidth:an(this)}},scrollIntoView:Jt(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:Fe(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):Eo(this,r.from,r.to,r.margin)}),setSize:Jt(function(r,i){var x=this,N=function(G){return typeof G=="number"||/^\d+$/.test(String(G))?G+"px":G};r!=null&&(this.display.wrapper.style.width=N(r)),i!=null&&(this.display.wrapper.style.height=N(i)),this.options.lineWrapping&&ao(this);var H=this.display.viewFrom;this.doc.iter(H,this.display.viewTo,function(G){if(G.widgets){for(var V=0;V<G.widgets.length;V++)if(G.widgets[V].noHScroll){Gr(x,H,"widget");break}}++H}),this.curOp.forceUpdate=!0,_e(this,"refresh",this)}),operation:function(r){return dr(this,r)},startOperation:function(){return cn(this)},endOperation:function(){return fn(this)},refresh:Jt(function(){var r=this.display.cachedTextHeight;rr(this),this.curOp.forceUpdate=!0,ai(this),si(this,this.doc.scrollLeft,this.doc.scrollTop),Da(this.display),(r==null||Math.abs(r-Dn(this.display))>.5||this.options.lineWrapping)&&xa(this),_e(this,"refresh",this)}),swapDoc:Jt(function(r){var i=this.doc;return i.cm=null,this.state.selectingText&&this.state.selectingText(),Mo(this,r),ai(this),this.display.input.reset(),si(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,zt(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}},ce(e),e.registerHelper=function(r,i,x){n.hasOwnProperty(r)||(n[r]=e[r]={_global:[]}),n[r][i]=x},e.registerGlobalHelper=function(r,i,x,N){e.registerHelper(r,i,N),n[r]._global.push({pred:x,val:N})}}function za(e,t,n,r,i){var x=t,N=n,H=it(e,t.line),G=i&&e.direction=="rtl"?-n:n;function V(){var tt=t.line+G;return tt<e.first||tt>=e.first+e.size?!1:(t=new Fe(tt,t.ch,t.sticky),H=it(e,tt))}function ae(tt){var Qe;if(r=="codepoint"){var nt=H.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(nt)?Qe=null:Qe=new Fe(t.line,Math.max(0,Math.min(H.text.length,t.ch+n*(nt>=55296&&nt<56320?2:1))),-n)}else i?Qe=Ml(e.cm,H,t,n):Qe=Fa(H,t,n);if(Qe==null)if(!tt&&V())t=Ba(i,e.cm,H,t.line,G);else return!1;else t=Qe;return!0}if(r=="char"||r=="codepoint")ae();else if(r=="column")ae(!0);else if(r=="word"||r=="group")for(var ue=null,xe=r=="group",Ee=e.cm&&e.cm.getHelper(t,"wordChars"),Pe=!0;!(n<0&&!ae(!Pe));Pe=!1){var Ue=H.text.charAt(t.ch)||`
`,Ke=De(Ue,Ee)?"w":xe&&Ue==`
`?"n":!xe||/\s/.test(Ue)?null:"p";if(xe&&!Pe&&!Ke&&(Ke="s"),ue&&ue!=Ke){n<0&&(n=1,ae(),t.sticky="after");break}if(Ke&&(ue=Ke),n>0&&!ae(!Pe))break}var $e=Qi(e,t,x,N,!0);return zn(x,$e)&&($e.hitSide=!0),$e}function Ds(e,t,n,r){var i=e.doc,x=t.left,N;if(r=="page"){var H=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),G=Math.max(H-.5*Dn(e.display),3);N=(n>0?t.bottom:t.top)+n*G}else r=="line"&&(N=n>0?t.bottom+3:t.top-3);for(var V;!(V=va(e,x,N),!V.outside);){if(n<0?N<=0:N>=i.height){V.hitSide=!0;break}N+=n*5}return V}var Dt=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new Y,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Dt.prototype.init=function(e){var t=this,n=this,r=n.cm,i=n.div=e.lineDiv;As(i,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function x(H){for(var G=H.target;G;G=G.parentNode){if(G==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(G.className))break}return!1}Se(i,"paste",function(H){if(!x(H)||Ne(r,H)||Ss(H,r))return;U<=11&&setTimeout(Wt(r,function(){return t.updateFromDOM()}),20)}),Se(i,"compositionstart",function(H){t.composing={data:H.data,done:!1}}),Se(i,"compositionupdate",function(H){t.composing||(t.composing={data:H.data,done:!1})}),Se(i,"compositionend",function(H){t.composing&&(H.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Se(i,"touchstart",function(){return n.forceCompositionEnd()}),Se(i,"input",function(){t.composing||t.readFromDOMSoon()});function N(H){if(!x(H)||Ne(r,H))return;if(r.somethingSelected())ra({lineWise:!1,text:r.getSelections()}),H.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var G=Cs(r);ra({lineWise:!0,text:G.text}),H.type=="cut"&&r.operation(function(){r.setSelections(G.ranges,0,ve),r.replaceSelection("",null,"cut")})}else return;if(H.clipboardData){H.clipboardData.clearData();var V=Dr.text.join(`
`);if(H.clipboardData.setData("Text",V),H.clipboardData.getData("Text")==V){H.preventDefault();return}}var ae=Ls(),ue=ae.firstChild;r.display.lineSpace.insertBefore(ae,r.display.lineSpace.firstChild),ue.value=Dr.text.join(`
`);var xe=document.activeElement;W(ue),setTimeout(function(){r.display.lineSpace.removeChild(ae),xe.focus(),xe==i&&n.showPrimarySelection()},50)}Se(i,"copy",N),Se(i,"cut",N)},Dt.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Dt.prototype.prepareSelection=function(){var e=po(this.cm,!1);return e.focus=document.activeElement==this.div,e},Dt.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},Dt.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Dt.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 x=na(t,e.anchorNode,e.anchorOffset),N=na(t,e.focusNode,e.focusOffset);if(x&&!x.bad&&N&&!N.bad&&ht(Zr(x,N),r)==0&&ht(bn(x,N),i)==0)return;var H=t.display.view,G=r.line>=t.display.viewFrom&&Os(t,r)||{node:H[0].measure.map[2],offset:0},V=i.line<t.display.viewTo&&Os(t,i);if(!V){var ae=H[H.length-1].measure,ue=ae.maps?ae.maps[ae.maps.length-1]:ae.map;V={node:ue[ue.length-1],offset:ue[ue.length-2]-ue[ue.length-3]}}if(!G||!V){e.removeAllRanges();return}var xe=e.rangeCount&&e.getRangeAt(0),Ee;try{Ee=g(G.node,G.offset,V.offset,V.node)}catch(Pe){}Ee&&(!L&&t.state.focused?(e.collapse(G.node,G.offset),Ee.collapsed||(e.removeAllRanges(),e.addRange(Ee))):(e.removeAllRanges(),e.addRange(Ee)),xe&&e.anchorNode==null?e.addRange(xe):L&&this.startGracePeriod()),this.rememberSelection()},Dt.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)},Dt.prototype.showMultipleSelections=function(e){d(this.cm.display.cursorDiv,e.cursors),d(this.cm.display.selectionDiv,e.selection)},Dt.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},Dt.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return E(this.div,t)},Dt.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},Dt.prototype.blur=function(){this.div.blur()},Dt.prototype.getField=function(){return this.div},Dt.prototype.supportsTouch=function(){return!0},Dt.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():dr(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)},Dt.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},Dt.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(u&&v&&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&&dr(t,function(){Yt(t.doc,Xr(n,r),ve),(n.bad||r.bad)&&(t.curOp.selectionChanged=!0)})},Dt.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=Fe(r.line-1,it(e.doc,r.line-1).length)),i.ch==it(e.doc,i.line).text.length&&i.line<e.lastLine()&&(i=Fe(i.line+1,0)),r.line<t.viewFrom||i.line>t.viewTo-1)return!1;var x,N,H;r.line==t.viewFrom||(x=ln(e,r.line))==0?(N=Ct(t.view[0].line),H=t.view[0].node):(N=Ct(t.view[x].line),H=t.view[x-1].node.nextSibling);var G=ln(e,i.line),V,ae;if(G==t.view.length-1?(V=t.viewTo-1,ae=t.lineDiv.lastChild):(V=Ct(t.view[G+1].line)-1,ae=t.view[G+1].node.previousSibling),!H)return!1;for(var ue=e.doc.splitLines(tu(e,H,ae,N,V)),xe=Pr(e.doc,Fe(N,0),Fe(V,it(e.doc,V).text.length));ue.length>1&&xe.length>1;)if($(ue)==$(xe))ue.pop(),xe.pop(),V--;else if(ue[0]==xe[0])ue.shift(),xe.shift(),N++;else break;for(var Ee=0,Pe=0,Ue=ue[0],Ke=xe[0],$e=Math.min(Ue.length,Ke.length);Ee<$e&&Ue.charCodeAt(Ee)==Ke.charCodeAt(Ee);)++Ee;for(var tt=$(ue),Qe=$(xe),nt=Math.min(tt.length-(ue.length==1?Ee:0),Qe.length-(xe.length==1?Ee:0));Pe<nt&&tt.charCodeAt(tt.length-Pe-1)==Qe.charCodeAt(Qe.length-Pe-1);)++Pe;if(ue.length==1&&xe.length==1&&N==r.line)for(;Ee&&Ee>r.ch&&tt.charCodeAt(tt.length-Pe-1)==Qe.charCodeAt(Qe.length-Pe-1);)Ee--,Pe++;ue[ue.length-1]=tt.slice(0,tt.length-Pe).replace(/^\u200b+/,""),ue[0]=ue[0].slice(Ee).replace(/\u200b+$/,"");var dt=Fe(N,Ee),lt=Fe(V,xe.length?$(xe).length-Pe:0);if(ue.length>1||ue[0]||ht(dt,lt))return Un(e.doc,ue,dt,lt,"+input"),!0},Dt.prototype.ensurePolled=function(){this.forceCompositionEnd()},Dt.prototype.reset=function(){this.forceCompositionEnd()},Dt.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},Dt.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)},Dt.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&dr(this.cm,function(){return rr(e.cm)})},Dt.prototype.setUneditable=function(e){e.contentEditable="false"},Dt.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||Wt(this.cm,Ga)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},Dt.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},Dt.prototype.onContextMenu=function(){},Dt.prototype.resetPosition=function(){},Dt.prototype.needsContentAttribute=!0;function Os(e,t){var n=ha(e,t.line);if(!n||n.hidden)return null;var r=it(e.doc,t.line),i=eo(n,r,t.line),x=We(r,e.doc.direction),N="left";if(x){var H=Xe(x,t.ch);N=H%2?"right":"left"}var G=no(i.map,t.ch,N);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 Wn(e,t){return t&&(e.bad=!0),e}function tu(e,t,n,r,i){var x="",N=!1,H=e.doc.lineSeparator(),G=!1;function V(Ee){return function(Pe){return Pe.id==Ee}}function ae(){N&&(x+=H,G&&(x+=H),N=G=!1)}function ue(Ee){Ee&&(ae(),x+=Ee)}function xe(Ee){if(Ee.nodeType==1){var Pe=Ee.getAttribute("cm-text");if(Pe){ue(Pe);return}var Ue=Ee.getAttribute("cm-marker"),Ke;if(Ue){var $e=e.findMarks(Fe(r,0),Fe(i+1,0),V(+Ue));$e.length&&(Ke=$e[0].find(0))&&ue(Pr(e.doc,Ke.from,Ke.to).join(H));return}if(Ee.getAttribute("contenteditable")=="false")return;var tt=/^(pre|div|p|li|table|br)$/i.test(Ee.nodeName);if(!/^br$/i.test(Ee.nodeName)&&Ee.textContent.length==0)return;tt&&ae();for(var Qe=0;Qe<Ee.childNodes.length;Qe++)xe(Ee.childNodes[Qe]);/^(pre|p)$/i.test(Ee.nodeName)&&(G=!0),tt&&(N=!0)}else Ee.nodeType==3&&ue(Ee.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(xe(t),t==n);)t=t.nextSibling,G=!1;return x}function na(e,t,n){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[n],!r)return Wn(e.clipPos(Fe(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 x=e.display.view[i];if(x.node==r)return ru(x,t,n)}}function ru(e,t,n){var r=e.text.firstChild,i=!1;if(!t||!E(r,t))return Wn(Fe(Ct(e.line),0),!0);if(t==r&&(i=!0,t=r.childNodes[n],n=0,!t)){var x=e.rest?$(e.rest):e.line;return Wn(Fe(Ct(x),x.text.length),i)}var N=t.nodeType==3?t:null,H=t;for(!N&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(N=t.firstChild,n&&(n=N.nodeValue.length));H.parentNode!=r;)H=H.parentNode;var G=e.measure,V=G.maps;function ae(Ke,$e,tt){for(var Qe=-1;Qe<(V?V.length:0);Qe++)for(var nt=Qe<0?G.map:V[Qe],dt=0;dt<nt.length;dt+=3){var lt=nt[dt+2];if(lt==Ke||lt==$e){var vt=Ct(Qe<0?e.line:e.rest[Qe]),Rt=nt[dt]+tt;return(tt<0||lt!=Ke)&&(Rt=nt[dt+(tt?1:0)]),Fe(vt,Rt)}}}var ue=ae(N,H,n);if(ue)return Wn(ue,i);for(var xe=H.nextSibling,Ee=N?N.nodeValue.length-n:0;xe;xe=xe.nextSibling){if(ue=ae(xe,xe.firstChild,0),ue)return Wn(Fe(ue.line,ue.ch-Ee),i);Ee+=xe.textContent.length}for(var Pe=H.previousSibling,Ue=n;Pe;Pe=Pe.previousSibling){if(ue=ae(Pe,Pe.firstChild,-1),ue)return Wn(Fe(ue.line,ue.ch+Ue),i);Ue+=Pe.textContent.length}}var Ut=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new Y,this.hasSelection=!1,this.composing=null};Ut.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),m&&(i.style.width="0px"),Se(i,"input",function(){B&&U>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),Se(i,"paste",function(N){if(Ne(r,N)||Ss(N,r))return;r.state.pasteIncoming=+new Date,n.fastPoll()});function x(N){if(Ne(r,N))return;if(r.somethingSelected())ra({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var H=Cs(r);ra({lineWise:!0,text:H.text}),N.type=="cut"?r.setSelections(H.ranges,null,ve):(n.prevInput="",i.value=H.text.join(`
`),W(i))}else return;N.type=="cut"&&(r.state.cutIncoming=+new Date)}Se(i,"cut",x),Se(i,"copy",x),Se(e.scroller,"paste",function(N){if(Br(e,N)||Ne(r,N))return;if(!i.dispatchEvent){r.state.pasteIncoming=+new Date,n.focus();return}var H=new Event("paste");H.clipboardData=N.clipboardData,i.dispatchEvent(H)}),Se(e.lineSpace,"selectstart",function(N){Br(e,N)||Q(N)}),Se(i,"compositionstart",function(){var N=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:N,range:r.markText(N,r.getCursor("to"),{className:"CodeMirror-composing"})}}),Se(i,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},Ut.prototype.createField=function(e){this.wrapper=Ls(),this.textarea=this.wrapper.firstChild},Ut.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},Ut.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=po(e);if(e.options.moveInputWithCursor){var i=Ar(e,n.sel.primary().head,"div"),x=t.wrapper.getBoundingClientRect(),N=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+N.top-x.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+N.left-x.left))}return r},Ut.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")},Ut.prototype.reset=function(e){if(this.contextMenuPending||this.composing)return;var t=this.cm;if(t.somethingSelected()){this.prevInput="";var n=t.getSelection();this.textarea.value=n,t.state.focused&&W(this.textarea),B&&U>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",B&&U>=9&&(this.hasSelection=null))},Ut.prototype.getField=function(){return this.textarea},Ut.prototype.supportsTouch=function(){return!1},Ut.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!o||M()!=this.textarea))try{this.textarea.focus()}catch(e){}},Ut.prototype.blur=function(){this.textarea.blur()},Ut.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Ut.prototype.receivedFocus=function(){this.slowPoll()},Ut.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()})},Ut.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)},Ut.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||st(n)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=n.value;if(i==r&&!t.somethingSelected())return!1;if(B&&U>=9&&this.hasSelection===i||l&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var x=i.charCodeAt(0);if(x==8203&&!r&&(r="\u200B"),x==8666)return this.reset(),this.cm.execCommand("undo")}for(var N=0,H=Math.min(r.length,i.length);N<H&&r.charCodeAt(N)==i.charCodeAt(N);)++N;return dr(t,function(){Ga(t,i.slice(N),r.length-N,null,e.composing?"*compose":null),i.length>1e3||i.indexOf(`
`)>-1?n.value=e.prevInput="":e.prevInput=i,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},Ut.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Ut.prototype.onKeyPress=function(){B&&U>=9&&(this.hasSelection=null),this.fastPoll()},Ut.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var x=sn(n,e),N=r.scroller.scrollTop;if(!x||S)return;var H=n.options.resetSelectionOnContextMenu;H&&n.doc.sel.contains(x)==-1&&Wt(n,Yt)(n.doc,Xr(x),ve);var G=i.style.cssText,V=t.wrapper.style.cssText,ae=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",i.style.cssText=`position: absolute; width: 30px; height: 30px;
top: `+(e.clientY-ae.top-5)+"px; left: "+(e.clientX-ae.left-5)+`px;
z-index: 1000; background: `+(B?"rgba(255, 255, 255, .05)":"transparent")+`;
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var ue;P&&(ue=window.scrollY),r.input.focus(),P&&window.scrollTo(null,ue),r.input.reset(),n.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=Ee,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll);function xe(){if(i.selectionStart!=null){var Ue=n.somethingSelected(),Ke="\u200B"+(Ue?i.value:"");i.value="\u21DA",i.value=Ke,t.prevInput=Ue?"":"\u200B",i.selectionStart=1,i.selectionEnd=Ke.length,r.selForContextMenu=n.doc.sel}}function Ee(){if(t.contextMenuPending!=Ee)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=V,i.style.cssText=G,B&&U<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=N),i.selectionStart!=null){(!B||B&&U<9)&&xe();var Ue=0,Ke=function(){r.selForContextMenu==n.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&t.prevInput=="\u200B"?Wt(n,Vo)(n):Ue++<10?r.detectingSelectAll=setTimeout(Ke,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(Ke,200)}}if(B&&U>=9&&xe(),A){se(e);var Pe=function(){Je(window,"mouseup",Pe),setTimeout(Ee,20)};Se(window,"mouseup",Pe)}else setTimeout(Ee,50)},Ut.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},Ut.prototype.setUneditable=function(){},Ut.prototype.needsContentAttribute=!1;function nu(e,t){if(t=t?k(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),t.autofocus==null){var n=M();t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function r(){e.value=H.getValue()}var i;if(e.form&&(Se(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var x=e.form;i=x.submit;try{var N=x.submit=function(){r(),x.submit=i,x.submit(),x.submit=N}}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&&(Je(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=i))}},e.style.display="none";var H=kt(function(G){return e.parentNode.insertBefore(G,e.nextSibling)},t);return H}function iu(e){e.off=Je,e.on=Se,e.wheelEventPixels=cl,e.Doc=nr,e.splitLines=ct,e.countColumn=K,e.findColumn=le,e.isWordChar=we,e.Pass=Te,e.signal=_e,e.Line=nn,e.changeEnd=Vr,e.scrollbarModel=So,e.Pos=Fe,e.cmpPos=ht,e.modes=xt,e.mimeModes=Ye,e.resolveMode=lr,e.getMode=_t,e.modeExtensions=ur,e.extendMode=pn,e.copyState=yr,e.startState=Gn,e.innerMode=br,e.commands=Ti,e.keyMap=jr,e.keyName=us,e.isModifierKey=ss,e.lookupKey=Fn,e.normalizeKeyMap=Pl,e.StringStream=Mt,e.SharedTextMarker=bi,e.TextMarker=$r,e.LineWidget=yi,e.e_preventDefault=Q,e.e_stopPropagation=J,e.e_stop=se,e.addClass=F,e.contains=E,e.rmClass=f,e.keyNames=Qr}$l(kt),ql(kt);var au="iter insert remove copy getEditor constructor".split(" ");for(var ia in nr.prototype)nr.prototype.hasOwnProperty(ia)&&q(au,ia)<0&&(kt.prototype[ia]=function(e){return function(){return e.apply(this.doc,arguments)}}(nr.prototype[ia]));return ce(nr),kt.inputStyles={textarea:Ut,contenteditable:Dt},kt.defineMode=function(e){!kt.defaults.mode&&e!="null"&&(kt.defaults.mode=e),fr.apply(this,arguments)},kt.defineMIME=sr,kt.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),kt.defineMIME("text/plain","null"),kt.defineExtension=function(e,t){kt.prototype[e]=t},kt.defineDocExtension=function(e,t){nr.prototype[e]=t},kt.fromTextArea=nu,iu(kt),kt.version="5.58.2",kt})},Y1PL:function(ft,rt,ne){"use strict";ne.r(rt),ne.d(rt,"ResizableTextArea",function(){return q});var re=ne("wx14"),X=ne("1OyB"),L=ne("vuIU"),z=ne("Ji7U"),I=ne("LK+K"),R=ne("cDcd"),B=ne("VTBJ"),U=ne("rePB"),P=ne("Zm9Q"),D=ne("Kwbf"),v=ne("c+Xe"),S=ne("m+aA"),_=ne("bdgK"),C=new Map;function T(ve){ve.forEach(function(ge){var me,le=ge.target;(me=C.get(le))===null||me===void 0||me.forEach(function(ie){return ie(le)})})}var m=new _.default(T),u=null,o=null;function l(ve,ge){C.has(ve)||(C.set(ve,new Set),m.observe(ve)),C.get(ve).add(ge)}function s(ve,ge){C.has(ve)&&(C.get(ve).delete(ge),C.get(ve).size||(m.unobserve(ve),C.delete(ve)))}var w=function(ve){Object(z.a)(me,ve);var ge=Object(I.a)(me);function me(){return Object(X.a)(this,me),ge.apply(this,arguments)}return Object(L.a)(me,[{key:"render",value:function(){return this.props.children}}]),me}(R.Component),p=R.createContext(null);function c(ve){var ge=ve.children,me=ve.onBatchResize,le=R.useRef(0),ie=R.useRef([]),he=R.useContext(p),$=R.useCallback(function(te,Z,be){le.current+=1;var Ae=le.current;ie.current.push({size:te,element:Z,data:be}),Promise.resolve().then(function(){Ae===le.current&&(me==null||me(ie.current),ie.current=[])}),he==null||he(te,Z,be)},[me,he]);return R.createElement(p.Provider,{value:$},ge)}function A(ve){var ge=ve.children,me=ve.disabled,le=R.useRef(null),ie=R.useRef(null),he=R.useContext(p),$=R.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),te=R.isValidElement(ge)&&Object(v.c)(ge),Z=te?ge.ref:null,be=R.useMemo(function(){return Object(v.a)(Z,le)},[Z,le]),Ae=R.useRef(ve);Ae.current=ve;var ye=R.useCallback(function(we){var De=Ae.current,Re=De.onResize,Me=De.data,ke=we.getBoundingClientRect(),Oe=ke.width,ze=ke.height,Ze=we.offsetWidth,je=we.offsetHeight,Xe=Math.floor(Oe),et=Math.floor(ze);if($.current.width!==Xe||$.current.height!==et||$.current.offsetWidth!==Ze||$.current.offsetHeight!==je){var We={width:Xe,height:et,offsetWidth:Ze,offsetHeight:je};$.current=We;var Be=Ze===Math.round(Oe)?Oe:Ze,Se=je===Math.round(ze)?ze:je,qe=Object(B.a)(Object(B.a)({},We),{},{offsetWidth:Be,offsetHeight:Se});he==null||he(qe,we,Me),Re&&Promise.resolve().then(function(){Re(qe,we)})}},[]);return R.useEffect(function(){var we=Object(S.a)(le.current)||Object(S.a)(ie.current);return we&&!me&&l(we,ye),function(){return s(we,ye)}},[le.current,me]),R.createElement(w,{ref:ie},te?R.cloneElement(ge,{ref:be}):ge)}var y="rc-observer-key";function f(ve){var ge=ve.children,me=Object(P.a)(ge);return me.map(function(le,ie){var he=(le==null?void 0:le.key)||"".concat(y,"-").concat(ie);return R.createElement(A,Object(re.a)({},ve,{key:he}),le)})}f.Collection=c;var h=f,d=ne("bT9E"),a=ne("TSYQ"),b=ne.n(a),g=`
min-height:0 !important;
max-height:none !important;
height:0 !important;
visibility:hidden !important;
overflow:hidden !important;
position:absolute !important;
z-index:-1000 !important;
top:0 !important;
right:0 !important
`,E=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break"],M={},F;function j(ve){var ge=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,me=ve.getAttribute("id")||ve.getAttribute("data-reactid")||ve.getAttribute("name");if(ge&&M[me])return M[me];var le=window.getComputedStyle(ve),ie=le.getPropertyValue("box-sizing")||le.getPropertyValue("-moz-box-sizing")||le.getPropertyValue("-webkit-box-sizing"),he=parseFloat(le.getPropertyValue("padding-bottom"))+parseFloat(le.getPropertyValue("padding-top")),$=parseFloat(le.getPropertyValue("border-bottom-width"))+parseFloat(le.getPropertyValue("border-top-width")),te=E.map(function(be){return"".concat(be,":").concat(le.getPropertyValue(be))}).join(";"),Z={sizingStyle:te,paddingSize:he,borderSize:$,boxSizing:ie};return ge&&me&&(M[me]=Z),Z}function W(ve){var ge=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,me=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,le=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;F||(F=document.createElement("textarea"),F.setAttribute("tab-index","-1"),F.setAttribute("aria-hidden","true"),document.body.appendChild(F)),ve.getAttribute("wrap")?F.setAttribute("wrap",ve.getAttribute("wrap")):F.removeAttribute("wrap");var ie=j(ve,ge),he=ie.paddingSize,$=ie.borderSize,te=ie.boxSizing,Z=ie.sizingStyle;F.setAttribute("style","".concat(Z,";").concat(g)),F.value=ve.value||ve.placeholder||"";var be=Number.MIN_SAFE_INTEGER,Ae=Number.MAX_SAFE_INTEGER,ye=F.scrollHeight,we;if(te==="border-box"?ye+=$:te==="content-box"&&(ye-=he),me!==null||le!==null){F.value=" ";var De=F.scrollHeight-he;me!==null&&(be=De*me,te==="border-box"&&(be=be+he+$),ye=Math.max(be,ye)),le!==null&&(Ae=De*le,te==="border-box"&&(Ae=Ae+he+$),we=ye>Ae?"":"hidden",ye=Math.min(Ae,ye))}return{height:ye,minHeight:be,maxHeight:Ae,overflowY:we,resize:"none"}}var O=ne("Gytx"),k=ne.n(O),K;(function(ve){ve[ve.NONE=0]="NONE",ve[ve.RESIZING=1]="RESIZING",ve[ve.RESIZED=2]="RESIZED"})(K||(K={}));var Y=function(ve){Object(z.a)(me,ve);var ge=Object(I.a)(me);function me(le){var ie;return Object(X.a)(this,me),ie=ge.call(this,le),ie.nextFrameActionId=void 0,ie.resizeFrameId=void 0,ie.textArea=void 0,ie.saveTextArea=function(he){ie.textArea=he},ie.handleResize=function(he){var $=ie.state.resizeStatus,te=ie.props,Z=te.autoSize,be=te.onResize;if($!==K.NONE)return;typeof be=="function"&&be(he),Z&&ie.resizeOnNextFrame()},ie.resizeOnNextFrame=function(){cancelAnimationFrame(ie.nextFrameActionId),ie.nextFrameActionId=requestAnimationFrame(ie.resizeTextarea)},ie.resizeTextarea=function(){var he=ie.props.autoSize;if(!he||!ie.textArea)return;var $=he.minRows,te=he.maxRows,Z=W(ie.textArea,!1,$,te);ie.setState({textareaStyles:Z,resizeStatus:K.RESIZING},function(){cancelAnimationFrame(ie.resizeFrameId),ie.resizeFrameId=requestAnimationFrame(function(){ie.setState({resizeStatus:K.RESIZED},function(){ie.resizeFrameId=requestAnimationFrame(function(){ie.setState({resizeStatus:K.NONE}),ie.fixFirefoxAutoScroll()})})})})},ie.renderTextArea=function(){var he=ie.props,$=he.prefixCls,te=$===void 0?"rc-textarea":$,Z=he.autoSize,be=he.onResize,Ae=he.className,ye=he.disabled,we=ie.state,De=we.textareaStyles,Re=we.resizeStatus,Me=Object(d.a)(ie.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),ke=b()(te,Ae,Object(U.a)({},"".concat(te,"-disabled"),ye));"value"in Me&&(Me.value=Me.value||"");var Oe=Object(B.a)(Object(B.a)(Object(B.a)({},ie.props.style),De),Re===K.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return R.createElement(h,{onResize:ie.handleResize,disabled:!(Z||be)},R.createElement("textarea",Object(re.a)({},Me,{className:ke,style:Oe,ref:ie.saveTextArea})))},ie.state={textareaStyles:{},resizeStatus:K.NONE},ie}return Object(L.a)(me,[{key:"componentDidUpdate",value:function(ie){(ie.value!==this.props.value||!k()(ie.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 ie=this.textArea.selectionStart,he=this.textArea.selectionEnd;this.textArea.setSelectionRange(ie,he)}}catch($){}}},{key:"render",value:function(){return this.renderTextArea()}}]),me}(R.Component),q=Y,oe=function(ve){Object(z.a)(me,ve);var ge=Object(I.a)(me);function me(le){var ie;Object(X.a)(this,me),ie=ge.call(this,le),ie.resizableTextArea=void 0,ie.focus=function(){ie.resizableTextArea.textArea.focus()},ie.saveTextArea=function($){ie.resizableTextArea=$},ie.handleChange=function($){var te=ie.props.onChange;ie.setValue($.target.value,function(){ie.resizableTextArea.resizeTextarea()}),te&&te($)},ie.handleKeyDown=function($){var te=ie.props,Z=te.onPressEnter,be=te.onKeyDown;$.keyCode===13&&Z&&Z($),be&&be($)};var he=typeof le.value=="undefined"||le.value===null?le.defaultValue:le.value;return ie.state={value:he},ie}return Object(L.a)(me,[{key:"setValue",value:function(ie,he){"value"in this.props||this.setState({value:ie},he)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return R.createElement(q,Object(re.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(ie){return"value"in ie?{value:ie.value}:null}}]),me}(R.Component),Te=rt.default=oe},ZW9T:function(ft,rt,ne){"use strict";ne.d(rt,"a",function(){return p});var re=ne("k1fw"),X=ne("miYZ"),L=ne("tsqr"),z=ne("rAM+"),I=ne("tJVT"),R=ne("PpiC"),B=ne("cDcd"),U=ne.n(B),P=ne("bdgK");function D(c,A,y,f,h){var d=A.getWordUntilPosition(y),a={startLineNumber:y.lineNumber,endLineNumber:y.lineNumber,startColumn:d.startColumn,endColumn:d.endColumn},b=f.map(function(g){return{label:g,kind:c.languages.CompletionItemKind.Keyword,insertText:g,insertTextRules:c.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:a}});return h.map(function(g){b.push(Object(re.a)(Object(re.a)({},g),{},{range:a}))}),b}var v=function(c){var A={label:"ifelse",kind:c.languages.CompletionItemKind.Method,insertText:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
`),insertTextRules:c.languages.CompletionItemInsertTextRule.InsertAsSnippet},y=["auto","break","case","char","const","continue","default","do","double","else","enum","extern","float","for","goto","if","int","long","register","return","short","signed","sizeof","static","struct","switch","typedef","union","unsigned","void","volatile","while","inline","restrict","_Bool","_Complex","_Imaginary","_Alignas","_Alignof","_Atomic","_Static_assert","_Noreturn","_Thread_local","_Generic"];c.languages.registerCompletionItemProvider("cpp",{provideCompletionItems:function(a,b){var g=D(c,a,b,y,[A]);return{suggestions:g}}});var f=["False","None","True","and","as","assert","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","nonlocal","not","or","pass","raise","return","try","while","with","yield"];c.languages.registerCompletionItemProvider("python",{provideCompletionItems:function(a,b){var g=[{label:"print",kind:c.languages.CompletionItemKind.Snippet,insertText:["print($0)"].join(`
`),insertTextRules:c.languages.CompletionItemInsertTextRule.InsertAsSnippet}],E=D(c,a,b,f,g);return{suggestions:E}}});var h=["abstract","assert","boolean","break","byte","case","catch","char","class","const","continue","default","do","double","else","enum","extends","final","finally","float","for","goto","if","implements","import","instance of","int","interface","long","native","new","package","private","protected","public","return","strictfp","short","static","super","switch","synchronized","this","throw","throws","transient","try","void","volatile","while"];c.languages.registerCompletionItemProvider("java",{provideCompletionItems:function(a,b){var g=[A,{label:"main",kind:c.languages.CompletionItemKind.Snippet,insertText:["public static void main(String[] args) {"," $0","}"].join(`
`),insertTextRules:c.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"System.out.print",kind:c.languages.CompletionItemKind.Snippet,insertText:["System.out.print($0)"].join(`
`),insertTextRules:c.languages.CompletionItemInsertTextRule.InsertAsSnippet}],E=D(c,a,b,h,g);return{suggestions:E}}})},S="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",_=ne("LvDl"),C=ne("+ua5");function T(c){return/^\d+$/.test(c)?"".concat(c,"px"):c}function m(){}var u=!1,o={"Python3.6":"python","Python2.7":"python",Dynamips:"cpp",Java:"java",Web:"php",Html:"html",Hive:"sql",Hadoop:"java",SDL:"cpp",PHP:"php",Matlab:"python",Git:"python",Python:"python","C/C++":"cpp","C++":"cpp",C:"cpp",Ruby:"ruby",Shell:"shell",JavaScript:"javascript",Perl6:"perl",Kotlin:"kotlin",Elixir:"elixir",Android:"java",JavaWeb:"java",Go:"go",Spark:"sql",MachineLearning:"python",Verilog:"xml","Verilog/VNC":"xml",Docker:"dockerfile","C#":"csharp",SQLite3:"sql",Oracle:"sql",Vhdl:"vhdl",R:"r",Swift:"swift",SQLServer:"mysql",MySQL:"mysql",Mongo:"sql",PostgreSql:"pgsql",Hbase:"powershell",Sqoop:"sql",Nasm:"cpp",Kafka:"java",Flink:"java",Sml:"javascript",OpenGL:"cpp",Perl5:"perl",Orange:"python"};function l(){var c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],A=c;if(Array.isArray(c)){for(var y=0;y<c.length;y++){var f=o[c[y]];if(f)return f}return A[0]}return o[A]||A}var s=null,w=rt.b=function(c){var A=c.width,y=A===void 0?"100%":A,f=c.height,h=f===void 0?"100%":f,d=c.value,a=c.language,b=a===void 0?"javascript":a,g=c.style,E=g===void 0?{}:g,M=c.options,F=M===void 0?{}:M,j=c.overrideServices,W=j===void 0?{}:j,O=c.theme,k=O===void 0?"vs-dark":O,K=c.onEditBlur,Y=c.onSave,q=c.autoHeight,oe=q===void 0?!1:q,Te=c.forbidCopy,ve=Te===void 0?!1:Te,ge=c.onChange,me=ge===void 0?m:ge,le=c.editorDidMount,ie=le===void 0?m:le,he=c.onFocus,$=he===void 0?m:he,te=c.filename,Z=te===void 0?"educoder.txt":te,be=c.errorLine,Ae=c.errorContent,ye=Ae===void 0?"":Ae,we=Object(R.a)(c,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename","errorLine","errorContent"]),De=Object(B.useRef)(),Re=Object(B.useRef)({}),Me=Object(B.useRef)(),ke=Object(B.useRef)(!1),Oe=Object(B.useRef)(),ze=Object(B.useState)(!1),Ze=Object(I.a)(ze,2),je=Ze[0],Xe=Ze[1];function et(){var Ce;return De.current&&(Ce=new P.default(function(Ie){var Ve=Object(z.a)(Ie),Ge;try{for(Ve.s();!(Ge=Ve.n()).done;){var gt=Ge.value;(gt.target.offsetHeight>0||gt.target.offsetWidth>0)&&Re.current.instance.layout()}}catch(ct){Ve.e(ct)}finally{Ve.f()}}),Ce.observe(De.current)),Ce}function We(){L.b.warn(decodeURIComponent(S))}var Be=function(){var Ie=Re.current.instance;if(d!=null&&Ie&&je){var Ve=Ie.getModel();Ve&&d!==Ve.getValue()&&(u=!0,Ve.setValue(d),Ie.layout(),u=!1)}};Object(B.useEffect)(function(){Me.current&&clearTimeout(Me.current),Me.current=setTimeout(function(){Be()},500)},[d,je,Re.current]),Object(B.useEffect)(function(){if(be&&Re.current&&Re.current.instance){var Ce=Re.current.instance;Ce.changeViewZones(function(Ve){var Ge=document.createElement("div");Ge.style.padding="10px 20px",Ge.style.width="calc(100% - 20px)",Ge.className="my-error-line-wrp",Ge.innerHTML=ye,Ve.addZone({afterLineNumber:be||11,heightInLines:3,domNode:Ge})});var Ie={domNode:null,getId:function(){return"my.overlay.widget"},getDomNode:function(){return this.domNode||(this.domNode=document.createElement("div"),this.domNode.innerHTML="",this.domNode.style.width="100%",this.domNode.style.padding="20px 100px",this.domNode.style.right="0px",this.domNode.style.top="50px",this.domNode.style.position="relative",this.domNode.style.color="#333"),this.domNode},getPosition:function(){return null}};Ce.addOverlayWidget(Ie),Ce.revealPositionInCenter({lineNumber:20,column:1})}},[be,Re.current,je]);function Se(){var Ce=Re.current.instance;if(Ce){var Ie=Ce.getSelection(),Ve=Re.current.pastePos||{},Ge=new s.Range(Ve.startLineNumber||Ie.endLineNumber,Ve.startColumn||Ie.endColumn,Ve.endLineNumber||Ie.endLineNumber,Ve.endColumn||Ie.endColumn);setTimeout(function(){Ce.executeEdits("",[{range:Ge,text:""}])},300)}}function qe(Ce){(window.navigator.platform.match("Mac")?Ce.metaKey:Ce.ctrlKey)&&Ce.keyCode==83&&(Ce.preventDefault(),Y())}var Je=function(){if(oe&&Re.current.instance){var Ie=Re.current.instance.getContentHeight();fe(Ie<h?h:Ie)}else fe(h)};function _e(Ce){var Ie=document.createEvent("MouseEvents");Ie.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),Ce.dispatchEvent(Ie)}function Ne(Ce,Ie){var Ve=window.URL||window.webkitURL||window,Ge=new Blob([Ie]),gt=document.createElementNS("http://www.w3.org/1999/xhtml","a");gt.href=Ve.createObjectURL(Ge),gt.download=Ce,_e(gt)}Object(B.useEffect)(function(){Je()},[Je]),Object(B.useEffect)(function(){De.current&&!je&&ne.e(27).then(ne.t.bind(null,"M/lh",7)).then(function(Ce){try{s=Ce,Re.current.instance=s.editor.create(De.current,{value:d,language:l(b),theme:k,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0},W);var Ie=Re.current.instance;if(ie(Ie,s),setTimeout(function(){Je(),Re.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){Ne(Z||"educoder.txt",Ie.getValue())}})},500),Re.current.subscription=Ie.onDidChangeModelContent(function(Ge){ke.current?clearTimeout(Oe.current):(Je(),me(Ie.getValue(),Ge)),Oe.current=setTimeout(function(){ke.current=!1},500)}),window.Monaco||v(s),ve&&(Ie.addCommand(s.KeyMod.CtrlCmd|s.KeyMod.Shift|s.KeyCode.KEY_V,function(){return We(),null}),Ie.addCommand(s.KeyMod.CtrlCmd|s.KeyCode.KEY_C,function(){return We(),null})),window.Monaco=s,K&&Ie.onDidBlurEditorWidget(function(){K(Ie.getValue())}),$&&Ie.onDidFocusEditorText(function(){$(Ie.getValue())}),ve){Ie.addCommand(s.KeyMod.CtrlCmd|s.KeyCode.KEY_V,function(){return We(),null}),Ie.onDidPaste(function(Ge){Re.current.pastePos=Ge});try{window.addEventListener("paste",Se)}catch(Ge){}}var Ve=et();return Xe(!0),function(){var Ge=Re.current.instance;Ge.dispose();var gt=Ge.getModel();gt&&gt.dispose(),Re.current.subscription&&Re.current.subscription.dispose(),ve&&window.removeEventListener("paste",Se),Ve.unobserve(De.current)}}catch(Ge){}})},[]),Object(B.useEffect)(function(){var Ce=Re.current.instance;if(Ce&&je)return document.addEventListener("keydown",qe,!1),function(){document.removeEventListener("keydown",qe)}},[Y,je]),Object(B.useEffect)(function(){var Ce=Re.current.instance;if(Ce&&je){var Ie=l(b);s.editor.setModelLanguage(Ce.getModel(),Ie),console.log("language:",b,Ce.getModel(),Ie)}},[b,je]),Object(B.useEffect)(function(){var Ce=Re.current.instance;Ce&&je&&s.editor.setTheme(k)},[k,je]),Object(B.useEffect)(function(){var Ce=Re.current.instance;Ce&&je&&(Ce.updateOptions(Object(re.a)({},F)),setTimeout(function(){Ce.getModel().updateOptions(Object(re.a)({},F))},200))},[JSON.stringify(F),je]),Object(B.useEffect)(function(){var Ce=Re.current.instance;Ce&&je&&Ce.layout()},[y,h,je]);var pe=Object(B.useState)(T(y)),de=Object(I.a)(pe,2),ce=de[0],Q=de[1],J=Object(B.useState)(T(h)),ee=Object(I.a)(J,2),se=ee[0],fe=ee[1],Le=Object(re.a)(Object(re.a)({},E),{},{width:ce,height:se});return U.a.createElement("div",{className:"my-monaco-editor",ref:De,style:Le})};function p(c){var A=c.width,y=A===void 0?"100%":A,f=c.height,h=f===void 0?"100%":f,d=c.original,a=c.modified,b=c.language,g=c.options,E=g===void 0?{}:g,M=Object(B.useRef)(),F=Object(B.useState)(null),j=Object(I.a)(F,2),W=j[0],O=j[1];function k(oe){var Te;return M.current&&(Te=new P.default(function(ve){var ge=Object(z.a)(ve),me;try{for(ge.s();!(me=ge.n()).done;){var le=me.value;(le.target.offsetHeight>0||le.target.offsetWidth>0)&&oe.layout()}}catch(ie){ge.e(ie)}finally{ge.f()}}),Te.observe(M.current)),Te}Object(B.useEffect)(function(){M.current&&ne.e(27).then(ne.t.bind(null,"M/lh",7)).then(function(oe){s=oe;var Te=s.editor.createDiffEditor(M.current,Object(re.a)(Object(re.a)({enableSplitViewResizing:!1,scrollBeyondLastLine:!1,roundedSelection:!1,renderIndicators:!1,useShadows:!1,horizontal:"hidden",lineNumbers:"off",ignoreTrimWhitespace:!1,followsCaret:!0,ignoreCharChanges:!0,minimap:{enabled:!1},readOnly:!0},E),{},{wordWrap:!0}));O(Te);var ve=k(Te);return function(){Te.dispose();var ge=Te.getModel();ge&&ge.dispose(),ve.unobserve(M.current)}})},[]),Object(B.useEffect)(function(){W&&W.setModel({original:s.editor.createModel(d,b),modified:s.editor.createModel(a,b)})},[d,a,b,W]);var K=T(y),Y=T(h),q={width:K,height:Y};return U.a.createElement("div",{className:"my-diff-editor",ref:M,style:q})}},ZpRC:function(ft,rt,ne){"use strict";function re(v){return typeof v=="object"&&v!=null&&v.nodeType===1}function X(v,S){return(!S||v!=="hidden")&&v!=="visible"&&v!=="clip"}function L(v,S){if(v.clientHeight<v.scrollHeight||v.clientWidth<v.scrollWidth){var _=getComputedStyle(v,null);return X(_.overflowY,S)||X(_.overflowX,S)||function(C){var T=function(m){if(!m.ownerDocument||!m.ownerDocument.defaultView)return null;try{return m.ownerDocument.defaultView.frameElement}catch(u){return null}}(C);return!!T&&(T.clientHeight<C.scrollHeight||T.clientWidth<C.scrollWidth)}(v)}return!1}function z(v,S,_,C,T,m,u,o){return m<v&&u>S||m>v&&u<S?0:m<=v&&o<=_||u>=S&&o>=_?m-v-C:u>S&&o<_||m<v&&o>_?u-S+T:0}var I=function(v,S){var _=window,C=S.scrollMode,T=S.block,m=S.inline,u=S.boundary,o=S.skipOverflowHiddenElements,l=typeof u=="function"?u:function(De){return De!==u};if(!re(v))throw new TypeError("Invalid target");for(var s=document.scrollingElement||document.documentElement,w=[],p=v;re(p)&&l(p);){if((p=p.parentElement)===s){w.push(p);break}p!=null&&p===document.body&&L(p)&&!L(document.documentElement)||p!=null&&L(p,o)&&w.push(p)}for(var c=_.visualViewport?_.visualViewport.width:innerWidth,A=_.visualViewport?_.visualViewport.height:innerHeight,y=window.scrollX||pageXOffset,f=window.scrollY||pageYOffset,h=v.getBoundingClientRect(),d=h.height,a=h.width,b=h.top,g=h.right,E=h.bottom,M=h.left,F=T==="start"||T==="nearest"?b:T==="end"?E:b+d/2,j=m==="center"?M+a/2:m==="end"?g:M,W=[],O=0;O<w.length;O++){var k=w[O],K=k.getBoundingClientRect(),Y=K.height,q=K.width,oe=K.top,Te=K.right,ve=K.bottom,ge=K.left;if(C==="if-needed"&&b>=0&&M>=0&&E<=A&&g<=c&&b>=oe&&E<=ve&&M>=ge&&g<=Te)return W;var me=getComputedStyle(k),le=parseInt(me.borderLeftWidth,10),ie=parseInt(me.borderTopWidth,10),he=parseInt(me.borderRightWidth,10),$=parseInt(me.borderBottomWidth,10),te=0,Z=0,be="offsetWidth"in k?k.offsetWidth-k.clientWidth-le-he:0,Ae="offsetHeight"in k?k.offsetHeight-k.clientHeight-ie-$:0;if(s===k)te=T==="start"?F:T==="end"?F-A:T==="nearest"?z(f,f+A,A,ie,$,f+F,f+F+d,d):F-A/2,Z=m==="start"?j:m==="center"?j-c/2:m==="end"?j-c:z(y,y+c,c,le,he,y+j,y+j+a,a),te=Math.max(0,te+f),Z=Math.max(0,Z+y);else{te=T==="start"?F-oe-ie:T==="end"?F-ve+$+Ae:T==="nearest"?z(oe,ve,Y,ie,$+Ae,F,F+d,d):F-(oe+Y/2)+Ae/2,Z=m==="start"?j-ge-le:m==="center"?j-(ge+q/2)+be/2:m==="end"?j-Te+he+be:z(ge,Te,q,le,he+be,j,j+a,a);var ye=k.scrollLeft,we=k.scrollTop;F+=we-(te=Math.max(0,Math.min(we+te,k.scrollHeight-Y+Ae))),j+=ye-(Z=Math.max(0,Math.min(ye+Z,k.scrollWidth-q+be)))}W.push({el:k,top:te,left:Z})}return W};function R(v){return v===Object(v)&&Object.keys(v).length!==0}function B(v,S){S===void 0&&(S="auto");var _="scrollBehavior"in document.body.style;v.forEach(function(C){var T=C.el,m=C.top,u=C.left;T.scroll&&_?T.scroll({top:m,left:u,behavior:S}):(T.scrollTop=m,T.scrollLeft=u)})}function U(v){return v===!1?{block:"end",inline:"nearest"}:R(v)?v:{block:"start",inline:"nearest"}}function P(v,S){var _=!v.ownerDocument.documentElement.contains(v);if(R(S)&&typeof S.behavior=="function")return S.behavior(_?[]:I(v,S));if(_)return;var C=U(S);return B(I(v,C),C.behavior)}var D=rt.a=P},Zss7:function(ft,rt,ne){var re;(function(X){var L=/^\s+/,z=/\s+$/,I=0,R=X.round,B=X.min,U=X.max,P=X.random;function D($,te){if($=$||"",te=te||{},$ instanceof D)return $;if(!(this instanceof D))return new D($,te);var Z=v($);this._originalInput=$,this._r=Z.r,this._g=Z.g,this._b=Z.b,this._a=Z.a,this._roundA=R(100*this._a)/100,this._format=te.format||Z.format,this._gradientType=te.gradientType,this._r<1&&(this._r=R(this._r)),this._g<1&&(this._g=R(this._g)),this._b<1&&(this._b=R(this._b)),this._ok=Z.ok,this._tc_id=I++}D.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var $=this.toRgb();return($.r*299+$.g*587+$.b*114)/1e3},getLuminance:function(){var $=this.toRgb(),te,Z,be,Ae,ye,we;return te=$.r/255,Z=$.g/255,be=$.b/255,te<=.03928?Ae=te/12.92:Ae=X.pow((te+.055)/1.055,2.4),Z<=.03928?ye=Z/12.92:ye=X.pow((Z+.055)/1.055,2.4),be<=.03928?we=be/12.92:we=X.pow((be+.055)/1.055,2.4),.2126*Ae+.7152*ye+.0722*we},setAlpha:function($){return this._a=W($),this._roundA=R(100*this._a)/100,this},toHsv:function(){var $=T(this._r,this._g,this._b);return{h:$.h*360,s:$.s,v:$.v,a:this._a}},toHsvString:function(){var $=T(this._r,this._g,this._b),te=R($.h*360),Z=R($.s*100),be=R($.v*100);return this._a==1?"hsv("+te+", "+Z+"%, "+be+"%)":"hsva("+te+", "+Z+"%, "+be+"%, "+this._roundA+")"},toHsl:function(){var $=_(this._r,this._g,this._b);return{h:$.h*360,s:$.s,l:$.l,a:this._a}},toHslString:function(){var $=_(this._r,this._g,this._b),te=R($.h*360),Z=R($.s*100),be=R($.l*100);return this._a==1?"hsl("+te+", "+Z+"%, "+be+"%)":"hsla("+te+", "+Z+"%, "+be+"%, "+this._roundA+")"},toHex:function($){return u(this._r,this._g,this._b,$)},toHexString:function($){return"#"+this.toHex($)},toHex8:function($){return o(this._r,this._g,this._b,this._a,$)},toHex8String:function($){return"#"+this.toHex8($)},toRgb:function(){return{r:R(this._r),g:R(this._g),b:R(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+R(this._r)+", "+R(this._g)+", "+R(this._b)+")":"rgba("+R(this._r)+", "+R(this._g)+", "+R(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:R(O(this._r,255)*100)+"%",g:R(O(this._g,255)*100)+"%",b:R(O(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+R(O(this._r,255)*100)+"%, "+R(O(this._g,255)*100)+"%, "+R(O(this._b,255)*100)+"%)":"rgba("+R(O(this._r,255)*100)+"%, "+R(O(this._g,255)*100)+"%, "+R(O(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:F[u(this._r,this._g,this._b,!0)]||!1},toFilter:function($){var te="#"+l(this._r,this._g,this._b,this._a),Z=te,be=this._gradientType?"GradientType = 1, ":"";if($){var Ae=D($);Z="#"+l(Ae._r,Ae._g,Ae._b,Ae._a)}return"progid:DXImageTransform.Microsoft.gradient("+be+"startColorstr="+te+",endColorstr="+Z+")"},toString:function($){var te=!!$;$=$||this._format;var Z=!1,be=this._a<1&&this._a>=0,Ae=!te&&be&&($==="hex"||$==="hex6"||$==="hex3"||$==="hex4"||$==="hex8"||$==="name");return Ae?$==="name"&&this._a===0?this.toName():this.toRgbString():($==="rgb"&&(Z=this.toRgbString()),$==="prgb"&&(Z=this.toPercentageRgbString()),($==="hex"||$==="hex6")&&(Z=this.toHexString()),$==="hex3"&&(Z=this.toHexString(!0)),$==="hex4"&&(Z=this.toHex8String(!0)),$==="hex8"&&(Z=this.toHex8String()),$==="name"&&(Z=this.toName()),$==="hsl"&&(Z=this.toHslString()),$==="hsv"&&(Z=this.toHsvString()),Z||this.toHexString())},clone:function(){return D(this.toString())},_applyModification:function($,te){var Z=$.apply(null,[this].concat([].slice.call(te)));return this._r=Z._r,this._g=Z._g,this._b=Z._b,this.setAlpha(Z._a),this},lighten:function(){return this._applyModification(c,arguments)},brighten:function(){return this._applyModification(A,arguments)},darken:function(){return this._applyModification(y,arguments)},desaturate:function(){return this._applyModification(s,arguments)},saturate:function(){return this._applyModification(w,arguments)},greyscale:function(){return this._applyModification(p,arguments)},spin:function(){return this._applyModification(f,arguments)},_applyCombination:function($,te){return $.apply(null,[this].concat([].slice.call(te)))},analogous:function(){return this._applyCombination(g,arguments)},complement:function(){return this._applyCombination(h,arguments)},monochromatic:function(){return this._applyCombination(E,arguments)},splitcomplement:function(){return this._applyCombination(b,arguments)},triad:function(){return this._applyCombination(d,arguments)},tetrad:function(){return this._applyCombination(a,arguments)}},D.fromRatio=function($,te){if(typeof $=="object"){var Z={};for(var be in $)$.hasOwnProperty(be)&&(be==="a"?Z[be]=$[be]:Z[be]=Te($[be]));$=Z}return D($,te)};function v($){var te={r:0,g:0,b:0},Z=1,be=null,Ae=null,ye=null,we=!1,De=!1;return typeof $=="string"&&($=ie($)),typeof $=="object"&&(le($.r)&&le($.g)&&le($.b)?(te=S($.r,$.g,$.b),we=!0,De=String($.r).substr(-1)==="%"?"prgb":"rgb"):le($.h)&&le($.s)&&le($.v)?(be=Te($.s),Ae=Te($.v),te=m($.h,be,Ae),we=!0,De="hsv"):le($.h)&&le($.s)&&le($.l)&&(be=Te($.s),ye=Te($.l),te=C($.h,be,ye),we=!0,De="hsl"),$.hasOwnProperty("a")&&(Z=$.a)),Z=W(Z),{ok:we,format:$.format||De,r:B(255,U(te.r,0)),g:B(255,U(te.g,0)),b:B(255,U(te.b,0)),a:Z}}function S($,te,Z){return{r:O($,255)*255,g:O(te,255)*255,b:O(Z,255)*255}}function _($,te,Z){$=O($,255),te=O(te,255),Z=O(Z,255);var be=U($,te,Z),Ae=B($,te,Z),ye,we,De=(be+Ae)/2;if(be==Ae)ye=we=0;else{var Re=be-Ae;we=De>.5?Re/(2-be-Ae):Re/(be+Ae);switch(be){case $:ye=(te-Z)/Re+(te<Z?6:0);break;case te:ye=(Z-$)/Re+2;break;case Z:ye=($-te)/Re+4;break}ye/=6}return{h:ye,s:we,l:De}}function C($,te,Z){var be,Ae,ye;$=O($,360),te=O(te,100),Z=O(Z,100);function we(Me,ke,Oe){return Oe<0&&(Oe+=1),Oe>1&&(Oe-=1),Oe<1/6?Me+(ke-Me)*6*Oe:Oe<1/2?ke:Oe<2/3?Me+(ke-Me)*(2/3-Oe)*6:Me}if(te===0)be=Ae=ye=Z;else{var De=Z<.5?Z*(1+te):Z+te-Z*te,Re=2*Z-De;be=we(Re,De,$+1/3),Ae=we(Re,De,$),ye=we(Re,De,$-1/3)}return{r:be*255,g:Ae*255,b:ye*255}}function T($,te,Z){$=O($,255),te=O(te,255),Z=O(Z,255);var be=U($,te,Z),Ae=B($,te,Z),ye,we,De=be,Re=be-Ae;if(we=be===0?0:Re/be,be==Ae)ye=0;else{switch(be){case $:ye=(te-Z)/Re+(te<Z?6:0);break;case te:ye=(Z-$)/Re+2;break;case Z:ye=($-te)/Re+4;break}ye/=6}return{h:ye,s:we,v:De}}function m($,te,Z){$=O($,360)*6,te=O(te,100),Z=O(Z,100);var be=X.floor($),Ae=$-be,ye=Z*(1-te),we=Z*(1-Ae*te),De=Z*(1-(1-Ae)*te),Re=be%6,Me=[Z,we,ye,ye,De,Z][Re],ke=[De,Z,Z,we,ye,ye][Re],Oe=[ye,ye,De,Z,Z,we][Re];return{r:Me*255,g:ke*255,b:Oe*255}}function u($,te,Z,be){var Ae=[oe(R($).toString(16)),oe(R(te).toString(16)),oe(R(Z).toString(16))];return be&&Ae[0].charAt(0)==Ae[0].charAt(1)&&Ae[1].charAt(0)==Ae[1].charAt(1)&&Ae[2].charAt(0)==Ae[2].charAt(1)?Ae[0].charAt(0)+Ae[1].charAt(0)+Ae[2].charAt(0):Ae.join("")}function o($,te,Z,be,Ae){var ye=[oe(R($).toString(16)),oe(R(te).toString(16)),oe(R(Z).toString(16)),oe(ve(be))];return Ae&&ye[0].charAt(0)==ye[0].charAt(1)&&ye[1].charAt(0)==ye[1].charAt(1)&&ye[2].charAt(0)==ye[2].charAt(1)&&ye[3].charAt(0)==ye[3].charAt(1)?ye[0].charAt(0)+ye[1].charAt(0)+ye[2].charAt(0)+ye[3].charAt(0):ye.join("")}function l($,te,Z,be){var Ae=[oe(ve(be)),oe(R($).toString(16)),oe(R(te).toString(16)),oe(R(Z).toString(16))];return Ae.join("")}D.equals=function($,te){return!$||!te?!1:D($).toRgbString()==D(te).toRgbString()},D.random=function(){return D.fromRatio({r:P(),g:P(),b:P()})};function s($,te){te=te===0?0:te||10;var Z=D($).toHsl();return Z.s-=te/100,Z.s=k(Z.s),D(Z)}function w($,te){te=te===0?0:te||10;var Z=D($).toHsl();return Z.s+=te/100,Z.s=k(Z.s),D(Z)}function p($){return D($).desaturate(100)}function c($,te){te=te===0?0:te||10;var Z=D($).toHsl();return Z.l+=te/100,Z.l=k(Z.l),D(Z)}function A($,te){te=te===0?0:te||10;var Z=D($).toRgb();return Z.r=U(0,B(255,Z.r-R(255*-(te/100)))),Z.g=U(0,B(255,Z.g-R(255*-(te/100)))),Z.b=U(0,B(255,Z.b-R(255*-(te/100)))),D(Z)}function y($,te){te=te===0?0:te||10;var Z=D($).toHsl();return Z.l-=te/100,Z.l=k(Z.l),D(Z)}function f($,te){var Z=D($).toHsl(),be=(Z.h+te)%360;return Z.h=be<0?360+be:be,D(Z)}function h($){var te=D($).toHsl();return te.h=(te.h+180)%360,D(te)}function d($){var te=D($).toHsl(),Z=te.h;return[D($),D({h:(Z+120)%360,s:te.s,l:te.l}),D({h:(Z+240)%360,s:te.s,l:te.l})]}function a($){var te=D($).toHsl(),Z=te.h;return[D($),D({h:(Z+90)%360,s:te.s,l:te.l}),D({h:(Z+180)%360,s:te.s,l:te.l}),D({h:(Z+270)%360,s:te.s,l:te.l})]}function b($){var te=D($).toHsl(),Z=te.h;return[D($),D({h:(Z+72)%360,s:te.s,l:te.l}),D({h:(Z+216)%360,s:te.s,l:te.l})]}function g($,te,Z){te=te||6,Z=Z||30;var be=D($).toHsl(),Ae=360/Z,ye=[D($)];for(be.h=(be.h-(Ae*te>>1)+720)%360;--te;)be.h=(be.h+Ae)%360,ye.push(D(be));return ye}function E($,te){te=te||6;for(var Z=D($).toHsv(),be=Z.h,Ae=Z.s,ye=Z.v,we=[],De=1/te;te--;)we.push(D({h:be,s:Ae,v:ye})),ye=(ye+De)%1;return we}D.mix=function($,te,Z){Z=Z===0?0:Z||50;var be=D($).toRgb(),Ae=D(te).toRgb(),ye=Z/100,we={r:(Ae.r-be.r)*ye+be.r,g:(Ae.g-be.g)*ye+be.g,b:(Ae.b-be.b)*ye+be.b,a:(Ae.a-be.a)*ye+be.a};return D(we)},D.readability=function($,te){var Z=D($),be=D(te);return(X.max(Z.getLuminance(),be.getLuminance())+.05)/(X.min(Z.getLuminance(),be.getLuminance())+.05)},D.isReadable=function($,te,Z){var be=D.readability($,te),Ae,ye;ye=!1,Ae=he(Z);switch(Ae.level+Ae.size){case"AAsmall":case"AAAlarge":ye=be>=4.5;break;case"AAlarge":ye=be>=3;break;case"AAAsmall":ye=be>=7;break}return ye},D.mostReadable=function($,te,Z){var be=null,Ae=0,ye,we,De,Re;Z=Z||{},we=Z.includeFallbackColors,De=Z.level,Re=Z.size;for(var Me=0;Me<te.length;Me++)ye=D.readability($,te[Me]),ye>Ae&&(Ae=ye,be=D(te[Me]));return D.isReadable($,be,{level:De,size:Re})||!we?be:(Z.includeFallbackColors=!1,D.mostReadable($,["#fff","#000"],Z))};var M=D.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},F=D.hexNames=j(M);function j($){var te={};for(var Z in $)$.hasOwnProperty(Z)&&(te[$[Z]]=Z);return te}function W($){return $=parseFloat($),(isNaN($)||$<0||$>1)&&($=1),$}function O($,te){Y($)&&($="100%");var Z=q($);return $=B(te,U(0,parseFloat($))),Z&&($=parseInt($*te,10)/100),X.abs($-te)<1e-6?1:$%te/parseFloat(te)}function k($){return B(1,U(0,$))}function K($){return parseInt($,16)}function Y($){return typeof $=="string"&&$.indexOf(".")!=-1&&parseFloat($)===1}function q($){return typeof $=="string"&&$.indexOf("%")!=-1}function oe($){return $.length==1?"0"+$:""+$}function Te($){return $<=1&&($=$*100+"%"),$}function ve($){return X.round(parseFloat($)*255).toString(16)}function ge($){return K($)/255}var me=function(){var $="[-\\+]?\\d+%?",te="[-\\+]?\\d*\\.\\d+%?",Z="(?:"+te+")|(?:"+$+")",be="[\\s|\\(]+("+Z+")[,|\\s]+("+Z+")[,|\\s]+("+Z+")\\s*\\)?",Ae="[\\s|\\(]+("+Z+")[,|\\s]+("+Z+")[,|\\s]+("+Z+")[,|\\s]+("+Z+")\\s*\\)?";return{CSS_UNIT:new RegExp(Z),rgb:new RegExp("rgb"+be),rgba:new RegExp("rgba"+Ae),hsl:new RegExp("hsl"+be),hsla:new RegExp("hsla"+Ae),hsv:new RegExp("hsv"+be),hsva:new RegExp("hsva"+Ae),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function le($){return!!me.CSS_UNIT.exec($)}function ie($){$=$.replace(L,"").replace(z,"").toLowerCase();var te=!1;if(M[$])$=M[$],te=!0;else if($=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var Z;return(Z=me.rgb.exec($))?{r:Z[1],g:Z[2],b:Z[3]}:(Z=me.rgba.exec($))?{r:Z[1],g:Z[2],b:Z[3],a:Z[4]}:(Z=me.hsl.exec($))?{h:Z[1],s:Z[2],l:Z[3]}:(Z=me.hsla.exec($))?{h:Z[1],s:Z[2],l:Z[3],a:Z[4]}:(Z=me.hsv.exec($))?{h:Z[1],s:Z[2],v:Z[3]}:(Z=me.hsva.exec($))?{h:Z[1],s:Z[2],v:Z[3],a:Z[4]}:(Z=me.hex8.exec($))?{r:K(Z[1]),g:K(Z[2]),b:K(Z[3]),a:ge(Z[4]),format:te?"name":"hex8"}:(Z=me.hex6.exec($))?{r:K(Z[1]),g:K(Z[2]),b:K(Z[3]),format:te?"name":"hex"}:(Z=me.hex4.exec($))?{r:K(Z[1]+""+Z[1]),g:K(Z[2]+""+Z[2]),b:K(Z[3]+""+Z[3]),a:ge(Z[4]+""+Z[4]),format:te?"name":"hex8"}:(Z=me.hex3.exec($))?{r:K(Z[1]+""+Z[1]),g:K(Z[2]+""+Z[2]),b:K(Z[3]+""+Z[3]),format:te?"name":"hex"}:!1}function he($){var te,Z;return $=$||{level:"AA",size:"small"},te=($.level||"AA").toUpperCase(),Z=($.size||"small").toLowerCase(),te!=="AA"&&te!=="AAA"&&(te="AA"),Z!=="small"&&Z!=="large"&&(Z="small"),{level:te,size:Z}}ft.exports?ft.exports=D:!(re=function(){return D}.call(rt,ne,rt,ft),re!==void 0&&(ft.exports=re))})(Math)},bT9E:function(ft,rt,ne){"use strict";ne.d(rt,"a",function(){return X});var re=ne("VTBJ");function X(L,z){var I=Object(re.a)({},L);return Array.isArray(z)&&z.forEach(function(R){delete I[R]}),I}},c5Ni:function(ft,rt,ne){},dejd:function(ft,rt,ne){},dmUQ:function(ft,rt,ne){"use strict";var re=ne("Ff2n"),X=ne("rePB"),L=ne("1OyB"),z=ne("vuIU"),I=ne("Ji7U"),R=ne("md7G"),B=ne("foSv"),U=ne("cDcd"),P=ne.n(U),D=ne("TSYQ"),v=ne.n(D),S=ne("4IlW");function _(d,a){var b=Object.keys(d);if(Object.getOwnPropertySymbols){var g=Object.getOwnPropertySymbols(d);a&&(g=g.filter(function(E){return Object.getOwnPropertyDescriptor(d,E).enumerable})),b.push.apply(b,g)}return b}function C(d){for(var a=1;a<arguments.length;a++){var b=arguments[a]!=null?arguments[a]:{};a%2?_(Object(b),!0).forEach(function(g){Object(X.a)(d,g,b[g])}):Object.getOwnPropertyDescriptors?Object.defineProperties(d,Object.getOwnPropertyDescriptors(b)):_(Object(b)).forEach(function(g){Object.defineProperty(d,g,Object.getOwnPropertyDescriptor(b,g))})}return d}function T(d){var a=m();return function(){var g=Object(B.a)(d),E;if(a){var M=Object(B.a)(this).constructor;E=Reflect.construct(g,arguments,M)}else E=g.apply(this,arguments);return Object(R.a)(this,E)}}function m(){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 u(){}function o(d){d.preventDefault()}var l=function(a){return a.replace(/[^\w.-]+/g,"")},s=200,w=600,p=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,c=function(a){return a!=null},A=function(a,b){return b===a||typeof b=="number"&&typeof a=="number"&&isNaN(b)&&isNaN(a)},y=function(d){Object(I.a)(b,d);var a=T(b);function b(g){var E;Object(L.a)(this,b),E=a.call(this,g),E.onKeyDown=function(j){var W=E.props,O=W.onKeyDown,k=W.onPressEnter;if(j.keyCode===S.a.UP){var K=E.getRatio(j);E.up(j,K,null),E.stop()}else if(j.keyCode===S.a.DOWN){var Y=E.getRatio(j);E.down(j,Y,null),E.stop()}else j.keyCode===S.a.ENTER&&k&&k(j);if(E.recordCursorPosition(),E.lastKeyCode=j.keyCode,O){for(var q=arguments.length,oe=new Array(q>1?q-1:0),Te=1;Te<q;Te++)oe[Te-1]=arguments[Te];O.apply(void 0,[j].concat(oe))}},E.onKeyUp=function(j){var W=E.props.onKeyUp;if(E.stop(),E.recordCursorPosition(),W){for(var O=arguments.length,k=new Array(O>1?O-1:0),K=1;K<O;K++)k[K-1]=arguments[K];W.apply(void 0,[j].concat(k))}},E.onChange=function(j){var W=E.props.onChange;E.state.focused&&(E.inputting=!0),E.rawInput=E.props.parser(E.getValueFromEvent(j)),E.setState({inputValue:E.rawInput}),W(E.toNumber(E.rawInput))},E.onMouseUp=function(){var j=E.props.onMouseUp;E.recordCursorPosition(),j&&j.apply(void 0,arguments)},E.onFocus=function(){var j;E.setState({focused:!0}),(j=E.props).onFocus.apply(j,arguments)},E.onBlur=function(){var j=E.props.onBlur;E.inputting=!1,E.setState({focused:!1});var W=E.getCurrentValidValue(E.state.inputValue),O=E.setValue(W,u);if(j){var k=E.input.value,K=E.getInputDisplayValue({focus:!1,value:O});E.input.value=K&&Number(K),j.apply(void 0,arguments),E.input.value=k}},E.getRatio=function(j){var W=1;return j.metaKey||j.ctrlKey?W=.1:j.shiftKey&&(W=10),W},E.getFullNum=function(j){return isNaN(j)?j:/e/i.test(String(j))?Number(j).toFixed(18).replace(/\.?0+$/,""):j},E.getPrecision=function(j){if(c(E.props.precision))return E.props.precision;var W=String(j);if(W.indexOf("e-")>=0)return parseInt(W.slice(W.indexOf("e-")+2),10);var O=0;return W.indexOf(".")>=0&&(O=W.length-W.indexOf(".")-1),O},E.getInputDisplayValue=function(j){var W=j||E.state,O=W.focused,k=W.inputValue,K=W.value,Y;O?Y=k:Y=E.toPrecisionAsStep(K),Y==null&&(Y="");var q=E.formatWrapper(Y);return c(E.props.decimalSeparator)&&(q=q.toString().replace(".",E.props.decimalSeparator)),q},E.recordCursorPosition=function(){try{E.cursorStart=E.input.selectionStart,E.cursorEnd=E.input.selectionEnd,E.currentValue=E.input.value,E.cursorBefore=E.input.value.substring(0,E.cursorStart),E.cursorAfter=E.input.value.substring(E.cursorEnd)}catch(j){}},E.restoreByAfter=function(j){if(j===void 0)return!1;var W=E.input.value,O=W.lastIndexOf(j);if(O===-1)return!1;var k=E.cursorBefore.length;return E.lastKeyCode===S.a.DELETE&&E.cursorBefore.charAt(k-1)===j[0]?(E.fixCaret(k,k),!0):O+j.length===W.length?(E.fixCaret(O,O),!0):!1},E.partRestoreByAfter=function(j){return j===void 0?!1:Array.prototype.some.call(j,function(W,O){var k=j.substring(O);return E.restoreByAfter(k)})},E.isNotCompleteNumber=function(j){return isNaN(j)||j===""||j===null||j&&j.toString().indexOf(".")===j.toString().length-1},E.stop=function(){E.autoStepTimer&&clearTimeout(E.autoStepTimer)},E.down=function(j,W,O){E.pressingUpOrDown=!0,E.step("down",j,W,O)},E.up=function(j,W,O){E.pressingUpOrDown=!0,E.step("up",j,W,O)},E.saveInput=function(j){E.input=j};var M=g.value;M===void 0&&(M=g.defaultValue),E.state={focused:g.autoFocus};var F=E.getValidValue(E.toNumber(M));return E.state=C(C({},E.state),{},{inputValue:E.toPrecisionAsStep(F),value:F}),E}return Object(z.a)(b,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(E){var M=this.props,F=M.value,j=M.onChange,W=M.max,O=M.min,k=this.state.focused;if(E){if(!A(E.value,F)||!A(E.max,W)||!A(E.min,O)){var K=k?F:this.getValidValue(F),Y;this.pressingUpOrDown?Y=K:this.inputting?Y=this.rawInput:Y=this.toPrecisionAsStep(K),this.setState({value:K,inputValue:Y})}var q="value"in this.props?F:this.state.value;"max"in this.props&&E.max!==W&&typeof q=="number"&&q>W&&j&&j(W),"min"in this.props&&E.min!==O&&typeof q=="number"&&q<O&&j&&j(O)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var oe=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===S.a.BACKSPACE?oe=this.cursorStart-1:this.lastKeyCode===S.a.DELETE&&(oe=this.cursorStart):oe=this.input.value.length,this.fixCaret(oe,oe)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case S.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case S.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(Te){}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(E){var M=E;return M===""?M="":this.isNotCompleteNumber(parseFloat(M))?M=this.state.value:M=this.getValidValue(M),this.toNumber(M)}},{key:"getValueFromEvent",value:function(E){var M=E.target.value.trim().replace(/。/g,".");return c(this.props.decimalSeparator)&&(M=M.replace(this.props.decimalSeparator,".")),M}},{key:"getValidValue",value:function(E){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,j=parseFloat(E);return isNaN(j)?E:(j<M&&(j=M),j>F&&(j=F),j)}},{key:"setValue",value:function(E,M){var F=this.props.precision,j=this.isNotCompleteNumber(parseFloat(E))?null:parseFloat(E),W=this.state.value,O=W===void 0?null:W,k=this.state.inputValue,K=k===void 0?null:k,Y=typeof j=="number"?j.toFixed(F):"".concat(j),q=j!==O||Y!=="".concat(K);return"value"in this.props?(K=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:K},M)):this.setState({value:j,inputValue:this.toPrecisionAsStep(E)},M),q&&this.props.onChange(j),j}},{key:"getMaxPrecision",value:function(E){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,F=this.props,j=F.precision,W=F.step;if(c(j))return j;var O=this.getPrecision(M),k=this.getPrecision(W),K=this.getPrecision(E);return E?Math.max(K,O+k):O+k}},{key:"getPrecisionFactor",value:function(E){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,F=this.getMaxPrecision(E,M);return Math.pow(10,F)}},{key:"focus",value:function(){this.input.focus(),this.recordCursorPosition()}},{key:"blur",value:function(){this.input.blur()}},{key:"select",value:function(){this.input.select()}},{key:"formatWrapper",value:function(E){return this.props.formatter?this.props.formatter(E):E}},{key:"toPrecisionAsStep",value:function(E){if(this.isNotCompleteNumber(E)||E==="")return E;var M=Math.abs(this.getMaxPrecision(E));return isNaN(M)?E.toString():Number(E).toFixed(M)}},{key:"toNumber",value:function(E){var M=this.props.precision,F=this.state.focused,j=E&&E.length>16&&F;return this.isNotCompleteNumber(E)||j?E:c(M)?Math.round(E*Math.pow(10,M))/Math.pow(10,M):Number(E)}},{key:"upStep",value:function(E,M){var F=this.props.step,j=this.getPrecisionFactor(E,M),W=Math.abs(this.getMaxPrecision(E,M)),O=((j*E+j*F*M)/j).toFixed(W);return this.toNumber(O)}},{key:"downStep",value:function(E,M){var F=this.props.step,j=this.getPrecisionFactor(E,M),W=Math.abs(this.getMaxPrecision(E,M)),O=((j*E-j*F*M)/j).toFixed(W);return this.toNumber(O)}},{key:"step",value:function(E,M){var F=this,j=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,W=arguments.length>3?arguments[3]:void 0;this.stop(),M&&(M.persist(),M.preventDefault());var O=this.props;if(O.disabled)return;var k=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(k))return;var K=this["".concat(E,"Step")](k,j),Y=K>O.max||K<O.min;if(K>O.max?K=O.max:K<O.min&&(K=O.min),this.setValue(K,null),this.setState({focused:!0},function(){F.pressingUpOrDown=!1}),Y)return;this.autoStepTimer=setTimeout(function(){F[E](M,j,!0)},W?s:w)}},{key:"fixCaret",value:function(E,M){if(E===void 0||M===void 0||!this.input||!this.input.value)return;try{var F=this.input.selectionStart,j=this.input.selectionEnd;(E!==F||M!==j)&&this.input.setSelectionRange(E,M)}catch(W){}}},{key:"render",value:function(){var E,M=this.props,F=M.prefixCls,j=M.disabled,W=M.readOnly,O=M.useTouch,k=M.autoComplete,K=M.upHandler,Y=M.downHandler,q=M.className,oe=M.max,Te=M.min,ve=M.style,ge=M.title,me=M.onMouseEnter,le=M.onMouseLeave,ie=M.onMouseOver,he=M.onMouseOut,$=M.required,te=M.onClick,Z=M.tabIndex,be=M.type,Ae=M.placeholder,ye=M.id,we=M.inputMode,De=M.pattern,Re=M.step,Me=M.maxLength,ke=M.autoFocus,Oe=M.name,ze=M.onPaste,Ze=M.onInput,je=Object(re.a)(M,["prefixCls","disabled","readOnly","useTouch","autoComplete","upHandler","downHandler","className","max","min","style","title","onMouseEnter","onMouseLeave","onMouseOver","onMouseOut","required","onClick","tabIndex","type","placeholder","id","inputMode","pattern","step","maxLength","autoFocus","name","onPaste","onInput"]),Xe=this.state,et=Xe.value,We=Xe.focused,Be=v()(F,(E={},Object(X.a)(E,q,!!q),Object(X.a)(E,"".concat(F,"-disabled"),j),Object(X.a)(E,"".concat(F,"-focused"),We),E)),Se={};Object.keys(je).forEach(function(se){(se.substr(0,5)==="data-"||se.substr(0,5)==="aria-"||se==="role")&&(Se[se]=je[se])});var qe=!W&&!j,Je=this.getInputDisplayValue(null),_e=(et||et===0)&&(isNaN(et)||Number(et)>=oe),Ne=(et||et===0)&&(isNaN(et)||Number(et)<=Te),pe=_e||j||W,de=Ne||j||W,ce=v()("".concat(F,"-handler"),"".concat(F,"-handler-up"),Object(X.a)({},"".concat(F,"-handler-up-disabled"),pe)),Q=v()("".concat(F,"-handler"),"".concat(F,"-handler-down"),Object(X.a)({},"".concat(F,"-handler-down-disabled"),de)),J=O?{onTouchStart:pe?u:this.up,onTouchEnd:this.stop}:{onMouseDown:pe?u:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},ee=O?{onTouchStart:de?u:this.down,onTouchEnd:this.stop}:{onMouseDown:de?u:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return P.a.createElement("div",{className:Be,style:ve,title:ge,onMouseEnter:me,onMouseLeave:le,onMouseOver:ie,onMouseOut:he,onFocus:function(){return null},onBlur:function(){return null}},P.a.createElement("div",{className:"".concat(F,"-handler-wrap")},P.a.createElement("span",Object.assign({unselectable:"on"},J,{role:"button","aria-label":"Increase Value","aria-disabled":pe,className:ce}),K||P.a.createElement("span",{unselectable:"on",className:"".concat(F,"-handler-up-inner"),onClick:o})),P.a.createElement("span",Object.assign({unselectable:"on"},ee,{role:"button","aria-label":"Decrease Value","aria-disabled":de,className:Q}),Y||P.a.createElement("span",{unselectable:"on",className:"".concat(F,"-handler-down-inner"),onClick:o}))),P.a.createElement("div",{className:"".concat(F,"-input-wrap")},P.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":Te,"aria-valuemax":oe,"aria-valuenow":et,required:$,type:be,placeholder:Ae,onPaste:ze,onClick:te,onMouseUp:this.onMouseUp,className:"".concat(F,"-input"),tabIndex:Z,autoComplete:k,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:qe?this.onKeyDown:u,onKeyUp:qe?this.onKeyUp:u,autoFocus:ke,maxLength:Me,readOnly:W,disabled:j,max:oe,min:Te,step:Re,name:Oe,title:ge,id:ye,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(Je),pattern:De,inputMode:we,onInput:Ze},Se))))}}]),b}(P.a.Component);y.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:p,min:-p,step:1,style:{},onChange:u,onKeyDown:u,onPressEnter:u,onFocus:u,onBlur:u,parser:l,required:!1,autoComplete:"off"};var f=y,h=rt.a=f},h78n:function(ft,rt,ne){"use strict";ne.d(rt,"a",function(){return E});var re=ne("cDcd"),X=ne.n(re),L=ne("TSYQ"),z=ne.n(L),I={className:"",percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,style:{},trailColor:"#D9D9D9",trailWidth:1},R=function(j){var W=j.map(function(){return Object(re.useRef)()}),O=Object(re.useRef)();return Object(re.useEffect)(function(){var k=Date.now(),K=!1;Object.keys(W).forEach(function(Y){var q=W[Y].current;if(!q)return;K=!0;var oe=q.style;oe.transitionDuration=".3s, .3s, .3s, .06s",O.current&&k-O.current<100&&(oe.transitionDuration="0s, 0s")}),K&&(O.current=Date.now())}),[W]};function B(){return B=Object.assign||function(F){for(var j=1;j<arguments.length;j++){var W=arguments[j];for(var O in W)Object.prototype.hasOwnProperty.call(W,O)&&(F[O]=W[O])}return F},B.apply(this,arguments)}function U(F,j){return _(F)||S(F,j)||D(F,j)||P()}function P(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function D(F,j){if(!F)return;if(typeof F=="string")return v(F,j);var W=Object.prototype.toString.call(F).slice(8,-1);if(W==="Object"&&F.constructor&&(W=F.constructor.name),W==="Map"||W==="Set")return Array.from(F);if(W==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(W))return v(F,j)}function v(F,j){(j==null||j>F.length)&&(j=F.length);for(var W=0,O=new Array(j);W<j;W++)O[W]=F[W];return O}function S(F,j){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(F)))return;var W=[],O=!0,k=!1,K=void 0;try{for(var Y=F[Symbol.iterator](),q;!(O=(q=Y.next()).done)&&!(W.push(q.value),j&&W.length===j);O=!0);}catch(oe){k=!0,K=oe}finally{try{!O&&Y.return!=null&&Y.return()}finally{if(k)throw K}}return W}function _(F){if(Array.isArray(F))return F}function C(F,j){if(F==null)return{};var W=T(F,j),O,k;if(Object.getOwnPropertySymbols){var K=Object.getOwnPropertySymbols(F);for(k=0;k<K.length;k++){if(O=K[k],j.indexOf(O)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(F,O))continue;W[O]=F[O]}}return W}function T(F,j){if(F==null)return{};var W={},O=Object.keys(F),k,K;for(K=0;K<O.length;K++){if(k=O[K],j.indexOf(k)>=0)continue;W[k]=F[k]}return W}var m=function(j){var W=j.className,O=j.percent,k=j.prefixCls,K=j.strokeColor,Y=j.strokeLinecap,q=j.strokeWidth,oe=j.style,Te=j.trailColor,ve=j.trailWidth,ge=j.transition,me=C(j,["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"]);delete me.gapPosition;var le=Array.isArray(O)?O:[O],ie=Array.isArray(K)?K:[K],he=R(le),$=U(he,1),te=$[0],Z=q/2,be=100-q/2,Ae="M ".concat(Y==="round"?Z:0,",").concat(Z,`
L `).concat(Y==="round"?be:100,",").concat(Z),ye="0 0 100 ".concat(q),we=0;return X.a.createElement("svg",B({className:z()("".concat(k,"-line"),W),viewBox:ye,preserveAspectRatio:"none",style:oe},me),X.a.createElement("path",{className:"".concat(k,"-line-trail"),d:Ae,strokeLinecap:Y,stroke:Te,strokeWidth:ve||q,fillOpacity:"0"}),le.map(function(De,Re){var Me={strokeDasharray:"".concat(De,"px, 100px"),strokeDashoffset:"-".concat(we,"px"),transition:ge||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},ke=ie[Re]||ie[ie.length-1];return we+=De,X.a.createElement("path",{key:Re,className:"".concat(k,"-line-path"),d:Ae,strokeLinecap:Y,stroke:ke,strokeWidth:q,fillOpacity:"0",ref:te[Re],style:Me})}))};m.defaultProps=I;var u=m;function o(){return o=Object.assign||function(F){for(var j=1;j<arguments.length;j++){var W=arguments[j];for(var O in W)Object.prototype.hasOwnProperty.call(W,O)&&(F[O]=W[O])}return F},o.apply(this,arguments)}function l(F,j){return A(F)||c(F,j)||w(F,j)||s()}function s(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function w(F,j){if(!F)return;if(typeof F=="string")return p(F,j);var W=Object.prototype.toString.call(F).slice(8,-1);if(W==="Object"&&F.constructor&&(W=F.constructor.name),W==="Map"||W==="Set")return Array.from(F);if(W==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(W))return p(F,j)}function p(F,j){(j==null||j>F.length)&&(j=F.length);for(var W=0,O=new Array(j);W<j;W++)O[W]=F[W];return O}function c(F,j){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(F)))return;var W=[],O=!0,k=!1,K=void 0;try{for(var Y=F[Symbol.iterator](),q;!(O=(q=Y.next()).done)&&!(W.push(q.value),j&&W.length===j);O=!0);}catch(oe){k=!0,K=oe}finally{try{!O&&Y.return!=null&&Y.return()}finally{if(k)throw K}}return W}function A(F){if(Array.isArray(F))return F}function y(F,j){if(F==null)return{};var W=f(F,j),O,k;if(Object.getOwnPropertySymbols){var K=Object.getOwnPropertySymbols(F);for(k=0;k<K.length;k++){if(O=K[k],j.indexOf(O)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(F,O))continue;W[O]=F[O]}}return W}function f(F,j){if(F==null)return{};var W={},O=Object.keys(F),k,K;for(K=0;K<O.length;K++){if(k=O[K],j.indexOf(k)>=0)continue;W[k]=F[k]}return W}var h=0;function d(F){return+F.replace("%","")}function a(F){return Array.isArray(F)?F:[F]}function b(F,j,W,O){var k=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,K=arguments.length>5?arguments[5]:void 0,Y=50-O/2,q=0,oe=-Y,Te=0,ve=-2*Y;switch(K){case"left":q=-Y,oe=0,Te=2*Y,ve=0;break;case"right":q=Y,oe=0,Te=-2*Y,ve=0;break;case"bottom":oe=Y,ve=2*Y;break;default:}var ge="M 50,50 m ".concat(q,",").concat(oe,`
a `).concat(Y,",").concat(Y," 0 1 1 ").concat(Te,",").concat(-ve,`
a `).concat(Y,",").concat(Y," 0 1 1 ").concat(-Te,",").concat(ve),me=Math.PI*2*Y,le={stroke:W,strokeDasharray:"".concat(j/100*(me-k),"px ").concat(me,"px"),strokeDashoffset:"-".concat(k/2+F/100*(me-k),"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"};return{pathString:ge,pathStyle:le}}var g=function(j){var W=j.prefixCls,O=j.strokeWidth,k=j.trailWidth,K=j.gapDegree,Y=j.gapPosition,q=j.trailColor,oe=j.strokeLinecap,Te=j.style,ve=j.className,ge=j.strokeColor,me=j.percent,le=y(j,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"]),ie=Object(re.useMemo)(function(){return h+=1,h},[]),he=b(0,100,q,O,K,Y),$=he.pathString,te=he.pathStyle,Z=a(me),be=a(ge),Ae=be.find(function(Me){return Object.prototype.toString.call(Me)==="[object Object]"}),ye=R(Z),we=l(ye,1),De=we[0],Re=function(){var ke=0;return Z.map(function(Oe,ze){var Ze=be[ze]||be[be.length-1],je=Object.prototype.toString.call(Ze)==="[object Object]"?"url(#".concat(W,"-gradient-").concat(ie,")"):"",Xe=b(ke,Oe,Ze,O,K,Y);return ke+=Oe,X.a.createElement("path",{key:ze,className:"".concat(W,"-circle-path"),d:Xe.pathString,stroke:je,strokeLinecap:oe,strokeWidth:O,opacity:Oe===0?0:1,fillOpacity:"0",style:Xe.pathStyle,ref:De[ze]})})};return X.a.createElement("svg",o({className:z()("".concat(W,"-circle"),ve),viewBox:"0 0 100 100",style:Te},le),Ae&&X.a.createElement("defs",null,X.a.createElement("linearGradient",{id:"".concat(W,"-gradient-").concat(ie),x1:"100%",y1:"0%",x2:"0%",y2:"0%"},Object.keys(Ae).sort(function(Me,ke){return d(Me)-d(ke)}).map(function(Me,ke){return X.a.createElement("stop",{key:ke,offset:Me,stopColor:Ae[Me]})}))),X.a.createElement("path",{className:"".concat(W,"-circle-trail"),d:$,stroke:q,strokeLinecap:oe,strokeWidth:k||O,fillOpacity:"0",style:te}),Re().reverse())};g.defaultProps=I;var E=g,M={Line:u,Circle:E}},kSUc:function(ft,rt,ne){},lZu9:function(ft,rt,ne){(function(re){re(ne("VrN/"),ne("1eCo"),ne("8EBN"))})(function(re){"use strict";re.defineMode("markdown",function(X,L){var z=re.getMode(X,"text/html"),I=z.name=="null";function R(O){if(re.findModeByName){var k=re.findModeByName(O);k&&(O=k.mime||k.mimes[0])}var K=re.getMode(X,O);return K.name=="null"?null:K}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 B={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough",emoji:"builtin"};for(var U in B)B.hasOwnProperty(U)&&L.tokenTypeOverrides[U]&&(B[U]=L.tokenTypeOverrides[U]);var P=/^([*\-_])(?:\s*\1){2,}\s*$/,D=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,v=/^\[(x| )\](?=\s)/i,S=L.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,_=/^ {0,3}(?:\={1,}|-{2,})\s*$/,C=/^[^#!\[\]*_\\<>` "'(~:]+/,T=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,m=/^\s*\[[^\]]+?\]:.*$/,u=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,o=" ";function l(O,k,K){return k.f=k.inline=K,K(O,k)}function s(O,k,K){return k.f=k.block=K,K(O,k)}function w(O){return!O||!/\S/.test(O.string)}function p(O){if(O.linkTitle=!1,O.linkHref=!1,O.linkText=!1,O.em=!1,O.strong=!1,O.strikethrough=!1,O.quote=0,O.indentedCode=!1,O.f==A){var k=I;if(!k){var K=re.innerMode(z,O.htmlState);k=K.mode.name=="xml"&&K.state.tagStart===null&&!K.state.context&&K.state.tokenize.isInText}k&&(O.f=d,O.block=c,O.htmlState=null)}return O.trailingSpace=0,O.trailingSpaceNewLine=!1,O.prevLine=O.thisLine,O.thisLine={stream:null},null}function c(O,k){var K=O.column()===k.indentation,Y=w(k.prevLine.stream),q=k.indentedCode,oe=k.prevLine.hr,Te=k.list!==!1,ve=(k.listStack[k.listStack.length-1]||0)+3;k.indentedCode=!1;var ge=k.indentation;if(k.indentationDiff===null&&(k.indentationDiff=k.indentation,Te)){for(k.list=null;ge<k.listStack[k.listStack.length-1];)k.listStack.pop(),k.listStack.length?k.indentation=k.listStack[k.listStack.length-1]:k.list=!1;k.list!==!1&&(k.indentationDiff=ge-k.listStack[k.listStack.length-1])}var me=!Y&&!oe&&!k.prevLine.header&&(!Te||!q)&&!k.prevLine.fencedCodeEnd,le=(k.list===!1||oe||Y)&&k.indentation<=ve&&O.match(P),ie=null;if(k.indentationDiff>=4&&(q||k.prevLine.fencedCodeEnd||k.prevLine.header||Y))return O.skipToEnd(),k.indentedCode=!0,B.code;if(O.eatSpace())return null;if(K&&k.indentation<=ve&&(ie=O.match(S))&&ie[1].length<=6)return k.quote=0,k.header=ie[1].length,k.thisLine.header=!0,L.highlightFormatting&&(k.formatting="header"),k.f=k.inline,f(k);if(k.indentation<=ve&&O.eat(">"))return k.quote=K?1:k.quote+1,L.highlightFormatting&&(k.formatting="quote"),O.eatSpace(),f(k);if(!le&&!k.setext&&K&&k.indentation<=ve&&(ie=O.match(D))){var he=ie[1]?"ol":"ul";return k.indentation=ge+O.current().length,k.list=!0,k.quote=0,k.listStack.push(k.indentation),k.em=!1,k.strong=!1,k.code=!1,k.strikethrough=!1,L.taskLists&&O.match(v,!1)&&(k.taskList=!0),k.f=k.inline,L.highlightFormatting&&(k.formatting=["list","list-"+he]),f(k)}else{if(K&&k.indentation<=ve&&(ie=O.match(T,!0)))return k.quote=0,k.fencedEndRE=new RegExp(ie[1]+"+ *$"),k.localMode=L.fencedCodeBlockHighlighting&&R(ie[2]||L.fencedCodeBlockDefaultMode),k.localMode&&(k.localState=re.startState(k.localMode)),k.f=k.block=y,L.highlightFormatting&&(k.formatting="code-block"),k.code=-1,f(k);if(k.setext||(!me||!Te)&&!k.quote&&k.list===!1&&!k.code&&!le&&!m.test(O.string)&&(ie=O.lookAhead(1))&&(ie=ie.match(_)))return k.setext?(k.header=k.setext,k.setext=0,O.skipToEnd(),L.highlightFormatting&&(k.formatting="header")):(k.header=ie[0].charAt(0)=="="?1:2,k.setext=k.header),k.thisLine.header=!0,k.f=k.inline,f(k);if(le)return O.skipToEnd(),k.hr=!0,k.thisLine.hr=!0,B.hr;if(O.peek()==="[")return l(O,k,M)}return l(O,k,k.inline)}function A(O,k){var K=z.token(O,k.htmlState);if(!I){var Y=re.innerMode(z,k.htmlState);(Y.mode.name=="xml"&&Y.state.tagStart===null&&!Y.state.context&&Y.state.tokenize.isInText||k.md_inside&&O.current().indexOf(">")>-1)&&(k.f=d,k.block=c,k.htmlState=null)}return K}function y(O,k){var K=k.listStack[k.listStack.length-1]||0,Y=k.indentation<K,q=K+3;if(k.fencedEndRE&&k.indentation<=q&&(Y||O.match(k.fencedEndRE))){L.highlightFormatting&&(k.formatting="code-block");var oe;return Y||(oe=f(k)),k.localMode=k.localState=null,k.block=c,k.f=d,k.fencedEndRE=null,k.code=0,k.thisLine.fencedCodeEnd=!0,Y?s(O,k,k.block):oe}else return k.localMode?k.localMode.token(O,k.localState):(O.skipToEnd(),B.code)}function f(O){var k=[];if(O.formatting){k.push(B.formatting),typeof O.formatting=="string"&&(O.formatting=[O.formatting]);for(var K=0;K<O.formatting.length;K++)k.push(B.formatting+"-"+O.formatting[K]),O.formatting[K]==="header"&&k.push(B.formatting+"-"+O.formatting[K]+"-"+O.header),O.formatting[K]==="quote"&&(!L.maxBlockquoteDepth||L.maxBlockquoteDepth>=O.quote?k.push(B.formatting+"-"+O.formatting[K]+"-"+O.quote):k.push("error"))}if(O.taskOpen)return k.push("meta"),k.length?k.join(" "):null;if(O.taskClosed)return k.push("property"),k.length?k.join(" "):null;if(O.linkHref?k.push(B.linkHref,"url"):(O.strong&&k.push(B.strong),O.em&&k.push(B.em),O.strikethrough&&k.push(B.strikethrough),O.emoji&&k.push(B.emoji),O.linkText&&k.push(B.linkText),O.code&&k.push(B.code),O.image&&k.push(B.image),O.imageAltText&&k.push(B.imageAltText,"link"),O.imageMarker&&k.push(B.imageMarker)),O.header&&k.push(B.header,B.header+"-"+O.header),O.quote&&(k.push(B.quote),!L.maxBlockquoteDepth||L.maxBlockquoteDepth>=O.quote?k.push(B.quote+"-"+O.quote):k.push(B.quote+"-"+L.maxBlockquoteDepth)),O.list!==!1){var Y=(O.listStack.length-1)%3;Y?Y===1?k.push(B.list2):k.push(B.list3):k.push(B.list1)}return O.trailingSpaceNewLine?k.push("trailing-space-new-line"):O.trailingSpace&&k.push("trailing-space-"+(O.trailingSpace%2?"a":"b")),k.length?k.join(" "):null}function h(O,k){return O.match(C,!0)?f(k):void 0}function d(O,k){var K=k.text(O,k);if(typeof K!="undefined")return K;if(k.list)return k.list=null,f(k);if(k.taskList){var Y=O.match(v,!0)[1]===" ";return Y?k.taskOpen=!0:k.taskClosed=!0,L.highlightFormatting&&(k.formatting="task"),k.taskList=!1,f(k)}if(k.taskOpen=!1,k.taskClosed=!1,k.header&&O.match(/^#+$/,!0))return L.highlightFormatting&&(k.formatting="header"),f(k);var q=O.next();if(k.linkTitle){k.linkTitle=!1;var oe=q;q==="("&&(oe=")"),oe=(oe+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var Te="^\\s*(?:[^"+oe+"\\\\]+|\\\\\\\\|\\\\.)"+oe;if(O.match(new RegExp(Te),!0))return B.linkHref}if(q==="`"){var ve=k.formatting;L.highlightFormatting&&(k.formatting="code"),O.eatWhile("`");var ge=O.current().length;if(k.code==0&&(!k.quote||ge==1))return k.code=ge,f(k);if(ge==k.code){var me=f(k);return k.code=0,me}else return k.formatting=ve,f(k)}else if(k.code)return f(k);if(q==="\\"&&(O.next(),L.highlightFormatting)){var le=f(k),ie=B.formatting+"-escape";return le?le+" "+ie:ie}if(q==="!"&&O.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return k.imageMarker=!0,k.image=!0,L.highlightFormatting&&(k.formatting="image"),f(k);if(q==="["&&k.imageMarker&&O.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return k.imageMarker=!1,k.imageAltText=!0,L.highlightFormatting&&(k.formatting="image"),f(k);if(q==="]"&&k.imageAltText){L.highlightFormatting&&(k.formatting="image");var le=f(k);return k.imageAltText=!1,k.image=!1,k.inline=k.f=b,le}if(q==="["&&!k.image)return k.linkText&&O.match(/^.*?\]/)||(k.linkText=!0,L.highlightFormatting&&(k.formatting="link")),f(k);if(q==="]"&&k.linkText){L.highlightFormatting&&(k.formatting="link");var le=f(k);return k.linkText=!1,k.inline=k.f=O.match(/\(.*?\)| ?\[.*?\]/,!1)?b:d,le}if(q==="<"&&O.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){k.f=k.inline=a,L.highlightFormatting&&(k.formatting="link");var le=f(k);return le?le+=" ":le="",le+B.linkInline}if(q==="<"&&O.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){k.f=k.inline=a,L.highlightFormatting&&(k.formatting="link");var le=f(k);return le?le+=" ":le="",le+B.linkEmail}if(L.xml&&q==="<"&&O.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var he=O.string.indexOf(">",O.pos);if(he!=-1){var $=O.string.substring(O.start,he);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test($)&&(k.md_inside=!0)}return O.backUp(1),k.htmlState=re.startState(z),s(O,k,A)}if(L.xml&&q==="<"&&O.match(/^\/\w*?>/))return k.md_inside=!1,"tag";if(q==="*"||q==="_"){for(var te=1,Z=O.pos==1?" ":O.string.charAt(O.pos-2);te<3&&O.eat(q);)te++;var be=O.peek()||" ",Ae=!/\s/.test(be)&&(!u.test(be)||/\s/.test(Z)||u.test(Z)),ye=!/\s/.test(Z)&&(!u.test(Z)||/\s/.test(be)||u.test(be)),we=null,De=null;if(te%2&&(!k.em&&Ae&&(q==="*"||!ye||u.test(Z))?we=!0:k.em==q&&ye&&(q==="*"||!Ae||u.test(be))&&(we=!1)),te>1&&(!k.strong&&Ae&&(q==="*"||!ye||u.test(Z))?De=!0:k.strong==q&&ye&&(q==="*"||!Ae||u.test(be))&&(De=!1)),De!=null||we!=null){L.highlightFormatting&&(k.formatting=we==null?"strong":De==null?"em":"strong em"),we===!0&&(k.em=q),De===!0&&(k.strong=q);var me=f(k);return we===!1&&(k.em=!1),De===!1&&(k.strong=!1),me}}else if(q===" "&&(O.eat("*")||O.eat("_"))){if(O.peek()===" ")return f(k);O.backUp(1)}if(L.strikethrough){if(q==="~"&&O.eatWhile(q)){if(k.strikethrough){L.highlightFormatting&&(k.formatting="strikethrough");var me=f(k);return k.strikethrough=!1,me}else if(O.match(/^[^\s]/,!1))return k.strikethrough=!0,L.highlightFormatting&&(k.formatting="strikethrough"),f(k)}else if(q===" "&&O.match(/^~~/,!0)){if(O.peek()===" ")return f(k);O.backUp(2)}}if(L.emoji&&q===":"&&O.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){k.emoji=!0,L.highlightFormatting&&(k.formatting="emoji");var Re=f(k);return k.emoji=!1,Re}return q===" "&&(O.match(/^ +$/,!1)?k.trailingSpace++:k.trailingSpace&&(k.trailingSpaceNewLine=!0)),f(k)}function a(O,k){var K=O.next();if(K===">"){k.f=k.inline=d,L.highlightFormatting&&(k.formatting="link");var Y=f(k);return Y?Y+=" ":Y="",Y+B.linkInline}return O.match(/^[^>]+/,!0),B.linkInline}function b(O,k){if(O.eatSpace())return null;var K=O.next();return K==="("||K==="["?(k.f=k.inline=E(K==="("?")":"]"),L.highlightFormatting&&(k.formatting="link-string"),k.linkHref=!0,f(k)):"error"}var g={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function E(O){return function(k,K){var Y=k.next();if(Y===O){K.f=K.inline=d,L.highlightFormatting&&(K.formatting="link-string");var q=f(K);return K.linkHref=!1,q}return k.match(g[O]),K.linkHref=!0,f(K)}}function M(O,k){return O.match(/^([^\]\\]|\\.)*\]:/,!1)?(k.f=F,O.next(),L.highlightFormatting&&(k.formatting="link"),k.linkText=!0,f(k)):l(O,k,d)}function F(O,k){if(O.match(/^\]:/,!0)){k.f=k.inline=j,L.highlightFormatting&&(k.formatting="link");var K=f(k);return k.linkText=!1,K}return O.match(/^([^\]\\]|\\.)+/,!0),B.linkText}function j(O,k){return O.eatSpace()?null:(O.match(/^[^\s]+/,!0),O.peek()===void 0?k.linkTitle=!0:O.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),k.f=k.inline=d,B.linkHref+" url")}var W={startState:function(){return{f:c,prevLine:{stream:null},thisLine:{stream:null},block:c,htmlState:null,indentation:0,inline:d,text:h,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(O){return{f:O.f,prevLine:O.prevLine,thisLine:O.thisLine,block:O.block,htmlState:O.htmlState&&re.copyState(z,O.htmlState),indentation:O.indentation,localMode:O.localMode,localState:O.localMode?re.copyState(O.localMode,O.localState):null,inline:O.inline,text:O.text,formatting:!1,linkText:O.linkText,linkTitle:O.linkTitle,linkHref:O.linkHref,code:O.code,em:O.em,strong:O.strong,strikethrough:O.strikethrough,emoji:O.emoji,header:O.header,setext:O.setext,hr:O.hr,taskList:O.taskList,list:O.list,listStack:O.listStack.slice(0),quote:O.quote,indentedCode:O.indentedCode,trailingSpace:O.trailingSpace,trailingSpaceNewLine:O.trailingSpaceNewLine,md_inside:O.md_inside,fencedEndRE:O.fencedEndRE}},token:function(O,k){if(k.formatting=!1,O!=k.thisLine.stream){if(k.header=0,k.hr=!1,O.match(/^\s*$/,!0))return p(k),null;if(k.prevLine=k.thisLine,k.thisLine={stream:O},k.taskList=!1,k.trailingSpace=0,k.trailingSpaceNewLine=!1,!k.localState&&(k.f=k.block,k.f!=A)){var K=O.match(/^\s*/,!0)[0].replace(/\t/g,o).length;if(k.indentation=K,k.indentationDiff=null,K>0)return null}}return k.f(O,k)},innerMode:function(O){return O.block==A?{state:O.htmlState,mode:z}:O.localState?{state:O.localState,mode:O.localMode}:{state:O,mode:W}},indent:function(O,k,K){return O.block==A&&z.indent?z.indent(O.htmlState,k,K):O.localState&&O.localMode.indent?O.localMode.indent(O.localState,k,K):re.Pass},blankLine:p,getType:f,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return W},"xml"),re.defineMIME("text/markdown","markdown"),re.defineMIME("text/x-markdown","markdown")})},osHv:function(ft,rt,ne){(function(re){re(ne("VrN/"))})(function(re){"use strict";var X=re.Pos;function L(u,o){return u.line-o.line||u.ch-o.ch}var z="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",I=z+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",R=new RegExp("<(/?)(["+z+"]["+I+"]*)","g");function B(u,o,l,s){this.line=o,this.ch=l,this.cm=u,this.text=u.getLine(o),this.min=s?Math.max(s.from,u.firstLine()):u.firstLine(),this.max=s?Math.min(s.to-1,u.lastLine()):u.lastLine()}function U(u,o){var l=u.cm.getTokenTypeAt(X(u.line,o));return l&&/\btag\b/.test(l)}function P(u){return u.line>=u.max?void 0:(u.ch=0,u.text=u.cm.getLine(++u.line),!0)}function D(u){return u.line<=u.min?void 0:(u.text=u.cm.getLine(--u.line),u.ch=u.text.length,!0)}function v(u){for(;;){var o=u.text.indexOf(">",u.ch);if(o==-1){if(P(u))continue;return}if(!U(u,o+1)){u.ch=o+1;continue}var l=u.text.lastIndexOf("/",o),s=l>-1&&!/\S/.test(u.text.slice(l+1,o));return u.ch=o+1,s?"selfClose":"regular"}}function S(u){for(;;){var o=u.ch?u.text.lastIndexOf("<",u.ch-1):-1;if(o==-1){if(D(u))continue;return}if(!U(u,o+1)){u.ch=o;continue}R.lastIndex=o,u.ch=o;var l=R.exec(u.text);if(l&&l.index==o)return l}}function _(u){for(;;){R.lastIndex=u.ch;var o=R.exec(u.text);if(!o){if(P(u))continue;return}if(!U(u,o.index+1)){u.ch=o.index+1;continue}return u.ch=o.index+o[0].length,o}}function C(u){for(;;){var o=u.ch?u.text.lastIndexOf(">",u.ch-1):-1;if(o==-1){if(D(u))continue;return}if(!U(u,o+1)){u.ch=o;continue}var l=u.text.lastIndexOf("/",o),s=l>-1&&!/\S/.test(u.text.slice(l+1,o));return u.ch=o+1,s?"selfClose":"regular"}}function T(u,o){for(var l=[];;){var s=_(u),w,p=u.line,c=u.ch-(s?s[0].length:0);if(!s||!(w=v(u)))return;if(w=="selfClose")continue;if(s[1]){for(var A=l.length-1;A>=0;--A)if(l[A]==s[2]){l.length=A;break}if(A<0&&(!o||o==s[2]))return{tag:s[2],from:X(p,c),to:X(u.line,u.ch)}}else l.push(s[2])}}function m(u,o){for(var l=[];;){var s=C(u);if(!s)return;if(s=="selfClose"){S(u);continue}var w=u.line,p=u.ch,c=S(u);if(!c)return;if(c[1])l.push(c[2]);else{for(var A=l.length-1;A>=0;--A)if(l[A]==c[2]){l.length=A;break}if(A<0&&(!o||o==c[2]))return{tag:c[2],from:X(u.line,u.ch),to:X(w,p)}}}}re.registerHelper("fold","xml",function(u,o){for(var l=new B(u,o.line,0);;){var s=_(l);if(!s||l.line!=o.line)return;var w=v(l);if(!w)return;if(!s[1]&&w!="selfClose"){var p=X(l.line,l.ch),c=T(l,s[2]);return c&&L(c.from,p)>0?{from:p,to:c.from}:null}}}),re.findMatchingTag=function(u,o,l){var s=new B(u,o.line,o.ch,l);if(s.text.indexOf(">")==-1&&s.text.indexOf("<")==-1)return;var w=v(s),p=w&&X(s.line,s.ch),c=w&&S(s);if(!w||!c||L(s,o)>0)return;var A={from:X(s.line,s.ch),to:p,tag:c[2]};return w=="selfClose"?{open:A,close:null,at:"open"}:c[1]?{open:m(s,c[2]),close:A,at:"close"}:(s=new B(u,p.line,p.ch,l),{open:A,close:T(s,c[2]),at:"open"})},re.findEnclosingTag=function(u,o,l,s){for(var w=new B(u,o.line,o.ch,l);;){var p=m(w,s);if(!p)break;var c=new B(u,o.line,o.ch,l),A=T(c,p.tag);if(A)return{open:p,close:A}}},re.scanForClosingTag=function(u,o,l,s){var w=new B(u,o.line,o.ch,s?{from:0,to:s}:null);return T(w,l)}})},p0QG:function(ft,rt,ne){ft.exports={flex_box_center:"flex_box_center___2axlI",flex_space_between:"flex_space_between___F6m1U",flex_box_vertical_center:"flex_box_vertical_center___2GovZ",flex_box_center_end:"flex_box_center_end___2h9j0",flex_box_column:"flex_box_column___1kuIs",SubMentItem:"SubMentItem___34z-Y",MenuItem:"MenuItem___1bbPM",wrp:"wrp___3LRhb",classroomInfo:"classroomInfo___Ohxoq",title:"title___22ZLP",titleLeft:"titleLeft___1MP-h",titleRight:"titleRight___3zsz9",classroomUser:"classroomUser___1ePAN",headPic:"headPic___2lEg_",teacherInfo:"teacherInfo___3C0Dn",classroomDesc:"classroomDesc____QVZX",classroomDescBg:"classroomDescBg___1e7L7",joinCouses:"joinCouses___2G4vP",bg:"bg___2QojS",leftMenus:"leftMenus___34tjX",titleSelected:"titleSelected___K6QwW",menuText:"menuText___3qMqH",totalCount:"totalCount___R2q38",actions:"actions___26Ww0",task_count:"task_count___3UQ1V",container:"container___2EGM4",leftMenuActions:"leftMenuActions___3_J-1"}},p5ED:function(ft,rt,ne){"use strict";var re=ne("+L6B"),X=ne("2/Rp"),L=ne("5Dmo"),z=ne("3S7+"),I=ne("k1fw"),R=ne("tJVT"),B=ne("cDcd"),U=ne.n(B),P=ne("vHTk"),D=ne.n(P),v=ne("yEEn"),S=ne("ZW9T"),_=ne("1vsH");rt.a=function(C){var T=C.name,m=C.data,u=C.theme,o=C.type,l=C.filename,s=C.monacoEditor,w=C.className,p=C.style,c=C.close,A=C.onClose,y=C.hasMask,f=Object(B.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),h=Object(R.a)(f,2),d=h[0],a=h[1],b=Object(B.useState)(""),g=Object(R.a)(b,2),E=g[0],M=g[1],F,j=1024*1024,W=10*j,O=Object(B.useRef)();o==="office"&&(F=Object(_.V)(m).filesize,F>W&&(o="other")),l&&(s.filename=l),Object(B.useEffect)(function(){var Y,q,oe=(Y=document.cookie)===null||Y===void 0||((q=Y.replace(/\s/g,""))===null||q===void 0)?void 0:q.split(";");oe==null||oe.map(function(Te){var ve=Te.split("=");ve[0]==="_educoder_session"&&M(ve[1])})},[]);var k=function(){if(m.startsWith("http")||m.startsWith("blob:")){K();return}Object(_.z)(l||"educoder",m,l)},K=function(){Object(_.x)(l||"educoder",decodeURIComponent(m))};return console.log("data:",m,"fileanme:",l," name:",T),U.a.createElement("div",{style:Object(I.a)({},p||{}),className:"".concat(y&&D.a.bgBlack," ").concat(o?D.a.wrp:"hide")},c&&U.a.createElement("div",{className:D.a.close,ref:O},U.a.createElement(z.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return O.current}},U.a.createElement("span",{onClick:K},U.a.createElement("i",{className:"icon-quxiaozhiding"}))),U.a.createElement(z.a,{title:"\u5173\u95ED",getPopupContainer:function(){return O.current}},U.a.createElement("span",{className:"",onClick:A},U.a.createElement("i",{className:"icon-guanbi1"})))),U.a.createElement("div",{className:"".concat(D.a[w]," ").concat(w," ").concat(D.a.monaco," ").concat(o==="txt"?"show":"hide")},o==="txt"&&U.a.createElement(S.b,s)),o==="audio"&&U.a.createElement("audio",{src:"".concat(m!=null&&m.startsWith("/")||(m==null?void 0:m.indexOf("https://"))>-1?m:"data:audio/mp3;base64,").concat(m),autoPlay:!0}),o==="video"&&U.a.createElement(U.a.Fragment,null,m!=null&&m.startsWith("/")?U.a.createElement("video",{controls:!0,src:"".concat(m),autoPlay:!0}):U.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(m),autoPlay:!0})),o==="html"&&U.a.createElement("iframe",{src:m+"&disposition=inline"}),o==="html"&&U.a.createElement("iframe",{src:m+"&disposition=inline"}),o==="pdf"&&U.a.createElement("embed",{className:D.a.embed,src:m}),o==="image"&&U.a.createElement(U.a.Fragment,null,U.a.createElement("img",{src:"".concat(m!=null&&m.startsWith("/")||(m==null?void 0:m.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(m)})),o==="other"&&U.a.createElement("div",null,U.a.createElement(X.a,{type:"primary",size:"large",onClick:k},U.a.createElement(v.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),(o==="download"||o==="office")&&U.a.createElement(X.a,{type:"primary",size:"large",onClick:k},U.a.createElement(v.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(ft,rt,ne){},"rAM+":function(ft,rt,ne){"use strict";ne.d(rt,"a",function(){return X});var re=ne("Qw5x");function X(L,z){var I;if(typeof Symbol=="undefined"||L[Symbol.iterator]==null){if(Array.isArray(L)||(I=Object(re.a)(L))||z&&L&&typeof L.length=="number"){I&&(L=I);var R=0,B=function(){};return{s:B,n:function(){return R>=L.length?{done:!0}:{done:!1,value:L[R++]}},e:function(S){throw S},f:B}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var U=!0,P=!1,D;return{s:function(){I=L[Symbol.iterator]()},n:function(){var S=I.next();return U=S.done,S},e:function(S){P=!0,D=S},f:function(){try{!U&&I.return!=null&&I.return()}finally{if(P)throw D}}}}},rUJ1:function(ft,rt){const ne=/[&<>"']/,re=/[&<>"']/g,X=/[<>"']|&(?!#?\w+;)/,L=/[<>"']|&(?!#?\w+;)/g,z={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},I=y=>z[y];function R(y,f){if(f){if(ne.test(y))return y.replace(re,I)}else if(X.test(y))return y.replace(L,I);return y}const B=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function U(y){return y.replace(B,(f,h)=>(h=h.toLowerCase(),h==="colon"?":":h.charAt(0)==="#"?h.charAt(1)==="x"?String.fromCharCode(parseInt(h.substring(2),16)):String.fromCharCode(+h.substring(1)):""))}const P=/(^|[^\[])\^/g;function D(y,f){y=y.source||y,f=f||"";const h={replace:(d,a)=>(a=a.source||a,a=a.replace(P,"$1"),y=y.replace(d,a),h),getRegex:()=>new RegExp(y,f)};return h}const v=/[^\w:]/g,S=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function _(y,f,h){if(y){let d;try{d=decodeURIComponent(U(h)).replace(v,"").toLowerCase()}catch(a){return null}if(d.indexOf("javascript:")===0||d.indexOf("vbscript:")===0||d.indexOf("data:")===0)return null}f&&!S.test(h)&&(h=o(f,h));try{h=encodeURI(h).replace(/%25/g,"%")}catch(d){return null}return h}const C={},T=/^[^:]+:\/*[^/]*$/,m=/^([^:]+:)[\s\S]*$/,u=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(y,f){C[" "+y]||(T.test(y)?C[" "+y]=y+"/":C[" "+y]=p(y,"/",!0)),y=C[" "+y];const h=y.indexOf(":")===-1;return f.substring(0,2)==="//"?h?f:y.replace(m,"$1")+f:f.charAt(0)==="/"?h?f:y.replace(u,"$1")+f:y+f}const l={exec:function(){}};function s(y){let f=1,h,d;for(;f<arguments.length;f++){h=arguments[f];for(d in h)Object.prototype.hasOwnProperty.call(h,d)&&(y[d]=h[d])}return y}function w(y,f){const h=y.replace(/\|/g,(b,g,E)=>{let M=!1,F=g;for(;--F>=0&&E[F]==="\\";)M=!M;return M?"|":" |"}),d=h.split(/ \|/);let a=0;if(d.length>f)d.splice(f);else for(;d.length<f;)d.push("");for(;a<d.length;a++)d[a]=d[a].trim().replace(/\\\|/g,"|");return d}function p(y,f,h){const d=y.length;if(d===0)return"";let a=0;for(;a<d;){const b=y.charAt(d-a-1);if(b===f&&!h)a++;else if(b!==f&&h)a++;else break}return y.substr(0,d-a)}function c(y,f){if(y.indexOf(f[1])===-1)return-1;const h=y.length;let d=0,a=0;for(;a<h;a++)if(y[a]==="\\")a++;else if(y[a]===f[0])d++;else if(y[a]===f[1]&&(d--,d<0))return a;return-1}function A(y){y&&y.sanitize&&!y.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")}ft.exports={escape:R,unescape:U,edit:D,cleanUrl:_,resolveUrl:o,noopTest:l,merge:s,splitCells:w,rtrim:p,findClosingBracket:c,checkSanitizeDeprecation:A}},ulZh:function(ft,rt,ne){typeof window!="undefined"&&function(X,L){ft.exports=L()}(this,function(){return function(re){var X={};function L(z){if(X[z])return X[z].exports;var I=X[z]={i:z,l:!1,exports:{}};return re[z].call(I.exports,I,I.exports,L),I.l=!0,I.exports}return L.m=re,L.c=X,L.d=function(z,I,R){L.o(z,I)||Object.defineProperty(z,I,{enumerable:!0,get:R})},L.r=function(z){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(z,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(z,"__esModule",{value:!0})},L.t=function(z,I){if(I&1&&(z=L(z)),I&8)return z;if(I&4&&typeof z=="object"&&z&&z.__esModule)return z;var R=Object.create(null);if(L.r(R),Object.defineProperty(R,"default",{enumerable:!0,value:z}),I&2&&typeof z!="string")for(var B in z)L.d(R,B,function(U){return z[U]}.bind(null,B));return R},L.n=function(z){var I=z&&z.__esModule?function(){return z.default}:function(){return z};return L.d(I,"a",I),I},L.o=function(z,I){return Object.prototype.hasOwnProperty.call(z,I)},L.p="/dist/",L(L.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(re,X,L){"use strict";var z=Object.prototype.hasOwnProperty,I="~";function R(){}Object.create&&(R.prototype=Object.create(null),new R().__proto__||(I=!1));function B(v,S,_){this.fn=v,this.context=S,this.once=_||!1}function U(v,S,_,C,T){if(typeof _!="function")throw new TypeError("The listener must be a function");var m=new B(_,C||v,T),u=I?I+S:S;return v._events[u]?v._events[u].fn?v._events[u]=[v._events[u],m]:v._events[u].push(m):(v._events[u]=m,v._eventsCount++),v}function P(v,S){--v._eventsCount===0?v._events=new R:delete v._events[S]}function D(){this._events=new R,this._eventsCount=0}D.prototype.eventNames=function(){var S=[],_,C;if(this._eventsCount===0)return S;for(C in _=this._events)z.call(_,C)&&S.push(I?C.slice(1):C);return Object.getOwnPropertySymbols?S.concat(Object.getOwnPropertySymbols(_)):S},D.prototype.listeners=function(S){var _=I?I+S:S,C=this._events[_];if(!C)return[];if(C.fn)return[C.fn];for(var T=0,m=C.length,u=new Array(m);T<m;T++)u[T]=C[T].fn;return u},D.prototype.listenerCount=function(S){var _=I?I+S:S,C=this._events[_];return C?C.fn?1:C.length:0},D.prototype.emit=function(S,_,C,T,m,u){var o=I?I+S:S;if(!this._events[o])return!1;var l=this._events[o],s=arguments.length,w,p;if(l.fn){l.once&&this.removeListener(S,l.fn,void 0,!0);switch(s){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,_),!0;case 3:return l.fn.call(l.context,_,C),!0;case 4:return l.fn.call(l.context,_,C,T),!0;case 5:return l.fn.call(l.context,_,C,T,m),!0;case 6:return l.fn.call(l.context,_,C,T,m,u),!0}for(p=1,w=new Array(s-1);p<s;p++)w[p-1]=arguments[p];l.fn.apply(l.context,w)}else{var c=l.length,A;for(p=0;p<c;p++){l[p].once&&this.removeListener(S,l[p].fn,void 0,!0);switch(s){case 1:l[p].fn.call(l[p].context);break;case 2:l[p].fn.call(l[p].context,_);break;case 3:l[p].fn.call(l[p].context,_,C);break;case 4:l[p].fn.call(l[p].context,_,C,T);break;default:if(!w)for(A=1,w=new Array(s-1);A<s;A++)w[A-1]=arguments[A];l[p].fn.apply(l[p].context,w)}}}return!0},D.prototype.on=function(S,_,C){return U(this,S,_,C,!1)},D.prototype.once=function(S,_,C){return U(this,S,_,C,!0)},D.prototype.removeListener=function(S,_,C,T){var m=I?I+S:S;if(!this._events[m])return this;if(!_)return P(this,m),this;var u=this._events[m];if(u.fn)u.fn===_&&(!T||u.once)&&(!C||u.context===C)&&P(this,m);else{for(var o=0,l=[],s=u.length;o<s;o++)(u[o].fn!==_||T&&!u[o].once||C&&u[o].context!==C)&&l.push(u[o]);l.length?this._events[m]=l.length===1?l[0]:l:P(this,m)}return this},D.prototype.removeAllListeners=function(S){var _;return S?(_=I?I+S:S,this._events[_]&&P(this,_)):(this._events=new R,this._eventsCount=0),this},D.prototype.off=D.prototype.removeListener,D.prototype.addListener=D.prototype.on,D.prefixed=I,D.EventEmitter=D,re.exports=D},"./node_modules/url-toolkit/src/url-toolkit.js":function(re,X,L){(function(z){var I=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,R=/^([^\/?#]*)([^]*)$/,B=/(?:\/|^)\.(?=\/)/g,U=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,P={buildAbsoluteURL:function(D,v,S){if(S=S||{},D=D.trim(),v=v.trim(),!v){if(!S.alwaysNormalize)return D;var _=P.parseURL(D);if(!_)throw new Error("Error trying to parse base URL.");return _.path=P.normalizePath(_.path),P.buildURLFromParts(_)}var C=P.parseURL(v);if(!C)throw new Error("Error trying to parse relative URL.");if(C.scheme)return S.alwaysNormalize?(C.path=P.normalizePath(C.path),P.buildURLFromParts(C)):v;var T=P.parseURL(D);if(!T)throw new Error("Error trying to parse base URL.");if(!T.netLoc&&T.path&&T.path[0]!=="/"){var m=R.exec(T.path);T.netLoc=m[1],T.path=m[2]}T.netLoc&&!T.path&&(T.path="/");var u={scheme:T.scheme,netLoc:C.netLoc,path:null,params:C.params,query:C.query,fragment:C.fragment};if(!C.netLoc&&(u.netLoc=T.netLoc,C.path[0]!=="/"))if(!C.path)u.path=T.path,C.params||(u.params=T.params,C.query||(u.query=T.query));else{var o=T.path,l=o.substring(0,o.lastIndexOf("/")+1)+C.path;u.path=P.normalizePath(l)}return u.path===null&&(u.path=S.alwaysNormalize?P.normalizePath(C.path):C.path),P.buildURLFromParts(u)},parseURL:function(D){var v=I.exec(D);return v?{scheme:v[1]||"",netLoc:v[2]||"",path:v[3]||"",params:v[4]||"",query:v[5]||"",fragment:v[6]||""}:null},normalizePath:function(D){for(D=D.split("").reverse().join("").replace(B,"");D.length!==(D=D.replace(U,"")).length;);return D.split("").reverse().join("")},buildURLFromParts:function(D){return D.scheme+D.netLoc+D.path+D.params+D.query+D.fragment}};re.exports=P})(this)},"./node_modules/webworkify-webpack/index.js":function(re,X,L){function z(S){var _={};function C(m){if(_[m])return _[m].exports;var u=_[m]={i:m,l:!1,exports:{}};return S[m].call(u.exports,u,u.exports,C),u.l=!0,u.exports}C.m=S,C.c=_,C.i=function(m){return m},C.d=function(m,u,o){C.o(m,u)||Object.defineProperty(m,u,{configurable:!1,enumerable:!0,get:o})},C.r=function(m){Object.defineProperty(m,"__esModule",{value:!0})},C.n=function(m){var u=m&&m.__esModule?function(){return m.default}:function(){return m};return C.d(u,"a",u),u},C.o=function(m,u){return Object.prototype.hasOwnProperty.call(m,u)},C.p="/",C.oe=function(m){throw console.error(m),m};var T=C(C.s=ENTRY_MODULE);return T.default||T}var I="[\\.|\\-|\\+|\\w|/|@]+",R="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+I+").*?\\)";function B(S){return(S+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function U(S){return!isNaN(1*S)}function P(S,_,C){var T={};T[C]=[];var m=_.toString(),u=m.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!u)return T;for(var o=u[1],l=new RegExp("(\\\\n|\\W)"+B(o)+R,"g"),s;s=l.exec(m);){if(s[3]==="dll-reference")continue;T[C].push(s[3])}for(l=new RegExp("\\("+B(o)+'\\("(dll-reference\\s('+I+'))"\\)\\)'+R,"g");s=l.exec(m);)S[s[2]]||(T[C].push(s[1]),S[s[2]]=L(s[1]).m),T[s[2]]=T[s[2]]||[],T[s[2]].push(s[4]);for(var w=Object.keys(T),p=0;p<w.length;p++)for(var c=0;c<T[w[p]].length;c++)U(T[w[p]][c])&&(T[w[p]][c]=1*T[w[p]][c]);return T}function D(S){var _=Object.keys(S);return _.reduce(function(C,T){return C||S[T].length>0},!1)}function v(S,_){for(var C={main:[_]},T={main:[]},m={main:{}};D(C);)for(var u=Object.keys(C),o=0;o<u.length;o++){var l=u[o],s=C[l],w=s.pop();if(m[l]=m[l]||{},m[l][w]||!S[l][w])continue;m[l][w]=!0,T[l]=T[l]||[],T[l].push(w);for(var p=P(S,S[l][w],l),c=Object.keys(p),A=0;A<c.length;A++)C[c[A]]=C[c[A]]||[],C[c[A]]=C[c[A]].concat(p[c[A]])}return T}re.exports=function(S,_){_=_||{};var C={main:L.m},T=_.all?{main:Object.keys(C.main)}:v(C,S),m="";Object.keys(T).filter(function(w){return w!=="main"}).forEach(function(w){for(var p=0;T[w][p];)p++;T[w].push(p),C[w][p]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",m=m+"var "+w+" = ("+z.toString().replace("ENTRY_MODULE",JSON.stringify(p))+")({"+T[w].map(function(c){return""+JSON.stringify(c)+": "+C[w][c].toString()}).join(",")+`});
`}),m=m+"new (("+z.toString().replace("ENTRY_MODULE",JSON.stringify(S))+")({"+T.main.map(function(w){return""+JSON.stringify(w)+": "+C.main[w].toString()}).join(",")+"}))(self);";var u=new window.Blob([m],{type:"text/javascript"});if(_.bare)return u;var o=window.URL||window.webkitURL||window.mozURL||window.msURL,l=o.createObjectURL(u),s=new window.Worker(l);return s.objectURL=l,s}},"./src/config.ts":function(re,X,L){"use strict";L.r(X),L.d(X,"hlsDefaultConfig",function(){return A}),L.d(X,"mergeConfig",function(){return f}),L.d(X,"enableStreamingMode",function(){return h});var z=L("./src/controller/abr-controller.ts"),I=L("./src/controller/audio-stream-controller.ts"),R=L("./src/controller/audio-track-controller.ts"),B=L("./src/controller/subtitle-stream-controller.ts"),U=L("./src/controller/subtitle-track-controller.ts"),P=L("./src/controller/buffer-controller.ts"),D=L("./src/controller/timeline-controller.ts"),v=L("./src/controller/cap-level-controller.ts"),S=L("./src/controller/fps-controller.ts"),_=L("./src/controller/eme-controller.ts"),C=L("./src/controller/cmcd-controller.ts"),T=L("./src/utils/xhr-loader.ts"),m=L("./src/utils/fetch-loader.ts"),u=L("./src/utils/cues.ts"),o=L("./src/utils/mediakeys-helper.ts"),l=L("./src/utils/logger.ts");function s(){return s=Object.assign||function(d){for(var a=1;a<arguments.length;a++){var b=arguments[a];for(var g in b)Object.prototype.hasOwnProperty.call(b,g)&&(d[g]=b[g])}return d},s.apply(this,arguments)}function w(d,a){var b=Object.keys(d);if(Object.getOwnPropertySymbols){var g=Object.getOwnPropertySymbols(d);a&&(g=g.filter(function(E){return Object.getOwnPropertyDescriptor(d,E).enumerable})),b.push.apply(b,g)}return b}function p(d){for(var a=1;a<arguments.length;a++){var b=arguments[a]!=null?arguments[a]:{};a%2?w(Object(b),!0).forEach(function(g){c(d,g,b[g])}):Object.getOwnPropertyDescriptors?Object.defineProperties(d,Object.getOwnPropertyDescriptors(b)):w(Object(b)).forEach(function(g){Object.defineProperty(d,g,Object.getOwnPropertyDescriptor(b,g))})}return d}function c(d,a,b){return a in d?Object.defineProperty(d,a,{value:b,enumerable:!0,configurable:!0,writable:!0}):d[a]=b,d}var A=p(p({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:T.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:z.default,bufferController:P.default,capLevelController:v.default,fpsController:S.default,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:o.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},y()),{},{subtitleStreamController:B.SubtitleStreamController,subtitleTrackController:U.default,timelineController:D.TimelineController,audioStreamController:I.default,audioTrackController:R.default,emeController:_.default,cmcdController:C.default});function y(){return{cueHandler:u.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,a){if((a.liveSyncDurationCount||a.liveMaxLatencyDurationCount)&&(a.liveSyncDuration||a.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(a.liveMaxLatencyDurationCount!==void 0&&(a.liveSyncDurationCount===void 0||a.liveMaxLatencyDurationCount<=a.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(a.liveMaxLatencyDuration!==void 0&&(a.liveSyncDuration===void 0||a.liveMaxLatencyDuration<=a.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return s({},d,a)}function h(d){var a=d.loader;if(a!==m.default&&a!==T.default)l.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),d.progressive=!1;else{var b=Object(m.fetchSupported)();b&&(d.loader=m.default,d.progressive=!0,d.enableSoftwareAES=!0,l.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(re,X,L){"use strict";L.r(X);var z=L("./src/polyfills/number.ts"),I=L("./src/utils/ewma-bandwidth-estimator.ts"),R=L("./src/events.ts"),B=L("./src/utils/buffer-helper.ts"),U=L("./src/errors.ts"),P=L("./src/types/loader.ts"),D=L("./src/utils/logger.ts");function v(C,T){for(var m=0;m<T.length;m++){var u=T[m];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(C,u.key,u)}}function S(C,T,m){return T&&v(C.prototype,T),m&&v(C,m),C}var _=function(){function C(m){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=m;var u=m.config;this.bwEstimator=new I.default(u.abrEwmaSlowVoD,u.abrEwmaFastVoD,u.abrEwmaDefaultEstimate),this.registerListeners()}var T=C.prototype;return T.registerListeners=function(){var u=this.hls;u.on(R.Events.FRAG_LOADING,this.onFragLoading,this),u.on(R.Events.FRAG_LOADED,this.onFragLoaded,this),u.on(R.Events.FRAG_BUFFERED,this.onFragBuffered,this),u.on(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.on(R.Events.ERROR,this.onError,this)},T.unregisterListeners=function(){var u=this.hls;u.off(R.Events.FRAG_LOADING,this.onFragLoading,this),u.off(R.Events.FRAG_LOADED,this.onFragLoaded,this),u.off(R.Events.FRAG_BUFFERED,this.onFragBuffered,this),u.off(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.off(R.Events.ERROR,this.onError,this)},T.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},T.onFragLoading=function(u,o){var l=o.frag;if(l.type===P.PlaylistLevelType.MAIN&&!this.timer){var s;this.fragCurrent=l,this.partCurrent=(s=o.part)!=null?s:null,this.timer=self.setInterval(this.onCheck,100)}},T.onLevelLoaded=function(u,o){var l=this.hls.config;o.details.live?this.bwEstimator.update(l.abrEwmaSlowLive,l.abrEwmaFastLive):this.bwEstimator.update(l.abrEwmaSlowVoD,l.abrEwmaFastVoD)},T._abandonRulesCheck=function(){var u=this.fragCurrent,o=this.partCurrent,l=this.hls,s=l.autoLevelEnabled,w=l.config,p=l.media;if(!u||!p)return;var c=o?o.stats:u.stats,A=o?o.duration:u.duration;if(c.aborted){D.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!s||p.paused||!p.playbackRate||!p.readyState)return;var y=performance.now()-c.loading.start,f=Math.abs(p.playbackRate);if(y<=500*A/f)return;var h=l.levels,d=l.minAutoLevel,a=h[u.level],b=c.total||Math.max(c.loaded,Math.round(A*a.maxBitrate/8)),g=Math.max(1,c.bwEstimate?c.bwEstimate/8:c.loaded*1e3/y),E=(b-c.loaded)/g,M=p.currentTime,F=(B.BufferHelper.bufferInfo(p,M,w.maxBufferHole).end-M)/f;if(F>=2*A/f||E<=F)return;var j=Number.POSITIVE_INFINITY,W;for(W=u.level-1;W>d;W--){var O=h[W].maxBitrate;if(j=A*O/(8*.8*g),j<F)break}if(j>=E)return;var k=this.bwEstimator.getEstimate();D.logger.warn("Fragment "+u.sn+(o?" part "+o.index:"")+" of level "+u.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+W+`
Current BW estimate: `+(Object(z.isFiniteNumber)(k)?(k/1024).toFixed(3):"Unknown")+` Kb/s
Estimated load time for current fragment: `+E.toFixed(3)+` s
Estimated load time for the next fragment: `+j.toFixed(3)+` s
Time to underbuffer: `+F.toFixed(3)+" s"),l.nextLoadLevel=W,this.bwEstimator.sample(y,c.loaded),this.clearTimer(),u.loader&&(this.fragCurrent=this.partCurrent=null,u.loader.abort()),l.trigger(R.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:u,part:o,stats:c})},T.onFragLoaded=function(u,o){var l=o.frag,s=o.part;if(l.type===P.PlaylistLevelType.MAIN&&Object(z.isFiniteNumber)(l.sn)){var w=s?s.stats:l.stats,p=s?s.duration:l.duration;if(this.clearTimer(),this.lastLoadedFragLevel=l.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var c=this.hls.levels[l.level],A=(c.loaded?c.loaded.bytes:0)+w.loaded,y=(c.loaded?c.loaded.duration:0)+p;c.loaded={bytes:A,duration:y},c.realBitrate=Math.round(8*A/y)}if(l.bitrateTest){var f={stats:w,frag:l,part:s,id:l.type};this.onFragBuffered(R.Events.FRAG_BUFFERED,f),l.bitrateTest=!1}}},T.onFragBuffered=function(u,o){var l=o.frag,s=o.part,w=s?s.stats:l.stats;if(w.aborted)return;if(l.type!==P.PlaylistLevelType.MAIN||l.sn==="initSegment")return;var p=w.parsing.end-w.loading.start;this.bwEstimator.sample(p,w.loaded),w.bwEstimate=this.bwEstimator.getEstimate(),l.bitrateTest?this.bitrateTestDelay=p/1e3:this.bitrateTestDelay=0},T.onError=function(u,o){switch(o.details){case U.ErrorDetails.FRAG_LOAD_ERROR:case U.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},T.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},T.getNextABRAutoLevel=function(){var u=this.fragCurrent,o=this.partCurrent,l=this.hls,s=l.maxAutoLevel,w=l.config,p=l.minAutoLevel,c=l.media,A=o?o.duration:u?u.duration:0,y=c?c.currentTime:0,f=c&&c.playbackRate!==0?Math.abs(c.playbackRate):1,h=this.bwEstimator?this.bwEstimator.getEstimate():w.abrEwmaDefaultEstimate,d=(B.BufferHelper.bufferInfo(c,y,w.maxBufferHole).end-y)/f,a=this.findBestLevel(h,p,s,d,w.abrBandWidthFactor,w.abrBandWidthUpFactor);if(a>=0)return a;D.logger.trace((d?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var b=A?Math.min(A,w.maxStarvationDelay):w.maxStarvationDelay,g=w.abrBandWidthFactor,E=w.abrBandWidthUpFactor;if(!d){var M=this.bitrateTestDelay;if(M){var F=A?Math.min(A,w.maxLoadingDelay):w.maxLoadingDelay;b=F-M,D.logger.trace("bitrate test took "+Math.round(1e3*M)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*b)+" ms"),g=E=1}}return a=this.findBestLevel(h,p,s,d+b,g,E),Math.max(a,0)},T.findBestLevel=function(u,o,l,s,w,p){for(var c,A=this.fragCurrent,y=this.partCurrent,f=this.lastLoadedFragLevel,h=this.hls.levels,d=h[f],a=!!(d!=null&&(c=d.details)!==null&&c!==void 0&&c.live),b=d==null?void 0:d.codecSet,g=y?y.duration:A?A.duration:0,E=l;E>=o;E--){var M=h[E];if(!M||b&&M.codecSet!==b)continue;var F=M.details,j=(y?F==null?void 0:F.partTarget:F==null?void 0:F.averagetargetduration)||g,W=void 0;E<=f?W=w*u:W=p*u;var O=h[E].maxBitrate,k=O*j/W;if(D.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+E+"/"+Math.round(W)+"/"+O+"/"+j+"/"+s+"/"+k),W>O&&(!k||a&&!this.bitrateTestDelay||k<s))return E}return-1},S(C,[{key:"nextAutoLevel",get:function(){var u=this._nextAutoLevel,o=this.bwEstimator;if(u!==-1&&(!o||!o.canEstimate()))return u;var l=this.getNextABRAutoLevel();return u!==-1&&(l=Math.min(u,l)),l},set:function(u){this._nextAutoLevel=u}}]),C}();X.default=_},"./src/controller/audio-stream-controller.ts":function(re,X,L){"use strict";L.r(X);var z=L("./src/polyfills/number.ts"),I=L("./src/controller/base-stream-controller.ts"),R=L("./src/events.ts"),B=L("./src/utils/buffer-helper.ts"),U=L("./src/controller/fragment-tracker.ts"),P=L("./src/types/level.ts"),D=L("./src/types/loader.ts"),v=L("./src/loader/fragment.ts"),S=L("./src/demux/chunk-cache.ts"),_=L("./src/demux/transmuxer-interface.ts"),C=L("./src/types/transmuxer.ts"),T=L("./src/controller/fragment-finders.ts"),m=L("./src/utils/discontinuities.ts"),u=L("./src/errors.ts"),o=L("./src/utils/logger.ts");function l(){return l=Object.assign||function(A){for(var y=1;y<arguments.length;y++){var f=arguments[y];for(var h in f)Object.prototype.hasOwnProperty.call(f,h)&&(A[h]=f[h])}return A},l.apply(this,arguments)}function s(A,y){A.prototype=Object.create(y.prototype),A.prototype.constructor=A,w(A,y)}function w(A,y){return w=Object.setPrototypeOf||function(h,d){return h.__proto__=d,h},w(A,y)}var p=100,c=function(A){s(y,A);function y(h,d){var a;return a=A.call(this,h,d,"[audio-stream-controller]")||this,a.videoBuffer=null,a.videoTrackCC=-1,a.waitingVideoCC=-1,a.audioSwitch=!1,a.trackId=-1,a.waitingData=null,a.mainDetails=null,a.bufferFlushed=!1,a._registerListeners(),a}var f=y.prototype;return f.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},f._registerListeners=function(){var d=this.hls;d.on(R.Events.MEDIA_ATTACHED,this.onMediaAttached,this),d.on(R.Events.MEDIA_DETACHING,this.onMediaDetaching,this),d.on(R.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.on(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.on(R.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),d.on(R.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),d.on(R.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.on(R.Events.ERROR,this.onError,this),d.on(R.Events.BUFFER_RESET,this.onBufferReset,this),d.on(R.Events.BUFFER_CREATED,this.onBufferCreated,this),d.on(R.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),d.on(R.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),d.on(R.Events.FRAG_BUFFERED,this.onFragBuffered,this)},f._unregisterListeners=function(){var d=this.hls;d.off(R.Events.MEDIA_ATTACHED,this.onMediaAttached,this),d.off(R.Events.MEDIA_DETACHING,this.onMediaDetaching,this),d.off(R.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.off(R.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.off(R.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),d.off(R.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),d.off(R.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.off(R.Events.ERROR,this.onError,this),d.off(R.Events.BUFFER_RESET,this.onBufferReset,this),d.off(R.Events.BUFFER_CREATED,this.onBufferCreated,this),d.off(R.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),d.off(R.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),d.off(R.Events.FRAG_BUFFERED,this.onFragBuffered,this)},f.onInitPtsFound=function(d,a){var b=a.frag,g=a.id,E=a.initPTS;if(g==="main"){var M=b.cc;this.initPTS[b.cc]=E,this.log("InitPTS for cc: "+M+" found from main: "+E),this.videoTrackCC=M,this.state===I.State.WAITING_INIT_PTS&&this.tick()}},f.startLoad=function(d){if(!this.levels){this.startPosition=d,this.state=I.State.STOPPED;return}var a=this.lastCurrentTime;this.stopLoad(),this.setInterval(p),this.fragLoadError=0,a>0&&d===-1?(this.log("Override startPosition with lastCurrentTime @"+a.toFixed(3)),this.state=I.State.IDLE):(this.loadedmetadata=!1,this.state=I.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=d,this.tick()},f.doTick=function(){switch(this.state){case I.State.IDLE:this.doTickIdle();break;case I.State.WAITING_TRACK:{var d,a=this.levels,b=this.trackId,g=a==null||((d=a[b])===null||d===void 0)?void 0:d.details;if(g){if(this.waitForCdnTuneIn(g))break;this.state=I.State.WAITING_INIT_PTS}break}case I.State.FRAG_LOADING_WAITING_RETRY:{var E,M=performance.now(),F=this.retryDate;(!F||M>=F||(E=this.media)!==null&&E!==void 0&&E.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=I.State.IDLE);break}case I.State.WAITING_INIT_PTS:{var j=this.waitingData;if(j){var W=j.frag,O=j.part,k=j.cache,K=j.complete;if(this.initPTS[W.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=I.State.FRAG_LOADING;var Y=k.flush(),q={frag:W,part:O,payload:Y,networkDetails:null};this._handleFragmentLoadProgress(q),K&&A.prototype._handleFragmentLoadComplete.call(this,q)}else if(this.videoTrackCC!==this.waitingVideoCC)o.logger.log("Waiting fragment cc ("+W.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var oe=this.getLoadPosition(),Te=B.BufferHelper.bufferInfo(this.mediaBuffer,oe,this.config.maxBufferHole),ve=Object(T.fragmentWithinToleranceTest)(Te.end,this.config.maxFragLookUpTolerance,W);ve<0&&(o.logger.log("Waiting fragment cc ("+W.cc+") @ "+W.start+" cancelled because another fragment at "+Te.end+" is needed"),this.clearWaitingFragment())}}else this.state=I.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=I.State.IDLE)},f.onTickEnd=function(){var d=this.media;if(!d||!d.readyState)return;var a=this.mediaBuffer?this.mediaBuffer:d,b=a.buffered;!this.loadedmetadata&&b.length&&(this.loadedmetadata=!0),this.lastCurrentTime=d.currentTime},f.doTickIdle=function(){var d,a,b=this.hls,g=this.levels,E=this.media,M=this.trackId,F=b.config;if(!g||!g[M])return;if(!E&&(this.startFragRequested||!F.startFragPrefetch))return;var j=g[M],W=j.details;if(!W||W.live&&this.levelLastLoaded!==M||this.waitForCdnTuneIn(W)){this.state=I.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,v.ElementaryStreamTypes.AUDIO,D.PlaylistLevelType.AUDIO));var O=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,D.PlaylistLevelType.AUDIO);if(O===null)return;var k=O.len,K=this.getMaxBufferLength(),Y=this.audioSwitch;if(k>=K&&!Y)return;if(!Y&&this._streamEnded(O,W)){b.trigger(R.Events.BUFFER_EOS,{type:"audio"}),this.state=I.State.ENDED;return}var q=W.fragments,oe=q[0].start,Te=O.end;if(Y){var ve=this.getLoadPosition();Te=ve,W.PTSKnown&&ve<oe&&((O.end>oe||O.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),E.currentTime=oe+.05))}var ge=this.getNextFragment(Te,W);if(!ge){this.bufferFlushed=!0;return}((d=ge.decryptdata)===null||d===void 0?void 0:d.keyFormat)==="identity"&&!((a=ge.decryptdata)!==null&&a!==void 0&&a.key)?this.loadKey(ge,W):this.loadFragment(ge,W,Te)},f.getMaxBufferLength=function(){var d=A.prototype.getMaxBufferLength.call(this),a=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,D.PlaylistLevelType.MAIN);return a===null?d:Math.max(d,a.len)},f.onMediaDetaching=function(){this.videoBuffer=null,A.prototype.onMediaDetaching.call(this)},f.onAudioTracksUpdated=function(d,a){var b=a.audioTracks;this.resetTransmuxer(),this.levels=b.map(function(g){return new P.Level(g)})},f.onAudioTrackSwitching=function(d,a){var b=!!a.url;this.trackId=a.id;var g=this.fragCurrent;g!=null&&g.loader&&g.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),b?this.setInterval(p):this.resetTransmuxer(),b?(this.audioSwitch=!0,this.state=I.State.IDLE):this.state=I.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,a){this.mainDetails=a.details},f.onAudioTrackLoaded=function(d,a){var b,g=this.levels,E=a.details,M=a.id;if(!g){this.warn("Audio tracks were reset while loading level "+M);return}this.log("Track "+M+" loaded ["+E.startSN+","+E.endSN+"],duration:"+E.totalduration);var F=g[M],j=0;if(E.live||(b=F.details)!==null&&b!==void 0&&b.live){var W=this.mainDetails;if(E.fragments[0]||(E.deltaUpdateFailed=!0),E.deltaUpdateFailed||!W)return;!F.details&&E.hasProgramDateTime&&W.hasProgramDateTime?(Object(m.alignMediaPlaylistByPDT)(E,W),j=E.fragments[0].start):j=this.alignPlaylists(E,F.details)}F.details=E,this.levelLastLoaded=M,!this.startFragRequested&&(this.mainDetails||!E.live)&&this.setStartPosition(F.details,j),this.state===I.State.WAITING_TRACK&&!this.waitForCdnTuneIn(E)&&(this.state=I.State.IDLE),this.tick()},f._handleFragmentLoadProgress=function(d){var a,b=d.frag,g=d.part,E=d.payload,M=this.config,F=this.trackId,j=this.levels;if(!j){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+b.sn+" of level "+b.level+" will not be buffered");return}var W=j[F];console.assert(W,"Audio track is defined on fragment load progress");var O=W.details;console.assert(O,"Audio track details are defined on fragment load progress");var k=M.defaultAudioCodec||W.audioCodec||"mp4a.40.2",K=this.transmuxer;K||(K=this.transmuxer=new _.default(this.hls,D.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var Y=this.initPTS[b.cc],q=(a=b.initSegment)===null||a===void 0?void 0:a.data;if(Y!==void 0){var oe=!1,Te=g?g.index:-1,ve=Te!==-1,ge=new C.ChunkMetadata(b.level,b.sn,b.stats.chunkCount,E.byteLength,Te,ve);K.push(E,q,k,"",b,g,O.totalduration,oe,ge,Y)}else{o.logger.log("Unknown video PTS for cc "+b.cc+", waiting for video PTS before demuxing audio frag "+b.sn+" of ["+O.startSN+" ,"+O.endSN+"],track "+F);var me=this.waitingData=this.waitingData||{frag:b,part:g,cache:new S.default,complete:!1},le=me.cache;le.push(new Uint8Array(E)),this.waitingVideoCC=this.videoTrackCC,this.state=I.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,a){var b=a.tracks.audio;b&&(this.mediaBuffer=b.buffer),a.tracks.video&&(this.videoBuffer=a.tracks.video.buffer)},f.onFragBuffered=function(d,a){var b=a.frag,g=a.part;if(b.type!==D.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(b)){this.warn("Fragment "+b.sn+(g?" p: "+g.index:"")+" of level "+b.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}b.sn!=="initSegment"&&(this.fragPrevious=b,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(R.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(b,g)},f.onError=function(d,a){switch(a.details){case u.ErrorDetails.FRAG_LOAD_ERROR:case u.ErrorDetails.FRAG_LOAD_TIMEOUT:case u.ErrorDetails.KEY_LOAD_ERROR:case u.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(D.PlaylistLevelType.AUDIO,a);break;case u.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case u.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==I.State.ERROR&&this.state!==I.State.STOPPED&&(this.state=a.fatal?I.State.ERROR:I.State.IDLE,this.warn(a.details+" while loading frag, switching to "+this.state+" state"));break;case u.ErrorDetails.BUFFER_FULL_ERROR:if(a.parent==="audio"&&(this.state===I.State.PARSING||this.state===I.State.PARSED)){var b=!0,g=this.getFwdBufferInfo(this.mediaBuffer,D.PlaylistLevelType.AUDIO);g&&g.len>.5&&(b=!this.reduceMaxBufferLength(g.len)),b&&(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,a){var b=a.type;b===v.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},f._handleTransmuxComplete=function(d){var a,b="audio",g=this.hls,E=d.remuxResult,M=d.chunkMeta,F=this.getCurrentContext(M);if(!F){this.warn("The loading context changed while buffering fragment "+M.sn+" of level "+M.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(M.level);return}var j=F.frag,W=F.part,O=E.audio,k=E.text,K=E.id3,Y=E.initSegment;if(this.fragContextChanged(j))return;if(this.state=I.State.PARSING,this.audioSwitch&&O&&this.completeAudioSwitch(),Y!=null&&Y.tracks&&(this._bufferInitSegment(Y.tracks,j,M),g.trigger(R.Events.FRAG_PARSING_INIT_SEGMENT,{frag:j,id:b,tracks:Y.tracks})),O){var q=O.startPTS,oe=O.endPTS,Te=O.startDTS,ve=O.endDTS;W&&(W.elementaryStreams[v.ElementaryStreamTypes.AUDIO]={startPTS:q,endPTS:oe,startDTS:Te,endDTS:ve}),j.setElementaryStreamInfo(v.ElementaryStreamTypes.AUDIO,q,oe,Te,ve),this.bufferFragmentData(O,j,W,M)}if(K!=null&&(a=K.samples)!==null&&a!==void 0&&a.length){var ge=l({frag:j,id:b},K);g.trigger(R.Events.FRAG_PARSING_METADATA,ge)}if(k){var me=l({frag:j,id:b},k);g.trigger(R.Events.FRAG_PARSING_USERDATA,me)}},f._bufferInitSegment=function(d,a,b){if(this.state!==I.State.PARSING)return;d.video&&delete d.video;var g=d.audio;if(!g)return;g.levelCodec=g.codec,g.id="audio",this.log("Init audio buffer, container:"+g.container+", codecs[parsed]=["+g.codec+"]"),this.hls.trigger(R.Events.BUFFER_CODECS,d);var E=g.initSegment;if(E!=null&&E.byteLength){var M={type:"audio",frag:a,part:null,chunkMeta:b,parent:a.type,data:E};this.hls.trigger(R.Events.BUFFER_APPENDING,M)}this.tick()},f.loadFragment=function(d,a,b){var g=this.fragmentTracker.getState(d);this.fragCurrent=d,(this.audioSwitch||g===U.FragmentState.NOT_LOADED||g===U.FragmentState.PARTIAL)&&(d.sn==="initSegment"?this._loadInitSegment(d):a.live&&!Object(z.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=I.State.WAITING_INIT_PTS):(this.startFragRequested=!0,A.prototype.loadFragment.call(this,d,a,b)))},f.completeAudioSwitch=function(){var d=this.hls,a=this.media,b=this.trackId;a&&(this.log("Switching audio track : flushing all audio"),A.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,d.trigger(R.Events.AUDIO_TRACK_SWITCHED,{id:b})},y}(I.default);X.default=c},"./src/controller/audio-track-controller.ts":function(re,X,L){"use strict";L.r(X);var z=L("./src/events.ts"),I=L("./src/errors.ts"),R=L("./src/controller/base-playlist-controller.ts"),B=L("./src/types/loader.ts");function U(_,C){for(var T=0;T<C.length;T++){var m=C[T];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(_,m.key,m)}}function P(_,C,T){return C&&U(_.prototype,C),T&&U(_,T),_}function D(_,C){_.prototype=Object.create(C.prototype),_.prototype.constructor=_,v(_,C)}function v(_,C){return v=Object.setPrototypeOf||function(m,u){return m.__proto__=u,m},v(_,C)}var S=function(_){D(C,_);function C(m){var u;return u=_.call(this,m,"[audio-track-controller]")||this,u.tracks=[],u.groupId=null,u.tracksInGroup=[],u.trackId=-1,u.trackName="",u.selectDefaultTrack=!0,u.registerListeners(),u}var T=C.prototype;return T.registerListeners=function(){var u=this.hls;u.on(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.on(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),u.on(z.Events.LEVEL_LOADING,this.onLevelLoading,this),u.on(z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),u.on(z.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),u.on(z.Events.ERROR,this.onError,this)},T.unregisterListeners=function(){var u=this.hls;u.off(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.off(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),u.off(z.Events.LEVEL_LOADING,this.onLevelLoading,this),u.off(z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),u.off(z.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),u.off(z.Events.ERROR,this.onError,this)},T.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,_.prototype.destroy.call(this)},T.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},T.onManifestParsed=function(u,o){this.tracks=o.audioTracks||[]},T.onAudioTrackLoaded=function(u,o){var l=o.id,s=o.details,w=this.tracksInGroup[l];if(!w){this.warn("Invalid audio track id "+l);return}var p=w.details;w.details=o.details,this.log("audioTrack "+l+" loaded ["+s.startSN+"-"+s.endSN+"]"),l===this.trackId&&(this.retryCount=0,this.playlistLoaded(l,o,p))},T.onLevelLoading=function(u,o){this.switchLevel(o.level)},T.onLevelSwitching=function(u,o){this.switchLevel(o.level)},T.switchLevel=function(u){var o=this.hls.levels[u];if(!(o!=null&&o.audioGroupIds))return;var l=o.audioGroupIds[o.urlId];if(this.groupId!==l){this.groupId=l;var s=this.tracks.filter(function(p){return!l||p.groupId===l});this.selectDefaultTrack&&!s.some(function(p){return p.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=s;var w={audioTracks:s};this.log("Updating audio tracks, "+s.length+' track(s) found in "'+l+'" group-id'),this.hls.trigger(z.Events.AUDIO_TRACKS_UPDATED,w),this.selectInitialTrack()}},T.onError=function(u,o){if(_.prototype.onError.call(this,u,o),o.fatal||!o.context)return;o.context.type===B.PlaylistContextType.AUDIO_TRACK&&o.context.id===this.trackId&&o.context.groupId===this.groupId&&this.retryLoadingOrFail(o)},T.setAudioTrack=function(u){var o=this.tracksInGroup;if(u<0||u>=o.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var l=o[this.trackId];this.log("Now switching to audio-track index "+u);var s=o[u],w=s.id,p=s.groupId,c=p===void 0?"":p,A=s.name,y=s.type,f=s.url;if(this.trackId=u,this.trackName=A,this.selectDefaultTrack=!1,this.hls.trigger(z.Events.AUDIO_TRACK_SWITCHING,{id:w,groupId:c,name:A,type:y,url:f}),s.details&&!s.details.live)return;var h=this.switchParams(s.url,l==null?void 0:l.details);this.loadPlaylist(h)},T.selectInitialTrack=function(){var u=this.tracksInGroup;console.assert(u.length,"Initial audio track should be selected when tracks are known");var o=this.trackName,l=this.findTrackId(o)||this.findTrackId();l!==-1?this.setAudioTrack(l):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(z.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},T.findTrackId=function(u){for(var o=this.tracksInGroup,l=0;l<o.length;l++){var s=o[l];if((!this.selectDefaultTrack||s.default)&&(!u||u===s.name))return s.id}return-1},T.loadPlaylist=function(u){var o=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(o)){var l=o.id,s=o.groupId,w=o.url;if(u)try{w=u.addDirectives(w)}catch(p){this.warn("Could not construct new URL with HLS Delivery Directives: "+p)}this.log("loading audio-track playlist for id: "+l),this.clearTimer(),this.hls.trigger(z.Events.AUDIO_TRACK_LOADING,{url:w,id:l,groupId:s,deliveryDirectives:u||null})}},P(C,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(u){this.selectDefaultTrack=!1,this.setAudioTrack(u)}}]),C}(R.default);X.default=S},"./src/controller/base-playlist-controller.ts":function(re,X,L){"use strict";L.r(X),L.d(X,"default",function(){return P});var z=L("./src/polyfills/number.ts"),I=L("./src/types/level.ts"),R=L("./src/controller/level-helper.ts"),B=L("./src/utils/logger.ts"),U=L("./src/errors.ts"),P=function(){function D(S,_){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=B.logger.log.bind(B.logger,_+":"),this.warn=B.logger.warn.bind(B.logger,_+":"),this.hls=S}var v=D.prototype;return v.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},v.onError=function(_,C){C.fatal&&C.type===U.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},v.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},v.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},v.stopLoad=function(){this.canLoad=!1,this.clearTimer()},v.switchParams=function(_,C){var T=C==null?void 0:C.renditionReports;if(T)for(var m=0;m<T.length;m++){var u=T[m],o=""+u.URI;if(o===_.substr(-o.length)){var l=parseInt(u["LAST-MSN"]),s=parseInt(u["LAST-PART"]);if(C&&this.hls.config.lowLatencyMode){var w=Math.min(C.age-C.partTarget,C.targetduration);s!==void 0&&w>C.partTarget&&(s+=1)}if(Object(z.isFiniteNumber)(l))return new I.HlsUrlParameters(l,Object(z.isFiniteNumber)(s)?s:void 0,I.HlsSkip.No)}}},v.loadPlaylist=function(_){},v.shouldLoadTrack=function(_){return this.canLoad&&_&&!!_.url&&(!_.details||_.details.live)},v.playlistLoaded=function(_,C,T){var m=this,u=C.details,o=C.stats,l=o.loading.end?Math.max(0,self.performance.now()-o.loading.end):0;if(u.advancedDateTime=Date.now()-l,u.live||T!=null&&T.live){if(u.reloaded(T),T&&this.log("live playlist "+_+" "+(u.advanced?"REFRESHED "+u.lastPartSn+"-"+u.lastPartIndex:"MISSED")),T&&u.fragments.length>0&&Object(R.mergeDetails)(T,u),!this.canLoad||!u.live)return;var s,w=void 0,p=void 0;if(u.canBlockReload&&u.endSN&&u.advanced){var c=this.hls.config.lowLatencyMode,A=u.lastPartSn,y=u.endSN,f=u.lastPartIndex,h=f!==-1,d=A===y,a=c?0:f;h?(w=d?y+1:A,p=d?a:f+1):w=y+1;var b=u.age,g=b+u.ageHeader,E=Math.min(g-u.partTarget,u.targetduration*1.5);if(E>0){if(T&&E>T.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+T.tuneInGoal+" to: "+E+" with playlist age: "+u.age),E=0;else{var M=Math.floor(E/u.targetduration);if(w+=M,p!==void 0){var F=Math.round(E%u.targetduration/u.partTarget);p+=F}this.log("CDN Tune-in age: "+u.ageHeader+"s last advanced "+b.toFixed(2)+"s goal: "+E+" skip sn "+M+" to part "+p)}u.tuneInGoal=E}if(s=this.getDeliveryDirectives(u,C.deliveryDirectives,w,p),c||!d){this.loadPlaylist(s);return}}else s=this.getDeliveryDirectives(u,C.deliveryDirectives,w,p);var j=Object(R.computeReloadInterval)(u,o);w!==void 0&&u.canBlockReload&&(j-=u.partTarget||1),this.log("reload live playlist "+_+" in "+Math.round(j)+" ms"),this.timer=self.setTimeout(function(){return m.loadPlaylist(s)},j)}else this.clearTimer()},v.getDeliveryDirectives=function(_,C,T,m){var u=Object(I.getSkipValue)(_,T);return C!=null&&C.skip&&_.deltaUpdateFailed&&(T=C.msn,m=C.part,u=I.HlsSkip.No),new I.HlsUrlParameters(T,m,u)},v.retryLoadingOrFail=function(_){var C=this,T=this.hls.config,m=this.retryCount<T.levelLoadingMaxRetry;if(m){var u;if(this.retryCount++,_.details.indexOf("LoadTimeOut")>-1&&(u=_.context)!==null&&u!==void 0&&u.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+_.details+'"'),this.loadPlaylist();else{var o=Math.min(Math.pow(2,this.retryCount)*T.levelLoadingRetryDelay,T.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return C.loadPlaylist()},o),this.warn("retry playlist loading #"+this.retryCount+" in "+o+' ms after "'+_.details+'"')}}else this.warn('cannot recover from error "'+_.details+'"'),this.clearTimer(),_.fatal=!0;return m},D}()},"./src/controller/base-stream-controller.ts":function(re,X,L){"use strict";L.r(X),L.d(X,"State",function(){return y}),L.d(X,"default",function(){return f});var z=L("./src/polyfills/number.ts"),I=L("./src/task-loop.ts"),R=L("./src/controller/fragment-tracker.ts"),B=L("./src/utils/buffer-helper.ts"),U=L("./src/utils/logger.ts"),P=L("./src/events.ts"),D=L("./src/errors.ts"),v=L("./src/types/transmuxer.ts"),S=L("./src/utils/mp4-tools.ts"),_=L("./src/utils/discontinuities.ts"),C=L("./src/controller/fragment-finders.ts"),T=L("./src/controller/level-helper.ts"),m=L("./src/loader/fragment-loader.ts"),u=L("./src/crypt/decrypter.ts"),o=L("./src/utils/time-ranges.ts"),l=L("./src/types/loader.ts");function s(h,d){for(var a=0;a<d.length;a++){var b=d[a];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(h,b.key,b)}}function w(h,d,a){return d&&s(h.prototype,d),a&&s(h,a),h}function p(h){if(h===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return h}function c(h,d){h.prototype=Object.create(d.prototype),h.prototype.constructor=h,A(h,d)}function A(h,d){return A=Object.setPrototypeOf||function(b,g){return b.__proto__=g,b},A(h,d)}var y={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(h){c(d,h);function d(b,g,E){var M;return M=h.call(this)||this,M.hls=void 0,M.fragPrevious=null,M.fragCurrent=null,M.fragmentTracker=void 0,M.transmuxer=null,M._state=y.STOPPED,M.media=void 0,M.mediaBuffer=void 0,M.config=void 0,M.bitrateTest=!1,M.lastCurrentTime=0,M.nextLoadPosition=0,M.startPosition=0,M.loadedmetadata=!1,M.fragLoadError=0,M.retryDate=0,M.levels=null,M.fragmentLoader=void 0,M.levelLastLoaded=null,M.startFragRequested=!1,M.decrypter=void 0,M.initPTS=[],M.onvseeking=null,M.onvended=null,M.logPrefix="",M.log=void 0,M.warn=void 0,M.logPrefix=E,M.log=U.logger.log.bind(U.logger,E+":"),M.warn=U.logger.warn.bind(U.logger,E+":"),M.hls=b,M.fragmentLoader=new m.default(b.config),M.fragmentTracker=g,M.config=b.config,M.decrypter=new u.default(b,b.config),b.on(P.Events.KEY_LOADED,M.onKeyLoaded,p(M)),M}var a=d.prototype;return a.doTick=function(){this.onTickEnd()},a.onTickEnd=function(){},a.startLoad=function(g){},a.stopLoad=function(){this.fragmentLoader.abort();var g=this.fragCurrent;g&&this.fragmentTracker.removeFragment(g),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=y.STOPPED},a._streamEnded=function(g,E){var M=this.fragCurrent,F=this.fragmentTracker;if(!E.live&&M&&M.sn===E.endSN&&!g.nextStart){var j=F.getState(M);return j===R.FragmentState.PARTIAL||j===R.FragmentState.OK}return!1},a.onMediaAttached=function(g,E){var M=this.media=this.mediaBuffer=E.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),M.addEventListener("seeking",this.onvseeking),M.addEventListener("ended",this.onvended);var F=this.config;this.levels&&F.autoStartLoad&&this.state===y.STOPPED&&this.startLoad(F.startPosition)},a.onMediaDetaching=function(){var g=this.media;g!=null&&g.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),g&&(g.removeEventListener("seeking",this.onvseeking),g.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},a.onMediaSeeking=function(){var g=this.config,E=this.fragCurrent,M=this.media,F=this.mediaBuffer,j=this.state,W=M?M.currentTime:0,O=B.BufferHelper.bufferInfo(F||M,W,g.maxBufferHole);if(this.log("media seeking to "+(Object(z.isFiniteNumber)(W)?W.toFixed(3):W)+", state: "+j),j===y.ENDED)this.resetLoadingState();else if(E&&!O.len){var k=g.maxFragLookUpTolerance,K=E.start-k,Y=E.start+E.duration+k,q=W>Y;(W<K||q)&&(q&&E.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),E.loader.abort()),this.resetLoadingState())}M&&(this.lastCurrentTime=W),!this.loadedmetadata&&!O.len&&(this.nextLoadPosition=this.startPosition=W),this.tickImmediate()},a.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},a.onKeyLoaded=function(g,E){if(this.state!==y.KEY_LOADING||E.frag!==this.fragCurrent||!this.levels)return;this.state=y.IDLE;var M=this.levels[E.frag.level].details;M&&this.loadFragment(E.frag,M,E.frag.start)},a.onHandlerDestroying=function(){this.stopLoad(),h.prototype.onHandlerDestroying.call(this)},a.onHandlerDestroyed=function(){this.state=y.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,h.prototype.onHandlerDestroyed.call(this)},a.loadKey=function(g,E){this.log("Loading key for "+g.sn+" of ["+E.startSN+"-"+E.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+g.level),this.state=y.KEY_LOADING,this.fragCurrent=g,this.hls.trigger(P.Events.KEY_LOADING,{frag:g})},a.loadFragment=function(g,E,M){this._loadFragForPlayback(g,E,M)},a._loadFragForPlayback=function(g,E,M){var F=this,j=function(O){if(F.fragContextChanged(g)){F.warn("Fragment "+g.sn+(O.part?" p: "+O.part.index:"")+" of level "+g.level+" was dropped during download."),F.fragmentTracker.removeFragment(g);return}g.stats.chunkCount++,F._handleFragmentLoadProgress(O)};this._doFragLoad(g,E,M,j).then(function(W){if(!W)return;F.fragLoadError=0;var O=F.state;if(F.fragContextChanged(g)){(O===y.FRAG_LOADING||O===y.BACKTRACKING||!F.fragCurrent&&O===y.PARSING)&&(F.fragmentTracker.removeFragment(g),F.state=y.IDLE);return}if("payload"in W&&(F.log("Loaded fragment "+g.sn+" of level "+g.level),F.hls.trigger(P.Events.FRAG_LOADED,W),F.state===y.BACKTRACKING)){F.fragmentTracker.backtrack(g,W),F.resetFragmentLoading(g);return}F._handleFragmentLoadComplete(W)}).catch(function(W){F.warn(W),F.resetFragmentLoading(g)})},a.flushMainBuffer=function(g,E,M){if(M===void 0&&(M=null),!(g-E))return;var F={startOffset:g,endOffset:E,type:M};this.fragLoadError=0,this.hls.trigger(P.Events.BUFFER_FLUSHING,F)},a._loadInitSegment=function(g){var E=this;this._doFragLoad(g).then(function(M){if(!M||E.fragContextChanged(g)||!E.levels)throw new Error("init load aborted");return M}).then(function(M){var F=E.hls,j=M.payload,W=g.decryptdata;if(j&&j.byteLength>0&&W&&W.key&&W.iv&&W.method==="AES-128"){var O=self.performance.now();return E.decrypter.webCryptoDecrypt(new Uint8Array(j),W.key.buffer,W.iv.buffer).then(function(k){var K=self.performance.now();return F.trigger(P.Events.FRAG_DECRYPTED,{frag:g,payload:k,stats:{tstart:O,tdecrypt:K}}),M.payload=k,M})}return M}).then(function(M){var F=E.fragCurrent,j=E.hls,W=E.levels;if(!W)throw new Error("init load aborted, missing levels");var O=W[g.level].details;console.assert(O,"Level details are defined when init segment is loaded");var k=g.stats;E.state=y.IDLE,E.fragLoadError=0,g.data=new Uint8Array(M.payload),k.parsing.start=k.buffering.start=self.performance.now(),k.parsing.end=k.buffering.end=self.performance.now(),M.frag===F&&j.trigger(P.Events.FRAG_BUFFERED,{stats:k,frag:F,part:null,id:g.type}),E.tick()}).catch(function(M){E.warn(M),E.resetFragmentLoading(g)})},a.fragContextChanged=function(g){var E=this.fragCurrent;return!g||!E||g.level!==E.level||g.sn!==E.sn||g.urlId!==E.urlId},a.fragBufferedComplete=function(g,E){var M=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+g.type+" sn: "+g.sn+(E?" part: "+E.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+g.level+" "+o.default.toString(B.BufferHelper.getBuffered(M))),this.state=y.IDLE,this.tick()},a._handleFragmentLoadComplete=function(g){var E=this.transmuxer;if(!E)return;var M=g.frag,F=g.part,j=g.partsLoaded,W=!j||j.length===0||j.some(function(k){return!k}),O=new v.ChunkMetadata(M.level,M.sn,M.stats.chunkCount+1,0,F?F.index:-1,!W);E.flush(O)},a._handleFragmentLoadProgress=function(g){},a._doFragLoad=function(g,E,M,F){var j=this;if(M===void 0&&(M=null),!this.levels)throw new Error("frag load aborted, missing levels");if(M=Math.max(g.start,M||0),this.config.lowLatencyMode&&E){var W=E.partList;if(W&&F){M>g.end&&E.fragmentHint&&(g=E.fragmentHint);var O=this.getNextPart(W,g,M);if(O>-1){var k=W[O];return this.log("Loading part sn: "+g.sn+" p: "+k.index+" cc: "+g.cc+" of playlist ["+E.startSN+"-"+E.endSN+"] parts [0-"+O+"-"+(W.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+g.level+", target: "+parseFloat(M.toFixed(3))),this.nextLoadPosition=k.start+k.duration,this.state=y.FRAG_LOADING,this.hls.trigger(P.Events.FRAG_LOADING,{frag:g,part:W[O],targetBufferTime:M}),this.doFragPartsLoad(g,W,O,F).catch(function(K){return j.handleFragLoadError(K)})}else if(!g.url||this.loadedEndOfParts(W,M))return Promise.resolve(null)}}return this.log("Loading fragment "+g.sn+" cc: "+g.cc+" "+(E?"of ["+E.startSN+"-"+E.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+g.level+", target: "+parseFloat(M.toFixed(3))),Object(z.isFiniteNumber)(g.sn)&&!this.bitrateTest&&(this.nextLoadPosition=g.start+g.duration),this.state=y.FRAG_LOADING,this.hls.trigger(P.Events.FRAG_LOADING,{frag:g,targetBufferTime:M}),this.fragmentLoader.load(g,F).catch(function(K){return j.handleFragLoadError(K)})},a.doFragPartsLoad=function(g,E,M,F){var j=this;return new Promise(function(W,O){var k=[],K=function Y(q){var oe=E[q];j.fragmentLoader.loadPart(g,oe,F).then(function(Te){k[oe.index]=Te;var ve=Te.part;j.hls.trigger(P.Events.FRAG_LOADED,Te);var ge=E[q+1];if(ge&&ge.fragment===g)Y(q+1);else return W({frag:g,part:ve,partsLoaded:k})}).catch(O)};K(M)})},a.handleFragLoadError=function(g){var E=g.data;return E&&E.details===D.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(E.frag,E.part):this.hls.trigger(P.Events.ERROR,E),null},a._handleTransmuxerFlush=function(g){var E=this.getCurrentContext(g);if(!E||this.state!==y.PARSING){this.fragCurrent||(this.state=y.IDLE);return}var M=E.frag,F=E.part,j=E.level,W=self.performance.now();M.stats.parsing.end=W,F&&(F.stats.parsing.end=W),this.updateLevelTiming(M,F,j,g.partial)},a.getCurrentContext=function(g){var E=this.levels,M=g.level,F=g.sn,j=g.part;if(!E||!E[M])return this.warn("Levels object was unset while buffering fragment "+F+" of level "+M+". The current chunk will not be buffered."),null;var W=E[M],O=j>-1?Object(T.getPartWith)(W,F,j):null,k=O?O.fragment:Object(T.getFragmentWithSN)(W,F,this.fragCurrent);return k?{frag:k,part:O,level:W}:null},a.bufferFragmentData=function(g,E,M,F){if(!g||this.state!==y.PARSING)return;var j=g.data1,W=g.data2,O=j;if(j&&W&&(O=Object(S.appendUint8Array)(j,W)),!O||!O.length)return;var k={type:g.type,frag:E,part:M,chunkMeta:F,parent:E.type,data:O};this.hls.trigger(P.Events.BUFFER_APPENDING,k),g.dropped&&g.independent&&!M&&this.flushBufferGap(E)},a.flushBufferGap=function(g){var E=this.media;if(!E)return;if(!B.BufferHelper.isBuffered(E,E.currentTime)){this.flushMainBuffer(0,g.start);return}var M=E.currentTime,F=B.BufferHelper.bufferInfo(E,M,0),j=g.duration,W=Math.min(this.config.maxFragLookUpTolerance*2,j*.25),O=Math.max(Math.min(g.start-W,F.end-W),M+W);g.start-O>W&&this.flushMainBuffer(O,g.start)},a.getFwdBufferInfo=function(g,E){var M=this.config,F=this.getLoadPosition();if(!Object(z.isFiniteNumber)(F))return null;var j=B.BufferHelper.bufferInfo(g,F,M.maxBufferHole);if(j.len===0&&j.nextStart!==void 0){var W=this.fragmentTracker.getBufferedFrag(F,E);if(W&&j.nextStart<W.end)return B.BufferHelper.bufferInfo(g,F,Math.max(j.nextStart,M.maxBufferHole))}return j},a.getMaxBufferLength=function(g){var E=this.config,M;return g?M=Math.max(8*E.maxBufferSize/g,E.maxBufferLength):M=E.maxBufferLength,Math.min(M,E.maxMaxBufferLength)},a.reduceMaxBufferLength=function(g){var E=this.config,M=g||E.maxBufferLength;return E.maxMaxBufferLength>=M?(E.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+E.maxMaxBufferLength+"s"),!0):!1},a.getNextFragment=function(g,E){var M,F,j=E.fragments,W=j.length;if(!W)return null;var O=this.config,k=j[0].start,K;if(E.live){var Y=O.initialLiveManifestSize;if(W<Y)return this.warn("Not enough fragments to start playback (have: "+W+", need: "+Y+")"),null;!E.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(K=this.getInitialLiveFragment(E,j),this.startPosition=K?this.hls.liveSyncPosition||K.start:g)}else g<=k&&(K=j[0]);if(!K){var q=O.lowLatencyMode?E.partEnd:E.fragmentEnd;K=this.getFragmentAtPosition(g,q,E)}return(M=K)!==null&&M!==void 0&&M.initSegment&&!((F=K)!==null&&F!==void 0&&F.initSegment.data)&&!this.bitrateTest&&(K=K.initSegment),K},a.getNextPart=function(g,E,M){for(var F=-1,j=!1,W=!0,O=0,k=g.length;O<k;O++){var K=g[O];if(W=W&&!K.independent,F>-1&&M<K.start)break;var Y=K.loaded;!Y&&(j||K.independent||W)&&K.fragment===E&&(F=O),j=Y}return F},a.loadedEndOfParts=function(g,E){var M=g[g.length-1];return M&&E>M.start&&M.loaded},a.getInitialLiveFragment=function(g,E){var M=this.fragPrevious,F=null;if(M){if(g.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+M.programDateTime),F=Object(C.findFragmentByPDT)(E,M.endProgramDateTime,this.config.maxFragLookUpTolerance)),!F){var j=M.sn+1;if(j>=g.startSN&&j<=g.endSN){var W=E[j-g.startSN];M.cc===W.cc&&(F=W,this.log("Live playlist, switching playlist, load frag with next SN: "+F.sn))}F||(F=Object(C.findFragWithCC)(E,M.cc),F&&this.log("Live playlist, switching playlist, load frag with same CC: "+F.sn))}}else{var O=this.hls.liveSyncPosition;O!==null&&(F=this.getFragmentAtPosition(O,this.bitrateTest?g.fragmentEnd:g.edge,g))}return F},a.getFragmentAtPosition=function(g,E,M){var F=this.config,j=this.fragPrevious,W=M.fragments,O=M.endSN,k=M.fragmentHint,K=F.maxFragLookUpTolerance,Y=!!(F.lowLatencyMode&&M.partList&&k);Y&&k&&!this.bitrateTest&&(W=W.concat(k),O=k.sn);var q;if(g<E){var oe=g>E-K?0:K;q=Object(C.findFragmentByPTS)(j,W,g,oe)}else q=W[W.length-1];if(q){var Te=q.sn-M.startSN,ve=j&&q.level===j.level,ge=W[Te+1],me=this.fragmentTracker.getState(q);if(me===R.FragmentState.BACKTRACKED){q=null;for(var le=Te;W[le]&&this.fragmentTracker.getState(W[le])===R.FragmentState.BACKTRACKED;)j?q=W[le--]:q=W[--le];q||(q=ge)}else j&&q.sn===j.sn&&!Y&&(ve&&(q.sn<O&&this.fragmentTracker.getState(ge)!==R.FragmentState.OK?(this.log("SN "+q.sn+" just loaded, load next one: "+ge.sn),q=ge):q=null))}return q},a.synchronizeToLiveEdge=function(g){var E=this.config,M=this.media;if(!M)return;var F=this.hls.liveSyncPosition,j=M.currentTime,W=g.fragments[0].start,O=g.edge,k=j>=W-E.maxFragLookUpTolerance&&j<=O;if(F!==null&&M.duration>F&&(j<F||!k)){var K=E.liveMaxLatencyDuration!==void 0?E.liveMaxLatencyDuration:E.liveMaxLatencyDurationCount*g.targetduration;(!k&&M.readyState<4||j<O-K)&&(this.loadedmetadata||(this.nextLoadPosition=F),M.readyState&&(this.warn("Playback: "+j.toFixed(3)+" is located too far from the end of live sliding playlist: "+O+", reset currentTime to : "+F.toFixed(3)),M.currentTime=F))}},a.alignPlaylists=function(g,E){var M=this.levels,F=this.levelLastLoaded,j=this.fragPrevious,W=F!==null?M[F]:null,O=g.fragments.length;if(!O)return this.warn("No fragments in live playlist"),0;var k=g.fragments[0].start,K=!E,Y=g.alignedSliding&&Object(z.isFiniteNumber)(k);if(K||!Y&&!k){Object(_.alignStream)(j,W,g);var q=g.fragments[0].start;return this.log("Live playlist sliding: "+q.toFixed(2)+" start-sn: "+(E?E.startSN:"na")+"->"+g.startSN+" prev-sn: "+(j?j.sn:"na")+" fragments: "+O),q}return k},a.waitForCdnTuneIn=function(g){var E=3;return g.live&&g.canBlockReload&&g.tuneInGoal>Math.max(g.partHoldBack,g.partTarget*E)},a.setStartPosition=function(g,E){var M=this.startPosition;if(M<E&&(M=-1),M===-1||this.lastCurrentTime===-1){var F=g.startTimeOffset;Object(z.isFiniteNumber)(F)?(M=E+F,F<0&&(M+=g.totalduration),M=Math.min(Math.max(E,M),E+g.totalduration),this.log("Start time offset "+F+" found in playlist, adjust startPosition to "+M),this.startPosition=M):g.live?M=this.hls.liveSyncPosition||E:this.startPosition=M=0,this.lastCurrentTime=M}this.nextLoadPosition=M},a.getLoadPosition=function(){var g=this.media,E=0;return this.loadedmetadata&&g?E=g.currentTime:this.nextLoadPosition&&(E=this.nextLoadPosition),E},a.handleFragLoadAborted=function(g,E){this.transmuxer&&g.sn!=="initSegment"&&g.stats.aborted&&(this.warn("Fragment "+g.sn+(E?" part"+E.index:"")+" of level "+g.level+" was aborted"),this.resetFragmentLoading(g))},a.resetFragmentLoading=function(g){(!this.fragCurrent||!this.fragContextChanged(g))&&(this.state=y.IDLE)},a.onFragmentOrKeyLoadError=function(g,E){if(E.fatal)return;var M=E.frag;if(!M||M.type!==g)return;var F=this.fragCurrent;console.assert(F&&M.sn===F.sn&&M.level===F.level&&M.urlId===F.urlId,"Frag load error must match current frag to retry");var j=this.config;if(this.fragLoadError+1<=j.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(M.level))return;var W=Math.min(Math.pow(2,this.fragLoadError)*j.fragLoadingRetryDelay,j.fragLoadingMaxRetryTimeout);this.warn("Fragment "+M.sn+" of "+g+" "+M.level+" failed to load, retrying in "+W+"ms"),this.retryDate=self.performance.now()+W,this.fragLoadError++,this.state=y.FRAG_LOADING_WAITING_RETRY}else E.levelRetry?(g===l.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=y.IDLE):(U.logger.error(E.details+" reaches max retry, redispatch as fatal ..."),E.fatal=!0,this.hls.stopLoad(),this.state=y.ERROR)},a.afterBufferFlushed=function(g,E,M){if(!g)return;var F=B.BufferHelper.getBuffered(g);this.fragmentTracker.detectEvictedFragments(E,F,M),this.state===y.ENDED&&this.resetLoadingState()},a.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=y.IDLE},a.resetLiveStartWhenNotLoaded=function(g){if(!this.loadedmetadata){this.startFragRequested=!1;var E=this.levels?this.levels[g].details:null;if(E!=null&&E.live)return this.startPosition=-1,this.setStartPosition(E,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},a.updateLevelTiming=function(g,E,M,F){var j=this,W=M.details;console.assert(!!W,"level.details must be defined");var O=Object.keys(g.elementaryStreams).reduce(function(k,K){var Y=g.elementaryStreams[K];if(Y){var q=Y.endPTS-Y.startPTS;if(q<=0)return j.warn("Could not parse fragment "+g.sn+" "+K+" duration reliably ("+q+") resetting transmuxer to fallback to playlist timing"),j.resetTransmuxer(),k||!1;var oe=F?0:Object(T.updateFragPTSDTS)(W,g,Y.startPTS,Y.endPTS,Y.startDTS,Y.endDTS);return j.hls.trigger(P.Events.LEVEL_PTS_UPDATED,{details:W,level:M,drift:oe,type:K,frag:g,start:Y.startPTS,end:Y.endPTS}),!0}return k},!1);O?(this.state=y.PARSED,this.hls.trigger(P.Events.FRAG_PARSED,{frag:g,part:E})):this.resetLoadingState()},a.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},w(d,[{key:"state",get:function(){return this._state},set:function(g){var E=this._state;E!==g&&(this._state=g,this.log(E+"->"+g))}}]),d}(I.default)},"./src/controller/buffer-controller.ts":function(re,X,L){"use strict";L.r(X),L.d(X,"default",function(){return C});var z=L("./src/polyfills/number.ts"),I=L("./src/events.ts"),R=L("./src/utils/logger.ts"),B=L("./src/errors.ts"),U=L("./src/utils/buffer-helper.ts"),P=L("./src/utils/mediasource-helper.ts"),D=L("./src/loader/fragment.ts"),v=L("./src/controller/buffer-operation-queue.ts"),S=Object(P.getMediaSource)(),_=/([ha]vc.)(?:\.[^.,]+)+/,C=function(){function T(u){var o=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var l=o.hls,s=o.media,w=o.mediaSource;R.logger.log("[buffer-controller]: Media source opened"),s&&(o.updateMediaElementDuration(),l.trigger(I.Events.MEDIA_ATTACHED,{media:s})),w&&w.removeEventListener("sourceopen",o._onMediaSourceOpen),o.checkPendingTracks()},this._onMediaSourceClose=function(){R.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){R.logger.log("[buffer-controller]: Media source ended")},this.hls=u,this._initSourceBuffer(),this.registerListeners()}var m=T.prototype;return m.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},m.destroy=function(){this.unregisterListeners(),this.details=null},m.registerListeners=function(){var o=this.hls;o.on(I.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.on(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(I.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(I.Events.BUFFER_RESET,this.onBufferReset,this),o.on(I.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.on(I.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.on(I.Events.BUFFER_EOS,this.onBufferEos,this),o.on(I.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.on(I.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.on(I.Events.FRAG_PARSED,this.onFragParsed,this),o.on(I.Events.FRAG_CHANGED,this.onFragChanged,this)},m.unregisterListeners=function(){var o=this.hls;o.off(I.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.off(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(I.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(I.Events.BUFFER_RESET,this.onBufferReset,this),o.off(I.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.off(I.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.off(I.Events.BUFFER_EOS,this.onBufferEos,this),o.off(I.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.off(I.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.off(I.Events.FRAG_PARSED,this.onFragParsed,this),o.off(I.Events.FRAG_CHANGED,this.onFragChanged,this)},m._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new v.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},m.onManifestParsed=function(o,l){var s=2;(l.audio&&!l.video||!l.altAudio)&&(s=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=s,this.details=null,R.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},m.onMediaAttaching=function(o,l){var s=this.media=l.media;if(s&&S){var w=this.mediaSource=new S;w.addEventListener("sourceopen",this._onMediaSourceOpen),w.addEventListener("sourceended",this._onMediaSourceEnded),w.addEventListener("sourceclose",this._onMediaSourceClose),s.src=self.URL.createObjectURL(w),this._objectUrl=s.src}},m.onMediaDetaching=function(){var o=this.media,l=this.mediaSource,s=this._objectUrl;if(l){if(R.logger.log("[buffer-controller]: media source detaching"),l.readyState==="open")try{l.endOfStream()}catch(w){R.logger.warn("[buffer-controller]: onMediaDetaching: "+w.message+" while calling endOfStream")}this.onBufferReset(),l.removeEventListener("sourceopen",this._onMediaSourceOpen),l.removeEventListener("sourceended",this._onMediaSourceEnded),l.removeEventListener("sourceclose",this._onMediaSourceClose),o&&(s&&self.URL.revokeObjectURL(s),o.src===s?(o.removeAttribute("src"),o.load()):R.logger.warn("[buffer-controller]: media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(I.Events.MEDIA_DETACHED,void 0)},m.onBufferReset=function(){var o=this;this.getSourceBufferTypes().forEach(function(l){var s=o.sourceBuffer[l];try{s&&(o.removeBufferListeners(l),o.mediaSource&&o.mediaSource.removeSourceBuffer(s),o.sourceBuffer[l]=void 0)}catch(w){R.logger.warn("[buffer-controller]: Failed to reset the "+l+" buffer",w)}}),this._initSourceBuffer()},m.onBufferCodecs=function(o,l){var s=this,w=this.getSourceBufferTypes().length;if(Object.keys(l).forEach(function(p){if(w){var c=s.tracks[p];if(c&&typeof c.buffer.changeType=="function"){var A=l[p],y=A.codec,f=A.levelCodec,h=A.container,d=(c.levelCodec||c.codec).replace(_,"$1"),a=(f||y).replace(_,"$1");if(d!==a){var b=h+";codecs="+(f||y);s.appendChangeType(p,b)}}}else s.pendingTracks[p]=l[p]}),w)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},m.appendChangeType=function(o,l){var s=this,w=this.operationQueue,p={execute:function(){var A=s.sourceBuffer[o];A&&(R.logger.log("[buffer-controller]: changing "+o+" sourceBuffer type to "+l),A.changeType(l)),w.shiftAndExecuteNext(o)},onStart:function(){},onComplete:function(){},onError:function(A){R.logger.warn("[buffer-controller]: Failed to change "+o+" SourceBuffer type",A)}};w.append(p,o)},m.onBufferAppending=function(o,l){var s=this,w=this.hls,p=this.operationQueue,c=this.tracks,A=l.data,y=l.type,f=l.frag,h=l.part,d=l.chunkMeta,a=d.buffering[y],b=self.performance.now();a.start=b;var g=f.stats.buffering,E=h?h.stats.buffering:null;g.start===0&&(g.start=b),E&&E.start===0&&(E.start=b);var M=c.audio,F=y==="audio"&&d.id===1&&(M==null?void 0:M.container)==="audio/mpeg",j={execute:function(){if(a.executeStart=self.performance.now(),F){var O=s.sourceBuffer[y];if(O){var k=f.start-O.timestampOffset;Math.abs(k)>=.1&&(R.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+f.start+" (delta: "+k+") sn: "+f.sn+")"),O.timestampOffset=f.start)}}s.appendExecutor(A,y)},onStart:function(){},onComplete:function(){var O=self.performance.now();a.executeEnd=a.end=O,g.first===0&&(g.first=O),E&&E.first===0&&(E.first=O);var k=s.sourceBuffer,K={};for(var Y in k)K[Y]=U.BufferHelper.getBuffered(k[Y]);s.appendError=0,s.hls.trigger(I.Events.BUFFER_APPENDED,{type:y,frag:f,part:h,chunkMeta:d,parent:f.type,timeRanges:K})},onError:function(O){R.logger.error("[buffer-controller]: Error encountered while trying to append to the "+y+" SourceBuffer",O);var k={type:B.ErrorTypes.MEDIA_ERROR,parent:f.type,details:B.ErrorDetails.BUFFER_APPEND_ERROR,err:O,fatal:!1};O.code===DOMException.QUOTA_EXCEEDED_ERR?k.details=B.ErrorDetails.BUFFER_FULL_ERROR:(s.appendError++,k.details=B.ErrorDetails.BUFFER_APPEND_ERROR,s.appendError>w.config.appendErrorMaxRetry&&(R.logger.error("[buffer-controller]: Failed "+w.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),k.fatal=!0)),w.trigger(I.Events.ERROR,k)}};p.append(j,y)},m.onBufferFlushing=function(o,l){var s=this,w=this.operationQueue,p=function(A){return{execute:s.removeExecutor.bind(s,A,l.startOffset,l.endOffset),onStart:function(){},onComplete:function(){s.hls.trigger(I.Events.BUFFER_FLUSHED,{type:A})},onError:function(f){R.logger.warn("[buffer-controller]: Failed to remove from "+A+" SourceBuffer",f)}}};l.type?w.append(p(l.type),l.type):this.getSourceBufferTypes().forEach(function(c){w.append(p(c),c)})},m.onFragParsed=function(o,l){var s=this,w=l.frag,p=l.part,c=[],A=p?p.elementaryStreams:w.elementaryStreams;A[D.ElementaryStreamTypes.AUDIOVIDEO]?c.push("audiovideo"):(A[D.ElementaryStreamTypes.AUDIO]&&c.push("audio"),A[D.ElementaryStreamTypes.VIDEO]&&c.push("video"));var y=function(){var h=self.performance.now();w.stats.buffering.end=h,p&&(p.stats.buffering.end=h);var d=p?p.stats:w.stats;s.hls.trigger(I.Events.FRAG_BUFFERED,{frag:w,part:p,stats:d,id:w.type})};c.length===0&&R.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+w.type+" level: "+w.level+" sn: "+w.sn),this.blockBuffers(y,c)},m.onFragChanged=function(o,l){this.flushBackBuffer()},m.onBufferEos=function(o,l){var s=this,w=this.getSourceBufferTypes().reduce(function(p,c){var A=s.sourceBuffer[c];return(!l.type||l.type===c)&&(A&&!A.ended&&(A.ended=!0,R.logger.log("[buffer-controller]: "+c+" sourceBuffer now EOS"))),p&&!!(!A||A.ended)},!0);w&&this.blockBuffers(function(){var p=s.mediaSource;if(!p||p.readyState!=="open")return;p.endOfStream()})},m.onLevelUpdated=function(o,l){var s=l.details;if(!s.fragments.length)return;this.details=s,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},m.flushBackBuffer=function(){var o=this.hls,l=this.details,s=this.media,w=this.sourceBuffer;if(!s||l===null)return;var p=this.getSourceBufferTypes();if(!p.length)return;var c=l.live&&o.config.liveBackBufferLength!==null?o.config.liveBackBufferLength:o.config.backBufferLength;if(!Object(z.isFiniteNumber)(c)||c<0)return;var A=s.currentTime,y=l.levelTargetDuration,f=Math.max(c,y),h=Math.floor(A/y)*y-f;p.forEach(function(d){var a=w[d];if(a){var b=U.BufferHelper.getBuffered(a);b.length>0&&h>b.start(0)&&(o.trigger(I.Events.BACK_BUFFER_REACHED,{bufferEnd:h}),l.live&&o.trigger(I.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:h}),o.trigger(I.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:h,type:d}))}})},m.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var o=this.details,l=this.hls,s=this.media,w=this.mediaSource,p=o.fragments[0].start+o.totalduration,c=s.duration,A=Object(z.isFiniteNumber)(w.duration)?w.duration:0;o.live&&l.config.liveDurationInfinity?(R.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),w.duration=Infinity,this.updateSeekableRange(o)):(p>A&&p>c||!Object(z.isFiniteNumber)(c))&&(R.logger.log("[buffer-controller]: Updating Media Source duration to "+p.toFixed(3)),w.duration=p)},m.updateSeekableRange=function(o){var l=this.mediaSource,s=o.fragments,w=s.length;if(w&&o.live&&l!==null&&l!==void 0&&l.setLiveSeekableRange){var p=Math.max(0,s[0].start),c=Math.max(p,p+o.totalduration);l.setLiveSeekableRange(p,c)}},m.checkPendingTracks=function(){var o=this.bufferCodecEventsExpected,l=this.operationQueue,s=this.pendingTracks,w=Object.keys(s).length;if(w&&!o||w===2){this.createSourceBuffers(s),this.pendingTracks={};var p=this.getSourceBufferTypes();if(p.length===0){this.hls.trigger(I.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}p.forEach(function(c){l.executeNext(c)})}},m.createSourceBuffers=function(o){var l=this.sourceBuffer,s=this.mediaSource;if(!s)throw Error("createSourceBuffers called when mediaSource was null");var w=0;for(var p in o)if(!l[p]){var c=o[p];if(!c)throw Error("source buffer exists for track "+p+", however track does not");var A=c.levelCodec||c.codec,y=c.container+";codecs="+A;R.logger.log("[buffer-controller]: creating sourceBuffer("+y+")");try{var f=l[p]=s.addSourceBuffer(y),h=p;this.addBufferListener(h,"updatestart",this._onSBUpdateStart),this.addBufferListener(h,"updateend",this._onSBUpdateEnd),this.addBufferListener(h,"error",this._onSBUpdateError),this.tracks[p]={buffer:f,codec:A,container:c.container,levelCodec:c.levelCodec,id:c.id},w++}catch(d){R.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+d.message),this.hls.trigger(I.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:d,mimeType:y})}}w&&this.hls.trigger(I.Events.BUFFER_CREATED,{tracks:this.tracks})},m._onSBUpdateStart=function(o){var l=this.operationQueue,s=l.current(o);s.onStart()},m._onSBUpdateEnd=function(o){var l=this.operationQueue,s=l.current(o);s.onComplete(),l.shiftAndExecuteNext(o)},m._onSBUpdateError=function(o,l){R.logger.error("[buffer-controller]: "+o+" SourceBuffer error",l),this.hls.trigger(I.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var s=this.operationQueue.current(o);s&&s.onError(l)},m.removeExecutor=function(o,l,s){var w=this.media,p=this.mediaSource,c=this.operationQueue,A=this.sourceBuffer,y=A[o];if(!w||!p||!y){R.logger.warn("[buffer-controller]: Attempting to remove from the "+o+" SourceBuffer, but it does not exist"),c.shiftAndExecuteNext(o);return}var f=Object(z.isFiniteNumber)(w.duration)?w.duration:Infinity,h=Object(z.isFiniteNumber)(p.duration)?p.duration:Infinity,d=Math.max(0,l),a=Math.min(s,f,h);a>d?(R.logger.log("[buffer-controller]: Removing ["+d+","+a+"] from the "+o+" SourceBuffer"),console.assert(!y.updating,o+" sourceBuffer must not be updating"),y.remove(d,a)):c.shiftAndExecuteNext(o)},m.appendExecutor=function(o,l){var s=this.operationQueue,w=this.sourceBuffer,p=w[l];if(!p){R.logger.warn("[buffer-controller]: Attempting to append to the "+l+" SourceBuffer, but it does not exist"),s.shiftAndExecuteNext(l);return}p.ended=!1,console.assert(!p.updating,l+" sourceBuffer must not be updating"),p.appendBuffer(o)},m.blockBuffers=function(o,l){var s=this;if(l===void 0&&(l=this.getSourceBufferTypes()),!l.length){R.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(o);return}var w=this.operationQueue,p=l.map(function(c){return w.appendBlocker(c)});Promise.all(p).then(function(){o(),l.forEach(function(c){var A=s.sourceBuffer[c];(!A||!A.updating)&&w.shiftAndExecuteNext(c)})})},m.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},m.addBufferListener=function(o,l,s){var w=this.sourceBuffer[o];if(!w)return;var p=s.bind(this,o);this.listeners[o].push({event:l,listener:p}),w.addEventListener(l,p)},m.removeBufferListeners=function(o){var l=this.sourceBuffer[o];if(!l)return;this.listeners[o].forEach(function(s){l.removeEventListener(s.event,s.listener)})},T}()},"./src/controller/buffer-operation-queue.ts":function(re,X,L){"use strict";L.r(X),L.d(X,"default",function(){return I});var z=L("./src/utils/logger.ts"),I=function(){function R(U){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=U}var B=R.prototype;return B.append=function(P,D){var v=this.queues[D];v.push(P),v.length===1&&this.buffers[D]&&this.executeNext(D)},B.insertAbort=function(P,D){var v=this.queues[D];v.unshift(P),this.executeNext(D)},B.appendBlocker=function(P){var D,v=new Promise(function(_){D=_}),S={execute:D,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(S,P),v},B.executeNext=function(P){var D=this.buffers,v=this.queues,S=D[P],_=v[P];if(_.length){var C=_[0];try{C.execute()}catch(T){z.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),C.onError(T),(!S||!S.updating)&&(_.shift(),this.executeNext(P))}}},B.shiftAndExecuteNext=function(P){this.queues[P].shift(),this.executeNext(P)},B.current=function(P){return this.queues[P][0]},R}()},"./src/controller/cap-level-controller.ts":function(re,X,L){"use strict";L.r(X);var z=L("./src/events.ts");function I(U,P){for(var D=0;D<P.length;D++){var v=P[D];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(U,v.key,v)}}function R(U,P,D){return P&&I(U.prototype,P),D&&I(U,D),U}var B=function(){function U(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=U.prototype;return P.setStreamController=function(v){this.streamController=v},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 v=this.hls;v.on(z.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),v.on(z.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),v.on(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),v.on(z.Events.BUFFER_CODECS,this.onBufferCodecs,this),v.on(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},P.unregisterListener=function(){var v=this.hls;v.off(z.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),v.off(z.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),v.off(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),v.off(z.Events.BUFFER_CODECS,this.onBufferCodecs,this),v.off(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},P.onFpsDropLevelCapping=function(v,S){U.isLevelAllowed(S.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(S.droppedLevel)},P.onMediaAttaching=function(v,S){this.media=S.media instanceof HTMLVideoElement?S.media:null},P.onManifestParsed=function(v,S){var _=this.hls;this.restrictedLevels=[],this.firstLevel=S.firstLevel,_.config.capLevelToPlayerSize&&S.video&&this.startCapping()},P.onBufferCodecs=function(v,S){var _=this.hls;_.config.capLevelToPlayerSize&&S.video&&this.startCapping()},P.onMediaDetaching=function(){this.stopCapping()},P.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var v=this.hls.levels;if(v.length){var S=this.hls;S.autoLevelCapping=this.getMaxLevel(v.length-1),S.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=S.autoLevelCapping}}},P.getMaxLevel=function(v){var S=this,_=this.hls.levels;if(!_.length)return-1;var C=_.filter(function(T,m){return U.isLevelAllowed(m,S.restrictedLevels)&&m<=v});return this.clientRect=null,U.getMaxLevelByMediaSize(C,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 v=this.media,S={width:0,height:0};if(v){var _=v.getBoundingClientRect();S.width=_.width,S.height=_.height,!S.width&&!S.height&&(S.width=_.right-_.left||v.width||0,S.height=_.bottom-_.top||v.height||0)}return this.clientRect=S,S},U.isLevelAllowed=function(v,S){return S===void 0&&(S=[]),S.indexOf(v)===-1},U.getMaxLevelByMediaSize=function(v,S,_){if(!v||!v.length)return-1;for(var C=function(l,s){return s?l.width!==s.width||l.height!==s.height:!0},T=v.length-1,m=0;m<v.length;m+=1){var u=v[m];if((u.width>=S||u.height>=_)&&C(u,v[m+1])){T=m;break}}return T},R(U,[{key:"mediaWidth",get:function(){return this.getDimensions().width*U.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*U.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var v=1;try{v=self.devicePixelRatio}catch(S){}return v}}]),U}();X.default=B},"./src/controller/cmcd-controller.ts":function(re,X,L){"use strict";L.r(X),L.d(X,"default",function(){return C});var z=L("./src/events.ts"),I=L("./src/types/cmcd.ts"),R=L("./src/utils/buffer-helper.ts"),B=L("./src/utils/logger.ts");function U(T,m){for(var u=0;u<m.length;u++){var o=m[u];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(T,o.key,o)}}function P(T,m,u){return m&&U(T.prototype,m),u&&U(T,u),T}function D(T,m){var u=typeof Symbol!="undefined"&&T[Symbol.iterator]||T["@@iterator"];if(u)return(u=u.call(T)).next.bind(u);if(Array.isArray(T)||(u=v(T))||m&&T&&typeof T.length=="number"){u&&(T=u);var o=0;return function(){return o>=T.length?{done:!0}:{done:!1,value:T[o++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function v(T,m){if(!T)return;if(typeof T=="string")return S(T,m);var u=Object.prototype.toString.call(T).slice(8,-1);if(u==="Object"&&T.constructor&&(u=T.constructor.name),u==="Map"||u==="Set")return Array.from(T);if(u==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(u))return S(T,m)}function S(T,m){(m==null||m>T.length)&&(m=T.length);for(var u=0,o=new Array(m);u<m;u++)o[u]=T[u];return o}function _(){return _=Object.assign||function(T){for(var m=1;m<arguments.length;m++){var u=arguments[m];for(var o in u)Object.prototype.hasOwnProperty.call(u,o)&&(T[o]=u[o])}return T},_.apply(this,arguments)}var C=function(){function T(u){var o=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){o.initialized&&(o.starved=!0),o.buffering=!0},this.onPlaying=function(){o.initialized||(o.initialized=!0),o.buffering=!1},this.applyPlaylistData=function(w){try{o.apply(w,{ot:I.CMCDObjectType.MANIFEST,su:!o.initialized})}catch(p){B.logger.warn("Could not generate manifest CMCD data.",p)}},this.applyFragmentData=function(w){try{var p=w.frag,c=o.hls.levels[p.level],A=o.getObjectType(p),y={d:p.duration*1e3,ot:A};(A===I.CMCDObjectType.VIDEO||A===I.CMCDObjectType.AUDIO||A==I.CMCDObjectType.MUXED)&&(y.br=c.bitrate/1e3,y.tb=o.getTopBandwidth(A),y.bl=o.getBufferLength(A)),o.apply(w,y)}catch(f){B.logger.warn("Could not generate segment CMCD data.",f)}},this.hls=u;var l=this.config=u.config,s=l.cmcd;s!=null&&(l.pLoader=this.createPlaylistLoader(),l.fLoader=this.createFragmentLoader(),this.sid=s.sessionId||T.uuid(),this.cid=s.contentId,this.useHeaders=s.useHeaders===!0,this.registerListeners())}var m=T.prototype;return m.registerListeners=function(){var o=this.hls;o.on(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(z.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.on(z.Events.BUFFER_CREATED,this.onBufferCreated,this)},m.unregisterListeners=function(){var o=this.hls;o.off(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(z.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.off(z.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},m.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},m.onMediaAttached=function(o,l){this.media=l.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},m.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},m.onBufferCreated=function(o,l){var s,w;this.audioBuffer=(s=l.tracks.audio)===null||s===void 0?void 0:s.buffer,this.videoBuffer=(w=l.tracks.video)===null||w===void 0?void 0:w.buffer},m.createData=function(){var o;return{v:I.CMCDVersion,sf:I.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(o=this.media)===null||o===void 0?void 0:o.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},m.apply=function(o,l){l===void 0&&(l={}),_(l,this.createData());var s=l.ot===I.CMCDObjectType.INIT||l.ot===I.CMCDObjectType.VIDEO||l.ot===I.CMCDObjectType.MUXED;if(this.starved&&s&&(l.bs=!0,l.su=!0,this.starved=!1),l.su==null&&(l.su=this.buffering),this.useHeaders){var w=T.toHeaders(l);if(!Object.keys(w).length)return;o.headers||(o.headers={}),_(o.headers,w)}else{var p=T.toQuery(l);if(!p)return;o.url=T.appendQueryToUri(o.url,p)}},m.getObjectType=function(o){var l=o.type;return l==="subtitle"?I.CMCDObjectType.TIMED_TEXT:o.sn==="initSegment"?I.CMCDObjectType.INIT:l==="audio"?I.CMCDObjectType.AUDIO:l==="main"?this.hls.audioTracks.length?I.CMCDObjectType.VIDEO:I.CMCDObjectType.MUXED:void 0},m.getTopBandwidth=function(o){for(var l=0,s=o===I.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,w=D(s),p;!(p=w()).done;){var c=p.value;c.bitrate>l&&(l=c.bitrate)}return l>0?l:NaN},m.getBufferLength=function(o){var l=this.hls.media,s=o===I.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!s||!l)return NaN;var w=R.BufferHelper.bufferInfo(s,l.currentTime,this.config.maxBufferHole);return w.len*1e3},m.createPlaylistLoader=function(){var o=this.config.pLoader,l=this.applyPlaylistData,s=o||this.config.loader;return function(){function w(c){this.loader=void 0,this.loader=new s(c)}var p=w.prototype;return p.destroy=function(){this.loader.destroy()},p.abort=function(){this.loader.abort()},p.load=function(A,y,f){l(A),this.loader.load(A,y,f)},P(w,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),w}()},m.createFragmentLoader=function(){var o=this.config.fLoader,l=this.applyFragmentData,s=o||this.config.loader;return function(){function w(c){this.loader=void 0,this.loader=new s(c)}var p=w.prototype;return p.destroy=function(){this.loader.destroy()},p.abort=function(){this.loader.abort()},p.load=function(A,y,f){l(A),this.loader.load(A,y,f)},P(w,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),w}()},T.uuid=function(){var o=URL.createObjectURL(new Blob),l=o.toString();return URL.revokeObjectURL(o),l.substr(l.lastIndexOf("/")+1)},T.serialize=function(o){for(var l=[],s=function(F){return!Number.isNaN(F)&&F!=null&&F!==""&&F!==!1},w=function(F){return Math.round(F)},p=function(F){return w(F/100)*100},c=function(F){return encodeURIComponent(F)},A={br:w,d:w,bl:p,dl:p,mtp:p,nor:c,rtp:p,tb:w},y=Object.keys(o||{}).sort(),f=D(y),h;!(h=f()).done;){var d=h.value,a=o[d];if(!s(a))continue;if(d==="v"&&a===1)continue;if(d=="pr"&&a===1)continue;var b=A[d];b&&(a=b(a));var g=typeof a,E=void 0;d==="ot"||d==="sf"||d==="st"?E=d+"="+a:g==="boolean"?E=d:g==="number"?E=d+"="+a:E=d+"="+JSON.stringify(a),l.push(E)}return l.join(",")},T.toHeaders=function(o){for(var l=Object.keys(o),s={},w=["Object","Request","Session","Status"],p=[{},{},{},{}],c={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,y=l;A<y.length;A++){var f=y[A],h=c[f]!=null?c[f]:1;p[h][f]=o[f]}for(var d=0;d<p.length;d++){var a=T.serialize(p[d]);a&&(s["CMCD-"+w[d]]=a)}return s},T.toQuery=function(o){return"CMCD="+encodeURIComponent(T.serialize(o))},T.appendQueryToUri=function(o,l){if(!l)return o;var s=o.includes("?")?"&":"?";return""+o+s+l},T}()},"./src/controller/eme-controller.ts":function(re,X,L){"use strict";L.r(X);var z=L("./src/events.ts"),I=L("./src/errors.ts"),R=L("./src/utils/logger.ts"),B=L("./src/utils/mediakeys-helper.ts");function U(C,T){for(var m=0;m<T.length;m++){var u=T[m];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(C,u.key,u)}}function P(C,T,m){return T&&U(C.prototype,T),m&&U(C,m),C}var D=3,v=function(T,m,u){var o={audioCapabilities:[],videoCapabilities:[]};return T.forEach(function(l){o.audioCapabilities.push({contentType:'audio/mp4; codecs="'+l+'"',robustness:u.audioRobustness||""})}),m.forEach(function(l){o.videoCapabilities.push({contentType:'video/mp4; codecs="'+l+'"',robustness:u.videoRobustness||""})}),[o]},S=function(T,m,u,o){switch(T){case B.KeySystems.WIDEVINE:return v(m,u,o);default:throw new Error("Unknown key-system: "+T)}},_=function(){function C(m){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=m,this._config=m.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 T=C.prototype;return T.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},T._registerListeners=function(){this.hls.on(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(z.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(z.Events.MANIFEST_PARSED,this.onManifestParsed,this)},T._unregisterListeners=function(){this.hls.off(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(z.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(z.Events.MANIFEST_PARSED,this.onManifestParsed,this)},T.getLicenseServerUrl=function(u){switch(u){case B.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+u+'"')},T._attemptKeySystemAccess=function(u,o,l){var s=this,w=S(u,o,l,this._drmSystemOptions);R.logger.log("Requesting encrypted media key-system access");var p=this.requestMediaKeySystemAccess(u,w);this.mediaKeysPromise=p.then(function(c){return s._onMediaKeySystemAccessObtained(u,c)}),p.catch(function(c){R.logger.error('Failed to obtain key-system "'+u+'" access:',c)})},T._onMediaKeySystemAccessObtained=function(u,o){var l=this;R.logger.log('Access for key-system "'+u+'" obtained');var s={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:o,mediaKeySystemDomain:u};this._mediaKeysList.push(s);var w=Promise.resolve().then(function(){return o.createMediaKeys()}).then(function(p){return s.mediaKeys=p,R.logger.log('Media-keys created for key-system "'+u+'"'),l._onMediaKeysCreated(),p});return w.catch(function(p){R.logger.error("Failed to create media-keys:",p)}),w},T._onMediaKeysCreated=function(){var u=this;this._mediaKeysList.forEach(function(o){o.mediaKeysSession||(o.mediaKeysSession=o.mediaKeys.createSession(),u._onNewMediaKeySession(o.mediaKeysSession))})},T._onNewMediaKeySession=function(u){var o=this;R.logger.log("New key-system session "+u.sessionId),u.addEventListener("message",function(l){o._onKeySessionMessage(u,l.message)},!1)},T._onKeySessionMessage=function(u,o){R.logger.log("Got EME message event, creating license request"),this._requestLicense(o,function(l){R.logger.log("Received license data (length: "+(l&&l.byteLength)+"), updating key-session"),u.update(l)})},T.onMediaEncrypted=function(u){var o=this;if(R.logger.log('Media is encrypted using "'+u.initDataType+'" init data type'),!this.mediaKeysPromise){R.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(z.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var l=function(w){if(!o._media)return;o._attemptSetMediaKeys(w),o._generateRequestWithPreferredKeySession(u.initDataType,u.initData)};this.mediaKeysPromise.then(l).catch(l)},T._attemptSetMediaKeys=function(u){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var o=this._mediaKeysList[0];if(!o||!o.mediaKeys){R.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(z.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}R.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(o.mediaKeys),this._hasSetMediaKeys=!0}},T._generateRequestWithPreferredKeySession=function(u,o){var l=this,s=this._mediaKeysList[0];if(!s){R.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(z.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(s.mediaKeysSessionInitialized){R.logger.warn("Key-Session already initialized but requested again");return}var w=s.mediaKeysSession;if(!w){R.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(z.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!o){R.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(z.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}R.logger.log('Generating key-session request for "'+u+'" init data type'),s.mediaKeysSessionInitialized=!0,w.generateRequest(u,o).then(function(){R.logger.debug("Key-session generation succeeded")}).catch(function(p){R.logger.error("Error generating key-session request:",p),l.hls.trigger(z.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},T._createLicenseXhr=function(u,o,l){var s=new XMLHttpRequest;s.responseType="arraybuffer",s.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,s,u,o,l);var w=this._licenseXhrSetup;if(w)try{w.call(this.hls,s,u),w=void 0}catch(p){R.logger.error(p)}try{s.readyState||s.open("POST",u,!0),w&&w.call(this.hls,s,u)}catch(p){throw new Error("issue setting up KeySystem license XHR "+p)}return s},T._onLicenseRequestReadyStageChange=function(u,o,l,s){switch(u.readyState){case 4:if(u.status===200){this._requestLicenseFailureCount=0,R.logger.log("License request succeeded");var w=u.response,p=this._licenseResponseCallback;if(p)try{w=p.call(this.hls,u,o)}catch(A){R.logger.error(A)}s(w)}else{if(R.logger.error("License Request XHR failed ("+o+"). Status: "+u.status+" ("+u.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>D){this.hls.trigger(z.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var c=D-this._requestLicenseFailureCount+1;R.logger.warn("Retrying license request, "+c+" attempts left"),this._requestLicense(l,s)}break}},T._generateLicenseRequestChallenge=function(u,o){switch(u.mediaKeySystemDomain){case B.KeySystems.WIDEVINE:return o}throw new Error("unsupported key-system: "+u.mediaKeySystemDomain)},T._requestLicense=function(u,o){R.logger.log("Requesting content license for key-system");var l=this._mediaKeysList[0];if(!l){R.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(z.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var s=this.getLicenseServerUrl(l.mediaKeySystemDomain),w=this._createLicenseXhr(s,u,o);R.logger.log("Sending license request to URL: "+s);var p=this._generateLicenseRequestChallenge(l,u);w.send(p)}catch(c){R.logger.error("Failure requesting DRM license: "+c),this.hls.trigger(z.Events.ERROR,{type:I.ErrorTypes.KEY_SYSTEM_ERROR,details:I.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},T.onMediaAttached=function(u,o){if(!this._emeEnabled)return;var l=o.media;this._media=l,l.addEventListener("encrypted",this._onMediaEncrypted)},T.onMediaDetached=function(){var u=this._media,o=this._mediaKeysList;if(!u)return;u.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(o.map(function(l){if(l.mediaKeysSession)return l.mediaKeysSession.close().catch(function(){})})).then(function(){return u.setMediaKeys(null)}).catch(function(){})},T.onManifestParsed=function(u,o){if(!this._emeEnabled)return;var l=o.levels.map(function(w){return w.audioCodec}).filter(function(w){return!!w}),s=o.levels.map(function(w){return w.videoCodec}).filter(function(w){return!!w});this._attemptKeySystemAccess(B.KeySystems.WIDEVINE,l,s)},P(C,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),C}();X.default=_},"./src/controller/fps-controller.ts":function(re,X,L){"use strict";L.r(X);var z=L("./src/events.ts"),I=L("./src/utils/logger.ts"),R=function(){function B(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 U=B.prototype;return U.setStreamController=function(D){this.streamController=D},U.registerListeners=function(){this.hls.on(z.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},U.unregisterListeners=function(){this.hls.off(z.Events.MEDIA_ATTACHING,this.onMediaAttaching)},U.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},U.onMediaAttaching=function(D,v){var S=this.hls.config;if(S.capLevelOnFPSDrop){var _=v.media instanceof self.HTMLVideoElement?v.media:null;this.media=_,_&&typeof _.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),S.fpsDroppedMonitoringPeriod)}},U.checkFPS=function(D,v,S){var _=performance.now();if(v){if(this.lastTime){var C=_-this.lastTime,T=S-this.lastDroppedFrames,m=v-this.lastDecodedFrames,u=1e3*T/C,o=this.hls;if(o.trigger(z.Events.FPS_DROP,{currentDropped:T,currentDecoded:m,totalDroppedFrames:S}),u>0&&T>o.config.fpsDroppedMonitoringThreshold*m){var l=o.currentLevel;I.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+l),l>0&&(o.autoLevelCapping===-1||o.autoLevelCapping>=l)&&(l=l-1,o.trigger(z.Events.FPS_DROP_LEVEL_CAPPING,{level:l,droppedLevel:o.currentLevel}),o.autoLevelCapping=l,this.streamController.nextLevelSwitch())}}this.lastTime=_,this.lastDroppedFrames=S,this.lastDecodedFrames=v}},U.checkFPSInterval=function(){var D=this.media;if(D)if(this.isVideoPlaybackQualityAvailable){var v=D.getVideoPlaybackQuality();this.checkFPS(D,v.totalVideoFrames,v.droppedVideoFrames)}else this.checkFPS(D,D.webkitDecodedFrameCount,D.webkitDroppedFrameCount)},B}();X.default=R},"./src/controller/fragment-finders.ts":function(re,X,L){"use strict";L.r(X),L.d(X,"findFragmentByPDT",function(){return R}),L.d(X,"findFragmentByPTS",function(){return B}),L.d(X,"fragmentWithinToleranceTest",function(){return U}),L.d(X,"pdtWithinToleranceTest",function(){return P}),L.d(X,"findFragWithCC",function(){return D});var z=L("./src/polyfills/number.ts"),I=L("./src/utils/binary-search.ts");function R(v,S,_){if(S===null||!Array.isArray(v)||!v.length||!Object(z.isFiniteNumber)(S))return null;var C=v[0].programDateTime;if(S<(C||0))return null;var T=v[v.length-1].endProgramDateTime;if(S>=(T||0))return null;_=_||0;for(var m=0;m<v.length;++m){var u=v[m];if(P(S,_,u))return u}return null}function B(v,S,_,C){_===void 0&&(_=0),C===void 0&&(C=0);var T=null;if(v?T=S[v.sn-S[0].sn+1]||null:_===0&&S[0].start===0&&(T=S[0]),T&&U(_,C,T)===0)return T;var m=I.default.search(S,U.bind(null,_,C));return m||T}function U(v,S,_){v===void 0&&(v=0),S===void 0&&(S=0);var C=Math.min(S,_.duration+(_.deltaPTS?_.deltaPTS:0));return _.start+_.duration-C<=v?1:_.start-C>v&&_.start?-1:0}function P(v,S,_){var C=Math.min(S,_.duration+(_.deltaPTS?_.deltaPTS:0))*1e3,T=_.endProgramDateTime||0;return T-C>v}function D(v,S){return I.default.search(v,function(_){return _.cc<S?1:_.cc>S?-1:0})}},"./src/controller/fragment-tracker.ts":function(re,X,L){"use strict";L.r(X),L.d(X,"FragmentState",function(){return R}),L.d(X,"FragmentTracker",function(){return B});var z=L("./src/events.ts"),I=L("./src/types/loader.ts"),R;(function(D){D.NOT_LOADED="NOT_LOADED",D.BACKTRACKED="BACKTRACKED",D.APPENDING="APPENDING",D.PARTIAL="PARTIAL",D.OK="OK"})(R||(R={}));var B=function(){function D(S){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=S,this._registerListeners()}var v=D.prototype;return v._registerListeners=function(){var _=this.hls;_.on(z.Events.BUFFER_APPENDED,this.onBufferAppended,this),_.on(z.Events.FRAG_BUFFERED,this.onFragBuffered,this),_.on(z.Events.FRAG_LOADED,this.onFragLoaded,this)},v._unregisterListeners=function(){var _=this.hls;_.off(z.Events.BUFFER_APPENDED,this.onBufferAppended,this),_.off(z.Events.FRAG_BUFFERED,this.onFragBuffered,this),_.off(z.Events.FRAG_LOADED,this.onFragLoaded,this)},v.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},v.getAppendedFrag=function(_,C){if(C===I.PlaylistLevelType.MAIN){var T=this.activeFragment,m=this.activeParts;if(!T)return null;if(m)for(var u=m.length;u--;){var o=m[u],l=o?o.end:T.appendedPTS;if(o.start<=_&&l!==void 0&&_<=l)return u>9&&(this.activeParts=m.slice(u-9)),o}else if(T.start<=_&&T.appendedPTS!==void 0&&_<=T.appendedPTS)return T}return this.getBufferedFrag(_,C)},v.getBufferedFrag=function(_,C){for(var T=this.fragments,m=Object.keys(T),u=m.length;u--;){var o=T[m[u]];if((o==null?void 0:o.body.type)===C&&o.buffered){var l=o.body;if(l.start<=_&&_<=l.end)return l}}return null},v.detectEvictedFragments=function(_,C,T){var m=this;Object.keys(this.fragments).forEach(function(u){var o=m.fragments[u];if(!o)return;if(!o.buffered){o.body.type===T&&m.removeFragment(o.body);return}var l=o.range[_];if(!l)return;l.time.some(function(s){var w=!m.isTimeBuffered(s.startPTS,s.endPTS,C);return w&&m.removeFragment(o.body),w})})},v.detectPartialFragments=function(_){var C=this,T=this.timeRanges,m=_.frag,u=_.part;if(!T||m.sn==="initSegment")return;var o=P(m),l=this.fragments[o];if(!l)return;Object.keys(T).forEach(function(s){var w=m.elementaryStreams[s];if(!w)return;var p=T[s],c=u!==null||w.partial===!0;l.range[s]=C.getBufferedTimes(m,u,c,p)}),l.backtrack=l.loaded=null,Object.keys(l.range).length?l.buffered=!0:this.removeFragment(l.body)},v.fragBuffered=function(_){var C=P(_),T=this.fragments[C];T&&(T.backtrack=T.loaded=null,T.buffered=!0)},v.getBufferedTimes=function(_,C,T,m){for(var u={time:[],partial:T},o=C?C.start:_.start,l=C?C.end:_.end,s=_.minEndPTS||l,w=_.maxStartPTS||o,p=0;p<m.length;p++){var c=m.start(p)-this.bufferPadding,A=m.end(p)+this.bufferPadding;if(w>=c&&s<=A){u.time.push({startPTS:Math.max(o,m.start(p)),endPTS:Math.min(l,m.end(p))});break}else if(o<A&&l>c)u.partial=!0,u.time.push({startPTS:Math.max(o,m.start(p)),endPTS:Math.min(l,m.end(p))});else if(l<=c)break}return u},v.getPartialFragment=function(_){var C=null,T,m,u,o=0,l=this.bufferPadding,s=this.fragments;return Object.keys(s).forEach(function(w){var p=s[w];if(!p)return;U(p)&&(m=p.body.start-l,u=p.body.end+l,_>=m&&_<=u&&(T=Math.min(_-m,u-_),o<=T&&(C=p.body,o=T)))}),C},v.getState=function(_){var C=P(_),T=this.fragments[C];return T?T.buffered?U(T)?R.PARTIAL:R.OK:T.backtrack?R.BACKTRACKED:R.APPENDING:R.NOT_LOADED},v.backtrack=function(_,C){var T=P(_),m=this.fragments[T];if(!m||m.backtrack)return null;var u=m.backtrack=C||m.loaded;return m.loaded=null,u},v.getBacktrackData=function(_){var C=P(_),T=this.fragments[C];if(T){var m,u=T.backtrack;if(u!=null&&(m=u.payload)!==null&&m!==void 0&&m.byteLength)return u;this.removeFragment(_)}return null},v.isTimeBuffered=function(_,C,T){for(var m,u,o=0;o<T.length;o++){if(m=T.start(o)-this.bufferPadding,u=T.end(o)+this.bufferPadding,_>=m&&C<=u)return!0;if(C<=m)return!1}return!1},v.onFragLoaded=function(_,C){var T=C.frag,m=C.part;if(T.sn==="initSegment"||T.bitrateTest||m)return;var u=P(T);this.fragments[u]={body:T,loaded:C,backtrack:null,buffered:!1,range:Object.create(null)}},v.onBufferAppended=function(_,C){var T=this,m=C.frag,u=C.part,o=C.timeRanges;if(m.type===I.PlaylistLevelType.MAIN)if(this.activeFragment=m,u){var l=this.activeParts;l||(this.activeParts=l=[]),l.push(u)}else this.activeParts=null;this.timeRanges=o,Object.keys(o).forEach(function(s){var w=o[s];if(T.detectEvictedFragments(s,w),!u)for(var p=0;p<w.length;p++)m.appendedPTS=Math.max(w.end(p),m.appendedPTS||0)})},v.onFragBuffered=function(_,C){this.detectPartialFragments(C)},v.hasFragment=function(_){var C=P(_);return!!this.fragments[C]},v.removeFragmentsInRange=function(_,C,T){var m=this;Object.keys(this.fragments).forEach(function(u){var o=m.fragments[u];if(!o)return;if(o.buffered){var l=o.body;l.type===T&&l.start<C&&l.end>_&&m.removeFragment(l)}})},v.removeFragment=function(_){var C=P(_);_.stats.loaded=0,_.clearElementaryStreamInfo(),delete this.fragments[C]},v.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},D}();function U(D){var v,S;return D.buffered&&(((v=D.range.video)===null||v===void 0?void 0:v.partial)||((S=D.range.audio)===null||S===void 0?void 0:S.partial))}function P(D){return D.type+"_"+D.level+"_"+D.urlId+"_"+D.sn}},"./src/controller/gap-controller.ts":function(re,X,L){"use strict";L.r(X),L.d(X,"STALL_MINIMUM_DURATION_MS",function(){return U}),L.d(X,"MAX_START_GAP_JUMP",function(){return P}),L.d(X,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return D}),L.d(X,"SKIP_BUFFER_RANGE_START",function(){return v}),L.d(X,"default",function(){return S});var z=L("./src/utils/buffer-helper.ts"),I=L("./src/errors.ts"),R=L("./src/events.ts"),B=L("./src/utils/logger.ts"),U=250,P=2,D=.1,v=.05,S=function(){function _(T,m,u,o){this.config=void 0,this.media=void 0,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=T,this.media=m,this.fragmentTracker=u,this.hls=o}var C=_.prototype;return C.destroy=function(){this.hls=this.fragmentTracker=this.media=null},C.poll=function(m){var u=this.config,o=this.media,l=this.stalled,s=o.currentTime,w=o.seeking,p=this.seeking&&!w,c=!this.seeking&&w;if(this.seeking=w,s!==m){if(this.moved=!0,l!==null){if(this.stallReported){var A=self.performance.now()-l;B.logger.warn("playback not stuck anymore @"+s+", after "+Math.round(A)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((c||p)&&(this.stalled=null),o.paused||o.ended||o.playbackRate===0||!z.BufferHelper.getBuffered(o).length)return;var y=z.BufferHelper.bufferInfo(o,s,0),f=y.len>0,h=y.nextStart||0;if(!f&&!h)return;if(w){var d=y.len>P,a=!h||h-s>P&&!this.fragmentTracker.getPartialFragment(s);if(d||a)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var b,g=Math.max(h,y.start||0)-s,E=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,M=E==null||((b=E.details)===null||b===void 0)?void 0:b.live,F=M?E.details.targetduration*2:P;if(g>0&&g<=F){this._trySkipBufferHole(null);return}}var j=self.performance.now();if(l===null){this.stalled=j;return}var W=j-l;!w&&W>=U&&this._reportStall(y.len);var O=z.BufferHelper.bufferInfo(o,s,u.maxBufferHole);this._tryFixBufferStall(O,W)},C._tryFixBufferStall=function(m,u){var o=this.config,l=this.fragmentTracker,s=this.media,w=s.currentTime,p=l.getPartialFragment(w);if(p){var c=this._trySkipBufferHole(p);if(c)return}m.len>o.maxBufferHole&&u>o.highBufferWatchdogPeriod*1e3&&(B.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},C._reportStall=function(m){var u=this.hls,o=this.media,l=this.stallReported;l||(this.stallReported=!0,B.logger.warn("Playback stalling at @"+o.currentTime+" due to low buffer (buffer="+m+")"),u.trigger(R.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:m}))},C._trySkipBufferHole=function(m){for(var u=this.config,o=this.hls,l=this.media,s=l.currentTime,w=0,p=z.BufferHelper.getBuffered(l),c=0;c<p.length;c++){var A=p.start(c);if(s+u.maxBufferHole>=w&&s<A){var y=Math.max(A+v,l.currentTime+D);return B.logger.warn("skipping hole, adjusting currentTime from "+s+" to "+y),this.moved=!0,this.stalled=null,l.currentTime=y,m&&o.trigger(R.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+s+" to "+y,frag:m}),y}w=p.end(c)}return 0},C._tryNudgeBuffer=function(){var m=this.config,u=this.hls,o=this.media,l=o.currentTime,s=(this.nudgeRetry||0)+1;if(this.nudgeRetry=s,s<m.nudgeMaxRetry){var w=l+s*m.nudgeOffset;B.logger.warn("Nudging 'currentTime' from "+l+" to "+w),o.currentTime=w,u.trigger(R.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else B.logger.error("Playhead still not moving while enough data buffered @"+l+" after "+m.nudgeMaxRetry+" nudges"),u.trigger(R.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},_}()},"./src/controller/id3-track-controller.ts":function(re,X,L){"use strict";L.r(X);var z=L("./src/events.ts"),I=L("./src/utils/texttrack-utils.ts"),R=L("./src/demux/id3.ts"),B=.25,U=function(){function P(v){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=v,this._registerListeners()}var D=P.prototype;return D.destroy=function(){this._unregisterListeners()},D._registerListeners=function(){var S=this.hls;S.on(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),S.on(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),S.on(z.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),S.on(z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},D._unregisterListeners=function(){var S=this.hls;S.off(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),S.off(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),S.off(z.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),S.off(z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},D.onMediaAttached=function(S,_){this.media=_.media},D.onMediaDetaching=function(){if(!this.id3Track)return;Object(I.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},D.getID3Track=function(S){if(!this.media)return;for(var _=0;_<S.length;_++){var C=S[_];if(C.kind==="metadata"&&C.label==="id3")return Object(I.sendAddTrackEvent)(C,this.media),C}return this.media.addTextTrack("metadata","id3")},D.onFragParsingMetadata=function(S,_){if(!this.media)return;var C=_.frag,T=_.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var m=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,u=0;u<T.length;u++){var o=R.getID3Frames(T[u].data);if(o){var l=T[u].pts,s=u<T.length-1?T[u+1].pts:C.end,w=s-l;w<=0&&(s=l+B);for(var p=0;p<o.length;p++){var c=o[p];if(!R.isTimeStampFrame(c)){var A=new m(l,s,"");A.value=c,this.id3Track.addCue(A)}}}}},D.onBufferFlushing=function(S,_){var C=_.startOffset,T=_.endOffset,m=_.type;if(!m||m==="audio"){var u=this.id3Track;u&&Object(I.removeCuesInRange)(u,C,T)}},P}();X.default=U},"./src/controller/latency-controller.ts":function(re,X,L){"use strict";L.r(X),L.d(X,"default",function(){return P});var z=L("./src/errors.ts"),I=L("./src/events.ts"),R=L("./src/utils/logger.ts");function B(D,v){for(var S=0;S<v.length;S++){var _=v[S];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(D,_.key,_)}}function U(D,v,S){return v&&B(D.prototype,v),S&&B(D,S),D}var P=function(){function D(S){var _=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 _.timeupdate()},this.hls=S,this.config=S.config,this.registerListeners()}var v=D.prototype;return v.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},v.registerListeners=function(){this.hls.on(I.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(I.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(I.Events.ERROR,this.onError,this)},v.unregisterListeners=function(){this.hls.off(I.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(I.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(I.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(I.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(I.Events.ERROR,this.onError)},v.onMediaAttached=function(_,C){this.media=C.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},v.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},v.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},v.onLevelUpdated=function(_,C){var T=C.details;this.levelDetails=T,T.advanced&&this.timeupdate(),!T.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},v.onError=function(_,C){if(C.details!==z.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,R.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},v.timeupdate=function(){var _=this.media,C=this.levelDetails;if(!_||!C)return;this.currentTime=_.currentTime;var T=this.computeLatency();if(T===null)return;this._latency=T;var m=this.config,u=m.lowLatencyMode,o=m.maxLiveSyncPlaybackRate;if(!u||o===1)return;var l=this.targetLatency;if(l===null)return;var s=T-l,w=Math.min(this.maxLatency,l+C.targetduration),p=s<w;if(C.live&&p&&s>.05&&this.forwardBufferLength>1){var c=Math.min(2,Math.max(1,o)),A=Math.round(2/(1+Math.exp(-.75*s-this.edgeStalled))*20)/20;_.playbackRate=Math.min(c,Math.max(1,A))}else _.playbackRate!==1&&_.playbackRate!==0&&(_.playbackRate=1)},v.estimateLiveEdge=function(){var _=this.levelDetails;return _===null?null:_.edge+_.age},v.computeLatency=function(){var _=this.estimateLiveEdge();return _===null?null:_-this.currentTime},U(D,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var _=this.config,C=this.levelDetails;return _.liveMaxLatencyDuration!==void 0?_.liveMaxLatencyDuration:C?_.liveMaxLatencyDurationCount*C.targetduration:0}},{key:"targetLatency",get:function(){var _=this.levelDetails;if(_===null)return null;var C=_.holdBack,T=_.partHoldBack,m=_.targetduration,u=this.config,o=u.liveSyncDuration,l=u.liveSyncDurationCount,s=u.lowLatencyMode,w=this.hls.userConfig,p=s&&T||C;(w.liveSyncDuration||w.liveSyncDurationCount||p===0)&&(p=o!==void 0?o:l*m);var c=m,A=1;return p+Math.min(this.stallCount*A,c)}},{key:"liveSyncPosition",get:function(){var _=this.estimateLiveEdge(),C=this.targetLatency,T=this.levelDetails;if(_===null||C===null||T===null)return null;var m=T.edge,u=_-C-this.edgeStalled,o=m-T.totalduration,l=m-(this.config.lowLatencyMode&&T.partTarget||T.targetduration);return Math.min(Math.max(o,u),l)}},{key:"drift",get:function(){var _=this.levelDetails;return _===null?1:_.drift}},{key:"edgeStalled",get:function(){var _=this.levelDetails;if(_===null)return 0;var C=(this.config.lowLatencyMode&&_.partTarget||_.targetduration)*3;return Math.max(_.age-C,0)}},{key:"forwardBufferLength",get:function(){var _=this.media,C=this.levelDetails;if(!_||!C)return 0;var T=_.buffered.length;return T?_.buffered.end(T-1):C.edge-this.currentTime}}]),D}()},"./src/controller/level-controller.ts":function(re,X,L){"use strict";L.r(X),L.d(X,"default",function(){return u});var z=L("./src/types/level.ts"),I=L("./src/events.ts"),R=L("./src/errors.ts"),B=L("./src/utils/codecs.ts"),U=L("./src/controller/level-helper.ts"),P=L("./src/controller/base-playlist-controller.ts"),D=L("./src/types/loader.ts");function v(){return v=Object.assign||function(o){for(var l=1;l<arguments.length;l++){var s=arguments[l];for(var w in s)Object.prototype.hasOwnProperty.call(s,w)&&(o[w]=s[w])}return o},v.apply(this,arguments)}function S(o,l){for(var s=0;s<l.length;s++){var w=l[s];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(o,w.key,w)}}function _(o,l,s){return l&&S(o.prototype,l),s&&S(o,s),o}function C(o,l){o.prototype=Object.create(l.prototype),o.prototype.constructor=o,T(o,l)}function T(o,l){return T=Object.setPrototypeOf||function(w,p){return w.__proto__=p,w},T(o,l)}var m=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),u=function(o){C(l,o);function l(w){var p;return p=o.call(this,w,"[level-controller]")||this,p._levels=[],p._firstLevel=-1,p._startLevel=void 0,p.currentLevelIndex=-1,p.manualLevelIndex=-1,p.onParsedComplete=void 0,p._registerListeners(),p}var s=l.prototype;return s._registerListeners=function(){var p=this.hls;p.on(I.Events.MANIFEST_LOADED,this.onManifestLoaded,this),p.on(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),p.on(I.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),p.on(I.Events.FRAG_LOADED,this.onFragLoaded,this),p.on(I.Events.ERROR,this.onError,this)},s._unregisterListeners=function(){var p=this.hls;p.off(I.Events.MANIFEST_LOADED,this.onManifestLoaded,this),p.off(I.Events.LEVEL_LOADED,this.onLevelLoaded,this),p.off(I.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),p.off(I.Events.FRAG_LOADED,this.onFragLoaded,this),p.off(I.Events.ERROR,this.onError,this)},s.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,o.prototype.destroy.call(this)},s.startLoad=function(){var p=this._levels;p.forEach(function(c){c.loadError=0}),o.prototype.startLoad.call(this)},s.onManifestLoaded=function(p,c){var A=[],y=[],f=[],h,d={},a,b=!1,g=!1,E=!1;if(c.levels.forEach(function(W){var O=W.attrs;b=b||!!(W.width&&W.height),g=g||!!W.videoCodec,E=E||!!W.audioCodec,m&&W.audioCodec&&W.audioCodec.indexOf("mp4a.40.34")!==-1&&(W.audioCodec=void 0);var k=W.bitrate+"-"+W.attrs.RESOLUTION+"-"+W.attrs.CODECS;a=d[k],a?a.url.push(W.url):(a=new z.Level(W),d[k]=a,A.push(a)),O&&(O.AUDIO&&Object(U.addGroupId)(a,"audio",O.AUDIO),O.SUBTITLES&&Object(U.addGroupId)(a,"text",O.SUBTITLES))}),(b||g)&&E&&(A=A.filter(function(W){var O=W.videoCodec,k=W.width,K=W.height;return!!O||!!(k&&K)})),A=A.filter(function(W){var O=W.audioCodec,k=W.videoCodec;return(!O||Object(B.isCodecSupportedInMp4)(O,"audio"))&&(!k||Object(B.isCodecSupportedInMp4)(k,"video"))}),c.audioTracks&&(y=c.audioTracks.filter(function(W){return!W.audioCodec||Object(B.isCodecSupportedInMp4)(W.audioCodec,"audio")}),Object(U.assignTrackIdsByGroup)(y)),c.subtitles&&(f=c.subtitles,Object(U.assignTrackIdsByGroup)(f)),A.length>0){h=A[0].bitrate,A.sort(function(W,O){return W.bitrate-O.bitrate}),this._levels=A;for(var M=0;M<A.length;M++)if(A[M].bitrate===h){this._firstLevel=M,this.log("manifest loaded, "+A.length+" level(s) found, first bitrate: "+h);break}var F=E&&!g,j={levels:A,audioTracks:y,subtitleTracks:f,firstLevel:this._firstLevel,stats:c.stats,audio:E,video:g,altAudio:!F&&y.some(function(W){return!!W.url})};this.hls.trigger(I.Events.MANIFEST_PARSED,j),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(I.Events.ERROR,{type:R.ErrorTypes.MEDIA_ERROR,details:R.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:c.url,reason:"no level with compatible codecs found in manifest"})},s.onError=function(p,c){if(o.prototype.onError.call(this,p,c),c.fatal)return;var A=c.context,y=this._levels[this.currentLevelIndex];if(A&&(A.type===D.PlaylistContextType.AUDIO_TRACK&&y.audioGroupIds&&A.groupId===y.audioGroupIds[y.urlId]||A.type===D.PlaylistContextType.SUBTITLE_TRACK&&y.textGroupIds&&A.groupId===y.textGroupIds[y.urlId])){this.redundantFailover(this.currentLevelIndex);return}var f=!1,h=!0,d;switch(c.details){case R.ErrorDetails.FRAG_LOAD_ERROR:case R.ErrorDetails.FRAG_LOAD_TIMEOUT:case R.ErrorDetails.KEY_LOAD_ERROR:case R.ErrorDetails.KEY_LOAD_TIMEOUT:if(c.frag){var a=this._levels[c.frag.level];a?(a.fragmentError++,a.fragmentError>this.hls.config.fragLoadingMaxRetry&&(d=c.frag.level)):d=c.frag.level}break;case R.ErrorDetails.LEVEL_LOAD_ERROR:case R.ErrorDetails.LEVEL_LOAD_TIMEOUT:A&&(A.deliveryDirectives&&(h=!1),d=A.level),f=!0;break;case R.ErrorDetails.REMUX_ALLOC_ERROR:d=c.level,f=!0;break}d!==void 0&&this.recoverLevel(c,d,f,h)},s.recoverLevel=function(p,c,A,y){var f=p.details,h=this._levels[c];if(h.loadError++,A){var d=this.retryLoadingOrFail(p);if(d)p.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(y){var a=h.url.length;if(a>1&&h.loadError<a)p.levelRetry=!0,this.redundantFailover(c);else if(this.manualLevelIndex===-1){var b=c===0?this._levels.length-1:c-1;this.currentLevelIndex!==b&&this._levels[b].loadError===0&&(this.warn(f+": switch to "+b),p.levelRetry=!0,this.hls.nextAutoLevel=b)}}},s.redundantFailover=function(p){var c=this._levels[p],A=c.url.length;if(A>1){var y=(c.urlId+1)%A;this.warn("Switching to redundant URL-id "+y),this._levels.forEach(function(f){f.urlId=y}),this.level=p}},s.onFragLoaded=function(p,c){var A=c.frag;if(A!==void 0&&A.type===D.PlaylistLevelType.MAIN){var y=this._levels[A.level];y!==void 0&&(y.fragmentError=0,y.loadError=0)}},s.onLevelLoaded=function(p,c){var A,y=c.level,f=c.details,h=this._levels[y];if(!h){var d;this.warn("Invalid level index "+y),(d=c.deliveryDirectives)!==null&&d!==void 0&&d.skip&&(f.deltaUpdateFailed=!0);return}y===this.currentLevelIndex?(h.fragmentError===0&&(h.loadError=0,this.retryCount=0),this.playlistLoaded(y,c,h.details)):(A=c.deliveryDirectives)!==null&&A!==void 0&&A.skip&&(f.deltaUpdateFailed=!0)},s.onAudioTrackSwitched=function(p,c){var A=this.hls.levels[this.currentLevelIndex];if(!A)return;if(A.audioGroupIds){for(var y=-1,f=this.hls.audioTracks[c.id].groupId,h=0;h<A.audioGroupIds.length;h++)if(A.audioGroupIds[h]===f){y=h;break}y!==A.urlId&&(A.urlId=y,this.startLoad())}},s.loadPlaylist=function(p){var c=this.currentLevelIndex,A=this._levels[c];if(this.canLoad&&A&&A.url.length>0){var y=A.urlId,f=A.url[y];if(p)try{f=p.addDirectives(f)}catch(h){this.warn("Could not construct new URL with HLS Delivery Directives: "+h)}this.log("Attempt loading level index "+c+(p?" at sn "+p.msn+" part "+p.part:"")+" with URL-id "+y+" "+f),this.clearTimer(),this.hls.trigger(I.Events.LEVEL_LOADING,{url:f,level:c,id:y,deliveryDirectives:p||null})}},s.removeLevel=function(p,c){var A=function(h,d){return d!==c},y=this._levels.filter(function(f,h){return h!==p?!0:f.url.length>1&&c!==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,h){var d=f.details;return d!=null&&d.fragments&&d.fragments.forEach(function(a){a.level=h}),f});this._levels=y,this.hls.trigger(I.Events.LEVELS_UPDATED,{levels:y})},_(l,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(p){var c,A=this._levels;if(A.length===0)return;if(this.currentLevelIndex===p&&(c=A[p])!==null&&c!==void 0&&c.details)return;if(p<0||p>=A.length){var y=p<0;if(this.hls.trigger(I.Events.ERROR,{type:R.ErrorTypes.OTHER_ERROR,details:R.ErrorDetails.LEVEL_SWITCH_ERROR,level:p,fatal:y,reason:"invalid level idx"}),y)return;p=Math.min(p,A.length-1)}this.clearTimer();var f=this.currentLevelIndex,h=A[f],d=A[p];this.log("switching to level "+p+" from "+f),this.currentLevelIndex=p;var a=v({},d,{level:p,maxBitrate:d.maxBitrate,uri:d.uri,urlId:d.urlId});delete a._urlId,this.hls.trigger(I.Events.LEVEL_SWITCHING,a);var b=d.details;if(!b||b.live){var g=this.switchParams(d.uri,h==null?void 0:h.details);this.loadPlaylist(g)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(p){this.manualLevelIndex=p,this._startLevel===void 0&&(this._startLevel=p),p!==-1&&(this.level=p)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(p){this._firstLevel=p}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var p=this.hls.config.startLevel;return p!==void 0?p:this._firstLevel}else return this._startLevel},set:function(p){this._startLevel=p}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(p){this.level=p,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=p)}}]),l}(P.default)},"./src/controller/level-helper.ts":function(re,X,L){"use strict";L.r(X),L.d(X,"addGroupId",function(){return R}),L.d(X,"assignTrackIdsByGroup",function(){return B}),L.d(X,"updatePTS",function(){return U}),L.d(X,"updateFragPTSDTS",function(){return D}),L.d(X,"mergeDetails",function(){return v}),L.d(X,"mapPartIntersection",function(){return S}),L.d(X,"mapFragmentIntersection",function(){return _}),L.d(X,"adjustSliding",function(){return C}),L.d(X,"addSliding",function(){return T}),L.d(X,"computeReloadInterval",function(){return m}),L.d(X,"getFragmentWithSN",function(){return u}),L.d(X,"getPartWith",function(){return o});var z=L("./src/polyfills/number.ts"),I=L("./src/utils/logger.ts");function R(l,s,w){switch(s){case"audio":l.audioGroupIds||(l.audioGroupIds=[]),l.audioGroupIds.push(w);break;case"text":l.textGroupIds||(l.textGroupIds=[]),l.textGroupIds.push(w);break}}function B(l){var s={};l.forEach(function(w){var p=w.groupId||"";w.id=s[p]=s[p]||0,s[p]++})}function U(l,s,w){var p=l[s],c=l[w];P(p,c)}function P(l,s){var w=s.startPTS;if(Object(z.isFiniteNumber)(w)){var p=0,c;s.sn>l.sn?(p=w-l.start,c=l):(p=l.start-w,c=s),c.duration!==p&&(c.duration=p)}else if(s.sn>l.sn){var A=l.cc===s.cc;A&&l.minEndPTS?s.start=l.start+(l.minEndPTS-l.start):s.start=l.start+l.duration}else s.start=Math.max(l.start-s.duration,0)}function D(l,s,w,p,c,A){var y=p-w;y<=0&&(I.logger.warn("Fragment should have a positive duration",s),p=w+s.duration,A=c+s.duration);var f=w,h=p,d=s.startPTS,a=s.endPTS;if(Object(z.isFiniteNumber)(d)){var b=Math.abs(d-w);Object(z.isFiniteNumber)(s.deltaPTS)?s.deltaPTS=Math.max(b,s.deltaPTS):s.deltaPTS=b,f=Math.max(w,d),w=Math.min(w,d),c=Math.min(c,s.startDTS),h=Math.min(p,a),p=Math.max(p,a),A=Math.max(A,s.endDTS)}s.duration=p-w;var g=w-s.start;s.appendedPTS=p,s.start=s.startPTS=w,s.maxStartPTS=f,s.startDTS=c,s.endPTS=p,s.minEndPTS=h,s.endDTS=A;var E=s.sn;if(!l||E<l.startSN||E>l.endSN)return 0;var M,F=E-l.startSN,j=l.fragments;for(j[F]=s,M=F;M>0;M--)P(j[M],j[M-1]);for(M=F;M<j.length-1;M++)P(j[M],j[M+1]);return l.fragmentHint&&P(j[j.length-1],l.fragmentHint),l.PTSKnown=l.alignedSliding=!0,g}function v(l,s){for(var w=null,p=l.fragments,c=p.length-1;c>=0;c--){var A=p[c].initSegment;if(A){w=A;break}}l.fragmentHint&&delete l.fragmentHint.endPTS;var y=0,f;if(_(l,s,function(M,F){M.relurl&&(y=M.cc-F.cc),Object(z.isFiniteNumber)(M.startPTS)&&Object(z.isFiniteNumber)(M.endPTS)&&(F.start=F.startPTS=M.startPTS,F.startDTS=M.startDTS,F.appendedPTS=M.appendedPTS,F.maxStartPTS=M.maxStartPTS,F.endPTS=M.endPTS,F.endDTS=M.endDTS,F.minEndPTS=M.minEndPTS,F.duration=M.endPTS-M.startPTS,F.duration&&(f=F),s.PTSKnown=s.alignedSliding=!0),F.elementaryStreams=M.elementaryStreams,F.loader=M.loader,F.stats=M.stats,F.urlId=M.urlId,M.initSegment&&(F.initSegment=M.initSegment,w=M.initSegment)}),w){var h=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments;h.forEach(function(M){var F;(!M.initSegment||M.initSegment.relurl===((F=w)===null||F===void 0?void 0:F.relurl))&&(M.initSegment=w)})}if(s.skippedSegments&&(s.deltaUpdateFailed=s.fragments.some(function(M){return!M}),s.deltaUpdateFailed)){I.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var d=s.skippedSegments;d--;)s.fragments.shift();s.startSN=s.fragments[0].sn,s.startCC=s.fragments[0].cc}var a=s.fragments;if(y){I.logger.warn("discontinuity sliding from playlist, take drift into account");for(var b=0;b<a.length;b++)a[b].cc+=y}s.skippedSegments&&(s.startCC=s.fragments[0].cc),S(l.partList,s.partList,function(M,F){F.elementaryStreams=M.elementaryStreams,F.stats=M.stats}),f?D(s,f,f.startPTS,f.endPTS,f.startDTS,f.endDTS):C(l,s),a.length&&(s.totalduration=s.edge-a[0].start),s.driftStartTime=l.driftStartTime,s.driftStart=l.driftStart;var g=s.advancedDateTime;if(s.advanced&&g){var E=s.edge;s.driftStart||(s.driftStartTime=g,s.driftStart=E),s.driftEndTime=g,s.driftEnd=E}else s.driftEndTime=l.driftEndTime,s.driftEnd=l.driftEnd,s.advancedDateTime=l.advancedDateTime}function S(l,s,w){if(l&&s)for(var p=0,c=0,A=l.length;c<=A;c++){var y=l[c],f=s[c+p];y&&f&&y.index===f.index&&y.fragment.sn===f.fragment.sn?w(y,f):p--}}function _(l,s,w){for(var p=s.skippedSegments,c=Math.max(l.startSN,s.startSN)-s.startSN,A=(l.fragmentHint?1:0)+(p?s.endSN:Math.min(l.endSN,s.endSN))-s.startSN,y=s.startSN-l.startSN,f=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments,h=l.fragmentHint?l.fragments.concat(l.fragmentHint):l.fragments,d=c;d<=A;d++){var a=h[y+d],b=f[d];p&&!b&&d<p&&(b=s.fragments[d]=a),a&&b&&w(a,b)}}function C(l,s){var w=s.startSN+s.skippedSegments-l.startSN,p=l.fragments;if(w<0||w>=p.length)return;T(s,p[w].start)}function T(l,s){if(s){for(var w=l.fragments,p=l.skippedSegments;p<w.length;p++)w[p].start+=s;l.fragmentHint&&(l.fragmentHint.start+=s)}}function m(l,s){var w=1e3*l.levelTargetDuration,p=w/2,c=l.age,A=c>0&&c<w*3,y=s.loading.end-s.loading.start,f,h=l.availabilityDelay;if(l.updated===!1)if(A){var d=333*l.misses;f=Math.max(Math.min(p,y*2),d),l.availabilityDelay=(l.availabilityDelay||0)+f}else f=p;else A?(h=Math.min(h||w/2,c),l.availabilityDelay=h,f=h+w-c):f=w-y;return Math.round(f)}function u(l,s,w){if(!l||!l.details)return null;var p=l.details,c=p.fragments[s-p.startSN];return c||(c=p.fragmentHint,c&&c.sn===s?c:s<p.startSN&&w&&w.sn===s?w:null)}function o(l,s,w){if(!l||!l.details)return null;var p=l.details.partList;if(p)for(var c=p.length;c--;){var A=p[c];if(A.index===w&&A.fragment.sn===s)return A}return null}},"./src/controller/stream-controller.ts":function(re,X,L){"use strict";L.r(X),L.d(X,"default",function(){return p});var z=L("./src/polyfills/number.ts"),I=L("./src/controller/base-stream-controller.ts"),R=L("./src/is-supported.ts"),B=L("./src/events.ts"),U=L("./src/utils/buffer-helper.ts"),P=L("./src/controller/fragment-tracker.ts"),D=L("./src/types/loader.ts"),v=L("./src/loader/fragment.ts"),S=L("./src/demux/transmuxer-interface.ts"),_=L("./src/types/transmuxer.ts"),C=L("./src/controller/gap-controller.ts"),T=L("./src/errors.ts"),m=L("./src/utils/logger.ts");function u(c,A){for(var y=0;y<A.length;y++){var f=A[y];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(c,f.key,f)}}function o(c,A,y){return A&&u(c.prototype,A),y&&u(c,y),c}function l(c,A){c.prototype=Object.create(A.prototype),c.prototype.constructor=c,s(c,A)}function s(c,A){return s=Object.setPrototypeOf||function(f,h){return f.__proto__=h,f},s(c,A)}var w=100,p=function(c){l(A,c);function A(f,h){var d;return d=c.call(this,f,h,"[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 y=A.prototype;return y._registerListeners=function(){var h=this.hls;h.on(B.Events.MEDIA_ATTACHED,this.onMediaAttached,this),h.on(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),h.on(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.on(B.Events.MANIFEST_PARSED,this.onManifestParsed,this),h.on(B.Events.LEVEL_LOADING,this.onLevelLoading,this),h.on(B.Events.LEVEL_LOADED,this.onLevelLoaded,this),h.on(B.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),h.on(B.Events.ERROR,this.onError,this),h.on(B.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),h.on(B.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),h.on(B.Events.BUFFER_CREATED,this.onBufferCreated,this),h.on(B.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),h.on(B.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),h.on(B.Events.FRAG_BUFFERED,this.onFragBuffered,this)},y._unregisterListeners=function(){var h=this.hls;h.off(B.Events.MEDIA_ATTACHED,this.onMediaAttached,this),h.off(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),h.off(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.off(B.Events.MANIFEST_PARSED,this.onManifestParsed,this),h.off(B.Events.LEVEL_LOADED,this.onLevelLoaded,this),h.off(B.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),h.off(B.Events.ERROR,this.onError,this),h.off(B.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),h.off(B.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),h.off(B.Events.BUFFER_CREATED,this.onBufferCreated,this),h.off(B.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),h.off(B.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),h.off(B.Events.FRAG_BUFFERED,this.onFragBuffered,this)},y.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},y.startLoad=function(h){if(this.levels){var d=this.lastCurrentTime,a=this.hls;if(this.stopLoad(),this.setInterval(w),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var b=a.startLevel;b===-1&&(a.config.testBandwidth?(b=0,this.bitrateTest=!0):b=a.nextAutoLevel),this.level=a.nextLoadLevel=b,this.loadedmetadata=!1}d>0&&h===-1&&(this.log("Override startPosition with lastCurrentTime @"+d.toFixed(3)),h=d),this.state=I.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=h,this.tick()}else this._forceStartLoad=!0,this.state=I.State.STOPPED},y.stopLoad=function(){this._forceStartLoad=!1,c.prototype.stopLoad.call(this)},y.doTick=function(){switch(this.state){case I.State.IDLE:this.doTickIdle();break;case I.State.WAITING_LEVEL:{var h,d=this.levels,a=this.level,b=d==null||((h=d[a])===null||h===void 0)?void 0:h.details;if(b&&(!b.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(b))break;this.state=I.State.IDLE;break}break}case I.State.FRAG_LOADING_WAITING_RETRY:{var g,E=self.performance.now(),M=this.retryDate;(!M||E>=M||(g=this.media)!==null&&g!==void 0&&g.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=I.State.IDLE)}break;default:break}this.onTickEnd()},y.onTickEnd=function(){c.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},y.doTickIdle=function(){var h,d,a=this.hls,b=this.levelLastLoaded,g=this.levels,E=this.media,M=a.config,F=a.nextLoadLevel;if(b===null||!E&&(this.startFragRequested||!M.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!g||!g[F])return;var j=g[F];this.level=a.nextLoadLevel=F;var W=j.details;if(!W||this.state===I.State.WAITING_LEVEL||W.live&&this.levelLastLoaded!==F){this.state=I.State.WAITING_LEVEL;return}var O=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:E,D.PlaylistLevelType.MAIN);if(O===null)return;var k=O.len,K=this.getMaxBufferLength(j.maxBitrate);if(k>=K)return;if(this._streamEnded(O,W)){var Y={};this.altAudio&&(Y.type="video"),this.hls.trigger(B.Events.BUFFER_EOS,Y),this.state=I.State.ENDED;return}var q=O.end,oe=this.getNextFragment(q,W);if(this.couldBacktrack&&!this.fragPrevious&&oe&&oe.sn!=="initSegment"){var Te=oe.sn-W.startSN;Te>1&&(oe=W.fragments[Te-1],this.fragmentTracker.removeFragment(oe))}if(oe&&this.fragmentTracker.getState(oe)===P.FragmentState.OK&&this.nextLoadPosition>q){var ve=this.audioOnly&&!this.altAudio?v.ElementaryStreamTypes.AUDIO:v.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(E,ve,D.PlaylistLevelType.MAIN),oe=this.getNextFragment(this.nextLoadPosition,W)}if(!oe)return;oe.initSegment&&!oe.initSegment.data&&!this.bitrateTest&&(oe=oe.initSegment),((h=oe.decryptdata)===null||h===void 0?void 0:h.keyFormat)==="identity"&&!((d=oe.decryptdata)!==null&&d!==void 0&&d.key)?this.loadKey(oe,W):this.loadFragment(oe,W,q)},y.loadFragment=function(h,d,a){var b,g=this.fragmentTracker.getState(h);if(this.fragCurrent=h,g===P.FragmentState.BACKTRACKED){var E=this.fragmentTracker.getBacktrackData(h);if(E){this._handleFragmentLoadProgress(E),this._handleFragmentLoadComplete(E);return}else g=P.FragmentState.NOT_LOADED}g===P.FragmentState.NOT_LOADED||g===P.FragmentState.PARTIAL?h.sn==="initSegment"?this._loadInitSegment(h):this.bitrateTest?(h.bitrateTest=!0,this.log("Fragment "+h.sn+" of level "+h.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(h)):(this.startFragRequested=!0,c.prototype.loadFragment.call(this,h,d,a)):g===P.FragmentState.APPENDING?this.reduceMaxBufferLength(h.duration)&&this.fragmentTracker.removeFragment(h):((b=this.media)===null||b===void 0?void 0:b.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},y.getAppendedFrag=function(h){var d=this.fragmentTracker.getAppendedFrag(h,D.PlaylistLevelType.MAIN);return d&&"fragment"in d?d.fragment:d},y.getBufferedFrag=function(h){return this.fragmentTracker.getBufferedFrag(h,D.PlaylistLevelType.MAIN)},y.followingBufferedFrag=function(h){return h?this.getBufferedFrag(h.end+.5):null},y.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},y.nextLevelSwitch=function(){var h=this.levels,d=this.media;if(d!=null&&d.readyState){var a,b=this.getAppendedFrag(d.currentTime);if(b&&b.start>1&&this.flushMainBuffer(0,b.start-1),!d.paused&&h){var g=this.hls.nextLoadLevel,E=h[g],M=this.fragLastKbps;M&&this.fragCurrent?a=this.fragCurrent.duration*E.maxBitrate/(1e3*M)+1:a=0}else a=0;var F=this.getBufferedFrag(d.currentTime+a);if(F){var j=this.followingBufferedFrag(F);if(j){this.abortCurrentFrag();var W=j.maxStartPTS?j.maxStartPTS:j.start,O=j.duration,k=Math.max(F.end,W+Math.min(Math.max(O-this.config.maxFragLookUpTolerance,O*.5),O*.75));this.flushMainBuffer(k,Number.POSITIVE_INFINITY)}}}},y.abortCurrentFrag=function(){var h=this.fragCurrent;this.fragCurrent=null,h!=null&&h.loader&&h.loader.abort(),this.state===I.State.KEY_LOADING&&(this.state=I.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},y.flushMainBuffer=function(h,d){c.prototype.flushMainBuffer.call(this,h,d,this.altAudio?"video":null)},y.onMediaAttached=function(h,d){c.prototype.onMediaAttached.call(this,h,d);var a=d.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),a.addEventListener("playing",this.onvplaying),a.addEventListener("seeked",this.onvseeked),this.gapController=new C.default(this.config,a,this.fragmentTracker,this.hls)},y.onMediaDetaching=function(){var h=this.media;h&&(h.removeEventListener("playing",this.onvplaying),h.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),c.prototype.onMediaDetaching.call(this)},y.onMediaPlaying=function(){this.tick()},y.onMediaSeeked=function(){var h=this.media,d=h?h.currentTime:null;Object(z.isFiniteNumber)(d)&&this.log("Media seeked to "+d.toFixed(3)),this.tick()},y.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(B.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},y.onManifestParsed=function(h,d){var a=!1,b=!1,g;d.levels.forEach(function(E){g=E.audioCodec,g&&(g.indexOf("mp4a.40.2")!==-1&&(a=!0),g.indexOf("mp4a.40.5")!==-1&&(b=!0))}),this.audioCodecSwitch=a&&b&&!Object(R.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},y.onLevelLoading=function(h,d){var a=this.levels;if(!a||this.state!==I.State.IDLE)return;var b=a[d.level];(!b.details||b.details.live&&this.levelLastLoaded!==d.level||this.waitForCdnTuneIn(b.details))&&(this.state=I.State.WAITING_LEVEL)},y.onLevelLoaded=function(h,d){var a,b=this.levels,g=d.level,E=d.details,M=E.totalduration;if(!b){this.warn("Levels were reset while loading level "+g);return}this.log("Level "+g+" loaded ["+E.startSN+","+E.endSN+"], cc ["+E.startCC+", "+E.endCC+"] duration:"+M);var F=this.fragCurrent;F&&(this.state===I.State.FRAG_LOADING||this.state===I.State.FRAG_LOADING_WAITING_RETRY)&&(F.level!==d.level&&F.loader&&(this.state=I.State.IDLE,F.loader.abort()));var j=b[g],W=0;if(E.live||(a=j.details)!==null&&a!==void 0&&a.live){if(E.fragments[0]||(E.deltaUpdateFailed=!0),E.deltaUpdateFailed)return;W=this.alignPlaylists(E,j.details)}if(j.details=E,this.levelLastLoaded=g,this.hls.trigger(B.Events.LEVEL_UPDATED,{details:E,level:g}),this.state===I.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(E))return;this.state=I.State.IDLE}this.startFragRequested?E.live&&this.synchronizeToLiveEdge(E):this.setStartPosition(E,W),this.tick()},y._handleFragmentLoadProgress=function(h){var d,a=h.frag,b=h.part,g=h.payload,E=this.levels;if(!E){this.warn("Levels were reset while fragment load was in progress. Fragment "+a.sn+" of level "+a.level+" will not be buffered");return}var M=E[a.level],F=M.details;if(!F){this.warn("Dropping fragment "+a.sn+" of level "+a.level+" after level details were reset");return}var j=M.videoCodec,W=F.PTSKnown||!F.live,O=(d=a.initSegment)===null||d===void 0?void 0:d.data,k=this._getAudioCodec(M),K=this.transmuxer=this.transmuxer||new S.default(this.hls,D.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),Y=b?b.index:-1,q=Y!==-1,oe=new _.ChunkMetadata(a.level,a.sn,a.stats.chunkCount,g.byteLength,Y,q),Te=this.initPTS[a.cc];K.push(g,O,k,j,a,b,F.totalduration,W,oe,Te)},y.onAudioTrackSwitching=function(h,d){var a=this.altAudio,b=!!d.url,g=d.id;if(!b){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var E=this.fragCurrent;E!=null&&E.loader&&(this.log("Switching to main audio track, cancel main fragment load"),E.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var M=this.hls;a&&M.trigger(B.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),M.trigger(B.Events.AUDIO_TRACK_SWITCHED,{id:g})}},y.onAudioTrackSwitched=function(h,d){var a=d.id,b=!!this.hls.audioTracks[a].url;if(b){var g=this.videoBuffer;g&&this.mediaBuffer!==g&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=g)}this.altAudio=b,this.tick()},y.onBufferCreated=function(h,d){var a=d.tracks,b,g,E=!1;for(var M in a){var F=a[M];if(F.id==="main"){if(g=M,b=F,M==="video"){var j=a[M];j&&(this.videoBuffer=j.buffer)}}else E=!0}E&&b?(this.log("Alternate track found, use "+g+".buffered to schedule main fragment loading"),this.mediaBuffer=b.buffer):this.mediaBuffer=this.media},y.onFragBuffered=function(h,d){var a=d.frag,b=d.part;if(a&&a.type!==D.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(a)){this.warn("Fragment "+a.sn+(b?" p: "+b.index:"")+" of level "+a.level+" finished buffering, but was aborted. state: "+this.state),this.state===I.State.PARSED&&(this.state=I.State.IDLE);return}var g=b?b.stats:a.stats;this.fragLastKbps=Math.round(8*g.total/(g.buffering.end-g.loading.first)),a.sn!=="initSegment"&&(this.fragPrevious=a),this.fragBufferedComplete(a,b)},y.onError=function(h,d){switch(d.details){case T.ErrorDetails.FRAG_LOAD_ERROR:case T.ErrorDetails.FRAG_LOAD_TIMEOUT:case T.ErrorDetails.KEY_LOAD_ERROR:case T.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(D.PlaylistLevelType.MAIN,d);break;case T.ErrorDetails.LEVEL_LOAD_ERROR:case T.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==I.State.ERROR&&(d.fatal?(this.warn(""+d.details),this.state=I.State.ERROR):!d.levelRetry&&this.state===I.State.WAITING_LEVEL&&(this.state=I.State.IDLE));break;case T.ErrorDetails.BUFFER_FULL_ERROR:if(d.parent==="main"&&(this.state===I.State.PARSING||this.state===I.State.PARSED)){var a=!0,b=this.getFwdBufferInfo(this.media,D.PlaylistLevelType.MAIN);b&&b.len>.5&&(a=!this.reduceMaxBufferLength(b.len)),a&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},y.checkBuffer=function(){var h=this.media,d=this.gapController;if(!h||!d||!h.readyState)return;var a=U.BufferHelper.getBuffered(h);!this.loadedmetadata&&a.length?(this.loadedmetadata=!0,this.seekToStartPos()):d.poll(this.lastCurrentTime),this.lastCurrentTime=h.currentTime},y.onFragLoadEmergencyAborted=function(){this.state=I.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},y.onBufferFlushed=function(h,d){var a=d.type;if(a!==v.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var b=(a===v.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(b,a,D.PlaylistLevelType.MAIN)}},y.onLevelsUpdated=function(h,d){this.levels=d.levels},y.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},y.seekToStartPos=function(){var h=this.media,d=h.currentTime,a=this.startPosition;if(a>=0&&d<a){if(h.seeking){m.logger.log("could not seek to "+a+", already seeking at "+d);return}var b=U.BufferHelper.getBuffered(h),g=b.length?b.start(0):0,E=g-a;E>0&&(E<this.config.maxBufferHole||E<this.config.maxFragLookUpTolerance)&&(m.logger.log("adjusting start position by "+E+" to match buffer start"),a+=E,this.startPosition=a),this.log("seek to target start position "+a+" from current time "+d),h.currentTime=a}},y._getAudioCodec=function(h){var d=this.config.defaultAudioCodec||h.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},y._loadBitrateTestFrag=function(h){var d=this;this._doFragLoad(h).then(function(a){var b=d.hls;if(!a||b.nextLoadLevel||d.fragContextChanged(h))return;d.fragLoadError=0,d.state=I.State.IDLE,d.startFragRequested=!1,d.bitrateTest=!1;var g=h.stats;g.parsing.start=g.parsing.end=g.buffering.start=g.buffering.end=self.performance.now(),b.trigger(B.Events.FRAG_LOADED,a)})},y._handleTransmuxComplete=function(h){var d,a="main",b=this.hls,g=h.remuxResult,E=h.chunkMeta,M=this.getCurrentContext(E);if(!M){this.warn("The loading context changed while buffering fragment "+E.sn+" of level "+E.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(E.level);return}var F=M.frag,j=M.part,W=M.level,O=g.video,k=g.text,K=g.id3,Y=g.initSegment,q=this.altAudio?void 0:g.audio;if(this.fragContextChanged(F))return;if(this.state=I.State.PARSING,Y){Y.tracks&&(this._bufferInitSegment(W,Y.tracks,F,E),b.trigger(B.Events.FRAG_PARSING_INIT_SEGMENT,{frag:F,id:a,tracks:Y.tracks}));var oe=Y.initPTS,Te=Y.timescale;Object(z.isFiniteNumber)(oe)&&(this.initPTS[F.cc]=oe,b.trigger(B.Events.INIT_PTS_FOUND,{frag:F,id:a,initPTS:oe,timescale:Te}))}if(O&&g.independent!==!1){if(W.details){var ve=O.startPTS,ge=O.endPTS,me=O.startDTS,le=O.endDTS;if(j)j.elementaryStreams[O.type]={startPTS:ve,endPTS:ge,startDTS:me,endDTS:le};else if(O.firstKeyFrame&&O.independent&&(this.couldBacktrack=!0),O.dropped&&O.independent){var ie=this.getLoadPosition()+this.config.maxBufferHole;if(ie<ve){this.backtrack(F);return}F.setElementaryStreamInfo(O.type,F.start,ge,F.start,le,!0)}F.setElementaryStreamInfo(O.type,ve,ge,me,le),this.bufferFragmentData(O,F,j,E)}}else if(g.independent===!1){this.backtrack(F);return}if(q){var he=q.startPTS,$=q.endPTS,te=q.startDTS,Z=q.endDTS;j&&(j.elementaryStreams[v.ElementaryStreamTypes.AUDIO]={startPTS:he,endPTS:$,startDTS:te,endDTS:Z}),F.setElementaryStreamInfo(v.ElementaryStreamTypes.AUDIO,he,$,te,Z),this.bufferFragmentData(q,F,j,E)}if(K!=null&&(d=K.samples)!==null&&d!==void 0&&d.length){var be={frag:F,id:a,samples:K.samples};b.trigger(B.Events.FRAG_PARSING_METADATA,be)}if(k){var Ae={frag:F,id:a,samples:k.samples};b.trigger(B.Events.FRAG_PARSING_USERDATA,Ae)}},y._bufferInitSegment=function(h,d,a,b){var g=this;if(this.state!==I.State.PARSING)return;this.audioOnly=!!d.audio&&!d.video,this.altAudio&&!this.audioOnly&&delete d.audio;var E=d.audio,M=d.video,F=d.audiovideo;if(E){var j=h.audioCodec,W=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(j&&(j.indexOf("mp4a.40.5")!==-1?j="mp4a.40.2":j="mp4a.40.5"),E.metadata.channelCount!==1&&W.indexOf("firefox")===-1&&(j="mp4a.40.5")),W.indexOf("android")!==-1&&E.container!=="audio/mpeg"&&(j="mp4a.40.2",this.log("Android: force audio codec to "+j)),h.audioCodec&&h.audioCodec!==j&&this.log('Swapping manifest audio codec "'+h.audioCodec+'" for "'+j+'"'),E.levelCodec=j,E.id="main",this.log("Init audio buffer, container:"+E.container+", codecs[selected/level/parsed]=["+(j||"")+"/"+(h.audioCodec||"")+"/"+E.codec+"]")}M&&(M.levelCodec=h.videoCodec,M.id="main",this.log("Init video buffer, container:"+M.container+", codecs[level/parsed]=["+(h.videoCodec||"")+"/"+M.codec+"]")),F&&this.log("Init audiovideo buffer, container:"+F.container+", codecs[level/parsed]=["+(h.attrs.CODECS||"")+"/"+F.codec+"]"),this.hls.trigger(B.Events.BUFFER_CODECS,d),Object.keys(d).forEach(function(O){var k=d[O],K=k.initSegment;K!=null&&K.byteLength&&g.hls.trigger(B.Events.BUFFER_APPENDING,{type:O,data:K,frag:a,part:null,chunkMeta:b,parent:a.type})}),this.tick()},y.backtrack=function(h){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(h);var d=this.fragmentTracker.backtrack(h);this.fragPrevious=null,this.nextLoadPosition=h.start,d?this.resetFragmentLoading(h):this.state=I.State.BACKTRACKING},y.checkFragmentChanged=function(){var h=this.media,d=null;if(h&&h.readyState>1&&h.seeking===!1){var a=h.currentTime;if(U.BufferHelper.isBuffered(h,a)?d=this.getAppendedFrag(a):U.BufferHelper.isBuffered(h,a+.1)&&(d=this.getAppendedFrag(a+.1)),d){var b=this.fragPlaying,g=d.level;(!b||d.sn!==b.sn||b.level!==g||d.urlId!==b.urlId)&&(this.hls.trigger(B.Events.FRAG_CHANGED,{frag:d}),(!b||b.level!==g)&&this.hls.trigger(B.Events.LEVEL_SWITCHED,{level:g}),this.fragPlaying=d)}}},o(A,[{key:"nextLevel",get:function(){var h=this.nextBufferedFrag;return h?h.level:-1}},{key:"currentLevel",get:function(){var h=this.media;if(h){var d=this.getAppendedFrag(h.currentTime);if(d)return d.level}return-1}},{key:"nextBufferedFrag",get:function(){var h=this.media;if(h){var d=this.getAppendedFrag(h.currentTime);return this.followingBufferedFrag(d)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),A}(I.default)},"./src/controller/subtitle-stream-controller.ts":function(re,X,L){"use strict";L.r(X),L.d(X,"SubtitleStreamController",function(){return l});var z=L("./src/events.ts"),I=L("./src/utils/logger.ts"),R=L("./src/utils/buffer-helper.ts"),B=L("./src/controller/fragment-finders.ts"),U=L("./src/utils/discontinuities.ts"),P=L("./src/controller/level-helper.ts"),D=L("./src/controller/fragment-tracker.ts"),v=L("./src/controller/base-stream-controller.ts"),S=L("./src/types/loader.ts"),_=L("./src/types/level.ts");function C(s,w){for(var p=0;p<w.length;p++){var c=w[p];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(s,c.key,c)}}function T(s,w,p){return w&&C(s.prototype,w),p&&C(s,p),s}function m(s,w){s.prototype=Object.create(w.prototype),s.prototype.constructor=s,u(s,w)}function u(s,w){return u=Object.setPrototypeOf||function(c,A){return c.__proto__=A,c},u(s,w)}var o=500,l=function(s){m(w,s);function w(c,A){var y;return y=s.call(this,c,A,"[subtitle-stream-controller]")||this,y.levels=[],y.currentTrackId=-1,y.tracksBuffered=[],y.mainDetails=null,y._registerListeners(),y}var p=w.prototype;return p.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},p._registerListeners=function(){var A=this.hls;A.on(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),A.on(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),A.on(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),A.on(z.Events.LEVEL_LOADED,this.onLevelLoaded,this),A.on(z.Events.ERROR,this.onError,this),A.on(z.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),A.on(z.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),A.on(z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),A.on(z.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),A.on(z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},p._unregisterListeners=function(){var A=this.hls;A.off(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),A.off(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),A.off(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),A.off(z.Events.LEVEL_LOADED,this.onLevelLoaded,this),A.off(z.Events.ERROR,this.onError,this),A.off(z.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),A.off(z.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),A.off(z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),A.off(z.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),A.off(z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},p.startLoad=function(){this.stopLoad(),this.state=v.State.IDLE,this.setInterval(o),this.tick()},p.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},p.onLevelLoaded=function(A,y){this.mainDetails=y.details},p.onSubtitleFragProcessed=function(A,y){var f=y.frag,h=y.success;if(this.fragPrevious=f,this.state=v.State.IDLE,!h)return;var d=this.tracksBuffered[this.currentTrackId];if(!d)return;for(var a,b=f.start,g=0;g<d.length;g++)if(b>=d[g].start&&b<=d[g].end){a=d[g];break}var E=f.start+f.duration;a?a.end=E:(a={start:b,end:E},d.push(a)),this.fragmentTracker.fragBuffered(f)},p.onBufferFlushing=function(A,y){var f=y.startOffset,h=y.endOffset;if(f===0&&h!==Number.POSITIVE_INFINITY){var d=this.currentTrackId,a=this.levels;if(!a.length||!a[d]||!a[d].details)return;var b=a[d].details,g=b.targetduration,E=h-g;if(E<=0)return;y.endOffsetSubtitles=Math.max(0,E),this.tracksBuffered.forEach(function(M){for(var F=0;F<M.length;){if(M[F].end<=E){M.shift();continue}else if(M[F].start<E)M[F].start=E;else break;F++}}),this.fragmentTracker.removeFragmentsInRange(f,E,S.PlaylistLevelType.SUBTITLE)}},p.onError=function(A,y){var f,h=y.frag;if(!h||h.type!==S.PlaylistLevelType.SUBTITLE)return;(f=this.fragCurrent)!==null&&f!==void 0&&f.loader&&this.fragCurrent.loader.abort(),this.state=v.State.IDLE},p.onSubtitleTracksUpdated=function(A,y){var f=this,h=y.subtitleTracks;this.tracksBuffered=[],this.levels=h.map(function(d){return new _.Level(d)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(d){f.tracksBuffered[d.id]=[]}),this.mediaBuffer=null},p.onSubtitleTrackSwitch=function(A,y){if(this.currentTrackId=y.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(o)},p.onSubtitleTrackLoaded=function(A,y){var f,h=y.details,d=y.id,a=this.currentTrackId,b=this.levels;if(!b.length)return;var g=b[a];if(d>=b.length||d!==a||!g)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,h.live||(f=g.details)!==null&&f!==void 0&&f.live){var E=this.mainDetails;if(h.deltaUpdateFailed||!E)return;var M=E.fragments[0];if(!g.details)h.hasProgramDateTime&&E.hasProgramDateTime?Object(U.alignMediaPlaylistByPDT)(h,E):M&&Object(P.addSliding)(h,M.start);else{var F=this.alignPlaylists(h,g.details);F===0&&M&&Object(P.addSliding)(h,M.start)}}if(g.details=h,this.levelLastLoaded=d,this.tick(),h.live&&!this.fragCurrent&&this.media&&this.state===v.State.IDLE){var j=Object(B.findFragmentByPTS)(null,h.fragments,this.media.currentTime,0);j||(this.warn("Subtitle playlist not aligned with playback"),g.details=void 0)}},p._handleFragmentLoadComplete=function(A){var y=A.frag,f=A.payload,h=y.decryptdata,d=this.hls;if(this.fragContextChanged(y))return;if(f&&f.byteLength>0&&h&&h.key&&h.iv&&h.method==="AES-128"){var a=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(f),h.key.buffer,h.iv.buffer).then(function(b){var g=performance.now();d.trigger(z.Events.FRAG_DECRYPTED,{frag:y,payload:b,stats:{tstart:a,tdecrypt:g}})})}},p.doTick=function(){if(!this.media){this.state=v.State.IDLE;return}if(this.state===v.State.IDLE){var A,y=this.currentTrackId,f=this.levels;if(!f.length||!f[y]||!f[y].details)return;var h=f[y].details,d=h.targetduration,a=this.config,b=this.media,g=R.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,b.currentTime-d,a.maxBufferHole),E=g.end,M=g.len,F=this.getMaxBufferLength()+d;if(M>F)return;console.assert(h,"Subtitle track details are defined on idle subtitle stream controller tick");var j=h.fragments,W=j.length,O=h.edge,k,K=this.fragPrevious;if(E<O){var Y=a.maxFragLookUpTolerance;K&&h.hasProgramDateTime&&(k=Object(B.findFragmentByPDT)(j,K.endProgramDateTime,Y)),k||(k=Object(B.findFragmentByPTS)(K,j,E,Y),!k&&K&&K.start<j[0].start&&(k=j[0]))}else k=j[W-1];(A=k)!==null&&A!==void 0&&A.encrypted?(I.logger.log("Loading key for "+k.sn),this.state=v.State.KEY_LOADING,this.hls.trigger(z.Events.KEY_LOADING,{frag:k})):k&&this.fragmentTracker.getState(k)===D.FragmentState.NOT_LOADED&&this.loadFragment(k,h,E)}},p.loadFragment=function(A,y,f){this.fragCurrent=A,s.prototype.loadFragment.call(this,A,y,f)},T(w,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),w}(v.default)},"./src/controller/subtitle-track-controller.ts":function(re,X,L){"use strict";L.r(X);var z=L("./src/events.ts"),I=L("./src/utils/texttrack-utils.ts"),R=L("./src/controller/base-playlist-controller.ts"),B=L("./src/types/loader.ts");function U(C,T){for(var m=0;m<T.length;m++){var u=T[m];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(C,u.key,u)}}function P(C,T,m){return T&&U(C.prototype,T),m&&U(C,m),C}function D(C,T){C.prototype=Object.create(T.prototype),C.prototype.constructor=C,v(C,T)}function v(C,T){return v=Object.setPrototypeOf||function(u,o){return u.__proto__=o,u},v(C,T)}var S=function(C){D(T,C);function T(u){var o;return o=C.call(this,u,"[subtitle-track-controller]")||this,o.media=null,o.tracks=[],o.groupId=null,o.tracksInGroup=[],o.trackId=-1,o.selectDefaultTrack=!0,o.queuedDefaultTrack=-1,o.trackChangeListener=function(){return o.onTextTracksChanged()},o.asyncPollTrackChange=function(){return o.pollTrackChange(0)},o.useTextTrackPolling=!1,o.subtitlePollingInterval=-1,o.subtitleDisplay=!0,o.registerListeners(),o}var m=T.prototype;return m.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,C.prototype.destroy.call(this)},m.registerListeners=function(){var o=this.hls;o.on(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(z.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.on(z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.on(z.Events.ERROR,this.onError,this)},m.unregisterListeners=function(){var o=this.hls;o.off(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(z.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.off(z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.off(z.Events.ERROR,this.onError,this)},m.onMediaAttached=function(o,l){if(this.media=l.media,!this.media)return;this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange)},m.pollTrackChange=function(o){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,o)},m.onMediaDetaching=function(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId);var o=_(this.media.textTracks);o.forEach(function(l){Object(I.clearCurrentCues)(l)}),this.subtitleTrack=-1,this.media=null},m.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},m.onManifestParsed=function(o,l){this.tracks=l.subtitleTracks},m.onSubtitleTrackLoaded=function(o,l){var s=l.id,w=l.details,p=this.trackId,c=this.tracksInGroup[p];if(!c){this.warn("Invalid subtitle track id "+s);return}var A=c.details;c.details=l.details,this.log("subtitle track "+s+" loaded ["+w.startSN+"-"+w.endSN+"]"),s===this.trackId&&(this.retryCount=0,this.playlistLoaded(s,l,A))},m.onLevelLoading=function(o,l){this.switchLevel(l.level)},m.onLevelSwitching=function(o,l){this.switchLevel(l.level)},m.switchLevel=function(o){var l=this.hls.levels[o];if(!(l!=null&&l.textGroupIds))return;var s=l.textGroupIds[l.urlId];if(this.groupId!==s){var w=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,p=this.tracks.filter(function(y){return!s||y.groupId===s});this.tracksInGroup=p;var c=this.findTrackId(w==null?void 0:w.name)||this.findTrackId();this.groupId=s;var A={subtitleTracks:p};this.log("Updating subtitle tracks, "+p.length+' track(s) found in "'+s+'" group-id'),this.hls.trigger(z.Events.SUBTITLE_TRACKS_UPDATED,A),c!==-1&&this.setSubtitleTrack(c,w)}},m.findTrackId=function(o){for(var l=this.tracksInGroup,s=0;s<l.length;s++){var w=l[s];if((!this.selectDefaultTrack||w.default)&&(!o||o===w.name))return w.id}return-1},m.onError=function(o,l){if(C.prototype.onError.call(this,o,l),l.fatal||!l.context)return;l.context.type===B.PlaylistContextType.SUBTITLE_TRACK&&l.context.id===this.trackId&&l.context.groupId===this.groupId&&this.retryLoadingOrFail(l)},m.loadPlaylist=function(o){var l=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(l)){var s=l.id,w=l.groupId,p=l.url;if(o)try{p=o.addDirectives(p)}catch(c){this.warn("Could not construct new URL with HLS Delivery Directives: "+c)}this.log("Loading subtitle playlist for id "+s),this.hls.trigger(z.Events.SUBTITLE_TRACK_LOADING,{url:p,id:s,groupId:w,deliveryDirectives:o||null})}},m.toggleTrackModes=function(o){var l=this,s=this.media,w=this.subtitleDisplay,p=this.trackId;if(!s)return;var c=_(s.textTracks),A=c.filter(function(h){return h.groupId===l.groupId});if(o===-1)[].slice.call(c).forEach(function(h){h.mode="disabled"});else{var y=A[p];y&&(y.mode="disabled")}var f=A[o];f&&(f.mode=w?"showing":"hidden")},m.setSubtitleTrack=function(o,l){var s,w=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=o;return}if(this.trackId!==o&&this.toggleTrackModes(o),this.trackId===o&&(o===-1||(s=w[o])!==null&&s!==void 0&&s.details)||o<-1||o>=w.length)return;this.clearTimer();var p=w[o];if(this.log("Switching to subtitle track "+o),this.trackId=o,p){var c=p.id,A=p.groupId,y=A===void 0?"":A,f=p.name,h=p.type,d=p.url;this.hls.trigger(z.Events.SUBTITLE_TRACK_SWITCH,{id:c,groupId:y,name:f,type:h,url:d});var a=this.switchParams(p.url,l==null?void 0:l.details);this.loadPlaylist(a)}else this.hls.trigger(z.Events.SUBTITLE_TRACK_SWITCH,{id:o})},m.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var o=-1,l=_(this.media.textTracks),s=0;s<l.length;s++)if(l[s].mode==="hidden")o=s;else if(l[s].mode==="showing"){o=s;break}this.subtitleTrack!==o&&(this.subtitleTrack=o)},P(T,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(o){this.selectDefaultTrack=!1;var l=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(o,l)}}]),T}(R.default);function _(C){for(var T=[],m=0;m<C.length;m++){var u=C[m];u.kind==="subtitles"&&u.label&&T.push(C[m])}return T}X.default=S},"./src/controller/timeline-controller.ts":function(re,X,L){"use strict";L.r(X),L.d(X,"TimelineController",function(){return _});var z=L("./src/polyfills/number.ts"),I=L("./src/events.ts"),R=L("./src/utils/cea-608-parser.ts"),B=L("./src/utils/output-filter.ts"),U=L("./src/utils/webvtt-parser.ts"),P=L("./src/utils/texttrack-utils.ts"),D=L("./src/utils/imsc1-ttml-parser.ts"),v=L("./src/types/loader.ts"),S=L("./src/utils/logger.ts"),_=function(){function u(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=m(),this.captionsProperties=void 0,this.hls=l,this.config=l.config,this.Cues=l.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},this.config.enableCEA708Captions){var s=new B.default(this,"textTrack1"),w=new B.default(this,"textTrack2"),p=new B.default(this,"textTrack3"),c=new B.default(this,"textTrack4");this.cea608Parser1=new R.default(1,s,w),this.cea608Parser2=new R.default(3,p,c)}l.on(I.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),l.on(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.on(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.on(I.Events.MANIFEST_LOADED,this.onManifestLoaded,this),l.on(I.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),l.on(I.Events.FRAG_LOADING,this.onFragLoading,this),l.on(I.Events.FRAG_LOADED,this.onFragLoaded,this),l.on(I.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),l.on(I.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),l.on(I.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),l.on(I.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),l.on(I.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var o=u.prototype;return o.destroy=function(){var s=this.hls;s.off(I.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),s.off(I.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.off(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.off(I.Events.MANIFEST_LOADED,this.onManifestLoaded,this),s.off(I.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),s.off(I.Events.FRAG_LOADING,this.onFragLoading,this),s.off(I.Events.FRAG_LOADED,this.onFragLoaded,this),s.off(I.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),s.off(I.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),s.off(I.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),s.off(I.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),s.off(I.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},o.addCues=function(s,w,p,c,A){for(var y=!1,f=A.length;f--;){var h=A[f],d=T(h[0],h[1],w,p);if(d>=0&&(h[0]=Math.min(h[0],w),h[1]=Math.max(h[1],p),y=!0,d/(p-w)>.5))return}if(y||A.push([w,p]),this.config.renderTextTracksNatively){var a=this.captionsTracks[s];this.Cues.newCue(a,w,p,c)}else{var b=this.Cues.newCue(null,w,p,c);this.hls.trigger(I.Events.CUES_PARSED,{type:"captions",cues:b,track:s})}},o.onInitPtsFound=function(s,w){var p=this,c=w.frag,A=w.id,y=w.initPTS,f=w.timescale,h=this.unparsedVttFrags;A==="main"&&(this.initPTS[c.cc]=y,this.timescale[c.cc]=f),h.length&&(this.unparsedVttFrags=[],h.forEach(function(d){p.onFragLoaded(I.Events.FRAG_LOADED,d)}))},o.getExistingTrack=function(s){var w=this.media;if(w)for(var p=0;p<w.textTracks.length;p++){var c=w.textTracks[p];if(c[s])return c}return null},o.createCaptionsTrack=function(s){this.config.renderTextTracksNatively?this.createNativeTrack(s):this.createNonNativeTrack(s)},o.createNativeTrack=function(s){if(this.captionsTracks[s])return;var w=this.captionsProperties,p=this.captionsTracks,c=this.media,A=w[s],y=A.label,f=A.languageCode,h=this.getExistingTrack(s);if(h)p[s]=h,Object(P.clearCurrentCues)(p[s]),Object(P.sendAddTrackEvent)(p[s],c);else{var d=this.createTextTrack("captions",y,f);d&&(d[s]=!0,p[s]=d)}},o.createNonNativeTrack=function(s){if(this.nonNativeCaptionsTracks[s])return;var w=this.captionsProperties[s];if(!w)return;var p=w.label,c={_id:s,label:p,kind:"captions",default:w.media?!!w.media.default:!1,closedCaptions:w.media};this.nonNativeCaptionsTracks[s]=c,this.hls.trigger(I.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[c]})},o.createTextTrack=function(s,w,p){var c=this.media;return c?c.addTextTrack(s,w,p):void 0},o.onMediaAttaching=function(s,w){this.media=w.media,this._cleanTracks()},o.onMediaDetaching=function(){var s=this.captionsTracks;Object.keys(s).forEach(function(w){Object(P.clearCurrentCues)(s[w]),delete s[w]}),this.nonNativeCaptionsTracks={}},o.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=m(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.timescale=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},o._cleanTracks=function(){var s=this.media;if(!s)return;var w=s.textTracks;if(w)for(var p=0;p<w.length;p++)Object(P.clearCurrentCues)(w[p])},o.onSubtitleTracksUpdated=function(s,w){var p=this;this.textTracks=[];var c=w.subtitleTracks||[],A=c.some(function(d){return d.textCodec===D.IMSC1_CODEC});if(this.config.enableWebVTT||A&&this.config.enableIMSC1){var y=this.tracks&&c&&this.tracks.length===c.length;if(this.tracks=c||[],this.config.renderTextTracksNatively){var f=this.media?this.media.textTracks:[];this.tracks.forEach(function(d,a){var b;if(a<f.length){for(var g=null,E=0;E<f.length;E++)if(C(f[E],d)){g=f[E];break}g&&(b=g)}b?Object(P.clearCurrentCues)(b):(b=p.createTextTrack("subtitles",d.name,d.lang),b&&(b.mode="disabled")),b&&(b.groupId=d.groupId,p.textTracks.push(b))})}else if(!y&&this.tracks&&this.tracks.length){var h=this.tracks.map(function(d){return{label:d.name,kind:d.type.toLowerCase(),default:d.default,subtitleTrack:d}});this.hls.trigger(I.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:h})}}},o.onManifestLoaded=function(s,w){var p=this;this.config.enableCEA708Captions&&w.captions&&w.captions.forEach(function(c){var A=/(?:CC|SERVICE)([1-4])/.exec(c.instreamId);if(!A)return;var y="textTrack"+A[1],f=p.captionsProperties[y];if(!f)return;f.label=c.name,c.lang&&(f.languageCode=c.lang),f.media=c})},o.onFragLoading=function(s,w){var p=this.cea608Parser1,c=this.cea608Parser2,A=this.lastSn,y=this.lastPartIndex;if(!this.enabled||!(p&&c))return;if(w.frag.type===v.PlaylistLevelType.MAIN){var f,h,d=w.frag.sn,a=(f=w==null||((h=w.part)===null||h===void 0)?void 0:h.index)!=null?f:-1;d===A+1||d===A&&a===y+1||(p.reset(),c.reset()),this.lastSn=d,this.lastPartIndex=a}},o.onFragLoaded=function(s,w){var p=w.frag,c=w.payload,A=this.initPTS,y=this.unparsedVttFrags;if(p.type===v.PlaylistLevelType.SUBTITLE)if(c.byteLength){if(!Object(z.isFiniteNumber)(A[p.cc])){y.push(w),A.length&&this.hls.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:p,error:new Error("Missing initial subtitle PTS")});return}var f=p.decryptdata;if(f==null||f.key==null||f.method!=="AES-128"){var h=this.tracks[p.level],d=this.vttCCs;d[p.cc]||(d[p.cc]={start:p.start,prevCC:this.prevCC,new:!0},this.prevCC=p.cc),h&&h.textCodec===D.IMSC1_CODEC?this._parseIMSC1(p,c):this._parseVTTs(p,c,d)}}else this.hls.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:p,error:new Error("Empty subtitle payload")})},o._parseIMSC1=function(s,w){var p=this,c=this.hls;Object(D.parseIMSC1)(w,this.initPTS[s.cc],this.timescale[s.cc],function(A){p._appendCues(A,s.level),c.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:s})},function(A){S.logger.log("Failed to parse IMSC1: "+A),c.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:s,error:A})})},o._parseVTTs=function(s,w,p){var c=this,A=this.hls;Object(U.parseWebVTT)(w,this.initPTS[s.cc],this.timescale[s.cc],p,s.cc,s.start,function(y){c._appendCues(y,s.level),A.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:s})},function(y){c._fallbackToIMSC1(s,w),S.logger.log("Failed to parse VTT cue: "+y),A.trigger(I.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:s,error:y})})},o._fallbackToIMSC1=function(s,w){var p=this,c=this.tracks[s.level];c.textCodec||Object(D.parseIMSC1)(w,this.initPTS[s.cc],this.timescale[s.cc],function(){c.textCodec=D.IMSC1_CODEC,p._parseIMSC1(s,w)},function(){c.textCodec="wvtt"})},o._appendCues=function(s,w){var p=this.hls;if(this.config.renderTextTracksNatively){var c=this.textTracks[w];if(c.mode==="disabled")return;s.forEach(function(f){return Object(P.addCueToTrack)(c,f)})}else{var A=this.tracks[w],y=A.default?"default":"subtitles"+w;p.trigger(I.Events.CUES_PARSED,{type:"subtitles",cues:s,track:y})}},o.onFragDecrypted=function(s,w){var p=w.frag;if(p.type===v.PlaylistLevelType.SUBTITLE){if(!Object(z.isFiniteNumber)(this.initPTS[p.cc])){this.unparsedVttFrags.push(w);return}this.onFragLoaded(I.Events.FRAG_LOADED,w)}},o.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},o.onFragParsingUserdata=function(s,w){var p=this.cea608Parser1,c=this.cea608Parser2;if(!this.enabled||!(p&&c))return;for(var A=0;A<w.samples.length;A++){var y=w.samples[A].bytes;if(y){var f=this.extractCea608Data(y);p.addData(w.samples[A].pts,f[0]),c.addData(w.samples[A].pts,f[1])}}},o.onBufferFlushing=function(s,w){var p=w.startOffset,c=w.endOffset,A=w.endOffsetSubtitles,y=w.type,f=this.media;if(!f||f.currentTime<c)return;if(!y||y==="video"){var h=this.captionsTracks;Object.keys(h).forEach(function(a){return Object(P.removeCuesInRange)(h[a],p,c)})}if(this.config.renderTextTracksNatively&&(p===0&&A!==void 0)){var d=this.textTracks;Object.keys(d).forEach(function(a){return Object(P.removeCuesInRange)(d[a],p,A)})}},o.extractCea608Data=function(s){for(var w=s[0]&31,p=2,c=[[],[]],A=0;A<w;A++){var y=s[p++],f=127&s[p++],h=127&s[p++],d=(4&y)!==0,a=3&y;if(f===0&&h===0)continue;d&&((a===0||a===1)&&(c[a].push(f),c[a].push(h)))}return c},u}();function C(u,o){return u&&u.label===o.name&&!(u.textTrack1||u.textTrack2)}function T(u,o,l,s){return Math.min(o,s)-Math.max(u,l)}function m(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(re,X,L){"use strict";L.r(X),L.d(X,"default",function(){return z});var z=function(){function I(B,U){this.subtle=void 0,this.aesIV=void 0,this.subtle=B,this.aesIV=U}var R=I.prototype;return R.decrypt=function(U,P){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},P,U)},I}()},"./src/crypt/aes-decryptor.ts":function(re,X,L){"use strict";L.r(X),L.d(X,"removePadding",function(){return I}),L.d(X,"default",function(){return R});var z=L("./src/utils/typed-array.ts");function I(B){var U=B.byteLength,P=U&&new DataView(B.buffer).getUint8(U-1);return P?Object(z.sliceUint8)(B,0,U-P):B}var R=function(){function B(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}var U=B.prototype;return U.uint8ArrayToUint32Array_=function(D){for(var v=new DataView(D),S=new Uint32Array(4),_=0;_<4;_++)S[_]=v.getUint32(_*4);return S},U.initTable=function(){var D=this.sBox,v=this.invSBox,S=this.subMix,_=S[0],C=S[1],T=S[2],m=S[3],u=this.invSubMix,o=u[0],l=u[1],s=u[2],w=u[3],p=new Uint32Array(256),c=0,A=0,y=0;for(y=0;y<256;y++)y<128?p[y]=y<<1:p[y]=y<<1^283;for(y=0;y<256;y++){var f=A^A<<1^A<<2^A<<3^A<<4;f=f>>>8^f&255^99,D[c]=f,v[f]=c;var h=p[c],d=p[h],a=p[d],b=p[f]*257^f*16843008;_[c]=b<<24|b>>>8,C[c]=b<<16|b>>>16,T[c]=b<<8|b>>>24,m[c]=b,b=a*16843009^d*65537^h*257^c*16843008,o[f]=b<<24|b>>>8,l[f]=b<<16|b>>>16,s[f]=b<<8|b>>>24,w[f]=b,c?(c=h^p[p[p[a^h]]],A^=p[p[A]]):c=A=1}},U.expandKey=function(D){for(var v=this.uint8ArrayToUint32Array_(D),S=!0,_=0;_<v.length&&S;)S=v[_]===this.key[_],_++;if(S)return;this.key=v;var C=this.keySize=v.length;if(C!==4&&C!==6&&C!==8)throw new Error("Invalid aes key size="+C);var T=this.ksRows=(C+6+1)*4,m,u,o=this.keySchedule=new Uint32Array(T),l=this.invKeySchedule=new Uint32Array(T),s=this.sBox,w=this.rcon,p=this.invSubMix,c=p[0],A=p[1],y=p[2],f=p[3],h,d;for(m=0;m<T;m++){if(m<C){h=o[m]=v[m];continue}d=h,m%C===0?(d=d<<8|d>>>24,d=s[d>>>24]<<24|s[d>>>16&255]<<16|s[d>>>8&255]<<8|s[d&255],d^=w[m/C|0]<<24):C>6&&m%C===4&&(d=s[d>>>24]<<24|s[d>>>16&255]<<16|s[d>>>8&255]<<8|s[d&255]),o[m]=h=(o[m-C]^d)>>>0}for(u=0;u<T;u++)m=T-u,u&3?d=o[m]:d=o[m-4],u<4||m<=4?l[u]=d:l[u]=c[s[d>>>24]]^A[s[d>>>16&255]]^y[s[d>>>8&255]]^f[s[d&255]],l[u]=l[u]>>>0},U.networkToHostOrderSwap=function(D){return D<<24|(D&65280)<<8|(D&16711680)>>8|D>>>24},U.decrypt=function(D,v,S){for(var _=this.keySize+6,C=this.invKeySchedule,T=this.invSBox,m=this.invSubMix,u=m[0],o=m[1],l=m[2],s=m[3],w=this.uint8ArrayToUint32Array_(S),p=w[0],c=w[1],A=w[2],y=w[3],f=new Int32Array(D),h=new Int32Array(f.length),d,a,b,g,E,M,F,j,W,O,k,K,Y,q,oe=this.networkToHostOrderSwap;v<f.length;){for(W=oe(f[v]),O=oe(f[v+1]),k=oe(f[v+2]),K=oe(f[v+3]),E=W^C[0],M=K^C[1],F=k^C[2],j=O^C[3],Y=4,q=1;q<_;q++)d=u[E>>>24]^o[M>>16&255]^l[F>>8&255]^s[j&255]^C[Y],a=u[M>>>24]^o[F>>16&255]^l[j>>8&255]^s[E&255]^C[Y+1],b=u[F>>>24]^o[j>>16&255]^l[E>>8&255]^s[M&255]^C[Y+2],g=u[j>>>24]^o[E>>16&255]^l[M>>8&255]^s[F&255]^C[Y+3],E=d,M=a,F=b,j=g,Y=Y+4;d=T[E>>>24]<<24^T[M>>16&255]<<16^T[F>>8&255]<<8^T[j&255]^C[Y],a=T[M>>>24]<<24^T[F>>16&255]<<16^T[j>>8&255]<<8^T[E&255]^C[Y+1],b=T[F>>>24]<<24^T[j>>16&255]<<16^T[E>>8&255]<<8^T[M&255]^C[Y+2],g=T[j>>>24]<<24^T[E>>16&255]<<16^T[M>>8&255]<<8^T[F&255]^C[Y+3],h[v]=oe(d^p),h[v+1]=oe(g^c),h[v+2]=oe(b^A),h[v+3]=oe(a^y),p=W,c=O,A=k,y=K,v=v+4}return h.buffer},B}()},"./src/crypt/decrypter.ts":function(re,X,L){"use strict";L.r(X),L.d(X,"default",function(){return v});var z=L("./src/crypt/aes-crypto.ts"),I=L("./src/crypt/fast-aes-key.ts"),R=L("./src/crypt/aes-decryptor.ts"),B=L("./src/utils/logger.ts"),U=L("./src/utils/mp4-tools.ts"),P=L("./src/utils/typed-array.ts"),D=16,v=function(){function S(C,T,m){var u=m===void 0?{}:m,o=u.removePKCS7Padding,l=o===void 0?!0:o;if(this.logEnabled=!0,this.observer=void 0,this.config=void 0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.observer=C,this.config=T,this.removePKCS7Padding=l,l)try{var s=self.crypto;s&&(this.subtle=s.subtle||s.webkitSubtle)}catch(w){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var _=S.prototype;return _.destroy=function(){this.observer=null},_.isSync=function(){return this.config.enableSoftwareAES},_.flush=function(){var T=this.currentResult;if(!T){this.reset();return}var m=new Uint8Array(T);return this.reset(),this.removePKCS7Padding?Object(R.removePadding)(m):m},_.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},_.decrypt=function(T,m,u,o){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(T),m,u);var l=this.flush();l&&o(l.buffer)}else this.webCryptoDecrypt(new Uint8Array(T),m,u).then(o)},_.softwareDecrypt=function(T,m,u){var o=this.currentIV,l=this.currentResult,s=this.remainderData;this.logOnce("JS AES decrypt"),s&&(T=Object(U.appendUint8Array)(s,T),this.remainderData=null);var w=this.getValidChunk(T);if(!w.length)return null;o&&(u=o);var p=this.softwareDecrypter;p||(p=this.softwareDecrypter=new R.default),p.expandKey(m);var c=l;return this.currentResult=p.decrypt(w.buffer,0,u),this.currentIV=Object(P.sliceUint8)(w,-16).buffer,c||null},_.webCryptoDecrypt=function(T,m,u){var o=this,l=this.subtle;return(this.key!==m||!this.fastAesKey)&&(this.key=m,this.fastAesKey=new I.default(l,m)),this.fastAesKey.expandKey().then(function(s){if(!l)return Promise.reject(new Error("web crypto not initialized"));var w=new z.default(l,u);return w.decrypt(T.buffer,s)}).catch(function(s){return o.onWebCryptoError(s,T,m,u)})},_.onWebCryptoError=function(T,m,u,o){return B.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",T),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(m,u,o)},_.getValidChunk=function(T){var m=T,u=T.length-T.length%D;return u!==T.length&&(m=Object(P.sliceUint8)(T,0,u),this.remainderData=Object(P.sliceUint8)(T,u)),m},_.logOnce=function(T){if(!this.logEnabled)return;B.logger.log("[decrypter.ts]: "+T),this.logEnabled=!1},S}()},"./src/crypt/fast-aes-key.ts":function(re,X,L){"use strict";L.r(X),L.d(X,"default",function(){return z});var z=function(){function I(B,U){this.subtle=void 0,this.key=void 0,this.subtle=B,this.key=U}var R=I.prototype;return R.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},I}()},"./src/demux/aacdemuxer.ts":function(re,X,L){"use strict";L.r(X);var z=L("./src/demux/base-audio-demuxer.ts"),I=L("./src/demux/adts.ts"),R=L("./src/utils/logger.ts"),B=L("./src/demux/id3.ts");function U(v,S){v.prototype=Object.create(S.prototype),v.prototype.constructor=v,P(v,S)}function P(v,S){return P=Object.setPrototypeOf||function(C,T){return C.__proto__=T,C},P(v,S)}var D=function(v){U(S,v);function S(C,T){var m;return m=v.call(this)||this,m.observer=void 0,m.config=void 0,m.observer=C,m.config=T,m}var _=S.prototype;return _.resetInitSegment=function(T,m,u){v.prototype.resetInitSegment.call(this,T,m,u),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:T,duration:u,inputTimeScale:9e4,dropped:0}},S.probe=function(T){if(!T)return!1;for(var m=B.getID3Data(T,0)||[],u=m.length,o=T.length;u<o;u++)if(I.probe(T,u))return R.logger.log("ADTS sync word found !"),!0;return!1},_.canParse=function(T,m){return I.canParse(T,m)},_.appendFrame=function(T,m,u){I.initTrackConfig(T,this.observer,m,u,T.manifestCodec);var o=I.appendFrame(T,m,u,this.initPTS,this.frameIndex);if(o&&o.missing===0)return o},S}(z.default);D.minProbeByteLength=9,X.default=D},"./src/demux/adts.ts":function(re,X,L){"use strict";L.r(X),L.d(X,"getAudioConfig",function(){return B}),L.d(X,"isHeaderPattern",function(){return U}),L.d(X,"getHeaderLength",function(){return P}),L.d(X,"getFullFrameLength",function(){return D}),L.d(X,"canGetFrameLength",function(){return v}),L.d(X,"isHeader",function(){return S}),L.d(X,"canParse",function(){return _}),L.d(X,"probe",function(){return C}),L.d(X,"initTrackConfig",function(){return T}),L.d(X,"getFrameDuration",function(){return m}),L.d(X,"parseFrameHeader",function(){return u}),L.d(X,"appendFrame",function(){return o});var z=L("./src/utils/logger.ts"),I=L("./src/errors.ts"),R=L("./src/events.ts");function B(l,s,w,p){var c,A,y,f,h=navigator.userAgent.toLowerCase(),d=p,a=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];c=((s[w+2]&192)>>>6)+1;var b=(s[w+2]&60)>>>2;if(b>a.length-1){l.trigger(R.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+b});return}return y=(s[w+2]&1)<<2,y|=(s[w+3]&192)>>>6,z.logger.log("manifest codec:"+p+", ADTS type:"+c+", samplingIndex:"+b),/firefox/i.test(h)?b>=6?(c=5,f=new Array(4),A=b-3):(c=2,f=new Array(2),A=b):h.indexOf("android")!==-1?(c=2,f=new Array(2),A=b):(c=5,f=new Array(4),p&&(p.indexOf("mp4a.40.29")!==-1||p.indexOf("mp4a.40.5")!==-1)||!p&&b>=6?A=b-3:((p&&p.indexOf("mp4a.40.2")!==-1&&(b>=6&&y===1||/vivaldi/i.test(h))||!p&&y===1)&&(c=2,f=new Array(2)),A=b)),f[0]=c<<3,f[0]|=(b&14)>>1,f[1]|=(b&1)<<7,f[1]|=y<<3,c===5&&(f[1]|=(A&14)>>1,f[2]=(A&1)<<7,f[2]|=2<<2,f[3]=0),{config:f,samplerate:a[b],channelCount:y,codec:"mp4a.40."+c,manifestCodec:d}}function U(l,s){return l[s]===255&&(l[s+1]&246)===240}function P(l,s){return l[s+1]&1?7:9}function D(l,s){return(l[s+3]&3)<<11|l[s+4]<<3|(l[s+5]&224)>>>5}function v(l,s){return s+5<l.length}function S(l,s){return s+1<l.length&&U(l,s)}function _(l,s){return v(l,s)&&U(l,s)&&D(l,s)<=l.length-s}function C(l,s){if(S(l,s)){var w=P(l,s);if(s+w>=l.length)return!1;var p=D(l,s);if(p<=w)return!1;var c=s+p;return c===l.length||S(l,c)}return!1}function T(l,s,w,p,c){if(!l.samplerate){var A=B(s,w,p,c);if(!A)return;l.config=A.config,l.samplerate=A.samplerate,l.channelCount=A.channelCount,l.codec=A.codec,l.manifestCodec=A.manifestCodec,z.logger.log("parsed codec:"+l.codec+", rate:"+A.samplerate+", channels:"+A.channelCount)}}function m(l){return 1024*9e4/l}function u(l,s,w,p,c){var A=P(l,s),y=D(l,s);if(y-=A,y>0){var f=w+p*c;return{headerLength:A,frameLength:y,stamp:f}}}function o(l,s,w,p,c){var A=m(l.samplerate),y=u(s,w,p,c,A);if(y){var f=y.frameLength,h=y.headerLength,d=y.stamp,a=h+f,b=Math.max(0,w+a-s.length),g;b?(g=new Uint8Array(a-h),g.set(s.subarray(w+h,s.length),0)):g=s.subarray(w+h,w+a);var E={unit:g,pts:d};return b||l.samples.push(E),{sample:E,length:a,missing:b}}}},"./src/demux/base-audio-demuxer.ts":function(re,X,L){"use strict";L.r(X),L.d(X,"initPTSFn",function(){return D});var z=L("./src/polyfills/number.ts"),I=L("./src/demux/id3.ts"),R=L("./src/demux/dummy-demuxed-track.ts"),B=L("./src/utils/mp4-tools.ts"),U=L("./src/utils/typed-array.ts"),P=function(){function v(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var S=v.prototype;return S.resetInitSegment=function(C,T,m){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},S.resetTimeStamp=function(){},S.resetContiguity=function(){},S.canParse=function(C,T){return!1},S.appendFrame=function(C,T,m){},S.demux=function(C,T){this.cachedData&&(C=Object(B.appendUint8Array)(this.cachedData,C),this.cachedData=null);var m=I.getID3Data(C,0),u=m?m.length:0,o,l,s=this._audioTrack,w=this._id3Track,p=m?I.getTimeStamp(m):void 0,c=C.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=D(p,T)),m&&m.length>0&&w.samples.push({pts:this.initPTS,dts:this.initPTS,data:m}),l=this.initPTS;u<c;){if(this.canParse(C,u)){var A=this.appendFrame(s,C,u);A?(this.frameIndex++,l=A.sample.pts,u+=A.length,o=u):u=c}else I.canParse(C,u)?(m=I.getID3Data(C,u),w.samples.push({pts:l,dts:l,data:m}),u+=m.length,o=u):u++;if(u===c&&o!==c){var y=Object(U.sliceUint8)(C,o);this.cachedData?this.cachedData=Object(B.appendUint8Array)(this.cachedData,y):this.cachedData=y}}return{audioTrack:s,avcTrack:Object(R.dummyTrack)(),id3Track:w,textTrack:Object(R.dummyTrack)()}},S.demuxSampleAes=function(C,T,m){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},S.flush=function(C){var T=this.cachedData;return T&&(this.cachedData=null,this.demux(T,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(R.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(R.dummyTrack)()}},S.destroy=function(){},v}(),D=function(S,_){return Object(z.isFiniteNumber)(S)?S*90:_*9e4};X.default=P},"./src/demux/chunk-cache.ts":function(re,X,L){"use strict";L.r(X),L.d(X,"default",function(){return z});var z=function(){function R(){this.chunks=[],this.dataLength=0}var B=R.prototype;return B.push=function(P){this.chunks.push(P),this.dataLength+=P.length},B.flush=function(){var P=this.chunks,D=this.dataLength,v;if(P.length)P.length===1?v=P[0]:v=I(P,D);else return new Uint8Array(0);return this.reset(),v},B.reset=function(){this.chunks.length=0,this.dataLength=0},R}();function I(R,B){for(var U=new Uint8Array(B),P=0,D=0;D<R.length;D++){var v=R[D];U.set(v,P),P+=v.length}return U}},"./src/demux/dummy-demuxed-track.ts":function(re,X,L){"use strict";L.r(X),L.d(X,"dummyTrack",function(){return z});function z(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(re,X,L){"use strict";L.r(X);var z=L("./src/utils/logger.ts"),I=function(){function R(U){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=U,this.bytesAvailable=U.byteLength,this.word=0,this.bitsAvailable=0}var B=R.prototype;return B.loadWord=function(){var P=this.data,D=this.bytesAvailable,v=P.byteLength-D,S=new Uint8Array(4),_=Math.min(4,D);if(_===0)throw new Error("no bytes available");S.set(P.subarray(v,v+_)),this.word=new DataView(S.buffer).getUint32(0),this.bitsAvailable=_*8,this.bytesAvailable-=_},B.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)},B.readBits=function(P){var D=Math.min(this.bitsAvailable,P),v=this.word>>>32-D;return P>32&&z.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?v<<D|this.readBits(D):v},B.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()},B.skipUEG=function(){this.skipBits(1+this.skipLZ())},B.skipEG=function(){this.skipBits(1+this.skipLZ())},B.readUEG=function(){var P=this.skipLZ();return this.readBits(P+1)-1},B.readEG=function(){var P=this.readUEG();return 1&P?1+P>>>1:-1*(P>>>1)},B.readBoolean=function(){return this.readBits(1)===1},B.readUByte=function(){return this.readBits(8)},B.readUShort=function(){return this.readBits(16)},B.readUInt=function(){return this.readBits(32)},B.skipScalingList=function(P){for(var D=8,v=8,S,_=0;_<P;_++)v!==0&&(S=this.readEG(),v=(D+S+256)%256),D=v===0?D:v},B.readSPS=function(){var P=0,D=0,v=0,S=0,_,C,T,m=this.readUByte.bind(this),u=this.readBits.bind(this),o=this.readUEG.bind(this),l=this.readBoolean.bind(this),s=this.skipBits.bind(this),w=this.skipEG.bind(this),p=this.skipUEG.bind(this),c=this.skipScalingList.bind(this);m();var A=m();if(u(5),s(3),m(),p(),A===100||A===110||A===122||A===244||A===44||A===83||A===86||A===118||A===128){var y=o();if(y===3&&s(1),p(),p(),s(1),l())for(C=y!==3?8:12,T=0;T<C;T++)l()&&(T<6?c(16):c(64))}p();var f=o();if(f===0)o();else if(f===1)for(s(1),w(),w(),_=o(),T=0;T<_;T++)w();p(),s(1);var h=o(),d=o(),a=u(1);a===0&&s(1),s(1),l()&&(P=o(),D=o(),v=o(),S=o());var b=[1,1];if(l()&&l()){var g=m();switch(g){case 1:b=[1,1];break;case 2:b=[12,11];break;case 3:b=[10,11];break;case 4:b=[16,11];break;case 5:b=[40,33];break;case 6:b=[24,11];break;case 7:b=[20,11];break;case 8:b=[32,11];break;case 9:b=[80,33];break;case 10:b=[18,11];break;case 11:b=[15,11];break;case 12:b=[64,33];break;case 13:b=[160,99];break;case 14:b=[4,3];break;case 15:b=[3,2];break;case 16:b=[2,1];break;case 255:{b=[m()<<8|m(),m()<<8|m()];break}}}return{width:Math.ceil((h+1)*16-P*2-D*2),height:(2-a)*(d+1)*16-(a?2:4)*(v+S),pixelRatio:b}},B.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},R}();X.default=I},"./src/demux/id3.ts":function(re,X,L){"use strict";L.r(X),L.d(X,"isHeader",function(){return z}),L.d(X,"isFooter",function(){return I}),L.d(X,"getID3Data",function(){return R}),L.d(X,"canParse",function(){return U}),L.d(X,"getTimeStamp",function(){return P}),L.d(X,"isTimeStampFrame",function(){return D}),L.d(X,"getID3Frames",function(){return S}),L.d(X,"decodeFrame",function(){return _}),L.d(X,"utf8ArrayToStr",function(){return o}),L.d(X,"testables",function(){return l});var z=function(c,A){return A+10<=c.length&&(c[A]===73&&c[A+1]===68&&c[A+2]===51&&(c[A+3]<255&&c[A+4]<255&&(c[A+6]<128&&c[A+7]<128&&c[A+8]<128&&c[A+9]<128)))},I=function(c,A){return A+10<=c.length&&(c[A]===51&&c[A+1]===68&&c[A+2]===73&&(c[A+3]<255&&c[A+4]<255&&(c[A+6]<128&&c[A+7]<128&&c[A+8]<128&&c[A+9]<128)))},R=function(c,A){for(var y=A,f=0;z(c,A);){f+=10;var h=B(c,A+6);f+=h,I(c,A+10)&&(f+=10),A+=f}return f>0?c.subarray(y,y+f):void 0},B=function(c,A){var y=0;return y=(c[A]&127)<<21,y|=(c[A+1]&127)<<14,y|=(c[A+2]&127)<<7,y|=c[A+3]&127,y},U=function(c,A){return z(c,A)&&B(c,A+6)+10<=c.length-A},P=function(c){for(var A=S(c),y=0;y<A.length;y++){var f=A[y];if(D(f))return u(f)}return},D=function(c){return c&&c.key==="PRIV"&&c.info==="com.apple.streaming.transportStreamTimestamp"},v=function(c){var A=String.fromCharCode(c[0],c[1],c[2],c[3]),y=B(c,4),f=10;return{type:A,size:y,data:c.subarray(f,f+y)}},S=function(c){for(var A=0,y=[];z(c,A);){var f=B(c,A+6);A+=10;for(var h=A+f;A+8<h;){var d=v(c.subarray(A)),a=_(d);a&&y.push(a),A+=d.size+10}I(c,A)&&(A+=10)}return y},_=function(c){return c.type==="PRIV"?C(c):c.type[0]==="W"?m(c):T(c)},C=function(c){if(c.size<2)return;var A=o(c.data,!0),y=new Uint8Array(c.data.subarray(A.length+1));return{key:c.type,info:A,data:y.buffer}},T=function(c){if(c.size<2)return;if(c.type==="TXXX"){var A=1,y=o(c.data.subarray(A),!0);A+=y.length+1;var f=o(c.data.subarray(A));return{key:c.type,info:y,data:f}}var h=o(c.data.subarray(1));return{key:c.type,data:h}},m=function(c){if(c.type==="WXXX"){if(c.size<2)return;var A=1,y=o(c.data.subarray(A),!0);A+=y.length+1;var f=o(c.data.subarray(A));return{key:c.type,info:y,data:f}}var h=o(c.data);return{key:c.type,data:h}},u=function(c){if(c.data.byteLength===8){var A=new Uint8Array(c.data),y=A[3]&1,f=(A[4]<<23)+(A[5]<<15)+(A[6]<<7)+A[7];return f/=45,y&&(f+=4772185884e-2),Math.round(f)}return},o=function(c,A){A===void 0&&(A=!1);var y=w();if(y){var f=y.decode(c);if(A){var h=f.indexOf("\0");return h!==-1?f.substring(0,h):f}return f.replace(/\0/g,"")}for(var d=c.length,a,b,g,E="",M=0;M<d;){if(a=c[M++],a===0&&A)return E;if(a===0||a===3)continue;switch(a>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:E+=String.fromCharCode(a);break;case 12:case 13:b=c[M++],E+=String.fromCharCode((a&31)<<6|b&63);break;case 14:b=c[M++],g=c[M++],E+=String.fromCharCode((a&15)<<12|(b&63)<<6|(g&63)<<0);break;default:}}return E},l={decodeTextFrame:T},s;function w(){return!s&&typeof self.TextDecoder!="undefined"&&(s=new self.TextDecoder("utf-8")),s}},"./src/demux/mp3demuxer.ts":function(re,X,L){"use strict";L.r(X);var z=L("./src/demux/base-audio-demuxer.ts"),I=L("./src/demux/id3.ts"),R=L("./src/utils/logger.ts"),B=L("./src/demux/mpegaudio.ts");function U(v,S){v.prototype=Object.create(S.prototype),v.prototype.constructor=v,P(v,S)}function P(v,S){return P=Object.setPrototypeOf||function(C,T){return C.__proto__=T,C},P(v,S)}var D=function(v){U(S,v);function S(){return v.apply(this,arguments)||this}var _=S.prototype;return _.resetInitSegment=function(T,m,u){v.prototype.resetInitSegment.call(this,T,m,u),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:T,duration:u,inputTimeScale:9e4,dropped:0}},S.probe=function(T){if(!T)return!1;for(var m=I.getID3Data(T,0)||[],u=m.length,o=T.length;u<o;u++)if(B.probe(T,u))return R.logger.log("MPEG Audio sync word found !"),!0;return!1},_.canParse=function(T,m){return B.canParse(T,m)},_.appendFrame=function(T,m,u){return this.initPTS===null?void 0:B.appendFrame(T,m,u,this.initPTS,this.frameIndex)},S}(z.default);D.minProbeByteLength=4,X.default=D},"./src/demux/mp4demuxer.ts":function(re,X,L){"use strict";L.r(X);var z=L("./src/utils/mp4-tools.ts"),I=L("./src/demux/dummy-demuxed-track.ts"),R=function(){function B(P,D){this.remainderData=null,this.config=void 0,this.config=D}var U=B.prototype;return U.resetTimeStamp=function(){},U.resetInitSegment=function(){},U.resetContiguity=function(){},B.probe=function(D){return Object(z.findBox)({data:D,start:0,end:Math.min(D.length,16384)},["moof"]).length>0},U.demux=function(D){var v=D,S=Object(I.dummyTrack)();if(this.config.progressive){this.remainderData&&(v=Object(z.appendUint8Array)(this.remainderData,D));var _=Object(z.segmentValidRange)(v);this.remainderData=_.remainder,S.samples=_.valid||new Uint8Array}else S.samples=v;return{audioTrack:Object(I.dummyTrack)(),avcTrack:S,id3Track:Object(I.dummyTrack)(),textTrack:Object(I.dummyTrack)()}},U.flush=function(){var D=Object(I.dummyTrack)();return D.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(I.dummyTrack)(),avcTrack:D,id3Track:Object(I.dummyTrack)(),textTrack:Object(I.dummyTrack)()}},U.demuxSampleAes=function(D,v,S){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},U.destroy=function(){},B}();R.minProbeByteLength=1024,X.default=R},"./src/demux/mpegaudio.ts":function(re,X,L){"use strict";L.r(X),L.d(X,"appendFrame",function(){return P}),L.d(X,"parseHeader",function(){return D}),L.d(X,"isHeaderPattern",function(){return v}),L.d(X,"isHeader",function(){return S}),L.d(X,"canParse",function(){return _}),L.d(X,"probe",function(){return C});var z=null,I=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],R=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],B=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],U=[0,1,1,4];function P(T,m,u,o,l){if(u+24>m.length)return;var s=D(m,u);if(s&&u+s.frameLength<=m.length){var w=s.samplesPerFrame*9e4/s.sampleRate,p=o+l*w,c={unit:m.subarray(u,u+s.frameLength),pts:p,dts:p};return T.config=[],T.channelCount=s.channelCount,T.samplerate=s.sampleRate,T.samples.push(c),{sample:c,length:s.frameLength,missing:0}}}function D(T,m){var u=T[m+1]>>3&3,o=T[m+1]>>1&3,l=T[m+2]>>4&15,s=T[m+2]>>2&3;if(u!==1&&l!==0&&l!==15&&s!==3){var w=T[m+2]>>1&1,p=T[m+3]>>6,c=u===3?3-o:o===3?3:4,A=I[c*14+l-1]*1e3,y=u===3?0:u===2?1:2,f=R[y*3+s],h=p===3?1:2,d=B[u][o],a=U[o],b=d*8*a,g=Math.floor(d*A/f+w)*a;if(z===null){var E=navigator.userAgent||"",M=E.match(/Chrome\/(\d+)/i);z=M?parseInt(M[1]):0}var F=!!z&&z<=87;return F&&o===2&&A>=224e3&&p===0&&(T[m+3]=T[m+3]|128),{sampleRate:f,channelCount:h,frameLength:g,samplesPerFrame:b}}}function v(T,m){return T[m]===255&&(T[m+1]&224)===224&&(T[m+1]&6)!==0}function S(T,m){return m+1<T.length&&v(T,m)}function _(T,m){var u=4;return v(T,m)&&u<=T.length-m}function C(T,m){if(m+1<T.length&&v(T,m)){var u=4,o=D(T,m),l=u;o!=null&&o.frameLength&&(l=o.frameLength);var s=m+l;return s===T.length||S(T,s)}return!1}},"./src/demux/sample-aes.ts":function(re,X,L){"use strict";L.r(X);var z=L("./src/crypt/decrypter.ts"),I=L("./src/demux/tsdemuxer.ts"),R=function(){function B(P,D,v){this.keyData=void 0,this.decrypter=void 0,this.keyData=v,this.decrypter=new z.default(P,D,{removePKCS7Padding:!1})}var U=B.prototype;return U.decryptBuffer=function(D,v){this.decrypter.decrypt(D,this.keyData.key.buffer,this.keyData.iv.buffer,v)},U.decryptAacSample=function(D,v,S,_){var C=D[v].unit,T=C.subarray(16,C.length-C.length%16),m=T.buffer.slice(T.byteOffset,T.byteOffset+T.length),u=this;this.decryptBuffer(m,function(o){var l=new Uint8Array(o);C.set(l,16),_||u.decryptAacSamples(D,v+1,S)})},U.decryptAacSamples=function(D,v,S){for(;;v++){if(v>=D.length){S();return}if(D[v].unit.length<32)continue;var _=this.decrypter.isSync();if(this.decryptAacSample(D,v,S,_),!_)return}},U.getAvcEncryptedData=function(D){for(var v=Math.floor((D.length-48)/160)*16+16,S=new Int8Array(v),_=0,C=32;C<=D.length-16;C+=160,_+=16)S.set(D.subarray(C,C+16),_);return S},U.getAvcDecryptedUnit=function(D,v){for(var S=new Uint8Array(v),_=0,C=32;C<=D.length-16;C+=160,_+=16)D.set(S.subarray(_,_+16),C);return D},U.decryptAvcSample=function(D,v,S,_,C,T){var m=Object(I.discardEPB)(C.data),u=this.getAvcEncryptedData(m),o=this;this.decryptBuffer(u.buffer,function(l){C.data=o.getAvcDecryptedUnit(m,l),T||o.decryptAvcSamples(D,v,S+1,_)})},U.decryptAvcSamples=function(D,v,S,_){if(D instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;v++,S=0){if(v>=D.length){_();return}for(var C=D[v].units;!(S>=C.length);S++){var T=C[S];if(T.data.length<=48||T.type!==1&&T.type!==5)continue;var m=this.decrypter.isSync();if(this.decryptAvcSample(D,v,S,_,T,m),!m)return}}},B}();X.default=R},"./src/demux/transmuxer-interface.ts":function(re,X,L){"use strict";L.r(X),L.d(X,"default",function(){return C});var z=L("./node_modules/webworkify-webpack/index.js"),I=L.n(z),R=L("./src/events.ts"),B=L("./src/demux/transmuxer.ts"),U=L("./src/utils/logger.ts"),P=L("./src/errors.ts"),D=L("./src/utils/mediasource-helper.ts"),v=L("./node_modules/eventemitter3/index.js"),S=L.n(v),_=Object(D.getMediaSource)()||{isTypeSupported:function(){return!1}},C=function(){function T(u,o,l,s){var w=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=u,this.id=o,this.onTransmuxComplete=l,this.onFlush=s;var p=u.config,c=function(d,a){a=a||{},a.frag=w.frag,a.id=w.id,u.trigger(d,a)};this.observer=new v.EventEmitter,this.observer.on(R.Events.FRAG_DECRYPTED,c),this.observer.on(R.Events.ERROR,c);var A={mp4:_.isTypeSupported("video/mp4"),mpeg:_.isTypeSupported("audio/mpeg"),mp3:_.isTypeSupported('audio/mp4; codecs="mp3"')},y=navigator.vendor;if(p.enableWorker&&typeof Worker!="undefined"){U.logger.log("demuxing in webworker");var f;try{f=this.worker=z("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),f.addEventListener("message",this.onwmsg),f.onerror=function(h){u.trigger(R.Events.ERROR,{type:P.ErrorTypes.OTHER_ERROR,details:P.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(h.message+" ("+h.filename+":"+h.lineno+")")})},f.postMessage({cmd:"init",typeSupported:A,vendor:y,id:o,config:JSON.stringify(p)})}catch(h){U.logger.warn("Error in worker:",h),U.logger.error("Error while initializing DemuxerWorker, fallback to inline"),f&&self.URL.revokeObjectURL(f.objectURL),this.transmuxer=new B.default(this.observer,A,p,y,o),this.worker=null}}else this.transmuxer=new B.default(this.observer,A,p,y,o)}var m=T.prototype;return m.destroy=function(){var o=this.worker;if(o)o.removeEventListener("message",this.onwmsg),o.terminate(),this.worker=null;else{var l=this.transmuxer;l&&(l.destroy(),this.transmuxer=null)}var s=this.observer;s&&s.removeAllListeners(),this.observer=null},m.push=function(o,l,s,w,p,c,A,y,f,h){var d=this;f.transmuxing.start=self.performance.now();var a=this.transmuxer,b=this.worker,g=c?c.start:p.start,E=p.decryptdata,M=this.frag,F=!(M&&p.cc===M.cc),j=!(M&&f.level===M.level),W=M?f.sn-M.sn:-1,O=this.part?f.part-this.part.index:1,k=!j&&(W===1||W===0&&O===1),K=self.performance.now();(j||W||p.stats.parsing.start===0)&&(p.stats.parsing.start=K),c&&(O||!k)&&(c.stats.parsing.start=K);var Y=new B.TransmuxState(F,k,y,j,g);if(!k||F){U.logger.log("[transmuxer-interface, "+p.type+"]: Starting new transmux session for sn: "+f.sn+" p: "+f.part+" level: "+f.level+" id: "+f.id+`
discontinuity: `+F+`
trackSwitch: `+j+`
contiguous: `+k+`
accurateTimeOffset: `+y+`
timeOffset: `+g);var q=new B.TransmuxConfig(s,w,l,A,h);this.configureTransmuxer(q)}if(this.frag=p,this.part=c,b)b.postMessage({cmd:"demux",data:o,decryptdata:E,chunkMeta:f,state:Y},o instanceof ArrayBuffer?[o]:[]);else if(a){var oe=a.push(o,E,f,Y);Object(B.isPromise)(oe)?oe.then(function(Te){d.handleTransmuxComplete(Te)}):this.handleTransmuxComplete(oe)}},m.flush=function(o){var l=this;o.transmuxing.start=self.performance.now();var s=this.transmuxer,w=this.worker;if(w)w.postMessage({cmd:"flush",chunkMeta:o});else if(s){var p=s.flush(o);Object(B.isPromise)(p)?p.then(function(c){l.handleFlushResult(c,o)}):this.handleFlushResult(p,o)}},m.handleFlushResult=function(o,l){var s=this;o.forEach(function(w){s.handleTransmuxComplete(w)}),this.onFlush(l)},m.onWorkerMessage=function(o){var l=o.data,s=this.hls;switch(l.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(l.data);break}case"flush":{this.onFlush(l.data);break}default:{l.data=l.data||{},l.data.frag=this.frag,l.data.id=this.id,s.trigger(l.event,l.data);break}}},m.configureTransmuxer=function(o){var l=this.worker,s=this.transmuxer;l?l.postMessage({cmd:"configure",config:o}):s&&s.configure(o)},m.handleTransmuxComplete=function(o){o.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(o)},T}()},"./src/demux/transmuxer-worker.ts":function(re,X,L){"use strict";L.r(X),L.d(X,"default",function(){return P});var z=L("./src/demux/transmuxer.ts"),I=L("./src/events.ts"),R=L("./src/utils/logger.ts"),B=L("./node_modules/eventemitter3/index.js"),U=L.n(B);function P(C){var T=new B.EventEmitter,m=function(o,l){C.postMessage({event:o,data:l})};T.on(I.Events.FRAG_DECRYPTED,m),T.on(I.Events.ERROR,m),C.addEventListener("message",function(u){var o=u.data;switch(o.cmd){case"init":{var l=JSON.parse(o.config);C.transmuxer=new z.default(T,o.typeSupported,l,o.vendor,o.id),Object(R.enableLogs)(l.debug),m("init",null);break}case"configure":{C.transmuxer.configure(o.config);break}case"demux":{var s=C.transmuxer.push(o.data,o.decryptdata,o.chunkMeta,o.state);Object(z.isPromise)(s)?s.then(function(c){D(C,c)}):D(C,s);break}case"flush":{var w=o.chunkMeta,p=C.transmuxer.flush(w);Object(z.isPromise)(p)?p.then(function(c){S(C,c,w)}):S(C,p,w);break}default:break}})}function D(C,T){if(_(T.remuxResult))return;var m=[],u=T.remuxResult,o=u.audio,l=u.video;o&&v(m,o),l&&v(m,l),C.postMessage({event:"transmuxComplete",data:T},m)}function v(C,T){T.data1&&C.push(T.data1.buffer),T.data2&&C.push(T.data2.buffer)}function S(C,T,m){T.forEach(function(u){D(C,u)}),C.postMessage({event:"flush",data:m})}function _(C){return!C.audio&&!C.video&&!C.text&&!C.id3&&!C.initSegment}},"./src/demux/transmuxer.ts":function(re,X,L){"use strict";L.r(X),L.d(X,"default",function(){return l}),L.d(X,"isPromise",function(){return p}),L.d(X,"TransmuxConfig",function(){return c}),L.d(X,"TransmuxState",function(){return A});var z=L("./src/events.ts"),I=L("./src/errors.ts"),R=L("./src/crypt/decrypter.ts"),B=L("./src/demux/aacdemuxer.ts"),U=L("./src/demux/mp4demuxer.ts"),P=L("./src/demux/tsdemuxer.ts"),D=L("./src/demux/mp3demuxer.ts"),v=L("./src/remux/mp4-remuxer.ts"),S=L("./src/remux/passthrough-remuxer.ts"),_=L("./src/demux/chunk-cache.ts"),C=L("./src/utils/mp4-tools.ts"),T=L("./src/utils/logger.ts"),m;try{m=self.performance.now.bind(self.performance)}catch(y){T.logger.debug("Unable to use Performance API on this environment"),m=self.Date.now}var u=[{demux:P.default,remux:v.default},{demux:U.default,remux:S.default},{demux:B.default,remux:v.default},{demux:D.default,remux:v.default}],o=1024;u.forEach(function(y){var f=y.demux;o=Math.max(o,f.minProbeByteLength)});var l=function(){function y(h,d,a,b,g){this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.cache=new _.default,this.observer=h,this.typeSupported=d,this.config=a,this.vendor=b,this.id=g}var f=y.prototype;return f.configure=function(d){this.transmuxConfig=d,this.decrypter&&this.decrypter.reset()},f.push=function(d,a,b,g){var E=this,M=b.transmuxing;M.executeStart=m();var F=new Uint8Array(d),j=this.cache,W=this.config,O=this.currentTransmuxState,k=this.transmuxConfig;g&&(this.currentTransmuxState=g);var K=s(F,a);if(K&&K.method==="AES-128"){var Y=this.getDecrypter();if(W.enableSoftwareAES){var q=Y.softwareDecrypt(F,K.key.buffer,K.iv.buffer);if(!q)return M.executeEnd=m(),w(b);F=new Uint8Array(q)}else return this.decryptionPromise=Y.webCryptoDecrypt(F,K.key.buffer,K.iv.buffer).then(function(we){var De=E.push(we,null,b);return E.decryptionPromise=null,De}),this.decryptionPromise}var oe=g||O,Te=oe.contiguous,ve=oe.discontinuity,ge=oe.trackSwitch,me=oe.accurateTimeOffset,le=oe.timeOffset,ie=k.audioCodec,he=k.videoCodec,$=k.defaultInitPts,te=k.duration,Z=k.initSegmentData;if((ve||ge)&&this.resetInitSegment(Z,ie,he,te),ve&&this.resetInitialTimestamp($),Te||this.resetContiguity(),this.needsProbing(F,ve,ge)){if(j.dataLength){var be=j.flush();F=Object(C.appendUint8Array)(be,F)}this.configureTransmuxer(F,k)}var Ae=this.transmux(F,K,le,me,b),ye=this.currentTransmuxState;return ye.contiguous=!0,ye.discontinuity=!1,ye.trackSwitch=!1,M.executeEnd=m(),Ae},f.flush=function(d){var a=this,b=d.transmuxing;b.executeStart=m();var g=this.decrypter,E=this.cache,M=this.currentTransmuxState,F=this.decryptionPromise;if(F)return F.then(function(){return a.flush(d)});var j=[],W=M.timeOffset;if(g){var O=g.flush();O&&j.push(this.push(O,null,d))}var k=E.dataLength;E.reset();var K=this.demuxer,Y=this.remuxer;if(!K||!Y)return k>=o&&this.observer.emit(z.Events.ERROR,z.Events.ERROR,{type:I.ErrorTypes.MEDIA_ERROR,details:I.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),b.executeEnd=m(),[w(d)];var q=K.flush(W);return p(q)?q.then(function(oe){return a.flushRemux(j,oe,d),j}):(this.flushRemux(j,q,d),j)},f.flushRemux=function(d,a,b){var g=a.audioTrack,E=a.avcTrack,M=a.id3Track,F=a.textTrack,j=this.currentTransmuxState,W=j.accurateTimeOffset,O=j.timeOffset;T.logger.log("[transmuxer.ts]: Flushed fragment "+b.sn+(b.part>-1?" p: "+b.part:"")+" of level "+b.level);var k=this.remuxer.remux(g,E,M,F,O,W,!0,this.id);d.push({remuxResult:k,chunkMeta:b}),b.transmuxing.executeEnd=m()},f.resetInitialTimestamp=function(d){var a=this.demuxer,b=this.remuxer;if(!a||!b)return;a.resetTimeStamp(d),b.resetTimeStamp(d)},f.resetContiguity=function(){var d=this.demuxer,a=this.remuxer;if(!d||!a)return;d.resetContiguity(),a.resetNextTimestamp()},f.resetInitSegment=function(d,a,b,g){var E=this.demuxer,M=this.remuxer;if(!E||!M)return;E.resetInitSegment(a,b,g),M.resetInitSegment(d,a,b)},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,a,b,g,E){var M;return a&&a.method==="SAMPLE-AES"?M=this.transmuxSampleAes(d,a,b,g,E):M=this.transmuxUnencrypted(d,b,g,E),M},f.transmuxUnencrypted=function(d,a,b,g){var E=this.demuxer.demux(d,a,!1,!this.config.progressive),M=E.audioTrack,F=E.avcTrack,j=E.id3Track,W=E.textTrack,O=this.remuxer.remux(M,F,j,W,a,b,!1,this.id);return{remuxResult:O,chunkMeta:g}},f.transmuxSampleAes=function(d,a,b,g,E){var M=this;return this.demuxer.demuxSampleAes(d,a,b).then(function(F){var j=M.remuxer.remux(F.audioTrack,F.avcTrack,F.id3Track,F.textTrack,b,g,!1,M.id);return{remuxResult:j,chunkMeta:E}})},f.configureTransmuxer=function(d,a){for(var b=this.config,g=this.observer,E=this.typeSupported,M=this.vendor,F=a.audioCodec,j=a.defaultInitPts,W=a.duration,O=a.initSegmentData,k=a.videoCodec,K,Y=0,q=u.length;Y<q;Y++)if(u[Y].demux.probe(d)){K=u[Y];break}K||(T.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),K={demux:U.default,remux:S.default});var oe=this.demuxer,Te=this.remuxer,ve=K.remux,ge=K.demux;(!Te||!(Te instanceof ve))&&(this.remuxer=new ve(g,b,E,M)),(!oe||!(oe instanceof ge))&&(this.demuxer=new ge(g,b,E),this.probe=ge.probe),this.resetInitSegment(O,F,k,W),this.resetInitialTimestamp(j)},f.needsProbing=function(d,a,b){return!this.demuxer||!this.remuxer||a||b},f.getDecrypter=function(){var d=this.decrypter;return d||(d=this.decrypter=new R.default(this.observer,this.config)),d},y}();function s(y,f){var h=null;return y.byteLength>0&&f!=null&&f.key!=null&&f.iv!==null&&f.method!=null&&(h=f),h}var w=function(f){return{remuxResult:{},chunkMeta:f}};function p(y){return"then"in y&&y.then instanceof Function}var c=function(f,h,d,a,b){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=h,this.initSegmentData=d,this.duration=a,this.defaultInitPts=b},A=function(f,h,d,a,b){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=h,this.accurateTimeOffset=d,this.trackSwitch=a,this.timeOffset=b}},"./src/demux/tsdemuxer.ts":function(re,X,L){"use strict";L.r(X),L.d(X,"discardEPB",function(){return w});var z=L("./src/demux/adts.ts"),I=L("./src/demux/mpegaudio.ts"),R=L("./src/demux/exp-golomb.ts"),B=L("./src/demux/id3.ts"),U=L("./src/demux/sample-aes.ts"),P=L("./src/events.ts"),D=L("./src/utils/mp4-tools.ts"),v=L("./src/utils/logger.ts"),S=L("./src/errors.ts"),_={video:1,audio:2,id3:3,text:4},C=function(){function p(A,y,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=y,this.typeSupported=f}p.probe=function(y){var f=p.syncOffset(y);return f<0?!1:(f&&v.logger.warn("MPEG2-TS detected but first sync word found @ offset "+f+", junk ahead ?"),!0)},p.syncOffset=function(y){for(var f=Math.min(1e3,y.length-3*188),h=0;h<f;){if(y[h]===71&&y[h+188]===71&&y[h+2*188]===71)return h;h++}return-1},p.createTrack=function(y,f){return{container:y==="video"||y==="audio"?"video/mp2t":void 0,type:y,id:_[y],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:y==="audio"?f:void 0}};var c=p.prototype;return c.resetInitSegment=function(y,f,h){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=p.createTrack("video",h),this._audioTrack=p.createTrack("audio",h),this._id3Track=p.createTrack("id3",h),this._txtTrack=p.createTrack("text",h),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=y,this.videoCodec=f,this._duration=h},c.resetTimeStamp=function(){},c.resetContiguity=function(){var y=this._audioTrack,f=this._avcTrack,h=this._id3Track;y&&(y.pesData=null),f&&(f.pesData=null),h&&(h.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},c.demux=function(y,f,h,d){h===void 0&&(h=!1),d===void 0&&(d=!1),h||(this.sampleAes=null);var a,b=this._avcTrack,g=this._audioTrack,E=this._id3Track,M=b.pid,F=b.pesData,j=g.pid,W=E.pid,O=g.pesData,k=E.pesData,K=!1,Y=this.pmtParsed,q=this._pmtId,oe=y.length;if(this.remainderData&&(y=Object(D.appendUint8Array)(this.remainderData,y),oe=y.length,this.remainderData=null),oe<188&&!d)return this.remainderData=y,{audioTrack:g,avcTrack:b,id3Track:E,textTrack:this._txtTrack};var Te=Math.max(0,p.syncOffset(y));oe-=(oe+Te)%188,oe<y.byteLength&&!d&&(this.remainderData=new Uint8Array(y.buffer,oe,y.buffer.byteLength-oe));for(var ve=Te;ve<oe;ve+=188)if(y[ve]===71){var ge=!!(y[ve+1]&64),me=((y[ve+1]&31)<<8)+y[ve+2],le=(y[ve+3]&48)>>4,ie=void 0;if(le>1){if(ie=ve+5+y[ve+4],ie===ve+188)continue}else ie=ve+4;switch(me){case M:ge&&(F&&(a=o(F))&&this.parseAVCPES(a,!1),F={data:[],size:0}),F&&(F.data.push(y.subarray(ie,ve+188)),F.size+=ve+188-ie);break;case j:ge&&(O&&(a=o(O))&&(g.isAAC?this.parseAACPES(a):this.parseMPEGPES(a)),O={data:[],size:0}),O&&(O.data.push(y.subarray(ie,ve+188)),O.size+=ve+188-ie);break;case W:ge&&(k&&(a=o(k))&&this.parseID3PES(a),k={data:[],size:0}),k&&(k.data.push(y.subarray(ie,ve+188)),k.size+=ve+188-ie);break;case 0:ge&&(ie+=y[ie]+1),q=this._pmtId=m(y,ie);break;case q:{ge&&(ie+=y[ie]+1);var he=u(y,ie,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,h);M=he.avc,M>0&&(b.pid=M),j=he.audio,j>0&&(g.pid=j,g.isAAC=he.isAAC),W=he.id3,W>0&&(E.pid=W),K&&!Y&&(v.logger.log("reparse from beginning"),K=!1,ve=Te-188),Y=this.pmtParsed=!0;break}case 17:case 8191:break;default:K=!0;break}}else this.observer.emit(P.Events.ERROR,P.Events.ERROR,{type:S.ErrorTypes.MEDIA_ERROR,details:S.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});b.pesData=F,g.pesData=O,E.pesData=k;var $={audioTrack:g,avcTrack:b,id3Track:E,textTrack:this._txtTrack};return d&&this.extractRemainingSamples($),$},c.flush=function(){var y=this.remainderData;this.remainderData=null;var f;return y?f=this.demux(y,-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},c.extractRemainingSamples=function(y){var f=y.audioTrack,h=y.avcTrack,d=y.id3Track,a=h.pesData,b=f.pesData,g=d.pesData,E;a&&(E=o(a))?(this.parseAVCPES(E,!0),h.pesData=null):h.pesData=a,b&&(E=o(b))?(f.isAAC?this.parseAACPES(E):this.parseMPEGPES(E),f.pesData=null):(b!=null&&b.size&&v.logger.log("last AAC PES packet truncated,might overlap between fragments"),f.pesData=b),g&&(E=o(g))?(this.parseID3PES(E),d.pesData=null):d.pesData=g},c.demuxSampleAes=function(y,f,h){var d=this.demux(y,h,!0,!this.config.progressive),a=this.sampleAes=new U.default(this.observer,this.config,f);return this.decrypt(d,a)},c.decrypt=function(y,f){return new Promise(function(h){var d=y.audioTrack,a=y.avcTrack;d.samples&&d.isAAC?f.decryptAacSamples(d.samples,0,function(){a.samples?f.decryptAvcSamples(a.samples,0,0,function(){h(y)}):h(y)}):a.samples&&f.decryptAvcSamples(a.samples,0,0,function(){h(y)})})},c.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},c.parseAVCPES=function(y,f){var h=this,d=this._avcTrack,a=this.parseAVCNALu(y.data),b=!1,g=this.avcSample,E,M=!1;y.data=null,g&&a.length&&!d.audFound&&(l(g,d),g=this.avcSample=T(!1,y.pts,y.dts,"")),a.forEach(function(F){switch(F.type){case 1:{E=!0,g||(g=h.avcSample=T(!0,y.pts,y.dts,"")),b&&(g.debug+="NDR "),g.frame=!0;var j=F.data;if(M&&j.length>4){var W=new R.default(j).readSliceType();(W===2||W===4||W===7||W===9)&&(g.key=!0)}break}case 5:E=!0,g||(g=h.avcSample=T(!0,y.pts,y.dts,"")),b&&(g.debug+="IDR "),g.key=!0,g.frame=!0;break;case 6:{E=!0,b&&g&&(g.debug+="SEI ");var O=new R.default(w(F.data));O.readUByte();for(var k=0,K=0,Y=!1,q=0;!Y&&O.bytesAvailable>1;){k=0;do q=O.readUByte(),k+=q;while(q===255);K=0;do q=O.readUByte(),K+=q;while(q===255);if(k===4&&O.bytesAvailable!==0){Y=!0;var oe=O.readUByte();if(oe===181){var Te=O.readUShort();if(Te===49){var ve=O.readUInt();if(ve===1195456820){var ge=O.readUByte();if(ge===3){for(var me=O.readUByte(),le=O.readUByte(),ie=31&me,he=[me,le],$=0;$<ie;$++)he.push(O.readUByte()),he.push(O.readUByte()),he.push(O.readUByte());s(h._txtTrack.samples,{type:3,pts:y.pts,bytes:he})}}}}}else if(k===5&&O.bytesAvailable!==0){if(Y=!0,K>16){for(var te=[],Z=0;Z<16;Z++)te.push(O.readUByte().toString(16)),(Z===3||Z===5||Z===7||Z===9)&&te.push("-");for(var be=K-16,Ae=new Uint8Array(be),ye=0;ye<be;ye++)Ae[ye]=O.readUByte();s(h._txtTrack.samples,{pts:y.pts,payloadType:k,uuid:te.join(""),userData:Object(B.utf8ArrayToStr)(Ae),userDataBytes:Ae})}}else if(K<O.bytesAvailable)for(var we=0;we<K;we++)O.readUByte()}break}case 7:if(E=!0,M=!0,b&&g&&(g.debug+="SPS "),!d.sps){var De=new R.default(F.data),Re=De.readSPS();d.width=Re.width,d.height=Re.height,d.pixelRatio=Re.pixelRatio,d.sps=[F.data],d.duration=h._duration;for(var Me=F.data.subarray(1,4),ke="avc1.",Oe=0;Oe<3;Oe++){var ze=Me[Oe].toString(16);ze.length<2&&(ze="0"+ze),ke+=ze}d.codec=ke}break;case 8:E=!0,b&&g&&(g.debug+="PPS "),d.pps||(d.pps=[F.data]);break;case 9:E=!1,d.audFound=!0,g&&l(g,d),g=h.avcSample=T(!1,y.pts,y.dts,b?"AUD ":"");break;case 12:E=!1;break;default:E=!1,g&&(g.debug+="unknown NAL "+F.type+" ");break}if(g&&E){var Ze=g.units;Ze.push(F)}}),f&&g&&(l(g,d),this.avcSample=null)},c.getLastNalUnit=function(){var y,f=this.avcSample,h;if(!f||f.units.length===0){var d=this._avcTrack.samples;f=d[d.length-1]}if((y=f)!==null&&y!==void 0&&y.units){var a=f.units;h=a[a.length-1]}return h},c.parseAVCNALu=function(y){var f=y.byteLength,h=this._avcTrack,d=h.naluState||0,a=d,b=[],g=0,E,M,F,j=-1,W=0;for(d===-1&&(j=0,W=y[0]&31,d=0,g=1);g<f;){if(E=y[g++],!d){d=E?0:1;continue}if(d===1){d=E?0:2;continue}if(!E)d=3;else if(E===1){if(j>=0){var O={data:y.subarray(j,g-d-1),type:W};b.push(O)}else{var k=this.getLastNalUnit();if(k&&(a&&g<=4-a&&(k.state&&(k.data=k.data.subarray(0,k.data.byteLength-a))),M=g-d-1,M>0)){var K=new Uint8Array(k.data.byteLength+M);K.set(k.data,0),K.set(y.subarray(0,M),k.data.byteLength),k.data=K,k.state=0}}g<f?(F=y[g]&31,j=g,W=F,d=0):d=-1}else d=0}if(j>=0&&d>=0){var Y={data:y.subarray(j,f),type:W,state:d};b.push(Y)}if(b.length===0){var q=this.getLastNalUnit();if(q){var oe=new Uint8Array(q.data.byteLength+y.byteLength);oe.set(q.data,0),oe.set(y,q.data.byteLength),q.data=oe}}return h.naluState=d,b},c.parseAACPES=function(y){var f=0,h=this._audioTrack,d=this.aacOverFlow,a=y.data;if(d){this.aacOverFlow=null;var b=d.sample.unit.byteLength,g=Math.min(d.missing,b),E=b-g;d.sample.unit.set(a.subarray(0,g),E),h.samples.push(d.sample),f=d.missing}var M,F;for(M=f,F=a.length;M<F-1&&!z.isHeader(a,M);M++);if(M!==f){var j,W;if(M<F-1?(j="AAC PES did not start with ADTS header,offset:"+M,W=!1):(j="no ADTS header found in AAC PES",W=!0),v.logger.warn("parsing error:"+j),this.observer.emit(P.Events.ERROR,P.Events.ERROR,{type:S.ErrorTypes.MEDIA_ERROR,details:S.ErrorDetails.FRAG_PARSING_ERROR,fatal:W,reason:j}),W)return}z.initTrackConfig(h,this.observer,a,M,this.audioCodec);var O;if(y.pts!==void 0)O=y.pts;else if(d){var k=z.getFrameDuration(h.samplerate);O=d.sample.pts+k}else{v.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var K=0;M<F;)if(z.isHeader(a,M)){if(M+5<F){var Y=z.appendFrame(h,a,M,O,K);if(Y)if(Y.missing)this.aacOverFlow=Y;else{M+=Y.length,K++;continue}}break}else M++},c.parseMPEGPES=function(y){var f=y.data,h=f.length,d=0,a=0,b=y.pts;if(b===void 0){v.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;a<h;)if(I.isHeader(f,a)){var g=I.appendFrame(this._audioTrack,f,a,b,d);if(g)a+=g.length,d++;else break}else a++},c.parseID3PES=function(y){if(y.pts===void 0){v.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(y)},p}();C.minProbeByteLength=188;function T(p,c,A,y){return{key:p,frame:!1,pts:c,dts:A,units:[],debug:y,length:0}}function m(p,c){return(p[c+10]&31)<<8|p[c+11]}function u(p,c,A,y){var f={audio:-1,avc:-1,id3:-1,isAAC:!0},h=(p[c+1]&15)<<8|p[c+2],d=c+3+h-4,a=(p[c+10]&15)<<8|p[c+11];for(c+=12+a;c<d;){var b=(p[c+1]&31)<<8|p[c+2];switch(p[c]){case 207:if(!y){v.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:f.audio===-1&&(f.audio=b);break;case 21:f.id3===-1&&(f.id3=b);break;case 219:if(!y){v.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:f.avc===-1&&(f.avc=b);break;case 3:case 4:A?f.audio===-1&&(f.audio=b,f.isAAC=!1):v.logger.log("MPEG audio found, not supported in this browser");break;case 36:v.logger.warn("Unsupported HEVC stream type found");break;default:break}c+=((p[c+3]&15)<<8|p[c+4])+5}return f}function o(p){var c=0,A,y,f,h,d,a=p.data;if(!p||p.size===0)return null;for(;a[0].length<19&&a.length>1;){var b=new Uint8Array(a[0].length+a[1].length);b.set(a[0]),b.set(a[1],a[0].length),a[0]=b,a.splice(1,1)}A=a[0];var g=(A[0]<<16)+(A[1]<<8)+A[2];if(g===1){if(y=(A[4]<<8)+A[5],y&&y>p.size-6)return null;var E=A[7];E&192&&(h=(A[9]&14)*536870912+(A[10]&255)*4194304+(A[11]&254)*16384+(A[12]&255)*128+(A[13]&254)/2,E&64?(d=(A[14]&14)*536870912+(A[15]&255)*4194304+(A[16]&254)*16384+(A[17]&255)*128+(A[18]&254)/2,h-d>60*9e4&&(v.logger.warn(Math.round((h-d)/9e4)+"s delta between PTS and DTS, align them"),h=d)):d=h),f=A[8];var M=f+9;if(p.size<=M)return null;p.size-=M;for(var F=new Uint8Array(p.size),j=0,W=a.length;j<W;j++){A=a[j];var O=A.byteLength;if(M)if(M>O){M-=O;continue}else A=A.subarray(M),O-=M,M=0;F.set(A,c),c+=O}return y&&(y-=f+3),{data:F,pts:h,dts:d,len:y}}return null}function l(p,c){if(p.units.length&&p.frame){if(p.pts===void 0){var A=c.samples,y=A.length;if(y){var f=A[y-1];p.pts=f.pts,p.dts=f.dts}else{c.dropped++;return}}c.samples.push(p)}p.debug.length&&v.logger.log(p.pts+"/"+p.dts+":"+p.debug)}function s(p,c){var A=p.length;if(A>0){if(c.pts>=p[A-1].pts)p.push(c);else for(var y=A-1;y>=0;y--)if(c.pts<p[y].pts){p.splice(y,0,c);break}}else p.push(c)}function w(p){for(var c=p.byteLength,A=[],y=1;y<c-2;)p[y]===0&&p[y+1]===0&&p[y+2]===3?(A.push(y+2),y+=2):y++;if(A.length===0)return p;var f=c-A.length,h=new Uint8Array(f),d=0;for(y=0;y<f;d++,y++)d===A[0]&&(d++,A.shift()),h[y]=p[d];return h}X.default=C},"./src/errors.ts":function(re,X,L){"use strict";L.r(X),L.d(X,"ErrorTypes",function(){return z}),L.d(X,"ErrorDetails",function(){return I});var z;(function(R){R.NETWORK_ERROR="networkError",R.MEDIA_ERROR="mediaError",R.KEY_SYSTEM_ERROR="keySystemError",R.MUX_ERROR="muxError",R.OTHER_ERROR="otherError"})(z||(z={}));var I;(function(R){R.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",R.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",R.KEY_SYSTEM_NO_SESSION="keySystemNoSession",R.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",R.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",R.MANIFEST_LOAD_ERROR="manifestLoadError",R.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",R.MANIFEST_PARSING_ERROR="manifestParsingError",R.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",R.LEVEL_EMPTY_ERROR="levelEmptyError",R.LEVEL_LOAD_ERROR="levelLoadError",R.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",R.LEVEL_SWITCH_ERROR="levelSwitchError",R.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",R.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",R.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",R.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",R.FRAG_LOAD_ERROR="fragLoadError",R.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",R.FRAG_DECRYPT_ERROR="fragDecryptError",R.FRAG_PARSING_ERROR="fragParsingError",R.REMUX_ALLOC_ERROR="remuxAllocError",R.KEY_LOAD_ERROR="keyLoadError",R.KEY_LOAD_TIMEOUT="keyLoadTimeOut",R.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",R.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",R.BUFFER_APPEND_ERROR="bufferAppendError",R.BUFFER_APPENDING_ERROR="bufferAppendingError",R.BUFFER_STALLED_ERROR="bufferStalledError",R.BUFFER_FULL_ERROR="bufferFullError",R.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",R.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",R.INTERNAL_EXCEPTION="internalException",R.INTERNAL_ABORTED="aborted",R.UNKNOWN="unknown"})(I||(I={}))},"./src/events.ts":function(re,X,L){"use strict";L.r(X),L.d(X,"Events",function(){return z});var z;(function(I){I.MEDIA_ATTACHING="hlsMediaAttaching",I.MEDIA_ATTACHED="hlsMediaAttached",I.MEDIA_DETACHING="hlsMediaDetaching",I.MEDIA_DETACHED="hlsMediaDetached",I.BUFFER_RESET="hlsBufferReset",I.BUFFER_CODECS="hlsBufferCodecs",I.BUFFER_CREATED="hlsBufferCreated",I.BUFFER_APPENDING="hlsBufferAppending",I.BUFFER_APPENDED="hlsBufferAppended",I.BUFFER_EOS="hlsBufferEos",I.BUFFER_FLUSHING="hlsBufferFlushing",I.BUFFER_FLUSHED="hlsBufferFlushed",I.MANIFEST_LOADING="hlsManifestLoading",I.MANIFEST_LOADED="hlsManifestLoaded",I.MANIFEST_PARSED="hlsManifestParsed",I.LEVEL_SWITCHING="hlsLevelSwitching",I.LEVEL_SWITCHED="hlsLevelSwitched",I.LEVEL_LOADING="hlsLevelLoading",I.LEVEL_LOADED="hlsLevelLoaded",I.LEVEL_UPDATED="hlsLevelUpdated",I.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",I.LEVELS_UPDATED="hlsLevelsUpdated",I.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",I.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",I.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",I.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",I.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",I.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",I.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",I.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",I.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",I.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",I.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",I.CUES_PARSED="hlsCuesParsed",I.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",I.INIT_PTS_FOUND="hlsInitPtsFound",I.FRAG_LOADING="hlsFragLoading",I.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",I.FRAG_LOADED="hlsFragLoaded",I.FRAG_DECRYPTED="hlsFragDecrypted",I.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",I.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",I.FRAG_PARSING_METADATA="hlsFragParsingMetadata",I.FRAG_PARSED="hlsFragParsed",I.FRAG_BUFFERED="hlsFragBuffered",I.FRAG_CHANGED="hlsFragChanged",I.FPS_DROP="hlsFpsDrop",I.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",I.ERROR="hlsError",I.DESTROYING="hlsDestroying",I.KEY_LOADING="hlsKeyLoading",I.KEY_LOADED="hlsKeyLoaded",I.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",I.BACK_BUFFER_REACHED="hlsBackBufferReached"})(z||(z={}))},"./src/hls.ts":function(re,X,L){"use strict";L.r(X),L.d(X,"default",function(){return p});var z=L("./node_modules/url-toolkit/src/url-toolkit.js"),I=L.n(z),R=L("./src/loader/playlist-loader.ts"),B=L("./src/loader/key-loader.ts"),U=L("./src/controller/id3-track-controller.ts"),P=L("./src/controller/latency-controller.ts"),D=L("./src/controller/level-controller.ts"),v=L("./src/controller/fragment-tracker.ts"),S=L("./src/controller/stream-controller.ts"),_=L("./src/is-supported.ts"),C=L("./src/utils/logger.ts"),T=L("./src/config.ts"),m=L("./node_modules/eventemitter3/index.js"),u=L.n(m),o=L("./src/events.ts"),l=L("./src/errors.ts");function s(c,A){for(var y=0;y<A.length;y++){var f=A[y];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(c,f.key,f)}}function w(c,A,y){return A&&s(c.prototype,A),y&&s(c,y),c}var p=function(){c.isSupported=function(){return Object(_.isSupported)()};function c(y){y===void 0&&(y={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new m.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(T.mergeConfig)(c.DefaultConfig,y);this.userConfig=y,Object(C.enableLogs)(f.debug),this._autoLevelCapping=-1,f.progressive&&Object(T.enableStreamingMode)(f);var h=f.abrController,d=f.bufferController,a=f.capLevelController,b=f.fpsController,g=this.abrController=new h(this),E=this.bufferController=new d(this),M=this.capLevelController=new a(this),F=new b(this),j=new R.default(this),W=new B.default(this),O=new U.default(this),k=this.levelController=new D.default(this),K=new v.FragmentTracker(this),Y=this.streamController=new S.default(this,K);M.setStreamController(Y),F.setStreamController(Y);var q=[k,Y];this.networkControllers=q;var oe=[j,W,g,E,M,F,O,K];this.audioTrackController=this.createController(f.audioTrackController,null,q),this.createController(f.audioStreamController,K,q),this.subtitleTrackController=this.createController(f.subtitleTrackController,null,q),this.createController(f.subtitleStreamController,K,q),this.createController(f.timelineController,null,oe),this.emeController=this.createController(f.emeController,null,oe),this.cmcdController=this.createController(f.cmcdController,null,oe),this.latencyController=this.createController(P.default,null,oe),this.coreComponents=oe}var A=c.prototype;return A.createController=function(f,h,d){if(f){var a=h?new f(this,h):new f(this);return d&&d.push(a),a}return null},A.on=function(f,h,d){d===void 0&&(d=this),this._emitter.on(f,h,d)},A.once=function(f,h,d){d===void 0&&(d=this),this._emitter.once(f,h,d)},A.removeAllListeners=function(f){this._emitter.removeAllListeners(f)},A.off=function(f,h,d,a){d===void 0&&(d=this),this._emitter.off(f,h,d,a)},A.listeners=function(f){return this._emitter.listeners(f)},A.emit=function(f,h,d){return this._emitter.emit(f,h,d)},A.trigger=function(f,h){if(this.config.debug)return this.emit(f,f,h);try{return this.emit(f,f,h)}catch(d){C.logger.error("An internal error happened while handling event "+f+'. Error message: "'+d.message+'". Here is a stacktrace:',d),this.trigger(o.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(){C.logger.log("destroy"),this.trigger(o.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(f){return f.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(f){return f.destroy()}),this.coreComponents.length=0},A.attachMedia=function(f){C.logger.log("attachMedia"),this._media=f,this.trigger(o.Events.MEDIA_ATTACHING,{media:f})},A.detachMedia=function(){C.logger.log("detachMedia"),this.trigger(o.Events.MEDIA_DETACHING,void 0),this._media=null},A.loadSource=function(f){this.stopLoad();var h=this.media,d=this.url,a=this.url=z.buildAbsoluteURL(self.location.href,f,{alwaysNormalize:!0});C.logger.log("loadSource:"+a),h&&d&&d!==a&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(h)),this.trigger(o.Events.MANIFEST_LOADING,{url:f})},A.startLoad=function(f){f===void 0&&(f=-1),C.logger.log("startLoad("+f+")"),this.networkControllers.forEach(function(h){h.startLoad(f)})},A.stopLoad=function(){C.logger.log("stopLoad"),this.networkControllers.forEach(function(f){f.stopLoad()})},A.swapAudioCodec=function(){C.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},A.recoverMediaError=function(){C.logger.log("recoverMediaError");var f=this._media;this.detachMedia(),f&&this.attachMedia(f)},A.removeLevel=function(f,h){h===void 0&&(h=0),this.levelController.removeLevel(f,h)},w(c,[{key:"levels",get:function(){var f=this.levelController.levels;return f||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(f){C.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){C.logger.log("set nextLevel:"+f),this.levelController.manualLevel=f,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(f){C.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){C.logger.log("set firstLevel:"+f),this.levelController.firstLevel=f}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(f){C.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 h=!!f;h!==this.config.capLevelToPlayerSize&&(h?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=h)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(f){this._autoLevelCapping!==f&&(C.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,h=this.config.minAutoBitrate;if(!f)return 0;for(var d=f.length,a=0;a<d;a++)if(f[a].maxBitrate>h)return a;return 0}},{key:"maxAutoLevel",get:function(){var f=this.levels,h=this.autoLevelCapping,d;return h===-1&&f&&f.length?d=f.length-1:d=h,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 h=this.audioTrackController;h&&(h.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 h=this.subtitleTrackController;h&&(h.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 h=this.subtitleTrackController;h&&(h.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 o.Events}},{key:"ErrorTypes",get:function(){return l.ErrorTypes}},{key:"ErrorDetails",get:function(){return l.ErrorDetails}},{key:"DefaultConfig",get:function(){return c.defaultConfig?c.defaultConfig:T.hlsDefaultConfig},set:function(f){c.defaultConfig=f}}]),c}();p.defaultConfig=void 0},"./src/is-supported.ts":function(re,X,L){"use strict";L.r(X),L.d(X,"isSupported",function(){return R}),L.d(X,"changeTypeSupported",function(){return B});var z=L("./src/utils/mediasource-helper.ts");function I(){return self.SourceBuffer||self.WebKitSourceBuffer}function R(){var U=Object(z.getMediaSource)();if(!U)return!1;var P=I(),D=U&&typeof U.isTypeSupported=="function"&&U.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),v=!P||P.prototype&&typeof P.prototype.appendBuffer=="function"&&typeof P.prototype.remove=="function";return!!D&&!!v}function B(){var U,P=I();return typeof(P==null||((U=P.prototype)===null||U===void 0)?void 0:U.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(re,X,L){"use strict";L.r(X),L.d(X,"default",function(){return C}),L.d(X,"LoadError",function(){return m});var z=L("./src/polyfills/number.ts"),I=L("./src/errors.ts");function R(u,o){u.prototype=Object.create(o.prototype),u.prototype.constructor=u,v(u,o)}function B(u){var o=typeof Map=="function"?new Map:void 0;return B=function(s){if(s===null||!D(s))return s;if(typeof s!="function")throw new TypeError("Super expression must either be null or a function");if(typeof o!="undefined"){if(o.has(s))return o.get(s);o.set(s,w)}function w(){return U(s,arguments,S(this).constructor)}return w.prototype=Object.create(s.prototype,{constructor:{value:w,enumerable:!1,writable:!0,configurable:!0}}),v(w,s)},B(u)}function U(u,o,l){return P()?U=Reflect.construct:U=function(w,p,c){var A=[null];A.push.apply(A,p);var y=Function.bind.apply(w,A),f=new y;return c&&v(f,c.prototype),f},U.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(u){return!1}}function D(u){return Function.toString.call(u).indexOf("[native code]")!==-1}function v(u,o){return v=Object.setPrototypeOf||function(s,w){return s.__proto__=w,s},v(u,o)}function S(u){return S=Object.setPrototypeOf?Object.getPrototypeOf:function(l){return l.__proto__||Object.getPrototypeOf(l)},S(u)}var _=Math.pow(2,17),C=function(){function u(l){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=l}var o=u.prototype;return o.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},o.abort=function(){this.loader&&this.loader.abort()},o.load=function(s,w){var p=this,c=s.url;if(!c)return Promise.reject(new m({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:s,networkDetails:null},"Fragment does not have a "+(c?"part list":"url")));this.abort();var A=this.config,y=A.fLoader,f=A.loader;return new Promise(function(h,d){p.loader&&p.loader.destroy();var a=p.loader=s.loader=y?new y(A):new f(A),b=T(s),g={timeout:A.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:A.fragLoadingMaxRetryTimeout,highWaterMark:_};s.stats=a.stats,a.load(b,g,{onSuccess:function(M,F,j,W){p.resetLoader(s,a),h({frag:s,part:null,payload:M.data,networkDetails:W})},onError:function(M,F,j){p.resetLoader(s,a),d(new m({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:s,response:M,networkDetails:j}))},onAbort:function(M,F,j){p.resetLoader(s,a),d(new m({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:s,networkDetails:j}))},onTimeout:function(M,F,j){p.resetLoader(s,a),d(new m({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:s,networkDetails:j}))},onProgress:function(M,F,j,W){w&&w({frag:s,part:null,payload:j,networkDetails:W})}})})},o.loadPart=function(s,w,p){var c=this;this.abort();var A=this.config,y=A.fLoader,f=A.loader;return new Promise(function(h,d){c.loader&&c.loader.destroy();var a=c.loader=s.loader=y?new y(A):new f(A),b=T(s,w),g={timeout:A.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:A.fragLoadingMaxRetryTimeout,highWaterMark:_};w.stats=a.stats,a.load(b,g,{onSuccess:function(M,F,j,W){c.resetLoader(s,a),c.updateStatsFromPart(s,w);var O={frag:s,part:w,payload:M.data,networkDetails:W};p(O),h(O)},onError:function(M,F,j){c.resetLoader(s,a),d(new m({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:s,part:w,response:M,networkDetails:j}))},onAbort:function(M,F,j){s.stats.aborted=w.stats.aborted,c.resetLoader(s,a),d(new m({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:s,part:w,networkDetails:j}))},onTimeout:function(M,F,j){c.resetLoader(s,a),d(new m({type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:s,part:w,networkDetails:j}))}})})},o.updateStatsFromPart=function(s,w){var p=s.stats,c=w.stats,A=c.total;if(p.loaded+=c.loaded,A){var y=Math.round(s.duration/w.duration),f=Math.min(Math.round(p.loaded/A),y),h=y-f,d=h*Math.round(p.loaded/f);p.total=p.loaded+d}else p.total=Math.max(p.loaded,p.total);var a=p.loading,b=c.loading;a.start?a.first+=b.first-b.start:(a.start=b.start,a.first=b.first),a.end=b.end},o.resetLoader=function(s,w){s.loader=null,this.loader===w&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),w.destroy()},u}();function T(u,o){o===void 0&&(o=null);var l=o||u,s={frag:u,part:o,responseType:"arraybuffer",url:l.url,headers:{},rangeStart:0,rangeEnd:0},w=l.byteRangeStartOffset,p=l.byteRangeEndOffset;return Object(z.isFiniteNumber)(w)&&Object(z.isFiniteNumber)(p)&&(s.rangeStart=w,s.rangeEnd=p),s}var m=function(u){R(o,u);function o(l){for(var s,w=arguments.length,p=new Array(w>1?w-1:0),c=1;c<w;c++)p[c-1]=arguments[c];return s=u.call.apply(u,[this].concat(p))||this,s.data=void 0,s.data=l,s}return o}(B(Error))},"./src/loader/fragment.ts":function(re,X,L){"use strict";L.r(X),L.d(X,"ElementaryStreamTypes",function(){return C}),L.d(X,"BaseSegment",function(){return T}),L.d(X,"Fragment",function(){return m}),L.d(X,"Part",function(){return u});var z=L("./src/polyfills/number.ts"),I=L("./node_modules/url-toolkit/src/url-toolkit.js"),R=L.n(I),B=L("./src/utils/logger.ts"),U=L("./src/loader/level-key.ts"),P=L("./src/loader/load-stats.ts");function D(o,l){o.prototype=Object.create(l.prototype),o.prototype.constructor=o,v(o,l)}function v(o,l){return v=Object.setPrototypeOf||function(w,p){return w.__proto__=p,w},v(o,l)}function S(o,l){for(var s=0;s<l.length;s++){var w=l[s];w.enumerable=w.enumerable||!1,w.configurable=!0,"value"in w&&(w.writable=!0),Object.defineProperty(o,w.key,w)}}function _(o,l,s){return l&&S(o.prototype,l),s&&S(o,s),o}var C;(function(o){o.AUDIO="audio",o.VIDEO="video",o.AUDIOVIDEO="audiovideo"})(C||(C={}));var T=function(){function o(s){var w;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(w={},w[C.AUDIO]=null,w[C.VIDEO]=null,w[C.AUDIOVIDEO]=null,w),this.baseurl=s}var l=o.prototype;return l.setByteRange=function(w,p){var c=w.split("@",2),A=[];c.length===1?A[0]=p?p.byteRangeEndOffset:0:A[0]=parseInt(c[1]),A[1]=parseInt(c[0])+A[0],this._byteRange=A},_(o,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Object(I.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(w){this._url=w}}]),o}(),m=function(o){D(l,o);function l(w,p){var c;return c=o.call(this,p)||this,c._decryptdata=null,c.rawProgramDateTime=null,c.programDateTime=null,c.tagList=[],c.duration=0,c.sn=0,c.levelkey=void 0,c.type=void 0,c.loader=null,c.level=-1,c.cc=0,c.startPTS=void 0,c.endPTS=void 0,c.appendedPTS=void 0,c.startDTS=void 0,c.endDTS=void 0,c.start=0,c.deltaPTS=void 0,c.maxStartPTS=void 0,c.minEndPTS=void 0,c.stats=new P.LoadStats,c.urlId=0,c.data=void 0,c.bitrateTest=!1,c.title=null,c.initSegment=null,c.type=w,c}var s=l.prototype;return s.createInitializationVector=function(p){for(var c=new Uint8Array(16),A=12;A<16;A++)c[A]=p>>8*(15-A)&255;return c},s.setDecryptDataFromLevelKey=function(p,c){var A=p;return(p==null?void 0:p.method)==="AES-128"&&p.uri&&!p.iv&&(A=U.LevelKey.fromURI(p.uri),A.method=p.method,A.iv=this.createInitializationVector(c),A.keyFormat="identity"),A},s.setElementaryStreamInfo=function(p,c,A,y,f,h){h===void 0&&(h=!1);var d=this.elementaryStreams,a=d[p];if(!a){d[p]={startPTS:c,endPTS:A,startDTS:y,endDTS:f,partial:h};return}a.startPTS=Math.min(a.startPTS,c),a.endPTS=Math.max(a.endPTS,A),a.startDTS=Math.min(a.startDTS,y),a.endDTS=Math.max(a.endDTS,f)},s.clearElementaryStreamInfo=function(){var p=this.elementaryStreams;p[C.AUDIO]=null,p[C.VIDEO]=null,p[C.AUDIOVIDEO]=null},_(l,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var p=this.sn;typeof p!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&B.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),p=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,p)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(z.isFiniteNumber)(this.programDateTime))return null;var p=Object(z.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+p*1e3}},{key:"encrypted",get:function(){var p;return!!((p=this.decryptdata)!==null&&p!==void 0&&p.keyFormat&&this.decryptdata.uri)}}]),l}(T),u=function(o){D(l,o);function l(s,w,p,c,A){var y;y=o.call(this,p)||this,y.fragOffset=0,y.duration=0,y.gap=!1,y.independent=!1,y.relurl=void 0,y.fragment=void 0,y.index=void 0,y.stats=new P.LoadStats,y.duration=s.decimalFloatingPoint("DURATION"),y.gap=s.bool("GAP"),y.independent=s.bool("INDEPENDENT"),y.relurl=s.enumeratedString("URI"),y.fragment=w,y.index=c;var f=s.enumeratedString("BYTERANGE");return f&&y.setByteRange(f,A),A&&(y.fragOffset=A.fragOffset+A.duration),y}return _(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 w=this.elementaryStreams;return!!(w.audio||w.video||w.audiovideo)}}]),l}(T)},"./src/loader/key-loader.ts":function(re,X,L){"use strict";L.r(X),L.d(X,"default",function(){return B});var z=L("./src/events.ts"),I=L("./src/errors.ts"),R=L("./src/utils/logger.ts"),B=function(){function U(D){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=D,this._registerListeners()}var P=U.prototype;return P._registerListeners=function(){this.hls.on(z.Events.KEY_LOADING,this.onKeyLoading,this)},P._unregisterListeners=function(){this.hls.off(z.Events.KEY_LOADING,this.onKeyLoading)},P.destroy=function(){this._unregisterListeners();for(var v in this.loaders){var S=this.loaders[v];S&&S.destroy()}this.loaders={}},P.onKeyLoading=function(v,S){var _=S.frag,C=_.type,T=this.loaders[C];if(!_.decryptdata){R.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var m=_.decryptdata.uri;if(m!==this.decrypturl||this.decryptkey===null){var u=this.hls.config;if(T&&(R.logger.warn("abort previous key loader for type:"+C),T.abort()),!m){R.logger.warn("key uri is falsy");return}var o=u.loader,l=_.loader=this.loaders[C]=new o(u);this.decrypturl=m,this.decryptkey=null;var s={url:m,frag:_,responseType:"arraybuffer"},w={timeout:u.fragLoadingTimeOut,maxRetry:0,retryDelay:u.fragLoadingRetryDelay,maxRetryDelay:u.fragLoadingMaxRetryTimeout,highWaterMark:0},p={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};l.load(s,w,p)}else this.decryptkey&&(_.decryptdata.key=this.decryptkey,this.hls.trigger(z.Events.KEY_LOADED,{frag:_}))},P.loadsuccess=function(v,S,_){var C=_.frag;if(!C.decryptdata){R.logger.error("after key load, decryptdata unset");return}this.decryptkey=C.decryptdata.key=new Uint8Array(v.data),C.loader=null,delete this.loaders[C.type],this.hls.trigger(z.Events.KEY_LOADED,{frag:C})},P.loaderror=function(v,S){var _=S.frag,C=_.loader;C&&C.abort(),delete this.loaders[_.type],this.hls.trigger(z.Events.ERROR,{type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:_,response:v})},P.loadtimeout=function(v,S){var _=S.frag,C=_.loader;C&&C.abort(),delete this.loaders[_.type],this.hls.trigger(z.Events.ERROR,{type:I.ErrorTypes.NETWORK_ERROR,details:I.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:_})},U}()},"./src/loader/level-details.ts":function(re,X,L){"use strict";L.r(X),L.d(X,"LevelDetails",function(){return U});var z=L("./src/polyfills/number.ts");function I(P,D){for(var v=0;v<D.length;v++){var S=D[v];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(P,S.key,S)}}function R(P,D,v){return D&&I(P.prototype,D),v&&I(P,v),P}var B=10,U=function(){function P(v){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=v}var D=P.prototype;return D.reloaded=function(S){if(!S){this.advanced=!0,this.updated=!0;return}var _=this.lastPartSn-S.lastPartSn,C=this.lastPartIndex-S.lastPartIndex;this.updated=this.endSN!==S.endSN||!!C||!!_,this.advanced=this.endSN>S.endSN||_>0||_===0&&C>0,this.updated||this.advanced?this.misses=Math.floor(S.misses*.6):this.misses=S.misses+1,this.availabilityDelay=S.availabilityDelay},R(P,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(z.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||B}},{key:"drift",get:function(){var S=this.driftEndTime-this.driftStartTime;if(S>0){var _=this.driftEnd-this.driftStart;return _*1e3/S}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var S;return(S=this.partList)!==null&&S!==void 0&&S.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var S;return(S=this.fragments)!==null&&S!==void 0&&S.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 S;return(S=this.partList)!==null&&S!==void 0&&S.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var S;return(S=this.partList)!==null&&S!==void 0&&S.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),P}()},"./src/loader/level-key.ts":function(re,X,L){"use strict";L.r(X),L.d(X,"LevelKey",function(){return U});var z=L("./node_modules/url-toolkit/src/url-toolkit.js"),I=L.n(z);function R(P,D){for(var v=0;v<D.length;v++){var S=D[v];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(P,S.key,S)}}function B(P,D,v){return D&&R(P.prototype,D),v&&R(P,v),P}var U=function(){P.fromURL=function(v,S){return new P(v,S)},P.fromURI=function(v){return new P(v)};function P(D,v){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,v?this._uri=Object(z.buildAbsoluteURL)(D,v,{alwaysNormalize:!0}):this._uri=D}return B(P,[{key:"uri",get:function(){return this._uri}}]),P}()},"./src/loader/load-stats.ts":function(re,X,L){"use strict";L.r(X),L.d(X,"LoadStats",function(){return z});var z=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(re,X,L){"use strict";L.r(X),L.d(X,"default",function(){return l});var z=L("./src/polyfills/number.ts"),I=L("./node_modules/url-toolkit/src/url-toolkit.js"),R=L.n(I),B=L("./src/loader/fragment.ts"),U=L("./src/loader/level-details.ts"),P=L("./src/loader/level-key.ts"),D=L("./src/utils/attr-list.ts"),v=L("./src/utils/logger.ts"),S=L("./src/utils/codecs.ts"),_=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,C=/#EXT-X-MEDIA:(.*)/g,T=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),m=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("|")),u=/\.(mp4|m4s|m4v|m4a)$/i;function o(A){var y,f;return u.test((y=(f=I.parseURL(A))===null||f===void 0?void 0:f.path)!=null?y:"")}var l=function(){function A(){}return A.findGroup=function(f,h){for(var d=0;d<f.length;d++){var a=f[d];if(a.id===h)return a}},A.convertAVC1ToAVCOTI=function(f){var h=f.split(".");if(h.length>2){var d=h.shift()+".";return d+=parseInt(h.shift()).toString(16),d+=("000"+parseInt(h.shift()).toString(16)).substr(-4),d}return f},A.resolve=function(f,h){return I.buildAbsoluteURL(h,f,{alwaysNormalize:!0})},A.parseMasterPlaylist=function(f,h){var d=[],a={},b=!1;_.lastIndex=0;for(var g;(g=_.exec(f))!=null;)if(g[1]){var E=new D.AttrList(g[1]),M={attrs:E,bitrate:E.decimalInteger("AVERAGE-BANDWIDTH")||E.decimalInteger("BANDWIDTH"),name:E.NAME,url:A.resolve(g[2],h)},F=E.decimalResolution("RESOLUTION");F&&(M.width=F.width,M.height=F.height),s((E.CODECS||"").split(/[ ,]+/).filter(function(W){return W}),M),M.videoCodec&&M.videoCodec.indexOf("avc1")!==-1&&(M.videoCodec=A.convertAVC1ToAVCOTI(M.videoCodec)),d.push(M)}else if(g[3]){var j=new D.AttrList(g[3]);j["DATA-ID"]&&(b=!0,a[j["DATA-ID"]]=j)}return{levels:d,sessionData:b?a:null}},A.parseMasterPlaylistMedia=function(f,h,d,a){a===void 0&&(a=[]);var b,g=[],E=0;for(C.lastIndex=0;(b=C.exec(f))!==null;){var M=new D.AttrList(b[1]);if(M.TYPE===d){var F={attrs:M,bitrate:0,id:E++,groupId:M["GROUP-ID"],instreamId:M["INSTREAM-ID"],name:M.NAME||M.LANGUAGE||"",type:d,default:M.bool("DEFAULT"),autoselect:M.bool("AUTOSELECT"),forced:M.bool("FORCED"),lang:M.LANGUAGE,url:M.URI?A.resolve(M.URI,h):""};if(a.length){var j=A.findGroup(a,F.groupId)||a[0];w(F,j,"audioCodec"),w(F,j,"textCodec")}g.push(F)}}return g},A.parseLevelPlaylist=function(f,h,d,a,b){var g=new U.LevelDetails(h),E=g.fragments,M=null,F=0,j=0,W=0,O=0,k=null,K=new B.Fragment(a,h),Y,q,oe,Te=-1,ve=!1;for(T.lastIndex=0,g.m3u8=f;(Y=T.exec(f))!==null;){ve&&(ve=!1,K=new B.Fragment(a,h),K.start=W,K.sn=F,K.cc=O,K.level=d,M&&(K.initSegment=M,K.rawProgramDateTime=M.rawProgramDateTime));var ge=Y[1];if(ge){K.duration=parseFloat(ge);var me=(" "+Y[2]).slice(1);K.title=me||null,K.tagList.push(me?["INF",ge,me]:["INF",ge])}else if(Y[3])Object(z.isFiniteNumber)(K.duration)&&(K.start=W,oe&&(K.levelkey=oe),K.sn=F,K.level=d,K.cc=O,K.urlId=b,E.push(K),K.relurl=(" "+Y[3]).slice(1),c(K,k),k=K,W+=K.duration,F++,j=0,ve=!0);else if(Y[4]){var le=(" "+Y[4]).slice(1);k?K.setByteRange(le,k):K.setByteRange(le)}else if(Y[5])K.rawProgramDateTime=(" "+Y[5]).slice(1),K.tagList.push(["PROGRAM-DATE-TIME",K.rawProgramDateTime]),Te===-1&&(Te=E.length);else{if(Y=Y[0].match(m),!Y){v.logger.warn("No matches on slow regex match for level playlist!");continue}for(q=1;q<Y.length&&!(typeof Y[q]!="undefined");q++);var ie=(" "+Y[q]).slice(1),he=(" "+Y[q+1]).slice(1),$=Y[q+2]?(" "+Y[q+2]).slice(1):"";switch(ie){case"PLAYLIST-TYPE":g.type=he.toUpperCase();break;case"MEDIA-SEQUENCE":F=g.startSN=parseInt(he);break;case"SKIP":{var te=new D.AttrList(he),Z=te.decimalInteger("SKIPPED-SEGMENTS");if(Object(z.isFiniteNumber)(Z)){g.skippedSegments=Z;for(var be=Z;be--;)E.unshift(null);F+=Z}var Ae=te.enumeratedString("RECENTLY-REMOVED-DATERANGES");Ae&&(g.recentlyRemovedDateranges=Ae.split(" "));break}case"TARGETDURATION":g.targetduration=parseFloat(he);break;case"VERSION":g.version=parseInt(he);break;case"EXTM3U":break;case"ENDLIST":g.live=!1;break;case"#":(he||$)&&K.tagList.push($?[he,$]:[he]);break;case"DIS":O++;case"GAP":K.tagList.push([ie]);break;case"BITRATE":K.tagList.push([ie,he]);break;case"DISCONTINUITY-SEQ":O=parseInt(he);break;case"KEY":{var ye,we=new D.AttrList(he),De=we.enumeratedString("METHOD"),Re=we.URI,Me=we.hexadecimalInteger("IV"),ke=we.enumeratedString("KEYFORMATVERSIONS"),Oe=we.enumeratedString("KEYID"),ze=(ye=we.enumeratedString("KEYFORMAT"))!=null?ye:"identity",Ze=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(Ze.indexOf(ze)>-1){v.logger.warn("Keyformat "+ze+" is not supported from the manifest");continue}else if(ze!=="identity")continue;De&&(oe=P.LevelKey.fromURL(h,Re),Re&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(De)>=0&&(oe.method=De,oe.keyFormat=ze,Oe&&(oe.keyID=Oe),ke&&(oe.keyFormatVersions=ke),oe.iv=Me));break}case"START":{var je=new D.AttrList(he),Xe=je.decimalFloatingPoint("TIME-OFFSET");Object(z.isFiniteNumber)(Xe)&&(g.startTimeOffset=Xe);break}case"MAP":{var et=new D.AttrList(he);K.relurl=et.URI,et.BYTERANGE&&K.setByteRange(et.BYTERANGE),K.level=d,K.sn="initSegment",oe&&(K.levelkey=oe),K.initSegment=null,M=K,ve=!0;break}case"SERVER-CONTROL":{var We=new D.AttrList(he);g.canBlockReload=We.bool("CAN-BLOCK-RELOAD"),g.canSkipUntil=We.optionalFloat("CAN-SKIP-UNTIL",0),g.canSkipDateRanges=g.canSkipUntil>0&&We.bool("CAN-SKIP-DATERANGES"),g.partHoldBack=We.optionalFloat("PART-HOLD-BACK",0),g.holdBack=We.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var Be=new D.AttrList(he);g.partTarget=Be.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Se=g.partList;Se||(Se=g.partList=[]);var qe=j>0?Se[Se.length-1]:void 0,Je=j++,_e=new B.Part(new D.AttrList(he),K,h,Je,qe);Se.push(_e),K.duration+=_e.duration;break}case"PRELOAD-HINT":{var Ne=new D.AttrList(he);g.preloadHint=Ne;break}case"RENDITION-REPORT":{var pe=new D.AttrList(he);g.renditionReports=g.renditionReports||[],g.renditionReports.push(pe);break}default:v.logger.warn("line parsed but not handled: "+Y);break}}}k&&!k.relurl?(E.pop(),W-=k.duration,g.partList&&(g.fragmentHint=k)):g.partList&&(c(K,k),K.cc=O,g.fragmentHint=K);var de=E.length,ce=E[0],Q=E[de-1];if(W+=g.skippedSegments*g.targetduration,W>0&&de&&Q){g.averagetargetduration=W/de;var J=Q.sn;g.endSN=J!=="initSegment"?J:0,ce&&(g.startCC=ce.cc,ce.initSegment||g.fragments.every(function(ee){return ee.relurl&&o(ee.relurl)})&&(v.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),K=new B.Fragment(a,h),K.relurl=Q.relurl,K.level=d,K.sn="initSegment",ce.initSegment=K,g.needSidxRanges=!0))}else g.endSN=0,g.startCC=0;return g.fragmentHint&&(W+=g.fragmentHint.duration),g.totalduration=W,g.endCC=O,Te>0&&p(E,Te),g},A}();function s(A,y){["video","audio","text"].forEach(function(f){var h=A.filter(function(a){return Object(S.isCodecType)(a,f)});if(h.length){var d=h.filter(function(a){return a.lastIndexOf("avc1",0)===0||a.lastIndexOf("mp4a",0)===0});y[f+"Codec"]=d.length>0?d[0]:h[0],A=A.filter(function(a){return h.indexOf(a)===-1})}}),y.unknownCodecs=A}function w(A,y,f){var h=y[f];h&&(A[f]=h)}function p(A,y){for(var f=A[y],h=y;h--;){var d=A[h];if(!d)return;d.programDateTime=f.programDateTime-d.duration*1e3,f=d}}function c(A,y){A.rawProgramDateTime?A.programDateTime=Date.parse(A.rawProgramDateTime):y!=null&&y.programDateTime&&(A.programDateTime=y.endProgramDateTime),Object(z.isFiniteNumber)(A.programDateTime)||(A.programDateTime=null,A.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(re,X,L){"use strict";L.r(X);var z=L("./src/polyfills/number.ts"),I=L("./src/events.ts"),R=L("./src/errors.ts"),B=L("./src/utils/logger.ts"),U=L("./src/utils/mp4-tools.ts"),P=L("./src/loader/m3u8-parser.ts"),D=L("./src/types/loader.ts"),v=L("./src/utils/attr-list.ts");function S(T){var m=T.type;switch(m){case D.PlaylistContextType.AUDIO_TRACK:return D.PlaylistLevelType.AUDIO;case D.PlaylistContextType.SUBTITLE_TRACK:return D.PlaylistLevelType.SUBTITLE;default:return D.PlaylistLevelType.MAIN}}function _(T,m){var u=T.url;return(u===void 0||u.indexOf("data:")===0)&&(u=m.url),u}var C=function(){function T(u){this.hls=void 0,this.loaders=Object.create(null),this.hls=u,this.registerListeners()}var m=T.prototype;return m.registerListeners=function(){var o=this.hls;o.on(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(I.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(I.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.on(I.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},m.unregisterListeners=function(){var o=this.hls;o.off(I.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(I.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(I.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.off(I.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},m.createInternalLoader=function(o){var l=this.hls.config,s=l.pLoader,w=l.loader,p=s||w,c=new p(l);return o.loader=c,this.loaders[o.type]=c,c},m.getInternalLoader=function(o){return this.loaders[o.type]},m.resetInternalLoader=function(o){this.loaders[o]&&delete this.loaders[o]},m.destroyInternalLoaders=function(){for(var o in this.loaders){var l=this.loaders[o];l&&l.destroy(),this.resetInternalLoader(o)}},m.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},m.onManifestLoading=function(o,l){var s=l.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:D.PlaylistContextType.MANIFEST,url:s,deliveryDirectives:null})},m.onLevelLoading=function(o,l){var s=l.id,w=l.level,p=l.url,c=l.deliveryDirectives;this.load({id:s,groupId:null,level:w,responseType:"text",type:D.PlaylistContextType.LEVEL,url:p,deliveryDirectives:c})},m.onAudioTrackLoading=function(o,l){var s=l.id,w=l.groupId,p=l.url,c=l.deliveryDirectives;this.load({id:s,groupId:w,level:null,responseType:"text",type:D.PlaylistContextType.AUDIO_TRACK,url:p,deliveryDirectives:c})},m.onSubtitleTrackLoading=function(o,l){var s=l.id,w=l.groupId,p=l.url,c=l.deliveryDirectives;this.load({id:s,groupId:w,level:null,responseType:"text",type:D.PlaylistContextType.SUBTITLE_TRACK,url:p,deliveryDirectives:c})},m.load=function(o){var l,s=this.hls.config,w=this.getInternalLoader(o);if(w){var p=w.context;if(p&&p.url===o.url){B.logger.trace("[playlist-loader]: playlist request ongoing");return}B.logger.log("[playlist-loader]: aborting previous loader for type: "+o.type),w.abort()}var c,A,y,f;switch(o.type){case D.PlaylistContextType.MANIFEST:c=s.manifestLoadingMaxRetry,A=s.manifestLoadingTimeOut,y=s.manifestLoadingRetryDelay,f=s.manifestLoadingMaxRetryTimeout;break;case D.PlaylistContextType.LEVEL:case D.PlaylistContextType.AUDIO_TRACK:case D.PlaylistContextType.SUBTITLE_TRACK:c=0,A=s.levelLoadingTimeOut;break;default:c=s.levelLoadingMaxRetry,A=s.levelLoadingTimeOut,y=s.levelLoadingRetryDelay,f=s.levelLoadingMaxRetryTimeout;break}if(w=this.createInternalLoader(o),(l=o.deliveryDirectives)!==null&&l!==void 0&&l.part){var h;if(o.type===D.PlaylistContextType.LEVEL&&o.level!==null?h=this.hls.levels[o.level].details:o.type===D.PlaylistContextType.AUDIO_TRACK&&o.id!==null?h=this.hls.audioTracks[o.id].details:o.type===D.PlaylistContextType.SUBTITLE_TRACK&&o.id!==null&&(h=this.hls.subtitleTracks[o.id].details),h){var d=h.partTarget,a=h.targetduration;d&&a&&(A=Math.min(Math.max(d*3,a*.8)*1e3,A))}}var b={timeout:A,maxRetry:c,retryDelay:y,maxRetryDelay:f,highWaterMark:0},g={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};w.load(o,b,g)},m.loadsuccess=function(o,l,s,w){if(w===void 0&&(w=null),s.isSidxRequest){this.handleSidxRequest(o,s),this.handlePlaylistLoaded(o,l,s,w);return}this.resetInternalLoader(s.type);var p=o.data;if(p.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(o,s,"no EXTM3U delimiter",w);return}l.parsing.start=performance.now(),p.indexOf("#EXTINF:")>0||p.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(o,l,s,w):this.handleMasterPlaylist(o,l,s,w)},m.loaderror=function(o,l,s){s===void 0&&(s=null),this.handleNetworkError(l,s,!1,o)},m.loadtimeout=function(o,l,s){s===void 0&&(s=null),this.handleNetworkError(l,s,!0)},m.handleMasterPlaylist=function(o,l,s,w){var p=this.hls,c=o.data,A=_(o,s),y=P.default.parseMasterPlaylist(c,A),f=y.levels,h=y.sessionData;if(!f.length){this.handleManifestParsingError(o,s,"no level found in manifest",w);return}var d=f.map(function(F){return{id:F.attrs.AUDIO,audioCodec:F.audioCodec}}),a=f.map(function(F){return{id:F.attrs.SUBTITLES,textCodec:F.textCodec}}),b=P.default.parseMasterPlaylistMedia(c,A,"AUDIO",d),g=P.default.parseMasterPlaylistMedia(c,A,"SUBTITLES",a),E=P.default.parseMasterPlaylistMedia(c,A,"CLOSED-CAPTIONS");if(b.length){var M=b.some(function(F){return!F.url});!M&&f[0].audioCodec&&!f[0].attrs.AUDIO&&(B.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),b.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new v.AttrList({}),bitrate:0,url:""}))}p.trigger(I.Events.MANIFEST_LOADED,{levels:f,audioTracks:b,subtitles:g,captions:E,url:A,stats:l,networkDetails:w,sessionData:h})},m.handleTrackOrLevelPlaylist=function(o,l,s,w){var p=this.hls,c=s.id,A=s.level,y=s.type,f=_(o,s),h=Object(z.isFiniteNumber)(c)?c:0,d=Object(z.isFiniteNumber)(A)?A:h,a=S(s),b=P.default.parseLevelPlaylist(o.data,f,d,a,h);if(!b.fragments.length){p.trigger(I.Events.ERROR,{type:R.ErrorTypes.NETWORK_ERROR,details:R.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:f,reason:"no fragments found in level",level:typeof s.level=="number"?s.level:void 0});return}if(y===D.PlaylistContextType.MANIFEST){var g={attrs:new v.AttrList({}),bitrate:0,details:b,name:"",url:f};p.trigger(I.Events.MANIFEST_LOADED,{levels:[g],audioTracks:[],url:f,stats:l,networkDetails:w,sessionData:null})}if(l.parsing.end=performance.now(),b.needSidxRanges){var E,M=(E=b.fragments[0].initSegment)===null||E===void 0?void 0:E.url;this.load({url:M,isSidxRequest:!0,type:y,level:A,levelDetails:b,id:c,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}s.levelDetails=b,this.handlePlaylistLoaded(o,l,s,w)},m.handleSidxRequest=function(o,l){var s=Object(U.parseSegmentIndex)(new Uint8Array(o.data));if(!s)return;var w=s.references,p=l.levelDetails;w.forEach(function(c,A){var y=c.info,f=p.fragments[A];f.byteRange.length===0&&f.setByteRange(String(1+y.end-y.start)+"@"+String(y.start)),f.initSegment&&f.initSegment.setByteRange(String(s.moovEndOffset)+"@0")})},m.handleManifestParsingError=function(o,l,s,w){this.hls.trigger(I.Events.ERROR,{type:R.ErrorTypes.NETWORK_ERROR,details:R.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:l.type===D.PlaylistContextType.MANIFEST,url:o.url,reason:s,response:o,context:l,networkDetails:w})},m.handleNetworkError=function(o,l,s,w){s===void 0&&(s=!1),B.logger.warn("[playlist-loader]: A network "+(s?"timeout":"error")+" occurred while loading "+o.type+" level: "+o.level+" id: "+o.id+' group-id: "'+o.groupId+'"');var p=R.ErrorDetails.UNKNOWN,c=!1,A=this.getInternalLoader(o);switch(o.type){case D.PlaylistContextType.MANIFEST:p=s?R.ErrorDetails.MANIFEST_LOAD_TIMEOUT:R.ErrorDetails.MANIFEST_LOAD_ERROR,c=!0;break;case D.PlaylistContextType.LEVEL:p=s?R.ErrorDetails.LEVEL_LOAD_TIMEOUT:R.ErrorDetails.LEVEL_LOAD_ERROR,c=!1;break;case D.PlaylistContextType.AUDIO_TRACK:p=s?R.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:R.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,c=!1;break;case D.PlaylistContextType.SUBTITLE_TRACK:p=s?R.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:R.ErrorDetails.SUBTITLE_LOAD_ERROR,c=!1;break}A&&this.resetInternalLoader(o.type);var y={type:R.ErrorTypes.NETWORK_ERROR,details:p,fatal:c,url:o.url,loader:A,context:o,networkDetails:l};w&&(y.response=w),this.hls.trigger(I.Events.ERROR,y)},m.handlePlaylistLoaded=function(o,l,s,w){var p=s.type,c=s.level,A=s.id,y=s.groupId,f=s.loader,h=s.levelDetails,d=s.deliveryDirectives;if(!(h!=null&&h.targetduration)){this.handleManifestParsingError(o,s,"invalid target duration",w);return}if(!f)return;h.live&&(f.getCacheAge&&(h.ageHeader=f.getCacheAge()||0),(!f.getCacheAge||isNaN(h.ageHeader))&&(h.ageHeader=0));switch(p){case D.PlaylistContextType.MANIFEST:case D.PlaylistContextType.LEVEL:this.hls.trigger(I.Events.LEVEL_LOADED,{details:h,level:c||0,id:A||0,stats:l,networkDetails:w,deliveryDirectives:d});break;case D.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(I.Events.AUDIO_TRACK_LOADED,{details:h,id:A||0,groupId:y||"",stats:l,networkDetails:w,deliveryDirectives:d});break;case D.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(I.Events.SUBTITLE_TRACK_LOADED,{details:h,id:A||0,groupId:y||"",stats:l,networkDetails:w,deliveryDirectives:d});break}},T}();X.default=C},"./src/polyfills/number.ts":function(re,X,L){"use strict";L.r(X),L.d(X,"isFiniteNumber",function(){return z}),L.d(X,"MAX_SAFE_INTEGER",function(){return I});var z=Number.isFinite||function(R){return typeof R=="number"&&isFinite(R)},I=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(re,X,L){"use strict";L.r(X);var z=function(){function I(){}return I.getSilentFrame=function(B,U){switch(B){case"mp4a.40.2":if(U===1)return new Uint8Array([0,200,0,128,35,128]);if(U===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(U===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(U===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(U===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(U===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(U===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(U===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(U===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},I}();X.default=z},"./src/remux/mp4-generator.ts":function(re,X,L){"use strict";L.r(X);var z=Math.pow(2,32)-1,I=function(){function R(){}return R.init=function(){R.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var U;for(U in R.types)R.types.hasOwnProperty(U)&&(R.types[U]=[U.charCodeAt(0),U.charCodeAt(1),U.charCodeAt(2),U.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]);R.HDLR_TYPES={video:P,audio:D};var v=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),S=new Uint8Array([0,0,0,0,0,0,0,0]);R.STTS=R.STSC=R.STCO=S,R.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),R.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),R.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),R.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var _=new Uint8Array([105,115,111,109]),C=new Uint8Array([97,118,99,49]),T=new Uint8Array([0,0,0,1]);R.FTYP=R.box(R.types.ftyp,_,T,_,C),R.DINF=R.box(R.types.dinf,R.box(R.types.dref,v))},R.box=function(U){for(var P=8,D=arguments.length,v=new Array(D>1?D-1:0),S=1;S<D;S++)v[S-1]=arguments[S];for(var _=v.length,C=_;_--;)P+=v[_].byteLength;var T=new Uint8Array(P);for(T[0]=P>>24&255,T[1]=P>>16&255,T[2]=P>>8&255,T[3]=P&255,T.set(U,4),_=0,P=8;_<C;_++)T.set(v[_],P),P+=v[_].byteLength;return T},R.hdlr=function(U){return R.box(R.types.hdlr,R.HDLR_TYPES[U])},R.mdat=function(U){return R.box(R.types.mdat,U)},R.mdhd=function(U,P){P*=U;var D=Math.floor(P/(z+1)),v=Math.floor(P%(z+1));return R.box(R.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,U>>24&255,U>>16&255,U>>8&255,U&255,D>>24,D>>16&255,D>>8&255,D&255,v>>24,v>>16&255,v>>8&255,v&255,85,196,0,0]))},R.mdia=function(U){return R.box(R.types.mdia,R.mdhd(U.timescale,U.duration),R.hdlr(U.type),R.minf(U))},R.mfhd=function(U){return R.box(R.types.mfhd,new Uint8Array([0,0,0,0,U>>24,U>>16&255,U>>8&255,U&255]))},R.minf=function(U){return U.type==="audio"?R.box(R.types.minf,R.box(R.types.smhd,R.SMHD),R.DINF,R.stbl(U)):R.box(R.types.minf,R.box(R.types.vmhd,R.VMHD),R.DINF,R.stbl(U))},R.moof=function(U,P,D){return R.box(R.types.moof,R.mfhd(U),R.traf(D,P))},R.moov=function(U){for(var P=U.length,D=[];P--;)D[P]=R.trak(U[P]);return R.box.apply(null,[R.types.moov,R.mvhd(U[0].timescale,U[0].duration)].concat(D).concat(R.mvex(U)))},R.mvex=function(U){for(var P=U.length,D=[];P--;)D[P]=R.trex(U[P]);return R.box.apply(null,[R.types.mvex].concat(D))},R.mvhd=function(U,P){P*=U;var D=Math.floor(P/(z+1)),v=Math.floor(P%(z+1)),S=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,U>>24&255,U>>16&255,U>>8&255,U&255,D>>24,D>>16&255,D>>8&255,D&255,v>>24,v>>16&255,v>>8&255,v&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return R.box(R.types.mvhd,S)},R.sdtp=function(U){var P=U.samples||[],D=new Uint8Array(4+P.length),v,S;for(v=0;v<P.length;v++)S=P[v].flags,D[v+4]=S.dependsOn<<4|S.isDependedOn<<2|S.hasRedundancy;return R.box(R.types.sdtp,D)},R.stbl=function(U){return R.box(R.types.stbl,R.stsd(U),R.box(R.types.stts,R.STTS),R.box(R.types.stsc,R.STSC),R.box(R.types.stsz,R.STSZ),R.box(R.types.stco,R.STCO))},R.avc1=function(U){var P=[],D=[],v,S,_;for(v=0;v<U.sps.length;v++)S=U.sps[v],_=S.byteLength,P.push(_>>>8&255),P.push(_&255),P=P.concat(Array.prototype.slice.call(S));for(v=0;v<U.pps.length;v++)S=U.pps[v],_=S.byteLength,D.push(_>>>8&255),D.push(_&255),D=D.concat(Array.prototype.slice.call(S));var C=R.box(R.types.avcC,new Uint8Array([1,P[3],P[4],P[5],252|3,224|U.sps.length].concat(P).concat([U.pps.length]).concat(D))),T=U.width,m=U.height,u=U.pixelRatio[0],o=U.pixelRatio[1];return R.box(R.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,T>>8&255,T&255,m>>8&255,m&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),C,R.box(R.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),R.box(R.types.pasp,new Uint8Array([u>>24,u>>16&255,u>>8&255,u&255,o>>24,o>>16&255,o>>8&255,o&255])))},R.esds=function(U){var P=U.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(U.config).concat([6,1,2]))},R.mp4a=function(U){var P=U.samplerate;return R.box(R.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,U.channelCount,0,16,0,0,0,0,P>>8&255,P&255,0,0]),R.box(R.types.esds,R.esds(U)))},R.mp3=function(U){var P=U.samplerate;return R.box(R.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,U.channelCount,0,16,0,0,0,0,P>>8&255,P&255,0,0]))},R.stsd=function(U){return U.type==="audio"?!U.isAAC&&U.codec==="mp3"?R.box(R.types.stsd,R.STSD,R.mp3(U)):R.box(R.types.stsd,R.STSD,R.mp4a(U)):R.box(R.types.stsd,R.STSD,R.avc1(U))},R.tkhd=function(U){var P=U.id,D=U.duration*U.timescale,v=U.width,S=U.height,_=Math.floor(D/(z+1)),C=Math.floor(D%(z+1));return R.box(R.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,P>>24&255,P>>16&255,P>>8&255,P&255,0,0,0,0,_>>24,_>>16&255,_>>8&255,_&255,C>>24,C>>16&255,C>>8&255,C&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,v>>8&255,v&255,0,0,S>>8&255,S&255,0,0]))},R.traf=function(U,P){var D=R.sdtp(U),v=U.id,S=Math.floor(P/(z+1)),_=Math.floor(P%(z+1));return R.box(R.types.traf,R.box(R.types.tfhd,new Uint8Array([0,0,0,0,v>>24,v>>16&255,v>>8&255,v&255])),R.box(R.types.tfdt,new Uint8Array([1,0,0,0,S>>24,S>>16&255,S>>8&255,S&255,_>>24,_>>16&255,_>>8&255,_&255])),R.trun(U,D.length+16+20+8+16+8+8),D)},R.trak=function(U){return U.duration=U.duration||4294967295,R.box(R.types.trak,R.tkhd(U),R.mdia(U))},R.trex=function(U){var P=U.id;return R.box(R.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]))},R.trun=function(U,P){var D=U.samples||[],v=D.length,S=12+16*v,_=new Uint8Array(S),C,T,m,u,o,l;for(P+=8+S,_.set([0,0,15,1,v>>>24&255,v>>>16&255,v>>>8&255,v&255,P>>>24&255,P>>>16&255,P>>>8&255,P&255],0),C=0;C<v;C++)T=D[C],m=T.duration,u=T.size,o=T.flags,l=T.cts,_.set([m>>>24&255,m>>>16&255,m>>>8&255,m&255,u>>>24&255,u>>>16&255,u>>>8&255,u&255,o.isLeading<<2|o.dependsOn,o.isDependedOn<<6|o.hasRedundancy<<4|o.paddingValue<<1|o.isNonSync,o.degradPrio&240<<8,o.degradPrio&15,l>>>24&255,l>>>16&255,l>>>8&255,l&255],12+16*C);return R.box(R.types.trun,_)},R.initSegment=function(U){R.types||R.init();var P=R.moov(U),D=new Uint8Array(R.FTYP.byteLength+P.byteLength);return D.set(R.FTYP),D.set(P,R.FTYP.byteLength),D},R}();I.types=void 0,I.HDLR_TYPES=void 0,I.STTS=void 0,I.STSC=void 0,I.STCO=void 0,I.STSZ=void 0,I.VMHD=void 0,I.SMHD=void 0,I.STSD=void 0,I.FTYP=void 0,I.DINF=void 0,X.default=I},"./src/remux/mp4-remuxer.ts":function(re,X,L){"use strict";L.r(X),L.d(X,"default",function(){return l}),L.d(X,"normalizePts",function(){return s});var z=L("./src/polyfills/number.ts"),I=L("./src/remux/aac-helper.ts"),R=L("./src/remux/mp4-generator.ts"),B=L("./src/events.ts"),U=L("./src/errors.ts"),P=L("./src/utils/logger.ts"),D=L("./src/types/loader.ts"),v=L("./src/utils/timescale-conversion.ts");function S(){return S=Object.assign||function(A){for(var y=1;y<arguments.length;y++){var f=arguments[y];for(var h in f)Object.prototype.hasOwnProperty.call(f,h)&&(A[h]=f[h])}return A},S.apply(this,arguments)}var _=10*1e3,C=1024,T=1152,m=null,u=null,o=!1,l=function(){function A(f,h,d,a){if(a===void 0&&(a=""),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=f,this.config=h,this.typeSupported=d,this.ISGenerated=!1,m===null){var b=navigator.userAgent||"",g=b.match(/Chrome\/(\d+)/i);m=g?parseInt(g[1]):0}if(u===null){var E=navigator.userAgent.match(/Safari\/(\d+)/i);u=E?parseInt(E[1]):0}o=!!m&&m<75||!!u&&u<600}var y=A.prototype;return y.destroy=function(){},y.resetTimeStamp=function(h){P.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=h},y.resetNextTimestamp=function(){P.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},y.resetInitSegment=function(){P.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},y.getVideoStartPts=function(h){var d=!1,a=h.reduce(function(b,g){var E=g.pts-b;return E<-4294967296?(d=!0,s(b,g.pts)):E>0?b:g.pts},h[0].pts);return d&&P.logger.debug("PTS rollover detected"),a},y.remux=function(h,d,a,b,g,E,M,F){var j,W,O,k,K,Y,q=g,oe=g,Te=h.pid>-1,ve=d.pid>-1,ge=d.samples.length,me=h.samples.length>0,le=ge>1,ie=(!Te||me)&&(!ve||le)||this.ISGenerated||M;if(ie){this.ISGenerated||(O=this.generateIS(h,d,g));var he=this.isVideoContiguous,$=-1;if(le&&($=w(d.samples),!he&&this.config.forceKeyFrameOnDiscontinuity))if(Y=!0,$>0){P.logger.warn("[mp4-remuxer]: Dropped "+$+" out of "+ge+" video samples due to a missing keyframe");var te=this.getVideoStartPts(d.samples);d.samples=d.samples.slice($),d.dropped+=$,oe+=(d.samples[0].pts-te)/(d.timescale||9e4)}else $===-1&&(P.logger.warn("[mp4-remuxer]: No keyframe found out of "+ge+" video samples"),Y=!1);if(this.ISGenerated){if(me&&le){var Z=this.getVideoStartPts(d.samples),be=s(h.samples[0].pts,Z)-Z,Ae=be/d.inputTimeScale;q+=Math.max(0,Ae),oe+=Math.max(0,-Ae)}if(me){if(h.samplerate||(P.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),O=this.generateIS(h,d,g)),W=this.remuxAudio(h,q,this.isAudioContiguous,E,ve||le||F===D.PlaylistLevelType.AUDIO?oe:void 0),le){var ye=W?W.endPTS-W.startPTS:0;d.inputTimeScale||(P.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),O=this.generateIS(h,d,g)),j=this.remuxVideo(d,oe,he,ye)}}else le&&(j=this.remuxVideo(d,oe,he,0));j&&(j.firstKeyFrame=$,j.independent=$!==-1)}}return this.ISGenerated&&(a.samples.length&&(K=this.remuxID3(a,g)),b.samples.length&&(k=this.remuxText(b,g))),{audio:W,video:j,initSegment:O,independent:Y,text:k,id3:K}},y.generateIS=function(h,d,a){var b=h.samples,g=d.samples,E=this.typeSupported,M={},F=!Object(z.isFiniteNumber)(this._initPTS),j="audio/mp4",W,O,k;if(F&&(W=O=Infinity),h.config&&b.length&&(h.timescale=h.samplerate,h.isAAC||(E.mpeg?(j="audio/mpeg",h.codec=""):E.mp3&&(h.codec="mp3")),M.audio={id:"audio",container:j,codec:h.codec,initSegment:!h.isAAC&&E.mpeg?new Uint8Array(0):R.default.initSegment([h]),metadata:{channelCount:h.channelCount}},F&&(k=h.inputTimeScale,W=O=b[0].pts-Math.round(k*a))),d.sps&&d.pps&&g.length&&(d.timescale=d.inputTimeScale,M.video={id:"main",container:"video/mp4",codec:d.codec,initSegment:R.default.initSegment([d]),metadata:{width:d.width,height:d.height}},F)){k=d.inputTimeScale;var K=this.getVideoStartPts(g),Y=Math.round(k*a);O=Math.min(O,s(g[0].dts,K)-Y),W=Math.min(W,K-Y)}if(Object.keys(M).length)return this.ISGenerated=!0,F&&(this._initPTS=W,this._initDTS=O),{tracks:M,initPTS:W,timescale:k}},y.remuxVideo=function(h,d,a,b){var g=h.inputTimeScale,E=h.samples,M=[],F=E.length,j=this._initPTS,W=this.nextAvcDts,O=8,k,K,Y,q=Number.POSITIVE_INFINITY,oe=Number.NEGATIVE_INFINITY,Te=0,ve=!1;if(!a||W===null){var ge=d*g,me=E[0].pts-s(E[0].dts,E[0].pts);W=ge-me}for(var le=0;le<F;le++){var ie=E[le];if(ie.pts=s(ie.pts-j,W),ie.dts=s(ie.dts-j,W),ie.dts>ie.pts){var he=9e4*.2;Te=Math.max(Math.min(Te,ie.pts-ie.dts),-1*he)}ie.dts<E[le>0?le-1:le].dts&&(ve=!0)}ve&&E.sort(function(gt,ct){var st=gt.dts-ct.dts,wt=gt.pts-ct.pts;return st||wt}),K=E[0].dts,Y=E[E.length-1].dts;var $=Math.round((Y-K)/(F-1));if(Te<0){if(Te<$*-2){P.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(v.toMsFromMpegTsClock)(-$,!0)+" ms");for(var te=Te,Z=0;Z<F;Z++)E[Z].dts=te=Math.max(te,E[Z].pts-$),E[Z].pts=Math.max(te,E[Z].pts)}else{P.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(v.toMsFromMpegTsClock)(Te,!0)+" ms to overcome this issue");for(var be=0;be<F;be++)E[be].dts=E[be].dts+Te}K=E[0].dts}if(a){var Ae=K-W,ye=Ae>$,we=Ae<-1;if(ye||we){ye?P.logger.warn("AVC: "+Object(v.toMsFromMpegTsClock)(Ae,!0)+" ms ("+Ae+"dts) hole between fragments detected, filling it"):P.logger.warn("AVC: "+Object(v.toMsFromMpegTsClock)(-Ae,!0)+" ms ("+Ae+"dts) overlapping between fragments detected"),K=W;var De=E[0].pts-Ae;E[0].dts=K,E[0].pts=De,P.logger.log("Video: First PTS/DTS adjusted: "+Object(v.toMsFromMpegTsClock)(De,!0)+"/"+Object(v.toMsFromMpegTsClock)(K,!0)+", delta: "+Object(v.toMsFromMpegTsClock)(Ae,!0)+" ms")}}o&&(K=Math.max(0,K));for(var Re=0,Me=0,ke=0;ke<F;ke++){for(var Oe=E[ke],ze=Oe.units,Ze=ze.length,je=0,Xe=0;Xe<Ze;Xe++)je+=ze[Xe].data.length;Me+=je,Re+=Ze,Oe.length=je,Oe.dts=Math.max(Oe.dts,K),Oe.pts=Math.max(Oe.pts,Oe.dts,0),q=Math.min(Oe.pts,q),oe=Math.max(Oe.pts,oe)}Y=E[F-1].dts;var et=Me+4*Re+8,We;try{We=new Uint8Array(et)}catch(gt){this.observer.emit(B.Events.ERROR,B.Events.ERROR,{type:U.ErrorTypes.MUX_ERROR,details:U.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:et,reason:"fail allocating video mdat "+et});return}var Be=new DataView(We.buffer);Be.setUint32(0,et),We.set(R.default.types.mdat,4);for(var Se=0;Se<F;Se++){for(var qe=E[Se],Je=qe.units,_e=0,Ne=0,pe=Je.length;Ne<pe;Ne++){var de=Je[Ne],ce=de.data,Q=de.data.byteLength;Be.setUint32(O,Q),O+=4,We.set(ce,O),O+=Q,_e+=4+Q}if(Se<F-1)k=E[Se+1].dts-qe.dts;else{var J=this.config,ee=qe.dts-E[Se>0?Se-1:Se].dts;if(J.stretchShortVideoTrack&&this.nextAudioPts!==null){var se=Math.floor(J.maxBufferHole*g),fe=(b?q+b*g:this.nextAudioPts)-qe.pts;fe>se?(k=fe-ee,k<0&&(k=ee),P.logger.log("[mp4-remuxer]: It is approximately "+fe/90+" ms to the next segment; using duration "+k/90+" ms for the last video frame.")):k=ee}else k=ee}var Le=Math.round(qe.pts-qe.dts);M.push(new p(qe.key,k,_e,Le))}if(M.length&&m&&m<70){var Ce=M[0].flags;Ce.dependsOn=2,Ce.isNonSync=0}console.assert(k!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=W=Y+k,this.isVideoContiguous=!0;var Ie=R.default.moof(h.sequenceNumber++,K,S({},h,{samples:M})),Ve="video",Ge={data1:Ie,data2:We,startPTS:q/g,endPTS:(oe+k)/g,startDTS:K/g,endDTS:W/g,type:Ve,hasAudio:!1,hasVideo:!0,nb:M.length,dropped:h.dropped};return h.samples=[],h.dropped=0,console.assert(We.length,"MDAT length must not be zero"),Ge},y.remuxAudio=function(h,d,a,b,g){var E=h.inputTimeScale,M=h.samplerate?h.samplerate:E,F=E/M,j=h.isAAC?C:T,W=j*F,O=this._initPTS,k=!h.isAAC&&this.typeSupported.mpeg,K=[],Y=h.samples,q=k?0:8,oe=this.nextAudioPts||-1,Te=d*E;if(this.isAudioContiguous=a=a||Y.length&&oe>0&&(b&&Math.abs(Te-oe)<9e3||Math.abs(s(Y[0].pts-O,Te)-oe)<20*W),Y.forEach(function(ce){ce.pts=s(ce.pts-O,Te)}),!a||oe<0){if(Y=Y.filter(function(ce){return ce.pts>=0}),!Y.length)return;g===0?oe=0:b?oe=Math.max(0,Te):oe=Y[0].pts}if(h.isAAC)for(var ve=g!==void 0,ge=this.config.maxAudioFramesDrift,me=0,le=oe;me<Y.length;me++){var ie=Y[me],he=ie.pts,$=he-le,te=Math.abs(1e3*$/E);if($<=-ge*W&&ve)me===0&&(P.logger.warn("Audio frame @ "+(he/E).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*$/E)+" ms."),this.nextAudioPts=oe=le=he);else if($>=ge*W&&te<_&&ve){var Z=Math.round($/W);le=he-Z*W,le<0&&(Z--,le+=W),me===0&&(this.nextAudioPts=oe=le),P.logger.warn("[mp4-remuxer]: Injecting "+Z+" audio frame @ "+(le/E).toFixed(3)+"s due to "+Math.round(1e3*$/E)+" ms gap.");for(var be=0;be<Z;be++){var Ae=Math.max(le,0),ye=I.default.getSilentFrame(h.manifestCodec||h.codec,h.channelCount);ye||(P.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),ye=ie.unit.subarray()),Y.splice(me,0,{unit:ye,pts:Ae}),le+=W,me++}}ie.pts=le,le+=W}for(var we=null,De=null,Re,Me=0,ke=Y.length;ke--;)Me+=Y[ke].unit.byteLength;for(var Oe=0,ze=Y.length;Oe<ze;Oe++){var Ze=Y[Oe],je=Ze.unit,Xe=Ze.pts;if(De!==null){var et=K[Oe-1];et.duration=Math.round((Xe-De)/F)}else if(a&&h.isAAC&&(Xe=oe),we=Xe,Me>0){Me+=q;try{Re=new Uint8Array(Me)}catch(ce){this.observer.emit(B.Events.ERROR,B.Events.ERROR,{type:U.ErrorTypes.MUX_ERROR,details:U.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Me,reason:"fail allocating audio mdat "+Me});return}if(!k){var We=new DataView(Re.buffer);We.setUint32(0,Me),Re.set(R.default.types.mdat,4)}}else return;Re.set(je,q);var Be=je.byteLength;q+=Be,K.push(new p(!0,j,Be,0)),De=Xe}var Se=K.length;if(!Se)return;var qe=K[K.length-1];this.nextAudioPts=oe=De+F*qe.duration;var Je=k?new Uint8Array(0):R.default.moof(h.sequenceNumber++,we/F,S({},h,{samples:K}));h.samples=[];var _e=we/E,Ne=oe/E,pe="audio",de={data1:Je,data2:Re,startPTS:_e,endPTS:Ne,startDTS:_e,endDTS:Ne,type:pe,hasAudio:!0,hasVideo:!1,nb:Se};return this.isAudioContiguous=!0,console.assert(Re.length,"MDAT length must not be zero"),de},y.remuxEmptyAudio=function(h,d,a,b){var g=h.inputTimeScale,E=h.samplerate?h.samplerate:g,M=g/E,F=this.nextAudioPts,j=(F!==null?F:b.startDTS*g)+this._initDTS,W=b.endDTS*g+this._initDTS,O=M*C,k=Math.ceil((W-j)/O),K=I.default.getSilentFrame(h.manifestCodec||h.codec,h.channelCount);if(P.logger.warn("[mp4-remuxer]: remux empty Audio"),!K){P.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var Y=[],q=0;q<k;q++){var oe=j+q*O;Y.push({unit:K,pts:oe,dts:oe})}return h.samples=Y,this.remuxAudio(h,d,a,!1)},y.remuxID3=function(h,d){var a=h.samples.length;if(!a)return;for(var b=h.inputTimeScale,g=this._initPTS,E=this._initDTS,M=0;M<a;M++){var F=h.samples[M];F.pts=s(F.pts-g,d*b)/b,F.dts=s(F.dts-E,d*b)/b}var j=h.samples;return h.samples=[],{samples:j}},y.remuxText=function(h,d){var a=h.samples.length;if(!a)return;for(var b=h.inputTimeScale,g=this._initPTS,E=0;E<a;E++){var M=h.samples[E];M.pts=s(M.pts-g,d*b)/b}h.samples.sort(function(j,W){return j.pts-W.pts});var F=h.samples;return h.samples=[],{samples:F}},A}();function s(A,y){var f;if(y===null)return A;for(y<A?f=-8589934592:f=8589934592;Math.abs(A-y)>4294967296;)A+=f;return A}function w(A){for(var y=0;y<A.length;y++)if(A[y].key)return y;return-1}var p=function(y,f,h,d){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=f,this.size=h,this.cts=d,this.flags=new c(y)},c=function(y){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=y?2:1,this.isNonSync=y?0:1}},"./src/remux/passthrough-remuxer.ts":function(re,X,L){"use strict";L.r(X);var z=L("./src/polyfills/number.ts"),I=L("./src/utils/mp4-tools.ts"),R=L("./src/loader/fragment.ts"),B=L("./src/utils/logger.ts"),U=function(){function v(){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 S=v.prototype;return S.destroy=function(){},S.resetTimeStamp=function(C){this.initPTS=C,this.lastEndDTS=null},S.resetNextTimestamp=function(){this.lastEndDTS=null},S.resetInitSegment=function(C,T,m){this.audioCodec=T,this.videoCodec=m,this.generateInitSegment(C),this.emitInitSegment=!0},S.generateInitSegment=function(C){var T=this.audioCodec,m=this.videoCodec;if(!C||!C.byteLength){this.initTracks=void 0,this.initData=void 0;return}var u=this.initData=Object(I.parseInitSegment)(C);T||(T=D(u.audio,R.ElementaryStreamTypes.AUDIO)),m||(m=D(u.video,R.ElementaryStreamTypes.VIDEO));var o={};u.audio&&u.video?o.audiovideo={container:"video/mp4",codec:T+","+m,initSegment:C,id:"main"}:u.audio?o.audio={container:"audio/mp4",codec:T,initSegment:C,id:"audio"}:u.video?o.video={container:"video/mp4",codec:m,initSegment:C,id:"main"}:B.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=o},S.remux=function(C,T,m,u,o){var l=this.initPTS,s=this.lastEndDTS,w={audio:void 0,video:void 0,text:u,id3:m,initSegment:void 0};Object(z.isFiniteNumber)(s)||(s=this.lastEndDTS=o||0);var p=T.samples;if(!p||!p.length)return w;var c={initPTS:void 0,timescale:1},A=this.initData;if((!A||!A.length)&&(this.generateInitSegment(p),A=this.initData),!A||!A.length)return B.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),w;this.emitInitSegment&&(c.tracks=this.initTracks,this.emitInitSegment=!1),Object(z.isFiniteNumber)(l)||(this.initPTS=c.initPTS=l=P(A,p,s));var y=Object(I.getDuration)(p,A),f=s,h=y+f;Object(I.offsetStartDTS)(A,p,l),y>0?this.lastEndDTS=h:(B.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var d=!!A.audio,a=!!A.video,b="";d&&(b+="audio"),a&&(b+="video");var g={data1:p,startPTS:f,startDTS:f,endPTS:h,endDTS:h,type:b,hasAudio:d,hasVideo:a,nb:1,dropped:0};return w.audio=g.type==="audio"?g:void 0,w.video=g.type!=="audio"?g:void 0,w.text=u,w.id3=m,w.initSegment=c,w},v}(),P=function(S,_,C){return Object(I.getStartDTS)(S,_)-C};function D(v,S){var _=v==null?void 0:v.codec;return _&&_.length>4?_:_==="hvc1"?"hvc1.1.c.L120.90":_==="av01"?"av01.0.04M.08":_==="avc1"||S===R.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}X.default=U},"./src/task-loop.ts":function(re,X,L){"use strict";L.r(X),L.d(X,"default",function(){return z});var z=function(){function I(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var R=I.prototype;return R.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},R.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},R.onHandlerDestroyed=function(){},R.hasInterval=function(){return!!this._tickInterval},R.hasNextTick=function(){return!!this._tickTimer},R.setInterval=function(U){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,U),!0)},R.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},R.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},R.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},R.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},R.doTick=function(){},I}()},"./src/types/cmcd.ts":function(re,X,L){"use strict";L.r(X),L.d(X,"CMCDVersion",function(){return z}),L.d(X,"CMCDObjectType",function(){return I}),L.d(X,"CMCDStreamingFormat",function(){return R}),L.d(X,"CMCDStreamType",function(){return B});var z=1,I;(function(U){U.MANIFEST="m",U.AUDIO="a",U.VIDEO="v",U.MUXED="av",U.INIT="i",U.CAPTION="c",U.TIMED_TEXT="tt",U.KEY="k",U.OTHER="o"})(I||(I={}));var R;(function(U){U.DASH="d",U.HLS="h",U.SMOOTH="s",U.OTHER="o"})(R||(R={}));var B;(function(U){U.VOD="v",U.LIVE="l"})(B||(B={}))},"./src/types/level.ts":function(re,X,L){"use strict";L.r(X),L.d(X,"HlsSkip",function(){return R}),L.d(X,"getSkipValue",function(){return B}),L.d(X,"HlsUrlParameters",function(){return U}),L.d(X,"Level",function(){return P});function z(D,v){for(var S=0;S<v.length;S++){var _=v[S];_.enumerable=_.enumerable||!1,_.configurable=!0,"value"in _&&(_.writable=!0),Object.defineProperty(D,_.key,_)}}function I(D,v,S){return v&&z(D.prototype,v),S&&z(D,S),D}var R;(function(D){D.No="",D.Yes="YES",D.v2="v2"})(R||(R={}));function B(D,v){var S=D.canSkipUntil,_=D.canSkipDateRanges,C=D.endSN,T=v!==void 0?v-C:0;return S&&T<S?_?R.v2:R.Yes:R.No}var U=function(){function D(S,_,C){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=S,this.part=_,this.skip=C}var v=D.prototype;return v.addDirectives=function(_){var C=new self.URL(_);return this.msn!==void 0&&C.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&C.searchParams.set("_HLS_part",this.part.toString()),this.skip&&C.searchParams.set("_HLS_skip",this.skip),C.toString()},D}(),P=function(){function D(v){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=[v.url],this.attrs=v.attrs,this.bitrate=v.bitrate,v.details&&(this.details=v.details),this.id=v.id||0,this.name=v.name,this.width=v.width||0,this.height=v.height||0,this.audioCodec=v.audioCodec,this.videoCodec=v.videoCodec,this.unknownCodecs=v.unknownCodecs,this.codecSet=[v.videoCodec,v.audioCodec].filter(function(S){return S}).join(",").replace(/\.[^.,]+/g,"")}return I(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(S){var _=S%this.url.length;this._urlId!==_&&(this.details=void 0,this._urlId=_)}}]),D}()},"./src/types/loader.ts":function(re,X,L){"use strict";L.r(X),L.d(X,"PlaylistContextType",function(){return z}),L.d(X,"PlaylistLevelType",function(){return I});var z;(function(R){R.MANIFEST="manifest",R.LEVEL="level",R.AUDIO_TRACK="audioTrack",R.SUBTITLE_TRACK="subtitleTrack"})(z||(z={}));var I;(function(R){R.MAIN="main",R.AUDIO="audio",R.SUBTITLE="subtitle"})(I||(I={}))},"./src/types/transmuxer.ts":function(re,X,L){"use strict";L.r(X),L.d(X,"ChunkMetadata",function(){return z});var z=function(B,U,P,D,v,S){D===void 0&&(D=0),v===void 0&&(v=-1),S===void 0&&(S=!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=I(),this.buffering={audio:I(),video:I(),audiovideo:I()},this.level=B,this.sn=U,this.id=P,this.size=D,this.part=v,this.partial=S};function I(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(re,X,L){"use strict";L.r(X),L.d(X,"AttrList",function(){return R});var z=/^(\d+)x(\d+)$/,I=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,R=function(){function B(P){typeof P=="string"&&(P=B.parseAttrList(P));for(var D in P)P.hasOwnProperty(D)&&(this[D]=P[D])}var U=B.prototype;return U.decimalInteger=function(D){var v=parseInt(this[D],10);return v>Number.MAX_SAFE_INTEGER?Infinity:v},U.hexadecimalInteger=function(D){if(this[D]){var v=(this[D]||"0x").slice(2);v=(v.length&1?"0":"")+v;for(var S=new Uint8Array(v.length/2),_=0;_<v.length/2;_++)S[_]=parseInt(v.slice(_*2,_*2+2),16);return S}else return null},U.hexadecimalIntegerAsNumber=function(D){var v=parseInt(this[D],16);return v>Number.MAX_SAFE_INTEGER?Infinity:v},U.decimalFloatingPoint=function(D){return parseFloat(this[D])},U.optionalFloat=function(D,v){var S=this[D];return S?parseFloat(S):v},U.enumeratedString=function(D){return this[D]},U.bool=function(D){return this[D]==="YES"},U.decimalResolution=function(D){var v=z.exec(this[D]);return v===null?void 0:{width:parseInt(v[1],10),height:parseInt(v[2],10)}},B.parseAttrList=function(D){var v,S={},_='"';for(I.lastIndex=0;(v=I.exec(D))!==null;){var C=v[2];C.indexOf(_)===0&&C.lastIndexOf(_)===C.length-1&&(C=C.slice(1,-1)),S[v[1]]=C}return S},B}()},"./src/utils/binary-search.ts":function(re,X,L){"use strict";L.r(X);var z={search:function(R,B){for(var U=0,P=R.length-1,D=null,v=null;U<=P;){D=(U+P)/2|0,v=R[D];var S=B(v);if(S>0)U=D+1;else if(S<0)P=D-1;else return v}return null}};X.default=z},"./src/utils/buffer-helper.ts":function(re,X,L){"use strict";L.r(X),L.d(X,"BufferHelper",function(){return R});var z=L("./src/utils/logger.ts"),I={length:0,start:function(){return 0},end:function(){return 0}},R=function(){function B(){}return B.isBuffered=function(P,D){try{if(P){for(var v=B.getBuffered(P),S=0;S<v.length;S++)if(D>=v.start(S)&&D<=v.end(S))return!0}}catch(_){}return!1},B.bufferInfo=function(P,D,v){try{if(P){var S=B.getBuffered(P),_=[],C;for(C=0;C<S.length;C++)_.push({start:S.start(C),end:S.end(C)});return this.bufferedInfo(_,D,v)}}catch(T){}return{len:0,start:D,end:D,nextStart:void 0}},B.bufferedInfo=function(P,D,v){D=Math.max(0,D),P.sort(function(c,A){var y=c.start-A.start;return y||A.end-c.end});var S=[];if(v)for(var _=0;_<P.length;_++){var C=S.length;if(C){var T=S[C-1].end;P[_].start-T<v?P[_].end>T&&(S[C-1].end=P[_].end):S.push(P[_])}else S.push(P[_])}else S=P;for(var m=0,u,o=D,l=D,s=0;s<S.length;s++){var w=S[s].start,p=S[s].end;if(D+v>=w&&D<p)o=w,l=p,m=l-D;else if(D+v<w){u=w;break}}return{len:m,start:o||0,end:l||0,nextStart:u}},B.getBuffered=function(P){try{return P.buffered}catch(D){return z.logger.log("failed to get media.buffered",D),I}},B}()},"./src/utils/cea-608-parser.ts":function(re,X,L){"use strict";L.r(X),L.d(X,"Row",function(){return l}),L.d(X,"CaptionScreen",function(){return s});var z=L("./src/utils/logger.ts"),I={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},R=function(h){var d=h;return I.hasOwnProperty(h)&&(d=I[h]),String.fromCharCode(d)},B=15,U=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},v={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},S={25:2,26:4,29:6,30:8,31:10,27:13,28:15},_=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],C;(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"})(C||(C={}));var T=function(){function f(){this.time=null,this.verboseLevel=C.ERROR}var h=f.prototype;return h.log=function(a,b){this.verboseLevel>=a&&z.logger.log(this.time+" ["+a+"] "+b)},f}(),m=function(h){for(var d=[],a=0;a<h.length;a++)d.push(h[a].toString(16));return d},u=function(){function f(d,a,b,g,E){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=a||!1,this.italics=b||!1,this.background=g||"black",this.flash=E||!1}var h=f.prototype;return h.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},h.setStyles=function(a){for(var b=["foreground","underline","italics","background","flash"],g=0;g<b.length;g++){var E=b[g];a.hasOwnProperty(E)&&(this[E]=a[E])}},h.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},h.equals=function(a){return this.foreground===a.foreground&&this.underline===a.underline&&this.italics===a.italics&&this.background===a.background&&this.flash===a.flash},h.copy=function(a){this.foreground=a.foreground,this.underline=a.underline,this.italics=a.italics,this.background=a.background,this.flash=a.flash},h.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},f}(),o=function(){function f(d,a,b,g,E,M){this.uchar=void 0,this.penState=void 0,this.uchar=d||" ",this.penState=new u(a,b,g,E,M)}var h=f.prototype;return h.reset=function(){this.uchar=" ",this.penState.reset()},h.setChar=function(a,b){this.uchar=a,this.penState.copy(b)},h.setPenState=function(a){this.penState.copy(a)},h.equals=function(a){return this.uchar===a.uchar&&this.penState.equals(a.penState)},h.copy=function(a){this.uchar=a.uchar,this.penState.copy(a.penState)},h.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 a=0;a<U;a++)this.chars.push(new o);this.logger=d,this.pos=0,this.currPenState=new u}var h=f.prototype;return h.equals=function(a){for(var b=!0,g=0;g<U;g++)if(!this.chars[g].equals(a.chars[g])){b=!1;break}return b},h.copy=function(a){for(var b=0;b<U;b++)this.chars[b].copy(a.chars[b])},h.isEmpty=function(){for(var a=!0,b=0;b<U;b++)if(!this.chars[b].isEmpty()){a=!1;break}return a},h.setCursor=function(a){this.pos!==a&&(this.pos=a),this.pos<0?(this.logger.log(C.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>U&&(this.logger.log(C.DEBUG,"Too large cursor position "+this.pos),this.pos=U)},h.moveCursor=function(a){var b=this.pos+a;if(a>1)for(var g=this.pos+1;g<b+1;g++)this.chars[g].setPenState(this.currPenState);this.setCursor(b)},h.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},h.insertChar=function(a){a>=144&&this.backSpace();var b=R(a);if(this.pos>=U){this.logger.log(C.ERROR,"Cannot insert "+a.toString(16)+" ("+b+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(b,this.currPenState),this.moveCursor(1)},h.clearFromPos=function(a){var b;for(b=a;b<U;b++)this.chars[b].reset()},h.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},h.clearToEndOfRow=function(){this.clearFromPos(this.pos)},h.getTextString=function(){for(var a=[],b=!0,g=0;g<U;g++){var E=this.chars[g].uchar;E!==" "&&(b=!1),a.push(E)}return b?"":a.join("")},h.setPenStyles=function(a){this.currPenState.setStyles(a);var b=this.chars[this.pos];b.setPenState(this.currPenState)},f}(),s=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 a=0;a<B;a++)this.rows.push(new l(d));this.logger=d,this.currRow=B-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var h=f.prototype;return h.reset=function(){for(var a=0;a<B;a++)this.rows[a].clear();this.currRow=B-1},h.equals=function(a){for(var b=!0,g=0;g<B;g++)if(!this.rows[g].equals(a.rows[g])){b=!1;break}return b},h.copy=function(a){for(var b=0;b<B;b++)this.rows[b].copy(a.rows[b])},h.isEmpty=function(){for(var a=!0,b=0;b<B;b++)if(!this.rows[b].isEmpty()){a=!1;break}return a},h.backSpace=function(){var a=this.rows[this.currRow];a.backSpace()},h.clearToEndOfRow=function(){var a=this.rows[this.currRow];a.clearToEndOfRow()},h.insertChar=function(a){var b=this.rows[this.currRow];b.insertChar(a)},h.setPen=function(a){var b=this.rows[this.currRow];b.setPenStyles(a)},h.moveCursor=function(a){var b=this.rows[this.currRow];b.moveCursor(a)},h.setCursor=function(a){this.logger.log(C.INFO,"setCursor: "+a);var b=this.rows[this.currRow];b.setCursor(a)},h.setPAC=function(a){this.logger.log(C.INFO,"pacData = "+JSON.stringify(a));var b=a.row-1;if(this.nrRollUpRows&&b<this.nrRollUpRows-1&&(b=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==b){for(var g=0;g<B;g++)this.rows[g].clear();var E=this.currRow+1-this.nrRollUpRows,M=this.lastOutputScreen;if(M){var F=M.rows[E].cueStartTime,j=this.logger.time;if(F&&j!==null&&F<j)for(var W=0;W<this.nrRollUpRows;W++)this.rows[b-this.nrRollUpRows+W+1].copy(M.rows[E+W])}}this.currRow=b;var O=this.rows[this.currRow];if(a.indent!==null){var k=a.indent,K=Math.max(k-1,0);O.setCursor(a.indent),a.color=O.chars[K].penState.foreground}var Y={foreground:a.color,underline:a.underline,italics:a.italics,background:"black",flash:!1};this.setPen(Y)},h.setBkgData=function(a){this.logger.log(C.INFO,"bkgData = "+JSON.stringify(a)),this.backSpace(),this.setPen(a),this.insertChar(32)},h.setRollUpRows=function(a){this.nrRollUpRows=a},h.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(C.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(C.TEXT,this.getDisplayText());var a=this.currRow+1-this.nrRollUpRows,b=this.rows.splice(a,1)[0];b.clear(),this.rows.splice(this.currRow,0,b),this.logger.log(C.INFO,"Rolling up")},h.getDisplayText=function(a){a=a||!1;for(var b=[],g="",E=-1,M=0;M<B;M++){var F=this.rows[M].getTextString();F&&(E=M+1,a?b.push("Row "+E+": '"+F+"'"):b.push(F.trim()))}return b.length>0&&(a?g="["+b.join(" | ")+"]":g=b.join(`
`)),g},h.getTextAndFormat=function(){return this.rows},f}(),w=function(){function f(d,a,b){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=a,this.mode=null,this.verbose=0,this.displayedMemory=new s(b),this.nonDisplayedMemory=new s(b),this.lastOutputScreen=new s(b),this.currRollUpRow=this.displayedMemory.rows[B-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=b}var h=f.prototype;return h.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[B-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},h.getHandler=function(){return this.outputFilter},h.setHandler=function(a){this.outputFilter=a},h.setPAC=function(a){this.writeScreen.setPAC(a)},h.setBkgData=function(a){this.writeScreen.setBkgData(a)},h.setMode=function(a){if(a===this.mode)return;this.mode=a,this.logger.log(C.INFO,"MODE="+a),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=a},h.insertChars=function(a){for(var b=0;b<a.length;b++)this.writeScreen.insertChar(a[b]);var g=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(C.INFO,g+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(C.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},h.ccRCL=function(){this.logger.log(C.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},h.ccBS=function(){if(this.logger.log(C.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},h.ccAOF=function(){},h.ccAON=function(){},h.ccDER=function(){this.logger.log(C.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},h.ccRU=function(a){this.logger.log(C.INFO,"RU("+a+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(a)},h.ccFON=function(){this.logger.log(C.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},h.ccRDC=function(){this.logger.log(C.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},h.ccTR=function(){this.logger.log(C.INFO,"TR"),this.setMode("MODE_TEXT")},h.ccRTD=function(){this.logger.log(C.INFO,"RTD"),this.setMode("MODE_TEXT")},h.ccEDM=function(){this.logger.log(C.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},h.ccCR=function(){this.logger.log(C.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},h.ccENM=function(){this.logger.log(C.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},h.ccEOC=function(){if(this.logger.log(C.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var a=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=a,this.writeScreen=this.nonDisplayedMemory,this.logger.log(C.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},h.ccTO=function(a){this.logger.log(C.INFO,"TO("+a+") - Tab Offset"),this.writeScreen.moveCursor(a)},h.ccMIDROW=function(a){var b={flash:!1};if(b.underline=a%2===1,b.italics=a>=46,b.italics)b.foreground="white";else{var g=Math.floor(a/2)-16,E=["white","green","blue","cyan","red","yellow","magenta"];b.foreground=E[g]}this.logger.log(C.INFO,"MIDROW: "+JSON.stringify(b)),this.writeScreen.setPen(b)},h.outputDataUpdate=function(a){a===void 0&&(a=!1);var b=this.logger.time;if(b===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=b:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,b,this.lastOutputScreen),a&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:b),this.lastOutputScreen.copy(this.displayedMemory))},h.cueSplitAtTime=function(a){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,a,this.displayedMemory),this.cueStartTime=a))},f}(),p=function(){function f(d,a,b){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var g=new T;this.channels=[null,new w(d,a,g),new w(d+1,b,g)],this.cmdHistory=y(),this.logger=g}var h=f.prototype;return h.getHandler=function(a){return this.channels[a].getHandler()},h.setHandler=function(a,b){this.channels[a].setHandler(b)},h.addData=function(a,b){var g,E,M,F=!1;this.logger.time=a;for(var j=0;j<b.length;j+=2){if(E=b[j]&127,M=b[j+1]&127,E===0&&M===0)continue;if(this.logger.log(C.DATA,"["+m([b[j],b[j+1]])+"] -> ("+m([E,M])+")"),g=this.parseCmd(E,M),g||(g=this.parseMidrow(E,M)),g||(g=this.parsePAC(E,M)),g||(g=this.parseBackgroundAttributes(E,M)),!g&&(F=this.parseChars(E,M),F)){var W=this.currentChannel;if(W&&W>0){var O=this.channels[W];O.insertChars(F)}else this.logger.log(C.WARNING,"No channel found yet. TEXT-MODE?")}!g&&!F&&this.logger.log(C.WARNING,"Couldn't parse cleaned data "+m([E,M])+" orig: "+m([b[j],b[j+1]]))}},h.parseCmd=function(a,b){var g=this.cmdHistory,E=(a===20||a===28||a===21||a===29)&&b>=32&&b<=47,M=(a===23||a===31)&&b>=33&&b<=35;if(!(E||M))return!1;if(A(a,b,g))return c(null,null,g),this.logger.log(C.DEBUG,"Repeated command ("+m([a,b])+") is dropped"),!0;var F=a===20||a===21||a===23?1:2,j=this.channels[F];return a===20||a===21||a===28||a===29?b===32?j.ccRCL():b===33?j.ccBS():b===34?j.ccAOF():b===35?j.ccAON():b===36?j.ccDER():b===37?j.ccRU(2):b===38?j.ccRU(3):b===39?j.ccRU(4):b===40?j.ccFON():b===41?j.ccRDC():b===42?j.ccTR():b===43?j.ccRTD():b===44?j.ccEDM():b===45?j.ccCR():b===46?j.ccENM():b===47&&j.ccEOC():j.ccTO(b-32),c(a,b,g),this.currentChannel=F,!0},h.parseMidrow=function(a,b){var g=0;if((a===17||a===25)&&b>=32&&b<=47){if(a===17?g=1:g=2,g!==this.currentChannel)return this.logger.log(C.ERROR,"Mismatch channel in midrow parsing"),!1;var E=this.channels[g];return E?(E.ccMIDROW(b),this.logger.log(C.DEBUG,"MIDROW ("+m([a,b])+")"),!0):!1}return!1},h.parsePAC=function(a,b){var g,E=this.cmdHistory,M=(a>=17&&a<=23||a>=25&&a<=31)&&b>=64&&b<=127,F=(a===16||a===24)&&b>=64&&b<=95;if(!(M||F))return!1;if(A(a,b,E))return c(null,null,E),!0;var j=a<=23?1:2;b>=64&&b<=95?g=j===1?P[a]:v[a]:g=j===1?D[a]:S[a];var W=this.channels[j];return W?(W.setPAC(this.interpretPAC(g,b)),c(a,b,E),this.currentChannel=j,!0):!1},h.interpretPAC=function(a,b){var g,E={color:null,italics:!1,indent:null,underline:!1,row:a};return b>95?g=b-96:g=b-64,E.underline=(g&1)===1,g<=13?E.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(g/2)]:g<=15?(E.italics=!0,E.color="white"):E.indent=Math.floor((g-16)/2)*4,E},h.parseChars=function(a,b){var g,E=null,M=null;if(a>=25?(g=2,M=a-8):(g=1,M=a),M>=17&&M<=19){var F;M===17?F=b+80:M===18?F=b+112:F=b+144,this.logger.log(C.INFO,"Special char '"+R(F)+"' in channel "+g),E=[F]}else a>=32&&a<=127&&(E=b===0?[a]:[a,b]);if(E){var j=m(E);this.logger.log(C.DEBUG,"Char codes = "+j.join(",")),c(a,b,this.cmdHistory)}return E},h.parseBackgroundAttributes=function(a,b){var g=(a===16||a===24)&&b>=32&&b<=47,E=(a===23||a===31)&&b>=45&&b<=47;if(!(g||E))return!1;var M,F={};a===16||a===24?(M=Math.floor((b-32)/2),F.background=_[M],b%2===1&&(F.background=F.background+"_semi")):b===45?F.background="transparent":(F.foreground="black",b===47&&(F.underline=!0));var j=a<=23?1:2,W=this.channels[j];return W.setBkgData(F),c(a,b,this.cmdHistory),!0},h.reset=function(){for(var a=0;a<Object.keys(this.channels).length;a++){var b=this.channels[a];b&&b.reset()}this.cmdHistory=y()},h.cueSplitAtTime=function(a){for(var b=0;b<this.channels.length;b++){var g=this.channels[b];g&&g.cueSplitAtTime(a)}},f}();function c(f,h,d){d.a=f,d.b=h}function A(f,h,d){return d.a===f&&d.b===h}function y(){return{a:null,b:null}}X.default=p},"./src/utils/codecs.ts":function(re,X,L){"use strict";L.r(X),L.d(X,"isCodecType",function(){return I}),L.d(X,"isCodecSupportedInMp4",function(){return R});var z={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 I(B,U){var P=z[U];return!!P&&P[B.slice(0,4)]===!0}function R(B,U){return MediaSource.isTypeSupported((U||"video")+'/mp4;codecs="'+B+'"')}},"./src/utils/cues.ts":function(re,X,L){"use strict";L.r(X);var z=L("./src/utils/vttparser.ts"),I=L("./src/utils/webvtt-parser.ts"),R=L("./src/utils/texttrack-utils.ts"),B=/\s/,U={newCue:function(D,v,S,_){for(var C=[],T,m,u,o,l,s=self.VTTCue||self.TextTrackCue,w=0;w<_.rows.length;w++)if(T=_.rows[w],u=!0,o=0,l="",!T.isEmpty()){for(var p=0;p<T.chars.length;p++)B.test(T.chars[p].uchar)&&u?o++:(l+=T.chars[p].uchar,u=!1);T.cueStartTime=v,v===S&&(S+=1e-4),o>=16?o--:o++;var c=Object(z.fixLineBreaks)(l.trim()),A=Object(I.generateCueId)(v,S,c);(!D||!D.cues||!D.cues.getCueById(A))&&(m=new s(v,S,c),m.id=A,m.line=w+1,m.align="left",m.position=10+Math.min(80,Math.floor(o*8/32)*10),C.push(m))}return D&&C.length&&(C.sort(function(y,f){return y.line==="auto"||f.line==="auto"?0:y.line>8&&f.line>8?f.line-y.line:y.line-f.line}),C.forEach(function(y){return Object(R.addCueToTrack)(D,y)})),C}};X.default=U},"./src/utils/discontinuities.ts":function(re,X,L){"use strict";L.r(X),L.d(X,"findFirstFragWithCC",function(){return B}),L.d(X,"shouldAlignOnDiscontinuities",function(){return U}),L.d(X,"findDiscontinuousReferenceFrag",function(){return P}),L.d(X,"adjustSlidingStart",function(){return v}),L.d(X,"alignStream",function(){return S}),L.d(X,"alignPDT",function(){return C}),L.d(X,"alignFragmentByPDTDelta",function(){return T}),L.d(X,"alignMediaPlaylistByPDT",function(){return m});var z=L("./src/polyfills/number.ts"),I=L("./src/utils/logger.ts"),R=L("./src/controller/level-helper.ts");function B(u,o){for(var l=null,s=0,w=u.length;s<w;s++){var p=u[s];if(p&&p.cc===o){l=p;break}}return l}function U(u,o,l){return!!(o.details&&(l.endCC>l.startCC||u&&u.cc<l.startCC))}function P(u,o){var l=u.fragments,s=o.fragments;if(!s.length||!l.length){I.logger.log("No fragments to align");return}var w=B(l,s[0].cc);if(!w||w&&!w.startPTS){I.logger.log("No frag in previous level to align on");return}return w}function D(u,o){if(u){var l=u.start+o;u.start=u.startPTS=l,u.endPTS=l+u.duration}}function v(u,o){for(var l=o.fragments,s=0,w=l.length;s<w;s++)D(l[s],u);o.fragmentHint&&D(o.fragmentHint,u),o.alignedSliding=!0}function S(u,o,l){if(!o)return;_(u,l,o),!l.alignedSliding&&o.details&&C(l,o.details),!l.alignedSliding&&o.details&&!l.skippedSegments&&Object(R.adjustSliding)(o.details,l)}function _(u,o,l){if(U(u,l,o)){var s=P(l.details,o);s&&Object(z.isFiniteNumber)(s.start)&&(I.logger.log("Adjusting PTS using last level due to CC increase within current level "+o.url),v(s.start,o))}}function C(u,o){if(!o.fragments.length||!u.hasProgramDateTime||!o.hasProgramDateTime)return;var l=o.fragments[0].programDateTime,s=u.fragments[0].programDateTime,w=(s-l)/1e3+o.fragments[0].start;w&&Object(z.isFiniteNumber)(w)&&(I.logger.log("Adjusting PTS using programDateTime delta "+(s-l)+"ms, sliding:"+w.toFixed(3)+" "+u.url+" "),v(w,u))}function T(u,o){var l=u.programDateTime;if(!l)return;var s=(l-o)/1e3;u.start=u.startPTS=s,u.endPTS=s+u.duration}function m(u,o){if(!o.fragments.length||!u.hasProgramDateTime||!o.hasProgramDateTime)return;var l=o.fragments[0].programDateTime,s=o.fragments[0].start,w=l-s*1e3;u.fragments.forEach(function(p){T(p,w)}),u.fragmentHint&&T(u.fragmentHint,w),u.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(re,X,L){"use strict";L.r(X);var z=L("./src/utils/ewma.ts"),I=function(){function R(U,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 z.default(U),this.fast_=new z.default(P)}var B=R.prototype;return B.update=function(P,D){var v=this.slow_,S=this.fast_;this.slow_.halfLife!==P&&(this.slow_=new z.default(P,v.getEstimate(),v.getTotalWeight())),this.fast_.halfLife!==D&&(this.fast_=new z.default(D,S.getEstimate(),S.getTotalWeight()))},B.sample=function(P,D){P=Math.max(P,this.minDelayMs_);var v=8*D,S=P/1e3,_=v/S;this.fast_.sample(S,_),this.slow_.sample(S,_)},B.canEstimate=function(){var P=this.fast_;return P&&P.getTotalWeight()>=this.minWeight_},B.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},B.destroy=function(){},R}();X.default=I},"./src/utils/ewma.ts":function(re,X,L){"use strict";L.r(X);var z=function(){function I(B,U,P){U===void 0&&(U=0),P===void 0&&(P=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=B,this.alpha_=B?Math.exp(Math.log(.5)/B):0,this.estimate_=U,this.totalWeight_=P}var R=I.prototype;return R.sample=function(U,P){var D=Math.pow(this.alpha_,U);this.estimate_=P*(1-D)+D*this.estimate_,this.totalWeight_+=U},R.getTotalWeight=function(){return this.totalWeight_},R.getEstimate=function(){if(this.alpha_){var U=1-Math.pow(this.alpha_,this.totalWeight_);if(U)return this.estimate_/U}return this.estimate_},I}();X.default=z},"./src/utils/fetch-loader.ts":function(re,X,L){"use strict";L.r(X),L.d(X,"fetchSupported",function(){return T});var z=L("./src/polyfills/number.ts"),I=L("./src/loader/load-stats.ts"),R=L("./src/demux/chunk-cache.ts");function B(s,w){s.prototype=Object.create(w.prototype),s.prototype.constructor=s,S(s,w)}function U(s){var w=typeof Map=="function"?new Map:void 0;return U=function(c){if(c===null||!v(c))return c;if(typeof c!="function")throw new TypeError("Super expression must either be null or a function");if(typeof w!="undefined"){if(w.has(c))return w.get(c);w.set(c,A)}function A(){return P(c,arguments,_(this).constructor)}return A.prototype=Object.create(c.prototype,{constructor:{value:A,enumerable:!1,writable:!0,configurable:!0}}),S(A,c)},U(s)}function P(s,w,p){return D()?P=Reflect.construct:P=function(A,y,f){var h=[null];h.push.apply(h,y);var d=Function.bind.apply(A,h),a=new d;return f&&S(a,f.prototype),a},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(s){return!1}}function v(s){return Function.toString.call(s).indexOf("[native code]")!==-1}function S(s,w){return S=Object.setPrototypeOf||function(c,A){return c.__proto__=A,c},S(s,w)}function _(s){return _=Object.setPrototypeOf?Object.getPrototypeOf:function(p){return p.__proto__||Object.getPrototypeOf(p)},_(s)}function C(){return C=Object.assign||function(s){for(var w=1;w<arguments.length;w++){var p=arguments[w];for(var c in p)Object.prototype.hasOwnProperty.call(p,c)&&(s[c]=p[c])}return s},C.apply(this,arguments)}function T(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(s){}return!1}var m=function(){function s(p){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=p.fetchSetup||o,this.controller=new self.AbortController,this.stats=new I.LoadStats}var w=s.prototype;return w.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},w.abortInternal=function(){var c=this.response;(!c||!c.ok)&&(this.stats.aborted=!0,this.controller.abort())},w.abort=function(){var c;this.abortInternal(),(c=this.callbacks)!==null&&c!==void 0&&c.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},w.load=function(c,A,y){var f=this,h=this.stats;if(h.loading.start)throw new Error("Loader can only be used once.");h.loading.start=self.performance.now();var d=u(c,this.controller.signal),a=y.onProgress,b=c.responseType==="arraybuffer",g=b?"byteLength":"length";this.context=c,this.config=A,this.callbacks=y,this.request=this.fetchSetup(c,d),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){f.abortInternal(),y.onTimeout(h,c,f.response)},A.timeout),self.fetch(this.request).then(function(E){if(f.response=f.loader=E,!E.ok){var M=E.status,F=E.statusText;throw new l(F||"fetch, bad network response",M,E)}return h.loading.first=Math.max(self.performance.now(),h.loading.start),h.total=parseInt(E.headers.get("Content-Length")||"0"),a&&Object(z.isFiniteNumber)(A.highWaterMark)?f.loadProgressively(E,h,c,A.highWaterMark,a):b?E.arrayBuffer():E.text()}).then(function(E){var M=f.response;self.clearTimeout(f.requestTimeout),h.loading.end=Math.max(self.performance.now(),h.loading.first),h.loaded=h.total=E[g];var F={url:M.url,data:E};a&&!Object(z.isFiniteNumber)(A.highWaterMark)&&a(h,c,E,M),y.onSuccess(F,h,c,M)}).catch(function(E){if(self.clearTimeout(f.requestTimeout),h.aborted)return;var M=E.code||0;y.onError({code:M,text:E.message},c,E.details)})},w.getCacheAge=function(){var c=null;if(this.response){var A=this.response.headers.get("age");c=A?parseFloat(A):null}return c},w.loadProgressively=function(c,A,y,f,h){f===void 0&&(f=0);var d=new R.default,a=c.body.getReader(),b=function g(){return a.read().then(function(E){if(E.done)return d.dataLength&&h(A,y,d.flush(),c),Promise.resolve(new ArrayBuffer(0));var M=E.value,F=M.length;return A.loaded+=F,F<f||d.dataLength?(d.push(M),d.dataLength>=f&&h(A,y,d.flush(),c)):h(A,y,M,c),g()}).catch(function(){return Promise.reject()})};return b()},s}();function u(s,w){var p={method:"GET",mode:"cors",credentials:"same-origin",signal:w,headers:new self.Headers(C({},s.headers))};return s.rangeEnd&&p.headers.set("Range","bytes="+s.rangeStart+"-"+String(s.rangeEnd-1)),p}function o(s,w){return new self.Request(s.url,w)}var l=function(s){B(w,s);function w(p,c,A){var y;return y=s.call(this,p)||this,y.code=void 0,y.details=void 0,y.code=c,y.details=A,y}return w}(U(Error));X.default=m},"./src/utils/imsc1-ttml-parser.ts":function(re,X,L){"use strict";L.r(X),L.d(X,"IMSC1_CODEC",function(){return v}),L.d(X,"parseIMSC1",function(){return T});var z=L("./src/utils/mp4-tools.ts"),I=L("./src/utils/vttparser.ts"),R=L("./src/utils/vttcue.ts"),B=L("./src/demux/id3.ts"),U=L("./src/utils/timescale-conversion.ts"),P=L("./src/utils/webvtt-parser.ts");function D(){return D=Object.assign||function(f){for(var h=1;h<arguments.length;h++){var d=arguments[h];for(var a in d)Object.prototype.hasOwnProperty.call(d,a)&&(f[a]=d[a])}return f},D.apply(this,arguments)}var v="stpp.ttml.im1t",S=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,_=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,C={left:"start",center:"center",right:"end",start:"start",end:"end"};function T(f,h,d,a,b){var g=Object(z.findBox)(new Uint8Array(f),["mdat"]);if(g.length===0){b(new Error("Could not parse IMSC1 mdat"));return}var E=g[0],M=Object(B.utf8ArrayToStr)(new Uint8Array(f,E.start,E.end-E.start)),F=Object(U.toTimescaleFromScale)(h,1,d);try{a(m(M,F))}catch(j){b(j)}}function m(f,h){var d=new DOMParser,a=d.parseFromString(f,"text/xml"),b=a.getElementsByTagName("tt")[0];if(!b)throw new Error("Invalid ttml");var g={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},E=Object.keys(g).reduce(function(O,k){return O[k]=b.getAttribute("ttp:"+k)||g[k],O},{}),M=b.getAttribute("xml:space")!=="preserve",F=o(u(b,"styling","style")),j=o(u(b,"layout","region")),W=u(b,"body","[begin]");return[].map.call(W,function(O){var k=l(O,M);if(!k||!O.hasAttribute("begin"))return null;var K=c(O.getAttribute("begin"),E),Y=c(O.getAttribute("dur"),E),q=c(O.getAttribute("end"),E);if(K===null)throw p(O);if(q===null){if(Y===null)throw p(O);q=K+Y}var oe=new R.default(K-h,q-h,k);oe.id=Object(P.generateCueId)(oe.startTime,oe.endTime,oe.text);var Te=j[O.getAttribute("region")],ve=F[O.getAttribute("style")];oe.position=10,oe.size=80;var ge=s(Te,ve),me=ge.textAlign;if(me){var le=C[me];le&&(oe.lineAlign=le),oe.align=me}return D(oe,ge),oe}).filter(function(O){return O!==null})}function u(f,h,d){var a=f.getElementsByTagName(h)[0];return a?[].slice.call(a.querySelectorAll(d)):[]}function o(f){return f.reduce(function(h,d){var a=d.getAttribute("xml:id");return a&&(h[a]=d),h},{})}function l(f,h){return[].slice.call(f.childNodes).reduce(function(d,a,b){var g;return a.nodeName==="br"&&b?d+`
`:(g=a.childNodes)!==null&&g!==void 0&&g.length?l(a,h):h?d+a.textContent.trim().replace(/\s+/g," "):d+a.textContent},"")}function s(f,h){var d="http://www.w3.org/ns/ttml#styling",a=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return a.reduce(function(b,g){var E=w(h,d,g)||w(f,d,g);return E&&(b[g]=E),b},{})}function w(f,h,d){return f.hasAttributeNS(h,d)?f.getAttributeNS(h,d):null}function p(f){return new Error("Could not parse ttml timestamp "+f)}function c(f,h){if(!f)return null;var d=Object(I.parseTimeStamp)(f);return d===null&&(S.test(f)?d=A(f,h):_.test(f)&&(d=y(f,h))),d}function A(f,h){var d=S.exec(f),a=(d[4]|0)+(d[5]|0)/h.subFrameRate;return(d[1]|0)*3600+(d[2]|0)*60+(d[3]|0)+a/h.frameRate}function y(f,h){var d=_.exec(f),a=Number(d[1]),b=d[2];switch(b){case"h":return a*3600;case"m":return a*60;case"ms":return a*1e3;case"f":return a/h.frameRate;case"t":return a/h.tickRate}return a}},"./src/utils/logger.ts":function(re,X,L){"use strict";L.r(X),L.d(X,"enableLogs",function(){return P}),L.d(X,"logger",function(){return D});var z=function(){},I={trace:z,debug:z,log:z,warn:z,info:z,error:z},R=I;function B(v){var S=self.console[v];return S?S.bind(self.console,"["+v+"] >"):z}function U(v){for(var S=arguments.length,_=new Array(S>1?S-1:0),C=1;C<S;C++)_[C-1]=arguments[C];_.forEach(function(T){R[T]=v[T]?v[T].bind(v):B(T)})}function P(v){if(self.console&&v===!0||typeof v=="object"){U(v,"debug","log","info","warn","error");try{R.log()}catch(S){R=I}}else R=I}var D=R},"./src/utils/mediakeys-helper.ts":function(re,X,L){"use strict";L.r(X),L.d(X,"KeySystems",function(){return z}),L.d(X,"requestMediaKeySystemAccess",function(){return I});var z;(function(R){R.WIDEVINE="com.widevine.alpha",R.PLAYREADY="com.microsoft.playready"})(z||(z={}));var I=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(re,X,L){"use strict";L.r(X),L.d(X,"getMediaSource",function(){return z});function z(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(re,X,L){"use strict";L.r(X),L.d(X,"bin2str",function(){return U}),L.d(X,"readUint16",function(){return P}),L.d(X,"readUint32",function(){return D}),L.d(X,"writeUint32",function(){return v}),L.d(X,"findBox",function(){return S}),L.d(X,"parseSegmentIndex",function(){return _}),L.d(X,"parseInitSegment",function(){return C}),L.d(X,"getStartDTS",function(){return T}),L.d(X,"getDuration",function(){return m}),L.d(X,"computeRawDurationFromSamples",function(){return u}),L.d(X,"offsetStartDTS",function(){return o}),L.d(X,"segmentValidRange",function(){return l}),L.d(X,"appendUint8Array",function(){return s});var z=L("./src/utils/typed-array.ts"),I=L("./src/loader/fragment.ts"),R=Math.pow(2,32)-1,B=[].push;function U(w){return String.fromCharCode.apply(null,w)}function P(w,p){"data"in w&&(p+=w.start,w=w.data);var c=w[p]<<8|w[p+1];return c<0?65536+c:c}function D(w,p){"data"in w&&(p+=w.start,w=w.data);var c=w[p]<<24|w[p+1]<<16|w[p+2]<<8|w[p+3];return c<0?4294967296+c:c}function v(w,p,c){"data"in w&&(p+=w.start,w=w.data),w[p]=c>>24,w[p+1]=c>>16&255,w[p+2]=c>>8&255,w[p+3]=c&255}function S(w,p){var c=[];if(!p.length)return c;var A,y,f;"data"in w?(A=w.data,y=w.start,f=w.end):(A=w,y=0,f=A.byteLength);for(var h=y;h<f;){var d=D(A,h),a=U(A.subarray(h+4,h+8)),b=d>1?h+d:f;if(a===p[0])if(p.length===1)c.push({data:A,start:h+8,end:b});else{var g=S({data:A,start:h+8,end:b},p.slice(1));g.length&&B.apply(c,g)}h=b}return c}function _(w){var p=S(w,["moov"]),c=p[0],A=c?c.end:null,y=S(w,["sidx"]);if(!y||!y[0])return null;var f=[],h=y[0],d=h.data[0],a=d===0?8:16,b=D(h,a);a+=4;var g=0,E=0;d===0?a+=8:a+=16,a+=2;var M=h.end+E,F=P(h,a);a+=2;for(var j=0;j<F;j++){var W=a,O=D(h,W);W+=4;var k=O&2147483647,K=(O&2147483648)>>>31;if(K===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var Y=D(h,W);W+=4,f.push({referenceSize:k,subsegmentDuration:Y,info:{duration:Y/b,start:M,end:M+k-1}}),M+=k,W+=4,a=W}return{earliestPresentationTime:g,timescale:b,version:d,referencesCount:F,references:f,moovEndOffset:A}}function C(w){for(var p=[],c=S(w,["moov","trak"]),A=0;A<c.length;A++){var y=c[A],f=S(y,["tkhd"])[0];if(f){var h=f.data[f.start],d=h===0?12:20,a=D(f,d),b=S(y,["mdia","mdhd"])[0];if(b){h=b.data[b.start],d=h===0?12:20;var g=D(b,d),E=S(y,["mdia","hdlr"])[0];if(E){var M=U(E.data.subarray(E.start+8,E.start+12)),F={soun:I.ElementaryStreamTypes.AUDIO,vide:I.ElementaryStreamTypes.VIDEO}[M];if(F){var j=S(y,["mdia","minf","stbl","stsd"])[0],W=void 0;j&&(W=U(j.data.subarray(j.start+12,j.start+16))),p[a]={timescale:g,type:F},p[F]={timescale:g,id:a,codec:W}}}}}}var O=S(w,["moov","mvex","trex"]);return O.forEach(function(k){var K=D(k,4),Y=p[K];Y&&(Y.default={duration:D(k,12),flags:D(k,20)})}),p}function T(w,p){return S(p,["moof","traf"]).reduce(function(c,A){var y=S(A,["tfdt"])[0],f=y.data[y.start],h=S(A,["tfhd"]).reduce(function(d,a){var b=D(a,4),g=w[b];if(g){var E=D(y,4);f===1&&(E*=Math.pow(2,32),E+=D(y,8));var M=g.timescale||9e4,F=E/M;if(isFinite(F)&&(d===null||F<d))return F}return d},null);return h!==null&&isFinite(h)&&(c===null||h<c)?h:c},null)||0}function m(w,p){for(var c=0,A=0,y=0,f=S(w,["moof","traf"]),h=0;h<f.length;h++){var d=f[h],a=S(d,["tfhd"])[0],b=D(a,4),g=p[b];if(!g)continue;var E=g.default,M=D(a,0)|(E==null?void 0:E.flags),F=E==null?void 0:E.duration;M&8&&(M&2?F=D(a,12):F=D(a,8));for(var j=g.timescale||9e4,W=S(d,["trun"]),O=0;O<W.length;O++){if(F){var k=D(W[O],4);c=F*k}else c=u(W[O]);g.type===I.ElementaryStreamTypes.VIDEO?A+=c/j:g.type===I.ElementaryStreamTypes.AUDIO&&(y+=c/j)}}if(A===0&&y===0){var K=_(w);if(K!=null&&K.references)return K.references.reduce(function(Y,q){return Y+q.info.duration||0},0)}return A||y}function u(w){var p=D(w,0),c=8;p&1&&(c+=4),p&4&&(c+=4);for(var A=0,y=D(w,4),f=0;f<y;f++){if(p&256){var h=D(w,c);A+=h,c+=4}p&512&&(c+=4),p&1024&&(c+=4),p&2048&&(c+=4)}return A}function o(w,p,c){S(p,["moof","traf"]).forEach(function(A){S(A,["tfhd"]).forEach(function(y){var f=D(y,4),h=w[f];if(!h)return;var d=h.timescale||9e4;S(A,["tfdt"]).forEach(function(a){var b=a.data[a.start],g=D(a,4);if(b===0)v(a,4,g-c*d);else{g*=Math.pow(2,32),g+=D(a,8),g-=c*d,g=Math.max(g,0);var E=Math.floor(g/(R+1)),M=Math.floor(g%(R+1));v(a,4,E),v(a,8,M)}})})})}function l(w){var p={valid:null,remainder:null},c=S(w,["moof"]);if(c){if(c.length<2)return p.remainder=w,p}else return p;var A=c[c.length-1];return p.valid=Object(z.sliceUint8)(w,0,A.start-8),p.remainder=Object(z.sliceUint8)(w,A.start-8),p}function s(w,p){var c=new Uint8Array(w.length+p.length);return c.set(w),c.set(p,w.length),c}},"./src/utils/output-filter.ts":function(re,X,L){"use strict";L.r(X),L.d(X,"default",function(){return z});var z=function(){function I(B,U){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=B,this.trackName=U}var R=I.prototype;return R.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},R.newCue=function(U,P,D){(this.startTime===null||this.startTime>U)&&(this.startTime=U),this.endTime=P,this.screen=D,this.timelineController.createCaptionsTrack(this.trackName)},R.reset=function(){this.cueRanges=[]},I}()},"./src/utils/texttrack-utils.ts":function(re,X,L){"use strict";L.r(X),L.d(X,"sendAddTrackEvent",function(){return I}),L.d(X,"addCueToTrack",function(){return R}),L.d(X,"clearCurrentCues",function(){return B}),L.d(X,"removeCuesInRange",function(){return U}),L.d(X,"getCuesInRange",function(){return D});var z=L("./src/utils/logger.ts");function I(v,S){var _;try{_=new Event("addtrack")}catch(C){_=document.createEvent("Event"),_.initEvent("addtrack",!1,!1)}_.track=v,S.dispatchEvent(_)}function R(v,S){var _=v.mode;if(_==="disabled"&&(v.mode="hidden"),v.cues&&!v.cues.getCueById(S.id))try{if(v.addCue(S),!v.cues.getCueById(S.id))throw new Error("addCue is failed for: "+S)}catch(T){z.logger.debug("[texttrack-utils]: "+T);var C=new self.TextTrackCue(S.startTime,S.endTime,S.text);C.id=S.id,v.addCue(C)}_==="disabled"&&(v.mode=_)}function B(v){var S=v.mode;if(S==="disabled"&&(v.mode="hidden"),v.cues)for(var _=v.cues.length;_--;)v.removeCue(v.cues[_]);S==="disabled"&&(v.mode=S)}function U(v,S,_){var C=v.mode;if(C==="disabled"&&(v.mode="hidden"),v.cues&&v.cues.length>0)for(var T=D(v.cues,S,_),m=0;m<T.length;m++)v.removeCue(T[m]);C==="disabled"&&(v.mode=C)}function P(v,S){if(S<v[0].startTime)return 0;var _=v.length-1;if(S>v[_].endTime)return-1;for(var C=0,T=_;C<=T;){var m=Math.floor((T+C)/2);if(S<v[m].startTime)T=m-1;else if(S>v[m].startTime&&C<_)C=m+1;else return m}return v[C].startTime-S<S-v[T].startTime?C:T}function D(v,S,_){var C=[],T=P(v,S);if(T>-1)for(var m=T,u=v.length;m<u;m++){var o=v[m];if(o.startTime>=S&&o.endTime<=_)C.push(o);else if(o.startTime>_)return C}return C}},"./src/utils/time-ranges.ts":function(re,X,L){"use strict";L.r(X);var z={toString:function(R){for(var B="",U=R.length,P=0;P<U;P++)B+="["+R.start(P).toFixed(3)+","+R.end(P).toFixed(3)+"]";return B}};X.default=z},"./src/utils/timescale-conversion.ts":function(re,X,L){"use strict";L.r(X),L.d(X,"toTimescaleFromBase",function(){return I}),L.d(X,"toTimescaleFromScale",function(){return R}),L.d(X,"toMsFromMpegTsClock",function(){return B}),L.d(X,"toMpegTsClockFromTimescale",function(){return U});var z=9e4;function I(P,D,v,S){v===void 0&&(v=1),S===void 0&&(S=!1);var _=P*D*v;return S?Math.round(_):_}function R(P,D,v,S){return v===void 0&&(v=1),S===void 0&&(S=!1),I(P,D,1/v,S)}function B(P,D){return D===void 0&&(D=!1),I(P,1e3,1/z,D)}function U(P,D){return D===void 0&&(D=1),I(P,z,1/D)}},"./src/utils/typed-array.ts":function(re,X,L){"use strict";L.r(X),L.d(X,"sliceUint8",function(){return z});function z(I,R,B){return Uint8Array.prototype.slice?I.slice(R,B):new Uint8Array(Array.prototype.slice.call(I,R,B))}},"./src/utils/vttcue.ts":function(re,X,L){"use strict";L.r(X),X.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var z=["","lr","rl"],I=["start","middle","end","left","right"];function R(v,S){if(typeof S!="string")return!1;if(!Array.isArray(v))return!1;var _=S.toLowerCase();return~v.indexOf(_)?_:!1}function B(v){return R(z,v)}function U(v){return R(I,v)}function P(v){for(var S=arguments.length,_=new Array(S>1?S-1:0),C=1;C<S;C++)_[C-1]=arguments[C];for(var T=1;T<arguments.length;T++){var m=arguments[T];for(var u in m)v[u]=m[u]}return v}function D(v,S,_){var C=this,T={enumerable:!0};C.hasBeenReset=!1;var m="",u=!1,o=v,l=S,s=_,w=null,p="",c=!0,A="auto",y="start",f=50,h="middle",d=50,a="middle";Object.defineProperty(C,"id",P({},T,{get:function(){return m},set:function(g){m=""+g}})),Object.defineProperty(C,"pauseOnExit",P({},T,{get:function(){return u},set:function(g){u=!!g}})),Object.defineProperty(C,"startTime",P({},T,{get:function(){return o},set:function(g){if(typeof g!="number")throw new TypeError("Start time must be set to a number.");o=g,this.hasBeenReset=!0}})),Object.defineProperty(C,"endTime",P({},T,{get:function(){return l},set:function(g){if(typeof g!="number")throw new TypeError("End time must be set to a number.");l=g,this.hasBeenReset=!0}})),Object.defineProperty(C,"text",P({},T,{get:function(){return s},set:function(g){s=""+g,this.hasBeenReset=!0}})),Object.defineProperty(C,"region",P({},T,{get:function(){return w},set:function(g){w=g,this.hasBeenReset=!0}})),Object.defineProperty(C,"vertical",P({},T,{get:function(){return p},set:function(g){var E=B(g);if(E===!1)throw new SyntaxError("An invalid or illegal string was specified.");p=E,this.hasBeenReset=!0}})),Object.defineProperty(C,"snapToLines",P({},T,{get:function(){return c},set:function(g){c=!!g,this.hasBeenReset=!0}})),Object.defineProperty(C,"line",P({},T,{get:function(){return A},set:function(g){if(typeof g!="number"&&g!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");A=g,this.hasBeenReset=!0}})),Object.defineProperty(C,"lineAlign",P({},T,{get:function(){return y},set:function(g){var E=U(g);if(!E)throw new SyntaxError("An invalid or illegal string was specified.");y=E,this.hasBeenReset=!0}})),Object.defineProperty(C,"position",P({},T,{get:function(){return f},set:function(g){if(g<0||g>100)throw new Error("Position must be between 0 and 100.");f=g,this.hasBeenReset=!0}})),Object.defineProperty(C,"positionAlign",P({},T,{get:function(){return h},set:function(g){var E=U(g);if(!E)throw new SyntaxError("An invalid or illegal string was specified.");h=E,this.hasBeenReset=!0}})),Object.defineProperty(C,"size",P({},T,{get:function(){return d},set:function(g){if(g<0||g>100)throw new Error("Size must be between 0 and 100.");d=g,this.hasBeenReset=!0}})),Object.defineProperty(C,"align",P({},T,{get:function(){return a},set:function(g){var E=U(g);if(!E)throw new SyntaxError("An invalid or illegal string was specified.");a=E,this.hasBeenReset=!0}})),C.displayState=void 0}return D.prototype.getCueAsHTML=function(){var v=self.WebVTT;return v.convertCueToDOMTree(self,this.text)},D}()},"./src/utils/vttparser.ts":function(re,X,L){"use strict";L.r(X),L.d(X,"parseTimeStamp",function(){return R}),L.d(X,"fixLineBreaks",function(){return S}),L.d(X,"VTTParser",function(){return _});var z=L("./src/utils/vttcue.ts"),I=function(){function C(){}var T=C.prototype;return T.decode=function(u,o){if(!u)return"";if(typeof u!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(u))},C}();function R(C){function T(u,o,l,s){return(u|0)*3600+(o|0)*60+(l|0)+parseFloat(s||0)}var m=C.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return m?parseFloat(m[2])>59?T(m[2],m[3],0,m[4]):T(m[1],m[2],m[3],m[4]):null}var B=function(){function C(){this.values=Object.create(null)}var T=C.prototype;return T.set=function(u,o){!this.get(u)&&o!==""&&(this.values[u]=o)},T.get=function(u,o,l){return l?this.has(u)?this.values[u]:o[l]:this.has(u)?this.values[u]:o},T.has=function(u){return u in this.values},T.alt=function(u,o,l){for(var s=0;s<l.length;++s)if(o===l[s]){this.set(u,o);break}},T.integer=function(u,o){/^-?\d+$/.test(o)&&this.set(u,parseInt(o,10))},T.percent=function(u,o){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(o)){var l=parseFloat(o);if(l>=0&&l<=100)return this.set(u,l),!0}return!1},C}();function U(C,T,m,u){var o=u?C.split(u):[C];for(var l in o){if(typeof o[l]!="string")continue;var s=o[l].split(m);if(s.length!==2)continue;var w=s[0],p=s[1];T(w,p)}}var P=new z.default(0,0,""),D=P.align==="middle"?"middle":"center";function v(C,T,m){var u=C;function o(){var w=R(C);if(w===null)throw new Error("Malformed timestamp: "+u);return C=C.replace(/^[^\sa-zA-Z-]+/,""),w}function l(w,p){var c=new B;U(w,function(f,h){var d;switch(f){case"region":for(var a=m.length-1;a>=0;a--)if(m[a].id===h){c.set(f,m[a].region);break}break;case"vertical":c.alt(f,h,["rl","lr"]);break;case"line":d=h.split(","),c.integer(f,d[0]),c.percent(f,d[0])&&c.set("snapToLines",!1),c.alt(f,d[0],["auto"]),d.length===2&&c.alt("lineAlign",d[1],["start",D,"end"]);break;case"position":d=h.split(","),c.percent(f,d[0]),d.length===2&&c.alt("positionAlign",d[1],["start",D,"end","line-left","line-right","auto"]);break;case"size":c.percent(f,h);break;case"align":c.alt(f,h,["start",D,"end","left","right"]);break}},/:/,/\s/),p.region=c.get("region",null),p.vertical=c.get("vertical","");var A=c.get("line","auto");A==="auto"&&P.line===-1&&(A=-1),p.line=A,p.lineAlign=c.get("lineAlign","start"),p.snapToLines=c.get("snapToLines",!0),p.size=c.get("size",100),p.align=c.get("align",D);var y=c.get("position","auto");y==="auto"&&P.position===50&&(y=p.align==="start"||p.align==="left"?0:p.align==="end"||p.align==="right"?100:50),p.position=y}function s(){C=C.replace(/^\s+/,"")}if(s(),T.startTime=o(),s(),C.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+u);C=C.substr(3),s(),T.endTime=o(),s(),l(C,T)}function S(C){return C.replace(/<br(?: \/)?>/gi,`
`)}var _=function(){function C(){this.state="INITIAL",this.buffer="",this.decoder=new I,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var T=C.prototype;return T.parse=function(u){var o=this;u&&(o.buffer+=o.decoder.decode(u,{stream:!0}));function l(){var y=o.buffer,f=0;for(y=S(y);f<y.length&&y[f]!=="\r"&&y[f]!==`
`;)++f;var h=y.substr(0,f);return y[f]==="\r"&&++f,y[f]===`
`&&++f,o.buffer=y.substr(f),h}function s(y){U(y,function(f,h){},/:/)}try{var w="";if(o.state==="INITIAL"){if(!/\r\n|\n/.test(o.buffer))return this;w=l();var p=w.match(/^()?WEBVTT([ \t].*)?$/);if(!p||!p[0])throw new Error("Malformed WebVTT signature.");o.state="HEADER"}for(var c=!1;o.buffer;){if(!/\r\n|\n/.test(o.buffer))return this;c?c=!1:w=l();switch(o.state){case"HEADER":/:/.test(w)?s(w):w||(o.state="ID");continue;case"NOTE":w||(o.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(w)){o.state="NOTE";break}if(!w)continue;if(o.cue=new z.default(0,0,""),o.state="CUE",w.indexOf("-->")===-1){o.cue.id=w;continue}case"CUE":if(!o.cue){o.state="BADCUE";continue}try{v(w,o.cue,o.regionList)}catch(y){o.cue=null,o.state="BADCUE";continue}o.state="CUETEXT";continue;case"CUETEXT":{var A=w.indexOf("-->")!==-1;if(!w||A&&(c=!0)){o.oncue&&o.cue&&o.oncue(o.cue),o.cue=null,o.state="ID";continue}if(o.cue===null)continue;o.cue.text&&(o.cue.text+=`
`),o.cue.text+=w}continue;case"BADCUE":w||(o.state="ID")}}}catch(y){o.state==="CUETEXT"&&o.cue&&o.oncue&&o.oncue(o.cue),o.cue=null,o.state=o.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},T.flush=function(){var u=this;try{if((u.cue||u.state==="HEADER")&&(u.buffer+=`
`,u.parse()),u.state==="INITIAL"||u.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(o){u.onparsingerror&&u.onparsingerror(o)}return u.onflush&&u.onflush(),this},C}()},"./src/utils/webvtt-parser.ts":function(re,X,L){"use strict";L.r(X),L.d(X,"generateCueId",function(){return _}),L.d(X,"parseWebVTT",function(){return T});var z=L("./src/polyfills/number.ts"),I=L("./src/utils/vttparser.ts"),R=L("./src/demux/id3.ts"),B=L("./src/utils/timescale-conversion.ts"),U=L("./src/remux/mp4-remuxer.ts"),P=/\r\n|\n\r|\n|\r/g,D=function(u,o,l){return l===void 0&&(l=0),u.substr(l,o.length)===o},v=function(u){var o=parseInt(u.substr(-3)),l=parseInt(u.substr(-6,2)),s=parseInt(u.substr(-9,2)),w=u.length>9?parseInt(u.substr(0,u.indexOf(":"))):0;if(!Object(z.isFiniteNumber)(o)||!Object(z.isFiniteNumber)(l)||!Object(z.isFiniteNumber)(s)||!Object(z.isFiniteNumber)(w))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+u);return o+=1e3*l,o+=60*1e3*s,o+=60*60*1e3*w,o},S=function(u){for(var o=5381,l=u.length;l;)o=o*33^u.charCodeAt(--l);return(o>>>0).toString()};function _(m,u,o){return S(m.toString())+S(u.toString())+S(o)}var C=function(u,o,l){var s=u[o],w=u[s.prevCC];if(!w||!w.new&&s.new){u.ccOffset=u.presentationOffset=s.start,s.new=!1;return}for(;(p=w)!==null&&p!==void 0&&p.new;){var p;u.ccOffset+=s.start-w.start,s.new=!1,s=w,w=u[s.prevCC]}u.presentationOffset=l};function T(m,u,o,l,s,w,p,c){var A=new I.VTTParser,y=Object(R.utf8ArrayToStr)(new Uint8Array(m)).trim().replace(P,`
`).split(`
`),f=[],h=Object(B.toMpegTsClockFromTimescale)(u,o),d="00:00.000",a=0,b=0,g,E=!0,M=!1;A.oncue=function(F){var j=l[s],W=l.ccOffset,O=(a-h)/9e4;if(j!=null&&j.new&&(b!==void 0?W=l.ccOffset=j.start:C(l,s,O)),O&&(W=O-l.presentationOffset),M){var k=F.endTime-F.startTime,K=Object(U.normalizePts)((F.startTime+W-b)*9e4,w*9e4)/9e4;F.startTime=K,F.endTime=K+k}var Y=F.text.trim();F.text=decodeURIComponent(encodeURIComponent(Y)),F.id||(F.id=_(F.startTime,F.endTime,Y)),F.endTime>0&&f.push(F)},A.onparsingerror=function(F){g=F},A.onflush=function(){if(g){c(g);return}p(f)},y.forEach(function(F){if(E)if(D(F,"X-TIMESTAMP-MAP=")){E=!1,M=!0,F.substr(16).split(",").forEach(function(j){D(j,"LOCAL:")?d=j.substr(6):D(j,"MPEGTS:")&&(a=parseInt(j.substr(7)))});try{b=v(d)/1e3}catch(j){M=!1,g=j}return}else F===""&&(E=!1);A.parse(F+`
`)}),A.flush()}},"./src/utils/xhr-loader.ts":function(re,X,L){"use strict";L.r(X);var z=L("./src/utils/logger.ts"),I=L("./src/loader/load-stats.ts"),R=/^age:\s*[\d.]+\s*$/m,B=function(){function U(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 I.LoadStats,this.retryDelay=0}var P=U.prototype;return P.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},P.abortInternal=function(){var v=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),v&&(v.onreadystatechange=null,v.onprogress=null,v.readyState!==4&&(this.stats.aborted=!0,v.abort()))},P.abort=function(){var v;this.abortInternal(),(v=this.callbacks)!==null&&v!==void 0&&v.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},P.load=function(v,S,_){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=v,this.config=S,this.callbacks=_,this.retryDelay=S.retryDelay,this.loadInternal()},P.loadInternal=function(){var v=this.config,S=this.context;if(!v)return;var _=this.loader=new self.XMLHttpRequest,C=this.stats;C.loading.first=0,C.loaded=0;var T=this.xhrSetup;try{if(T)try{T(_,S.url)}catch(o){_.open("GET",S.url,!0),T(_,S.url)}_.readyState||_.open("GET",S.url,!0);var m=this.context.headers;if(m)for(var u in m)_.setRequestHeader(u,m[u])}catch(o){this.callbacks.onError({code:_.status,text:o.message},S,_);return}S.rangeEnd&&_.setRequestHeader("Range","bytes="+S.rangeStart+"-"+(S.rangeEnd-1)),_.onreadystatechange=this.readystatechange.bind(this),_.onprogress=this.loadprogress.bind(this),_.responseType=S.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),v.timeout),_.send()},P.readystatechange=function(){var v=this.context,S=this.loader,_=this.stats;if(!v||!S)return;var C=S.readyState,T=this.config;if(_.aborted)return;if(C>=2)if(self.clearTimeout(this.requestTimeout),_.loading.first===0&&(_.loading.first=Math.max(self.performance.now(),_.loading.start)),C===4){S.onreadystatechange=null,S.onprogress=null;var m=S.status;if(m>=200&&m<300){_.loading.end=Math.max(self.performance.now(),_.loading.first);var u,o;if(v.responseType==="arraybuffer"?(u=S.response,o=u.byteLength):(u=S.responseText,o=u.length),_.loaded=_.total=o,!this.callbacks)return;var l=this.callbacks.onProgress;if(l&&l(_,v,u,S),!this.callbacks)return;var s={url:S.responseURL,data:u};this.callbacks.onSuccess(s,_,v,S)}else _.retry>=T.maxRetry||m>=400&&m<499?(z.logger.error(m+" while loading "+v.url),this.callbacks.onError({code:m,text:S.statusText},v,S)):(z.logger.warn(m+" while loading "+v.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,T.maxRetryDelay),_.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),T.timeout)},P.loadtimeout=function(){z.logger.warn("timeout while loading "+this.context.url);var v=this.callbacks;v&&(this.abortInternal(),v.onTimeout(this.stats,this.context,this.loader))},P.loadprogress=function(v){var S=this.stats;S.loaded=v.loaded,v.lengthComputable&&(S.total=v.total)},P.getCacheAge=function(){var v=null;if(this.loader&&R.test(this.loader.getAllResponseHeaders())){var S=this.loader.getResponseHeader("age");v=S?parseFloat(S):null}return v},U}();X.default=B}}).default})},vHTk:function(ft,rt,ne){ft.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}}}]);