You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
143 lines
771 KiB
143 lines
771 KiB
(window.webpackJsonp=window.webpackJsonp||[]).push([[254,5,6,7,16],{"+NIl":function(nt,Qe,te){(function(q){q(te("VrN/"))})(function(q){"use strict";q.defineMode("stex",function(G,D){"use strict";function z(S,b){S.cmdState.push(b)}function U(S){return S.cmdState.length>0?S.cmdState[S.cmdState.length-1]:null}function O(S){var b=S.cmdState.pop();b&&b.closeBracket()}function F(S){for(var b=S.cmdState,f=b.length-1;f>=0;f--){var u=b[f];if(u.name=="DEFAULT")continue;return u}return{styleIdentifier:function(){return null}}}function M(S,b,f){return function(){this.name=S,this.bracketNo=0,this.style=b,this.styles=f,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var R={};R.importmodule=M("importmodule","tag",["string","builtin"]),R.documentclass=M("documentclass","tag",["","atom"]),R.usepackage=M("usepackage","tag",["atom"]),R.begin=M("begin","tag",["atom"]),R.end=M("end","tag",["atom"]),R.label=M("label","tag",["atom"]),R.ref=M("ref","tag",["atom"]),R.eqref=M("eqref","tag",["atom"]),R.cite=M("cite","tag",["atom"]),R.bibitem=M("bibitem","tag",["atom"]),R.Bibitem=M("Bibitem","tag",["atom"]),R.RBibitem=M("RBibitem","tag",["atom"]),R.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function C(S,b){S.f=b}function m(S,b){var f;if(S.match(/^\\[a-zA-Z@]+/)){var u=S.current().slice(1);return f=R.hasOwnProperty(u)?R[u]:R.DEFAULT,f=new f,z(b,f),C(b,k),f.style}if(S.match(/^\\[$&%#{}_]/))return"tag";if(S.match(/^\\[,;!\/\\]/))return"tag";if(S.match("\\["))return C(b,function(s,l){return v(s,l,"\\]")}),"keyword";if(S.match("\\("))return C(b,function(s,l){return v(s,l,"\\)")}),"keyword";if(S.match("$$"))return C(b,function(s,l){return v(s,l,"$$")}),"keyword";if(S.match("$"))return C(b,function(s,l){return v(s,l,"$")}),"keyword";var a=S.next();if(a=="%")return S.skipToEnd(),"comment";if(a=="}"||a=="]"){if(f=U(b),f)f.closeBracket(a),C(b,k);else return"error";return"bracket"}else return a=="{"||a=="["?(f=R.DEFAULT,f=new f,z(b,f),"bracket"):/\d/.test(a)?(S.eatWhile(/[\w.%]/),"atom"):(S.eatWhile(/[\w\-_]/),f=F(b),f.name=="begin"&&(f.argument=S.current()),f.styleIdentifier())}function v(S,b,f){if(S.eatSpace())return null;if(f&&S.match(f))return C(b,m),"keyword";if(S.match(/^\\[a-zA-Z@]+/))return"tag";if(S.match(/^[a-zA-Z]+/))return"variable-2";if(S.match(/^\\[$&%#{}_]/))return"tag";if(S.match(/^\\[,;!\/]/))return"tag";if(S.match(/^[\^_&]/))return"tag";if(S.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(S.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var u=S.next();return u=="{"||u=="}"||u=="["||u=="]"||u=="("||u==")"?"bracket":u=="%"?(S.skipToEnd(),"comment"):"error"}function k(S,b){var f=S.peek(),u;return f=="{"||f=="["?(u=U(b),u.openBracket(f),S.eat(f),C(b,m),"bracket"):/[ \t\r]/.test(f)?(S.eat(f),null):(C(b,m),O(b),m(S,b))}return{startState:function(){var S=D.inMathMode?function(b,f){return v(b,f)}:m;return{cmdState:[],f:S}},copyState:function(S){return{cmdState:S.cmdState.slice(),f:S.f}},token:function(S,b){return b.f(S,b)},blankLine:function(S){S.f=m,S.cmdState.length=0},lineComment:"%"}}),q.defineMIME("text/x-stex","stex"),q.defineMIME("text/x-latex","stex")})},"+ua5":function(nt,Qe,te){},"19Vz":function(nt,Qe,te){(function(q){q(te("VrN/"))})(function(q){q.defineOption("placeholder","",function(M,R,C){var m=C&&C!=q.Init;if(R&&!m)M.on("blur",U),M.on("change",O),M.on("swapDoc",O),q.on(M.getInputField(),"compositionupdate",M.state.placeholderCompose=function(){z(M)}),O(M);else if(!R&&m){M.off("blur",U),M.off("change",O),M.off("swapDoc",O),q.off(M.getInputField(),"compositionupdate",M.state.placeholderCompose),G(M);var v=M.getWrapperElement();v.className=v.className.replace(" CodeMirror-empty","")}R&&!M.hasFocus()&&U(M)});function G(M){M.state.placeholder&&(M.state.placeholder.parentNode.removeChild(M.state.placeholder),M.state.placeholder=null)}function D(M){G(M);var R=M.state.placeholder=document.createElement("pre");R.style.cssText="height: 0; overflow: visible",R.style.direction=M.getOption("direction"),R.className="CodeMirror-placeholder CodeMirror-line-like";var C=M.getOption("placeholder");typeof C=="string"&&(C=document.createTextNode(C)),R.appendChild(C),M.display.lineSpace.insertBefore(R,M.display.lineSpace.firstChild)}function z(M){setTimeout(function(){var R=!1,C=M.getInputField();C.nodeName=="TEXTAREA"?R=!C.value:M.lineCount()==1&&(R=!/[^\u200b]/.test(C.querySelector(".CodeMirror-line").textContent)),R?D(M):G(M)},20)}function U(M){F(M)&&D(M)}function O(M){var R=M.getWrapperElement(),C=F(M);R.className=R.className.replace(" CodeMirror-empty","")+(C?" CodeMirror-empty":""),C?D(M):G(M)}function F(M){return M.lineCount()===1&&M.getLine(0)===""}})},"1eCo":function(nt,Qe,te){(function(q){q(te("VrN/"))})(function(q){"use strict";var G={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},D={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};q.defineMode("xml",function(z,U){var O=z.indentUnit,F={},M=U.htmlMode?G:D;for(var R in M)F[R]=M[R];for(var R in U)F[R]=U[R];var C,m;function v(o,T){function E(N){return T.tokenize=N,N(o,T)}var g=o.next();if(g=="<")return o.eat("!")?o.eat("[")?o.match("CDATA[")?E(b("atom","]]>")):null:o.match("--")?E(b("comment","-->")):o.match("DOCTYPE",!0,!0)?(o.eatWhile(/[\w\._\-]/),E(f(1))):null:o.eat("?")?(o.eatWhile(/[\w\._\-]/),T.tokenize=b("meta","?>"),"meta"):(C=o.eat("/")?"closeTag":"openTag",T.tokenize=k,"tag bracket");if(g=="&"){var _;return o.eat("#")?o.eat("x")?_=o.eatWhile(/[a-fA-F\d]/)&&o.eat(";"):_=o.eatWhile(/[\d]/)&&o.eat(";"):_=o.eatWhile(/[\w\.\-:]/)&&o.eat(";"),_?"atom":"error"}else return o.eatWhile(/[^&<]/),null}v.isInText=!0;function k(o,T){var E=o.next();if(E==">"||E=="/"&&o.eat(">"))return T.tokenize=v,C=E==">"?"endTag":"selfcloseTag","tag bracket";if(E=="=")return C="equals",null;if(E=="<"){T.tokenize=v,T.state=l,T.tagName=T.tagStart=null;var g=T.tokenize(o,T);return g?g+" tag error":"tag error"}else return/[\'\"]/.test(E)?(T.tokenize=S(E),T.stringStartCol=o.column(),T.tokenize(o,T)):(o.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function S(o){var T=function(E,g){for(;!E.eol();)if(E.next()==o){g.tokenize=k;break}return"string"};return T.isInAttribute=!0,T}function b(o,T){return function(E,g){for(;!E.eol();){if(E.match(T)){g.tokenize=v;break}E.next()}return o}}function f(o){return function(T,E){for(var g;(g=T.next())!=null;){if(g=="<")return E.tokenize=f(o+1),E.tokenize(T,E);if(g==">")if(o==1){E.tokenize=v;break}else return E.tokenize=f(o-1),E.tokenize(T,E)}return"meta"}}function u(o,T,E){this.prev=o.context,this.tagName=T,this.indent=o.indented,this.startOfLine=E,(F.doNotIndent.hasOwnProperty(T)||o.context&&o.context.noIndent)&&(this.noIndent=!0)}function a(o){o.context&&(o.context=o.context.prev)}function s(o,T){for(var E;;){if(!o.context)return;if(E=o.context.tagName,!F.contextGrabbers.hasOwnProperty(E)||!F.contextGrabbers[E].hasOwnProperty(T))return;a(o)}}function l(o,T,E){return o=="openTag"?(E.tagStart=T.column(),A):o=="closeTag"?y:l}function A(o,T,E){return o=="word"?(E.tagName=T.current(),m="tag",x):F.allowMissingTagName&&o=="endTag"?(m="tag bracket",x(o,T,E)):(m="error",A)}function y(o,T,E){if(o=="word"){var g=T.current();return E.context&&E.context.tagName!=g&&F.implicitlyClosed.hasOwnProperty(E.context.tagName)&&a(E),E.context&&E.context.tagName==g||F.matchClosing===!1?(m="tag",c):(m="tag error",L)}else return F.allowMissingTagName&&o=="endTag"?(m="tag bracket",c(o,T,E)):(m="error",L)}function c(o,T,E){return o!="endTag"?(m="error",c):(a(E),l)}function L(o,T,E){return m="error",c(o,T,E)}function x(o,T,E){if(o=="word")return m="attribute",h;if(o=="endTag"||o=="selfcloseTag"){var g=E.tagName,_=E.tagStart;return E.tagName=E.tagStart=null,o=="selfcloseTag"||F.autoSelfClosers.hasOwnProperty(g)?s(E,g):(s(E,g),E.context=new u(E,g,_==E.indented)),l}return m="error",x}function h(o,T,E){return o=="equals"?p:(F.allowMissing||(m="error"),x(o,T,E))}function p(o,T,E){return o=="string"?d:o=="word"&&F.allowUnquoted?(m="string",x):(m="error",x(o,T,E))}function d(o,T,E){return o=="string"?d:x(o,T,E)}return{startState:function(o){var T={tokenize:v,state:l,indented:o||0,tagName:null,tagStart:null,context:null};return o!=null&&(T.baseIndent=o),T},token:function(o,T){if(!T.tagName&&o.sol()&&(T.indented=o.indentation()),o.eatSpace())return null;C=null;var E=T.tokenize(o,T);return(E||C)&&E!="comment"&&(m=null,T.state=T.state(C||E,o,T),m&&(E=m=="error"?E+" error":m)),E},indent:function(o,T,E){var g=o.context;if(o.tokenize.isInAttribute)return o.tagStart==o.indented?o.stringStartCol+1:o.indented+O;if(g&&g.noIndent)return q.Pass;if(o.tokenize!=k&&o.tokenize!=v)return E?E.match(/^(\s*)/)[0].length:0;if(o.tagName)return F.multilineTagIndentPastTag!==!1?o.tagStart+o.tagName.length+2:o.tagStart+O*(F.multilineTagIndentFactor||1);if(F.alignCDATA&&/<!\[CDATA\[/.test(T))return 0;var _=T&&/^<(\/)?([\w_:\.-]*)/.exec(T);if(_&&_[1])for(;g;)if(g.tagName==_[2]){g=g.prev;break}else if(F.implicitlyClosed.hasOwnProperty(g.tagName))g=g.prev;else break;else if(_)for(;g;){var N=F.contextGrabbers[g.tagName];if(N&&N.hasOwnProperty(_[2]))g=g.prev;else break}for(;g&&g.prev&&!g.startOfLine;)g=g.prev;return g?g.indent+O:o.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:F.htmlMode?"html":"xml",helperType:F.htmlMode?"html":"xml",skipAttribute:function(o){o.state==p&&(o.state=x)},xmlCurrentTag:function(o){return o.tagName?{name:o.tagName,close:o.type=="closeTag"}:null},xmlCurrentContext:function(o){for(var T=[],E=o.context;E;E=E.prev)E.tagName&&T.push(E.tagName);return T.reverse()}}}),q.defineMIME("text/xml","xml"),q.defineMIME("application/xml","xml"),q.mimeModes.hasOwnProperty("text/html")||q.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"7Cbv":function(nt,Qe,te){"use strict";var q=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),G=new Uint8Array(16);function D(){if(!q)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return q(G)}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 U(k){return typeof k=="string"&&z.test(k)}for(var O=U,F=[],M=0;M<256;++M)F.push((M+256).toString(16).substr(1));function R(k){var S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,b=(F[k[S+0]]+F[k[S+1]]+F[k[S+2]]+F[k[S+3]]+"-"+F[k[S+4]]+F[k[S+5]]+"-"+F[k[S+6]]+F[k[S+7]]+"-"+F[k[S+8]]+F[k[S+9]]+"-"+F[k[S+10]]+F[k[S+11]]+F[k[S+12]]+F[k[S+13]]+F[k[S+14]]+F[k[S+15]]).toLowerCase();if(!O(b))throw TypeError("Stringified UUID is invalid");return b}var C=R;function m(k,S,b){k=k||{};var f=k.random||(k.rng||D)();if(f[6]=f[6]&15|64,f[8]=f[8]&63|128,S){b=b||0;for(var u=0;u<16;++u)S[b+u]=f[u];return S}return C(f)}var v=Qe.a=m},"7ahc":function(nt,Qe,te){"use strict";te.d(Qe,"a",function(){return A});var q=te("k1fw"),G=te("0Owb"),D=te("+L6B"),z=te("2/Rp"),U=te("y8nQ"),O=te("Vl3Y"),F=te("tJVT"),M=te("OaEy"),R=te("2fM7"),C=te("cDcd"),m=te.n(C),v=te("VrN/"),k=te.n(v),S=te("p77/"),b=te.n(S),f=te("c5Ni"),u=te.n(f),a=R.a.Option,s={labelCol:{span:4},wrapperCol:{span:20}},l={asp:["ASP","vbscript"],actionscript:["ActionScript(3.0)/Flash/Flex","clike"],bash:["Bash/Bat","shell"],css:["CSS","css"],c:["C","clike"],cpp:["C++","clike"],csharp:["C#","clike"],coffeescript:["CoffeeScript","coffeescript"],d:["D","d"],dart:["Dart","dart"],delphi:["Delphi/Pascal","pascal"],erlang:["Erlang","erlang"],go:["Golang","go"],groovy:["Groovy","groovy"],html:["HTML","text/html"],java:["Java","clike"],json:["JSON","text/json"],javascript:["Javascript","javascript"],lua:["Lua","lua"],less:["LESS","css"],markdown:["Markdown","gfm"],"objective-c":["Objective-C","clike"],php:["PHP","php"],perl:["Perl","perl"],python:["Python","python"],r:["R","r"],rst:["reStructedText","rst"],ruby:["Ruby","ruby"],sql:["SQL","sql"],sass:["SASS/SCSS","sass"],shell:["Shell","shell"],scala:["Scala","clike"],swift:["Swift","clike"],vb:["VB/VBScript","vb"],xml:["XML","text/xml"],yaml:["YAML","yaml"]};Qe.b=function(y){var c=y.callback,L=y.onCancel,x=Object(C.useState)("python"),h=Object(F.a)(x,2),p=h[0],d=h[1];function o(E){d(l[E][1])}function T(E){c(E)}return m.a.createElement(O.a,Object(G.a)({},s,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:T}),m.a.createElement(O.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},m.a.createElement(R.a,{onChange:o},Object.keys(l).map(function(E){return m.a.createElement(a,{key:E,value:E},l[E][0])}))),m.a.createElement(O.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},m.a.createElement(A,{mode:p})),m.a.createElement("div",{className:"flex-container flex-end"},m.a.createElement(z.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),m.a.createElement(z.a,{type:"ghost",onClick:L},"\u53D6\u6D88")))};function A(y){var c=y.value,L=y.onChange,x=y.mode,h=y.options,p=h===void 0?{}:h,d=Object(C.useRef)(),o=Object(C.useState)(),T=Object(F.a)(o,2),E=T[0],g=T[1];return Object(C.useEffect)(function(){if(E){function _(N){var B=N.getValue();L&&L(B)}return E.on("change",_),function(){E.off("change",_)}}},[E,L]),Object(C.useEffect)(function(){E&&E.setOption("mode",x)},[E,x]),Object(C.useEffect)(function(){E&&((c!==E.getValue()||c==="")&&setTimeout(function(){E.setValue(c||" ")},300))},[E,c]),Object(C.useEffect)(function(){if(d.current&&!E){var _=k.a.fromTextArea(d.current,Object(q.a)({mode:x,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},p));g(_)}},[d.current,E]),m.a.createElement("div",{className:"my-codemirror-container"},m.a.createElement("textarea",{ref:d}))}},"8EBN":function(nt,Qe,te){(function(q){q(te("VrN/"))})(function(q){"use strict";q.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded Javascript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var G=0;G<q.modeInfo.length;G++){var D=q.modeInfo[G];D.mimes&&(D.mime=D.mimes[0])}q.findModeByMIME=function(z){z=z.toLowerCase();for(var U=0;U<q.modeInfo.length;U++){var O=q.modeInfo[U];if(O.mime==z)return O;if(O.mimes){for(var F=0;F<O.mimes.length;F++)if(O.mimes[F]==z)return O}}if(/\+xml$/.test(z))return q.findModeByMIME("application/xml");if(/\+json$/.test(z))return q.findModeByMIME("application/json")},q.findModeByExtension=function(z){z=z.toLowerCase();for(var U=0;U<q.modeInfo.length;U++){var O=q.modeInfo[U];if(O.ext){for(var F=0;F<O.ext.length;F++)if(O.ext[F]==z)return O}}},q.findModeByFileName=function(z){for(var U=0;U<q.modeInfo.length;U++){var O=q.modeInfo[U];if(O.file&&O.file.test(z))return O}var F=z.lastIndexOf("."),M=F>-1&&z.substring(F+1,z.length);if(M)return q.findModeByExtension(M)},q.findModeByName=function(z){z=z.toLowerCase();for(var U=0;U<q.modeInfo.length;U++){var O=q.modeInfo[U];if(O.name.toLowerCase()==z)return O;if(O.alias){for(var F=0;F<O.alias.length;F++)if(O.alias[F].toLowerCase()==z)return O}}}})},"8hTe":function(nt,Qe,te){nt.exports={button:"button___1wy9m"}},"9Bee":function(nt,Qe,te){"use strict";var q=te("DYRE"),G=te("zeV3"),D=te("+L6B"),z=te("2/Rp"),U=te("k1fw"),O=te("tJVT"),F=te("cDcd"),M=te.n(F),R=te("vg9a"),C=te("DlQD"),m=te.n(C),v=te("rUJ1");function k(me,he){var se=me.match(/^(\s+)(?:```)/);if(se===null)return he;var ne=se[1];return he.split(`
|
|
`).map(function(ce){var $=ce.match(/^\s+/);if($===null)return ce;var ie=Object(O.a)($,1),Z=ie[0];return Z.length>=ne.length?ce.slice(ne.length):ce}).join(`
|
|
`)}var S=[],b=["<ul>"],f=new m.a.Renderer,u=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function a(){S.length=0,b=["<ul>"]}var s={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function l(me,he,se,ne){if(he>=me.length||me[he].level<=se)return he;var ce=me[he];ne.push("<li><a href='#"+ce.anchor+"'>"+ce.text+"</a>"),he++;var $=[];return he=l(me,he,ce.level,$),$.length>0&&(ne.push("<ul>"),$.forEach(function(ie){ne.push(ie)}),ne.push("</ul>")),ne.push("</li>"),he=l(me,he,se,ne),he}function A(){return l(S,0,0,b),b.push("</ul>"),b.join("")}var y={heading:function(he){var se=u.exec(he);if(se)return{type:"heading",raw:se[0],depth:se[1].length,text:se[2]}},fences:function(he){var se=this.rules.block.fences.exec(he);if(se){var ne=se[0],ce=k(ne,se[3]||""),$=se[2]?se[2].trim():se[2];if(["latex","katex","math"].indexOf($)>=0){var ie=x(),Z=ce;ce=ie,h[ie]={type:"block",expression:Z}}return{type:"code",raw:ne,lang:$,text:ce}}}},c=/(?:\${2})([^\n`]+?)(?:\${2})/gi,L=0,x=function(){return"__special_katext_id_".concat(L++,"__")},h={};function p(){return h}function d(){L=0,h={}}function o(me){return me=me.replace(c,function(he,se){var ne=x();return h[ne]={type:"inline",expression:se},ne}),me}var T=f.listitem;f.listitem=function(me){return T(o(me))};var E=f.paragraph;f.paragraph=function(me){return E(o(me))};var g=f.tablecell;f.tablecell=function(me,he){return g(o(me),he)},f.code=function(me,he,se){var ne=(he||"").match(/\S*/)[0];return ne?["latex","katex","math"].indexOf(ne)>=0?"<p class='editormd-tex'>".concat(me,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(he,'">').concat(se?me:Object(v.escape)(me,!0),`</code></pre>
|
|
`):'<pre class="prettyprint linenums"><code>'+(se?me:Object(v.escape)(me,!0))+"</code></pre>"},f.heading=function(me,he,se){var ne=this.options.headerPrefix+se.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return S.push({anchor:ne,level:he,text:me}),"<h"+he+' id="'+ne+'">'+me+"</h"+he+">"},m.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),m.a.use({tokenizer:y,renderer:f});var _=m.a,N=te("SJMd"),B=te("ulZh"),W=te.n(B),P=te("m3rI"),I=te("Oy/b"),H=te("p5ED"),Y=te("8hTe"),ee=te.n(Y),oe=/<pre[^>]*>/g;function Ee(me){var he=document.createElement("div");return he.innerHTML=me,he.childNodes.length===0?"":he.childNodes[0].nodeValue}var pe=Qe.a=function(me){var he=me.value,se=he===void 0?"":he,ne=me.edit,ce=ne===void 0?!1:ne,$=me.className,ie=me.showTextOnly,Z=me.showLines,ye=me.replaces,Ce=me.zoomImg,ve=me.hasMask,we=me.style,Ae=we===void 0?{}:we,Re=me.stylesPrev,Ie=Re===void 0?{}:Re,Me=String(se),De=Object(F.useRef)(),Ve=Object(F.useRef)(),et=Object(F.useState)(""),ze=Object(O.a)(et,2),Xe=ze[0],qe=ze[1],He=Object(F.useState)("office"),Be=Object(O.a)(He,2),Se=Be[0],Ze=Be[1],Je=Object(F.useMemo)(function(){try{var fe=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Q=/\"\/api\/attachments\/|\"\/attachments\/download\//g,J=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;Me=Me.replace(fe,"("+P.a.API_SERVER+"/api/attachments/").replace(Q,'"'+P.a.API_SERVER+"/api/attachments/").replace(J,'"'+P.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(_e){}var re=_(Me),le=p();if(Me.match(/\[TOC\]/)&&(re=re.replace("<p>[TOC]</p>",A()),a()),re=re.replace(/(__special_katext_id_\d+__)/g,function(_e,ke){var je=le[ke],it=je.type,Oe=je.expression;return Object(I.renderToString)(Ee(Oe)||"",{displayMode:it==="block",throwOnError:!1,output:"html"})}),re=re.replace(/▁/g,"\u2581\u2581\u2581"),d(),ie){var Te=document.createElement("div");return Te.innerHTML=re,Te.innerText}return setTimeout(function(){return ge()},500),re},[Me]),Le=Object(F.useRef)();s.WebkitLineClamp=Z,Z&&(Ae=Object(U.a)(Object(U.a)({},Ae),s));function Ue(fe){var Q=fe.target;if(Q.tagName.toUpperCase()==="IMG"){if(Ce){var J=Q.getAttribute("src");qe(J),Ze("image")}}else if(Q.tagName.toUpperCase()==="A"){var re=Q.getAttribute("href");if(re.indexOf("office")>-1)fe.preventDefault(),qe(re),Ze("office");else if(re.indexOf("application/pdf")>-1)fe.preventDefault(),qe(re),Ze("pdf");else if(re.indexOf("text/html")>-1)fe.preventDefault(),qe(re),Ze("html");else if(re.startsWith("#")){fe.preventDefault();var le=document.getElementById(re.replace("#",""));le&&le.scrollIntoView(!0)}}}var ge=function(){var Q,J=(Q=Le.current)===null||Q===void 0?void 0:Q.querySelectorAll("video");J==null||J.forEach(function(re){if(re.oncontextmenu=function(){return!1},re.src.indexOf(".m3u8")>-1&&!re.canPlayType("application/vnd.apple.mpegurl")){if(W.a.isSupported()){var le=new W.a;le.loadSource(re.src),le.attachMedia(re)}}})};Object(F.useEffect)(function(){if(Le.current&&Je&&(Je.match(oe)&&window.PR.prettyPrint()),Le.current)return Le.current.addEventListener("click",Ue),function(){Le.current.removeEventListener("click",Ue),d(),a()}},[Je,Le.current,Ue]);var de=function(Q){if(!ce)return;Q.target.nodeName==="IMG"?(De.current.style.display="flex",De.current.style.width=Q.target.clientWidth+"px",De.current.style.height=Q.target.clientHeight+"px",De.current.style.top=Q.target.offsetTop+"px",De.current.style.left=Q.target.offsetLeft+"px",Ve.current.src=Q.target.getAttribute("src")):De.current.style.display="none"};return M.a.createElement("div",{style:{position:"relative"}},M.a.createElement("div",{ref:Le,style:Object(U.a)({},Ae),className:"".concat($||""," markdown-body ").concat(ee.a.mdBody),onMouseOver:de,dangerouslySetInnerHTML:{__html:Je}}),M.a.createElement("div",{ref:De,className:ee.a.button},M.a.createElement(G.a,null,M.a.createElement(z.a,{onClick:function(){return openCrop()}},"\u88C1\u526A"),M.a.createElement(z.a,{onClick:function(){return openEditor()}},"\u7F16\u8F91"))),M.a.createElement("img",{ref:Ve,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1,top:"-10000px"}}),M.a.createElement(H.a,{close:!0,data:Xe,type:Xe!=null&&Xe.length?Se:"",style:Object(U.a)({},Ie),onClose:function(){return qe("")}}))}},"9VGf":function(nt,Qe,te){"use strict";te.d(Qe,"a",function(){return D});var q=te("cDcd"),G=te.n(q);function D(z,U){var O=Object(q.useRef)();Object(q.useEffect)(function(){O.current=z}),Object(q.useEffect)(function(){function F(){O.current()}if(U!==null){var M=setInterval(F,U);return function(){return clearInterval(M)}}},[U])}},BU3w:function(nt,Qe,te){"use strict";te.d(Qe,"a",function(){return O});var q=te("MNnm"),G="rc-util-key";function D(F){if(F.attachTo)return F.attachTo;var M=document.querySelector("head");return M||document.body}function z(F){var M,R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(q.a)())return null;var C=document.createElement("style");if((M=R.csp)===null||M===void 0?void 0:M.nonce){var m;C.nonce=(m=R.csp)===null||m===void 0?void 0:m.nonce}C.innerHTML=F;var v=D(R),k=v.firstChild;return R.prepend&&v.prepend?v.prepend(C):R.prepend&&k?v.insertBefore(C,k):v.appendChild(C),C}var U=new Map;function O(F,M){var R=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},C=D(R);if(!U.has(C)){var m=z("",R),v=m.parentNode;U.set(C,v),v.removeChild(m)}var k=Array.from(U.get(C).children).find(function(a){return a.tagName==="STYLE"&&a[G]===M});if(k){var S,b;if(((S=R.csp)===null||S===void 0?void 0:S.nonce)&&k.nonce!==((b=R.csp)===null||b===void 0?void 0:b.nonce)){var f;k.nonce=(f=R.csp)===null||f===void 0?void 0:f.nonce}return k.innerHTML!==F&&(k.innerHTML=F),k}var u=z(F,R);return u[G]=M,u}},Bd2K:function(nt,Qe,te){(function(q){q(te("VrN/"),te("osHv"))})(function(q){q.defineOption("autoCloseTags",!1,function(R,C,m){if(m!=q.Init&&m&&R.removeKeyMap("autoCloseTags"),!C)return;var v={name:"autoCloseTags"};(typeof C!="object"||C.whenClosing!==!1)&&(v["'/'"]=function(k){return O(k)}),(typeof C!="object"||C.whenOpening!==!1)&&(v["'>'"]=function(k){return z(k)}),R.addKeyMap(v)});var G=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],D=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];function z(R){if(R.getOption("disableInput"))return q.Pass;for(var C=R.listSelections(),m=[],v=R.getOption("autoCloseTags"),k=0;k<C.length;k++){if(!C[k].empty())return q.Pass;var S=C[k].head,b=R.getTokenAt(S),f=q.innerMode(R.getMode(),b.state),u=f.state,a=f.mode.xmlCurrentTag&&f.mode.xmlCurrentTag(u),s=a&&a.name;if(!s)return q.Pass;var l=f.mode.configuration=="html",A=typeof v=="object"&&v.dontCloseTags||l&&G,y=typeof v=="object"&&v.indentTags||l&&D;b.end>S.ch&&(s=s.slice(0,s.length-b.end+S.ch));var c=s.toLowerCase();if(!s||b.type=="string"&&(b.end!=S.ch||!/[\"\']/.test(b.string.charAt(b.string.length-1))||b.string.length==1)||b.type=="tag"&&a.close||b.string.indexOf("/")==S.ch-b.start-1||A&&F(A,c)>-1||M(R,f.mode.xmlCurrentContext&&f.mode.xmlCurrentContext(u)||[],s,S,!0))return q.Pass;var L=typeof v=="object"&&v.emptyTags;if(L&&F(L,s)>-1){m[k]={text:"/>",newPos:q.Pos(S.line,S.ch+2)};continue}var x=y&&F(y,c)>-1;m[k]={indent:x,text:">"+(x?`
|
|
|
|
`:"")+"</"+s+">",newPos:x?q.Pos(S.line+1,0):q.Pos(S.line,S.ch+1)}}for(var h=typeof v=="object"&&v.dontIndentOnAutoClose,k=C.length-1;k>=0;k--){var p=m[k];R.replaceRange(p.text,C[k].head,C[k].anchor,"+insert");var d=R.listSelections().slice(0);d[k]={head:p.newPos,anchor:p.newPos},R.setSelections(d),!h&&p.indent&&(R.indentLine(p.newPos.line,null,!0),R.indentLine(p.newPos.line+1,null,!0))}}function U(R,C){for(var m=R.listSelections(),v=[],k=C?"/":"</",S=R.getOption("autoCloseTags"),b=typeof S=="object"&&S.dontIndentOnSlash,f=0;f<m.length;f++){if(!m[f].empty())return q.Pass;var u=m[f].head,a=R.getTokenAt(u),s=q.innerMode(R.getMode(),a.state),l=s.state;if(C&&(a.type=="string"||a.string.charAt(0)!="<"||a.start!=u.ch-1))return q.Pass;var A,y=s.mode.name!="xml"&&R.getMode().name=="htmlmixed";if(y&&s.mode.name=="javascript")A=k+"script";else if(y&&s.mode.name=="css")A=k+"style";else{var c=s.mode.xmlCurrentContext&&s.mode.xmlCurrentContext(l);if(!c||c.length&&M(R,c,c[c.length-1],u))return q.Pass;A=k+c[c.length-1]}R.getLine(u.line).charAt(a.end)!=">"&&(A+=">"),v[f]=A}if(R.replaceSelections(v),m=R.listSelections(),!b)for(var f=0;f<m.length;f++)(f==m.length-1||m[f].head.line<m[f+1].head.line)&&R.indentLine(m[f].head.line)}function O(R){return R.getOption("disableInput")?q.Pass:U(R,!0)}q.commands.closeTag=function(R){return U(R)};function F(R,C){if(R.indexOf)return R.indexOf(C);for(var m=0,v=R.length;m<v;++m)if(R[m]==C)return m;return-1}function M(R,C,m,v,k){if(!q.scanForClosingTag)return!1;var S=Math.min(R.lastLine()+1,v.line+500),b=q.scanForClosingTag(R,v,null,S);if(!b||b.tag!=m)return!1;for(var f=k?1:0,u=C.length-1;u>=0&&C[u]==m;u--)++f;v=b.to;for(var u=1;u<f;u++){var a=q.scanForClosingTag(R,v,null,S);if(!a||a.tag!=m)return!1;v=a.to}return!0}})},BjJ7:function(nt,Qe,te){"use strict";te.d(Qe,"d",function(){return G}),te.d(Qe,"c",function(){return D}),te.d(Qe,"e",function(){return z}),te.d(Qe,"b",function(){return U}),te.d(Qe,"a",function(){return F});var q=te("m3rI");function G(M){var R=!0;if(M.length>0){for(var C=0;C<M.length;C++)if(M[C].compile_success==0||!M[C].compile_success){R=!1;break}}else R=!1;return R}function D(M){for(var R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",C=[],m=0;m<M.length;m++){var v=M[m],k=R?"".concat(R,"/").concat(v.name):"".concat(v.name);C.push({title:v.name,isLeaf:!(v.type==="tree"),key:k})}return C}function z(M,R,C){for(var m=0;m<M.length;m++){var v=M[m];if(v.key===R){v.children=C;break}v.children&&z(v.children,R,C)}return M}function U(M,R,C){var m;return function(){var v=this,k=arguments,S=function(){m=null,C||M.apply(v,k)},b=C&&!m;clearTimeout(m),m=setTimeout(S,R),b&&M.apply(v,k)}}var O=!0,F=q.a.API_SERVER},"C+DQ":function(nt,Qe,te){},D1Df:function(nt,Qe,te){"use strict";function q(g){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?q=function(N){return typeof N}:q=function(N){return N&&typeof Symbol=="function"&&N.constructor===Symbol&&N!==Symbol.prototype?"symbol":typeof N},q(g)}function G(){return G=Object.assign||function(g){for(var _=1;_<arguments.length;_++){var N=arguments[_];for(var B in N)Object.prototype.hasOwnProperty.call(N,B)&&(g[B]=N[B])}return g},G.apply(this,arguments)}function D(g,_){var N=Object.keys(g);if(Object.getOwnPropertySymbols){var B=Object.getOwnPropertySymbols(g);_&&(B=B.filter(function(W){return Object.getOwnPropertyDescriptor(g,W).enumerable})),N.push.apply(N,B)}return N}function z(g){for(var _=1;_<arguments.length;_++){var N=arguments[_]!=null?arguments[_]:{};_%2?D(N,!0).forEach(function(B){b(g,B,N[B])}):Object.getOwnPropertyDescriptors?Object.defineProperties(g,Object.getOwnPropertyDescriptors(N)):D(N).forEach(function(B){Object.defineProperty(g,B,Object.getOwnPropertyDescriptor(N,B))})}return g}function U(g,_){if(g==null)return{};var N=O(g,_),B,W;if(Object.getOwnPropertySymbols){var P=Object.getOwnPropertySymbols(g);for(W=0;W<P.length;W++){if(B=P[W],_.indexOf(B)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(g,B))continue;N[B]=g[B]}}return N}function O(g,_){if(g==null)return{};var N={},B=Object.keys(g),W,P;for(P=0;P<B.length;P++){if(W=B[P],_.indexOf(W)>=0)continue;N[W]=g[W]}return N}function F(g,_){if(!(g instanceof _))throw new TypeError("Cannot call a class as a function")}function M(g,_){for(var N=0;N<_.length;N++){var B=_[N];B.enumerable=B.enumerable||!1,B.configurable=!0,"value"in B&&(B.writable=!0),Object.defineProperty(g,B.key,B)}}function R(g,_,N){return _&&M(g.prototype,_),N&&M(g,N),g}function C(g,_){return _&&(q(_)==="object"||typeof _=="function")?_:v(g)}function m(g){return m=Object.setPrototypeOf?Object.getPrototypeOf:function(N){return N.__proto__||Object.getPrototypeOf(N)},m(g)}function v(g){if(g===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return g}function k(g,_){if(typeof _!="function"&&_!==null)throw new TypeError("Super expression must either be null or a function");g.prototype=Object.create(_&&_.prototype,{constructor:{value:g,writable:!0,configurable:!0}}),_&&S(g,_)}function S(g,_){return S=Object.setPrototypeOf||function(B,W){return B.__proto__=W,B},S(g,_)}function b(g,_,N){return _ in g?Object.defineProperty(g,_,{value:N,enumerable:!0,configurable:!0,writable:!0}):g[_]=N,g}var f=te("cDcd"),u=te("17x9"),a=te("H38U"),s=te("aRTE");function l(g){for(var _="",N=0;N<g.length;N++){var B=g.charCodeAt(N);B<128?_+=String.fromCharCode(B):B<2048?(_+=String.fromCharCode(192|B>>6),_+=String.fromCharCode(128|B&63)):B<55296||B>=57344?(_+=String.fromCharCode(224|B>>12),_+=String.fromCharCode(128|B>>6&63),_+=String.fromCharCode(128|B&63)):(N++,B=65536+((B&1023)<<10|g.charCodeAt(N)&1023),_+=String.fromCharCode(240|B>>18),_+=String.fromCharCode(128|B>>12&63),_+=String.fromCharCode(128|B>>6&63),_+=String.fromCharCode(128|B&63))}return _}var A={size:128,level:"L",bgColor:"#FFFFFF",fgColor:"#000000",includeMargin:!1},y={},c=4,L=.1;function x(g){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,N=[];return g.forEach(function(B,W){var P=null;B.forEach(function(I,H){if(!I&&P!==null){N.push("M".concat(P+_," ").concat(W+_,"h").concat(H-P,"v1H").concat(P+_,"z")),P=null;return}if(H===B.length-1){if(!I)return;P===null?N.push("M".concat(H+_,",").concat(W+_," h1v1H").concat(H+_,"z")):N.push("M".concat(P+_,",").concat(W+_," h").concat(H+1-P,"v1H").concat(P+_,"z"));return}I&&P===null&&(P=H)})}),N.join("")}function h(g,_){return g.slice().map(function(N,B){return B<_.y||B>=_.y+_.h?N:N.map(function(W,P){return P<_.x||P>=_.x+_.w?W:!1})})}function p(g,_){var N=g.imageSettings,B=g.size,W=g.includeMargin;if(N==null)return null;var P=W?c:0,I=_.length+P*2,H=Math.floor(B*L),Y=I/B,ee=(N.width||H)*Y,oe=(N.height||H)*Y,Ee=N.x==null?_.length/2-ee/2:N.x*Y,pe=N.y==null?_.length/2-oe/2:N.y*Y,me=null;if(N.excavate){var he=Math.floor(Ee),se=Math.floor(pe),ne=Math.ceil(ee+Ee-he),ce=Math.ceil(oe+pe-se);me={x:he,y:se,w:ne,h:ce}}return{x:Ee,y:pe,h:oe,w:ee,excavation:me}}var d=function(){try{new Path2D().addPath(new Path2D)}catch(g){return!1}return!0}(),o=function(g){k(_,g);function _(){var N,B;F(this,_);for(var W=arguments.length,P=new Array(W),I=0;I<W;I++)P[I]=arguments[I];return B=C(this,(N=m(_)).call.apply(N,[this].concat(P))),b(v(B),"_canvas",void 0),b(v(B),"_image",void 0),b(v(B),"state",{imgLoaded:!1}),b(v(B),"handleImageLoad",function(){B.setState({imgLoaded:!0})}),B}return R(_,[{key:"componentDidMount",value:function(){this.update()}},{key:"componentDidUpdate",value:function(){this.update()}},{key:"update",value:function(){var B=this.props,W=B.value,P=B.size,I=B.level,H=B.bgColor,Y=B.fgColor,ee=B.includeMargin,oe=B.imageSettings,Ee=new a(-1,s[I]);if(Ee.addData(l(W)),Ee.make(),this._canvas!=null){var pe=this._canvas,me=pe.getContext("2d");if(!me)return;var he=Ee.modules;if(he===null)return;var se=ee?c:0,ne=he.length+se*2,ce=p(this.props,he);oe!=null&&ce!=null&&(ce.excavation!=null&&(he=h(he,ce.excavation)));var $=window.devicePixelRatio||1;pe.height=pe.width=P*$;var ie=P/ne*$;me.scale(ie,ie),me.fillStyle=H,me.fillRect(0,0,ne,ne),me.fillStyle=Y,d?me.fill(new Path2D(x(he,se))):he.forEach(function(Z,ye){Z.forEach(function(Ce,ve){Ce&&me.fillRect(ve+se,ye+se,1,1)})}),this.state.imgLoaded&&this._image&&ce!=null&&me.drawImage(this._image,ce.x+se,ce.y+se,ce.w,ce.h)}}},{key:"render",value:function(){var B=this,W=this.props,P=W.value,I=W.size,H=W.level,Y=W.bgColor,ee=W.fgColor,oe=W.style,Ee=W.includeMargin,pe=W.imageSettings,me=U(W,["value","size","level","bgColor","fgColor","style","includeMargin","imageSettings"]),he=z({height:I,width:I},oe),se=null,ne=pe&&pe.src;return pe!=null&&ne!=null&&(se=f.createElement("img",{src:ne,style:{display:"none"},onLoad:this.handleImageLoad,ref:function($){return B._image=$}})),f.createElement(f.Fragment,null,f.createElement("canvas",G({style:he,height:I,width:I,ref:function($){return B._canvas=$}},me)),se)}}]),_}(f.PureComponent);b(o,"defaultProps",A);var T=function(g){k(_,g);function _(){return F(this,_),C(this,m(_).apply(this,arguments))}return R(_,[{key:"render",value:function(){var B=this.props,W=B.value,P=B.size,I=B.level,H=B.bgColor,Y=B.fgColor,ee=B.includeMargin,oe=B.imageSettings,Ee=U(B,["value","size","level","bgColor","fgColor","includeMargin","imageSettings"]),pe=new a(-1,s[I]);pe.addData(l(W)),pe.make();var me=pe.modules;if(me===null)return null;var he=ee?c:0,se=me.length+he*2,ne=p(this.props,me),ce=null;oe!=null&&ne!=null&&(ne.excavation!=null&&(me=h(me,ne.excavation)),ce=f.createElement("image",{xlinkHref:oe.src,height:ne.h,width:ne.w,x:ne.x+he,y:ne.y+he,preserveAspectRatio:"none"}));var $=x(me,he);return f.createElement("svg",G({shapeRendering:"crispEdges",height:P,width:P,viewBox:"0 0 ".concat(se," ").concat(se)},Ee),f.createElement("path",{fill:H,d:"M0,0 h".concat(se,"v").concat(se,"H0z")}),f.createElement("path",{fill:Y,d:$}),ce)}}]),_}(f.PureComponent);b(T,"defaultProps",A);var E=function(_){var N=_.renderAs,B=U(_,["renderAs"]),W=N==="svg"?T:o;return f.createElement(W,B)};E.defaultProps=z({renderAs:"canvas"},A),nt.exports=E},DlQD:function(nt,Qe,te){(function(q,G){nt.exports=G()})(this,function(){"use strict";function q(ge,de){for(var fe=0;fe<de.length;fe++){var Q=de[fe];Q.enumerable=Q.enumerable||!1,Q.configurable=!0,"value"in Q&&(Q.writable=!0),Object.defineProperty(ge,Q.key,Q)}}function G(ge,de,fe){return de&&q(ge.prototype,de),fe&&q(ge,fe),ge}function D(ge,de){if(!ge)return;if(typeof ge=="string")return z(ge,de);var fe=Object.prototype.toString.call(ge).slice(8,-1);if(fe==="Object"&&ge.constructor&&(fe=ge.constructor.name),fe==="Map"||fe==="Set")return Array.from(ge);if(fe==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(fe))return z(ge,de)}function z(ge,de){(de==null||de>ge.length)&&(de=ge.length);for(var fe=0,Q=new Array(de);fe<de;fe++)Q[fe]=ge[fe];return Q}function U(ge,de){var fe;if(typeof Symbol=="undefined"||ge[Symbol.iterator]==null){if(Array.isArray(ge)||(fe=D(ge))||de&&ge&&typeof ge.length=="number"){fe&&(ge=fe);var Q=0;return function(){return Q>=ge.length?{done:!0}:{done:!1,value:ge[Q++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}return fe=ge[Symbol.iterator](),fe.next.bind(fe)}function O(ge,de){return de={exports:{}},ge(de,de.exports),de.exports}var F=O(function(ge){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 fe(Q){ge.exports.defaults=Q}ge.exports={defaults:de(),getDefaults:de,changeDefaults:fe}}),M=F.defaults,R=F.getDefaults,C=F.changeDefaults,m=/[&<>"']/,v=/[&<>"']/g,k=/[<>"']|&(?!#?\w+;)/,S=/[<>"']|&(?!#?\w+;)/g,b={"&":"&","<":"<",">":">",'"':""","'":"'"},f=function(de){return b[de]};function u(ge,de){if(de){if(m.test(ge))return ge.replace(v,f)}else if(k.test(ge))return ge.replace(S,f);return ge}var a=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function s(ge){return ge.replace(a,function(de,fe){return fe=fe.toLowerCase(),fe==="colon"?":":fe.charAt(0)==="#"?fe.charAt(1)==="x"?String.fromCharCode(parseInt(fe.substring(2),16)):String.fromCharCode(+fe.substring(1)):""})}var l=/(^|[^\[])\^/g;function A(ge,de){ge=ge.source||ge,de=de||"";var fe={replace:function(J,re){return re=re.source||re,re=re.replace(l,"$1"),ge=ge.replace(J,re),fe},getRegex:function(){return new RegExp(ge,de)}};return fe}var y=/[^\w:]/g,c=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function L(ge,de,fe){if(ge){var Q;try{Q=decodeURIComponent(s(fe)).replace(y,"").toLowerCase()}catch(J){return null}if(Q.indexOf("javascript:")===0||Q.indexOf("vbscript:")===0||Q.indexOf("data:")===0)return null}de&&!c.test(fe)&&(fe=o(de,fe));try{fe=encodeURI(fe).replace(/%25/g,"%")}catch(J){return null}return fe}var x={},h=/^[^:]+:\/*[^/]*$/,p=/^([^:]+:)[\s\S]*$/,d=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(ge,de){x[" "+ge]||(h.test(ge)?x[" "+ge]=ge+"/":x[" "+ge]=_(ge,"/",!0)),ge=x[" "+ge];var fe=ge.indexOf(":")===-1;return de.substring(0,2)==="//"?fe?de:ge.replace(p,"$1")+de:de.charAt(0)==="/"?fe?de:ge.replace(d,"$1")+de:ge+de}var T={exec:function(){}};function E(ge){for(var de=1,fe,Q;de<arguments.length;de++){fe=arguments[de];for(Q in fe)Object.prototype.hasOwnProperty.call(fe,Q)&&(ge[Q]=fe[Q])}return ge}function g(ge,de){var fe=ge.replace(/\|/g,function(re,le,Te){for(var _e=!1,ke=le;--ke>=0&&Te[ke]==="\\";)_e=!_e;return _e?"|":" |"}),Q=fe.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 _(ge,de,fe){var Q=ge.length;if(Q===0)return"";for(var J=0;J<Q;){var re=ge.charAt(Q-J-1);if(re===de&&!fe)J++;else if(re!==de&&fe)J++;else break}return ge.substr(0,Q-J)}function N(ge,de){if(ge.indexOf(de[1])===-1)return-1;for(var fe=ge.length,Q=0,J=0;J<fe;J++)if(ge[J]==="\\")J++;else if(ge[J]===de[0])Q++;else if(ge[J]===de[1]&&(Q--,Q<0))return J;return-1}function B(ge){ge&&ge.sanitize&&!ge.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}var W={escape:u,unescape:s,edit:A,cleanUrl:L,resolveUrl:o,noopTest:T,merge:E,splitCells:g,rtrim:_,findClosingBracket:N,checkSanitizeDeprecation:B},P=F.defaults,I=W.rtrim,H=W.splitCells,Y=W.escape,ee=W.findClosingBracket;function oe(ge,de,fe){var Q=de.href,J=de.title?Y(de.title):null,re=ge[1].replace(/\\([\[\]])/g,"$1");return ge[0].charAt(0)!=="!"?{type:"link",raw:fe,href:Q,title:J,text:re}:{type:"image",raw:fe,href:Q,title:J,text:Y(re)}}function Ee(ge,de){var fe=ge.match(/^(\s+)(?:```)/);if(fe===null)return de;var Q=fe[1];return de.split(`
|
|
`).map(function(J){var re=J.match(/^\s+/);if(re===null)return J;var le=re[0];return le.length>=Q.length?J.slice(Q.length):J}).join(`
|
|
`)}var pe=function(){function ge(fe){this.options=fe||P}var de=ge.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 re=this.rules.block.code.exec(Q);if(re){var le=J[J.length-1];if(le&&le.type==="paragraph")return{raw:re[0],text:re[0].trimRight()};var Te=re[0].replace(/^ {4}/gm,"");return{type:"code",raw:re[0],codeBlockStyle:"indented",text:this.options.pedantic?Te:I(Te,`
|
|
`)}}},de.fences=function(Q){var J=this.rules.block.fences.exec(Q);if(J){var re=J[0],le=Ee(re,J[3]||"");return{type:"code",raw:re,lang:J[2]?J[2].trim():J[2],text:le}}},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 re={type:"table",header:H(J[1].replace(/^ *| *\| *$/g,"")),align:J[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:J[3]?J[3].replace(/\n$/,"").split(`
|
|
`):[],raw:J[0]};if(re.header.length===re.align.length){var le=re.align.length,Te;for(Te=0;Te<le;Te++)/^ *-+: *$/.test(re.align[Te])?re.align[Te]="right":/^ *:-+: *$/.test(re.align[Te])?re.align[Te]="center":/^ *:-+ *$/.test(re.align[Te])?re.align[Te]="left":re.align[Te]=null;for(le=re.cells.length,Te=0;Te<le;Te++)re.cells[Te]=H(re.cells[Te],re.header.length);return re}}},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 re=J[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:J[0],text:re}}},de.list=function(Q){var J=this.rules.block.list.exec(Q);if(J){for(var re=J[0],le=J[2],Te=le.length>1,_e=le[le.length-1]===")",ke={type:"list",raw:re,ordered:Te,start:Te?+le.slice(0,-1):"",loose:!1,items:[]},je=J[0].match(this.rules.block.item),it=!1,Oe,ft,ot,rt,Et,st,vt,yt=je.length,Ke=0;Ke<yt;Ke++)Oe=je[Ke],re=Oe,ft=Oe.length,Oe=Oe.replace(/^ *([*+-]|\d+[.)]) */,""),~Oe.indexOf(`
|
|
`)&&(ft-=Oe.length,Oe=this.options.pedantic?Oe.replace(/^ {1,4}/gm,""):Oe.replace(new RegExp("^ {1,"+ft+"}","gm"),"")),Ke!==yt-1&&(ot=this.rules.block.bullet.exec(je[Ke+1])[0],(Te?ot.length===1||!_e&&ot[ot.length-1]===")":ot.length>1||this.options.smartLists&&ot!==le)&&(rt=je.slice(Ke+1).join(`
|
|
`),ke.raw=ke.raw.substring(0,ke.raw.length-rt.length),Ke=yt-1)),Et=it||/\n\n(?!\s*$)/.test(Oe),Ke!==yt-1&&(it=Oe.charAt(Oe.length-1)===`
|
|
`,Et||(Et=it)),Et&&(ke.loose=!0),st=/^\[[ xX]\] /.test(Oe),vt=void 0,st&&(vt=Oe[1]!==" ",Oe=Oe.replace(/^\[[ xX]\] +/,"")),ke.items.push({type:"list_item",raw:re,task:st,checked:vt,loose:Et,text:Oe});return ke}},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 re=J[1].toLowerCase().replace(/\s+/g," ");return{tag:re,raw:J[0],href:J[2],title:J[3]}}},de.table=function(Q){var J=this.rules.block.table.exec(Q);if(J){var re={type:"table",header:H(J[1].replace(/^ *| *\| *$/g,"")),align:J[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:J[3]?J[3].replace(/\n$/,"").split(`
|
|
`):[]};if(re.header.length===re.align.length){re.raw=J[0];var le=re.align.length,Te;for(Te=0;Te<le;Te++)/^ *-+: *$/.test(re.align[Te])?re.align[Te]="right":/^ *:-+: *$/.test(re.align[Te])?re.align[Te]="center":/^ *:-+ *$/.test(re.align[Te])?re.align[Te]="left":re.align[Te]=null;for(le=re.cells.length,Te=0;Te<le;Te++)re.cells[Te]=H(re.cells[Te].replace(/^ *\| *| *\| *$/g,""),re.header.length);return re}}},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 re=this.rules.block.text.exec(Q);if(re){var le=J[J.length-1];return le&&le.type==="text"?{raw:re[0],text:re[0]}:{type:"text",raw:re[0],text:re[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,re){var le=this.rules.inline.tag.exec(Q);if(le)return!J&&/^<a /i.test(le[0])?J=!0:J&&/^<\/a>/i.test(le[0])&&(J=!1),!re&&/^<(pre|code|kbd|script)(\s|>)/i.test(le[0])?re=!0:re&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(le[0])&&(re=!1),{type:this.options.sanitize?"text":"html",raw:le[0],inLink:J,inRawBlock:re,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(le[0]):Y(le[0]):le[0]}},de.link=function(Q){var J=this.rules.inline.link.exec(Q);if(J){var re=ee(J[2],"()");if(re>-1){var le=J[0].indexOf("!")===0?5:4,Te=le+J[1].length+re;J[2]=J[2].substring(0,re),J[0]=J[0].substring(0,Te).trim(),J[3]=""}var _e=J[2],ke="";if(this.options.pedantic){var je=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(_e);je?(_e=je[1],ke=je[3]):ke=""}else ke=J[3]?J[3].slice(1,-1):"";_e=_e.trim().replace(/^<([\s\S]*)>$/,"$1");var it=oe(J,{href:_e&&_e.replace(this.rules.inline._escapes,"$1"),title:ke&&ke.replace(this.rules.inline._escapes,"$1")},J[0]);return it}},de.reflink=function(Q,J){var re;if((re=this.rules.inline.reflink.exec(Q))||(re=this.rules.inline.nolink.exec(Q))){var le=(re[2]||re[1]).replace(/\s+/g," ");if(le=J[le.toLowerCase()],!le||!le.href){var Te=re[0].charAt(0);return{type:"text",raw:Te,text:Te}}var _e=oe(re,le,re[0]);return _e}},de.strong=function(Q,J,re){re===void 0&&(re="");var le=this.rules.inline.strong.start.exec(Q);if(le&&(!le[1]||le[1]&&(re===""||this.rules.inline.punctuation.exec(re)))){J=J.slice(-1*Q.length);var Te=le[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;Te.lastIndex=0;for(var _e;(le=Te.exec(J))!=null;)if(_e=this.rules.inline.strong.middle.exec(J.slice(0,le.index+3)),_e)return{type:"strong",raw:Q.slice(0,_e[0].length),text:Q.slice(2,_e[0].length-2)}}},de.em=function(Q,J,re){re===void 0&&(re="");var le=this.rules.inline.em.start.exec(Q);if(le&&(!le[1]||le[1]&&(re===""||this.rules.inline.punctuation.exec(re)))){J=J.slice(-1*Q.length);var Te=le[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;Te.lastIndex=0;for(var _e;(le=Te.exec(J))!=null;)if(_e=this.rules.inline.em.middle.exec(J.slice(0,le.index+2)),_e)return{type:"em",raw:Q.slice(0,_e[0].length),text:Q.slice(1,_e[0].length-1)}}},de.codespan=function(Q){var J=this.rules.inline.code.exec(Q);if(J){var re=J[2].replace(/\n/g," "),le=/[^ ]/.test(re),Te=re.startsWith(" ")&&re.endsWith(" ");return le&&Te&&(re=re.substring(1,re.length-1)),re=Y(re,!0),{type:"codespan",raw:J[0],text:re}}},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 re=this.rules.inline.autolink.exec(Q);if(re){var le,Te;return re[2]==="@"?(le=Y(this.options.mangle?J(re[1]):re[1]),Te="mailto:"+le):(le=Y(re[1]),Te=le),{type:"link",raw:re[0],text:le,href:Te,tokens:[{type:"text",raw:le,text:le}]}}},de.url=function(Q,J){var re;if(re=this.rules.inline.url.exec(Q)){var le,Te;if(re[2]==="@")le=Y(this.options.mangle?J(re[0]):re[0]),Te="mailto:"+le;else{var _e;do _e=re[0],re[0]=this.rules.inline._backpedal.exec(re[0])[0];while(_e!==re[0]);le=Y(re[0]),re[1]==="www."?Te="http://"+le:Te=le}return{type:"link",raw:re[0],text:le,href:Te,tokens:[{type:"text",raw:le,text:le}]}}},de.inlineText=function(Q,J,re){var le=this.rules.inline.text.exec(Q);if(le){var Te;return J?Te=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(le[0]):Y(le[0]):le[0]:Te=Y(this.options.smartypants?re(le[0]):le[0]),{type:"text",raw:le[0],text:Te}}},ge}(),me=W.noopTest,he=W.edit,se=W.merge,ne={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6}) +([^\n]*?)(?: +#+)? *(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|<![A-Z][\\s\\S]*?>\\n*|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>\\n*|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:me,table:me,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};ne._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,ne._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,ne.def=he(ne.def).replace("label",ne._label).replace("title",ne._title).getRegex(),ne.bullet=/(?:[*+-]|\d{1,9}[.)])/,ne.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,ne.item=he(ne.item,"gm").replace(/bull/g,ne.bullet).getRegex(),ne.list=he(ne.list).replace(/bull/g,ne.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+ne.def.source+")").getRegex(),ne._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",ne._comment=/<!--(?!-?>)[\s\S]*?-->/,ne.html=he(ne.html,"i").replace("comment",ne._comment).replace("tag",ne._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ne.paragraph=he(ne._paragraph).replace("hr",ne.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",ne._tag).getRegex(),ne.blockquote=he(ne.blockquote).replace("paragraph",ne.paragraph).getRegex(),ne.normal=se({},ne),ne.gfm=se({},ne.normal,{nptable:"^ *([^|\\n ].*\\|.*)\\n *([-:]+ *\\|[-| :]*)(?:\\n((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)",table:"^ *\\|(.+)\\n *\\|?( *[-:]+[-| :]*)(?:\\n *((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),ne.gfm.nptable=he(ne.gfm.nptable).replace("hr",ne.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",ne._tag).getRegex(),ne.gfm.table=he(ne.gfm.table).replace("hr",ne.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)").replace("tag",ne._tag).getRegex(),ne.pedantic=se({},ne.normal,{html:he(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ne._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,fences:me,paragraph:he(ne.normal._paragraph).replace("hr",ne.hr).replace("heading",` *#{1,6} *[^
|
|
]`).replace("lheading",ne.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var ce={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:me,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:me,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};ce._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",ce.punctuation=he(ce.punctuation).replace(/punctuation/g,ce._punctuation).getRegex(),ce._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",ce._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",ce.em.start=he(ce.em.start).replace(/punctuation/g,ce._punctuation).getRegex(),ce.em.middle=he(ce.em.middle).replace(/punctuation/g,ce._punctuation).replace(/overlapSkip/g,ce._overlapSkip).getRegex(),ce.em.endAst=he(ce.em.endAst,"g").replace(/punctuation/g,ce._punctuation).getRegex(),ce.em.endUnd=he(ce.em.endUnd,"g").replace(/punctuation/g,ce._punctuation).getRegex(),ce.strong.start=he(ce.strong.start).replace(/punctuation/g,ce._punctuation).getRegex(),ce.strong.middle=he(ce.strong.middle).replace(/punctuation/g,ce._punctuation).replace(/blockSkip/g,ce._blockSkip).getRegex(),ce.strong.endAst=he(ce.strong.endAst,"g").replace(/punctuation/g,ce._punctuation).getRegex(),ce.strong.endUnd=he(ce.strong.endUnd,"g").replace(/punctuation/g,ce._punctuation).getRegex(),ce.blockSkip=he(ce._blockSkip,"g").getRegex(),ce.overlapSkip=he(ce._overlapSkip,"g").getRegex(),ce._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,ce._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,ce._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])?)+(?![-_])/,ce.autolink=he(ce.autolink).replace("scheme",ce._scheme).replace("email",ce._email).getRegex(),ce._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,ce.tag=he(ce.tag).replace("comment",ne._comment).replace("attribute",ce._attribute).getRegex(),ce._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,ce._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,ce._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,ce.link=he(ce.link).replace("label",ce._label).replace("href",ce._href).replace("title",ce._title).getRegex(),ce.reflink=he(ce.reflink).replace("label",ce._label).getRegex(),ce.reflinkSearch=he(ce.reflinkSearch,"g").replace("reflink",ce.reflink).replace("nolink",ce.nolink).getRegex(),ce.normal=se({},ce),ce.pedantic=se({},ce.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:he(/^!?\[(label)\]\((.*?)\)/).replace("label",ce._label).getRegex(),reflink:he(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ce._label).getRegex()}),ce.gfm=se({},ce.normal,{escape:he(ce.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),ce.gfm.url=he(ce.gfm.url,"i").replace("email",ce.gfm._extended_email).getRegex(),ce.breaks=se({},ce.gfm,{br:he(ce.br).replace("{2,}","*").getRegex(),text:he(ce.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var $={block:ne,inline:ce},ie=F.defaults,Z=$.block,ye=$.inline;function Ce(ge){return ge.replace(/---/g,"\u2014").replace(/--/g,"\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1\u201C").replace(/"/g,"\u201D").replace(/\.{3}/g,"\u2026")}function ve(ge){var de="",fe,Q,J=ge.length;for(fe=0;fe<J;fe++)Q=ge.charCodeAt(fe),Math.random()>.5&&(Q="x"+Q.toString(16)),de+="&#"+Q+";";return de}var we=function(){function ge(fe){this.tokens=[],this.tokens.links=Object.create(null),this.options=fe||ie,this.options.tokenizer=this.options.tokenizer||new pe,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var Q={block:Z.normal,inline:ye.normal};this.options.pedantic?(Q.block=Z.pedantic,Q.inline=ye.pedantic):this.options.gfm&&(Q.block=Z.gfm,this.options.breaks?Q.inline=ye.breaks:Q.inline=ye.gfm),this.tokenizer.rules=Q}ge.lex=function(Q,J){var re=new ge(J);return re.lex(Q)};var de=ge.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,re){J===void 0&&(J=[]),re===void 0&&(re=!0),Q=Q.replace(/^ +$/gm,"");for(var le,Te,_e,ke;Q;){if(le=this.tokenizer.space(Q)){Q=Q.substring(le.raw.length),le.type&&J.push(le);continue}if(le=this.tokenizer.code(Q,J)){Q=Q.substring(le.raw.length),le.type?J.push(le):(ke=J[J.length-1],ke.raw+=`
|
|
`+le.raw,ke.text+=`
|
|
`+le.text);continue}if(le=this.tokenizer.fences(Q)){Q=Q.substring(le.raw.length),J.push(le);continue}if(le=this.tokenizer.heading(Q)){Q=Q.substring(le.raw.length),J.push(le);continue}if(le=this.tokenizer.nptable(Q)){Q=Q.substring(le.raw.length),J.push(le);continue}if(le=this.tokenizer.hr(Q)){Q=Q.substring(le.raw.length),J.push(le);continue}if(le=this.tokenizer.blockquote(Q)){Q=Q.substring(le.raw.length),le.tokens=this.blockTokens(le.text,[],re),J.push(le);continue}if(le=this.tokenizer.list(Q)){for(Q=Q.substring(le.raw.length),_e=le.items.length,Te=0;Te<_e;Te++)le.items[Te].tokens=this.blockTokens(le.items[Te].text,[],!1);J.push(le);continue}if(le=this.tokenizer.html(Q)){Q=Q.substring(le.raw.length),J.push(le);continue}if(re&&(le=this.tokenizer.def(Q))){Q=Q.substring(le.raw.length),this.tokens.links[le.tag]||(this.tokens.links[le.tag]={href:le.href,title:le.title});continue}if(le=this.tokenizer.table(Q)){Q=Q.substring(le.raw.length),J.push(le);continue}if(le=this.tokenizer.lheading(Q)){Q=Q.substring(le.raw.length),J.push(le);continue}if(re&&(le=this.tokenizer.paragraph(Q))){Q=Q.substring(le.raw.length),J.push(le);continue}if(le=this.tokenizer.text(Q,J)){Q=Q.substring(le.raw.length),le.type?J.push(le):(ke=J[J.length-1],ke.raw+=`
|
|
`+le.raw,ke.text+=`
|
|
`+le.text);continue}if(Q){var je="Infinite loop on byte: "+Q.charCodeAt(0);if(this.options.silent){console.error(je);break}else throw new Error(je)}}return J},de.inline=function(Q){var J,re,le,Te,_e,ke,je=Q.length;for(J=0;J<je;J++){ke=Q[J];switch(ke.type){case"paragraph":case"text":case"heading":{ke.tokens=[],this.inlineTokens(ke.text,ke.tokens);break}case"table":{for(ke.tokens={header:[],cells:[]},Te=ke.header.length,re=0;re<Te;re++)ke.tokens.header[re]=[],this.inlineTokens(ke.header[re],ke.tokens.header[re]);for(Te=ke.cells.length,re=0;re<Te;re++)for(_e=ke.cells[re],ke.tokens.cells[re]=[],le=0;le<_e.length;le++)ke.tokens.cells[re][le]=[],this.inlineTokens(_e[le],ke.tokens.cells[re][le]);break}case"blockquote":{this.inline(ke.tokens);break}case"list":{for(Te=ke.items.length,re=0;re<Te;re++)this.inline(ke.items[re].tokens);break}}}return Q},de.inlineTokens=function(Q,J,re,le,Te){J===void 0&&(J=[]),re===void 0&&(re=!1),le===void 0&&(le=!1),Te===void 0&&(Te="");var _e,ke=Q,je;if(this.tokens.links){var it=Object.keys(this.tokens.links);if(it.length>0)for(;(je=this.tokenizer.rules.inline.reflinkSearch.exec(ke))!=null;)it.includes(je[0].slice(je[0].lastIndexOf("[")+1,-1))&&(ke=ke.slice(0,je.index)+"["+"a".repeat(je[0].length-2)+"]"+ke.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(je=this.tokenizer.rules.inline.blockSkip.exec(ke))!=null;)ke=ke.slice(0,je.index)+"["+"a".repeat(je[0].length-2)+"]"+ke.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;Q;){if(_e=this.tokenizer.escape(Q)){Q=Q.substring(_e.raw.length),J.push(_e);continue}if(_e=this.tokenizer.tag(Q,re,le)){Q=Q.substring(_e.raw.length),re=_e.inLink,le=_e.inRawBlock,J.push(_e);continue}if(_e=this.tokenizer.link(Q)){Q=Q.substring(_e.raw.length),_e.type==="link"&&(_e.tokens=this.inlineTokens(_e.text,[],!0,le)),J.push(_e);continue}if(_e=this.tokenizer.reflink(Q,this.tokens.links)){Q=Q.substring(_e.raw.length),_e.type==="link"&&(_e.tokens=this.inlineTokens(_e.text,[],!0,le)),J.push(_e);continue}if(_e=this.tokenizer.strong(Q,ke,Te)){Q=Q.substring(_e.raw.length),_e.tokens=this.inlineTokens(_e.text,[],re,le),J.push(_e);continue}if(_e=this.tokenizer.em(Q,ke,Te)){Q=Q.substring(_e.raw.length),_e.tokens=this.inlineTokens(_e.text,[],re,le),J.push(_e);continue}if(_e=this.tokenizer.codespan(Q)){Q=Q.substring(_e.raw.length),J.push(_e);continue}if(_e=this.tokenizer.br(Q)){Q=Q.substring(_e.raw.length),J.push(_e);continue}if(_e=this.tokenizer.del(Q)){Q=Q.substring(_e.raw.length),_e.tokens=this.inlineTokens(_e.text,[],re,le),J.push(_e);continue}if(_e=this.tokenizer.autolink(Q,ve)){Q=Q.substring(_e.raw.length),J.push(_e);continue}if(!re&&(_e=this.tokenizer.url(Q,ve))){Q=Q.substring(_e.raw.length),J.push(_e);continue}if(_e=this.tokenizer.inlineText(Q,le,Ce)){Q=Q.substring(_e.raw.length),Te=_e.raw.slice(-1),J.push(_e);continue}if(Q){var Oe="Infinite loop on byte: "+Q.charCodeAt(0);if(this.options.silent){console.error(Oe);break}else throw new Error(Oe)}}return J},G(ge,null,[{key:"rules",get:function(){return{block:Z,inline:ye}}}]),ge}(),Ae=F.defaults,Re=W.cleanUrl,Ie=W.escape,Me=function(){function ge(fe){this.options=fe||Ae}var de=ge.prototype;return de.code=function(Q,J,re){var le=(J||"").match(/\S*/)[0];if(this.options.highlight){var Te=this.options.highlight(Q,le);Te!=null&&Te!==Q&&(re=!0,Q=Te)}return le?'<pre><code class="'+this.options.langPrefix+Ie(le,!0)+'">'+(re?Q:Ie(Q,!0))+`</code></pre>
|
|
`:"<pre><code>"+(re?Q:Ie(Q,!0))+`</code></pre>
|
|
`},de.blockquote=function(Q){return`<blockquote>
|
|
`+Q+`</blockquote>
|
|
`},de.html=function(Q){return Q},de.heading=function(Q,J,re,le){return this.options.headerIds?"<h"+J+' id="'+this.options.headerPrefix+le.slug(re)+'">'+Q+"</h"+J+`>
|
|
`:"<h"+J+">"+Q+"</h"+J+`>
|
|
`},de.hr=function(){return this.options.xhtml?`<hr/>
|
|
`:`<hr>
|
|
`},de.list=function(Q,J,re){var le=J?"ol":"ul",Te=J&&re!==1?' start="'+re+'"':"";return"<"+le+Te+`>
|
|
`+Q+"</"+le+`>
|
|
`},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 re=J.header?"th":"td",le=J.align?"<"+re+' align="'+J.align+'">':"<"+re+">";return le+Q+"</"+re+`>
|
|
`},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,re){if(Q=Re(this.options.sanitize,this.options.baseUrl,Q),Q===null)return re;var le='<a href="'+Ie(Q)+'"';return J&&(le+=' title="'+J+'"'),le+=">"+re+"</a>",le},de.image=function(Q,J,re){if(Q=Re(this.options.sanitize,this.options.baseUrl,Q),Q===null)return re;var le='<img src="'+Q+'" alt="'+re+'"';return J&&(le+=' title="'+J+'"'),le+=this.options.xhtml?"/>":">",le},de.text=function(Q){return Q},ge}(),De=function(){function ge(){}var de=ge.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,re){return""+re},de.image=function(Q,J,re){return""+re},de.br=function(){return""},ge}(),Ve=function(){function ge(){this.seen={}}var de=ge.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 re=J;do this.seen[re]++,J=re+"-"+this.seen[re];while(this.seen.hasOwnProperty(J))}return this.seen[J]=0,J},ge}(),et=F.defaults,ze=W.unescape,Xe=function(){function ge(fe){this.options=fe||et,this.options.renderer=this.options.renderer||new Me,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new De,this.slugger=new Ve}ge.parse=function(Q,J){var re=new ge(J);return re.parse(Q)};var de=ge.prototype;return de.parse=function(Q,J){J===void 0&&(J=!0);var re="",le,Te,_e,ke,je,it,Oe,ft,ot,rt,Et,st,vt,yt,Ke,Qt,Mt,Bt,kt=Q.length;for(le=0;le<kt;le++){rt=Q[le];switch(rt.type){case"space":continue;case"hr":{re+=this.renderer.hr();continue}case"heading":{re+=this.renderer.heading(this.parseInline(rt.tokens),rt.depth,ze(this.parseInline(rt.tokens,this.textRenderer)),this.slugger);continue}case"code":{re+=this.renderer.code(rt.text,rt.lang,rt.escaped);continue}case"table":{for(ft="",Oe="",ke=rt.header.length,Te=0;Te<ke;Te++)Oe+=this.renderer.tablecell(this.parseInline(rt.tokens.header[Te]),{header:!0,align:rt.align[Te]});for(ft+=this.renderer.tablerow(Oe),ot="",ke=rt.cells.length,Te=0;Te<ke;Te++){for(it=rt.tokens.cells[Te],Oe="",je=it.length,_e=0;_e<je;_e++)Oe+=this.renderer.tablecell(this.parseInline(it[_e]),{header:!1,align:rt.align[_e]});ot+=this.renderer.tablerow(Oe)}re+=this.renderer.table(ft,ot);continue}case"blockquote":{ot=this.parse(rt.tokens),re+=this.renderer.blockquote(ot);continue}case"list":{for(Et=rt.ordered,st=rt.start,vt=rt.loose,ke=rt.items.length,ot="",Te=0;Te<ke;Te++)Ke=rt.items[Te],Qt=Ke.checked,Mt=Ke.task,yt="",Ke.task&&(Bt=this.renderer.checkbox(Qt),vt?Ke.tokens.length>0&&Ke.tokens[0].type==="text"?(Ke.tokens[0].text=Bt+" "+Ke.tokens[0].text,Ke.tokens[0].tokens&&Ke.tokens[0].tokens.length>0&&Ke.tokens[0].tokens[0].type==="text"&&(Ke.tokens[0].tokens[0].text=Bt+" "+Ke.tokens[0].tokens[0].text)):Ke.tokens.unshift({type:"text",text:Bt}):yt+=Bt),yt+=this.parse(Ke.tokens,vt),ot+=this.renderer.listitem(yt,Mt,Qt);re+=this.renderer.list(ot,Et,st);continue}case"html":{re+=this.renderer.html(rt.text);continue}case"paragraph":{re+=this.renderer.paragraph(this.parseInline(rt.tokens));continue}case"text":{for(ot=rt.tokens?this.parseInline(rt.tokens):rt.text;le+1<kt&&Q[le+1].type==="text";)rt=Q[++le],ot+=`
|
|
`+(rt.tokens?this.parseInline(rt.tokens):rt.text);re+=J?this.renderer.paragraph(ot):ot;continue}default:{var fr='Token with "'+rt.type+'" type was not found.';if(this.options.silent){console.error(fr);return}else throw new Error(fr)}}}return re},de.parseInline=function(Q,J){J=J||this.renderer;var re="",le,Te,_e=Q.length;for(le=0;le<_e;le++){Te=Q[le];switch(Te.type){case"escape":{re+=J.text(Te.text);break}case"html":{re+=J.html(Te.text);break}case"link":{re+=J.link(Te.href,Te.title,this.parseInline(Te.tokens,J));break}case"image":{re+=J.image(Te.href,Te.title,Te.text);break}case"strong":{re+=J.strong(this.parseInline(Te.tokens,J));break}case"em":{re+=J.em(this.parseInline(Te.tokens,J));break}case"codespan":{re+=J.codespan(Te.text);break}case"br":{re+=J.br();break}case"del":{re+=J.del(this.parseInline(Te.tokens,J));break}case"text":{re+=J.text(Te.text);break}default:{var ke='Token with "'+Te.type+'" type was not found.';if(this.options.silent){console.error(ke);return}else throw new Error(ke)}}}return re},ge}(),qe=W.merge,He=W.checkSanitizeDeprecation,Be=W.escape,Se=F.getDefaults,Ze=F.changeDefaults,Je=F.defaults;function Le(ge,de,fe){if(typeof ge=="undefined"||ge===null)throw new Error("marked(): input parameter is undefined or null");if(typeof ge!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(ge)+", string expected");if(typeof de=="function"&&(fe=de,de=null),de=qe({},Le.defaults,de||{}),He(de),fe){var Q=de.highlight,J;try{J=we.lex(ge,de)}catch(_e){return fe(_e)}var re=function(ke){var je;if(!ke)try{je=Xe.parse(J,de)}catch(it){ke=it}return de.highlight=Q,ke?fe(ke):fe(null,je)};if(!Q||Q.length<3)return re();if(delete de.highlight,!J.length)return re();var le=0;Le.walkTokens(J,function(_e){_e.type==="code"&&(le++,setTimeout(function(){Q(_e.text,_e.lang,function(ke,je){if(ke)return re(ke);je!=null&&je!==_e.text&&(_e.text=je,_e.escaped=!0),le--,le===0&&re()})},0))}),le===0&&re();return}try{var Te=we.lex(ge,de);return de.walkTokens&&Le.walkTokens(Te,de.walkTokens),Xe.parse(Te,de)}catch(_e){if(_e.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,de.silent)return"<p>An error occurred:</p><pre>"+Be(_e.message+"",!0)+"</pre>";throw _e}}Le.options=Le.setOptions=function(ge){return qe(Le.defaults,ge),Ze(Le.defaults),Le},Le.getDefaults=Se,Le.defaults=Je,Le.use=function(ge){var de=qe({},ge);if(ge.renderer&&function(){var Q=Le.defaults.renderer||new Me,J=function(Te){var _e=Q[Te];Q[Te]=function(){for(var ke=arguments.length,je=new Array(ke),it=0;it<ke;it++)je[it]=arguments[it];var Oe=ge.renderer[Te].apply(Q,je);return Oe===!1&&(Oe=_e.apply(Q,je)),Oe}};for(var re in ge.renderer)J(re);de.renderer=Q}(),ge.tokenizer&&function(){var Q=Le.defaults.tokenizer||new pe,J=function(Te){var _e=Q[Te];Q[Te]=function(){for(var ke=arguments.length,je=new Array(ke),it=0;it<ke;it++)je[it]=arguments[it];var Oe=ge.tokenizer[Te].apply(Q,je);return Oe===!1&&(Oe=_e.apply(Q,je)),Oe}};for(var re in ge.tokenizer)J(re);de.tokenizer=Q}(),ge.walkTokens){var fe=Le.defaults.walkTokens;de.walkTokens=function(Q){ge.walkTokens(Q),fe&&fe(Q)}}Le.setOptions(de)},Le.walkTokens=function(ge,de){for(var fe=U(ge),Q;!(Q=fe()).done;){var J=Q.value;de(J);switch(J.type){case"table":{for(var re=U(J.tokens.header),le;!(le=re()).done;){var Te=le.value;Le.walkTokens(Te,de)}for(var _e=U(J.tokens.cells),ke;!(ke=_e()).done;)for(var je=ke.value,it=U(je),Oe;!(Oe=it()).done;){var ft=Oe.value;Le.walkTokens(ft,de)}break}case"list":{Le.walkTokens(J.items,de);break}default:J.tokens&&Le.walkTokens(J.tokens,de)}}},Le.Parser=Xe,Le.parser=Xe.parse,Le.Renderer=Me,Le.TextRenderer=De,Le.Lexer=we,Le.lexer=we.lex,Le.Tokenizer=pe,Le.Slugger=Ve,Le.parse=Le;var Ue=Le;return Ue})},ELLl:function(nt,Qe,te){(function(q){q(te("VrN/"))})(function(q){var G={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},D=q.Pos;q.defineOption("autoCloseBrackets",!1,function(b,f,u){u&&u!=q.Init&&(b.removeKeyMap(U),b.state.closeBrackets=null),f&&(O(z(f,"pairs")),b.state.closeBrackets=f,b.addKeyMap(U))});function z(b,f){return f=="pairs"&&typeof b=="string"?b:typeof b=="object"&&b[f]!=null?b[f]:G[f]}var U={Backspace:R,Enter:C};function O(b){for(var f=0;f<b.length;f++){var u=b.charAt(f),a="'"+u+"'";U[a]||(U[a]=F(u))}}O(G.pairs+"`");function F(b){return function(f){return v(f,b)}}function M(b){var f=b.state.closeBrackets;if(!f||f.override)return f;var u=b.getModeAt(b.getCursor());return u.closeBrackets||f}function R(b){var f=M(b);if(!f||b.getOption("disableInput"))return q.Pass;for(var u=z(f,"pairs"),a=b.listSelections(),s=0;s<a.length;s++){if(!a[s].empty())return q.Pass;var l=k(b,a[s].head);if(!l||u.indexOf(l)%2!=0)return q.Pass}for(var s=a.length-1;s>=0;s--){var A=a[s].head;b.replaceRange("",D(A.line,A.ch-1),D(A.line,A.ch+1),"+delete")}}function C(b){var f=M(b),u=f&&z(f,"explode");if(!u||b.getOption("disableInput"))return q.Pass;for(var a=b.listSelections(),s=0;s<a.length;s++){if(!a[s].empty())return q.Pass;var l=k(b,a[s].head);if(!l||u.indexOf(l)%2!=0)return q.Pass}b.operation(function(){var A=b.lineSeparator()||`
|
|
`;b.replaceSelection(A+A,null),b.execCommand("goCharLeft"),a=b.listSelections();for(var y=0;y<a.length;y++){var c=a[y].head.line;b.indentLine(c,null,!0),b.indentLine(c+1,null,!0)}})}function m(b){var f=q.cmpPos(b.anchor,b.head)>0;return{anchor:new D(b.anchor.line,b.anchor.ch+(f?-1:1)),head:new D(b.head.line,b.head.ch+(f?1:-1))}}function v(b,f){var u=M(b);if(!u||b.getOption("disableInput"))return q.Pass;var a=z(u,"pairs"),s=a.indexOf(f);if(s==-1)return q.Pass;for(var l=z(u,"closeBefore"),A=z(u,"triples"),y=a.charAt(s+1)==f,c=b.listSelections(),L=s%2==0,x,h=0;h<c.length;h++){var p=c[h],d=p.head,o,T=b.getRange(d,D(d.line,d.ch+1));if(L&&!p.empty())o="surround";else if((y||!L)&&T==f)y&&S(b,d)?o="both":A.indexOf(f)>=0&&b.getRange(d,D(d.line,d.ch+3))==f+f+f?o="skipThree":o="skip";else if(y&&d.ch>1&&A.indexOf(f)>=0&&b.getRange(D(d.line,d.ch-2),d)==f+f){if(d.ch>2&&/\bstring/.test(b.getTokenTypeAt(D(d.line,d.ch-2))))return q.Pass;o="addFour"}else if(y){var E=d.ch==0?" ":b.getRange(D(d.line,d.ch-1),d);if(!q.isWordChar(T)&&E!=f&&!q.isWordChar(E))o="both";else return q.Pass}else if(L&&(T.length===0||/\s/.test(T)||l.indexOf(T)>-1))o="both";else return q.Pass;if(!x)x=o;else if(x!=o)return q.Pass}var g=s%2?a.charAt(s-1):f,_=s%2?f:a.charAt(s+1);b.operation(function(){if(x=="skip")b.execCommand("goCharRight");else if(x=="skipThree")for(var N=0;N<3;N++)b.execCommand("goCharRight");else if(x=="surround"){for(var B=b.getSelections(),N=0;N<B.length;N++)B[N]=g+B[N]+_;b.replaceSelections(B,"around"),B=b.listSelections().slice();for(var N=0;N<B.length;N++)B[N]=m(B[N]);b.setSelections(B)}else x=="both"?(b.replaceSelection(g+_,null),b.triggerElectric(g+_),b.execCommand("goCharLeft")):x=="addFour"&&(b.replaceSelection(g+g+g+g,"before"),b.execCommand("goCharRight"))})}function k(b,f){var u=b.getRange(D(f.line,f.ch-1),D(f.line,f.ch+1));return u.length==2?u:null}function S(b,f){var u=b.getTokenAt(D(f.line,f.ch+1));return/\bstring/.test(u.type)&&u.start==f.ch&&(f.ch==0||!/\bstring/.test(b.getTokenTypeAt(f)))}})},GfqC:function(nt,Qe,te){"use strict";var q=te("cDcd"),G=te.n(q),D=te("TSYQ"),z=te.n(D);function U(W,P){var I="cannot "+W.method+" "+W.action+" "+P.status+"'",H=new Error(I);return H.status=P.status,H.method=W.method,H.url=W.action,H}function O(W){var P=W.responseText||W.response;if(!P)return P;try{return JSON.parse(P)}catch(I){return P}}function F(W){var P=new XMLHttpRequest;W.onProgress&&P.upload&&(P.upload.onprogress=function(ee){ee.total>0&&(ee.percent=ee.loaded/ee.total*100),W.onProgress(ee)});var I=new FormData;W.data&&Object.keys(W.data).forEach(function(Y){var ee=W.data[Y];if(Array.isArray(ee)){ee.forEach(function(oe){I.append(Y+"[]",oe)});return}I.append(Y,W.data[Y])}),W.file instanceof Blob?I.append(W.filename,W.file,W.file.name):I.append(W.filename,W.file),P.onerror=function(ee){W.onError(ee)},P.onload=function(){return P.status<200||P.status>=300?W.onError(U(W,P),O(P)):W.onSuccess(O(P),P)},P.open(W.method,W.action,!0),W.withCredentials&&"withCredentials"in P&&(P.withCredentials=!0);var H=W.headers||{};return H["X-Requested-With"]!==null&&P.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(H).forEach(function(Y){H[Y]!==null&&P.setRequestHeader(Y,H[Y])}),P.send(I),{abort:function(){P.abort()}}}var M=+new Date,R=0;function C(){return"rc-upload-"+M+"-"+ ++R}function m(W,P){return W.indexOf(P,W.length-P.length)!==-1}var v=function(W,P){if(W&&P){var I=Array.isArray(P)?P:P.split(","),H=W.name||"",Y=W.type||"",ee=Y.replace(/\/.*$/,"");return I.some(function(oe){var Ee=oe.trim();return Ee.charAt(0)==="."?m(H.toLowerCase(),Ee.toLowerCase()):/\/\*$/.test(Ee)?ee===Ee.replace(/\/.*$/,""):Y===Ee})}return!0};function k(W,P){var I=W.createReader(),H=[];function Y(){I.readEntries(function(ee){var oe=Array.prototype.slice.apply(ee);H=H.concat(oe);var Ee=!oe.length;Ee?P(H):Y()})}Y()}var S=function(P,I,H){var Y=function ee(oe,Ee){Ee=Ee||"",oe.isFile?oe.file(function(pe){H(pe)&&(oe.fullPath&&!pe.webkitRelativePath&&(Object.defineProperties(pe,{webkitRelativePath:{writable:!0}}),pe.webkitRelativePath=oe.fullPath.replace(/^\//,""),Object.defineProperties(pe,{webkitRelativePath:{writable:!1}})),I([pe]))}):oe.isDirectory&&k(oe,function(pe){pe.forEach(function(me){ee(me,""+Ee+oe.name+"/")})})};P.forEach(function(ee){Y(ee.webkitGetAsEntry())})},b=S,f=Object.assign||function(W){for(var P=1;P<arguments.length;P++){var I=arguments[P];for(var H in I)Object.prototype.hasOwnProperty.call(I,H)&&(W[H]=I[H])}return W},u=function(){function W(P,I){var H=[],Y=!0,ee=!1,oe=void 0;try{for(var Ee=P[Symbol.iterator](),pe;!(Y=(pe=Ee.next()).done)&&!(H.push(pe.value),I&&H.length===I);Y=!0);}catch(me){ee=!0,oe=me}finally{try{!Y&&Ee.return&&Ee.return()}finally{if(ee)throw oe}}return H}return function(P,I){if(Array.isArray(P))return P;if(Symbol.iterator in Object(P))return W(P,I);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),a=function(){function W(P,I){for(var H=0;H<I.length;H++){var Y=I[H];Y.enumerable=Y.enumerable||!1,Y.configurable=!0,"value"in Y&&(Y.writable=!0),Object.defineProperty(P,Y.key,Y)}}return function(P,I,H){return I&&W(P.prototype,I),H&&W(P,H),P}}();function s(W,P,I){return P in W?Object.defineProperty(W,P,{value:I,enumerable:!0,configurable:!0,writable:!0}):W[P]=I,W}function l(W,P){var I={};for(var H in W){if(P.indexOf(H)>=0)continue;if(!Object.prototype.hasOwnProperty.call(W,H))continue;I[H]=W[H]}return I}function A(W,P){if(!(W instanceof P))throw new TypeError("Cannot call a class as a function")}function y(W,P){if(!W)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return P&&(typeof P=="object"||typeof P=="function")?P:W}function c(W,P){if(typeof P!="function"&&P!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof P);W.prototype=Object.create(P&&P.prototype,{constructor:{value:W,enumerable:!1,writable:!0,configurable:!0}}),P&&(Object.setPrototypeOf?Object.setPrototypeOf(W,P):W.__proto__=P)}var L=function(P){return Object.keys(P).reduce(function(I,H){return(H.substr(0,5)==="data-"||H.substr(0,5)==="aria-"||H==="role")&&(I[H]=P[H]),I},{})},x=function(W){c(P,W);function P(){var I,H,Y,ee;A(this,P);for(var oe=arguments.length,Ee=Array(oe),pe=0;pe<oe;pe++)Ee[pe]=arguments[pe];return ee=(H=(Y=y(this,(I=P.__proto__||Object.getPrototypeOf(P)).call.apply(I,[this].concat(Ee))),Y),Y.state={uid:C()},Y.reqs={},Y.onChange=function(me){var he=me.target.files;Y.uploadFiles(he),Y.reset()},Y.onClick=function(me){var he=Y.fileInput;if(!he)return;var se=Y.props,ne=se.children,ce=se.onClick;ne&&ne.type==="button"&&(he.parentNode.focus(),he.parentNode.querySelector("button").blur()),he.click(),ce&&ce(me)},Y.onKeyDown=function(me){me.key==="Enter"&&Y.onClick()},Y.onFileDrop=function(me){var he=Y.props.multiple;if(me.preventDefault(),me.type==="dragover")return;if(Y.props.directory)b(Array.prototype.slice.call(me.dataTransfer.items),Y.uploadFiles,function(ne){return v(ne,Y.props.accept)});else{var se=Array.prototype.slice.call(me.dataTransfer.files).filter(function(ne){return v(ne,Y.props.accept)});he===!1&&(se=se.slice(0,1)),Y.uploadFiles(se)}},Y.uploadFiles=function(me){var he=Array.prototype.slice.call(me);he.map(function(se){return se.uid=C(),se}).forEach(function(se){Y.upload(se,he)})},Y.saveFileInput=function(me){Y.fileInput=me},H),y(Y,ee)}return a(P,[{key:"componentDidMount",value:function(){this._isMounted=!0}},{key:"componentWillUnmount",value:function(){this._isMounted=!1,this.abort()}},{key:"upload",value:function(H,Y){var ee=this,oe=this.props;if(!oe.beforeUpload)return setTimeout(function(){return ee.post(H)},0);var Ee=oe.beforeUpload(H,Y);Ee&&Ee.then?Ee.then(function(pe){var me=Object.prototype.toString.call(pe);return me==="[object File]"||me==="[object Blob]"?ee.post(pe):ee.post(H)}).catch(function(pe){console.log(pe)}):Ee!==!1&&setTimeout(function(){return ee.post(H)},0);return}},{key:"post",value:function(H){var Y=this;if(!this._isMounted)return;var ee=this.props,oe=ee.onStart,Ee=ee.onProgress,pe=ee.transformFile,me=pe===void 0?function(he){return he}:pe;new Promise(function(he){var se=ee.action;return typeof se=="function"&&(se=se(H)),he(se)}).then(function(he){var se=H.uid,ne=ee.customRequest||F,ce=Promise.resolve(me(H)).then(function($){var ie=ee.data;return typeof ie=="function"&&(ie=ie($)),Promise.all([$,ie])}).catch(function($){console.error($)});ce.then(function($){var ie=u($,2),Z=ie[0],ye=ie[1],Ce={action:he,filename:ee.name,data:ye,file:Z,headers:ee.headers,withCredentials:ee.withCredentials,method:ee.method||"post",onProgress:Ee?function(ve){Ee(ve,H)}:null,onSuccess:function(we,Ae){delete Y.reqs[se],ee.onSuccess(we,H,Ae)},onError:function(we,Ae){delete Y.reqs[se],ee.onError(we,Ae,H)}};oe(H),Y.reqs[se]=ne(Ce)})})}},{key:"reset",value:function(){this.setState({uid:C()})}},{key:"abort",value:function(H){var Y=this.reqs;if(H){var ee=H;H&&H.uid&&(ee=H.uid),Y[ee]&&Y[ee].abort&&Y[ee].abort(),delete Y[ee]}else Object.keys(Y).forEach(function(oe){Y[oe]&&Y[oe].abort&&Y[oe].abort(),delete Y[oe]})}},{key:"render",value:function(){var H,Y=this.props,ee=Y.component,oe=Y.prefixCls,Ee=Y.className,pe=Y.disabled,me=Y.id,he=Y.style,se=Y.multiple,ne=Y.accept,ce=Y.children,$=Y.directory,ie=Y.openFileDialogOnClick,Z=Y.onMouseEnter,ye=Y.onMouseLeave,Ce=l(Y,["component","prefixCls","className","disabled","id","style","multiple","accept","children","directory","openFileDialogOnClick","onMouseEnter","onMouseLeave"]),ve=z()((H={},s(H,oe,!0),s(H,oe+"-disabled",pe),s(H,Ee,Ee),H)),we=pe?{}:{onClick:ie?this.onClick:function(){},onKeyDown:ie?this.onKeyDown:function(){},onMouseEnter:Z,onMouseLeave:ye,onDrop:this.onFileDrop,onDragOver:this.onFileDrop,tabIndex:"0"};return G.a.createElement(ee,f({},we,{className:ve,role:"button",style:he}),G.a.createElement("input",f({},L(Ce),{id:me,type:"file",ref:this.saveFileInput,onClick:function(Re){return Re.stopPropagation()},key:this.state.uid,style:{display:"none"},accept:ne,directory:$?"directory":null,webkitdirectory:$?"webkitdirectory":null,multiple:se,onChange:this.onChange})),ce)}}]),P}(q.Component),h=x,p=Object.assign||function(W){for(var P=1;P<arguments.length;P++){var I=arguments[P];for(var H in I)Object.prototype.hasOwnProperty.call(I,H)&&(W[H]=I[H])}return W},d=function(){function W(P,I){for(var H=0;H<I.length;H++){var Y=I[H];Y.enumerable=Y.enumerable||!1,Y.configurable=!0,"value"in Y&&(Y.writable=!0),Object.defineProperty(P,Y.key,Y)}}return function(P,I,H){return I&&W(P.prototype,I),H&&W(P,H),P}}();function o(W,P){if(!(W instanceof P))throw new TypeError("Cannot call a class as a function")}function T(W,P){if(!W)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return P&&(typeof P=="object"||typeof P=="function")?P:W}function E(W,P){if(typeof P!="function"&&P!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof P);W.prototype=Object.create(P&&P.prototype,{constructor:{value:W,enumerable:!1,writable:!0,configurable:!0}}),P&&(Object.setPrototypeOf?Object.setPrototypeOf(W,P):W.__proto__=P)}function g(){}var _=function(W){E(P,W);function P(){var I,H,Y,ee;o(this,P);for(var oe=arguments.length,Ee=Array(oe),pe=0;pe<oe;pe++)Ee[pe]=arguments[pe];return ee=(H=(Y=T(this,(I=P.__proto__||Object.getPrototypeOf(P)).call.apply(I,[this].concat(Ee))),Y),Y.saveUploader=function(me){Y.uploader=me},H),T(Y,ee)}return d(P,[{key:"abort",value:function(H){this.uploader.abort(H)}},{key:"render",value:function(){return G.a.createElement(h,p({},this.props,{ref:this.saveUploader}))}}]),P}(q.Component);_.defaultProps={component:"span",prefixCls:"rc-upload",data:{},headers:{},name:"file",multipart:!1,onStart:g,onError:g,onSuccess:g,multiple:!1,beforeUpload:null,customRequest:null,withCredentials:!1,openFileDialogOnClick:!0};var N=_,B=Qe.a=N},H38U:function(nt,Qe,te){var q=te("f4xo"),G=te("rcnY"),D=te("wU8J"),z=te("Iq15"),U=te("dWSS");function O(M,R){this.typeNumber=M,this.errorCorrectLevel=R,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}var F=O.prototype;F.addData=function(M){var R=new q(M);this.dataList.push(R),this.dataCache=null},F.isDark=function(M,R){if(M<0||this.moduleCount<=M||R<0||this.moduleCount<=R)throw new Error(M+","+R);return this.modules[M][R]},F.getModuleCount=function(){return this.moduleCount},F.make=function(){if(this.typeNumber<1){var M=1;for(M=1;M<40;M++){for(var R=G.getRSBlocks(M,this.errorCorrectLevel),C=new D,m=0,v=0;v<R.length;v++)m+=R[v].dataCount;for(var v=0;v<this.dataList.length;v++){var k=this.dataList[v];C.put(k.mode,4),C.put(k.getLength(),z.getLengthInBits(k.mode,M)),k.write(C)}if(C.getLengthInBits()<=m*8)break}this.typeNumber=M}this.makeImpl(!1,this.getBestMaskPattern())},F.makeImpl=function(M,R){this.moduleCount=this.typeNumber*4+17,this.modules=new Array(this.moduleCount);for(var C=0;C<this.moduleCount;C++){this.modules[C]=new Array(this.moduleCount);for(var m=0;m<this.moduleCount;m++)this.modules[C][m]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(M,R),this.typeNumber>=7&&this.setupTypeNumber(M),this.dataCache==null&&(this.dataCache=O.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,R)},F.setupPositionProbePattern=function(M,R){for(var C=-1;C<=7;C++){if(M+C<=-1||this.moduleCount<=M+C)continue;for(var m=-1;m<=7;m++){if(R+m<=-1||this.moduleCount<=R+m)continue;0<=C&&C<=6&&(m==0||m==6)||0<=m&&m<=6&&(C==0||C==6)||2<=C&&C<=4&&2<=m&&m<=4?this.modules[M+C][R+m]=!0:this.modules[M+C][R+m]=!1}}},F.getBestMaskPattern=function(){for(var M=0,R=0,C=0;C<8;C++){this.makeImpl(!0,C);var m=z.getLostPoint(this);(C==0||M>m)&&(M=m,R=C)}return R},F.createMovieClip=function(M,R,C){var m=M.createEmptyMovieClip(R,C),v=1;this.make();for(var k=0;k<this.modules.length;k++)for(var S=k*v,b=0;b<this.modules[k].length;b++){var f=b*v,u=this.modules[k][b];u&&(m.beginFill(0,100),m.moveTo(f,S),m.lineTo(f+v,S),m.lineTo(f+v,S+v),m.lineTo(f,S+v),m.endFill())}return m},F.setupTimingPattern=function(){for(var M=8;M<this.moduleCount-8;M++){if(this.modules[M][6]!=null)continue;this.modules[M][6]=M%2==0}for(var R=8;R<this.moduleCount-8;R++){if(this.modules[6][R]!=null)continue;this.modules[6][R]=R%2==0}},F.setupPositionAdjustPattern=function(){for(var M=z.getPatternPosition(this.typeNumber),R=0;R<M.length;R++)for(var C=0;C<M.length;C++){var m=M[R],v=M[C];if(this.modules[m][v]!=null)continue;for(var k=-2;k<=2;k++)for(var S=-2;S<=2;S++)k==-2||k==2||S==-2||S==2||k==0&&S==0?this.modules[m+k][v+S]=!0:this.modules[m+k][v+S]=!1}},F.setupTypeNumber=function(M){for(var R=z.getBCHTypeNumber(this.typeNumber),C=0;C<18;C++){var m=!M&&(R>>C&1)==1;this.modules[Math.floor(C/3)][C%3+this.moduleCount-8-3]=m}for(var C=0;C<18;C++){var m=!M&&(R>>C&1)==1;this.modules[C%3+this.moduleCount-8-3][Math.floor(C/3)]=m}},F.setupTypeInfo=function(M,R){for(var C=this.errorCorrectLevel<<3|R,m=z.getBCHTypeInfo(C),v=0;v<15;v++){var k=!M&&(m>>v&1)==1;v<6?this.modules[v][8]=k:v<8?this.modules[v+1][8]=k:this.modules[this.moduleCount-15+v][8]=k}for(var v=0;v<15;v++){var k=!M&&(m>>v&1)==1;v<8?this.modules[8][this.moduleCount-v-1]=k:v<9?this.modules[8][15-v-1+1]=k:this.modules[8][15-v-1]=k}this.modules[this.moduleCount-8][8]=!M},F.mapData=function(M,R){for(var C=-1,m=this.moduleCount-1,v=7,k=0,S=this.moduleCount-1;S>0;S-=2)for(S==6&&S--;;){for(var b=0;b<2;b++)if(this.modules[m][S-b]==null){var f=!1;k<M.length&&(f=(M[k]>>>v&1)==1);var u=z.getMask(R,m,S-b);u&&(f=!f),this.modules[m][S-b]=f,v--,v==-1&&(k++,v=7)}if(m+=C,m<0||this.moduleCount<=m){m-=C,C=-C;break}}},O.PAD0=236,O.PAD1=17,O.createData=function(M,R,C){for(var m=G.getRSBlocks(M,R),v=new D,k=0;k<C.length;k++){var S=C[k];v.put(S.mode,4),v.put(S.getLength(),z.getLengthInBits(S.mode,M)),S.write(v)}for(var b=0,k=0;k<m.length;k++)b+=m[k].dataCount;if(v.getLengthInBits()>b*8)throw new Error("code length overflow. ("+v.getLengthInBits()+">"+b*8+")");for(v.getLengthInBits()+4<=b*8&&v.put(0,4);v.getLengthInBits()%8!=0;)v.putBit(!1);for(;!(v.getLengthInBits()>=b*8);){if(v.put(O.PAD0,8),v.getLengthInBits()>=b*8)break;v.put(O.PAD1,8)}return O.createBytes(v,m)},O.createBytes=function(M,R){for(var C=0,m=0,v=0,k=new Array(R.length),S=new Array(R.length),b=0;b<R.length;b++){var f=R[b].dataCount,u=R[b].totalCount-f;m=Math.max(m,f),v=Math.max(v,u),k[b]=new Array(f);for(var a=0;a<k[b].length;a++)k[b][a]=255&M.buffer[a+C];C+=f;var s=z.getErrorCorrectPolynomial(u),l=new U(k[b],s.getLength()-1),A=l.mod(s);S[b]=new Array(s.getLength()-1);for(var a=0;a<S[b].length;a++){var y=a+A.getLength()-S[b].length;S[b][a]=y>=0?A.get(y):0}}for(var c=0,a=0;a<R.length;a++)c+=R[a].totalCount;for(var L=new Array(c),x=0,a=0;a<m;a++)for(var b=0;b<R.length;b++)a<k[b].length&&(L[x++]=k[b][a]);for(var a=0;a<v;a++)for(var b=0;b<R.length;b++)a<S[b].length&&(L[x++]=S[b][a]);return L},nt.exports=O},HmJG:function(nt,Qe,te){},Iq15:function(nt,Qe,te){var q=te("nVVt"),G=te("dWSS"),D=te("dQei"),z={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},U={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1<<10|1<<8|1<<5|1<<4|1<<2|1<<1|1<<0,G18:1<<12|1<<11|1<<10|1<<9|1<<8|1<<5|1<<2|1<<0,G15_MASK:1<<14|1<<12|1<<10|1<<4|1<<1,getBCHTypeInfo:function(O){for(var F=O<<10;U.getBCHDigit(F)-U.getBCHDigit(U.G15)>=0;)F^=U.G15<<U.getBCHDigit(F)-U.getBCHDigit(U.G15);return(O<<10|F)^U.G15_MASK},getBCHTypeNumber:function(O){for(var F=O<<12;U.getBCHDigit(F)-U.getBCHDigit(U.G18)>=0;)F^=U.G18<<U.getBCHDigit(F)-U.getBCHDigit(U.G18);return O<<12|F},getBCHDigit:function(O){for(var F=0;O!=0;)F++,O>>>=1;return F},getPatternPosition:function(O){return U.PATTERN_POSITION_TABLE[O-1]},getMask:function(O,F,M){switch(O){case z.PATTERN000:return(F+M)%2==0;case z.PATTERN001:return F%2==0;case z.PATTERN010:return M%3==0;case z.PATTERN011:return(F+M)%3==0;case z.PATTERN100:return(Math.floor(F/2)+Math.floor(M/3))%2==0;case z.PATTERN101:return F*M%2+F*M%3==0;case z.PATTERN110:return(F*M%2+F*M%3)%2==0;case z.PATTERN111:return(F*M%3+(F+M)%2)%2==0;default:throw new Error("bad maskPattern:"+O)}},getErrorCorrectPolynomial:function(O){for(var F=new G([1],0),M=0;M<O;M++)F=F.multiply(new G([1,D.gexp(M)],0));return F},getLengthInBits:function(O,F){if(1<=F&&F<10)switch(O){case q.MODE_NUMBER:return 10;case q.MODE_ALPHA_NUM:return 9;case q.MODE_8BIT_BYTE:return 8;case q.MODE_KANJI:return 8;default:throw new Error("mode:"+O)}else if(F<27)switch(O){case q.MODE_NUMBER:return 12;case q.MODE_ALPHA_NUM:return 11;case q.MODE_8BIT_BYTE:return 16;case q.MODE_KANJI:return 10;default:throw new Error("mode:"+O)}else if(F<41)switch(O){case q.MODE_NUMBER:return 14;case q.MODE_ALPHA_NUM:return 13;case q.MODE_8BIT_BYTE:return 16;case q.MODE_KANJI:return 12;default:throw new Error("mode:"+O)}else throw new Error("type:"+F)},getLostPoint:function(O){for(var F=O.getModuleCount(),M=0,R=0;R<F;R++)for(var C=0;C<F;C++){for(var m=0,v=O.isDark(R,C),k=-1;k<=1;k++){if(R+k<0||F<=R+k)continue;for(var S=-1;S<=1;S++){if(C+S<0||F<=C+S)continue;if(k==0&&S==0)continue;v==O.isDark(R+k,C+S)&&m++}}m>5&&(M+=3+m-5)}for(var R=0;R<F-1;R++)for(var C=0;C<F-1;C++){var b=0;O.isDark(R,C)&&b++,O.isDark(R+1,C)&&b++,O.isDark(R,C+1)&&b++,O.isDark(R+1,C+1)&&b++,(b==0||b==4)&&(M+=3)}for(var R=0;R<F;R++)for(var C=0;C<F-6;C++)O.isDark(R,C)&&!O.isDark(R,C+1)&&O.isDark(R,C+2)&&O.isDark(R,C+3)&&O.isDark(R,C+4)&&!O.isDark(R,C+5)&&O.isDark(R,C+6)&&(M+=40);for(var C=0;C<F;C++)for(var R=0;R<F-6;R++)O.isDark(R,C)&&!O.isDark(R+1,C)&&O.isDark(R+2,C)&&O.isDark(R+3,C)&&O.isDark(R+4,C)&&!O.isDark(R+5,C)&&O.isDark(R+6,C)&&(M+=40);for(var f=0,C=0;C<F;C++)for(var R=0;R<F;R++)O.isDark(R,C)&&f++;var u=Math.abs(100*f/F/F-50)/5;return M+=u*10,M}};nt.exports=U},LdHM:function(nt,Qe,te){"use strict";te.d(Qe,"b",function(){return l}),te.d(Qe,"a",function(){return y});var q=te("1OyB"),G=te("vuIU"),D=te("Ji7U"),z=te("LK+K"),U=te("cDcd"),O=te("rePB"),F=te("Ff2n"),M=te("ODXe"),R=te("4IlW"),C=te("bX4T"),m=te("YrtM"),v=te("TSYQ"),k=te.n(v),S=te("+nKL"),b=te("8OUc"),f=function(H,Y){var ee=H.prefixCls,oe=H.id,Ee=H.flattenOptions,pe=H.childrenAsData,me=H.values,he=H.searchValue,se=H.multiple,ne=H.defaultActiveFirstOption,ce=H.height,$=H.itemHeight,ie=H.notFoundContent,Z=H.open,ye=H.menuItemSelectedIcon,Ce=H.virtual,ve=H.onSelect,we=H.onToggleOpen,Ae=H.onActiveValue,Re=H.onScroll,Ie=H.onMouseEnter,Me="".concat(ee,"-item"),De=Object(m.a)(function(){return Ee},[Z,Ee],function(Ue,ge){return ge[0]&&Ue[1]!==ge[1]}),Ve=U.useRef(null),et=function(ge){ge.preventDefault()},ze=function(ge){Ve.current&&Ve.current.scrollTo({index:ge})},Xe=function(ge){for(var de=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,fe=De.length,Q=0;Q<fe;Q+=1){var J=(ge+Q*de+fe)%fe,re=De[J],le=re.group,Te=re.data;if(!le&&!Te.disabled)return J}return-1},qe=U.useState(function(){return Xe(0)}),He=Object(M.a)(qe,2),Be=He[0],Se=He[1],Ze=function(ge){Se(ge);var de=De[ge];if(!de){Ae(null,-1);return}Ae(de.data.value,ge)};U.useEffect(function(){Ze(ne!==!1?Xe(0):-1)},[De.length,he]),U.useEffect(function(){var Ue=setTimeout(function(){if(!se&&Z&&me.size===1){var ge=Array.from(me)[0],de=De.findIndex(function(fe){var Q=fe.data;return Q.value===ge});Ze(de),ze(de)}});return function(){return clearTimeout(Ue)}},[Z]);var Je=function(ge){ge!==void 0&&ve(ge,{selected:!me.has(ge)}),se||we(!1)};if(U.useImperativeHandle(Y,function(){return{onKeyDown:function(ge){var de=ge.which;switch(de){case R.a.UP:case R.a.DOWN:{var fe=0;if(de===R.a.UP?fe=-1:de===R.a.DOWN&&(fe=1),fe!==0){var Q=Xe(Be+fe,fe);ze(Q),Ze(Q)}break}case R.a.ENTER:{var J=De[Be];J&&!J.data.disabled?Je(J.data.value):Je(void 0),Z&&ge.preventDefault();break}case R.a.ESC:we(!1)}},onKeyUp:function(){},scrollTo:function(ge){ze(ge)}}}),De.length===0)return U.createElement("div",{role:"listbox",id:"".concat(oe,"_list"),className:"".concat(Me,"-empty"),onMouseDown:et},ie);function Le(Ue){var ge=De[Ue];if(!ge)return null;var de=ge.data||{},fe=de.value,Q=de.label,J=de.children,re=Object(C.a)(de,!0),le=pe?J:Q;return ge?U.createElement("div",Object.assign({"aria-label":typeof le=="string"?le:null},re,{key:Ue,role:"option",id:"".concat(oe,"_list_").concat(Ue),"aria-selected":me.has(fe)}),fe):null}return U.createElement(U.Fragment,null,U.createElement("div",{role:"listbox",id:"".concat(oe,"_list"),style:{height:0,width:0,overflow:"hidden"}},Le(Be-1),Le(Be),Le(Be+1)),U.createElement(S.a,{itemKey:"key",ref:Ve,data:De,height:ce,itemHeight:$,fullHeight:!1,onMouseDown:et,onScroll:Re,virtual:Ce,onMouseEnter:Ie},function(Ue,ge){var de,fe=Ue.group,Q=Ue.groupOption,J=Ue.data,re=J.label,le=J.key;if(fe)return U.createElement("div",{className:k()(Me,"".concat(Me,"-group"))},re!==void 0?re:le);var Te=J.disabled,_e=J.value,ke=J.title,je=J.children,it=J.style,Oe=J.className,ft=Object(F.a)(J,["disabled","value","title","children","style","className"]),ot=me.has(_e),rt="".concat(Me,"-option"),Et=k()(Me,rt,Oe,(de={},Object(O.a)(de,"".concat(rt,"-grouped"),Q),Object(O.a)(de,"".concat(rt,"-active"),Be===ge&&!Te),Object(O.a)(de,"".concat(rt,"-disabled"),Te),Object(O.a)(de,"".concat(rt,"-selected"),ot),de)),st=pe?je:re,vt=!ye||typeof ye=="function"||ot;return U.createElement("div",Object.assign({},ft,{"aria-selected":ot,className:Et,title:ke,onMouseMove:function(){if(Be===ge||Te)return;Ze(ge)},onClick:function(){Te||Je(_e)},style:it}),U.createElement("div",{className:"".concat(rt,"-content")},st||_e),U.isValidElement(ye)||ot,vt&&U.createElement(b.a,{className:"".concat(Me,"-option-state"),customizeIcon:ye,customizeIconProps:{isSelected:ot}},ot?"\u2713":null))}))},u=U.forwardRef(f);u.displayName="OptionList";var a=u,s=function(){return null};s.isSelectOption=!0;var l=s,A=function(){return null};A.isSelectOptGroup=!0;var y=A,c=te("VTBJ"),L=te("Zm9Q");function x(I){var H=I.key,Y=I.props,ee=Y.children,oe=Y.value,Ee=Object(F.a)(Y,["children","value"]);return Object(c.a)({key:H,value:oe!==void 0?oe:H,children:ee},Ee)}function h(I){var H=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(L.a)(I).map(function(Y,ee){if(!U.isValidElement(Y)||!Y.type)return null;var oe=Y.type.isSelectOptGroup,Ee=Y.key,pe=Y.props,me=pe.children,he=Object(F.a)(pe,["children"]);return H||!oe?x(Y):Object(c.a)(Object(c.a)({key:"__RC_SELECT_GRP__".concat(Ee===null?ee:Ee,"__"),label:Ee},he),{},{options:h(me)})}).filter(function(Y){return Y})}var p=te("2Qr1"),d=te("qNPg"),o=te("U8pU"),T=te("Kwbf"),E=te("WKfj");function g(I){var H=I.mode,Y=I.options,ee=I.children,oe=I.backfill,Ee=I.allowClear,pe=I.placeholder,me=I.getInputElement,he=I.showSearch,se=I.onSearch,ne=I.defaultOpen,ce=I.autoFocus,$=I.labelInValue,ie=I.value,Z=I.inputValue,ye=I.optionLabelProp,Ce=H==="multiple"||H==="tags",ve=he!==void 0?he:Ce||H==="combobox",we=Y||h(ee);if(Object(T.a)(H!=="tags"||we.every(function(Me){return!Me.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),H==="tags"||H==="combobox"){var Ae=we.some(function(Me){return Me.options?Me.options.some(function(De){return typeof("value"in De?De.value:De.key)=="number"}):typeof("value"in Me?Me.value:Me.key)=="number"});Object(T.a)(!Ae,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(T.a)(H!=="combobox"||!ye,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(T.a)(H==="combobox"||!oe,"`backfill` only works with `combobox` mode."),Object(T.a)(H==="combobox"||!me,"`getInputElement` only work with `combobox` mode."),Object(T.b)(H!=="combobox"||!me||!Ee||!pe,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),se&&!ve&&H!=="combobox"&&H!=="tags"&&Object(T.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(T.b)(!ne||ce,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),ie!=null){var Re=Object(E.d)(ie);Object(T.a)(!$||Re.every(function(Me){return Object(o.a)(Me)==="object"&&("key"in Me||"value"in Me)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(T.a)(!Ce||Array.isArray(ie),"`value` should be array when `mode` is `multiple` or `tags`")}if(ee){var Ie=null;Object(L.a)(ee).some(function(Me){if(!U.isValidElement(Me)||!Me.type)return!1;var De=Me.type;if(De.isSelectOption)return!1;if(De.isSelectOptGroup){var Ve=Object(L.a)(Me.props.children).every(function(et){return!U.isValidElement(et)||!Me.type||et.type.isSelectOption?!0:(Ie=et.type,!1)});return!Ve}return Ie=De,!0}),Ie&&Object(T.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(Ie.displayName||Ie.name||Ie,"`.")),Object(T.a)(Z===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var _=g,N=Object(d.a)({prefixCls:"rc-select",components:{optionList:a},convertChildrenToData:h,flattenOptions:p.d,getLabeledValue:p.e,filterOptions:p.b,isValueDisabled:p.g,findValueOption:p.c,warningProps:_,fillOptionsWithMissingValue:p.a}),B=function(I){Object(D.a)(Y,I);var H=Object(z.a)(Y);function Y(){var ee;return Object(q.a)(this,Y),ee=H.apply(this,arguments),ee.selectRef=U.createRef(),ee.focus=function(){ee.selectRef.current.focus()},ee.blur=function(){ee.selectRef.current.blur()},ee}return Object(G.a)(Y,[{key:"render",value:function(){return U.createElement(N,Object.assign({ref:this.selectRef},this.props))}}]),Y}(U.Component);B.Option=l,B.OptGroup=y;var W=B,P=Qe.c=W},M8RZ:function(nt,Qe,te){"use strict";te.d(Qe,"a",function(){return R});var q=te("fWQN"),G=te("mtLc"),D=te("yKVA"),z=te("879j"),U=te("cDcd"),O=te.n(U),F=te("faye"),M=te.n(F),R=function(C){Object(D.a)(v,C);var m=Object(z.a)(v);function v(k){var S;Object(q.a)(this,v),S=m.call(this,k);var b=window.document;return S.node=b.createElement("div"),b.body.appendChild(S.node),S}return Object(G.a)(v,[{key:"render",value:function(){var S=this.props.children;return Object(F.createPortal)(S,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),v}(O.a.Component)},Ot1p:function(nt,Qe,te){"use strict";var q=te("2qtc"),G=te("kLXV"),D=te("rAM+"),z=te("miYZ"),U=te("tsqr"),O=te("9og8"),F=te("tJVT"),M=te("jrin"),R=te("WmNS"),C=te.n(R),m=te("cDcd"),v=te.n(m),k=te("VrN/"),S=te.n(k),b=te("bdgK"),f=te("p77/"),u=te("Bd2K"),a=te("ELLl"),s=te("19Vz"),l=te("lZu9"),A=te("+NIl"),y=te("kSUc"),c=te("9Bee"),L=function(Oe){var ft=Oe.value,ot=ft===void 0?"":ft,rt=Oe.className,Et=Oe.showTextOnly,st=Oe.showLines,vt=Oe.style,yt=vt===void 0?{}:vt,Ke=Object(m.useMemo)(function(){return""},[ot]);return v.a.createElement(v.a.Fragment,null,v.a.createElement("div",{dangerouslySetInnerHTML:{__html:Ke}}))},x=te("Q9mQ"),h=te("diRs"),p=te("0Owb"),d=te("dejd"),o=te("C+DQ"),T=te("D1Df"),E=te.n(T),g=te("1vsH"),_=te("m3rI"),N=[{title:"\u7C97\u4F53",icon:"icon-bold",actionName:"bold"},{title:"\u659C\u4F53",icon:"icon-italic",actionName:"italic"},"|",{title:"\u65E0\u5E8F\u5217\u8868",icon:"icon-unorder-list",actionName:"list-ul"},{title:"\u6709\u5E8F\u5217\u8868",icon:"icon-order-list",actionName:"list-ol"},"|",{title:"\u884C\u5185\u4EE3\u7801",icon:"icon-code",actionName:"code"},{title:"\u4EE3\u7801\u5757\uFF08\u591A\u8BED\u8A00\u98CE\u683C\uFF09",icon:"icon-file-code",actionName:"code-block"},{title:"\u94FE\u63A5",icon:"icon-link",actionName:"link"},"|",{title:"\u884C\u5185\u516C\u5F0F",icon:"icon-sum",actionName:"inline-latex"},{title:"\u591A\u884C\u516C\u5F0F",icon:"icon-formula",actionName:"latex"},"|",{title:"\u6DFB\u52A0\u56FE\u7247",icon:"icon-picture",actionName:"upload-image"},{title:"\u8868\u683C",icon:"icon-table",actionName:"add-table"},"|",{title:"\u6362\u884C",icon:"icon-minus",actionName:"line-break"},{title:"\u6E05\u7A7A",icon:"icon-eraser",actionName:"eraser"}];function B(Oe){var ft=Oe.onActionCallback,ot=Oe.title,rt=Oe.icon,Et=Oe.actionName,st=Oe.className,vt=st===void 0?"":st,yt=Oe.children;function Ke(){ft(Et)}return v.a.createElement("a",{title:ot,className:vt,onClick:Ke},v.a.createElement("i",{className:"md-iconfont ".concat(rt)}),yt)}var W=function(Oe){var ft=Oe.watch,ot=Oe.showNullButton,rt=Oe.onActionCallback,Et=Oe.fullScreen,st=Oe.insertTemp,vt=Oe.hidetoolBar,yt=Oe.uuid,Ke=Oe.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(g.G)("_educoder_session_login"),"&_educoder_session=").concat(Object(g.G)("_educoder_session"),"&key=").concat(yt,"&api=").concat(encodeURIComponent(_.a.PROXY_SERVER)));var Qt=[].concat(N,[{title:"".concat(ft?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(ft?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return v.a.createElement("ul",{className:"markdown-toolbar-container"},!vt&&Qt.map(function(Mt,Bt){return v.a.createElement("li",{key:Bt},Mt.actionName?v.a.createElement(B,Object(p.a)({},Mt,{onActionCallback:rt})):v.a.createElement("span",{className:"v-line"}))}),ot?v.a.createElement("li",null,v.a.createElement(B,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:rt},v.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,st&&v.a.createElement("li",null,v.a.createElement(B,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(st),onActionCallback:rt},v.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),v.a.createElement("li",null,v.a.createElement(h.a,{title:"\u6253\u5F00\u624B\u673A\u626B\u4E00\u626B",content:v.a.createElement("div",null,v.a.createElement(E.a,{size:150,fgColor:"#000",value:"https://test2.educoder.net/upload.html?_educoder_session_login=".concat(Object(g.G)("_educoder_session_login"),"&_educoder_session=").concat(Object(g.G)("_educoder_session"),"&key=").concat(yt,"&api=").concat(encodeURIComponent(_.a.PROXY_SERVER))}))},v.a.createElement("span",{className:"fill-tip",onMouseOver:function(){return Ke(!0)}},"\u624B\u673A\u4E0A\u4F20\u6587\u4EF6"))),v.a.createElement("li",{className:"btn-full-screen"},v.a.createElement(B,{icon:"".concat(Et?"icon-shrink":"icon-enlarge"),title:Et?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:rt})))},P=te("M8RZ"),I=te("+L6B"),H=te("2/Rp"),Y=te("y8nQ"),ee=te("Vl3Y"),oe=te("5NDa"),Ee=te("5rEg"),pe={labelCol:{span:4},wrapperCol:{span:20}},me=function(Oe){var ft=Oe.callback,ot=Oe.onCancel;function rt(Et){ft(Et)}return v.a.createElement(ee.a,Object(p.a)({},pe,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:rt}),v.a.createElement(ee.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},v.a.createElement(Ee.a,null)),v.a.createElement(ee.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},v.a.createElement(Ee.a,null)),v.a.createElement("div",{className:"flex-container flex-end"},v.a.createElement(H.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),v.a.createElement(H.a,{type:"ghost",onClick:ot},"\u53D6\u6D88")))},he=te("7ahc"),se=te("k1fw"),ne=te("HmJG"),ce=te("BjJ7"),$=ee.a.useForm,ie={width:280,marginRight:10},Z={labelCol:{span:5},wrapperCol:{span:19}},ye=function(Oe){var ft=Oe.callback,ot=Oe.onCancel,rt=$(),Et=Object(F.a)(rt,1),st=Et[0],vt=useRef();function yt(Mt){ft(Object(se.a)(Object(se.a)({},Mt),{},{name:vt.current}))}function Ke(Mt,Bt){if(Mt.status===-1){U.b.error(Mt.message);return}st.setFieldsValue({src:"/api/attachments/".concat(Mt.id),type:Bt.type})}function Qt(Mt){var Bt=Mt.target.files[0];vt.current=Bt.name,ve(Bt,Ke)}return v.a.createElement(ee.a,Object(p.a)({form:st},Z,{className:"upload-image-panel",onFinish:yt}),v.a.createElement(ee.a.Item,{label:"\u6587\u4EF6\u5730\u5740",required:!0},v.a.createElement("div",{className:"flex-container"},v.a.createElement(ee.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u6587\u4EF6\u5730\u5740"}]},v.a.createElement(Ee.a,{style:ie})),v.a.createElement(Ce,{onFileChange:Qt}))),v.a.createElement(ee.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},v.a.createElement(Ee.a,{style:{width:264}})),v.a.createElement(ee.a.Item,{style:{textAlign:"right"}},v.a.createElement(H.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),v.a.createElement(H.a,{type:"ghost",onClick:ot},"\u53D6\u6D88")))};function Ce(Oe){var ft=Oe.onFileChange;return v.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",v.a.createElement("input",{type:"file",onChange:ft}))}function ve(Oe,ft){if(!Oe)throw new String("\u6CA1\u6709\u6587\u4EF6");var ot=new FormData;ot.append("editormd-image-file",Oe),ot.append("file_param_name","editormd-image-file"),ot.append("byxhr","true");var rt=new window.XMLHttpRequest;rt.withCredentials=!0,rt.addEventListener("load",function(Et){ft(JSON.parse(Et.target.responseText),Oe)},!1),rt.addEventListener("error",function(Et){console.error(Et)},!1),rt.open("POST","".concat(ce.a,"/api/attachments.json")),rt.send(ot)}var we=te("giR+"),Ae=te("fyUT"),Re=te("7Kak"),Ie=te("9yH6"),Me=Ie.a.Group,De={margin:"0 8px"},Ve=function(Oe){var ft=Oe.callback,ot=Oe.onCancel;function rt(Et){ft(Et)}return v.a.createElement(ee.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:rt},v.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},v.a.createElement("span",{style:De},"\u5355\u5143\u683C\u6570\uFF1A"),v.a.createElement("span",{style:De},"\u884C\u6570"),v.a.createElement(ee.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},v.a.createElement(Ae.a,null)),v.a.createElement("span",{style:De},"\u5217\u6570"),v.a.createElement(ee.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},v.a.createElement(Ae.a,null))),v.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},v.a.createElement("span",{style:De},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),v.a.createElement(ee.a.Item,{name:"align"},v.a.createElement(Me,null,v.a.createElement(Ie.a,{value:"default"},v.a.createElement("i",{className:"fa fa-align-justify"})),v.a.createElement(Ie.a,{value:"left"},v.a.createElement("i",{className:"fa fa-align-left"})),v.a.createElement(Ie.a,{value:"center"},v.a.createElement("i",{className:"fa fa-align-center"})),v.a.createElement(Ie.a,{value:"right"},v.a.createElement("i",{className:"fa fa-align-right"}))))),v.a.createElement("div",{className:"flex-container flex-end"},v.a.createElement(H.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),v.a.createElement(H.a,{type:"ghost",onClick:ot},"\u53D6\u6D88")))},et=te("ErOA"),ze=te("7Cbv"),Xe="link",qe="upload-image",He="code-block",Be="add-table",Se="------------",Ze={default:Se,left:":".concat(Se),center:":".concat(Se,":"),right:"".concat(Se,":")},Je=te("9VGf"),Le,Ue;function ge(){}var de=0,fe=1e4,Q="\u2581",J=`
|
|
**\u6A21\u677F\u6807\u9898**
|
|
\u6A21\u677F\u6B63\u6587\u5185\u5BB9\uFF0C\u53EF\u8F93\u5165\u6587\u672C\u5185\u5BB9\u548C\u7C98\u8D34\u56FE\u7247\u7B49\u64CD\u4F5C`;function re(Oe){return/^\d+$/.test(Oe)?"".concat(Oe,"px"):Oe}var le=navigator.platform.toUpperCase().indexOf("MAC")>=0,Te=le?"Cmd":"Ctrl",_e=["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"],ke=(Le={},Object(M.a)(Le,Te+"-B","bold"),Object(M.a)(Le,Te+"-I","italic"),Le),je=(Ue={},Object(M.a)(Ue,Xe,"\u6DFB\u52A0\u94FE\u63A5"),Object(M.a)(Ue,He,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(M.a)(Ue,qe,"\u6DFB\u52A0\u6587\u4EF6"),Object(M.a)(Ue,Be,"\u6DFB\u52A0\u8868\u683C"),Ue),it=Qe.a=function(Oe){var ft=Oe.defaultValue,ot=ft===void 0?"":ft,rt=Oe.onChange,Et=Oe.width,st=Et===void 0?"100%":Et,vt=Oe.height,yt=vt===void 0?400:vt,Ke=Oe.miniToolbar,Qt=Ke===void 0?!1:Ke,Mt=Oe.isFocus,Bt=Mt===void 0?!1:Mt,kt=Oe.watch,fr=Oe.insertTemp,Zr=Oe.mode,hr=Zr===void 0?"markdown":Zr,vr=Oe.id,qr=vr===void 0?"markdown-editor-id":vr,It=Oe.showResizeBar,ut=It===void 0?!1:It,wr=Oe.noStorage,Vn=wr===void 0?!1:wr,mr=Oe.showNullButton,Ct=mr===void 0?!1:mr,Cr=Oe.hidetoolBar,en=Cr===void 0?!1:Cr,bn=Oe.fullScreen,Fe=bn===void 0?!1:bn,mt=Oe.onBlur,tn=Oe.onCMBeforeChange,rn=Oe.onFullScreen,nn=Oe.className,En=nn===void 0?"":nn,Yn=Oe.disablePaste,gt=Yn===void 0?!1:Yn,Ci=Oe.placeholder,Ai=Ci===void 0?"":Ci,an=Oe.values,lr=an===void 0?"":an,Li=Object(m.useState)(null),$n=Object(F.a)(Li,2),We=$n[0],Qn=$n[1],Di=Object(m.useState)(ot),xn=Object(F.a)(Di,2),on=xn[0],Nr=xn[1],Oi=Object(m.useState)(kt),Jn=Object(F.a)(Oi,2),Rr=Jn[0],Ri=Jn[1],_i=Object(m.useState)(Fe),yr=Object(F.a)(_i,2),Ar=yr[0],ki=yr[1],Tn=Object(m.useState)(""),Fr=Object(F.a)(Tn,2),Br=Fr[0],jr=Fr[1],aa=Object(m.useState)(0),Pi=Object(F.a)(aa,2),_r=Pi[0],Sn=Pi[1],oa=Object(m.useState)(yt),Zn=Object(F.a)(oa,2),qn=Zn[0],sn=Zn[1],wn=Object(m.useState)(!1),Cn=Object(F.a)(wn,2),sa=Cn[0],An=Cn[1],ln=Object(m.useRef)(Object(ze.a)()),Mi=Object(m.useRef)(!1),ei=Object(m.useRef)(),Jt=Object(m.useRef)(),Wr=Object(m.useRef)(),Ln=Object(m.useRef)(),Hr=Object(m.useRef)(),Ii=function(){var lt=Object(O.a)(C.a.mark(function pt(){var ct,xt;return C.a.wrap(function(Rt){for(;;)switch(Rt.prev=Rt.next){case 0:return Rt.next=2,Object(et.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:ln.current}});case 2:xt=Rt.sent,xt!=null&&(ct=xt.attachments)!==null&&ct!==void 0&&ct.length&&(console.log("cm:",We,Jt),xt.attachments.map(function(Tt){Tt.content_type.indexOf("image")>-1?We.replaceSelection(".concat(Tt.content_type,")")):Tt.content_type.indexOf("video")>-1?We.replaceSelection('<video width="100%" controls src="'.concat(_.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):Tt.content_type.indexOf("pdf")>-1?We.replaceSelection('<a href="'.concat(_.a.API_SERVER,"/api/attachments/").concat(Tt.id,"?type=").concat(Tt.content_type,'&disposition=inline" target="_blank">').concat(Tt.name,"</a>")):We.replaceSelection("[".concat(Tt.name,"](").concat(_.a.API_SERVER,"/api/attachments/").concat(Tt.id,"?type=").concat(Tt.content_type,")"))}));case 4:case"end":return Rt.stop()}},pt)}));return function(){return lt.apply(this,arguments)}}();Object(m.useEffect)(function(){Nr(lr),We==null||We.setValue(lr)},[lr]),Object(m.useEffect)(function(){rn==null||rn(Ar)},[Ar]),Object(m.useEffect)(function(){if(Jt.current){var lt=S.a.fromTextArea(Jt.current,{mode:hr,lineNumbers:!Qt,lineWrapping:!0,value:ot,autoCloseTags:!0,autoCloseBrackets:!0});Bt&<.focus();function pt(ct,xt){if(gt){xt.preventDefault();return}var wt=xt.clipboardData;if(wt){var Rt=wt.types.toString(),Tt=wt.items;if(Rt==="Files"||wt.types.indexOf("Files")>-1){if(xt.preventDefault(),hr=="stex")return;try{var Nt,Kt=Tt[1];((Nt=Tt[0])===null||Nt===void 0?void 0:Nt.kind)==="file"&&(Kt=Tt[0]);var St=Kt.getAsFile(),Pr=St.name.split(".").pop();ve(St,function(Lt){if(Lt.id){var er,Ot,br;(St==null||((er=St.type)===null||er===void 0)?void 0:er.indexOf("image"))>-1?lt.replaceSelection(".concat(Lt.content_type,")")):(St==null||((Ot=St.type)===null||Ot===void 0)?void 0:Ot.indexOf("video"))>-1?lt.replaceSelection('<video width="100%" controls src="'.concat(_.a.API_SERVER,"/api/attachments/").concat(Lt.id,'"></video>')):(St==null||((br=St.type)===null||br===void 0)?void 0:br.indexOf("pdf"))>-1?lt.replaceSelection('<a href="'.concat(_.a.API_SERVER,"/api/attachments/").concat(Lt.id,"?type=").concat(St.type,'&disposition=inline" target="_blank">').concat(St.name,"</a>")):_e.includes(Pr)?lt.replaceSelection('<a href="'.concat(_.a.API_SERVER,"/api/attachments/").concat(Lt.id,'?type=office&disposition=inline" target="_blank">').concat(St.name,"</a>")):lt.replaceSelection("[".concat(St.name,"](").concat(_.a.API_SERVER,"/api/attachments/").concat(Lt.id,"?type=").concat(Lt.content_type,")"))}else(Lt==null?void 0:Lt.status)===401&&(document.location.href="/user/login")})}catch(Lt){U.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return lt.on("paste",pt),lt.on("dragleave",function(ct,xt){Wr.current.classList.remove("mouse-hover-md")}),lt.on("dragover",function(ct,xt){Wr.current.classList.add("mouse-hover-md")}),lt.on("drop",function(ct,xt){Wr.current.classList.add("mouse-hover-md");var wt;if(wt=xt.dataTransfer.files,wt.length>0){xt.preventDefault(),xt.stopPropagation();for(var Rt=function(Kt){var St=wt[Kt],Pr=St.name.split(".").pop();ve(St,function(Lt){if(Lt.id){var er,Ot,br;(St==null||((er=St.type)===null||er===void 0)?void 0:er.indexOf("image"))>-1?lt.replaceSelection(".concat(Lt.content_type,")")):(St==null||((Ot=St.type)===null||Ot===void 0)?void 0:Ot.indexOf("video"))>-1?lt.replaceSelection('<video width="100%" controls src="'.concat(_.a.API_SERVER,"/api/attachments/").concat(Lt.id,'"></video>')):(St==null||((br=St.type)===null||br===void 0)?void 0:br.indexOf("pdf"))>-1?lt.replaceSelection('<a href="'.concat(_.a.API_SERVER,"/api/attachments/").concat(Lt.id,"?type=").concat(St.type,'&disposition=inline" target="_blank">').concat(St.name,"</a>")):_e.includes(Pr)?lt.replaceSelection('<a href="'.concat(_.a.API_SERVER,"/api/attachments/").concat(Lt.id,'?type=office&disposition=inline" target="_blank">').concat(St.name,"</a>")):lt.replaceSelection("[".concat(St.name,"](").concat(_.a.API_SERVER,"/api/attachments/").concat(Lt.id,"?type=").concat(Lt.content_type,")"))}else(Lt==null?void 0:Lt.status)===401&&(document.location.href="/user/login")})},Tt=0;Tt<wt.length;Tt++)Rt(Tt)}}),Qn(lt),function(){lt.off("paste",pt)}}},[]);var Er=Object(m.useCallback)(function(){if(Wr.current)try{}catch(lt){console.log(lt,"---- to set md editor body height")}},[qn,Wr,Ar]);Object(m.useEffect)(function(){function lt(){var ct=new b.default(function(xt){var wt=Object(D.a)(xt),Rt;try{for(wt.s();!(Rt=wt.n()).done;){var Tt=Rt.value;(Tt.target.offsetHeight>0||Tt.target.offsetWidth>0)&&(Er(),We.setSize("100%","100%"),We.refresh())}}catch(Nt){wt.e(Nt)}finally{wt.f()}});return ct.observe(Jt.current.parentElement),ct}if(We){var pt=lt();return function(){pt.unobserve(Jt.current.parentElement)}}},[We,Er]),Object(m.useEffect)(function(){if(We){for(var lt=[],pt=function(){var Tt=xt[ct];wt=Object(F.a)(Tt,2);var Nt=wt[0],Kt=wt[1],St=Object(M.a)({},Nt,function(){Dn(Kt)});lt.push(St),We.addKeyMap(St)},ct=0,xt=Object.entries(ke);ct<xt.length;ct++){var wt;pt()}return ei.current=setInterval(function(){Mi.current&&Ii()},4e3),function(){clearInterval(ei.current);var Rt=Object(D.a)(lt),Tt;try{for(Rt.s();!(Tt=Rt.n()).done;){var Nt=Tt.value;We.removeKeyMap(Nt)}}catch(Kt){Rt.e(Kt)}finally{Rt.f()}}}},[We]),Object(m.useEffect)(function(){Fe!==Ar&&ki(Fe)},[Fe]),Object(Je.a)(function(){if(!Vn&&_r>0){var lt=new Date().getTime(),pt=window.sessionStorage.getItem(qr);lt>=_r+fe&&(!pt||pt!==on)&&(window.sessionStorage.setItem(qr,on),An(!0))}},fe),Object(m.useEffect)(function(){Ri(kt)},[We,kt]),Object(m.useEffect)(function(){We&&(Bt&&We.focus())},[We,Bt]),Object(m.useEffect)(function(){if(Rr&&We){var lt=We.getScrollerElement();function pt(ct){var xt=ct.target;if(Hr.current){var wt=xt.scrollTop/xt.scrollHeight;Hr.current.scrollTop=Hr.current.scrollHeight*wt}}return lt.addEventListener("scroll",pt),function(){lt.removeEventListener("scroll",pt)}}},[We,Rr]),Object(m.useEffect)(function(){if(We&&tn){function lt(pt,ct){tn(pt,ct)}return We.on("beforeChange",lt),function(){We.off("beforeChange",lt)}}},[We,tn]),Object(m.useEffect)(function(){if(We&&mt){function lt(){mt(We.getValue())}return We.on("blur",lt),function(){We.off("blur",lt)}}},[We,mt]),Object(m.useEffect)(function(){if(We){function lt(pt){var ct=pt.getValue();Nr(ct),Sn(new Date().getTime()),pt.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),rt&&rt(ct)}return We.on("change",lt),function(){We.off("change",lt)}}},[We,rt]),Object(m.useEffect)(function(){We&&(ot==null?(We.setValue(""),Nr("")):ot!==We.getValue()&&(We.setValue(ot),Nr(ot),We.setCursor(We.lineCount(),0)))},[We,ot]);var Dn=Object(m.useCallback)(function(lt){var pt=We.getCursor(),ct=We.getSelection(),xt=ct.split(`
|
|
`);switch(lt){case"bold":return We.replaceSelection("**"+ct+"**"),ct===""&&We.setCursor(pt.line,pt.ch+2),We.focus();case"italic":return We.replaceSelection("*"+ct+"*"),ct===""&&We.setCursor(pt.line,pt.ch+1),We.focus();case"code":return We.replaceSelection("`"+ct+"`"),ct===""&&We.setCursor(pt.line,pt.ch+1),We.focus();case"inline-latex":return We.replaceSelection("`$$"+ct+"$$`"),ct===""&&We.setCursor(pt.line,pt.ch+3),We.focus();case"latex":return We.replaceSelection("```latex\n"+ct+"\n```"),We.setCursor(pt.line+1,ct.length+1),We.focus();case"line-break":return We.replaceSelection(`<br/>
|
|
`),We.focus();case"list-ul":return ct===""?We.replaceSelection("- "+ct):We.replaceSelection(xt.map(function(wt){return wt===""?"":"- ".concat(wt)}).join(`
|
|
`)),We.focus();case"list-ol":return ct===""?We.replaceSelection("1. "+ct):We.replaceSelection(xt.map(function(wt,Rt){return wt===""?"":"".concat(Rt+1,". ").concat(wt)}).join(`
|
|
`)),We.focus();case"add-null-ch":return ct===""&&We.setCursor(pt.line,pt.ch+1),We.replaceSelection(Q),We.focus();case"inster-template-1":return ct===""&&We.setCursor(pt.line,pt.ch),We.replaceSelection(J),We.focus();case"eraser":return We.setValue(""),We.focus();case"trigger-watch":return Ri(!Rr),We.focus();case"trigger-full-screen":return ki(!Ar),We.focus();case Xe:jr(Xe);return;case He:jr(He);return;case qe:jr(qe);return;case Be:jr(Be);return;default:throw new Error}},[We,Rr,Ar]),ur=Object(m.useCallback)(function(lt){jr("");switch(Br){case Xe:var pt=lt.title,ct=lt.link;return We.replaceSelection("[".concat(pt,"](").concat(ct,")")),We.focus();case He:var xt=lt.language,wt=lt.content;return We.replaceSelection(["```"+xt,wt,"```"].join(`
|
|
`)),We.focus();case qe:var Rt=lt.src,Tt=lt.alt;return Tt?We.replaceSelection(".concat(Rt,' "').concat(Tt,'" )')):We.replaceSelection("")),We.focus();case Be:for(var Nt=lt.row,Kt=lt.col,St=lt.align,Pr=`
|
|
`,Lt=0;Lt<Nt;Lt++){for(var er=[],Ot=[],br=0;br<Kt;br++)Lt===1&&Ot.push(Ze[St]),er.push(" ");Lt===1&&(Pr+="| ".concat(Ot.join(" | "),` |
|
|
`)),Pr+="| ".concat(er.join(Kt===1?"":" | "),` |
|
|
`)}return We.replaceSelection(Pr+`
|
|
`),We.focus();default:throw new Error}},[We,Br]),On=Object(m.useMemo)(function(){switch(Br){case Xe:return v.a.createElement(me,{callback:ur,onCancel:kr});case He:return v.a.createElement(he.b,{callback:ur,onCancel:kr});case qe:return v.a.createElement(ye,{callback:ur,onCancel:kr});case Be:return v.a.createElement(Ve,{callback:ur,onCancel:kr});default:return null}},[Br]);function kr(){jr("")}Object(m.useEffect)(function(){if(Ln.current){var lt=Ln.current,pt=!1,ct=0;function xt(Tt){pt=!0,ct=Tt.pageY}function wt(){pt=!1}function Rt(Tt){if(pt){var Nt=Tt.pageY-ct;Nt<0&&(Nt=0),Nt>300&&(Nt=300);var Kt=yt+Nt+"px";sn(Kt)}}return lt.addEventListener("mousedown",xt),document.addEventListener("mousemove",Rt),document.addEventListener("mouseup",wt),function(){lt.removeEventListener("mousedown",xt),document.removeEventListener("mousemove",Rt),document.removeEventListener("mouseup",wt)}}},[We,Ln]),Object(m.useEffect)(function(){sn(yt)},[yt]);var Kr=re(st),la=re(qn),ua={width:Kr,height:la},$a=Object(m.useMemo)(function(){if(_r){var lt=new Date(_r),pt=lt.getHours(),ct=lt.getMinutes(),xt=lt.getSeconds();return pt=pt<10?"0"+pt:pt,ct=ct<10?"0"+ct:ct,xt=xt<10?"0"+xt:xt,"".concat(pt,":").concat(ct,":").concat(xt)}return 0},[_r]);function Qa(){window.sessionStorage.removeItem(qr),An(!1),Sn(0)}function da(){An(!1),Sn(0),We.setValue(window.sessionStorage.getItem(qr))}function Ui(lt,pt){var ct=We.getValue();ct=ct.replace(lt,pt),Nr(ct),We==null||We.setValue(ct)}return v.a.createElement(m.Fragment,null,v.a.createElement("div",{className:"markdown-editor-wrapper",ref:Wr},v.a.createElement("div",{className:"markdown-editor-container ".concat(En," ").concat(Rr?"on-preview":""," ").concat(Qt?"mini":""," ").concat(Ar?"full-screen":""),style:ua},v.a.createElement(W,{insertTemp:fr,watch:Rr,fullScreen:Ar,showNullButton:Ct,onActionCallback:Dn,hidetoolBar:en,uuid:ln.current,setOpenPhones:function(){Mi.current=!0}}),v.a.createElement("div",{className:"markdown-editor-body"},v.a.createElement("div",{className:"codemirror-container"},v.a.createElement("textarea",{ref:Jt,placeholder:Ai})),Rr?v.a.createElement("div",{ref:Hr,className:"preview-container"},hr==="stex"&&v.a.createElement(L,{value:on}),hr!=="stex"&&v.a.createElement(c.a,{edit:!0,value:on,replaces:Ui})):null))),ut?v.a.createElement("a",{ref:Ln,className:"editor-resize"}):null,v.a.createElement(P.a,null,je[Br]?v.a.createElement(G.a,{centered:!0,title:je[Br],visible:!0,onCancel:kr,footer:null,className:"markdown-popup-form"},On):null))}},SJMd:function(nt,Qe){/**
|
|
* @license
|
|
* Copyright (C) 2006 Google Inc.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/var te,q,G,D=!1,z,U;window.PR_SHOULD_USE_CONTINUATION=!0;var O,F;(function(){var M=window,R=["break,continue,do,else,for,if,return,while"],C=[R,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,restrict,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],m=[C,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],v=[m,"alignas,alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,noexcept,noreturn,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],k=[m,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],S=[m,"abstract,add,alias,as,ascending,async,await,base,bool,by,byte,checked,decimal,delegate,descending,dynamic,event,finally,fixed,foreach,from,get,global,group,implicit,in,interface,internal,into,is,join,let,lock,null,object,out,override,orderby,params,partial,readonly,ref,remove,sbyte,sealed,select,set,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,value,var,virtual,where,yield"],b="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes",f=[m,"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",a=[R,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],s=[R,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],l=[R,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],A=[v,S,k,f,u,a,s,l],y=/^(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",L="kwd",x="com",h="typ",p="lit",d="pun",o="pln",T="tag",E="dec",g="src",_="atn",N="atv",B="nocode",W="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function P(ve){for(var we=0,Ae=!1,Re=!1,Ie=0,Me=ve.length;Ie<Me;++Ie){var De=ve[Ie];if(De.ignoreCase)Re=!0;else if(/[a-z]/i.test(De.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Ae=!0,Re=!1;break}}var Ve={b:8,t:9,n:10,v:11,f:12,r:13};function et(Be){var Se=Be.charCodeAt(0);if(Se!==92)return Se;var Ze=Be.charAt(1);return Se=Ve[Ze],Se||("0"<=Ze&&Ze<="7"?parseInt(Be.substring(1),8):Ze==="u"||Ze==="x"?parseInt(Be.substring(2),16):Be.charCodeAt(1))}function ze(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")),Ze=[],Je=Se[0]==="^",Le=["["];Je&&Le.push("^");for(var Ue=Je?1:0,ge=Se.length;Ue<ge;++Ue){var de=Se[Ue];if(/\\[bdsw]/i.test(de))Le.push(de);else{var fe=et(de),Q;Ue+2<ge&&Se[Ue+1]==="-"?(Q=et(Se[Ue+2]),Ue+=2):Q=fe,Ze.push([fe,Q]),Q<65||fe>122||(Q<65||fe>90||Ze.push([Math.max(65,fe)|32,Math.min(Q,90)|32]),Q<97||fe>122||Ze.push([Math.max(97,fe)&~32,Math.min(Q,122)&~32]))}}Ze.sort(function(Te,_e){return Te[0]-_e[0]||_e[1]-Te[1]});for(var J=[],re=[],Ue=0;Ue<Ze.length;++Ue){var le=Ze[Ue];le[0]<=re[1]+1?re[1]=Math.max(re[1],le[1]):J.push(re=le)}for(var Ue=0;Ue<J.length;++Ue){var le=J[Ue];Le.push(ze(le[0])),le[1]>le[0]&&(le[1]+1>le[0]&&Le.push("-"),Le.push(ze(le[1])))}return Le.push("]"),Le.join("")}function qe(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")),Ze=Se.length,Je=[],Le=0,Ue=0;Le<Ze;++Le){var ge=Se[Le];if(ge==="(")++Ue;else if(ge.charAt(0)==="\\"){var de=+ge.substring(1);de&&(de<=Ue?Je[de]=-1:Se[Le]=ze(de))}}for(var Le=1;Le<Je.length;++Le)Je[Le]===-1&&(Je[Le]=++we);for(var Le=0,Ue=0;Le<Ze;++Le){var ge=Se[Le];if(ge==="(")++Ue,Je[Ue]||(Se[Le]="(?:");else if(ge.charAt(0)==="\\"){var de=+ge.substring(1);de&&de<=Ue&&(Se[Le]="\\"+Je[de])}}for(var Le=0;Le<Ze;++Le)Se[Le]==="^"&&Se[Le+1]!=="^"&&(Se[Le]="");if(Be.ignoreCase&&Ae)for(var Le=0;Le<Ze;++Le){var ge=Se[Le],fe=ge.charAt(0);ge.length>=2&&fe==="["?Se[Le]=Xe(ge):fe!=="\\"&&(Se[Le]=ge.replace(/[a-zA-Z]/g,function(re){var le=re.charCodeAt(0);return"["+String.fromCharCode(le&~32,le|32)+"]"}))}return Se.join("")}for(var He=[],Ie=0,Me=ve.length;Ie<Me;++Ie){var De=ve[Ie];if(De.global||De.multiline)throw new Error(""+De);He.push("(?:"+qe(De)+")")}return new RegExp(He.join("|"),Re?"gi":"g")}function I(ve,we){var Ae=/(?:^|\s)nocode(?:\s|$)/,Re=[],Ie=0,Me=[],De=0;function Ve(et){var ze=et.nodeType;if(ze==1){if(Ae.test(et.className))return;for(var Xe=et.firstChild;Xe;Xe=Xe.nextSibling)Ve(Xe);var qe=et.nodeName.toLowerCase();(qe==="br"||qe==="li")&&(Re[De]=`
|
|
`,Me[De<<1]=Ie++,Me[De++<<1|1]=et)}else if(ze==3||ze==4){var He=et.nodeValue;He.length&&(we?He=He.replace(/\r\n?/g,`
|
|
`):He=He.replace(/[ \t\r\n]+/g," "),Re[De]=He,Me[De<<1]=Ie,Ie+=He.length,Me[De++<<1|1]=et)}}return Ve(ve),{sourceCode:Re.join("").replace(/\n$/,""),spans:Me}}function H(ve,we,Ae,Re,Ie){if(!Ae)return;var Me={sourceNode:ve,pre:1,langExtension:null,numberLines:null,sourceCode:Ae,spans:null,basePos:we,decorations:null};Re(Me),Ie.push.apply(Ie,Me.decorations)}var Y=/\S/;function ee(ve){for(var we=void 0,Ae=ve.firstChild;Ae;Ae=Ae.nextSibling){var Re=Ae.nodeType;we=Re===1?we?ve:Ae:Re===3&&Y.test(Ae.nodeValue)?ve:we}return we===ve?void 0:we}function oe(ve,we){var Ae={},Re;(function(){for(var De=ve.concat(we),Ve=[],et={},ze=0,Xe=De.length;ze<Xe;++ze){var qe=De[ze],He=qe[3];if(He)for(var Be=He.length;--Be>=0;)Ae[He.charAt(Be)]=qe;var Se=qe[1],Ze=""+Se;et.hasOwnProperty(Ze)||(Ve.push(Se),et[Ze]=null)}Ve.push(/[\0-\uffff]/),Re=P(Ve)})();var Ie=we.length,Me=function(De){for(var Ve=De.sourceCode,et=De.basePos,ze=De.sourceNode,Xe=[et,o],qe=0,He=Ve.match(Re)||[],Be={},Se=0,Ze=He.length;Se<Ze;++Se){var Je=He[Se],Le=Be[Je],Ue=void 0,ge;if(typeof Le=="string")ge=!1;else{var de=Ae[Je.charAt(0)];if(de)Ue=Je.match(de[1]),Le=de[0];else{for(var fe=0;fe<Ie;++fe)if(de=we[fe],Ue=Je.match(de[1]),Ue){Le=de[0];break}Ue||(Le=o)}ge=Le.length>=5&&Le.substring(0,5)==="lang-",ge&&!(Ue&&typeof Ue[1]=="string")&&(ge=!1,Le=g),ge||(Be[Je]=Le)}var Q=qe;if(qe+=Je.length,!ge)Xe.push(et+Q,Le);else{var J=Ue[1],re=Je.indexOf(J),le=re+J.length;Ue[2]&&(le=Je.length-Ue[2].length,re=le-J.length);var Te=Le.substring(5);H(ze,et+Q,Je.substring(0,re),Me,Xe),H(ze,et+Q+re,J,ce(Te,J),Xe),H(ze,et+Q+le,Je.substring(le),Me,Xe)}}De.decorations=Xe};return Me}function Ee(ve){var we=[],Ae=[];ve.tripleQuotedStrings?we.push([c,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):ve.multiLineStrings?we.push([c,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):we.push([c,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),ve.verbatimStrings&&Ae.push([c,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var Re=ve.hashComments;Re&&(ve.cStyleComments?(Re>1?we.push([x,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):we.push([x,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Ae.push([c,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):we.push([x,/^#[^\r\n]*/,null,"#"])),ve.cStyleComments&&(Ae.push([x,/^\/\/[^\r\n]*/,null]),Ae.push([x,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Ie=ve.regexLiterals;if(Ie){var Me=Ie>1?"":`
|
|
\r`,De=Me?".":"[\\S\\s]",Ve="/(?=[^/*"+Me+"])(?:[^/\\x5B\\x5C"+Me+"]|\\x5C"+De+"|\\x5B(?:[^\\x5C\\x5D"+Me+"]|\\x5C"+De+")*(?:\\x5D|$))+/";Ae.push(["lang-regex",RegExp("^"+W+"("+Ve+")")])}var et=ve.types;et&&Ae.push([h,et]);var ze=(""+ve.keywords).replace(/^ | $/g,"");ze.length&&Ae.push([L,new RegExp("^(?:"+ze.replace(/[\s,]+/g,"|")+")\\b"),null]),we.push([o,/^\s+/,null,` \r
|
|
\xA0`]);var Xe="^.[^\\s\\w.$@'\"`/\\\\]*";return ve.regexLiterals&&(Xe+="(?!s*/)"),Ae.push([p,/^@[a-z_$][a-z_$@0-9]*/i,null],[h,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[o,/^[a-z_$][a-z_$@0-9]*/i,null],[p,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[o,/^\\[\s\S]?/,null],[d,new RegExp(Xe),null]),oe(we,Ae)}var pe=Ee({keywords:A,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function me(ve,we,Ae){for(var Re=/(?:^|\s)nocode(?:\s|$)/,Ie=/\r\n?|\n/,Me=ve.ownerDocument,De=Me.createElement("li");ve.firstChild;)De.appendChild(ve.firstChild);var Ve=[De];function et(Se){var Ze=Se.nodeType;if(Ze==1&&!Re.test(Se.className))if(Se.nodeName==="br")ze(Se),Se.parentNode&&Se.parentNode.removeChild(Se);else for(var Je=Se.firstChild;Je;Je=Je.nextSibling)et(Je);else if((Ze==3||Ze==4)&&Ae){var Le=Se.nodeValue,Ue=Le.match(Ie);if(Ue){var ge=Le.substring(0,Ue.index);Se.nodeValue=ge;var de=Le.substring(Ue.index+Ue[0].length);if(de){var fe=Se.parentNode;fe.insertBefore(Me.createTextNode(de),Se.nextSibling)}ze(Se),ge||Se.parentNode.removeChild(Se)}}}function ze(Se){for(;!Se.nextSibling;)if(Se=Se.parentNode,!Se)return;function Ze(Ue,ge){var de=ge?Ue.cloneNode(!1):Ue,fe=Ue.parentNode;if(fe){var Q=Ze(fe,1),J=Ue.nextSibling;Q.appendChild(de);for(var re=J;re;re=J)J=re.nextSibling,Q.appendChild(re)}return de}for(var Je=Ze(Se.nextSibling,0),Le;(Le=Je.parentNode)&&Le.nodeType===1;)Je=Le;Ve.push(Je)}for(var Xe=0;Xe<Ve.length;++Xe)et(Ve[Xe]);we===(we|0)&&Ve[0].setAttribute("value",we);var qe=Me.createElement("ol");qe.className="linenums";for(var He=Math.max(0,we-1|0)||0,Xe=0,Be=Ve.length;Xe<Be;++Xe)De=Ve[Xe],De.className="L"+(Xe+He)%10,De.firstChild||De.appendChild(Me.createTextNode("\xA0")),qe.appendChild(De);ve.appendChild(qe)}function he(ve){var we=/\bMSIE\s(\d+)/.exec(navigator.userAgent);we=we&&+we[1]<=8;var Ae=/\n/g,Re=ve.sourceCode,Ie=Re.length,Me=0,De=ve.spans,Ve=De.length,et=0,ze=ve.decorations,Xe=ze.length,qe=0;ze[Xe]=Ie;var He,Be;for(Be=He=0;Be<Xe;)ze[Be]!==ze[Be+2]?(ze[He++]=ze[Be++],ze[He++]=ze[Be++]):Be+=2;for(Xe=He,Be=He=0;Be<Xe;){for(var Se=ze[Be],Ze=ze[Be+1],Je=Be+2;Je+2<=Xe&&ze[Je+1]===Ze;)Je+=2;ze[He++]=Se,ze[He++]=Ze,Be=Je}Xe=ze.length=He;var Le=ve.sourceNode,Ue="";Le&&(Ue=Le.style.display,Le.style.display="none");try{for(var ge=null;et<Ve;){var de=De[et],fe=De[et+2]||Ie,Q=ze[qe+2]||Ie,Je=Math.min(fe,Q),J=De[et+1],re;if(J.nodeType!==1&&(re=Re.substring(Me,Je))){we&&(re=re.replace(Ae,"\r")),J.nodeValue=re;var le=J.ownerDocument,Te=le.createElement("span");Te.className=ze[qe+1];var _e=J.parentNode;_e.replaceChild(Te,J),Te.appendChild(J),Me<fe&&(De[et+1]=J=le.createTextNode(Re.substring(Je,fe)),_e.insertBefore(J,Te.nextSibling))}Me=Je,Me>=fe&&(et+=2),Me>=Q&&(qe+=2)}}finally{Le&&(Le.style.display=Ue)}}var se={};function ne(ve,we){for(var Ae=we.length;--Ae>=0;){var Re=we[Ae];se.hasOwnProperty(Re)?M.console&&console.warn("cannot override language handler %s",Re):se[Re]=ve}}function ce(ve,we){return ve&&se.hasOwnProperty(ve)||(ve=/^\s*</.test(we)?"default-markup":"default-code"),se[ve]}ne(pe,["default-code"]),ne(oe([],[[o,/^[^<?]+/],[E,/^<!\w[^>]*(?:>|$)/],[x,/^<\!--[\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"]),ne(oe([[o,/^[\s]+/,null,` \r
|
|
`],[N,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[T,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[_,/^(?!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"]),ne(oe([],[[N,/^[\s\S]+/]]),["uq.val"]),ne(Ee({keywords:v,hashComments:!0,cStyleComments:!0,types:y}),["c","cc","cpp","cxx","cyc","m"]),ne(Ee({keywords:"null,true,false"}),["json"]),ne(Ee({keywords:S,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:y}),["cs"]),ne(Ee({keywords:k,cStyleComments:!0}),["java"]),ne(Ee({keywords:l,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),ne(Ee({keywords:a,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),ne(Ee({keywords:u,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),ne(Ee({keywords:s,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),ne(Ee({keywords:f,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),ne(Ee({keywords:b,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),ne(oe([],[[c,/^[\s\S]+/]]),["regex"]);function $(ve){var we=ve.langExtension;try{var Ae=I(ve.sourceNode,ve.pre),Re=Ae.sourceCode;ve.sourceCode=Re,ve.spans=Ae.spans,ve.basePos=0,ce(we,Re)(ve),he(ve)}catch(Ie){M.console&&console.log(Ie&&Ie.stack||Ie)}}function ie(ve,we,Ae){var Re=Ae||!1,Ie=we||null,Me=document.createElement("div");Me.innerHTML="<pre>"+ve+"</pre>",Me=Me.firstChild,Re&&me(Me,Re,!0);var De={langExtension:Ie,numberLines:Re,sourceNode:Me,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return $(De),Me.innerHTML}function Z(ve,we){var Ae=we||document.body,Re=Ae.ownerDocument||document;function Ie(de){return Ae.getElementsByTagName(de)}for(var Me=[Ie("pre"),Ie("code"),Ie("xmp")],De=[],Ve=0;Ve<Me.length;++Ve)for(var et=0,ze=Me[Ve].length;et<ze;++et)De.push(Me[Ve][et]);Me=null;var Xe=Date;Xe.now||(Xe={now:function(){return+new Date}});var qe=0,He=/\blang(?:uage)?-([\w.]+)(?!\S)/,Be=/\bprettyprint\b/,Se=/\bprettyprinted\b/,Ze=/pre|xmp/i,Je=/^code$/i,Le=/^(?:pre|code|xmp)$/i,Ue={};function ge(){for(var de=M.PR_SHOULD_USE_CONTINUATION?Xe.now()+250:Infinity;qe<De.length&&Xe.now()<de;qe++){for(var fe=De[qe],Q=Ue,J=fe;J=J.previousSibling;){var re=J.nodeType,le=(re===7||re===8)&&J.nodeValue;if(le?!/^\??prettify\b/.test(le):re!==3||/\S/.test(J.nodeValue))break;if(le){Q={},le.replace(/\b(\w+)=([\w:.%+-]+)/g,function(yt,Ke,Qt){Q[Ke]=Qt});break}}var Te=fe.className;if((Q!==Ue||Be.test(Te))&&!Se.test(Te)){for(var _e=!1,ke=fe.parentNode;ke;ke=ke.parentNode){var je=ke.tagName;if(Le.test(je)&&ke.className&&Be.test(ke.className)){_e=!0;break}}if(!_e){fe.className+=" prettyprinted";var it=Q.lang;if(!it){it=Te.match(He);var Oe;!it&&(Oe=ee(fe))&&Je.test(Oe.tagName)&&(it=Oe.className.match(He)),it&&(it=it[1])}var ft;if(Ze.test(fe.tagName))ft=1;else{var ot=fe.currentStyle,rt=Re.defaultView,Et=ot?ot.whiteSpace:rt&&rt.getComputedStyle?rt.getComputedStyle(fe,null).getPropertyValue("white-space"):0;ft=Et&&Et.substring(0,3)==="pre"}var st=Q.linenums;(st=st==="true"||+st)||(st=Te.match(/\blinenums\b(?::(\d+))?/),st=st?st[1]&&st[1].length?+st[1]:!0:!1),st&&me(fe,st,ft);var vt={langExtension:it,sourceNode:fe,numberLines:st,pre:ft,sourceCode:null,basePos:null,spans:null,decorations:null};$(vt)}}}qe<De.length?M.setTimeout(ge,250):typeof ve=="function"&&ve()}ge()}var ye=M.PR={createSimpleLexer:oe,registerLangHandler:ne,sourceDecorator:Ee,PR_ATTRIB_NAME:_,PR_ATTRIB_VALUE:N,PR_COMMENT:x,PR_DECLARATION:E,PR_KEYWORD:L,PR_LITERAL:p,PR_NOCODE:B,PR_PLAIN:o,PR_PUNCTUATION:d,PR_SOURCE:g,PR_STRING:c,PR_TAG:T,PR_TYPE:h,prettyPrintOne:D?M.prettyPrintOne=ie:O=ie,prettyPrint:F=D?M.prettyPrint=Z:F=Z},Ce=M.define;typeof Ce=="function"&&Ce.amd&&Ce("google-code-prettify",[],function(){return ye})})()},"T+//":function(nt,Qe,te){"use strict";te.r(Qe);var q=te("Q9mQ"),G=te("diRs"),D=te("2qtc"),z=te("kLXV"),U=te("miYZ"),O=te("tsqr"),F=te("9og8"),M=te("tJVT"),R=te("B9cy"),C=te("Ol7k"),m=te("lUTK"),v=te("BvKs"),k=te("WmNS"),S=te.n(k),b=te("cDcd"),f=te.n(b),u=te("m3rI"),a=te("p0QG"),s=te.n(a),l=te("ErOA"),A=te("9kvl"),y=te("RCxd"),c=te("xGfz"),L=te("xKgJ"),x=te("5NDa"),h=te("5rEg");function p(se){var ne=se.user,ce=se.CategoryId,$=se.IsShow,ie=se.setIsShow,Z=se.dispatch,ye=se.init,Ce=Object(b.useState)(),ve=Object(M.a)(Ce,2),we=ve[0],Ae=ve[1];return f.a.createElement(z.a,{title:ce?"\u65B0\u5EFA\u4E09\u7EA7\u7C7B\u76EE":"\u65B0\u5EFA\u4E8C\u7EA7\u7C7B\u76EE",width:424,onCancel:function(){ie(!1)},onOk:Object(F.a)(S.a.mark(function Re(){var Ie;return S.a.wrap(function(De){for(;;)switch(De.prev=De.next){case 0:if(we){De.next=3;break}return O.b.error("\u680F\u76EE\u540D\u4E0D\u80FD\u4E3A\u7A7A"),De.abrupt("return");case 3:return De.next=5,Object(l.a)("/api/programas.json",{method:"post",body:{name:we,parent_id:ce}});case 5:Ie=De.sent,Ie.status===0&&(O.b.info("\u521B\u5EFA\u6210\u529F"),ie(!1),Ae(""),ye());case 7:case"end":return De.stop()}},Re)})),visible:$},f.a.createElement(h.a,{value:we,onChange:function(Ie){return Ae(Ie.target.value)},placeholder:"\u8BF7\u8F93\u5165\u4E0D\u8D85\u8FC710\u4E2A\u6C49\u5B57\u7684\u540D\u79F0",maxLength:10}))}var d=Object(A.a)(function(se){var ne=se.user;return{user:ne}})(p);function o(se){var ne=se.user,ce=se.CategoryId,$=se.name,ie=se.IsShow,Z=se.setIsShow,ye=se.dispatch,Ce=se.init,ve=Object(b.useState)(),we=Object(M.a)(ve,2),Ae=we[0],Re=we[1];return Object(b.useEffect)(function(){Re($)},[$]),f.a.createElement(z.a,{title:"\u76EE\u5F55\u91CD\u547D\u540D",width:424,onCancel:function(){Z(!1)},onOk:Object(F.a)(S.a.mark(function Ie(){var Me;return S.a.wrap(function(Ve){for(;;)switch(Ve.prev=Ve.next){case 0:if(Ae){Ve.next=3;break}return O.b.error("\u680F\u76EE\u540D\u4E0D\u80FD\u4E3A\u7A7A"),Ve.abrupt("return");case 3:return Ve.next=5,Object(l.a)("/api/programas/".concat(ce,"/rename.json"),{method:"put",body:{name:Ae,id:ce}});case 5:Me=Ve.sent,Me.status===0&&(O.b.info("\u4FEE\u6539\u6210\u529F"),Z(!1),Re(""),Ce());case 7:case"end":return Ve.stop()}},Ie)})),visible:ie},f.a.createElement(h.a,{value:Ae,onChange:function(Me){return Re(Me.target.value)},placeholder:"\u8BF7\u8F93\u5165\u4E0D\u8D85\u8FC710\u4E2A\u6C49\u5B57\u7684\u540D\u79F0",maxLength:10}))}var T=Object(A.a)(function(se){var ne=se.user;return{user:ne}})(o),E=te("+L6B"),g=te("2/Rp"),_=te("9Bee");function N(se){var ne,ce,$,ie,Z=se.user,ye=se.ItemData,Ce=se.setIssee,ve=se.dispatch,we=se.init;return f.a.createElement("div",null,f.a.createElement("div",{style:{textAlign:"right"}},Object(L.v)()&&f.a.createElement(g.a,{onClick:function(){return Ce(!1)}},"\u7F16\u8F91")),f.a.createElement(_.a,{value:ye.content}),(ye==null||((ne=ye.attachment)===null||ne===void 0)?void 0:ne.id)&&f.a.createElement("div",null,f.a.createElement("a",{href:ye==null||((ce=ye.attachment)===null||ce===void 0)?void 0:ce.url,target:"_self",download:ye==null||(($=ye.attachment)===null||$===void 0)?void 0:$.title},f.a.createElement("i",{style:{color:"#29BD8B"},className:"font-14 color-green iconfont icon-fujian mr8"}),f.a.createElement("span",{style:{color:"#000000"}},ye==null||((ie=ye.attachment)===null||ie===void 0)?void 0:ie.title))))}var B=Object(A.a)(function(se){var ne=se.user;return{user:ne}})(N),W=te("DZo9"),P=te("8z0m"),I=te("Ot1p"),H=te("hJwl");function Y(se){var ne=se.user,ce=se.ItemData,$=se.setIssee,ie=se.CategoryId,Z=se.dispatch,ye=se.init,Ce=Object(b.useState)([]),ve=Object(M.a)(Ce,2),we=ve[0],Ae=ve[1],Re=Object(b.useState)(ce.content),Ie=Object(M.a)(Re,2),Me=Ie[0],De=Ie[1];function Ve(){var He,Be=[];return ce==null||((He=ce.attachments)===null||He===void 0)||He.map(function(Se){var Ze={uid:Se==null?void 0:Se.id,name:Se.title,response:{id:Se.id}};Be.push(Ze)}),Be}var et={name:"file",multiple:!0,action:u.a.API_SERVER+"/api/attachments.json",defaultFileList:Ve(),onRemove:function(Be){Object(H.t)({id:Be.uid})},onChange:function(Be){console.log("info",Be);var Se=Be.file.status;Se!=="uploading",Se==="removed"&&Ae(Be.fileList),Se==="done"?(Ae(Be.fileList),O.b.success("".concat(Be.file.name," \u6587\u4EF6\u4E0A\u4F20\u6210\u529F"))):Se==="error"&&O.b.error("".concat(Be.file.name," \u6587\u4EF6\u4E0A\u4F20\u5931\u8D25"))},beforeUpload:function(Be){var Se=Be.size/1024/1024<150;return Se||O.b.info("\u6587\u4EF6\u5927\u5C0F\u5FC5\u987B\u5C0F\u4E8E150MB"),Se}};function ze(){return Xe.apply(this,arguments)}function Xe(){return Xe=Object(F.a)(S.a.mark(function He(){var Be;return S.a.wrap(function(Ze){for(;;)switch(Ze.prev=Ze.next){case 0:return Ze.next=2,Object(l.a)("/api/programas/".concat(ie,"/update_content.json"),{method:"put",body:{id:ie,content:Me,attachment_id:qe(we)}});case 2:Be=Ze.sent,Be&&(O.b.info("\u63D0\u4EA4\u6210\u529F"),$(!0));case 4:case"end":return Ze.stop()}},He)})),Xe.apply(this,arguments)}function qe(He){var Be;return He&&He.map(function(Se){Be=Se.response.id}),Be}return f.a.createElement("div",null,f.a.createElement(I.a,{defaultValue:Me,onChange:function(Be){return De(Be)}}),f.a.createElement(P.a,et,f.a.createElement(g.a,{className:"uploadBtn"},"\u4E0A\u4F20\u9644\u4EF6"),"(\u5355\u4E2A\u6587\u4EF6150M\u4EE5\u5185)"),f.a.createElement("p",{style:{marginTop:"10px"}},f.a.createElement(g.a,{style:{width:"90px"},onClick:function(){return ze()}},"\u63D0\u4EA4"),f.a.createElement(g.a,{style:{marginLeft:"30px",width:"90px"},type:"primary",onClick:function(){return $(!0)}},"\u53D6\u6D88")))}var ee=Object(A.a)(function(se){var ne=se.user;return{user:ne}})(Y),oe=v.a.SubMenu,Ee=C.a.Content,pe=C.a.Sider;function me(se){var ne,ce=se.user,$=se.dispatch,ie=se.globalSetting,Z=Object(b.useState)(),ye=Object(M.a)(Z,2),Ce=ye[0],ve=ye[1],we=Object(b.useState)(!1),Ae=Object(M.a)(we,2),Re=Ae[0],Ie=Ae[1],Me=Object(b.useState)(),De=Object(M.a)(Me,2),Ve=De[0],et=De[1],ze=Object(b.useState)(),Xe=Object(M.a)(ze,2),qe=Xe[0],He=Xe[1],Be=Object(b.useState)(!1),Se=Object(M.a)(Be,2),Ze=Se[0],Je=Se[1],Le=Object(b.useState)(""),Ue=Object(M.a)(Le,2),ge=Ue[0],de=Ue[1],fe=Object(b.useState)(""),Q=Object(M.a)(fe,2),J=Q[0],re=Q[1],le=Object(b.useState)(!0),Te=Object(M.a)(le,2),_e=Te[0],ke=Te[1];Object(b.useEffect)(function(){je()},[]),console.log("globalSetting",ie);function je(){return it.apply(this,arguments)}function it(){return it=Object(F.a)(S.a.mark(function st(){var vt;return S.a.wrap(function(Ke){for(;;)switch(Ke.prev=Ke.next){case 0:return Ke.next=2,Object(l.a)("/api/programas.json",{method:"get"});case 2:vt=Ke.sent,vt&&et(vt==null?void 0:vt.programas);case 4:case"end":return Ke.stop()}},st)})),it.apply(this,arguments)}var Oe=function(){var st=Object(F.a)(S.a.mark(function vt(yt,Ke,Qt){var Mt;return S.a.wrap(function(kt){for(;;)switch(kt.prev=kt.next){case 0:kt.t0=yt,kt.next=kt.t0===1?3:kt.t0===2?6:kt.t0===3?10:kt.t0===4?15:17;break;case 3:return He(Ke==null?void 0:Ke.id),Ie(!0),kt.abrupt("break",17);case 6:return He(Ke==null?void 0:Ke.id),Je(!0),de(Ke==null?void 0:Ke.name),kt.abrupt("break",17);case 10:return kt.next=12,Object(l.a)("/api/programas/".concat(Ke==null?void 0:Ke.id,"/top.json"),{method:"post",body:{id:Ke==null?void 0:Ke.id}});case 12:return Mt=kt.sent,Mt.status===0&&je(),kt.abrupt("break",17);case 15:return ft(f.a.createElement("p",null,"\u5220\u9664\u4E4B\u540E\u4E0D\u80FD\u6062\u590D,",f.a.createElement("br",null),"\u662F\u5426\u786E\u8BA4\u5220\u9664?"),Object(F.a)(S.a.mark(function fr(){var Zr;return S.a.wrap(function(vr){for(;;)switch(vr.prev=vr.next){case 0:return vr.next=2,Object(l.a)("/api/programas/".concat(Ke==null?void 0:Ke.id,".json"),{method:"delete",body:{id:Ke==null?void 0:Ke.id}});case 2:Zr=vr.sent,Zr.status===0&&(O.b.info("\u5220\u9664\u6210\u529F"),je());case 4:case"end":return vr.stop()}},fr)}))),kt.abrupt("break",17);case 17:case"end":return kt.stop()}},vt)}));return function(yt,Ke,Qt){return st.apply(this,arguments)}}(),ft=function(vt,yt){z.a.confirm({centered:!0,title:"\u63D0\u793A",icon:f.a.createElement(y.a,null),content:vt,okText:"\u786E\u8BA4",onOk:function(){return yt()},cancelText:"\u53D6\u6D88"})},ot=function(vt,yt){return f.a.createElement("div",{className:s.a.leftMenuActions},yt===1&&f.a.createElement("p",{className:"current",onClick:function(){return Oe(1,vt,yt)}},"\u65B0\u5EFA"),f.a.createElement("p",{className:"current",onClick:function(){return Oe(2,vt,yt)}},"\u91CD\u547D\u540D"),f.a.createElement("p",{className:"current",onClick:function(){return Oe(3,vt,yt)}},"\u7F6E\u9876"),f.a.createElement("p",{className:"current",onClick:function(){return Oe(4,vt,yt)}},"\u5220\u9664"))};function rt(){return Et.apply(this,arguments)}function Et(){return Et=Object(F.a)(S.a.mark(function st(){var vt;return S.a.wrap(function(Ke){for(;;)switch(Ke.prev=Ke.next){case 0:return Ke.next=2,Object(l.a)("/api/programas/".concat(qe,"/content.json"),{method:"get",params:{id:qe}});case 2:vt=Ke.sent,vt&&re(vt);case 4:case"end":return Ke.stop()}},st)})),Et.apply(this,arguments)}return f.a.createElement("div",{style:{marginBottom:"40px"}},f.a.createElement("img",{style:{width:"100%"},src:u.a.IMG_SERVER+"/".concat(ie==null||((ne=ie.setting)===null||ne===void 0)?void 0:ne.shixun_banner_url)}),f.a.createElement("div",{className:"edu-container minH500",style:{display:"flex",width:"1200px"}},f.a.createElement(pe,{width:244,className:s.a.leftMenus,style:{background:"none",marginTop:"20px",height:"auto"}},f.a.createElement(v.a,{mode:"inline"},Ve==null?void 0:Ve.map(function(st,vt){if((st==null?void 0:st.children.length)>0){var yt;return f.a.createElement(oe,{title:f.a.createElement("span",{className:"font16"},f.a.createElement("span",null,st.name),!Object(L.v)()&&f.a.createElement("span",null),Object(L.v)()&&f.a.createElement(G.a,{placement:"right",content:function(){return ot(st,1)},trigger:"hover"},f.a.createElement("span",{className:["iconfont icon-sandian",s.a.actions].join(" ")})))},st==null||((yt=st.children)===null||yt===void 0)?void 0:yt.map(function(Ke,Qt){return f.a.createElement(v.a.Item,{className:s.a===null||s.a===void 0?void 0:s.a.SubMentItem,onClick:function(){He(Ke==null?void 0:Ke.id),qe=Ke==null?void 0:Ke.id,rt()}},f.a.createElement("span",{style:{flex:"1"}},Ke==null?void 0:Ke.name),Object(L.v)()&&f.a.createElement(G.a,{placement:"right",content:function(){return ot(Ke,2)},trigger:"hover"},f.a.createElement("span",{className:["iconfont icon-sandian",s.a.actions].join(" ")})))}))}else return f.a.createElement(v.a.Item,{className:s.a===null||s.a===void 0?void 0:s.a.SubMentItem,onClick:function(){He(st==null?void 0:st.id),qe=st==null?void 0:st.id,rt()}},f.a.createElement("span",{style:{flex:"1"}},st==null?void 0:st.name),Object(L.v)()&&f.a.createElement(G.a,{placement:"right",content:function(){return ot(st,1)},trigger:"hover"},f.a.createElement("span",{className:["iconfont icon-sandian",s.a.actions].join(" ")})))}),f.a.createElement(v.a.Item,{onClick:function(){He(""),qe="",Ie(!0)},style:{color:"#0152d9",fontSize:"16px",height:"40px",display:"flex",alignItems:"center"},icon:f.a.createElement(c.a,{style:{color:"#0152d9",fontSize:"16px"}})},"\u65B0\u589E\u4E8C\u7EA7\u7C7B\u76EE"))),f.a.createElement("div",{style:{width:"937px",marginLeft:"17px",background:"#fff",padding:"20px"}},_e&&f.a.createElement(B,{ItemData:J,setIssee:ke}),_e===!1&&f.a.createElement(ee,{ItemData:J,setIssee:ke,CategoryId:qe}))),f.a.createElement(d,{CategoryId:qe,IsShow:Re,setIsShow:Ie,init:je}),f.a.createElement(T,{CategoryId:qe,name:ge,IsShow:Ze,setIsShow:Je,init:je}))}var he=Qe.default=Object(A.a)(function(se){var ne=se.user,ce=se.globalSetting;return{user:ne,globalSetting:ce}})(me)},"VrN/":function(nt,Qe,te){(function(q,G){nt.exports=G()})(this,function(){"use strict";var q=navigator.userAgent,G=navigator.platform,D=/gecko\/\d/i.test(q),z=/MSIE \d/.test(q),U=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(q),O=/Edge\/(\d+)/.exec(q),F=z||U||O,M=F&&(z?document.documentMode||6:+(O||U)[1]),R=!O&&/WebKit\//.test(q),C=R&&/Qt\/\d+\.\d+/.test(q),m=!O&&/Chrome\//.test(q),v=/Opera\//.test(q),k=/Apple Computer/.test(navigator.vendor),S=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(q),b=/PhantomJS/.test(q),f=!O&&/AppleWebKit/.test(q)&&/Mobile\/\w+/.test(q),u=/Android/.test(q),a=f||u||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(q),s=f||/Mac/.test(G),l=/\bCrOS\b/.test(q),A=/win/i.test(G),y=v&&q.match(/Version\/(\d*\.\d*)/);y&&(y=Number(y[1])),y&&y>=15&&(v=!1,R=!0);var c=s&&(C||v&&(y==null||y<12.11)),L=D||F&&M>=9;function x(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var h=function(e,t){var n=e.className,r=x(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 p(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function d(e,t){return p(e).appendChild(t)}function o(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),typeof t=="string")i.appendChild(document.createTextNode(t));else if(t)for(var w=0;w<t.length;++w)i.appendChild(t[w]);return i}function T(e,t,n,r){var i=o(e,t,n,r);return i.setAttribute("role","presentation"),i}var E;document.createRange?E=function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:E=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 g(e,t){if(t.nodeType==3&&(t=t.parentNode),e.contains)return e.contains(t);do if(t.nodeType==11&&(t=t.host),t==e)return!0;while(t=t.parentNode)}function _(){var e;try{e=document.activeElement}catch(t){e=document.body||null}for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e}function N(e,t){var n=e.className;x(t).test(n)||(e.className+=(n?" ":"")+t)}function B(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!x(n[r]).test(t)&&(t+=" "+n[r]);return t}var W=function(e){e.select()};f?W=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:F&&(W=function(e){try{e.select()}catch(t){}});function P(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function I(e,t,n){t||(t={});for(var r in e)e.hasOwnProperty(r)&&(n!==!1||!t.hasOwnProperty(r))&&(t[r]=e[r]);return t}function H(e,t,n,r,i){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var w=r||0,j=i||0;;){var K=e.indexOf(" ",w);if(K<0||K>=t)return j+(t-w);j+=K-w,j+=n-j%n,w=K+1}}var Y=function(){this.id=null,this.f=null,this.time=0,this.handler=P(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 ee(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}var oe=50,Ee={toString:function(){return"CodeMirror.Pass"}},pe={scroll:!1},me={origin:"*mouse"},he={origin:"+move"};function se(e,t,n){for(var r=0,i=0;;){var w=e.indexOf(" ",r);w==-1&&(w=e.length);var j=w-r;if(w==e.length||i+j>=t)return r+Math.min(j,t-i);if(i+=w-r,i+=n-i%n,r=w+1,i>=t)return r}}var ne=[""];function ce(e){for(;ne.length<=e;)ne.push($(ne)+" ");return ne[e]}function $(e){return e[e.length-1]}function ie(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 ye(){}function Ce(e,t){var n;return Object.create?n=Object.create(e):(ye.prototype=e,n=new ye),t&&I(t,n),n}var ve=/[\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()||ve.test(e))}function Ae(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 Ie=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function Me(e){return e.charCodeAt(0)>=768&&Ie.test(e)}function De(e,t,n){for(;(n<0?t>0:t<e.length)&&Me(e.charAt(t));)t+=n;return t}function Ve(e,t,n){for(var r=t>n?-1:1;;){if(t==n)return t;var i=(t+n)/2,w=r<0?Math.ceil(i):Math.floor(i);if(w==t)return e(w)?t:n;e(w)?n=w:t=w+r}}function et(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var i=!1,w=0;w<e.length;++w){var j=e[w];(j.from<n&&j.to>t||t==n&&j.to==t)&&(r(Math.max(j.from,t),Math.min(j.to,n),j.level==1?"rtl":"ltr",w),i=!0)}i||r(t,n,"ltr")}var ze=null;function Xe(e,t,n){var r;ze=null;for(var i=0;i<e.length;++i){var w=e[i];if(w.from<t&&w.to>t)return i;w.to==t&&(w.from!=w.to&&n=="before"?r=i:ze=i),w.from==t&&(w.from!=w.to&&n!="before"?r=i:ze=i)}return r!=null?r:ze}var qe=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]/,w=/[LRr]/,j=/[Lb1n]/,K=/[1n]/;function X(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,be=[],Pe=0;Pe<xe;++Pe)be.push(n(V.charCodeAt(Pe)));for(var Ne=0,Ge=ue;Ne<xe;++Ne){var Ye=be[Ne];Ye=="m"?be[Ne]=Ge:Ge=Ye}for(var tt=0,$e=ue;tt<xe;++tt){var at=be[tt];at=="1"&&$e=="r"?be[tt]="n":w.test(at)&&($e=at,at=="r"&&(be[tt]="R"))}for(var ht=1,dt=be[0];ht<xe-1;++ht){var bt=be[ht];bt=="+"&&dt=="1"&&be[ht+1]=="1"?be[ht]="1":bt==","&&dt==be[ht+1]&&(dt=="1"||dt=="n")&&(be[ht]=dt),dt=bt}for(var _t=0;_t<xe;++_t){var Vt=be[_t];if(Vt==",")be[_t]="N";else if(Vt=="%"){var Ut=void 0;for(Ut=_t+1;Ut<xe&&be[Ut]=="%";++Ut);for(var cr=_t&&be[_t-1]=="!"||Ut<xe&&be[Ut]=="1"?"1":"N",ar=_t;ar<Ut;++ar)be[ar]=cr;_t=Ut-1}}for(var Wt=0,or=ue;Wt<xe;++Wt){var $t=be[Wt];or=="L"&&$t=="1"?be[Wt]="L":w.test($t)&&(or=$t)}for(var Gt=0;Gt<xe;++Gt)if(i.test(be[Gt])){var Ht=void 0;for(Ht=Gt+1;Ht<xe&&i.test(be[Ht]);++Ht);for(var Ft=(Gt?be[Gt-1]:ue)=="L",sr=(Ht<xe?be[Ht]:ue)=="L",zn=Ft==sr?Ft?"L":"R":ue,Jr=Gt;Jr<Ht;++Jr)be[Jr]=zn;Gt=Ht-1}for(var qt=[],Or,Yt=0;Yt<xe;)if(j.test(be[Yt])){var Va=Yt;for(++Yt;Yt<xe&&j.test(be[Yt]);++Yt);qt.push(new X(0,Va,Yt))}else{var Ur=Yt,vn=qt.length,yn=ae=="rtl"?1:0;for(++Yt;Yt<xe&&be[Yt]!="L";++Yt);for(var rr=Ur;rr<Yt;)if(K.test(be[rr])){Ur<rr&&(qt.splice(vn,0,new X(1,Ur,rr)),vn+=yn);var Xn=rr;for(++rr;rr<Yt&&K.test(be[rr]);++rr);qt.splice(vn,0,new X(2,Xn,rr)),vn+=yn,Ur=rr}else++rr;Ur<Yt&&qt.splice(vn,0,new X(1,Ur,Yt))}return ae=="ltr"&&(qt[0].level==1&&(Or=V.match(/^\s+/))&&(qt[0].from=Or[0].length,qt.unshift(new X(0,0,Or[0].length))),$(qt).level==1&&(Or=V.match(/\s+$/))&&($(qt).to-=Or[0].length,qt.push(new X(0,xe-Or[0].length,xe)))),ae=="rtl"?qt.reverse():qt}}();function He(e,t){var n=e.order;return n==null&&(n=e.order=qe(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 Ze(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 w=ee(i,n);w>-1&&(r[t]=i.slice(0,w).concat(i.slice(w+1)))}}}function Le(e,t){var n=Ze(e,t);if(!n.length)return;for(var r=Array.prototype.slice.call(arguments,2),i=0;i<n.length;++i)n[i].apply(null,r)}function Ue(e,t,n){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Le(e,n||t.type,e,t),re(t)||t.codemirrorIgnore}function ge(e){var t=e._handlers&&e._handlers.cursorActivity;if(!t)return;for(var n=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),r=0;r<t.length;++r)ee(n,t[r])==-1&&n.push(t[r])}function de(e,t){return Ze(e,t).length>0}function fe(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 re(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function le(e){Q(e),J(e)}function Te(e){return e.target||e.srcElement}function _e(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),s&&e.ctrlKey&&t==1&&(t=3),t}var ke=function(){if(F&&M<9)return!1;var e=o("div");return"draggable"in e||"dragDrop"in e}(),je;function it(e){if(je==null){var t=o("span","\u200B");d(e,o("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(je=t.offsetWidth<=1&&t.offsetHeight>2&&!(F&&M<8))}var n=je?o("span","\u200B"):o("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var Oe;function ft(e){if(Oe!=null)return Oe;var t=d(e,document.createTextNode("A\u062EA")),n=E(t,0,1).getBoundingClientRect(),r=E(t,1,2).getBoundingClientRect();return p(e),!n||n.left==n.right?!1:Oe=r.right-n.right<3}var ot=`
|
|
|
|
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 w=e.slice(t,e.charAt(i-1)=="\r"?i-1:i),j=w.indexOf("\r");j!=-1?(n.push(w.slice(0,j)),t+=j+1):(n.push(w),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},rt=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(n){}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},Et=function(){var e=o("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),st=null;function vt(e){if(st!=null)return st;var t=d(e,o("span","x")),n=t.getBoundingClientRect(),r=E(t,0,1).getBoundingClientRect();return st=Math.abs(n.left-r.left)>1}var yt={},Ke={};function Qt(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),yt[e]=t}function Mt(e,t){Ke[e]=t}function Bt(e){if(typeof e=="string"&&Ke.hasOwnProperty(e))e=Ke[e];else if(e&&typeof e.name=="string"&&Ke.hasOwnProperty(e.name)){var t=Ke[e.name];typeof t=="string"&&(t={name:t}),e=Ce(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Bt("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Bt("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function kt(e,t){t=Bt(t);var n=yt[t.name];if(!n)return kt(e,"text/plain");var r=n(e,t);if(fr.hasOwnProperty(t.name)){var i=fr[t.name];for(var w in i){if(!i.hasOwnProperty(w))continue;r.hasOwnProperty(w)&&(r["_"+w]=r[w]),r[w]=i[w]}}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var j in t.modeProps)r[j]=t.modeProps[j];return r}var fr={};function Zr(e,t){var n=fr.hasOwnProperty(e)?fr[e]:fr[e]={};I(t,n)}function hr(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var i=t[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n}function vr(e,t){for(var n;e.innerMode&&!(n=e.innerMode(t),!n||n.mode==e);)t=n.state,e=n.mode;return n||{mode:e,state:t}}function qr(e,t,n){return e.startState?e.startState(t,n):!0}var It=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};It.prototype.eol=function(){return this.pos>=this.string.length},It.prototype.sol=function(){return this.pos==this.lineStart},It.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},It.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},It.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},It.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},It.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},It.prototype.skipToEnd=function(){this.pos=this.string.length},It.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},It.prototype.backUp=function(e){this.pos-=e},It.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=H(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?H(this.string,this.lineStart,this.tabSize):0)},It.prototype.indentation=function(){return H(this.string,null,this.tabSize)-(this.lineStart?H(this.string,this.lineStart,this.tabSize):0)},It.prototype.match=function(e,t,n){if(typeof e=="string"){var r=function(j){return n?j.toLowerCase():j},i=this.string.substr(this.pos,e.length);if(r(i)==r(e))return t!==!1&&(this.pos+=e.length),!0}else{var w=this.string.slice(this.pos).match(e);return w&&w.index>0?null:(w&&t!==!1&&(this.pos+=w[0].length),w)}},It.prototype.current=function(){return this.string.slice(this.start,this.pos)},It.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},It.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},It.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function ut(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],w=i.chunkSize();if(t<w){n=i;break}t-=w}return n.lines[t]}function wr(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,function(w){var j=w.text;i==n.line&&(j=j.slice(0,n.ch)),i==t.line&&(j=j.slice(t.ch)),r.push(j),++i}),r}function Vn(e,t,n){var r=[];return e.iter(t,n,function(i){r.push(i.text)}),r}function mr(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=ee(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var i=0;!(r.children[i]==t);++i)n+=r.children[i].chunkSize();return n+t.first}function Cr(e,t){var n=e.first;e:do{for(var r=0;r<e.children.length;++r){var i=e.children[r],w=i.height;if(t<w){e=i;continue e}t-=w,n+=i.chunkSize()}return n}while(!e.lines);for(var j=0;j<e.lines.length;++j){var K=e.lines[j],X=K.height;if(t<X)break;t-=X}return n+j}function en(e,t){return t>=e.first&&t<e.first+e.size}function bn(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 mt(e,t){return e.line-t.line||e.ch-t.ch}function tn(e,t){return e.sticky==t.sticky&&mt(e,t)==0}function rn(e){return Fe(e.line,e.ch)}function nn(e,t){return mt(e,t)<0?t:e}function En(e,t){return mt(e,t)<0?e:t}function Yn(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function gt(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,ut(e,n).text.length):Ci(t,ut(e,t.line).text.length)}function Ci(e,t){var n=e.ch;return n==null||n>t?Fe(e.line,t):n<0?Fe(e.line,0):e}function Ai(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=gt(e,t[r]);return n}var an=function(e,t){this.state=e,this.lookAhead=t},lr=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};lr.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},lr.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}},lr.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},lr.fromSaved=function(e,t,n){return t instanceof an?new lr(e,hr(e.mode,t.state),n,t.lookAhead):new lr(e,hr(e.mode,t),n)},lr.prototype.save=function(e){var t=e!==!1?hr(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new an(t,this.maxLookAhead):t};function Li(e,t,n,r){var i=[e.state.modeGen],w={};Jn(e,t.text,e.doc.mode,n,function(V,ae){return i.push(V,ae)},w,r);for(var j=n.state,K=function(V){n.baseTokens=i;var ae=e.state.overlays[V],ue=1,xe=0;n.state=!0,Jn(e,t.text,ae.mode,n,function(be,Pe){for(var Ne=ue;xe<be;){var Ge=i[ue];Ge>be&&i.splice(ue,1,be,i[ue+1],Ge),ue+=2,xe=Math.min(be,Ge)}if(!Pe)return;if(ae.opaque)i.splice(Ne,ue-Ne,be,"overlay "+Pe),ue=Ne+2;else for(;Ne<ue;Ne+=2){var Ye=i[Ne+1];i[Ne+1]=(Ye?Ye+" ":"")+"overlay "+Pe}},w),n.state=j,n.baseTokens=null,n.baseTokenPos=1},X=0;X<e.state.overlays.length;++X)K(X);return{styles:i,classes:w.bgClass||w.textClass?w:null}}function $n(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=We(e,Ct(t)),i=t.text.length>e.options.maxHighlightLength&&hr(e.doc.mode,r.state),w=Li(e,t,r);i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=w.styles,w.classes?t.styleClasses=w.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 We(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new lr(r,!0,t);var w=Rr(e,t,n),j=w>r.first&&ut(r,w-1).stateAfter,K=j?lr.fromSaved(r,j,w):new lr(r,qr(r.mode),w);return r.iter(w,t,function(X){Qn(e,X.text,K);var V=K.line;X.stateAfter=V==t-1||V%5==0||V>=i.viewFrom&&V<i.viewTo?K.save():null,K.nextLine()}),n&&(r.modeFrontier=K.line),K}function Qn(e,t,n,r){var i=e.doc.mode,w=new It(t,e.options.tabSize,n);for(w.start=w.pos=r||0,t==""&&Di(i,n.state);!w.eol();)xn(i,w,n.state),w.start=w.pos}function Di(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var n=vr(e,t);if(n.mode.blankLine)return n.mode.blankLine(n.state)}function xn(e,t,n,r){for(var i=0;i<10;i++){r&&(r[0]=vr(e,n).mode);var w=e.token(t,n);if(t.pos>t.start)return w}throw new Error("Mode "+e.name+" failed to advance stream.")}var on=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function Nr(e,t,n,r){var i=e.doc,w=i.mode,j;t=gt(i,t);var K=ut(i,t.line),X=We(e,t.line,n),V=new It(K.text,e.options.tabSize,X),ae;for(r&&(ae=[]);(r||V.pos<t.ch)&&!V.eol();)V.start=V.pos,j=xn(w,V,X.state),r&&ae.push(new on(V,j,hr(i.mode,X.state)));return r?ae:new on(V,j,X.state)}function Oi(e,t){if(e)for(;;){var n=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!n)break;e=e.slice(0,n.index)+e.slice(n.index+n[0].length);var r=n[1]?"bgClass":"textClass";t[r]==null?t[r]=n[2]:new RegExp("(?:^|\\s)"+n[2]+"(?:$|\\s)").test(t[r])||(t[r]+=" "+n[2])}return e}function Jn(e,t,n,r,i,w,j){var K=n.flattenSpans;K==null&&(K=e.options.flattenSpans);var X=0,V=null,ae=new It(t,e.options.tabSize,r),ue,xe=e.options.addModeClass&&[null];for(t==""&&Oi(Di(n,r.state),w);!ae.eol();){if(ae.pos>e.options.maxHighlightLength?(K=!1,j&&Qn(e,t,r,ae.pos),ae.pos=t.length,ue=null):ue=Oi(xn(n,ae,r.state,xe),w),xe){var be=xe[0].name;be&&(ue="m-"+(ue?be+" "+ue:be))}if(!K||V!=ue){for(;X<ae.start;)X=Math.min(ae.start,X+5e3),i(X,V);V=ue}ae.start=ae.pos}for(;X<ae.pos;){var Pe=Math.min(ae.pos,X+5e3);i(Pe,V),X=Pe}}function Rr(e,t,n){for(var r,i,w=e.doc,j=n?-1:t-(e.doc.mode.innerMode?1e3:100),K=t;K>j;--K){if(K<=w.first)return w.first;var X=ut(w,K-1),V=X.stateAfter;if(V&&(!n||K+(V instanceof an?V.lookAhead:0)<=w.modeFrontier))return K;var ae=H(X.text,null,e.options.tabSize);(i==null||r>ae)&&(i=K-1,r=ae)}return i}function Ri(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),e.highlightFrontier<t-10)return;for(var n=e.first,r=t-1;r>n;r--){var i=ut(e,r).stateAfter;if(i&&(!(i instanceof an)||r+i.lookAhead<t)){n=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}var _i=!1,yr=!1;function Ar(){_i=!0}function ki(){yr=!0}function Tn(e,t,n){this.marker=e,this.from=t,this.to=n}function Fr(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function Br(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n||(n=[])).push(e[r]);return n}function jr(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function aa(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var w=e[i],j=w.marker,K=w.from==null||(j.inclusiveLeft?w.from<=t:w.from<t);if(K||w.from==t&&j.type=="bookmark"&&(!n||!w.marker.insertLeft)){var X=w.to==null||(j.inclusiveRight?w.to>=t:w.to>t);(r||(r=[])).push(new Tn(j,w.from,X?null:w.to))}}return r}function Pi(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var w=e[i],j=w.marker,K=w.to==null||(j.inclusiveRight?w.to>=t:w.to>t);if(K||w.from==t&&j.type=="bookmark"&&(!n||w.marker.insertLeft)){var X=w.from==null||(j.inclusiveLeft?w.from<=t:w.from<t);(r||(r=[])).push(new Tn(j,X?null:w.from-t,w.to==null?null:w.to-t))}}return r}function _r(e,t){if(t.full)return null;var n=en(e,t.from.line)&&ut(e,t.from.line).markedSpans,r=en(e,t.to.line)&&ut(e,t.to.line).markedSpans;if(!n&&!r)return null;var i=t.from.ch,w=t.to.ch,j=mt(t.from,t.to)==0,K=aa(n,i,j),X=Pi(r,w,j),V=t.text.length==1,ae=$(t.text).length+(V?i:0);if(K)for(var ue=0;ue<K.length;++ue){var xe=K[ue];if(xe.to==null){var be=Fr(X,xe.marker);be?V&&(xe.to=be.to==null?null:be.to+ae):xe.to=i}}if(X)for(var Pe=0;Pe<X.length;++Pe){var Ne=X[Pe];if(Ne.to!=null&&(Ne.to+=ae),Ne.from==null){var Ge=Fr(K,Ne.marker);Ge||(Ne.from=ae,V&&(K||(K=[])).push(Ne))}else Ne.from+=ae,V&&(K||(K=[])).push(Ne)}K&&(K=Sn(K)),X&&X!=K&&(X=Sn(X));var Ye=[K];if(!V){var tt=t.text.length-2,$e;if(tt>0&&K)for(var at=0;at<K.length;++at)K[at].to==null&&($e||($e=[])).push(new Tn(K[at].marker,null,null));for(var ht=0;ht<tt;++ht)Ye.push($e);Ye.push(X)}return Ye}function Sn(e){for(var t=0;t<e.length;++t){var n=e[t];n.from!=null&&n.from==n.to&&n.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function oa(e,t,n){var r=null;if(e.iter(t.line,n.line+1,function(be){if(be.markedSpans)for(var Pe=0;Pe<be.markedSpans.length;++Pe){var Ne=be.markedSpans[Pe].marker;Ne.readOnly&&(!r||ee(r,Ne)==-1)&&(r||(r=[])).push(Ne)}}),!r)return null;for(var i=[{from:t,to:n}],w=0;w<r.length;++w)for(var j=r[w],K=j.find(0),X=0;X<i.length;++X){var V=i[X];if(mt(V.to,K.from)<0||mt(V.from,K.to)>0)continue;var ae=[X,1],ue=mt(V.from,K.from),xe=mt(V.to,K.to);(ue<0||!j.inclusiveLeft&&!ue)&&ae.push({from:V.from,to:K.from}),(xe>0||!j.inclusiveRight&&!xe)&&ae.push({from:K.to,to:V.to}),i.splice.apply(i,ae),X+=ae.length-3}return i}function Zn(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 qn(e,t){if(!t)return;for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}function sn(e){return e.inclusiveLeft?-1:0}function wn(e){return e.inclusiveRight?1:0}function Cn(e,t){var n=e.lines.length-t.lines.length;if(n!=0)return n;var r=e.find(),i=t.find(),w=mt(r.from,i.from)||sn(e)-sn(t);if(w)return-w;var j=mt(r.to,i.to)||wn(e)-wn(t);return j||t.id-e.id}function sa(e,t){var n=yr&&e.markedSpans,r;if(n)for(var i=void 0,w=0;w<n.length;++w)i=n[w],i.marker.collapsed&&(t?i.from:i.to)==null&&(!r||Cn(r,i.marker)<0)&&(r=i.marker);return r}function An(e){return sa(e,!0)}function ln(e){return sa(e,!1)}function Mi(e,t){var n=yr&&e.markedSpans,r;if(n)for(var i=0;i<n.length;++i){var w=n[i];w.marker.collapsed&&(w.from==null||w.from<t)&&(w.to==null||w.to>t)&&(!r||Cn(r,w.marker)<0)&&(r=w.marker)}return r}function ei(e,t,n,r,i){var w=ut(e,t),j=yr&&w.markedSpans;if(j)for(var K=0;K<j.length;++K){var X=j[K];if(!X.marker.collapsed)continue;var V=X.marker.find(0),ae=mt(V.from,n)||sn(X.marker)-sn(i),ue=mt(V.to,r)||wn(X.marker)-wn(i);if(ae>=0&&ue<=0||ae<=0&&ue>=0)continue;if(ae<=0&&(X.marker.inclusiveRight&&i.inclusiveLeft?mt(V.to,n)>=0:mt(V.to,n)>0)||ae>=0&&(X.marker.inclusiveRight&&i.inclusiveLeft?mt(V.from,r)<=0:mt(V.from,r)<0))return!0}}function Jt(e){for(var t;t=An(e);)e=t.find(-1,!0).line;return e}function Wr(e){for(var t;t=ln(e);)e=t.find(1,!0).line;return e}function Ln(e){for(var t,n;t=ln(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function Hr(e,t){var n=ut(e,t),r=Jt(n);return n==r?t:Ct(r)}function Ii(e,t){if(t>e.lastLine())return t;var n=ut(e,t),r;if(!Er(e,n))return t;for(;r=ln(n);)n=r.find(1,!0).line;return Ct(n)+1}function Er(e,t){var n=yr&&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&&Dn(e,t,r))return!0}}function Dn(e,t,n){if(n.to==null){var r=n.marker.find(1,!0);return Dn(e,r.line,Fr(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var i=void 0,w=0;w<t.markedSpans.length;++w)if(i=t.markedSpans[w],i.marker.collapsed&&!i.marker.widgetNode&&i.from==n.to&&(i.to==null||i.to!=n.from)&&(i.marker.inclusiveLeft||n.marker.inclusiveRight)&&Dn(e,t,i))return!0}function ur(e){e=Jt(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 w=n.parent;w;n=w,w=n.parent)for(var j=0;j<w.children.length;++j){var K=w.children[j];if(K==n)break;t+=K.height}return t}function On(e){if(e.height==0)return 0;for(var t=e.text.length,n,r=e;n=An(r);){var i=n.find(0,!0);r=i.from.line,t+=i.from.ch-i.to.ch}for(r=e;n=ln(r);){var w=n.find(0,!0);t-=r.text.length-w.from.ch,r=w.to.line,t+=r.text.length-w.to.ch}return t}function kr(e){var t=e.display,n=e.doc;t.maxLine=ut(n,n.first),t.maxLineLength=On(t.maxLine),t.maxLineChanged=!0,n.iter(function(r){var i=On(r);i>t.maxLineLength&&(t.maxLineLength=i,t.maxLine=r)})}var Kr=function(e,t,n){this.text=e,qn(this,t),this.height=n?n(this):1};Kr.prototype.lineNo=function(){return Ct(this)},fe(Kr);function la(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),Zn(e),qn(e,n);var i=r?r(e):1;i!=e.height&&mr(e,i)}function ua(e){e.parent=null,Zn(e)}var $a={},Qa={};function da(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?Qa:$a;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Ui(e,t){var n=T("span",null,null,R?"padding-right: .1px":null),r={pre:T("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 w=i?t.rest[i-1]:t.line,j=void 0;r.pos=0,r.addToken=pt,ft(e.display.measure)&&(j=He(w,e.doc.direction))&&(r.addToken=xt(r.addToken,j)),r.map=[];var K=t!=e.display.externalMeasured&&Ct(w);Rt(w,r,$n(e,w,K)),w.styleClasses&&(w.styleClasses.bgClass&&(r.bgClass=B(w.styleClasses.bgClass,r.bgClass||"")),w.styleClasses.textClass&&(r.textClass=B(w.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(it(e.display.measure))),i==0?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(R){var X=r.content.lastChild;(/\bcm-tab\b/.test(X.className)||X.querySelector&&X.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return Le(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=B(r.pre.className,r.textClass||"")),r}function lt(e){var t=o("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function pt(e,t,n,r,i,w,j){if(!t)return;var K=e.splitSpaces?ct(t,e.trailingSpace):t,X=e.cm.state.specialChars,V=!1,ae;if(!X.test(t))e.col+=t.length,ae=document.createTextNode(K),e.map.push(e.pos,e.pos+t.length,ae),F&&M<9&&(V=!0),e.pos+=t.length;else{ae=document.createDocumentFragment();for(var ue=0;;){X.lastIndex=ue;var xe=X.exec(t),be=xe?xe.index-ue:t.length-ue;if(be){var Pe=document.createTextNode(K.slice(ue,ue+be));F&&M<9?ae.appendChild(o("span",[Pe])):ae.appendChild(Pe),e.map.push(e.pos,e.pos+be,Pe),e.col+=be,e.pos+=be}if(!xe)break;ue+=be+1;var Ne=void 0;if(xe[0]==" "){var Ge=e.cm.options.tabSize,Ye=Ge-e.col%Ge;Ne=ae.appendChild(o("span",ce(Ye),"cm-tab")),Ne.setAttribute("role","presentation"),Ne.setAttribute("cm-text"," "),e.col+=Ye}else xe[0]=="\r"||xe[0]==`
|
|
`?(Ne=ae.appendChild(o("span",xe[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Ne.setAttribute("cm-text",xe[0]),e.col+=1):(Ne=e.cm.options.specialCharPlaceholder(xe[0]),Ne.setAttribute("cm-text",xe[0]),F&&M<9?ae.appendChild(o("span",[Ne])):ae.appendChild(Ne),e.col+=1);e.map.push(e.pos,e.pos+1,Ne),e.pos++}}if(e.trailingSpace=K.charCodeAt(t.length-1)==32,n||r||i||V||w||j){var tt=n||"";r&&(tt+=r),i&&(tt+=i);var $e=o("span",[ae],tt,w);if(j)for(var at in j)j.hasOwnProperty(at)&&at!="style"&&at!="class"&&$e.setAttribute(at,j[at]);return e.content.appendChild($e)}e.content.appendChild(ae)}function ct(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",i=0;i<e.length;i++){var w=e.charAt(i);w==" "&&n&&(i==e.length-1||e.charCodeAt(i+1)==32)&&(w="\xA0"),r+=w,n=w==" "}return r}function xt(e,t){return function(n,r,i,w,j,K,X){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,w,j,K,X);e(n,r.slice(0,ue.to-V),i,w,null,K,X),w=null,r=r.slice(ue.to-V),V=ue.to}}}function wt(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 Rt(e,t,n){var r=e.markedSpans,i=e.text,w=0;if(!r){for(var j=1;j<n.length;j+=2)t.addToken(t,i.slice(w,w=n[j]),da(n[j+1],t.cm.options));return}for(var K=i.length,X=0,V=1,ae="",ue,xe,be=0,Pe,Ne,Ge,Ye,tt;;){if(be==X){Pe=Ne=Ge=xe="",tt=null,Ye=null,be=Infinity;for(var $e=[],at=void 0,ht=0;ht<r.length;++ht){var dt=r[ht],bt=dt.marker;if(bt.type=="bookmark"&&dt.from==X&&bt.widgetNode)$e.push(bt);else if(dt.from<=X&&(dt.to==null||dt.to>X||bt.collapsed&&dt.to==X&&dt.from==X)){if(dt.to!=null&&dt.to!=X&&be>dt.to&&(be=dt.to,Ne=""),bt.className&&(Pe+=" "+bt.className),bt.css&&(xe=(xe?xe+";":"")+bt.css),bt.startStyle&&dt.from==X&&(Ge+=" "+bt.startStyle),bt.endStyle&&dt.to==be&&(at||(at=[])).push(bt.endStyle,dt.to),bt.title&&((tt||(tt={})).title=bt.title),bt.attributes)for(var _t in bt.attributes)(tt||(tt={}))[_t]=bt.attributes[_t];bt.collapsed&&(!Ye||Cn(Ye.marker,bt)<0)&&(Ye=dt)}else dt.from>X&&be>dt.from&&(be=dt.from)}if(at)for(var Vt=0;Vt<at.length;Vt+=2)at[Vt+1]==be&&(Ne+=" "+at[Vt]);if(!Ye||Ye.from==X)for(var Ut=0;Ut<$e.length;++Ut)wt(t,0,$e[Ut]);if(Ye&&(Ye.from||0)==X){if(wt(t,(Ye.to==null?K+1:Ye.to)-X,Ye.marker,Ye.from==null),Ye.to==null)return;Ye.to==X&&(Ye=!1)}}if(X>=K)break;for(var cr=Math.min(K,be);;){if(ae){var ar=X+ae.length;if(!Ye){var Wt=ar>cr?ae.slice(0,cr-X):ae;t.addToken(t,Wt,ue?ue+Pe:Pe,Ge,X+Wt.length==be?Ne:"",xe,tt)}if(ar>=cr){ae=ae.slice(cr-X),X=cr;break}X=ar,Ge=""}ae=i.slice(w,w=n[V++]),ue=da(n[V++],t.cm.options)}}}function Tt(e,t,n){this.line=t,this.rest=Ln(t),this.size=this.rest?Ct($(this.rest))-n+1:1,this.node=this.text=null,this.hidden=Er(e,t)}function Nt(e,t,n){for(var r=[],i,w=t;w<n;w=i){var j=new Tt(e.doc,ut(e.doc,w),w);i=w+j.size,r.push(j)}return r}var Kt=null;function St(e){Kt?Kt.ops.push(e):e.ownsGroup=Kt={ops:[e],delayedCallbacks:[]}}function Pr(e){var t=e.delayedCallbacks,n=0;do{for(;n<t.length;n++)t[n].call(null);for(var r=0;r<e.ops.length;r++){var i=e.ops[r];if(i.cursorActivityHandlers)for(;i.cursorActivityCalled<i.cursorActivityHandlers.length;)i.cursorActivityHandlers[i.cursorActivityCalled++].call(null,i.cm)}}while(n<t.length)}function Lt(e,t){var n=e.ownsGroup;if(!n)return;try{Pr(n)}finally{Kt=null,t(n)}}var er=null;function Ot(e,t){var n=Ze(e,t);if(!n.length)return;var r=Array.prototype.slice.call(arguments,2),i;Kt?i=Kt.delayedCallbacks:er?i=er:(i=er=[],setTimeout(br,0));for(var w=function(K){i.push(function(){return n[K].apply(null,r)})},j=0;j<n.length;++j)w(j)}function br(){var e=er;er=null;for(var t=0;t<e.length;++t)e[t]()}function Ja(e,t,n,r){for(var i=0;i<t.changes.length;i++){var w=t.changes[i];w=="text"?Ms(e,t):w=="gutter"?qa(e,t,n,r):w=="class"?ca(e,t):w=="widget"&&Is(e,t,r)}t.changes=null}function ti(e){return e.node==e.text&&(e.node=o("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),F&&M<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=ti(t);t.background=r.insertBefore(o("div",null,n),r.firstChild),e.display.input.setUneditable(t.background)}}function Za(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):Ui(e,t)}function Ms(e,t){var n=t.text.className,r=Za(e,t);t.text==t.node&&(t.node=r.pre),t.text.parentNode.replaceChild(r.pre,t.text),t.text=r.pre,r.bgClass!=t.bgClass||r.textClass!=t.textClass?(t.bgClass=r.bgClass,t.textClass=r.textClass,ca(e,t)):n&&(t.text.className=n)}function ca(e,t){Ps(e,t),t.line.wrapClass?ti(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=ti(t);t.gutterBackground=o("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),i.insertBefore(t.gutterBackground,t.text)}var w=t.line.gutterMarkers;if(e.options.lineNumbers||w){var j=ti(t),K=t.gutter=o("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(K),j.insertBefore(K,t.text),t.line.gutterClass&&(K.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!w||!w["CodeMirror-linenumbers"])&&(t.lineNumber=K.appendChild(o("div",bn(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),w)for(var X=0;X<e.display.gutterSpecs.length;++X){var V=e.display.gutterSpecs[X].className,ae=w.hasOwnProperty(V)&&w[V];ae&&K.appendChild(o("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=x("CodeMirror-linewidget"),i=t.node.firstChild,w=void 0;i;i=w)w=i.nextSibling,r.test(i.className)&&t.node.removeChild(i);eo(e,t,n)}function Us(e,t,n,r){var i=Za(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),ca(e,t),qa(e,t,n,r),eo(e,t,r),t.node}function eo(e,t,n){if(to(e,t.line,t,n,!0),t.rest)for(var r=0;r<t.rest.length;r++)to(e,t.rest[r],t,n,!1)}function to(e,t,n,r,i){if(!t.widgets)return;for(var w=ti(n),j=0,K=t.widgets;j<K.length;++j){var X=K[j],V=o("div",[X.node],"CodeMirror-linewidget"+(X.className?" "+X.className:""));X.handleMouseEvents||V.setAttribute("cm-ignore-events","true"),Ns(X,V,n,r),e.display.input.setUneditable(V),i&&X.above?w.insertBefore(V,n.gutter||n.text):w.appendChild(V),Ot(X,"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 ri(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!g(document.body,e.node)){var n="position: relative;";e.coverGutter&&(n+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(n+="width: "+t.display.wrapper.clientWidth+"px;"),d(t.display.measure,o("div",[e.node],null,n))}return e.height=e.node.parentNode.offsetHeight}function Mr(e,t){for(var n=Te(t);n!=e.wrapper;n=n.parentNode)if(!n||n.nodeType==1&&n.getAttribute("cm-ignore-events")=="true"||n.parentNode==e.sizer&&n!=e.mover)return!0}function Ni(e){return e.lineSpace.offsetTop}function fa(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function ro(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=d(e.measure,o("pre","x","CodeMirror-line-like")),n=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r={left:parseInt(n.paddingLeft),right:parseInt(n.paddingRight)};return!isNaN(r.left)&&!isNaN(r.right)&&(e.cachedPaddingH=r),r}function Lr(e){return oe-e.display.nativeBarWidth}function un(e){return e.display.scroller.clientWidth-Lr(e)-e.display.barWidth}function ha(e){return e.display.scroller.clientHeight-Lr(e)-e.display.barHeight}function Fs(e,t,n){var r=e.options.lineWrapping,i=r&&un(e);if(!t.measure.heights||r&&t.measure.width!=i){var w=t.measure.heights=[];if(r){t.measure.width=i;for(var j=t.text.firstChild.getClientRects(),K=0;K<j.length-1;K++){var X=j[K],V=j[K+1];Math.abs(X.bottom-V.bottom)>2&&w.push((X.bottom+V.top)/2-n.top)}}w.push(n.bottom-n.top)}}function no(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var r=0;r<e.rest.length;r++)if(e.rest[r]==t)return{map:e.measure.maps[r],cache:e.measure.caches[r]};for(var i=0;i<e.rest.length;i++)if(Ct(e.rest[i])>n)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Bs(e,t){t=Jt(t);var n=Ct(t),r=e.display.externalMeasured=new Tt(e.doc,t,n);r.lineN=n;var i=r.built=Ui(e,r);return r.text=i.pre,d(e.display.lineMeasure,i.pre),r}function io(e,t,n,r){return Dr(e,Rn(e,t),n,r)}function ma(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[fn(e,t)];var n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size)return n}function Rn(e,t){var n=Ct(t),r=ma(e,n);r&&!r.text?r=null:r&&r.changes&&(Ja(e,r,n,Ea(e)),e.curOp.forceUpdate=!0),r||(r=Bs(e,t));var i=no(r,t,n);return{line:t,view:r,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function Dr(e,t,n,r,i){t.before&&(n=-1);var w=n+(r||""),j;return t.cache.hasOwnProperty(w)?j=t.cache[w]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Fs(e,t.view,t.rect),t.hasHeights=!0),j=Ws(e,t,n,r),j.bogus||(t.cache[w]=j)),{left:j.left,right:j.right,top:i?j.rtop:j.top,bottom:i?j.rbottom:j.bottom}}var ao={left:0,right:0,top:0,bottom:0};function oo(e,t,n){for(var r,i,w,j,K,X,V=0;V<e.length;V+=3)if(K=e[V],X=e[V+1],t<K?(i=0,w=1,j="left"):t<X?(i=t-K,w=i+1):(V==e.length-3||t==X&&e[V+3]>t)&&(w=X-K,i=w-1,t>=X&&(j="right")),i!=null){if(r=e[V+2],K==X&&n==(r.insertLeft?"left":"right")&&(j=n),n=="left"&&i==0)for(;V&&e[V-2]==e[V-3]&&e[V-1].insertLeft;)r=e[(V-=3)+2],j="left";if(n=="right"&&i==X-K)for(;V<e.length-3&&e[V+3]==e[V+4]&&!e[V+5].insertLeft;)r=e[(V+=3)+2],j="right";break}return{node:r,start:i,end:w,collapse:j,coverStart:K,coverEnd:X}}function js(e,t){var n=ao;if(t=="left")for(var r=0;r<e.length&&!((n=e[r]).left!=n.right);r++);else for(var i=e.length-1;i>=0&&!((n=e[i]).left!=n.right);i--);return n}function Ws(e,t,n,r){var i=oo(t.map,n,r),w=i.node,j=i.start,K=i.end,X=i.collapse,V;if(w.nodeType==3){for(var ae=0;ae<4;ae++){for(;j&&Me(t.line.text.charAt(i.coverStart+j));)--j;for(;i.coverStart+K<i.coverEnd&&Me(t.line.text.charAt(i.coverStart+K));)++K;if(F&&M<9&&j==0&&K==i.coverEnd-i.coverStart?V=w.parentNode.getBoundingClientRect():V=js(E(w,j,K).getClientRects(),r),V.left||V.right||j==0)break;K=j,j=j-1,X="right"}F&&M<11&&(V=Hs(e.display.measure,V))}else{j>0&&(X=r="right");var ue;e.options.lineWrapping&&(ue=w.getClientRects()).length>1?V=ue[r=="right"?ue.length-1:0]:V=w.getBoundingClientRect()}if(F&&M<9&&!j&&(!V||!V.left&&!V.right)){var xe=w.parentNode.getClientRects()[0];xe?V={left:xe.left,right:xe.left+kn(e.display),top:xe.top,bottom:xe.bottom}:V=ao}for(var be=V.top-t.rect.top,Pe=V.bottom-t.rect.top,Ne=(be+Pe)/2,Ge=t.view.measure.heights,Ye=0;Ye<Ge.length-1&&!(Ne<Ge[Ye]);Ye++);var tt=Ye?Ge[Ye-1]:0,$e=Ge[Ye],at={left:(X=="right"?V.right:V.left)-t.rect.left,right:(X=="left"?V.left:V.right)-t.rect.left,top:tt,bottom:$e};return!V.left&&!V.right&&(at.bogus=!0),e.options.singleCursorHeightPerLine||(at.rtop=be,at.rbottom=Pe),at}function Hs(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!vt(e))return t;var n=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*n,right:t.right*n,top:t.top*r,bottom:t.bottom*r}}function so(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function lo(e){e.display.externalMeasure=null,p(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)so(e.display.view[t])}function ni(e){lo(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function uo(){return m&&u?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function co(){return m&&u?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function pa(e){var t=0;if(e.widgets)for(var n=0;n<e.widgets.length;++n)e.widgets[n].above&&(t+=ri(e.widgets[n]));return t}function Fi(e,t,n,r,i){if(!i){var w=pa(t);n.top+=w,n.bottom+=w}if(r=="line")return n;r||(r="local");var j=ur(t);if(r=="local"?j+=Ni(e.display):j-=e.display.viewOffset,r=="page"||r=="window"){var K=e.display.lineSpace.getBoundingClientRect();j+=K.top+(r=="window"?0:co());var X=K.left+(r=="window"?0:uo());n.left+=X,n.right+=X}return n.top+=j,n.bottom+=j,n}function fo(e,t,n){if(n=="div")return t;var r=t.left,i=t.top;if(n=="page")r-=uo(),i-=co();else if(n=="local"||!n){var w=e.display.sizer.getBoundingClientRect();r+=w.left,i+=w.top}var j=e.display.lineSpace.getBoundingClientRect();return{left:r-j.left,top:i-j.top}}function ga(e,t,n,r,i){return r||(r=ut(e.doc,t.line)),Fi(e,r,io(e,r,t.ch,i),n)}function xr(e,t,n,r,i,w){r=r||ut(e.doc,t.line),i||(i=Rn(e,r));function j(Pe,Ne){var Ge=Dr(e,i,Pe,Ne?"right":"left",w);return Ne?Ge.left=Ge.right:Ge.right=Ge.left,Fi(e,r,Ge,n)}var K=He(r,e.doc.direction),X=t.ch,V=t.sticky;if(X>=r.text.length?(X=r.text.length,V="before"):X<=0&&(X=0,V="after"),!K)return j(V=="before"?X-1:X,V=="before");function ae(Pe,Ne,Ge){var Ye=K[Ne],tt=Ye.level==1;return j(Ge?Pe-1:Pe,tt!=Ge)}var ue=Xe(K,X,V),xe=ze,be=ae(X,ue,V=="before");return xe!=null&&(be.other=ae(X,xe,V!="before")),be}function ho(e,t){var n=0;t=gt(e.doc,t),e.options.lineWrapping||(n=kn(e.display)*t.ch);var r=ut(e.doc,t.line),i=ur(r)+Ni(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function va(e,t,n,r,i){var w=Fe(e,t,n);return w.xRel=i,r&&(w.outside=r),w}function ya(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return va(r.first,0,null,-1,-1);var i=Cr(r,n),w=r.first+r.size-1;if(i>w)return va(r.first+r.size-1,ut(r,w).text.length,null,1,1);t<0&&(t=0);for(var j=ut(r,i);;){var K=Ks(e,j,i,t,n),X=Mi(j,K.ch+(K.xRel>0||K.outside>0?1:0));if(!X)return K;var V=X.find(1);if(V.line==i)return V;j=ut(r,i=V.line)}}function mo(e,t,n,r){r-=pa(t);var i=t.text.length,w=Ve(function(j){return Dr(e,n,j-1).bottom<=r},i,0);return i=Ve(function(j){return Dr(e,n,j).top>r},w,i),{begin:w,end:i}}function po(e,t,n,r){n||(n=Rn(e,t));var i=Fi(e,t,Dr(e,n,r),"line").top;return mo(e,t,n,i)}function ba(e,t,n,r){return e.bottom<=n?!1:e.top>n?!0:(r?e.left:e.right)>t}function Ks(e,t,n,r,i){i-=ur(t);var w=Rn(e,t),j=pa(t),K=0,X=t.text.length,V=!0,ae=He(t,e.doc.direction);if(ae){var ue=(e.options.lineWrapping?zs:Gs)(e,t,n,w,ae,r,i);V=ue.level!=1,K=V?ue.from:ue.to-1,X=V?ue.to:ue.from-1}var xe=null,be=null,Pe=Ve(function(ht){var dt=Dr(e,w,ht);return dt.top+=j,dt.bottom+=j,ba(dt,r,i,!1)?(dt.top<=i&&dt.left<=r&&(xe=ht,be=dt),!0):!1},K,X),Ne,Ge,Ye=!1;if(be){var tt=r-be.left<be.right-r,$e=tt==V;Pe=xe+($e?0:1),Ge=$e?"after":"before",Ne=tt?be.left:be.right}else{!V&&(Pe==X||Pe==K)&&Pe++,Ge=Pe==0?"after":Pe==t.text.length?"before":Dr(e,w,Pe-(V?1:0)).bottom+j<=i==V?"after":"before";var at=xr(e,Fe(n,Pe,Ge),"line",t,w);Ne=at.left,Ye=i<at.top?-1:i>=at.bottom?1:0}return Pe=De(t.text,Pe,1),va(n,Pe,Ge,Ye,r-Ne)}function Gs(e,t,n,r,i,w,j){var K=Ve(function(ue){var xe=i[ue],be=xe.level!=1;return ba(xr(e,Fe(n,be?xe.to:xe.from,be?"before":"after"),"line",t,r),w,j,!0)},0,i.length-1),X=i[K];if(K>0){var V=X.level!=1,ae=xr(e,Fe(n,V?X.from:X.to,V?"after":"before"),"line",t,r);ba(ae,w,j,!0)&&ae.top>j&&(X=i[K-1])}return X}function zs(e,t,n,r,i,w,j){var K=mo(e,t,r,j),X=K.begin,V=K.end;/\s/.test(t.text.charAt(V-1))&&V--;for(var ae=null,ue=null,xe=0;xe<i.length;xe++){var be=i[xe];if(be.from>=V||be.to<=X)continue;var Pe=be.level!=1,Ne=Dr(e,r,Pe?Math.min(V,be.to)-1:Math.max(X,be.from)).right,Ge=Ne<w?w-Ne+1e9:Ne-w;(!ae||ue>Ge)&&(ae=be,ue=Ge)}return ae||(ae=i[i.length-1]),ae.from<X&&(ae={from:X,to:ae.to,level:ae.level}),ae.to>V&&(ae={from:ae.from,to:V,level:ae.level}),ae}var dn;function _n(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(dn==null){dn=o("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)dn.appendChild(document.createTextNode("x")),dn.appendChild(o("br"));dn.appendChild(document.createTextNode("x"))}d(e.measure,dn);var n=dn.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),p(e.measure),n||1}function kn(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=o("span","xxxxxxxxxx"),n=o("pre",[t],"CodeMirror-line-like");d(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function Ea(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,w=t.gutters.firstChild,j=0;w;w=w.nextSibling,++j){var K=e.display.gutterSpecs[j].className;n[K]=w.offsetLeft+w.clientLeft+i,r[K]=w.clientWidth}return{fixedPos:xa(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function xa(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function go(e){var t=_n(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/kn(e.display)-3);return function(i){if(Er(e.doc,i))return 0;var w=0;if(i.widgets)for(var j=0;j<i.widgets.length;j++)i.widgets[j].height&&(w+=i.widgets[j].height);return n?w+(Math.ceil(i.text.length/r)||1)*t:w+t}}function Ta(e){var t=e.doc,n=go(e);t.iter(function(r){var i=n(r);i!=r.height&&mr(r,i)})}function cn(e,t,n,r){var i=e.display;if(!n&&Te(t).getAttribute("cm-not-content")=="true")return null;var w,j,K=i.lineSpace.getBoundingClientRect();try{w=t.clientX-K.left,j=t.clientY-K.top}catch(ue){return null}var X=ya(e,w,j),V;if(r&&X.xRel>0&&(V=ut(e.doc,X.line).text).length==X.ch){var ae=H(V,V.length,e.options.tabSize)-V.length;X=Fe(X.line,Math.max(0,Math.round((w-ro(e.display).left)/kn(e.display))-ae))}return X}function fn(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 nr(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)yr&&Hr(e.doc,t)<i.viewTo&&zr(e);else if(n<=i.viewFrom)yr&&Ii(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 w=Bi(e,n,n+r,1);w?(i.view=i.view.slice(w.index),i.viewFrom=w.lineN,i.viewTo+=r):zr(e)}else if(n>=i.viewTo){var j=Bi(e,t,t,-1);j?(i.view=i.view.slice(0,j.index),i.viewTo=j.lineN):zr(e)}else{var K=Bi(e,t,t,-1),X=Bi(e,n,n+r,1);K&&X?(i.view=i.view.slice(0,K.index).concat(Nt(e,K.lineN,X.lineN)).concat(i.view.slice(X.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 w=r.view[fn(e,t)];if(w.node==null)return;var j=w.changes||(w.changes=[]);ee(j,n)==-1&&j.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=fn(e,t),w,j=e.display.view;if(!yr||n==e.doc.first+e.doc.size)return{index:i,lineN:n};for(var K=e.display.viewFrom,X=0;X<i;X++)K+=j[X].size;if(K!=t){if(r>0){if(i==j.length-1)return null;w=K+j[i].size-t,i++}else w=K-t;t+=w,n+=w}for(;Hr(e.doc,n)!=n;){if(i==(r<0?0:j.length-1))return null;n+=r*j[i-(r<0?1:0)].size,i+=r}return{index:i,lineN:n}}function Xs(e,t,n){var r=e.display,i=r.view;i.length==0||t>=r.viewTo||n<=r.viewFrom?(r.view=Nt(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=Nt(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(fn(e,t))),r.viewFrom=t,r.viewTo<n?r.view=r.view.concat(Nt(e,r.viewTo,n)):r.viewTo>n&&(r.view=r.view.slice(0,fn(e,n)))),r.viewTo=n}function vo(e){for(var t=e.display.view,n=0,r=0;r<t.length;r++){var i=t[r];!i.hidden&&(!i.node||i.changes)&&++n}return n}function ii(e){e.display.input.showSelection(e.display.input.prepareSelection())}function yo(e,t){t===void 0&&(t=!0);for(var n=e.doc,r={},i=r.cursors=document.createDocumentFragment(),w=r.selection=document.createDocumentFragment(),j=0;j<n.sel.ranges.length;j++){if(!t&&j==n.sel.primIndex)continue;var K=n.sel.ranges[j];if(K.from().line>=e.display.viewTo||K.to().line<e.display.viewFrom)continue;var X=K.empty();(X||e.options.showCursorWhenSelecting)&&bo(e,K.head,i),X||Vs(e,K,w)}return r}function bo(e,t,n){var r=xr(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),i=n.appendChild(o("div","\xA0","CodeMirror-cursor"));if(i.style.left=r.left+"px",i.style.top=r.top+"px",i.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px",r.other){var w=n.appendChild(o("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));w.style.display="",w.style.left=r.other.left+"px",w.style.top=r.other.top+"px",w.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,w=document.createDocumentFragment(),j=ro(e.display),K=j.left,X=Math.max(r.sizerWidth,un(e)-r.sizer.offsetLeft)-j.right,V=i.direction=="ltr";function ae($e,at,ht,dt){at<0&&(at=0),at=Math.round(at),dt=Math.round(dt),w.appendChild(o("div",null,"CodeMirror-selected","position: absolute; left: "+$e+`px;
|
|
top: `+at+"px; width: "+(ht==null?X-$e:ht)+`px;
|
|
height: `+(dt-at)+"px"))}function ue($e,at,ht){var dt=ut(i,$e),bt=dt.text.length,_t,Vt;function Ut(Wt,or){return ga(e,Fe($e,Wt),"div",dt,or)}function cr(Wt,or,$t){var Gt=po(e,dt,null,Wt),Ht=or=="ltr"==($t=="after")?"left":"right",Ft=$t=="after"?Gt.begin:Gt.end-(/\s/.test(dt.text.charAt(Gt.end-1))?2:1);return Ut(Ft,Ht)[Ht]}var ar=He(dt,i.direction);return et(ar,at||0,ht==null?bt:ht,function(Wt,or,$t,Gt){var Ht=$t=="ltr",Ft=Ut(Wt,Ht?"left":"right"),sr=Ut(or-1,Ht?"right":"left"),zn=at==null&&Wt==0,Jr=ht==null&&or==bt,qt=Gt==0,Or=!ar||Gt==ar.length-1;if(sr.top-Ft.top<=3){var Yt=(V?zn:Jr)&&qt,Va=(V?Jr:zn)&&Or,Ur=Yt?K:(Ht?Ft:sr).left,vn=Va?X:(Ht?sr:Ft).right;ae(Ur,Ft.top,vn-Ur,Ft.bottom)}else{var yn,rr,Xn,Ya;Ht?(yn=V&&zn&&qt?K:Ft.left,rr=V?X:cr(Wt,$t,"before"),Xn=V?K:cr(or,$t,"after"),Ya=V&&Jr&&Or?X:sr.right):(yn=V?cr(Wt,$t,"before"):K,rr=!V&&zn&&qt?X:Ft.right,Xn=!V&&Jr&&Or?K:sr.left,Ya=V?cr(or,$t,"after"):X),ae(yn,Ft.top,rr-yn,Ft.bottom),Ft.bottom<sr.top&&ae(K,Ft.bottom,null,sr.top),ae(Xn,sr.top,Ya-Xn,sr.bottom)}(!_t||ji(Ft,_t)<0)&&(_t=Ft),ji(sr,_t)<0&&(_t=sr),(!Vt||ji(Ft,Vt)<0)&&(Vt=Ft),ji(sr,Vt)<0&&(Vt=sr)}),{start:_t,end:Vt}}var xe=t.from(),be=t.to();if(xe.line==be.line)ue(xe.line,xe.ch,be.ch);else{var Pe=ut(i,xe.line),Ne=ut(i,be.line),Ge=Jt(Pe)==Jt(Ne),Ye=ue(xe.line,xe.ch,Ge?Pe.text.length+1:null).end,tt=ue(be.line,Ge?0:null,be.ch).start;Ge&&(Ye.top<tt.top-2?(ae(Ye.right,Ye.top,null,Ye.bottom),ae(K,tt.top,tt.left,tt.bottom)):ae(Ye.right,Ye.top,tt.left-Ye.right,Ye.bottom)),Ye.bottom<tt.top&&ae(K,Ye.bottom,null,tt.top)}n.appendChild(w)}function Sa(e){if(!e.state.focused)return;var t=e.display;clearInterval(t.blinker);var n=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){e.hasFocus()||Pn(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function Eo(e){e.state.focused||(e.display.input.focus(),wa(e))}function xo(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Pn(e))},100)}function wa(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(Le(e,"focus",e,t),e.state.focused=!0,N(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),R&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Sa(e)}function Pn(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(Le(e,"blur",e,t),e.state.focused=!1,h(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function Wi(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var i=t.view[r],w=e.options.lineWrapping,j=void 0,K=0;if(i.hidden)continue;if(F&&M<8){var X=i.node.offsetTop+i.node.offsetHeight;j=X-n,n=X}else{var V=i.node.getBoundingClientRect();j=V.bottom-V.top,!w&&i.text.firstChild&&(K=i.text.firstChild.getBoundingClientRect().right-V.left-1)}var ae=i.line.height-j;if((ae>.005||ae<-.005)&&(mr(i.line,j),To(i.line),i.rest))for(var ue=0;ue<i.rest.length;ue++)To(i.rest[ue]);if(K>e.display.sizerWidth){var xe=Math.ceil(K/kn(e.display));xe>e.display.maxLineLength&&(e.display.maxLineLength=xe,e.display.maxLine=i.line,e.display.maxLineChanged=!0)}}}function To(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var n=e.widgets[t],r=n.node.parentNode;r&&(n.height=r.offsetHeight)}}function Hi(e,t,n){var r=n&&n.top!=null?Math.max(0,n.top):e.scroller.scrollTop;r=Math.floor(r-Ni(e));var i=n&&n.bottom!=null?n.bottom:r+e.wrapper.clientHeight,w=Cr(t,r),j=Cr(t,i);if(n&&n.ensure){var K=n.ensure.from.line,X=n.ensure.to.line;K<w?(w=K,j=Cr(t,ur(ut(t,K))+e.wrapper.clientHeight)):Math.min(X,t.lastLine())>=j&&(w=Cr(t,ur(ut(t,X))-e.wrapper.clientHeight),j=X)}return{from:w,to:Math.max(j,w+1)}}function Ys(e,t){if(Ue(e,"scrollCursorIntoView"))return;var n=e.display,r=n.sizer.getBoundingClientRect(),i=null;if(t.top+r.top<0?i=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),i!=null&&!b){var w=o("div","\u200B",null,`position: absolute;
|
|
top: `+(t.top-n.viewOffset-Ni(e.display))+`px;
|
|
height: `+(t.bottom-t.top+Lr(e)+n.barHeight)+`px;
|
|
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(w),w.scrollIntoView(i),e.display.lineSpace.removeChild(w)}}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 w=0;w<5;w++){var j=!1,K=xr(e,t),X=!n||n==t?K:xr(e,n);i={left:Math.min(K.left,X.left),top:Math.min(K.top,X.top)-r,right:Math.max(K.left,X.left),bottom:Math.max(K.bottom,X.bottom)+r};var V=Ca(e,i),ae=e.doc.scrollTop,ue=e.doc.scrollLeft;if(V.scrollTop!=null&&(oi(e,V.scrollTop),Math.abs(e.doc.scrollTop-ae)>1&&(j=!0)),V.scrollLeft!=null&&(hn(e,V.scrollLeft),Math.abs(e.doc.scrollLeft-ue)>1&&(j=!0)),!j)break}return i}function Qs(e,t){var n=Ca(e,t);n.scrollTop!=null&&oi(e,n.scrollTop),n.scrollLeft!=null&&hn(e,n.scrollLeft)}function Ca(e,t){var n=e.display,r=_n(e.display);t.top<0&&(t.top=0);var i=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop,w=ha(e),j={};t.bottom-t.top>w&&(t.bottom=t.top+w);var K=e.doc.height+fa(n),X=t.top<r,V=t.bottom>K-r;if(t.top<i)j.scrollTop=X?0:t.top;else if(t.bottom>i+w){var ae=Math.min(t.top,(V?K:t.bottom)-w);ae!=i&&(j.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,be=un(e)-n.gutters.offsetWidth,Pe=t.right-t.left>be;return Pe&&(t.right=t.left+be),t.left<10?j.scrollLeft=0:t.left<xe?j.scrollLeft=Math.max(0,t.left+ue-(Pe?0:10)):t.right>be+xe-3&&(j.scrollLeft=t.right+(Pe?0:10)-be),j}function Aa(e,t){if(t==null)return;Ki(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function Mn(e){Ki(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function ai(e,t,n){(t!=null||n!=null)&&Ki(e),t!=null&&(e.curOp.scrollLeft=t),n!=null&&(e.curOp.scrollTop=n)}function Js(e,t){Ki(e),e.curOp.scrollToPos=t}function Ki(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=ho(e,t.from),r=ho(e,t.to);So(e,n,r,t.margin)}}function So(e,t,n,r){var i=Ca(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-r,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+r});ai(e,i.scrollLeft,i.scrollTop)}function oi(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;D||Da(e,{top:t}),wo(e,t,!0),D&&Da(e),ui(e,100)}function wo(e,t,n){if(t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),e.display.scroller.scrollTop==t&&!n)return;e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t)}function hn(e,t,n,r){if(t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r)return;e.doc.scrollLeft=t,Oo(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function si(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+fa(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:r,scrollHeight:r+Lr(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var mn=function(e,t,n){this.cm=n;var r=this.vert=o("div",[o("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=o("div",[o("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=i.tabIndex=-1,e(r),e(i),Se(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),Se(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,F&&M<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};mn.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 w=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+w)+"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}},mn.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},mn.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},mn.prototype.zeroWidthHack=function(){var e=s&&!S?"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},mn.prototype.enableZeroWidthBar=function(e,t,n){e.style.pointerEvents="auto";function r(){var i=e.getBoundingClientRect(),w=n=="vert"?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1);w!=e?e.style.pointerEvents="none":t.set(1e3,r)}t.set(1e3,r)},mn.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var li=function(){};li.prototype.update=function(){return{bottom:0,right:0}},li.prototype.setScrollLeft=function(){},li.prototype.setScrollTop=function(){},li.prototype.clear=function(){};function In(e,t){t||(t=si(e));var n=e.display.barWidth,r=e.display.barHeight;Co(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&Wi(e),Co(e,si(e)),n=e.display.barWidth,r=e.display.barHeight}function Co(e,t){var n=e.display,r=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",n.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}var Ao={native:mn,null:li};function Lo(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&h(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Ao[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Se(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,n){n=="horizontal"?hn(e,t):oi(e,t)},e),e.display.scrollbars.addClass&&N(e.display.wrapper,e.display.scrollbars.addClass)}var Zs=0;function pn(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},St(e.curOp)}function gn(e){var t=e.curOp;t&&Lt(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 w=0;w<t.length;w++)nl(t[w]);for(var j=0;j<t.length;j++)il(t[j])}function el(e){var t=e.cm,n=t.display;ol(t),e.updateMaxLine&&kr(t),e.mustUpdate=e.viewChanged||e.forceUpdate||e.scrollTop!=null||e.scrollToPos&&(e.scrollToPos.from.line<n.viewFrom||e.scrollToPos.to.line>=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new Gi(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&La(e.cm,e.update)}function rl(e){var t=e.cm,n=t.display;e.updatedDisplay&&Wi(t),e.barMeasure=si(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=io(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+Lr(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-un(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&&hn(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var n=e.focus&&e.focus==_();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,n),(e.updatedDisplay||e.startHeight!=t.doc.height)&&In(t,e.barMeasure),e.updatedDisplay&&Ra(t,e.barMeasure),e.selectionChanged&&Sa(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),n&&Eo(e.cm)}function il(e){var t=e.cm,n=t.display,r=t.doc;if(e.updatedDisplay&&Do(t,e.update),n.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(n.wheelStartX=n.wheelStartY=null),e.scrollTop!=null&&wo(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&hn(t,e.scrollLeft,!0,!0),e.scrollToPos){var i=$s(t,gt(r,e.scrollToPos.from),gt(r,e.scrollToPos.to),e.scrollToPos.margin);Ys(t,i)}var w=e.maybeHiddenMarkers,j=e.maybeUnhiddenMarkers;if(w)for(var K=0;K<w.length;++K)w[K].lines.length||Le(w[K],"hide");if(j)for(var X=0;X<j.length;++X)j[X].lines.length&&Le(j[X],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Le(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function dr(e,t){if(e.curOp)return t();pn(e);try{return t()}finally{gn(e)}}function zt(e,t){return function(){if(e.curOp)return t.apply(e,arguments);pn(e);try{return t.apply(e,arguments)}finally{gn(e)}}}function tr(e){return function(){if(this.curOp)return e.apply(this,arguments);pn(this);try{return e.apply(this,arguments)}finally{gn(this)}}}function Xt(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);pn(t);try{return e.apply(this,arguments)}finally{gn(t)}}}function ui(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,P(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var n=+new Date+e.options.workTime,r=We(e,t.highlightFrontier),i=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(w){if(r.line>=e.display.viewFrom){var j=w.styles,K=w.text.length>e.options.maxHighlightLength?hr(t.mode,r.state):null,X=Li(e,w,r,!0);K&&(r.state=K),w.styles=X.styles;var V=w.styleClasses,ae=X.classes;ae?w.styleClasses=ae:V&&(w.styleClasses=null);for(var ue=!j||j.length!=w.styles.length||V!=ae&&(!V||!ae||V.bgClass!=ae.bgClass||V.textClass!=ae.textClass),xe=0;!ue&&xe<j.length;++xe)ue=j[xe]!=w.styles[xe];ue&&i.push(r.line),w.stateAfter=r.save(),r.nextLine()}else w.text.length<=e.options.maxHighlightLength&&Qn(e,w.text,r),w.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>n)return ui(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&dr(e,function(){for(var w=0;w<i.length;w++)Gr(e,i[w],"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=un(e),this.force=n,this.dims=Ea(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++)Le.apply(null,this.events[e])};function ol(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=Lr(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Lr(e)+"px",t.scrollbarsClipped=!0)}function sl(e){if(e.hasFocus())return null;var t=_();if(!t||!g(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&g(e.display.lineDiv,r.anchorNode)&&(n.anchorNode=r.anchorNode,n.anchorOffset=r.anchorOffset,n.focusNode=r.focusNode,n.focusOffset=r.focusOffset)}return n}function ll(e){if(!e||!e.activeElt||e.activeElt==_())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&g(document.body,e.anchorNode)&&g(document.body,e.focusNode)){var t=window.getSelection(),n=document.createRange();n.setEnd(e.anchorNode,e.anchorOffset),n.collapse(!1),t.removeAllRanges(),t.addRange(n),t.extend(e.focusNode,e.focusOffset)}}function La(e,t){var n=e.display,r=e.doc;if(t.editorIsHidden)return 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&&vo(e)==0)return!1;Ro(e)&&(zr(e),t.dims=Ea(e));var i=r.first+r.size,w=Math.max(t.visible.from-e.options.viewportMargin,r.first),j=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFrom<w&&w-n.viewFrom<20&&(w=Math.max(r.first,n.viewFrom)),n.viewTo>j&&n.viewTo-j<20&&(j=Math.min(i,n.viewTo)),yr&&(w=Hr(e.doc,w),j=Ii(e.doc,j));var K=w!=n.viewFrom||j!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Xs(e,w,j),n.viewOffset=ur(ut(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var X=vo(e);if(!K&&X==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var V=sl(e);return X>4&&(n.lineDiv.style.display="none"),ul(e,n.updateLineNumbers,t.dims),X>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,ll(V),p(n.cursorDiv),p(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,K&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,ui(e,400)),n.updateLineNumbers=null,!0}function Do(e,t){for(var n=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==un(e)){if(n&&n.top!=null&&(n={top:Math.min(e.doc.height+fa(e.display)-ha(e),n.top)}),t.visible=Hi(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=Hi(e.display,e.doc,n));if(!La(e,t))break;Wi(e);var i=si(e);ii(e),In(e,i),Ra(e,i),t.force=!1}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function Da(e,t){var n=new Gi(e,t);if(La(e,n)){Wi(e),Do(e,n);var r=si(e);ii(e),In(e,r),Ra(e,r),n.finish()}}function ul(e,t,n){var r=e.display,i=e.options.lineNumbers,w=r.lineDiv,j=w.firstChild;function K(Pe){var Ne=Pe.nextSibling;return R&&s&&e.display.currentWheelTarget==Pe?Pe.style.display="none":Pe.parentNode.removeChild(Pe),Ne}for(var X=r.view,V=r.viewFrom,ae=0;ae<X.length;ae++){var ue=X[ae];if(!ue.hidden)if(!ue.node||ue.node.parentNode!=w){var xe=Us(e,ue,V,n);w.insertBefore(xe,j)}else{for(;j!=ue.node;)j=K(j);var be=i&&t!=null&&t<=V&&ue.lineNumber;ue.changes&&(ee(ue.changes,"gutter")>-1&&(be=!1),Ja(e,ue,V,n)),be&&(p(ue.lineNumber),ue.lineNumber.appendChild(document.createTextNode(bn(e.options,V)))),j=ue.node.nextSibling}V+=ue.size}for(;j;)j=K(j)}function Oa(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Ra(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+Lr(e)+"px"}function Oo(e){var t=e.display,n=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var r=xa(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,w=r+"px",j=0;j<n.length;j++)if(!n[j].hidden){e.options.fixedGutter&&(n[j].gutter&&(n[j].gutter.style.left=w),n[j].gutterBackground&&(n[j].gutterBackground.style.left=w));var K=n[j].alignable;if(K)for(var X=0;X<K.length;X++)K[X].style.left=w}e.options.fixedGutter&&(t.gutters.style.left=r+i+"px")}function Ro(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=bn(e.options,t.first+t.size-1),r=e.display;if(n.length!=r.lineNumChars){var i=r.measure.appendChild(o("div",[o("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),w=i.firstChild.offsetWidth,j=i.offsetWidth-w;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(w,r.lineGutter.offsetWidth-j)+1,r.lineNumWidth=r.lineNumInnerWidth+j,r.lineNumChars=r.lineNumInnerWidth?n.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",Oa(e.display),!0}return!1}function _a(e,t){for(var n=[],r=!1,i=0;i<e.length;i++){var w=e[i],j=null;if(typeof w!="string"&&(j=w.style,w=w.className),w=="CodeMirror-linenumbers")if(t)r=!0;else continue;n.push({className:w,style:j})}return t&&!r&&n.push({className:"CodeMirror-linenumbers",style:null}),n}function _o(e){var t=e.gutters,n=e.gutterSpecs;p(t),e.lineGutter=null;for(var r=0;r<n.length;++r){var i=n[r],w=i.className,j=i.style,K=t.appendChild(o("div",null,"CodeMirror-gutter "+w));j&&(K.style.cssText=j),w=="CodeMirror-linenumbers"&&(e.lineGutter=K,K.style.width=(e.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",Oa(e)}function di(e){_o(e.display),nr(e),Oo(e)}function dl(e,t,n,r){var i=this;this.input=n,i.scrollbarFiller=o("div",null,"CodeMirror-scrollbar-filler"),i.scrollbarFiller.setAttribute("cm-not-content","true"),i.gutterFiller=o("div",null,"CodeMirror-gutter-filler"),i.gutterFiller.setAttribute("cm-not-content","true"),i.lineDiv=T("div",null,"CodeMirror-code"),i.selectionDiv=o("div",null,null,"position: relative; z-index: 1"),i.cursorDiv=o("div",null,"CodeMirror-cursors"),i.measure=o("div",null,"CodeMirror-measure"),i.lineMeasure=o("div",null,"CodeMirror-measure"),i.lineSpace=T("div",[i.measure,i.lineMeasure,i.selectionDiv,i.cursorDiv,i.lineDiv],null,"position: relative; outline: none");var w=T("div",[i.lineSpace],"CodeMirror-lines");i.mover=o("div",[w],null,"position: relative"),i.sizer=o("div",[i.mover],"CodeMirror-sizer"),i.sizerWidth=null,i.heightForcer=o("div",null,null,"position: absolute; height: "+oe+"px; width: 1px;"),i.gutters=o("div",null,"CodeMirror-gutters"),i.lineGutter=null,i.scroller=o("div",[i.sizer,i.heightForcer,i.gutters],"CodeMirror-scroll"),i.scroller.setAttribute("tabIndex","-1"),i.wrapper=o("div",[i.scrollbarFiller,i.gutterFiller,i.scroller],"CodeMirror"),F&&M<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),!R&&!(D&&a)&&(i.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(i.wrapper):e(i.wrapper)),i.viewFrom=i.viewTo=t.first,i.reportedViewFrom=i.reportedViewTo=t.first,i.view=[],i.renderedView=null,i.externalMeasured=null,i.viewOffset=0,i.lastWrapHeight=i.lastWrapWidth=0,i.updateLineNumbers=null,i.nativeBarWidth=i.barHeight=i.barWidth=0,i.scrollbarsClipped=!1,i.lineNumWidth=i.lineNumInnerWidth=i.lineNumChars=null,i.alignWidgets=!1,i.cachedCharWidth=i.cachedTextHeight=i.cachedPaddingH=null,i.maxLine=null,i.maxLineLength=0,i.maxLineChanged=!1,i.wheelDX=i.wheelDY=i.wheelStartX=i.wheelStartY=null,i.shift=!1,i.selForContextMenu=null,i.activeTouch=null,i.gutterSpecs=_a(r.gutters,r.lineNumbers),_o(i),n.init(i)}var zi=0,pr=null;F?pr=-.53:D?pr=15:m?pr=-.7:k&&(pr=-1/3);function ko(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=ko(e);return t.x*=pr,t.y*=pr,t}function Po(e,t){var n=ko(t),r=n.x,i=n.y,w=e.display,j=w.scroller,K=j.scrollWidth>j.clientWidth,X=j.scrollHeight>j.clientHeight;if(!(r&&K||i&&X))return;if(i&&s&&R){e:for(var V=t.target,ae=w.view;V!=j;V=V.parentNode)for(var ue=0;ue<ae.length;ue++)if(ae[ue].node==V){e.display.currentWheelTarget=V;break e}}if(r&&!D&&!v&&pr!=null){i&&X&&oi(e,Math.max(0,j.scrollTop+i*pr)),hn(e,Math.max(0,j.scrollLeft+r*pr)),(!i||i&&X)&&Q(t),w.wheelStartX=null;return}if(i&&pr!=null){var xe=i*pr,be=e.doc.scrollTop,Pe=be+w.wrapper.clientHeight;xe<0?be=Math.max(0,be+xe-50):Pe=Math.min(e.doc.height,Pe+xe+50),Da(e,{top:be,bottom:Pe})}zi<20&&(w.wheelStartX==null?(w.wheelStartX=j.scrollLeft,w.wheelStartY=j.scrollTop,w.wheelDX=r,w.wheelDY=i,setTimeout(function(){if(w.wheelStartX==null)return;var Ne=j.scrollLeft-w.wheelStartX,Ge=j.scrollTop-w.wheelStartY,Ye=Ge&&w.wheelDY&&Ge/w.wheelDY||Ne&&w.wheelDX&&Ne/w.wheelDX;if(w.wheelStartX=w.wheelStartY=null,!Ye)return;pr=(pr*zi+Ye)/(zi+1),++zi},200)):(w.wheelDX+=r,w.wheelDY+=i))}var gr=function(e,t){this.ranges=e,this.primIndex=t};gr.prototype.primary=function(){return this.ranges[this.primIndex]},gr.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(!tn(n.anchor,r.anchor)||!tn(n.head,r.head))return!1}return!0},gr.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new At(rn(this.ranges[t].anchor),rn(this.ranges[t].head));return new gr(e,this.primIndex)},gr.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},gr.prototype.contains=function(e,t){t||(t=e);for(var n=0;n<this.ranges.length;n++){var r=this.ranges[n];if(mt(t,r.from())>=0&&mt(e,r.to())<=0)return n}return-1};var At=function(e,t){this.anchor=e,this.head=t};At.prototype.from=function(){return En(this.anchor,this.head)},At.prototype.to=function(){return nn(this.anchor,this.head)},At.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Tr(e,t,n){var r=e&&e.options.selectionsMayTouch,i=t[n];t.sort(function(xe,be){return mt(xe.from(),be.from())}),n=ee(t,i);for(var w=1;w<t.length;w++){var j=t[w],K=t[w-1],X=mt(K.to(),j.from());if(r&&!j.empty()?X>0:X>=0){var V=En(K.from(),j.from()),ae=nn(K.to(),j.to()),ue=K.empty()?j.from()==j.head:K.from()==K.head;w<=n&&--n,t.splice(--w,2,new At(ue?ae:V,ue?V:ae))}}return new gr(t,n)}function Xr(e,t){return new gr([new At(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 Mo(e,t){if(mt(e,t.from)<0)return e;if(mt(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 ka(e,t){for(var n=[],r=0;r<e.sel.ranges.length;r++){var i=e.sel.ranges[r];n.push(new At(Mo(i.anchor,t),Mo(i.head,t)))}return Tr(e.cm,n,e.sel.primIndex)}function Io(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),w=i,j=0;j<t.length;j++){var K=t[j],X=Io(K.from,i,w),V=Io(Vr(K),i,w);if(i=K.to,w=V,n=="around"){var ae=e.sel.ranges[j],ue=mt(ae.head,ae.anchor)<0;r[j]=new At(ue?V:X,ue?X:V)}else r[j]=new At(X,X)}return new gr(r,e.sel.primIndex)}function Pa(e){e.doc.mode=kt(e.options,e.doc.modeOption),ci(e)}function ci(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,ui(e,100),e.state.modeGen++,e.curOp&&nr(e)}function Uo(e,t){return t.from.ch==0&&t.to.ch==0&&$(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Ma(e,t,n,r){function i(tt){return n?n[tt]:null}function w(tt,$e,at){la(tt,$e,at,r),Ot(tt,"change",tt,t)}function j(tt,$e){for(var at=[],ht=tt;ht<$e;++ht)at.push(new Kr(V[ht],i(ht),r));return at}var K=t.from,X=t.to,V=t.text,ae=ut(e,K.line),ue=ut(e,X.line),xe=$(V),be=i(V.length-1),Pe=X.line-K.line;if(t.full)e.insert(0,j(0,V.length)),e.remove(V.length,e.size-V.length);else if(Uo(e,t)){var Ne=j(0,V.length-1);w(ue,ue.text,be),Pe&&e.remove(K.line,Pe),Ne.length&&e.insert(K.line,Ne)}else if(ae==ue)if(V.length==1)w(ae,ae.text.slice(0,K.ch)+xe+ae.text.slice(X.ch),be);else{var Ge=j(1,V.length-1);Ge.push(new Kr(xe+ae.text.slice(X.ch),be,r)),w(ae,ae.text.slice(0,K.ch)+V[0],i(0)),e.insert(K.line+1,Ge)}else if(V.length==1)w(ae,ae.text.slice(0,K.ch)+V[0]+ue.text.slice(X.ch),i(0)),e.remove(K.line+1,Pe);else{w(ae,ae.text.slice(0,K.ch)+V[0],i(0)),w(ue,xe+ue.text.slice(X.ch),be);var Ye=j(1,V.length-1);Pe>1&&e.remove(K.line+1,Pe-1),e.insert(K.line+1,Ye)}Ot(e,"change",e,t)}function Yr(e,t,n){function r(i,w,j){if(i.linked)for(var K=0;K<i.linked.length;++K){var X=i.linked[K];if(X.doc==w)continue;var V=j&&X.sharedHist;if(n&&!V)continue;t(X.doc,V),r(X.doc,i,V)}}r(e,null,!0)}function No(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,Ta(e),Pa(e),Fo(e),e.options.lineWrapping||kr(e),e.options.mode=t.modeOption,nr(e)}function Fo(e){(e.doc.direction=="rtl"?N:h)(e.display.lineDiv,"CodeMirror-rtl")}function hl(e){dr(e,function(){Fo(e),nr(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 Ia(e,t){var n={from:rn(t.from),to:Vr(t),text:wr(e,t.from,t.to)};return Wo(e,n,t.from.line,t.to.line+1),Yr(e,function(r){return Wo(r,n,t.from.line,t.to.line+1)},!0),n}function Bo(e){for(;e.length;){var t=$(e);if(t.ranges)e.pop();else break}}function ml(e,t){if(t)return Bo(e.done),$(e.done);if(e.done.length&&!$(e.done).ranges)return $(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),$(e.done)}function jo(e,t,n,r){var i=e.history;i.undone.length=0;var w=+new Date,j,K;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&i.lastModTime>w-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(j=ml(i,i.lastOp==r)))K=$(j.changes),mt(t.from,t.to)==0&&mt(t.from,K.to)==0?K.to=Vr(t):j.changes.push(Ia(e,t));else{var X=$(i.done);for((!X||!X.ranges)&&Vi(e.sel,i.done),j={changes:[Ia(e,t)],generation:i.generation},i.done.push(j);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(n),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=w,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,K||Le(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,w=r&&r.origin;n==i.lastSelOp||w&&i.lastSelOrigin==w&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==w||pl(e,w,$(i.done),t))?i.done[i.done.length-1]=t:Vi(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=w,i.lastSelOp=n,r&&r.clearRedo!==!1&&Bo(i.undone)}function Vi(e,t){var n=$(t);n&&n.ranges&&n.equals(e)||t.push(e)}function Wo(e,t,n,r){var i=t["spans_"+e.id],w=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(j){j.markedSpans&&((i||(i=t["spans_"+e.id]={}))[w]=j.markedSpans),++w})}function vl(e){if(!e)return null;for(var t,n=0;n<e.length;++n)e[n].marker.explicitlyCleared?t||(t=e.slice(0,n)):t&&t.push(e[n]);return t?t.length?t:null:e}function yl(e,t){var n=t["spans_"+e.id];if(!n)return null;for(var r=[],i=0;i<t.text.length;++i)r.push(vl(n[i]));return r}function Ho(e,t){var n=yl(e,t),r=_r(e,t);if(!n)return r;if(!r)return n;for(var i=0;i<n.length;++i){var w=n[i],j=r[i];if(w&&j){e:for(var K=0;K<j.length;++K){for(var X=j[K],V=0;V<w.length;++V)if(w[V].marker==X.marker)continue e;w.push(X)}}else j&&(n[i]=j)}return n}function Un(e,t,n){for(var r=[],i=0;i<e.length;++i){var w=e[i];if(w.ranges){r.push(n?gr.prototype.deepCopy.call(w):w);continue}var j=w.changes,K=[];r.push({changes:K});for(var X=0;X<j.length;++X){var V=j[X],ae=void 0;if(K.push({from:V.from,to:V.to,text:V.text}),t)for(var ue in V)(ae=ue.match(/^spans_(\d+)$/))&&(ee(t,Number(ae[1]))>-1&&($(K)[ue]=V[ue],delete V[ue]))}}return r}function Ua(e,t,n,r){if(r){var i=e.anchor;if(n){var w=mt(t,i)<0;w!=mt(n,i)<0?(i=t,t=n):w!=mt(t,n)<0&&(t=n)}return new At(i,t)}else return new At(n||t,t)}function Yi(e,t,n,r,i){i==null&&(i=e.cm&&(e.cm.display.shift||e.extend)),Zt(e,new gr([Ua(e.sel.primary(),t,n,i)],0),r)}function Ko(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),w=0;w<e.sel.ranges.length;w++)r[w]=Ua(e.sel.ranges[w],t[w],null,i);var j=Tr(e.cm,r,e.sel.primIndex);Zt(e,j,n)}function Na(e,t,n,r){var i=e.sel.ranges.slice(0);i[t]=n,Zt(e,Tr(e.cm,i,e.sel.primIndex),r)}function Go(e,t,n,r){Zt(e,Xr(t,n),r)}function bl(e,t,n){var r={ranges:t.ranges,update:function(i){this.ranges=[];for(var w=0;w<i.length;w++)this.ranges[w]=new At(gt(e,i[w].anchor),gt(e,i[w].head))},origin:n&&n.origin};return Le(e,"beforeSelectionChange",e,r),e.cm&&Le(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?Tr(e.cm,r.ranges,r.ranges.length-1):t}function zo(e,t,n){var r=e.history.done,i=$(r);i&&i.ranges?(r[r.length-1]=t,$i(e,t,n)):Zt(e,t,n)}function Zt(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||(mt(t.primary().head,e.sel.primary().head)<0?-1:1);Xo(e,Yo(e,t,r,!0)),!(n&&n.scroll===!1)&&e.cm&&Mn(e.cm)}function Xo(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,ge(e.cm)),Ot(e,"cursorActivity",e)}function Vo(e){Xo(e,Yo(e,e.sel,null,!1))}function Yo(e,t,n,r){for(var i,w=0;w<t.ranges.length;w++){var j=t.ranges[w],K=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[w],X=Qi(e,j.anchor,K&&K.anchor,n,r),V=Qi(e,j.head,K&&K.head,n,r);(i||X!=j.anchor||V!=j.head)&&(i||(i=t.ranges.slice(0,w)),i[w]=new At(X,V))}return i?Tr(e.cm,i,t.primIndex):t}function Nn(e,t,n,r,i){var w=ut(e,t.line);if(w.markedSpans)for(var j=0;j<w.markedSpans.length;++j){var K=w.markedSpans[j],X=K.marker,V="selectLeft"in X?!X.selectLeft:X.inclusiveLeft,ae="selectRight"in X?!X.selectRight:X.inclusiveRight;if((K.from==null||(V?K.from<=t.ch:K.from<t.ch))&&(K.to==null||(ae?K.to>=t.ch:K.to>t.ch))){if(i&&(Le(X,"beforeCursorEnter"),X.explicitlyCleared))if(w.markedSpans){--j;continue}else break;if(!X.atomic)continue;if(n){var ue=X.find(r<0?1:-1),xe=void 0;if((r<0?ae:V)&&(ue=$o(e,ue,-r,ue&&ue.line==t.line?w:null)),ue&&ue.line==t.line&&(xe=mt(ue,n))&&(r<0?xe<0:xe>0))return Nn(e,ue,t,r,i)}var be=X.find(r<0?-1:1);return(r<0?V:ae)&&(be=$o(e,be,r,be.line==t.line?w:null)),be?Nn(e,be,t,r,i):null}}return t}function Qi(e,t,n,r,i){var w=r||1,j=Nn(e,t,n,w,i)||!i&&Nn(e,t,n,w,!0)||Nn(e,t,n,-w,i)||!i&&Nn(e,t,n,-w,!0);return j||(e.cantEdit=!0,Fe(e.first,0))}function $o(e,t,n,r){return n<0&&t.ch==0?t.line>e.first?gt(e,Fe(t.line-1)):null:n>0&&t.ch==(r||ut(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 Qo(e){e.setSelection(Fe(e.firstLine(),0),Fe(e.lastLine()),pe)}function Jo(e,t,n){var r={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return r.canceled=!0}};return n&&(r.update=function(i,w,j,K){i&&(r.from=gt(e,i)),w&&(r.to=gt(e,w)),j&&(r.text=j),K!==void 0&&(r.origin=K)}),Le(e,"beforeChange",e,r),e.cm&&Le(e.cm,"beforeChange",e.cm,r),r.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:r.from,to:r.to,text:r.text,origin:r.origin}}function Fn(e,t,n){if(e.cm){if(!e.cm.curOp)return zt(e.cm,Fn)(e,t,n);if(e.cm.state.suppressEdits)return}if((de(e,"beforeChange")||e.cm&&de(e.cm,"beforeChange"))&&(t=Jo(e,t,!0),!t))return;var r=_i&&!n&&oa(e,t.from,t.to);if(r)for(var i=r.length-1;i>=0;--i)Zo(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else Zo(e,t)}function Zo(e,t){if(t.text.length==1&&t.text[0]==""&&mt(t.from,t.to)==0)return;var n=ka(e,t);jo(e,t,n,e.cm?e.cm.curOp.id:NaN),fi(e,t,n,_r(e,t));var r=[];Yr(e,function(i,w){!w&&ee(r,i.history)==-1&&(rs(i.history,t),r.push(i.history)),fi(i,t,null,_r(i,t))})}function Ji(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(r&&!n)return;for(var i=e.history,w,j=e.sel,K=t=="undo"?i.done:i.undone,X=t=="undo"?i.undone:i.done,V=0;V<K.length&&!(w=K[V],n?w.ranges&&!w.equals(e.sel):!w.ranges);V++);if(V==K.length)return;for(i.lastOrigin=i.lastSelOrigin=null;;)if(w=K.pop(),w.ranges){if(Vi(w,X),n&&!w.equals(e.sel)){Zt(e,w,{clearRedo:!1});return}j=w}else if(r){K.push(w);return}else break;var ae=[];Vi(j,X),X.push({changes:ae,generation:i.generation}),i.generation=w.generation||++i.maxGeneration;for(var ue=de(e,"beforeChange")||e.cm&&de(e.cm,"beforeChange"),xe=function(Ne){var Ge=w.changes[Ne];if(Ge.origin=t,ue&&!Jo(e,Ge,!1))return K.length=0,{};ae.push(Ia(e,Ge));var Ye=Ne?ka(e,Ge):$(K);fi(e,Ge,Ye,Ho(e,Ge)),!Ne&&e.cm&&e.cm.scrollIntoView({from:Ge.from,to:Vr(Ge)});var tt=[];Yr(e,function($e,at){!at&&ee(tt,$e.history)==-1&&(rs($e.history,Ge),tt.push($e.history)),fi($e,Ge,null,Ho($e,Ge))})},be=w.changes.length-1;be>=0;--be){var Pe=xe(be);if(Pe)return Pe.v}}function qo(e,t){if(t==0)return;if(e.first+=t,e.sel=new gr(ie(e.sel.ranges,function(i){return new At(Fe(i.anchor.line+t,i.anchor.ch),Fe(i.head.line+t,i.head.ch))}),e.sel.primIndex),e.cm){nr(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 fi(e,t,n,r){if(e.cm&&!e.cm.curOp)return zt(e.cm,fi)(e,t,n,r);if(t.to.line<e.first){qo(e,t.text.length-1-(t.to.line-t.from.line));return}if(t.from.line>e.lastLine())return;if(t.from.line<e.first){var i=t.text.length-1-(e.first-t.from.line);qo(e,i),t={from:Fe(e.first,0),to:Fe(t.to.line+i,t.to.ch),text:[$(t.text)],origin:t.origin}}var w=e.lastLine();t.to.line>w&&(t={from:t.from,to:Fe(w,ut(e,w).text.length),text:[t.text[0]],origin:t.origin}),t.removed=wr(e,t.from,t.to),n||(n=ka(e,t)),e.cm?El(e.cm,t,r):Ma(e,t,r),$i(e,n,pe),e.cantEdit&&Qi(e,Fe(e.firstLine(),0))&&(e.cantEdit=!1)}function El(e,t,n){var r=e.doc,i=e.display,w=t.from,j=t.to,K=!1,X=w.line;e.options.lineWrapping||(X=Ct(Jt(ut(r,w.line))),r.iter(X,j.line+1,function(be){if(be==i.maxLine)return K=!0,!0})),r.sel.contains(t.from,t.to)>-1&&ge(e),Ma(r,t,n,go(e)),e.options.lineWrapping||(r.iter(X,w.line+t.text.length,function(be){var Pe=On(be);Pe>i.maxLineLength&&(i.maxLine=be,i.maxLineLength=Pe,i.maxLineChanged=!0,K=!1)}),K&&(e.curOp.updateMaxLine=!0)),Ri(r,w.line),ui(e,400);var V=t.text.length-(j.line-w.line)-1;t.full?nr(e):w.line==j.line&&t.text.length==1&&!Uo(e.doc,t)?Gr(e,w.line,"text"):nr(e,w.line,j.line+1,V);var ae=de(e,"changes"),ue=de(e,"change");if(ue||ae){var xe={from:w,to:j,text:t.text,removed:t.removed,origin:t.origin};ue&&Ot(e,"change",e,xe),ae&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(xe)}e.display.selForContextMenu=null}function Bn(e,t,n,r,i){var w;r||(r=n),mt(r,n)<0&&(w=[r,n],n=w[0],r=w[1]),typeof t=="string"&&(t=e.splitLines(t)),Fn(e,{from:n,to:r,text:t,origin:i})}function es(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function ts(e,t,n,r){for(var i=0;i<e.length;++i){var w=e[i],j=!0;if(w.ranges){w.copied||(w=e[i]=w.deepCopy(),w.copied=!0);for(var K=0;K<w.ranges.length;K++)es(w.ranges[K].anchor,t,n,r),es(w.ranges[K].head,t,n,r);continue}for(var X=0;X<w.changes.length;++X){var V=w.changes[X];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){j=!1;break}}j||(e.splice(0,i+1),i=0)}}function rs(e,t){var n=t.from.line,r=t.to.line,i=t.text.length-(r-n)-1;ts(e.done,n,r,i),ts(e.undone,n,r,i)}function hi(e,t,n,r){var i=t,w=t;return typeof t=="number"?w=ut(e,Yn(e,t)):i=Ct(t),i==null?null:(r(w,i)&&e.cm&&Gr(e.cm,i,n),w)}function mi(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}mi.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var n=e,r=e+t;n<r;++n){var i=this.lines[n];this.height-=i.height,ua(i),Ot(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 pi(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}pi.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 w=Math.min(t,i-e),j=r.height;if(r.removeInner(e,w),this.height-=j-r.height,i==w&&(this.children.splice(n--,1),r.parent=null),(t-=w)==0)break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof mi))){var K=[];this.collapse(K),this.children=[new mi(K)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,n){this.size+=t.length,this.height+=n;for(var r=0;r<this.children.length;++r){var i=this.children[r],w=i.chunkSize();if(e<=w){if(i.insertInner(e,t,n),i.lines&&i.lines.length>50){for(var j=i.lines.length%25+25,K=j;K<i.lines.length;){var X=new mi(i.lines.slice(K,K+=25));i.height-=X.height,this.children.splice(++r,0,X),X.parent=this}i.lines=i.lines.slice(0,j),this.maybeSpill()}break}e-=w}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),n=new pi(t);if(e.parent){e.size-=n.size,e.height-=n.height;var i=ee(e.parent.children,e);e.parent.children.splice(i+1,0,n)}else{var r=new pi(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],w=i.chunkSize();if(e<w){var j=Math.min(t,w-e);if(i.iterN(e,j,n))return!0;if((t-=j)==0)break;e=0}else e-=w}}};var gi=function(e,t,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.doc=e,this.node=t};gi.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 w=ri(this);mr(n,Math.max(0,n.height-w)),e&&(dr(e,function(){ns(e,n,-w),Gr(e,r,"widget")}),Ot(e,"lineWidgetCleared",e,this,r))},gi.prototype.changed=function(){var e=this,t=this.height,n=this.doc.cm,r=this.line;this.height=null;var i=ri(this)-t;if(!i)return;Er(this.doc,r)||mr(r,r.height+i),n&&dr(n,function(){n.curOp.forceUpdate=!0,ns(n,r,i),Ot(n,"lineWidgetChanged",n,e,Ct(r))})},fe(gi);function ns(e,t,n){ur(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Aa(e,n)}function xl(e,t,n,r){var i=new gi(e,n,r),w=e.cm;return w&&i.noHScroll&&(w.display.alignWidgets=!0),hi(e,t,"widget",function(j){var K=j.widgets||(j.widgets=[]);if(i.insertAt==null?K.push(i):K.splice(Math.min(K.length-1,Math.max(0,i.insertAt)),0,i),i.line=j,w&&!Er(e,j)){var X=ur(j)<e.scrollTop;mr(j,j.height+ri(i)),X&&Aa(w,i.height),w.curOp.forceUpdate=!0}return!0}),w&&Ot(w,"lineWidgetAdded",w,i,typeof t=="number"?t:Ct(t)),i}var is=0,$r=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++is};$r.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&pn(e),de(this,"clear")){var n=this.find();n&&Ot(this,"clear",n.from,n.to)}for(var r=null,i=null,w=0;w<this.lines.length;++w){var j=this.lines[w],K=Fr(j.markedSpans,this);e&&!this.collapsed?Gr(e,Ct(j),"text"):e&&(K.to!=null&&(i=Ct(j)),K.from!=null&&(r=Ct(j))),j.markedSpans=Br(j.markedSpans,K),K.from==null&&this.collapsed&&!Er(this.doc,j)&&e&&mr(j,_n(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var X=0;X<this.lines.length;++X){var V=Jt(this.lines[X]),ae=On(V);ae>e.display.maxLineLength&&(e.display.maxLine=V,e.display.maxLineLength=ae,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&nr(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Vo(e.doc)),e&&Ot(e,"markerCleared",e,this,r,i),t&&gn(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 w=this.lines[i],j=Fr(w.markedSpans,this);if(j.from!=null&&(n=Fe(t?w:Ct(w),j.from),e==-1))return n;if(j.to!=null&&(r=Fe(t?w:Ct(w),j.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,w=Ct(t.line),j=ma(r,w);if(j&&(so(j),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!Er(n.doc,i)&&n.height!=null){var K=n.height;n.height=null;var X=ri(n)-K;X&&mr(i,i.height+X)}Ot(r,"markerChanged",r,e)})},$r.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||ee(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},$r.prototype.detachLine=function(e){if(this.lines.splice(ee(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},fe($r);function jn(e,t,n,r,i){if(r&&r.shared)return Tl(e,t,n,r,i);if(e.cm&&!e.cm.curOp)return zt(e.cm,jn)(e,t,n,r,i);var w=new $r(e,i),j=mt(t,n);if(r&&I(r,w,!1),j>0||j==0&&w.clearWhenEmpty!==!1)return w;if(w.replacedWith&&(w.collapsed=!0,w.widgetNode=T("span",[w.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||w.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(w.widgetNode.insertLeft=!0)),w.collapsed){if(ei(e,t.line,t,n,w)||t.line!=n.line&&ei(e,n.line,t,n,w))throw new Error("Inserting collapsed marker partially overlapping an existing one");ki()}w.addToHistory&&jo(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var K=t.line,X=e.cm,V;if(e.iter(K,n.line+1,function(ue){X&&w.collapsed&&!X.options.lineWrapping&&Jt(ue)==X.display.maxLine&&(V=!0),w.collapsed&&K!=t.line&&mr(ue,0),jr(ue,new Tn(w,K==t.line?t.ch:null,K==n.line?n.ch:null)),++K}),w.collapsed&&e.iter(t.line,n.line+1,function(ue){Er(e,ue)&&mr(ue,0)}),w.clearOnEnter&&Se(w,"beforeCursorEnter",function(){return w.clear()}),w.readOnly&&(Ar(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),w.collapsed&&(w.id=++is,w.atomic=!0),X){if(V&&(X.curOp.updateMaxLine=!0),w.collapsed)nr(X,t.line,n.line+1);else if(w.className||w.startStyle||w.endStyle||w.css||w.attributes||w.title)for(var ae=t.line;ae<=n.line;ae++)Gr(X,ae,"text");w.atomic&&Vo(X.doc),Ot(X,"markerAdded",X,w)}return w}var vi=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};vi.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();Ot(this,"clear")},vi.prototype.find=function(e,t){return this.primary.find(e,t)},fe(vi);function Tl(e,t,n,r,i){r=I(r),r.shared=!1;var w=[jn(e,t,n,r,i)],j=w[0],K=r.widgetNode;return Yr(e,function(X){K&&(r.widgetNode=K.cloneNode(!0)),w.push(jn(X,gt(X,t),gt(X,n),r,i));for(var V=0;V<X.linked.length;++V)if(X.linked[V].isParent)return;j=$(w)}),new vi(w,j)}function as(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(),w=e.clipPos(i.from),j=e.clipPos(i.to);if(mt(w,j)){var K=jn(e,w,j,r.primary,r.primary.type);r.markers.push(K),K.parent=r}}}function wl(e){for(var t=function(r){var i=e[r],w=[i.primary.doc];Yr(i.primary.doc,function(X){return w.push(X)});for(var j=0;j<i.markers.length;j++){var K=i.markers[j];ee(w,K.doc)==-1&&(K.parent=null,i.markers.splice(j--,1))}},n=0;n<e.length;n++)t(n)}var Cl=0,ir=function(e,t,n,r,i){if(!(this instanceof ir))return new ir(e,t,n,r,i);n==null&&(n=0),pi.call(this,[new mi([new Kr("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var w=Fe(n,0);this.sel=Xr(w),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)),Ma(this,{from:w,to:w,text:e}),Zt(this,Xr(w),pe)};ir.prototype=Ce(pi.prototype,{constructor:ir,iter:function(e,t,n){n?this.iterN(e-this.first,t-e,n):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var n=0,r=0;r<t.length;++r)n+=t[r].height;this.insertInner(e-this.first,t,n)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=Vn(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:Xt(function(e){var t=Fe(this.first,0),n=this.first+this.size-1;Fn(this,{from:t,to:Fe(n,ut(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&ai(this.cm,0,0),Zt(this,Xr(t),pe)}),replaceRange:function(e,t,n,r){t=gt(this,t),n=n?gt(this,n):t,Bn(this,e,t,n,r)},getRange:function(e,t,n){var r=wr(this,gt(this,e),gt(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(en(this,e))return ut(this,e)},getLineNumber:function(e){return Ct(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=ut(this,e)),Jt(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return gt(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:Xt(function(e,t,n){Go(this,gt(this,typeof e=="number"?Fe(e,t||0):e),null,n)}),setSelection:Xt(function(e,t,n){Go(this,gt(this,e),gt(this,t||e),n)}),extendSelection:Xt(function(e,t,n){Yi(this,gt(this,e),t&>(this,t),n)}),extendSelections:Xt(function(e,t){Ko(this,Ai(this,e),t)}),extendSelectionsBy:Xt(function(e,t){var n=ie(this.sel.ranges,e);Ko(this,Ai(this,n),t)}),setSelections:Xt(function(e,t,n){if(!e.length)return;for(var r=[],i=0;i<e.length;i++)r[i]=new At(gt(this,e[i].anchor),gt(this,e[i].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),Zt(this,Tr(this.cm,r,t),n)}),addSelection:Xt(function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new At(gt(this,e),gt(this,t||e))),Zt(this,Tr(this.cm,r,r.length-1),n)}),getSelection:function(e){for(var t=this.sel.ranges,n,r=0;r<t.length;r++){var i=wr(this,t[r].from(),t[r].to());n=n?n.concat(i):i}return e===!1?n:n.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],n=this.sel.ranges,r=0;r<n.length;r++){var i=wr(this,n[r].from(),n[r].to());e!==!1&&(i=i.join(e||this.lineSeparator())),t[r]=i}return t},replaceSelection:function(e,t,n){for(var r=[],i=0;i<this.sel.ranges.length;i++)r[i]=e;this.replaceSelections(r,t,n||"+input")},replaceSelections:Xt(function(e,t,n){for(var r=[],i=this.sel,w=0;w<i.ranges.length;w++){var j=i.ranges[w];r[w]={from:j.from(),to:j.to(),text:this.splitLines(e[w]),origin:n}}for(var K=t&&t!="end"&&fl(this,r,t),X=r.length-1;X>=0;X--)Fn(this,r[X]);K?zo(this,K):this.cm&&Mn(this.cm)}),undo:Xt(function(){Ji(this,"undo")}),redo:Xt(function(){Ji(this,"redo")}),undoSelection:Xt(function(){Ji(this,"undo",!0)}),redoSelection:Xt(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:Un(this.history.done),undone:Un(this.history.undone)}},setHistory:function(e){var t=this.history=new Xi(this.history.maxGeneration);t.done=Un(e.done.slice(0),null,!0),t.undone=Un(e.undone.slice(0),null,!0)},setGutterMarker:Xt(function(e,t,n){return hi(this,e,"gutter",function(r){var i=r.gutterMarkers||(r.gutterMarkers={});return i[t]=n,!n&&Re(i)&&(r.gutterMarkers=null),!0})}),clearGutter:Xt(function(e){var t=this;this.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&hi(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(!en(this,e))return null;if(t=e,e=ut(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:Xt(function(e,t,n){return hi(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(x(n).test(r[i]))return!1;r[i]+=" "+n}return!0})}),removeLineClass:Xt(function(e,t,n){return hi(this,e,t=="gutter"?"gutter":"class",function(r){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",w=r[i];if(w)if(n==null)r[i]=null;else{var j=w.match(x(n));if(!j)return!1;var K=j.index+j[0].length;r[i]=w.slice(0,j.index)+(!j.index||K==w.length?"":" ")+w.slice(K)||null}else return!1;return!0})}),addLineWidget:Xt(function(e,t,n){return xl(this,e,t,n)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return jn(this,gt(this,e),gt(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=gt(this,e),jn(this,e,e,n,"bookmark")},findMarksAt:function(e){e=gt(this,e);var t=[],n=ut(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=gt(this,e),t=gt(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,function(w){var j=w.markedSpans;if(j)for(var K=0;K<j.length;K++){var X=j[K];!(X.to!=null&&i==e.line&&e.ch>=X.to||X.from==null&&i!=e.line||X.from!=null&&i==t.line&&X.from>=t.ch)&&(!n||n(X.marker))&&r.push(X.marker.parent||X.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 w=i.text.length+r;if(w>e)return t=e,!0;e-=w,++n}),gt(this,Fe(n,t))},indexFromPos:function(e){e=gt(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 ir(Vn(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,n=this.first+this.size;e.from!=null&&e.from>t&&(t=e.from),e.to!=null&&e.to<n&&(n=e.to);var r=new ir(Vn(this,t,n),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(r.history=this.history),(this.linked||(this.linked=[])).push({doc:r,sharedHist:e.sharedHist}),r.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],Sl(r,as(this)),r},unlinkDoc:function(e){if(e instanceof Pt&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){var n=this.linked[t];if(n.doc!=e)continue;this.linked.splice(t,1),e.unlinkDoc(this),wl(as(this));break}if(e.history==this.history){var r=[e.id];Yr(e,function(i){return r.push(i.id)},!0),e.history=new Xi(null),e.history.done=Un(this.history.done,r),e.history.undone=Un(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):ot(e)},lineSeparator:function(){return this.lineSep||`
|
|
`},setDirection:Xt(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)})}),ir.prototype.eachLine=ir.prototype.iter;var os=0;function Al(e){var t=this;if(ss(t),Ue(t,e)||Mr(t.display,e))return;Q(e),F&&(os=+new Date);var n=cn(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,w=Array(i),j=0,K=function(){++j==i&&zt(t,function(){n=gt(t.doc,n);var be={from:n,to:n,text:t.doc.splitLines(w.filter(function(Pe){return Pe!=null}).join(t.doc.lineSeparator())),origin:"paste"};Fn(t.doc,be),zo(t.doc,Xr(gt(t.doc,n),gt(t.doc,Vr(be))))})()},X=function(be,Pe){if(t.options.allowDropFileTypes&&ee(t.options.allowDropFileTypes,be.type)==-1){K();return}var Ne=new FileReader;Ne.onerror=function(){return K()},Ne.onload=function(){var Ge=Ne.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(Ge)){K();return}w[Pe]=Ge,K()},Ne.readAsText(be)},V=0;V<r.length;V++)X(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)Bn(t.doc,"",ue[xe].anchor,ue[xe].head,"drag");t.replaceSelection(ae,"around","paste"),t.display.input.focus()}}catch(be){}}}function Ll(e,t){if(F&&(!e.state.draggingText||+new Date-os<100)){le(t);return}if(Ue(e,t)||Mr(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!k){var n=o("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",v&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),v&&n.parentNode.removeChild(n)}}function Dl(e,t){var n=cn(e,t);if(!n)return;var r=document.createDocumentFragment();bo(e,n,r),e.display.dragCursor||(e.display.dragCursor=o("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),d(e.display.dragCursor,r)}function ss(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function ls(e){if(!document.getElementsByClassName)return;for(var t=document.getElementsByClassName("CodeMirror"),n=[],r=0;r<t.length;r++){var i=t[r].CodeMirror;i&&n.push(i)}n.length&&n[0].operation(function(){for(var w=0;w<n.length;w++)e(n[w])})}var us=!1;function Ol(){if(us)return;Rl(),us=!0}function Rl(){var e;Se(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,ls(_l)},100))}),Se(window,"blur",function(){return ls(Pn)})}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"},yi=0;yi<10;yi++)Qr[yi+48]=Qr[yi+96]=String(yi);for(var Zi=65;Zi<=90;Zi++)Qr[Zi]=String.fromCharCode(Zi);for(var bi=1;bi<=12;bi++)Qr[bi+111]=Qr[bi+63235]="F"+bi;var Ir={};Ir.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"},Ir.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"},Ir.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"},Ir.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"]},Ir.default=s?Ir.macDefault:Ir.pcDefault;function kl(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var n,r,i,w,j=0;j<t.length-1;j++){var K=t[j];if(/^(cmd|meta|m)$/i.test(K))w=!0;else if(/^a(lt)?$/i.test(K))n=!0;else if(/^(c|ctrl|control)$/i.test(K))r=!0;else if(/^s(hift)?$/i.test(K))i=!0;else throw new Error("Unrecognized modifier name: "+K)}return n&&(e="Alt-"+e),r&&(e="Ctrl-"+e),w&&(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=ie(n.split(" "),kl),w=0;w<i.length;w++){var j=void 0,K=void 0;w==i.length-1?(K=i.join(" "),j=r):(K=i.slice(0,w+1).join(" "),j="...");var X=t[K];if(!X)t[K]=j;else if(X!=j)throw new Error("Inconsistent bindings for "+K)}delete e[n]}for(var V in t)e[V]=t[V];return e}function Wn(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 Wn(e,t.fallthrough,n,r);for(var w=0;w<t.fallthrough.length;w++){var j=Wn(e,t.fallthrough[w],n,r);if(j)return j}}}function ds(e){var t=typeof e=="string"?e:Qr[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function cs(e,t,n){var r=e;return t.altKey&&r!="Alt"&&(e="Alt-"+e),(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 fs(e,t){if(v&&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),cs(n,e,t))}function qi(e){return typeof e=="string"?Ir[e]:e}function Hn(e,t){for(var n=e.doc.sel.ranges,r=[],i=0;i<n.length;i++){for(var w=t(n[i]);r.length&&mt(w.from,$(r).to)<=0;){var j=r.pop();if(mt(j.from,w.from)<0){w.from=j.from;break}}r.push(w)}dr(e,function(){for(var K=r.length-1;K>=0;K--)Bn(e.doc,"",r[K].from,r[K].to,"+delete");Mn(e)})}function Fa(e,t,n){var r=De(e.text,t+n,n);return r<0||r>e.text.length?null:r}function Ba(e,t,n){var r=Fa(e,t.ch,n);return r==null?null:new Fe(t.line,r,n<0?"after":"before")}function ja(e,t,n,r,i){if(e){t.doc.direction=="rtl"&&(i=-i);var w=He(n,t.doc.direction);if(w){var j=i<0?$(w):w[0],K=i<0==(j.level==1),X=K?"after":"before",V;if(j.level>0||t.doc.direction=="rtl"){var ae=Rn(t,n);V=i<0?n.text.length-1:0;var ue=Dr(t,ae,V).top;V=Ve(function(xe){return Dr(t,ae,xe).top==ue},i<0==(j.level==1)?j.from:j.to-1,V),X=="before"&&(V=Fa(n,V,1))}else V=i<0?j.to:j.from;return new Fe(r,V,X)}}return new Fe(r,i<0?n.text.length:0,i<0?"before":"after")}function Ml(e,t,n,r){var i=He(t,e.doc.direction);if(!i)return Ba(t,n,r);n.ch>=t.text.length?(n.ch=t.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var w=Xe(i,n.ch,n.sticky),j=i[w];if(e.doc.direction=="ltr"&&j.level%2==0&&(r>0?j.to>n.ch:j.from<n.ch))return Ba(t,n,r);var K=function(Ye,tt){return Fa(t,Ye instanceof Fe?Ye.ch:Ye,tt)},X,V=function(Ye){return e.options.lineWrapping?(X=X||Rn(e,t),po(e,t,X,Ye)):{begin:0,end:t.text.length}},ae=V(n.sticky=="before"?K(n,-1):n.ch);if(e.doc.direction=="rtl"||j.level==1){var ue=j.level==1==r<0,xe=K(n,ue?1:-1);if(xe!=null&&(ue?xe<=j.to&&xe<=ae.end:xe>=j.from&&xe>=ae.begin)){var be=ue?"before":"after";return new Fe(n.line,xe,be)}}var Pe=function(Ye,tt,$e){for(var at=function(_t,Vt){return Vt?new Fe(n.line,K(_t,1),"before"):new Fe(n.line,_t,"after")};Ye>=0&&Ye<i.length;Ye+=tt){var ht=i[Ye],dt=tt>0==(ht.level!=1),bt=dt?$e.begin:K($e.end,-1);if(ht.from<=bt&&bt<ht.to)return at(bt,dt);if(bt=dt?ht.from:K(ht.to,-1),$e.begin<=bt&&bt<$e.end)return at(bt,dt)}},Ne=Pe(w+r,r,ae);if(Ne)return Ne;var Ge=r>0?ae.end:K(ae.begin,-1);return Ge!=null&&!(r>0&&Ge==t.text.length)&&(Ne=Pe(r>0?0:i.length-1,r,V(Ge)),Ne)?Ne:null}var Ei={selectAll:Qo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),pe)},killLine:function(e){return Hn(e,function(t){if(t.empty()){var n=ut(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 Hn(e,function(t){return{from:Fe(t.from().line,0),to:gt(e.doc,Fe(t.to().line+1,0))}})},delLineLeft:function(e){return Hn(e,function(t){return{from:Fe(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return Hn(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 Hn(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 hs(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return ms(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return Il(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div")},he)},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")},he)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return r.ch<e.getLine(r.line).search(/\S/)?ms(e,t.head):r},he)},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 w=n[i].from(),j=H(e.getLine(w.line),w.ch,r);t.push(ce(r-j%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,w=ut(e.doc,i.line).text;if(w){if(i.ch==w.length&&(i=new Fe(i.line,i.ch-1)),i.ch>0)i=new Fe(i.line,i.ch+1),e.replaceRange(w.charAt(i.ch-1)+w.charAt(i.ch-2),Fe(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var j=ut(e.doc,i.line-1).text;j&&(i=new Fe(i.line,1),e.replaceRange(w.charAt(0)+e.doc.lineSeparator()+j.charAt(j.length-1),Fe(i.line-1,j.length-1),i,"+transpose"))}}n.push(new At(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);Mn(e)})},openLine:function(e){return e.replaceSelection(`
|
|
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function hs(e,t){var n=ut(e.doc,t),r=Jt(n);return r!=n&&(t=Ct(r)),ja(!0,e,r,t,1)}function Il(e,t){var n=ut(e.doc,t),r=Wr(n);return r!=n&&(t=Ct(r)),ja(!0,e,n,t,-1)}function ms(e,t){var n=hs(e,t.line),r=ut(e.doc,n.line),i=He(r,e.doc.direction);if(!i||i[0].level==0){var w=Math.max(n.ch,r.text.search(/\S/)),j=t.line==n.line&&t.ch<=w&&t.ch;return Fe(n.line,j?0:w,n.sticky)}return n}function ea(e,t,n){if(typeof t=="string"&&(t=Ei[t],!t))return!1;e.display.input.ensurePolled();var r=e.display.shift,i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),i=t(e)!=Ee}finally{e.display.shift=r,e.state.suppressEdits=!1}return i}function Ul(e,t,n){for(var r=0;r<e.state.keyMaps.length;r++){var i=Wn(t,e.state.keyMaps[r],n,e);if(i)return i}return e.options.extraKeys&&Wn(t,e.options.extraKeys,n,e)||Wn(t,e.options.keyMap,n,e)}var Nl=new Y;function xi(e,t,n,r){var i=e.state.keySeq;if(i){if(ds(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Nl.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),ps(e,i+" "+t,n,r))return!0}return ps(e,t,n,r)}function ps(e,t,n,r){var i=Ul(e,t,r);return i=="multi"&&(e.state.keySeq=t),i=="handled"&&Ot(e,"keyHandled",e,t,n),(i=="handled"||i=="multi")&&(Q(n),Sa(e)),!!i}function gs(e,t){var n=fs(t,!0);return n?t.shiftKey&&!e.state.keySeq?xi(e,"Shift-"+n,t,function(r){return ea(e,r,!0)})||xi(e,n,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return ea(e,r)}):xi(e,n,t,function(r){return ea(e,r)}):!1}function Fl(e,t,n){return xi(e,"'"+n+"'",t,function(r){return ea(e,r,!0)})}var Wa=null;function vs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=_(),Ue(t,e))return;F&&M<11&&e.keyCode==27&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=n==16||e.shiftKey;var r=gs(t,e);v&&(Wa=r?n:null,!r&&n==88&&!Et&&(s?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),D&&!s&&!r&&n==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),n==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Bl(t)}function Bl(e){var t=e.display.lineDiv;N(t,"CodeMirror-crosshair");function n(r){(r.keyCode==18||!r.altKey)&&(h(t,"CodeMirror-crosshair"),Je(document,"keyup",n),Je(document,"mouseover",n))}Se(document,"keyup",n),Se(document,"mouseover",n)}function ys(e){e.keyCode==16&&(this.doc.sel.shift=!1),Ue(this,e)}function bs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(Mr(t.display,e)||Ue(t,e)||e.ctrlKey&&!e.altKey||s&&e.metaKey)return;var n=e.keyCode,r=e.charCode;if(v&&n==Wa){Wa=null,Q(e);return}if(v&&(!e.which||e.which<10)&&gs(t,e))return;var i=String.fromCharCode(r==null?n:r);if(i=="\b")return;if(Fl(t,e,i))return;t.display.input.onKeyPress(e)}var jl=400,Ha=function(e,t,n){this.time=e,this.pos=t,this.button=n};Ha.prototype.compare=function(e,t,n){return this.time+jl>e&&mt(t,this.pos)==0&&n==this.button};var Ti,Si;function Wl(e,t){var n=+new Date;return Si&&Si.compare(n,e,t)?(Ti=Si=null,"triple"):Ti&&Ti.compare(n,e,t)?(Si=new Ha(n,e,t),Ti=null,"double"):(Ti=new Ha(n,e,t),Si=null,"single")}function Es(e){var t=this,n=t.display;if(Ue(t,e)||n.activeTouch&&n.input.supportsTouch())return;if(n.input.ensurePolled(),n.shift=e.shiftKey,Mr(n,e)){R||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(Ka(t,e))return;var r=cn(t,e),i=_e(e),w=r?Wl(r,i):"single";if(window.focus(),i==1&&t.state.selectingText&&t.state.selectingText(e),r&&Hl(t,i,r,w,e))return;i==1?r?Gl(t,r,w,e):Te(e)==n.scroller&&Q(e):i==2?(r&&Yi(t.doc,r),setTimeout(function(){return n.input.focus()},20)):i==3&&(L?t.display.input.onContextMenu(e):xo(t))}function Hl(e,t,n,r,i){var w="Click";return r=="double"?w="Double"+w:r=="triple"&&(w="Triple"+w),w=(t==1?"Left":t==2?"Middle":"Right")+w,xi(e,cs(w,i),i,function(j){if(typeof j=="string"&&(j=Ei[j]),!j)return!1;var K=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),K=j(e,n)!=Ee}finally{e.state.suppressEdits=!1}return K})}function Kl(e,t,n){var r=e.getOption("configureMouse"),i=r?r(e,t,n):{};if(i.unit==null){var w=l?n.shiftKey&&n.metaKey:n.altKey;i.unit=w?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(i.extend==null||e.doc.extend)&&(i.extend=e.doc.extend||n.shiftKey),i.addNew==null&&(i.addNew=s?n.metaKey:n.ctrlKey),i.moveOnDrag==null&&(i.moveOnDrag=!(s?n.altKey:n.ctrlKey)),i}function Gl(e,t,n,r){F?setTimeout(P(Eo,e),0):e.curOp.focus=_();var i=Kl(e,n,r),w=e.doc.sel,j;e.options.dragDrop&&ke&&!e.isReadOnly()&&n=="single"&&(j=w.contains(t))>-1&&(mt((j=w.ranges[j]).from(),t)<0||t.xRel>0)&&(mt(j.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,w=!1,j=zt(e,function(V){R&&(i.scroller.draggable=!1),e.state.draggingText=!1,Je(i.wrapper.ownerDocument,"mouseup",j),Je(i.wrapper.ownerDocument,"mousemove",K),Je(i.scroller,"dragstart",X),Je(i.scroller,"drop",j),w||(Q(V),r.addNew||Yi(e.doc,n,null,null,r.extend),R&&!k||F&&M==9?setTimeout(function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()},20):i.input.focus())}),K=function(V){w=w||Math.abs(t.clientX-V.clientX)+Math.abs(t.clientY-V.clientY)>=10},X=function(){return w=!0};R&&(i.scroller.draggable=!0),e.state.draggingText=j,j.copy=!r.moveOnDrag,i.scroller.dragDrop&&i.scroller.dragDrop(),Se(i.wrapper.ownerDocument,"mouseup",j),Se(i.wrapper.ownerDocument,"mousemove",K),Se(i.scroller,"dragstart",X),Se(i.scroller,"drop",j),xo(e),setTimeout(function(){return i.input.focus()},20)}function xs(e,t,n){if(n=="char")return new At(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new At(Fe(t.line,0),gt(e.doc,Fe(t.line+1,0)));var r=n(e,t);return new At(r.from,r.to)}function Xl(e,t,n,r){var i=e.display,w=e.doc;Q(t);var j,K,X=w.sel,V=X.ranges;if(r.addNew&&!r.extend?(K=w.sel.contains(n),K>-1?j=V[K]:j=new At(n,n)):(j=w.sel.primary(),K=w.sel.primIndex),r.unit=="rectangle")r.addNew||(j=new At(n,n)),n=cn(e,t,!0,!0),K=-1;else{var ae=xs(e,n,r.unit);r.extend?j=Ua(j,ae.anchor,ae.head,r.extend):j=ae}r.addNew?K==-1?(K=V.length,Zt(w,Tr(e,V.concat([j]),K),{scroll:!1,origin:"*mouse"})):V.length>1&&V[K].empty()&&r.unit=="char"&&!r.extend?(Zt(w,Tr(e,V.slice(0,K).concat(V.slice(K+1)),0),{scroll:!1,origin:"*mouse"}),X=w.sel):Na(w,K,j,me):(K=0,Zt(w,new gr([j],0),me),X=w.sel);var ue=n;function xe($e){if(mt(ue,$e)==0)return;if(ue=$e,r.unit=="rectangle"){for(var at=[],ht=e.options.tabSize,dt=H(ut(w,n.line).text,n.ch,ht),bt=H(ut(w,$e.line).text,$e.ch,ht),_t=Math.min(dt,bt),Vt=Math.max(dt,bt),Ut=Math.min(n.line,$e.line),cr=Math.min(e.lastLine(),Math.max(n.line,$e.line));Ut<=cr;Ut++){var ar=ut(w,Ut).text,Wt=se(ar,_t,ht);_t==Vt?at.push(new At(Fe(Ut,Wt),Fe(Ut,Wt))):ar.length>Wt&&at.push(new At(Fe(Ut,Wt),Fe(Ut,se(ar,Vt,ht))))}at.length||at.push(new At(n,n)),Zt(w,Tr(e,X.ranges.slice(0,K).concat(at),K),{origin:"*mouse",scroll:!1}),e.scrollIntoView($e)}else{var or=j,$t=xs(e,$e,r.unit),Gt=or.anchor,Ht;mt($t.anchor,Gt)>0?(Ht=$t.head,Gt=En(or.from(),$t.anchor)):(Ht=$t.anchor,Gt=nn(or.to(),$t.head));var Ft=X.ranges.slice(0);Ft[K]=Vl(e,new At(gt(w,Gt),Ht)),Zt(w,Tr(e,Ft,K),me)}}var be=i.wrapper.getBoundingClientRect(),Pe=0;function Ne($e){var at=++Pe,ht=cn(e,$e,!0,r.unit=="rectangle");if(!ht)return;if(mt(ht,ue)!=0){e.curOp.focus=_(),xe(ht);var dt=Hi(i,w);(ht.line>=dt.to||ht.line<dt.from)&&setTimeout(zt(e,function(){Pe==at&&Ne($e)}),150)}else{var bt=$e.clientY<be.top?-20:$e.clientY>be.bottom?20:0;bt&&setTimeout(zt(e,function(){if(Pe!=at)return;i.scroller.scrollTop+=bt,Ne($e)}),50)}}function Ge($e){e.state.selectingText=!1,Pe=Infinity,$e&&(Q($e),i.input.focus()),Je(i.wrapper.ownerDocument,"mousemove",Ye),Je(i.wrapper.ownerDocument,"mouseup",tt),w.history.lastSelOrigin=null}var Ye=zt(e,function($e){$e.buttons===0||!_e($e)?Ge($e):Ne($e)}),tt=zt(e,Ge);e.state.selectingText=tt,Se(i.wrapper.ownerDocument,"mousemove",Ye),Se(i.wrapper.ownerDocument,"mouseup",tt)}function Vl(e,t){var n=t.anchor,r=t.head,i=ut(e.doc,n.line);if(mt(n,r)==0&&n.sticky==r.sticky)return t;var w=He(i);if(!w)return t;var j=Xe(w,n.ch,n.sticky),K=w[j];if(K.from!=n.ch&&K.to!=n.ch)return t;var X=j+(K.from==n.ch==(K.level!=1)?0:1);if(X==0||X==w.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(w,r.ch,r.sticky),ue=ae-j||(r.ch-n.ch)*(K.level==1?-1:1);ae==X-1||ae==X?V=ue<0:V=ue>0}var xe=w[X+(V?-1:0)],be=V==(xe.level==1),Pe=be?xe.from:xe.to,Ne=be?"after":"before";return n.ch==Pe&&n.sticky==Ne?t:new At(new Fe(n.line,Pe,Ne),r)}function Ts(e,t,n,r){var i,w;if(t.touches)i=t.touches[0].clientX,w=t.touches[0].clientY;else try{i=t.clientX,w=t.clientY}catch(xe){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&Q(t);var j=e.display,K=j.lineDiv.getBoundingClientRect();if(w>K.bottom||!de(e,n))return re(t);w-=K.top-j.viewOffset;for(var X=0;X<e.display.gutterSpecs.length;++X){var V=j.gutters.childNodes[X];if(V&&V.getBoundingClientRect().right>=i){var ae=Cr(e.doc,w),ue=e.display.gutterSpecs[X];return Le(e,n,e,ae,ue.className,t),re(t)}}}function Ka(e,t){return Ts(e,t,"gutterClick",!0)}function Ss(e,t){if(Mr(e.display,t)||Yl(e,t))return;if(Ue(e,t,"contextmenu"))return;L||e.display.input.onContextMenu(t)}function Yl(e,t){return de(e,"gutterContextMenu")?Ts(e,t,"gutterContextMenu",!1):!1}function ws(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),ni(e)}var Kn={toString:function(){return"CodeMirror.Init"}},Cs={},ta={};function $l(e){var t=e.optionHandlers;function n(r,i,w,j){e.defaults[r]=i,w&&(t[r]=j?function(K,X,V){V!=Kn&&w(K,X,V)}:w)}e.defineOption=n,e.Init=Kn,n("value","",function(r,i){return r.setValue(i)},!0),n("mode",null,function(r,i){r.doc.modeOption=i,Pa(r)},!0),n("indentUnit",2,Pa,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(r){ci(r),ni(r),nr(r)},!0),n("lineSeparator",null,function(r,i){if(r.doc.lineSep=i,!i)return;var w=[],j=r.doc.first;r.doc.iter(function(X){for(var V=0;;){var ae=X.text.indexOf(i,V);if(ae==-1)break;V=ae+i.length,w.push(Fe(j,ae))}j++});for(var K=w.length-1;K>=0;K--)Bn(r.doc,i,w[K],Fe(w[K].line,w[K].ch+i.length))}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(r,i,w){r.state.specialChars=new RegExp(i.source+(i.test(" ")?"":"| "),"g"),w!=Kn&&r.refresh()}),n("specialCharPlaceholder",lt,function(r){return r.refresh()},!0),n("electricChars",!0),n("inputStyle",a?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),n("spellcheck",!1,function(r,i){return r.getInputField().spellcheck=i},!0),n("autocorrect",!1,function(r,i){return r.getInputField().autocorrect=i},!0),n("autocapitalize",!1,function(r,i){return r.getInputField().autocapitalize=i},!0),n("rtlMoveVisually",!A),n("wholeLineUpdateBefore",!0),n("theme","default",function(r){ws(r),di(r)},!0),n("keyMap","default",function(r,i,w){var j=qi(i),K=w!=Kn&&qi(w);K&&K.detach&&K.detach(r,j),j.attach&&j.attach(r,K||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Jl,!0),n("gutters",[],function(r,i){r.display.gutterSpecs=_a(i,r.options.lineNumbers),di(r)},!0),n("fixedGutter",!0,function(r,i){r.display.gutters.style.left=i?xa(r.display)+"px":"0",r.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(r){return In(r)},!0),n("scrollbarStyle","native",function(r){Lo(r),In(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=_a(r.options.gutters,i),di(r)},!0),n("firstLineNumber",1,di,!0),n("lineNumberFormatter",function(r){return r},di,!0),n("showCursorWhenSelecting",!1,ii,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,function(r,i){i=="nocursor"&&(Pn(r),r.display.input.blur()),r.display.input.readOnlyChanged(i)}),n("screenReaderLabel",null,function(r,i){i=i===""?null:i,r.display.input.screenReaderLabelChanged(i)}),n("disableInput",!1,function(r,i){i||r.display.input.reset()},!0),n("dragDrop",!0,Ql),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,ii,!0),n("singleCursorHeightPerLine",!0,ii,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,ci,!0),n("addModeClass",!1,ci,!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,ci,!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!=Kn;if(!t!=!r){var i=e.display.dragFunctions,w=t?Se:Je;w(e.display.scroller,"dragstart",i.start),w(e.display.scroller,"dragenter",i.enter),w(e.display.scroller,"dragover",i.over),w(e.display.scroller,"dragleave",i.leave),w(e.display.scroller,"drop",i.drop)}}function Jl(e){e.options.lineWrapping?(N(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(h(e.display.wrapper,"CodeMirror-wrap"),kr(e)),Ta(e),nr(e),ni(e),setTimeout(function(){return In(e)},100)}function Pt(e,t){var n=this;if(!(this instanceof Pt))return new Pt(e,t);this.options=t=t?I(t):{},I(Cs,t,!1);var r=t.value;typeof r=="string"?r=new ir(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var i=new Pt.inputStyles[t.inputStyle](this),w=this.display=new dl(e,r,i,t);w.wrapper.CodeMirror=this,ws(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Lo(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new Y,keySeq:null,specialChars:null},t.autofocus&&!a&&w.input.focus(),F&&M<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Zl(this),Ol(),pn(this),this.curOp.forceUpdate=!0,No(this,r),t.autofocus&&!a||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&wa(n)},20):Pn(this);for(var j in ta)ta.hasOwnProperty(j)&&ta[j](this,t[j],Kn);Ro(this),t.finishInit&&t.finishInit(this);for(var K=0;K<Ga.length;++K)Ga[K](this);gn(this),R&&t.lineWrapping&&getComputedStyle(w.lineDiv).textRendering=="optimizelegibility"&&(w.lineDiv.style.textRendering="auto")}Pt.defaults=Cs,Pt.optionHandlers=ta;function Zl(e){var t=e.display;Se(t.scroller,"mousedown",zt(e,Es)),F&&M<11?Se(t.scroller,"dblclick",zt(e,function(X){if(Ue(e,X))return;var V=cn(e,X);if(!V||Ka(e,X)||Mr(e.display,X))return;Q(X);var ae=e.findWordAt(V);Yi(e.doc,ae.anchor,ae.head)})):Se(t.scroller,"dblclick",function(X){return Ue(e,X)||Q(X)}),Se(t.scroller,"contextmenu",function(X){return Ss(e,X)}),Se(t.input.getField(),"contextmenu",function(X){t.scroller.contains(X.target)||Ss(e,X)});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 w(X){if(X.touches.length!=1)return!1;var V=X.touches[0];return V.radiusX<=1&&V.radiusY<=1}function j(X,V){if(V.left==null)return!0;var ae=V.left-X.left,ue=V.top-X.top;return ae*ae+ue*ue>20*20}Se(t.scroller,"touchstart",function(X){if(!Ue(e,X)&&!w(X)&&!Ka(e,X)){t.input.ensurePolled(),clearTimeout(n);var V=+new Date;t.activeTouch={start:V,moved:!1,prev:V-r.end<=300?r:null},X.touches.length==1&&(t.activeTouch.left=X.touches[0].pageX,t.activeTouch.top=X.touches[0].pageY)}}),Se(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Se(t.scroller,"touchend",function(X){var V=t.activeTouch;if(V&&!Mr(t,X)&&V.left!=null&&!V.moved&&new Date-V.start<300){var ae=e.coordsChar(t.activeTouch,"page"),ue;!V.prev||j(V,V.prev)?ue=new At(ae,ae):!V.prev.prev||j(V,V.prev.prev)?ue=e.findWordAt(ae):ue=new At(Fe(ae.line,0),gt(e.doc,Fe(ae.line+1,0))),e.setSelection(ue.anchor,ue.head),e.focus(),Q(X)}i()}),Se(t.scroller,"touchcancel",i),Se(t.scroller,"scroll",function(){t.scroller.clientHeight&&(oi(e,t.scroller.scrollTop),hn(e,t.scroller.scrollLeft,!0),Le(e,"scroll",e))}),Se(t.scroller,"mousewheel",function(X){return Po(e,X)}),Se(t.scroller,"DOMMouseScroll",function(X){return Po(e,X)}),Se(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(X){Ue(e,X)||le(X)},over:function(X){Ue(e,X)||(Dl(e,X),le(X))},start:function(X){return Ll(e,X)},drop:zt(e,Al),leave:function(X){Ue(e,X)||ss(e)}};var K=t.input.getField();Se(K,"keyup",function(X){return ys.call(e,X)}),Se(K,"keydown",zt(e,vs)),Se(K,"keypress",zt(e,bs)),Se(K,"focus",function(X){return wa(e,X)}),Se(K,"blur",function(X){return Pn(e,X)})}var Ga=[];Pt.defineInitHook=function(e){return Ga.push(e)};function wi(e,t,n,r){var i=e.doc,w;n==null&&(n="add"),n=="smart"&&(i.mode.indent?w=We(e,t).state:n="prev");var j=e.options.tabSize,K=ut(i,t),X=H(K.text,null,j);K.stateAfter&&(K.stateAfter=null);var V=K.text.match(/^\s*/)[0],ae;if(!r&&!/\S/.test(K.text))ae=0,n="not";else if(n=="smart"&&(ae=i.mode.indent(w,K.text.slice(V.length),K.text),ae==Ee||ae>150)){if(!r)return;n="prev"}n=="prev"?t>i.first?ae=H(ut(i,t-1).text,null,j):ae=0:n=="add"?ae=X+e.options.indentUnit:n=="subtract"?ae=X-e.options.indentUnit:typeof n=="number"&&(ae=X+n),ae=Math.max(0,ae);var ue="",xe=0;if(e.options.indentWithTabs)for(var be=Math.floor(ae/j);be;--be)xe+=j,ue+=" ";if(xe<ae&&(ue+=ce(ae-xe)),ue!=V)return Bn(i,ue,Fe(t,0),Fe(t,V.length),"+input"),K.stateAfter=null,!0;for(var Pe=0;Pe<i.sel.ranges.length;Pe++){var Ne=i.sel.ranges[Pe];if(Ne.head.line==t&&Ne.head.ch<V.length){var Ge=Fe(t,V.length);Na(i,Pe,new At(Ge,Ge));break}}}var Sr=null;function ra(e){Sr=e}function za(e,t,n,r,i){var w=e.doc;e.display.shift=!1,r||(r=w.sel);var j=+new Date-200,K=i=="paste"||e.state.pasteIncoming>j,X=ot(t),V=null;if(K&&r.ranges.length>1)if(Sr&&Sr.text.join(`
|
|
`)==t){if(r.ranges.length%Sr.text.length==0){V=[];for(var ae=0;ae<Sr.text.length;ae++)V.push(w.splitLines(Sr.text[ae]))}}else X.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(V=ie(X,function(Ye){return[Ye]}));for(var ue=e.curOp.updateInput,xe=r.ranges.length-1;xe>=0;xe--){var be=r.ranges[xe],Pe=be.from(),Ne=be.to();be.empty()&&(n&&n>0?Pe=Fe(Pe.line,Pe.ch-n):e.state.overwrite&&!K?Ne=Fe(Ne.line,Math.min(ut(w,Ne.line).text.length,Ne.ch+$(X).length)):K&&Sr&&Sr.lineWise&&Sr.text.join(`
|
|
`)==X.join(`
|
|
`)&&(Pe=Ne=Fe(Pe.line,0)));var Ge={from:Pe,to:Ne,text:V?V[xe%V.length]:X,origin:i||(K?"paste":e.state.cutIncoming>j?"cut":"+input")};Fn(e.doc,Ge),Ot(e,"inputRead",e,Ge)}t&&!K&&Ls(e,t),Mn(e),e.curOp.updateInput<2&&(e.curOp.updateInput=ue),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function As(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&dr(t,function(){return za(t,n,0,null,"paste")}),!0}function Ls(e,t){if(!e.options.electricChars||!e.options.smartIndent)return;for(var n=e.doc.sel,r=n.ranges.length-1;r>=0;r--){var i=n.ranges[r];if(i.head.ch>100||r&&n.ranges[r-1].head.line==i.head.line)continue;var w=e.getModeAt(i.head),j=!1;if(w.electricChars){for(var K=0;K<w.electricChars.length;K++)if(t.indexOf(w.electricChars.charAt(K))>-1){j=wi(e,i.head.line,"smart");break}}else w.electricInput&&(w.electricInput.test(ut(e.doc,i.head.line).text.slice(0,i.head.ch))&&(j=wi(e,i.head.line,"smart")));j&&Ot(e,"electricInput",e,i.head.line)}}function Ds(e){for(var t=[],n=[],r=0;r<e.doc.sel.ranges.length;r++){var i=e.doc.sel.ranges[r].head.line,w={anchor:Fe(i,0),head:Fe(i+1,0)};n.push(w),t.push(e.getRange(w.anchor,w.head))}return{text:t,ranges:n}}function Os(e,t,n,r){e.setAttribute("autocorrect",n?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function Rs(){var e=o("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=o("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return R?e.style.width="1000px":e.setAttribute("wrap","off"),f&&(e.style.border="1px solid black"),Os(e),t}function ql(e){var t=e.optionHandlers,n=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(r,i){var w=this.options,j=w[r];if(w[r]==i&&r!="mode")return;w[r]=i,t.hasOwnProperty(r)&&zt(this,t[r])(this,i,j),Le(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,w=0;w<i.length;++w)if(i[w]==r||i[w].name==r)return i.splice(w,1),!0},addOverlay:tr(function(r,i){var w=r.token?r:e.getMode(this.options,r);if(w.startState)throw new Error("Overlays may not be stateful.");Z(this.state.overlays,{mode:w,modeSpec:r,opaque:i&&i.opaque,priority:i&&i.priority||0},function(j){return j.priority}),this.state.modeGen++,nr(this)}),removeOverlay:tr(function(r){for(var i=this.state.overlays,w=0;w<i.length;++w){var j=i[w].modeSpec;if(j==r||typeof r=="string"&&j.name==r){i.splice(w,1),this.state.modeGen++,nr(this);return}}}),indentLine:tr(function(r,i,w){typeof i!="string"&&typeof i!="number"&&(i==null?i=this.options.smartIndent?"smart":"prev":i=i?"add":"subtract"),en(this.doc,r)&&wi(this,r,i,w)}),indentSelection:tr(function(r){for(var i=this.doc.sel.ranges,w=-1,j=0;j<i.length;j++){var K=i[j];if(K.empty())K.head.line>w&&(wi(this,K.head.line,r,!0),w=K.head.line,j==this.doc.sel.primIndex&&Mn(this));else{var X=K.from(),V=K.to(),ae=Math.max(w,X.line);w=Math.min(this.lastLine(),V.line-(V.ch?0:1))+1;for(var ue=ae;ue<w;++ue)wi(this,ue,r);var xe=this.doc.sel.ranges;X.ch==0&&i.length==xe.length&&xe[j].from().ch>0&&Na(this.doc,j,new At(X,xe[j].to()),pe)}}}),getTokenAt:function(r,i){return Nr(this,r,i)},getLineTokens:function(r,i){return Nr(this,Fe(r),i,!0)},getTokenTypeAt:function(r){r=gt(this.doc,r);var i=$n(this,ut(this.doc,r.line)),w=0,j=(i.length-1)/2,K=r.ch,X;if(K==0)X=i[2];else for(;;){var V=w+j>>1;if((V?i[V*2-1]:0)>=K)j=V;else if(i[V*2+1]<K)w=V+1;else{X=i[V*2+2];break}}var ae=X?X.indexOf("overlay "):-1;return ae<0?X:ae==0?null:X.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 w=[];if(!n.hasOwnProperty(i))return w;var j=n[i],K=this.getModeAt(r);if(typeof K[i]=="string")j[K[i]]&&w.push(j[K[i]]);else if(K[i])for(var X=0;X<K[i].length;X++){var V=j[K[i][X]];V&&w.push(V)}else K.helperType&&j[K.helperType]?w.push(j[K.helperType]):j[K.name]&&w.push(j[K.name]);for(var ae=0;ae<j._global.length;ae++){var ue=j._global[ae];ue.pred(K,this)&&ee(w,ue.val)==-1&&w.push(ue.val)}return w},getStateAfter:function(r,i){var w=this.doc;return r=Yn(w,r==null?w.first+w.size-1:r),We(this,r+1,i).state},cursorCoords:function(r,i){var w,j=this.doc.sel.primary();return r==null?w=j.head:typeof r=="object"?w=gt(this.doc,r):w=r?j.from():j.to(),xr(this,w,i||"page")},charCoords:function(r,i){return ga(this,gt(this.doc,r),i||"page")},coordsChar:function(r,i){return r=fo(this,r,i||"page"),ya(this,r.left,r.top)},lineAtHeight:function(r,i){return r=fo(this,{top:r,left:0},i||"page").top,Cr(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,i,w){var j=!1,K;if(typeof r=="number"){var X=this.doc.first+this.doc.size-1;r<this.doc.first?r=this.doc.first:r>X&&(r=X,j=!0),K=ut(this.doc,r)}else K=r;return Fi(this,K,{top:0,left:0},i||"page",w||j).top+(j?this.doc.height-ur(K):0)},defaultTextHeight:function(){return _n(this.display)},defaultCharWidth:function(){return kn(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,i,w,j,K){var X=this.display;r=xr(this,gt(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),X.sizer.appendChild(i),j=="over")V=r.top;else if(j=="above"||j=="near"){var ue=Math.max(X.wrapper.clientHeight,this.doc.height),xe=Math.max(X.sizer.clientWidth,X.lineSpace.clientWidth);(j=="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="",K=="right"?(ae=X.sizer.clientWidth-i.offsetWidth,i.style.right="0px"):(K=="left"?ae=0:K=="middle"&&(ae=(X.sizer.clientWidth-i.offsetWidth)/2),i.style.left=ae+"px"),w&&Qs(this,{left:ae,top:V,right:ae+i.offsetWidth,bottom:V+i.offsetHeight})},triggerOnKeyDown:tr(vs),triggerOnKeyPress:tr(bs),triggerOnKeyUp:ys,triggerOnMouseDown:tr(Es),execCommand:function(r){if(Ei.hasOwnProperty(r))return Ei[r].call(null,this)},triggerElectric:tr(function(r){Ls(this,r)}),findPosH:function(r,i,w,j){var K=1;i<0&&(K=-1,i=-i);for(var X=gt(this.doc,r),V=0;V<i&&!(X=Xa(this.doc,X,K,w,j),X.hitSide);++V);return X},moveH:tr(function(r,i){var w=this;this.extendSelectionsBy(function(j){return w.display.shift||w.doc.extend||j.empty()?Xa(w.doc,j.head,r,i,w.options.rtlMoveVisually):r<0?j.from():j.to()},he)}),deleteH:tr(function(r,i){var w=this.doc.sel,j=this.doc;w.somethingSelected()?j.replaceSelection("",null,"+delete"):Hn(this,function(K){var X=Xa(j,K.head,r,i,!1);return r<0?{from:X,to:K.head}:{from:K.head,to:X}})}),findPosV:function(r,i,w,j){var K=1,X=j;i<0&&(K=-1,i=-i);for(var V=gt(this.doc,r),ae=0;ae<i;++ae){var ue=xr(this,V,"div");if(X==null?X=ue.left:ue.left=X,V=_s(this,ue,K,w),V.hitSide)break}return V},moveV:tr(function(r,i){var w=this,j=this.doc,K=[],X=!this.display.shift&&!j.extend&&j.sel.somethingSelected();if(j.extendSelectionsBy(function(ae){if(X)return r<0?ae.from():ae.to();var ue=xr(w,ae.head,"div");ae.goalColumn!=null&&(ue.left=ae.goalColumn),K.push(ue.left);var xe=_s(w,ue,r,i);return i=="page"&&ae==j.sel.primary()&&Aa(w,ga(w,xe,"div").top-ue.top),xe},he),K.length)for(var V=0;V<j.sel.ranges.length;V++)j.sel.ranges[V].goalColumn=K[V]}),findWordAt:function(r){var i=this.doc,w=ut(i,r.line).text,j=r.ch,K=r.ch;if(w){var X=this.getHelper(r,"wordChars");(r.sticky=="before"||K==w.length)&&j?--j:++K;for(var V=w.charAt(j),ae=Ae(V,X)?function(ue){return Ae(ue,X)}:/\s/.test(V)?function(ue){return/\s/.test(ue)}:function(ue){return!/\s/.test(ue)&&!Ae(ue)};j>0&&ae(w.charAt(j-1));)--j;for(;K<w.length&&ae(w.charAt(K));)++K}return new At(Fe(r.line,j),Fe(r.line,K))},toggleOverwrite:function(r){if(r!=null&&r==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?N(this.display.cursorDiv,"CodeMirror-overwrite"):h(this.display.cursorDiv,"CodeMirror-overwrite"),Le(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==_()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:tr(function(r,i){ai(this,r,i)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-Lr(this)-this.display.barHeight,width:r.scrollWidth-Lr(this)-this.display.barWidth,clientHeight:ha(this),clientWidth:un(this)}},scrollIntoView:tr(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):So(this,r.from,r.to,r.margin)}),setSize:tr(function(r,i){var w=this,j=function(X){return typeof X=="number"||/^\d+$/.test(String(X))?X+"px":X};r!=null&&(this.display.wrapper.style.width=j(r)),i!=null&&(this.display.wrapper.style.height=j(i)),this.options.lineWrapping&&lo(this);var K=this.display.viewFrom;this.doc.iter(K,this.display.viewTo,function(X){if(X.widgets){for(var V=0;V<X.widgets.length;V++)if(X.widgets[V].noHScroll){Gr(w,K,"widget");break}}++K}),this.curOp.forceUpdate=!0,Le(this,"refresh",this)}),operation:function(r){return dr(this,r)},startOperation:function(){return pn(this)},endOperation:function(){return gn(this)},refresh:tr(function(){var r=this.display.cachedTextHeight;nr(this),this.curOp.forceUpdate=!0,ni(this),ai(this,this.doc.scrollLeft,this.doc.scrollTop),Oa(this.display),(r==null||Math.abs(r-_n(this.display))>.5||this.options.lineWrapping)&&Ta(this),Le(this,"refresh",this)}),swapDoc:tr(function(r){var i=this.doc;return i.cm=null,this.state.selectingText&&this.state.selectingText(),No(this,r),ni(this),this.display.input.reset(),ai(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,Ot(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}},fe(e),e.registerHelper=function(r,i,w){n.hasOwnProperty(r)||(n[r]=e[r]={_global:[]}),n[r][i]=w},e.registerGlobalHelper=function(r,i,w,j){e.registerHelper(r,i,j),n[r]._global.push({pred:w,val:j})}}function Xa(e,t,n,r,i){var w=t,j=n,K=ut(e,t.line),X=i&&e.direction=="rtl"?-n:n;function V(){var tt=t.line+X;return tt<e.first||tt>=e.first+e.size?!1:(t=new Fe(tt,t.ch,t.sticky),K=ut(e,tt))}function ae(tt){var $e;if(r=="codepoint"){var at=K.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(at)?$e=null:$e=new Fe(t.line,Math.max(0,Math.min(K.text.length,t.ch+n*(at>=55296&&at<56320?2:1))),-n)}else i?$e=Ml(e.cm,K,t,n):$e=Ba(K,t,n);if($e==null)if(!tt&&V())t=ja(i,e.cm,K,t.line,X);else return!1;else t=$e;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",be=e.cm&&e.cm.getHelper(t,"wordChars"),Pe=!0;!(n<0&&!ae(!Pe));Pe=!1){var Ne=K.text.charAt(t.ch)||`
|
|
`,Ge=Ae(Ne,be)?"w":xe&&Ne==`
|
|
`?"n":!xe||/\s/.test(Ne)?null:"p";if(xe&&!Pe&&!Ge&&(Ge="s"),ue&&ue!=Ge){n<0&&(n=1,ae(),t.sticky="after");break}if(Ge&&(ue=Ge),n>0&&!ae(!Pe))break}var Ye=Qi(e,t,w,j,!0);return tn(w,Ye)&&(Ye.hitSide=!0),Ye}function _s(e,t,n,r){var i=e.doc,w=t.left,j;if(r=="page"){var K=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),X=Math.max(K-.5*_n(e.display),3);j=(n>0?t.bottom:t.top)+n*X}else r=="line"&&(j=n>0?t.bottom+3:t.top-3);for(var V;!(V=ya(e,w,j),!V.outside);){if(n<0?j<=0:j>=i.height){V.hitSide=!0;break}j+=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;Os(i,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function w(K){for(var X=K.target;X;X=X.parentNode){if(X==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(X.className))break}return!1}Se(i,"paste",function(K){if(!w(K)||Ue(r,K)||As(K,r))return;M<=11&&setTimeout(zt(r,function(){return t.updateFromDOM()}),20)}),Se(i,"compositionstart",function(K){t.composing={data:K.data,done:!1}}),Se(i,"compositionupdate",function(K){t.composing||(t.composing={data:K.data,done:!1})}),Se(i,"compositionend",function(K){t.composing&&(K.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Se(i,"touchstart",function(){return n.forceCompositionEnd()}),Se(i,"input",function(){t.composing||t.readFromDOMSoon()});function j(K){if(!w(K)||Ue(r,K))return;if(r.somethingSelected())ra({lineWise:!1,text:r.getSelections()}),K.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var X=Ds(r);ra({lineWise:!0,text:X.text}),K.type=="cut"&&r.operation(function(){r.setSelections(X.ranges,0,pe),r.replaceSelection("",null,"cut")})}else return;if(K.clipboardData){K.clipboardData.clearData();var V=Sr.text.join(`
|
|
`);if(K.clipboardData.setData("Text",V),K.clipboardData.getData("Text")==V){K.preventDefault();return}}var ae=Rs(),ue=ae.firstChild;r.display.lineSpace.insertBefore(ae,r.display.lineSpace.firstChild),ue.value=Sr.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",j),Se(i,"cut",j)},Dt.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Dt.prototype.prepareSelection=function(){var e=yo(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 w=na(t,e.anchorNode,e.anchorOffset),j=na(t,e.focusNode,e.focusOffset);if(w&&!w.bad&&j&&!j.bad&&mt(En(w,j),r)==0&&mt(nn(w,j),i)==0)return;var K=t.display.view,X=r.line>=t.display.viewFrom&&ks(t,r)||{node:K[0].measure.map[2],offset:0},V=i.line<t.display.viewTo&&ks(t,i);if(!V){var ae=K[K.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(!X||!V){e.removeAllRanges();return}var xe=e.rangeCount&&e.getRangeAt(0),be;try{be=E(X.node,X.offset,V.offset,V.node)}catch(Pe){}be&&(!D&&t.state.focused?(e.collapse(X.node,X.offset),be.collapsed||(e.removeAllRanges(),e.addRange(be))):(e.removeAllRanges(),e.addRange(be)),xe&&e.anchorNode==null?e.addRange(xe):D&&this.startGracePeriod()),this.rememberSelection()},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 g(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&&m&&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(){Zt(t.doc,Xr(n,r),pe),(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,ut(e.doc,r.line-1).length)),i.ch==ut(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 w,j,K;r.line==t.viewFrom||(w=fn(e,r.line))==0?(j=Ct(t.view[0].line),K=t.view[0].node):(j=Ct(t.view[w].line),K=t.view[w-1].node.nextSibling);var X=fn(e,i.line),V,ae;if(X==t.view.length-1?(V=t.viewTo-1,ae=t.lineDiv.lastChild):(V=Ct(t.view[X+1].line)-1,ae=t.view[X+1].node.previousSibling),!K)return!1;for(var ue=e.doc.splitLines(tu(e,K,ae,j,V)),xe=wr(e.doc,Fe(j,0),Fe(V,ut(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(),j++;else break;for(var be=0,Pe=0,Ne=ue[0],Ge=xe[0],Ye=Math.min(Ne.length,Ge.length);be<Ye&&Ne.charCodeAt(be)==Ge.charCodeAt(be);)++be;for(var tt=$(ue),$e=$(xe),at=Math.min(tt.length-(ue.length==1?be:0),$e.length-(xe.length==1?be:0));Pe<at&&tt.charCodeAt(tt.length-Pe-1)==$e.charCodeAt($e.length-Pe-1);)++Pe;if(ue.length==1&&xe.length==1&&j==r.line)for(;be&&be>r.ch&&tt.charCodeAt(tt.length-Pe-1)==$e.charCodeAt($e.length-Pe-1);)be--,Pe++;ue[ue.length-1]=tt.slice(0,tt.length-Pe).replace(/^\u200b+/,""),ue[0]=ue[0].slice(be).replace(/\u200b+$/,"");var ht=Fe(j,be),dt=Fe(V,xe.length?$(xe).length-Pe:0);if(ue.length>1||ue[0]||mt(ht,dt))return Bn(e.doc,ue,ht,dt,"+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 nr(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()||zt(this.cm,za)(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 ks(e,t){var n=ma(e,t.line);if(!n||n.hidden)return null;var r=ut(e.doc,t.line),i=no(n,r,t.line),w=He(r,e.doc.direction),j="left";if(w){var K=Xe(w,t.ch);j=K%2?"right":"left"}var X=oo(i.map,t.ch,j);return X.offset=X.collapse=="right"?X.end:X.start,X}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function Gn(e,t){return t&&(e.bad=!0),e}function tu(e,t,n,r,i){var w="",j=!1,K=e.doc.lineSeparator(),X=!1;function V(be){return function(Pe){return Pe.id==be}}function ae(){j&&(w+=K,X&&(w+=K),j=X=!1)}function ue(be){be&&(ae(),w+=be)}function xe(be){if(be.nodeType==1){var Pe=be.getAttribute("cm-text");if(Pe){ue(Pe);return}var Ne=be.getAttribute("cm-marker"),Ge;if(Ne){var Ye=e.findMarks(Fe(r,0),Fe(i+1,0),V(+Ne));Ye.length&&(Ge=Ye[0].find(0))&&ue(wr(e.doc,Ge.from,Ge.to).join(K));return}if(be.getAttribute("contenteditable")=="false")return;var tt=/^(pre|div|p|li|table|br)$/i.test(be.nodeName);if(!/^br$/i.test(be.nodeName)&&be.textContent.length==0)return;tt&&ae();for(var $e=0;$e<be.childNodes.length;$e++)xe(be.childNodes[$e]);/^(pre|p)$/i.test(be.nodeName)&&(X=!0),tt&&(j=!0)}else be.nodeType==3&&ue(be.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(xe(t),t==n);)t=t.nextSibling,X=!1;return w}function na(e,t,n){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[n],!r)return Gn(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 w=e.display.view[i];if(w.node==r)return ru(w,t,n)}}function ru(e,t,n){var r=e.text.firstChild,i=!1;if(!t||!g(r,t))return Gn(Fe(Ct(e.line),0),!0);if(t==r&&(i=!0,t=r.childNodes[n],n=0,!t)){var w=e.rest?$(e.rest):e.line;return Gn(Fe(Ct(w),w.text.length),i)}var j=t.nodeType==3?t:null,K=t;for(!j&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(j=t.firstChild,n&&(n=j.nodeValue.length));K.parentNode!=r;)K=K.parentNode;var X=e.measure,V=X.maps;function ae(Ge,Ye,tt){for(var $e=-1;$e<(V?V.length:0);$e++)for(var at=$e<0?X.map:V[$e],ht=0;ht<at.length;ht+=3){var dt=at[ht+2];if(dt==Ge||dt==Ye){var bt=Ct($e<0?e.line:e.rest[$e]),_t=at[ht]+tt;return(tt<0||dt!=Ge)&&(_t=at[ht+(tt?1:0)]),Fe(bt,_t)}}}var ue=ae(j,K,n);if(ue)return Gn(ue,i);for(var xe=K.nextSibling,be=j?j.nodeValue.length-n:0;xe;xe=xe.nextSibling){if(ue=ae(xe,xe.firstChild,0),ue)return Gn(Fe(ue.line,ue.ch-be),i);be+=xe.textContent.length}for(var Pe=K.previousSibling,Ne=n;Pe;Pe=Pe.previousSibling){if(ue=ae(Pe,Pe.firstChild,-1),ue)return Gn(Fe(ue.line,ue.ch+Ne),i);Ne+=Pe.textContent.length}}var jt=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new Y,this.hasSelection=!1,this.composing=null};jt.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),f&&(i.style.width="0px"),Se(i,"input",function(){F&&M>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),Se(i,"paste",function(j){if(Ue(r,j)||As(j,r))return;r.state.pasteIncoming=+new Date,n.fastPoll()});function w(j){if(Ue(r,j))return;if(r.somethingSelected())ra({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var K=Ds(r);ra({lineWise:!0,text:K.text}),j.type=="cut"?r.setSelections(K.ranges,null,pe):(n.prevInput="",i.value=K.text.join(`
|
|
`),W(i))}else return;j.type=="cut"&&(r.state.cutIncoming=+new Date)}Se(i,"cut",w),Se(i,"copy",w),Se(e.scroller,"paste",function(j){if(Mr(e,j)||Ue(r,j))return;if(!i.dispatchEvent){r.state.pasteIncoming=+new Date,n.focus();return}var K=new Event("paste");K.clipboardData=j.clipboardData,i.dispatchEvent(K)}),Se(e.lineSpace,"selectstart",function(j){Mr(e,j)||Q(j)}),Se(i,"compositionstart",function(){var j=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:j,range:r.markText(j,r.getCursor("to"),{className:"CodeMirror-composing"})}}),Se(i,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},jt.prototype.createField=function(e){this.wrapper=Rs(),this.textarea=this.wrapper.firstChild},jt.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},jt.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=yo(e);if(e.options.moveInputWithCursor){var i=xr(e,n.sel.primary().head,"div"),w=t.wrapper.getBoundingClientRect(),j=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+j.top-w.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+j.left-w.left))}return r},jt.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")},jt.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),F&&M>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",F&&M>=9&&(this.hasSelection=null))},jt.prototype.getField=function(){return this.textarea},jt.prototype.supportsTouch=function(){return!1},jt.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!a||_()!=this.textarea))try{this.textarea.focus()}catch(e){}},jt.prototype.blur=function(){this.textarea.blur()},jt.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},jt.prototype.receivedFocus=function(){this.slowPoll()},jt.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()})},jt.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)},jt.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||rt(n)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=n.value;if(i==r&&!t.somethingSelected())return!1;if(F&&M>=9&&this.hasSelection===i||s&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var w=i.charCodeAt(0);if(w==8203&&!r&&(r="\u200B"),w==8666)return this.reset(),this.cm.execCommand("undo")}for(var j=0,K=Math.min(r.length,i.length);j<K&&r.charCodeAt(j)==i.charCodeAt(j);)++j;return dr(t,function(){za(t,i.slice(j),r.length-j,null,e.composing?"*compose":null),i.length>1e3||i.indexOf(`
|
|
`)>-1?n.value=e.prevInput="":e.prevInput=i,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},jt.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},jt.prototype.onKeyPress=function(){F&&M>=9&&(this.hasSelection=null),this.fastPoll()},jt.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var w=cn(n,e),j=r.scroller.scrollTop;if(!w||v)return;var K=n.options.resetSelectionOnContextMenu;K&&n.doc.sel.contains(w)==-1&&zt(n,Zt)(n.doc,Xr(w),pe);var X=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: `+(F?"rgba(255, 255, 255, .05)":"transparent")+`;
|
|
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var ue;R&&(ue=window.scrollY),r.input.focus(),R&&window.scrollTo(null,ue),r.input.reset(),n.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=be,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll);function xe(){if(i.selectionStart!=null){var Ne=n.somethingSelected(),Ge="\u200B"+(Ne?i.value:"");i.value="\u21DA",i.value=Ge,t.prevInput=Ne?"":"\u200B",i.selectionStart=1,i.selectionEnd=Ge.length,r.selForContextMenu=n.doc.sel}}function be(){if(t.contextMenuPending!=be)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=V,i.style.cssText=X,F&&M<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=j),i.selectionStart!=null){(!F||F&&M<9)&&xe();var Ne=0,Ge=function(){r.selForContextMenu==n.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&t.prevInput=="\u200B"?zt(n,Qo)(n):Ne++<10?r.detectingSelectAll=setTimeout(Ge,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(Ge,200)}}if(F&&M>=9&&xe(),L){le(e);var Pe=function(){Je(window,"mouseup",Pe),setTimeout(be,20)};Se(window,"mouseup",Pe)}else setTimeout(be,50)},jt.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},jt.prototype.setUneditable=function(){},jt.prototype.needsContentAttribute=!1;function nu(e,t){if(t=t?I(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),t.autofocus==null){var n=_();t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function r(){e.value=K.getValue()}var i;if(e.form&&(Se(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var w=e.form;i=w.submit;try{var j=w.submit=function(){r(),w.submit=i,w.submit(),w.submit=j}}catch(X){}}t.finishInit=function(X){X.save=r,X.getTextArea=function(){return e},X.toTextArea=function(){X.toTextArea=isNaN,r(),e.parentNode.removeChild(X.getWrapperElement()),e.style.display="",e.form&&(Je(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=i))}},e.style.display="none";var K=Pt(function(X){return e.parentNode.insertBefore(X,e.nextSibling)},t);return K}function iu(e){e.off=Je,e.on=Se,e.wheelEventPixels=cl,e.Doc=ir,e.splitLines=ot,e.countColumn=H,e.findColumn=se,e.isWordChar=we,e.Pass=Ee,e.signal=Le,e.Line=Kr,e.changeEnd=Vr,e.scrollbarModel=Ao,e.Pos=Fe,e.cmpPos=mt,e.modes=yt,e.mimeModes=Ke,e.resolveMode=Bt,e.getMode=kt,e.modeExtensions=fr,e.extendMode=Zr,e.copyState=hr,e.startState=qr,e.innerMode=vr,e.commands=Ei,e.keyMap=Ir,e.keyName=fs,e.isModifierKey=ds,e.lookupKey=Wn,e.normalizeKeyMap=Pl,e.StringStream=It,e.SharedTextMarker=vi,e.TextMarker=$r,e.LineWidget=gi,e.e_preventDefault=Q,e.e_stopPropagation=J,e.e_stop=le,e.addClass=N,e.contains=g,e.rmClass=h,e.keyNames=Qr}$l(Pt),ql(Pt);var au="iter insert remove copy getEditor constructor".split(" ");for(var ia in ir.prototype)ir.prototype.hasOwnProperty(ia)&&ee(au,ia)<0&&(Pt.prototype[ia]=function(e){return function(){return e.apply(this.doc,arguments)}}(ir.prototype[ia]));return fe(ir),Pt.inputStyles={textarea:jt,contenteditable:Dt},Pt.defineMode=function(e){!Pt.defaults.mode&&e!="null"&&(Pt.defaults.mode=e),Qt.apply(this,arguments)},Pt.defineMIME=Mt,Pt.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Pt.defineMIME("text/plain","null"),Pt.defineExtension=function(e,t){Pt.prototype[e]=t},Pt.defineDocExtension=function(e,t){ir.prototype[e]=t},Pt.fromTextArea=nu,iu(Pt),Pt.version="5.58.2",Pt})},Y1PL:function(nt,Qe,te){"use strict";te.r(Qe),te.d(Qe,"ResizableTextArea",function(){return ee});var q=te("wx14"),G=te("1OyB"),D=te("vuIU"),z=te("Ji7U"),U=te("LK+K"),O=te("cDcd"),F=te("VTBJ"),M=te("rePB"),R=te("Zm9Q"),C=te("Kwbf"),m=te("c+Xe"),v=te("m+aA"),k=te("bdgK"),S=new Map;function b(pe){pe.forEach(function(me){var he,se=me.target;(he=S.get(se))===null||he===void 0||he.forEach(function(ne){return ne(se)})})}var f=new k.default(b),u=null,a=null;function s(pe,me){S.has(pe)||(S.set(pe,new Set),f.observe(pe)),S.get(pe).add(me)}function l(pe,me){S.has(pe)&&(S.get(pe).delete(me),S.get(pe).size||(f.unobserve(pe),S.delete(pe)))}var A=function(pe){Object(z.a)(he,pe);var me=Object(U.a)(he);function he(){return Object(G.a)(this,he),me.apply(this,arguments)}return Object(D.a)(he,[{key:"render",value:function(){return this.props.children}}]),he}(O.Component),y=O.createContext(null);function c(pe){var me=pe.children,he=pe.onBatchResize,se=O.useRef(0),ne=O.useRef([]),ce=O.useContext(y),$=O.useCallback(function(ie,Z,ye){se.current+=1;var Ce=se.current;ne.current.push({size:ie,element:Z,data:ye}),Promise.resolve().then(function(){Ce===se.current&&(he==null||he(ne.current),ne.current=[])}),ce==null||ce(ie,Z,ye)},[he,ce]);return O.createElement(y.Provider,{value:$},me)}function L(pe){var me=pe.children,he=pe.disabled,se=O.useRef(null),ne=O.useRef(null),ce=O.useContext(y),$=O.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),ie=O.isValidElement(me)&&Object(m.c)(me),Z=ie?me.ref:null,ye=O.useMemo(function(){return Object(m.a)(Z,se)},[Z,se]),Ce=O.useRef(pe);Ce.current=pe;var ve=O.useCallback(function(we){var Ae=Ce.current,Re=Ae.onResize,Ie=Ae.data,Me=we.getBoundingClientRect(),De=Me.width,Ve=Me.height,et=we.offsetWidth,ze=we.offsetHeight,Xe=Math.floor(De),qe=Math.floor(Ve);if($.current.width!==Xe||$.current.height!==qe||$.current.offsetWidth!==et||$.current.offsetHeight!==ze){var He={width:Xe,height:qe,offsetWidth:et,offsetHeight:ze};$.current=He;var Be=et===Math.round(De)?De:et,Se=ze===Math.round(Ve)?Ve:ze,Ze=Object(F.a)(Object(F.a)({},He),{},{offsetWidth:Be,offsetHeight:Se});ce==null||ce(Ze,we,Ie),Re&&Promise.resolve().then(function(){Re(Ze,we)})}},[]);return O.useEffect(function(){var we=Object(v.a)(se.current)||Object(v.a)(ne.current);return we&&!he&&s(we,ve),function(){return l(we,ve)}},[se.current,he]),O.createElement(A,{ref:ne},ie?O.cloneElement(me,{ref:ye}):me)}var x="rc-observer-key";function h(pe){var me=pe.children,he=Object(R.a)(me);return he.map(function(se,ne){var ce=(se==null?void 0:se.key)||"".concat(x,"-").concat(ne);return O.createElement(L,Object(q.a)({},pe,{key:ce}),se)})}h.Collection=c;var p=h,d=te("bT9E"),o=te("TSYQ"),T=te.n(o),E=`
|
|
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
|
|
`,g=["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"],_={},N;function B(pe){var me=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,he=pe.getAttribute("id")||pe.getAttribute("data-reactid")||pe.getAttribute("name");if(me&&_[he])return _[he];var se=window.getComputedStyle(pe),ne=se.getPropertyValue("box-sizing")||se.getPropertyValue("-moz-box-sizing")||se.getPropertyValue("-webkit-box-sizing"),ce=parseFloat(se.getPropertyValue("padding-bottom"))+parseFloat(se.getPropertyValue("padding-top")),$=parseFloat(se.getPropertyValue("border-bottom-width"))+parseFloat(se.getPropertyValue("border-top-width")),ie=g.map(function(ye){return"".concat(ye,":").concat(se.getPropertyValue(ye))}).join(";"),Z={sizingStyle:ie,paddingSize:ce,borderSize:$,boxSizing:ne};return me&&he&&(_[he]=Z),Z}function W(pe){var me=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,he=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,se=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;N||(N=document.createElement("textarea"),N.setAttribute("tab-index","-1"),N.setAttribute("aria-hidden","true"),document.body.appendChild(N)),pe.getAttribute("wrap")?N.setAttribute("wrap",pe.getAttribute("wrap")):N.removeAttribute("wrap");var ne=B(pe,me),ce=ne.paddingSize,$=ne.borderSize,ie=ne.boxSizing,Z=ne.sizingStyle;N.setAttribute("style","".concat(Z,";").concat(E)),N.value=pe.value||pe.placeholder||"";var ye=Number.MIN_SAFE_INTEGER,Ce=Number.MAX_SAFE_INTEGER,ve=N.scrollHeight,we;if(ie==="border-box"?ve+=$:ie==="content-box"&&(ve-=ce),he!==null||se!==null){N.value=" ";var Ae=N.scrollHeight-ce;he!==null&&(ye=Ae*he,ie==="border-box"&&(ye=ye+ce+$),ve=Math.max(ye,ve)),se!==null&&(Ce=Ae*se,ie==="border-box"&&(Ce=Ce+ce+$),we=ve>Ce?"":"hidden",ve=Math.min(Ce,ve))}return{height:ve,minHeight:ye,maxHeight:Ce,overflowY:we,resize:"none"}}var P=te("Gytx"),I=te.n(P),H;(function(pe){pe[pe.NONE=0]="NONE",pe[pe.RESIZING=1]="RESIZING",pe[pe.RESIZED=2]="RESIZED"})(H||(H={}));var Y=function(pe){Object(z.a)(he,pe);var me=Object(U.a)(he);function he(se){var ne;return Object(G.a)(this,he),ne=me.call(this,se),ne.nextFrameActionId=void 0,ne.resizeFrameId=void 0,ne.textArea=void 0,ne.saveTextArea=function(ce){ne.textArea=ce},ne.handleResize=function(ce){var $=ne.state.resizeStatus,ie=ne.props,Z=ie.autoSize,ye=ie.onResize;if($!==H.NONE)return;typeof ye=="function"&&ye(ce),Z&&ne.resizeOnNextFrame()},ne.resizeOnNextFrame=function(){cancelAnimationFrame(ne.nextFrameActionId),ne.nextFrameActionId=requestAnimationFrame(ne.resizeTextarea)},ne.resizeTextarea=function(){var ce=ne.props.autoSize;if(!ce||!ne.textArea)return;var $=ce.minRows,ie=ce.maxRows,Z=W(ne.textArea,!1,$,ie);ne.setState({textareaStyles:Z,resizeStatus:H.RESIZING},function(){cancelAnimationFrame(ne.resizeFrameId),ne.resizeFrameId=requestAnimationFrame(function(){ne.setState({resizeStatus:H.RESIZED},function(){ne.resizeFrameId=requestAnimationFrame(function(){ne.setState({resizeStatus:H.NONE}),ne.fixFirefoxAutoScroll()})})})})},ne.renderTextArea=function(){var ce=ne.props,$=ce.prefixCls,ie=$===void 0?"rc-textarea":$,Z=ce.autoSize,ye=ce.onResize,Ce=ce.className,ve=ce.disabled,we=ne.state,Ae=we.textareaStyles,Re=we.resizeStatus,Ie=Object(d.a)(ne.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Me=T()(ie,Ce,Object(M.a)({},"".concat(ie,"-disabled"),ve));"value"in Ie&&(Ie.value=Ie.value||"");var De=Object(F.a)(Object(F.a)(Object(F.a)({},ne.props.style),Ae),Re===H.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return O.createElement(p,{onResize:ne.handleResize,disabled:!(Z||ye)},O.createElement("textarea",Object(q.a)({},Ie,{className:Me,style:De,ref:ne.saveTextArea})))},ne.state={textareaStyles:{},resizeStatus:H.NONE},ne}return Object(D.a)(he,[{key:"componentDidUpdate",value:function(ne){(ne.value!==this.props.value||!I()(ne.autoSize,this.props.autoSize))&&this.resizeTextarea()}},{key:"componentWillUnmount",value:function(){cancelAnimationFrame(this.nextFrameActionId),cancelAnimationFrame(this.resizeFrameId)}},{key:"fixFirefoxAutoScroll",value:function(){try{if(document.activeElement===this.textArea){var ne=this.textArea.selectionStart,ce=this.textArea.selectionEnd;this.textArea.setSelectionRange(ne,ce)}}catch($){}}},{key:"render",value:function(){return this.renderTextArea()}}]),he}(O.Component),ee=Y,oe=function(pe){Object(z.a)(he,pe);var me=Object(U.a)(he);function he(se){var ne;Object(G.a)(this,he),ne=me.call(this,se),ne.resizableTextArea=void 0,ne.focus=function(){ne.resizableTextArea.textArea.focus()},ne.saveTextArea=function($){ne.resizableTextArea=$},ne.handleChange=function($){var ie=ne.props.onChange;ne.setValue($.target.value,function(){ne.resizableTextArea.resizeTextarea()}),ie&&ie($)},ne.handleKeyDown=function($){var ie=ne.props,Z=ie.onPressEnter,ye=ie.onKeyDown;$.keyCode===13&&Z&&Z($),ye&&ye($)};var ce=typeof se.value=="undefined"||se.value===null?se.defaultValue:se.value;return ne.state={value:ce},ne}return Object(D.a)(he,[{key:"setValue",value:function(ne,ce){"value"in this.props||this.setState({value:ne},ce)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return O.createElement(ee,Object(q.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(ne){return"value"in ne?{value:ne.value}:null}}]),he}(O.Component),Ee=Qe.default=oe},ZW9T:function(nt,Qe,te){"use strict";te.d(Qe,"a",function(){return y});var q=te("k1fw"),G=te("miYZ"),D=te("tsqr"),z=te("rAM+"),U=te("tJVT"),O=te("PpiC"),F=te("cDcd"),M=te.n(F),R=te("bdgK");function C(c,L,x,h,p){var d=L.getWordUntilPosition(x),o={startLineNumber:x.lineNumber,endLineNumber:x.lineNumber,startColumn:d.startColumn,endColumn:d.endColumn},T=h.map(function(E){return{label:E,kind:c.languages.CompletionItemKind.Keyword,insertText:E,insertTextRules:c.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:o}});return p.map(function(E){T.push(Object(q.a)(Object(q.a)({},E),{},{range:o}))}),T}var m=function(c){var L={label:"ifelse",kind:c.languages.CompletionItemKind.Method,insertText:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
|
|
`),insertTextRules:c.languages.CompletionItemInsertTextRule.InsertAsSnippet},x=["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(o,T){var E=C(c,o,T,x,[L]);return{suggestions:E}}});var h=["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(o,T){var E=[{label:"print",kind:c.languages.CompletionItemKind.Snippet,insertText:["print($0)"].join(`
|
|
`),insertTextRules:c.languages.CompletionItemInsertTextRule.InsertAsSnippet}],g=C(c,o,T,h,E);return{suggestions:g}}});var p=["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(o,T){var E=[L,{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}],g=C(c,o,T,p,E);return{suggestions:g}}})},v="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",k=te("LvDl"),S=te("+ua5");function b(c){return/^\d+$/.test(c)?"".concat(c,"px"):c}function f(){}var u=!1,a={"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 s(){var c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],L=c;if(Array.isArray(c)){for(var x=0;x<c.length;x++){var h=a[c[x]];if(h)return h}return L[0]}return a[L]||L}var l=null,A=Qe.b=function(c){var L=c.width,x=L===void 0?"100%":L,h=c.height,p=h===void 0?"100%":h,d=c.value,o=c.language,T=o===void 0?"javascript":o,E=c.style,g=E===void 0?{}:E,_=c.options,N=_===void 0?{}:_,B=c.overrideServices,W=B===void 0?{}:B,P=c.theme,I=P===void 0?"vs-dark":P,H=c.onEditBlur,Y=c.onSave,ee=c.autoHeight,oe=ee===void 0?!1:ee,Ee=c.forbidCopy,pe=Ee===void 0?!1:Ee,me=c.onChange,he=me===void 0?f:me,se=c.editorDidMount,ne=se===void 0?f:se,ce=c.onFocus,$=ce===void 0?f:ce,ie=c.filename,Z=ie===void 0?"educoder.txt":ie,ye=c.errorLine,Ce=c.errorContent,ve=Ce===void 0?"":Ce,we=Object(O.a)(c,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename","errorLine","errorContent"]),Ae=Object(F.useRef)(),Re=Object(F.useRef)({}),Ie=Object(F.useRef)(),Me=Object(F.useRef)(!1),De=Object(F.useRef)(),Ve=Object(F.useState)(!1),et=Object(U.a)(Ve,2),ze=et[0],Xe=et[1];function qe(){var ke;return Ae.current&&(ke=new R.default(function(je){var it=Object(z.a)(je),Oe;try{for(it.s();!(Oe=it.n()).done;){var ft=Oe.value;(ft.target.offsetHeight>0||ft.target.offsetWidth>0)&&Re.current.instance.layout()}}catch(ot){it.e(ot)}finally{it.f()}}),ke.observe(Ae.current)),ke}function He(){D.b.warn(decodeURIComponent(v))}var Be=function(){var je=Re.current.instance;if(d!=null&&je&&ze){var it=je.getModel();it&&d!==it.getValue()&&(u=!0,it.setValue(d),je.layout(),u=!1)}};Object(F.useEffect)(function(){Ie.current&&clearTimeout(Ie.current),Ie.current=setTimeout(function(){Be()},500)},[d,ze,Re.current]),Object(F.useEffect)(function(){if(ye&&Re.current&&Re.current.instance){var ke=Re.current.instance;ke.changeViewZones(function(it){var Oe=document.createElement("div");Oe.style.padding="10px 20px",Oe.style.width="calc(100% - 20px)",Oe.className="my-error-line-wrp",Oe.innerHTML=ve,it.addZone({afterLineNumber:ye||11,heightInLines:3,domNode:Oe})});var je={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}};ke.addOverlayWidget(je),ke.revealPositionInCenter({lineNumber:20,column:1})}},[ye,Re.current,ze]);function Se(){var ke=Re.current.instance;if(ke){var je=ke.getSelection(),it=Re.current.pastePos||{},Oe=new l.Range(it.startLineNumber||je.endLineNumber,it.startColumn||je.endColumn,it.endLineNumber||je.endLineNumber,it.endColumn||je.endColumn);setTimeout(function(){ke.executeEdits("",[{range:Oe,text:""}])},300)}}function Ze(ke){(window.navigator.platform.match("Mac")?ke.metaKey:ke.ctrlKey)&&ke.keyCode==83&&(ke.preventDefault(),Y())}var Je=function(){if(oe&&Re.current.instance){var je=Re.current.instance.getContentHeight();Te(je<p?p:je)}else Te(p)};function Le(ke){var je=document.createEvent("MouseEvents");je.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),ke.dispatchEvent(je)}function Ue(ke,je){var it=window.URL||window.webkitURL||window,Oe=new Blob([je]),ft=document.createElementNS("http://www.w3.org/1999/xhtml","a");ft.href=it.createObjectURL(Oe),ft.download=ke,Le(ft)}Object(F.useEffect)(function(){Je()},[Je]),Object(F.useEffect)(function(){Ae.current&&!ze&&te.e(27).then(te.t.bind(null,"M/lh",7)).then(function(ke){try{l=ke,Re.current.instance=l.editor.create(Ae.current,{value:d,language:s(T),theme:I,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0},W);var je=Re.current.instance;if(ne(je,l),setTimeout(function(){Je(),Re.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){Ue(Z||"educoder.txt",je.getValue())}})},500),Re.current.subscription=je.onDidChangeModelContent(function(Oe){Me.current?clearTimeout(De.current):(Je(),he(je.getValue(),Oe)),De.current=setTimeout(function(){Me.current=!1},500)}),window.Monaco||m(l),pe&&(je.addCommand(l.KeyMod.CtrlCmd|l.KeyMod.Shift|l.KeyCode.KEY_V,function(){return He(),null}),je.addCommand(l.KeyMod.CtrlCmd|l.KeyCode.KEY_C,function(){return He(),null})),window.Monaco=l,H&&je.onDidBlurEditorWidget(function(){H(je.getValue())}),$&&je.onDidFocusEditorText(function(){$(je.getValue())}),pe){je.addCommand(l.KeyMod.CtrlCmd|l.KeyCode.KEY_V,function(){return He(),null}),je.onDidPaste(function(Oe){Re.current.pastePos=Oe});try{window.addEventListener("paste",Se)}catch(Oe){}}var it=qe();return Xe(!0),function(){var Oe=Re.current.instance;Oe.dispose();var ft=Oe.getModel();ft&&ft.dispose(),Re.current.subscription&&Re.current.subscription.dispose(),pe&&window.removeEventListener("paste",Se),it.unobserve(Ae.current)}}catch(Oe){}})},[]),Object(F.useEffect)(function(){var ke=Re.current.instance;if(ke&&ze)return document.addEventListener("keydown",Ze,!1),function(){document.removeEventListener("keydown",Ze)}},[Y,ze]),Object(F.useEffect)(function(){var ke=Re.current.instance;if(ke&&ze){var je=s(T);l.editor.setModelLanguage(ke.getModel(),je),console.log("language:",T,ke.getModel(),je)}},[T,ze]),Object(F.useEffect)(function(){var ke=Re.current.instance;ke&&ze&&l.editor.setTheme(I)},[I,ze]),Object(F.useEffect)(function(){var ke=Re.current.instance;ke&&ze&&(ke.updateOptions(Object(q.a)({},N)),setTimeout(function(){ke.getModel().updateOptions(Object(q.a)({},N))},200))},[JSON.stringify(N),ze]),Object(F.useEffect)(function(){var ke=Re.current.instance;ke&&ze&&ke.layout()},[x,p,ze]);var ge=Object(F.useState)(b(x)),de=Object(U.a)(ge,2),fe=de[0],Q=de[1],J=Object(F.useState)(b(p)),re=Object(U.a)(J,2),le=re[0],Te=re[1],_e=Object(q.a)(Object(q.a)({},g),{},{width:fe,height:le});return M.a.createElement("div",{className:"my-monaco-editor",ref:Ae,style:_e})};function y(c){var L=c.width,x=L===void 0?"100%":L,h=c.height,p=h===void 0?"100%":h,d=c.original,o=c.modified,T=c.language,E=c.options,g=E===void 0?{}:E,_=Object(F.useRef)(),N=Object(F.useState)(null),B=Object(U.a)(N,2),W=B[0],P=B[1];function I(oe){var Ee;return _.current&&(Ee=new R.default(function(pe){var me=Object(z.a)(pe),he;try{for(me.s();!(he=me.n()).done;){var se=he.value;(se.target.offsetHeight>0||se.target.offsetWidth>0)&&oe.layout()}}catch(ne){me.e(ne)}finally{me.f()}}),Ee.observe(_.current)),Ee}Object(F.useEffect)(function(){_.current&&te.e(27).then(te.t.bind(null,"M/lh",7)).then(function(oe){l=oe;var Ee=l.editor.createDiffEditor(_.current,Object(q.a)(Object(q.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},g),{},{wordWrap:!0}));P(Ee);var pe=I(Ee);return function(){Ee.dispose();var me=Ee.getModel();me&&me.dispose(),pe.unobserve(_.current)}})},[]),Object(F.useEffect)(function(){W&&W.setModel({original:l.editor.createModel(d,T),modified:l.editor.createModel(o,T)})},[d,o,T,W]);var H=b(x),Y=b(p),ee={width:H,height:Y};return M.a.createElement("div",{className:"my-diff-editor",ref:_,style:ee})}},ZpRC:function(nt,Qe,te){"use strict";function q(m){return typeof m=="object"&&m!=null&&m.nodeType===1}function G(m,v){return(!v||m!=="hidden")&&m!=="visible"&&m!=="clip"}function D(m,v){if(m.clientHeight<m.scrollHeight||m.clientWidth<m.scrollWidth){var k=getComputedStyle(m,null);return G(k.overflowY,v)||G(k.overflowX,v)||function(S){var b=function(f){if(!f.ownerDocument||!f.ownerDocument.defaultView)return null;try{return f.ownerDocument.defaultView.frameElement}catch(u){return null}}(S);return!!b&&(b.clientHeight<S.scrollHeight||b.clientWidth<S.scrollWidth)}(m)}return!1}function z(m,v,k,S,b,f,u,a){return f<m&&u>v||f>m&&u<v?0:f<=m&&a<=k||u>=v&&a>=k?f-m-S:u>v&&a<k||f<m&&a>k?u-v+b:0}var U=function(m,v){var k=window,S=v.scrollMode,b=v.block,f=v.inline,u=v.boundary,a=v.skipOverflowHiddenElements,s=typeof u=="function"?u:function(Ae){return Ae!==u};if(!q(m))throw new TypeError("Invalid target");for(var l=document.scrollingElement||document.documentElement,A=[],y=m;q(y)&&s(y);){if((y=y.parentElement)===l){A.push(y);break}y!=null&&y===document.body&&D(y)&&!D(document.documentElement)||y!=null&&D(y,a)&&A.push(y)}for(var c=k.visualViewport?k.visualViewport.width:innerWidth,L=k.visualViewport?k.visualViewport.height:innerHeight,x=window.scrollX||pageXOffset,h=window.scrollY||pageYOffset,p=m.getBoundingClientRect(),d=p.height,o=p.width,T=p.top,E=p.right,g=p.bottom,_=p.left,N=b==="start"||b==="nearest"?T:b==="end"?g:T+d/2,B=f==="center"?_+o/2:f==="end"?E:_,W=[],P=0;P<A.length;P++){var I=A[P],H=I.getBoundingClientRect(),Y=H.height,ee=H.width,oe=H.top,Ee=H.right,pe=H.bottom,me=H.left;if(S==="if-needed"&&T>=0&&_>=0&&g<=L&&E<=c&&T>=oe&&g<=pe&&_>=me&&E<=Ee)return W;var he=getComputedStyle(I),se=parseInt(he.borderLeftWidth,10),ne=parseInt(he.borderTopWidth,10),ce=parseInt(he.borderRightWidth,10),$=parseInt(he.borderBottomWidth,10),ie=0,Z=0,ye="offsetWidth"in I?I.offsetWidth-I.clientWidth-se-ce:0,Ce="offsetHeight"in I?I.offsetHeight-I.clientHeight-ne-$:0;if(l===I)ie=b==="start"?N:b==="end"?N-L:b==="nearest"?z(h,h+L,L,ne,$,h+N,h+N+d,d):N-L/2,Z=f==="start"?B:f==="center"?B-c/2:f==="end"?B-c:z(x,x+c,c,se,ce,x+B,x+B+o,o),ie=Math.max(0,ie+h),Z=Math.max(0,Z+x);else{ie=b==="start"?N-oe-ne:b==="end"?N-pe+$+Ce:b==="nearest"?z(oe,pe,Y,ne,$+Ce,N,N+d,d):N-(oe+Y/2)+Ce/2,Z=f==="start"?B-me-se:f==="center"?B-(me+ee/2)+ye/2:f==="end"?B-Ee+ce+ye:z(me,Ee,ee,se,ce+ye,B,B+o,o);var ve=I.scrollLeft,we=I.scrollTop;N+=we-(ie=Math.max(0,Math.min(we+ie,I.scrollHeight-Y+Ce))),B+=ve-(Z=Math.max(0,Math.min(ve+Z,I.scrollWidth-ee+ye)))}W.push({el:I,top:ie,left:Z})}return W};function O(m){return m===Object(m)&&Object.keys(m).length!==0}function F(m,v){v===void 0&&(v="auto");var k="scrollBehavior"in document.body.style;m.forEach(function(S){var b=S.el,f=S.top,u=S.left;b.scroll&&k?b.scroll({top:f,left:u,behavior:v}):(b.scrollTop=f,b.scrollLeft=u)})}function M(m){return m===!1?{block:"end",inline:"nearest"}:O(m)?m:{block:"start",inline:"nearest"}}function R(m,v){var k=!m.ownerDocument.documentElement.contains(m);if(O(v)&&typeof v.behavior=="function")return v.behavior(k?[]:U(m,v));if(k)return;var S=M(v);return F(U(m,S),S.behavior)}var C=Qe.a=R},Zss7:function(nt,Qe,te){var q;(function(G){var D=/^\s+/,z=/\s+$/,U=0,O=G.round,F=G.min,M=G.max,R=G.random;function C($,ie){if($=$||"",ie=ie||{},$ instanceof C)return $;if(!(this instanceof C))return new C($,ie);var Z=m($);this._originalInput=$,this._r=Z.r,this._g=Z.g,this._b=Z.b,this._a=Z.a,this._roundA=O(100*this._a)/100,this._format=ie.format||Z.format,this._gradientType=ie.gradientType,this._r<1&&(this._r=O(this._r)),this._g<1&&(this._g=O(this._g)),this._b<1&&(this._b=O(this._b)),this._ok=Z.ok,this._tc_id=U++}C.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var $=this.toRgb();return($.r*299+$.g*587+$.b*114)/1e3},getLuminance:function(){var $=this.toRgb(),ie,Z,ye,Ce,ve,we;return ie=$.r/255,Z=$.g/255,ye=$.b/255,ie<=.03928?Ce=ie/12.92:Ce=G.pow((ie+.055)/1.055,2.4),Z<=.03928?ve=Z/12.92:ve=G.pow((Z+.055)/1.055,2.4),ye<=.03928?we=ye/12.92:we=G.pow((ye+.055)/1.055,2.4),.2126*Ce+.7152*ve+.0722*we},setAlpha:function($){return this._a=W($),this._roundA=O(100*this._a)/100,this},toHsv:function(){var $=b(this._r,this._g,this._b);return{h:$.h*360,s:$.s,v:$.v,a:this._a}},toHsvString:function(){var $=b(this._r,this._g,this._b),ie=O($.h*360),Z=O($.s*100),ye=O($.v*100);return this._a==1?"hsv("+ie+", "+Z+"%, "+ye+"%)":"hsva("+ie+", "+Z+"%, "+ye+"%, "+this._roundA+")"},toHsl:function(){var $=k(this._r,this._g,this._b);return{h:$.h*360,s:$.s,l:$.l,a:this._a}},toHslString:function(){var $=k(this._r,this._g,this._b),ie=O($.h*360),Z=O($.s*100),ye=O($.l*100);return this._a==1?"hsl("+ie+", "+Z+"%, "+ye+"%)":"hsla("+ie+", "+Z+"%, "+ye+"%, "+this._roundA+")"},toHex:function($){return u(this._r,this._g,this._b,$)},toHexString:function($){return"#"+this.toHex($)},toHex8:function($){return a(this._r,this._g,this._b,this._a,$)},toHex8String:function($){return"#"+this.toHex8($)},toRgb:function(){return{r:O(this._r),g:O(this._g),b:O(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+O(this._r)+", "+O(this._g)+", "+O(this._b)+")":"rgba("+O(this._r)+", "+O(this._g)+", "+O(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:O(P(this._r,255)*100)+"%",g:O(P(this._g,255)*100)+"%",b:O(P(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+O(P(this._r,255)*100)+"%, "+O(P(this._g,255)*100)+"%, "+O(P(this._b,255)*100)+"%)":"rgba("+O(P(this._r,255)*100)+"%, "+O(P(this._g,255)*100)+"%, "+O(P(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:N[u(this._r,this._g,this._b,!0)]||!1},toFilter:function($){var ie="#"+s(this._r,this._g,this._b,this._a),Z=ie,ye=this._gradientType?"GradientType = 1, ":"";if($){var Ce=C($);Z="#"+s(Ce._r,Ce._g,Ce._b,Ce._a)}return"progid:DXImageTransform.Microsoft.gradient("+ye+"startColorstr="+ie+",endColorstr="+Z+")"},toString:function($){var ie=!!$;$=$||this._format;var Z=!1,ye=this._a<1&&this._a>=0,Ce=!ie&&ye&&($==="hex"||$==="hex6"||$==="hex3"||$==="hex4"||$==="hex8"||$==="name");return Ce?$==="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 C(this.toString())},_applyModification:function($,ie){var Z=$.apply(null,[this].concat([].slice.call(ie)));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(L,arguments)},darken:function(){return this._applyModification(x,arguments)},desaturate:function(){return this._applyModification(l,arguments)},saturate:function(){return this._applyModification(A,arguments)},greyscale:function(){return this._applyModification(y,arguments)},spin:function(){return this._applyModification(h,arguments)},_applyCombination:function($,ie){return $.apply(null,[this].concat([].slice.call(ie)))},analogous:function(){return this._applyCombination(E,arguments)},complement:function(){return this._applyCombination(p,arguments)},monochromatic:function(){return this._applyCombination(g,arguments)},splitcomplement:function(){return this._applyCombination(T,arguments)},triad:function(){return this._applyCombination(d,arguments)},tetrad:function(){return this._applyCombination(o,arguments)}},C.fromRatio=function($,ie){if(typeof $=="object"){var Z={};for(var ye in $)$.hasOwnProperty(ye)&&(ye==="a"?Z[ye]=$[ye]:Z[ye]=Ee($[ye]));$=Z}return C($,ie)};function m($){var ie={r:0,g:0,b:0},Z=1,ye=null,Ce=null,ve=null,we=!1,Ae=!1;return typeof $=="string"&&($=ne($)),typeof $=="object"&&(se($.r)&&se($.g)&&se($.b)?(ie=v($.r,$.g,$.b),we=!0,Ae=String($.r).substr(-1)==="%"?"prgb":"rgb"):se($.h)&&se($.s)&&se($.v)?(ye=Ee($.s),Ce=Ee($.v),ie=f($.h,ye,Ce),we=!0,Ae="hsv"):se($.h)&&se($.s)&&se($.l)&&(ye=Ee($.s),ve=Ee($.l),ie=S($.h,ye,ve),we=!0,Ae="hsl"),$.hasOwnProperty("a")&&(Z=$.a)),Z=W(Z),{ok:we,format:$.format||Ae,r:F(255,M(ie.r,0)),g:F(255,M(ie.g,0)),b:F(255,M(ie.b,0)),a:Z}}function v($,ie,Z){return{r:P($,255)*255,g:P(ie,255)*255,b:P(Z,255)*255}}function k($,ie,Z){$=P($,255),ie=P(ie,255),Z=P(Z,255);var ye=M($,ie,Z),Ce=F($,ie,Z),ve,we,Ae=(ye+Ce)/2;if(ye==Ce)ve=we=0;else{var Re=ye-Ce;we=Ae>.5?Re/(2-ye-Ce):Re/(ye+Ce);switch(ye){case $:ve=(ie-Z)/Re+(ie<Z?6:0);break;case ie:ve=(Z-$)/Re+2;break;case Z:ve=($-ie)/Re+4;break}ve/=6}return{h:ve,s:we,l:Ae}}function S($,ie,Z){var ye,Ce,ve;$=P($,360),ie=P(ie,100),Z=P(Z,100);function we(Ie,Me,De){return De<0&&(De+=1),De>1&&(De-=1),De<1/6?Ie+(Me-Ie)*6*De:De<1/2?Me:De<2/3?Ie+(Me-Ie)*(2/3-De)*6:Ie}if(ie===0)ye=Ce=ve=Z;else{var Ae=Z<.5?Z*(1+ie):Z+ie-Z*ie,Re=2*Z-Ae;ye=we(Re,Ae,$+1/3),Ce=we(Re,Ae,$),ve=we(Re,Ae,$-1/3)}return{r:ye*255,g:Ce*255,b:ve*255}}function b($,ie,Z){$=P($,255),ie=P(ie,255),Z=P(Z,255);var ye=M($,ie,Z),Ce=F($,ie,Z),ve,we,Ae=ye,Re=ye-Ce;if(we=ye===0?0:Re/ye,ye==Ce)ve=0;else{switch(ye){case $:ve=(ie-Z)/Re+(ie<Z?6:0);break;case ie:ve=(Z-$)/Re+2;break;case Z:ve=($-ie)/Re+4;break}ve/=6}return{h:ve,s:we,v:Ae}}function f($,ie,Z){$=P($,360)*6,ie=P(ie,100),Z=P(Z,100);var ye=G.floor($),Ce=$-ye,ve=Z*(1-ie),we=Z*(1-Ce*ie),Ae=Z*(1-(1-Ce)*ie),Re=ye%6,Ie=[Z,we,ve,ve,Ae,Z][Re],Me=[Ae,Z,Z,we,ve,ve][Re],De=[ve,ve,Ae,Z,Z,we][Re];return{r:Ie*255,g:Me*255,b:De*255}}function u($,ie,Z,ye){var Ce=[oe(O($).toString(16)),oe(O(ie).toString(16)),oe(O(Z).toString(16))];return ye&&Ce[0].charAt(0)==Ce[0].charAt(1)&&Ce[1].charAt(0)==Ce[1].charAt(1)&&Ce[2].charAt(0)==Ce[2].charAt(1)?Ce[0].charAt(0)+Ce[1].charAt(0)+Ce[2].charAt(0):Ce.join("")}function a($,ie,Z,ye,Ce){var ve=[oe(O($).toString(16)),oe(O(ie).toString(16)),oe(O(Z).toString(16)),oe(pe(ye))];return Ce&&ve[0].charAt(0)==ve[0].charAt(1)&&ve[1].charAt(0)==ve[1].charAt(1)&&ve[2].charAt(0)==ve[2].charAt(1)&&ve[3].charAt(0)==ve[3].charAt(1)?ve[0].charAt(0)+ve[1].charAt(0)+ve[2].charAt(0)+ve[3].charAt(0):ve.join("")}function s($,ie,Z,ye){var Ce=[oe(pe(ye)),oe(O($).toString(16)),oe(O(ie).toString(16)),oe(O(Z).toString(16))];return Ce.join("")}C.equals=function($,ie){return!$||!ie?!1:C($).toRgbString()==C(ie).toRgbString()},C.random=function(){return C.fromRatio({r:R(),g:R(),b:R()})};function l($,ie){ie=ie===0?0:ie||10;var Z=C($).toHsl();return Z.s-=ie/100,Z.s=I(Z.s),C(Z)}function A($,ie){ie=ie===0?0:ie||10;var Z=C($).toHsl();return Z.s+=ie/100,Z.s=I(Z.s),C(Z)}function y($){return C($).desaturate(100)}function c($,ie){ie=ie===0?0:ie||10;var Z=C($).toHsl();return Z.l+=ie/100,Z.l=I(Z.l),C(Z)}function L($,ie){ie=ie===0?0:ie||10;var Z=C($).toRgb();return Z.r=M(0,F(255,Z.r-O(255*-(ie/100)))),Z.g=M(0,F(255,Z.g-O(255*-(ie/100)))),Z.b=M(0,F(255,Z.b-O(255*-(ie/100)))),C(Z)}function x($,ie){ie=ie===0?0:ie||10;var Z=C($).toHsl();return Z.l-=ie/100,Z.l=I(Z.l),C(Z)}function h($,ie){var Z=C($).toHsl(),ye=(Z.h+ie)%360;return Z.h=ye<0?360+ye:ye,C(Z)}function p($){var ie=C($).toHsl();return ie.h=(ie.h+180)%360,C(ie)}function d($){var ie=C($).toHsl(),Z=ie.h;return[C($),C({h:(Z+120)%360,s:ie.s,l:ie.l}),C({h:(Z+240)%360,s:ie.s,l:ie.l})]}function o($){var ie=C($).toHsl(),Z=ie.h;return[C($),C({h:(Z+90)%360,s:ie.s,l:ie.l}),C({h:(Z+180)%360,s:ie.s,l:ie.l}),C({h:(Z+270)%360,s:ie.s,l:ie.l})]}function T($){var ie=C($).toHsl(),Z=ie.h;return[C($),C({h:(Z+72)%360,s:ie.s,l:ie.l}),C({h:(Z+216)%360,s:ie.s,l:ie.l})]}function E($,ie,Z){ie=ie||6,Z=Z||30;var ye=C($).toHsl(),Ce=360/Z,ve=[C($)];for(ye.h=(ye.h-(Ce*ie>>1)+720)%360;--ie;)ye.h=(ye.h+Ce)%360,ve.push(C(ye));return ve}function g($,ie){ie=ie||6;for(var Z=C($).toHsv(),ye=Z.h,Ce=Z.s,ve=Z.v,we=[],Ae=1/ie;ie--;)we.push(C({h:ye,s:Ce,v:ve})),ve=(ve+Ae)%1;return we}C.mix=function($,ie,Z){Z=Z===0?0:Z||50;var ye=C($).toRgb(),Ce=C(ie).toRgb(),ve=Z/100,we={r:(Ce.r-ye.r)*ve+ye.r,g:(Ce.g-ye.g)*ve+ye.g,b:(Ce.b-ye.b)*ve+ye.b,a:(Ce.a-ye.a)*ve+ye.a};return C(we)},C.readability=function($,ie){var Z=C($),ye=C(ie);return(G.max(Z.getLuminance(),ye.getLuminance())+.05)/(G.min(Z.getLuminance(),ye.getLuminance())+.05)},C.isReadable=function($,ie,Z){var ye=C.readability($,ie),Ce,ve;ve=!1,Ce=ce(Z);switch(Ce.level+Ce.size){case"AAsmall":case"AAAlarge":ve=ye>=4.5;break;case"AAlarge":ve=ye>=3;break;case"AAAsmall":ve=ye>=7;break}return ve},C.mostReadable=function($,ie,Z){var ye=null,Ce=0,ve,we,Ae,Re;Z=Z||{},we=Z.includeFallbackColors,Ae=Z.level,Re=Z.size;for(var Ie=0;Ie<ie.length;Ie++)ve=C.readability($,ie[Ie]),ve>Ce&&(Ce=ve,ye=C(ie[Ie]));return C.isReadable($,ye,{level:Ae,size:Re})||!we?ye:(Z.includeFallbackColors=!1,C.mostReadable($,["#fff","#000"],Z))};var _=C.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},N=C.hexNames=B(_);function B($){var ie={};for(var Z in $)$.hasOwnProperty(Z)&&(ie[$[Z]]=Z);return ie}function W($){return $=parseFloat($),(isNaN($)||$<0||$>1)&&($=1),$}function P($,ie){Y($)&&($="100%");var Z=ee($);return $=F(ie,M(0,parseFloat($))),Z&&($=parseInt($*ie,10)/100),G.abs($-ie)<1e-6?1:$%ie/parseFloat(ie)}function I($){return F(1,M(0,$))}function H($){return parseInt($,16)}function Y($){return typeof $=="string"&&$.indexOf(".")!=-1&&parseFloat($)===1}function ee($){return typeof $=="string"&&$.indexOf("%")!=-1}function oe($){return $.length==1?"0"+$:""+$}function Ee($){return $<=1&&($=$*100+"%"),$}function pe($){return G.round(parseFloat($)*255).toString(16)}function me($){return H($)/255}var he=function(){var $="[-\\+]?\\d+%?",ie="[-\\+]?\\d*\\.\\d+%?",Z="(?:"+ie+")|(?:"+$+")",ye="[\\s|\\(]+("+Z+")[,|\\s]+("+Z+")[,|\\s]+("+Z+")\\s*\\)?",Ce="[\\s|\\(]+("+Z+")[,|\\s]+("+Z+")[,|\\s]+("+Z+")[,|\\s]+("+Z+")\\s*\\)?";return{CSS_UNIT:new RegExp(Z),rgb:new RegExp("rgb"+ye),rgba:new RegExp("rgba"+Ce),hsl:new RegExp("hsl"+ye),hsla:new RegExp("hsla"+Ce),hsv:new RegExp("hsv"+ye),hsva:new RegExp("hsva"+Ce),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function se($){return!!he.CSS_UNIT.exec($)}function ne($){$=$.replace(D,"").replace(z,"").toLowerCase();var ie=!1;if(_[$])$=_[$],ie=!0;else if($=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var Z;return(Z=he.rgb.exec($))?{r:Z[1],g:Z[2],b:Z[3]}:(Z=he.rgba.exec($))?{r:Z[1],g:Z[2],b:Z[3],a:Z[4]}:(Z=he.hsl.exec($))?{h:Z[1],s:Z[2],l:Z[3]}:(Z=he.hsla.exec($))?{h:Z[1],s:Z[2],l:Z[3],a:Z[4]}:(Z=he.hsv.exec($))?{h:Z[1],s:Z[2],v:Z[3]}:(Z=he.hsva.exec($))?{h:Z[1],s:Z[2],v:Z[3],a:Z[4]}:(Z=he.hex8.exec($))?{r:H(Z[1]),g:H(Z[2]),b:H(Z[3]),a:me(Z[4]),format:ie?"name":"hex8"}:(Z=he.hex6.exec($))?{r:H(Z[1]),g:H(Z[2]),b:H(Z[3]),format:ie?"name":"hex"}:(Z=he.hex4.exec($))?{r:H(Z[1]+""+Z[1]),g:H(Z[2]+""+Z[2]),b:H(Z[3]+""+Z[3]),a:me(Z[4]+""+Z[4]),format:ie?"name":"hex8"}:(Z=he.hex3.exec($))?{r:H(Z[1]+""+Z[1]),g:H(Z[2]+""+Z[2]),b:H(Z[3]+""+Z[3]),format:ie?"name":"hex"}:!1}function ce($){var ie,Z;return $=$||{level:"AA",size:"small"},ie=($.level||"AA").toUpperCase(),Z=($.size||"small").toLowerCase(),ie!=="AA"&&ie!=="AAA"&&(ie="AA"),Z!=="small"&&Z!=="large"&&(Z="small"),{level:ie,size:Z}}nt.exports?nt.exports=C:!(q=function(){return C}.call(Qe,te,Qe,nt),q!==void 0&&(nt.exports=q))})(Math)},aRTE:function(nt,Qe){nt.exports={L:1,M:0,Q:3,H:2}},bT9E:function(nt,Qe,te){"use strict";te.d(Qe,"a",function(){return G});var q=te("VTBJ");function G(D,z){var U=Object(q.a)({},D);return Array.isArray(z)&&z.forEach(function(O){delete U[O]}),U}},c5Ni:function(nt,Qe,te){},dQei:function(nt,Qe){for(var te={glog:function(G){if(G<1)throw new Error("glog("+G+")");return te.LOG_TABLE[G]},gexp:function(G){for(;G<0;)G+=255;for(;G>=256;)G-=255;return te.EXP_TABLE[G]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)},q=0;q<8;q++)te.EXP_TABLE[q]=1<<q;for(var q=8;q<256;q++)te.EXP_TABLE[q]=te.EXP_TABLE[q-4]^te.EXP_TABLE[q-5]^te.EXP_TABLE[q-6]^te.EXP_TABLE[q-8];for(var q=0;q<255;q++)te.LOG_TABLE[te.EXP_TABLE[q]]=q;nt.exports=te},dWSS:function(nt,Qe,te){var q=te("dQei");function G(D,z){if(D.length==null)throw new Error(D.length+"/"+z);for(var U=0;U<D.length&&D[U]==0;)U++;this.num=new Array(D.length-U+z);for(var O=0;O<D.length-U;O++)this.num[O]=D[O+U]}G.prototype={get:function(D){return this.num[D]},getLength:function(){return this.num.length},multiply:function(D){for(var z=new Array(this.getLength()+D.getLength()-1),U=0;U<this.getLength();U++)for(var O=0;O<D.getLength();O++)z[U+O]^=q.gexp(q.glog(this.get(U))+q.glog(D.get(O)));return new G(z,0)},mod:function(D){if(this.getLength()-D.getLength()<0)return this;for(var z=q.glog(this.get(0))-q.glog(D.get(0)),U=new Array(this.getLength()),O=0;O<this.getLength();O++)U[O]=this.get(O);for(var O=0;O<D.getLength();O++)U[O]^=q.gexp(q.glog(D.get(O))+z);return new G(U,0).mod(D)}},nt.exports=G},dejd:function(nt,Qe,te){},dmUQ:function(nt,Qe,te){"use strict";var q=te("Ff2n"),G=te("rePB"),D=te("1OyB"),z=te("vuIU"),U=te("Ji7U"),O=te("md7G"),F=te("foSv"),M=te("cDcd"),R=te.n(M),C=te("TSYQ"),m=te.n(C),v=te("4IlW");function k(d,o){var T=Object.keys(d);if(Object.getOwnPropertySymbols){var E=Object.getOwnPropertySymbols(d);o&&(E=E.filter(function(g){return Object.getOwnPropertyDescriptor(d,g).enumerable})),T.push.apply(T,E)}return T}function S(d){for(var o=1;o<arguments.length;o++){var T=arguments[o]!=null?arguments[o]:{};o%2?k(Object(T),!0).forEach(function(E){Object(G.a)(d,E,T[E])}):Object.getOwnPropertyDescriptors?Object.defineProperties(d,Object.getOwnPropertyDescriptors(T)):k(Object(T)).forEach(function(E){Object.defineProperty(d,E,Object.getOwnPropertyDescriptor(T,E))})}return d}function b(d){var o=f();return function(){var E=Object(F.a)(d),g;if(o){var _=Object(F.a)(this).constructor;g=Reflect.construct(E,arguments,_)}else g=E.apply(this,arguments);return Object(O.a)(this,g)}}function f(){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 a(d){d.preventDefault()}var s=function(o){return o.replace(/[^\w.-]+/g,"")},l=200,A=600,y=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,c=function(o){return o!=null},L=function(o,T){return T===o||typeof T=="number"&&typeof o=="number"&&isNaN(T)&&isNaN(o)},x=function(d){Object(U.a)(T,d);var o=b(T);function T(E){var g;Object(D.a)(this,T),g=o.call(this,E),g.onKeyDown=function(B){var W=g.props,P=W.onKeyDown,I=W.onPressEnter;if(B.keyCode===v.a.UP){var H=g.getRatio(B);g.up(B,H,null),g.stop()}else if(B.keyCode===v.a.DOWN){var Y=g.getRatio(B);g.down(B,Y,null),g.stop()}else B.keyCode===v.a.ENTER&&I&&I(B);if(g.recordCursorPosition(),g.lastKeyCode=B.keyCode,P){for(var ee=arguments.length,oe=new Array(ee>1?ee-1:0),Ee=1;Ee<ee;Ee++)oe[Ee-1]=arguments[Ee];P.apply(void 0,[B].concat(oe))}},g.onKeyUp=function(B){var W=g.props.onKeyUp;if(g.stop(),g.recordCursorPosition(),W){for(var P=arguments.length,I=new Array(P>1?P-1:0),H=1;H<P;H++)I[H-1]=arguments[H];W.apply(void 0,[B].concat(I))}},g.onChange=function(B){var W=g.props.onChange;g.state.focused&&(g.inputting=!0),g.rawInput=g.props.parser(g.getValueFromEvent(B)),g.setState({inputValue:g.rawInput}),W(g.toNumber(g.rawInput))},g.onMouseUp=function(){var B=g.props.onMouseUp;g.recordCursorPosition(),B&&B.apply(void 0,arguments)},g.onFocus=function(){var B;g.setState({focused:!0}),(B=g.props).onFocus.apply(B,arguments)},g.onBlur=function(){var B=g.props.onBlur;g.inputting=!1,g.setState({focused:!1});var W=g.getCurrentValidValue(g.state.inputValue),P=g.setValue(W,u);if(B){var I=g.input.value,H=g.getInputDisplayValue({focus:!1,value:P});g.input.value=H&&Number(H),B.apply(void 0,arguments),g.input.value=I}},g.getRatio=function(B){var W=1;return B.metaKey||B.ctrlKey?W=.1:B.shiftKey&&(W=10),W},g.getFullNum=function(B){return isNaN(B)?B:/e/i.test(String(B))?Number(B).toFixed(18).replace(/\.?0+$/,""):B},g.getPrecision=function(B){if(c(g.props.precision))return g.props.precision;var W=String(B);if(W.indexOf("e-")>=0)return parseInt(W.slice(W.indexOf("e-")+2),10);var P=0;return W.indexOf(".")>=0&&(P=W.length-W.indexOf(".")-1),P},g.getInputDisplayValue=function(B){var W=B||g.state,P=W.focused,I=W.inputValue,H=W.value,Y;P?Y=I:Y=g.toPrecisionAsStep(H),Y==null&&(Y="");var ee=g.formatWrapper(Y);return c(g.props.decimalSeparator)&&(ee=ee.toString().replace(".",g.props.decimalSeparator)),ee},g.recordCursorPosition=function(){try{g.cursorStart=g.input.selectionStart,g.cursorEnd=g.input.selectionEnd,g.currentValue=g.input.value,g.cursorBefore=g.input.value.substring(0,g.cursorStart),g.cursorAfter=g.input.value.substring(g.cursorEnd)}catch(B){}},g.restoreByAfter=function(B){if(B===void 0)return!1;var W=g.input.value,P=W.lastIndexOf(B);if(P===-1)return!1;var I=g.cursorBefore.length;return g.lastKeyCode===v.a.DELETE&&g.cursorBefore.charAt(I-1)===B[0]?(g.fixCaret(I,I),!0):P+B.length===W.length?(g.fixCaret(P,P),!0):!1},g.partRestoreByAfter=function(B){return B===void 0?!1:Array.prototype.some.call(B,function(W,P){var I=B.substring(P);return g.restoreByAfter(I)})},g.isNotCompleteNumber=function(B){return isNaN(B)||B===""||B===null||B&&B.toString().indexOf(".")===B.toString().length-1},g.stop=function(){g.autoStepTimer&&clearTimeout(g.autoStepTimer)},g.down=function(B,W,P){g.pressingUpOrDown=!0,g.step("down",B,W,P)},g.up=function(B,W,P){g.pressingUpOrDown=!0,g.step("up",B,W,P)},g.saveInput=function(B){g.input=B};var _=E.value;_===void 0&&(_=E.defaultValue),g.state={focused:E.autoFocus};var N=g.getValidValue(g.toNumber(_));return g.state=S(S({},g.state),{},{inputValue:g.toPrecisionAsStep(N),value:N}),g}return Object(z.a)(T,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(g){var _=this.props,N=_.value,B=_.onChange,W=_.max,P=_.min,I=this.state.focused;if(g){if(!L(g.value,N)||!L(g.max,W)||!L(g.min,P)){var H=I?N:this.getValidValue(N),Y;this.pressingUpOrDown?Y=H:this.inputting?Y=this.rawInput:Y=this.toPrecisionAsStep(H),this.setState({value:H,inputValue:Y})}var ee="value"in this.props?N:this.state.value;"max"in this.props&&g.max!==W&&typeof ee=="number"&&ee>W&&B&&B(W),"min"in this.props&&g.min!==P&&typeof ee=="number"&&ee<P&&B&&B(P)}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===v.a.BACKSPACE?oe=this.cursorStart-1:this.lastKeyCode===v.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 v.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case v.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(Ee){}if(this.lastKeyCode=null,!this.pressingUpOrDown)return;this.props.focusOnUpDown&&this.state.focused&&(document.activeElement!==this.input&&this.focus())}},{key:"componentWillUnmount",value:function(){this.stop()}},{key:"getCurrentValidValue",value:function(g){var _=g;return _===""?_="":this.isNotCompleteNumber(parseFloat(_))?_=this.state.value:_=this.getValidValue(_),this.toNumber(_)}},{key:"getValueFromEvent",value:function(g){var _=g.target.value.trim().replace(/。/g,".");return c(this.props.decimalSeparator)&&(_=_.replace(this.props.decimalSeparator,".")),_}},{key:"getValidValue",value:function(g){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,N=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,B=parseFloat(g);return isNaN(B)?g:(B<_&&(B=_),B>N&&(B=N),B)}},{key:"setValue",value:function(g,_){var N=this.props.precision,B=this.isNotCompleteNumber(parseFloat(g))?null:parseFloat(g),W=this.state.value,P=W===void 0?null:W,I=this.state.inputValue,H=I===void 0?null:I,Y=typeof B=="number"?B.toFixed(N):"".concat(B),ee=B!==P||Y!=="".concat(H);return"value"in this.props?(H=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:H},_)):this.setState({value:B,inputValue:this.toPrecisionAsStep(g)},_),ee&&this.props.onChange(B),B}},{key:"getMaxPrecision",value:function(g){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,N=this.props,B=N.precision,W=N.step;if(c(B))return B;var P=this.getPrecision(_),I=this.getPrecision(W),H=this.getPrecision(g);return g?Math.max(H,P+I):P+I}},{key:"getPrecisionFactor",value:function(g){var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,N=this.getMaxPrecision(g,_);return Math.pow(10,N)}},{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(g){return this.props.formatter?this.props.formatter(g):g}},{key:"toPrecisionAsStep",value:function(g){if(this.isNotCompleteNumber(g)||g==="")return g;var _=Math.abs(this.getMaxPrecision(g));return isNaN(_)?g.toString():Number(g).toFixed(_)}},{key:"toNumber",value:function(g){var _=this.props.precision,N=this.state.focused,B=g&&g.length>16&&N;return this.isNotCompleteNumber(g)||B?g:c(_)?Math.round(g*Math.pow(10,_))/Math.pow(10,_):Number(g)}},{key:"upStep",value:function(g,_){var N=this.props.step,B=this.getPrecisionFactor(g,_),W=Math.abs(this.getMaxPrecision(g,_)),P=((B*g+B*N*_)/B).toFixed(W);return this.toNumber(P)}},{key:"downStep",value:function(g,_){var N=this.props.step,B=this.getPrecisionFactor(g,_),W=Math.abs(this.getMaxPrecision(g,_)),P=((B*g-B*N*_)/B).toFixed(W);return this.toNumber(P)}},{key:"step",value:function(g,_){var N=this,B=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,W=arguments.length>3?arguments[3]:void 0;this.stop(),_&&(_.persist(),_.preventDefault());var P=this.props;if(P.disabled)return;var I=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(I))return;var H=this["".concat(g,"Step")](I,B),Y=H>P.max||H<P.min;if(H>P.max?H=P.max:H<P.min&&(H=P.min),this.setValue(H,null),this.setState({focused:!0},function(){N.pressingUpOrDown=!1}),Y)return;this.autoStepTimer=setTimeout(function(){N[g](_,B,!0)},W?l:A)}},{key:"fixCaret",value:function(g,_){if(g===void 0||_===void 0||!this.input||!this.input.value)return;try{var N=this.input.selectionStart,B=this.input.selectionEnd;(g!==N||_!==B)&&this.input.setSelectionRange(g,_)}catch(W){}}},{key:"render",value:function(){var g,_=this.props,N=_.prefixCls,B=_.disabled,W=_.readOnly,P=_.useTouch,I=_.autoComplete,H=_.upHandler,Y=_.downHandler,ee=_.className,oe=_.max,Ee=_.min,pe=_.style,me=_.title,he=_.onMouseEnter,se=_.onMouseLeave,ne=_.onMouseOver,ce=_.onMouseOut,$=_.required,ie=_.onClick,Z=_.tabIndex,ye=_.type,Ce=_.placeholder,ve=_.id,we=_.inputMode,Ae=_.pattern,Re=_.step,Ie=_.maxLength,Me=_.autoFocus,De=_.name,Ve=_.onPaste,et=_.onInput,ze=Object(q.a)(_,["prefixCls","disabled","readOnly","useTouch","autoComplete","upHandler","downHandler","className","max","min","style","title","onMouseEnter","onMouseLeave","onMouseOver","onMouseOut","required","onClick","tabIndex","type","placeholder","id","inputMode","pattern","step","maxLength","autoFocus","name","onPaste","onInput"]),Xe=this.state,qe=Xe.value,He=Xe.focused,Be=m()(N,(g={},Object(G.a)(g,ee,!!ee),Object(G.a)(g,"".concat(N,"-disabled"),B),Object(G.a)(g,"".concat(N,"-focused"),He),g)),Se={};Object.keys(ze).forEach(function(le){(le.substr(0,5)==="data-"||le.substr(0,5)==="aria-"||le==="role")&&(Se[le]=ze[le])});var Ze=!W&&!B,Je=this.getInputDisplayValue(null),Le=(qe||qe===0)&&(isNaN(qe)||Number(qe)>=oe),Ue=(qe||qe===0)&&(isNaN(qe)||Number(qe)<=Ee),ge=Le||B||W,de=Ue||B||W,fe=m()("".concat(N,"-handler"),"".concat(N,"-handler-up"),Object(G.a)({},"".concat(N,"-handler-up-disabled"),ge)),Q=m()("".concat(N,"-handler"),"".concat(N,"-handler-down"),Object(G.a)({},"".concat(N,"-handler-down-disabled"),de)),J=P?{onTouchStart:ge?u:this.up,onTouchEnd:this.stop}:{onMouseDown:ge?u:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},re=P?{onTouchStart:de?u:this.down,onTouchEnd:this.stop}:{onMouseDown:de?u:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return R.a.createElement("div",{className:Be,style:pe,title:me,onMouseEnter:he,onMouseLeave:se,onMouseOver:ne,onMouseOut:ce,onFocus:function(){return null},onBlur:function(){return null}},R.a.createElement("div",{className:"".concat(N,"-handler-wrap")},R.a.createElement("span",Object.assign({unselectable:"on"},J,{role:"button","aria-label":"Increase Value","aria-disabled":ge,className:fe}),H||R.a.createElement("span",{unselectable:"on",className:"".concat(N,"-handler-up-inner"),onClick:a})),R.a.createElement("span",Object.assign({unselectable:"on"},re,{role:"button","aria-label":"Decrease Value","aria-disabled":de,className:Q}),Y||R.a.createElement("span",{unselectable:"on",className:"".concat(N,"-handler-down-inner"),onClick:a}))),R.a.createElement("div",{className:"".concat(N,"-input-wrap")},R.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":Ee,"aria-valuemax":oe,"aria-valuenow":qe,required:$,type:ye,placeholder:Ce,onPaste:Ve,onClick:ie,onMouseUp:this.onMouseUp,className:"".concat(N,"-input"),tabIndex:Z,autoComplete:I,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:Ze?this.onKeyDown:u,onKeyUp:Ze?this.onKeyUp:u,autoFocus:Me,maxLength:Ie,readOnly:W,disabled:B,max:oe,min:Ee,step:Re,name:De,title:me,id:ve,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(Je),pattern:Ae,inputMode:we,onInput:et},Se))))}}]),T}(R.a.Component);x.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:y,min:-y,step:1,style:{},onChange:u,onKeyDown:u,onPressEnter:u,onFocus:u,onBlur:u,parser:s,required:!1,autoComplete:"off"};var h=x,p=Qe.a=h},f4xo:function(nt,Qe,te){var q=te("nVVt");function G(D){this.mode=q.MODE_8BIT_BYTE,this.data=D}G.prototype={getLength:function(D){return this.data.length},write:function(D){for(var z=0;z<this.data.length;z++)D.put(this.data.charCodeAt(z),8)}},nt.exports=G},h78n:function(nt,Qe,te){"use strict";te.d(Qe,"a",function(){return g});var q=te("cDcd"),G=te.n(q),D=te("TSYQ"),z=te.n(D),U={className:"",percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,style:{},trailColor:"#D9D9D9",trailWidth:1},O=function(B){var W=B.map(function(){return Object(q.useRef)()}),P=Object(q.useRef)();return Object(q.useEffect)(function(){var I=Date.now(),H=!1;Object.keys(W).forEach(function(Y){var ee=W[Y].current;if(!ee)return;H=!0;var oe=ee.style;oe.transitionDuration=".3s, .3s, .3s, .06s",P.current&&I-P.current<100&&(oe.transitionDuration="0s, 0s")}),H&&(P.current=Date.now())}),[W]};function F(){return F=Object.assign||function(N){for(var B=1;B<arguments.length;B++){var W=arguments[B];for(var P in W)Object.prototype.hasOwnProperty.call(W,P)&&(N[P]=W[P])}return N},F.apply(this,arguments)}function M(N,B){return k(N)||v(N,B)||C(N,B)||R()}function R(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function C(N,B){if(!N)return;if(typeof N=="string")return m(N,B);var W=Object.prototype.toString.call(N).slice(8,-1);if(W==="Object"&&N.constructor&&(W=N.constructor.name),W==="Map"||W==="Set")return Array.from(N);if(W==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(W))return m(N,B)}function m(N,B){(B==null||B>N.length)&&(B=N.length);for(var W=0,P=new Array(B);W<B;W++)P[W]=N[W];return P}function v(N,B){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(N)))return;var W=[],P=!0,I=!1,H=void 0;try{for(var Y=N[Symbol.iterator](),ee;!(P=(ee=Y.next()).done)&&!(W.push(ee.value),B&&W.length===B);P=!0);}catch(oe){I=!0,H=oe}finally{try{!P&&Y.return!=null&&Y.return()}finally{if(I)throw H}}return W}function k(N){if(Array.isArray(N))return N}function S(N,B){if(N==null)return{};var W=b(N,B),P,I;if(Object.getOwnPropertySymbols){var H=Object.getOwnPropertySymbols(N);for(I=0;I<H.length;I++){if(P=H[I],B.indexOf(P)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(N,P))continue;W[P]=N[P]}}return W}function b(N,B){if(N==null)return{};var W={},P=Object.keys(N),I,H;for(H=0;H<P.length;H++){if(I=P[H],B.indexOf(I)>=0)continue;W[I]=N[I]}return W}var f=function(B){var W=B.className,P=B.percent,I=B.prefixCls,H=B.strokeColor,Y=B.strokeLinecap,ee=B.strokeWidth,oe=B.style,Ee=B.trailColor,pe=B.trailWidth,me=B.transition,he=S(B,["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"]);delete he.gapPosition;var se=Array.isArray(P)?P:[P],ne=Array.isArray(H)?H:[H],ce=O(se),$=M(ce,1),ie=$[0],Z=ee/2,ye=100-ee/2,Ce="M ".concat(Y==="round"?Z:0,",").concat(Z,`
|
|
L `).concat(Y==="round"?ye:100,",").concat(Z),ve="0 0 100 ".concat(ee),we=0;return G.a.createElement("svg",F({className:z()("".concat(I,"-line"),W),viewBox:ve,preserveAspectRatio:"none",style:oe},he),G.a.createElement("path",{className:"".concat(I,"-line-trail"),d:Ce,strokeLinecap:Y,stroke:Ee,strokeWidth:pe||ee,fillOpacity:"0"}),se.map(function(Ae,Re){var Ie={strokeDasharray:"".concat(Ae,"px, 100px"),strokeDashoffset:"-".concat(we,"px"),transition:me||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},Me=ne[Re]||ne[ne.length-1];return we+=Ae,G.a.createElement("path",{key:Re,className:"".concat(I,"-line-path"),d:Ce,strokeLinecap:Y,stroke:Me,strokeWidth:ee,fillOpacity:"0",ref:ie[Re],style:Ie})}))};f.defaultProps=U;var u=f;function a(){return a=Object.assign||function(N){for(var B=1;B<arguments.length;B++){var W=arguments[B];for(var P in W)Object.prototype.hasOwnProperty.call(W,P)&&(N[P]=W[P])}return N},a.apply(this,arguments)}function s(N,B){return L(N)||c(N,B)||A(N,B)||l()}function l(){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 A(N,B){if(!N)return;if(typeof N=="string")return y(N,B);var W=Object.prototype.toString.call(N).slice(8,-1);if(W==="Object"&&N.constructor&&(W=N.constructor.name),W==="Map"||W==="Set")return Array.from(N);if(W==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(W))return y(N,B)}function y(N,B){(B==null||B>N.length)&&(B=N.length);for(var W=0,P=new Array(B);W<B;W++)P[W]=N[W];return P}function c(N,B){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(N)))return;var W=[],P=!0,I=!1,H=void 0;try{for(var Y=N[Symbol.iterator](),ee;!(P=(ee=Y.next()).done)&&!(W.push(ee.value),B&&W.length===B);P=!0);}catch(oe){I=!0,H=oe}finally{try{!P&&Y.return!=null&&Y.return()}finally{if(I)throw H}}return W}function L(N){if(Array.isArray(N))return N}function x(N,B){if(N==null)return{};var W=h(N,B),P,I;if(Object.getOwnPropertySymbols){var H=Object.getOwnPropertySymbols(N);for(I=0;I<H.length;I++){if(P=H[I],B.indexOf(P)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(N,P))continue;W[P]=N[P]}}return W}function h(N,B){if(N==null)return{};var W={},P=Object.keys(N),I,H;for(H=0;H<P.length;H++){if(I=P[H],B.indexOf(I)>=0)continue;W[I]=N[I]}return W}var p=0;function d(N){return+N.replace("%","")}function o(N){return Array.isArray(N)?N:[N]}function T(N,B,W,P){var I=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,H=arguments.length>5?arguments[5]:void 0,Y=50-P/2,ee=0,oe=-Y,Ee=0,pe=-2*Y;switch(H){case"left":ee=-Y,oe=0,Ee=2*Y,pe=0;break;case"right":ee=Y,oe=0,Ee=-2*Y,pe=0;break;case"bottom":oe=Y,pe=2*Y;break;default:}var me="M 50,50 m ".concat(ee,",").concat(oe,`
|
|
a `).concat(Y,",").concat(Y," 0 1 1 ").concat(Ee,",").concat(-pe,`
|
|
a `).concat(Y,",").concat(Y," 0 1 1 ").concat(-Ee,",").concat(pe),he=Math.PI*2*Y,se={stroke:W,strokeDasharray:"".concat(B/100*(he-I),"px ").concat(he,"px"),strokeDashoffset:"-".concat(I/2+N/100*(he-I),"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"};return{pathString:me,pathStyle:se}}var E=function(B){var W=B.prefixCls,P=B.strokeWidth,I=B.trailWidth,H=B.gapDegree,Y=B.gapPosition,ee=B.trailColor,oe=B.strokeLinecap,Ee=B.style,pe=B.className,me=B.strokeColor,he=B.percent,se=x(B,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"]),ne=Object(q.useMemo)(function(){return p+=1,p},[]),ce=T(0,100,ee,P,H,Y),$=ce.pathString,ie=ce.pathStyle,Z=o(he),ye=o(me),Ce=ye.find(function(Ie){return Object.prototype.toString.call(Ie)==="[object Object]"}),ve=O(Z),we=s(ve,1),Ae=we[0],Re=function(){var Me=0;return Z.map(function(De,Ve){var et=ye[Ve]||ye[ye.length-1],ze=Object.prototype.toString.call(et)==="[object Object]"?"url(#".concat(W,"-gradient-").concat(ne,")"):"",Xe=T(Me,De,et,P,H,Y);return Me+=De,G.a.createElement("path",{key:Ve,className:"".concat(W,"-circle-path"),d:Xe.pathString,stroke:ze,strokeLinecap:oe,strokeWidth:P,opacity:De===0?0:1,fillOpacity:"0",style:Xe.pathStyle,ref:Ae[Ve]})})};return G.a.createElement("svg",a({className:z()("".concat(W,"-circle"),pe),viewBox:"0 0 100 100",style:Ee},se),Ce&&G.a.createElement("defs",null,G.a.createElement("linearGradient",{id:"".concat(W,"-gradient-").concat(ne),x1:"100%",y1:"0%",x2:"0%",y2:"0%"},Object.keys(Ce).sort(function(Ie,Me){return d(Ie)-d(Me)}).map(function(Ie,Me){return G.a.createElement("stop",{key:Me,offset:Ie,stopColor:Ce[Ie]})}))),G.a.createElement("path",{className:"".concat(W,"-circle-trail"),d:$,stroke:ee,strokeLinecap:oe,strokeWidth:I||P,fillOpacity:"0",style:ie}),Re().reverse())};E.defaultProps=U;var g=E,_={Line:u,Circle:g}},kSUc:function(nt,Qe,te){},lZu9:function(nt,Qe,te){(function(q){q(te("VrN/"),te("1eCo"),te("8EBN"))})(function(q){"use strict";q.defineMode("markdown",function(G,D){var z=q.getMode(G,"text/html"),U=z.name=="null";function O(P){if(q.findModeByName){var I=q.findModeByName(P);I&&(P=I.mime||I.mimes[0])}var H=q.getMode(G,P);return H.name=="null"?null:H}D.highlightFormatting===void 0&&(D.highlightFormatting=!1),D.maxBlockquoteDepth===void 0&&(D.maxBlockquoteDepth=0),D.taskLists===void 0&&(D.taskLists=!1),D.strikethrough===void 0&&(D.strikethrough=!1),D.emoji===void 0&&(D.emoji=!1),D.fencedCodeBlockHighlighting===void 0&&(D.fencedCodeBlockHighlighting=!0),D.fencedCodeBlockDefaultMode===void 0&&(D.fencedCodeBlockDefaultMode="text/plain"),D.xml===void 0&&(D.xml=!0),D.tokenTypeOverrides===void 0&&(D.tokenTypeOverrides={});var F={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 M in F)F.hasOwnProperty(M)&&D.tokenTypeOverrides[M]&&(F[M]=D.tokenTypeOverrides[M]);var R=/^([*\-_])(?:\s*\1){2,}\s*$/,C=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,m=/^\[(x| )\](?=\s)/i,v=D.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,k=/^ {0,3}(?:\={1,}|-{2,})\s*$/,S=/^[^#!\[\]*_\\<>` "'(~:]+/,b=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,f=/^\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]/,a=" ";function s(P,I,H){return I.f=I.inline=H,H(P,I)}function l(P,I,H){return I.f=I.block=H,H(P,I)}function A(P){return!P||!/\S/.test(P.string)}function y(P){if(P.linkTitle=!1,P.linkHref=!1,P.linkText=!1,P.em=!1,P.strong=!1,P.strikethrough=!1,P.quote=0,P.indentedCode=!1,P.f==L){var I=U;if(!I){var H=q.innerMode(z,P.htmlState);I=H.mode.name=="xml"&&H.state.tagStart===null&&!H.state.context&&H.state.tokenize.isInText}I&&(P.f=d,P.block=c,P.htmlState=null)}return P.trailingSpace=0,P.trailingSpaceNewLine=!1,P.prevLine=P.thisLine,P.thisLine={stream:null},null}function c(P,I){var H=P.column()===I.indentation,Y=A(I.prevLine.stream),ee=I.indentedCode,oe=I.prevLine.hr,Ee=I.list!==!1,pe=(I.listStack[I.listStack.length-1]||0)+3;I.indentedCode=!1;var me=I.indentation;if(I.indentationDiff===null&&(I.indentationDiff=I.indentation,Ee)){for(I.list=null;me<I.listStack[I.listStack.length-1];)I.listStack.pop(),I.listStack.length?I.indentation=I.listStack[I.listStack.length-1]:I.list=!1;I.list!==!1&&(I.indentationDiff=me-I.listStack[I.listStack.length-1])}var he=!Y&&!oe&&!I.prevLine.header&&(!Ee||!ee)&&!I.prevLine.fencedCodeEnd,se=(I.list===!1||oe||Y)&&I.indentation<=pe&&P.match(R),ne=null;if(I.indentationDiff>=4&&(ee||I.prevLine.fencedCodeEnd||I.prevLine.header||Y))return P.skipToEnd(),I.indentedCode=!0,F.code;if(P.eatSpace())return null;if(H&&I.indentation<=pe&&(ne=P.match(v))&&ne[1].length<=6)return I.quote=0,I.header=ne[1].length,I.thisLine.header=!0,D.highlightFormatting&&(I.formatting="header"),I.f=I.inline,h(I);if(I.indentation<=pe&&P.eat(">"))return I.quote=H?1:I.quote+1,D.highlightFormatting&&(I.formatting="quote"),P.eatSpace(),h(I);if(!se&&!I.setext&&H&&I.indentation<=pe&&(ne=P.match(C))){var ce=ne[1]?"ol":"ul";return I.indentation=me+P.current().length,I.list=!0,I.quote=0,I.listStack.push(I.indentation),I.em=!1,I.strong=!1,I.code=!1,I.strikethrough=!1,D.taskLists&&P.match(m,!1)&&(I.taskList=!0),I.f=I.inline,D.highlightFormatting&&(I.formatting=["list","list-"+ce]),h(I)}else{if(H&&I.indentation<=pe&&(ne=P.match(b,!0)))return I.quote=0,I.fencedEndRE=new RegExp(ne[1]+"+ *$"),I.localMode=D.fencedCodeBlockHighlighting&&O(ne[2]||D.fencedCodeBlockDefaultMode),I.localMode&&(I.localState=q.startState(I.localMode)),I.f=I.block=x,D.highlightFormatting&&(I.formatting="code-block"),I.code=-1,h(I);if(I.setext||(!he||!Ee)&&!I.quote&&I.list===!1&&!I.code&&!se&&!f.test(P.string)&&(ne=P.lookAhead(1))&&(ne=ne.match(k)))return I.setext?(I.header=I.setext,I.setext=0,P.skipToEnd(),D.highlightFormatting&&(I.formatting="header")):(I.header=ne[0].charAt(0)=="="?1:2,I.setext=I.header),I.thisLine.header=!0,I.f=I.inline,h(I);if(se)return P.skipToEnd(),I.hr=!0,I.thisLine.hr=!0,F.hr;if(P.peek()==="[")return s(P,I,_)}return s(P,I,I.inline)}function L(P,I){var H=z.token(P,I.htmlState);if(!U){var Y=q.innerMode(z,I.htmlState);(Y.mode.name=="xml"&&Y.state.tagStart===null&&!Y.state.context&&Y.state.tokenize.isInText||I.md_inside&&P.current().indexOf(">")>-1)&&(I.f=d,I.block=c,I.htmlState=null)}return H}function x(P,I){var H=I.listStack[I.listStack.length-1]||0,Y=I.indentation<H,ee=H+3;if(I.fencedEndRE&&I.indentation<=ee&&(Y||P.match(I.fencedEndRE))){D.highlightFormatting&&(I.formatting="code-block");var oe;return Y||(oe=h(I)),I.localMode=I.localState=null,I.block=c,I.f=d,I.fencedEndRE=null,I.code=0,I.thisLine.fencedCodeEnd=!0,Y?l(P,I,I.block):oe}else return I.localMode?I.localMode.token(P,I.localState):(P.skipToEnd(),F.code)}function h(P){var I=[];if(P.formatting){I.push(F.formatting),typeof P.formatting=="string"&&(P.formatting=[P.formatting]);for(var H=0;H<P.formatting.length;H++)I.push(F.formatting+"-"+P.formatting[H]),P.formatting[H]==="header"&&I.push(F.formatting+"-"+P.formatting[H]+"-"+P.header),P.formatting[H]==="quote"&&(!D.maxBlockquoteDepth||D.maxBlockquoteDepth>=P.quote?I.push(F.formatting+"-"+P.formatting[H]+"-"+P.quote):I.push("error"))}if(P.taskOpen)return I.push("meta"),I.length?I.join(" "):null;if(P.taskClosed)return I.push("property"),I.length?I.join(" "):null;if(P.linkHref?I.push(F.linkHref,"url"):(P.strong&&I.push(F.strong),P.em&&I.push(F.em),P.strikethrough&&I.push(F.strikethrough),P.emoji&&I.push(F.emoji),P.linkText&&I.push(F.linkText),P.code&&I.push(F.code),P.image&&I.push(F.image),P.imageAltText&&I.push(F.imageAltText,"link"),P.imageMarker&&I.push(F.imageMarker)),P.header&&I.push(F.header,F.header+"-"+P.header),P.quote&&(I.push(F.quote),!D.maxBlockquoteDepth||D.maxBlockquoteDepth>=P.quote?I.push(F.quote+"-"+P.quote):I.push(F.quote+"-"+D.maxBlockquoteDepth)),P.list!==!1){var Y=(P.listStack.length-1)%3;Y?Y===1?I.push(F.list2):I.push(F.list3):I.push(F.list1)}return P.trailingSpaceNewLine?I.push("trailing-space-new-line"):P.trailingSpace&&I.push("trailing-space-"+(P.trailingSpace%2?"a":"b")),I.length?I.join(" "):null}function p(P,I){return P.match(S,!0)?h(I):void 0}function d(P,I){var H=I.text(P,I);if(typeof H!="undefined")return H;if(I.list)return I.list=null,h(I);if(I.taskList){var Y=P.match(m,!0)[1]===" ";return Y?I.taskOpen=!0:I.taskClosed=!0,D.highlightFormatting&&(I.formatting="task"),I.taskList=!1,h(I)}if(I.taskOpen=!1,I.taskClosed=!1,I.header&&P.match(/^#+$/,!0))return D.highlightFormatting&&(I.formatting="header"),h(I);var ee=P.next();if(I.linkTitle){I.linkTitle=!1;var oe=ee;ee==="("&&(oe=")"),oe=(oe+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var Ee="^\\s*(?:[^"+oe+"\\\\]+|\\\\\\\\|\\\\.)"+oe;if(P.match(new RegExp(Ee),!0))return F.linkHref}if(ee==="`"){var pe=I.formatting;D.highlightFormatting&&(I.formatting="code"),P.eatWhile("`");var me=P.current().length;if(I.code==0&&(!I.quote||me==1))return I.code=me,h(I);if(me==I.code){var he=h(I);return I.code=0,he}else return I.formatting=pe,h(I)}else if(I.code)return h(I);if(ee==="\\"&&(P.next(),D.highlightFormatting)){var se=h(I),ne=F.formatting+"-escape";return se?se+" "+ne:ne}if(ee==="!"&&P.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return I.imageMarker=!0,I.image=!0,D.highlightFormatting&&(I.formatting="image"),h(I);if(ee==="["&&I.imageMarker&&P.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return I.imageMarker=!1,I.imageAltText=!0,D.highlightFormatting&&(I.formatting="image"),h(I);if(ee==="]"&&I.imageAltText){D.highlightFormatting&&(I.formatting="image");var se=h(I);return I.imageAltText=!1,I.image=!1,I.inline=I.f=T,se}if(ee==="["&&!I.image)return I.linkText&&P.match(/^.*?\]/)||(I.linkText=!0,D.highlightFormatting&&(I.formatting="link")),h(I);if(ee==="]"&&I.linkText){D.highlightFormatting&&(I.formatting="link");var se=h(I);return I.linkText=!1,I.inline=I.f=P.match(/\(.*?\)| ?\[.*?\]/,!1)?T:d,se}if(ee==="<"&&P.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){I.f=I.inline=o,D.highlightFormatting&&(I.formatting="link");var se=h(I);return se?se+=" ":se="",se+F.linkInline}if(ee==="<"&&P.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){I.f=I.inline=o,D.highlightFormatting&&(I.formatting="link");var se=h(I);return se?se+=" ":se="",se+F.linkEmail}if(D.xml&&ee==="<"&&P.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var ce=P.string.indexOf(">",P.pos);if(ce!=-1){var $=P.string.substring(P.start,ce);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test($)&&(I.md_inside=!0)}return P.backUp(1),I.htmlState=q.startState(z),l(P,I,L)}if(D.xml&&ee==="<"&&P.match(/^\/\w*?>/))return I.md_inside=!1,"tag";if(ee==="*"||ee==="_"){for(var ie=1,Z=P.pos==1?" ":P.string.charAt(P.pos-2);ie<3&&P.eat(ee);)ie++;var ye=P.peek()||" ",Ce=!/\s/.test(ye)&&(!u.test(ye)||/\s/.test(Z)||u.test(Z)),ve=!/\s/.test(Z)&&(!u.test(Z)||/\s/.test(ye)||u.test(ye)),we=null,Ae=null;if(ie%2&&(!I.em&&Ce&&(ee==="*"||!ve||u.test(Z))?we=!0:I.em==ee&&ve&&(ee==="*"||!Ce||u.test(ye))&&(we=!1)),ie>1&&(!I.strong&&Ce&&(ee==="*"||!ve||u.test(Z))?Ae=!0:I.strong==ee&&ve&&(ee==="*"||!Ce||u.test(ye))&&(Ae=!1)),Ae!=null||we!=null){D.highlightFormatting&&(I.formatting=we==null?"strong":Ae==null?"em":"strong em"),we===!0&&(I.em=ee),Ae===!0&&(I.strong=ee);var he=h(I);return we===!1&&(I.em=!1),Ae===!1&&(I.strong=!1),he}}else if(ee===" "&&(P.eat("*")||P.eat("_"))){if(P.peek()===" ")return h(I);P.backUp(1)}if(D.strikethrough){if(ee==="~"&&P.eatWhile(ee)){if(I.strikethrough){D.highlightFormatting&&(I.formatting="strikethrough");var he=h(I);return I.strikethrough=!1,he}else if(P.match(/^[^\s]/,!1))return I.strikethrough=!0,D.highlightFormatting&&(I.formatting="strikethrough"),h(I)}else if(ee===" "&&P.match(/^~~/,!0)){if(P.peek()===" ")return h(I);P.backUp(2)}}if(D.emoji&&ee===":"&&P.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){I.emoji=!0,D.highlightFormatting&&(I.formatting="emoji");var Re=h(I);return I.emoji=!1,Re}return ee===" "&&(P.match(/^ +$/,!1)?I.trailingSpace++:I.trailingSpace&&(I.trailingSpaceNewLine=!0)),h(I)}function o(P,I){var H=P.next();if(H===">"){I.f=I.inline=d,D.highlightFormatting&&(I.formatting="link");var Y=h(I);return Y?Y+=" ":Y="",Y+F.linkInline}return P.match(/^[^>]+/,!0),F.linkInline}function T(P,I){if(P.eatSpace())return null;var H=P.next();return H==="("||H==="["?(I.f=I.inline=g(H==="("?")":"]"),D.highlightFormatting&&(I.formatting="link-string"),I.linkHref=!0,h(I)):"error"}var E={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function g(P){return function(I,H){var Y=I.next();if(Y===P){H.f=H.inline=d,D.highlightFormatting&&(H.formatting="link-string");var ee=h(H);return H.linkHref=!1,ee}return I.match(E[P]),H.linkHref=!0,h(H)}}function _(P,I){return P.match(/^([^\]\\]|\\.)*\]:/,!1)?(I.f=N,P.next(),D.highlightFormatting&&(I.formatting="link"),I.linkText=!0,h(I)):s(P,I,d)}function N(P,I){if(P.match(/^\]:/,!0)){I.f=I.inline=B,D.highlightFormatting&&(I.formatting="link");var H=h(I);return I.linkText=!1,H}return P.match(/^([^\]\\]|\\.)+/,!0),F.linkText}function B(P,I){return P.eatSpace()?null:(P.match(/^[^\s]+/,!0),P.peek()===void 0?I.linkTitle=!0:P.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),I.f=I.inline=d,F.linkHref+" url")}var W={startState:function(){return{f:c,prevLine:{stream:null},thisLine:{stream:null},block:c,htmlState:null,indentation:0,inline:d,text:p,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(P){return{f:P.f,prevLine:P.prevLine,thisLine:P.thisLine,block:P.block,htmlState:P.htmlState&&q.copyState(z,P.htmlState),indentation:P.indentation,localMode:P.localMode,localState:P.localMode?q.copyState(P.localMode,P.localState):null,inline:P.inline,text:P.text,formatting:!1,linkText:P.linkText,linkTitle:P.linkTitle,linkHref:P.linkHref,code:P.code,em:P.em,strong:P.strong,strikethrough:P.strikethrough,emoji:P.emoji,header:P.header,setext:P.setext,hr:P.hr,taskList:P.taskList,list:P.list,listStack:P.listStack.slice(0),quote:P.quote,indentedCode:P.indentedCode,trailingSpace:P.trailingSpace,trailingSpaceNewLine:P.trailingSpaceNewLine,md_inside:P.md_inside,fencedEndRE:P.fencedEndRE}},token:function(P,I){if(I.formatting=!1,P!=I.thisLine.stream){if(I.header=0,I.hr=!1,P.match(/^\s*$/,!0))return y(I),null;if(I.prevLine=I.thisLine,I.thisLine={stream:P},I.taskList=!1,I.trailingSpace=0,I.trailingSpaceNewLine=!1,!I.localState&&(I.f=I.block,I.f!=L)){var H=P.match(/^\s*/,!0)[0].replace(/\t/g,a).length;if(I.indentation=H,I.indentationDiff=null,H>0)return null}}return I.f(P,I)},innerMode:function(P){return P.block==L?{state:P.htmlState,mode:z}:P.localState?{state:P.localState,mode:P.localMode}:{state:P,mode:W}},indent:function(P,I,H){return P.block==L&&z.indent?z.indent(P.htmlState,I,H):P.localState&&P.localMode.indent?P.localMode.indent(P.localState,I,H):q.Pass},blankLine:y,getType:h,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return W},"xml"),q.defineMIME("text/markdown","markdown"),q.defineMIME("text/x-markdown","markdown")})},nVVt:function(nt,Qe){nt.exports={MODE_NUMBER:1<<0,MODE_ALPHA_NUM:1<<1,MODE_8BIT_BYTE:1<<2,MODE_KANJI:1<<3}},osHv:function(nt,Qe,te){(function(q){q(te("VrN/"))})(function(q){"use strict";var G=q.Pos;function D(u,a){return u.line-a.line||u.ch-a.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",U=z+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",O=new RegExp("<(/?)(["+z+"]["+U+"]*)","g");function F(u,a,s,l){this.line=a,this.ch=s,this.cm=u,this.text=u.getLine(a),this.min=l?Math.max(l.from,u.firstLine()):u.firstLine(),this.max=l?Math.min(l.to-1,u.lastLine()):u.lastLine()}function M(u,a){var s=u.cm.getTokenTypeAt(G(u.line,a));return s&&/\btag\b/.test(s)}function R(u){return u.line>=u.max?void 0:(u.ch=0,u.text=u.cm.getLine(++u.line),!0)}function C(u){return u.line<=u.min?void 0:(u.text=u.cm.getLine(--u.line),u.ch=u.text.length,!0)}function m(u){for(;;){var a=u.text.indexOf(">",u.ch);if(a==-1){if(R(u))continue;return}if(!M(u,a+1)){u.ch=a+1;continue}var s=u.text.lastIndexOf("/",a),l=s>-1&&!/\S/.test(u.text.slice(s+1,a));return u.ch=a+1,l?"selfClose":"regular"}}function v(u){for(;;){var a=u.ch?u.text.lastIndexOf("<",u.ch-1):-1;if(a==-1){if(C(u))continue;return}if(!M(u,a+1)){u.ch=a;continue}O.lastIndex=a,u.ch=a;var s=O.exec(u.text);if(s&&s.index==a)return s}}function k(u){for(;;){O.lastIndex=u.ch;var a=O.exec(u.text);if(!a){if(R(u))continue;return}if(!M(u,a.index+1)){u.ch=a.index+1;continue}return u.ch=a.index+a[0].length,a}}function S(u){for(;;){var a=u.ch?u.text.lastIndexOf(">",u.ch-1):-1;if(a==-1){if(C(u))continue;return}if(!M(u,a+1)){u.ch=a;continue}var s=u.text.lastIndexOf("/",a),l=s>-1&&!/\S/.test(u.text.slice(s+1,a));return u.ch=a+1,l?"selfClose":"regular"}}function b(u,a){for(var s=[];;){var l=k(u),A,y=u.line,c=u.ch-(l?l[0].length:0);if(!l||!(A=m(u)))return;if(A=="selfClose")continue;if(l[1]){for(var L=s.length-1;L>=0;--L)if(s[L]==l[2]){s.length=L;break}if(L<0&&(!a||a==l[2]))return{tag:l[2],from:G(y,c),to:G(u.line,u.ch)}}else s.push(l[2])}}function f(u,a){for(var s=[];;){var l=S(u);if(!l)return;if(l=="selfClose"){v(u);continue}var A=u.line,y=u.ch,c=v(u);if(!c)return;if(c[1])s.push(c[2]);else{for(var L=s.length-1;L>=0;--L)if(s[L]==c[2]){s.length=L;break}if(L<0&&(!a||a==c[2]))return{tag:c[2],from:G(u.line,u.ch),to:G(A,y)}}}}q.registerHelper("fold","xml",function(u,a){for(var s=new F(u,a.line,0);;){var l=k(s);if(!l||s.line!=a.line)return;var A=m(s);if(!A)return;if(!l[1]&&A!="selfClose"){var y=G(s.line,s.ch),c=b(s,l[2]);return c&&D(c.from,y)>0?{from:y,to:c.from}:null}}}),q.findMatchingTag=function(u,a,s){var l=new F(u,a.line,a.ch,s);if(l.text.indexOf(">")==-1&&l.text.indexOf("<")==-1)return;var A=m(l),y=A&&G(l.line,l.ch),c=A&&v(l);if(!A||!c||D(l,a)>0)return;var L={from:G(l.line,l.ch),to:y,tag:c[2]};return A=="selfClose"?{open:L,close:null,at:"open"}:c[1]?{open:f(l,c[2]),close:L,at:"close"}:(l=new F(u,y.line,y.ch,s),{open:L,close:b(l,c[2]),at:"open"})},q.findEnclosingTag=function(u,a,s,l){for(var A=new F(u,a.line,a.ch,s);;){var y=f(A,l);if(!y)break;var c=new F(u,a.line,a.ch,s),L=b(c,y.tag);if(L)return{open:y,close:L}}},q.scanForClosingTag=function(u,a,s,l){var A=new F(u,a.line,a.ch,l?{from:0,to:l}:null);return b(A,s)}})},p0QG:function(nt,Qe,te){nt.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(nt,Qe,te){"use strict";var q=te("+L6B"),G=te("2/Rp"),D=te("5Dmo"),z=te("3S7+"),U=te("k1fw"),O=te("tJVT"),F=te("cDcd"),M=te.n(F),R=te("vHTk"),C=te.n(R),m=te("yEEn"),v=te("ZW9T"),k=te("1vsH");Qe.a=function(S){var b=S.name,f=S.data,u=S.theme,a=S.type,s=S.filename,l=S.monacoEditor,A=S.className,y=S.style,c=S.close,L=S.onClose,x=S.hasMask,h=Object(F.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),p=Object(O.a)(h,2),d=p[0],o=p[1],T=Object(F.useState)(""),E=Object(O.a)(T,2),g=E[0],_=E[1],N,B=1024*1024,W=10*B,P=Object(F.useRef)();a==="office"&&(N=Object(k.V)(f).filesize,N>W&&(a="other")),s&&(l.filename=s),Object(F.useEffect)(function(){var Y,ee,oe=(Y=document.cookie)===null||Y===void 0||((ee=Y.replace(/\s/g,""))===null||ee===void 0)?void 0:ee.split(";");oe==null||oe.map(function(Ee){var pe=Ee.split("=");pe[0]==="_educoder_session"&&_(pe[1])})},[]);var I=function(){if(f.startsWith("http")||f.startsWith("blob:")){H();return}Object(k.z)(s||"educoder",f,s)},H=function(){Object(k.x)(s||"educoder",decodeURIComponent(f))};return console.log("data:",f,"fileanme:",s," name:",b),M.a.createElement("div",{style:Object(U.a)({},y||{}),className:"".concat(x&&C.a.bgBlack," ").concat(a?C.a.wrp:"hide")},c&&M.a.createElement("div",{className:C.a.close,ref:P},M.a.createElement(z.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return P.current}},M.a.createElement("span",{onClick:H},M.a.createElement("i",{className:"icon-quxiaozhiding"}))),M.a.createElement(z.a,{title:"\u5173\u95ED",getPopupContainer:function(){return P.current}},M.a.createElement("span",{className:"",onClick:L},M.a.createElement("i",{className:"icon-guanbi1"})))),M.a.createElement("div",{className:"".concat(C.a[A]," ").concat(A," ").concat(C.a.monaco," ").concat(a==="txt"?"show":"hide")},a==="txt"&&M.a.createElement(v.b,l)),a==="audio"&&M.a.createElement("audio",{src:"".concat(f!=null&&f.startsWith("/")||(f==null?void 0:f.indexOf("https://"))>-1?f:"data:audio/mp3;base64,").concat(f),autoPlay:!0}),a==="video"&&M.a.createElement(M.a.Fragment,null,f!=null&&f.startsWith("/")?M.a.createElement("video",{controls:!0,src:"".concat(f),autoPlay:!0}):M.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(f),autoPlay:!0})),a==="html"&&M.a.createElement("iframe",{src:f+"&disposition=inline"}),a==="html"&&M.a.createElement("iframe",{src:f+"&disposition=inline"}),a==="pdf"&&M.a.createElement("embed",{className:C.a.embed,src:f}),a==="image"&&M.a.createElement(M.a.Fragment,null,M.a.createElement("img",{src:"".concat(f!=null&&f.startsWith("/")||(f==null?void 0:f.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(f)})),a==="other"&&M.a.createElement("div",null,M.a.createElement(G.a,{type:"primary",size:"large",onClick:I},M.a.createElement(m.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),(a==="download"||a==="office")&&M.a.createElement(G.a,{type:"primary",size:"large",onClick:I},M.a.createElement(m.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(nt,Qe,te){},"rAM+":function(nt,Qe,te){"use strict";te.d(Qe,"a",function(){return G});var q=te("Qw5x");function G(D,z){var U;if(typeof Symbol=="undefined"||D[Symbol.iterator]==null){if(Array.isArray(D)||(U=Object(q.a)(D))||z&&D&&typeof D.length=="number"){U&&(D=U);var O=0,F=function(){};return{s:F,n:function(){return O>=D.length?{done:!0}:{done:!1,value:D[O++]}},e:function(v){throw v},f:F}}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 M=!0,R=!1,C;return{s:function(){U=D[Symbol.iterator]()},n:function(){var v=U.next();return M=v.done,v},e:function(v){R=!0,C=v},f:function(){try{!M&&U.return!=null&&U.return()}finally{if(R)throw C}}}}},rUJ1:function(nt,Qe){const te=/[&<>"']/,q=/[&<>"']/g,G=/[<>"']|&(?!#?\w+;)/,D=/[<>"']|&(?!#?\w+;)/g,z={"&":"&","<":"<",">":">",'"':""","'":"'"},U=x=>z[x];function O(x,h){if(h){if(te.test(x))return x.replace(q,U)}else if(G.test(x))return x.replace(D,U);return x}const F=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function M(x){return x.replace(F,(h,p)=>(p=p.toLowerCase(),p==="colon"?":":p.charAt(0)==="#"?p.charAt(1)==="x"?String.fromCharCode(parseInt(p.substring(2),16)):String.fromCharCode(+p.substring(1)):""))}const R=/(^|[^\[])\^/g;function C(x,h){x=x.source||x,h=h||"";const p={replace:(d,o)=>(o=o.source||o,o=o.replace(R,"$1"),x=x.replace(d,o),p),getRegex:()=>new RegExp(x,h)};return p}const m=/[^\w:]/g,v=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function k(x,h,p){if(x){let d;try{d=decodeURIComponent(M(p)).replace(m,"").toLowerCase()}catch(o){return null}if(d.indexOf("javascript:")===0||d.indexOf("vbscript:")===0||d.indexOf("data:")===0)return null}h&&!v.test(p)&&(p=a(h,p));try{p=encodeURI(p).replace(/%25/g,"%")}catch(d){return null}return p}const S={},b=/^[^:]+:\/*[^/]*$/,f=/^([^:]+:)[\s\S]*$/,u=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(x,h){S[" "+x]||(b.test(x)?S[" "+x]=x+"/":S[" "+x]=y(x,"/",!0)),x=S[" "+x];const p=x.indexOf(":")===-1;return h.substring(0,2)==="//"?p?h:x.replace(f,"$1")+h:h.charAt(0)==="/"?p?h:x.replace(u,"$1")+h:x+h}const s={exec:function(){}};function l(x){let h=1,p,d;for(;h<arguments.length;h++){p=arguments[h];for(d in p)Object.prototype.hasOwnProperty.call(p,d)&&(x[d]=p[d])}return x}function A(x,h){const p=x.replace(/\|/g,(T,E,g)=>{let _=!1,N=E;for(;--N>=0&&g[N]==="\\";)_=!_;return _?"|":" |"}),d=p.split(/ \|/);let o=0;if(d.length>h)d.splice(h);else for(;d.length<h;)d.push("");for(;o<d.length;o++)d[o]=d[o].trim().replace(/\\\|/g,"|");return d}function y(x,h,p){const d=x.length;if(d===0)return"";let o=0;for(;o<d;){const T=x.charAt(d-o-1);if(T===h&&!p)o++;else if(T!==h&&p)o++;else break}return x.substr(0,d-o)}function c(x,h){if(x.indexOf(h[1])===-1)return-1;const p=x.length;let d=0,o=0;for(;o<p;o++)if(x[o]==="\\")o++;else if(x[o]===h[0])d++;else if(x[o]===h[1]&&(d--,d<0))return o;return-1}function L(x){x&&x.sanitize&&!x.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")}nt.exports={escape:O,unescape:M,edit:C,cleanUrl:k,resolveUrl:a,noopTest:s,merge:l,splitCells:A,rtrim:y,findClosingBracket:c,checkSanitizeDeprecation:L}},rcnY:function(nt,Qe,te){var q=te("aRTE");function G(D,z){this.totalCount=D,this.dataCount=z}G.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],G.getRSBlocks=function(D,z){var U=G.getRsBlockTable(D,z);if(U==null)throw new Error("bad rs block @ typeNumber:"+D+"/errorCorrectLevel:"+z);for(var O=U.length/3,F=new Array,M=0;M<O;M++)for(var R=U[M*3+0],C=U[M*3+1],m=U[M*3+2],v=0;v<R;v++)F.push(new G(C,m));return F},G.getRsBlockTable=function(D,z){switch(z){case q.L:return G.RS_BLOCK_TABLE[(D-1)*4+0];case q.M:return G.RS_BLOCK_TABLE[(D-1)*4+1];case q.Q:return G.RS_BLOCK_TABLE[(D-1)*4+2];case q.H:return G.RS_BLOCK_TABLE[(D-1)*4+3];default:return}},nt.exports=G},ulZh:function(nt,Qe,te){typeof window!="undefined"&&function(G,D){nt.exports=D()}(this,function(){return function(q){var G={};function D(z){if(G[z])return G[z].exports;var U=G[z]={i:z,l:!1,exports:{}};return q[z].call(U.exports,U,U.exports,D),U.l=!0,U.exports}return D.m=q,D.c=G,D.d=function(z,U,O){D.o(z,U)||Object.defineProperty(z,U,{enumerable:!0,get:O})},D.r=function(z){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(z,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(z,"__esModule",{value:!0})},D.t=function(z,U){if(U&1&&(z=D(z)),U&8)return z;if(U&4&&typeof z=="object"&&z&&z.__esModule)return z;var O=Object.create(null);if(D.r(O),Object.defineProperty(O,"default",{enumerable:!0,value:z}),U&2&&typeof z!="string")for(var F in z)D.d(O,F,function(M){return z[M]}.bind(null,F));return O},D.n=function(z){var U=z&&z.__esModule?function(){return z.default}:function(){return z};return D.d(U,"a",U),U},D.o=function(z,U){return Object.prototype.hasOwnProperty.call(z,U)},D.p="/dist/",D(D.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(q,G,D){"use strict";var z=Object.prototype.hasOwnProperty,U="~";function O(){}Object.create&&(O.prototype=Object.create(null),new O().__proto__||(U=!1));function F(m,v,k){this.fn=m,this.context=v,this.once=k||!1}function M(m,v,k,S,b){if(typeof k!="function")throw new TypeError("The listener must be a function");var f=new F(k,S||m,b),u=U?U+v:v;return m._events[u]?m._events[u].fn?m._events[u]=[m._events[u],f]:m._events[u].push(f):(m._events[u]=f,m._eventsCount++),m}function R(m,v){--m._eventsCount===0?m._events=new O:delete m._events[v]}function C(){this._events=new O,this._eventsCount=0}C.prototype.eventNames=function(){var v=[],k,S;if(this._eventsCount===0)return v;for(S in k=this._events)z.call(k,S)&&v.push(U?S.slice(1):S);return Object.getOwnPropertySymbols?v.concat(Object.getOwnPropertySymbols(k)):v},C.prototype.listeners=function(v){var k=U?U+v:v,S=this._events[k];if(!S)return[];if(S.fn)return[S.fn];for(var b=0,f=S.length,u=new Array(f);b<f;b++)u[b]=S[b].fn;return u},C.prototype.listenerCount=function(v){var k=U?U+v:v,S=this._events[k];return S?S.fn?1:S.length:0},C.prototype.emit=function(v,k,S,b,f,u){var a=U?U+v:v;if(!this._events[a])return!1;var s=this._events[a],l=arguments.length,A,y;if(s.fn){s.once&&this.removeListener(v,s.fn,void 0,!0);switch(l){case 1:return s.fn.call(s.context),!0;case 2:return s.fn.call(s.context,k),!0;case 3:return s.fn.call(s.context,k,S),!0;case 4:return s.fn.call(s.context,k,S,b),!0;case 5:return s.fn.call(s.context,k,S,b,f),!0;case 6:return s.fn.call(s.context,k,S,b,f,u),!0}for(y=1,A=new Array(l-1);y<l;y++)A[y-1]=arguments[y];s.fn.apply(s.context,A)}else{var c=s.length,L;for(y=0;y<c;y++){s[y].once&&this.removeListener(v,s[y].fn,void 0,!0);switch(l){case 1:s[y].fn.call(s[y].context);break;case 2:s[y].fn.call(s[y].context,k);break;case 3:s[y].fn.call(s[y].context,k,S);break;case 4:s[y].fn.call(s[y].context,k,S,b);break;default:if(!A)for(L=1,A=new Array(l-1);L<l;L++)A[L-1]=arguments[L];s[y].fn.apply(s[y].context,A)}}}return!0},C.prototype.on=function(v,k,S){return M(this,v,k,S,!1)},C.prototype.once=function(v,k,S){return M(this,v,k,S,!0)},C.prototype.removeListener=function(v,k,S,b){var f=U?U+v:v;if(!this._events[f])return this;if(!k)return R(this,f),this;var u=this._events[f];if(u.fn)u.fn===k&&(!b||u.once)&&(!S||u.context===S)&&R(this,f);else{for(var a=0,s=[],l=u.length;a<l;a++)(u[a].fn!==k||b&&!u[a].once||S&&u[a].context!==S)&&s.push(u[a]);s.length?this._events[f]=s.length===1?s[0]:s:R(this,f)}return this},C.prototype.removeAllListeners=function(v){var k;return v?(k=U?U+v:v,this._events[k]&&R(this,k)):(this._events=new O,this._eventsCount=0),this},C.prototype.off=C.prototype.removeListener,C.prototype.addListener=C.prototype.on,C.prefixed=U,C.EventEmitter=C,q.exports=C},"./node_modules/url-toolkit/src/url-toolkit.js":function(q,G,D){(function(z){var U=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,O=/^([^\/?#]*)([^]*)$/,F=/(?:\/|^)\.(?=\/)/g,M=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,R={buildAbsoluteURL:function(C,m,v){if(v=v||{},C=C.trim(),m=m.trim(),!m){if(!v.alwaysNormalize)return C;var k=R.parseURL(C);if(!k)throw new Error("Error trying to parse base URL.");return k.path=R.normalizePath(k.path),R.buildURLFromParts(k)}var S=R.parseURL(m);if(!S)throw new Error("Error trying to parse relative URL.");if(S.scheme)return v.alwaysNormalize?(S.path=R.normalizePath(S.path),R.buildURLFromParts(S)):m;var b=R.parseURL(C);if(!b)throw new Error("Error trying to parse base URL.");if(!b.netLoc&&b.path&&b.path[0]!=="/"){var f=O.exec(b.path);b.netLoc=f[1],b.path=f[2]}b.netLoc&&!b.path&&(b.path="/");var u={scheme:b.scheme,netLoc:S.netLoc,path:null,params:S.params,query:S.query,fragment:S.fragment};if(!S.netLoc&&(u.netLoc=b.netLoc,S.path[0]!=="/"))if(!S.path)u.path=b.path,S.params||(u.params=b.params,S.query||(u.query=b.query));else{var a=b.path,s=a.substring(0,a.lastIndexOf("/")+1)+S.path;u.path=R.normalizePath(s)}return u.path===null&&(u.path=v.alwaysNormalize?R.normalizePath(S.path):S.path),R.buildURLFromParts(u)},parseURL:function(C){var m=U.exec(C);return m?{scheme:m[1]||"",netLoc:m[2]||"",path:m[3]||"",params:m[4]||"",query:m[5]||"",fragment:m[6]||""}:null},normalizePath:function(C){for(C=C.split("").reverse().join("").replace(F,"");C.length!==(C=C.replace(M,"")).length;);return C.split("").reverse().join("")},buildURLFromParts:function(C){return C.scheme+C.netLoc+C.path+C.params+C.query+C.fragment}};q.exports=R})(this)},"./node_modules/webworkify-webpack/index.js":function(q,G,D){function z(v){var k={};function S(f){if(k[f])return k[f].exports;var u=k[f]={i:f,l:!1,exports:{}};return v[f].call(u.exports,u,u.exports,S),u.l=!0,u.exports}S.m=v,S.c=k,S.i=function(f){return f},S.d=function(f,u,a){S.o(f,u)||Object.defineProperty(f,u,{configurable:!1,enumerable:!0,get:a})},S.r=function(f){Object.defineProperty(f,"__esModule",{value:!0})},S.n=function(f){var u=f&&f.__esModule?function(){return f.default}:function(){return f};return S.d(u,"a",u),u},S.o=function(f,u){return Object.prototype.hasOwnProperty.call(f,u)},S.p="/",S.oe=function(f){throw console.error(f),f};var b=S(S.s=ENTRY_MODULE);return b.default||b}var U="[\\.|\\-|\\+|\\w|/|@]+",O="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+U+").*?\\)";function F(v){return(v+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function M(v){return!isNaN(1*v)}function R(v,k,S){var b={};b[S]=[];var f=k.toString(),u=f.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!u)return b;for(var a=u[1],s=new RegExp("(\\\\n|\\W)"+F(a)+O,"g"),l;l=s.exec(f);){if(l[3]==="dll-reference")continue;b[S].push(l[3])}for(s=new RegExp("\\("+F(a)+'\\("(dll-reference\\s('+U+'))"\\)\\)'+O,"g");l=s.exec(f);)v[l[2]]||(b[S].push(l[1]),v[l[2]]=D(l[1]).m),b[l[2]]=b[l[2]]||[],b[l[2]].push(l[4]);for(var A=Object.keys(b),y=0;y<A.length;y++)for(var c=0;c<b[A[y]].length;c++)M(b[A[y]][c])&&(b[A[y]][c]=1*b[A[y]][c]);return b}function C(v){var k=Object.keys(v);return k.reduce(function(S,b){return S||v[b].length>0},!1)}function m(v,k){for(var S={main:[k]},b={main:[]},f={main:{}};C(S);)for(var u=Object.keys(S),a=0;a<u.length;a++){var s=u[a],l=S[s],A=l.pop();if(f[s]=f[s]||{},f[s][A]||!v[s][A])continue;f[s][A]=!0,b[s]=b[s]||[],b[s].push(A);for(var y=R(v,v[s][A],s),c=Object.keys(y),L=0;L<c.length;L++)S[c[L]]=S[c[L]]||[],S[c[L]]=S[c[L]].concat(y[c[L]])}return b}q.exports=function(v,k){k=k||{};var S={main:D.m},b=k.all?{main:Object.keys(S.main)}:m(S,v),f="";Object.keys(b).filter(function(A){return A!=="main"}).forEach(function(A){for(var y=0;b[A][y];)y++;b[A].push(y),S[A][y]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",f=f+"var "+A+" = ("+z.toString().replace("ENTRY_MODULE",JSON.stringify(y))+")({"+b[A].map(function(c){return""+JSON.stringify(c)+": "+S[A][c].toString()}).join(",")+`});
|
|
`}),f=f+"new (("+z.toString().replace("ENTRY_MODULE",JSON.stringify(v))+")({"+b.main.map(function(A){return""+JSON.stringify(A)+": "+S.main[A].toString()}).join(",")+"}))(self);";var u=new window.Blob([f],{type:"text/javascript"});if(k.bare)return u;var a=window.URL||window.webkitURL||window.mozURL||window.msURL,s=a.createObjectURL(u),l=new window.Worker(s);return l.objectURL=s,l}},"./src/config.ts":function(q,G,D){"use strict";D.r(G),D.d(G,"hlsDefaultConfig",function(){return L}),D.d(G,"mergeConfig",function(){return h}),D.d(G,"enableStreamingMode",function(){return p});var z=D("./src/controller/abr-controller.ts"),U=D("./src/controller/audio-stream-controller.ts"),O=D("./src/controller/audio-track-controller.ts"),F=D("./src/controller/subtitle-stream-controller.ts"),M=D("./src/controller/subtitle-track-controller.ts"),R=D("./src/controller/buffer-controller.ts"),C=D("./src/controller/timeline-controller.ts"),m=D("./src/controller/cap-level-controller.ts"),v=D("./src/controller/fps-controller.ts"),k=D("./src/controller/eme-controller.ts"),S=D("./src/controller/cmcd-controller.ts"),b=D("./src/utils/xhr-loader.ts"),f=D("./src/utils/fetch-loader.ts"),u=D("./src/utils/cues.ts"),a=D("./src/utils/mediakeys-helper.ts"),s=D("./src/utils/logger.ts");function l(){return l=Object.assign||function(d){for(var o=1;o<arguments.length;o++){var T=arguments[o];for(var E in T)Object.prototype.hasOwnProperty.call(T,E)&&(d[E]=T[E])}return d},l.apply(this,arguments)}function A(d,o){var T=Object.keys(d);if(Object.getOwnPropertySymbols){var E=Object.getOwnPropertySymbols(d);o&&(E=E.filter(function(g){return Object.getOwnPropertyDescriptor(d,g).enumerable})),T.push.apply(T,E)}return T}function y(d){for(var o=1;o<arguments.length;o++){var T=arguments[o]!=null?arguments[o]:{};o%2?A(Object(T),!0).forEach(function(E){c(d,E,T[E])}):Object.getOwnPropertyDescriptors?Object.defineProperties(d,Object.getOwnPropertyDescriptors(T)):A(Object(T)).forEach(function(E){Object.defineProperty(d,E,Object.getOwnPropertyDescriptor(T,E))})}return d}function c(d,o,T){return o in d?Object.defineProperty(d,o,{value:T,enumerable:!0,configurable:!0,writable:!0}):d[o]=T,d}var L=y(y({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:Infinity,maxBufferSize:60*1e3*1e3,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:Infinity,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:b.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:z.default,bufferController:R.default,capLevelController:m.default,fpsController:v.default,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:a.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},x()),{},{subtitleStreamController:F.SubtitleStreamController,subtitleTrackController:M.default,timelineController:C.TimelineController,audioStreamController:U.default,audioTrackController:O.default,emeController:k.default,cmcdController:S.default});function x(){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 h(d,o){if((o.liveSyncDurationCount||o.liveMaxLatencyDurationCount)&&(o.liveSyncDuration||o.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(o.liveMaxLatencyDurationCount!==void 0&&(o.liveSyncDurationCount===void 0||o.liveMaxLatencyDurationCount<=o.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(o.liveMaxLatencyDuration!==void 0&&(o.liveSyncDuration===void 0||o.liveMaxLatencyDuration<=o.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return l({},d,o)}function p(d){var o=d.loader;if(o!==f.default&&o!==b.default)s.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),d.progressive=!1;else{var T=Object(f.fetchSupported)();T&&(d.loader=f.default,d.progressive=!0,d.enableSoftwareAES=!0,s.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(q,G,D){"use strict";D.r(G);var z=D("./src/polyfills/number.ts"),U=D("./src/utils/ewma-bandwidth-estimator.ts"),O=D("./src/events.ts"),F=D("./src/utils/buffer-helper.ts"),M=D("./src/errors.ts"),R=D("./src/types/loader.ts"),C=D("./src/utils/logger.ts");function m(S,b){for(var f=0;f<b.length;f++){var u=b[f];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(S,u.key,u)}}function v(S,b,f){return b&&m(S.prototype,b),f&&m(S,f),S}var k=function(){function S(f){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=f;var u=f.config;this.bwEstimator=new U.default(u.abrEwmaSlowVoD,u.abrEwmaFastVoD,u.abrEwmaDefaultEstimate),this.registerListeners()}var b=S.prototype;return b.registerListeners=function(){var u=this.hls;u.on(O.Events.FRAG_LOADING,this.onFragLoading,this),u.on(O.Events.FRAG_LOADED,this.onFragLoaded,this),u.on(O.Events.FRAG_BUFFERED,this.onFragBuffered,this),u.on(O.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.on(O.Events.ERROR,this.onError,this)},b.unregisterListeners=function(){var u=this.hls;u.off(O.Events.FRAG_LOADING,this.onFragLoading,this),u.off(O.Events.FRAG_LOADED,this.onFragLoaded,this),u.off(O.Events.FRAG_BUFFERED,this.onFragBuffered,this),u.off(O.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.off(O.Events.ERROR,this.onError,this)},b.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},b.onFragLoading=function(u,a){var s=a.frag;if(s.type===R.PlaylistLevelType.MAIN&&!this.timer){var l;this.fragCurrent=s,this.partCurrent=(l=a.part)!=null?l:null,this.timer=self.setInterval(this.onCheck,100)}},b.onLevelLoaded=function(u,a){var s=this.hls.config;a.details.live?this.bwEstimator.update(s.abrEwmaSlowLive,s.abrEwmaFastLive):this.bwEstimator.update(s.abrEwmaSlowVoD,s.abrEwmaFastVoD)},b._abandonRulesCheck=function(){var u=this.fragCurrent,a=this.partCurrent,s=this.hls,l=s.autoLevelEnabled,A=s.config,y=s.media;if(!u||!y)return;var c=a?a.stats:u.stats,L=a?a.duration:u.duration;if(c.aborted){C.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!l||y.paused||!y.playbackRate||!y.readyState)return;var x=performance.now()-c.loading.start,h=Math.abs(y.playbackRate);if(x<=500*L/h)return;var p=s.levels,d=s.minAutoLevel,o=p[u.level],T=c.total||Math.max(c.loaded,Math.round(L*o.maxBitrate/8)),E=Math.max(1,c.bwEstimate?c.bwEstimate/8:c.loaded*1e3/x),g=(T-c.loaded)/E,_=y.currentTime,N=(F.BufferHelper.bufferInfo(y,_,A.maxBufferHole).end-_)/h;if(N>=2*L/h||g<=N)return;var B=Number.POSITIVE_INFINITY,W;for(W=u.level-1;W>d;W--){var P=p[W].maxBitrate;if(B=L*P/(8*.8*E),B<N)break}if(B>=g)return;var I=this.bwEstimator.getEstimate();C.logger.warn("Fragment "+u.sn+(a?" part "+a.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)(I)?(I/1024).toFixed(3):"Unknown")+` Kb/s
|
|
Estimated load time for current fragment: `+g.toFixed(3)+` s
|
|
Estimated load time for the next fragment: `+B.toFixed(3)+` s
|
|
Time to underbuffer: `+N.toFixed(3)+" s"),s.nextLoadLevel=W,this.bwEstimator.sample(x,c.loaded),this.clearTimer(),u.loader&&(this.fragCurrent=this.partCurrent=null,u.loader.abort()),s.trigger(O.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:u,part:a,stats:c})},b.onFragLoaded=function(u,a){var s=a.frag,l=a.part;if(s.type===R.PlaylistLevelType.MAIN&&Object(z.isFiniteNumber)(s.sn)){var A=l?l.stats:s.stats,y=l?l.duration:s.duration;if(this.clearTimer(),this.lastLoadedFragLevel=s.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var c=this.hls.levels[s.level],L=(c.loaded?c.loaded.bytes:0)+A.loaded,x=(c.loaded?c.loaded.duration:0)+y;c.loaded={bytes:L,duration:x},c.realBitrate=Math.round(8*L/x)}if(s.bitrateTest){var h={stats:A,frag:s,part:l,id:s.type};this.onFragBuffered(O.Events.FRAG_BUFFERED,h),s.bitrateTest=!1}}},b.onFragBuffered=function(u,a){var s=a.frag,l=a.part,A=l?l.stats:s.stats;if(A.aborted)return;if(s.type!==R.PlaylistLevelType.MAIN||s.sn==="initSegment")return;var y=A.parsing.end-A.loading.start;this.bwEstimator.sample(y,A.loaded),A.bwEstimate=this.bwEstimator.getEstimate(),s.bitrateTest?this.bitrateTestDelay=y/1e3:this.bitrateTestDelay=0},b.onError=function(u,a){switch(a.details){case M.ErrorDetails.FRAG_LOAD_ERROR:case M.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},b.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},b.getNextABRAutoLevel=function(){var u=this.fragCurrent,a=this.partCurrent,s=this.hls,l=s.maxAutoLevel,A=s.config,y=s.minAutoLevel,c=s.media,L=a?a.duration:u?u.duration:0,x=c?c.currentTime:0,h=c&&c.playbackRate!==0?Math.abs(c.playbackRate):1,p=this.bwEstimator?this.bwEstimator.getEstimate():A.abrEwmaDefaultEstimate,d=(F.BufferHelper.bufferInfo(c,x,A.maxBufferHole).end-x)/h,o=this.findBestLevel(p,y,l,d,A.abrBandWidthFactor,A.abrBandWidthUpFactor);if(o>=0)return o;C.logger.trace((d?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var T=L?Math.min(L,A.maxStarvationDelay):A.maxStarvationDelay,E=A.abrBandWidthFactor,g=A.abrBandWidthUpFactor;if(!d){var _=this.bitrateTestDelay;if(_){var N=L?Math.min(L,A.maxLoadingDelay):A.maxLoadingDelay;T=N-_,C.logger.trace("bitrate test took "+Math.round(1e3*_)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*T)+" ms"),E=g=1}}return o=this.findBestLevel(p,y,l,d+T,E,g),Math.max(o,0)},b.findBestLevel=function(u,a,s,l,A,y){for(var c,L=this.fragCurrent,x=this.partCurrent,h=this.lastLoadedFragLevel,p=this.hls.levels,d=p[h],o=!!(d!=null&&(c=d.details)!==null&&c!==void 0&&c.live),T=d==null?void 0:d.codecSet,E=x?x.duration:L?L.duration:0,g=s;g>=a;g--){var _=p[g];if(!_||T&&_.codecSet!==T)continue;var N=_.details,B=(x?N==null?void 0:N.partTarget:N==null?void 0:N.averagetargetduration)||E,W=void 0;g<=h?W=A*u:W=y*u;var P=p[g].maxBitrate,I=P*B/W;if(C.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+g+"/"+Math.round(W)+"/"+P+"/"+B+"/"+l+"/"+I),W>P&&(!I||o&&!this.bitrateTestDelay||I<l))return g}return-1},v(S,[{key:"nextAutoLevel",get:function(){var u=this._nextAutoLevel,a=this.bwEstimator;if(u!==-1&&(!a||!a.canEstimate()))return u;var s=this.getNextABRAutoLevel();return u!==-1&&(s=Math.min(u,s)),s},set:function(u){this._nextAutoLevel=u}}]),S}();G.default=k},"./src/controller/audio-stream-controller.ts":function(q,G,D){"use strict";D.r(G);var z=D("./src/polyfills/number.ts"),U=D("./src/controller/base-stream-controller.ts"),O=D("./src/events.ts"),F=D("./src/utils/buffer-helper.ts"),M=D("./src/controller/fragment-tracker.ts"),R=D("./src/types/level.ts"),C=D("./src/types/loader.ts"),m=D("./src/loader/fragment.ts"),v=D("./src/demux/chunk-cache.ts"),k=D("./src/demux/transmuxer-interface.ts"),S=D("./src/types/transmuxer.ts"),b=D("./src/controller/fragment-finders.ts"),f=D("./src/utils/discontinuities.ts"),u=D("./src/errors.ts"),a=D("./src/utils/logger.ts");function s(){return s=Object.assign||function(L){for(var x=1;x<arguments.length;x++){var h=arguments[x];for(var p in h)Object.prototype.hasOwnProperty.call(h,p)&&(L[p]=h[p])}return L},s.apply(this,arguments)}function l(L,x){L.prototype=Object.create(x.prototype),L.prototype.constructor=L,A(L,x)}function A(L,x){return A=Object.setPrototypeOf||function(p,d){return p.__proto__=d,p},A(L,x)}var y=100,c=function(L){l(x,L);function x(p,d){var o;return o=L.call(this,p,d,"[audio-stream-controller]")||this,o.videoBuffer=null,o.videoTrackCC=-1,o.waitingVideoCC=-1,o.audioSwitch=!1,o.trackId=-1,o.waitingData=null,o.mainDetails=null,o.bufferFlushed=!1,o._registerListeners(),o}var h=x.prototype;return h.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},h._registerListeners=function(){var d=this.hls;d.on(O.Events.MEDIA_ATTACHED,this.onMediaAttached,this),d.on(O.Events.MEDIA_DETACHING,this.onMediaDetaching,this),d.on(O.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.on(O.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.on(O.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),d.on(O.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),d.on(O.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.on(O.Events.ERROR,this.onError,this),d.on(O.Events.BUFFER_RESET,this.onBufferReset,this),d.on(O.Events.BUFFER_CREATED,this.onBufferCreated,this),d.on(O.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),d.on(O.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),d.on(O.Events.FRAG_BUFFERED,this.onFragBuffered,this)},h._unregisterListeners=function(){var d=this.hls;d.off(O.Events.MEDIA_ATTACHED,this.onMediaAttached,this),d.off(O.Events.MEDIA_DETACHING,this.onMediaDetaching,this),d.off(O.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.off(O.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.off(O.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),d.off(O.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),d.off(O.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.off(O.Events.ERROR,this.onError,this),d.off(O.Events.BUFFER_RESET,this.onBufferReset,this),d.off(O.Events.BUFFER_CREATED,this.onBufferCreated,this),d.off(O.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),d.off(O.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),d.off(O.Events.FRAG_BUFFERED,this.onFragBuffered,this)},h.onInitPtsFound=function(d,o){var T=o.frag,E=o.id,g=o.initPTS;if(E==="main"){var _=T.cc;this.initPTS[T.cc]=g,this.log("InitPTS for cc: "+_+" found from main: "+g),this.videoTrackCC=_,this.state===U.State.WAITING_INIT_PTS&&this.tick()}},h.startLoad=function(d){if(!this.levels){this.startPosition=d,this.state=U.State.STOPPED;return}var o=this.lastCurrentTime;this.stopLoad(),this.setInterval(y),this.fragLoadError=0,o>0&&d===-1?(this.log("Override startPosition with lastCurrentTime @"+o.toFixed(3)),this.state=U.State.IDLE):(this.loadedmetadata=!1,this.state=U.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=d,this.tick()},h.doTick=function(){switch(this.state){case U.State.IDLE:this.doTickIdle();break;case U.State.WAITING_TRACK:{var d,o=this.levels,T=this.trackId,E=o==null||((d=o[T])===null||d===void 0)?void 0:d.details;if(E){if(this.waitForCdnTuneIn(E))break;this.state=U.State.WAITING_INIT_PTS}break}case U.State.FRAG_LOADING_WAITING_RETRY:{var g,_=performance.now(),N=this.retryDate;(!N||_>=N||(g=this.media)!==null&&g!==void 0&&g.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=U.State.IDLE);break}case U.State.WAITING_INIT_PTS:{var B=this.waitingData;if(B){var W=B.frag,P=B.part,I=B.cache,H=B.complete;if(this.initPTS[W.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=U.State.FRAG_LOADING;var Y=I.flush(),ee={frag:W,part:P,payload:Y,networkDetails:null};this._handleFragmentLoadProgress(ee),H&&L.prototype._handleFragmentLoadComplete.call(this,ee)}else if(this.videoTrackCC!==this.waitingVideoCC)a.logger.log("Waiting fragment cc ("+W.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var oe=this.getLoadPosition(),Ee=F.BufferHelper.bufferInfo(this.mediaBuffer,oe,this.config.maxBufferHole),pe=Object(b.fragmentWithinToleranceTest)(Ee.end,this.config.maxFragLookUpTolerance,W);pe<0&&(a.logger.log("Waiting fragment cc ("+W.cc+") @ "+W.start+" cancelled because another fragment at "+Ee.end+" is needed"),this.clearWaitingFragment())}}else this.state=U.State.IDLE}}this.onTickEnd()},h.clearWaitingFragment=function(){var d=this.waitingData;d&&(this.fragmentTracker.removeFragment(d.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=U.State.IDLE)},h.onTickEnd=function(){var d=this.media;if(!d||!d.readyState)return;var o=this.mediaBuffer?this.mediaBuffer:d,T=o.buffered;!this.loadedmetadata&&T.length&&(this.loadedmetadata=!0),this.lastCurrentTime=d.currentTime},h.doTickIdle=function(){var d,o,T=this.hls,E=this.levels,g=this.media,_=this.trackId,N=T.config;if(!E||!E[_])return;if(!g&&(this.startFragRequested||!N.startFragPrefetch))return;var B=E[_],W=B.details;if(!W||W.live&&this.levelLastLoaded!==_||this.waitForCdnTuneIn(W)){this.state=U.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,m.ElementaryStreamTypes.AUDIO,C.PlaylistLevelType.AUDIO));var P=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,C.PlaylistLevelType.AUDIO);if(P===null)return;var I=P.len,H=this.getMaxBufferLength(),Y=this.audioSwitch;if(I>=H&&!Y)return;if(!Y&&this._streamEnded(P,W)){T.trigger(O.Events.BUFFER_EOS,{type:"audio"}),this.state=U.State.ENDED;return}var ee=W.fragments,oe=ee[0].start,Ee=P.end;if(Y){var pe=this.getLoadPosition();Ee=pe,W.PTSKnown&&pe<oe&&((P.end>oe||P.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),g.currentTime=oe+.05))}var me=this.getNextFragment(Ee,W);if(!me){this.bufferFlushed=!0;return}((d=me.decryptdata)===null||d===void 0?void 0:d.keyFormat)==="identity"&&!((o=me.decryptdata)!==null&&o!==void 0&&o.key)?this.loadKey(me,W):this.loadFragment(me,W,Ee)},h.getMaxBufferLength=function(){var d=L.prototype.getMaxBufferLength.call(this),o=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,C.PlaylistLevelType.MAIN);return o===null?d:Math.max(d,o.len)},h.onMediaDetaching=function(){this.videoBuffer=null,L.prototype.onMediaDetaching.call(this)},h.onAudioTracksUpdated=function(d,o){var T=o.audioTracks;this.resetTransmuxer(),this.levels=T.map(function(E){return new R.Level(E)})},h.onAudioTrackSwitching=function(d,o){var T=!!o.url;this.trackId=o.id;var E=this.fragCurrent;E!=null&&E.loader&&E.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),T?this.setInterval(y):this.resetTransmuxer(),T?(this.audioSwitch=!0,this.state=U.State.IDLE):this.state=U.State.STOPPED,this.tick()},h.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},h.onLevelLoaded=function(d,o){this.mainDetails=o.details},h.onAudioTrackLoaded=function(d,o){var T,E=this.levels,g=o.details,_=o.id;if(!E){this.warn("Audio tracks were reset while loading level "+_);return}this.log("Track "+_+" loaded ["+g.startSN+","+g.endSN+"],duration:"+g.totalduration);var N=E[_],B=0;if(g.live||(T=N.details)!==null&&T!==void 0&&T.live){var W=this.mainDetails;if(g.fragments[0]||(g.deltaUpdateFailed=!0),g.deltaUpdateFailed||!W)return;!N.details&&g.hasProgramDateTime&&W.hasProgramDateTime?(Object(f.alignMediaPlaylistByPDT)(g,W),B=g.fragments[0].start):B=this.alignPlaylists(g,N.details)}N.details=g,this.levelLastLoaded=_,!this.startFragRequested&&(this.mainDetails||!g.live)&&this.setStartPosition(N.details,B),this.state===U.State.WAITING_TRACK&&!this.waitForCdnTuneIn(g)&&(this.state=U.State.IDLE),this.tick()},h._handleFragmentLoadProgress=function(d){var o,T=d.frag,E=d.part,g=d.payload,_=this.config,N=this.trackId,B=this.levels;if(!B){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+T.sn+" of level "+T.level+" will not be buffered");return}var W=B[N];console.assert(W,"Audio track is defined on fragment load progress");var P=W.details;console.assert(P,"Audio track details are defined on fragment load progress");var I=_.defaultAudioCodec||W.audioCodec||"mp4a.40.2",H=this.transmuxer;H||(H=this.transmuxer=new k.default(this.hls,C.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var Y=this.initPTS[T.cc],ee=(o=T.initSegment)===null||o===void 0?void 0:o.data;if(Y!==void 0){var oe=!1,Ee=E?E.index:-1,pe=Ee!==-1,me=new S.ChunkMetadata(T.level,T.sn,T.stats.chunkCount,g.byteLength,Ee,pe);H.push(g,ee,I,"",T,E,P.totalduration,oe,me,Y)}else{a.logger.log("Unknown video PTS for cc "+T.cc+", waiting for video PTS before demuxing audio frag "+T.sn+" of ["+P.startSN+" ,"+P.endSN+"],track "+N);var he=this.waitingData=this.waitingData||{frag:T,part:E,cache:new v.default,complete:!1},se=he.cache;se.push(new Uint8Array(g)),this.waitingVideoCC=this.videoTrackCC,this.state=U.State.WAITING_INIT_PTS}},h._handleFragmentLoadComplete=function(d){if(this.waitingData){this.waitingData.complete=!0;return}L.prototype._handleFragmentLoadComplete.call(this,d)},h.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},h.onBufferCreated=function(d,o){var T=o.tracks.audio;T&&(this.mediaBuffer=T.buffer),o.tracks.video&&(this.videoBuffer=o.tracks.video.buffer)},h.onFragBuffered=function(d,o){var T=o.frag,E=o.part;if(T.type!==C.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(T)){this.warn("Fragment "+T.sn+(E?" p: "+E.index:"")+" of level "+T.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}T.sn!=="initSegment"&&(this.fragPrevious=T,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(O.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(T,E)},h.onError=function(d,o){switch(o.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(C.PlaylistLevelType.AUDIO,o);break;case u.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case u.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==U.State.ERROR&&this.state!==U.State.STOPPED&&(this.state=o.fatal?U.State.ERROR:U.State.IDLE,this.warn(o.details+" while loading frag, switching to "+this.state+" state"));break;case u.ErrorDetails.BUFFER_FULL_ERROR:if(o.parent==="audio"&&(this.state===U.State.PARSING||this.state===U.State.PARSED)){var T=!0,E=this.getFwdBufferInfo(this.mediaBuffer,C.PlaylistLevelType.AUDIO);E&&E.len>.5&&(T=!this.reduceMaxBufferLength(E.len)),T&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,L.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},h.onBufferFlushed=function(d,o){var T=o.type;T===m.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},h._handleTransmuxComplete=function(d){var o,T="audio",E=this.hls,g=d.remuxResult,_=d.chunkMeta,N=this.getCurrentContext(_);if(!N){this.warn("The loading context changed while buffering fragment "+_.sn+" of level "+_.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(_.level);return}var B=N.frag,W=N.part,P=g.audio,I=g.text,H=g.id3,Y=g.initSegment;if(this.fragContextChanged(B))return;if(this.state=U.State.PARSING,this.audioSwitch&&P&&this.completeAudioSwitch(),Y!=null&&Y.tracks&&(this._bufferInitSegment(Y.tracks,B,_),E.trigger(O.Events.FRAG_PARSING_INIT_SEGMENT,{frag:B,id:T,tracks:Y.tracks})),P){var ee=P.startPTS,oe=P.endPTS,Ee=P.startDTS,pe=P.endDTS;W&&(W.elementaryStreams[m.ElementaryStreamTypes.AUDIO]={startPTS:ee,endPTS:oe,startDTS:Ee,endDTS:pe}),B.setElementaryStreamInfo(m.ElementaryStreamTypes.AUDIO,ee,oe,Ee,pe),this.bufferFragmentData(P,B,W,_)}if(H!=null&&(o=H.samples)!==null&&o!==void 0&&o.length){var me=s({frag:B,id:T},H);E.trigger(O.Events.FRAG_PARSING_METADATA,me)}if(I){var he=s({frag:B,id:T},I);E.trigger(O.Events.FRAG_PARSING_USERDATA,he)}},h._bufferInitSegment=function(d,o,T){if(this.state!==U.State.PARSING)return;d.video&&delete d.video;var E=d.audio;if(!E)return;E.levelCodec=E.codec,E.id="audio",this.log("Init audio buffer, container:"+E.container+", codecs[parsed]=["+E.codec+"]"),this.hls.trigger(O.Events.BUFFER_CODECS,d);var g=E.initSegment;if(g!=null&&g.byteLength){var _={type:"audio",frag:o,part:null,chunkMeta:T,parent:o.type,data:g};this.hls.trigger(O.Events.BUFFER_APPENDING,_)}this.tick()},h.loadFragment=function(d,o,T){var E=this.fragmentTracker.getState(d);this.fragCurrent=d,(this.audioSwitch||E===M.FragmentState.NOT_LOADED||E===M.FragmentState.PARTIAL)&&(d.sn==="initSegment"?this._loadInitSegment(d):o.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=U.State.WAITING_INIT_PTS):(this.startFragRequested=!0,L.prototype.loadFragment.call(this,d,o,T)))},h.completeAudioSwitch=function(){var d=this.hls,o=this.media,T=this.trackId;o&&(this.log("Switching audio track : flushing all audio"),L.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,d.trigger(O.Events.AUDIO_TRACK_SWITCHED,{id:T})},x}(U.default);G.default=c},"./src/controller/audio-track-controller.ts":function(q,G,D){"use strict";D.r(G);var z=D("./src/events.ts"),U=D("./src/errors.ts"),O=D("./src/controller/base-playlist-controller.ts"),F=D("./src/types/loader.ts");function M(k,S){for(var b=0;b<S.length;b++){var f=S[b];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(k,f.key,f)}}function R(k,S,b){return S&&M(k.prototype,S),b&&M(k,b),k}function C(k,S){k.prototype=Object.create(S.prototype),k.prototype.constructor=k,m(k,S)}function m(k,S){return m=Object.setPrototypeOf||function(f,u){return f.__proto__=u,f},m(k,S)}var v=function(k){C(S,k);function S(f){var u;return u=k.call(this,f,"[audio-track-controller]")||this,u.tracks=[],u.groupId=null,u.tracksInGroup=[],u.trackId=-1,u.trackName="",u.selectDefaultTrack=!0,u.registerListeners(),u}var b=S.prototype;return b.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)},b.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)},b.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,k.prototype.destroy.call(this)},b.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},b.onManifestParsed=function(u,a){this.tracks=a.audioTracks||[]},b.onAudioTrackLoaded=function(u,a){var s=a.id,l=a.details,A=this.tracksInGroup[s];if(!A){this.warn("Invalid audio track id "+s);return}var y=A.details;A.details=a.details,this.log("audioTrack "+s+" loaded ["+l.startSN+"-"+l.endSN+"]"),s===this.trackId&&(this.retryCount=0,this.playlistLoaded(s,a,y))},b.onLevelLoading=function(u,a){this.switchLevel(a.level)},b.onLevelSwitching=function(u,a){this.switchLevel(a.level)},b.switchLevel=function(u){var a=this.hls.levels[u];if(!(a!=null&&a.audioGroupIds))return;var s=a.audioGroupIds[a.urlId];if(this.groupId!==s){this.groupId=s;var l=this.tracks.filter(function(y){return!s||y.groupId===s});this.selectDefaultTrack&&!l.some(function(y){return y.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=l;var A={audioTracks:l};this.log("Updating audio tracks, "+l.length+' track(s) found in "'+s+'" group-id'),this.hls.trigger(z.Events.AUDIO_TRACKS_UPDATED,A),this.selectInitialTrack()}},b.onError=function(u,a){if(k.prototype.onError.call(this,u,a),a.fatal||!a.context)return;a.context.type===F.PlaylistContextType.AUDIO_TRACK&&a.context.id===this.trackId&&a.context.groupId===this.groupId&&this.retryLoadingOrFail(a)},b.setAudioTrack=function(u){var a=this.tracksInGroup;if(u<0||u>=a.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var s=a[this.trackId];this.log("Now switching to audio-track index "+u);var l=a[u],A=l.id,y=l.groupId,c=y===void 0?"":y,L=l.name,x=l.type,h=l.url;if(this.trackId=u,this.trackName=L,this.selectDefaultTrack=!1,this.hls.trigger(z.Events.AUDIO_TRACK_SWITCHING,{id:A,groupId:c,name:L,type:x,url:h}),l.details&&!l.details.live)return;var p=this.switchParams(l.url,s==null?void 0:s.details);this.loadPlaylist(p)},b.selectInitialTrack=function(){var u=this.tracksInGroup;console.assert(u.length,"Initial audio track should be selected when tracks are known");var a=this.trackName,s=this.findTrackId(a)||this.findTrackId();s!==-1?this.setAudioTrack(s):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(z.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},b.findTrackId=function(u){for(var a=this.tracksInGroup,s=0;s<a.length;s++){var l=a[s];if((!this.selectDefaultTrack||l.default)&&(!u||u===l.name))return l.id}return-1},b.loadPlaylist=function(u){var a=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(a)){var s=a.id,l=a.groupId,A=a.url;if(u)try{A=u.addDirectives(A)}catch(y){this.warn("Could not construct new URL with HLS Delivery Directives: "+y)}this.log("loading audio-track playlist for id: "+s),this.clearTimer(),this.hls.trigger(z.Events.AUDIO_TRACK_LOADING,{url:A,id:s,groupId:l,deliveryDirectives:u||null})}},R(S,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(u){this.selectDefaultTrack=!1,this.setAudioTrack(u)}}]),S}(O.default);G.default=v},"./src/controller/base-playlist-controller.ts":function(q,G,D){"use strict";D.r(G),D.d(G,"default",function(){return R});var z=D("./src/polyfills/number.ts"),U=D("./src/types/level.ts"),O=D("./src/controller/level-helper.ts"),F=D("./src/utils/logger.ts"),M=D("./src/errors.ts"),R=function(){function C(v,k){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=F.logger.log.bind(F.logger,k+":"),this.warn=F.logger.warn.bind(F.logger,k+":"),this.hls=v}var m=C.prototype;return m.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},m.onError=function(k,S){S.fatal&&S.type===M.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},m.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},m.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},m.stopLoad=function(){this.canLoad=!1,this.clearTimer()},m.switchParams=function(k,S){var b=S==null?void 0:S.renditionReports;if(b)for(var f=0;f<b.length;f++){var u=b[f],a=""+u.URI;if(a===k.substr(-a.length)){var s=parseInt(u["LAST-MSN"]),l=parseInt(u["LAST-PART"]);if(S&&this.hls.config.lowLatencyMode){var A=Math.min(S.age-S.partTarget,S.targetduration);l!==void 0&&A>S.partTarget&&(l+=1)}if(Object(z.isFiniteNumber)(s))return new U.HlsUrlParameters(s,Object(z.isFiniteNumber)(l)?l:void 0,U.HlsSkip.No)}}},m.loadPlaylist=function(k){},m.shouldLoadTrack=function(k){return this.canLoad&&k&&!!k.url&&(!k.details||k.details.live)},m.playlistLoaded=function(k,S,b){var f=this,u=S.details,a=S.stats,s=a.loading.end?Math.max(0,self.performance.now()-a.loading.end):0;if(u.advancedDateTime=Date.now()-s,u.live||b!=null&&b.live){if(u.reloaded(b),b&&this.log("live playlist "+k+" "+(u.advanced?"REFRESHED "+u.lastPartSn+"-"+u.lastPartIndex:"MISSED")),b&&u.fragments.length>0&&Object(O.mergeDetails)(b,u),!this.canLoad||!u.live)return;var l,A=void 0,y=void 0;if(u.canBlockReload&&u.endSN&&u.advanced){var c=this.hls.config.lowLatencyMode,L=u.lastPartSn,x=u.endSN,h=u.lastPartIndex,p=h!==-1,d=L===x,o=c?0:h;p?(A=d?x+1:L,y=d?o:h+1):A=x+1;var T=u.age,E=T+u.ageHeader,g=Math.min(E-u.partTarget,u.targetduration*1.5);if(g>0){if(b&&g>b.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+b.tuneInGoal+" to: "+g+" with playlist age: "+u.age),g=0;else{var _=Math.floor(g/u.targetduration);if(A+=_,y!==void 0){var N=Math.round(g%u.targetduration/u.partTarget);y+=N}this.log("CDN Tune-in age: "+u.ageHeader+"s last advanced "+T.toFixed(2)+"s goal: "+g+" skip sn "+_+" to part "+y)}u.tuneInGoal=g}if(l=this.getDeliveryDirectives(u,S.deliveryDirectives,A,y),c||!d){this.loadPlaylist(l);return}}else l=this.getDeliveryDirectives(u,S.deliveryDirectives,A,y);var B=Object(O.computeReloadInterval)(u,a);A!==void 0&&u.canBlockReload&&(B-=u.partTarget||1),this.log("reload live playlist "+k+" in "+Math.round(B)+" ms"),this.timer=self.setTimeout(function(){return f.loadPlaylist(l)},B)}else this.clearTimer()},m.getDeliveryDirectives=function(k,S,b,f){var u=Object(U.getSkipValue)(k,b);return S!=null&&S.skip&&k.deltaUpdateFailed&&(b=S.msn,f=S.part,u=U.HlsSkip.No),new U.HlsUrlParameters(b,f,u)},m.retryLoadingOrFail=function(k){var S=this,b=this.hls.config,f=this.retryCount<b.levelLoadingMaxRetry;if(f){var u;if(this.retryCount++,k.details.indexOf("LoadTimeOut")>-1&&(u=k.context)!==null&&u!==void 0&&u.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+k.details+'"'),this.loadPlaylist();else{var a=Math.min(Math.pow(2,this.retryCount)*b.levelLoadingRetryDelay,b.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return S.loadPlaylist()},a),this.warn("retry playlist loading #"+this.retryCount+" in "+a+' ms after "'+k.details+'"')}}else this.warn('cannot recover from error "'+k.details+'"'),this.clearTimer(),k.fatal=!0;return f},C}()},"./src/controller/base-stream-controller.ts":function(q,G,D){"use strict";D.r(G),D.d(G,"State",function(){return x}),D.d(G,"default",function(){return h});var z=D("./src/polyfills/number.ts"),U=D("./src/task-loop.ts"),O=D("./src/controller/fragment-tracker.ts"),F=D("./src/utils/buffer-helper.ts"),M=D("./src/utils/logger.ts"),R=D("./src/events.ts"),C=D("./src/errors.ts"),m=D("./src/types/transmuxer.ts"),v=D("./src/utils/mp4-tools.ts"),k=D("./src/utils/discontinuities.ts"),S=D("./src/controller/fragment-finders.ts"),b=D("./src/controller/level-helper.ts"),f=D("./src/loader/fragment-loader.ts"),u=D("./src/crypt/decrypter.ts"),a=D("./src/utils/time-ranges.ts"),s=D("./src/types/loader.ts");function l(p,d){for(var o=0;o<d.length;o++){var T=d[o];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(p,T.key,T)}}function A(p,d,o){return d&&l(p.prototype,d),o&&l(p,o),p}function y(p){if(p===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return p}function c(p,d){p.prototype=Object.create(d.prototype),p.prototype.constructor=p,L(p,d)}function L(p,d){return L=Object.setPrototypeOf||function(T,E){return T.__proto__=E,T},L(p,d)}var x={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",BACKTRACKING:"BACKTRACKING",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"},h=function(p){c(d,p);function d(T,E,g){var _;return _=p.call(this)||this,_.hls=void 0,_.fragPrevious=null,_.fragCurrent=null,_.fragmentTracker=void 0,_.transmuxer=null,_._state=x.STOPPED,_.media=void 0,_.mediaBuffer=void 0,_.config=void 0,_.bitrateTest=!1,_.lastCurrentTime=0,_.nextLoadPosition=0,_.startPosition=0,_.loadedmetadata=!1,_.fragLoadError=0,_.retryDate=0,_.levels=null,_.fragmentLoader=void 0,_.levelLastLoaded=null,_.startFragRequested=!1,_.decrypter=void 0,_.initPTS=[],_.onvseeking=null,_.onvended=null,_.logPrefix="",_.log=void 0,_.warn=void 0,_.logPrefix=g,_.log=M.logger.log.bind(M.logger,g+":"),_.warn=M.logger.warn.bind(M.logger,g+":"),_.hls=T,_.fragmentLoader=new f.default(T.config),_.fragmentTracker=E,_.config=T.config,_.decrypter=new u.default(T,T.config),T.on(R.Events.KEY_LOADED,_.onKeyLoaded,y(_)),_}var o=d.prototype;return o.doTick=function(){this.onTickEnd()},o.onTickEnd=function(){},o.startLoad=function(E){},o.stopLoad=function(){this.fragmentLoader.abort();var E=this.fragCurrent;E&&this.fragmentTracker.removeFragment(E),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=x.STOPPED},o._streamEnded=function(E,g){var _=this.fragCurrent,N=this.fragmentTracker;if(!g.live&&_&&_.sn===g.endSN&&!E.nextStart){var B=N.getState(_);return B===O.FragmentState.PARTIAL||B===O.FragmentState.OK}return!1},o.onMediaAttached=function(E,g){var _=this.media=this.mediaBuffer=g.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),_.addEventListener("seeking",this.onvseeking),_.addEventListener("ended",this.onvended);var N=this.config;this.levels&&N.autoStartLoad&&this.state===x.STOPPED&&this.startLoad(N.startPosition)},o.onMediaDetaching=function(){var E=this.media;E!=null&&E.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),E&&(E.removeEventListener("seeking",this.onvseeking),E.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},o.onMediaSeeking=function(){var E=this.config,g=this.fragCurrent,_=this.media,N=this.mediaBuffer,B=this.state,W=_?_.currentTime:0,P=F.BufferHelper.bufferInfo(N||_,W,E.maxBufferHole);if(this.log("media seeking to "+(Object(z.isFiniteNumber)(W)?W.toFixed(3):W)+", state: "+B),B===x.ENDED)this.resetLoadingState();else if(g&&!P.len){var I=E.maxFragLookUpTolerance,H=g.start-I,Y=g.start+g.duration+I,ee=W>Y;(W<H||ee)&&(ee&&g.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),g.loader.abort()),this.resetLoadingState())}_&&(this.lastCurrentTime=W),!this.loadedmetadata&&!P.len&&(this.nextLoadPosition=this.startPosition=W),this.tickImmediate()},o.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},o.onKeyLoaded=function(E,g){if(this.state!==x.KEY_LOADING||g.frag!==this.fragCurrent||!this.levels)return;this.state=x.IDLE;var _=this.levels[g.frag.level].details;_&&this.loadFragment(g.frag,_,g.frag.start)},o.onHandlerDestroying=function(){this.stopLoad(),p.prototype.onHandlerDestroying.call(this)},o.onHandlerDestroyed=function(){this.state=x.STOPPED,this.hls.off(R.Events.KEY_LOADED,this.onKeyLoaded,this),this.fragmentLoader&&this.fragmentLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.fragmentLoader=this.fragmentTracker=null,p.prototype.onHandlerDestroyed.call(this)},o.loadKey=function(E,g){this.log("Loading key for "+E.sn+" of ["+g.startSN+"-"+g.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+E.level),this.state=x.KEY_LOADING,this.fragCurrent=E,this.hls.trigger(R.Events.KEY_LOADING,{frag:E})},o.loadFragment=function(E,g,_){this._loadFragForPlayback(E,g,_)},o._loadFragForPlayback=function(E,g,_){var N=this,B=function(P){if(N.fragContextChanged(E)){N.warn("Fragment "+E.sn+(P.part?" p: "+P.part.index:"")+" of level "+E.level+" was dropped during download."),N.fragmentTracker.removeFragment(E);return}E.stats.chunkCount++,N._handleFragmentLoadProgress(P)};this._doFragLoad(E,g,_,B).then(function(W){if(!W)return;N.fragLoadError=0;var P=N.state;if(N.fragContextChanged(E)){(P===x.FRAG_LOADING||P===x.BACKTRACKING||!N.fragCurrent&&P===x.PARSING)&&(N.fragmentTracker.removeFragment(E),N.state=x.IDLE);return}if("payload"in W&&(N.log("Loaded fragment "+E.sn+" of level "+E.level),N.hls.trigger(R.Events.FRAG_LOADED,W),N.state===x.BACKTRACKING)){N.fragmentTracker.backtrack(E,W),N.resetFragmentLoading(E);return}N._handleFragmentLoadComplete(W)}).catch(function(W){N.warn(W),N.resetFragmentLoading(E)})},o.flushMainBuffer=function(E,g,_){if(_===void 0&&(_=null),!(E-g))return;var N={startOffset:E,endOffset:g,type:_};this.fragLoadError=0,this.hls.trigger(R.Events.BUFFER_FLUSHING,N)},o._loadInitSegment=function(E){var g=this;this._doFragLoad(E).then(function(_){if(!_||g.fragContextChanged(E)||!g.levels)throw new Error("init load aborted");return _}).then(function(_){var N=g.hls,B=_.payload,W=E.decryptdata;if(B&&B.byteLength>0&&W&&W.key&&W.iv&&W.method==="AES-128"){var P=self.performance.now();return g.decrypter.webCryptoDecrypt(new Uint8Array(B),W.key.buffer,W.iv.buffer).then(function(I){var H=self.performance.now();return N.trigger(R.Events.FRAG_DECRYPTED,{frag:E,payload:I,stats:{tstart:P,tdecrypt:H}}),_.payload=I,_})}return _}).then(function(_){var N=g.fragCurrent,B=g.hls,W=g.levels;if(!W)throw new Error("init load aborted, missing levels");var P=W[E.level].details;console.assert(P,"Level details are defined when init segment is loaded");var I=E.stats;g.state=x.IDLE,g.fragLoadError=0,E.data=new Uint8Array(_.payload),I.parsing.start=I.buffering.start=self.performance.now(),I.parsing.end=I.buffering.end=self.performance.now(),_.frag===N&&B.trigger(R.Events.FRAG_BUFFERED,{stats:I,frag:N,part:null,id:E.type}),g.tick()}).catch(function(_){g.warn(_),g.resetFragmentLoading(E)})},o.fragContextChanged=function(E){var g=this.fragCurrent;return!E||!g||E.level!==g.level||E.sn!==g.sn||E.urlId!==g.urlId},o.fragBufferedComplete=function(E,g){var _=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+E.type+" sn: "+E.sn+(g?" part: "+g.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+E.level+" "+a.default.toString(F.BufferHelper.getBuffered(_))),this.state=x.IDLE,this.tick()},o._handleFragmentLoadComplete=function(E){var g=this.transmuxer;if(!g)return;var _=E.frag,N=E.part,B=E.partsLoaded,W=!B||B.length===0||B.some(function(I){return!I}),P=new m.ChunkMetadata(_.level,_.sn,_.stats.chunkCount+1,0,N?N.index:-1,!W);g.flush(P)},o._handleFragmentLoadProgress=function(E){},o._doFragLoad=function(E,g,_,N){var B=this;if(_===void 0&&(_=null),!this.levels)throw new Error("frag load aborted, missing levels");if(_=Math.max(E.start,_||0),this.config.lowLatencyMode&&g){var W=g.partList;if(W&&N){_>E.end&&g.fragmentHint&&(E=g.fragmentHint);var P=this.getNextPart(W,E,_);if(P>-1){var I=W[P];return this.log("Loading part sn: "+E.sn+" p: "+I.index+" cc: "+E.cc+" of playlist ["+g.startSN+"-"+g.endSN+"] parts [0-"+P+"-"+(W.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+E.level+", target: "+parseFloat(_.toFixed(3))),this.nextLoadPosition=I.start+I.duration,this.state=x.FRAG_LOADING,this.hls.trigger(R.Events.FRAG_LOADING,{frag:E,part:W[P],targetBufferTime:_}),this.doFragPartsLoad(E,W,P,N).catch(function(H){return B.handleFragLoadError(H)})}else if(!E.url||this.loadedEndOfParts(W,_))return Promise.resolve(null)}}return this.log("Loading fragment "+E.sn+" cc: "+E.cc+" "+(g?"of ["+g.startSN+"-"+g.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+E.level+", target: "+parseFloat(_.toFixed(3))),Object(z.isFiniteNumber)(E.sn)&&!this.bitrateTest&&(this.nextLoadPosition=E.start+E.duration),this.state=x.FRAG_LOADING,this.hls.trigger(R.Events.FRAG_LOADING,{frag:E,targetBufferTime:_}),this.fragmentLoader.load(E,N).catch(function(H){return B.handleFragLoadError(H)})},o.doFragPartsLoad=function(E,g,_,N){var B=this;return new Promise(function(W,P){var I=[],H=function Y(ee){var oe=g[ee];B.fragmentLoader.loadPart(E,oe,N).then(function(Ee){I[oe.index]=Ee;var pe=Ee.part;B.hls.trigger(R.Events.FRAG_LOADED,Ee);var me=g[ee+1];if(me&&me.fragment===E)Y(ee+1);else return W({frag:E,part:pe,partsLoaded:I})}).catch(P)};H(_)})},o.handleFragLoadError=function(E){var g=E.data;return g&&g.details===C.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(g.frag,g.part):this.hls.trigger(R.Events.ERROR,g),null},o._handleTransmuxerFlush=function(E){var g=this.getCurrentContext(E);if(!g||this.state!==x.PARSING){this.fragCurrent||(this.state=x.IDLE);return}var _=g.frag,N=g.part,B=g.level,W=self.performance.now();_.stats.parsing.end=W,N&&(N.stats.parsing.end=W),this.updateLevelTiming(_,N,B,E.partial)},o.getCurrentContext=function(E){var g=this.levels,_=E.level,N=E.sn,B=E.part;if(!g||!g[_])return this.warn("Levels object was unset while buffering fragment "+N+" of level "+_+". The current chunk will not be buffered."),null;var W=g[_],P=B>-1?Object(b.getPartWith)(W,N,B):null,I=P?P.fragment:Object(b.getFragmentWithSN)(W,N,this.fragCurrent);return I?{frag:I,part:P,level:W}:null},o.bufferFragmentData=function(E,g,_,N){if(!E||this.state!==x.PARSING)return;var B=E.data1,W=E.data2,P=B;if(B&&W&&(P=Object(v.appendUint8Array)(B,W)),!P||!P.length)return;var I={type:E.type,frag:g,part:_,chunkMeta:N,parent:g.type,data:P};this.hls.trigger(R.Events.BUFFER_APPENDING,I),E.dropped&&E.independent&&!_&&this.flushBufferGap(g)},o.flushBufferGap=function(E){var g=this.media;if(!g)return;if(!F.BufferHelper.isBuffered(g,g.currentTime)){this.flushMainBuffer(0,E.start);return}var _=g.currentTime,N=F.BufferHelper.bufferInfo(g,_,0),B=E.duration,W=Math.min(this.config.maxFragLookUpTolerance*2,B*.25),P=Math.max(Math.min(E.start-W,N.end-W),_+W);E.start-P>W&&this.flushMainBuffer(P,E.start)},o.getFwdBufferInfo=function(E,g){var _=this.config,N=this.getLoadPosition();if(!Object(z.isFiniteNumber)(N))return null;var B=F.BufferHelper.bufferInfo(E,N,_.maxBufferHole);if(B.len===0&&B.nextStart!==void 0){var W=this.fragmentTracker.getBufferedFrag(N,g);if(W&&B.nextStart<W.end)return F.BufferHelper.bufferInfo(E,N,Math.max(B.nextStart,_.maxBufferHole))}return B},o.getMaxBufferLength=function(E){var g=this.config,_;return E?_=Math.max(8*g.maxBufferSize/E,g.maxBufferLength):_=g.maxBufferLength,Math.min(_,g.maxMaxBufferLength)},o.reduceMaxBufferLength=function(E){var g=this.config,_=E||g.maxBufferLength;return g.maxMaxBufferLength>=_?(g.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+g.maxMaxBufferLength+"s"),!0):!1},o.getNextFragment=function(E,g){var _,N,B=g.fragments,W=B.length;if(!W)return null;var P=this.config,I=B[0].start,H;if(g.live){var Y=P.initialLiveManifestSize;if(W<Y)return this.warn("Not enough fragments to start playback (have: "+W+", need: "+Y+")"),null;!g.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(H=this.getInitialLiveFragment(g,B),this.startPosition=H?this.hls.liveSyncPosition||H.start:E)}else E<=I&&(H=B[0]);if(!H){var ee=P.lowLatencyMode?g.partEnd:g.fragmentEnd;H=this.getFragmentAtPosition(E,ee,g)}return(_=H)!==null&&_!==void 0&&_.initSegment&&!((N=H)!==null&&N!==void 0&&N.initSegment.data)&&!this.bitrateTest&&(H=H.initSegment),H},o.getNextPart=function(E,g,_){for(var N=-1,B=!1,W=!0,P=0,I=E.length;P<I;P++){var H=E[P];if(W=W&&!H.independent,N>-1&&_<H.start)break;var Y=H.loaded;!Y&&(B||H.independent||W)&&H.fragment===g&&(N=P),B=Y}return N},o.loadedEndOfParts=function(E,g){var _=E[E.length-1];return _&&g>_.start&&_.loaded},o.getInitialLiveFragment=function(E,g){var _=this.fragPrevious,N=null;if(_){if(E.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+_.programDateTime),N=Object(S.findFragmentByPDT)(g,_.endProgramDateTime,this.config.maxFragLookUpTolerance)),!N){var B=_.sn+1;if(B>=E.startSN&&B<=E.endSN){var W=g[B-E.startSN];_.cc===W.cc&&(N=W,this.log("Live playlist, switching playlist, load frag with next SN: "+N.sn))}N||(N=Object(S.findFragWithCC)(g,_.cc),N&&this.log("Live playlist, switching playlist, load frag with same CC: "+N.sn))}}else{var P=this.hls.liveSyncPosition;P!==null&&(N=this.getFragmentAtPosition(P,this.bitrateTest?E.fragmentEnd:E.edge,E))}return N},o.getFragmentAtPosition=function(E,g,_){var N=this.config,B=this.fragPrevious,W=_.fragments,P=_.endSN,I=_.fragmentHint,H=N.maxFragLookUpTolerance,Y=!!(N.lowLatencyMode&&_.partList&&I);Y&&I&&!this.bitrateTest&&(W=W.concat(I),P=I.sn);var ee;if(E<g){var oe=E>g-H?0:H;ee=Object(S.findFragmentByPTS)(B,W,E,oe)}else ee=W[W.length-1];if(ee){var Ee=ee.sn-_.startSN,pe=B&&ee.level===B.level,me=W[Ee+1],he=this.fragmentTracker.getState(ee);if(he===O.FragmentState.BACKTRACKED){ee=null;for(var se=Ee;W[se]&&this.fragmentTracker.getState(W[se])===O.FragmentState.BACKTRACKED;)B?ee=W[se--]:ee=W[--se];ee||(ee=me)}else B&&ee.sn===B.sn&&!Y&&(pe&&(ee.sn<P&&this.fragmentTracker.getState(me)!==O.FragmentState.OK?(this.log("SN "+ee.sn+" just loaded, load next one: "+me.sn),ee=me):ee=null))}return ee},o.synchronizeToLiveEdge=function(E){var g=this.config,_=this.media;if(!_)return;var N=this.hls.liveSyncPosition,B=_.currentTime,W=E.fragments[0].start,P=E.edge,I=B>=W-g.maxFragLookUpTolerance&&B<=P;if(N!==null&&_.duration>N&&(B<N||!I)){var H=g.liveMaxLatencyDuration!==void 0?g.liveMaxLatencyDuration:g.liveMaxLatencyDurationCount*E.targetduration;(!I&&_.readyState<4||B<P-H)&&(this.loadedmetadata||(this.nextLoadPosition=N),_.readyState&&(this.warn("Playback: "+B.toFixed(3)+" is located too far from the end of live sliding playlist: "+P+", reset currentTime to : "+N.toFixed(3)),_.currentTime=N))}},o.alignPlaylists=function(E,g){var _=this.levels,N=this.levelLastLoaded,B=this.fragPrevious,W=N!==null?_[N]:null,P=E.fragments.length;if(!P)return this.warn("No fragments in live playlist"),0;var I=E.fragments[0].start,H=!g,Y=E.alignedSliding&&Object(z.isFiniteNumber)(I);if(H||!Y&&!I){Object(k.alignStream)(B,W,E);var ee=E.fragments[0].start;return this.log("Live playlist sliding: "+ee.toFixed(2)+" start-sn: "+(g?g.startSN:"na")+"->"+E.startSN+" prev-sn: "+(B?B.sn:"na")+" fragments: "+P),ee}return I},o.waitForCdnTuneIn=function(E){var g=3;return E.live&&E.canBlockReload&&E.tuneInGoal>Math.max(E.partHoldBack,E.partTarget*g)},o.setStartPosition=function(E,g){var _=this.startPosition;if(_<g&&(_=-1),_===-1||this.lastCurrentTime===-1){var N=E.startTimeOffset;Object(z.isFiniteNumber)(N)?(_=g+N,N<0&&(_+=E.totalduration),_=Math.min(Math.max(g,_),g+E.totalduration),this.log("Start time offset "+N+" found in playlist, adjust startPosition to "+_),this.startPosition=_):E.live?_=this.hls.liveSyncPosition||g:this.startPosition=_=0,this.lastCurrentTime=_}this.nextLoadPosition=_},o.getLoadPosition=function(){var E=this.media,g=0;return this.loadedmetadata&&E?g=E.currentTime:this.nextLoadPosition&&(g=this.nextLoadPosition),g},o.handleFragLoadAborted=function(E,g){this.transmuxer&&E.sn!=="initSegment"&&E.stats.aborted&&(this.warn("Fragment "+E.sn+(g?" part"+g.index:"")+" of level "+E.level+" was aborted"),this.resetFragmentLoading(E))},o.resetFragmentLoading=function(E){(!this.fragCurrent||!this.fragContextChanged(E))&&(this.state=x.IDLE)},o.onFragmentOrKeyLoadError=function(E,g){if(g.fatal)return;var _=g.frag;if(!_||_.type!==E)return;var N=this.fragCurrent;console.assert(N&&_.sn===N.sn&&_.level===N.level&&_.urlId===N.urlId,"Frag load error must match current frag to retry");var B=this.config;if(this.fragLoadError+1<=B.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(_.level))return;var W=Math.min(Math.pow(2,this.fragLoadError)*B.fragLoadingRetryDelay,B.fragLoadingMaxRetryTimeout);this.warn("Fragment "+_.sn+" of "+E+" "+_.level+" failed to load, retrying in "+W+"ms"),this.retryDate=self.performance.now()+W,this.fragLoadError++,this.state=x.FRAG_LOADING_WAITING_RETRY}else g.levelRetry?(E===s.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=x.IDLE):(M.logger.error(g.details+" reaches max retry, redispatch as fatal ..."),g.fatal=!0,this.hls.stopLoad(),this.state=x.ERROR)},o.afterBufferFlushed=function(E,g,_){if(!E)return;var N=F.BufferHelper.getBuffered(E);this.fragmentTracker.detectEvictedFragments(g,N,_),this.state===x.ENDED&&this.resetLoadingState()},o.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=x.IDLE},o.resetLiveStartWhenNotLoaded=function(E){if(!this.loadedmetadata){this.startFragRequested=!1;var g=this.levels?this.levels[E].details:null;if(g!=null&&g.live)return this.startPosition=-1,this.setStartPosition(g,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},o.updateLevelTiming=function(E,g,_,N){var B=this,W=_.details;console.assert(!!W,"level.details must be defined");var P=Object.keys(E.elementaryStreams).reduce(function(I,H){var Y=E.elementaryStreams[H];if(Y){var ee=Y.endPTS-Y.startPTS;if(ee<=0)return B.warn("Could not parse fragment "+E.sn+" "+H+" duration reliably ("+ee+") resetting transmuxer to fallback to playlist timing"),B.resetTransmuxer(),I||!1;var oe=N?0:Object(b.updateFragPTSDTS)(W,E,Y.startPTS,Y.endPTS,Y.startDTS,Y.endDTS);return B.hls.trigger(R.Events.LEVEL_PTS_UPDATED,{details:W,level:_,drift:oe,type:H,frag:E,start:Y.startPTS,end:Y.endPTS}),!0}return I},!1);P?(this.state=x.PARSED,this.hls.trigger(R.Events.FRAG_PARSED,{frag:E,part:g})):this.resetLoadingState()},o.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},A(d,[{key:"state",get:function(){return this._state},set:function(E){var g=this._state;g!==E&&(this._state=E,this.log(g+"->"+E))}}]),d}(U.default)},"./src/controller/buffer-controller.ts":function(q,G,D){"use strict";D.r(G),D.d(G,"default",function(){return S});var z=D("./src/polyfills/number.ts"),U=D("./src/events.ts"),O=D("./src/utils/logger.ts"),F=D("./src/errors.ts"),M=D("./src/utils/buffer-helper.ts"),R=D("./src/utils/mediasource-helper.ts"),C=D("./src/loader/fragment.ts"),m=D("./src/controller/buffer-operation-queue.ts"),v=Object(R.getMediaSource)(),k=/([ha]vc.)(?:\.[^.,]+)+/,S=function(){function b(u){var a=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var s=a.hls,l=a.media,A=a.mediaSource;O.logger.log("[buffer-controller]: Media source opened"),l&&(a.updateMediaElementDuration(),s.trigger(U.Events.MEDIA_ATTACHED,{media:l})),A&&A.removeEventListener("sourceopen",a._onMediaSourceOpen),a.checkPendingTracks()},this._onMediaSourceClose=function(){O.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){O.logger.log("[buffer-controller]: Media source ended")},this.hls=u,this._initSourceBuffer(),this.registerListeners()}var f=b.prototype;return f.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},f.destroy=function(){this.unregisterListeners(),this.details=null},f.registerListeners=function(){var a=this.hls;a.on(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),a.on(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.on(U.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.on(U.Events.BUFFER_RESET,this.onBufferReset,this),a.on(U.Events.BUFFER_APPENDING,this.onBufferAppending,this),a.on(U.Events.BUFFER_CODECS,this.onBufferCodecs,this),a.on(U.Events.BUFFER_EOS,this.onBufferEos,this),a.on(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),a.on(U.Events.LEVEL_UPDATED,this.onLevelUpdated,this),a.on(U.Events.FRAG_PARSED,this.onFragParsed,this),a.on(U.Events.FRAG_CHANGED,this.onFragChanged,this)},f.unregisterListeners=function(){var a=this.hls;a.off(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),a.off(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.off(U.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.off(U.Events.BUFFER_RESET,this.onBufferReset,this),a.off(U.Events.BUFFER_APPENDING,this.onBufferAppending,this),a.off(U.Events.BUFFER_CODECS,this.onBufferCodecs,this),a.off(U.Events.BUFFER_EOS,this.onBufferEos,this),a.off(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),a.off(U.Events.LEVEL_UPDATED,this.onLevelUpdated,this),a.off(U.Events.FRAG_PARSED,this.onFragParsed,this),a.off(U.Events.FRAG_CHANGED,this.onFragChanged,this)},f._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new m.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},f.onManifestParsed=function(a,s){var l=2;(s.audio&&!s.video||!s.altAudio)&&(l=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=l,this.details=null,O.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},f.onMediaAttaching=function(a,s){var l=this.media=s.media;if(l&&v){var A=this.mediaSource=new v;A.addEventListener("sourceopen",this._onMediaSourceOpen),A.addEventListener("sourceended",this._onMediaSourceEnded),A.addEventListener("sourceclose",this._onMediaSourceClose),l.src=self.URL.createObjectURL(A),this._objectUrl=l.src}},f.onMediaDetaching=function(){var a=this.media,s=this.mediaSource,l=this._objectUrl;if(s){if(O.logger.log("[buffer-controller]: media source detaching"),s.readyState==="open")try{s.endOfStream()}catch(A){O.logger.warn("[buffer-controller]: onMediaDetaching: "+A.message+" while calling endOfStream")}this.onBufferReset(),s.removeEventListener("sourceopen",this._onMediaSourceOpen),s.removeEventListener("sourceended",this._onMediaSourceEnded),s.removeEventListener("sourceclose",this._onMediaSourceClose),a&&(l&&self.URL.revokeObjectURL(l),a.src===l?(a.removeAttribute("src"),a.load()):O.logger.warn("[buffer-controller]: media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(U.Events.MEDIA_DETACHED,void 0)},f.onBufferReset=function(){var a=this;this.getSourceBufferTypes().forEach(function(s){var l=a.sourceBuffer[s];try{l&&(a.removeBufferListeners(s),a.mediaSource&&a.mediaSource.removeSourceBuffer(l),a.sourceBuffer[s]=void 0)}catch(A){O.logger.warn("[buffer-controller]: Failed to reset the "+s+" buffer",A)}}),this._initSourceBuffer()},f.onBufferCodecs=function(a,s){var l=this,A=this.getSourceBufferTypes().length;if(Object.keys(s).forEach(function(y){if(A){var c=l.tracks[y];if(c&&typeof c.buffer.changeType=="function"){var L=s[y],x=L.codec,h=L.levelCodec,p=L.container,d=(c.levelCodec||c.codec).replace(k,"$1"),o=(h||x).replace(k,"$1");if(d!==o){var T=p+";codecs="+(h||x);l.appendChangeType(y,T)}}}else l.pendingTracks[y]=s[y]}),A)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},f.appendChangeType=function(a,s){var l=this,A=this.operationQueue,y={execute:function(){var L=l.sourceBuffer[a];L&&(O.logger.log("[buffer-controller]: changing "+a+" sourceBuffer type to "+s),L.changeType(s)),A.shiftAndExecuteNext(a)},onStart:function(){},onComplete:function(){},onError:function(L){O.logger.warn("[buffer-controller]: Failed to change "+a+" SourceBuffer type",L)}};A.append(y,a)},f.onBufferAppending=function(a,s){var l=this,A=this.hls,y=this.operationQueue,c=this.tracks,L=s.data,x=s.type,h=s.frag,p=s.part,d=s.chunkMeta,o=d.buffering[x],T=self.performance.now();o.start=T;var E=h.stats.buffering,g=p?p.stats.buffering:null;E.start===0&&(E.start=T),g&&g.start===0&&(g.start=T);var _=c.audio,N=x==="audio"&&d.id===1&&(_==null?void 0:_.container)==="audio/mpeg",B={execute:function(){if(o.executeStart=self.performance.now(),N){var P=l.sourceBuffer[x];if(P){var I=h.start-P.timestampOffset;Math.abs(I)>=.1&&(O.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+h.start+" (delta: "+I+") sn: "+h.sn+")"),P.timestampOffset=h.start)}}l.appendExecutor(L,x)},onStart:function(){},onComplete:function(){var P=self.performance.now();o.executeEnd=o.end=P,E.first===0&&(E.first=P),g&&g.first===0&&(g.first=P);var I=l.sourceBuffer,H={};for(var Y in I)H[Y]=M.BufferHelper.getBuffered(I[Y]);l.appendError=0,l.hls.trigger(U.Events.BUFFER_APPENDED,{type:x,frag:h,part:p,chunkMeta:d,parent:h.type,timeRanges:H})},onError:function(P){O.logger.error("[buffer-controller]: Error encountered while trying to append to the "+x+" SourceBuffer",P);var I={type:F.ErrorTypes.MEDIA_ERROR,parent:h.type,details:F.ErrorDetails.BUFFER_APPEND_ERROR,err:P,fatal:!1};P.code===DOMException.QUOTA_EXCEEDED_ERR?I.details=F.ErrorDetails.BUFFER_FULL_ERROR:(l.appendError++,I.details=F.ErrorDetails.BUFFER_APPEND_ERROR,l.appendError>A.config.appendErrorMaxRetry&&(O.logger.error("[buffer-controller]: Failed "+A.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),I.fatal=!0)),A.trigger(U.Events.ERROR,I)}};y.append(B,x)},f.onBufferFlushing=function(a,s){var l=this,A=this.operationQueue,y=function(L){return{execute:l.removeExecutor.bind(l,L,s.startOffset,s.endOffset),onStart:function(){},onComplete:function(){l.hls.trigger(U.Events.BUFFER_FLUSHED,{type:L})},onError:function(h){O.logger.warn("[buffer-controller]: Failed to remove from "+L+" SourceBuffer",h)}}};s.type?A.append(y(s.type),s.type):this.getSourceBufferTypes().forEach(function(c){A.append(y(c),c)})},f.onFragParsed=function(a,s){var l=this,A=s.frag,y=s.part,c=[],L=y?y.elementaryStreams:A.elementaryStreams;L[C.ElementaryStreamTypes.AUDIOVIDEO]?c.push("audiovideo"):(L[C.ElementaryStreamTypes.AUDIO]&&c.push("audio"),L[C.ElementaryStreamTypes.VIDEO]&&c.push("video"));var x=function(){var p=self.performance.now();A.stats.buffering.end=p,y&&(y.stats.buffering.end=p);var d=y?y.stats:A.stats;l.hls.trigger(U.Events.FRAG_BUFFERED,{frag:A,part:y,stats:d,id:A.type})};c.length===0&&O.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+A.type+" level: "+A.level+" sn: "+A.sn),this.blockBuffers(x,c)},f.onFragChanged=function(a,s){this.flushBackBuffer()},f.onBufferEos=function(a,s){var l=this,A=this.getSourceBufferTypes().reduce(function(y,c){var L=l.sourceBuffer[c];return(!s.type||s.type===c)&&(L&&!L.ended&&(L.ended=!0,O.logger.log("[buffer-controller]: "+c+" sourceBuffer now EOS"))),y&&!!(!L||L.ended)},!0);A&&this.blockBuffers(function(){var y=l.mediaSource;if(!y||y.readyState!=="open")return;y.endOfStream()})},f.onLevelUpdated=function(a,s){var l=s.details;if(!l.fragments.length)return;this.details=l,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},f.flushBackBuffer=function(){var a=this.hls,s=this.details,l=this.media,A=this.sourceBuffer;if(!l||s===null)return;var y=this.getSourceBufferTypes();if(!y.length)return;var c=s.live&&a.config.liveBackBufferLength!==null?a.config.liveBackBufferLength:a.config.backBufferLength;if(!Object(z.isFiniteNumber)(c)||c<0)return;var L=l.currentTime,x=s.levelTargetDuration,h=Math.max(c,x),p=Math.floor(L/x)*x-h;y.forEach(function(d){var o=A[d];if(o){var T=M.BufferHelper.getBuffered(o);T.length>0&&p>T.start(0)&&(a.trigger(U.Events.BACK_BUFFER_REACHED,{bufferEnd:p}),s.live&&a.trigger(U.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:p}),a.trigger(U.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:p,type:d}))}})},f.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var a=this.details,s=this.hls,l=this.media,A=this.mediaSource,y=a.fragments[0].start+a.totalduration,c=l.duration,L=Object(z.isFiniteNumber)(A.duration)?A.duration:0;a.live&&s.config.liveDurationInfinity?(O.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),A.duration=Infinity,this.updateSeekableRange(a)):(y>L&&y>c||!Object(z.isFiniteNumber)(c))&&(O.logger.log("[buffer-controller]: Updating Media Source duration to "+y.toFixed(3)),A.duration=y)},f.updateSeekableRange=function(a){var s=this.mediaSource,l=a.fragments,A=l.length;if(A&&a.live&&s!==null&&s!==void 0&&s.setLiveSeekableRange){var y=Math.max(0,l[0].start),c=Math.max(y,y+a.totalduration);s.setLiveSeekableRange(y,c)}},f.checkPendingTracks=function(){var a=this.bufferCodecEventsExpected,s=this.operationQueue,l=this.pendingTracks,A=Object.keys(l).length;if(A&&!a||A===2){this.createSourceBuffers(l),this.pendingTracks={};var y=this.getSourceBufferTypes();if(y.length===0){this.hls.trigger(U.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}y.forEach(function(c){s.executeNext(c)})}},f.createSourceBuffers=function(a){var s=this.sourceBuffer,l=this.mediaSource;if(!l)throw Error("createSourceBuffers called when mediaSource was null");var A=0;for(var y in a)if(!s[y]){var c=a[y];if(!c)throw Error("source buffer exists for track "+y+", however track does not");var L=c.levelCodec||c.codec,x=c.container+";codecs="+L;O.logger.log("[buffer-controller]: creating sourceBuffer("+x+")");try{var h=s[y]=l.addSourceBuffer(x),p=y;this.addBufferListener(p,"updatestart",this._onSBUpdateStart),this.addBufferListener(p,"updateend",this._onSBUpdateEnd),this.addBufferListener(p,"error",this._onSBUpdateError),this.tracks[y]={buffer:h,codec:L,container:c.container,levelCodec:c.levelCodec,id:c.id},A++}catch(d){O.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+d.message),this.hls.trigger(U.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:d,mimeType:x})}}A&&this.hls.trigger(U.Events.BUFFER_CREATED,{tracks:this.tracks})},f._onSBUpdateStart=function(a){var s=this.operationQueue,l=s.current(a);l.onStart()},f._onSBUpdateEnd=function(a){var s=this.operationQueue,l=s.current(a);l.onComplete(),s.shiftAndExecuteNext(a)},f._onSBUpdateError=function(a,s){O.logger.error("[buffer-controller]: "+a+" SourceBuffer error",s),this.hls.trigger(U.Events.ERROR,{type:F.ErrorTypes.MEDIA_ERROR,details:F.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var l=this.operationQueue.current(a);l&&l.onError(s)},f.removeExecutor=function(a,s,l){var A=this.media,y=this.mediaSource,c=this.operationQueue,L=this.sourceBuffer,x=L[a];if(!A||!y||!x){O.logger.warn("[buffer-controller]: Attempting to remove from the "+a+" SourceBuffer, but it does not exist"),c.shiftAndExecuteNext(a);return}var h=Object(z.isFiniteNumber)(A.duration)?A.duration:Infinity,p=Object(z.isFiniteNumber)(y.duration)?y.duration:Infinity,d=Math.max(0,s),o=Math.min(l,h,p);o>d?(O.logger.log("[buffer-controller]: Removing ["+d+","+o+"] from the "+a+" SourceBuffer"),console.assert(!x.updating,a+" sourceBuffer must not be updating"),x.remove(d,o)):c.shiftAndExecuteNext(a)},f.appendExecutor=function(a,s){var l=this.operationQueue,A=this.sourceBuffer,y=A[s];if(!y){O.logger.warn("[buffer-controller]: Attempting to append to the "+s+" SourceBuffer, but it does not exist"),l.shiftAndExecuteNext(s);return}y.ended=!1,console.assert(!y.updating,s+" sourceBuffer must not be updating"),y.appendBuffer(a)},f.blockBuffers=function(a,s){var l=this;if(s===void 0&&(s=this.getSourceBufferTypes()),!s.length){O.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(a);return}var A=this.operationQueue,y=s.map(function(c){return A.appendBlocker(c)});Promise.all(y).then(function(){a(),s.forEach(function(c){var L=l.sourceBuffer[c];(!L||!L.updating)&&A.shiftAndExecuteNext(c)})})},f.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},f.addBufferListener=function(a,s,l){var A=this.sourceBuffer[a];if(!A)return;var y=l.bind(this,a);this.listeners[a].push({event:s,listener:y}),A.addEventListener(s,y)},f.removeBufferListeners=function(a){var s=this.sourceBuffer[a];if(!s)return;this.listeners[a].forEach(function(l){s.removeEventListener(l.event,l.listener)})},b}()},"./src/controller/buffer-operation-queue.ts":function(q,G,D){"use strict";D.r(G),D.d(G,"default",function(){return U});var z=D("./src/utils/logger.ts"),U=function(){function O(M){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=M}var F=O.prototype;return F.append=function(R,C){var m=this.queues[C];m.push(R),m.length===1&&this.buffers[C]&&this.executeNext(C)},F.insertAbort=function(R,C){var m=this.queues[C];m.unshift(R),this.executeNext(C)},F.appendBlocker=function(R){var C,m=new Promise(function(k){C=k}),v={execute:C,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(v,R),m},F.executeNext=function(R){var C=this.buffers,m=this.queues,v=C[R],k=m[R];if(k.length){var S=k[0];try{S.execute()}catch(b){z.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),S.onError(b),(!v||!v.updating)&&(k.shift(),this.executeNext(R))}}},F.shiftAndExecuteNext=function(R){this.queues[R].shift(),this.executeNext(R)},F.current=function(R){return this.queues[R][0]},O}()},"./src/controller/cap-level-controller.ts":function(q,G,D){"use strict";D.r(G);var z=D("./src/events.ts");function U(M,R){for(var C=0;C<R.length;C++){var m=R[C];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(M,m.key,m)}}function O(M,R,C){return R&&U(M.prototype,R),C&&U(M,C),M}var F=function(){function M(C){this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.hls=void 0,this.streamController=void 0,this.clientRect=void 0,this.hls=C,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var R=M.prototype;return R.setStreamController=function(m){this.streamController=m},R.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},R.registerListeners=function(){var m=this.hls;m.on(z.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),m.on(z.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),m.on(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),m.on(z.Events.BUFFER_CODECS,this.onBufferCodecs,this),m.on(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},R.unregisterListener=function(){var m=this.hls;m.off(z.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),m.off(z.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),m.off(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),m.off(z.Events.BUFFER_CODECS,this.onBufferCodecs,this),m.off(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},R.onFpsDropLevelCapping=function(m,v){M.isLevelAllowed(v.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(v.droppedLevel)},R.onMediaAttaching=function(m,v){this.media=v.media instanceof HTMLVideoElement?v.media:null},R.onManifestParsed=function(m,v){var k=this.hls;this.restrictedLevels=[],this.firstLevel=v.firstLevel,k.config.capLevelToPlayerSize&&v.video&&this.startCapping()},R.onBufferCodecs=function(m,v){var k=this.hls;k.config.capLevelToPlayerSize&&v.video&&this.startCapping()},R.onMediaDetaching=function(){this.stopCapping()},R.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var m=this.hls.levels;if(m.length){var v=this.hls;v.autoLevelCapping=this.getMaxLevel(m.length-1),v.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=v.autoLevelCapping}}},R.getMaxLevel=function(m){var v=this,k=this.hls.levels;if(!k.length)return-1;var S=k.filter(function(b,f){return M.isLevelAllowed(f,v.restrictedLevels)&&f<=m});return this.clientRect=null,M.getMaxLevelByMediaSize(S,this.mediaWidth,this.mediaHeight)},R.startCapping=function(){if(this.timer)return;this.autoLevelCapping=Number.POSITIVE_INFINITY,this.hls.firstLevel=this.getMaxLevel(this.firstLevel),self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize()},R.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},R.getDimensions=function(){if(this.clientRect)return this.clientRect;var m=this.media,v={width:0,height:0};if(m){var k=m.getBoundingClientRect();v.width=k.width,v.height=k.height,!v.width&&!v.height&&(v.width=k.right-k.left||m.width||0,v.height=k.bottom-k.top||m.height||0)}return this.clientRect=v,v},M.isLevelAllowed=function(m,v){return v===void 0&&(v=[]),v.indexOf(m)===-1},M.getMaxLevelByMediaSize=function(m,v,k){if(!m||!m.length)return-1;for(var S=function(s,l){return l?s.width!==l.width||s.height!==l.height:!0},b=m.length-1,f=0;f<m.length;f+=1){var u=m[f];if((u.width>=v||u.height>=k)&&S(u,m[f+1])){b=f;break}}return b},O(M,[{key:"mediaWidth",get:function(){return this.getDimensions().width*M.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*M.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var m=1;try{m=self.devicePixelRatio}catch(v){}return m}}]),M}();G.default=F},"./src/controller/cmcd-controller.ts":function(q,G,D){"use strict";D.r(G),D.d(G,"default",function(){return S});var z=D("./src/events.ts"),U=D("./src/types/cmcd.ts"),O=D("./src/utils/buffer-helper.ts"),F=D("./src/utils/logger.ts");function M(b,f){for(var u=0;u<f.length;u++){var a=f[u];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(b,a.key,a)}}function R(b,f,u){return f&&M(b.prototype,f),u&&M(b,u),b}function C(b,f){var u=typeof Symbol!="undefined"&&b[Symbol.iterator]||b["@@iterator"];if(u)return(u=u.call(b)).next.bind(u);if(Array.isArray(b)||(u=m(b))||f&&b&&typeof b.length=="number"){u&&(b=u);var a=0;return function(){return a>=b.length?{done:!0}:{done:!1,value:b[a++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function m(b,f){if(!b)return;if(typeof b=="string")return v(b,f);var u=Object.prototype.toString.call(b).slice(8,-1);if(u==="Object"&&b.constructor&&(u=b.constructor.name),u==="Map"||u==="Set")return Array.from(b);if(u==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(u))return v(b,f)}function v(b,f){(f==null||f>b.length)&&(f=b.length);for(var u=0,a=new Array(f);u<f;u++)a[u]=b[u];return a}function k(){return k=Object.assign||function(b){for(var f=1;f<arguments.length;f++){var u=arguments[f];for(var a in u)Object.prototype.hasOwnProperty.call(u,a)&&(b[a]=u[a])}return b},k.apply(this,arguments)}var S=function(){function b(u){var a=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){a.initialized&&(a.starved=!0),a.buffering=!0},this.onPlaying=function(){a.initialized||(a.initialized=!0),a.buffering=!1},this.applyPlaylistData=function(A){try{a.apply(A,{ot:U.CMCDObjectType.MANIFEST,su:!a.initialized})}catch(y){F.logger.warn("Could not generate manifest CMCD data.",y)}},this.applyFragmentData=function(A){try{var y=A.frag,c=a.hls.levels[y.level],L=a.getObjectType(y),x={d:y.duration*1e3,ot:L};(L===U.CMCDObjectType.VIDEO||L===U.CMCDObjectType.AUDIO||L==U.CMCDObjectType.MUXED)&&(x.br=c.bitrate/1e3,x.tb=a.getTopBandwidth(L),x.bl=a.getBufferLength(L)),a.apply(A,x)}catch(h){F.logger.warn("Could not generate segment CMCD data.",h)}},this.hls=u;var s=this.config=u.config,l=s.cmcd;l!=null&&(s.pLoader=this.createPlaylistLoader(),s.fLoader=this.createFragmentLoader(),this.sid=l.sessionId||b.uuid(),this.cid=l.contentId,this.useHeaders=l.useHeaders===!0,this.registerListeners())}var f=b.prototype;return f.registerListeners=function(){var a=this.hls;a.on(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.on(z.Events.MEDIA_DETACHED,this.onMediaDetached,this),a.on(z.Events.BUFFER_CREATED,this.onBufferCreated,this)},f.unregisterListeners=function(){var a=this.hls;a.off(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.off(z.Events.MEDIA_DETACHED,this.onMediaDetached,this),a.off(z.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},f.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},f.onMediaAttached=function(a,s){this.media=s.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},f.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},f.onBufferCreated=function(a,s){var l,A;this.audioBuffer=(l=s.tracks.audio)===null||l===void 0?void 0:l.buffer,this.videoBuffer=(A=s.tracks.video)===null||A===void 0?void 0:A.buffer},f.createData=function(){var a;return{v:U.CMCDVersion,sf:U.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(a=this.media)===null||a===void 0?void 0:a.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},f.apply=function(a,s){s===void 0&&(s={}),k(s,this.createData());var l=s.ot===U.CMCDObjectType.INIT||s.ot===U.CMCDObjectType.VIDEO||s.ot===U.CMCDObjectType.MUXED;if(this.starved&&l&&(s.bs=!0,s.su=!0,this.starved=!1),s.su==null&&(s.su=this.buffering),this.useHeaders){var A=b.toHeaders(s);if(!Object.keys(A).length)return;a.headers||(a.headers={}),k(a.headers,A)}else{var y=b.toQuery(s);if(!y)return;a.url=b.appendQueryToUri(a.url,y)}},f.getObjectType=function(a){var s=a.type;return s==="subtitle"?U.CMCDObjectType.TIMED_TEXT:a.sn==="initSegment"?U.CMCDObjectType.INIT:s==="audio"?U.CMCDObjectType.AUDIO:s==="main"?this.hls.audioTracks.length?U.CMCDObjectType.VIDEO:U.CMCDObjectType.MUXED:void 0},f.getTopBandwidth=function(a){for(var s=0,l=a===U.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,A=C(l),y;!(y=A()).done;){var c=y.value;c.bitrate>s&&(s=c.bitrate)}return s>0?s:NaN},f.getBufferLength=function(a){var s=this.hls.media,l=a===U.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!l||!s)return NaN;var A=O.BufferHelper.bufferInfo(l,s.currentTime,this.config.maxBufferHole);return A.len*1e3},f.createPlaylistLoader=function(){var a=this.config.pLoader,s=this.applyPlaylistData,l=a||this.config.loader;return function(){function A(c){this.loader=void 0,this.loader=new l(c)}var y=A.prototype;return y.destroy=function(){this.loader.destroy()},y.abort=function(){this.loader.abort()},y.load=function(L,x,h){s(L),this.loader.load(L,x,h)},R(A,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),A}()},f.createFragmentLoader=function(){var a=this.config.fLoader,s=this.applyFragmentData,l=a||this.config.loader;return function(){function A(c){this.loader=void 0,this.loader=new l(c)}var y=A.prototype;return y.destroy=function(){this.loader.destroy()},y.abort=function(){this.loader.abort()},y.load=function(L,x,h){s(L),this.loader.load(L,x,h)},R(A,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),A}()},b.uuid=function(){var a=URL.createObjectURL(new Blob),s=a.toString();return URL.revokeObjectURL(a),s.substr(s.lastIndexOf("/")+1)},b.serialize=function(a){for(var s=[],l=function(N){return!Number.isNaN(N)&&N!=null&&N!==""&&N!==!1},A=function(N){return Math.round(N)},y=function(N){return A(N/100)*100},c=function(N){return encodeURIComponent(N)},L={br:A,d:A,bl:y,dl:y,mtp:y,nor:c,rtp:y,tb:A},x=Object.keys(a||{}).sort(),h=C(x),p;!(p=h()).done;){var d=p.value,o=a[d];if(!l(o))continue;if(d==="v"&&o===1)continue;if(d=="pr"&&o===1)continue;var T=L[d];T&&(o=T(o));var E=typeof o,g=void 0;d==="ot"||d==="sf"||d==="st"?g=d+"="+o:E==="boolean"?g=d:E==="number"?g=d+"="+o:g=d+"="+JSON.stringify(o),s.push(g)}return s.join(",")},b.toHeaders=function(a){for(var s=Object.keys(a),l={},A=["Object","Request","Session","Status"],y=[{},{},{},{}],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},L=0,x=s;L<x.length;L++){var h=x[L],p=c[h]!=null?c[h]:1;y[p][h]=a[h]}for(var d=0;d<y.length;d++){var o=b.serialize(y[d]);o&&(l["CMCD-"+A[d]]=o)}return l},b.toQuery=function(a){return"CMCD="+encodeURIComponent(b.serialize(a))},b.appendQueryToUri=function(a,s){if(!s)return a;var l=a.includes("?")?"&":"?";return""+a+l+s},b}()},"./src/controller/eme-controller.ts":function(q,G,D){"use strict";D.r(G);var z=D("./src/events.ts"),U=D("./src/errors.ts"),O=D("./src/utils/logger.ts"),F=D("./src/utils/mediakeys-helper.ts");function M(S,b){for(var f=0;f<b.length;f++){var u=b[f];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(S,u.key,u)}}function R(S,b,f){return b&&M(S.prototype,b),f&&M(S,f),S}var C=3,m=function(b,f,u){var a={audioCapabilities:[],videoCapabilities:[]};return b.forEach(function(s){a.audioCapabilities.push({contentType:'audio/mp4; codecs="'+s+'"',robustness:u.audioRobustness||""})}),f.forEach(function(s){a.videoCapabilities.push({contentType:'video/mp4; codecs="'+s+'"',robustness:u.videoRobustness||""})}),[a]},v=function(b,f,u,a){switch(b){case F.KeySystems.WIDEVINE:return m(f,u,a);default:throw new Error("Unknown key-system: "+b)}},k=function(){function S(f){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=f,this._config=f.config,this._widevineLicenseUrl=this._config.widevineLicenseUrl,this._licenseXhrSetup=this._config.licenseXhrSetup,this._licenseResponseCallback=this._config.licenseResponseCallback,this._emeEnabled=this._config.emeEnabled,this._requestMediaKeySystemAccess=this._config.requestMediaKeySystemAccessFunc,this._drmSystemOptions=this._config.drmSystemOptions,this._registerListeners()}var b=S.prototype;return b.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},b._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)},b._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)},b.getLicenseServerUrl=function(u){switch(u){case F.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+u+'"')},b._attemptKeySystemAccess=function(u,a,s){var l=this,A=v(u,a,s,this._drmSystemOptions);O.logger.log("Requesting encrypted media key-system access");var y=this.requestMediaKeySystemAccess(u,A);this.mediaKeysPromise=y.then(function(c){return l._onMediaKeySystemAccessObtained(u,c)}),y.catch(function(c){O.logger.error('Failed to obtain key-system "'+u+'" access:',c)})},b._onMediaKeySystemAccessObtained=function(u,a){var s=this;O.logger.log('Access for key-system "'+u+'" obtained');var l={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:a,mediaKeySystemDomain:u};this._mediaKeysList.push(l);var A=Promise.resolve().then(function(){return a.createMediaKeys()}).then(function(y){return l.mediaKeys=y,O.logger.log('Media-keys created for key-system "'+u+'"'),s._onMediaKeysCreated(),y});return A.catch(function(y){O.logger.error("Failed to create media-keys:",y)}),A},b._onMediaKeysCreated=function(){var u=this;this._mediaKeysList.forEach(function(a){a.mediaKeysSession||(a.mediaKeysSession=a.mediaKeys.createSession(),u._onNewMediaKeySession(a.mediaKeysSession))})},b._onNewMediaKeySession=function(u){var a=this;O.logger.log("New key-system session "+u.sessionId),u.addEventListener("message",function(s){a._onKeySessionMessage(u,s.message)},!1)},b._onKeySessionMessage=function(u,a){O.logger.log("Got EME message event, creating license request"),this._requestLicense(a,function(s){O.logger.log("Received license data (length: "+(s&&s.byteLength)+"), updating key-session"),u.update(s)})},b.onMediaEncrypted=function(u){var a=this;if(O.logger.log('Media is encrypted using "'+u.initDataType+'" init data type'),!this.mediaKeysPromise){O.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(z.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var s=function(A){if(!a._media)return;a._attemptSetMediaKeys(A),a._generateRequestWithPreferredKeySession(u.initDataType,u.initData)};this.mediaKeysPromise.then(s).catch(s)},b._attemptSetMediaKeys=function(u){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var a=this._mediaKeysList[0];if(!a||!a.mediaKeys){O.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(z.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}O.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(a.mediaKeys),this._hasSetMediaKeys=!0}},b._generateRequestWithPreferredKeySession=function(u,a){var s=this,l=this._mediaKeysList[0];if(!l){O.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(z.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(l.mediaKeysSessionInitialized){O.logger.warn("Key-Session already initialized but requested again");return}var A=l.mediaKeysSession;if(!A){O.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(z.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!a){O.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(z.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}O.logger.log('Generating key-session request for "'+u+'" init data type'),l.mediaKeysSessionInitialized=!0,A.generateRequest(u,a).then(function(){O.logger.debug("Key-session generation succeeded")}).catch(function(y){O.logger.error("Error generating key-session request:",y),s.hls.trigger(z.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},b._createLicenseXhr=function(u,a,s){var l=new XMLHttpRequest;l.responseType="arraybuffer",l.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,l,u,a,s);var A=this._licenseXhrSetup;if(A)try{A.call(this.hls,l,u),A=void 0}catch(y){O.logger.error(y)}try{l.readyState||l.open("POST",u,!0),A&&A.call(this.hls,l,u)}catch(y){throw new Error("issue setting up KeySystem license XHR "+y)}return l},b._onLicenseRequestReadyStageChange=function(u,a,s,l){switch(u.readyState){case 4:if(u.status===200){this._requestLicenseFailureCount=0,O.logger.log("License request succeeded");var A=u.response,y=this._licenseResponseCallback;if(y)try{A=y.call(this.hls,u,a)}catch(L){O.logger.error(L)}l(A)}else{if(O.logger.error("License Request XHR failed ("+a+"). Status: "+u.status+" ("+u.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>C){this.hls.trigger(z.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var c=C-this._requestLicenseFailureCount+1;O.logger.warn("Retrying license request, "+c+" attempts left"),this._requestLicense(s,l)}break}},b._generateLicenseRequestChallenge=function(u,a){switch(u.mediaKeySystemDomain){case F.KeySystems.WIDEVINE:return a}throw new Error("unsupported key-system: "+u.mediaKeySystemDomain)},b._requestLicense=function(u,a){O.logger.log("Requesting content license for key-system");var s=this._mediaKeysList[0];if(!s){O.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(z.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var l=this.getLicenseServerUrl(s.mediaKeySystemDomain),A=this._createLicenseXhr(l,u,a);O.logger.log("Sending license request to URL: "+l);var y=this._generateLicenseRequestChallenge(s,u);A.send(y)}catch(c){O.logger.error("Failure requesting DRM license: "+c),this.hls.trigger(z.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},b.onMediaAttached=function(u,a){if(!this._emeEnabled)return;var s=a.media;this._media=s,s.addEventListener("encrypted",this._onMediaEncrypted)},b.onMediaDetached=function(){var u=this._media,a=this._mediaKeysList;if(!u)return;u.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(a.map(function(s){if(s.mediaKeysSession)return s.mediaKeysSession.close().catch(function(){})})).then(function(){return u.setMediaKeys(null)}).catch(function(){})},b.onManifestParsed=function(u,a){if(!this._emeEnabled)return;var s=a.levels.map(function(A){return A.audioCodec}).filter(function(A){return!!A}),l=a.levels.map(function(A){return A.videoCodec}).filter(function(A){return!!A});this._attemptKeySystemAccess(F.KeySystems.WIDEVINE,s,l)},R(S,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),S}();G.default=k},"./src/controller/fps-controller.ts":function(q,G,D){"use strict";D.r(G);var z=D("./src/events.ts"),U=D("./src/utils/logger.ts"),O=function(){function F(R){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=R,this.registerListeners()}var M=F.prototype;return M.setStreamController=function(C){this.streamController=C},M.registerListeners=function(){this.hls.on(z.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},M.unregisterListeners=function(){this.hls.off(z.Events.MEDIA_ATTACHING,this.onMediaAttaching)},M.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},M.onMediaAttaching=function(C,m){var v=this.hls.config;if(v.capLevelOnFPSDrop){var k=m.media instanceof self.HTMLVideoElement?m.media:null;this.media=k,k&&typeof k.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),v.fpsDroppedMonitoringPeriod)}},M.checkFPS=function(C,m,v){var k=performance.now();if(m){if(this.lastTime){var S=k-this.lastTime,b=v-this.lastDroppedFrames,f=m-this.lastDecodedFrames,u=1e3*b/S,a=this.hls;if(a.trigger(z.Events.FPS_DROP,{currentDropped:b,currentDecoded:f,totalDroppedFrames:v}),u>0&&b>a.config.fpsDroppedMonitoringThreshold*f){var s=a.currentLevel;U.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+s),s>0&&(a.autoLevelCapping===-1||a.autoLevelCapping>=s)&&(s=s-1,a.trigger(z.Events.FPS_DROP_LEVEL_CAPPING,{level:s,droppedLevel:a.currentLevel}),a.autoLevelCapping=s,this.streamController.nextLevelSwitch())}}this.lastTime=k,this.lastDroppedFrames=v,this.lastDecodedFrames=m}},M.checkFPSInterval=function(){var C=this.media;if(C)if(this.isVideoPlaybackQualityAvailable){var m=C.getVideoPlaybackQuality();this.checkFPS(C,m.totalVideoFrames,m.droppedVideoFrames)}else this.checkFPS(C,C.webkitDecodedFrameCount,C.webkitDroppedFrameCount)},F}();G.default=O},"./src/controller/fragment-finders.ts":function(q,G,D){"use strict";D.r(G),D.d(G,"findFragmentByPDT",function(){return O}),D.d(G,"findFragmentByPTS",function(){return F}),D.d(G,"fragmentWithinToleranceTest",function(){return M}),D.d(G,"pdtWithinToleranceTest",function(){return R}),D.d(G,"findFragWithCC",function(){return C});var z=D("./src/polyfills/number.ts"),U=D("./src/utils/binary-search.ts");function O(m,v,k){if(v===null||!Array.isArray(m)||!m.length||!Object(z.isFiniteNumber)(v))return null;var S=m[0].programDateTime;if(v<(S||0))return null;var b=m[m.length-1].endProgramDateTime;if(v>=(b||0))return null;k=k||0;for(var f=0;f<m.length;++f){var u=m[f];if(R(v,k,u))return u}return null}function F(m,v,k,S){k===void 0&&(k=0),S===void 0&&(S=0);var b=null;if(m?b=v[m.sn-v[0].sn+1]||null:k===0&&v[0].start===0&&(b=v[0]),b&&M(k,S,b)===0)return b;var f=U.default.search(v,M.bind(null,k,S));return f||b}function M(m,v,k){m===void 0&&(m=0),v===void 0&&(v=0);var S=Math.min(v,k.duration+(k.deltaPTS?k.deltaPTS:0));return k.start+k.duration-S<=m?1:k.start-S>m&&k.start?-1:0}function R(m,v,k){var S=Math.min(v,k.duration+(k.deltaPTS?k.deltaPTS:0))*1e3,b=k.endProgramDateTime||0;return b-S>m}function C(m,v){return U.default.search(m,function(k){return k.cc<v?1:k.cc>v?-1:0})}},"./src/controller/fragment-tracker.ts":function(q,G,D){"use strict";D.r(G),D.d(G,"FragmentState",function(){return O}),D.d(G,"FragmentTracker",function(){return F});var z=D("./src/events.ts"),U=D("./src/types/loader.ts"),O;(function(C){C.NOT_LOADED="NOT_LOADED",C.BACKTRACKED="BACKTRACKED",C.APPENDING="APPENDING",C.PARTIAL="PARTIAL",C.OK="OK"})(O||(O={}));var F=function(){function C(v){this.activeFragment=null,this.activeParts=null,this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hls=v,this._registerListeners()}var m=C.prototype;return m._registerListeners=function(){var k=this.hls;k.on(z.Events.BUFFER_APPENDED,this.onBufferAppended,this),k.on(z.Events.FRAG_BUFFERED,this.onFragBuffered,this),k.on(z.Events.FRAG_LOADED,this.onFragLoaded,this)},m._unregisterListeners=function(){var k=this.hls;k.off(z.Events.BUFFER_APPENDED,this.onBufferAppended,this),k.off(z.Events.FRAG_BUFFERED,this.onFragBuffered,this),k.off(z.Events.FRAG_LOADED,this.onFragLoaded,this)},m.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},m.getAppendedFrag=function(k,S){if(S===U.PlaylistLevelType.MAIN){var b=this.activeFragment,f=this.activeParts;if(!b)return null;if(f)for(var u=f.length;u--;){var a=f[u],s=a?a.end:b.appendedPTS;if(a.start<=k&&s!==void 0&&k<=s)return u>9&&(this.activeParts=f.slice(u-9)),a}else if(b.start<=k&&b.appendedPTS!==void 0&&k<=b.appendedPTS)return b}return this.getBufferedFrag(k,S)},m.getBufferedFrag=function(k,S){for(var b=this.fragments,f=Object.keys(b),u=f.length;u--;){var a=b[f[u]];if((a==null?void 0:a.body.type)===S&&a.buffered){var s=a.body;if(s.start<=k&&k<=s.end)return s}}return null},m.detectEvictedFragments=function(k,S,b){var f=this;Object.keys(this.fragments).forEach(function(u){var a=f.fragments[u];if(!a)return;if(!a.buffered){a.body.type===b&&f.removeFragment(a.body);return}var s=a.range[k];if(!s)return;s.time.some(function(l){var A=!f.isTimeBuffered(l.startPTS,l.endPTS,S);return A&&f.removeFragment(a.body),A})})},m.detectPartialFragments=function(k){var S=this,b=this.timeRanges,f=k.frag,u=k.part;if(!b||f.sn==="initSegment")return;var a=R(f),s=this.fragments[a];if(!s)return;Object.keys(b).forEach(function(l){var A=f.elementaryStreams[l];if(!A)return;var y=b[l],c=u!==null||A.partial===!0;s.range[l]=S.getBufferedTimes(f,u,c,y)}),s.backtrack=s.loaded=null,Object.keys(s.range).length?s.buffered=!0:this.removeFragment(s.body)},m.fragBuffered=function(k){var S=R(k),b=this.fragments[S];b&&(b.backtrack=b.loaded=null,b.buffered=!0)},m.getBufferedTimes=function(k,S,b,f){for(var u={time:[],partial:b},a=S?S.start:k.start,s=S?S.end:k.end,l=k.minEndPTS||s,A=k.maxStartPTS||a,y=0;y<f.length;y++){var c=f.start(y)-this.bufferPadding,L=f.end(y)+this.bufferPadding;if(A>=c&&l<=L){u.time.push({startPTS:Math.max(a,f.start(y)),endPTS:Math.min(s,f.end(y))});break}else if(a<L&&s>c)u.partial=!0,u.time.push({startPTS:Math.max(a,f.start(y)),endPTS:Math.min(s,f.end(y))});else if(s<=c)break}return u},m.getPartialFragment=function(k){var S=null,b,f,u,a=0,s=this.bufferPadding,l=this.fragments;return Object.keys(l).forEach(function(A){var y=l[A];if(!y)return;M(y)&&(f=y.body.start-s,u=y.body.end+s,k>=f&&k<=u&&(b=Math.min(k-f,u-k),a<=b&&(S=y.body,a=b)))}),S},m.getState=function(k){var S=R(k),b=this.fragments[S];return b?b.buffered?M(b)?O.PARTIAL:O.OK:b.backtrack?O.BACKTRACKED:O.APPENDING:O.NOT_LOADED},m.backtrack=function(k,S){var b=R(k),f=this.fragments[b];if(!f||f.backtrack)return null;var u=f.backtrack=S||f.loaded;return f.loaded=null,u},m.getBacktrackData=function(k){var S=R(k),b=this.fragments[S];if(b){var f,u=b.backtrack;if(u!=null&&(f=u.payload)!==null&&f!==void 0&&f.byteLength)return u;this.removeFragment(k)}return null},m.isTimeBuffered=function(k,S,b){for(var f,u,a=0;a<b.length;a++){if(f=b.start(a)-this.bufferPadding,u=b.end(a)+this.bufferPadding,k>=f&&S<=u)return!0;if(S<=f)return!1}return!1},m.onFragLoaded=function(k,S){var b=S.frag,f=S.part;if(b.sn==="initSegment"||b.bitrateTest||f)return;var u=R(b);this.fragments[u]={body:b,loaded:S,backtrack:null,buffered:!1,range:Object.create(null)}},m.onBufferAppended=function(k,S){var b=this,f=S.frag,u=S.part,a=S.timeRanges;if(f.type===U.PlaylistLevelType.MAIN)if(this.activeFragment=f,u){var s=this.activeParts;s||(this.activeParts=s=[]),s.push(u)}else this.activeParts=null;this.timeRanges=a,Object.keys(a).forEach(function(l){var A=a[l];if(b.detectEvictedFragments(l,A),!u)for(var y=0;y<A.length;y++)f.appendedPTS=Math.max(A.end(y),f.appendedPTS||0)})},m.onFragBuffered=function(k,S){this.detectPartialFragments(S)},m.hasFragment=function(k){var S=R(k);return!!this.fragments[S]},m.removeFragmentsInRange=function(k,S,b){var f=this;Object.keys(this.fragments).forEach(function(u){var a=f.fragments[u];if(!a)return;if(a.buffered){var s=a.body;s.type===b&&s.start<S&&s.end>k&&f.removeFragment(s)}})},m.removeFragment=function(k){var S=R(k);k.stats.loaded=0,k.clearElementaryStreamInfo(),delete this.fragments[S]},m.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},C}();function M(C){var m,v;return C.buffered&&(((m=C.range.video)===null||m===void 0?void 0:m.partial)||((v=C.range.audio)===null||v===void 0?void 0:v.partial))}function R(C){return C.type+"_"+C.level+"_"+C.urlId+"_"+C.sn}},"./src/controller/gap-controller.ts":function(q,G,D){"use strict";D.r(G),D.d(G,"STALL_MINIMUM_DURATION_MS",function(){return M}),D.d(G,"MAX_START_GAP_JUMP",function(){return R}),D.d(G,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return C}),D.d(G,"SKIP_BUFFER_RANGE_START",function(){return m}),D.d(G,"default",function(){return v});var z=D("./src/utils/buffer-helper.ts"),U=D("./src/errors.ts"),O=D("./src/events.ts"),F=D("./src/utils/logger.ts"),M=250,R=2,C=.1,m=.05,v=function(){function k(b,f,u,a){this.config=void 0,this.media=void 0,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=b,this.media=f,this.fragmentTracker=u,this.hls=a}var S=k.prototype;return S.destroy=function(){this.hls=this.fragmentTracker=this.media=null},S.poll=function(f){var u=this.config,a=this.media,s=this.stalled,l=a.currentTime,A=a.seeking,y=this.seeking&&!A,c=!this.seeking&&A;if(this.seeking=A,l!==f){if(this.moved=!0,s!==null){if(this.stallReported){var L=self.performance.now()-s;F.logger.warn("playback not stuck anymore @"+l+", after "+Math.round(L)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((c||y)&&(this.stalled=null),a.paused||a.ended||a.playbackRate===0||!z.BufferHelper.getBuffered(a).length)return;var x=z.BufferHelper.bufferInfo(a,l,0),h=x.len>0,p=x.nextStart||0;if(!h&&!p)return;if(A){var d=x.len>R,o=!p||p-l>R&&!this.fragmentTracker.getPartialFragment(l);if(d||o)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var T,E=Math.max(p,x.start||0)-l,g=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,_=g==null||((T=g.details)===null||T===void 0)?void 0:T.live,N=_?g.details.targetduration*2:R;if(E>0&&E<=N){this._trySkipBufferHole(null);return}}var B=self.performance.now();if(s===null){this.stalled=B;return}var W=B-s;!A&&W>=M&&this._reportStall(x.len);var P=z.BufferHelper.bufferInfo(a,l,u.maxBufferHole);this._tryFixBufferStall(P,W)},S._tryFixBufferStall=function(f,u){var a=this.config,s=this.fragmentTracker,l=this.media,A=l.currentTime,y=s.getPartialFragment(A);if(y){var c=this._trySkipBufferHole(y);if(c)return}f.len>a.maxBufferHole&&u>a.highBufferWatchdogPeriod*1e3&&(F.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},S._reportStall=function(f){var u=this.hls,a=this.media,s=this.stallReported;s||(this.stallReported=!0,F.logger.warn("Playback stalling at @"+a.currentTime+" due to low buffer (buffer="+f+")"),u.trigger(O.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:f}))},S._trySkipBufferHole=function(f){for(var u=this.config,a=this.hls,s=this.media,l=s.currentTime,A=0,y=z.BufferHelper.getBuffered(s),c=0;c<y.length;c++){var L=y.start(c);if(l+u.maxBufferHole>=A&&l<L){var x=Math.max(L+m,s.currentTime+C);return F.logger.warn("skipping hole, adjusting currentTime from "+l+" to "+x),this.moved=!0,this.stalled=null,s.currentTime=x,f&&a.trigger(O.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+l+" to "+x,frag:f}),x}A=y.end(c)}return 0},S._tryNudgeBuffer=function(){var f=this.config,u=this.hls,a=this.media,s=a.currentTime,l=(this.nudgeRetry||0)+1;if(this.nudgeRetry=l,l<f.nudgeMaxRetry){var A=s+l*f.nudgeOffset;F.logger.warn("Nudging 'currentTime' from "+s+" to "+A),a.currentTime=A,u.trigger(O.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else F.logger.error("Playhead still not moving while enough data buffered @"+s+" after "+f.nudgeMaxRetry+" nudges"),u.trigger(O.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},k}()},"./src/controller/id3-track-controller.ts":function(q,G,D){"use strict";D.r(G);var z=D("./src/events.ts"),U=D("./src/utils/texttrack-utils.ts"),O=D("./src/demux/id3.ts"),F=.25,M=function(){function R(m){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=m,this._registerListeners()}var C=R.prototype;return C.destroy=function(){this._unregisterListeners()},C._registerListeners=function(){var v=this.hls;v.on(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),v.on(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),v.on(z.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),v.on(z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},C._unregisterListeners=function(){var v=this.hls;v.off(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),v.off(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),v.off(z.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),v.off(z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},C.onMediaAttached=function(v,k){this.media=k.media},C.onMediaDetaching=function(){if(!this.id3Track)return;Object(U.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},C.getID3Track=function(v){if(!this.media)return;for(var k=0;k<v.length;k++){var S=v[k];if(S.kind==="metadata"&&S.label==="id3")return Object(U.sendAddTrackEvent)(S,this.media),S}return this.media.addTextTrack("metadata","id3")},C.onFragParsingMetadata=function(v,k){if(!this.media)return;var S=k.frag,b=k.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var f=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,u=0;u<b.length;u++){var a=O.getID3Frames(b[u].data);if(a){var s=b[u].pts,l=u<b.length-1?b[u+1].pts:S.end,A=l-s;A<=0&&(l=s+F);for(var y=0;y<a.length;y++){var c=a[y];if(!O.isTimeStampFrame(c)){var L=new f(s,l,"");L.value=c,this.id3Track.addCue(L)}}}}},C.onBufferFlushing=function(v,k){var S=k.startOffset,b=k.endOffset,f=k.type;if(!f||f==="audio"){var u=this.id3Track;u&&Object(U.removeCuesInRange)(u,S,b)}},R}();G.default=M},"./src/controller/latency-controller.ts":function(q,G,D){"use strict";D.r(G),D.d(G,"default",function(){return R});var z=D("./src/errors.ts"),U=D("./src/events.ts"),O=D("./src/utils/logger.ts");function F(C,m){for(var v=0;v<m.length;v++){var k=m[v];k.enumerable=k.enumerable||!1,k.configurable=!0,"value"in k&&(k.writable=!0),Object.defineProperty(C,k.key,k)}}function M(C,m,v){return m&&F(C.prototype,m),v&&F(C,v),C}var R=function(){function C(v){var k=this;this.hls=void 0,this.config=void 0,this.media=null,this.levelDetails=null,this.currentTime=0,this.stallCount=0,this._latency=null,this.timeupdateHandler=function(){return k.timeupdate()},this.hls=v,this.config=v.config,this.registerListeners()}var m=C.prototype;return m.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},m.registerListeners=function(){this.hls.on(U.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(U.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(U.Events.ERROR,this.onError,this)},m.unregisterListeners=function(){this.hls.off(U.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(U.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(U.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(U.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(U.Events.ERROR,this.onError)},m.onMediaAttached=function(k,S){this.media=S.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},m.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},m.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},m.onLevelUpdated=function(k,S){var b=S.details;this.levelDetails=b,b.advanced&&this.timeupdate(),!b.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},m.onError=function(k,S){if(S.details!==z.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,O.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},m.timeupdate=function(){var k=this.media,S=this.levelDetails;if(!k||!S)return;this.currentTime=k.currentTime;var b=this.computeLatency();if(b===null)return;this._latency=b;var f=this.config,u=f.lowLatencyMode,a=f.maxLiveSyncPlaybackRate;if(!u||a===1)return;var s=this.targetLatency;if(s===null)return;var l=b-s,A=Math.min(this.maxLatency,s+S.targetduration),y=l<A;if(S.live&&y&&l>.05&&this.forwardBufferLength>1){var c=Math.min(2,Math.max(1,a)),L=Math.round(2/(1+Math.exp(-.75*l-this.edgeStalled))*20)/20;k.playbackRate=Math.min(c,Math.max(1,L))}else k.playbackRate!==1&&k.playbackRate!==0&&(k.playbackRate=1)},m.estimateLiveEdge=function(){var k=this.levelDetails;return k===null?null:k.edge+k.age},m.computeLatency=function(){var k=this.estimateLiveEdge();return k===null?null:k-this.currentTime},M(C,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var k=this.config,S=this.levelDetails;return k.liveMaxLatencyDuration!==void 0?k.liveMaxLatencyDuration:S?k.liveMaxLatencyDurationCount*S.targetduration:0}},{key:"targetLatency",get:function(){var k=this.levelDetails;if(k===null)return null;var S=k.holdBack,b=k.partHoldBack,f=k.targetduration,u=this.config,a=u.liveSyncDuration,s=u.liveSyncDurationCount,l=u.lowLatencyMode,A=this.hls.userConfig,y=l&&b||S;(A.liveSyncDuration||A.liveSyncDurationCount||y===0)&&(y=a!==void 0?a:s*f);var c=f,L=1;return y+Math.min(this.stallCount*L,c)}},{key:"liveSyncPosition",get:function(){var k=this.estimateLiveEdge(),S=this.targetLatency,b=this.levelDetails;if(k===null||S===null||b===null)return null;var f=b.edge,u=k-S-this.edgeStalled,a=f-b.totalduration,s=f-(this.config.lowLatencyMode&&b.partTarget||b.targetduration);return Math.min(Math.max(a,u),s)}},{key:"drift",get:function(){var k=this.levelDetails;return k===null?1:k.drift}},{key:"edgeStalled",get:function(){var k=this.levelDetails;if(k===null)return 0;var S=(this.config.lowLatencyMode&&k.partTarget||k.targetduration)*3;return Math.max(k.age-S,0)}},{key:"forwardBufferLength",get:function(){var k=this.media,S=this.levelDetails;if(!k||!S)return 0;var b=k.buffered.length;return b?k.buffered.end(b-1):S.edge-this.currentTime}}]),C}()},"./src/controller/level-controller.ts":function(q,G,D){"use strict";D.r(G),D.d(G,"default",function(){return u});var z=D("./src/types/level.ts"),U=D("./src/events.ts"),O=D("./src/errors.ts"),F=D("./src/utils/codecs.ts"),M=D("./src/controller/level-helper.ts"),R=D("./src/controller/base-playlist-controller.ts"),C=D("./src/types/loader.ts");function m(){return m=Object.assign||function(a){for(var s=1;s<arguments.length;s++){var l=arguments[s];for(var A in l)Object.prototype.hasOwnProperty.call(l,A)&&(a[A]=l[A])}return a},m.apply(this,arguments)}function v(a,s){for(var l=0;l<s.length;l++){var A=s[l];A.enumerable=A.enumerable||!1,A.configurable=!0,"value"in A&&(A.writable=!0),Object.defineProperty(a,A.key,A)}}function k(a,s,l){return s&&v(a.prototype,s),l&&v(a,l),a}function S(a,s){a.prototype=Object.create(s.prototype),a.prototype.constructor=a,b(a,s)}function b(a,s){return b=Object.setPrototypeOf||function(A,y){return A.__proto__=y,A},b(a,s)}var f=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),u=function(a){S(s,a);function s(A){var y;return y=a.call(this,A,"[level-controller]")||this,y._levels=[],y._firstLevel=-1,y._startLevel=void 0,y.currentLevelIndex=-1,y.manualLevelIndex=-1,y.onParsedComplete=void 0,y._registerListeners(),y}var l=s.prototype;return l._registerListeners=function(){var y=this.hls;y.on(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),y.on(U.Events.LEVEL_LOADED,this.onLevelLoaded,this),y.on(U.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),y.on(U.Events.FRAG_LOADED,this.onFragLoaded,this),y.on(U.Events.ERROR,this.onError,this)},l._unregisterListeners=function(){var y=this.hls;y.off(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),y.off(U.Events.LEVEL_LOADED,this.onLevelLoaded,this),y.off(U.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),y.off(U.Events.FRAG_LOADED,this.onFragLoaded,this),y.off(U.Events.ERROR,this.onError,this)},l.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,a.prototype.destroy.call(this)},l.startLoad=function(){var y=this._levels;y.forEach(function(c){c.loadError=0}),a.prototype.startLoad.call(this)},l.onManifestLoaded=function(y,c){var L=[],x=[],h=[],p,d={},o,T=!1,E=!1,g=!1;if(c.levels.forEach(function(W){var P=W.attrs;T=T||!!(W.width&&W.height),E=E||!!W.videoCodec,g=g||!!W.audioCodec,f&&W.audioCodec&&W.audioCodec.indexOf("mp4a.40.34")!==-1&&(W.audioCodec=void 0);var I=W.bitrate+"-"+W.attrs.RESOLUTION+"-"+W.attrs.CODECS;o=d[I],o?o.url.push(W.url):(o=new z.Level(W),d[I]=o,L.push(o)),P&&(P.AUDIO&&Object(M.addGroupId)(o,"audio",P.AUDIO),P.SUBTITLES&&Object(M.addGroupId)(o,"text",P.SUBTITLES))}),(T||E)&&g&&(L=L.filter(function(W){var P=W.videoCodec,I=W.width,H=W.height;return!!P||!!(I&&H)})),L=L.filter(function(W){var P=W.audioCodec,I=W.videoCodec;return(!P||Object(F.isCodecSupportedInMp4)(P,"audio"))&&(!I||Object(F.isCodecSupportedInMp4)(I,"video"))}),c.audioTracks&&(x=c.audioTracks.filter(function(W){return!W.audioCodec||Object(F.isCodecSupportedInMp4)(W.audioCodec,"audio")}),Object(M.assignTrackIdsByGroup)(x)),c.subtitles&&(h=c.subtitles,Object(M.assignTrackIdsByGroup)(h)),L.length>0){p=L[0].bitrate,L.sort(function(W,P){return W.bitrate-P.bitrate}),this._levels=L;for(var _=0;_<L.length;_++)if(L[_].bitrate===p){this._firstLevel=_,this.log("manifest loaded, "+L.length+" level(s) found, first bitrate: "+p);break}var N=g&&!E,B={levels:L,audioTracks:x,subtitleTracks:h,firstLevel:this._firstLevel,stats:c.stats,audio:g,video:E,altAudio:!N&&x.some(function(W){return!!W.url})};this.hls.trigger(U.Events.MANIFEST_PARSED,B),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(U.Events.ERROR,{type:O.ErrorTypes.MEDIA_ERROR,details:O.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:c.url,reason:"no level with compatible codecs found in manifest"})},l.onError=function(y,c){if(a.prototype.onError.call(this,y,c),c.fatal)return;var L=c.context,x=this._levels[this.currentLevelIndex];if(L&&(L.type===C.PlaylistContextType.AUDIO_TRACK&&x.audioGroupIds&&L.groupId===x.audioGroupIds[x.urlId]||L.type===C.PlaylistContextType.SUBTITLE_TRACK&&x.textGroupIds&&L.groupId===x.textGroupIds[x.urlId])){this.redundantFailover(this.currentLevelIndex);return}var h=!1,p=!0,d;switch(c.details){case O.ErrorDetails.FRAG_LOAD_ERROR:case O.ErrorDetails.FRAG_LOAD_TIMEOUT:case O.ErrorDetails.KEY_LOAD_ERROR:case O.ErrorDetails.KEY_LOAD_TIMEOUT:if(c.frag){var o=this._levels[c.frag.level];o?(o.fragmentError++,o.fragmentError>this.hls.config.fragLoadingMaxRetry&&(d=c.frag.level)):d=c.frag.level}break;case O.ErrorDetails.LEVEL_LOAD_ERROR:case O.ErrorDetails.LEVEL_LOAD_TIMEOUT:L&&(L.deliveryDirectives&&(p=!1),d=L.level),h=!0;break;case O.ErrorDetails.REMUX_ALLOC_ERROR:d=c.level,h=!0;break}d!==void 0&&this.recoverLevel(c,d,h,p)},l.recoverLevel=function(y,c,L,x){var h=y.details,p=this._levels[c];if(p.loadError++,L){var d=this.retryLoadingOrFail(y);if(d)y.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(x){var o=p.url.length;if(o>1&&p.loadError<o)y.levelRetry=!0,this.redundantFailover(c);else if(this.manualLevelIndex===-1){var T=c===0?this._levels.length-1:c-1;this.currentLevelIndex!==T&&this._levels[T].loadError===0&&(this.warn(h+": switch to "+T),y.levelRetry=!0,this.hls.nextAutoLevel=T)}}},l.redundantFailover=function(y){var c=this._levels[y],L=c.url.length;if(L>1){var x=(c.urlId+1)%L;this.warn("Switching to redundant URL-id "+x),this._levels.forEach(function(h){h.urlId=x}),this.level=y}},l.onFragLoaded=function(y,c){var L=c.frag;if(L!==void 0&&L.type===C.PlaylistLevelType.MAIN){var x=this._levels[L.level];x!==void 0&&(x.fragmentError=0,x.loadError=0)}},l.onLevelLoaded=function(y,c){var L,x=c.level,h=c.details,p=this._levels[x];if(!p){var d;this.warn("Invalid level index "+x),(d=c.deliveryDirectives)!==null&&d!==void 0&&d.skip&&(h.deltaUpdateFailed=!0);return}x===this.currentLevelIndex?(p.fragmentError===0&&(p.loadError=0,this.retryCount=0),this.playlistLoaded(x,c,p.details)):(L=c.deliveryDirectives)!==null&&L!==void 0&&L.skip&&(h.deltaUpdateFailed=!0)},l.onAudioTrackSwitched=function(y,c){var L=this.hls.levels[this.currentLevelIndex];if(!L)return;if(L.audioGroupIds){for(var x=-1,h=this.hls.audioTracks[c.id].groupId,p=0;p<L.audioGroupIds.length;p++)if(L.audioGroupIds[p]===h){x=p;break}x!==L.urlId&&(L.urlId=x,this.startLoad())}},l.loadPlaylist=function(y){var c=this.currentLevelIndex,L=this._levels[c];if(this.canLoad&&L&&L.url.length>0){var x=L.urlId,h=L.url[x];if(y)try{h=y.addDirectives(h)}catch(p){this.warn("Could not construct new URL with HLS Delivery Directives: "+p)}this.log("Attempt loading level index "+c+(y?" at sn "+y.msn+" part "+y.part:"")+" with URL-id "+x+" "+h),this.clearTimer(),this.hls.trigger(U.Events.LEVEL_LOADING,{url:h,level:c,id:x,deliveryDirectives:y||null})}},l.removeLevel=function(y,c){var L=function(p,d){return d!==c},x=this._levels.filter(function(h,p){return p!==y?!0:h.url.length>1&&c!==void 0?(h.url=h.url.filter(L),h.audioGroupIds&&(h.audioGroupIds=h.audioGroupIds.filter(L)),h.textGroupIds&&(h.textGroupIds=h.textGroupIds.filter(L)),h.urlId=0,!0):!1}).map(function(h,p){var d=h.details;return d!=null&&d.fragments&&d.fragments.forEach(function(o){o.level=p}),h});this._levels=x,this.hls.trigger(U.Events.LEVELS_UPDATED,{levels:x})},k(s,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(y){var c,L=this._levels;if(L.length===0)return;if(this.currentLevelIndex===y&&(c=L[y])!==null&&c!==void 0&&c.details)return;if(y<0||y>=L.length){var x=y<0;if(this.hls.trigger(U.Events.ERROR,{type:O.ErrorTypes.OTHER_ERROR,details:O.ErrorDetails.LEVEL_SWITCH_ERROR,level:y,fatal:x,reason:"invalid level idx"}),x)return;y=Math.min(y,L.length-1)}this.clearTimer();var h=this.currentLevelIndex,p=L[h],d=L[y];this.log("switching to level "+y+" from "+h),this.currentLevelIndex=y;var o=m({},d,{level:y,maxBitrate:d.maxBitrate,uri:d.uri,urlId:d.urlId});delete o._urlId,this.hls.trigger(U.Events.LEVEL_SWITCHING,o);var T=d.details;if(!T||T.live){var E=this.switchParams(d.uri,p==null?void 0:p.details);this.loadPlaylist(E)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(y){this.manualLevelIndex=y,this._startLevel===void 0&&(this._startLevel=y),y!==-1&&(this.level=y)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(y){this._firstLevel=y}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var y=this.hls.config.startLevel;return y!==void 0?y:this._firstLevel}else return this._startLevel},set:function(y){this._startLevel=y}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(y){this.level=y,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=y)}}]),s}(R.default)},"./src/controller/level-helper.ts":function(q,G,D){"use strict";D.r(G),D.d(G,"addGroupId",function(){return O}),D.d(G,"assignTrackIdsByGroup",function(){return F}),D.d(G,"updatePTS",function(){return M}),D.d(G,"updateFragPTSDTS",function(){return C}),D.d(G,"mergeDetails",function(){return m}),D.d(G,"mapPartIntersection",function(){return v}),D.d(G,"mapFragmentIntersection",function(){return k}),D.d(G,"adjustSliding",function(){return S}),D.d(G,"addSliding",function(){return b}),D.d(G,"computeReloadInterval",function(){return f}),D.d(G,"getFragmentWithSN",function(){return u}),D.d(G,"getPartWith",function(){return a});var z=D("./src/polyfills/number.ts"),U=D("./src/utils/logger.ts");function O(s,l,A){switch(l){case"audio":s.audioGroupIds||(s.audioGroupIds=[]),s.audioGroupIds.push(A);break;case"text":s.textGroupIds||(s.textGroupIds=[]),s.textGroupIds.push(A);break}}function F(s){var l={};s.forEach(function(A){var y=A.groupId||"";A.id=l[y]=l[y]||0,l[y]++})}function M(s,l,A){var y=s[l],c=s[A];R(y,c)}function R(s,l){var A=l.startPTS;if(Object(z.isFiniteNumber)(A)){var y=0,c;l.sn>s.sn?(y=A-s.start,c=s):(y=s.start-A,c=l),c.duration!==y&&(c.duration=y)}else if(l.sn>s.sn){var L=s.cc===l.cc;L&&s.minEndPTS?l.start=s.start+(s.minEndPTS-s.start):l.start=s.start+s.duration}else l.start=Math.max(s.start-l.duration,0)}function C(s,l,A,y,c,L){var x=y-A;x<=0&&(U.logger.warn("Fragment should have a positive duration",l),y=A+l.duration,L=c+l.duration);var h=A,p=y,d=l.startPTS,o=l.endPTS;if(Object(z.isFiniteNumber)(d)){var T=Math.abs(d-A);Object(z.isFiniteNumber)(l.deltaPTS)?l.deltaPTS=Math.max(T,l.deltaPTS):l.deltaPTS=T,h=Math.max(A,d),A=Math.min(A,d),c=Math.min(c,l.startDTS),p=Math.min(y,o),y=Math.max(y,o),L=Math.max(L,l.endDTS)}l.duration=y-A;var E=A-l.start;l.appendedPTS=y,l.start=l.startPTS=A,l.maxStartPTS=h,l.startDTS=c,l.endPTS=y,l.minEndPTS=p,l.endDTS=L;var g=l.sn;if(!s||g<s.startSN||g>s.endSN)return 0;var _,N=g-s.startSN,B=s.fragments;for(B[N]=l,_=N;_>0;_--)R(B[_],B[_-1]);for(_=N;_<B.length-1;_++)R(B[_],B[_+1]);return s.fragmentHint&&R(B[B.length-1],s.fragmentHint),s.PTSKnown=s.alignedSliding=!0,E}function m(s,l){for(var A=null,y=s.fragments,c=y.length-1;c>=0;c--){var L=y[c].initSegment;if(L){A=L;break}}s.fragmentHint&&delete s.fragmentHint.endPTS;var x=0,h;if(k(s,l,function(_,N){_.relurl&&(x=_.cc-N.cc),Object(z.isFiniteNumber)(_.startPTS)&&Object(z.isFiniteNumber)(_.endPTS)&&(N.start=N.startPTS=_.startPTS,N.startDTS=_.startDTS,N.appendedPTS=_.appendedPTS,N.maxStartPTS=_.maxStartPTS,N.endPTS=_.endPTS,N.endDTS=_.endDTS,N.minEndPTS=_.minEndPTS,N.duration=_.endPTS-_.startPTS,N.duration&&(h=N),l.PTSKnown=l.alignedSliding=!0),N.elementaryStreams=_.elementaryStreams,N.loader=_.loader,N.stats=_.stats,N.urlId=_.urlId,_.initSegment&&(N.initSegment=_.initSegment,A=_.initSegment)}),A){var p=l.fragmentHint?l.fragments.concat(l.fragmentHint):l.fragments;p.forEach(function(_){var N;(!_.initSegment||_.initSegment.relurl===((N=A)===null||N===void 0?void 0:N.relurl))&&(_.initSegment=A)})}if(l.skippedSegments&&(l.deltaUpdateFailed=l.fragments.some(function(_){return!_}),l.deltaUpdateFailed)){U.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var d=l.skippedSegments;d--;)l.fragments.shift();l.startSN=l.fragments[0].sn,l.startCC=l.fragments[0].cc}var o=l.fragments;if(x){U.logger.warn("discontinuity sliding from playlist, take drift into account");for(var T=0;T<o.length;T++)o[T].cc+=x}l.skippedSegments&&(l.startCC=l.fragments[0].cc),v(s.partList,l.partList,function(_,N){N.elementaryStreams=_.elementaryStreams,N.stats=_.stats}),h?C(l,h,h.startPTS,h.endPTS,h.startDTS,h.endDTS):S(s,l),o.length&&(l.totalduration=l.edge-o[0].start),l.driftStartTime=s.driftStartTime,l.driftStart=s.driftStart;var E=l.advancedDateTime;if(l.advanced&&E){var g=l.edge;l.driftStart||(l.driftStartTime=E,l.driftStart=g),l.driftEndTime=E,l.driftEnd=g}else l.driftEndTime=s.driftEndTime,l.driftEnd=s.driftEnd,l.advancedDateTime=s.advancedDateTime}function v(s,l,A){if(s&&l)for(var y=0,c=0,L=s.length;c<=L;c++){var x=s[c],h=l[c+y];x&&h&&x.index===h.index&&x.fragment.sn===h.fragment.sn?A(x,h):y--}}function k(s,l,A){for(var y=l.skippedSegments,c=Math.max(s.startSN,l.startSN)-l.startSN,L=(s.fragmentHint?1:0)+(y?l.endSN:Math.min(s.endSN,l.endSN))-l.startSN,x=l.startSN-s.startSN,h=l.fragmentHint?l.fragments.concat(l.fragmentHint):l.fragments,p=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments,d=c;d<=L;d++){var o=p[x+d],T=h[d];y&&!T&&d<y&&(T=l.fragments[d]=o),o&&T&&A(o,T)}}function S(s,l){var A=l.startSN+l.skippedSegments-s.startSN,y=s.fragments;if(A<0||A>=y.length)return;b(l,y[A].start)}function b(s,l){if(l){for(var A=s.fragments,y=s.skippedSegments;y<A.length;y++)A[y].start+=l;s.fragmentHint&&(s.fragmentHint.start+=l)}}function f(s,l){var A=1e3*s.levelTargetDuration,y=A/2,c=s.age,L=c>0&&c<A*3,x=l.loading.end-l.loading.start,h,p=s.availabilityDelay;if(s.updated===!1)if(L){var d=333*s.misses;h=Math.max(Math.min(y,x*2),d),s.availabilityDelay=(s.availabilityDelay||0)+h}else h=y;else L?(p=Math.min(p||A/2,c),s.availabilityDelay=p,h=p+A-c):h=A-x;return Math.round(h)}function u(s,l,A){if(!s||!s.details)return null;var y=s.details,c=y.fragments[l-y.startSN];return c||(c=y.fragmentHint,c&&c.sn===l?c:l<y.startSN&&A&&A.sn===l?A:null)}function a(s,l,A){if(!s||!s.details)return null;var y=s.details.partList;if(y)for(var c=y.length;c--;){var L=y[c];if(L.index===A&&L.fragment.sn===l)return L}return null}},"./src/controller/stream-controller.ts":function(q,G,D){"use strict";D.r(G),D.d(G,"default",function(){return y});var z=D("./src/polyfills/number.ts"),U=D("./src/controller/base-stream-controller.ts"),O=D("./src/is-supported.ts"),F=D("./src/events.ts"),M=D("./src/utils/buffer-helper.ts"),R=D("./src/controller/fragment-tracker.ts"),C=D("./src/types/loader.ts"),m=D("./src/loader/fragment.ts"),v=D("./src/demux/transmuxer-interface.ts"),k=D("./src/types/transmuxer.ts"),S=D("./src/controller/gap-controller.ts"),b=D("./src/errors.ts"),f=D("./src/utils/logger.ts");function u(c,L){for(var x=0;x<L.length;x++){var h=L[x];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(c,h.key,h)}}function a(c,L,x){return L&&u(c.prototype,L),x&&u(c,x),c}function s(c,L){c.prototype=Object.create(L.prototype),c.prototype.constructor=c,l(c,L)}function l(c,L){return l=Object.setPrototypeOf||function(h,p){return h.__proto__=p,h},l(c,L)}var A=100,y=function(c){s(L,c);function L(h,p){var d;return d=c.call(this,h,p,"[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 x=L.prototype;return x._registerListeners=function(){var p=this.hls;p.on(F.Events.MEDIA_ATTACHED,this.onMediaAttached,this),p.on(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),p.on(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),p.on(F.Events.MANIFEST_PARSED,this.onManifestParsed,this),p.on(F.Events.LEVEL_LOADING,this.onLevelLoading,this),p.on(F.Events.LEVEL_LOADED,this.onLevelLoaded,this),p.on(F.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),p.on(F.Events.ERROR,this.onError,this),p.on(F.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),p.on(F.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),p.on(F.Events.BUFFER_CREATED,this.onBufferCreated,this),p.on(F.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),p.on(F.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),p.on(F.Events.FRAG_BUFFERED,this.onFragBuffered,this)},x._unregisterListeners=function(){var p=this.hls;p.off(F.Events.MEDIA_ATTACHED,this.onMediaAttached,this),p.off(F.Events.MEDIA_DETACHING,this.onMediaDetaching,this),p.off(F.Events.MANIFEST_LOADING,this.onManifestLoading,this),p.off(F.Events.MANIFEST_PARSED,this.onManifestParsed,this),p.off(F.Events.LEVEL_LOADED,this.onLevelLoaded,this),p.off(F.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),p.off(F.Events.ERROR,this.onError,this),p.off(F.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),p.off(F.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),p.off(F.Events.BUFFER_CREATED,this.onBufferCreated,this),p.off(F.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),p.off(F.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),p.off(F.Events.FRAG_BUFFERED,this.onFragBuffered,this)},x.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},x.startLoad=function(p){if(this.levels){var d=this.lastCurrentTime,o=this.hls;if(this.stopLoad(),this.setInterval(A),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var T=o.startLevel;T===-1&&(o.config.testBandwidth?(T=0,this.bitrateTest=!0):T=o.nextAutoLevel),this.level=o.nextLoadLevel=T,this.loadedmetadata=!1}d>0&&p===-1&&(this.log("Override startPosition with lastCurrentTime @"+d.toFixed(3)),p=d),this.state=U.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=p,this.tick()}else this._forceStartLoad=!0,this.state=U.State.STOPPED},x.stopLoad=function(){this._forceStartLoad=!1,c.prototype.stopLoad.call(this)},x.doTick=function(){switch(this.state){case U.State.IDLE:this.doTickIdle();break;case U.State.WAITING_LEVEL:{var p,d=this.levels,o=this.level,T=d==null||((p=d[o])===null||p===void 0)?void 0:p.details;if(T&&(!T.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(T))break;this.state=U.State.IDLE;break}break}case U.State.FRAG_LOADING_WAITING_RETRY:{var E,g=self.performance.now(),_=this.retryDate;(!_||g>=_||(E=this.media)!==null&&E!==void 0&&E.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=U.State.IDLE)}break;default:break}this.onTickEnd()},x.onTickEnd=function(){c.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},x.doTickIdle=function(){var p,d,o=this.hls,T=this.levelLastLoaded,E=this.levels,g=this.media,_=o.config,N=o.nextLoadLevel;if(T===null||!g&&(this.startFragRequested||!_.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!E||!E[N])return;var B=E[N];this.level=o.nextLoadLevel=N;var W=B.details;if(!W||this.state===U.State.WAITING_LEVEL||W.live&&this.levelLastLoaded!==N){this.state=U.State.WAITING_LEVEL;return}var P=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:g,C.PlaylistLevelType.MAIN);if(P===null)return;var I=P.len,H=this.getMaxBufferLength(B.maxBitrate);if(I>=H)return;if(this._streamEnded(P,W)){var Y={};this.altAudio&&(Y.type="video"),this.hls.trigger(F.Events.BUFFER_EOS,Y),this.state=U.State.ENDED;return}var ee=P.end,oe=this.getNextFragment(ee,W);if(this.couldBacktrack&&!this.fragPrevious&&oe&&oe.sn!=="initSegment"){var Ee=oe.sn-W.startSN;Ee>1&&(oe=W.fragments[Ee-1],this.fragmentTracker.removeFragment(oe))}if(oe&&this.fragmentTracker.getState(oe)===R.FragmentState.OK&&this.nextLoadPosition>ee){var pe=this.audioOnly&&!this.altAudio?m.ElementaryStreamTypes.AUDIO:m.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(g,pe,C.PlaylistLevelType.MAIN),oe=this.getNextFragment(this.nextLoadPosition,W)}if(!oe)return;oe.initSegment&&!oe.initSegment.data&&!this.bitrateTest&&(oe=oe.initSegment),((p=oe.decryptdata)===null||p===void 0?void 0:p.keyFormat)==="identity"&&!((d=oe.decryptdata)!==null&&d!==void 0&&d.key)?this.loadKey(oe,W):this.loadFragment(oe,W,ee)},x.loadFragment=function(p,d,o){var T,E=this.fragmentTracker.getState(p);if(this.fragCurrent=p,E===R.FragmentState.BACKTRACKED){var g=this.fragmentTracker.getBacktrackData(p);if(g){this._handleFragmentLoadProgress(g),this._handleFragmentLoadComplete(g);return}else E=R.FragmentState.NOT_LOADED}E===R.FragmentState.NOT_LOADED||E===R.FragmentState.PARTIAL?p.sn==="initSegment"?this._loadInitSegment(p):this.bitrateTest?(p.bitrateTest=!0,this.log("Fragment "+p.sn+" of level "+p.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(p)):(this.startFragRequested=!0,c.prototype.loadFragment.call(this,p,d,o)):E===R.FragmentState.APPENDING?this.reduceMaxBufferLength(p.duration)&&this.fragmentTracker.removeFragment(p):((T=this.media)===null||T===void 0?void 0:T.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},x.getAppendedFrag=function(p){var d=this.fragmentTracker.getAppendedFrag(p,C.PlaylistLevelType.MAIN);return d&&"fragment"in d?d.fragment:d},x.getBufferedFrag=function(p){return this.fragmentTracker.getBufferedFrag(p,C.PlaylistLevelType.MAIN)},x.followingBufferedFrag=function(p){return p?this.getBufferedFrag(p.end+.5):null},x.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},x.nextLevelSwitch=function(){var p=this.levels,d=this.media;if(d!=null&&d.readyState){var o,T=this.getAppendedFrag(d.currentTime);if(T&&T.start>1&&this.flushMainBuffer(0,T.start-1),!d.paused&&p){var E=this.hls.nextLoadLevel,g=p[E],_=this.fragLastKbps;_&&this.fragCurrent?o=this.fragCurrent.duration*g.maxBitrate/(1e3*_)+1:o=0}else o=0;var N=this.getBufferedFrag(d.currentTime+o);if(N){var B=this.followingBufferedFrag(N);if(B){this.abortCurrentFrag();var W=B.maxStartPTS?B.maxStartPTS:B.start,P=B.duration,I=Math.max(N.end,W+Math.min(Math.max(P-this.config.maxFragLookUpTolerance,P*.5),P*.75));this.flushMainBuffer(I,Number.POSITIVE_INFINITY)}}}},x.abortCurrentFrag=function(){var p=this.fragCurrent;this.fragCurrent=null,p!=null&&p.loader&&p.loader.abort(),this.state===U.State.KEY_LOADING&&(this.state=U.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},x.flushMainBuffer=function(p,d){c.prototype.flushMainBuffer.call(this,p,d,this.altAudio?"video":null)},x.onMediaAttached=function(p,d){c.prototype.onMediaAttached.call(this,p,d);var o=d.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),o.addEventListener("playing",this.onvplaying),o.addEventListener("seeked",this.onvseeked),this.gapController=new S.default(this.config,o,this.fragmentTracker,this.hls)},x.onMediaDetaching=function(){var p=this.media;p&&(p.removeEventListener("playing",this.onvplaying),p.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)},x.onMediaPlaying=function(){this.tick()},x.onMediaSeeked=function(){var p=this.media,d=p?p.currentTime:null;Object(z.isFiniteNumber)(d)&&this.log("Media seeked to "+d.toFixed(3)),this.tick()},x.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(F.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},x.onManifestParsed=function(p,d){var o=!1,T=!1,E;d.levels.forEach(function(g){E=g.audioCodec,E&&(E.indexOf("mp4a.40.2")!==-1&&(o=!0),E.indexOf("mp4a.40.5")!==-1&&(T=!0))}),this.audioCodecSwitch=o&&T&&!Object(O.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},x.onLevelLoading=function(p,d){var o=this.levels;if(!o||this.state!==U.State.IDLE)return;var T=o[d.level];(!T.details||T.details.live&&this.levelLastLoaded!==d.level||this.waitForCdnTuneIn(T.details))&&(this.state=U.State.WAITING_LEVEL)},x.onLevelLoaded=function(p,d){var o,T=this.levels,E=d.level,g=d.details,_=g.totalduration;if(!T){this.warn("Levels were reset while loading level "+E);return}this.log("Level "+E+" loaded ["+g.startSN+","+g.endSN+"], cc ["+g.startCC+", "+g.endCC+"] duration:"+_);var N=this.fragCurrent;N&&(this.state===U.State.FRAG_LOADING||this.state===U.State.FRAG_LOADING_WAITING_RETRY)&&(N.level!==d.level&&N.loader&&(this.state=U.State.IDLE,N.loader.abort()));var B=T[E],W=0;if(g.live||(o=B.details)!==null&&o!==void 0&&o.live){if(g.fragments[0]||(g.deltaUpdateFailed=!0),g.deltaUpdateFailed)return;W=this.alignPlaylists(g,B.details)}if(B.details=g,this.levelLastLoaded=E,this.hls.trigger(F.Events.LEVEL_UPDATED,{details:g,level:E}),this.state===U.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(g))return;this.state=U.State.IDLE}this.startFragRequested?g.live&&this.synchronizeToLiveEdge(g):this.setStartPosition(g,W),this.tick()},x._handleFragmentLoadProgress=function(p){var d,o=p.frag,T=p.part,E=p.payload,g=this.levels;if(!g){this.warn("Levels were reset while fragment load was in progress. Fragment "+o.sn+" of level "+o.level+" will not be buffered");return}var _=g[o.level],N=_.details;if(!N){this.warn("Dropping fragment "+o.sn+" of level "+o.level+" after level details were reset");return}var B=_.videoCodec,W=N.PTSKnown||!N.live,P=(d=o.initSegment)===null||d===void 0?void 0:d.data,I=this._getAudioCodec(_),H=this.transmuxer=this.transmuxer||new v.default(this.hls,C.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),Y=T?T.index:-1,ee=Y!==-1,oe=new k.ChunkMetadata(o.level,o.sn,o.stats.chunkCount,E.byteLength,Y,ee),Ee=this.initPTS[o.cc];H.push(E,P,I,B,o,T,N.totalduration,W,oe,Ee)},x.onAudioTrackSwitching=function(p,d){var o=this.altAudio,T=!!d.url,E=d.id;if(!T){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var g=this.fragCurrent;g!=null&&g.loader&&(this.log("Switching to main audio track, cancel main fragment load"),g.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var _=this.hls;o&&_.trigger(F.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),_.trigger(F.Events.AUDIO_TRACK_SWITCHED,{id:E})}},x.onAudioTrackSwitched=function(p,d){var o=d.id,T=!!this.hls.audioTracks[o].url;if(T){var E=this.videoBuffer;E&&this.mediaBuffer!==E&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=E)}this.altAudio=T,this.tick()},x.onBufferCreated=function(p,d){var o=d.tracks,T,E,g=!1;for(var _ in o){var N=o[_];if(N.id==="main"){if(E=_,T=N,_==="video"){var B=o[_];B&&(this.videoBuffer=B.buffer)}}else g=!0}g&&T?(this.log("Alternate track found, use "+E+".buffered to schedule main fragment loading"),this.mediaBuffer=T.buffer):this.mediaBuffer=this.media},x.onFragBuffered=function(p,d){var o=d.frag,T=d.part;if(o&&o.type!==C.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(o)){this.warn("Fragment "+o.sn+(T?" p: "+T.index:"")+" of level "+o.level+" finished buffering, but was aborted. state: "+this.state),this.state===U.State.PARSED&&(this.state=U.State.IDLE);return}var E=T?T.stats:o.stats;this.fragLastKbps=Math.round(8*E.total/(E.buffering.end-E.loading.first)),o.sn!=="initSegment"&&(this.fragPrevious=o),this.fragBufferedComplete(o,T)},x.onError=function(p,d){switch(d.details){case b.ErrorDetails.FRAG_LOAD_ERROR:case b.ErrorDetails.FRAG_LOAD_TIMEOUT:case b.ErrorDetails.KEY_LOAD_ERROR:case b.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(C.PlaylistLevelType.MAIN,d);break;case b.ErrorDetails.LEVEL_LOAD_ERROR:case b.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==U.State.ERROR&&(d.fatal?(this.warn(""+d.details),this.state=U.State.ERROR):!d.levelRetry&&this.state===U.State.WAITING_LEVEL&&(this.state=U.State.IDLE));break;case b.ErrorDetails.BUFFER_FULL_ERROR:if(d.parent==="main"&&(this.state===U.State.PARSING||this.state===U.State.PARSED)){var o=!0,T=this.getFwdBufferInfo(this.media,C.PlaylistLevelType.MAIN);T&&T.len>.5&&(o=!this.reduceMaxBufferLength(T.len)),o&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},x.checkBuffer=function(){var p=this.media,d=this.gapController;if(!p||!d||!p.readyState)return;var o=M.BufferHelper.getBuffered(p);!this.loadedmetadata&&o.length?(this.loadedmetadata=!0,this.seekToStartPos()):d.poll(this.lastCurrentTime),this.lastCurrentTime=p.currentTime},x.onFragLoadEmergencyAborted=function(){this.state=U.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},x.onBufferFlushed=function(p,d){var o=d.type;if(o!==m.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var T=(o===m.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(T,o,C.PlaylistLevelType.MAIN)}},x.onLevelsUpdated=function(p,d){this.levels=d.levels},x.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},x.seekToStartPos=function(){var p=this.media,d=p.currentTime,o=this.startPosition;if(o>=0&&d<o){if(p.seeking){f.logger.log("could not seek to "+o+", already seeking at "+d);return}var T=M.BufferHelper.getBuffered(p),E=T.length?T.start(0):0,g=E-o;g>0&&(g<this.config.maxBufferHole||g<this.config.maxFragLookUpTolerance)&&(f.logger.log("adjusting start position by "+g+" to match buffer start"),o+=g,this.startPosition=o),this.log("seek to target start position "+o+" from current time "+d),p.currentTime=o}},x._getAudioCodec=function(p){var d=this.config.defaultAudioCodec||p.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},x._loadBitrateTestFrag=function(p){var d=this;this._doFragLoad(p).then(function(o){var T=d.hls;if(!o||T.nextLoadLevel||d.fragContextChanged(p))return;d.fragLoadError=0,d.state=U.State.IDLE,d.startFragRequested=!1,d.bitrateTest=!1;var E=p.stats;E.parsing.start=E.parsing.end=E.buffering.start=E.buffering.end=self.performance.now(),T.trigger(F.Events.FRAG_LOADED,o)})},x._handleTransmuxComplete=function(p){var d,o="main",T=this.hls,E=p.remuxResult,g=p.chunkMeta,_=this.getCurrentContext(g);if(!_){this.warn("The loading context changed while buffering fragment "+g.sn+" of level "+g.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(g.level);return}var N=_.frag,B=_.part,W=_.level,P=E.video,I=E.text,H=E.id3,Y=E.initSegment,ee=this.altAudio?void 0:E.audio;if(this.fragContextChanged(N))return;if(this.state=U.State.PARSING,Y){Y.tracks&&(this._bufferInitSegment(W,Y.tracks,N,g),T.trigger(F.Events.FRAG_PARSING_INIT_SEGMENT,{frag:N,id:o,tracks:Y.tracks}));var oe=Y.initPTS,Ee=Y.timescale;Object(z.isFiniteNumber)(oe)&&(this.initPTS[N.cc]=oe,T.trigger(F.Events.INIT_PTS_FOUND,{frag:N,id:o,initPTS:oe,timescale:Ee}))}if(P&&E.independent!==!1){if(W.details){var pe=P.startPTS,me=P.endPTS,he=P.startDTS,se=P.endDTS;if(B)B.elementaryStreams[P.type]={startPTS:pe,endPTS:me,startDTS:he,endDTS:se};else if(P.firstKeyFrame&&P.independent&&(this.couldBacktrack=!0),P.dropped&&P.independent){var ne=this.getLoadPosition()+this.config.maxBufferHole;if(ne<pe){this.backtrack(N);return}N.setElementaryStreamInfo(P.type,N.start,me,N.start,se,!0)}N.setElementaryStreamInfo(P.type,pe,me,he,se),this.bufferFragmentData(P,N,B,g)}}else if(E.independent===!1){this.backtrack(N);return}if(ee){var ce=ee.startPTS,$=ee.endPTS,ie=ee.startDTS,Z=ee.endDTS;B&&(B.elementaryStreams[m.ElementaryStreamTypes.AUDIO]={startPTS:ce,endPTS:$,startDTS:ie,endDTS:Z}),N.setElementaryStreamInfo(m.ElementaryStreamTypes.AUDIO,ce,$,ie,Z),this.bufferFragmentData(ee,N,B,g)}if(H!=null&&(d=H.samples)!==null&&d!==void 0&&d.length){var ye={frag:N,id:o,samples:H.samples};T.trigger(F.Events.FRAG_PARSING_METADATA,ye)}if(I){var Ce={frag:N,id:o,samples:I.samples};T.trigger(F.Events.FRAG_PARSING_USERDATA,Ce)}},x._bufferInitSegment=function(p,d,o,T){var E=this;if(this.state!==U.State.PARSING)return;this.audioOnly=!!d.audio&&!d.video,this.altAudio&&!this.audioOnly&&delete d.audio;var g=d.audio,_=d.video,N=d.audiovideo;if(g){var B=p.audioCodec,W=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(B&&(B.indexOf("mp4a.40.5")!==-1?B="mp4a.40.2":B="mp4a.40.5"),g.metadata.channelCount!==1&&W.indexOf("firefox")===-1&&(B="mp4a.40.5")),W.indexOf("android")!==-1&&g.container!=="audio/mpeg"&&(B="mp4a.40.2",this.log("Android: force audio codec to "+B)),p.audioCodec&&p.audioCodec!==B&&this.log('Swapping manifest audio codec "'+p.audioCodec+'" for "'+B+'"'),g.levelCodec=B,g.id="main",this.log("Init audio buffer, container:"+g.container+", codecs[selected/level/parsed]=["+(B||"")+"/"+(p.audioCodec||"")+"/"+g.codec+"]")}_&&(_.levelCodec=p.videoCodec,_.id="main",this.log("Init video buffer, container:"+_.container+", codecs[level/parsed]=["+(p.videoCodec||"")+"/"+_.codec+"]")),N&&this.log("Init audiovideo buffer, container:"+N.container+", codecs[level/parsed]=["+(p.attrs.CODECS||"")+"/"+N.codec+"]"),this.hls.trigger(F.Events.BUFFER_CODECS,d),Object.keys(d).forEach(function(P){var I=d[P],H=I.initSegment;H!=null&&H.byteLength&&E.hls.trigger(F.Events.BUFFER_APPENDING,{type:P,data:H,frag:o,part:null,chunkMeta:T,parent:o.type})}),this.tick()},x.backtrack=function(p){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(p);var d=this.fragmentTracker.backtrack(p);this.fragPrevious=null,this.nextLoadPosition=p.start,d?this.resetFragmentLoading(p):this.state=U.State.BACKTRACKING},x.checkFragmentChanged=function(){var p=this.media,d=null;if(p&&p.readyState>1&&p.seeking===!1){var o=p.currentTime;if(M.BufferHelper.isBuffered(p,o)?d=this.getAppendedFrag(o):M.BufferHelper.isBuffered(p,o+.1)&&(d=this.getAppendedFrag(o+.1)),d){var T=this.fragPlaying,E=d.level;(!T||d.sn!==T.sn||T.level!==E||d.urlId!==T.urlId)&&(this.hls.trigger(F.Events.FRAG_CHANGED,{frag:d}),(!T||T.level!==E)&&this.hls.trigger(F.Events.LEVEL_SWITCHED,{level:E}),this.fragPlaying=d)}}},a(L,[{key:"nextLevel",get:function(){var p=this.nextBufferedFrag;return p?p.level:-1}},{key:"currentLevel",get:function(){var p=this.media;if(p){var d=this.getAppendedFrag(p.currentTime);if(d)return d.level}return-1}},{key:"nextBufferedFrag",get:function(){var p=this.media;if(p){var d=this.getAppendedFrag(p.currentTime);return this.followingBufferedFrag(d)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),L}(U.default)},"./src/controller/subtitle-stream-controller.ts":function(q,G,D){"use strict";D.r(G),D.d(G,"SubtitleStreamController",function(){return s});var z=D("./src/events.ts"),U=D("./src/utils/logger.ts"),O=D("./src/utils/buffer-helper.ts"),F=D("./src/controller/fragment-finders.ts"),M=D("./src/utils/discontinuities.ts"),R=D("./src/controller/level-helper.ts"),C=D("./src/controller/fragment-tracker.ts"),m=D("./src/controller/base-stream-controller.ts"),v=D("./src/types/loader.ts"),k=D("./src/types/level.ts");function S(l,A){for(var y=0;y<A.length;y++){var c=A[y];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(l,c.key,c)}}function b(l,A,y){return A&&S(l.prototype,A),y&&S(l,y),l}function f(l,A){l.prototype=Object.create(A.prototype),l.prototype.constructor=l,u(l,A)}function u(l,A){return u=Object.setPrototypeOf||function(c,L){return c.__proto__=L,c},u(l,A)}var a=500,s=function(l){f(A,l);function A(c,L){var x;return x=l.call(this,c,L,"[subtitle-stream-controller]")||this,x.levels=[],x.currentTrackId=-1,x.tracksBuffered=[],x.mainDetails=null,x._registerListeners(),x}var y=A.prototype;return y.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},y._registerListeners=function(){var L=this.hls;L.on(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),L.on(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),L.on(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),L.on(z.Events.LEVEL_LOADED,this.onLevelLoaded,this),L.on(z.Events.ERROR,this.onError,this),L.on(z.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),L.on(z.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),L.on(z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),L.on(z.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),L.on(z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},y._unregisterListeners=function(){var L=this.hls;L.off(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),L.off(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),L.off(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),L.off(z.Events.LEVEL_LOADED,this.onLevelLoaded,this),L.off(z.Events.ERROR,this.onError,this),L.off(z.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),L.off(z.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),L.off(z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),L.off(z.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),L.off(z.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},y.startLoad=function(){this.stopLoad(),this.state=m.State.IDLE,this.setInterval(a),this.tick()},y.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},y.onLevelLoaded=function(L,x){this.mainDetails=x.details},y.onSubtitleFragProcessed=function(L,x){var h=x.frag,p=x.success;if(this.fragPrevious=h,this.state=m.State.IDLE,!p)return;var d=this.tracksBuffered[this.currentTrackId];if(!d)return;for(var o,T=h.start,E=0;E<d.length;E++)if(T>=d[E].start&&T<=d[E].end){o=d[E];break}var g=h.start+h.duration;o?o.end=g:(o={start:T,end:g},d.push(o)),this.fragmentTracker.fragBuffered(h)},y.onBufferFlushing=function(L,x){var h=x.startOffset,p=x.endOffset;if(h===0&&p!==Number.POSITIVE_INFINITY){var d=this.currentTrackId,o=this.levels;if(!o.length||!o[d]||!o[d].details)return;var T=o[d].details,E=T.targetduration,g=p-E;if(g<=0)return;x.endOffsetSubtitles=Math.max(0,g),this.tracksBuffered.forEach(function(_){for(var N=0;N<_.length;){if(_[N].end<=g){_.shift();continue}else if(_[N].start<g)_[N].start=g;else break;N++}}),this.fragmentTracker.removeFragmentsInRange(h,g,v.PlaylistLevelType.SUBTITLE)}},y.onError=function(L,x){var h,p=x.frag;if(!p||p.type!==v.PlaylistLevelType.SUBTITLE)return;(h=this.fragCurrent)!==null&&h!==void 0&&h.loader&&this.fragCurrent.loader.abort(),this.state=m.State.IDLE},y.onSubtitleTracksUpdated=function(L,x){var h=this,p=x.subtitleTracks;this.tracksBuffered=[],this.levels=p.map(function(d){return new k.Level(d)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(d){h.tracksBuffered[d.id]=[]}),this.mediaBuffer=null},y.onSubtitleTrackSwitch=function(L,x){if(this.currentTrackId=x.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var h=this.levels[this.currentTrackId];h!=null&&h.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,h&&this.setInterval(a)},y.onSubtitleTrackLoaded=function(L,x){var h,p=x.details,d=x.id,o=this.currentTrackId,T=this.levels;if(!T.length)return;var E=T[o];if(d>=T.length||d!==o||!E)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,p.live||(h=E.details)!==null&&h!==void 0&&h.live){var g=this.mainDetails;if(p.deltaUpdateFailed||!g)return;var _=g.fragments[0];if(!E.details)p.hasProgramDateTime&&g.hasProgramDateTime?Object(M.alignMediaPlaylistByPDT)(p,g):_&&Object(R.addSliding)(p,_.start);else{var N=this.alignPlaylists(p,E.details);N===0&&_&&Object(R.addSliding)(p,_.start)}}if(E.details=p,this.levelLastLoaded=d,this.tick(),p.live&&!this.fragCurrent&&this.media&&this.state===m.State.IDLE){var B=Object(F.findFragmentByPTS)(null,p.fragments,this.media.currentTime,0);B||(this.warn("Subtitle playlist not aligned with playback"),E.details=void 0)}},y._handleFragmentLoadComplete=function(L){var x=L.frag,h=L.payload,p=x.decryptdata,d=this.hls;if(this.fragContextChanged(x))return;if(h&&h.byteLength>0&&p&&p.key&&p.iv&&p.method==="AES-128"){var o=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(h),p.key.buffer,p.iv.buffer).then(function(T){var E=performance.now();d.trigger(z.Events.FRAG_DECRYPTED,{frag:x,payload:T,stats:{tstart:o,tdecrypt:E}})})}},y.doTick=function(){if(!this.media){this.state=m.State.IDLE;return}if(this.state===m.State.IDLE){var L,x=this.currentTrackId,h=this.levels;if(!h.length||!h[x]||!h[x].details)return;var p=h[x].details,d=p.targetduration,o=this.config,T=this.media,E=O.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,T.currentTime-d,o.maxBufferHole),g=E.end,_=E.len,N=this.getMaxBufferLength()+d;if(_>N)return;console.assert(p,"Subtitle track details are defined on idle subtitle stream controller tick");var B=p.fragments,W=B.length,P=p.edge,I,H=this.fragPrevious;if(g<P){var Y=o.maxFragLookUpTolerance;H&&p.hasProgramDateTime&&(I=Object(F.findFragmentByPDT)(B,H.endProgramDateTime,Y)),I||(I=Object(F.findFragmentByPTS)(H,B,g,Y),!I&&H&&H.start<B[0].start&&(I=B[0]))}else I=B[W-1];(L=I)!==null&&L!==void 0&&L.encrypted?(U.logger.log("Loading key for "+I.sn),this.state=m.State.KEY_LOADING,this.hls.trigger(z.Events.KEY_LOADING,{frag:I})):I&&this.fragmentTracker.getState(I)===C.FragmentState.NOT_LOADED&&this.loadFragment(I,p,g)}},y.loadFragment=function(L,x,h){this.fragCurrent=L,l.prototype.loadFragment.call(this,L,x,h)},b(A,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),A}(m.default)},"./src/controller/subtitle-track-controller.ts":function(q,G,D){"use strict";D.r(G);var z=D("./src/events.ts"),U=D("./src/utils/texttrack-utils.ts"),O=D("./src/controller/base-playlist-controller.ts"),F=D("./src/types/loader.ts");function M(S,b){for(var f=0;f<b.length;f++){var u=b[f];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(S,u.key,u)}}function R(S,b,f){return b&&M(S.prototype,b),f&&M(S,f),S}function C(S,b){S.prototype=Object.create(b.prototype),S.prototype.constructor=S,m(S,b)}function m(S,b){return m=Object.setPrototypeOf||function(u,a){return u.__proto__=a,u},m(S,b)}var v=function(S){C(b,S);function b(u){var a;return a=S.call(this,u,"[subtitle-track-controller]")||this,a.media=null,a.tracks=[],a.groupId=null,a.tracksInGroup=[],a.trackId=-1,a.selectDefaultTrack=!0,a.queuedDefaultTrack=-1,a.trackChangeListener=function(){return a.onTextTracksChanged()},a.asyncPollTrackChange=function(){return a.pollTrackChange(0)},a.useTextTrackPolling=!1,a.subtitlePollingInterval=-1,a.subtitleDisplay=!0,a.registerListeners(),a}var f=b.prototype;return f.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,S.prototype.destroy.call(this)},f.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.MANIFEST_PARSED,this.onManifestParsed,this),a.on(z.Events.LEVEL_LOADING,this.onLevelLoading,this),a.on(z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),a.on(z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),a.on(z.Events.ERROR,this.onError,this)},f.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.MANIFEST_PARSED,this.onManifestParsed,this),a.off(z.Events.LEVEL_LOADING,this.onLevelLoading,this),a.off(z.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),a.off(z.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),a.off(z.Events.ERROR,this.onError,this)},f.onMediaAttached=function(a,s){if(this.media=s.media,!this.media)return;this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange)},f.pollTrackChange=function(a){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,a)},f.onMediaDetaching=function(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId);var a=k(this.media.textTracks);a.forEach(function(s){Object(U.clearCurrentCues)(s)}),this.subtitleTrack=-1,this.media=null},f.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},f.onManifestParsed=function(a,s){this.tracks=s.subtitleTracks},f.onSubtitleTrackLoaded=function(a,s){var l=s.id,A=s.details,y=this.trackId,c=this.tracksInGroup[y];if(!c){this.warn("Invalid subtitle track id "+l);return}var L=c.details;c.details=s.details,this.log("subtitle track "+l+" loaded ["+A.startSN+"-"+A.endSN+"]"),l===this.trackId&&(this.retryCount=0,this.playlistLoaded(l,s,L))},f.onLevelLoading=function(a,s){this.switchLevel(s.level)},f.onLevelSwitching=function(a,s){this.switchLevel(s.level)},f.switchLevel=function(a){var s=this.hls.levels[a];if(!(s!=null&&s.textGroupIds))return;var l=s.textGroupIds[s.urlId];if(this.groupId!==l){var A=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,y=this.tracks.filter(function(x){return!l||x.groupId===l});this.tracksInGroup=y;var c=this.findTrackId(A==null?void 0:A.name)||this.findTrackId();this.groupId=l;var L={subtitleTracks:y};this.log("Updating subtitle tracks, "+y.length+' track(s) found in "'+l+'" group-id'),this.hls.trigger(z.Events.SUBTITLE_TRACKS_UPDATED,L),c!==-1&&this.setSubtitleTrack(c,A)}},f.findTrackId=function(a){for(var s=this.tracksInGroup,l=0;l<s.length;l++){var A=s[l];if((!this.selectDefaultTrack||A.default)&&(!a||a===A.name))return A.id}return-1},f.onError=function(a,s){if(S.prototype.onError.call(this,a,s),s.fatal||!s.context)return;s.context.type===F.PlaylistContextType.SUBTITLE_TRACK&&s.context.id===this.trackId&&s.context.groupId===this.groupId&&this.retryLoadingOrFail(s)},f.loadPlaylist=function(a){var s=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(s)){var l=s.id,A=s.groupId,y=s.url;if(a)try{y=a.addDirectives(y)}catch(c){this.warn("Could not construct new URL with HLS Delivery Directives: "+c)}this.log("Loading subtitle playlist for id "+l),this.hls.trigger(z.Events.SUBTITLE_TRACK_LOADING,{url:y,id:l,groupId:A,deliveryDirectives:a||null})}},f.toggleTrackModes=function(a){var s=this,l=this.media,A=this.subtitleDisplay,y=this.trackId;if(!l)return;var c=k(l.textTracks),L=c.filter(function(p){return p.groupId===s.groupId});if(a===-1)[].slice.call(c).forEach(function(p){p.mode="disabled"});else{var x=L[y];x&&(x.mode="disabled")}var h=L[a];h&&(h.mode=A?"showing":"hidden")},f.setSubtitleTrack=function(a,s){var l,A=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=a;return}if(this.trackId!==a&&this.toggleTrackModes(a),this.trackId===a&&(a===-1||(l=A[a])!==null&&l!==void 0&&l.details)||a<-1||a>=A.length)return;this.clearTimer();var y=A[a];if(this.log("Switching to subtitle track "+a),this.trackId=a,y){var c=y.id,L=y.groupId,x=L===void 0?"":L,h=y.name,p=y.type,d=y.url;this.hls.trigger(z.Events.SUBTITLE_TRACK_SWITCH,{id:c,groupId:x,name:h,type:p,url:d});var o=this.switchParams(y.url,s==null?void 0:s.details);this.loadPlaylist(o)}else this.hls.trigger(z.Events.SUBTITLE_TRACK_SWITCH,{id:a})},f.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var a=-1,s=k(this.media.textTracks),l=0;l<s.length;l++)if(s[l].mode==="hidden")a=l;else if(s[l].mode==="showing"){a=l;break}this.subtitleTrack!==a&&(this.subtitleTrack=a)},R(b,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(a){this.selectDefaultTrack=!1;var s=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(a,s)}}]),b}(O.default);function k(S){for(var b=[],f=0;f<S.length;f++){var u=S[f];u.kind==="subtitles"&&u.label&&b.push(S[f])}return b}G.default=v},"./src/controller/timeline-controller.ts":function(q,G,D){"use strict";D.r(G),D.d(G,"TimelineController",function(){return k});var z=D("./src/polyfills/number.ts"),U=D("./src/events.ts"),O=D("./src/utils/cea-608-parser.ts"),F=D("./src/utils/output-filter.ts"),M=D("./src/utils/webvtt-parser.ts"),R=D("./src/utils/texttrack-utils.ts"),C=D("./src/utils/imsc1-ttml-parser.ts"),m=D("./src/types/loader.ts"),v=D("./src/utils/logger.ts"),k=function(){function u(s){if(this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.timescale=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=f(),this.captionsProperties=void 0,this.hls=s,this.config=s.config,this.Cues=s.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},this.config.enableCEA708Captions){var l=new F.default(this,"textTrack1"),A=new F.default(this,"textTrack2"),y=new F.default(this,"textTrack3"),c=new F.default(this,"textTrack4");this.cea608Parser1=new O.default(1,l,A),this.cea608Parser2=new O.default(3,y,c)}s.on(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),s.on(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.on(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.on(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),s.on(U.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),s.on(U.Events.FRAG_LOADING,this.onFragLoading,this),s.on(U.Events.FRAG_LOADED,this.onFragLoaded,this),s.on(U.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),s.on(U.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),s.on(U.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),s.on(U.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),s.on(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var a=u.prototype;return a.destroy=function(){var l=this.hls;l.off(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),l.off(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.off(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.off(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),l.off(U.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),l.off(U.Events.FRAG_LOADING,this.onFragLoading,this),l.off(U.Events.FRAG_LOADED,this.onFragLoaded,this),l.off(U.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),l.off(U.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),l.off(U.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),l.off(U.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),l.off(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},a.addCues=function(l,A,y,c,L){for(var x=!1,h=L.length;h--;){var p=L[h],d=b(p[0],p[1],A,y);if(d>=0&&(p[0]=Math.min(p[0],A),p[1]=Math.max(p[1],y),x=!0,d/(y-A)>.5))return}if(x||L.push([A,y]),this.config.renderTextTracksNatively){var o=this.captionsTracks[l];this.Cues.newCue(o,A,y,c)}else{var T=this.Cues.newCue(null,A,y,c);this.hls.trigger(U.Events.CUES_PARSED,{type:"captions",cues:T,track:l})}},a.onInitPtsFound=function(l,A){var y=this,c=A.frag,L=A.id,x=A.initPTS,h=A.timescale,p=this.unparsedVttFrags;L==="main"&&(this.initPTS[c.cc]=x,this.timescale[c.cc]=h),p.length&&(this.unparsedVttFrags=[],p.forEach(function(d){y.onFragLoaded(U.Events.FRAG_LOADED,d)}))},a.getExistingTrack=function(l){var A=this.media;if(A)for(var y=0;y<A.textTracks.length;y++){var c=A.textTracks[y];if(c[l])return c}return null},a.createCaptionsTrack=function(l){this.config.renderTextTracksNatively?this.createNativeTrack(l):this.createNonNativeTrack(l)},a.createNativeTrack=function(l){if(this.captionsTracks[l])return;var A=this.captionsProperties,y=this.captionsTracks,c=this.media,L=A[l],x=L.label,h=L.languageCode,p=this.getExistingTrack(l);if(p)y[l]=p,Object(R.clearCurrentCues)(y[l]),Object(R.sendAddTrackEvent)(y[l],c);else{var d=this.createTextTrack("captions",x,h);d&&(d[l]=!0,y[l]=d)}},a.createNonNativeTrack=function(l){if(this.nonNativeCaptionsTracks[l])return;var A=this.captionsProperties[l];if(!A)return;var y=A.label,c={_id:l,label:y,kind:"captions",default:A.media?!!A.media.default:!1,closedCaptions:A.media};this.nonNativeCaptionsTracks[l]=c,this.hls.trigger(U.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[c]})},a.createTextTrack=function(l,A,y){var c=this.media;return c?c.addTextTrack(l,A,y):void 0},a.onMediaAttaching=function(l,A){this.media=A.media,this._cleanTracks()},a.onMediaDetaching=function(){var l=this.captionsTracks;Object.keys(l).forEach(function(A){Object(R.clearCurrentCues)(l[A]),delete l[A]}),this.nonNativeCaptionsTracks={}},a.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=f(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.timescale=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},a._cleanTracks=function(){var l=this.media;if(!l)return;var A=l.textTracks;if(A)for(var y=0;y<A.length;y++)Object(R.clearCurrentCues)(A[y])},a.onSubtitleTracksUpdated=function(l,A){var y=this;this.textTracks=[];var c=A.subtitleTracks||[],L=c.some(function(d){return d.textCodec===C.IMSC1_CODEC});if(this.config.enableWebVTT||L&&this.config.enableIMSC1){var x=this.tracks&&c&&this.tracks.length===c.length;if(this.tracks=c||[],this.config.renderTextTracksNatively){var h=this.media?this.media.textTracks:[];this.tracks.forEach(function(d,o){var T;if(o<h.length){for(var E=null,g=0;g<h.length;g++)if(S(h[g],d)){E=h[g];break}E&&(T=E)}T?Object(R.clearCurrentCues)(T):(T=y.createTextTrack("subtitles",d.name,d.lang),T&&(T.mode="disabled")),T&&(T.groupId=d.groupId,y.textTracks.push(T))})}else if(!x&&this.tracks&&this.tracks.length){var p=this.tracks.map(function(d){return{label:d.name,kind:d.type.toLowerCase(),default:d.default,subtitleTrack:d}});this.hls.trigger(U.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:p})}}},a.onManifestLoaded=function(l,A){var y=this;this.config.enableCEA708Captions&&A.captions&&A.captions.forEach(function(c){var L=/(?:CC|SERVICE)([1-4])/.exec(c.instreamId);if(!L)return;var x="textTrack"+L[1],h=y.captionsProperties[x];if(!h)return;h.label=c.name,c.lang&&(h.languageCode=c.lang),h.media=c})},a.onFragLoading=function(l,A){var y=this.cea608Parser1,c=this.cea608Parser2,L=this.lastSn,x=this.lastPartIndex;if(!this.enabled||!(y&&c))return;if(A.frag.type===m.PlaylistLevelType.MAIN){var h,p,d=A.frag.sn,o=(h=A==null||((p=A.part)===null||p===void 0)?void 0:p.index)!=null?h:-1;d===L+1||d===L&&o===x+1||(y.reset(),c.reset()),this.lastSn=d,this.lastPartIndex=o}},a.onFragLoaded=function(l,A){var y=A.frag,c=A.payload,L=this.initPTS,x=this.unparsedVttFrags;if(y.type===m.PlaylistLevelType.SUBTITLE)if(c.byteLength){if(!Object(z.isFiniteNumber)(L[y.cc])){x.push(A),L.length&&this.hls.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:y,error:new Error("Missing initial subtitle PTS")});return}var h=y.decryptdata;if(h==null||h.key==null||h.method!=="AES-128"){var p=this.tracks[y.level],d=this.vttCCs;d[y.cc]||(d[y.cc]={start:y.start,prevCC:this.prevCC,new:!0},this.prevCC=y.cc),p&&p.textCodec===C.IMSC1_CODEC?this._parseIMSC1(y,c):this._parseVTTs(y,c,d)}}else this.hls.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:y,error:new Error("Empty subtitle payload")})},a._parseIMSC1=function(l,A){var y=this,c=this.hls;Object(C.parseIMSC1)(A,this.initPTS[l.cc],this.timescale[l.cc],function(L){y._appendCues(L,l.level),c.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:l})},function(L){v.logger.log("Failed to parse IMSC1: "+L),c.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:l,error:L})})},a._parseVTTs=function(l,A,y){var c=this,L=this.hls;Object(M.parseWebVTT)(A,this.initPTS[l.cc],this.timescale[l.cc],y,l.cc,l.start,function(x){c._appendCues(x,l.level),L.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:l})},function(x){c._fallbackToIMSC1(l,A),v.logger.log("Failed to parse VTT cue: "+x),L.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:l,error:x})})},a._fallbackToIMSC1=function(l,A){var y=this,c=this.tracks[l.level];c.textCodec||Object(C.parseIMSC1)(A,this.initPTS[l.cc],this.timescale[l.cc],function(){c.textCodec=C.IMSC1_CODEC,y._parseIMSC1(l,A)},function(){c.textCodec="wvtt"})},a._appendCues=function(l,A){var y=this.hls;if(this.config.renderTextTracksNatively){var c=this.textTracks[A];if(c.mode==="disabled")return;l.forEach(function(h){return Object(R.addCueToTrack)(c,h)})}else{var L=this.tracks[A],x=L.default?"default":"subtitles"+A;y.trigger(U.Events.CUES_PARSED,{type:"subtitles",cues:l,track:x})}},a.onFragDecrypted=function(l,A){var y=A.frag;if(y.type===m.PlaylistLevelType.SUBTITLE){if(!Object(z.isFiniteNumber)(this.initPTS[y.cc])){this.unparsedVttFrags.push(A);return}this.onFragLoaded(U.Events.FRAG_LOADED,A)}},a.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},a.onFragParsingUserdata=function(l,A){var y=this.cea608Parser1,c=this.cea608Parser2;if(!this.enabled||!(y&&c))return;for(var L=0;L<A.samples.length;L++){var x=A.samples[L].bytes;if(x){var h=this.extractCea608Data(x);y.addData(A.samples[L].pts,h[0]),c.addData(A.samples[L].pts,h[1])}}},a.onBufferFlushing=function(l,A){var y=A.startOffset,c=A.endOffset,L=A.endOffsetSubtitles,x=A.type,h=this.media;if(!h||h.currentTime<c)return;if(!x||x==="video"){var p=this.captionsTracks;Object.keys(p).forEach(function(o){return Object(R.removeCuesInRange)(p[o],y,c)})}if(this.config.renderTextTracksNatively&&(y===0&&L!==void 0)){var d=this.textTracks;Object.keys(d).forEach(function(o){return Object(R.removeCuesInRange)(d[o],y,L)})}},a.extractCea608Data=function(l){for(var A=l[0]&31,y=2,c=[[],[]],L=0;L<A;L++){var x=l[y++],h=127&l[y++],p=127&l[y++],d=(4&x)!==0,o=3&x;if(h===0&&p===0)continue;d&&((o===0||o===1)&&(c[o].push(h),c[o].push(p)))}return c},u}();function S(u,a){return u&&u.label===a.name&&!(u.textTrack1||u.textTrack2)}function b(u,a,s,l){return Math.min(a,l)-Math.max(u,s)}function f(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(q,G,D){"use strict";D.r(G),D.d(G,"default",function(){return z});var z=function(){function U(F,M){this.subtle=void 0,this.aesIV=void 0,this.subtle=F,this.aesIV=M}var O=U.prototype;return O.decrypt=function(M,R){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},R,M)},U}()},"./src/crypt/aes-decryptor.ts":function(q,G,D){"use strict";D.r(G),D.d(G,"removePadding",function(){return U}),D.d(G,"default",function(){return O});var z=D("./src/utils/typed-array.ts");function U(F){var M=F.byteLength,R=M&&new DataView(F.buffer).getUint8(M-1);return R?Object(z.sliceUint8)(F,0,M-R):F}var O=function(){function F(){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 M=F.prototype;return M.uint8ArrayToUint32Array_=function(C){for(var m=new DataView(C),v=new Uint32Array(4),k=0;k<4;k++)v[k]=m.getUint32(k*4);return v},M.initTable=function(){var C=this.sBox,m=this.invSBox,v=this.subMix,k=v[0],S=v[1],b=v[2],f=v[3],u=this.invSubMix,a=u[0],s=u[1],l=u[2],A=u[3],y=new Uint32Array(256),c=0,L=0,x=0;for(x=0;x<256;x++)x<128?y[x]=x<<1:y[x]=x<<1^283;for(x=0;x<256;x++){var h=L^L<<1^L<<2^L<<3^L<<4;h=h>>>8^h&255^99,C[c]=h,m[h]=c;var p=y[c],d=y[p],o=y[d],T=y[h]*257^h*16843008;k[c]=T<<24|T>>>8,S[c]=T<<16|T>>>16,b[c]=T<<8|T>>>24,f[c]=T,T=o*16843009^d*65537^p*257^c*16843008,a[h]=T<<24|T>>>8,s[h]=T<<16|T>>>16,l[h]=T<<8|T>>>24,A[h]=T,c?(c=p^y[y[y[o^p]]],L^=y[y[L]]):c=L=1}},M.expandKey=function(C){for(var m=this.uint8ArrayToUint32Array_(C),v=!0,k=0;k<m.length&&v;)v=m[k]===this.key[k],k++;if(v)return;this.key=m;var S=this.keySize=m.length;if(S!==4&&S!==6&&S!==8)throw new Error("Invalid aes key size="+S);var b=this.ksRows=(S+6+1)*4,f,u,a=this.keySchedule=new Uint32Array(b),s=this.invKeySchedule=new Uint32Array(b),l=this.sBox,A=this.rcon,y=this.invSubMix,c=y[0],L=y[1],x=y[2],h=y[3],p,d;for(f=0;f<b;f++){if(f<S){p=a[f]=m[f];continue}d=p,f%S===0?(d=d<<8|d>>>24,d=l[d>>>24]<<24|l[d>>>16&255]<<16|l[d>>>8&255]<<8|l[d&255],d^=A[f/S|0]<<24):S>6&&f%S===4&&(d=l[d>>>24]<<24|l[d>>>16&255]<<16|l[d>>>8&255]<<8|l[d&255]),a[f]=p=(a[f-S]^d)>>>0}for(u=0;u<b;u++)f=b-u,u&3?d=a[f]:d=a[f-4],u<4||f<=4?s[u]=d:s[u]=c[l[d>>>24]]^L[l[d>>>16&255]]^x[l[d>>>8&255]]^h[l[d&255]],s[u]=s[u]>>>0},M.networkToHostOrderSwap=function(C){return C<<24|(C&65280)<<8|(C&16711680)>>8|C>>>24},M.decrypt=function(C,m,v){for(var k=this.keySize+6,S=this.invKeySchedule,b=this.invSBox,f=this.invSubMix,u=f[0],a=f[1],s=f[2],l=f[3],A=this.uint8ArrayToUint32Array_(v),y=A[0],c=A[1],L=A[2],x=A[3],h=new Int32Array(C),p=new Int32Array(h.length),d,o,T,E,g,_,N,B,W,P,I,H,Y,ee,oe=this.networkToHostOrderSwap;m<h.length;){for(W=oe(h[m]),P=oe(h[m+1]),I=oe(h[m+2]),H=oe(h[m+3]),g=W^S[0],_=H^S[1],N=I^S[2],B=P^S[3],Y=4,ee=1;ee<k;ee++)d=u[g>>>24]^a[_>>16&255]^s[N>>8&255]^l[B&255]^S[Y],o=u[_>>>24]^a[N>>16&255]^s[B>>8&255]^l[g&255]^S[Y+1],T=u[N>>>24]^a[B>>16&255]^s[g>>8&255]^l[_&255]^S[Y+2],E=u[B>>>24]^a[g>>16&255]^s[_>>8&255]^l[N&255]^S[Y+3],g=d,_=o,N=T,B=E,Y=Y+4;d=b[g>>>24]<<24^b[_>>16&255]<<16^b[N>>8&255]<<8^b[B&255]^S[Y],o=b[_>>>24]<<24^b[N>>16&255]<<16^b[B>>8&255]<<8^b[g&255]^S[Y+1],T=b[N>>>24]<<24^b[B>>16&255]<<16^b[g>>8&255]<<8^b[_&255]^S[Y+2],E=b[B>>>24]<<24^b[g>>16&255]<<16^b[_>>8&255]<<8^b[N&255]^S[Y+3],p[m]=oe(d^y),p[m+1]=oe(E^c),p[m+2]=oe(T^L),p[m+3]=oe(o^x),y=W,c=P,L=I,x=H,m=m+4}return p.buffer},F}()},"./src/crypt/decrypter.ts":function(q,G,D){"use strict";D.r(G),D.d(G,"default",function(){return m});var z=D("./src/crypt/aes-crypto.ts"),U=D("./src/crypt/fast-aes-key.ts"),O=D("./src/crypt/aes-decryptor.ts"),F=D("./src/utils/logger.ts"),M=D("./src/utils/mp4-tools.ts"),R=D("./src/utils/typed-array.ts"),C=16,m=function(){function v(S,b,f){var u=f===void 0?{}:f,a=u.removePKCS7Padding,s=a===void 0?!0:a;if(this.logEnabled=!0,this.observer=void 0,this.config=void 0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.observer=S,this.config=b,this.removePKCS7Padding=s,s)try{var l=self.crypto;l&&(this.subtle=l.subtle||l.webkitSubtle)}catch(A){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var k=v.prototype;return k.destroy=function(){this.observer=null},k.isSync=function(){return this.config.enableSoftwareAES},k.flush=function(){var b=this.currentResult;if(!b){this.reset();return}var f=new Uint8Array(b);return this.reset(),this.removePKCS7Padding?Object(O.removePadding)(f):f},k.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},k.decrypt=function(b,f,u,a){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(b),f,u);var s=this.flush();s&&a(s.buffer)}else this.webCryptoDecrypt(new Uint8Array(b),f,u).then(a)},k.softwareDecrypt=function(b,f,u){var a=this.currentIV,s=this.currentResult,l=this.remainderData;this.logOnce("JS AES decrypt"),l&&(b=Object(M.appendUint8Array)(l,b),this.remainderData=null);var A=this.getValidChunk(b);if(!A.length)return null;a&&(u=a);var y=this.softwareDecrypter;y||(y=this.softwareDecrypter=new O.default),y.expandKey(f);var c=s;return this.currentResult=y.decrypt(A.buffer,0,u),this.currentIV=Object(R.sliceUint8)(A,-16).buffer,c||null},k.webCryptoDecrypt=function(b,f,u){var a=this,s=this.subtle;return(this.key!==f||!this.fastAesKey)&&(this.key=f,this.fastAesKey=new U.default(s,f)),this.fastAesKey.expandKey().then(function(l){if(!s)return Promise.reject(new Error("web crypto not initialized"));var A=new z.default(s,u);return A.decrypt(b.buffer,l)}).catch(function(l){return a.onWebCryptoError(l,b,f,u)})},k.onWebCryptoError=function(b,f,u,a){return F.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",b),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(f,u,a)},k.getValidChunk=function(b){var f=b,u=b.length-b.length%C;return u!==b.length&&(f=Object(R.sliceUint8)(b,0,u),this.remainderData=Object(R.sliceUint8)(b,u)),f},k.logOnce=function(b){if(!this.logEnabled)return;F.logger.log("[decrypter.ts]: "+b),this.logEnabled=!1},v}()},"./src/crypt/fast-aes-key.ts":function(q,G,D){"use strict";D.r(G),D.d(G,"default",function(){return z});var z=function(){function U(F,M){this.subtle=void 0,this.key=void 0,this.subtle=F,this.key=M}var O=U.prototype;return O.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},U}()},"./src/demux/aacdemuxer.ts":function(q,G,D){"use strict";D.r(G);var z=D("./src/demux/base-audio-demuxer.ts"),U=D("./src/demux/adts.ts"),O=D("./src/utils/logger.ts"),F=D("./src/demux/id3.ts");function M(m,v){m.prototype=Object.create(v.prototype),m.prototype.constructor=m,R(m,v)}function R(m,v){return R=Object.setPrototypeOf||function(S,b){return S.__proto__=b,S},R(m,v)}var C=function(m){M(v,m);function v(S,b){var f;return f=m.call(this)||this,f.observer=void 0,f.config=void 0,f.observer=S,f.config=b,f}var k=v.prototype;return k.resetInitSegment=function(b,f,u){m.prototype.resetInitSegment.call(this,b,f,u),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:b,duration:u,inputTimeScale:9e4,dropped:0}},v.probe=function(b){if(!b)return!1;for(var f=F.getID3Data(b,0)||[],u=f.length,a=b.length;u<a;u++)if(U.probe(b,u))return O.logger.log("ADTS sync word found !"),!0;return!1},k.canParse=function(b,f){return U.canParse(b,f)},k.appendFrame=function(b,f,u){U.initTrackConfig(b,this.observer,f,u,b.manifestCodec);var a=U.appendFrame(b,f,u,this.initPTS,this.frameIndex);if(a&&a.missing===0)return a},v}(z.default);C.minProbeByteLength=9,G.default=C},"./src/demux/adts.ts":function(q,G,D){"use strict";D.r(G),D.d(G,"getAudioConfig",function(){return F}),D.d(G,"isHeaderPattern",function(){return M}),D.d(G,"getHeaderLength",function(){return R}),D.d(G,"getFullFrameLength",function(){return C}),D.d(G,"canGetFrameLength",function(){return m}),D.d(G,"isHeader",function(){return v}),D.d(G,"canParse",function(){return k}),D.d(G,"probe",function(){return S}),D.d(G,"initTrackConfig",function(){return b}),D.d(G,"getFrameDuration",function(){return f}),D.d(G,"parseFrameHeader",function(){return u}),D.d(G,"appendFrame",function(){return a});var z=D("./src/utils/logger.ts"),U=D("./src/errors.ts"),O=D("./src/events.ts");function F(s,l,A,y){var c,L,x,h,p=navigator.userAgent.toLowerCase(),d=y,o=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];c=((l[A+2]&192)>>>6)+1;var T=(l[A+2]&60)>>>2;if(T>o.length-1){s.trigger(O.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+T});return}return x=(l[A+2]&1)<<2,x|=(l[A+3]&192)>>>6,z.logger.log("manifest codec:"+y+", ADTS type:"+c+", samplingIndex:"+T),/firefox/i.test(p)?T>=6?(c=5,h=new Array(4),L=T-3):(c=2,h=new Array(2),L=T):p.indexOf("android")!==-1?(c=2,h=new Array(2),L=T):(c=5,h=new Array(4),y&&(y.indexOf("mp4a.40.29")!==-1||y.indexOf("mp4a.40.5")!==-1)||!y&&T>=6?L=T-3:((y&&y.indexOf("mp4a.40.2")!==-1&&(T>=6&&x===1||/vivaldi/i.test(p))||!y&&x===1)&&(c=2,h=new Array(2)),L=T)),h[0]=c<<3,h[0]|=(T&14)>>1,h[1]|=(T&1)<<7,h[1]|=x<<3,c===5&&(h[1]|=(L&14)>>1,h[2]=(L&1)<<7,h[2]|=2<<2,h[3]=0),{config:h,samplerate:o[T],channelCount:x,codec:"mp4a.40."+c,manifestCodec:d}}function M(s,l){return s[l]===255&&(s[l+1]&246)===240}function R(s,l){return s[l+1]&1?7:9}function C(s,l){return(s[l+3]&3)<<11|s[l+4]<<3|(s[l+5]&224)>>>5}function m(s,l){return l+5<s.length}function v(s,l){return l+1<s.length&&M(s,l)}function k(s,l){return m(s,l)&&M(s,l)&&C(s,l)<=s.length-l}function S(s,l){if(v(s,l)){var A=R(s,l);if(l+A>=s.length)return!1;var y=C(s,l);if(y<=A)return!1;var c=l+y;return c===s.length||v(s,c)}return!1}function b(s,l,A,y,c){if(!s.samplerate){var L=F(l,A,y,c);if(!L)return;s.config=L.config,s.samplerate=L.samplerate,s.channelCount=L.channelCount,s.codec=L.codec,s.manifestCodec=L.manifestCodec,z.logger.log("parsed codec:"+s.codec+", rate:"+L.samplerate+", channels:"+L.channelCount)}}function f(s){return 1024*9e4/s}function u(s,l,A,y,c){var L=R(s,l),x=C(s,l);if(x-=L,x>0){var h=A+y*c;return{headerLength:L,frameLength:x,stamp:h}}}function a(s,l,A,y,c){var L=f(s.samplerate),x=u(l,A,y,c,L);if(x){var h=x.frameLength,p=x.headerLength,d=x.stamp,o=p+h,T=Math.max(0,A+o-l.length),E;T?(E=new Uint8Array(o-p),E.set(l.subarray(A+p,l.length),0)):E=l.subarray(A+p,A+o);var g={unit:E,pts:d};return T||s.samples.push(g),{sample:g,length:o,missing:T}}}},"./src/demux/base-audio-demuxer.ts":function(q,G,D){"use strict";D.r(G),D.d(G,"initPTSFn",function(){return C});var z=D("./src/polyfills/number.ts"),U=D("./src/demux/id3.ts"),O=D("./src/demux/dummy-demuxed-track.ts"),F=D("./src/utils/mp4-tools.ts"),M=D("./src/utils/typed-array.ts"),R=function(){function m(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var v=m.prototype;return v.resetInitSegment=function(S,b,f){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},v.resetTimeStamp=function(){},v.resetContiguity=function(){},v.canParse=function(S,b){return!1},v.appendFrame=function(S,b,f){},v.demux=function(S,b){this.cachedData&&(S=Object(F.appendUint8Array)(this.cachedData,S),this.cachedData=null);var f=U.getID3Data(S,0),u=f?f.length:0,a,s,l=this._audioTrack,A=this._id3Track,y=f?U.getTimeStamp(f):void 0,c=S.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=C(y,b)),f&&f.length>0&&A.samples.push({pts:this.initPTS,dts:this.initPTS,data:f}),s=this.initPTS;u<c;){if(this.canParse(S,u)){var L=this.appendFrame(l,S,u);L?(this.frameIndex++,s=L.sample.pts,u+=L.length,a=u):u=c}else U.canParse(S,u)?(f=U.getID3Data(S,u),A.samples.push({pts:s,dts:s,data:f}),u+=f.length,a=u):u++;if(u===c&&a!==c){var x=Object(M.sliceUint8)(S,a);this.cachedData?this.cachedData=Object(F.appendUint8Array)(this.cachedData,x):this.cachedData=x}}return{audioTrack:l,avcTrack:Object(O.dummyTrack)(),id3Track:A,textTrack:Object(O.dummyTrack)()}},v.demuxSampleAes=function(S,b,f){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},v.flush=function(S){var b=this.cachedData;return b&&(this.cachedData=null,this.demux(b,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(O.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(O.dummyTrack)()}},v.destroy=function(){},m}(),C=function(v,k){return Object(z.isFiniteNumber)(v)?v*90:k*9e4};G.default=R},"./src/demux/chunk-cache.ts":function(q,G,D){"use strict";D.r(G),D.d(G,"default",function(){return z});var z=function(){function O(){this.chunks=[],this.dataLength=0}var F=O.prototype;return F.push=function(R){this.chunks.push(R),this.dataLength+=R.length},F.flush=function(){var R=this.chunks,C=this.dataLength,m;if(R.length)R.length===1?m=R[0]:m=U(R,C);else return new Uint8Array(0);return this.reset(),m},F.reset=function(){this.chunks.length=0,this.dataLength=0},O}();function U(O,F){for(var M=new Uint8Array(F),R=0,C=0;C<O.length;C++){var m=O[C];M.set(m,R),R+=m.length}return M}},"./src/demux/dummy-demuxed-track.ts":function(q,G,D){"use strict";D.r(G),D.d(G,"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(q,G,D){"use strict";D.r(G);var z=D("./src/utils/logger.ts"),U=function(){function O(M){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=M,this.bytesAvailable=M.byteLength,this.word=0,this.bitsAvailable=0}var F=O.prototype;return F.loadWord=function(){var R=this.data,C=this.bytesAvailable,m=R.byteLength-C,v=new Uint8Array(4),k=Math.min(4,C);if(k===0)throw new Error("no bytes available");v.set(R.subarray(m,m+k)),this.word=new DataView(v.buffer).getUint32(0),this.bitsAvailable=k*8,this.bytesAvailable-=k},F.skipBits=function(R){var C;this.bitsAvailable>R?(this.word<<=R,this.bitsAvailable-=R):(R-=this.bitsAvailable,C=R>>3,R-=C>>3,this.bytesAvailable-=C,this.loadWord(),this.word<<=R,this.bitsAvailable-=R)},F.readBits=function(R){var C=Math.min(this.bitsAvailable,R),m=this.word>>>32-C;return R>32&&z.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=C,this.bitsAvailable>0?this.word<<=C:this.bytesAvailable>0&&this.loadWord(),C=R-C,C>0&&this.bitsAvailable?m<<C|this.readBits(C):m},F.skipLZ=function(){var R;for(R=0;R<this.bitsAvailable;++R)if((this.word&2147483648>>>R)!==0)return this.word<<=R,this.bitsAvailable-=R,R;return this.loadWord(),R+this.skipLZ()},F.skipUEG=function(){this.skipBits(1+this.skipLZ())},F.skipEG=function(){this.skipBits(1+this.skipLZ())},F.readUEG=function(){var R=this.skipLZ();return this.readBits(R+1)-1},F.readEG=function(){var R=this.readUEG();return 1&R?1+R>>>1:-1*(R>>>1)},F.readBoolean=function(){return this.readBits(1)===1},F.readUByte=function(){return this.readBits(8)},F.readUShort=function(){return this.readBits(16)},F.readUInt=function(){return this.readBits(32)},F.skipScalingList=function(R){for(var C=8,m=8,v,k=0;k<R;k++)m!==0&&(v=this.readEG(),m=(C+v+256)%256),C=m===0?C:m},F.readSPS=function(){var R=0,C=0,m=0,v=0,k,S,b,f=this.readUByte.bind(this),u=this.readBits.bind(this),a=this.readUEG.bind(this),s=this.readBoolean.bind(this),l=this.skipBits.bind(this),A=this.skipEG.bind(this),y=this.skipUEG.bind(this),c=this.skipScalingList.bind(this);f();var L=f();if(u(5),l(3),f(),y(),L===100||L===110||L===122||L===244||L===44||L===83||L===86||L===118||L===128){var x=a();if(x===3&&l(1),y(),y(),l(1),s())for(S=x!==3?8:12,b=0;b<S;b++)s()&&(b<6?c(16):c(64))}y();var h=a();if(h===0)a();else if(h===1)for(l(1),A(),A(),k=a(),b=0;b<k;b++)A();y(),l(1);var p=a(),d=a(),o=u(1);o===0&&l(1),l(1),s()&&(R=a(),C=a(),m=a(),v=a());var T=[1,1];if(s()&&s()){var E=f();switch(E){case 1:T=[1,1];break;case 2:T=[12,11];break;case 3:T=[10,11];break;case 4:T=[16,11];break;case 5:T=[40,33];break;case 6:T=[24,11];break;case 7:T=[20,11];break;case 8:T=[32,11];break;case 9:T=[80,33];break;case 10:T=[18,11];break;case 11:T=[15,11];break;case 12:T=[64,33];break;case 13:T=[160,99];break;case 14:T=[4,3];break;case 15:T=[3,2];break;case 16:T=[2,1];break;case 255:{T=[f()<<8|f(),f()<<8|f()];break}}}return{width:Math.ceil((p+1)*16-R*2-C*2),height:(2-o)*(d+1)*16-(o?2:4)*(m+v),pixelRatio:T}},F.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},O}();G.default=U},"./src/demux/id3.ts":function(q,G,D){"use strict";D.r(G),D.d(G,"isHeader",function(){return z}),D.d(G,"isFooter",function(){return U}),D.d(G,"getID3Data",function(){return O}),D.d(G,"canParse",function(){return M}),D.d(G,"getTimeStamp",function(){return R}),D.d(G,"isTimeStampFrame",function(){return C}),D.d(G,"getID3Frames",function(){return v}),D.d(G,"decodeFrame",function(){return k}),D.d(G,"utf8ArrayToStr",function(){return a}),D.d(G,"testables",function(){return s});var z=function(c,L){return L+10<=c.length&&(c[L]===73&&c[L+1]===68&&c[L+2]===51&&(c[L+3]<255&&c[L+4]<255&&(c[L+6]<128&&c[L+7]<128&&c[L+8]<128&&c[L+9]<128)))},U=function(c,L){return L+10<=c.length&&(c[L]===51&&c[L+1]===68&&c[L+2]===73&&(c[L+3]<255&&c[L+4]<255&&(c[L+6]<128&&c[L+7]<128&&c[L+8]<128&&c[L+9]<128)))},O=function(c,L){for(var x=L,h=0;z(c,L);){h+=10;var p=F(c,L+6);h+=p,U(c,L+10)&&(h+=10),L+=h}return h>0?c.subarray(x,x+h):void 0},F=function(c,L){var x=0;return x=(c[L]&127)<<21,x|=(c[L+1]&127)<<14,x|=(c[L+2]&127)<<7,x|=c[L+3]&127,x},M=function(c,L){return z(c,L)&&F(c,L+6)+10<=c.length-L},R=function(c){for(var L=v(c),x=0;x<L.length;x++){var h=L[x];if(C(h))return u(h)}return},C=function(c){return c&&c.key==="PRIV"&&c.info==="com.apple.streaming.transportStreamTimestamp"},m=function(c){var L=String.fromCharCode(c[0],c[1],c[2],c[3]),x=F(c,4),h=10;return{type:L,size:x,data:c.subarray(h,h+x)}},v=function(c){for(var L=0,x=[];z(c,L);){var h=F(c,L+6);L+=10;for(var p=L+h;L+8<p;){var d=m(c.subarray(L)),o=k(d);o&&x.push(o),L+=d.size+10}U(c,L)&&(L+=10)}return x},k=function(c){return c.type==="PRIV"?S(c):c.type[0]==="W"?f(c):b(c)},S=function(c){if(c.size<2)return;var L=a(c.data,!0),x=new Uint8Array(c.data.subarray(L.length+1));return{key:c.type,info:L,data:x.buffer}},b=function(c){if(c.size<2)return;if(c.type==="TXXX"){var L=1,x=a(c.data.subarray(L),!0);L+=x.length+1;var h=a(c.data.subarray(L));return{key:c.type,info:x,data:h}}var p=a(c.data.subarray(1));return{key:c.type,data:p}},f=function(c){if(c.type==="WXXX"){if(c.size<2)return;var L=1,x=a(c.data.subarray(L),!0);L+=x.length+1;var h=a(c.data.subarray(L));return{key:c.type,info:x,data:h}}var p=a(c.data);return{key:c.type,data:p}},u=function(c){if(c.data.byteLength===8){var L=new Uint8Array(c.data),x=L[3]&1,h=(L[4]<<23)+(L[5]<<15)+(L[6]<<7)+L[7];return h/=45,x&&(h+=4772185884e-2),Math.round(h)}return},a=function(c,L){L===void 0&&(L=!1);var x=A();if(x){var h=x.decode(c);if(L){var p=h.indexOf("\0");return p!==-1?h.substring(0,p):h}return h.replace(/\0/g,"")}for(var d=c.length,o,T,E,g="",_=0;_<d;){if(o=c[_++],o===0&&L)return g;if(o===0||o===3)continue;switch(o>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:g+=String.fromCharCode(o);break;case 12:case 13:T=c[_++],g+=String.fromCharCode((o&31)<<6|T&63);break;case 14:T=c[_++],E=c[_++],g+=String.fromCharCode((o&15)<<12|(T&63)<<6|(E&63)<<0);break;default:}}return g},s={decodeTextFrame:b},l;function A(){return!l&&typeof self.TextDecoder!="undefined"&&(l=new self.TextDecoder("utf-8")),l}},"./src/demux/mp3demuxer.ts":function(q,G,D){"use strict";D.r(G);var z=D("./src/demux/base-audio-demuxer.ts"),U=D("./src/demux/id3.ts"),O=D("./src/utils/logger.ts"),F=D("./src/demux/mpegaudio.ts");function M(m,v){m.prototype=Object.create(v.prototype),m.prototype.constructor=m,R(m,v)}function R(m,v){return R=Object.setPrototypeOf||function(S,b){return S.__proto__=b,S},R(m,v)}var C=function(m){M(v,m);function v(){return m.apply(this,arguments)||this}var k=v.prototype;return k.resetInitSegment=function(b,f,u){m.prototype.resetInitSegment.call(this,b,f,u),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:b,duration:u,inputTimeScale:9e4,dropped:0}},v.probe=function(b){if(!b)return!1;for(var f=U.getID3Data(b,0)||[],u=f.length,a=b.length;u<a;u++)if(F.probe(b,u))return O.logger.log("MPEG Audio sync word found !"),!0;return!1},k.canParse=function(b,f){return F.canParse(b,f)},k.appendFrame=function(b,f,u){return this.initPTS===null?void 0:F.appendFrame(b,f,u,this.initPTS,this.frameIndex)},v}(z.default);C.minProbeByteLength=4,G.default=C},"./src/demux/mp4demuxer.ts":function(q,G,D){"use strict";D.r(G);var z=D("./src/utils/mp4-tools.ts"),U=D("./src/demux/dummy-demuxed-track.ts"),O=function(){function F(R,C){this.remainderData=null,this.config=void 0,this.config=C}var M=F.prototype;return M.resetTimeStamp=function(){},M.resetInitSegment=function(){},M.resetContiguity=function(){},F.probe=function(C){return Object(z.findBox)({data:C,start:0,end:Math.min(C.length,16384)},["moof"]).length>0},M.demux=function(C){var m=C,v=Object(U.dummyTrack)();if(this.config.progressive){this.remainderData&&(m=Object(z.appendUint8Array)(this.remainderData,C));var k=Object(z.segmentValidRange)(m);this.remainderData=k.remainder,v.samples=k.valid||new Uint8Array}else v.samples=m;return{audioTrack:Object(U.dummyTrack)(),avcTrack:v,id3Track:Object(U.dummyTrack)(),textTrack:Object(U.dummyTrack)()}},M.flush=function(){var C=Object(U.dummyTrack)();return C.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(U.dummyTrack)(),avcTrack:C,id3Track:Object(U.dummyTrack)(),textTrack:Object(U.dummyTrack)()}},M.demuxSampleAes=function(C,m,v){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},M.destroy=function(){},F}();O.minProbeByteLength=1024,G.default=O},"./src/demux/mpegaudio.ts":function(q,G,D){"use strict";D.r(G),D.d(G,"appendFrame",function(){return R}),D.d(G,"parseHeader",function(){return C}),D.d(G,"isHeaderPattern",function(){return m}),D.d(G,"isHeader",function(){return v}),D.d(G,"canParse",function(){return k}),D.d(G,"probe",function(){return S});var z=null,U=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],O=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],F=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],M=[0,1,1,4];function R(b,f,u,a,s){if(u+24>f.length)return;var l=C(f,u);if(l&&u+l.frameLength<=f.length){var A=l.samplesPerFrame*9e4/l.sampleRate,y=a+s*A,c={unit:f.subarray(u,u+l.frameLength),pts:y,dts:y};return b.config=[],b.channelCount=l.channelCount,b.samplerate=l.sampleRate,b.samples.push(c),{sample:c,length:l.frameLength,missing:0}}}function C(b,f){var u=b[f+1]>>3&3,a=b[f+1]>>1&3,s=b[f+2]>>4&15,l=b[f+2]>>2&3;if(u!==1&&s!==0&&s!==15&&l!==3){var A=b[f+2]>>1&1,y=b[f+3]>>6,c=u===3?3-a:a===3?3:4,L=U[c*14+s-1]*1e3,x=u===3?0:u===2?1:2,h=O[x*3+l],p=y===3?1:2,d=F[u][a],o=M[a],T=d*8*o,E=Math.floor(d*L/h+A)*o;if(z===null){var g=navigator.userAgent||"",_=g.match(/Chrome\/(\d+)/i);z=_?parseInt(_[1]):0}var N=!!z&&z<=87;return N&&a===2&&L>=224e3&&y===0&&(b[f+3]=b[f+3]|128),{sampleRate:h,channelCount:p,frameLength:E,samplesPerFrame:T}}}function m(b,f){return b[f]===255&&(b[f+1]&224)===224&&(b[f+1]&6)!==0}function v(b,f){return f+1<b.length&&m(b,f)}function k(b,f){var u=4;return m(b,f)&&u<=b.length-f}function S(b,f){if(f+1<b.length&&m(b,f)){var u=4,a=C(b,f),s=u;a!=null&&a.frameLength&&(s=a.frameLength);var l=f+s;return l===b.length||v(b,l)}return!1}},"./src/demux/sample-aes.ts":function(q,G,D){"use strict";D.r(G);var z=D("./src/crypt/decrypter.ts"),U=D("./src/demux/tsdemuxer.ts"),O=function(){function F(R,C,m){this.keyData=void 0,this.decrypter=void 0,this.keyData=m,this.decrypter=new z.default(R,C,{removePKCS7Padding:!1})}var M=F.prototype;return M.decryptBuffer=function(C,m){this.decrypter.decrypt(C,this.keyData.key.buffer,this.keyData.iv.buffer,m)},M.decryptAacSample=function(C,m,v,k){var S=C[m].unit,b=S.subarray(16,S.length-S.length%16),f=b.buffer.slice(b.byteOffset,b.byteOffset+b.length),u=this;this.decryptBuffer(f,function(a){var s=new Uint8Array(a);S.set(s,16),k||u.decryptAacSamples(C,m+1,v)})},M.decryptAacSamples=function(C,m,v){for(;;m++){if(m>=C.length){v();return}if(C[m].unit.length<32)continue;var k=this.decrypter.isSync();if(this.decryptAacSample(C,m,v,k),!k)return}},M.getAvcEncryptedData=function(C){for(var m=Math.floor((C.length-48)/160)*16+16,v=new Int8Array(m),k=0,S=32;S<=C.length-16;S+=160,k+=16)v.set(C.subarray(S,S+16),k);return v},M.getAvcDecryptedUnit=function(C,m){for(var v=new Uint8Array(m),k=0,S=32;S<=C.length-16;S+=160,k+=16)C.set(v.subarray(k,k+16),S);return C},M.decryptAvcSample=function(C,m,v,k,S,b){var f=Object(U.discardEPB)(S.data),u=this.getAvcEncryptedData(f),a=this;this.decryptBuffer(u.buffer,function(s){S.data=a.getAvcDecryptedUnit(f,s),b||a.decryptAvcSamples(C,m,v+1,k)})},M.decryptAvcSamples=function(C,m,v,k){if(C instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;m++,v=0){if(m>=C.length){k();return}for(var S=C[m].units;!(v>=S.length);v++){var b=S[v];if(b.data.length<=48||b.type!==1&&b.type!==5)continue;var f=this.decrypter.isSync();if(this.decryptAvcSample(C,m,v,k,b,f),!f)return}}},F}();G.default=O},"./src/demux/transmuxer-interface.ts":function(q,G,D){"use strict";D.r(G),D.d(G,"default",function(){return S});var z=D("./node_modules/webworkify-webpack/index.js"),U=D.n(z),O=D("./src/events.ts"),F=D("./src/demux/transmuxer.ts"),M=D("./src/utils/logger.ts"),R=D("./src/errors.ts"),C=D("./src/utils/mediasource-helper.ts"),m=D("./node_modules/eventemitter3/index.js"),v=D.n(m),k=Object(C.getMediaSource)()||{isTypeSupported:function(){return!1}},S=function(){function b(u,a,s,l){var A=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=a,this.onTransmuxComplete=s,this.onFlush=l;var y=u.config,c=function(d,o){o=o||{},o.frag=A.frag,o.id=A.id,u.trigger(d,o)};this.observer=new m.EventEmitter,this.observer.on(O.Events.FRAG_DECRYPTED,c),this.observer.on(O.Events.ERROR,c);var L={mp4:k.isTypeSupported("video/mp4"),mpeg:k.isTypeSupported("audio/mpeg"),mp3:k.isTypeSupported('audio/mp4; codecs="mp3"')},x=navigator.vendor;if(y.enableWorker&&typeof Worker!="undefined"){M.logger.log("demuxing in webworker");var h;try{h=this.worker=z("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),h.addEventListener("message",this.onwmsg),h.onerror=function(p){u.trigger(O.Events.ERROR,{type:R.ErrorTypes.OTHER_ERROR,details:R.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(p.message+" ("+p.filename+":"+p.lineno+")")})},h.postMessage({cmd:"init",typeSupported:L,vendor:x,id:a,config:JSON.stringify(y)})}catch(p){M.logger.warn("Error in worker:",p),M.logger.error("Error while initializing DemuxerWorker, fallback to inline"),h&&self.URL.revokeObjectURL(h.objectURL),this.transmuxer=new F.default(this.observer,L,y,x,a),this.worker=null}}else this.transmuxer=new F.default(this.observer,L,y,x,a)}var f=b.prototype;return f.destroy=function(){var a=this.worker;if(a)a.removeEventListener("message",this.onwmsg),a.terminate(),this.worker=null;else{var s=this.transmuxer;s&&(s.destroy(),this.transmuxer=null)}var l=this.observer;l&&l.removeAllListeners(),this.observer=null},f.push=function(a,s,l,A,y,c,L,x,h,p){var d=this;h.transmuxing.start=self.performance.now();var o=this.transmuxer,T=this.worker,E=c?c.start:y.start,g=y.decryptdata,_=this.frag,N=!(_&&y.cc===_.cc),B=!(_&&h.level===_.level),W=_?h.sn-_.sn:-1,P=this.part?h.part-this.part.index:1,I=!B&&(W===1||W===0&&P===1),H=self.performance.now();(B||W||y.stats.parsing.start===0)&&(y.stats.parsing.start=H),c&&(P||!I)&&(c.stats.parsing.start=H);var Y=new F.TransmuxState(N,I,x,B,E);if(!I||N){M.logger.log("[transmuxer-interface, "+y.type+"]: Starting new transmux session for sn: "+h.sn+" p: "+h.part+" level: "+h.level+" id: "+h.id+`
|
|
discontinuity: `+N+`
|
|
trackSwitch: `+B+`
|
|
contiguous: `+I+`
|
|
accurateTimeOffset: `+x+`
|
|
timeOffset: `+E);var ee=new F.TransmuxConfig(l,A,s,L,p);this.configureTransmuxer(ee)}if(this.frag=y,this.part=c,T)T.postMessage({cmd:"demux",data:a,decryptdata:g,chunkMeta:h,state:Y},a instanceof ArrayBuffer?[a]:[]);else if(o){var oe=o.push(a,g,h,Y);Object(F.isPromise)(oe)?oe.then(function(Ee){d.handleTransmuxComplete(Ee)}):this.handleTransmuxComplete(oe)}},f.flush=function(a){var s=this;a.transmuxing.start=self.performance.now();var l=this.transmuxer,A=this.worker;if(A)A.postMessage({cmd:"flush",chunkMeta:a});else if(l){var y=l.flush(a);Object(F.isPromise)(y)?y.then(function(c){s.handleFlushResult(c,a)}):this.handleFlushResult(y,a)}},f.handleFlushResult=function(a,s){var l=this;a.forEach(function(A){l.handleTransmuxComplete(A)}),this.onFlush(s)},f.onWorkerMessage=function(a){var s=a.data,l=this.hls;switch(s.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(s.data);break}case"flush":{this.onFlush(s.data);break}default:{s.data=s.data||{},s.data.frag=this.frag,s.data.id=this.id,l.trigger(s.event,s.data);break}}},f.configureTransmuxer=function(a){var s=this.worker,l=this.transmuxer;s?s.postMessage({cmd:"configure",config:a}):l&&l.configure(a)},f.handleTransmuxComplete=function(a){a.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(a)},b}()},"./src/demux/transmuxer-worker.ts":function(q,G,D){"use strict";D.r(G),D.d(G,"default",function(){return R});var z=D("./src/demux/transmuxer.ts"),U=D("./src/events.ts"),O=D("./src/utils/logger.ts"),F=D("./node_modules/eventemitter3/index.js"),M=D.n(F);function R(S){var b=new F.EventEmitter,f=function(a,s){S.postMessage({event:a,data:s})};b.on(U.Events.FRAG_DECRYPTED,f),b.on(U.Events.ERROR,f),S.addEventListener("message",function(u){var a=u.data;switch(a.cmd){case"init":{var s=JSON.parse(a.config);S.transmuxer=new z.default(b,a.typeSupported,s,a.vendor,a.id),Object(O.enableLogs)(s.debug),f("init",null);break}case"configure":{S.transmuxer.configure(a.config);break}case"demux":{var l=S.transmuxer.push(a.data,a.decryptdata,a.chunkMeta,a.state);Object(z.isPromise)(l)?l.then(function(c){C(S,c)}):C(S,l);break}case"flush":{var A=a.chunkMeta,y=S.transmuxer.flush(A);Object(z.isPromise)(y)?y.then(function(c){v(S,c,A)}):v(S,y,A);break}default:break}})}function C(S,b){if(k(b.remuxResult))return;var f=[],u=b.remuxResult,a=u.audio,s=u.video;a&&m(f,a),s&&m(f,s),S.postMessage({event:"transmuxComplete",data:b},f)}function m(S,b){b.data1&&S.push(b.data1.buffer),b.data2&&S.push(b.data2.buffer)}function v(S,b,f){b.forEach(function(u){C(S,u)}),S.postMessage({event:"flush",data:f})}function k(S){return!S.audio&&!S.video&&!S.text&&!S.id3&&!S.initSegment}},"./src/demux/transmuxer.ts":function(q,G,D){"use strict";D.r(G),D.d(G,"default",function(){return s}),D.d(G,"isPromise",function(){return y}),D.d(G,"TransmuxConfig",function(){return c}),D.d(G,"TransmuxState",function(){return L});var z=D("./src/events.ts"),U=D("./src/errors.ts"),O=D("./src/crypt/decrypter.ts"),F=D("./src/demux/aacdemuxer.ts"),M=D("./src/demux/mp4demuxer.ts"),R=D("./src/demux/tsdemuxer.ts"),C=D("./src/demux/mp3demuxer.ts"),m=D("./src/remux/mp4-remuxer.ts"),v=D("./src/remux/passthrough-remuxer.ts"),k=D("./src/demux/chunk-cache.ts"),S=D("./src/utils/mp4-tools.ts"),b=D("./src/utils/logger.ts"),f;try{f=self.performance.now.bind(self.performance)}catch(x){b.logger.debug("Unable to use Performance API on this environment"),f=self.Date.now}var u=[{demux:R.default,remux:m.default},{demux:M.default,remux:v.default},{demux:F.default,remux:m.default},{demux:C.default,remux:m.default}],a=1024;u.forEach(function(x){var h=x.demux;a=Math.max(a,h.minProbeByteLength)});var s=function(){function x(p,d,o,T,E){this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.cache=new k.default,this.observer=p,this.typeSupported=d,this.config=o,this.vendor=T,this.id=E}var h=x.prototype;return h.configure=function(d){this.transmuxConfig=d,this.decrypter&&this.decrypter.reset()},h.push=function(d,o,T,E){var g=this,_=T.transmuxing;_.executeStart=f();var N=new Uint8Array(d),B=this.cache,W=this.config,P=this.currentTransmuxState,I=this.transmuxConfig;E&&(this.currentTransmuxState=E);var H=l(N,o);if(H&&H.method==="AES-128"){var Y=this.getDecrypter();if(W.enableSoftwareAES){var ee=Y.softwareDecrypt(N,H.key.buffer,H.iv.buffer);if(!ee)return _.executeEnd=f(),A(T);N=new Uint8Array(ee)}else return this.decryptionPromise=Y.webCryptoDecrypt(N,H.key.buffer,H.iv.buffer).then(function(we){var Ae=g.push(we,null,T);return g.decryptionPromise=null,Ae}),this.decryptionPromise}var oe=E||P,Ee=oe.contiguous,pe=oe.discontinuity,me=oe.trackSwitch,he=oe.accurateTimeOffset,se=oe.timeOffset,ne=I.audioCodec,ce=I.videoCodec,$=I.defaultInitPts,ie=I.duration,Z=I.initSegmentData;if((pe||me)&&this.resetInitSegment(Z,ne,ce,ie),pe&&this.resetInitialTimestamp($),Ee||this.resetContiguity(),this.needsProbing(N,pe,me)){if(B.dataLength){var ye=B.flush();N=Object(S.appendUint8Array)(ye,N)}this.configureTransmuxer(N,I)}var Ce=this.transmux(N,H,se,he,T),ve=this.currentTransmuxState;return ve.contiguous=!0,ve.discontinuity=!1,ve.trackSwitch=!1,_.executeEnd=f(),Ce},h.flush=function(d){var o=this,T=d.transmuxing;T.executeStart=f();var E=this.decrypter,g=this.cache,_=this.currentTransmuxState,N=this.decryptionPromise;if(N)return N.then(function(){return o.flush(d)});var B=[],W=_.timeOffset;if(E){var P=E.flush();P&&B.push(this.push(P,null,d))}var I=g.dataLength;g.reset();var H=this.demuxer,Y=this.remuxer;if(!H||!Y)return I>=a&&this.observer.emit(z.Events.ERROR,z.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),T.executeEnd=f(),[A(d)];var ee=H.flush(W);return y(ee)?ee.then(function(oe){return o.flushRemux(B,oe,d),B}):(this.flushRemux(B,ee,d),B)},h.flushRemux=function(d,o,T){var E=o.audioTrack,g=o.avcTrack,_=o.id3Track,N=o.textTrack,B=this.currentTransmuxState,W=B.accurateTimeOffset,P=B.timeOffset;b.logger.log("[transmuxer.ts]: Flushed fragment "+T.sn+(T.part>-1?" p: "+T.part:"")+" of level "+T.level);var I=this.remuxer.remux(E,g,_,N,P,W,!0,this.id);d.push({remuxResult:I,chunkMeta:T}),T.transmuxing.executeEnd=f()},h.resetInitialTimestamp=function(d){var o=this.demuxer,T=this.remuxer;if(!o||!T)return;o.resetTimeStamp(d),T.resetTimeStamp(d)},h.resetContiguity=function(){var d=this.demuxer,o=this.remuxer;if(!d||!o)return;d.resetContiguity(),o.resetNextTimestamp()},h.resetInitSegment=function(d,o,T,E){var g=this.demuxer,_=this.remuxer;if(!g||!_)return;g.resetInitSegment(o,T,E),_.resetInitSegment(d,o,T)},h.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},h.transmux=function(d,o,T,E,g){var _;return o&&o.method==="SAMPLE-AES"?_=this.transmuxSampleAes(d,o,T,E,g):_=this.transmuxUnencrypted(d,T,E,g),_},h.transmuxUnencrypted=function(d,o,T,E){var g=this.demuxer.demux(d,o,!1,!this.config.progressive),_=g.audioTrack,N=g.avcTrack,B=g.id3Track,W=g.textTrack,P=this.remuxer.remux(_,N,B,W,o,T,!1,this.id);return{remuxResult:P,chunkMeta:E}},h.transmuxSampleAes=function(d,o,T,E,g){var _=this;return this.demuxer.demuxSampleAes(d,o,T).then(function(N){var B=_.remuxer.remux(N.audioTrack,N.avcTrack,N.id3Track,N.textTrack,T,E,!1,_.id);return{remuxResult:B,chunkMeta:g}})},h.configureTransmuxer=function(d,o){for(var T=this.config,E=this.observer,g=this.typeSupported,_=this.vendor,N=o.audioCodec,B=o.defaultInitPts,W=o.duration,P=o.initSegmentData,I=o.videoCodec,H,Y=0,ee=u.length;Y<ee;Y++)if(u[Y].demux.probe(d)){H=u[Y];break}H||(b.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),H={demux:M.default,remux:v.default});var oe=this.demuxer,Ee=this.remuxer,pe=H.remux,me=H.demux;(!Ee||!(Ee instanceof pe))&&(this.remuxer=new pe(E,T,g,_)),(!oe||!(oe instanceof me))&&(this.demuxer=new me(E,T,g),this.probe=me.probe),this.resetInitSegment(P,N,I,W),this.resetInitialTimestamp(B)},h.needsProbing=function(d,o,T){return!this.demuxer||!this.remuxer||o||T},h.getDecrypter=function(){var d=this.decrypter;return d||(d=this.decrypter=new O.default(this.observer,this.config)),d},x}();function l(x,h){var p=null;return x.byteLength>0&&h!=null&&h.key!=null&&h.iv!==null&&h.method!=null&&(p=h),p}var A=function(h){return{remuxResult:{},chunkMeta:h}};function y(x){return"then"in x&&x.then instanceof Function}var c=function(h,p,d,o,T){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=h,this.videoCodec=p,this.initSegmentData=d,this.duration=o,this.defaultInitPts=T},L=function(h,p,d,o,T){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=h,this.contiguous=p,this.accurateTimeOffset=d,this.trackSwitch=o,this.timeOffset=T}},"./src/demux/tsdemuxer.ts":function(q,G,D){"use strict";D.r(G),D.d(G,"discardEPB",function(){return A});var z=D("./src/demux/adts.ts"),U=D("./src/demux/mpegaudio.ts"),O=D("./src/demux/exp-golomb.ts"),F=D("./src/demux/id3.ts"),M=D("./src/demux/sample-aes.ts"),R=D("./src/events.ts"),C=D("./src/utils/mp4-tools.ts"),m=D("./src/utils/logger.ts"),v=D("./src/errors.ts"),k={video:1,audio:2,id3:3,text:4},S=function(){function y(L,x,h){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this.aacLastPTS=null,this._initPTS=null,this._initDTS=null,this._pmtId=-1,this._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=L,this.config=x,this.typeSupported=h}y.probe=function(x){var h=y.syncOffset(x);return h<0?!1:(h&&m.logger.warn("MPEG2-TS detected but first sync word found @ offset "+h+", junk ahead ?"),!0)},y.syncOffset=function(x){for(var h=Math.min(1e3,x.length-3*188),p=0;p<h;){if(x[p]===71&&x[p+188]===71&&x[p+2*188]===71)return p;p++}return-1},y.createTrack=function(x,h){return{container:x==="video"||x==="audio"?"video/mp2t":void 0,type:x,id:k[x],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:x==="audio"?h:void 0}};var c=y.prototype;return c.resetInitSegment=function(x,h,p){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=y.createTrack("video",p),this._audioTrack=y.createTrack("audio",p),this._id3Track=y.createTrack("id3",p),this._txtTrack=y.createTrack("text",p),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=x,this.videoCodec=h,this._duration=p},c.resetTimeStamp=function(){},c.resetContiguity=function(){var x=this._audioTrack,h=this._avcTrack,p=this._id3Track;x&&(x.pesData=null),h&&(h.pesData=null),p&&(p.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},c.demux=function(x,h,p,d){p===void 0&&(p=!1),d===void 0&&(d=!1),p||(this.sampleAes=null);var o,T=this._avcTrack,E=this._audioTrack,g=this._id3Track,_=T.pid,N=T.pesData,B=E.pid,W=g.pid,P=E.pesData,I=g.pesData,H=!1,Y=this.pmtParsed,ee=this._pmtId,oe=x.length;if(this.remainderData&&(x=Object(C.appendUint8Array)(this.remainderData,x),oe=x.length,this.remainderData=null),oe<188&&!d)return this.remainderData=x,{audioTrack:E,avcTrack:T,id3Track:g,textTrack:this._txtTrack};var Ee=Math.max(0,y.syncOffset(x));oe-=(oe+Ee)%188,oe<x.byteLength&&!d&&(this.remainderData=new Uint8Array(x.buffer,oe,x.buffer.byteLength-oe));for(var pe=Ee;pe<oe;pe+=188)if(x[pe]===71){var me=!!(x[pe+1]&64),he=((x[pe+1]&31)<<8)+x[pe+2],se=(x[pe+3]&48)>>4,ne=void 0;if(se>1){if(ne=pe+5+x[pe+4],ne===pe+188)continue}else ne=pe+4;switch(he){case _:me&&(N&&(o=a(N))&&this.parseAVCPES(o,!1),N={data:[],size:0}),N&&(N.data.push(x.subarray(ne,pe+188)),N.size+=pe+188-ne);break;case B:me&&(P&&(o=a(P))&&(E.isAAC?this.parseAACPES(o):this.parseMPEGPES(o)),P={data:[],size:0}),P&&(P.data.push(x.subarray(ne,pe+188)),P.size+=pe+188-ne);break;case W:me&&(I&&(o=a(I))&&this.parseID3PES(o),I={data:[],size:0}),I&&(I.data.push(x.subarray(ne,pe+188)),I.size+=pe+188-ne);break;case 0:me&&(ne+=x[ne]+1),ee=this._pmtId=f(x,ne);break;case ee:{me&&(ne+=x[ne]+1);var ce=u(x,ne,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,p);_=ce.avc,_>0&&(T.pid=_),B=ce.audio,B>0&&(E.pid=B,E.isAAC=ce.isAAC),W=ce.id3,W>0&&(g.pid=W),H&&!Y&&(m.logger.log("reparse from beginning"),H=!1,pe=Ee-188),Y=this.pmtParsed=!0;break}case 17:case 8191:break;default:H=!0;break}}else this.observer.emit(R.Events.ERROR,R.Events.ERROR,{type:v.ErrorTypes.MEDIA_ERROR,details:v.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});T.pesData=N,E.pesData=P,g.pesData=I;var $={audioTrack:E,avcTrack:T,id3Track:g,textTrack:this._txtTrack};return d&&this.extractRemainingSamples($),$},c.flush=function(){var x=this.remainderData;this.remainderData=null;var h;return x?h=this.demux(x,-1,!1,!0):h={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(h),this.sampleAes?this.decrypt(h,this.sampleAes):h},c.extractRemainingSamples=function(x){var h=x.audioTrack,p=x.avcTrack,d=x.id3Track,o=p.pesData,T=h.pesData,E=d.pesData,g;o&&(g=a(o))?(this.parseAVCPES(g,!0),p.pesData=null):p.pesData=o,T&&(g=a(T))?(h.isAAC?this.parseAACPES(g):this.parseMPEGPES(g),h.pesData=null):(T!=null&&T.size&&m.logger.log("last AAC PES packet truncated,might overlap between fragments"),h.pesData=T),E&&(g=a(E))?(this.parseID3PES(g),d.pesData=null):d.pesData=E},c.demuxSampleAes=function(x,h,p){var d=this.demux(x,p,!0,!this.config.progressive),o=this.sampleAes=new M.default(this.observer,this.config,h);return this.decrypt(d,o)},c.decrypt=function(x,h){return new Promise(function(p){var d=x.audioTrack,o=x.avcTrack;d.samples&&d.isAAC?h.decryptAacSamples(d.samples,0,function(){o.samples?h.decryptAvcSamples(o.samples,0,0,function(){p(x)}):p(x)}):o.samples&&h.decryptAvcSamples(o.samples,0,0,function(){p(x)})})},c.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},c.parseAVCPES=function(x,h){var p=this,d=this._avcTrack,o=this.parseAVCNALu(x.data),T=!1,E=this.avcSample,g,_=!1;x.data=null,E&&o.length&&!d.audFound&&(s(E,d),E=this.avcSample=b(!1,x.pts,x.dts,"")),o.forEach(function(N){switch(N.type){case 1:{g=!0,E||(E=p.avcSample=b(!0,x.pts,x.dts,"")),T&&(E.debug+="NDR "),E.frame=!0;var B=N.data;if(_&&B.length>4){var W=new O.default(B).readSliceType();(W===2||W===4||W===7||W===9)&&(E.key=!0)}break}case 5:g=!0,E||(E=p.avcSample=b(!0,x.pts,x.dts,"")),T&&(E.debug+="IDR "),E.key=!0,E.frame=!0;break;case 6:{g=!0,T&&E&&(E.debug+="SEI ");var P=new O.default(A(N.data));P.readUByte();for(var I=0,H=0,Y=!1,ee=0;!Y&&P.bytesAvailable>1;){I=0;do ee=P.readUByte(),I+=ee;while(ee===255);H=0;do ee=P.readUByte(),H+=ee;while(ee===255);if(I===4&&P.bytesAvailable!==0){Y=!0;var oe=P.readUByte();if(oe===181){var Ee=P.readUShort();if(Ee===49){var pe=P.readUInt();if(pe===1195456820){var me=P.readUByte();if(me===3){for(var he=P.readUByte(),se=P.readUByte(),ne=31&he,ce=[he,se],$=0;$<ne;$++)ce.push(P.readUByte()),ce.push(P.readUByte()),ce.push(P.readUByte());l(p._txtTrack.samples,{type:3,pts:x.pts,bytes:ce})}}}}}else if(I===5&&P.bytesAvailable!==0){if(Y=!0,H>16){for(var ie=[],Z=0;Z<16;Z++)ie.push(P.readUByte().toString(16)),(Z===3||Z===5||Z===7||Z===9)&&ie.push("-");for(var ye=H-16,Ce=new Uint8Array(ye),ve=0;ve<ye;ve++)Ce[ve]=P.readUByte();l(p._txtTrack.samples,{pts:x.pts,payloadType:I,uuid:ie.join(""),userData:Object(F.utf8ArrayToStr)(Ce),userDataBytes:Ce})}}else if(H<P.bytesAvailable)for(var we=0;we<H;we++)P.readUByte()}break}case 7:if(g=!0,_=!0,T&&E&&(E.debug+="SPS "),!d.sps){var Ae=new O.default(N.data),Re=Ae.readSPS();d.width=Re.width,d.height=Re.height,d.pixelRatio=Re.pixelRatio,d.sps=[N.data],d.duration=p._duration;for(var Ie=N.data.subarray(1,4),Me="avc1.",De=0;De<3;De++){var Ve=Ie[De].toString(16);Ve.length<2&&(Ve="0"+Ve),Me+=Ve}d.codec=Me}break;case 8:g=!0,T&&E&&(E.debug+="PPS "),d.pps||(d.pps=[N.data]);break;case 9:g=!1,d.audFound=!0,E&&s(E,d),E=p.avcSample=b(!1,x.pts,x.dts,T?"AUD ":"");break;case 12:g=!1;break;default:g=!1,E&&(E.debug+="unknown NAL "+N.type+" ");break}if(E&&g){var et=E.units;et.push(N)}}),h&&E&&(s(E,d),this.avcSample=null)},c.getLastNalUnit=function(){var x,h=this.avcSample,p;if(!h||h.units.length===0){var d=this._avcTrack.samples;h=d[d.length-1]}if((x=h)!==null&&x!==void 0&&x.units){var o=h.units;p=o[o.length-1]}return p},c.parseAVCNALu=function(x){var h=x.byteLength,p=this._avcTrack,d=p.naluState||0,o=d,T=[],E=0,g,_,N,B=-1,W=0;for(d===-1&&(B=0,W=x[0]&31,d=0,E=1);E<h;){if(g=x[E++],!d){d=g?0:1;continue}if(d===1){d=g?0:2;continue}if(!g)d=3;else if(g===1){if(B>=0){var P={data:x.subarray(B,E-d-1),type:W};T.push(P)}else{var I=this.getLastNalUnit();if(I&&(o&&E<=4-o&&(I.state&&(I.data=I.data.subarray(0,I.data.byteLength-o))),_=E-d-1,_>0)){var H=new Uint8Array(I.data.byteLength+_);H.set(I.data,0),H.set(x.subarray(0,_),I.data.byteLength),I.data=H,I.state=0}}E<h?(N=x[E]&31,B=E,W=N,d=0):d=-1}else d=0}if(B>=0&&d>=0){var Y={data:x.subarray(B,h),type:W,state:d};T.push(Y)}if(T.length===0){var ee=this.getLastNalUnit();if(ee){var oe=new Uint8Array(ee.data.byteLength+x.byteLength);oe.set(ee.data,0),oe.set(x,ee.data.byteLength),ee.data=oe}}return p.naluState=d,T},c.parseAACPES=function(x){var h=0,p=this._audioTrack,d=this.aacOverFlow,o=x.data;if(d){this.aacOverFlow=null;var T=d.sample.unit.byteLength,E=Math.min(d.missing,T),g=T-E;d.sample.unit.set(o.subarray(0,E),g),p.samples.push(d.sample),h=d.missing}var _,N;for(_=h,N=o.length;_<N-1&&!z.isHeader(o,_);_++);if(_!==h){var B,W;if(_<N-1?(B="AAC PES did not start with ADTS header,offset:"+_,W=!1):(B="no ADTS header found in AAC PES",W=!0),m.logger.warn("parsing error:"+B),this.observer.emit(R.Events.ERROR,R.Events.ERROR,{type:v.ErrorTypes.MEDIA_ERROR,details:v.ErrorDetails.FRAG_PARSING_ERROR,fatal:W,reason:B}),W)return}z.initTrackConfig(p,this.observer,o,_,this.audioCodec);var P;if(x.pts!==void 0)P=x.pts;else if(d){var I=z.getFrameDuration(p.samplerate);P=d.sample.pts+I}else{m.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var H=0;_<N;)if(z.isHeader(o,_)){if(_+5<N){var Y=z.appendFrame(p,o,_,P,H);if(Y)if(Y.missing)this.aacOverFlow=Y;else{_+=Y.length,H++;continue}}break}else _++},c.parseMPEGPES=function(x){var h=x.data,p=h.length,d=0,o=0,T=x.pts;if(T===void 0){m.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;o<p;)if(U.isHeader(h,o)){var E=U.appendFrame(this._audioTrack,h,o,T,d);if(E)o+=E.length,d++;else break}else o++},c.parseID3PES=function(x){if(x.pts===void 0){m.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(x)},y}();S.minProbeByteLength=188;function b(y,c,L,x){return{key:y,frame:!1,pts:c,dts:L,units:[],debug:x,length:0}}function f(y,c){return(y[c+10]&31)<<8|y[c+11]}function u(y,c,L,x){var h={audio:-1,avc:-1,id3:-1,isAAC:!0},p=(y[c+1]&15)<<8|y[c+2],d=c+3+p-4,o=(y[c+10]&15)<<8|y[c+11];for(c+=12+o;c<d;){var T=(y[c+1]&31)<<8|y[c+2];switch(y[c]){case 207:if(!x){m.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:h.audio===-1&&(h.audio=T);break;case 21:h.id3===-1&&(h.id3=T);break;case 219:if(!x){m.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:h.avc===-1&&(h.avc=T);break;case 3:case 4:L?h.audio===-1&&(h.audio=T,h.isAAC=!1):m.logger.log("MPEG audio found, not supported in this browser");break;case 36:m.logger.warn("Unsupported HEVC stream type found");break;default:break}c+=((y[c+3]&15)<<8|y[c+4])+5}return h}function a(y){var c=0,L,x,h,p,d,o=y.data;if(!y||y.size===0)return null;for(;o[0].length<19&&o.length>1;){var T=new Uint8Array(o[0].length+o[1].length);T.set(o[0]),T.set(o[1],o[0].length),o[0]=T,o.splice(1,1)}L=o[0];var E=(L[0]<<16)+(L[1]<<8)+L[2];if(E===1){if(x=(L[4]<<8)+L[5],x&&x>y.size-6)return null;var g=L[7];g&192&&(p=(L[9]&14)*536870912+(L[10]&255)*4194304+(L[11]&254)*16384+(L[12]&255)*128+(L[13]&254)/2,g&64?(d=(L[14]&14)*536870912+(L[15]&255)*4194304+(L[16]&254)*16384+(L[17]&255)*128+(L[18]&254)/2,p-d>60*9e4&&(m.logger.warn(Math.round((p-d)/9e4)+"s delta between PTS and DTS, align them"),p=d)):d=p),h=L[8];var _=h+9;if(y.size<=_)return null;y.size-=_;for(var N=new Uint8Array(y.size),B=0,W=o.length;B<W;B++){L=o[B];var P=L.byteLength;if(_)if(_>P){_-=P;continue}else L=L.subarray(_),P-=_,_=0;N.set(L,c),c+=P}return x&&(x-=h+3),{data:N,pts:p,dts:d,len:x}}return null}function s(y,c){if(y.units.length&&y.frame){if(y.pts===void 0){var L=c.samples,x=L.length;if(x){var h=L[x-1];y.pts=h.pts,y.dts=h.dts}else{c.dropped++;return}}c.samples.push(y)}y.debug.length&&m.logger.log(y.pts+"/"+y.dts+":"+y.debug)}function l(y,c){var L=y.length;if(L>0){if(c.pts>=y[L-1].pts)y.push(c);else for(var x=L-1;x>=0;x--)if(c.pts<y[x].pts){y.splice(x,0,c);break}}else y.push(c)}function A(y){for(var c=y.byteLength,L=[],x=1;x<c-2;)y[x]===0&&y[x+1]===0&&y[x+2]===3?(L.push(x+2),x+=2):x++;if(L.length===0)return y;var h=c-L.length,p=new Uint8Array(h),d=0;for(x=0;x<h;d++,x++)d===L[0]&&(d++,L.shift()),p[x]=y[d];return p}G.default=S},"./src/errors.ts":function(q,G,D){"use strict";D.r(G),D.d(G,"ErrorTypes",function(){return z}),D.d(G,"ErrorDetails",function(){return U});var z;(function(O){O.NETWORK_ERROR="networkError",O.MEDIA_ERROR="mediaError",O.KEY_SYSTEM_ERROR="keySystemError",O.MUX_ERROR="muxError",O.OTHER_ERROR="otherError"})(z||(z={}));var U;(function(O){O.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",O.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",O.KEY_SYSTEM_NO_SESSION="keySystemNoSession",O.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",O.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",O.MANIFEST_LOAD_ERROR="manifestLoadError",O.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",O.MANIFEST_PARSING_ERROR="manifestParsingError",O.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",O.LEVEL_EMPTY_ERROR="levelEmptyError",O.LEVEL_LOAD_ERROR="levelLoadError",O.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",O.LEVEL_SWITCH_ERROR="levelSwitchError",O.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",O.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",O.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",O.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",O.FRAG_LOAD_ERROR="fragLoadError",O.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",O.FRAG_DECRYPT_ERROR="fragDecryptError",O.FRAG_PARSING_ERROR="fragParsingError",O.REMUX_ALLOC_ERROR="remuxAllocError",O.KEY_LOAD_ERROR="keyLoadError",O.KEY_LOAD_TIMEOUT="keyLoadTimeOut",O.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",O.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",O.BUFFER_APPEND_ERROR="bufferAppendError",O.BUFFER_APPENDING_ERROR="bufferAppendingError",O.BUFFER_STALLED_ERROR="bufferStalledError",O.BUFFER_FULL_ERROR="bufferFullError",O.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",O.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",O.INTERNAL_EXCEPTION="internalException",O.INTERNAL_ABORTED="aborted",O.UNKNOWN="unknown"})(U||(U={}))},"./src/events.ts":function(q,G,D){"use strict";D.r(G),D.d(G,"Events",function(){return z});var z;(function(U){U.MEDIA_ATTACHING="hlsMediaAttaching",U.MEDIA_ATTACHED="hlsMediaAttached",U.MEDIA_DETACHING="hlsMediaDetaching",U.MEDIA_DETACHED="hlsMediaDetached",U.BUFFER_RESET="hlsBufferReset",U.BUFFER_CODECS="hlsBufferCodecs",U.BUFFER_CREATED="hlsBufferCreated",U.BUFFER_APPENDING="hlsBufferAppending",U.BUFFER_APPENDED="hlsBufferAppended",U.BUFFER_EOS="hlsBufferEos",U.BUFFER_FLUSHING="hlsBufferFlushing",U.BUFFER_FLUSHED="hlsBufferFlushed",U.MANIFEST_LOADING="hlsManifestLoading",U.MANIFEST_LOADED="hlsManifestLoaded",U.MANIFEST_PARSED="hlsManifestParsed",U.LEVEL_SWITCHING="hlsLevelSwitching",U.LEVEL_SWITCHED="hlsLevelSwitched",U.LEVEL_LOADING="hlsLevelLoading",U.LEVEL_LOADED="hlsLevelLoaded",U.LEVEL_UPDATED="hlsLevelUpdated",U.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",U.LEVELS_UPDATED="hlsLevelsUpdated",U.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",U.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",U.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",U.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",U.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",U.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",U.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",U.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",U.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",U.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",U.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",U.CUES_PARSED="hlsCuesParsed",U.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",U.INIT_PTS_FOUND="hlsInitPtsFound",U.FRAG_LOADING="hlsFragLoading",U.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",U.FRAG_LOADED="hlsFragLoaded",U.FRAG_DECRYPTED="hlsFragDecrypted",U.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",U.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",U.FRAG_PARSING_METADATA="hlsFragParsingMetadata",U.FRAG_PARSED="hlsFragParsed",U.FRAG_BUFFERED="hlsFragBuffered",U.FRAG_CHANGED="hlsFragChanged",U.FPS_DROP="hlsFpsDrop",U.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",U.ERROR="hlsError",U.DESTROYING="hlsDestroying",U.KEY_LOADING="hlsKeyLoading",U.KEY_LOADED="hlsKeyLoaded",U.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",U.BACK_BUFFER_REACHED="hlsBackBufferReached"})(z||(z={}))},"./src/hls.ts":function(q,G,D){"use strict";D.r(G),D.d(G,"default",function(){return y});var z=D("./node_modules/url-toolkit/src/url-toolkit.js"),U=D.n(z),O=D("./src/loader/playlist-loader.ts"),F=D("./src/loader/key-loader.ts"),M=D("./src/controller/id3-track-controller.ts"),R=D("./src/controller/latency-controller.ts"),C=D("./src/controller/level-controller.ts"),m=D("./src/controller/fragment-tracker.ts"),v=D("./src/controller/stream-controller.ts"),k=D("./src/is-supported.ts"),S=D("./src/utils/logger.ts"),b=D("./src/config.ts"),f=D("./node_modules/eventemitter3/index.js"),u=D.n(f),a=D("./src/events.ts"),s=D("./src/errors.ts");function l(c,L){for(var x=0;x<L.length;x++){var h=L[x];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(c,h.key,h)}}function A(c,L,x){return L&&l(c.prototype,L),x&&l(c,x),c}var y=function(){c.isSupported=function(){return Object(k.isSupported)()};function c(x){x===void 0&&(x={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new f.EventEmitter,this._autoLevelCapping=void 0,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null;var h=this.config=Object(b.mergeConfig)(c.DefaultConfig,x);this.userConfig=x,Object(S.enableLogs)(h.debug),this._autoLevelCapping=-1,h.progressive&&Object(b.enableStreamingMode)(h);var p=h.abrController,d=h.bufferController,o=h.capLevelController,T=h.fpsController,E=this.abrController=new p(this),g=this.bufferController=new d(this),_=this.capLevelController=new o(this),N=new T(this),B=new O.default(this),W=new F.default(this),P=new M.default(this),I=this.levelController=new C.default(this),H=new m.FragmentTracker(this),Y=this.streamController=new v.default(this,H);_.setStreamController(Y),N.setStreamController(Y);var ee=[I,Y];this.networkControllers=ee;var oe=[B,W,E,g,_,N,P,H];this.audioTrackController=this.createController(h.audioTrackController,null,ee),this.createController(h.audioStreamController,H,ee),this.subtitleTrackController=this.createController(h.subtitleTrackController,null,ee),this.createController(h.subtitleStreamController,H,ee),this.createController(h.timelineController,null,oe),this.emeController=this.createController(h.emeController,null,oe),this.cmcdController=this.createController(h.cmcdController,null,oe),this.latencyController=this.createController(R.default,null,oe),this.coreComponents=oe}var L=c.prototype;return L.createController=function(h,p,d){if(h){var o=p?new h(this,p):new h(this);return d&&d.push(o),o}return null},L.on=function(h,p,d){d===void 0&&(d=this),this._emitter.on(h,p,d)},L.once=function(h,p,d){d===void 0&&(d=this),this._emitter.once(h,p,d)},L.removeAllListeners=function(h){this._emitter.removeAllListeners(h)},L.off=function(h,p,d,o){d===void 0&&(d=this),this._emitter.off(h,p,d,o)},L.listeners=function(h){return this._emitter.listeners(h)},L.emit=function(h,p,d){return this._emitter.emit(h,p,d)},L.trigger=function(h,p){if(this.config.debug)return this.emit(h,h,p);try{return this.emit(h,h,p)}catch(d){S.logger.error("An internal error happened while handling event "+h+'. Error message: "'+d.message+'". Here is a stacktrace:',d),this.trigger(a.Events.ERROR,{type:s.ErrorTypes.OTHER_ERROR,details:s.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:h,error:d})}return!1},L.listenerCount=function(h){return this._emitter.listenerCount(h)},L.destroy=function(){S.logger.log("destroy"),this.trigger(a.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(h){return h.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(h){return h.destroy()}),this.coreComponents.length=0},L.attachMedia=function(h){S.logger.log("attachMedia"),this._media=h,this.trigger(a.Events.MEDIA_ATTACHING,{media:h})},L.detachMedia=function(){S.logger.log("detachMedia"),this.trigger(a.Events.MEDIA_DETACHING,void 0),this._media=null},L.loadSource=function(h){this.stopLoad();var p=this.media,d=this.url,o=this.url=z.buildAbsoluteURL(self.location.href,h,{alwaysNormalize:!0});S.logger.log("loadSource:"+o),p&&d&&d!==o&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(p)),this.trigger(a.Events.MANIFEST_LOADING,{url:h})},L.startLoad=function(h){h===void 0&&(h=-1),S.logger.log("startLoad("+h+")"),this.networkControllers.forEach(function(p){p.startLoad(h)})},L.stopLoad=function(){S.logger.log("stopLoad"),this.networkControllers.forEach(function(h){h.stopLoad()})},L.swapAudioCodec=function(){S.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},L.recoverMediaError=function(){S.logger.log("recoverMediaError");var h=this._media;this.detachMedia(),h&&this.attachMedia(h)},L.removeLevel=function(h,p){p===void 0&&(p=0),this.levelController.removeLevel(h,p)},A(c,[{key:"levels",get:function(){var h=this.levelController.levels;return h||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(h){S.logger.log("set currentLevel:"+h),this.loadLevel=h,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(h){S.logger.log("set nextLevel:"+h),this.levelController.manualLevel=h,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(h){S.logger.log("set loadLevel:"+h),this.levelController.manualLevel=h}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(h){this.levelController.nextLoadLevel=h}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(h){S.logger.log("set firstLevel:"+h),this.levelController.firstLevel=h}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(h){S.logger.log("set startLevel:"+h),h!==-1&&(h=Math.max(h,this.minAutoLevel)),this.levelController.startLevel=h}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(h){var p=!!h;p!==this.config.capLevelToPlayerSize&&(p?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=p)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(h){this._autoLevelCapping!==h&&(S.logger.log("set autoLevelCapping:"+h),this._autoLevelCapping=h)}},{key:"bandwidthEstimate",get:function(){var h=this.abrController.bwEstimator;return h?h.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var h=this.levels,p=this.config.minAutoBitrate;if(!h)return 0;for(var d=h.length,o=0;o<d;o++)if(h[o].maxBitrate>p)return o;return 0}},{key:"maxAutoLevel",get:function(){var h=this.levels,p=this.autoLevelCapping,d;return p===-1&&h&&h.length?d=h.length-1:d=p,d}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(h){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,h)}},{key:"audioTracks",get:function(){var h=this.audioTrackController;return h?h.audioTracks:[]}},{key:"audioTrack",get:function(){var h=this.audioTrackController;return h?h.audioTrack:-1},set:function(h){var p=this.audioTrackController;p&&(p.audioTrack=h)}},{key:"subtitleTracks",get:function(){var h=this.subtitleTrackController;return h?h.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var h=this.subtitleTrackController;return h?h.subtitleTrack:-1},set:function(h){var p=this.subtitleTrackController;p&&(p.subtitleTrack=h)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var h=this.subtitleTrackController;return h?h.subtitleDisplay:!1},set:function(h){var p=this.subtitleTrackController;p&&(p.subtitleDisplay=h)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(h){this.config.lowLatencyMode=h}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}],[{key:"version",get:function(){return"1.1.2"}},{key:"Events",get:function(){return a.Events}},{key:"ErrorTypes",get:function(){return s.ErrorTypes}},{key:"ErrorDetails",get:function(){return s.ErrorDetails}},{key:"DefaultConfig",get:function(){return c.defaultConfig?c.defaultConfig:b.hlsDefaultConfig},set:function(h){c.defaultConfig=h}}]),c}();y.defaultConfig=void 0},"./src/is-supported.ts":function(q,G,D){"use strict";D.r(G),D.d(G,"isSupported",function(){return O}),D.d(G,"changeTypeSupported",function(){return F});var z=D("./src/utils/mediasource-helper.ts");function U(){return self.SourceBuffer||self.WebKitSourceBuffer}function O(){var M=Object(z.getMediaSource)();if(!M)return!1;var R=U(),C=M&&typeof M.isTypeSupported=="function"&&M.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),m=!R||R.prototype&&typeof R.prototype.appendBuffer=="function"&&typeof R.prototype.remove=="function";return!!C&&!!m}function F(){var M,R=U();return typeof(R==null||((M=R.prototype)===null||M===void 0)?void 0:M.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(q,G,D){"use strict";D.r(G),D.d(G,"default",function(){return S}),D.d(G,"LoadError",function(){return f});var z=D("./src/polyfills/number.ts"),U=D("./src/errors.ts");function O(u,a){u.prototype=Object.create(a.prototype),u.prototype.constructor=u,m(u,a)}function F(u){var a=typeof Map=="function"?new Map:void 0;return F=function(l){if(l===null||!C(l))return l;if(typeof l!="function")throw new TypeError("Super expression must either be null or a function");if(typeof a!="undefined"){if(a.has(l))return a.get(l);a.set(l,A)}function A(){return M(l,arguments,v(this).constructor)}return A.prototype=Object.create(l.prototype,{constructor:{value:A,enumerable:!1,writable:!0,configurable:!0}}),m(A,l)},F(u)}function M(u,a,s){return R()?M=Reflect.construct:M=function(A,y,c){var L=[null];L.push.apply(L,y);var x=Function.bind.apply(A,L),h=new x;return c&&m(h,c.prototype),h},M.apply(null,arguments)}function R(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(u){return!1}}function C(u){return Function.toString.call(u).indexOf("[native code]")!==-1}function m(u,a){return m=Object.setPrototypeOf||function(l,A){return l.__proto__=A,l},m(u,a)}function v(u){return v=Object.setPrototypeOf?Object.getPrototypeOf:function(s){return s.__proto__||Object.getPrototypeOf(s)},v(u)}var k=Math.pow(2,17),S=function(){function u(s){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=s}var a=u.prototype;return a.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},a.abort=function(){this.loader&&this.loader.abort()},a.load=function(l,A){var y=this,c=l.url;if(!c)return Promise.reject(new f({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:l,networkDetails:null},"Fragment does not have a "+(c?"part list":"url")));this.abort();var L=this.config,x=L.fLoader,h=L.loader;return new Promise(function(p,d){y.loader&&y.loader.destroy();var o=y.loader=l.loader=x?new x(L):new h(L),T=b(l),E={timeout:L.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:L.fragLoadingMaxRetryTimeout,highWaterMark:k};l.stats=o.stats,o.load(T,E,{onSuccess:function(_,N,B,W){y.resetLoader(l,o),p({frag:l,part:null,payload:_.data,networkDetails:W})},onError:function(_,N,B){y.resetLoader(l,o),d(new f({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:l,response:_,networkDetails:B}))},onAbort:function(_,N,B){y.resetLoader(l,o),d(new f({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:l,networkDetails:B}))},onTimeout:function(_,N,B){y.resetLoader(l,o),d(new f({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:l,networkDetails:B}))},onProgress:function(_,N,B,W){A&&A({frag:l,part:null,payload:B,networkDetails:W})}})})},a.loadPart=function(l,A,y){var c=this;this.abort();var L=this.config,x=L.fLoader,h=L.loader;return new Promise(function(p,d){c.loader&&c.loader.destroy();var o=c.loader=l.loader=x?new x(L):new h(L),T=b(l,A),E={timeout:L.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:L.fragLoadingMaxRetryTimeout,highWaterMark:k};A.stats=o.stats,o.load(T,E,{onSuccess:function(_,N,B,W){c.resetLoader(l,o),c.updateStatsFromPart(l,A);var P={frag:l,part:A,payload:_.data,networkDetails:W};y(P),p(P)},onError:function(_,N,B){c.resetLoader(l,o),d(new f({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:l,part:A,response:_,networkDetails:B}))},onAbort:function(_,N,B){l.stats.aborted=A.stats.aborted,c.resetLoader(l,o),d(new f({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:l,part:A,networkDetails:B}))},onTimeout:function(_,N,B){c.resetLoader(l,o),d(new f({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:l,part:A,networkDetails:B}))}})})},a.updateStatsFromPart=function(l,A){var y=l.stats,c=A.stats,L=c.total;if(y.loaded+=c.loaded,L){var x=Math.round(l.duration/A.duration),h=Math.min(Math.round(y.loaded/L),x),p=x-h,d=p*Math.round(y.loaded/h);y.total=y.loaded+d}else y.total=Math.max(y.loaded,y.total);var o=y.loading,T=c.loading;o.start?o.first+=T.first-T.start:(o.start=T.start,o.first=T.first),o.end=T.end},a.resetLoader=function(l,A){l.loader=null,this.loader===A&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),A.destroy()},u}();function b(u,a){a===void 0&&(a=null);var s=a||u,l={frag:u,part:a,responseType:"arraybuffer",url:s.url,headers:{},rangeStart:0,rangeEnd:0},A=s.byteRangeStartOffset,y=s.byteRangeEndOffset;return Object(z.isFiniteNumber)(A)&&Object(z.isFiniteNumber)(y)&&(l.rangeStart=A,l.rangeEnd=y),l}var f=function(u){O(a,u);function a(s){for(var l,A=arguments.length,y=new Array(A>1?A-1:0),c=1;c<A;c++)y[c-1]=arguments[c];return l=u.call.apply(u,[this].concat(y))||this,l.data=void 0,l.data=s,l}return a}(F(Error))},"./src/loader/fragment.ts":function(q,G,D){"use strict";D.r(G),D.d(G,"ElementaryStreamTypes",function(){return S}),D.d(G,"BaseSegment",function(){return b}),D.d(G,"Fragment",function(){return f}),D.d(G,"Part",function(){return u});var z=D("./src/polyfills/number.ts"),U=D("./node_modules/url-toolkit/src/url-toolkit.js"),O=D.n(U),F=D("./src/utils/logger.ts"),M=D("./src/loader/level-key.ts"),R=D("./src/loader/load-stats.ts");function C(a,s){a.prototype=Object.create(s.prototype),a.prototype.constructor=a,m(a,s)}function m(a,s){return m=Object.setPrototypeOf||function(A,y){return A.__proto__=y,A},m(a,s)}function v(a,s){for(var l=0;l<s.length;l++){var A=s[l];A.enumerable=A.enumerable||!1,A.configurable=!0,"value"in A&&(A.writable=!0),Object.defineProperty(a,A.key,A)}}function k(a,s,l){return s&&v(a.prototype,s),l&&v(a,l),a}var S;(function(a){a.AUDIO="audio",a.VIDEO="video",a.AUDIOVIDEO="audiovideo"})(S||(S={}));var b=function(){function a(l){var A;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(A={},A[S.AUDIO]=null,A[S.VIDEO]=null,A[S.AUDIOVIDEO]=null,A),this.baseurl=l}var s=a.prototype;return s.setByteRange=function(A,y){var c=A.split("@",2),L=[];c.length===1?L[0]=y?y.byteRangeEndOffset:0:L[0]=parseInt(c[1]),L[1]=parseInt(c[0])+L[0],this._byteRange=L},k(a,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Object(U.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(A){this._url=A}}]),a}(),f=function(a){C(s,a);function s(A,y){var c;return c=a.call(this,y)||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 R.LoadStats,c.urlId=0,c.data=void 0,c.bitrateTest=!1,c.title=null,c.initSegment=null,c.type=A,c}var l=s.prototype;return l.createInitializationVector=function(y){for(var c=new Uint8Array(16),L=12;L<16;L++)c[L]=y>>8*(15-L)&255;return c},l.setDecryptDataFromLevelKey=function(y,c){var L=y;return(y==null?void 0:y.method)==="AES-128"&&y.uri&&!y.iv&&(L=M.LevelKey.fromURI(y.uri),L.method=y.method,L.iv=this.createInitializationVector(c),L.keyFormat="identity"),L},l.setElementaryStreamInfo=function(y,c,L,x,h,p){p===void 0&&(p=!1);var d=this.elementaryStreams,o=d[y];if(!o){d[y]={startPTS:c,endPTS:L,startDTS:x,endDTS:h,partial:p};return}o.startPTS=Math.min(o.startPTS,c),o.endPTS=Math.max(o.endPTS,L),o.startDTS=Math.min(o.startDTS,x),o.endDTS=Math.max(o.endDTS,h)},l.clearElementaryStreamInfo=function(){var y=this.elementaryStreams;y[S.AUDIO]=null,y[S.VIDEO]=null,y[S.AUDIOVIDEO]=null},k(s,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var y=this.sn;typeof y!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&F.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),y=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,y)}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 y=Object(z.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+y*1e3}},{key:"encrypted",get:function(){var y;return!!((y=this.decryptdata)!==null&&y!==void 0&&y.keyFormat&&this.decryptdata.uri)}}]),s}(b),u=function(a){C(s,a);function s(l,A,y,c,L){var x;x=a.call(this,y)||this,x.fragOffset=0,x.duration=0,x.gap=!1,x.independent=!1,x.relurl=void 0,x.fragment=void 0,x.index=void 0,x.stats=new R.LoadStats,x.duration=l.decimalFloatingPoint("DURATION"),x.gap=l.bool("GAP"),x.independent=l.bool("INDEPENDENT"),x.relurl=l.enumeratedString("URI"),x.fragment=A,x.index=c;var h=l.enumeratedString("BYTERANGE");return h&&x.setByteRange(h,L),L&&(x.fragOffset=L.fragOffset+L.duration),x}return k(s,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var A=this.elementaryStreams;return!!(A.audio||A.video||A.audiovideo)}}]),s}(b)},"./src/loader/key-loader.ts":function(q,G,D){"use strict";D.r(G),D.d(G,"default",function(){return F});var z=D("./src/events.ts"),U=D("./src/errors.ts"),O=D("./src/utils/logger.ts"),F=function(){function M(C){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=C,this._registerListeners()}var R=M.prototype;return R._registerListeners=function(){this.hls.on(z.Events.KEY_LOADING,this.onKeyLoading,this)},R._unregisterListeners=function(){this.hls.off(z.Events.KEY_LOADING,this.onKeyLoading)},R.destroy=function(){this._unregisterListeners();for(var m in this.loaders){var v=this.loaders[m];v&&v.destroy()}this.loaders={}},R.onKeyLoading=function(m,v){var k=v.frag,S=k.type,b=this.loaders[S];if(!k.decryptdata){O.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var f=k.decryptdata.uri;if(f!==this.decrypturl||this.decryptkey===null){var u=this.hls.config;if(b&&(O.logger.warn("abort previous key loader for type:"+S),b.abort()),!f){O.logger.warn("key uri is falsy");return}var a=u.loader,s=k.loader=this.loaders[S]=new a(u);this.decrypturl=f,this.decryptkey=null;var l={url:f,frag:k,responseType:"arraybuffer"},A={timeout:u.fragLoadingTimeOut,maxRetry:0,retryDelay:u.fragLoadingRetryDelay,maxRetryDelay:u.fragLoadingMaxRetryTimeout,highWaterMark:0},y={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};s.load(l,A,y)}else this.decryptkey&&(k.decryptdata.key=this.decryptkey,this.hls.trigger(z.Events.KEY_LOADED,{frag:k}))},R.loadsuccess=function(m,v,k){var S=k.frag;if(!S.decryptdata){O.logger.error("after key load, decryptdata unset");return}this.decryptkey=S.decryptdata.key=new Uint8Array(m.data),S.loader=null,delete this.loaders[S.type],this.hls.trigger(z.Events.KEY_LOADED,{frag:S})},R.loaderror=function(m,v){var k=v.frag,S=k.loader;S&&S.abort(),delete this.loaders[k.type],this.hls.trigger(z.Events.ERROR,{type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:k,response:m})},R.loadtimeout=function(m,v){var k=v.frag,S=k.loader;S&&S.abort(),delete this.loaders[k.type],this.hls.trigger(z.Events.ERROR,{type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:k})},M}()},"./src/loader/level-details.ts":function(q,G,D){"use strict";D.r(G),D.d(G,"LevelDetails",function(){return M});var z=D("./src/polyfills/number.ts");function U(R,C){for(var m=0;m<C.length;m++){var v=C[m];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(R,v.key,v)}}function O(R,C,m){return C&&U(R.prototype,C),m&&U(R,m),R}var F=10,M=function(){function R(m){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=m}var C=R.prototype;return C.reloaded=function(v){if(!v){this.advanced=!0,this.updated=!0;return}var k=this.lastPartSn-v.lastPartSn,S=this.lastPartIndex-v.lastPartIndex;this.updated=this.endSN!==v.endSN||!!S||!!k,this.advanced=this.endSN>v.endSN||k>0||k===0&&S>0,this.updated||this.advanced?this.misses=Math.floor(v.misses*.6):this.misses=v.misses+1,this.availabilityDelay=v.availabilityDelay},O(R,[{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||F}},{key:"drift",get:function(){var v=this.driftEndTime-this.driftStartTime;if(v>0){var k=this.driftEnd-this.driftStart;return k*1e3/v}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var v;return(v=this.partList)!==null&&v!==void 0&&v.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var v;return(v=this.fragments)!==null&&v!==void 0&&v.length?this.fragments[this.fragments.length-1].end:0}},{key:"age",get:function(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}},{key:"lastPartIndex",get:function(){var v;return(v=this.partList)!==null&&v!==void 0&&v.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var v;return(v=this.partList)!==null&&v!==void 0&&v.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),R}()},"./src/loader/level-key.ts":function(q,G,D){"use strict";D.r(G),D.d(G,"LevelKey",function(){return M});var z=D("./node_modules/url-toolkit/src/url-toolkit.js"),U=D.n(z);function O(R,C){for(var m=0;m<C.length;m++){var v=C[m];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(R,v.key,v)}}function F(R,C,m){return C&&O(R.prototype,C),m&&O(R,m),R}var M=function(){R.fromURL=function(m,v){return new R(m,v)},R.fromURI=function(m){return new R(m)};function R(C,m){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,m?this._uri=Object(z.buildAbsoluteURL)(C,m,{alwaysNormalize:!0}):this._uri=C}return F(R,[{key:"uri",get:function(){return this._uri}}]),R}()},"./src/loader/load-stats.ts":function(q,G,D){"use strict";D.r(G),D.d(G,"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(q,G,D){"use strict";D.r(G),D.d(G,"default",function(){return s});var z=D("./src/polyfills/number.ts"),U=D("./node_modules/url-toolkit/src/url-toolkit.js"),O=D.n(U),F=D("./src/loader/fragment.ts"),M=D("./src/loader/level-details.ts"),R=D("./src/loader/level-key.ts"),C=D("./src/utils/attr-list.ts"),m=D("./src/utils/logger.ts"),v=D("./src/utils/codecs.ts"),k=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,S=/#EXT-X-MEDIA:(.*)/g,b=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),f=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 a(L){var x,h;return u.test((x=(h=U.parseURL(L))===null||h===void 0?void 0:h.path)!=null?x:"")}var s=function(){function L(){}return L.findGroup=function(h,p){for(var d=0;d<h.length;d++){var o=h[d];if(o.id===p)return o}},L.convertAVC1ToAVCOTI=function(h){var p=h.split(".");if(p.length>2){var d=p.shift()+".";return d+=parseInt(p.shift()).toString(16),d+=("000"+parseInt(p.shift()).toString(16)).substr(-4),d}return h},L.resolve=function(h,p){return U.buildAbsoluteURL(p,h,{alwaysNormalize:!0})},L.parseMasterPlaylist=function(h,p){var d=[],o={},T=!1;k.lastIndex=0;for(var E;(E=k.exec(h))!=null;)if(E[1]){var g=new C.AttrList(E[1]),_={attrs:g,bitrate:g.decimalInteger("AVERAGE-BANDWIDTH")||g.decimalInteger("BANDWIDTH"),name:g.NAME,url:L.resolve(E[2],p)},N=g.decimalResolution("RESOLUTION");N&&(_.width=N.width,_.height=N.height),l((g.CODECS||"").split(/[ ,]+/).filter(function(W){return W}),_),_.videoCodec&&_.videoCodec.indexOf("avc1")!==-1&&(_.videoCodec=L.convertAVC1ToAVCOTI(_.videoCodec)),d.push(_)}else if(E[3]){var B=new C.AttrList(E[3]);B["DATA-ID"]&&(T=!0,o[B["DATA-ID"]]=B)}return{levels:d,sessionData:T?o:null}},L.parseMasterPlaylistMedia=function(h,p,d,o){o===void 0&&(o=[]);var T,E=[],g=0;for(S.lastIndex=0;(T=S.exec(h))!==null;){var _=new C.AttrList(T[1]);if(_.TYPE===d){var N={attrs:_,bitrate:0,id:g++,groupId:_["GROUP-ID"],instreamId:_["INSTREAM-ID"],name:_.NAME||_.LANGUAGE||"",type:d,default:_.bool("DEFAULT"),autoselect:_.bool("AUTOSELECT"),forced:_.bool("FORCED"),lang:_.LANGUAGE,url:_.URI?L.resolve(_.URI,p):""};if(o.length){var B=L.findGroup(o,N.groupId)||o[0];A(N,B,"audioCodec"),A(N,B,"textCodec")}E.push(N)}}return E},L.parseLevelPlaylist=function(h,p,d,o,T){var E=new M.LevelDetails(p),g=E.fragments,_=null,N=0,B=0,W=0,P=0,I=null,H=new F.Fragment(o,p),Y,ee,oe,Ee=-1,pe=!1;for(b.lastIndex=0,E.m3u8=h;(Y=b.exec(h))!==null;){pe&&(pe=!1,H=new F.Fragment(o,p),H.start=W,H.sn=N,H.cc=P,H.level=d,_&&(H.initSegment=_,H.rawProgramDateTime=_.rawProgramDateTime));var me=Y[1];if(me){H.duration=parseFloat(me);var he=(" "+Y[2]).slice(1);H.title=he||null,H.tagList.push(he?["INF",me,he]:["INF",me])}else if(Y[3])Object(z.isFiniteNumber)(H.duration)&&(H.start=W,oe&&(H.levelkey=oe),H.sn=N,H.level=d,H.cc=P,H.urlId=T,g.push(H),H.relurl=(" "+Y[3]).slice(1),c(H,I),I=H,W+=H.duration,N++,B=0,pe=!0);else if(Y[4]){var se=(" "+Y[4]).slice(1);I?H.setByteRange(se,I):H.setByteRange(se)}else if(Y[5])H.rawProgramDateTime=(" "+Y[5]).slice(1),H.tagList.push(["PROGRAM-DATE-TIME",H.rawProgramDateTime]),Ee===-1&&(Ee=g.length);else{if(Y=Y[0].match(f),!Y){m.logger.warn("No matches on slow regex match for level playlist!");continue}for(ee=1;ee<Y.length&&!(typeof Y[ee]!="undefined");ee++);var ne=(" "+Y[ee]).slice(1),ce=(" "+Y[ee+1]).slice(1),$=Y[ee+2]?(" "+Y[ee+2]).slice(1):"";switch(ne){case"PLAYLIST-TYPE":E.type=ce.toUpperCase();break;case"MEDIA-SEQUENCE":N=E.startSN=parseInt(ce);break;case"SKIP":{var ie=new C.AttrList(ce),Z=ie.decimalInteger("SKIPPED-SEGMENTS");if(Object(z.isFiniteNumber)(Z)){E.skippedSegments=Z;for(var ye=Z;ye--;)g.unshift(null);N+=Z}var Ce=ie.enumeratedString("RECENTLY-REMOVED-DATERANGES");Ce&&(E.recentlyRemovedDateranges=Ce.split(" "));break}case"TARGETDURATION":E.targetduration=parseFloat(ce);break;case"VERSION":E.version=parseInt(ce);break;case"EXTM3U":break;case"ENDLIST":E.live=!1;break;case"#":(ce||$)&&H.tagList.push($?[ce,$]:[ce]);break;case"DIS":P++;case"GAP":H.tagList.push([ne]);break;case"BITRATE":H.tagList.push([ne,ce]);break;case"DISCONTINUITY-SEQ":P=parseInt(ce);break;case"KEY":{var ve,we=new C.AttrList(ce),Ae=we.enumeratedString("METHOD"),Re=we.URI,Ie=we.hexadecimalInteger("IV"),Me=we.enumeratedString("KEYFORMATVERSIONS"),De=we.enumeratedString("KEYID"),Ve=(ve=we.enumeratedString("KEYFORMAT"))!=null?ve:"identity",et=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(et.indexOf(Ve)>-1){m.logger.warn("Keyformat "+Ve+" is not supported from the manifest");continue}else if(Ve!=="identity")continue;Ae&&(oe=R.LevelKey.fromURL(p,Re),Re&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Ae)>=0&&(oe.method=Ae,oe.keyFormat=Ve,De&&(oe.keyID=De),Me&&(oe.keyFormatVersions=Me),oe.iv=Ie));break}case"START":{var ze=new C.AttrList(ce),Xe=ze.decimalFloatingPoint("TIME-OFFSET");Object(z.isFiniteNumber)(Xe)&&(E.startTimeOffset=Xe);break}case"MAP":{var qe=new C.AttrList(ce);H.relurl=qe.URI,qe.BYTERANGE&&H.setByteRange(qe.BYTERANGE),H.level=d,H.sn="initSegment",oe&&(H.levelkey=oe),H.initSegment=null,_=H,pe=!0;break}case"SERVER-CONTROL":{var He=new C.AttrList(ce);E.canBlockReload=He.bool("CAN-BLOCK-RELOAD"),E.canSkipUntil=He.optionalFloat("CAN-SKIP-UNTIL",0),E.canSkipDateRanges=E.canSkipUntil>0&&He.bool("CAN-SKIP-DATERANGES"),E.partHoldBack=He.optionalFloat("PART-HOLD-BACK",0),E.holdBack=He.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var Be=new C.AttrList(ce);E.partTarget=Be.decimalFloatingPoint("PART-TARGET");break}case"PART":{var Se=E.partList;Se||(Se=E.partList=[]);var Ze=B>0?Se[Se.length-1]:void 0,Je=B++,Le=new F.Part(new C.AttrList(ce),H,p,Je,Ze);Se.push(Le),H.duration+=Le.duration;break}case"PRELOAD-HINT":{var Ue=new C.AttrList(ce);E.preloadHint=Ue;break}case"RENDITION-REPORT":{var ge=new C.AttrList(ce);E.renditionReports=E.renditionReports||[],E.renditionReports.push(ge);break}default:m.logger.warn("line parsed but not handled: "+Y);break}}}I&&!I.relurl?(g.pop(),W-=I.duration,E.partList&&(E.fragmentHint=I)):E.partList&&(c(H,I),H.cc=P,E.fragmentHint=H);var de=g.length,fe=g[0],Q=g[de-1];if(W+=E.skippedSegments*E.targetduration,W>0&&de&&Q){E.averagetargetduration=W/de;var J=Q.sn;E.endSN=J!=="initSegment"?J:0,fe&&(E.startCC=fe.cc,fe.initSegment||E.fragments.every(function(re){return re.relurl&&a(re.relurl)})&&(m.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),H=new F.Fragment(o,p),H.relurl=Q.relurl,H.level=d,H.sn="initSegment",fe.initSegment=H,E.needSidxRanges=!0))}else E.endSN=0,E.startCC=0;return E.fragmentHint&&(W+=E.fragmentHint.duration),E.totalduration=W,E.endCC=P,Ee>0&&y(g,Ee),E},L}();function l(L,x){["video","audio","text"].forEach(function(h){var p=L.filter(function(o){return Object(v.isCodecType)(o,h)});if(p.length){var d=p.filter(function(o){return o.lastIndexOf("avc1",0)===0||o.lastIndexOf("mp4a",0)===0});x[h+"Codec"]=d.length>0?d[0]:p[0],L=L.filter(function(o){return p.indexOf(o)===-1})}}),x.unknownCodecs=L}function A(L,x,h){var p=x[h];p&&(L[h]=p)}function y(L,x){for(var h=L[x],p=x;p--;){var d=L[p];if(!d)return;d.programDateTime=h.programDateTime-d.duration*1e3,h=d}}function c(L,x){L.rawProgramDateTime?L.programDateTime=Date.parse(L.rawProgramDateTime):x!=null&&x.programDateTime&&(L.programDateTime=x.endProgramDateTime),Object(z.isFiniteNumber)(L.programDateTime)||(L.programDateTime=null,L.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(q,G,D){"use strict";D.r(G);var z=D("./src/polyfills/number.ts"),U=D("./src/events.ts"),O=D("./src/errors.ts"),F=D("./src/utils/logger.ts"),M=D("./src/utils/mp4-tools.ts"),R=D("./src/loader/m3u8-parser.ts"),C=D("./src/types/loader.ts"),m=D("./src/utils/attr-list.ts");function v(b){var f=b.type;switch(f){case C.PlaylistContextType.AUDIO_TRACK:return C.PlaylistLevelType.AUDIO;case C.PlaylistContextType.SUBTITLE_TRACK:return C.PlaylistLevelType.SUBTITLE;default:return C.PlaylistLevelType.MAIN}}function k(b,f){var u=b.url;return(u===void 0||u.indexOf("data:")===0)&&(u=f.url),u}var S=function(){function b(u){this.hls=void 0,this.loaders=Object.create(null),this.hls=u,this.registerListeners()}var f=b.prototype;return f.registerListeners=function(){var a=this.hls;a.on(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.on(U.Events.LEVEL_LOADING,this.onLevelLoading,this),a.on(U.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),a.on(U.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},f.unregisterListeners=function(){var a=this.hls;a.off(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.off(U.Events.LEVEL_LOADING,this.onLevelLoading,this),a.off(U.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),a.off(U.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},f.createInternalLoader=function(a){var s=this.hls.config,l=s.pLoader,A=s.loader,y=l||A,c=new y(s);return a.loader=c,this.loaders[a.type]=c,c},f.getInternalLoader=function(a){return this.loaders[a.type]},f.resetInternalLoader=function(a){this.loaders[a]&&delete this.loaders[a]},f.destroyInternalLoaders=function(){for(var a in this.loaders){var s=this.loaders[a];s&&s.destroy(),this.resetInternalLoader(a)}},f.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},f.onManifestLoading=function(a,s){var l=s.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:C.PlaylistContextType.MANIFEST,url:l,deliveryDirectives:null})},f.onLevelLoading=function(a,s){var l=s.id,A=s.level,y=s.url,c=s.deliveryDirectives;this.load({id:l,groupId:null,level:A,responseType:"text",type:C.PlaylistContextType.LEVEL,url:y,deliveryDirectives:c})},f.onAudioTrackLoading=function(a,s){var l=s.id,A=s.groupId,y=s.url,c=s.deliveryDirectives;this.load({id:l,groupId:A,level:null,responseType:"text",type:C.PlaylistContextType.AUDIO_TRACK,url:y,deliveryDirectives:c})},f.onSubtitleTrackLoading=function(a,s){var l=s.id,A=s.groupId,y=s.url,c=s.deliveryDirectives;this.load({id:l,groupId:A,level:null,responseType:"text",type:C.PlaylistContextType.SUBTITLE_TRACK,url:y,deliveryDirectives:c})},f.load=function(a){var s,l=this.hls.config,A=this.getInternalLoader(a);if(A){var y=A.context;if(y&&y.url===a.url){F.logger.trace("[playlist-loader]: playlist request ongoing");return}F.logger.log("[playlist-loader]: aborting previous loader for type: "+a.type),A.abort()}var c,L,x,h;switch(a.type){case C.PlaylistContextType.MANIFEST:c=l.manifestLoadingMaxRetry,L=l.manifestLoadingTimeOut,x=l.manifestLoadingRetryDelay,h=l.manifestLoadingMaxRetryTimeout;break;case C.PlaylistContextType.LEVEL:case C.PlaylistContextType.AUDIO_TRACK:case C.PlaylistContextType.SUBTITLE_TRACK:c=0,L=l.levelLoadingTimeOut;break;default:c=l.levelLoadingMaxRetry,L=l.levelLoadingTimeOut,x=l.levelLoadingRetryDelay,h=l.levelLoadingMaxRetryTimeout;break}if(A=this.createInternalLoader(a),(s=a.deliveryDirectives)!==null&&s!==void 0&&s.part){var p;if(a.type===C.PlaylistContextType.LEVEL&&a.level!==null?p=this.hls.levels[a.level].details:a.type===C.PlaylistContextType.AUDIO_TRACK&&a.id!==null?p=this.hls.audioTracks[a.id].details:a.type===C.PlaylistContextType.SUBTITLE_TRACK&&a.id!==null&&(p=this.hls.subtitleTracks[a.id].details),p){var d=p.partTarget,o=p.targetduration;d&&o&&(L=Math.min(Math.max(d*3,o*.8)*1e3,L))}}var T={timeout:L,maxRetry:c,retryDelay:x,maxRetryDelay:h,highWaterMark:0},E={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};A.load(a,T,E)},f.loadsuccess=function(a,s,l,A){if(A===void 0&&(A=null),l.isSidxRequest){this.handleSidxRequest(a,l),this.handlePlaylistLoaded(a,s,l,A);return}this.resetInternalLoader(l.type);var y=a.data;if(y.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(a,l,"no EXTM3U delimiter",A);return}s.parsing.start=performance.now(),y.indexOf("#EXTINF:")>0||y.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(a,s,l,A):this.handleMasterPlaylist(a,s,l,A)},f.loaderror=function(a,s,l){l===void 0&&(l=null),this.handleNetworkError(s,l,!1,a)},f.loadtimeout=function(a,s,l){l===void 0&&(l=null),this.handleNetworkError(s,l,!0)},f.handleMasterPlaylist=function(a,s,l,A){var y=this.hls,c=a.data,L=k(a,l),x=R.default.parseMasterPlaylist(c,L),h=x.levels,p=x.sessionData;if(!h.length){this.handleManifestParsingError(a,l,"no level found in manifest",A);return}var d=h.map(function(N){return{id:N.attrs.AUDIO,audioCodec:N.audioCodec}}),o=h.map(function(N){return{id:N.attrs.SUBTITLES,textCodec:N.textCodec}}),T=R.default.parseMasterPlaylistMedia(c,L,"AUDIO",d),E=R.default.parseMasterPlaylistMedia(c,L,"SUBTITLES",o),g=R.default.parseMasterPlaylistMedia(c,L,"CLOSED-CAPTIONS");if(T.length){var _=T.some(function(N){return!N.url});!_&&h[0].audioCodec&&!h[0].attrs.AUDIO&&(F.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),T.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new m.AttrList({}),bitrate:0,url:""}))}y.trigger(U.Events.MANIFEST_LOADED,{levels:h,audioTracks:T,subtitles:E,captions:g,url:L,stats:s,networkDetails:A,sessionData:p})},f.handleTrackOrLevelPlaylist=function(a,s,l,A){var y=this.hls,c=l.id,L=l.level,x=l.type,h=k(a,l),p=Object(z.isFiniteNumber)(c)?c:0,d=Object(z.isFiniteNumber)(L)?L:p,o=v(l),T=R.default.parseLevelPlaylist(a.data,h,d,o,p);if(!T.fragments.length){y.trigger(U.Events.ERROR,{type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:h,reason:"no fragments found in level",level:typeof l.level=="number"?l.level:void 0});return}if(x===C.PlaylistContextType.MANIFEST){var E={attrs:new m.AttrList({}),bitrate:0,details:T,name:"",url:h};y.trigger(U.Events.MANIFEST_LOADED,{levels:[E],audioTracks:[],url:h,stats:s,networkDetails:A,sessionData:null})}if(s.parsing.end=performance.now(),T.needSidxRanges){var g,_=(g=T.fragments[0].initSegment)===null||g===void 0?void 0:g.url;this.load({url:_,isSidxRequest:!0,type:x,level:L,levelDetails:T,id:c,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}l.levelDetails=T,this.handlePlaylistLoaded(a,s,l,A)},f.handleSidxRequest=function(a,s){var l=Object(M.parseSegmentIndex)(new Uint8Array(a.data));if(!l)return;var A=l.references,y=s.levelDetails;A.forEach(function(c,L){var x=c.info,h=y.fragments[L];h.byteRange.length===0&&h.setByteRange(String(1+x.end-x.start)+"@"+String(x.start)),h.initSegment&&h.initSegment.setByteRange(String(l.moovEndOffset)+"@0")})},f.handleManifestParsingError=function(a,s,l,A){this.hls.trigger(U.Events.ERROR,{type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:s.type===C.PlaylistContextType.MANIFEST,url:a.url,reason:l,response:a,context:s,networkDetails:A})},f.handleNetworkError=function(a,s,l,A){l===void 0&&(l=!1),F.logger.warn("[playlist-loader]: A network "+(l?"timeout":"error")+" occurred while loading "+a.type+" level: "+a.level+" id: "+a.id+' group-id: "'+a.groupId+'"');var y=O.ErrorDetails.UNKNOWN,c=!1,L=this.getInternalLoader(a);switch(a.type){case C.PlaylistContextType.MANIFEST:y=l?O.ErrorDetails.MANIFEST_LOAD_TIMEOUT:O.ErrorDetails.MANIFEST_LOAD_ERROR,c=!0;break;case C.PlaylistContextType.LEVEL:y=l?O.ErrorDetails.LEVEL_LOAD_TIMEOUT:O.ErrorDetails.LEVEL_LOAD_ERROR,c=!1;break;case C.PlaylistContextType.AUDIO_TRACK:y=l?O.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:O.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,c=!1;break;case C.PlaylistContextType.SUBTITLE_TRACK:y=l?O.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:O.ErrorDetails.SUBTITLE_LOAD_ERROR,c=!1;break}L&&this.resetInternalLoader(a.type);var x={type:O.ErrorTypes.NETWORK_ERROR,details:y,fatal:c,url:a.url,loader:L,context:a,networkDetails:s};A&&(x.response=A),this.hls.trigger(U.Events.ERROR,x)},f.handlePlaylistLoaded=function(a,s,l,A){var y=l.type,c=l.level,L=l.id,x=l.groupId,h=l.loader,p=l.levelDetails,d=l.deliveryDirectives;if(!(p!=null&&p.targetduration)){this.handleManifestParsingError(a,l,"invalid target duration",A);return}if(!h)return;p.live&&(h.getCacheAge&&(p.ageHeader=h.getCacheAge()||0),(!h.getCacheAge||isNaN(p.ageHeader))&&(p.ageHeader=0));switch(y){case C.PlaylistContextType.MANIFEST:case C.PlaylistContextType.LEVEL:this.hls.trigger(U.Events.LEVEL_LOADED,{details:p,level:c||0,id:L||0,stats:s,networkDetails:A,deliveryDirectives:d});break;case C.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(U.Events.AUDIO_TRACK_LOADED,{details:p,id:L||0,groupId:x||"",stats:s,networkDetails:A,deliveryDirectives:d});break;case C.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(U.Events.SUBTITLE_TRACK_LOADED,{details:p,id:L||0,groupId:x||"",stats:s,networkDetails:A,deliveryDirectives:d});break}},b}();G.default=S},"./src/polyfills/number.ts":function(q,G,D){"use strict";D.r(G),D.d(G,"isFiniteNumber",function(){return z}),D.d(G,"MAX_SAFE_INTEGER",function(){return U});var z=Number.isFinite||function(O){return typeof O=="number"&&isFinite(O)},U=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(q,G,D){"use strict";D.r(G);var z=function(){function U(){}return U.getSilentFrame=function(F,M){switch(F){case"mp4a.40.2":if(M===1)return new Uint8Array([0,200,0,128,35,128]);if(M===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(M===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(M===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(M===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(M===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(M===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(M===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(M===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}return},U}();G.default=z},"./src/remux/mp4-generator.ts":function(q,G,D){"use strict";D.r(G);var z=Math.pow(2,32)-1,U=function(){function O(){}return O.init=function(){O.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var M;for(M in O.types)O.types.hasOwnProperty(M)&&(O.types[M]=[M.charCodeAt(0),M.charCodeAt(1),M.charCodeAt(2),M.charCodeAt(3)]);var R=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),C=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);O.HDLR_TYPES={video:R,audio:C};var m=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),v=new Uint8Array([0,0,0,0,0,0,0,0]);O.STTS=O.STSC=O.STCO=v,O.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),O.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),O.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),O.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var k=new Uint8Array([105,115,111,109]),S=new Uint8Array([97,118,99,49]),b=new Uint8Array([0,0,0,1]);O.FTYP=O.box(O.types.ftyp,k,b,k,S),O.DINF=O.box(O.types.dinf,O.box(O.types.dref,m))},O.box=function(M){for(var R=8,C=arguments.length,m=new Array(C>1?C-1:0),v=1;v<C;v++)m[v-1]=arguments[v];for(var k=m.length,S=k;k--;)R+=m[k].byteLength;var b=new Uint8Array(R);for(b[0]=R>>24&255,b[1]=R>>16&255,b[2]=R>>8&255,b[3]=R&255,b.set(M,4),k=0,R=8;k<S;k++)b.set(m[k],R),R+=m[k].byteLength;return b},O.hdlr=function(M){return O.box(O.types.hdlr,O.HDLR_TYPES[M])},O.mdat=function(M){return O.box(O.types.mdat,M)},O.mdhd=function(M,R){R*=M;var C=Math.floor(R/(z+1)),m=Math.floor(R%(z+1));return O.box(O.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,M>>24&255,M>>16&255,M>>8&255,M&255,C>>24,C>>16&255,C>>8&255,C&255,m>>24,m>>16&255,m>>8&255,m&255,85,196,0,0]))},O.mdia=function(M){return O.box(O.types.mdia,O.mdhd(M.timescale,M.duration),O.hdlr(M.type),O.minf(M))},O.mfhd=function(M){return O.box(O.types.mfhd,new Uint8Array([0,0,0,0,M>>24,M>>16&255,M>>8&255,M&255]))},O.minf=function(M){return M.type==="audio"?O.box(O.types.minf,O.box(O.types.smhd,O.SMHD),O.DINF,O.stbl(M)):O.box(O.types.minf,O.box(O.types.vmhd,O.VMHD),O.DINF,O.stbl(M))},O.moof=function(M,R,C){return O.box(O.types.moof,O.mfhd(M),O.traf(C,R))},O.moov=function(M){for(var R=M.length,C=[];R--;)C[R]=O.trak(M[R]);return O.box.apply(null,[O.types.moov,O.mvhd(M[0].timescale,M[0].duration)].concat(C).concat(O.mvex(M)))},O.mvex=function(M){for(var R=M.length,C=[];R--;)C[R]=O.trex(M[R]);return O.box.apply(null,[O.types.mvex].concat(C))},O.mvhd=function(M,R){R*=M;var C=Math.floor(R/(z+1)),m=Math.floor(R%(z+1)),v=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,M>>24&255,M>>16&255,M>>8&255,M&255,C>>24,C>>16&255,C>>8&255,C&255,m>>24,m>>16&255,m>>8&255,m&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return O.box(O.types.mvhd,v)},O.sdtp=function(M){var R=M.samples||[],C=new Uint8Array(4+R.length),m,v;for(m=0;m<R.length;m++)v=R[m].flags,C[m+4]=v.dependsOn<<4|v.isDependedOn<<2|v.hasRedundancy;return O.box(O.types.sdtp,C)},O.stbl=function(M){return O.box(O.types.stbl,O.stsd(M),O.box(O.types.stts,O.STTS),O.box(O.types.stsc,O.STSC),O.box(O.types.stsz,O.STSZ),O.box(O.types.stco,O.STCO))},O.avc1=function(M){var R=[],C=[],m,v,k;for(m=0;m<M.sps.length;m++)v=M.sps[m],k=v.byteLength,R.push(k>>>8&255),R.push(k&255),R=R.concat(Array.prototype.slice.call(v));for(m=0;m<M.pps.length;m++)v=M.pps[m],k=v.byteLength,C.push(k>>>8&255),C.push(k&255),C=C.concat(Array.prototype.slice.call(v));var S=O.box(O.types.avcC,new Uint8Array([1,R[3],R[4],R[5],252|3,224|M.sps.length].concat(R).concat([M.pps.length]).concat(C))),b=M.width,f=M.height,u=M.pixelRatio[0],a=M.pixelRatio[1];return O.box(O.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b>>8&255,b&255,f>>8&255,f&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]),S,O.box(O.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),O.box(O.types.pasp,new Uint8Array([u>>24,u>>16&255,u>>8&255,u&255,a>>24,a>>16&255,a>>8&255,a&255])))},O.esds=function(M){var R=M.config.length;return new Uint8Array([0,0,0,0,3,23+R,0,1,0,4,15+R,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([R]).concat(M.config).concat([6,1,2]))},O.mp4a=function(M){var R=M.samplerate;return O.box(O.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,M.channelCount,0,16,0,0,0,0,R>>8&255,R&255,0,0]),O.box(O.types.esds,O.esds(M)))},O.mp3=function(M){var R=M.samplerate;return O.box(O.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,M.channelCount,0,16,0,0,0,0,R>>8&255,R&255,0,0]))},O.stsd=function(M){return M.type==="audio"?!M.isAAC&&M.codec==="mp3"?O.box(O.types.stsd,O.STSD,O.mp3(M)):O.box(O.types.stsd,O.STSD,O.mp4a(M)):O.box(O.types.stsd,O.STSD,O.avc1(M))},O.tkhd=function(M){var R=M.id,C=M.duration*M.timescale,m=M.width,v=M.height,k=Math.floor(C/(z+1)),S=Math.floor(C%(z+1));return O.box(O.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,R>>24&255,R>>16&255,R>>8&255,R&255,0,0,0,0,k>>24,k>>16&255,k>>8&255,k&255,S>>24,S>>16&255,S>>8&255,S&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,m>>8&255,m&255,0,0,v>>8&255,v&255,0,0]))},O.traf=function(M,R){var C=O.sdtp(M),m=M.id,v=Math.floor(R/(z+1)),k=Math.floor(R%(z+1));return O.box(O.types.traf,O.box(O.types.tfhd,new Uint8Array([0,0,0,0,m>>24,m>>16&255,m>>8&255,m&255])),O.box(O.types.tfdt,new Uint8Array([1,0,0,0,v>>24,v>>16&255,v>>8&255,v&255,k>>24,k>>16&255,k>>8&255,k&255])),O.trun(M,C.length+16+20+8+16+8+8),C)},O.trak=function(M){return M.duration=M.duration||4294967295,O.box(O.types.trak,O.tkhd(M),O.mdia(M))},O.trex=function(M){var R=M.id;return O.box(O.types.trex,new Uint8Array([0,0,0,0,R>>24,R>>16&255,R>>8&255,R&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},O.trun=function(M,R){var C=M.samples||[],m=C.length,v=12+16*m,k=new Uint8Array(v),S,b,f,u,a,s;for(R+=8+v,k.set([0,0,15,1,m>>>24&255,m>>>16&255,m>>>8&255,m&255,R>>>24&255,R>>>16&255,R>>>8&255,R&255],0),S=0;S<m;S++)b=C[S],f=b.duration,u=b.size,a=b.flags,s=b.cts,k.set([f>>>24&255,f>>>16&255,f>>>8&255,f&255,u>>>24&255,u>>>16&255,u>>>8&255,u&255,a.isLeading<<2|a.dependsOn,a.isDependedOn<<6|a.hasRedundancy<<4|a.paddingValue<<1|a.isNonSync,a.degradPrio&240<<8,a.degradPrio&15,s>>>24&255,s>>>16&255,s>>>8&255,s&255],12+16*S);return O.box(O.types.trun,k)},O.initSegment=function(M){O.types||O.init();var R=O.moov(M),C=new Uint8Array(O.FTYP.byteLength+R.byteLength);return C.set(O.FTYP),C.set(R,O.FTYP.byteLength),C},O}();U.types=void 0,U.HDLR_TYPES=void 0,U.STTS=void 0,U.STSC=void 0,U.STCO=void 0,U.STSZ=void 0,U.VMHD=void 0,U.SMHD=void 0,U.STSD=void 0,U.FTYP=void 0,U.DINF=void 0,G.default=U},"./src/remux/mp4-remuxer.ts":function(q,G,D){"use strict";D.r(G),D.d(G,"default",function(){return s}),D.d(G,"normalizePts",function(){return l});var z=D("./src/polyfills/number.ts"),U=D("./src/remux/aac-helper.ts"),O=D("./src/remux/mp4-generator.ts"),F=D("./src/events.ts"),M=D("./src/errors.ts"),R=D("./src/utils/logger.ts"),C=D("./src/types/loader.ts"),m=D("./src/utils/timescale-conversion.ts");function v(){return v=Object.assign||function(L){for(var x=1;x<arguments.length;x++){var h=arguments[x];for(var p in h)Object.prototype.hasOwnProperty.call(h,p)&&(L[p]=h[p])}return L},v.apply(this,arguments)}var k=10*1e3,S=1024,b=1152,f=null,u=null,a=!1,s=function(){function L(h,p,d,o){if(o===void 0&&(o=""),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=h,this.config=p,this.typeSupported=d,this.ISGenerated=!1,f===null){var T=navigator.userAgent||"",E=T.match(/Chrome\/(\d+)/i);f=E?parseInt(E[1]):0}if(u===null){var g=navigator.userAgent.match(/Safari\/(\d+)/i);u=g?parseInt(g[1]):0}a=!!f&&f<75||!!u&&u<600}var x=L.prototype;return x.destroy=function(){},x.resetTimeStamp=function(p){R.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=p},x.resetNextTimestamp=function(){R.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},x.resetInitSegment=function(){R.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},x.getVideoStartPts=function(p){var d=!1,o=p.reduce(function(T,E){var g=E.pts-T;return g<-4294967296?(d=!0,l(T,E.pts)):g>0?T:E.pts},p[0].pts);return d&&R.logger.debug("PTS rollover detected"),o},x.remux=function(p,d,o,T,E,g,_,N){var B,W,P,I,H,Y,ee=E,oe=E,Ee=p.pid>-1,pe=d.pid>-1,me=d.samples.length,he=p.samples.length>0,se=me>1,ne=(!Ee||he)&&(!pe||se)||this.ISGenerated||_;if(ne){this.ISGenerated||(P=this.generateIS(p,d,E));var ce=this.isVideoContiguous,$=-1;if(se&&($=A(d.samples),!ce&&this.config.forceKeyFrameOnDiscontinuity))if(Y=!0,$>0){R.logger.warn("[mp4-remuxer]: Dropped "+$+" out of "+me+" video samples due to a missing keyframe");var ie=this.getVideoStartPts(d.samples);d.samples=d.samples.slice($),d.dropped+=$,oe+=(d.samples[0].pts-ie)/(d.timescale||9e4)}else $===-1&&(R.logger.warn("[mp4-remuxer]: No keyframe found out of "+me+" video samples"),Y=!1);if(this.ISGenerated){if(he&&se){var Z=this.getVideoStartPts(d.samples),ye=l(p.samples[0].pts,Z)-Z,Ce=ye/d.inputTimeScale;ee+=Math.max(0,Ce),oe+=Math.max(0,-Ce)}if(he){if(p.samplerate||(R.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),P=this.generateIS(p,d,E)),W=this.remuxAudio(p,ee,this.isAudioContiguous,g,pe||se||N===C.PlaylistLevelType.AUDIO?oe:void 0),se){var ve=W?W.endPTS-W.startPTS:0;d.inputTimeScale||(R.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),P=this.generateIS(p,d,E)),B=this.remuxVideo(d,oe,ce,ve)}}else se&&(B=this.remuxVideo(d,oe,ce,0));B&&(B.firstKeyFrame=$,B.independent=$!==-1)}}return this.ISGenerated&&(o.samples.length&&(H=this.remuxID3(o,E)),T.samples.length&&(I=this.remuxText(T,E))),{audio:W,video:B,initSegment:P,independent:Y,text:I,id3:H}},x.generateIS=function(p,d,o){var T=p.samples,E=d.samples,g=this.typeSupported,_={},N=!Object(z.isFiniteNumber)(this._initPTS),B="audio/mp4",W,P,I;if(N&&(W=P=Infinity),p.config&&T.length&&(p.timescale=p.samplerate,p.isAAC||(g.mpeg?(B="audio/mpeg",p.codec=""):g.mp3&&(p.codec="mp3")),_.audio={id:"audio",container:B,codec:p.codec,initSegment:!p.isAAC&&g.mpeg?new Uint8Array(0):O.default.initSegment([p]),metadata:{channelCount:p.channelCount}},N&&(I=p.inputTimeScale,W=P=T[0].pts-Math.round(I*o))),d.sps&&d.pps&&E.length&&(d.timescale=d.inputTimeScale,_.video={id:"main",container:"video/mp4",codec:d.codec,initSegment:O.default.initSegment([d]),metadata:{width:d.width,height:d.height}},N)){I=d.inputTimeScale;var H=this.getVideoStartPts(E),Y=Math.round(I*o);P=Math.min(P,l(E[0].dts,H)-Y),W=Math.min(W,H-Y)}if(Object.keys(_).length)return this.ISGenerated=!0,N&&(this._initPTS=W,this._initDTS=P),{tracks:_,initPTS:W,timescale:I}},x.remuxVideo=function(p,d,o,T){var E=p.inputTimeScale,g=p.samples,_=[],N=g.length,B=this._initPTS,W=this.nextAvcDts,P=8,I,H,Y,ee=Number.POSITIVE_INFINITY,oe=Number.NEGATIVE_INFINITY,Ee=0,pe=!1;if(!o||W===null){var me=d*E,he=g[0].pts-l(g[0].dts,g[0].pts);W=me-he}for(var se=0;se<N;se++){var ne=g[se];if(ne.pts=l(ne.pts-B,W),ne.dts=l(ne.dts-B,W),ne.dts>ne.pts){var ce=9e4*.2;Ee=Math.max(Math.min(Ee,ne.pts-ne.dts),-1*ce)}ne.dts<g[se>0?se-1:se].dts&&(pe=!0)}pe&&g.sort(function(ft,ot){var rt=ft.dts-ot.dts,Et=ft.pts-ot.pts;return rt||Et}),H=g[0].dts,Y=g[g.length-1].dts;var $=Math.round((Y-H)/(N-1));if(Ee<0){if(Ee<$*-2){R.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(m.toMsFromMpegTsClock)(-$,!0)+" ms");for(var ie=Ee,Z=0;Z<N;Z++)g[Z].dts=ie=Math.max(ie,g[Z].pts-$),g[Z].pts=Math.max(ie,g[Z].pts)}else{R.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(m.toMsFromMpegTsClock)(Ee,!0)+" ms to overcome this issue");for(var ye=0;ye<N;ye++)g[ye].dts=g[ye].dts+Ee}H=g[0].dts}if(o){var Ce=H-W,ve=Ce>$,we=Ce<-1;if(ve||we){ve?R.logger.warn("AVC: "+Object(m.toMsFromMpegTsClock)(Ce,!0)+" ms ("+Ce+"dts) hole between fragments detected, filling it"):R.logger.warn("AVC: "+Object(m.toMsFromMpegTsClock)(-Ce,!0)+" ms ("+Ce+"dts) overlapping between fragments detected"),H=W;var Ae=g[0].pts-Ce;g[0].dts=H,g[0].pts=Ae,R.logger.log("Video: First PTS/DTS adjusted: "+Object(m.toMsFromMpegTsClock)(Ae,!0)+"/"+Object(m.toMsFromMpegTsClock)(H,!0)+", delta: "+Object(m.toMsFromMpegTsClock)(Ce,!0)+" ms")}}a&&(H=Math.max(0,H));for(var Re=0,Ie=0,Me=0;Me<N;Me++){for(var De=g[Me],Ve=De.units,et=Ve.length,ze=0,Xe=0;Xe<et;Xe++)ze+=Ve[Xe].data.length;Ie+=ze,Re+=et,De.length=ze,De.dts=Math.max(De.dts,H),De.pts=Math.max(De.pts,De.dts,0),ee=Math.min(De.pts,ee),oe=Math.max(De.pts,oe)}Y=g[N-1].dts;var qe=Ie+4*Re+8,He;try{He=new Uint8Array(qe)}catch(ft){this.observer.emit(F.Events.ERROR,F.Events.ERROR,{type:M.ErrorTypes.MUX_ERROR,details:M.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:qe,reason:"fail allocating video mdat "+qe});return}var Be=new DataView(He.buffer);Be.setUint32(0,qe),He.set(O.default.types.mdat,4);for(var Se=0;Se<N;Se++){for(var Ze=g[Se],Je=Ze.units,Le=0,Ue=0,ge=Je.length;Ue<ge;Ue++){var de=Je[Ue],fe=de.data,Q=de.data.byteLength;Be.setUint32(P,Q),P+=4,He.set(fe,P),P+=Q,Le+=4+Q}if(Se<N-1)I=g[Se+1].dts-Ze.dts;else{var J=this.config,re=Ze.dts-g[Se>0?Se-1:Se].dts;if(J.stretchShortVideoTrack&&this.nextAudioPts!==null){var le=Math.floor(J.maxBufferHole*E),Te=(T?ee+T*E:this.nextAudioPts)-Ze.pts;Te>le?(I=Te-re,I<0&&(I=re),R.logger.log("[mp4-remuxer]: It is approximately "+Te/90+" ms to the next segment; using duration "+I/90+" ms for the last video frame.")):I=re}else I=re}var _e=Math.round(Ze.pts-Ze.dts);_.push(new y(Ze.key,I,Le,_e))}if(_.length&&f&&f<70){var ke=_[0].flags;ke.dependsOn=2,ke.isNonSync=0}console.assert(I!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=W=Y+I,this.isVideoContiguous=!0;var je=O.default.moof(p.sequenceNumber++,H,v({},p,{samples:_})),it="video",Oe={data1:je,data2:He,startPTS:ee/E,endPTS:(oe+I)/E,startDTS:H/E,endDTS:W/E,type:it,hasAudio:!1,hasVideo:!0,nb:_.length,dropped:p.dropped};return p.samples=[],p.dropped=0,console.assert(He.length,"MDAT length must not be zero"),Oe},x.remuxAudio=function(p,d,o,T,E){var g=p.inputTimeScale,_=p.samplerate?p.samplerate:g,N=g/_,B=p.isAAC?S:b,W=B*N,P=this._initPTS,I=!p.isAAC&&this.typeSupported.mpeg,H=[],Y=p.samples,ee=I?0:8,oe=this.nextAudioPts||-1,Ee=d*g;if(this.isAudioContiguous=o=o||Y.length&&oe>0&&(T&&Math.abs(Ee-oe)<9e3||Math.abs(l(Y[0].pts-P,Ee)-oe)<20*W),Y.forEach(function(fe){fe.pts=l(fe.pts-P,Ee)}),!o||oe<0){if(Y=Y.filter(function(fe){return fe.pts>=0}),!Y.length)return;E===0?oe=0:T?oe=Math.max(0,Ee):oe=Y[0].pts}if(p.isAAC)for(var pe=E!==void 0,me=this.config.maxAudioFramesDrift,he=0,se=oe;he<Y.length;he++){var ne=Y[he],ce=ne.pts,$=ce-se,ie=Math.abs(1e3*$/g);if($<=-me*W&&pe)he===0&&(R.logger.warn("Audio frame @ "+(ce/g).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*$/g)+" ms."),this.nextAudioPts=oe=se=ce);else if($>=me*W&&ie<k&&pe){var Z=Math.round($/W);se=ce-Z*W,se<0&&(Z--,se+=W),he===0&&(this.nextAudioPts=oe=se),R.logger.warn("[mp4-remuxer]: Injecting "+Z+" audio frame @ "+(se/g).toFixed(3)+"s due to "+Math.round(1e3*$/g)+" ms gap.");for(var ye=0;ye<Z;ye++){var Ce=Math.max(se,0),ve=U.default.getSilentFrame(p.manifestCodec||p.codec,p.channelCount);ve||(R.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),ve=ne.unit.subarray()),Y.splice(he,0,{unit:ve,pts:Ce}),se+=W,he++}}ne.pts=se,se+=W}for(var we=null,Ae=null,Re,Ie=0,Me=Y.length;Me--;)Ie+=Y[Me].unit.byteLength;for(var De=0,Ve=Y.length;De<Ve;De++){var et=Y[De],ze=et.unit,Xe=et.pts;if(Ae!==null){var qe=H[De-1];qe.duration=Math.round((Xe-Ae)/N)}else if(o&&p.isAAC&&(Xe=oe),we=Xe,Ie>0){Ie+=ee;try{Re=new Uint8Array(Ie)}catch(fe){this.observer.emit(F.Events.ERROR,F.Events.ERROR,{type:M.ErrorTypes.MUX_ERROR,details:M.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Ie,reason:"fail allocating audio mdat "+Ie});return}if(!I){var He=new DataView(Re.buffer);He.setUint32(0,Ie),Re.set(O.default.types.mdat,4)}}else return;Re.set(ze,ee);var Be=ze.byteLength;ee+=Be,H.push(new y(!0,B,Be,0)),Ae=Xe}var Se=H.length;if(!Se)return;var Ze=H[H.length-1];this.nextAudioPts=oe=Ae+N*Ze.duration;var Je=I?new Uint8Array(0):O.default.moof(p.sequenceNumber++,we/N,v({},p,{samples:H}));p.samples=[];var Le=we/g,Ue=oe/g,ge="audio",de={data1:Je,data2:Re,startPTS:Le,endPTS:Ue,startDTS:Le,endDTS:Ue,type:ge,hasAudio:!0,hasVideo:!1,nb:Se};return this.isAudioContiguous=!0,console.assert(Re.length,"MDAT length must not be zero"),de},x.remuxEmptyAudio=function(p,d,o,T){var E=p.inputTimeScale,g=p.samplerate?p.samplerate:E,_=E/g,N=this.nextAudioPts,B=(N!==null?N:T.startDTS*E)+this._initDTS,W=T.endDTS*E+this._initDTS,P=_*S,I=Math.ceil((W-B)/P),H=U.default.getSilentFrame(p.manifestCodec||p.codec,p.channelCount);if(R.logger.warn("[mp4-remuxer]: remux empty Audio"),!H){R.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var Y=[],ee=0;ee<I;ee++){var oe=B+ee*P;Y.push({unit:H,pts:oe,dts:oe})}return p.samples=Y,this.remuxAudio(p,d,o,!1)},x.remuxID3=function(p,d){var o=p.samples.length;if(!o)return;for(var T=p.inputTimeScale,E=this._initPTS,g=this._initDTS,_=0;_<o;_++){var N=p.samples[_];N.pts=l(N.pts-E,d*T)/T,N.dts=l(N.dts-g,d*T)/T}var B=p.samples;return p.samples=[],{samples:B}},x.remuxText=function(p,d){var o=p.samples.length;if(!o)return;for(var T=p.inputTimeScale,E=this._initPTS,g=0;g<o;g++){var _=p.samples[g];_.pts=l(_.pts-E,d*T)/T}p.samples.sort(function(B,W){return B.pts-W.pts});var N=p.samples;return p.samples=[],{samples:N}},L}();function l(L,x){var h;if(x===null)return L;for(x<L?h=-8589934592:h=8589934592;Math.abs(L-x)>4294967296;)L+=h;return L}function A(L){for(var x=0;x<L.length;x++)if(L[x].key)return x;return-1}var y=function(x,h,p,d){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=h,this.size=p,this.cts=d,this.flags=new c(x)},c=function(x){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=x?2:1,this.isNonSync=x?0:1}},"./src/remux/passthrough-remuxer.ts":function(q,G,D){"use strict";D.r(G);var z=D("./src/polyfills/number.ts"),U=D("./src/utils/mp4-tools.ts"),O=D("./src/loader/fragment.ts"),F=D("./src/utils/logger.ts"),M=function(){function m(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=void 0,this.initTracks=void 0,this.lastEndDTS=null}var v=m.prototype;return v.destroy=function(){},v.resetTimeStamp=function(S){this.initPTS=S,this.lastEndDTS=null},v.resetNextTimestamp=function(){this.lastEndDTS=null},v.resetInitSegment=function(S,b,f){this.audioCodec=b,this.videoCodec=f,this.generateInitSegment(S),this.emitInitSegment=!0},v.generateInitSegment=function(S){var b=this.audioCodec,f=this.videoCodec;if(!S||!S.byteLength){this.initTracks=void 0,this.initData=void 0;return}var u=this.initData=Object(U.parseInitSegment)(S);b||(b=C(u.audio,O.ElementaryStreamTypes.AUDIO)),f||(f=C(u.video,O.ElementaryStreamTypes.VIDEO));var a={};u.audio&&u.video?a.audiovideo={container:"video/mp4",codec:b+","+f,initSegment:S,id:"main"}:u.audio?a.audio={container:"audio/mp4",codec:b,initSegment:S,id:"audio"}:u.video?a.video={container:"video/mp4",codec:f,initSegment:S,id:"main"}:F.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=a},v.remux=function(S,b,f,u,a){var s=this.initPTS,l=this.lastEndDTS,A={audio:void 0,video:void 0,text:u,id3:f,initSegment:void 0};Object(z.isFiniteNumber)(l)||(l=this.lastEndDTS=a||0);var y=b.samples;if(!y||!y.length)return A;var c={initPTS:void 0,timescale:1},L=this.initData;if((!L||!L.length)&&(this.generateInitSegment(y),L=this.initData),!L||!L.length)return F.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),A;this.emitInitSegment&&(c.tracks=this.initTracks,this.emitInitSegment=!1),Object(z.isFiniteNumber)(s)||(this.initPTS=c.initPTS=s=R(L,y,l));var x=Object(U.getDuration)(y,L),h=l,p=x+h;Object(U.offsetStartDTS)(L,y,s),x>0?this.lastEndDTS=p:(F.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var d=!!L.audio,o=!!L.video,T="";d&&(T+="audio"),o&&(T+="video");var E={data1:y,startPTS:h,startDTS:h,endPTS:p,endDTS:p,type:T,hasAudio:d,hasVideo:o,nb:1,dropped:0};return A.audio=E.type==="audio"?E:void 0,A.video=E.type!=="audio"?E:void 0,A.text=u,A.id3=f,A.initSegment=c,A},m}(),R=function(v,k,S){return Object(U.getStartDTS)(v,k)-S};function C(m,v){var k=m==null?void 0:m.codec;return k&&k.length>4?k:k==="hvc1"?"hvc1.1.c.L120.90":k==="av01"?"av01.0.04M.08":k==="avc1"||v===O.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}G.default=M},"./src/task-loop.ts":function(q,G,D){"use strict";D.r(G),D.d(G,"default",function(){return z});var z=function(){function U(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var O=U.prototype;return O.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},O.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},O.onHandlerDestroyed=function(){},O.hasInterval=function(){return!!this._tickInterval},O.hasNextTick=function(){return!!this._tickTimer},O.setInterval=function(M){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,M),!0)},O.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},O.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},O.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},O.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},O.doTick=function(){},U}()},"./src/types/cmcd.ts":function(q,G,D){"use strict";D.r(G),D.d(G,"CMCDVersion",function(){return z}),D.d(G,"CMCDObjectType",function(){return U}),D.d(G,"CMCDStreamingFormat",function(){return O}),D.d(G,"CMCDStreamType",function(){return F});var z=1,U;(function(M){M.MANIFEST="m",M.AUDIO="a",M.VIDEO="v",M.MUXED="av",M.INIT="i",M.CAPTION="c",M.TIMED_TEXT="tt",M.KEY="k",M.OTHER="o"})(U||(U={}));var O;(function(M){M.DASH="d",M.HLS="h",M.SMOOTH="s",M.OTHER="o"})(O||(O={}));var F;(function(M){M.VOD="v",M.LIVE="l"})(F||(F={}))},"./src/types/level.ts":function(q,G,D){"use strict";D.r(G),D.d(G,"HlsSkip",function(){return O}),D.d(G,"getSkipValue",function(){return F}),D.d(G,"HlsUrlParameters",function(){return M}),D.d(G,"Level",function(){return R});function z(C,m){for(var v=0;v<m.length;v++){var k=m[v];k.enumerable=k.enumerable||!1,k.configurable=!0,"value"in k&&(k.writable=!0),Object.defineProperty(C,k.key,k)}}function U(C,m,v){return m&&z(C.prototype,m),v&&z(C,v),C}var O;(function(C){C.No="",C.Yes="YES",C.v2="v2"})(O||(O={}));function F(C,m){var v=C.canSkipUntil,k=C.canSkipDateRanges,S=C.endSN,b=m!==void 0?m-S:0;return v&&b<v?k?O.v2:O.Yes:O.No}var M=function(){function C(v,k,S){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=v,this.part=k,this.skip=S}var m=C.prototype;return m.addDirectives=function(k){var S=new self.URL(k);return this.msn!==void 0&&S.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&S.searchParams.set("_HLS_part",this.part.toString()),this.skip&&S.searchParams.set("_HLS_skip",this.skip),S.toString()},C}(),R=function(){function C(m){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=[m.url],this.attrs=m.attrs,this.bitrate=m.bitrate,m.details&&(this.details=m.details),this.id=m.id||0,this.name=m.name,this.width=m.width||0,this.height=m.height||0,this.audioCodec=m.audioCodec,this.videoCodec=m.videoCodec,this.unknownCodecs=m.unknownCodecs,this.codecSet=[m.videoCodec,m.audioCodec].filter(function(v){return v}).join(",").replace(/\.[^.,]+/g,"")}return U(C,[{key:"maxBitrate",get:function(){return Math.max(this.realBitrate,this.bitrate)}},{key:"uri",get:function(){return this.url[this._urlId]||""}},{key:"urlId",get:function(){return this._urlId},set:function(v){var k=v%this.url.length;this._urlId!==k&&(this.details=void 0,this._urlId=k)}}]),C}()},"./src/types/loader.ts":function(q,G,D){"use strict";D.r(G),D.d(G,"PlaylistContextType",function(){return z}),D.d(G,"PlaylistLevelType",function(){return U});var z;(function(O){O.MANIFEST="manifest",O.LEVEL="level",O.AUDIO_TRACK="audioTrack",O.SUBTITLE_TRACK="subtitleTrack"})(z||(z={}));var U;(function(O){O.MAIN="main",O.AUDIO="audio",O.SUBTITLE="subtitle"})(U||(U={}))},"./src/types/transmuxer.ts":function(q,G,D){"use strict";D.r(G),D.d(G,"ChunkMetadata",function(){return z});var z=function(F,M,R,C,m,v){C===void 0&&(C=0),m===void 0&&(m=-1),v===void 0&&(v=!1),this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=U(),this.buffering={audio:U(),video:U(),audiovideo:U()},this.level=F,this.sn=M,this.id=R,this.size=C,this.part=m,this.partial=v};function U(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(q,G,D){"use strict";D.r(G),D.d(G,"AttrList",function(){return O});var z=/^(\d+)x(\d+)$/,U=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,O=function(){function F(R){typeof R=="string"&&(R=F.parseAttrList(R));for(var C in R)R.hasOwnProperty(C)&&(this[C]=R[C])}var M=F.prototype;return M.decimalInteger=function(C){var m=parseInt(this[C],10);return m>Number.MAX_SAFE_INTEGER?Infinity:m},M.hexadecimalInteger=function(C){if(this[C]){var m=(this[C]||"0x").slice(2);m=(m.length&1?"0":"")+m;for(var v=new Uint8Array(m.length/2),k=0;k<m.length/2;k++)v[k]=parseInt(m.slice(k*2,k*2+2),16);return v}else return null},M.hexadecimalIntegerAsNumber=function(C){var m=parseInt(this[C],16);return m>Number.MAX_SAFE_INTEGER?Infinity:m},M.decimalFloatingPoint=function(C){return parseFloat(this[C])},M.optionalFloat=function(C,m){var v=this[C];return v?parseFloat(v):m},M.enumeratedString=function(C){return this[C]},M.bool=function(C){return this[C]==="YES"},M.decimalResolution=function(C){var m=z.exec(this[C]);return m===null?void 0:{width:parseInt(m[1],10),height:parseInt(m[2],10)}},F.parseAttrList=function(C){var m,v={},k='"';for(U.lastIndex=0;(m=U.exec(C))!==null;){var S=m[2];S.indexOf(k)===0&&S.lastIndexOf(k)===S.length-1&&(S=S.slice(1,-1)),v[m[1]]=S}return v},F}()},"./src/utils/binary-search.ts":function(q,G,D){"use strict";D.r(G);var z={search:function(O,F){for(var M=0,R=O.length-1,C=null,m=null;M<=R;){C=(M+R)/2|0,m=O[C];var v=F(m);if(v>0)M=C+1;else if(v<0)R=C-1;else return m}return null}};G.default=z},"./src/utils/buffer-helper.ts":function(q,G,D){"use strict";D.r(G),D.d(G,"BufferHelper",function(){return O});var z=D("./src/utils/logger.ts"),U={length:0,start:function(){return 0},end:function(){return 0}},O=function(){function F(){}return F.isBuffered=function(R,C){try{if(R){for(var m=F.getBuffered(R),v=0;v<m.length;v++)if(C>=m.start(v)&&C<=m.end(v))return!0}}catch(k){}return!1},F.bufferInfo=function(R,C,m){try{if(R){var v=F.getBuffered(R),k=[],S;for(S=0;S<v.length;S++)k.push({start:v.start(S),end:v.end(S)});return this.bufferedInfo(k,C,m)}}catch(b){}return{len:0,start:C,end:C,nextStart:void 0}},F.bufferedInfo=function(R,C,m){C=Math.max(0,C),R.sort(function(c,L){var x=c.start-L.start;return x||L.end-c.end});var v=[];if(m)for(var k=0;k<R.length;k++){var S=v.length;if(S){var b=v[S-1].end;R[k].start-b<m?R[k].end>b&&(v[S-1].end=R[k].end):v.push(R[k])}else v.push(R[k])}else v=R;for(var f=0,u,a=C,s=C,l=0;l<v.length;l++){var A=v[l].start,y=v[l].end;if(C+m>=A&&C<y)a=A,s=y,f=s-C;else if(C+m<A){u=A;break}}return{len:f,start:a||0,end:s||0,nextStart:u}},F.getBuffered=function(R){try{return R.buffered}catch(C){return z.logger.log("failed to get media.buffered",C),U}},F}()},"./src/utils/cea-608-parser.ts":function(q,G,D){"use strict";D.r(G),D.d(G,"Row",function(){return s}),D.d(G,"CaptionScreen",function(){return l});var z=D("./src/utils/logger.ts"),U={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},O=function(p){var d=p;return U.hasOwnProperty(p)&&(d=U[p]),String.fromCharCode(d)},F=15,M=100,R={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},C={17:2,18:4,21:6,22:8,23:10,19:13,20:15},m={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},v={25:2,26:4,29:6,30:8,31:10,27:13,28:15},k=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],S;(function(h){h[h.ERROR=0]="ERROR",h[h.TEXT=1]="TEXT",h[h.WARNING=2]="WARNING",h[h.INFO=2]="INFO",h[h.DEBUG=3]="DEBUG",h[h.DATA=3]="DATA"})(S||(S={}));var b=function(){function h(){this.time=null,this.verboseLevel=S.ERROR}var p=h.prototype;return p.log=function(o,T){this.verboseLevel>=o&&z.logger.log(this.time+" ["+o+"] "+T)},h}(),f=function(p){for(var d=[],o=0;o<p.length;o++)d.push(p[o].toString(16));return d},u=function(){function h(d,o,T,E,g){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=d||"white",this.underline=o||!1,this.italics=T||!1,this.background=E||"black",this.flash=g||!1}var p=h.prototype;return p.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},p.setStyles=function(o){for(var T=["foreground","underline","italics","background","flash"],E=0;E<T.length;E++){var g=T[E];o.hasOwnProperty(g)&&(this[g]=o[g])}},p.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},p.equals=function(o){return this.foreground===o.foreground&&this.underline===o.underline&&this.italics===o.italics&&this.background===o.background&&this.flash===o.flash},p.copy=function(o){this.foreground=o.foreground,this.underline=o.underline,this.italics=o.italics,this.background=o.background,this.flash=o.flash},p.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},h}(),a=function(){function h(d,o,T,E,g,_){this.uchar=void 0,this.penState=void 0,this.uchar=d||" ",this.penState=new u(o,T,E,g,_)}var p=h.prototype;return p.reset=function(){this.uchar=" ",this.penState.reset()},p.setChar=function(o,T){this.uchar=o,this.penState.copy(T)},p.setPenState=function(o){this.penState.copy(o)},p.equals=function(o){return this.uchar===o.uchar&&this.penState.equals(o.penState)},p.copy=function(o){this.uchar=o.uchar,this.penState.copy(o.penState)},p.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},h}(),s=function(){function h(d){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var o=0;o<M;o++)this.chars.push(new a);this.logger=d,this.pos=0,this.currPenState=new u}var p=h.prototype;return p.equals=function(o){for(var T=!0,E=0;E<M;E++)if(!this.chars[E].equals(o.chars[E])){T=!1;break}return T},p.copy=function(o){for(var T=0;T<M;T++)this.chars[T].copy(o.chars[T])},p.isEmpty=function(){for(var o=!0,T=0;T<M;T++)if(!this.chars[T].isEmpty()){o=!1;break}return o},p.setCursor=function(o){this.pos!==o&&(this.pos=o),this.pos<0?(this.logger.log(S.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>M&&(this.logger.log(S.DEBUG,"Too large cursor position "+this.pos),this.pos=M)},p.moveCursor=function(o){var T=this.pos+o;if(o>1)for(var E=this.pos+1;E<T+1;E++)this.chars[E].setPenState(this.currPenState);this.setCursor(T)},p.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},p.insertChar=function(o){o>=144&&this.backSpace();var T=O(o);if(this.pos>=M){this.logger.log(S.ERROR,"Cannot insert "+o.toString(16)+" ("+T+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(T,this.currPenState),this.moveCursor(1)},p.clearFromPos=function(o){var T;for(T=o;T<M;T++)this.chars[T].reset()},p.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},p.clearToEndOfRow=function(){this.clearFromPos(this.pos)},p.getTextString=function(){for(var o=[],T=!0,E=0;E<M;E++){var g=this.chars[E].uchar;g!==" "&&(T=!1),o.push(g)}return T?"":o.join("")},p.setPenStyles=function(o){this.currPenState.setStyles(o);var T=this.chars[this.pos];T.setPenState(this.currPenState)},h}(),l=function(){function h(d){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var o=0;o<F;o++)this.rows.push(new s(d));this.logger=d,this.currRow=F-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var p=h.prototype;return p.reset=function(){for(var o=0;o<F;o++)this.rows[o].clear();this.currRow=F-1},p.equals=function(o){for(var T=!0,E=0;E<F;E++)if(!this.rows[E].equals(o.rows[E])){T=!1;break}return T},p.copy=function(o){for(var T=0;T<F;T++)this.rows[T].copy(o.rows[T])},p.isEmpty=function(){for(var o=!0,T=0;T<F;T++)if(!this.rows[T].isEmpty()){o=!1;break}return o},p.backSpace=function(){var o=this.rows[this.currRow];o.backSpace()},p.clearToEndOfRow=function(){var o=this.rows[this.currRow];o.clearToEndOfRow()},p.insertChar=function(o){var T=this.rows[this.currRow];T.insertChar(o)},p.setPen=function(o){var T=this.rows[this.currRow];T.setPenStyles(o)},p.moveCursor=function(o){var T=this.rows[this.currRow];T.moveCursor(o)},p.setCursor=function(o){this.logger.log(S.INFO,"setCursor: "+o);var T=this.rows[this.currRow];T.setCursor(o)},p.setPAC=function(o){this.logger.log(S.INFO,"pacData = "+JSON.stringify(o));var T=o.row-1;if(this.nrRollUpRows&&T<this.nrRollUpRows-1&&(T=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==T){for(var E=0;E<F;E++)this.rows[E].clear();var g=this.currRow+1-this.nrRollUpRows,_=this.lastOutputScreen;if(_){var N=_.rows[g].cueStartTime,B=this.logger.time;if(N&&B!==null&&N<B)for(var W=0;W<this.nrRollUpRows;W++)this.rows[T-this.nrRollUpRows+W+1].copy(_.rows[g+W])}}this.currRow=T;var P=this.rows[this.currRow];if(o.indent!==null){var I=o.indent,H=Math.max(I-1,0);P.setCursor(o.indent),o.color=P.chars[H].penState.foreground}var Y={foreground:o.color,underline:o.underline,italics:o.italics,background:"black",flash:!1};this.setPen(Y)},p.setBkgData=function(o){this.logger.log(S.INFO,"bkgData = "+JSON.stringify(o)),this.backSpace(),this.setPen(o),this.insertChar(32)},p.setRollUpRows=function(o){this.nrRollUpRows=o},p.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(S.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(S.TEXT,this.getDisplayText());var o=this.currRow+1-this.nrRollUpRows,T=this.rows.splice(o,1)[0];T.clear(),this.rows.splice(this.currRow,0,T),this.logger.log(S.INFO,"Rolling up")},p.getDisplayText=function(o){o=o||!1;for(var T=[],E="",g=-1,_=0;_<F;_++){var N=this.rows[_].getTextString();N&&(g=_+1,o?T.push("Row "+g+": '"+N+"'"):T.push(N.trim()))}return T.length>0&&(o?E="["+T.join(" | ")+"]":E=T.join(`
|
|
`)),E},p.getTextAndFormat=function(){return this.rows},h}(),A=function(){function h(d,o,T){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=d,this.outputFilter=o,this.mode=null,this.verbose=0,this.displayedMemory=new l(T),this.nonDisplayedMemory=new l(T),this.lastOutputScreen=new l(T),this.currRollUpRow=this.displayedMemory.rows[F-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=T}var p=h.prototype;return p.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[F-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},p.getHandler=function(){return this.outputFilter},p.setHandler=function(o){this.outputFilter=o},p.setPAC=function(o){this.writeScreen.setPAC(o)},p.setBkgData=function(o){this.writeScreen.setBkgData(o)},p.setMode=function(o){if(o===this.mode)return;this.mode=o,this.logger.log(S.INFO,"MODE="+o),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=o},p.insertChars=function(o){for(var T=0;T<o.length;T++)this.writeScreen.insertChar(o[T]);var E=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(S.INFO,E+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(S.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},p.ccRCL=function(){this.logger.log(S.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},p.ccBS=function(){if(this.logger.log(S.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},p.ccAOF=function(){},p.ccAON=function(){},p.ccDER=function(){this.logger.log(S.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},p.ccRU=function(o){this.logger.log(S.INFO,"RU("+o+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(o)},p.ccFON=function(){this.logger.log(S.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},p.ccRDC=function(){this.logger.log(S.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},p.ccTR=function(){this.logger.log(S.INFO,"TR"),this.setMode("MODE_TEXT")},p.ccRTD=function(){this.logger.log(S.INFO,"RTD"),this.setMode("MODE_TEXT")},p.ccEDM=function(){this.logger.log(S.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},p.ccCR=function(){this.logger.log(S.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},p.ccENM=function(){this.logger.log(S.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},p.ccEOC=function(){if(this.logger.log(S.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var o=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=o,this.writeScreen=this.nonDisplayedMemory,this.logger.log(S.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},p.ccTO=function(o){this.logger.log(S.INFO,"TO("+o+") - Tab Offset"),this.writeScreen.moveCursor(o)},p.ccMIDROW=function(o){var T={flash:!1};if(T.underline=o%2===1,T.italics=o>=46,T.italics)T.foreground="white";else{var E=Math.floor(o/2)-16,g=["white","green","blue","cyan","red","yellow","magenta"];T.foreground=g[E]}this.logger.log(S.INFO,"MIDROW: "+JSON.stringify(T)),this.writeScreen.setPen(T)},p.outputDataUpdate=function(o){o===void 0&&(o=!1);var T=this.logger.time;if(T===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=T:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,T,this.lastOutputScreen),o&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:T),this.lastOutputScreen.copy(this.displayedMemory))},p.cueSplitAtTime=function(o){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,o,this.displayedMemory),this.cueStartTime=o))},h}(),y=function(){function h(d,o,T){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var E=new b;this.channels=[null,new A(d,o,E),new A(d+1,T,E)],this.cmdHistory=x(),this.logger=E}var p=h.prototype;return p.getHandler=function(o){return this.channels[o].getHandler()},p.setHandler=function(o,T){this.channels[o].setHandler(T)},p.addData=function(o,T){var E,g,_,N=!1;this.logger.time=o;for(var B=0;B<T.length;B+=2){if(g=T[B]&127,_=T[B+1]&127,g===0&&_===0)continue;if(this.logger.log(S.DATA,"["+f([T[B],T[B+1]])+"] -> ("+f([g,_])+")"),E=this.parseCmd(g,_),E||(E=this.parseMidrow(g,_)),E||(E=this.parsePAC(g,_)),E||(E=this.parseBackgroundAttributes(g,_)),!E&&(N=this.parseChars(g,_),N)){var W=this.currentChannel;if(W&&W>0){var P=this.channels[W];P.insertChars(N)}else this.logger.log(S.WARNING,"No channel found yet. TEXT-MODE?")}!E&&!N&&this.logger.log(S.WARNING,"Couldn't parse cleaned data "+f([g,_])+" orig: "+f([T[B],T[B+1]]))}},p.parseCmd=function(o,T){var E=this.cmdHistory,g=(o===20||o===28||o===21||o===29)&&T>=32&&T<=47,_=(o===23||o===31)&&T>=33&&T<=35;if(!(g||_))return!1;if(L(o,T,E))return c(null,null,E),this.logger.log(S.DEBUG,"Repeated command ("+f([o,T])+") is dropped"),!0;var N=o===20||o===21||o===23?1:2,B=this.channels[N];return o===20||o===21||o===28||o===29?T===32?B.ccRCL():T===33?B.ccBS():T===34?B.ccAOF():T===35?B.ccAON():T===36?B.ccDER():T===37?B.ccRU(2):T===38?B.ccRU(3):T===39?B.ccRU(4):T===40?B.ccFON():T===41?B.ccRDC():T===42?B.ccTR():T===43?B.ccRTD():T===44?B.ccEDM():T===45?B.ccCR():T===46?B.ccENM():T===47&&B.ccEOC():B.ccTO(T-32),c(o,T,E),this.currentChannel=N,!0},p.parseMidrow=function(o,T){var E=0;if((o===17||o===25)&&T>=32&&T<=47){if(o===17?E=1:E=2,E!==this.currentChannel)return this.logger.log(S.ERROR,"Mismatch channel in midrow parsing"),!1;var g=this.channels[E];return g?(g.ccMIDROW(T),this.logger.log(S.DEBUG,"MIDROW ("+f([o,T])+")"),!0):!1}return!1},p.parsePAC=function(o,T){var E,g=this.cmdHistory,_=(o>=17&&o<=23||o>=25&&o<=31)&&T>=64&&T<=127,N=(o===16||o===24)&&T>=64&&T<=95;if(!(_||N))return!1;if(L(o,T,g))return c(null,null,g),!0;var B=o<=23?1:2;T>=64&&T<=95?E=B===1?R[o]:m[o]:E=B===1?C[o]:v[o];var W=this.channels[B];return W?(W.setPAC(this.interpretPAC(E,T)),c(o,T,g),this.currentChannel=B,!0):!1},p.interpretPAC=function(o,T){var E,g={color:null,italics:!1,indent:null,underline:!1,row:o};return T>95?E=T-96:E=T-64,g.underline=(E&1)===1,E<=13?g.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(E/2)]:E<=15?(g.italics=!0,g.color="white"):g.indent=Math.floor((E-16)/2)*4,g},p.parseChars=function(o,T){var E,g=null,_=null;if(o>=25?(E=2,_=o-8):(E=1,_=o),_>=17&&_<=19){var N;_===17?N=T+80:_===18?N=T+112:N=T+144,this.logger.log(S.INFO,"Special char '"+O(N)+"' in channel "+E),g=[N]}else o>=32&&o<=127&&(g=T===0?[o]:[o,T]);if(g){var B=f(g);this.logger.log(S.DEBUG,"Char codes = "+B.join(",")),c(o,T,this.cmdHistory)}return g},p.parseBackgroundAttributes=function(o,T){var E=(o===16||o===24)&&T>=32&&T<=47,g=(o===23||o===31)&&T>=45&&T<=47;if(!(E||g))return!1;var _,N={};o===16||o===24?(_=Math.floor((T-32)/2),N.background=k[_],T%2===1&&(N.background=N.background+"_semi")):T===45?N.background="transparent":(N.foreground="black",T===47&&(N.underline=!0));var B=o<=23?1:2,W=this.channels[B];return W.setBkgData(N),c(o,T,this.cmdHistory),!0},p.reset=function(){for(var o=0;o<Object.keys(this.channels).length;o++){var T=this.channels[o];T&&T.reset()}this.cmdHistory=x()},p.cueSplitAtTime=function(o){for(var T=0;T<this.channels.length;T++){var E=this.channels[T];E&&E.cueSplitAtTime(o)}},h}();function c(h,p,d){d.a=h,d.b=p}function L(h,p,d){return d.a===h&&d.b===p}function x(){return{a:null,b:null}}G.default=y},"./src/utils/codecs.ts":function(q,G,D){"use strict";D.r(G),D.d(G,"isCodecType",function(){return U}),D.d(G,"isCodecSupportedInMp4",function(){return O});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 U(F,M){var R=z[M];return!!R&&R[F.slice(0,4)]===!0}function O(F,M){return MediaSource.isTypeSupported((M||"video")+'/mp4;codecs="'+F+'"')}},"./src/utils/cues.ts":function(q,G,D){"use strict";D.r(G);var z=D("./src/utils/vttparser.ts"),U=D("./src/utils/webvtt-parser.ts"),O=D("./src/utils/texttrack-utils.ts"),F=/\s/,M={newCue:function(C,m,v,k){for(var S=[],b,f,u,a,s,l=self.VTTCue||self.TextTrackCue,A=0;A<k.rows.length;A++)if(b=k.rows[A],u=!0,a=0,s="",!b.isEmpty()){for(var y=0;y<b.chars.length;y++)F.test(b.chars[y].uchar)&&u?a++:(s+=b.chars[y].uchar,u=!1);b.cueStartTime=m,m===v&&(v+=1e-4),a>=16?a--:a++;var c=Object(z.fixLineBreaks)(s.trim()),L=Object(U.generateCueId)(m,v,c);(!C||!C.cues||!C.cues.getCueById(L))&&(f=new l(m,v,c),f.id=L,f.line=A+1,f.align="left",f.position=10+Math.min(80,Math.floor(a*8/32)*10),S.push(f))}return C&&S.length&&(S.sort(function(x,h){return x.line==="auto"||h.line==="auto"?0:x.line>8&&h.line>8?h.line-x.line:x.line-h.line}),S.forEach(function(x){return Object(O.addCueToTrack)(C,x)})),S}};G.default=M},"./src/utils/discontinuities.ts":function(q,G,D){"use strict";D.r(G),D.d(G,"findFirstFragWithCC",function(){return F}),D.d(G,"shouldAlignOnDiscontinuities",function(){return M}),D.d(G,"findDiscontinuousReferenceFrag",function(){return R}),D.d(G,"adjustSlidingStart",function(){return m}),D.d(G,"alignStream",function(){return v}),D.d(G,"alignPDT",function(){return S}),D.d(G,"alignFragmentByPDTDelta",function(){return b}),D.d(G,"alignMediaPlaylistByPDT",function(){return f});var z=D("./src/polyfills/number.ts"),U=D("./src/utils/logger.ts"),O=D("./src/controller/level-helper.ts");function F(u,a){for(var s=null,l=0,A=u.length;l<A;l++){var y=u[l];if(y&&y.cc===a){s=y;break}}return s}function M(u,a,s){return!!(a.details&&(s.endCC>s.startCC||u&&u.cc<s.startCC))}function R(u,a){var s=u.fragments,l=a.fragments;if(!l.length||!s.length){U.logger.log("No fragments to align");return}var A=F(s,l[0].cc);if(!A||A&&!A.startPTS){U.logger.log("No frag in previous level to align on");return}return A}function C(u,a){if(u){var s=u.start+a;u.start=u.startPTS=s,u.endPTS=s+u.duration}}function m(u,a){for(var s=a.fragments,l=0,A=s.length;l<A;l++)C(s[l],u);a.fragmentHint&&C(a.fragmentHint,u),a.alignedSliding=!0}function v(u,a,s){if(!a)return;k(u,s,a),!s.alignedSliding&&a.details&&S(s,a.details),!s.alignedSliding&&a.details&&!s.skippedSegments&&Object(O.adjustSliding)(a.details,s)}function k(u,a,s){if(M(u,s,a)){var l=R(s.details,a);l&&Object(z.isFiniteNumber)(l.start)&&(U.logger.log("Adjusting PTS using last level due to CC increase within current level "+a.url),m(l.start,a))}}function S(u,a){if(!a.fragments.length||!u.hasProgramDateTime||!a.hasProgramDateTime)return;var s=a.fragments[0].programDateTime,l=u.fragments[0].programDateTime,A=(l-s)/1e3+a.fragments[0].start;A&&Object(z.isFiniteNumber)(A)&&(U.logger.log("Adjusting PTS using programDateTime delta "+(l-s)+"ms, sliding:"+A.toFixed(3)+" "+u.url+" "),m(A,u))}function b(u,a){var s=u.programDateTime;if(!s)return;var l=(s-a)/1e3;u.start=u.startPTS=l,u.endPTS=l+u.duration}function f(u,a){if(!a.fragments.length||!u.hasProgramDateTime||!a.hasProgramDateTime)return;var s=a.fragments[0].programDateTime,l=a.fragments[0].start,A=s-l*1e3;u.fragments.forEach(function(y){b(y,A)}),u.fragmentHint&&b(u.fragmentHint,A),u.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(q,G,D){"use strict";D.r(G);var z=D("./src/utils/ewma.ts"),U=function(){function O(M,R,C){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=C,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new z.default(M),this.fast_=new z.default(R)}var F=O.prototype;return F.update=function(R,C){var m=this.slow_,v=this.fast_;this.slow_.halfLife!==R&&(this.slow_=new z.default(R,m.getEstimate(),m.getTotalWeight())),this.fast_.halfLife!==C&&(this.fast_=new z.default(C,v.getEstimate(),v.getTotalWeight()))},F.sample=function(R,C){R=Math.max(R,this.minDelayMs_);var m=8*C,v=R/1e3,k=m/v;this.fast_.sample(v,k),this.slow_.sample(v,k)},F.canEstimate=function(){var R=this.fast_;return R&&R.getTotalWeight()>=this.minWeight_},F.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},F.destroy=function(){},O}();G.default=U},"./src/utils/ewma.ts":function(q,G,D){"use strict";D.r(G);var z=function(){function U(F,M,R){M===void 0&&(M=0),R===void 0&&(R=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=F,this.alpha_=F?Math.exp(Math.log(.5)/F):0,this.estimate_=M,this.totalWeight_=R}var O=U.prototype;return O.sample=function(M,R){var C=Math.pow(this.alpha_,M);this.estimate_=R*(1-C)+C*this.estimate_,this.totalWeight_+=M},O.getTotalWeight=function(){return this.totalWeight_},O.getEstimate=function(){if(this.alpha_){var M=1-Math.pow(this.alpha_,this.totalWeight_);if(M)return this.estimate_/M}return this.estimate_},U}();G.default=z},"./src/utils/fetch-loader.ts":function(q,G,D){"use strict";D.r(G),D.d(G,"fetchSupported",function(){return b});var z=D("./src/polyfills/number.ts"),U=D("./src/loader/load-stats.ts"),O=D("./src/demux/chunk-cache.ts");function F(l,A){l.prototype=Object.create(A.prototype),l.prototype.constructor=l,v(l,A)}function M(l){var A=typeof Map=="function"?new Map:void 0;return M=function(c){if(c===null||!m(c))return c;if(typeof c!="function")throw new TypeError("Super expression must either be null or a function");if(typeof A!="undefined"){if(A.has(c))return A.get(c);A.set(c,L)}function L(){return R(c,arguments,k(this).constructor)}return L.prototype=Object.create(c.prototype,{constructor:{value:L,enumerable:!1,writable:!0,configurable:!0}}),v(L,c)},M(l)}function R(l,A,y){return C()?R=Reflect.construct:R=function(L,x,h){var p=[null];p.push.apply(p,x);var d=Function.bind.apply(L,p),o=new d;return h&&v(o,h.prototype),o},R.apply(null,arguments)}function C(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(l){return!1}}function m(l){return Function.toString.call(l).indexOf("[native code]")!==-1}function v(l,A){return v=Object.setPrototypeOf||function(c,L){return c.__proto__=L,c},v(l,A)}function k(l){return k=Object.setPrototypeOf?Object.getPrototypeOf:function(y){return y.__proto__||Object.getPrototypeOf(y)},k(l)}function S(){return S=Object.assign||function(l){for(var A=1;A<arguments.length;A++){var y=arguments[A];for(var c in y)Object.prototype.hasOwnProperty.call(y,c)&&(l[c]=y[c])}return l},S.apply(this,arguments)}function b(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(l){}return!1}var f=function(){function l(y){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=y.fetchSetup||a,this.controller=new self.AbortController,this.stats=new U.LoadStats}var A=l.prototype;return A.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},A.abortInternal=function(){var c=this.response;(!c||!c.ok)&&(this.stats.aborted=!0,this.controller.abort())},A.abort=function(){var c;this.abortInternal(),(c=this.callbacks)!==null&&c!==void 0&&c.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},A.load=function(c,L,x){var h=this,p=this.stats;if(p.loading.start)throw new Error("Loader can only be used once.");p.loading.start=self.performance.now();var d=u(c,this.controller.signal),o=x.onProgress,T=c.responseType==="arraybuffer",E=T?"byteLength":"length";this.context=c,this.config=L,this.callbacks=x,this.request=this.fetchSetup(c,d),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){h.abortInternal(),x.onTimeout(p,c,h.response)},L.timeout),self.fetch(this.request).then(function(g){if(h.response=h.loader=g,!g.ok){var _=g.status,N=g.statusText;throw new s(N||"fetch, bad network response",_,g)}return p.loading.first=Math.max(self.performance.now(),p.loading.start),p.total=parseInt(g.headers.get("Content-Length")||"0"),o&&Object(z.isFiniteNumber)(L.highWaterMark)?h.loadProgressively(g,p,c,L.highWaterMark,o):T?g.arrayBuffer():g.text()}).then(function(g){var _=h.response;self.clearTimeout(h.requestTimeout),p.loading.end=Math.max(self.performance.now(),p.loading.first),p.loaded=p.total=g[E];var N={url:_.url,data:g};o&&!Object(z.isFiniteNumber)(L.highWaterMark)&&o(p,c,g,_),x.onSuccess(N,p,c,_)}).catch(function(g){if(self.clearTimeout(h.requestTimeout),p.aborted)return;var _=g.code||0;x.onError({code:_,text:g.message},c,g.details)})},A.getCacheAge=function(){var c=null;if(this.response){var L=this.response.headers.get("age");c=L?parseFloat(L):null}return c},A.loadProgressively=function(c,L,x,h,p){h===void 0&&(h=0);var d=new O.default,o=c.body.getReader(),T=function E(){return o.read().then(function(g){if(g.done)return d.dataLength&&p(L,x,d.flush(),c),Promise.resolve(new ArrayBuffer(0));var _=g.value,N=_.length;return L.loaded+=N,N<h||d.dataLength?(d.push(_),d.dataLength>=h&&p(L,x,d.flush(),c)):p(L,x,_,c),E()}).catch(function(){return Promise.reject()})};return T()},l}();function u(l,A){var y={method:"GET",mode:"cors",credentials:"same-origin",signal:A,headers:new self.Headers(S({},l.headers))};return l.rangeEnd&&y.headers.set("Range","bytes="+l.rangeStart+"-"+String(l.rangeEnd-1)),y}function a(l,A){return new self.Request(l.url,A)}var s=function(l){F(A,l);function A(y,c,L){var x;return x=l.call(this,y)||this,x.code=void 0,x.details=void 0,x.code=c,x.details=L,x}return A}(M(Error));G.default=f},"./src/utils/imsc1-ttml-parser.ts":function(q,G,D){"use strict";D.r(G),D.d(G,"IMSC1_CODEC",function(){return m}),D.d(G,"parseIMSC1",function(){return b});var z=D("./src/utils/mp4-tools.ts"),U=D("./src/utils/vttparser.ts"),O=D("./src/utils/vttcue.ts"),F=D("./src/demux/id3.ts"),M=D("./src/utils/timescale-conversion.ts"),R=D("./src/utils/webvtt-parser.ts");function C(){return C=Object.assign||function(h){for(var p=1;p<arguments.length;p++){var d=arguments[p];for(var o in d)Object.prototype.hasOwnProperty.call(d,o)&&(h[o]=d[o])}return h},C.apply(this,arguments)}var m="stpp.ttml.im1t",v=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,k=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,S={left:"start",center:"center",right:"end",start:"start",end:"end"};function b(h,p,d,o,T){var E=Object(z.findBox)(new Uint8Array(h),["mdat"]);if(E.length===0){T(new Error("Could not parse IMSC1 mdat"));return}var g=E[0],_=Object(F.utf8ArrayToStr)(new Uint8Array(h,g.start,g.end-g.start)),N=Object(M.toTimescaleFromScale)(p,1,d);try{o(f(_,N))}catch(B){T(B)}}function f(h,p){var d=new DOMParser,o=d.parseFromString(h,"text/xml"),T=o.getElementsByTagName("tt")[0];if(!T)throw new Error("Invalid ttml");var E={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},g=Object.keys(E).reduce(function(P,I){return P[I]=T.getAttribute("ttp:"+I)||E[I],P},{}),_=T.getAttribute("xml:space")!=="preserve",N=a(u(T,"styling","style")),B=a(u(T,"layout","region")),W=u(T,"body","[begin]");return[].map.call(W,function(P){var I=s(P,_);if(!I||!P.hasAttribute("begin"))return null;var H=c(P.getAttribute("begin"),g),Y=c(P.getAttribute("dur"),g),ee=c(P.getAttribute("end"),g);if(H===null)throw y(P);if(ee===null){if(Y===null)throw y(P);ee=H+Y}var oe=new O.default(H-p,ee-p,I);oe.id=Object(R.generateCueId)(oe.startTime,oe.endTime,oe.text);var Ee=B[P.getAttribute("region")],pe=N[P.getAttribute("style")];oe.position=10,oe.size=80;var me=l(Ee,pe),he=me.textAlign;if(he){var se=S[he];se&&(oe.lineAlign=se),oe.align=he}return C(oe,me),oe}).filter(function(P){return P!==null})}function u(h,p,d){var o=h.getElementsByTagName(p)[0];return o?[].slice.call(o.querySelectorAll(d)):[]}function a(h){return h.reduce(function(p,d){var o=d.getAttribute("xml:id");return o&&(p[o]=d),p},{})}function s(h,p){return[].slice.call(h.childNodes).reduce(function(d,o,T){var E;return o.nodeName==="br"&&T?d+`
|
|
`:(E=o.childNodes)!==null&&E!==void 0&&E.length?s(o,p):p?d+o.textContent.trim().replace(/\s+/g," "):d+o.textContent},"")}function l(h,p){var d="http://www.w3.org/ns/ttml#styling",o=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return o.reduce(function(T,E){var g=A(p,d,E)||A(h,d,E);return g&&(T[E]=g),T},{})}function A(h,p,d){return h.hasAttributeNS(p,d)?h.getAttributeNS(p,d):null}function y(h){return new Error("Could not parse ttml timestamp "+h)}function c(h,p){if(!h)return null;var d=Object(U.parseTimeStamp)(h);return d===null&&(v.test(h)?d=L(h,p):k.test(h)&&(d=x(h,p))),d}function L(h,p){var d=v.exec(h),o=(d[4]|0)+(d[5]|0)/p.subFrameRate;return(d[1]|0)*3600+(d[2]|0)*60+(d[3]|0)+o/p.frameRate}function x(h,p){var d=k.exec(h),o=Number(d[1]),T=d[2];switch(T){case"h":return o*3600;case"m":return o*60;case"ms":return o*1e3;case"f":return o/p.frameRate;case"t":return o/p.tickRate}return o}},"./src/utils/logger.ts":function(q,G,D){"use strict";D.r(G),D.d(G,"enableLogs",function(){return R}),D.d(G,"logger",function(){return C});var z=function(){},U={trace:z,debug:z,log:z,warn:z,info:z,error:z},O=U;function F(m){var v=self.console[m];return v?v.bind(self.console,"["+m+"] >"):z}function M(m){for(var v=arguments.length,k=new Array(v>1?v-1:0),S=1;S<v;S++)k[S-1]=arguments[S];k.forEach(function(b){O[b]=m[b]?m[b].bind(m):F(b)})}function R(m){if(self.console&&m===!0||typeof m=="object"){M(m,"debug","log","info","warn","error");try{O.log()}catch(v){O=U}}else O=U}var C=O},"./src/utils/mediakeys-helper.ts":function(q,G,D){"use strict";D.r(G),D.d(G,"KeySystems",function(){return z}),D.d(G,"requestMediaKeySystemAccess",function(){return U});var z;(function(O){O.WIDEVINE="com.widevine.alpha",O.PLAYREADY="com.microsoft.playready"})(z||(z={}));var U=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(q,G,D){"use strict";D.r(G),D.d(G,"getMediaSource",function(){return z});function z(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(q,G,D){"use strict";D.r(G),D.d(G,"bin2str",function(){return M}),D.d(G,"readUint16",function(){return R}),D.d(G,"readUint32",function(){return C}),D.d(G,"writeUint32",function(){return m}),D.d(G,"findBox",function(){return v}),D.d(G,"parseSegmentIndex",function(){return k}),D.d(G,"parseInitSegment",function(){return S}),D.d(G,"getStartDTS",function(){return b}),D.d(G,"getDuration",function(){return f}),D.d(G,"computeRawDurationFromSamples",function(){return u}),D.d(G,"offsetStartDTS",function(){return a}),D.d(G,"segmentValidRange",function(){return s}),D.d(G,"appendUint8Array",function(){return l});var z=D("./src/utils/typed-array.ts"),U=D("./src/loader/fragment.ts"),O=Math.pow(2,32)-1,F=[].push;function M(A){return String.fromCharCode.apply(null,A)}function R(A,y){"data"in A&&(y+=A.start,A=A.data);var c=A[y]<<8|A[y+1];return c<0?65536+c:c}function C(A,y){"data"in A&&(y+=A.start,A=A.data);var c=A[y]<<24|A[y+1]<<16|A[y+2]<<8|A[y+3];return c<0?4294967296+c:c}function m(A,y,c){"data"in A&&(y+=A.start,A=A.data),A[y]=c>>24,A[y+1]=c>>16&255,A[y+2]=c>>8&255,A[y+3]=c&255}function v(A,y){var c=[];if(!y.length)return c;var L,x,h;"data"in A?(L=A.data,x=A.start,h=A.end):(L=A,x=0,h=L.byteLength);for(var p=x;p<h;){var d=C(L,p),o=M(L.subarray(p+4,p+8)),T=d>1?p+d:h;if(o===y[0])if(y.length===1)c.push({data:L,start:p+8,end:T});else{var E=v({data:L,start:p+8,end:T},y.slice(1));E.length&&F.apply(c,E)}p=T}return c}function k(A){var y=v(A,["moov"]),c=y[0],L=c?c.end:null,x=v(A,["sidx"]);if(!x||!x[0])return null;var h=[],p=x[0],d=p.data[0],o=d===0?8:16,T=C(p,o);o+=4;var E=0,g=0;d===0?o+=8:o+=16,o+=2;var _=p.end+g,N=R(p,o);o+=2;for(var B=0;B<N;B++){var W=o,P=C(p,W);W+=4;var I=P&2147483647,H=(P&2147483648)>>>31;if(H===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var Y=C(p,W);W+=4,h.push({referenceSize:I,subsegmentDuration:Y,info:{duration:Y/T,start:_,end:_+I-1}}),_+=I,W+=4,o=W}return{earliestPresentationTime:E,timescale:T,version:d,referencesCount:N,references:h,moovEndOffset:L}}function S(A){for(var y=[],c=v(A,["moov","trak"]),L=0;L<c.length;L++){var x=c[L],h=v(x,["tkhd"])[0];if(h){var p=h.data[h.start],d=p===0?12:20,o=C(h,d),T=v(x,["mdia","mdhd"])[0];if(T){p=T.data[T.start],d=p===0?12:20;var E=C(T,d),g=v(x,["mdia","hdlr"])[0];if(g){var _=M(g.data.subarray(g.start+8,g.start+12)),N={soun:U.ElementaryStreamTypes.AUDIO,vide:U.ElementaryStreamTypes.VIDEO}[_];if(N){var B=v(x,["mdia","minf","stbl","stsd"])[0],W=void 0;B&&(W=M(B.data.subarray(B.start+12,B.start+16))),y[o]={timescale:E,type:N},y[N]={timescale:E,id:o,codec:W}}}}}}var P=v(A,["moov","mvex","trex"]);return P.forEach(function(I){var H=C(I,4),Y=y[H];Y&&(Y.default={duration:C(I,12),flags:C(I,20)})}),y}function b(A,y){return v(y,["moof","traf"]).reduce(function(c,L){var x=v(L,["tfdt"])[0],h=x.data[x.start],p=v(L,["tfhd"]).reduce(function(d,o){var T=C(o,4),E=A[T];if(E){var g=C(x,4);h===1&&(g*=Math.pow(2,32),g+=C(x,8));var _=E.timescale||9e4,N=g/_;if(isFinite(N)&&(d===null||N<d))return N}return d},null);return p!==null&&isFinite(p)&&(c===null||p<c)?p:c},null)||0}function f(A,y){for(var c=0,L=0,x=0,h=v(A,["moof","traf"]),p=0;p<h.length;p++){var d=h[p],o=v(d,["tfhd"])[0],T=C(o,4),E=y[T];if(!E)continue;var g=E.default,_=C(o,0)|(g==null?void 0:g.flags),N=g==null?void 0:g.duration;_&8&&(_&2?N=C(o,12):N=C(o,8));for(var B=E.timescale||9e4,W=v(d,["trun"]),P=0;P<W.length;P++){if(N){var I=C(W[P],4);c=N*I}else c=u(W[P]);E.type===U.ElementaryStreamTypes.VIDEO?L+=c/B:E.type===U.ElementaryStreamTypes.AUDIO&&(x+=c/B)}}if(L===0&&x===0){var H=k(A);if(H!=null&&H.references)return H.references.reduce(function(Y,ee){return Y+ee.info.duration||0},0)}return L||x}function u(A){var y=C(A,0),c=8;y&1&&(c+=4),y&4&&(c+=4);for(var L=0,x=C(A,4),h=0;h<x;h++){if(y&256){var p=C(A,c);L+=p,c+=4}y&512&&(c+=4),y&1024&&(c+=4),y&2048&&(c+=4)}return L}function a(A,y,c){v(y,["moof","traf"]).forEach(function(L){v(L,["tfhd"]).forEach(function(x){var h=C(x,4),p=A[h];if(!p)return;var d=p.timescale||9e4;v(L,["tfdt"]).forEach(function(o){var T=o.data[o.start],E=C(o,4);if(T===0)m(o,4,E-c*d);else{E*=Math.pow(2,32),E+=C(o,8),E-=c*d,E=Math.max(E,0);var g=Math.floor(E/(O+1)),_=Math.floor(E%(O+1));m(o,4,g),m(o,8,_)}})})})}function s(A){var y={valid:null,remainder:null},c=v(A,["moof"]);if(c){if(c.length<2)return y.remainder=A,y}else return y;var L=c[c.length-1];return y.valid=Object(z.sliceUint8)(A,0,L.start-8),y.remainder=Object(z.sliceUint8)(A,L.start-8),y}function l(A,y){var c=new Uint8Array(A.length+y.length);return c.set(A),c.set(y,A.length),c}},"./src/utils/output-filter.ts":function(q,G,D){"use strict";D.r(G),D.d(G,"default",function(){return z});var z=function(){function U(F,M){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=F,this.trackName=M}var O=U.prototype;return O.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},O.newCue=function(M,R,C){(this.startTime===null||this.startTime>M)&&(this.startTime=M),this.endTime=R,this.screen=C,this.timelineController.createCaptionsTrack(this.trackName)},O.reset=function(){this.cueRanges=[]},U}()},"./src/utils/texttrack-utils.ts":function(q,G,D){"use strict";D.r(G),D.d(G,"sendAddTrackEvent",function(){return U}),D.d(G,"addCueToTrack",function(){return O}),D.d(G,"clearCurrentCues",function(){return F}),D.d(G,"removeCuesInRange",function(){return M}),D.d(G,"getCuesInRange",function(){return C});var z=D("./src/utils/logger.ts");function U(m,v){var k;try{k=new Event("addtrack")}catch(S){k=document.createEvent("Event"),k.initEvent("addtrack",!1,!1)}k.track=m,v.dispatchEvent(k)}function O(m,v){var k=m.mode;if(k==="disabled"&&(m.mode="hidden"),m.cues&&!m.cues.getCueById(v.id))try{if(m.addCue(v),!m.cues.getCueById(v.id))throw new Error("addCue is failed for: "+v)}catch(b){z.logger.debug("[texttrack-utils]: "+b);var S=new self.TextTrackCue(v.startTime,v.endTime,v.text);S.id=v.id,m.addCue(S)}k==="disabled"&&(m.mode=k)}function F(m){var v=m.mode;if(v==="disabled"&&(m.mode="hidden"),m.cues)for(var k=m.cues.length;k--;)m.removeCue(m.cues[k]);v==="disabled"&&(m.mode=v)}function M(m,v,k){var S=m.mode;if(S==="disabled"&&(m.mode="hidden"),m.cues&&m.cues.length>0)for(var b=C(m.cues,v,k),f=0;f<b.length;f++)m.removeCue(b[f]);S==="disabled"&&(m.mode=S)}function R(m,v){if(v<m[0].startTime)return 0;var k=m.length-1;if(v>m[k].endTime)return-1;for(var S=0,b=k;S<=b;){var f=Math.floor((b+S)/2);if(v<m[f].startTime)b=f-1;else if(v>m[f].startTime&&S<k)S=f+1;else return f}return m[S].startTime-v<v-m[b].startTime?S:b}function C(m,v,k){var S=[],b=R(m,v);if(b>-1)for(var f=b,u=m.length;f<u;f++){var a=m[f];if(a.startTime>=v&&a.endTime<=k)S.push(a);else if(a.startTime>k)return S}return S}},"./src/utils/time-ranges.ts":function(q,G,D){"use strict";D.r(G);var z={toString:function(O){for(var F="",M=O.length,R=0;R<M;R++)F+="["+O.start(R).toFixed(3)+","+O.end(R).toFixed(3)+"]";return F}};G.default=z},"./src/utils/timescale-conversion.ts":function(q,G,D){"use strict";D.r(G),D.d(G,"toTimescaleFromBase",function(){return U}),D.d(G,"toTimescaleFromScale",function(){return O}),D.d(G,"toMsFromMpegTsClock",function(){return F}),D.d(G,"toMpegTsClockFromTimescale",function(){return M});var z=9e4;function U(R,C,m,v){m===void 0&&(m=1),v===void 0&&(v=!1);var k=R*C*m;return v?Math.round(k):k}function O(R,C,m,v){return m===void 0&&(m=1),v===void 0&&(v=!1),U(R,C,1/m,v)}function F(R,C){return C===void 0&&(C=!1),U(R,1e3,1/z,C)}function M(R,C){return C===void 0&&(C=1),U(R,z,1/C)}},"./src/utils/typed-array.ts":function(q,G,D){"use strict";D.r(G),D.d(G,"sliceUint8",function(){return z});function z(U,O,F){return Uint8Array.prototype.slice?U.slice(O,F):new Uint8Array(Array.prototype.slice.call(U,O,F))}},"./src/utils/vttcue.ts":function(q,G,D){"use strict";D.r(G),G.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var z=["","lr","rl"],U=["start","middle","end","left","right"];function O(m,v){if(typeof v!="string")return!1;if(!Array.isArray(m))return!1;var k=v.toLowerCase();return~m.indexOf(k)?k:!1}function F(m){return O(z,m)}function M(m){return O(U,m)}function R(m){for(var v=arguments.length,k=new Array(v>1?v-1:0),S=1;S<v;S++)k[S-1]=arguments[S];for(var b=1;b<arguments.length;b++){var f=arguments[b];for(var u in f)m[u]=f[u]}return m}function C(m,v,k){var S=this,b={enumerable:!0};S.hasBeenReset=!1;var f="",u=!1,a=m,s=v,l=k,A=null,y="",c=!0,L="auto",x="start",h=50,p="middle",d=50,o="middle";Object.defineProperty(S,"id",R({},b,{get:function(){return f},set:function(E){f=""+E}})),Object.defineProperty(S,"pauseOnExit",R({},b,{get:function(){return u},set:function(E){u=!!E}})),Object.defineProperty(S,"startTime",R({},b,{get:function(){return a},set:function(E){if(typeof E!="number")throw new TypeError("Start time must be set to a number.");a=E,this.hasBeenReset=!0}})),Object.defineProperty(S,"endTime",R({},b,{get:function(){return s},set:function(E){if(typeof E!="number")throw new TypeError("End time must be set to a number.");s=E,this.hasBeenReset=!0}})),Object.defineProperty(S,"text",R({},b,{get:function(){return l},set:function(E){l=""+E,this.hasBeenReset=!0}})),Object.defineProperty(S,"region",R({},b,{get:function(){return A},set:function(E){A=E,this.hasBeenReset=!0}})),Object.defineProperty(S,"vertical",R({},b,{get:function(){return y},set:function(E){var g=F(E);if(g===!1)throw new SyntaxError("An invalid or illegal string was specified.");y=g,this.hasBeenReset=!0}})),Object.defineProperty(S,"snapToLines",R({},b,{get:function(){return c},set:function(E){c=!!E,this.hasBeenReset=!0}})),Object.defineProperty(S,"line",R({},b,{get:function(){return L},set:function(E){if(typeof E!="number"&&E!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");L=E,this.hasBeenReset=!0}})),Object.defineProperty(S,"lineAlign",R({},b,{get:function(){return x},set:function(E){var g=M(E);if(!g)throw new SyntaxError("An invalid or illegal string was specified.");x=g,this.hasBeenReset=!0}})),Object.defineProperty(S,"position",R({},b,{get:function(){return h},set:function(E){if(E<0||E>100)throw new Error("Position must be between 0 and 100.");h=E,this.hasBeenReset=!0}})),Object.defineProperty(S,"positionAlign",R({},b,{get:function(){return p},set:function(E){var g=M(E);if(!g)throw new SyntaxError("An invalid or illegal string was specified.");p=g,this.hasBeenReset=!0}})),Object.defineProperty(S,"size",R({},b,{get:function(){return d},set:function(E){if(E<0||E>100)throw new Error("Size must be between 0 and 100.");d=E,this.hasBeenReset=!0}})),Object.defineProperty(S,"align",R({},b,{get:function(){return o},set:function(E){var g=M(E);if(!g)throw new SyntaxError("An invalid or illegal string was specified.");o=g,this.hasBeenReset=!0}})),S.displayState=void 0}return C.prototype.getCueAsHTML=function(){var m=self.WebVTT;return m.convertCueToDOMTree(self,this.text)},C}()},"./src/utils/vttparser.ts":function(q,G,D){"use strict";D.r(G),D.d(G,"parseTimeStamp",function(){return O}),D.d(G,"fixLineBreaks",function(){return v}),D.d(G,"VTTParser",function(){return k});var z=D("./src/utils/vttcue.ts"),U=function(){function S(){}var b=S.prototype;return b.decode=function(u,a){if(!u)return"";if(typeof u!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(u))},S}();function O(S){function b(u,a,s,l){return(u|0)*3600+(a|0)*60+(s|0)+parseFloat(l||0)}var f=S.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return f?parseFloat(f[2])>59?b(f[2],f[3],0,f[4]):b(f[1],f[2],f[3],f[4]):null}var F=function(){function S(){this.values=Object.create(null)}var b=S.prototype;return b.set=function(u,a){!this.get(u)&&a!==""&&(this.values[u]=a)},b.get=function(u,a,s){return s?this.has(u)?this.values[u]:a[s]:this.has(u)?this.values[u]:a},b.has=function(u){return u in this.values},b.alt=function(u,a,s){for(var l=0;l<s.length;++l)if(a===s[l]){this.set(u,a);break}},b.integer=function(u,a){/^-?\d+$/.test(a)&&this.set(u,parseInt(a,10))},b.percent=function(u,a){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(a)){var s=parseFloat(a);if(s>=0&&s<=100)return this.set(u,s),!0}return!1},S}();function M(S,b,f,u){var a=u?S.split(u):[S];for(var s in a){if(typeof a[s]!="string")continue;var l=a[s].split(f);if(l.length!==2)continue;var A=l[0],y=l[1];b(A,y)}}var R=new z.default(0,0,""),C=R.align==="middle"?"middle":"center";function m(S,b,f){var u=S;function a(){var A=O(S);if(A===null)throw new Error("Malformed timestamp: "+u);return S=S.replace(/^[^\sa-zA-Z-]+/,""),A}function s(A,y){var c=new F;M(A,function(h,p){var d;switch(h){case"region":for(var o=f.length-1;o>=0;o--)if(f[o].id===p){c.set(h,f[o].region);break}break;case"vertical":c.alt(h,p,["rl","lr"]);break;case"line":d=p.split(","),c.integer(h,d[0]),c.percent(h,d[0])&&c.set("snapToLines",!1),c.alt(h,d[0],["auto"]),d.length===2&&c.alt("lineAlign",d[1],["start",C,"end"]);break;case"position":d=p.split(","),c.percent(h,d[0]),d.length===2&&c.alt("positionAlign",d[1],["start",C,"end","line-left","line-right","auto"]);break;case"size":c.percent(h,p);break;case"align":c.alt(h,p,["start",C,"end","left","right"]);break}},/:/,/\s/),y.region=c.get("region",null),y.vertical=c.get("vertical","");var L=c.get("line","auto");L==="auto"&&R.line===-1&&(L=-1),y.line=L,y.lineAlign=c.get("lineAlign","start"),y.snapToLines=c.get("snapToLines",!0),y.size=c.get("size",100),y.align=c.get("align",C);var x=c.get("position","auto");x==="auto"&&R.position===50&&(x=y.align==="start"||y.align==="left"?0:y.align==="end"||y.align==="right"?100:50),y.position=x}function l(){S=S.replace(/^\s+/,"")}if(l(),b.startTime=a(),l(),S.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+u);S=S.substr(3),l(),b.endTime=a(),l(),s(S,b)}function v(S){return S.replace(/<br(?: \/)?>/gi,`
|
|
`)}var k=function(){function S(){this.state="INITIAL",this.buffer="",this.decoder=new U,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var b=S.prototype;return b.parse=function(u){var a=this;u&&(a.buffer+=a.decoder.decode(u,{stream:!0}));function s(){var x=a.buffer,h=0;for(x=v(x);h<x.length&&x[h]!=="\r"&&x[h]!==`
|
|
`;)++h;var p=x.substr(0,h);return x[h]==="\r"&&++h,x[h]===`
|
|
`&&++h,a.buffer=x.substr(h),p}function l(x){M(x,function(h,p){},/:/)}try{var A="";if(a.state==="INITIAL"){if(!/\r\n|\n/.test(a.buffer))return this;A=s();var y=A.match(/^()?WEBVTT([ \t].*)?$/);if(!y||!y[0])throw new Error("Malformed WebVTT signature.");a.state="HEADER"}for(var c=!1;a.buffer;){if(!/\r\n|\n/.test(a.buffer))return this;c?c=!1:A=s();switch(a.state){case"HEADER":/:/.test(A)?l(A):A||(a.state="ID");continue;case"NOTE":A||(a.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(A)){a.state="NOTE";break}if(!A)continue;if(a.cue=new z.default(0,0,""),a.state="CUE",A.indexOf("-->")===-1){a.cue.id=A;continue}case"CUE":if(!a.cue){a.state="BADCUE";continue}try{m(A,a.cue,a.regionList)}catch(x){a.cue=null,a.state="BADCUE";continue}a.state="CUETEXT";continue;case"CUETEXT":{var L=A.indexOf("-->")!==-1;if(!A||L&&(c=!0)){a.oncue&&a.cue&&a.oncue(a.cue),a.cue=null,a.state="ID";continue}if(a.cue===null)continue;a.cue.text&&(a.cue.text+=`
|
|
`),a.cue.text+=A}continue;case"BADCUE":A||(a.state="ID")}}}catch(x){a.state==="CUETEXT"&&a.cue&&a.oncue&&a.oncue(a.cue),a.cue=null,a.state=a.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},b.flush=function(){var 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(a){u.onparsingerror&&u.onparsingerror(a)}return u.onflush&&u.onflush(),this},S}()},"./src/utils/webvtt-parser.ts":function(q,G,D){"use strict";D.r(G),D.d(G,"generateCueId",function(){return k}),D.d(G,"parseWebVTT",function(){return b});var z=D("./src/polyfills/number.ts"),U=D("./src/utils/vttparser.ts"),O=D("./src/demux/id3.ts"),F=D("./src/utils/timescale-conversion.ts"),M=D("./src/remux/mp4-remuxer.ts"),R=/\r\n|\n\r|\n|\r/g,C=function(u,a,s){return s===void 0&&(s=0),u.substr(s,a.length)===a},m=function(u){var a=parseInt(u.substr(-3)),s=parseInt(u.substr(-6,2)),l=parseInt(u.substr(-9,2)),A=u.length>9?parseInt(u.substr(0,u.indexOf(":"))):0;if(!Object(z.isFiniteNumber)(a)||!Object(z.isFiniteNumber)(s)||!Object(z.isFiniteNumber)(l)||!Object(z.isFiniteNumber)(A))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+u);return a+=1e3*s,a+=60*1e3*l,a+=60*60*1e3*A,a},v=function(u){for(var a=5381,s=u.length;s;)a=a*33^u.charCodeAt(--s);return(a>>>0).toString()};function k(f,u,a){return v(f.toString())+v(u.toString())+v(a)}var S=function(u,a,s){var l=u[a],A=u[l.prevCC];if(!A||!A.new&&l.new){u.ccOffset=u.presentationOffset=l.start,l.new=!1;return}for(;(y=A)!==null&&y!==void 0&&y.new;){var y;u.ccOffset+=l.start-A.start,l.new=!1,l=A,A=u[l.prevCC]}u.presentationOffset=s};function b(f,u,a,s,l,A,y,c){var L=new U.VTTParser,x=Object(O.utf8ArrayToStr)(new Uint8Array(f)).trim().replace(R,`
|
|
`).split(`
|
|
`),h=[],p=Object(F.toMpegTsClockFromTimescale)(u,a),d="00:00.000",o=0,T=0,E,g=!0,_=!1;L.oncue=function(N){var B=s[l],W=s.ccOffset,P=(o-p)/9e4;if(B!=null&&B.new&&(T!==void 0?W=s.ccOffset=B.start:S(s,l,P)),P&&(W=P-s.presentationOffset),_){var I=N.endTime-N.startTime,H=Object(M.normalizePts)((N.startTime+W-T)*9e4,A*9e4)/9e4;N.startTime=H,N.endTime=H+I}var Y=N.text.trim();N.text=decodeURIComponent(encodeURIComponent(Y)),N.id||(N.id=k(N.startTime,N.endTime,Y)),N.endTime>0&&h.push(N)},L.onparsingerror=function(N){E=N},L.onflush=function(){if(E){c(E);return}y(h)},x.forEach(function(N){if(g)if(C(N,"X-TIMESTAMP-MAP=")){g=!1,_=!0,N.substr(16).split(",").forEach(function(B){C(B,"LOCAL:")?d=B.substr(6):C(B,"MPEGTS:")&&(o=parseInt(B.substr(7)))});try{T=m(d)/1e3}catch(B){_=!1,E=B}return}else N===""&&(g=!1);L.parse(N+`
|
|
`)}),L.flush()}},"./src/utils/xhr-loader.ts":function(q,G,D){"use strict";D.r(G);var z=D("./src/utils/logger.ts"),U=D("./src/loader/load-stats.ts"),O=/^age:\s*[\d.]+\s*$/m,F=function(){function M(C){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=void 0,this.loader=null,this.stats=void 0,this.xhrSetup=C?C.xhrSetup:null,this.stats=new U.LoadStats,this.retryDelay=0}var R=M.prototype;return R.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},R.abortInternal=function(){var m=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),m&&(m.onreadystatechange=null,m.onprogress=null,m.readyState!==4&&(this.stats.aborted=!0,m.abort()))},R.abort=function(){var m;this.abortInternal(),(m=this.callbacks)!==null&&m!==void 0&&m.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},R.load=function(m,v,k){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=m,this.config=v,this.callbacks=k,this.retryDelay=v.retryDelay,this.loadInternal()},R.loadInternal=function(){var m=this.config,v=this.context;if(!m)return;var k=this.loader=new self.XMLHttpRequest,S=this.stats;S.loading.first=0,S.loaded=0;var b=this.xhrSetup;try{if(b)try{b(k,v.url)}catch(a){k.open("GET",v.url,!0),b(k,v.url)}k.readyState||k.open("GET",v.url,!0);var f=this.context.headers;if(f)for(var u in f)k.setRequestHeader(u,f[u])}catch(a){this.callbacks.onError({code:k.status,text:a.message},v,k);return}v.rangeEnd&&k.setRequestHeader("Range","bytes="+v.rangeStart+"-"+(v.rangeEnd-1)),k.onreadystatechange=this.readystatechange.bind(this),k.onprogress=this.loadprogress.bind(this),k.responseType=v.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),m.timeout),k.send()},R.readystatechange=function(){var m=this.context,v=this.loader,k=this.stats;if(!m||!v)return;var S=v.readyState,b=this.config;if(k.aborted)return;if(S>=2)if(self.clearTimeout(this.requestTimeout),k.loading.first===0&&(k.loading.first=Math.max(self.performance.now(),k.loading.start)),S===4){v.onreadystatechange=null,v.onprogress=null;var f=v.status;if(f>=200&&f<300){k.loading.end=Math.max(self.performance.now(),k.loading.first);var u,a;if(m.responseType==="arraybuffer"?(u=v.response,a=u.byteLength):(u=v.responseText,a=u.length),k.loaded=k.total=a,!this.callbacks)return;var s=this.callbacks.onProgress;if(s&&s(k,m,u,v),!this.callbacks)return;var l={url:v.responseURL,data:u};this.callbacks.onSuccess(l,k,m,v)}else k.retry>=b.maxRetry||f>=400&&f<499?(z.logger.error(f+" while loading "+m.url),this.callbacks.onError({code:f,text:v.statusText},m,v)):(z.logger.warn(f+" while loading "+m.url+", retrying in "+this.retryDelay+"..."),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,b.maxRetryDelay),k.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),b.timeout)},R.loadtimeout=function(){z.logger.warn("timeout while loading "+this.context.url);var m=this.callbacks;m&&(this.abortInternal(),m.onTimeout(this.stats,this.context,this.loader))},R.loadprogress=function(m){var v=this.stats;v.loaded=m.loaded,m.lengthComputable&&(v.total=m.total)},R.getCacheAge=function(){var m=null;if(this.loader&&O.test(this.loader.getAllResponseHeaders())){var v=this.loader.getResponseHeader("age");m=v?parseFloat(v):null}return m},M}();G.default=F}}).default})},vHTk:function(nt,Qe,te){nt.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}},wU8J:function(nt,Qe){function te(){this.buffer=new Array,this.length=0}te.prototype={get:function(q){var G=Math.floor(q/8);return(this.buffer[G]>>>7-q%8&1)==1},put:function(q,G){for(var D=0;D<G;D++)this.putBit((q>>>G-D-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(q){var G=Math.floor(this.length/8);this.buffer.length<=G&&this.buffer.push(0),q&&(this.buffer[G]|=128>>>this.length%8),this.length++}},nt.exports=te}}]);
|