You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
NewEduCoderBuild/p__Three.a347a99f.async.js

372 lines
946 KiB

(window.webpackJsonp=window.webpackJsonp||[]).push([[233,5,6,7],{"+NIl":function(Tt,dt,le){(function(he){he(le("VrN/"))})(function(he){"use strict";he.defineMode("stex",function(J,D){"use strict";function Q(L,w){L.cmdState.push(w)}function B(L){return L.cmdState.length>0?L.cmdState[L.cmdState.length-1]:null}function _(L){var w=L.cmdState.pop();w&&w.closeBracket()}function G(L){for(var w=L.cmdState,y=w.length-1;y>=0;y--){var u=w[y];if(u.name=="DEFAULT")continue;return u}return{styleIdentifier:function(){return null}}}function j(L,w,y){return function(){this.name=L,this.bracketNo=0,this.style=w,this.styles=y,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var I={};I.importmodule=j("importmodule","tag",["string","builtin"]),I.documentclass=j("documentclass","tag",["","atom"]),I.usepackage=j("usepackage","tag",["atom"]),I.begin=j("begin","tag",["atom"]),I.end=j("end","tag",["atom"]),I.label=j("label","tag",["atom"]),I.ref=j("ref","tag",["atom"]),I.eqref=j("eqref","tag",["atom"]),I.cite=j("cite","tag",["atom"]),I.bibitem=j("bibitem","tag",["atom"]),I.Bibitem=j("Bibitem","tag",["atom"]),I.RBibitem=j("RBibitem","tag",["atom"]),I.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function R(L,w){L.f=w}function v(L,w){var y;if(L.match(/^\\[a-zA-Z@]+/)){var u=L.current().slice(1);return y=I.hasOwnProperty(u)?I[u]:I.DEFAULT,y=new y,Q(w,y),R(w,M),y.style}if(L.match(/^\\[$&%#{}_]/))return"tag";if(L.match(/^\\[,;!\/\\]/))return"tag";if(L.match("\\["))return R(w,function(l,d){return A(l,d,"\\]")}),"keyword";if(L.match("\\("))return R(w,function(l,d){return A(l,d,"\\)")}),"keyword";if(L.match("$$"))return R(w,function(l,d){return A(l,d,"$$")}),"keyword";if(L.match("$"))return R(w,function(l,d){return A(l,d,"$")}),"keyword";var o=L.next();if(o=="%")return L.skipToEnd(),"comment";if(o=="}"||o=="]"){if(y=B(w),y)y.closeBracket(o),R(w,M);else return"error";return"bracket"}else return o=="{"||o=="["?(y=I.DEFAULT,y=new y,Q(w,y),"bracket"):/\d/.test(o)?(L.eatWhile(/[\w.%]/),"atom"):(L.eatWhile(/[\w\-_]/),y=G(w),y.name=="begin"&&(y.argument=L.current()),y.styleIdentifier())}function A(L,w,y){if(L.eatSpace())return null;if(y&&L.match(y))return R(w,v),"keyword";if(L.match(/^\\[a-zA-Z@]+/))return"tag";if(L.match(/^[a-zA-Z]+/))return"variable-2";if(L.match(/^\\[$&%#{}_]/))return"tag";if(L.match(/^\\[,;!\/]/))return"tag";if(L.match(/^[\^_&]/))return"tag";if(L.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(L.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var u=L.next();return u=="{"||u=="}"||u=="["||u=="]"||u=="("||u==")"?"bracket":u=="%"?(L.skipToEnd(),"comment"):"error"}function M(L,w){var y=L.peek(),u;return y=="{"||y=="["?(u=B(w),u.openBracket(y),L.eat(y),R(w,v),"bracket"):/[ \t\r]/.test(y)?(L.eat(y),null):(R(w,v),_(w),v(L,w))}return{startState:function(){var L=D.inMathMode?function(w,y){return A(w,y)}:v;return{cmdState:[],f:L}},copyState:function(L){return{cmdState:L.cmdState.slice(),f:L.f}},token:function(L,w){return w.f(L,w)},blankLine:function(L){L.f=v,L.cmdState.length=0},lineComment:"%"}}),he.defineMIME("text/x-stex","stex"),he.defineMIME("text/x-latex","stex")})},"19Vz":function(Tt,dt,le){(function(he){he(le("VrN/"))})(function(he){he.defineOption("placeholder","",function(j,I,R){var v=R&&R!=he.Init;if(I&&!v)j.on("blur",B),j.on("change",_),j.on("swapDoc",_),he.on(j.getInputField(),"compositionupdate",j.state.placeholderCompose=function(){Q(j)}),_(j);else if(!I&&v){j.off("blur",B),j.off("change",_),j.off("swapDoc",_),he.off(j.getInputField(),"compositionupdate",j.state.placeholderCompose),J(j);var A=j.getWrapperElement();A.className=A.className.replace(" CodeMirror-empty","")}I&&!j.hasFocus()&&B(j)});function J(j){j.state.placeholder&&(j.state.placeholder.parentNode.removeChild(j.state.placeholder),j.state.placeholder=null)}function D(j){J(j);var I=j.state.placeholder=document.createElement("pre");I.style.cssText="height: 0; overflow: visible",I.style.direction=j.getOption("direction"),I.className="CodeMirror-placeholder CodeMirror-line-like";var R=j.getOption("placeholder");typeof R=="string"&&(R=document.createTextNode(R)),I.appendChild(R),j.display.lineSpace.insertBefore(I,j.display.lineSpace.firstChild)}function Q(j){setTimeout(function(){var I=!1,R=j.getInputField();R.nodeName=="TEXTAREA"?I=!R.value:j.lineCount()==1&&(I=!/[^\u200b]/.test(R.querySelector(".CodeMirror-line").textContent)),I?D(j):J(j)},20)}function B(j){G(j)&&D(j)}function _(j){var I=j.getWrapperElement(),R=G(j);I.className=I.className.replace(" CodeMirror-empty","")+(R?" CodeMirror-empty":""),R?D(j):J(j)}function G(j){return j.lineCount()===1&&j.getLine(0)===""}})},"1eCo":function(Tt,dt,le){(function(he){he(le("VrN/"))})(function(he){"use strict";var J={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};he.defineMode("xml",function(Q,B){var _=Q.indentUnit,G={},j=B.htmlMode?J:D;for(var I in j)G[I]=j[I];for(var I in B)G[I]=B[I];var R,v;function A(a,E){function b(U){return E.tokenize=U,U(a,E)}var S=a.next();if(S=="<")return a.eat("!")?a.eat("[")?a.match("CDATA[")?b(w("atom","]]>")):null:a.match("--")?b(w("comment","-->")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),b(y(1))):null:a.eat("?")?(a.eatWhile(/[\w\._\-]/),E.tokenize=w("meta","?>"),"meta"):(R=a.eat("/")?"closeTag":"openTag",E.tokenize=M,"tag bracket");if(S=="&"){var N;return a.eat("#")?a.eat("x")?N=a.eatWhile(/[a-fA-F\d]/)&&a.eat(";"):N=a.eatWhile(/[\d]/)&&a.eat(";"):N=a.eatWhile(/[\w\.\-:]/)&&a.eat(";"),N?"atom":"error"}else return a.eatWhile(/[^&<]/),null}A.isInText=!0;function M(a,E){var b=a.next();if(b==">"||b=="/"&&a.eat(">"))return E.tokenize=A,R=b==">"?"endTag":"selfcloseTag","tag bracket";if(b=="=")return R="equals",null;if(b=="<"){E.tokenize=A,E.state=d,E.tagName=E.tagStart=null;var S=E.tokenize(a,E);return S?S+" tag error":"tag error"}else return/[\'\"]/.test(b)?(E.tokenize=L(b),E.stringStartCol=a.column(),E.tokenize(a,E)):(a.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function L(a){var E=function(b,S){for(;!b.eol();)if(b.next()==a){S.tokenize=M;break}return"string"};return E.isInAttribute=!0,E}function w(a,E){return function(b,S){for(;!b.eol();){if(b.match(E)){S.tokenize=A;break}b.next()}return a}}function y(a){return function(E,b){for(var S;(S=E.next())!=null;){if(S=="<")return b.tokenize=y(a+1),b.tokenize(E,b);if(S==">")if(a==1){b.tokenize=A;break}else return b.tokenize=y(a-1),b.tokenize(E,b)}return"meta"}}function u(a,E,b){this.prev=a.context,this.tagName=E,this.indent=a.indented,this.startOfLine=b,(G.doNotIndent.hasOwnProperty(E)||a.context&&a.context.noIndent)&&(this.noIndent=!0)}function o(a){a.context&&(a.context=a.context.prev)}function l(a,E){for(var b;;){if(!a.context)return;if(b=a.context.tagName,!G.contextGrabbers.hasOwnProperty(b)||!G.contextGrabbers[b].hasOwnProperty(E))return;o(a)}}function d(a,E,b){return a=="openTag"?(b.tagStart=E.column(),T):a=="closeTag"?c:d}function T(a,E,b){return a=="word"?(b.tagName=E.current(),v="tag",x):G.allowMissingTagName&&a=="endTag"?(v="tag bracket",x(a,E,b)):(v="error",T)}function c(a,E,b){if(a=="word"){var S=E.current();return b.context&&b.context.tagName!=S&&G.implicitlyClosed.hasOwnProperty(b.context.tagName)&&o(b),b.context&&b.context.tagName==S||G.matchClosing===!1?(v="tag",p):(v="tag error",k)}else return G.allowMissingTagName&&a=="endTag"?(v="tag bracket",p(a,E,b)):(v="error",k)}function p(a,E,b){return a!="endTag"?(v="error",p):(o(b),d)}function k(a,E,b){return v="error",p(a,E,b)}function x(a,E,b){if(a=="word")return v="attribute",m;if(a=="endTag"||a=="selfcloseTag"){var S=b.tagName,N=b.tagStart;return b.tagName=b.tagStart=null,a=="selfcloseTag"||G.autoSelfClosers.hasOwnProperty(S)?l(b,S):(l(b,S),b.context=new u(b,S,N==b.indented)),d}return v="error",x}function m(a,E,b){return a=="equals"?g:(G.allowMissing||(v="error"),x(a,E,b))}function g(a,E,b){return a=="string"?h:a=="word"&&G.allowUnquoted?(v="string",x):(v="error",x(a,E,b))}function h(a,E,b){return a=="string"?h:x(a,E,b)}return{startState:function(a){var E={tokenize:A,state:d,indented:a||0,tagName:null,tagStart:null,context:null};return a!=null&&(E.baseIndent=a),E},token:function(a,E){if(!E.tagName&&a.sol()&&(E.indented=a.indentation()),a.eatSpace())return null;R=null;var b=E.tokenize(a,E);return(b||R)&&b!="comment"&&(v=null,E.state=E.state(R||b,a,E),v&&(b=v=="error"?b+" error":v)),b},indent:function(a,E,b){var S=a.context;if(a.tokenize.isInAttribute)return a.tagStart==a.indented?a.stringStartCol+1:a.indented+_;if(S&&S.noIndent)return he.Pass;if(a.tokenize!=M&&a.tokenize!=A)return b?b.match(/^(\s*)/)[0].length:0;if(a.tagName)return G.multilineTagIndentPastTag!==!1?a.tagStart+a.tagName.length+2:a.tagStart+_*(G.multilineTagIndentFactor||1);if(G.alignCDATA&&/<!\[CDATA\[/.test(E))return 0;var N=E&&/^<(\/)?([\w_:\.-]*)/.exec(E);if(N&&N[1])for(;S;)if(S.tagName==N[2]){S=S.prev;break}else if(G.implicitlyClosed.hasOwnProperty(S.tagName))S=S.prev;else break;else if(N)for(;S;){var U=G.contextGrabbers[S.tagName];if(U&&U.hasOwnProperty(N[2]))S=S.prev;else break}for(;S&&S.prev&&!S.startOfLine;)S=S.prev;return S?S.indent+_:a.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:G.htmlMode?"html":"xml",helperType:G.htmlMode?"html":"xml",skipAttribute:function(a){a.state==g&&(a.state=x)},xmlCurrentTag:function(a){return a.tagName?{name:a.tagName,close:a.type=="closeTag"}:null},xmlCurrentContext:function(a){for(var E=[],b=a.context;b;b=b.prev)b.tagName&&E.push(b.tagName);return E.reverse()}}}),he.defineMIME("text/xml","xml"),he.defineMIME("application/xml","xml"),he.mimeModes.hasOwnProperty("text/html")||he.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"7Cbv":function(Tt,dt,le){"use strict";var he=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),J=new Uint8Array(16);function D(){if(!he)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return he(J)}var Q=/^(?:[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 B(M){return typeof M=="string"&&Q.test(M)}for(var _=B,G=[],j=0;j<256;++j)G.push((j+256).toString(16).substr(1));function I(M){var L=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,w=(G[M[L+0]]+G[M[L+1]]+G[M[L+2]]+G[M[L+3]]+"-"+G[M[L+4]]+G[M[L+5]]+"-"+G[M[L+6]]+G[M[L+7]]+"-"+G[M[L+8]]+G[M[L+9]]+"-"+G[M[L+10]]+G[M[L+11]]+G[M[L+12]]+G[M[L+13]]+G[M[L+14]]+G[M[L+15]]).toLowerCase();if(!_(w))throw TypeError("Stringified UUID is invalid");return w}var R=I;function v(M,L,w){M=M||{};var y=M.random||(M.rng||D)();if(y[6]=y[6]&15|64,y[8]=y[8]&63|128,L){w=w||0;for(var u=0;u<16;++u)L[w+u]=y[u];return L}return R(y)}var A=dt.a=v},"7ahc":function(Tt,dt,le){"use strict";le.d(dt,"a",function(){return T});var he=le("k1fw"),J=le("0Owb"),D=le("+L6B"),Q=le("2/Rp"),B=le("y8nQ"),_=le("Vl3Y"),G=le("tJVT"),j=le("OaEy"),I=le("2fM7"),R=le("q1tI"),v=le.n(R),A=le("VrN/"),M=le.n(A),L=le("p77/"),w=le.n(L),y=le("c5Ni"),u=le.n(y),o=I.a.Option,l={labelCol:{span:4},wrapperCol:{span:20}},d={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"]};dt.b=function(c){var p=c.callback,k=c.onCancel,x=Object(R.useState)("python"),m=Object(G.a)(x,2),g=m[0],h=m[1];function a(b){h(d[b][1])}function E(b){p(b)}return v.a.createElement(_.a,Object(J.a)({},l,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:E}),v.a.createElement(_.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},v.a.createElement(I.a,{onChange:a},Object.keys(d).map(function(b){return v.a.createElement(o,{key:b,value:b},d[b][0])}))),v.a.createElement(_.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},v.a.createElement(T,{mode:g})),v.a.createElement("div",{className:"flex-container flex-end"},v.a.createElement(Q.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),v.a.createElement(Q.a,{type:"ghost",onClick:k},"\u53D6\u6D88")))};function T(c){var p=c.value,k=c.onChange,x=c.mode,m=c.options,g=m===void 0?{}:m,h=Object(R.useRef)(),a=Object(R.useState)(),E=Object(G.a)(a,2),b=E[0],S=E[1];return Object(R.useEffect)(function(){if(b){function N(U){var K=U.getValue();k&&k(K)}return b.on("change",N),function(){b.off("change",N)}}},[b,k]),Object(R.useEffect)(function(){b&&b.setOption("mode",x)},[b,x]),Object(R.useEffect)(function(){b&&((p!==b.getValue()||p==="")&&setTimeout(function(){b.setValue(p||" ")},300))},[b,p]),Object(R.useEffect)(function(){if(h.current&&!b){var N=M.a.fromTextArea(h.current,Object(he.a)({mode:x,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},g));S(N)}},[h.current,b]),v.a.createElement("div",{className:"my-codemirror-container"},v.a.createElement("textarea",{ref:h}))}},"8EBN":function(Tt,dt,le){(function(he){he(le("VrN/"))})(function(he){"use strict";he.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 J=0;J<he.modeInfo.length;J++){var D=he.modeInfo[J];D.mimes&&(D.mime=D.mimes[0])}he.findModeByMIME=function(Q){Q=Q.toLowerCase();for(var B=0;B<he.modeInfo.length;B++){var _=he.modeInfo[B];if(_.mime==Q)return _;if(_.mimes){for(var G=0;G<_.mimes.length;G++)if(_.mimes[G]==Q)return _}}if(/\+xml$/.test(Q))return he.findModeByMIME("application/xml");if(/\+json$/.test(Q))return he.findModeByMIME("application/json")},he.findModeByExtension=function(Q){Q=Q.toLowerCase();for(var B=0;B<he.modeInfo.length;B++){var _=he.modeInfo[B];if(_.ext){for(var G=0;G<_.ext.length;G++)if(_.ext[G]==Q)return _}}},he.findModeByFileName=function(Q){for(var B=0;B<he.modeInfo.length;B++){var _=he.modeInfo[B];if(_.file&&_.file.test(Q))return _}var G=Q.lastIndexOf("."),j=G>-1&&Q.substring(G+1,Q.length);if(j)return he.findModeByExtension(j)},he.findModeByName=function(Q){Q=Q.toLowerCase();for(var B=0;B<he.modeInfo.length;B++){var _=he.modeInfo[B];if(_.name.toLowerCase()==Q)return _;if(_.alias){for(var G=0;G<_.alias.length;G++)if(_.alias[G].toLowerCase()==Q)return _}}}})},"8hTe":function(Tt,dt,le){Tt.exports={button:"button___1wy9m"}},"9Bee":function(Tt,dt,le){"use strict";var he=le("DYRE"),J=le("zeV3"),D=le("+L6B"),Q=le("2/Rp"),B=le("k1fw"),_=le("9og8"),G=le("tJVT"),j=le("WmNS"),I=le.n(j),R=le("q1tI"),v=le.n(R),A=le("vg9a"),M=le("DlQD"),L=le.n(M),w=le("rUJ1");function y(z,s){var f=z.match(/^(\s+)(?:```)/);if(f===null)return s;var W=f[1];return s.split(`
`).map(function(X){var H=X.match(/^\s+/);if(H===null)return X;var ve=Object(G.a)(H,1),He=ve[0];return He.length>=W.length?X.slice(W.length):X}).join(`
`)}var u=[],o=["<ul>"],l=new L.a.Renderer,d=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function T(){u.length=0,o=["<ul>"]}var c={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function p(z,s,f,W){if(s>=z.length||z[s].level<=f)return s;var X=z[s];W.push("<li><a href='#"+X.anchor+"'>"+X.text+"</a>"),s++;var H=[];return s=p(z,s,X.level,H),H.length>0&&(W.push("<ul>"),H.forEach(function(ve){W.push(ve)}),W.push("</ul>")),W.push("</li>"),s=p(z,s,f,W),s}function k(){return p(u,0,0,o),o.push("</ul>"),o.join("")}var x={heading:function(s){var f=d.exec(s);if(f)return{type:"heading",raw:f[0],depth:f[1].length,text:f[2]}},fences:function(s){var f=this.rules.block.fences.exec(s);if(f){var W=f[0],X=y(W,f[3]||""),H=f[2]?f[2].trim():f[2];if(["latex","katex","math"].indexOf(H)>=0){var ve=h(),He=X;X=ve,a[ve]={type:"block",expression:He}}return{type:"code",raw:W,lang:H,text:X}}}},m=/(?:\${2})([^\n`]+?)(?:\${2})/gi,g=0,h=function(){return"__special_katext_id_".concat(g++,"__")},a={};function E(){return a}function b(){g=0,a={}}function S(z){return z=z.replace(m,function(s,f){var W=h();return a[W]={type:"inline",expression:f},W}),z}var N=l.listitem;l.listitem=function(z){return N(S(z))};var U=l.paragraph;l.paragraph=function(z){return U(S(z))};var K=l.tablecell;l.tablecell=function(z,s){return K(S(z),s)},l.code=function(z,s,f){var W=(s||"").match(/\S*/)[0];return W?["latex","katex","math"].indexOf(W)>=0?"<p class='editormd-tex'>".concat(z,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(s,'">').concat(f?z:Object(w.escape)(z,!0),`</code></pre>
`):'<pre class="prettyprint linenums"><code>'+(f?z:Object(w.escape)(z,!0))+"</code></pre>"},l.heading=function(z,s,f){var W=this.options.headerPrefix+f.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return u.push({anchor:W,level:s,text:z}),"<h"+s+' id="'+W+'">'+z+"</h"+s+">"},L.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),L.a.use({tokenizer:x,renderer:l});var V=L.a,O=le("SJMd"),P=le("ulZh"),$=le.n(P),ee=le("m3rI"),oe=le("Oy/b"),fe=le("p5ED"),Oe=le("ErOA");/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var Ce=function(z,s){return(Ce=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(f,W){f.__proto__=W}||function(f,W){for(var X in W)Object.prototype.hasOwnProperty.call(W,X)&&(f[X]=W[X])})(z,s)};function Ae(z,s){function f(){this.constructor=z}Ce(z,s),z.prototype=s===null?Object.create(s):(f.prototype=s.prototype,new f)}function Le(z,s,f,W){return new(f||(f=Promise))(function(X,H){function ve(ft){try{qe(W.next(ft))}catch(Ge){H(Ge)}}function He(ft){try{qe(W.throw(ft))}catch(Ge){H(Ge)}}function qe(ft){var Ge;ft.done?X(ft.value):(Ge=ft.value,Ge instanceof f?Ge:new f(function(Ct){Ct(Ge)})).then(ve,He)}qe((W=W.apply(z,s||[])).next())})}function be(z,s){var f,W,X,H,ve={label:0,sent:function(){if(1&X[0])throw X[1];return X[1]},trys:[],ops:[]};return H={next:He(0),throw:He(1),return:He(2)},typeof Symbol=="function"&&(H[Symbol.iterator]=function(){return this}),H;function He(qe){return function(ft){return function(Ge){if(f)throw new TypeError("Generator is already executing.");for(;ve;)try{if(f=1,W&&(X=2&Ge[0]?W.return:Ge[0]?W.throw||((X=W.return)&&X.call(W),0):W.next)&&!(X=X.call(W,Ge[1])).done)return X;switch(W=0,X&&(Ge=[2&Ge[0],X.value]),Ge[0]){case 0:case 1:X=Ge;break;case 4:return ve.label++,{value:Ge[1],done:!1};case 5:ve.label++,W=Ge[1],Ge=[0];continue;case 7:Ge=ve.ops.pop(),ve.trys.pop();continue;default:if(!(X=ve.trys,(X=X.length>0&&X[X.length-1])||Ge[0]!==6&&Ge[0]!==2)){ve=0;continue}if(Ge[0]===3&&(!X||Ge[1]>X[0]&&Ge[1]<X[3])){ve.label=Ge[1];break}if(Ge[0]===6&&ve.label<X[1]){ve.label=X[1],X=Ge;break}if(X&&ve.label<X[2]){ve.label=X[2],ve.ops.push(Ge);break}X[2]&&ve.ops.pop(),ve.trys.pop();continue}Ge=s.call(z,ve)}catch(Ct){Ge=[6,Ct],W=0}finally{f=X=0}if(5&Ge[0])throw Ge[1];return{value:Ge[0]?Ge[1]:void 0,done:!0}}([qe,ft])}}}function pe(){for(var z=0,s=0,f=arguments.length;s<f;s++)z+=arguments[s].length;var W=Array(z),X=0;for(s=0;s<f;s++)for(var H=arguments[s],ve=0,He=H.length;ve<He;ve++,X++)W[X]=H[ve];return W}var se=function(){function z(){}return z.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},z.setAttributes=function(s,f){for(var W=0,X=f;W<X.length;W++){var H=X[W],ve=H[0],He=H[1];s.setAttribute(ve,He)}},z.createRect=function(s,f,W){var X=document.createElementNS("http://www.w3.org/2000/svg","rect");return X.setAttribute("width",s.toString()),X.setAttribute("height",f.toString()),W&&z.setAttributes(X,W),X},z.createLine=function(s,f,W,X,H){var ve=document.createElementNS("http://www.w3.org/2000/svg","line");return ve.setAttribute("x1",s.toString()),ve.setAttribute("y1",f.toString()),ve.setAttribute("x2",W.toString()),ve.setAttribute("y2",X.toString()),H&&z.setAttributes(ve,H),ve},z.createPolygon=function(s,f){var W=document.createElementNS("http://www.w3.org/2000/svg","polygon");return W.setAttribute("points",s),f&&z.setAttributes(W,f),W},z.createCircle=function(s,f){var W=document.createElementNS("http://www.w3.org/2000/svg","circle");return W.setAttribute("cx",(s/2).toString()),W.setAttribute("cy",(s/2).toString()),W.setAttribute("r",s.toString()),f&&z.setAttributes(W,f),W},z.createEllipse=function(s,f,W){var X=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return X.setAttribute("cx",(s/2).toString()),X.setAttribute("cy",(f/2).toString()),X.setAttribute("rx",(s/2).toString()),X.setAttribute("ry",(f/2).toString()),W&&z.setAttributes(X,W),X},z.createGroup=function(s){var f=document.createElementNS("http://www.w3.org/2000/svg","g");return s&&z.setAttributes(f,s),f},z.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},z.createMarker=function(s,f,W,X,H,ve,He){var qe=document.createElementNS("http://www.w3.org/2000/svg","marker");return z.setAttributes(qe,[["id",s],["orient",f],["markerWidth",W.toString()],["markerHeight",X.toString()],["refX",H.toString()],["refY",ve.toString()]]),qe.appendChild(He),qe},z.createText=function(s){var f=document.createElementNS("http://www.w3.org/2000/svg","text");return f.setAttribute("x","0"),f.setAttribute("y","0"),s&&z.setAttributes(f,s),f},z.createTSpan=function(s,f){var W=document.createElementNS("http://www.w3.org/2000/svg","tspan");return W.textContent=s,f&&z.setAttributes(W,f),W},z.createImage=function(s){var f=document.createElementNS("http://www.w3.org/2000/svg","image");return s&&z.setAttributes(f,s),f},z.createPoint=function(s,f){var W=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return W.x=s,W.y=f,W},z.createPath=function(s,f){var W=document.createElementNS("http://www.w3.org/2000/svg","path");return W.setAttribute("d",s),f&&z.setAttributes(W,f),W},z}(),te=function(){function z(){}return z.addKey=function(s){z.key=s},Object.defineProperty(z,"isLicensed",{get:function(){return!!z.key&&new RegExp(/^MJS2-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(z.key)},enumerable:!1,configurable:!0}),z}(),ue=function(){function z(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return z.prototype.rasterize=function(s,f,W){var X=this;return new Promise(function(H){var ve=W!==void 0?W:document.createElement("canvas");s===null&&(X.markersOnly=!0,X.naturalSize=!1);var He=document.createElementNS("http://www.w3.org/2000/svg","svg");He.setAttribute("xmlns","http://www.w3.org/2000/svg"),He.setAttribute("width",f.width.baseVal.valueAsString),He.setAttribute("height",f.height.baseVal.valueAsString),He.setAttribute("viewBox","0 0 "+f.viewBox.baseVal.width.toString()+" "+f.viewBox.baseVal.height.toString()),He.innerHTML=f.innerHTML,X.naturalSize===!0?(He.width.baseVal.value=s.naturalWidth,He.height.baseVal.value=s.naturalHeight):X.width!==void 0&&X.height!==void 0&&(He.width.baseVal.value=X.width,He.height.baseVal.value=X.height),ve.width=He.width.baseVal.value,ve.height=He.height.baseVal.value;var qe=He.outerHTML,ft=ve.getContext("2d");X.markersOnly!==!0&&ft.drawImage(s,0,0,ve.width,ve.height);var Ge=window.URL,Ct=new Image(ve.width,ve.height);Ct.setAttribute("crossOrigin","anonymous");var Mt=new Blob([qe],{type:"image/svg+xml"}),Vt=Ge.createObjectURL(Mt);Ct.onload=function(){ft.drawImage(Ct,0,0),Ge.revokeObjectURL(Vt);var jr=ve.toDataURL(X.imageType,X.imageQuality);H(jr)},Ct.src=Vt})},z}(),ne=function(){},Te=function(){function z(s){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+s+"_"}return Object.defineProperty(z.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"defaultSettings",{get:function(){return{canvasBackgroundColor:"#ffffff",toolbarBackgroundColor:"#111111",toolbarBackgroundHoverColor:"#333333",toolbarColor:"#eeeeee",toolbarHeight:40,toolboxColor:"#eeeeee",toolboxAccentColor:"#3080c3",undoButtonVisible:!0,redoButtonVisible:!1,zoomButtonVisible:!1,zoomOutButtonVisible:!1,clearButtonVisible:!1,resultButtonBlockVisible:!0,logoPosition:"left"}},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"fade_out"},enumerable:!1,configurable:!0}),z.prototype.addClass=function(s){return this.styleSheet===void 0&&this.addStyleSheet(),s.name=""+this.classNamePrefix+s.localName,this.classes.push(s),this.styleSheet.sheet.insertRule("."+s.name+" {"+s.style+"}",this.styleSheet.sheet.cssRules.length),s},z.prototype.addRule=function(s){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(s),this.styleSheet.sheet.insertRule(s.selector+" {"+s.style+"}",this.styleSheet.sheet.cssRules.length)},z.prototype.addStyleSheet=function(){var s;this.styleSheet=document.createElement("style"),((s=this.styleSheetRoot)!==null&&s!==void 0?s:document.head).appendChild(this.styleSheet),this.addRule(new Re("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new Re("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new Re("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
from {
opacity: 1;
}
to {
opacity: 0;
}
`)),this.addClass(new xe("fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new xe("fade_out",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
`))},z.prototype.removeStyleSheet=function(){var s;this.styleSheet&&(((s=this.styleSheetRoot)!==null&&s!==void 0?s:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},z}(),Re=function(z,s){this.selector=z,this.style=s},xe=function(z,s){this.localName=z,this.style=s},Me=function(){function z(s,f,W,X,H){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=s,this.displayMode=f,this.markerItems=W,this.uiStyleSettings=X,this.styles=H,this.addStyles(),this.adjustLayout=this.adjustLayout.bind(this),this.overflowButtonClicked=this.overflowButtonClicked.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this)}return z.prototype.show=function(s){var f=this;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=s,this.uiContainer.className=this.toolbarStyleClass.name+" "+this.styles.fadeInAnimationClassName+" "+(this.uiStyleSettings.toolbarStyleColorsClassName?this.uiStyleSettings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name);var W=document.createElement("div");W.className=this.toolbarBlockStyleClass.name,W.style.whiteSpace="nowrap",this.uiContainer.appendChild(W),this.addActionButton(W,'<svg viewBox="0 0 24 24"><path d="M10.07 14.27a.997.997 0 011.33.48l2.3 4.99 1.8-.85-2.31-4.98c-.24-.5-.02-1.1.48-1.33l.28-.08 2.3-.45L8 5.12V15.9l1.82-1.47.25-.16m3.57 7.7a.99.99 0 01-1.33-.47l-2.18-4.74-2.51 2.02c-.17.14-.38.22-.62.22a1 1 0 01-1-1V3a1 1 0 011-1c.24 0 .47.09.64.23l.01-.01 11.49 9.64a1.001 1.001 0 01-.44 1.75l-3.16.62 2.2 4.73c.26.5.02 1.09-.48 1.32l-3.62 1.69z"/></svg>',"select"),this.addActionButton(W,'<svg viewBox="0 0 24 24"><path d="M9 3v1H4v2h1v13a2 2 0 002 2h10a2 2 0 002-2V6h1V4h-5V3H9M7 6h10v13H7V6m2 2v9h2V8H9m4 0v9h2V8h-2z"/></svg>',"delete"),this.uiStyleSettings.clearButtonVisible&&this.addActionButton(W,'<svg viewBox="0 0 24 24"><path d="M19.36 2.72l1.42 1.42-5.72 5.71c1.07 1.54 1.22 3.39.32 4.59L9.06 8.12c1.2-.9 3.05-.75 4.59.32l5.71-5.72M5.93 17.57c-2.01-2.01-3.24-4.41-3.58-6.65l4.88-2.09 7.44 7.44-2.09 4.88c-2.24-.34-4.64-1.57-6.65-3.58z"/></svg>',"clear"),this.uiStyleSettings.undoButtonVisible&&this.addActionButton(W,'<svg viewBox="0 0 24 24"><path d="M12.5 8c-2.65 0-5.05 1-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8z"/></svg>',"undo"),this.uiStyleSettings.redoButtonVisible&&this.addActionButton(W,'<svg viewBox="0 0 24 24"><path d="M18.4 10.6C16.55 9 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16a8.002 8.002 0 017.6-5.5c1.95 0 3.73.72 5.12 1.88L13 16h9V7l-3.6 3.6z"/></svg>',"redo"),this.uiStyleSettings.zoomButtonVisible&&this.addActionButton(W,'<svg viewBox="0 0 24 24"><path d="M15.5 14l5 5-1.5 1.5-5-5v-.79l-.27-.28A6.471 6.471 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3 6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.57 4.23l.28.27h.79m-6 0C12 14 14 12 14 9.5S12 5 9.5 5 5 7 5 9.5 7 14 9.5 14m2.5-4h-2v2H9v-2H7V9h2V7h1v2h2v1z"/></svg>',"zoom"),this.uiStyleSettings.zoomButtonVisible&&this.uiStyleSettings.zoomOutButtonVisible&&this.addActionButton(W,'<svg viewBox="0 0 24 24"><path d="M15.5 14h-.79l-.28-.27A6.471 6.471 0 0016 9.5 6.5 6.5 0 009.5 3 6.5 6.5 0 003 9.5 6.5 6.5 0 009.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 5 1.5-1.5-5-5m-6 0C7 14 5 12 5 9.5S7 5 9.5 5 14 7 14 9.5 12 14 9.5 14M7 9h5v1H7V9z"/></svg>',"zoom-out"),this.uiStyleSettings.notesButtonVisible&&this.addActionButton(W,'<svg viewBox="0 0 24 24"><path d="M18.13 12l1.26-1.26c.44-.44 1-.68 1.61-.74V9l-6-6H5c-1.11 0-2 .89-2 2v14a2 2 0 002 2h6v-1.87l.13-.13H5V5h7v7h6.13M14 4.5l5.5 5.5H14V4.5m5.13 9.33l2.04 2.04L15.04 22H13v-2.04l6.13-6.13m3.72.36l-.98.98-2.04-2.04.98-.98c.19-.2.52-.2.72 0l1.32 1.32c.2.2.2.53 0 .72z"/></svg>',"notes"),this.markerButtonBlock=document.createElement("div"),this.markerButtonBlock.className=this.toolbarBlockStyleClass.name,this.markerButtonBlock.style.flexGrow="2",this.markerButtonBlock.style.textAlign="center",this.uiContainer.appendChild(this.markerButtonBlock),this.markerButtonOverflowBlock=document.createElement("div"),this.markerButtonOverflowBlock.className=this.toolbarOverflowBlockStyleClass.name+" "+(this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName?this.uiStyleSettings.toolbarOverflowBlockStyleColorsClassName:this.toolbarOverflowBlockStyleColorsClass.name),this.markerButtonOverflowBlock.style.display="none",this.uiContainer.appendChild(this.markerButtonOverflowBlock),this.markerItems&&(this.markerItems.forEach(function(H){var ve=document.createElement("div");ve.className=""+f.toolbarButtonStyleClass.name,ve.setAttribute("data-type-name",H.typeName),ve.innerHTML=H.icon,ve.addEventListener("click",function(){f.markerToolbarButtonClicked(ve,H)}),f.buttons.push(ve),f.markerButtons.push(ve)}),this.overflowButton=document.createElement("div"),this.overflowButton.className=this.toolbarButtonStyleClass.name+" "+(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name),this.overflowButton.innerHTML='<svg viewBox="0 0 24 24"><path d="M12 16a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2z"/></svg>',this.overflowButton.addEventListener("click",this.overflowButtonClicked),this.markerButtonBlock.appendChild(this.overflowButton));var X=document.createElement("div");X.className=this.toolbarBlockStyleClass.name,X.style.whiteSpace="nowrap",X.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(X),this.addActionButton(X,'<svg viewBox="0 0 24 24"><path d="M9 20.42l-6.21-6.21 2.83-2.83L9 14.77l9.88-9.89 2.83 2.83L9 20.42z"/></svg>',"render"),this.addActionButton(X,'<svg viewBox="0 0 24 24"><path d="M20 6.91L17.09 4 12 9.09 6.91 4 4 6.91 9.09 12 4 17.09 6.91 20 12 14.91 17.09 20 20 17.09 14.91 12 20 6.91z"/></svg>',"close"),this.markerjsContainer.appendChild(this.uiContainer),this.setSelectMode(),this.setCurrentMarker(),this.adjustLayout()},z.prototype.addButtonClickListener=function(s){this.buttonClickListeners.push(s)},z.prototype.removeButtonClickListener=function(s){this.buttonClickListeners.indexOf(s)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(s),1)},z.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},z.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var s=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var f=0;f<this.markerButtons.length;f++)f<s||f===s&&this.markerButtons.length-1===s?this.markerButtonBlock.appendChild(this.markerButtons[f]):(f===s&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[f]))}},z.prototype.overflowButtonClicked=function(){this.markerButtonOverflowBlock.style.display!=="none"?(this.markerButtonOverflowBlock.className=this.markerButtonOverflowBlock.className.replace(this.styles.fadeInAnimationClassName,""),this.markerButtonOverflowBlock.style.display="none"):(this.markerButtonOverflowBlock.className+=" "+this.styles.fadeInAnimationClassName,this.markerButtonOverflowBlock.style.top=this.uiContainer.offsetTop+this.overflowButton.offsetHeight+"px",this.markerButtonOverflowBlock.style.right=this.uiContainer.offsetWidth-this.overflowButton.offsetLeft-this.overflowButton.offsetWidth+2*this.uiContainer.offsetLeft+"px",this.markerButtonOverflowBlock.style.display="inline-block")},z.prototype.resetButtonStyles=function(){var s=this;this.buttons.forEach(function(f){f.className=f.className.replace(s.uiStyleSettings.toolbarButtonStyleColorsClassName?s.uiStyleSettings.toolbarButtonStyleColorsClassName:s.toolbarButtonStyleColorsClass.name,"").trim(),f.className=f.className.replace(s.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?s.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:s.toolbarActiveButtonStyleColorsClass.name,"").trim(),f.className+=" "+(s.uiStyleSettings.toolbarButtonStyleColorsClassName?s.uiStyleSettings.toolbarButtonStyleColorsClassName:s.toolbarButtonStyleColorsClass.name)})},z.prototype.addActionButton=function(s,f,W){var X=this,H=document.createElement("div");switch(H.className=""+this.toolbarButtonStyleClass.name,H.innerHTML=f,H.setAttribute("data-action",W),H.addEventListener("click",function(){X.actionToolbarButtonClicked(H,W)}),W){case"select":H.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":H.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"undo":case"redo":H.style.fill=this.uiStyleSettings.selectButtonColor;break;case"render":H.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":H.style.fill=this.uiStyleSettings.closeButtonColor}s.appendChild(H),this.buttons.push(H)},z.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new xe("toolbar",`
width: 100%;
flex-shrink: 0;
display: flex;
flex-direction: row;
justify-content: space-between;
height: `+this.uiStyleSettings.toolbarHeight+`px;
box-sizing: content-box;
`+(this.displayMode==="inline"?"border-top-left-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
`+(this.displayMode==="inline"?"border-top-right-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
overflow: hidden;
`)),this.toolbarStyleColorsClass=this.styles.addClass(new xe("toolbar_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
box-shadow: 0px 3px rgba(33, 33, 33, 0.1);
`)),this.toolbarBlockStyleClass=this.styles.addClass(new xe("toolbar-block",`
display: inline-block;
box-sizing: content-box;
`)),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new xe("toolbar-overflow-block",`
position: absolute;
top: `+this.uiStyleSettings.toolbarHeight+`px;
max-width: `+2*this.uiStyleSettings.toolbarHeight+`px;
z-index: 10;
box-sizing: content-box;
`)),this.toolbarOverflowBlockStyleColorsClass=this.styles.addClass(new xe("toolbar-overflow-block_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`));var s=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new xe("toolbar_button",`
display: inline-block;
width: `+(this.uiStyleSettings.toolbarHeight-2*s)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*s)+`px;
padding: `+s+`px;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new xe("toolbar_button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new xe("toolbar_active_button",`
fill: `+this.uiStyleSettings.toolbarColor+`;
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new Re("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`)),this.styles.addRule(new Re("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`))},z.prototype.markerToolbarButtonClicked=function(s,f){this.setActiveButton(s),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(W){return W("marker",f)}),this.markerButtonOverflowBlock.style.display="none"},z.prototype.actionToolbarButtonClicked=function(s,f){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(W){return W("action",f)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},z.prototype.setActiveButton=function(s){this.resetButtonStyles(),s.className=s.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),s.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},z.prototype.setActiveMarkerButton=function(s){var f=this.markerButtons.find(function(W){return W.getAttribute("data-type-name")===s});f&&this.setActiveButton(f)},z.prototype.setCurrentMarker=function(s){var f=this;this.currentMarker=s,this.buttons.filter(function(W){return/delete|notes/.test(W.getAttribute("data-action"))}).forEach(function(W){f.currentMarker===void 0?(W.style.fillOpacity="0.4",W.style.pointerEvents="none"):(W.style.fillOpacity="1",W.style.pointerEvents="all")})},z}(),Pe=function(){function z(s,f,W,X){this.panels=[],this.panelButtons=[],this.markerjsContainer=s,this.displayMode=f,this.uiStyleSettings=W,this.styles=X,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return z.prototype.addStyles=function(){var s;this.toolboxStyleClass=this.styles.addClass(new xe("toolbox",`
width: 100%;
flex-shrink: 0;
display: flex;
flex-direction: column;
font-family: sans-serif;
`+(this.displayMode==="popup"?"height:"+2.5*this.uiStyleSettings.toolbarHeight+"px;":"")+`
box-sizing: content-box;
`+(this.displayMode==="popup"?"background-color: "+this.uiStyleSettings.canvasBackgroundColor+";":"")+`
`+(this.displayMode==="inline"?"border-bottom-left-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
`+(this.displayMode==="inline"?"border-bottom-right-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
overflow: hidden;
`)),this.toolboxStyleColorsClass=this.styles.addClass(new xe("toolbox_colors",`
color: `+this.uiStyleSettings.toolboxColor+`;
`));var f=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new xe("toolbox-button-row",`
display: flex;
cursor: default;
box-sizing: content-box;
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new xe("toolbox-button-row_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new xe("toolbox-panel-row",`
display: flex;
`+(this.displayMode==="inline"?"position: absolute;":"")+`
`+(this.displayMode==="inline"?"bottom: "+this.uiStyleSettings.toolbarHeight+"px;":"")+`
cursor: default;
height: `+1.5*this.uiStyleSettings.toolbarHeight+`px;
`+(this.displayMode==="inline"?"width: 100%;":"")+`
box-sizing: content-box;
`)),this.toolboxPanelRowStyleColorsClass=this.styles.addClass(new xe("toolbox-panel-row_colors",`
background-color: `+((s=this.uiStyleSettings.toolboxBackgroundColor)!==null&&s!==void 0?s:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
`)),this.toolboxButtonStyleClass=this.styles.addClass(new xe("toolbox_button",`
display: inline-block;
width: `+(this.uiStyleSettings.toolbarHeight-2*f)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*f)+`px;
padding: `+f+`px;
box-sizing: content-box;
`)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new xe("toolbox-button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new xe("toolbox-active-button_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.styles.addRule(new Re("."+this.toolboxButtonStyleColorsClass.name+":hover",`
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
`)),this.styles.addRule(new Re("."+this.toolboxButtonStyleClass.name+" svg",`
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
`))},z.prototype.show=function(s){var f;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=s,this.uiContainer.className=this.toolboxStyleClass.name+" "+((f=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&f!==void 0?f:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},z.prototype.setPanelButtons=function(s){var f,W,X=this;this.panels=s,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((f=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&f!==void 0?f:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((W=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&W!==void 0?W:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(H){var ve;H.uiStyleSettings=X.uiStyleSettings;var He=document.createElement("div");He.className=X.toolboxButtonStyleClass.name+" "+((ve=X.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&ve!==void 0?ve:X.toolboxButtonStyleColorsClass.name),He.innerHTML=H.icon,He.title=H.title,He.addEventListener("click",function(){X.panelButtonClick(H)}),X.panelButtons.push(He),X.buttonRow.appendChild(He)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},z.prototype.panelButtonClick=function(s){var f=this,W=-1;if(s!==this.activePanel){W=this.panels.indexOf(s),this.panelRow.innerHTML="";var X=s.getUi();X.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(X),this.panelRow.style.display="flex",this.panelRow.style.visibility="visible",this.panelRow.className=this.panelRow.className.replace(this.styles.fadeOutAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeInAnimationClassName,this.activePanel=s}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){f.displayMode==="inline"?f.panelRow.style.display="none":f.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(H,ve){var He,qe;H.className=f.toolboxButtonStyleClass.name+" "+(ve===W?""+((He=f.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&He!==void 0?He:f.toolboxActiveButtonStyleColorsClass.name):""+((qe=f.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&qe!==void 0?qe:f.toolboxButtonStyleColorsClass.name))})},z}(),je=function(z,s){this.title=z,this.icon=s},Ue=function(z){function s(f,W,X,H){var ve=z.call(this,f,H||'<svg viewBox="0 0 24 24"><path d="M17.5 12a1.5 1.5 0 01-1.5-1.5A1.5 1.5 0 0117.5 9a1.5 1.5 0 011.5 1.5 1.5 1.5 0 01-1.5 1.5m-3-4A1.5 1.5 0 0113 6.5 1.5 1.5 0 0114.5 5 1.5 1.5 0 0116 6.5 1.5 1.5 0 0114.5 8m-5 0A1.5 1.5 0 018 6.5 1.5 1.5 0 019.5 5 1.5 1.5 0 0111 6.5 1.5 1.5 0 019.5 8m-3 4A1.5 1.5 0 015 10.5 1.5 1.5 0 016.5 9 1.5 1.5 0 018 10.5 1.5 1.5 0 016.5 12M12 3a9 9 0 00-9 9 9 9 0 009 9 1.5 1.5 0 001.5-1.5c0-.39-.15-.74-.39-1-.23-.27-.38-.62-.38-1a1.5 1.5 0 011.5-1.5H16a5 5 0 005-5c0-4.42-4.03-8-9-8z"/></svg>')||this;return ve.colors=[],ve.addTransparent=!1,ve.colorBoxes=[],ve.colors=W,ve.currentColor=X,ve.setCurrentColor=ve.setCurrentColor.bind(ve),ve.getColorBox=ve.getColorBox.bind(ve),ve}return Ae(s,z),s.prototype.getUi=function(){var f=this,W=document.createElement("div");return W.style.overflow="hidden",W.style.whiteSpace="nowrap",this.colors.forEach(function(X){var H=f.getColorBox(X);W.appendChild(H),f.colorBoxes.push(H)}),W},s.prototype.getColorBox=function(f){var W=this,X=this.uiStyleSettings.toolbarHeight/4,H=this.uiStyleSettings.toolbarHeight-X,ve=document.createElement("div");ve.style.display="inline-block",ve.style.boxSizing="content-box",ve.style.width=H-2+"px",ve.style.height=H-2+"px",ve.style.padding="1px",ve.style.marginRight="2px",ve.style.marginBottom="2px",ve.style.borderWidth="2px",ve.style.borderStyle="solid",ve.style.borderRadius=(H+2)/2+"px",ve.style.borderColor=f===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",ve.addEventListener("click",function(){W.setCurrentColor(f,ve)});var He=document.createElement("div");return He.style.display="inline-block",He.style.width=H-2+"px",He.style.height=H-2+"px",He.style.backgroundColor=f,He.style.borderRadius=H/2+"px",f==="transparent"&&(He.style.fill=this.uiStyleSettings.toolboxAccentColor,He.innerHTML=`<svg viewBox="0 0 24 24">
<path d="M2,5.27L3.28,4L20,20.72L18.73,22L15.65,18.92C14.5,19.3 13.28,19.5 12,19.5C7,19.5 2.73,16.39 1,12C1.69,10.24 2.79,8.69 4.19,7.46L2,5.27M12,9A3,3 0 0,1 15,12C15,12.35 14.94,12.69 14.83,13L11,9.17C11.31,9.06 11.65,9 12,9M12,4.5C17,4.5 21.27,7.61 23,12C22.18,14.08 20.79,15.88 19,17.19L17.58,15.76C18.94,14.82 20.06,13.54 20.82,12C19.17,8.64 15.76,6.5 12,6.5C10.91,6.5 9.84,6.68 8.84,7L7.3,5.47C8.74,4.85 10.33,4.5 12,4.5M3.18,12C4.83,15.36 8.24,17.5 12,17.5C12.69,17.5 13.37,17.43 14,17.29L11.72,15C10.29,14.85 9.15,13.71 9,12.28L5.6,8.87C4.61,9.72 3.78,10.78 3.18,12Z" />
</svg>`),ve.appendChild(He),ve},s.prototype.setCurrentColor=function(f,W){var X=this;this.currentColor=f,this.colorBoxes.forEach(function(H){H.style.borderColor=H===W?X.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(f)},s}(je),Ne=function(){function z(s,f,W){this._state="new",this._isSelected=!1,this._container=s,this._overlayContainer=f,this.globalSettings=W,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(z.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),z.prototype.ownsTarget=function(s){return!1},Object.defineProperty(z.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),z.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},z.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},z.prototype.pointerDown=function(s,f){},z.prototype.dblClick=function(s,f){},z.prototype.manipulate=function(s){},z.prototype.pointerUp=function(s){this.stateChanged()},z.prototype.dispose=function(){},z.prototype.addMarkerVisualToContainer=function(s){this.container.childNodes.length>0?this.container.insertBefore(s,this.container.childNodes[0]):this.container.appendChild(s)},z.prototype.getState=function(){return{typeName:z.typeName,state:this.state,notes:this.notes}},z.prototype.restoreState=function(s){this._state=s.state,this.notes=s.notes},z.prototype.scale=function(s,f){},z.prototype.colorChanged=function(s){this.onColorChanged&&this.onColorChanged(s),this.stateChanged()},z.prototype.fillColorChanged=function(s){this.onFillColorChanged&&this.onFillColorChanged(s),this.stateChanged()},z.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var s=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),s.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(s)&&this.onStateChanged(this)}},z.typeName="MarkerBase",z}(),Ie=function(){function z(){this.findGripByVisual=this.findGripByVisual.bind(this)}return z.prototype.findGripByVisual=function(s){return this.topLeft.ownsTarget(s)?this.topLeft:this.topCenter.ownsTarget(s)?this.topCenter:this.topRight.ownsTarget(s)?this.topRight:this.centerLeft.ownsTarget(s)?this.centerLeft:this.centerRight.ownsTarget(s)?this.centerRight:this.bottomLeft.ownsTarget(s)?this.bottomLeft:this.bottomCenter.ownsTarget(s)?this.bottomCenter:this.bottomRight.ownsTarget(s)?this.bottomRight:void 0},z}(),Qe=function(){function z(){this.GRIP_SIZE=10,this.visual=se.createGroup(),this.visual.appendChild(se.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(se.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return z.prototype.ownsTarget=function(s){return s===this.visual||s===this.visual.childNodes[0]||s===this.visual.childNodes[1]},z}(),rt=function(){function z(){}return z.toITransformMatrix=function(s){return{a:s.a,b:s.b,c:s.c,d:s.d,e:s.e,f:s.f}},z.toSVGMatrix=function(s,f){return s.a=f.a,s.b=f.b,s.c=f.c,s.d=f.d,s.e=f.e,s.f=f.f,s},z}(),et=function(z){function s(f,W,X){var H=z.call(this,f,W,X)||this;return H.left=0,H.top=0,H.width=0,H.height=0,H.defaultSize={x:50,y:20},H.offsetX=0,H.offsetY=0,H.rotationAngle=0,H.CB_DISTANCE=10,H._suppressMarkerCreateEvent=!1,H.container.transform.baseVal.appendItem(se.createTransform()),H.setupControlBox(),H}return Ae(s,z),Object.defineProperty(s.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"visual",{get:function(){return this._visual},set:function(f){this._visual=f;var W=se.createTransform();this._visual.transform.baseVal.appendItem(W)},enumerable:!1,configurable:!0}),s.prototype.ownsTarget=function(f){return!!z.prototype.ownsTarget.call(this,f)||!!(this.controlGrips.findGripByVisual(f)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(f))},s.prototype.pointerDown=function(f,W){z.prototype.pointerDown.call(this,f,W),this.state==="new"&&(this.left=f.x,this.top=f.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var X=this.unrotatePoint(f);if(this.manipulationStartX=X.x,this.manipulationStartY=X.y,this.offsetX=X.x-this.left,this.offsetY=X.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(W),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(W)){this.activeGrip=this.rotatorGrip;var H=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=H.x-this.width/2,this.top=H.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var ve=this.container.transform.baseVal.getItem(0);ve.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(ve,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},s.prototype.pointerUp=function(f){var W=this.state;z.prototype.pointerUp.call(this,f),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(f),this._state="select",W==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},s.prototype.moveVisual=function(f){this.visual.style.transform="translate("+f.x+"px, "+f.y+"px)"},s.prototype.manipulate=function(f){var W=this.unrotatePoint(f);this.state==="creating"?this.resize(f):this.state==="move"?(this.left=this.manipulationStartLeft+(W.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(W.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(W):this.state==="rotate"&&this.rotate(f)},s.prototype.resize=function(f){var W=this.manipulationStartLeft,X=this.manipulationStartWidth,H=this.manipulationStartTop,ve=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:W=this.manipulationStartLeft+f.x-this.manipulationStartX,X=this.manipulationStartWidth+this.manipulationStartLeft-W;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:X=this.manipulationStartWidth+f.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:H=this.manipulationStartTop+f.y-this.manipulationStartY,ve=this.manipulationStartHeight+this.manipulationStartTop-H;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:ve=this.manipulationStartHeight+f.y-this.manipulationStartY}X>=0?(this.left=W,this.width=X):(this.left=W+X,this.width=-X),ve>=0?(this.top=H,this.height=ve):(this.top=H+ve,this.height=-ve),this.setSize()},s.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},s.prototype.rotate=function(f){if(Math.abs(f.x-this.centerX)>.1){var W=Math.sign(f.x-this.centerX);this.rotationAngle=180*Math.atan((f.y-this.centerY)/(f.x-this.centerX))/Math.PI+90*W,this.applyRotation()}},s.prototype.applyRotation=function(){var f=this.container.transform.baseVal.getItem(0);f.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(f,0)},s.prototype.rotatePoint=function(f){if(this.rotationAngle===0)return f;var W=this.container.getCTM(),X=se.createPoint(f.x,f.y);return{x:(X=X.matrixTransform(W)).x,y:X.y}},s.prototype.unrotatePoint=function(f){if(this.rotationAngle===0)return f;var W=this.container.getCTM();W=W.inverse();var X=se.createPoint(f.x,f.y);return{x:(X=X.matrixTransform(W)).x,y:X.y}},s.prototype.select=function(){z.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},s.prototype.deselect=function(){z.prototype.deselect.call(this),this.controlBox.style.display="none"},s.prototype.setupControlBox=function(){this.controlBox=se.createGroup();var f=se.createTransform();f.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(f),this.container.appendChild(this.controlBox),this.controlRect=se.createRect(this.width+this.CB_DISTANCE,this.height+this.CB_DISTANCE,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"],["fill","transparent"],["pointer-events","none"]]),this.controlBox.appendChild(this.controlRect),this.globalSettings.disableRotation!==!0&&(this.rotatorGripLine=se.createLine((this.width+2*this.CB_DISTANCE)/2,this.top-this.CB_DISTANCE,(this.width+2*this.CB_DISTANCE)/2,this.top-3*this.CB_DISTANCE,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.appendChild(this.rotatorGripLine)),this.controlGrips=new Ie,this.addControlGrips(),this.controlBox.style.display="none"},s.prototype.adjustControlBox=function(){var f=this.controlBox.transform.baseVal.getItem(0);f.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(f,0),this.controlRect.setAttribute("width",(this.width+this.CB_DISTANCE).toString()),this.controlRect.setAttribute("height",(this.height+this.CB_DISTANCE).toString()),this.rotatorGripLine!==void 0&&(this.rotatorGripLine.setAttribute("x1",((this.width+this.CB_DISTANCE)/2).toString()),this.rotatorGripLine.setAttribute("y1",(-this.CB_DISTANCE/2).toString()),this.rotatorGripLine.setAttribute("x2",((this.width+this.CB_DISTANCE)/2).toString()),this.rotatorGripLine.setAttribute("y2",(3*-this.CB_DISTANCE).toString())),this.positionGrips()},s.prototype.addControlGrips=function(){this.controlGrips.topLeft=this.createGrip(),this.controlGrips.topCenter=this.createGrip(),this.controlGrips.topRight=this.createGrip(),this.controlGrips.centerLeft=this.createGrip(),this.controlGrips.centerRight=this.createGrip(),this.controlGrips.bottomLeft=this.createGrip(),this.controlGrips.bottomCenter=this.createGrip(),this.controlGrips.bottomRight=this.createGrip(),this.globalSettings.disableRotation!==!0&&(this.rotatorGrip=this.createGrip()),this.positionGrips()},s.prototype.createGrip=function(){var f=new Qe;return f.visual.transform.baseVal.appendItem(se.createTransform()),this.controlBox.appendChild(f.visual),f},s.prototype.positionGrips=function(){var f=this.controlGrips.topLeft.GRIP_SIZE,W=-f/2,X=W,H=(this.width+this.CB_DISTANCE)/2-f/2,ve=(this.height+this.CB_DISTANCE)/2-f/2,He=this.height+this.CB_DISTANCE-f/2,qe=this.width+this.CB_DISTANCE-f/2;this.positionGrip(this.controlGrips.topLeft.visual,W,X),this.positionGrip(this.controlGrips.topCenter.visual,H,X),this.positionGrip(this.controlGrips.topRight.visual,qe,X),this.positionGrip(this.controlGrips.centerLeft.visual,W,ve),this.positionGrip(this.controlGrips.centerRight.visual,qe,ve),this.positionGrip(this.controlGrips.bottomLeft.visual,W,He),this.positionGrip(this.controlGrips.bottomCenter.visual,H,He),this.positionGrip(this.controlGrips.bottomRight.visual,qe,He),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,H,X-3*this.CB_DISTANCE)},s.prototype.positionGrip=function(f,W,X){var H=f.transform.baseVal.getItem(0);H.setTranslate(W,X),f.transform.baseVal.replaceItem(H,0)},s.prototype.hideControlBox=function(){this.controlBox.style.display="none"},s.prototype.showControlBox=function(){this.controlBox.style.display=""},s.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:rt.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:rt.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},z.prototype.getState.call(this))},s.prototype.restoreState=function(f){z.prototype.restoreState.call(this,f);var W=f;this.left=W.left,this.top=W.top,this.width=W.width,this.height=W.height,this.rotationAngle=W.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(rt.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,W.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(rt.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,W.containerTransformMatrix))},s.prototype.scale=function(f,W){z.prototype.scale.call(this,f,W);var X=this.rotatePoint({x:this.left,y:this.top}),H=this.unrotatePoint({x:X.x*f,y:X.y*W});this.left=H.x,this.top=H.y,this.width=this.width*f,this.height=this.height*W,this.adjustControlBox()},s}(Ne),Je=function(z){function s(f,W,X){var H=z.call(this,f,W,X)||this;return H.fillColor="transparent",H.strokeColor="transparent",H.strokeWidth=0,H.strokeDasharray="",H.opacity=1,H.setStrokeColor=H.setStrokeColor.bind(H),H.setFillColor=H.setFillColor.bind(H),H.setStrokeWidth=H.setStrokeWidth.bind(H),H.setStrokeDasharray=H.setStrokeDasharray.bind(H),H.createVisual=H.createVisual.bind(H),H}return Ae(s,z),s.prototype.ownsTarget=function(f){return!(!z.prototype.ownsTarget.call(this,f)&&f!==this.visual)},s.prototype.createVisual=function(){this.visual=se.createRect(1,1,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},s.prototype.pointerDown=function(f,W){z.prototype.pointerDown.call(this,f,W),this.state==="new"&&(this.createVisual(),this.moveVisual(f),this._state="creating")},s.prototype.manipulate=function(f){z.prototype.manipulate.call(this,f)},s.prototype.resize=function(f){z.prototype.resize.call(this,f),this.setSize()},s.prototype.setSize=function(){z.prototype.setSize.call(this),se.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},s.prototype.pointerUp=function(f){z.prototype.pointerUp.call(this,f),this.setSize()},s.prototype.setStrokeColor=function(f){this.strokeColor=f,this.visual&&se.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(f),this.stateChanged()},s.prototype.setFillColor=function(f){this.fillColor=f,this.visual&&se.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},s.prototype.setStrokeWidth=function(f){this.strokeWidth=f,this.visual&&se.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},s.prototype.setStrokeDasharray=function(f){this.strokeDasharray=f,this.visual&&se.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},s.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},z.prototype.getState.call(this))},s.prototype.restoreState=function(f){var W=f;this.fillColor=W.fillColor,this.strokeColor=W.strokeColor,this.strokeWidth=W.strokeWidth,this.strokeDasharray=W.strokeDasharray,this.opacity=W.opacity,this.createVisual(),z.prototype.restoreState.call(this,f),this.setSize()},s.prototype.scale=function(f,W){z.prototype.scale.call(this,f,W),this.setSize()},s.title="Rectangle marker",s}(et),st=function(z){function s(f,W,X,H){var ve=z.call(this,f,H||'<svg viewBox="0 0 24 24"><path d="M3 17h18v-2H3v2m0 3h18v-1H3v1m0-7h18v-3H3v3m0-9v4h18V4H3z"/></svg>')||this;return ve.widths=[],ve.widthBoxes=[],ve.widths=W,ve.currentWidth=X,ve.setCurrentWidth=ve.setCurrentWidth.bind(ve),ve}return Ae(s,z),s.prototype.getUi=function(){var f=this,W=document.createElement("div");return W.style.display="flex",W.style.overflow="hidden",W.style.flexGrow="2",this.widths.forEach(function(X){var H=document.createElement("div");H.style.display="flex",H.style.flexGrow="2",H.style.alignItems="center",H.style.justifyContent="space-between",H.style.padding="5px",H.style.borderWidth="2px",H.style.borderStyle="solid",H.style.borderColor=X===f.currentWidth?f.uiStyleSettings.toolboxAccentColor:"transparent",H.addEventListener("click",function(){f.setCurrentWidth(X,H)}),W.appendChild(H);var ve=document.createElement("div");ve.innerText=X.toString(),ve.style.marginRight="5px",H.appendChild(ve);var He=document.createElement("div");He.style.minHeight="20px",He.style.flexGrow="2",He.style.display="flex",He.style.alignItems="center";var qe=document.createElement("hr");qe.style.minWidth="20px",qe.style.border="0px",qe.style.borderTop=X+"px solid "+f.uiStyleSettings.toolboxColor,qe.style.flexGrow="2",He.appendChild(qe),H.appendChild(He),f.widthBoxes.push(H)}),W},s.prototype.setCurrentWidth=function(f,W){var X=this;this.currentWidth=f,this.widthBoxes.forEach(function(H){H.style.borderColor=H===W?X.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},s}(je),Ye=function(z){function s(f,W,X,H){var ve=z.call(this,f,H||'<svg viewBox="0 0 24 24"><path d="M3 16h5v-2H3v2m6.5 0h5v-2h-5v2m6.5 0h5v-2h-5v2M3 20h2v-2H3v2m4 0h2v-2H7v2m4 0h2v-2h-2v2m4 0h2v-2h-2v2m4 0h2v-2h-2v2M3 12h8v-2H3v2m10 0h8v-2h-8v2M3 4v4h18V4H3z"/></svg>')||this;return ve.styles=[],ve.styleBoxes=[],ve.styles=W,ve.currentStyle=X,ve.setCurrentStyle=ve.setCurrentStyle.bind(ve),ve}return Ae(s,z),s.prototype.getUi=function(){var f=this,W=document.createElement("div");return W.style.display="flex",W.style.overflow="hidden",W.style.flexGrow="2",this.styles.forEach(function(X){var H=document.createElement("div");H.style.display="flex",H.style.alignItems="center",H.style.justifyContent="space-between",H.style.padding="5px",H.style.borderWidth="2px",H.style.borderStyle="solid",H.style.overflow="hidden",H.style.maxWidth=100/f.styles.length-5+"%",H.style.borderColor=X===f.currentStyle?f.uiStyleSettings.toolboxAccentColor:"transparent",H.addEventListener("click",function(){f.setCurrentStyle(X,H)}),W.appendChild(H);var ve=document.createElement("div");ve.style.minHeight="20px",ve.style.flexGrow="2",ve.style.overflow="hidden";var He=`<svg width="100" height="20">
<line x1="0" y1="10" x2="100" y2="10" stroke="`+f.uiStyleSettings.toolboxColor+'" stroke-width="3" '+(X!==""?'stroke-dasharray="'+X+'"':"")+` />
</svg>`;ve.innerHTML=He,H.appendChild(ve),f.styleBoxes.push(H)}),W},s.prototype.setCurrentStyle=function(f,W){var X=this;this.currentStyle=f,this.styleBoxes.forEach(function(H){H.style.borderColor=H===W?X.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},s}(je),Xe=function(z){function s(f,W,X){var H=z.call(this,f,W,X)||this;return H.strokeColor=X.defaultColor,H.strokeWidth=X.defaultStrokeWidth,H.strokeDasharray=X.defaultStrokeDasharray,H.strokePanel=new Ue("Line color",X.defaultColorSet,X.defaultColor),H.strokePanel.onColorChanged=H.setStrokeColor,H.strokeWidthPanel=new st("Line width",X.defaultStrokeWidths,X.defaultStrokeWidth),H.strokeWidthPanel.onWidthChanged=H.setStrokeWidth,H.strokeStylePanel=new Ye("Line style",X.defaultStrokeDasharrays,X.defaultStrokeDasharray),H.strokeStylePanel.onStyleChanged=H.setStrokeDasharray,H}return Ae(s,z),Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var f=z.prototype.getState.call(this);return f.typeName=s.typeName,f},s.typeName="FrameMarker",s.title="Frame marker",s.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',s}(Je),_e=function(){this.defaultColorSet=["#EF4444","#10B981","#2563EB","#FFFF00","#7C3AED","#F472B6","#000000","#FFFFFF"],this.defaultColor=this.defaultColorSet[0],this.defaultFillColor=this.defaultColorSet[0],this.defaultStrokeColor=this.defaultColorSet[7],this.defaultHighlightColor=this.defaultColorSet[3],this.defaultStrokeWidth=3,this.defaultStrokeDasharray="",this.defaultHighlightOpacity=.5,this.defaultFontFamily="Helvetica, Arial, sans-serif",this.defaultStrokeWidths=[1,2,3,5,10],this.defaultStrokeDasharrays=["","3","12 3","9 6 3 6"],this.defaultOpacitySteps=[.1,.25,.5,.75,1],this.displayMode="inline",this.defaultFontFamilies=['Times, "Times New Roman", serif',"Helvetica, Arial, sans-serif",'Courier, "Courier New", monospace',"cursive","fantasy"],this.popupMargin=30,this.newFreehandMarkerOnPointerUp=!1,this.defaultColorsFollowCurrentColors=!1,this.freehandPixelRatio=1,this.disableRotation=!1},ot=function(z){function s(f,W,X){var H=z.call(this,f,W,X)||this;return H.x1=0,H.y1=0,H.x2=0,H.y2=0,H.defaultLength=50,H.manipulationStartX=0,H.manipulationStartY=0,H.manipulationStartX1=0,H.manipulationStartY1=0,H.manipulationStartX2=0,H.manipulationStartY2=0,H.setupControlBox(),H}return Ae(s,z),s.prototype.ownsTarget=function(f){return!!z.prototype.ownsTarget.call(this,f)||!(!this.grip1.ownsTarget(f)&&!this.grip2.ownsTarget(f))},s.prototype.pointerDown=function(f,W){z.prototype.pointerDown.call(this,f,W),this.manipulationStartX=f.x,this.manipulationStartY=f.y,this.state==="new"&&(this.x1=f.x,this.y1=f.y,this.x2=f.x,this.y2=f.y),this.manipulationStartX1=this.x1,this.manipulationStartY1=this.y1,this.manipulationStartX2=this.x2,this.manipulationStartY2=this.y2,this.state!=="new"&&(this.select(),this.grip1.ownsTarget(W)?this.activeGrip=this.grip1:this.grip2.ownsTarget(W)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},s.prototype.pointerUp=function(f){var W=this.state;z.prototype.pointerUp.call(this,f),this.state==="creating"&&Math.abs(this.x1-this.x2)<10&&Math.abs(this.y1-this.y2)<10?(this.x2=this.x1+this.defaultLength,this.adjustVisual(),this.adjustControlBox()):this.manipulate(f),this._state="select",W==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},s.prototype.adjustVisual=function(){},s.prototype.manipulate=function(f){this.state==="creating"?this.resize(f):this.state==="move"?(this.x1=this.manipulationStartX1+f.x-this.manipulationStartX,this.y1=this.manipulationStartY1+f.y-this.manipulationStartY,this.x2=this.manipulationStartX2+f.x-this.manipulationStartX,this.y2=this.manipulationStartY2+f.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(f)},s.prototype.resize=function(f){switch(this.activeGrip){case this.grip1:this.x1=f.x,this.y1=f.y;break;case this.grip2:case void 0:this.x2=f.x,this.y2=f.y}this.adjustVisual(),this.adjustControlBox()},s.prototype.select=function(){z.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},s.prototype.deselect=function(){z.prototype.deselect.call(this),this.controlBox.style.display="none"},s.prototype.setupControlBox=function(){this.controlBox=se.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},s.prototype.adjustControlBox=function(){this.positionGrips()},s.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},s.prototype.createGrip=function(){var f=new Qe;return f.visual.transform.baseVal.appendItem(se.createTransform()),this.controlBox.appendChild(f.visual),f},s.prototype.positionGrips=function(){var f=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-f/2,this.y1-f/2),this.positionGrip(this.grip2.visual,this.x2-f/2,this.y2-f/2)},s.prototype.positionGrip=function(f,W,X){var H=f.transform.baseVal.getItem(0);H.setTranslate(W,X),f.transform.baseVal.replaceItem(H,0)},s.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},z.prototype.getState.call(this))},s.prototype.restoreState=function(f){z.prototype.restoreState.call(this,f);var W=f;this.x1=W.x1,this.y1=W.y1,this.x2=W.x2,this.y2=W.y2},s.prototype.scale=function(f,W){z.prototype.scale.call(this,f,W),this.x1=this.x1*f,this.y1=this.y1*W,this.x2=this.x2*f,this.y2=this.y2*W,this.adjustVisual(),this.adjustControlBox()},s}(Ne),at=function(z){function s(f,W,X){var H=z.call(this,f,W,X)||this;return H.strokeColor="transparent",H.strokeWidth=0,H.strokeDasharray="",H.setStrokeColor=H.setStrokeColor.bind(H),H.setStrokeWidth=H.setStrokeWidth.bind(H),H.setStrokeDasharray=H.setStrokeDasharray.bind(H),H.strokeColor=X.defaultColor,H.strokeWidth=X.defaultStrokeWidth,H.strokeDasharray=X.defaultStrokeDasharray,H.strokePanel=new Ue("Line color",X.defaultColorSet,X.defaultColor),H.strokePanel.onColorChanged=H.setStrokeColor,H.strokeWidthPanel=new st("Line width",X.defaultStrokeWidths,X.defaultStrokeWidth),H.strokeWidthPanel.onWidthChanged=H.setStrokeWidth,H.strokeStylePanel=new Ye("Line style",X.defaultStrokeDasharrays,X.defaultStrokeDasharray),H.strokeStylePanel.onStyleChanged=H.setStrokeDasharray,H}return Ae(s,z),s.prototype.ownsTarget=function(f){return!(!z.prototype.ownsTarget.call(this,f)&&f!==this.visual&&f!==this.selectorLine&&f!==this.visibleLine)},s.prototype.createVisual=function(){this.visual=se.createGroup(),this.selectorLine=se.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=se.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.visual.appendChild(this.selectorLine),this.visual.appendChild(this.visibleLine),this.addMarkerVisualToContainer(this.visual)},s.prototype.pointerDown=function(f,W){z.prototype.pointerDown.call(this,f,W),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},s.prototype.adjustVisual=function(){this.selectorLine&&this.visibleLine&&(this.selectorLine.setAttribute("x1",this.x1.toString()),this.selectorLine.setAttribute("y1",this.y1.toString()),this.selectorLine.setAttribute("x2",this.x2.toString()),this.selectorLine.setAttribute("y2",this.y2.toString()),this.visibleLine.setAttribute("x1",this.x1.toString()),this.visibleLine.setAttribute("y1",this.y1.toString()),this.visibleLine.setAttribute("x2",this.x2.toString()),this.visibleLine.setAttribute("y2",this.y2.toString()),se.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),se.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),se.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},s.prototype.setStrokeColor=function(f){this.strokeColor=f,this.adjustVisual(),this.colorChanged(f)},s.prototype.setStrokeWidth=function(f){this.strokeWidth=f,this.adjustVisual()},s.prototype.setStrokeDasharray=function(f){this.strokeDasharray=f,this.adjustVisual(),this.stateChanged()},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var f=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},z.prototype.getState.call(this));return f.typeName=s.typeName,f},s.prototype.restoreState=function(f){z.prototype.restoreState.call(this,f);var W=f;this.strokeColor=W.strokeColor,this.strokeWidth=W.strokeWidth,this.strokeDasharray=W.strokeDasharray,this.createVisual(),this.adjustVisual()},s.typeName="LineMarker",s.title="Line marker",s.icon='<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>',s}(ot),Be=function(z){function s(f,W,X,H){var ve=z.call(this,f,H||'<svg viewBox="0 0 24 24"><path d="M17 8h3v12h1v1h-4v-1h1v-3h-4l-1.5 3H14v1h-4v-1h1l6-12m1 1l-3.5 7H18V9M5 3h5c1.11 0 2 .89 2 2v11H9v-5H6v5H3V5c0-1.11.89-2 2-2m1 2v4h3V5H6z"/></svg>')||this;return ve.fonts=[],ve.fontBoxes=[],ve.fonts=W,ve.currentFont=X,ve.setCurrentFont=ve.setCurrentFont.bind(ve),ve}return Ae(s,z),s.prototype.getUi=function(){var f=this,W=document.createElement("div");return W.style.overflow="hidden",W.style.flexGrow="2",this.fonts.forEach(function(X){var H=document.createElement("div");H.style.display="inline-block",H.style.alignItems="center",H.style.justifyContent="space-between",H.style.padding="5px",H.style.borderWidth="2px",H.style.borderStyle="solid",H.style.overflow="hidden",H.style.maxWidth=100/f.fonts.length-5+"%",H.style.borderColor=X===f.currentFont?f.uiStyleSettings.toolboxAccentColor:"transparent",H.addEventListener("click",function(){f.setCurrentFont(X,H)}),W.appendChild(H);var ve=document.createElement("div");ve.style.display="flex",ve.style.minHeight="20px",ve.style.flexGrow="2",ve.style.fontFamily=X,ve.style.overflow="hidden";var He=document.createElement("div");He.style.whiteSpace="nowrap",He.style.overflow="hidden",He.style.textOverflow="ellipsis",He.innerHTML="The quick brown fox jumps over the lazy dog",ve.appendChild(He),H.appendChild(ve),f.fontBoxes.push(H)}),W},s.prototype.setCurrentFont=function(f,W){var X=this;this.currentFont=f,this.fontBoxes.forEach(function(H){H.style.borderColor=H===W?X.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},s}(je),Ke=function(z){function s(f,W,X){var H=z.call(this,f,W,X)||this;return H.color="transparent",H.padding=5,H.DEFAULT_TEXT="your text here",H.text=H.DEFAULT_TEXT,H.isMoved=!1,H.color=X.defaultColor,H.fontFamily=X.defaultFontFamily,H.defaultSize={x:100,y:30},H.setColor=H.setColor.bind(H),H.setFont=H.setFont.bind(H),H.renderText=H.renderText.bind(H),H.sizeText=H.sizeText.bind(H),H.textEditDivClicked=H.textEditDivClicked.bind(H),H.showTextEditor=H.showTextEditor.bind(H),H.setSize=H.setSize.bind(H),H.positionTextEditor=H.positionTextEditor.bind(H),H.colorPanel=new Ue("Color",X.defaultColorSet,X.defaultColor),H.colorPanel.onColorChanged=H.setColor,H.fontFamilyPanel=new Be("Font",X.defaultFontFamilies,X.defaultFontFamily),H.fontFamilyPanel.onFontChanged=H.setFont,H}return Ae(s,z),s.prototype.ownsTarget=function(f){if(z.prototype.ownsTarget.call(this,f)||f===this.visual||f===this.textElement||f===this.bgRectangle)return!0;var W=!1;return this.textElement.childNodes.forEach(function(X){X===f&&(W=!0)}),W},s.prototype.createVisual=function(){this.visual=se.createGroup(),this.bgRectangle=se.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=se.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(se.createTransform()),this.textElement.transform.baseVal.appendItem(se.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},s.prototype.pointerDown=function(f,W){z.prototype.pointerDown.call(this,f,W),this.isMoved=!1,this.pointerDownPoint=f,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(f),this._state="creating")},s.prototype.renderText=function(){var f=this;if(this.textElement){for(;this.textElement.lastChild;)this.textElement.removeChild(this.textElement.lastChild);this.text.split(/\r\n|[\n\v\f\r\x85\u2028\u2029]/).forEach(function(W){f.textElement.appendChild(se.createTSpan(W.trim()===""?" ":W.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},s.prototype.getTextScale=function(){var f=this.textElement.getBBox(),W=1;if(f.width>0&&f.height>0){var X=(1*this.width-this.width*this.padding*2/100)/f.width,H=(1*this.height-this.height*this.padding*2/100)/f.height;W=Math.min(X,H)}return W},s.prototype.getTextPosition=function(f){var W=this.textElement.getBBox(),X=0,H=0;return W.width>0&&W.height>0&&(X=(this.width-W.width*f)/2,H=this.height/2-W.height*f/2),{x:X,y:H}},s.prototype.sizeText=function(){var f=this.textElement.getBBox(),W=this.getTextScale(),X=this.getTextPosition(W);X.y-=f.y*W,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+X.x+"px, "+X.y+"px) scale("+W+", "+W+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(X.x,X.y),this.textElement.transform.baseVal.getItem(1).setScale(W,W))},s.prototype.manipulate=function(f){z.prototype.manipulate.call(this,f),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(f.x-this.pointerDownPoint.x)>5||Math.abs(f.y-this.pointerDownPoint.y)>5)},s.prototype.resize=function(f){z.prototype.resize.call(this,f),this.isMoved=!0,this.setSize(),this.sizeText()},s.prototype.setSize=function(){z.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(se.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),se.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},s.prototype.pointerUp=function(f){var W=this.state;W==="creating"&&(this._suppressMarkerCreateEvent=!0),z.prototype.pointerUp.call(this,f),this.setSize(),(W==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},s.prototype.showTextEditor=function(){var f=this;this._state="edit",this.overlayContainer.innerHTML="",this.textEditDiv=document.createElement("div"),this.textEditDiv.style.flexGrow="2",this.textEditDiv.style.alignItems="center",this.textEditDiv.style.justifyContent="center",this.textEditDiv.style.pointerEvents="auto",this.textEditDiv.style.overflow="hidden",this.textEditor=document.createElement("div"),this.textEditor.style.position="absolute",this.textEditor.style.fontFamily=this.fontFamily,this.textEditor.style.lineHeight="1em",this.textEditor.innerText=this.text,this.textEditor.contentEditable="true",this.textEditor.style.color=this.color,this.textEditor.style.whiteSpace="pre",this.positionTextEditor(),this.textEditor.addEventListener("pointerup",function(W){W.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var W=Number.parseFloat(f.textEditor.style.fontSize);f.textEditor.clientWidth>=Number.parseInt(f.textEditor.style.maxWidth)&&W>.9;)W-=.1,f.textEditor.style.fontSize=Math.max(W,.9)+"em"}),this.textEditor.addEventListener("keyup",function(W){W.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(W){if(W.clipboardData){var X=W.clipboardData.getData("text"),H=window.getSelection();if(!H.rangeCount)return!1;H.deleteFromDocument(),H.getRangeAt(0).insertNode(document.createTextNode(X)),W.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){f.textEditDivClicked(f.textEditor.innerText)}),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},s.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var f=this.getTextScale(),W=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),X=this.textElement.getBBox(),H={x:X.width*f,y:X.height*f};W.x-=H.x/2,W.y-=H.y/2,this.textEditor.style.top=W.y+"px",this.textEditor.style.left=W.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-W.x+"px",this.textEditor.style.fontSize=Math.max(16*f,12)+"px",this.textElement.style.display="none"}},s.prototype.textEditDivClicked=function(f){this.text=f.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},s.prototype.select=function(){z.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},s.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),z.prototype.deselect.call(this)},s.prototype.dblClick=function(f,W){z.prototype.dblClick.call(this,f,W),this.showTextEditor()},s.prototype.setColor=function(f){this.textElement&&se.setAttributes(this.textElement,[["fill",f]]),this.color=f,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(f)},s.prototype.setFont=function(f){this.textElement&&se.setAttributes(this.textElement,[["font-family",f]]),this.fontFamily=f,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},s.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},s.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var f=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},z.prototype.getState.call(this));return f.typeName=s.typeName,f},s.prototype.restoreState=function(f){var W=f;this.color=W.color,this.fontFamily=W.fontFamily,this.padding=W.padding,this.text=W.text,this.createVisual(),z.prototype.restoreState.call(this,f),this.setSize()},s.prototype.scale=function(f,W){z.prototype.scale.call(this,f,W),this.setSize(),this.sizeText(),this.positionTextEditor()},s.typeName="TextMarker",s.title="Text marker",s.icon='<svg viewBox="0 0 24 24"><path d="M9.6 14L12 7.7l2.4 6.3M11 5L5.5 19h2.2l1.1-3H15l1.1 3h2.2L13 5h-2z"/></svg>',s}(et),Ee=function(z){function s(f,W,X){var H=z.call(this,f,W,X)||this;return H.color="transparent",H.lineWidth=3,H.drawing=!1,H.pixelRatio=1,H.color=X.defaultColor,H.lineWidth=X.defaultStrokeWidth,H.pixelRatio=X.freehandPixelRatio,H.setColor=H.setColor.bind(H),H.addCanvas=H.addCanvas.bind(H),H.finishCreation=H.finishCreation.bind(H),H.setLineWidth=H.setLineWidth.bind(H),H.colorPanel=new Ue("Color",X.defaultColorSet,X.defaultColor),H.colorPanel.onColorChanged=H.setColor,H.lineWidthPanel=new st("Line width",X.defaultStrokeWidths,X.defaultStrokeWidth),H.lineWidthPanel.onWidthChanged=H.setLineWidth,H}return Ae(s,z),s.prototype.ownsTarget=function(f){return!(!z.prototype.ownsTarget.call(this,f)&&f!==this.visual&&f!==this.drawingImage)},s.prototype.createVisual=function(){this.visual=se.createGroup(),this.drawingImage=se.createImage(),this.visual.appendChild(this.drawingImage);var f=se.createTransform();this.visual.transform.baseVal.appendItem(f),this.addMarkerVisualToContainer(this.visual)},s.prototype.pointerDown=function(f,W){this.state==="new"&&(this.addCanvas(),this.createVisual(),this._state="creating"),this.state==="creating"?(this.canvasContext.strokeStyle=this.color,this.canvasContext.lineWidth=this.lineWidth,this.canvasContext.beginPath(),this.canvasContext.moveTo(f.x,f.y),this.drawing=!0):z.prototype.pointerDown.call(this,f,W)},s.prototype.manipulate=function(f){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(f.x,f.y),this.canvasContext.stroke()):z.prototype.manipulate.call(this,f)},s.prototype.resize=function(f){z.prototype.resize.call(this,f),se.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),se.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},s.prototype.pointerUp=function(f){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):z.prototype.pointerUp.call(this,f)},s.prototype.addCanvas=function(){this.overlayContainer.innerHTML="",this.canvasElement=document.createElement("canvas"),this.canvasElement.width=this.overlayContainer.clientWidth*this.pixelRatio,this.canvasElement.height=this.overlayContainer.clientHeight*this.pixelRatio,this.canvasContext=this.canvasElement.getContext("2d"),this.canvasContext.scale(this.pixelRatio,this.pixelRatio),this.overlayContainer.appendChild(this.canvasElement)},s.prototype.select=function(){this.state==="creating"&&this.finishCreation(),z.prototype.select.call(this)},s.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),z.prototype.deselect.call(this)},s.prototype.finishCreation=function(){for(var f=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),W=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],X=W[0],H=W[1],ve=W[2],He=W[3],qe=!1,ft=0;ft<this.canvasElement.height;ft++)for(var Ge=0;Ge<this.canvasElement.width;Ge++)f.data[ft*this.canvasElement.width*4+4*Ge+3]>0&&(qe=!0,ft<H&&(H=ft),Ge<X&&(X=Ge),ft>He&&(He=ft),Ge>ve&&(ve=Ge));if(qe){this.left=X/this.pixelRatio,this.top=H/this.pixelRatio,this.width=(ve-X)/this.pixelRatio,this.height=(He-H)/this.pixelRatio;var Ct=document.createElement("canvas");Ct.width=ve-X,Ct.height=He-H,Ct.getContext("2d").putImageData(this.canvasContext.getImageData(X,H,ve-X,He-H),0,0),this.drawingImgUrl=Ct.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},s.prototype.setDrawingImage=function(){se.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),se.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},s.prototype.setColor=function(f){this.color=f,this.colorChanged(f)},s.prototype.setLineWidth=function(f){this.lineWidth=f},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var f=Object.assign({drawingImgUrl:this.drawingImgUrl},z.prototype.getState.call(this));return f.typeName=s.typeName,f},s.prototype.restoreState=function(f){this.createVisual(),z.prototype.restoreState.call(this,f),this.drawingImgUrl=f.drawingImgUrl,this.setDrawingImage()},s.prototype.scale=function(f,W){z.prototype.scale.call(this,f,W),this.setDrawingImage()},s.typeName="FreehandMarker",s.title="Freehand marker",s.icon='<svg viewBox="0 0 24 24"><path d="M9.75 20.85c1.78-.7 1.39-2.63.49-3.85-.89-1.25-2.12-2.11-3.36-2.94A9.817 9.817 0 014.54 12c-.28-.33-.85-.94-.27-1.06.59-.12 1.61.46 2.13.68.91.38 1.81.82 2.65 1.34l1.01-1.7C8.5 10.23 6.5 9.32 4.64 9.05c-1.06-.16-2.18.06-2.54 1.21-.32.99.19 1.99.77 2.77 1.37 1.83 3.5 2.71 5.09 4.29.34.33.75.72.95 1.18.21.44.16.47-.31.47-1.24 0-2.79-.97-3.8-1.61l-1.01 1.7c1.53.94 4.09 2.41 5.96 1.79m11.09-15.6c.22-.22.22-.58 0-.79l-1.3-1.3a.562.562 0 00-.78 0l-1.02 1.02 2.08 2.08M11 10.92V13h2.08l6.15-6.15-2.08-2.08L11 10.92z"/></svg>',s}(et),ge=function(z){function s(f,W,X){var H=z.call(this,f,X||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>')||this;return H.typeBoxes=[],H.currentType=W,H.setCurrentType=H.setCurrentType.bind(H),H}return Ae(s,z),s.prototype.getUi=function(){var f=this,W=document.createElement("div");W.style.display="flex",W.style.overflow="hidden",W.style.flexGrow="2";for(var X=function(He){var qe="both";switch(He){case 0:qe="both";break;case 1:qe="start";break;case 2:qe="end";break;case 3:qe="none"}var ft=document.createElement("div");if(ft.style.display="flex",ft.style.flexGrow="2",ft.style.alignItems="center",ft.style.justifyContent="space-between",ft.style.padding="5px",ft.style.borderWidth="2px",ft.style.borderStyle="solid",ft.style.borderColor=qe===H.currentType?H.uiStyleSettings.toolboxAccentColor:"transparent",ft.addEventListener("click",function(){f.setCurrentType(qe,ft)}),W.appendChild(ft),qe==="both"||qe==="start"){var Ge=document.createElement("div");Ge.style.display="flex",Ge.style.alignItems="center",Ge.style.minHeight="20px",Ge.innerHTML=`<svg viewBox="0 0 10 10" width="10" height="10" xmlns="http://www.w3.org/2000/svg">
<polygon points="0,5 10,0 10,10" fill="`+(H.uiStyleSettings!==void 0?H.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,Ge.style.marginLeft="5px",ft.appendChild(Ge)}var Ct=document.createElement("div");Ct.style.display="flex",Ct.style.alignItems="center",Ct.style.minHeight="20px",Ct.style.flexGrow="2";var Mt=document.createElement("hr");if(Mt.style.minWidth="20px",Mt.style.border="0px",Mt.style.borderTop="3px solid "+(H.uiStyleSettings!==void 0?H.uiStyleSettings.toolboxColor:"#eeeeee"),Mt.style.flexGrow="2",Ct.appendChild(Mt),ft.appendChild(Ct),qe==="both"||qe==="end"){var Vt=document.createElement("div");Vt.style.display="flex",Vt.style.alignItems="center",Vt.style.minHeight="20px",Vt.innerHTML=`<svg viewBox="0 0 10 10" width="10" height="10" xmlns="http://www.w3.org/2000/svg">
<polygon points="0,0 10,5 0,10" fill="`+(H.uiStyleSettings!==void 0?H.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,Vt.style.marginRight="5px",ft.appendChild(Vt)}H.typeBoxes.push(ft)},H=this,ve=0;ve<4;ve++)X(ve);return W},s.prototype.setCurrentType=function(f,W){var X=this;this.currentType=f,this.typeBoxes.forEach(function(H){H.style.borderColor=H===W?X.uiStyleSettings!==void 0?X.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},s}(je),ye=function(z){function s(f,W,X){var H=z.call(this,f,W,X)||this;return H.arrowType="end",H.arrowBaseHeight=10,H.arrowBaseWidth=10,H.getArrowPoints=H.getArrowPoints.bind(H),H.setArrowType=H.setArrowType.bind(H),H.arrowTypePanel=new ge("Arrow type","end"),H.arrowTypePanel.onArrowTypeChanged=H.setArrowType,H}return Ae(s,z),s.prototype.ownsTarget=function(f){return!(!z.prototype.ownsTarget.call(this,f)&&f!==this.arrow1&&f!==this.arrow2)},s.prototype.getArrowPoints=function(f,W){var X=this.arrowBaseWidth+2*this.strokeWidth,H=this.arrowBaseHeight+2*this.strokeWidth;return f-X/2+","+(W+H/2)+" "+f+","+(W-H/2)+" "+(f+X/2)+","+(W+H/2)},s.prototype.createTips=function(){this.arrow1=se.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(se.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=se.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(se.createTransform()),this.visual.appendChild(this.arrow2)},s.prototype.pointerDown=function(f,W){z.prototype.pointerDown.call(this,f,W),this.state==="creating"&&this.createTips()},s.prototype.adjustVisual=function(){if(z.prototype.adjustVisual.call(this),this.arrow1&&this.arrow2&&(this.arrow1.style.display=this.arrowType==="both"||this.arrowType==="start"?"":"none",this.arrow2.style.display=this.arrowType==="both"||this.arrowType==="end"?"":"none",se.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),se.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var f=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),W=this.arrow1.transform.baseVal.getItem(0);W.setRotate(f,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(W,0);var X=this.arrow2.transform.baseVal.getItem(0);X.setRotate(f+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(X,0)}},s.prototype.setArrowType=function(f){this.arrowType=f,this.adjustVisual(),this.stateChanged()},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var f=Object.assign({arrowType:this.arrowType},z.prototype.getState.call(this));return f.typeName=s.typeName,f},s.prototype.restoreState=function(f){z.prototype.restoreState.call(this,f);var W=f;this.arrowType=W.arrowType,this.createTips(),this.adjustVisual()},s.typeName="ArrowMarker",s.title="Arrow marker",s.icon='<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 7 15.59V9H5v10h10v-2H8.41L19 6.41z"/></svg>',s}(at),re=function(z){function s(f,W,X){var H=z.call(this,f,W,X)||this;return H.fillColor=X.defaultFillColor,H.strokeWidth=0,H.fillPanel=new Ue("Color",X.defaultColorSet,X.defaultFillColor),H.fillPanel.onColorChanged=H.setFillColor,H}return Ae(s,z),Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var f=z.prototype.getState.call(this);return f.typeName=s.typeName,f},s.typeName="CoverMarker",s.title="Cover marker",s.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',s}(Je),ie=function(z){function s(f,W,X,H){var ve=z.call(this,f,H||'<svg viewBox="0 0 24 24"><path d="M17.66 8L12 2.35 6.34 8A8.02 8.02 0 004 13.64c0 2 .78 4.11 2.34 5.67a7.99 7.99 0 0011.32 0c1.56-1.56 2.34-3.67 2.34-5.67S19.22 9.56 17.66 8M6 14c0-2 .62-3.27 1.76-4.4L12 5.27l4.24 4.38C17.38 10.77 18 12 18 14H6z"/></svg>')||this;return ve.opacities=[],ve.opacityBoxes=[],ve.opacities=W,ve.currentOpacity=X,ve.setCurrentOpacity=ve.setCurrentOpacity.bind(ve),ve}return Ae(s,z),s.prototype.getUi=function(){var f=this,W=document.createElement("div");return W.style.display="flex",W.style.overflow="hidden",W.style.flexGrow="2",W.style.justifyContent="space-between",this.opacities.forEach(function(X){var H=document.createElement("div");H.style.display="flex",H.style.alignItems="center",H.style.justifyContent="center",H.style.padding="5px",H.style.borderWidth="2px",H.style.borderStyle="solid",H.style.borderColor=X===f.currentOpacity?f.uiStyleSettings.toolboxAccentColor:"transparent",H.addEventListener("click",function(){f.setCurrentOpacity(X,H)}),W.appendChild(H);var ve=document.createElement("div");ve.innerText=100*X+"%",H.appendChild(ve),f.opacityBoxes.push(H)}),W},s.prototype.setCurrentOpacity=function(f,W){var X=this;this.currentOpacity=f,this.opacityBoxes.forEach(function(H){H.style.borderColor=H===W?X.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},s}(je),ae=function(z){function s(f,W,X){var H=z.call(this,f,W,X)||this;return H.setOpacity=H.setOpacity.bind(H),H.fillColor=X.defaultHighlightColor,H.strokeWidth=0,H.opacity=X.defaultHighlightOpacity,H.fillPanel=new Ue("Color",X.defaultColorSet,H.fillColor),H.fillPanel.onColorChanged=H.setFillColor,H.opacityPanel=new ie("Opacity",X.defaultOpacitySteps,H.opacity),H.opacityPanel.onOpacityChanged=H.setOpacity,H}return Ae(s,z),s.prototype.setOpacity=function(f){this.opacity=f,this.visual&&se.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var f=z.prototype.getState.call(this);return f.typeName=s.typeName,f},s.typeName="HighlightMarker",s.title="Highlight marker",s.icon='<svg viewBox="0 0 24 24"><path d="M18.5 1.15c-.53 0-1.04.19-1.43.58l-5.81 5.82 5.65 5.65 5.82-5.81c.77-.78.77-2.04 0-2.83l-2.84-2.83c-.39-.39-.89-.58-1.39-.58M10.3 8.5l-5.96 5.96c-.78.78-.78 2.04.02 2.85C3.14 18.54 1.9 19.77.67 21h5.66l.86-.86c.78.76 2.03.75 2.81-.02l5.95-5.96"/></svg>',s}(re),de='<svg viewBox="0 0 24 24"><path d="M19 11.5s-2 2.17-2 3.5a2 2 0 002 2 2 2 0 002-2c0-1.33-2-3.5-2-3.5M5.21 10L10 5.21 14.79 10m1.77-1.06L7.62 0 6.21 1.41l2.38 2.38-5.15 5.15c-.59.56-.59 1.53 0 2.12l5.5 5.5c.29.29.68.44 1.06.44s.77-.15 1.06-.44l5.5-5.5c.59-.59.59-1.56 0-2.12z"/></svg>',ke=function(z){function s(f,W,X){var H=z.call(this,f,W,X)||this;return H.bgColor="transparent",H.tipPosition={x:0,y:0},H.tipBase1Position={x:0,y:0},H.tipBase2Position={x:0,y:0},H.tipMoving=!1,H.color=X.defaultStrokeColor,H.bgColor=X.defaultFillColor,H.fontFamily=X.defaultFontFamily,H.defaultSize={x:100,y:30},H.setBgColor=H.setBgColor.bind(H),H.getTipPoints=H.getTipPoints.bind(H),H.positionTip=H.positionTip.bind(H),H.setTipPoints=H.setTipPoints.bind(H),H.colorPanel=new Ue("Text color",X.defaultColorSet,H.color,'<svg viewBox="0 0 24 24"><path d="M9.62 12L12 5.67 14.37 12M11 3L5.5 17h2.25l1.12-3h6.25l1.13 3h2.25L13 3h-2z"/></svg>'),H.colorPanel.onColorChanged=H.setColor,H.bgColorPanel=new Ue("Fill color",X.defaultColorSet,H.bgColor,de),H.bgColorPanel.onColorChanged=H.setBgColor,H.fontFamilyPanel=new Be("Font",X.defaultFontFamilies,X.defaultFontFamily),H.fontFamilyPanel.onFontChanged=H.setFont,H.tipGrip=new Qe,H.tipGrip.visual.transform.baseVal.appendItem(se.createTransform()),H.controlBox.appendChild(H.tipGrip.visual),H}return Ae(s,z),s.prototype.ownsTarget=function(f){return z.prototype.ownsTarget.call(this,f)||this.tipGrip.ownsTarget(f)||this.tip===f},s.prototype.createTip=function(){se.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=se.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},s.prototype.pointerDown=function(f,W){this.state==="new"&&z.prototype.pointerDown.call(this,f,W),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(W)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):z.prototype.pointerDown.call(this,f,W)},s.prototype.pointerUp=function(f){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,z.prototype.pointerUp.call(this,f);else{var W=this.state==="creating";z.prototype.pointerUp.call(this,f),this.setTipPoints(W),this.positionTip()}},s.prototype.manipulate=function(f){if(this.tipMoving){var W=this.unrotatePoint(f);this.tipPosition={x:W.x-this.manipulationStartLeft,y:W.y-this.manipulationStartTop},this.positionTip()}else z.prototype.manipulate.call(this,f)},s.prototype.setBgColor=function(f){this.bgRectangle&&this.tip&&(se.setAttributes(this.bgRectangle,[["fill",f]]),se.setAttributes(this.tip,[["fill",f]])),this.bgColor=f,this.fillColorChanged(f)},s.prototype.getTipPoints=function(){return this.setTipPoints(this.state==="creating"),this.tipBase1Position.x+","+this.tipBase1Position.y+" "+this.tipBase2Position.x+","+this.tipBase2Position.y+" "+this.tipPosition.x+","+this.tipPosition.y},s.prototype.setTipPoints=function(f){f===void 0&&(f=!1);var W=Math.min(this.height/2,15),X=this.height/5;f&&(this.tipPosition={x:W+X/2,y:this.height+20});var H=Math.atan(this.height/2/(this.width/2));this.tipPosition.x<this.width/2&&this.tipPosition.y<this.height/2?H<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?(X=this.width/5,W=Math.min(this.width/2,15),this.tipBase1Position={x:W,y:0},this.tipBase2Position={x:W+X,y:0}):(this.tipBase1Position={x:0,y:W},this.tipBase2Position={x:0,y:W+X}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?H<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?(X=this.width/5,W=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-W-X,y:0},this.tipBase2Position={x:this.width-W,y:0}):(this.tipBase1Position={x:this.width,y:W},this.tipBase2Position={x:this.width,y:W+X}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?H<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?(X=this.width/5,W=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-W-X,y:this.height},this.tipBase2Position={x:this.width-W,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-W-X},this.tipBase2Position={x:this.width,y:this.height-W}):H<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?(X=this.width/5,W=Math.min(this.width/2,15),this.tipBase1Position={x:W,y:this.height},this.tipBase2Position={x:W+X,y:this.height}):(this.tipBase1Position={x:0,y:this.height-W},this.tipBase2Position={x:0,y:this.height-W-X})},s.prototype.resize=function(f){z.prototype.resize.call(this,f),this.positionTip()},s.prototype.positionTip=function(){se.setAttributes(this.tip,[["points",this.getTipPoints()]]);var f=this.tipGrip.visual.transform.baseVal.getItem(0);f.setTranslate(this.tipPosition.x,this.tipPosition.y),this.tipGrip.visual.transform.baseVal.replaceItem(f,0)},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.bgColorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),s.prototype.select=function(){this.positionTip(),z.prototype.select.call(this)},s.prototype.getState=function(){var f=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},z.prototype.getState.call(this));return f.typeName=s.typeName,f},s.prototype.restoreState=function(f){var W=f;this.bgColor=W.bgColor,this.tipPosition=W.tipPosition,z.prototype.restoreState.call(this,f),this.createTip(),this.setTipPoints()},s.prototype.scale=function(f,W){z.prototype.scale.call(this,f,W),this.tipPosition={x:this.tipPosition.x*f,y:this.tipPosition.y*W},this.positionTip()},s.typeName="CalloutMarker",s.title="Callout marker",s.icon='<svg viewBox="0 0 24 24"><path d="M4 2h16a2 2 0 012 2v12a2 2 0 01-2 2h-4l-4 4-4-4H4a2 2 0 01-2-2V4a2 2 0 012-2m0 2v12h4.83L12 19.17 15.17 16H20V4H4m2 3h12v2H6V7m0 4h10v2H6v-2z"/></svg>',s}(Ke),Se=function(z){function s(f,W,X){var H=z.call(this,f,W,X)||this;return H.fillColor="transparent",H.strokeColor="transparent",H.strokeWidth=0,H.strokeDasharray="",H.opacity=1,H.strokeColor=X.defaultColor,H.strokeWidth=X.defaultStrokeWidth,H.strokeDasharray=X.defaultStrokeDasharray,H.fillColor=X.defaultFillColor,H.setStrokeColor=H.setStrokeColor.bind(H),H.setFillColor=H.setFillColor.bind(H),H.setStrokeWidth=H.setStrokeWidth.bind(H),H.setStrokeDasharray=H.setStrokeDasharray.bind(H),H.setOpacity=H.setOpacity.bind(H),H.createVisual=H.createVisual.bind(H),H.strokePanel=new Ue("Line color",pe(X.defaultColorSet,["transparent"]),X.defaultColor),H.strokePanel.onColorChanged=H.setStrokeColor,H.fillPanel=new Ue("Fill color",pe(X.defaultColorSet,["transparent"]),H.fillColor,de),H.fillPanel.onColorChanged=H.setFillColor,H.strokeWidthPanel=new st("Line width",X.defaultStrokeWidths,X.defaultStrokeWidth),H.strokeWidthPanel.onWidthChanged=H.setStrokeWidth,H.strokeStylePanel=new Ye("Line style",X.defaultStrokeDasharrays,X.defaultStrokeDasharray),H.strokeStylePanel.onStyleChanged=H.setStrokeDasharray,H.opacityPanel=new ie("Opacity",X.defaultOpacitySteps,H.opacity),H.opacityPanel.onOpacityChanged=H.setOpacity,H}return Ae(s,z),s.prototype.ownsTarget=function(f){return!(!z.prototype.ownsTarget.call(this,f)&&f!==this.visual)},s.prototype.createVisual=function(){this.visual=se.createEllipse(this.width/2,this.height/2,[["fill",this.fillColor],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["stroke-dasharray",this.strokeDasharray],["opacity",this.opacity.toString()]]),this.addMarkerVisualToContainer(this.visual)},s.prototype.pointerDown=function(f,W){z.prototype.pointerDown.call(this,f,W),this.state==="new"&&(this.createVisual(),this.moveVisual(f),this._state="creating")},s.prototype.manipulate=function(f){z.prototype.manipulate.call(this,f)},s.prototype.resize=function(f){z.prototype.resize.call(this,f),this.setSize()},s.prototype.setSize=function(){z.prototype.setSize.call(this),se.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},s.prototype.pointerUp=function(f){z.prototype.pointerUp.call(this,f),this.setSize()},s.prototype.setStrokeColor=function(f){this.strokeColor=f,this.visual&&se.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(f),this.stateChanged()},s.prototype.setFillColor=function(f){this.fillColor=f,this.visual&&se.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(f),this.stateChanged()},s.prototype.setStrokeWidth=function(f){this.strokeWidth=f,this.visual&&se.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},s.prototype.setStrokeDasharray=function(f){this.strokeDasharray=f,this.visual&&se.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},s.prototype.setOpacity=function(f){this.opacity=f,this.visual&&se.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var f=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},z.prototype.getState.call(this));return f.typeName=s.typeName,f},s.prototype.restoreState=function(f){var W=f;this.fillColor=W.fillColor,this.strokeColor=W.strokeColor,this.strokeWidth=W.strokeWidth,this.strokeDasharray=W.strokeDasharray,this.opacity=W.opacity,this.createVisual(),z.prototype.restoreState.call(this,f),this.setSize()},s.prototype.scale=function(f,W){z.prototype.scale.call(this,f,W),this.setSize()},s.typeName="EllipseMarker",s.title="Ellipse marker",s.icon='<svg viewBox="0 0 24 24"><path d="M12 4C6.5 4 2 7.58 2 12s4.5 8 10 8 10-3.58 10-8-4.5-8-10-8z"/></svg>',s}(et),We=function(z){function s(f,W,X){return z.call(this,f,W,X)||this}return Ae(s,z),Object.defineProperty(s.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),s.prototype.ownsTarget=function(f){return!(!z.prototype.ownsTarget.call(this,f)&&f!==this.tip1&&f!==this.tip2)},s.prototype.createTips=function(){this.tip1=se.createLine(this.x1-this.tipLength/2,this.y1,this.x1+this.tipLength/2,this.y1,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.tip1.transform.baseVal.appendItem(se.createTransform()),this.visual.appendChild(this.tip1),this.tip2=se.createLine(this.x2-this.tipLength/2,this.y2,this.x2+this.tipLength/2,this.y2,[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),this.tip2.transform.baseVal.appendItem(se.createTransform()),this.visual.appendChild(this.tip2)},s.prototype.pointerDown=function(f,W){z.prototype.pointerDown.call(this,f,W),this.state==="creating"&&this.createTips()},s.prototype.adjustVisual=function(){if(z.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(se.setAttributes(this.tip1,[["x1",(this.x1-this.tipLength/2).toString()],["y1",this.y1.toString()],["x2",(this.x1+this.tipLength/2).toString()],["y2",this.y1.toString()],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),se.setAttributes(this.tip2,[["x1",(this.x2-this.tipLength/2).toString()],["y1",this.y2.toString()],["x2",(this.x2+this.tipLength/2).toString()],["y2",this.y2.toString()],["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()]]),Math.abs(this.x1-this.x2)>.1)){var f=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),W=this.tip1.transform.baseVal.getItem(0);W.setRotate(f,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(W,0);var X=this.tip2.transform.baseVal.getItem(0);X.setRotate(f+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(X,0)}},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var f=z.prototype.getState.call(this);return f.typeName=s.typeName,f},s.prototype.restoreState=function(f){z.prototype.restoreState.call(this,f),this.createTips(),this.adjustVisual()},s.typeName="MeasurementMarker",s.title="Measurement marker",s.icon='<svg viewBox="0 0 24 24"><path d="M1.39 18.36l1.77-1.76L4.58 18l1.06-1.05-1.42-1.41 1.42-1.42 2.47 2.48 1.06-1.06-2.47-2.48 1.41-1.41 1.42 1.41L10.59 12l-1.42-1.41 1.42-1.42 2.47 2.48 1.06-1.06-2.47-2.48 1.41-1.41 1.41 1.41 1.07-1.06-1.42-1.41 1.42-1.42L18 6.7l1.07-1.06-2.47-2.48 1.76-1.77 4.25 4.25L5.64 22.61l-4.25-4.25z"/></svg>',s}(at),tt=function(z){function s(f,W,X){var H=z.call(this,f,W,X)||this;return H.strokePanel.colors=X.defaultColorSet,H.fillColor="transparent",H}return Ae(s,z),Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var f=z.prototype.getState.call(this);return f.typeName=s.typeName,f},s.typeName="EllipseFrameMarker",s.title="Ellipse frame marker",s.icon='<svg viewBox="0 0 24 24"><path d="M12 6c4.41 0 8 2.69 8 6s-3.59 6-8 6-8-2.69-8-6 3.59-6 8-6m0-2C6.5 4 2 7.58 2 12s4.5 8 10 8 10-3.58 10-8-4.5-8-10-8z"/></svg>',s}(Se),ct=function(){function z(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(z.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),z.prototype.addUndoStep=function(s){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(s)||(this.undoStack.push(s),JSON.stringify(this.lastRedoStep)!==JSON.stringify(s)&&this.redoStack.splice(0,this.redoStack.length))},z.prototype.replaceLastUndoStep=function(s){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=s)},z.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},z.prototype.undo=function(){if(this.undoStack.length>1){var s=this.undoStack.pop();return s!==void 0&&this.redoStack.push(s),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},z.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},z}(),lt=function(z){function s(f,W,X){var H=z.call(this,f,W,X)||this;return H.strokeColor="transparent",H.strokeWidth=0,H.strokeDasharray="",H.curveX=0,H.curveY=0,H.manipulationStartCurveX=0,H.manipulationStartCurveY=0,H.setStrokeColor=H.setStrokeColor.bind(H),H.setStrokeWidth=H.setStrokeWidth.bind(H),H.setStrokeDasharray=H.setStrokeDasharray.bind(H),H.positionGrips=H.positionGrips.bind(H),H.addControlGrips=H.addControlGrips.bind(H),H.adjustVisual=H.adjustVisual.bind(H),H.setupControlBox=H.setupControlBox.bind(H),H.resize=H.resize.bind(H),H.strokeColor=X.defaultColor,H.strokeWidth=X.defaultStrokeWidth,H.strokeDasharray=X.defaultStrokeDasharray,H.strokePanel=new Ue("Line color",X.defaultColorSet,X.defaultColor),H.strokePanel.onColorChanged=H.setStrokeColor,H.strokeWidthPanel=new st("Line width",X.defaultStrokeWidths,X.defaultStrokeWidth),H.strokeWidthPanel.onWidthChanged=H.setStrokeWidth,H.strokeStylePanel=new Ye("Line style",X.defaultStrokeDasharrays,X.defaultStrokeDasharray),H.strokeStylePanel.onStyleChanged=H.setStrokeDasharray,H}return Ae(s,z),s.prototype.ownsTarget=function(f){return!(!z.prototype.ownsTarget.call(this,f)&&f!==this.visual&&f!==this.selectorCurve&&f!==this.visibleCurve&&!this.curveGrip.ownsTarget(f))},s.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},s.prototype.createVisual=function(){this.visual=se.createGroup(),this.selectorCurve=se.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=se.createPath(this.getPathD(),[["stroke",this.strokeColor],["stroke-width",this.strokeWidth.toString()],["fill","transparent"]]),this.visual.appendChild(this.selectorCurve),this.visual.appendChild(this.visibleCurve),this.addMarkerVisualToContainer(this.visual)},s.prototype.pointerDown=function(f,W){z.prototype.pointerDown.call(this,f,W),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=f.x,this.curveY=f.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(W)&&(this.activeGrip=this.curveGrip,this._state="resize")},s.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),se.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),se.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),se.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},s.prototype.setupControlBox=function(){z.prototype.setupControlBox.call(this),this.curveControlLine1=se.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=se.createLine(this.x2,this.y2,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.controlBox.insertBefore(this.curveControlLine1,this.controlBox.firstChild),this.controlBox.insertBefore(this.curveControlLine2,this.controlBox.firstChild)},s.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,z.prototype.addControlGrips.call(this)},s.prototype.positionGrips=function(){z.prototype.positionGrips.call(this);var f=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-f/2,this.curveY-f/2),this.curveControlLine1&&this.curveControlLine2&&(this.curveControlLine1.setAttribute("x1",this.x1.toString()),this.curveControlLine1.setAttribute("y1",this.y1.toString()),this.curveControlLine1.setAttribute("x2",this.curveX.toString()),this.curveControlLine1.setAttribute("y2",this.curveY.toString()),this.curveControlLine2.setAttribute("x1",this.x2.toString()),this.curveControlLine2.setAttribute("y1",this.y2.toString()),this.curveControlLine2.setAttribute("x2",this.curveX.toString()),this.curveControlLine2.setAttribute("y2",this.curveY.toString()))},s.prototype.manipulate=function(f){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+f.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+f.y-this.manipulationStartY),z.prototype.manipulate.call(this,f)},s.prototype.resize=function(f){this.activeGrip===this.curveGrip&&(this.curveX=f.x,this.curveY=f.y),z.prototype.resize.call(this,f),this.state==="creating"&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},s.prototype.setStrokeColor=function(f){this.strokeColor=f,this.adjustVisual(),this.colorChanged(f)},s.prototype.setStrokeWidth=function(f){this.strokeWidth=f,this.adjustVisual()},s.prototype.setStrokeDasharray=function(f){this.strokeDasharray=f,this.adjustVisual()},s.prototype.scale=function(f,W){this.curveX=this.curveX*f,this.curveY=this.curveY*W,z.prototype.scale.call(this,f,W)},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var f=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},z.prototype.getState.call(this));return f.typeName=s.typeName,f},s.prototype.restoreState=function(f){z.prototype.restoreState.call(this,f);var W=f;this.strokeColor=W.strokeColor,this.strokeWidth=W.strokeWidth,this.strokeDasharray=W.strokeDasharray,this.curveX=W.curveX,this.curveY=W.curveY,this.createVisual(),this.adjustVisual()},s.typeName="CurveMarker",s.title="Curve marker",s.icon='<svg viewBox="0 0 24 24"><path d="M18.5 2A1.5 1.5 0 0120 3.5 1.5 1.5 0 0118.5 5c-.23 0-.45-.05-.65-.15l-3.69 3.7.34.45c2.19-1.26 4.76-2 7.5-2l1 .03v2.01L22 9c-2.58 0-5 .75-7 2.04A3.96 3.96 0 0111.04 15C9.75 17 9 19.42 9 22l.04 1H7.03L7 22c0-2.74.74-5.31 2-7.5l-.45-.34-3.7 3.69c.1.2.15.42.15.65A1.5 1.5 0 013.5 20 1.5 1.5 0 012 18.5 1.5 1.5 0 013.5 17c.23 0 .45.05.65.15l3.69-3.7C7.31 12.78 7 11.92 7 11a4 4 0 014-4c.92 0 1.78.31 2.45.84l3.7-3.69c-.1-.2-.15-.42-.15-.65A1.5 1.5 0 0118.5 2M11 9a2 2 0 00-2 2 2 2 0 002 2 2 2 0 002-2 2 2 0 00-2-2z"/></svg>',s}(ot),kt=function(){function z(s,f){f===void 0&&(f=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=s,this.cancelable=f}return Object.defineProperty(z.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),z.prototype.preventDefault=function(){this._defaultPrevented=!0},z}(),Et=function(z){function s(f,W,X){var H=z.call(this,f,!1)||this;return H.dataUrl=W,H.state=X,H}return Ae(s,z),s}(kt),ht=function(z){function s(f,W,X){X===void 0&&(X=!1);var H=z.call(this,f,X)||this;return H.marker=W,H}return Ae(s,z),s}(kt),jt=function(){function z(){this.render=[],this.beforeclose=[],this.close=[],this.show=[],this.restorestate=[],this.statechange=[],this.markerselect=[],this.markerdeselect=[],this.markercreating=[],this.markercreate=[],this.markerbeforedelete=[],this.markerdelete=[],this.markerchange=[],this.focus=[],this.blur=[]}return z.prototype.addEventListener=function(s,f){this[s].push(f)},z.prototype.removeEventListener=function(s,f){var W=this[s].indexOf(f);W>-1&&this[s].splice(W,1)},z}(),vt=function(){function z(s){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new _e,this._isOpen=!1,this.undoRedoManager=new ct,this.renderAtNaturalSize=!1,this.renderImageType="image/png",this.renderMarkersOnly=!1,this.zoomSteps=[1,1.5,2,4],this._zoomLevel=1,this._isResizing=!1,this.prevPanPoint={x:0,y:0},this.eventListeners=new jt,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=z.instanceCounter++,this.styles=new Te(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=s,this.targetRoot=document.body,this.width=s.clientWidth,this.height=s.clientHeight,this.styles.removeStyleSheet(),this.open=this.open.bind(this),this.setTopLeft=this.setTopLeft.bind(this),this.toolbarButtonClicked=this.toolbarButtonClicked.bind(this),this.createNewMarker=this.createNewMarker.bind(this),this.addNewMarker=this.addNewMarker.bind(this),this.markerCreated=this.markerCreated.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onDblClick=this.onDblClick.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.onPointerOut=this.onPointerOut.bind(this),this.onKeyUp=this.onKeyUp.bind(this),this.overrideOverflow=this.overrideOverflow.bind(this),this.restoreOverflow=this.restoreOverflow.bind(this),this.close=this.close.bind(this),this.closeUI=this.closeUI.bind(this),this.addCloseEventListener=this.addCloseEventListener.bind(this),this.removeCloseEventListener=this.removeCloseEventListener.bind(this),this.addRenderEventListener=this.addRenderEventListener.bind(this),this.removeRenderEventListener=this.removeRenderEventListener.bind(this),this.clientToLocalCoordinates=this.clientToLocalCoordinates.bind(this),this.onWindowResize=this.onWindowResize.bind(this),this.deleteSelectedMarker=this.deleteSelectedMarker.bind(this),this.setWindowHeight=this.setWindowHeight.bind(this),this.removeMarker=this.removeMarker.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this),this.onPopupTargetResize=this.onPopupTargetResize.bind(this),this.showNotesEditor=this.showNotesEditor.bind(this),this.hideNotesEditor=this.hideNotesEditor.bind(this),this.stepZoom=this.stepZoom.bind(this),this.focus=this.focus.bind(this),this.blur=this.blur.bind(this),this.markerStateChanged=this.markerStateChanged.bind(this),this.switchToSelectMode=this.switchToSelectMode.bind(this),this.addDefs=this.addDefs.bind(this),this.addDefsToImage=this.addDefsToImage.bind(this)}return Object.defineProperty(z.prototype,"ALL_MARKER_TYPES",{get:function(){return[Xe,Ee,ye,Ke,tt,Se,ae,ke,We,re,at,lt]},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[Xe,Ee,ye,Ke,Se,ae,ke]},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"BASIC_MARKER_TYPES",{get:function(){return[Xe,Ee,ye,Ke,ae]},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(s){var f=this;this._availableMarkerTypes.splice(0),s.forEach(function(W){if(typeof W=="string"){var X=f.ALL_MARKER_TYPES.find(function(H){return H.typeName===W});X!==void 0&&f._availableMarkerTypes.push(X)}else f._availableMarkerTypes.push(W)})},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"zoomLevel",{get:function(){return this._zoomLevel},set:function(s){this._zoomLevel=s,this.editorCanvas&&this.contentDiv&&(this.editorCanvas.style.transform="scale("+this._zoomLevel+")",this.contentDiv.scrollTo({left:(this.editorCanvas.clientWidth*this._zoomLevel-this.contentDiv.clientWidth)/2,top:(this.editorCanvas.clientHeight*this._zoomLevel-this.contentDiv.clientHeight)/2}))},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),z.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),this.settings.displayMode==="popup"&&this.onPopupTargetResize(),te.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},z.prototype.show=function(){var s=this;this.styles.styleSheetRoot===void 0&&ne.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=ne.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(f){return f(new kt(s))})},z.prototype.render=function(){return Le(this,void 0,void 0,function(){var s;return be(this,function(f){switch(f.label){case 0:return this.setCurrentMarker(),(s=new ue).naturalSize=this.renderAtNaturalSize,s.imageType=this.renderImageType,s.imageQuality=this.renderImageQuality,s.markersOnly=this.renderMarkersOnly,s.width=this.renderWidth,s.height=this.renderHeight,[4,s.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return f.sent(),[4,s.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,f.sent()]}})})},z.prototype.close=function(s){var f=this;if(s===void 0&&(s=!1),this.isOpen){var W=!1;s||this.eventListeners.beforeclose.forEach(function(X){var H=new kt(f,!0);X(H),H.defaultPrevented&&(W=!0)}),W||(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.settings.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),this.eventListeners.close.forEach(function(X){return X(new kt(f))}),this.detachEvents(),this._isOpen=!1)}},z.prototype.addMarkersToToolbar=function(){for(var s,f=[],W=0;W<arguments.length;W++)f[W]=arguments[W];(s=this._availableMarkerTypes).push.apply(s,f)},z.prototype.addRenderEventListener=function(s){this.addEventListener("render",function(f){s(f.dataUrl,f.state)})},z.prototype.removeRenderEventListener=function(s){},z.prototype.addCloseEventListener=function(s){this.addEventListener("close",function(){s()})},z.prototype.removeCloseEventListener=function(s){},z.prototype.setupResizeObserver=function(){var s=this;this.settings.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){s.resize(s.target.clientWidth,s.target.clientHeight)}),this.targetObserver.observe(this.target)):this.settings.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){return s.onPopupTargetResize()}),this.targetObserver.observe(this.editorCanvas)),window.addEventListener("resize",this.setWindowHeight))},z.prototype.onPopupTargetResize=function(){var s=1*this.target.clientWidth/this.target.clientHeight,f=this.editorCanvas.clientWidth/s>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*s:this.editorCanvas.clientWidth,W=f<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/s;this.resize(f,W)},z.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},z.prototype.resize=function(s,f){this._isResizing=!0;var W=s/this.imageWidth,X=f/this.imageHeight;this.imageWidth=Math.round(s),this.imageHeight=Math.round(f),this.target instanceof HTMLImageElement&&this.editingTarget instanceof HTMLImageElement&&(this.editingTarget.src=this.target.src),this.editingTarget.width=this.imageWidth,this.editingTarget.height=this.imageHeight,this.editingTarget.style.width=this.imageWidth+"px",this.editingTarget.style.height=this.imageHeight+"px",this.markerImage.setAttribute("width",this.imageWidth.toString()),this.markerImage.setAttribute("height",this.imageHeight.toString()),this.markerImage.setAttribute("viewBox","0 0 "+this.imageWidth.toString()+" "+this.imageHeight.toString()),this.markerImageHolder.style.width=this.imageWidth+"px",this.markerImageHolder.style.height=this.imageHeight+"px",this.overlayContainer.style.width=this.imageWidth+"px",this.overlayContainer.style.height=this.imageHeight+"px",this.settings.displayMode!=="popup"?this.coverDiv.style.width=this.imageWidth.toString()+"px":(this.setTopLeft(),this.positionMarkerImage()),this.toolbar!==void 0&&this.toolbar.adjustLayout(),this.positionLogo(),this.scaleMarkers(W,X),this._isResizing=!1},z.prototype.scaleMarkers=function(s,f){var W,X=this;this._currentMarker&&this._currentMarker instanceof Ke?this._currentMarker.scale(s,f):(W=this._currentMarker,this.setCurrentMarker()),this.markers.forEach(function(H){H!==X._currentMarker&&H.scale(s,f)}),W!==void 0&&this.setCurrentMarker(W)},z.prototype.setEditingTarget=function(){this.imageWidth=Math.round(this.target.clientWidth),this.imageHeight=Math.round(this.target.clientHeight),this.target instanceof HTMLImageElement&&this.editingTarget instanceof HTMLImageElement&&(this.editingTarget.src=this.target.src),this.editingTarget.width=this.imageWidth,this.editingTarget.height=this.imageHeight,this.editingTarget.style.width=this.imageWidth+"px",this.editingTarget.style.height=this.imageHeight+"px"},z.prototype.setTopLeft=function(){var s=this.editingTarget.getBoundingClientRect(),f=this.editorCanvas.getBoundingClientRect();this.left=s.left-f.left,this.top=s.top-f.top},z.prototype.initMarkerCanvas=function(){this.markerImageHolder=document.createElement("div"),this.markerImageHolder.style.setProperty("touch-action","pinch-zoom"),this.markerImage=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.markerImage.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.markerImage.setAttribute("width",this.imageWidth.toString()),this.markerImage.setAttribute("height",this.imageHeight.toString()),this.markerImage.setAttribute("viewBox","0 0 "+this.imageWidth.toString()+" "+this.imageHeight.toString()),this.markerImage.style.pointerEvents="auto",this.markerImageHolder.style.position="absolute",this.markerImageHolder.style.width=this.imageWidth+"px",this.markerImageHolder.style.height=this.imageHeight+"px",this.markerImageHolder.style.transformOrigin="top left",this.positionMarkerImage(),this.markerImageHolder.appendChild(this.markerImage),this.editorCanvas.appendChild(this.markerImageHolder)},z.prototype.addDefs=function(){for(var s,f=[],W=0;W<arguments.length;W++)f[W]=arguments[W];this.defs=se.createDefs(),this.addDefsToImage(),(s=this.defs).append.apply(s,f)},z.prototype.addDefsToImage=function(){this.defs&&this.markerImage.insertBefore(this.defs,this.markerImage.firstChild)},z.prototype.initOverlay=function(){this.overlayContainer=document.createElement("div"),this.overlayContainer.style.position="absolute",this.overlayContainer.style.left="0px",this.overlayContainer.style.top="0px",this.overlayContainer.style.width=this.imageWidth+"px",this.overlayContainer.style.height=this.imageHeight+"px",this.overlayContainer.style.display="flex",this.markerImageHolder.appendChild(this.overlayContainer)},z.prototype.positionMarkerImage=function(){this.markerImageHolder.style.top=this.top/this.zoomLevel+"px",this.markerImageHolder.style.left=this.left/this.zoomLevel+"px"},z.prototype.attachEvents=function(){this.markerImage.addEventListener("pointerdown",this.onPointerDown),this.markerImage.addEventListener("dblclick",this.onDblClick),this.attachWindowEvents()},z.prototype.attachWindowEvents=function(){window.addEventListener("pointermove",this.onPointerMove),window.addEventListener("pointerup",this.onPointerUp),window.addEventListener("pointercancel",this.onPointerOut),window.addEventListener("pointerout",this.onPointerOut),window.addEventListener("pointerleave",this.onPointerUp),window.addEventListener("resize",this.onWindowResize),window.addEventListener("keyup",this.onKeyUp)},z.prototype.detachEvents=function(){this.markerImage.removeEventListener("pointerdown",this.onPointerDown),this.markerImage.removeEventListener("dblclick",this.onDblClick),this.detachWindowEvents()},z.prototype.detachWindowEvents=function(){window.removeEventListener("pointermove",this.onPointerMove),window.removeEventListener("pointerup",this.onPointerUp),window.removeEventListener("pointercancel",this.onPointerOut),window.removeEventListener("pointerout",this.onPointerOut),window.removeEventListener("pointerleave",this.onPointerUp),window.removeEventListener("resize",this.onWindowResize),window.removeEventListener("keyup",this.onKeyUp)},z.prototype.addLogo=function(){this.logoUI=document.createElement("div"),this.logoUI.style.display="inline-block",this.logoUI.style.margin="0px",this.logoUI.style.padding="0px",this.logoUI.style.fill="#333333";var s=document.createElement("a");s.href="https://markerjs.com/",s.target="_blank",s.innerHTML='<svg viewBox="0 0 112 96" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414"><path fill="#e5f20d" fill-opacity=".647" d="M0 40.386h111.96V95.62H0z"/><path d="M93.61 61.452c0 .987-.328 1.831-.987 2.53-.657.7-1.52 1.048-2.591 1.048-1.481 0-2.222-.74-2.222-2.22 0-16.617-.533-29.347-1.604-38.192-1.068-8.842-2.92-13.265-5.552-13.265-4.443 0-10.94 15.509-19.497 46.52v.124c0 .987-.328 1.831-.987 2.53-.657.7-1.52 1.048-2.592 1.048-1.48 0-2.22-.74-2.22-2.22 0-3.29.165-8.392.493-15.302.33-7.732.494-13.82.494-18.262 0-6.17-.186-10.55-.556-13.142-.37-2.591-1.172-3.887-2.406-3.887-2.796 0-6.333 5.12-10.612 15.363C38.494 34.367 34.01 46.44 29.32 60.34l-1.11 3.209a5.714 5.714 0 01-1.42 2.097c-.617.578-1.295.864-2.036.864-.987 0-1.644-.081-1.974-.247-.328-.162-.533-.656-.617-1.48-.41-4.03-.74-9.418-.987-16.165-.163-1.728-.329-4.566-.494-8.515-.822-13.901-1.562-23.3-2.221-28.196-.657-4.893-.987-7.628-.987-8.205 0-.657.33-1.44.987-2.345.659-.903 1.276-1.357 1.85-1.357 1.319 0 2.387.947 3.21 2.838.411.906.863 4.526 1.357 10.859.493 6.335.905 14.19 1.233 23.568l.617 18.88c4.527-13.983 9.216-26.673 14.068-38.068C45.65 6.686 50.093.988 54.123.988c2.715 0 4.566 1.974 5.553 5.923.987 3.949 1.481 9.667 1.481 17.152 0 3.949-.081 9.625-.247 17.029l-.123 5.676c3.373-11.762 6.725-21.634 10.057-29.615 3.331-7.979 6.685-11.97 10.056-11.97 8.475 0 12.71 18.757 12.71 56.269z" fill-rule="nonzero"/></svg>',s.title="Powered by marker.js",s.style.display="grid",s.style.alignItems="center",s.style.justifyItems="center",s.style.padding="3px",s.style.width="20px",s.style.height="20px",this.logoUI.appendChild(s),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},z.prototype.positionLogo=function(){this.logoUI&&(this.uiStyleSettings.logoPosition!=="right"?this.logoUI.style.left=this.markerImageHolder.offsetLeft+10+"px":this.logoUI.style.left=this.markerImageHolder.offsetLeft+this.markerImageHolder.offsetWidth-this.logoUI.clientWidth-10+"px",this.logoUI.style.top=this.markerImageHolder.offsetTop+this.markerImageHolder.offsetHeight-this.logoUI.clientHeight-10+"px")},z.prototype.overrideOverflow=function(){this.scrollXState=window.scrollX,this.scrollYState=window.scrollY,this.bodyOverflowState=document.body.style.overflow,window.scroll({top:0,left:0}),document.body.style.overflow="hidden"},z.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},z.prototype.showUI=function(){switch(this.settings.displayMode==="popup"&&this.overrideOverflow(),this.coverDiv=document.createElement("div"),this.coverDiv.style.visibility=this._silentRenderMode?"hidden":"visible",this.coverDiv.className=this.styles.classNamePrefixBase+" "+this.styles.classNamePrefix,this.coverDiv.style.fontSize="16px",this.coverDiv.style.userSelect="none",this.settings.displayMode){case"inline":this.coverDiv.style.position="absolute";var s=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=s+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px",this.coverDiv.style.width=this.target.offsetWidth.toString()+"px",this.coverDiv.style.zIndex=this.uiStyleSettings.zIndex!==void 0?this.uiStyleSettings.zIndex:"5";break;case"popup":this.coverDiv.style.position="absolute",this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=window.innerHeight+"px",this.coverDiv.style.backgroundColor="rgba(0, 0, 0, 0.75)",this.coverDiv.style.zIndex=this.uiStyleSettings.zIndex!==void 0?this.uiStyleSettings.zIndex:"1000",this.coverDiv.style.display="flex"}this.targetRoot.appendChild(this.coverDiv),this.uiDiv=document.createElement("div"),this.uiDiv.style.display="flex",this.uiDiv.style.flexDirection="column",this.uiDiv.style.flexGrow="2",this.uiDiv.style.margin=this.settings.displayMode==="popup"?this.settings.popupMargin+"px":"0px",this.uiDiv.style.border="0px",this.coverDiv.appendChild(this.uiDiv),this.toolbar=new Me(this.uiDiv,this.settings.displayMode,this._availableMarkerTypes,this.uiStyleSettings,this.styles),this.toolbar.addButtonClickListener(this.toolbarButtonClicked),this.toolbar.show(this._silentRenderMode||this.uiStyleSettings.hideToolbar?"hidden":"visible"),this.contentDiv=document.createElement("div"),this.contentDiv.style.display="flex",this.contentDiv.style.flexDirection="row",this.contentDiv.style.flexGrow="2",this.contentDiv.style.flexShrink="1",this.settings.displayMode==="popup"&&(this.contentDiv.style.backgroundColor=this.uiStyleSettings.canvasBackgroundColor,this.contentDiv.style.maxHeight=this.windowHeight-2*this.settings.popupMargin-3.5*this.uiStyleSettings.toolbarHeight+"px",this.contentDiv.style.maxWidth="calc(100vw - "+2*this.settings.popupMargin+"px)"),this.contentDiv.style.overflow="auto",this.uiDiv.appendChild(this.contentDiv),this.editorCanvas=document.createElement("div"),this.editorCanvas.style.flexGrow="2",this.editorCanvas.style.flexShrink="1",this.editorCanvas.style.position="relative",this.editorCanvas.style.overflow="hidden",this.editorCanvas.style.display="flex",this.settings.displayMode==="popup"&&(this.editorCanvas.style.alignItems="center",this.editorCanvas.style.justifyContent="center"),this.editorCanvas.style.pointerEvents="none",this.editorCanvas.style.transformOrigin="left top",this.editorCanvas.style.transform="scale("+this.zoomLevel+")",this.contentDiv.appendChild(this.editorCanvas),this.editingTarget=this.target instanceof HTMLImageElement?document.createElement("img"):document.createElement("canvas"),this.target.getClientRects().item(0).y<this.styles.settings.toolbarHeight&&(this.editingTarget.style.marginTop=this.target.offsetTop-this.styles.settings.toolbarHeight+"px"),this.editorCanvas.appendChild(this.editingTarget),this.toolbox=new Pe(this.uiDiv,this.settings.displayMode,this.uiStyleSettings,this.styles),this.toolbox.show(this._silentRenderMode||this.uiStyleSettings.hideToolbox?"hidden":"visible")},z.prototype.closeUI=function(){this.settings.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},z.prototype.removeMarker=function(s){this.markerImage.removeChild(s.container),this.markers.indexOf(s)>-1&&this.markers.splice(this.markers.indexOf(s),1),s.dispose()},z.prototype.switchToSelectMode=function(){this.mode="select",this.hideNotesEditor(),this._currentMarker!==void 0&&(this._currentMarker.state!=="new"?this._currentMarker.select():(this.removeMarker(this._currentMarker),this.setCurrentMarker(),this.markerImage.style.cursor="default"),this.addUndoStep())},z.prototype.toolbarButtonClicked=function(s,f){if(s==="marker"&&f!==void 0)this.createNewMarker(f);else if(s==="action")switch(f){case"select":this.switchToSelectMode(),this.switchToSelectMode();break;case"delete":this.deleteSelectedMarker();break;case"clear":this.clear();break;case"undo":this.undo();break;case"redo":this.redo();break;case"zoom":this.stepZoom();break;case"zoom-out":this.zoomLevel=1;break;case"notes":this.notesArea===void 0?(this.switchToSelectMode(),this.zoomLevel=1,this.showNotesEditor()):this.switchToSelectMode();break;case"close":this.close();break;case"render":this.switchToSelectMode(),this.startRenderAndClose()}},z.prototype.deleteSelectedMarker=function(){var s=this;if(this._currentMarker!==void 0){var f=!1;if(this.eventListeners.markerbeforedelete.forEach(function(X){var H=new ht(s,s._currentMarker,!0);X(H),H.defaultPrevented&&(f=!0)}),!f){var W=this._currentMarker;this._currentMarker.dispose(),this.markerImage.removeChild(this._currentMarker.container),this.markers.splice(this.markers.indexOf(this._currentMarker),1),this.setCurrentMarker(),this.addUndoStep(),this.eventListeners.markerdelete.forEach(function(X){return X(new ht(s,W))})}}},z.prototype.clear=function(){var s=this,f=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(ve){var He=new ht(s,void 0,!0);ve(He),He.defaultPrevented&&(f=!0)}),!f)){this.setCurrentMarker();for(var W=function(ve){var He=X.markers[ve];X.setCurrentMarker(X.markers[ve]),X._currentMarker.dispose(),X.markerImage.removeChild(X._currentMarker.container),X.markers.splice(X.markers.indexOf(X._currentMarker),1),X.eventListeners.markerdelete.forEach(function(qe){return qe(new ht(s,He))})},X=this,H=this.markers.length-1;H>=0;H--)W(H);this.addUndoStep()}},Object.defineProperty(z.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),z.prototype.showNotesEditor=function(){var s;this._currentMarker!==void 0&&(this.overlayContainer.innerHTML="",this.notesArea=document.createElement("textarea"),this.notesArea.className=this.uiStyleSettings.notesAreaStyleClassName,this.notesArea.style.pointerEvents="auto",this.notesArea.style.alignSelf="stretch",this.notesArea.style.width="100%",this.notesArea.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.notesArea.value=(s=this._currentMarker.notes)!==null&&s!==void 0?s:"",this.overlayContainer.appendChild(this.notesArea))},z.prototype.hideNotesEditor=function(){this.isNotesAreaOpen&&(this._currentMarker!==void 0&&(this._currentMarker.notes=this.notesArea.value.trim()!==""?this.notesArea.value:void 0),this.overlayContainer.removeChild(this.notesArea),this.notesArea=void 0)},z.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},z.prototype.addUndoStep=function(){var s=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var f=this.getState(),W=this.undoRedoManager.getLastUndoStep();if(!W||W.width===f.width&&W.height===f.height){var X=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(f),X<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach(function(H){return H(new kt(s))})}else this.undoRedoManager.replaceLastUndoStep(f),this.eventListeners.statechange.forEach(function(H){return H(new kt(s))})}},z.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},z.prototype.undoStep=function(){var s=this,f=this.undoRedoManager.undo();f!==void 0&&(this.restoreState(f),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(W){return W(new kt(s))}))},z.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},z.prototype.redoStep=function(){var s=this,f=this.undoRedoManager.redo();f!==void 0&&(this.restoreState(f),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(W){return W(new kt(s))}))},z.prototype.stepZoom=function(){var s=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=s<this.zoomSteps.length-1?this.zoomSteps[s+1]:this.zoomSteps[0]},z.prototype.panTo=function(s){this.contentDiv.scrollBy({left:this.prevPanPoint.x-s.x,top:this.prevPanPoint.y-s.y}),this.prevPanPoint=s},z.prototype.startRenderAndClose=function(){return Le(this,void 0,void 0,function(){var s,f,W=this;return be(this,function(X){switch(X.label){case 0:return[4,this.render()];case 1:return s=X.sent(),f=this.getState(),this.eventListeners.render.forEach(function(H){return H(new Et(W,s,f))}),this.close(!0),[2]}})})},z.prototype.getState=function(s){s===!0&&this.setCurrentMarker();var f={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach(function(W){return f.markers.push(W.getState())}),f},z.prototype.restoreState=function(s){var f=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);s.markers.forEach(function(W){var X=f._availableMarkerTypes.find(function(ve){return ve.typeName===W.typeName});if(X!==void 0){var H=f.addNewMarker(X);H.restoreState(W),f.markers.push(H)}}),s.width&&s.height&&(s.width!==this.imageWidth||s.height!==this.imageHeight)&&this.scaleMarkers(this.imageWidth/s.width,this.imageHeight/s.height),this.eventListeners.restorestate.forEach(function(W){return W(new kt(f))})},z.prototype.addNewMarker=function(s){var f=se.createGroup();return this.markerImage.appendChild(f),new s(f,this.overlayContainer,this.settings)},z.prototype.createNewMarker=function(s){var f,W=this;(f=typeof s=="string"?this._availableMarkerTypes.find(function(X){return X.typeName===s}):s)&&(this.setCurrentMarker(),this.addUndoStep(),this._currentMarker=this.addNewMarker(f),this._currentMarker.onMarkerCreated=this.markerCreated,this._currentMarker.onColorChanged=this.colorChanged,this._currentMarker.onFillColorChanged=this.fillColorChanged,this._currentMarker.onStateChanged=this.markerStateChanged,this.markerImage.style.cursor="crosshair",this.toolbar.setActiveMarkerButton(f.typeName),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this.eventListeners.markercreating.forEach(function(X){return X(new ht(W,W._currentMarker))}))},z.prototype.markerCreated=function(s){var f=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(s),this.setCurrentMarker(s),s instanceof Ee&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(Ee):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function(W){return W(new ht(f,f._currentMarker))})},z.prototype.colorChanged=function(s){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=s,this.settings.defaultStrokeColor=s)},z.prototype.fillColorChanged=function(s){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=s)},z.prototype.markerStateChanged=function(s){var f=this;this.eventListeners.markerchange.forEach(function(W){return W(new ht(f,s))})},z.prototype.setCurrentMarker=function(s){var f=this;this._currentMarker!==s&&this._currentMarker!==void 0&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach(function(W){return W(new ht(f,f._currentMarker))})),this._currentMarker=s,this._currentMarker===void 0||this._currentMarker.isSelected||(this._currentMarker.state!=="new"&&this._currentMarker.select(),this.toolbar.setCurrentMarker(this._currentMarker),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this._isResizing||this.eventListeners.markerselect.forEach(function(W){return W(new ht(f,f._currentMarker))}))},z.prototype.onPointerDown=function(s){if(this._isFocused||this.focus(),this.touchPoints++,this.touchPoints===1||s.pointerType!=="touch")if(this._currentMarker===void 0||this._currentMarker.state!=="new"&&this._currentMarker.state!=="creating"){if(this.mode==="select"){var f=this.markers.find(function(W){return W.ownsTarget(s.target)});f!==void 0?(this.setCurrentMarker(f),this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(s.clientX,s.clientY),s.target)):(this.setCurrentMarker(),this.isDragging=!0,this.prevPanPoint={x:s.clientX,y:s.clientY})}}else this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(s.clientX,s.clientY))},z.prototype.onDblClick=function(s){if(this._isFocused||this.focus(),this.mode==="select"){var f=this.markers.find(function(W){return W.ownsTarget(s.target)});f!==void 0&&f!==this._currentMarker&&this.setCurrentMarker(f),this._currentMarker!==void 0?this._currentMarker.dblClick(this.clientToLocalCoordinates(s.clientX,s.clientY),s.target):this.setCurrentMarker()}},z.prototype.onPointerMove=function(s){this.touchPoints!==1&&s.pointerType==="touch"||(this._currentMarker!==void 0||this.isDragging)&&(this._currentMarker!==void 0&&this._currentMarker.state==="edit"||s.preventDefault(),this._currentMarker!==void 0?this._currentMarker.manipulate(this.clientToLocalCoordinates(s.clientX,s.clientY)):this.zoomLevel>1&&this.panTo({x:s.clientX,y:s.clientY}))},z.prototype.onPointerUp=function(s){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(s.clientX,s.clientY)),this.isDragging=!1,this.addUndoStep()},z.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},z.prototype.onKeyUp=function(s){this._currentMarker===void 0||this.notesArea!==void 0||s.key!=="Delete"&&s.key!=="Backspace"||this.deleteSelectedMarker()},z.prototype.clientToLocalCoordinates=function(s,f){var W=this.markerImage.getBoundingClientRect();return{x:(s-W.left)/this.zoomLevel,y:(f-W.top)/this.zoomLevel}},z.prototype.onWindowResize=function(){this.positionUI()},z.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var s=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=s+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px";break;case"popup":this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=this.windowHeight+"px",this.contentDiv.style.maxHeight=this.windowHeight-2*this.settings.popupMargin-3.5*this.styles.settings.toolbarHeight+"px"}this.positionMarkerImage(),this.positionLogo()},z.prototype.addLicenseKey=function(s){te.addKey(s)},z.prototype.addEventListener=function(s,f){this.eventListeners.addEventListener(s,f)},z.prototype.removeEventListener=function(s,f){this.eventListeners.removeEventListener(s,f)},z.prototype.renderState=function(s){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(s),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(z.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),z.prototype.focus=function(){var s=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,this._previousCurrentMarker!==void 0&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach(function(f){return f(new kt(s))}))},z.prototype.blur=function(){var s=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(f){return f(new kt(s))}))},z.instanceCounter=0,z}();/* **********************************
cropro version 1.2.0
@license SEE LICENSE IN LICENSE
copyright Alan Mendelevich
see README and LICENSE for details
********************************** *//*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var At=function(z,s){return(At=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(f,W){f.__proto__=W}||function(f,W){for(var X in W)Object.prototype.hasOwnProperty.call(W,X)&&(f[X]=W[X])})(z,s)};function Dt(z,s){if(typeof s!="function"&&s!==null)throw new TypeError("Class extends value "+String(s)+" is not a constructor or null");function f(){this.constructor=z}At(z,s),z.prototype=s===null?Object.create(s):(f.prototype=s.prototype,new f)}function Ze(z,s,f,W){return new(f||(f=Promise))(function(X,H){function ve(ft){try{qe(W.next(ft))}catch(Ge){H(Ge)}}function He(ft){try{qe(W.throw(ft))}catch(Ge){H(Ge)}}function qe(ft){var Ge;ft.done?X(ft.value):(Ge=ft.value,Ge instanceof f?Ge:new f(function(Ct){Ct(Ge)})).then(ve,He)}qe((W=W.apply(z,s||[])).next())})}function Er(z,s){var f,W,X,H,ve={label:0,sent:function(){if(1&X[0])throw X[1];return X[1]},trys:[],ops:[]};return H={next:He(0),throw:He(1),return:He(2)},typeof Symbol=="function"&&(H[Symbol.iterator]=function(){return this}),H;function He(qe){return function(ft){return function(Ge){if(f)throw new TypeError("Generator is already executing.");for(;ve;)try{if(f=1,W&&(X=2&Ge[0]?W.return:Ge[0]?W.throw||((X=W.return)&&X.call(W),0):W.next)&&!(X=X.call(W,Ge[1])).done)return X;switch(W=0,X&&(Ge=[2&Ge[0],X.value]),Ge[0]){case 0:case 1:X=Ge;break;case 4:return ve.label++,{value:Ge[1],done:!1};case 5:ve.label++,W=Ge[1],Ge=[0];continue;case 7:Ge=ve.ops.pop(),ve.trys.pop();continue;default:if(!(X=ve.trys,(X=X.length>0&&X[X.length-1])||Ge[0]!==6&&Ge[0]!==2)){ve=0;continue}if(Ge[0]===3&&(!X||Ge[1]>X[0]&&Ge[1]<X[3])){ve.label=Ge[1];break}if(Ge[0]===6&&ve.label<X[1]){ve.label=X[1],X=Ge;break}if(X&&ve.label<X[2]){ve.label=X[2],ve.ops.push(Ge);break}X[2]&&ve.ops.pop(),ve.trys.pop();continue}Ge=s.call(z,ve)}catch(Ct){Ge=[6,Ct],W=0}finally{f=X=0}if(5&Ge[0])throw Ge[1];return{value:Ge[0]?Ge[1]:void 0,done:!0}}([qe,ft])}}}var _r=function(){function z(){}return z.addKey=function(s){z.key=s},Object.defineProperty(z,"isLicensed",{get:function(){return!!z.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(z.key)},enumerable:!1,configurable:!0}),z}(),bt=function(){function z(){}return z.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},z.setAttributes=function(s,f){for(var W=0,X=f;W<X.length;W++){var H=X[W],ve=H[0],He=H[1];s.setAttribute(ve,He)}},z.createRect=function(s,f,W){var X=document.createElementNS("http://www.w3.org/2000/svg","rect");return X.setAttribute("width",s.toString()),X.setAttribute("height",f.toString()),W&&z.setAttributes(X,W),X},z.createLine=function(s,f,W,X,H){var ve=document.createElementNS("http://www.w3.org/2000/svg","line");return ve.setAttribute("x1",s.toString()),ve.setAttribute("y1",f.toString()),ve.setAttribute("x2",W.toString()),ve.setAttribute("y2",X.toString()),H&&z.setAttributes(ve,H),ve},z.createPolygon=function(s,f){var W=document.createElementNS("http://www.w3.org/2000/svg","polygon");return W.setAttribute("points",s),f&&z.setAttributes(W,f),W},z.createCircle=function(s,f){var W=document.createElementNS("http://www.w3.org/2000/svg","circle");return W.setAttribute("cx",(s/2).toString()),W.setAttribute("cy",(s/2).toString()),W.setAttribute("r",s.toString()),f&&z.setAttributes(W,f),W},z.createEllipse=function(s,f,W){var X=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return X.setAttribute("cx",(s/2).toString()),X.setAttribute("cy",(f/2).toString()),X.setAttribute("rx",(s/2).toString()),X.setAttribute("ry",(f/2).toString()),W&&z.setAttributes(X,W),X},z.createGroup=function(s){var f=document.createElementNS("http://www.w3.org/2000/svg","g");return s&&z.setAttributes(f,s),f},z.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},z.createMarker=function(s,f,W,X,H,ve,He){var qe=document.createElementNS("http://www.w3.org/2000/svg","marker");return z.setAttributes(qe,[["id",s],["orient",f],["markerWidth",W.toString()],["markerHeight",X.toString()],["refX",H.toString()],["refY",ve.toString()]]),qe.appendChild(He),qe},z.createText=function(s){var f=document.createElementNS("http://www.w3.org/2000/svg","text");return f.setAttribute("x","0"),f.setAttribute("y","0"),s&&z.setAttributes(f,s),f},z.createTSpan=function(s,f){var W=document.createElementNS("http://www.w3.org/2000/svg","tspan");return W.textContent=s,f&&z.setAttributes(W,f),W},z.createImage=function(s){var f=document.createElementNS("http://www.w3.org/2000/svg","image");return s&&z.setAttributes(f,s),f},z.createPoint=function(s,f){var W=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return W.x=s,W.y=f,W},z.createPath=function(s,f){var W=document.createElementNS("http://www.w3.org/2000/svg","path");return W.setAttribute("d",s),f&&z.setAttributes(W,f),W},z.createElement=function(s,f){var W=document.createElementNS("http://www.w3.org/2000/svg",s);return f&&z.setAttributes(W,f),W},z.getHollowRectanglePath=function(s,f,W,X,H,ve,He,qe){return"M"+s+","+f+"V"+(f+X)+"H"+(s+W)+"V"+f+"H"+H+"V"+ve+"H"+(H+He)+"V"+(ve+qe)+"H"+H+"V"+f+"Z"},z}(),Yt=function(){function z(s){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+s+"_"}return Object.defineProperty(z.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"defaultSettings",{get:function(){return{canvasBackgroundColor:"#333333",toolbarBackgroundColor:"#111111",toolbarBackgroundHoverColor:"#333333",toolbarBackgroundActiveColor:"#282828",toolbarColor:"#eeeeee",cropShadeColor:"#ffffff",cropFrameColor:"#ffffff",gripColor:"#333333",gripFillColor:"#cccccc",toolbarHeight:40}},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_out"},enumerable:!1,configurable:!0}),z.prototype.addClass=function(s){return this.styleSheet===void 0&&this.addStyleSheet(),s.name=""+this.classNamePrefix+s.localName,this.classes.push(s),this.styleSheet.sheet.insertRule("."+s.name+" {"+s.style+"}",this.styleSheet.sheet.cssRules.length),s},z.prototype.addRule=function(s){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(s),this.styleSheet.sheet.insertRule(s.selector+" {"+s.style+"}",this.styleSheet.sheet.cssRules.length)},z.prototype.addStyleSheet=function(){var s;this.styleSheet=document.createElement("style"),((s=this.styleSheetRoot)!==null&&s!==void 0?s:document.head).appendChild(this.styleSheet),this.addRule(new qt("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new qt("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new qt("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
from {
opacity: 1;
}
to {
opacity: 0;
}
`)),this.addClass(new rr("_fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new rr("_fade_out",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
`))},z.prototype.removeStyleSheet=function(){var s;this.styleSheet&&(((s=this.styleSheetRoot)!==null&&s!==void 0?s:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},z}(),qt=function(z,s){this.selector=z,this.style=s},rr=function(z,s){this.localName=z,this.style=s},Br=function(){function z(){this.blocks=[],this.display=""}return z.prototype.addButtonBlock=function(s){s.className=this.blockClassName,s.buttonClassName=this.buttonClassName,s.buttonColorsClassName=this.buttonColorsClassName,s.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(s)},z.prototype.addElementBlock=function(s){s.className===void 0&&(s.className=this.blockClassName),this.blocks.push(s)},z.prototype.getUI=function(){var s=document.createElement("div");return s.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,s.style.display=this.display,this.blocks.forEach(function(f){return s.appendChild(f.getUI())}),s},z}(),Sr=function(){function z(){}return z.prototype.getUI=function(){var s=document.createElement("div");if(s.className=this.className,this.minWidth!==void 0&&(s.style.minWidth=this.minWidth),this.contentAlign!==void 0)switch(this.contentAlign){case"start":s.style.justifyContent="flex-start";break;case"center":s.style.justifyContent="center";break;case"end":s.style.justifyContent="flex-end"}return s.style.whiteSpace="nowrap",s},z}(),si=function(z){function s(){var f=z!==null&&z.apply(this,arguments)||this;return f.buttons=[],f}return Dt(s,z),s.prototype.addButton=function(f){f.className=this.buttonClassName,f.colorsClassName=this.buttonColorsClassName,f.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(f)},s.prototype.getUI=function(){var f=z.prototype.getUI.call(this);return this.buttons.forEach(function(W){return f.appendChild(W.getUI())}),f},s}(Sr),Nt=function(){function z(s,f){this._isActive=!1,this._isHidden=!1,this._icon=s,this.title=f,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(z.prototype,"icon",{get:function(){return this._icon},set:function(s){this._icon=s,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isActive",{get:function(){return this._isActive},set:function(s){this._isActive=s,this.adjustClassName()},enumerable:!1,configurable:!0}),z.prototype.getUI=function(){var s=this;return this.buttonContainer=document.createElement("div"),this.buttonContainer.title=this.title,this.buttonContainer.className=this.className+" "+this.colorsClassName,this.adjustClassName(),this.buttonContainer.innerHTML=this._icon,this.onClick&&this.buttonContainer.addEventListener("click",function(){return s.onClick()}),this.uiContainer.appendChild(this.buttonContainer),this.uiContainer.style.display=this._isHidden?"none":"inline-block",this.uiContainer},z.prototype.adjustClassName=function(){this.activeColorsClassName&&(this._isActive&&this.buttonContainer.className.indexOf(this.activeColorsClassName)<0?this.buttonContainer.className+=" "+this.activeColorsClassName:this._isActive||(this.buttonContainer.className=this.buttonContainer.className.replace(this.activeColorsClassName,"")))},z.prototype.hide=function(){this._isHidden=!0},z}(),mt=function(z){function s(){var f=z!==null&&z.apply(this,arguments)||this;return f.elements=[],f}return Dt(s,z),s.prototype.addElement=function(f){this.elements.push(f)},s.prototype.getUI=function(){var f=z.prototype.getUI.call(this);return this.elements.forEach(function(W){return f.appendChild(W)}),f},s}(Sr),Ur=function(){function z(s,f){this.horizontal=s,this.vertical=f}return Object.defineProperty(z.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),z.prototype.getVerticalLength=function(s){return s/this.ratio},z.prototype.getHorizontalLength=function(s){return s*this.ratio},z}(),li=function(){function z(){}return z.getIcon=function(s,f){if(s>0&&f>0){var W=new Ur(s,f),X=W.ratio>=1?20:W.getHorizontalLength(20),H=W.ratio<1?20:W.getVerticalLength(20),ve=document.createElementNS("http://www.w3.org/2000/svg","svg");ve.setAttribute("xmlns","http://www.w3.org/2000/svg"),ve.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(ve);var He=bt.createDefs();ve.appendChild(He);var qe=bt.createElement("clipPath",[["id","text-bg-clip"]]);He.appendChild(qe);var ft=bt.createPath(bt.getHollowRectanglePath((24-X)/2,(24-H)/2,X,H,(24-X)/2+2,(24-H)/2+2,X-4,H-4));ve.appendChild(ft);var Ge=bt.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);Ge.appendChild(bt.createTSpan(s+":"+f)),ve.appendChild(Ge);var Ct=Ge.getBBox();bt.setAttributes(Ge,[["x",((24-Ct.width)/2).toString()],["y",((24-Ct.height)/2-Ct.y).toString()]]);var Mt=bt.createPath(bt.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(Ct.width))/2,(24-Math.ceil(Ct.height))/2,Math.ceil(Ct.width),Math.ceil(Ct.height)));return qe.appendChild(Mt),bt.setAttributes(ft,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(ve),ve.outerHTML}return'<svg viewBox="0 0 24 24"><path d="M19 12h-2v3h-3v2h5v-5M7 9h3V7H5v5h2V9m14-6H3a2 2 0 00-2 2v14a2 2 0 002 2h18a2 2 0 002-2V5a2 2 0 00-2-2m0 16H3V5h18v14z"/></svg>'},z}(),Cr=function(z){function s(f,W,X){var H=z.call(this,f,W)||this;return H.isDropdownOpen=!1,H.onClick=H.dropdownButtonClicked,H.dropdownButtons=X,H}return Dt(s,z),s.prototype.setupDropdown=function(){var f=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(W){W.className=f.className,W.colorsClassName=f.colorsClassName,f.dropdownBlock.appendChild(W.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},s.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},s.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},s.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},s.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},s.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},s}(Nt),Ot=function(){function z(s,f){this.GRIP_SIZE=10,this.color=s,this.fillColor=f,this.visual=bt.createGroup(),this.visual.appendChild(bt.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(bt.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return z.prototype.ownsTarget=function(s){return s===this.visual||s===this.visual.childNodes[0]||s===this.visual.childNodes[1]},z.prototype.setCenter=function(s,f){this.visual.childNodes.forEach(function(W){return bt.setAttributes(W,[["cx",s.toString()],["cy",f.toString()]])})},z}(),Fr=function(){function z(s,f,W,X){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=s,this.canvasHeight=f,this.margin=W,this.container=X,this.attachEvents=this.attachEvents.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.resize=this.resize.bind(this),this.adjustCropRect=this.adjustCropRect.bind(this),this.scaleCanvas=this.scaleCanvas.bind(this),this.getRescaledRect=this.getRescaledRect.bind(this)}return Object.defineProperty(z.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(s){this._aspectRatio=s,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(s){this._isGridVisible=s,this.gridContainer&&bt.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(s){this._zoomFactor=s,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),z.prototype.open=function(){var s=this;this.cropShadeElement=bt.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=bt.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var f=0;f<this.numberOfGridLines;f++)this.horizontalGridLines.push(bt.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(bt.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach(function(W){return s.gridContainer.appendChild(W)}),this.verticalGridLines.forEach(function(W){return s.gridContainer.appendChild(W)}),this.cropRectElement=bt.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new Ot(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new Ot(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new Ot(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new Ot(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},z.prototype.setCropRectangle=function(s){this.cropRect=s;var f=Object.assign({},this.cropRect);this.zoomFactor!==1&&(f.width=this.cropRect.width*this.zoomFactor,f.height=this.cropRect.height*this.zoomFactor,f.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-f.width/2,f.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-f.height/2),bt.setAttributes(this.cropRectElement,[["x",f.x.toString()],["y",f.y.toString()],["width",f.width.toString()],["height",f.height.toString()]]);var W=f.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(H,ve){var He=f.y+W*(ve+1);bt.setAttributes(H,[["x1",""+f.x],["y1",""+He],["x2",""+(f.x+f.width)],["y2",""+He]])});var X=f.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(H,ve){var He=f.x+X*(ve+1);bt.setAttributes(H,[["x1",""+He],["y1",""+f.y],["x2",""+He],["y2",""+(f.y+f.height)]])}),bt.setAttributes(this.cropShadeElement,[["d",bt.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,f.x,f.y,f.width,f.height)]]),this.topLeftGrip.setCenter(f.x,f.y),this.topRightGrip.setCenter(f.x+f.width,f.y),this.bottomLeftGrip.setCenter(f.x,f.y+f.height),this.bottomRightGrip.setCenter(f.x+f.width,f.y+f.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},z.prototype.attachEvents=function(){this.container.style.touchAction="none",this.container.addEventListener("pointerdown",this.onPointerDown),this.container.addEventListener("pointermove",this.onPointerMove),this.container.addEventListener("pointerup",this.onPointerUp)},z.prototype.clientToLocalCoordinates=function(s,f){var W=this.container.getBoundingClientRect();return{x:s-W.left+this.margin,y:f-W.top+this.margin}},z.prototype.onPointerDown=function(s){this.container.setPointerCapture(s.pointerId),this.previousPoint=this.clientToLocalCoordinates(s.clientX,s.clientY),this.cropRectElement===s.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(s.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(s.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(s.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(s.target)&&(this.activeGrip=this.bottomRightGrip)},z.prototype.onPointerMove=function(s){if(this.isMoving)this.move(this.clientToLocalCoordinates(s.clientX,s.clientY));else if(this.activeGrip){var f=this.clientToLocalCoordinates(s.clientX,s.clientY);this.resize(f)}s.preventDefault()},z.prototype.onPointerUp=function(s){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(s.pointerId)},z.prototype.move=function(s){var f=s.x-this.previousPoint.x,W=s.y-this.previousPoint.y;this.zoomFactor!==1&&(f=-f/this.zoomFactor,W=-W/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+f),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+W),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=s},z.prototype.resize=function(s){var f=Object.assign({},this.cropRect),W=s.x-this.previousPoint.x,X=s.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:f.x+W<this.margin&&(W=this.margin-f.x),f.x+=W,f.width=this.cropRect.x+this.cropRect.width-f.x;break;case this.bottomRightGrip:case this.topRightGrip:f.width+W>this.canvasWidth*this.zoomFactor&&(W=this.canvasWidth*this.zoomFactor-f.width),f.width+=W}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(f.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(W),f.height=this.aspectRatio.getVerticalLength(f.width)):(f.y+=X,f.height=this.cropRect.y+this.cropRect.height-f.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?f.height=this.aspectRatio.getVerticalLength(f.width):f.height+=X}f.width<10&&(f.x=this.cropRect.x,f.width=10),f.height<10&&(f.y=this.cropRect.y,f.height=10),this.previousPoint=s,f.x>=this.margin&&f.y>=this.margin&&f.x-this.margin+f.width<=this.canvasWidth&&f.y-this.margin+f.height<=this.canvasHeight&&(this.cropRect=f,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},z.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var s=this.cropRect.x+this.cropRect.width/2,f=this.cropRect.y+this.cropRect.height/2,W=this.aspectRatio.getHorizontalLength(this.cropRect.height),X=this.aspectRatio.getVerticalLength(this.cropRect.width);W/this.canvasWidth<X/this.canvasHeight?this.cropRect.width=W:this.cropRect.height=X,this.cropRect.width>this.canvasWidth&&(this.cropRect.height/=this.cropRect.width/this.canvasWidth,this.cropRect.width=this.canvasWidth),this.cropRect.height>this.canvasHeight&&(this.cropRect.width/=this.cropRect.height/this.canvasHeight,this.cropRect.height=this.canvasHeight),this.cropRect.x=s-this.cropRect.width/2,this.cropRect.y=f-this.cropRect.height/2,this.cropRect.x+this.cropRect.width>this.margin+this.canvasWidth&&(this.cropRect.x=this.margin+this.canvasWidth-this.cropRect.width),this.cropRect.y+this.cropRect.height>this.margin+this.canvasHeight&&(this.cropRect.y=this.margin+this.canvasHeight-this.cropRect.height),this.cropRect.x=Math.max(this.cropRect.x,this.margin),this.cropRect.y=Math.max(this.cropRect.y,this.margin)}},z.prototype.getRescaledRect=function(s,f,W,X,H,ve){var He=W/s,qe=X/f;return{x:(H.x-ve)*He+ve,y:(H.y-ve)*qe+ve,width:H.width*He,height:H.height*qe}},z.prototype.scaleCanvas=function(s,f){var W=this.getRescaledRect(this.canvasWidth,this.canvasHeight,s,f,this.cropRect,this.margin);this.canvasWidth=s,this.canvasHeight=f,this.onCropChange&&this.onCropChange(W),this.setCropRectangle(W)},z}(),$r=function(){function z(s){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=s,this.uiContainer=document.createElement("div"),this.getUI=this.getUI.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.setAngleLabel=this.setAngleLabel.bind(this),this.positionScaleShape=this.positionScaleShape.bind(this)}return Object.defineProperty(z.prototype,"angle",{get:function(){return this._angle},set:function(s){this._angle=s,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),z.prototype.getUI=function(){return this.controlContainer=document.createElement("div"),this.controlContainer.title=this.title,this.controlContainer.className=this.className+" "+this.colorsClassName,this.controlContainer.appendChild(this.getVisual()),this.controlContainer.addEventListener("pointerdown",this.onPointerDown),this.controlContainer.addEventListener("pointermove",this.onPointerMove),this.controlContainer.addEventListener("pointerup",this.onPointerUp),this.uiContainer.appendChild(this.controlContainer),this.uiContainer.style.display="inline-block",this.uiContainer.style.touchAction="none",this.setAngleLabel(),this.positionScaleShape(),this.uiContainer},z.prototype.onPointerDown=function(s){this.controlContainer.setPointerCapture(s.pointerId),this.isDragging=!0,this.previousPoint={x:s.clientX,y:s.clientY}},z.prototype.onPointerMove=function(s){this.isDragging&&(this.onAngleChange&&this.onAngleChange((s.clientX-this.previousPoint.x)/5),this.previousPoint.x=s.clientX)},z.prototype.onPointerUp=function(s){this.isDragging&&this.onAngleChange&&this.onAngleChange((s.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(s.pointerId)},z.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var s=this.angleLabelText.getBBox();bt.setAttributes(this.angleLabelElement,[["x",((this.width-s.width)/2).toString()],["y",(this.height/2).toString()]])}},z.prototype.positionScaleShape=function(){if(this.scaleShape){var s=this.scaleShape.transform.baseVal.getItem(0);s.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(s,0)}},z.prototype.getVisual=function(){var s=document.createElementNS("http://www.w3.org/2000/svg","svg");s.setAttribute("xmlns","http://www.w3.org/2000/svg"),s.setAttribute("width",this.width+"px"),s.setAttribute("height",this.height+"px"),s.setAttribute("viewBox","0 0 "+this.width+" "+this.height),s.style.flexShrink="0",document.body.appendChild(s);for(var f="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,W=1;W<=this.width/5+10;W++){var X=W%5==0?this.height/3:this.height/6;f+="h4v"+-X+"h1v"+X}f+="v1H0Z",this.scaleShape=bt.createPath(f);var H=bt.createTransform();this.scaleShape.transform.baseVal.appendItem(H),s.appendChild(this.scaleShape),this.angleLabelElement=bt.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=bt.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var ve=bt.createTSpan("");return ve.innerHTML="&deg;",this.angleLabelElement.appendChild(ve),s.appendChild(this.angleLabelElement),document.body.removeChild(s),s},z}(),ui=function(){function z(){this.naturalSize=!1,this.imageType="image/png"}return z.prototype.rasterize=function(s,f,W,X,H,ve,He){var qe=this;return new Promise(function(ft){var Ge=document.createElement("canvas");Ge.width=s.width.baseVal.value-2*X,Ge.height=s.height.baseVal.value-2*X;var Ct=1,Mt=1;qe.naturalSize===!0?(Ct=f.naturalWidth/(s.width.baseVal.value-2*X)/ve,Mt=f.naturalHeight/(s.height.baseVal.value-2*X)/He,Ge.width=f.naturalWidth/ve,Ge.height=f.naturalHeight/He):qe.width!==void 0&&qe.height!==void 0&&(Ct=qe.width/W.width,Mt=qe.height/W.height,Ge.width*=Ct,Ge.height*=Mt);var Vt=Ge.getContext("2d");Vt.translate(Ge.width/2,Ge.height/2),Vt.rotate(H*Math.PI/180),Vt.scale(ve,He),Vt.translate(-Ge.width/2,-Ge.height/2),Vt.drawImage(f,0,0,Ge.width,Ge.height);var jr=document.createElement("canvas");jr.width=W.width*Ct,jr.height=W.height*Mt,jr.getContext("2d").putImageData(Vt.getImageData((W.x-X)*Ct,(W.y-X)*Mt,W.width*Ct,W.height*Mt),0,0),ft(jr.toDataURL(qe.imageType,qe.imageQuality))})},z}(),Ve=function(){function z(s){this._zoomToCropEnabled=!0,this.zoomFactor=1,this.flippedHorizontally=!1,this.flippedVertically=!1,this._isGridVisible=!0,this._gridLines=2,this._rotationAngle=0,this.scaleFactor=1,this.renderEventListeners=[],this.closeEventListeners=[],this._isOpen=!1,this.CANVAS_MARGIN=20,this.renderAtNaturalSize=!1,this.renderImageType="image/png",this.displayMode="inline",this.popupMargin=30,this.toolbarHeight=40,this.aspectRatios=[{horizontal:0,vertical:0},{horizontal:4,vertical:3},{horizontal:3,vertical:2},{horizontal:16,vertical:9},{horizontal:1,vertical:1},{horizontal:3,vertical:4},{horizontal:2,vertical:3},{horizontal:9,vertical:16}],this._instanceNo=z.instanceCounter++,this.styles=new Yt(this.instanceNo),this.target=s,this.targetRoot=document.body,this.open=this.open.bind(this),this.setTopLeft=this.setTopLeft.bind(this),this.overrideOverflow=this.overrideOverflow.bind(this),this.restoreOverflow=this.restoreOverflow.bind(this),this.close=this.close.bind(this),this.closeUI=this.closeUI.bind(this),this.addCloseEventListener=this.addCloseEventListener.bind(this),this.removeCloseEventListener=this.removeCloseEventListener.bind(this),this.addRenderEventListener=this.addRenderEventListener.bind(this),this.removeRenderEventListener=this.removeRenderEventListener.bind(this),this.clientToLocalCoordinates=this.clientToLocalCoordinates.bind(this),this.onWindowResize=this.onWindowResize.bind(this),this.setWindowHeight=this.setWindowHeight.bind(this),this.rotateBy=this.rotateBy.bind(this),this.applyRotation=this.applyRotation.bind(this),this.cropRectChanged=this.cropRectChanged.bind(this),this.zoomToCrop=this.zoomToCrop.bind(this),this.unzoomFromCrop=this.unzoomFromCrop.bind(this),this.rotateLeftButtonClicked=this.rotateLeftButtonClicked.bind(this),this.rotateRightButtonClicked=this.rotateRightButtonClicked.bind(this),this.flipHorizontallyButtonClicked=this.flipHorizontallyButtonClicked.bind(this),this.flipVerticallyButtonClicked=this.flipVerticallyButtonClicked.bind(this),this.applyFlip=this.applyFlip.bind(this),this.startRenderAndClose=this.startRenderAndClose.bind(this),this.render=this.render.bind(this),this.onPopupResize=this.onPopupResize.bind(this),this.applyAspectRatio=this.applyAspectRatio.bind(this)}return Object.defineProperty(z.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(s){this._zoomToCropEnabled=s,s?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(s){this._isGridVisible=s,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"gridLines",{get:function(){return this._gridLines},set:function(s){this._gridLines=s,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(s){this._rotationAngle=s,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"aspectRatio",{get:function(){var s;return(s=this._aspectRatio)!==null&&s!==void 0?s:this.aspectRatios[0]},set:function(s){this._aspectRatio=s},enumerable:!1,configurable:!0}),z.prototype.open=function(){this.imageWidth=Math.round(this.target.clientWidth),this.imageHeight=Math.round(this.target.clientHeight),this.setupResizeObserver(),this.initCropCanvas(),this.setEditingTarget(),this.setTopLeft(),this.initCropLayer(),this.attachEvents(),this.applyAspectRatio(),this.displayMode==="popup"&&this.onPopupResize(),this._isOpen=!0},z.prototype.show=function(){this.showUI(),this.open()},z.prototype.close=function(s){s===void 0&&(s=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),s||this.closeEventListeners.forEach(function(f){return f()}),this._isOpen=!1)},z.prototype.addRenderEventListener=function(s){this.renderEventListeners.push(s)},z.prototype.removeRenderEventListener=function(s){this.renderEventListeners.indexOf(s)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(s),1)},z.prototype.addCloseEventListener=function(s){this.closeEventListeners.push(s)},z.prototype.removeCloseEventListener=function(s){this.closeEventListeners.indexOf(s)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(s),1)},z.prototype.setupResizeObserver=function(){var s=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){s.resize(s.target.clientWidth,s.target.clientHeight)}),this.targetObserver.observe(this.target)):this.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(this.onPopupResize),this.targetObserver.observe(this.contentDiv)),window.addEventListener("resize",this.setWindowHeight))},z.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var s=1*this.target.clientWidth/this.target.clientHeight,f=this.contentDiv.clientWidth/s>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*s:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,W=f+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/s;this.resize(f,W)}},z.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},z.prototype.setEditingTargetSize=function(){this.editorCanvas.style.width=this.imageWidth+2*this.CANVAS_MARGIN+"px",this.editorCanvas.style.height=this.imageHeight+2*this.CANVAS_MARGIN+"px",bt.setAttributes(this.editingTarget,[["width",""+this.imageWidth],["height",""+this.imageHeight]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px"},z.prototype.resize=function(s,f){this.imageWidth=Math.round(s),this.imageHeight=Math.round(f),this.setEditingTargetSize(),this.cropImage.setAttribute("width",this.paddedImageWidth.toString()),this.cropImage.setAttribute("height",this.paddedImageHeight.toString()),this.cropImage.setAttribute("viewBox","0 0 "+this.paddedImageWidth.toString()+" "+this.paddedImageHeight.toString()),this.cropImageHolder.style.width=this.paddedImageWidth+"px",this.cropImageHolder.style.height=this.paddedImageHeight+"px",this.displayMode!=="popup"?this.coverDiv.style.width=this.paddedImageWidth+"px":(this.setTopLeft(),this.positionCropImage()),this.cropLayer.scaleCanvas(this.imageWidth,this.imageHeight),this.applyRotation()},z.prototype.setEditingTarget=function(){var s=document.createElement("canvas");s.width=this.target.naturalWidth,s.height=this.target.naturalHeight,s.getContext("2d").drawImage(this.target,0,0,this.target.naturalWidth,this.target.naturalHeight);var f=s.toDataURL();bt.setAttributes(this.editingTarget,[["href",f]]),this.setEditingTargetSize()},z.prototype.setTopLeft=function(){var s=this.target.getBoundingClientRect(),f=this.editorCanvas.getBoundingClientRect();this.left=s.left-f.left-this.CANVAS_MARGIN,this.top=s.top-f.top-this.CANVAS_MARGIN},z.prototype.initCropCanvas=function(){this.cropImageHolder=document.createElement("div"),this.cropImageHolder.style.setProperty("touch-action","none"),this.cropImageHolder.style.setProperty("-ms-touch-action","none"),this.cropImage=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.cropImage.setAttribute("xmlns","http://www.w3.org/2000/svg"),this.cropImage.setAttribute("width",this.paddedImageWidth.toString()),this.cropImage.setAttribute("height",this.paddedImageHeight.toString()),this.cropImage.setAttribute("viewBox","0 0 "+this.paddedImageWidth.toString()+" "+this.paddedImageHeight.toString()),this.cropImage.style.pointerEvents="auto",this.cropImageHolder.style.width=this.paddedImageWidth+"px",this.cropImageHolder.style.height=this.paddedImageHeight+"px",this.cropImageHolder.style.transformOrigin="top left",this.positionCropImage(),this.defs=bt.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=bt.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=bt.createGroup(),this.editingTargetRotationScaleContainer=bt.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var s=bt.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(s);var f=bt.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(f),this.editingTargetContainer=bt.createGroup(),this.editingTargetContainer.style.transform="translate("+this.CANVAS_MARGIN+"px, "+this.CANVAS_MARGIN+"px)",this.editingTargetContainer.appendChild(this.editingTargetRotationContainer),this.cropImage.appendChild(this.editingTargetContainer),this.cropImageHolder.appendChild(this.cropImage),this.editorCanvas.appendChild(this.cropImageHolder)},z.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},z.prototype.initCropLayer=function(){this.cropRect={x:this.CANVAS_MARGIN,y:this.CANVAS_MARGIN,width:this.imageWidth,height:this.imageHeight},this.cropLayerContainer=bt.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new Fr(this.imageWidth,this.imageHeight,this.CANVAS_MARGIN,this.cropLayerContainer),this.cropLayer.onCropChange=this.cropRectChanged,this.cropLayer.numberOfGridLines=this.gridLines,this.cropLayer.isGridVisible=this.isGridVisible,this.cropLayer.cropShadeColor=this.styles.settings.cropShadeColor,this.cropLayer.cropFrameColor=this.styles.settings.cropFrameColor,this.cropLayer.gripColor=this.styles.settings.gripColor,this.cropLayer.gripFillColor=this.styles.settings.gripFillColor,this.cropLayer.open(),this.cropLayer.setCropRectangle(this.cropRect),this.zoomToCropEnabled&&this.zoomToCrop()},z.prototype.zoomToCrop=function(){if(this.cropRect){var s=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,f=this.cropRect.y-this.CANVAS_MARGIN+this.cropRect.height/2;this.zoomFactor=Math.min(this.imageWidth/this.cropRect.width,this.imageHeight/this.cropRect.height),this.editingTargetContainer&&this.cropLayer&&(this.editingTargetContainer.style.transformOrigin=s+"px "+f+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-s+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-f+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},z.prototype.unzoomFromCrop=function(){this.zoomFactor=1,this.editingTargetContainer&&this.cropLayer&&(this.editingTargetContainer.style.transformOrigin="center",this.editingTargetContainer.style.transform="translate("+this.CANVAS_MARGIN+"px, "+this.CANVAS_MARGIN+"px) scale(1)",this.cropLayer.zoomFactor=this.zoomFactor)},z.prototype.cropRectChanged=function(s){this.cropRect=s,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1},z.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},z.prototype.overrideOverflow=function(){this.scrollXState=window.scrollX,this.scrollYState=window.scrollY,this.bodyOverflowState=document.body.style.overflow,window.scroll({top:0,left:0}),document.body.style.overflow="hidden"},z.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},z.prototype.showUI=function(){switch(this.addStyles(),this.displayMode==="popup"&&this.overrideOverflow(),this.coverDiv=document.createElement("div"),this.coverDiv.className=this.styles.classNamePrefixBase+" "+this.styles.classNamePrefix,this.coverDiv.style.fontSize="16px",this.displayMode){case"inline":this.coverDiv.style.position="absolute";var s=this.styles.settings.hideTopToolbar?0:this.toolbarHeight,f=this.target.offsetTop>s+this.CANVAS_MARGIN?this.target.offsetTop-(s+this.CANVAS_MARGIN):0;this.coverDiv.style.top=f+"px",this.coverDiv.style.left=(this.target.offsetLeft>this.CANVAS_MARGIN?this.target.offsetLeft-this.CANVAS_MARGIN:0)+"px",this.coverDiv.style.width=this.target.offsetWidth+this.CANVAS_MARGIN+"px",this.coverDiv.style.zIndex=this.styles.settings.zIndex!==void 0?this.styles.settings.zIndex:"5";break;case"popup":this.coverDiv.style.position="absolute",this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=window.innerHeight+"px",this.coverDiv.style.backgroundColor="rgba(0, 0, 0, 0.75)",this.coverDiv.style.zIndex=this.styles.settings.zIndex!==void 0?this.styles.settings.zIndex:"1000",this.coverDiv.style.display="flex"}this.targetRoot.appendChild(this.coverDiv),this.uiDiv=document.createElement("div"),this.uiDiv.style.display="flex",this.uiDiv.style.flexDirection="column",this.uiDiv.style.flexGrow="2",this.uiDiv.style.margin=this.displayMode==="popup"?this.popupMargin+"px":"0px",this.uiDiv.style.border="0px",this.coverDiv.appendChild(this.uiDiv),this.addToolbars(),this.uiDiv.appendChild(this.topToolbar.getUI()),this.contentDiv=document.createElement("div"),this.contentDiv.style.display="flex",this.contentDiv.style.alignItems="center",this.contentDiv.style.flexDirection="row",this.contentDiv.style.flexGrow="2",this.contentDiv.style.flexShrink="1",this.contentDiv.style.overflow="hidden",this.contentDiv.style.backgroundColor=this.styles.settings.canvasBackgroundColor,this.displayMode==="popup"&&(this.contentDiv.style.maxHeight="calc(100vh - "+(2*this.popupMargin+2*this.toolbarHeight)+"px)",this.contentDiv.style.maxWidth="calc(100vw - "+2*this.popupMargin+"px)"),this.uiDiv.appendChild(this.contentDiv),this.editorCanvas=document.createElement("div"),this.editorCanvas.style.flexGrow="2",this.editorCanvas.style.flexShrink="1",this.editorCanvas.style.position="relative",this.editorCanvas.style.overflow="hidden",this.editorCanvas.style.display="flex",this.displayMode==="popup"&&(this.editorCanvas.style.alignItems="center",this.editorCanvas.style.justifyContent="center"),this.editorCanvas.style.pointerEvents="none",this.contentDiv.appendChild(this.editorCanvas),this.uiDiv.appendChild(this.bottomToolbar.getUI()),this.straightener.angle=this.rotationAngle},z.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},z.prototype.addTopToolbar=function(){var s=this;this.topToolbar=new Br,this.topToolbar.display=this.styles.settings.hideTopToolbar?"none":"",this.topToolbar.className=this.toolbarStyleClass.name,this.topToolbar.colorsClassName=this.styles.settings.toolbarStyleColorsClassName?this.styles.settings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name,this.topToolbar.fadeInClassName=this.styles.fadeInAnimationClassName,this.topToolbar.blockClassName=this.toolbarBlockStyleClass.name,this.topToolbar.buttonClassName=this.toolbarButtonStyleClass.name,this.topToolbar.buttonColorsClassName=this.styles.settings.toolbarButtonStyleColorsClassName?this.styles.settings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,this.topToolbar.buttonActiveColorsClassName=this.styles.settings.toolbarActiveButtonStyleColorsClassName?this.styles.settings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name;var f=new si;f.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(f);var W=[];this.aspectRatios.forEach(function(Mt){var Vt=new Nt(li.getIcon(Mt.horizontal,Mt.vertical),Mt.horizontal===0&&Mt.vertical===0?"FREE":Mt.horizontal+":"+Mt.vertical);Vt.onClick=function(){return s.ratioButtonClicked(Mt)},W.push(Vt)}),this.aspectRatioButton=new Cr(li.getIcon(0,0),"Aspect ratio",W),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,f.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var X=new Nt('<svg viewBox="0 0 24 24"><path d="M10 4v4h4V4h-4m6 0v4h4V4h-4m0 6v4h4v-4h-4m0 6v4h4v-4h-4m-2 4v-4h-4v4h4m-6 0v-4H4v4h4m0-6v-4H4v4h4m0-6V4H4v4h4m2 6h4v-4h-4v4M4 2h16a2 2 0 012 2v16a2 2 0 01-2 2H4c-1.08 0-2-.9-2-2V4a2 2 0 012-2z"/></svg>',"Toggle grid");X.isActive=this.isGridVisible,X.onClick=function(){s.isGridVisible=!s.isGridVisible,X.isActive=s.isGridVisible},f.addButton(X);var H=new Nt('<svg viewBox="0 0 24 24"><path d="M15.5 14l5 5-1.5 1.5-5-5v-.79l-.27-.28A6.471 6.471 0 019.5 16 6.5 6.5 0 013 9.5 6.5 6.5 0 019.5 3 6.5 6.5 0 0116 9.5c0 1.61-.59 3.09-1.57 4.23l.28.27h.79m-6 0C12 14 14 12 14 9.5S12 5 9.5 5 5 7 5 9.5 7 14 9.5 14m2.5-4h-2v2H9v-2H7V9h2V7h1v2h2v1z"/></svg>',"Zoom to selection");if(H.isActive=this.zoomToCropEnabled,H.onClick=function(){s.zoomToCropEnabled=!s.zoomToCropEnabled,H.isActive=s.zoomToCropEnabled},f.addButton(H),!_r.isLicensed){var ve=new mt;this.topToolbar.addElementBlock(ve);var He=document.createElement("div");He.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var qe=document.createElement("a");qe.style.color="currentColor",qe.href="https://markerjs.com/products/cropro",qe.target="_blank",qe.innerHTML='<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2"><path d="M16.326 14.895c0 1.126-.558 1.688-1.673 1.688H9.931c-1.116 0-1.674-.562-1.674-1.688V3.733c0-1.126.558-1.688 1.674-1.688h4.722c1.115 0 1.673.562 1.673 1.688v2.899h-1.957V3.793h-4.124v11.042h4.124v-3.242h1.957v3.302z" fill="currentColor"/><path d="M15.94 7.364a.783.783 0 00-1.065-.304l-11.01 6.126a.783.783 0 00-.303 1.065l4.498 8.085a.783.783 0 001.065.304l11.01-6.126a.783.783 0 00.303-1.065L15.94 7.364zM5.311 14.173l3.737 6.718 9.641-5.364-3.737-6.718-9.641 5.364z" fill="#eef762"/></svg>',He.appendChild(qe),ve.addElement(He)}var ft=new si;ft.minWidth=3*this.toolbarHeight+"px",ft.contentAlign="end",this.topToolbar.addButtonBlock(ft);var Ge=new Nt('<svg viewBox="0 0 24 24"><path d="M9 20.42l-6.21-6.21 2.83-2.83L9 14.77l9.88-9.89 2.83 2.83L9 20.42z"/></svg>',"OK");Ge.onClick=this.startRenderAndClose,ft.addButton(Ge),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(Ge.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var Ct=new Nt('<svg viewBox="0 0 24 24"><path d="M20 6.91L17.09 4 12 9.09 6.91 4 4 6.91 9.09 12 4 17.09 6.91 20 12 14.91 17.09 20 20 17.09 14.91 12 20 6.91z"/></svg>',"Close");Ct.onClick=this.close,ft.addButton(Ct),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(Ct.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},z.prototype.addBottomToolbar=function(){var s=this;this.bottomToolbar=new Br,this.bottomToolbar.display=this.styles.settings.hideBottomToolbar?"none":"",this.bottomToolbar.className=this.toolbarStyleClass.name,this.bottomToolbar.colorsClassName=this.styles.settings.toolbarStyleColorsClassName?this.styles.settings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name,this.bottomToolbar.fadeInClassName=this.styles.fadeInAnimationClassName,this.bottomToolbar.blockClassName=this.toolbarBlockStyleClass.name,this.bottomToolbar.buttonClassName=this.toolbarButtonStyleClass.name,this.bottomToolbar.buttonColorsClassName=this.styles.settings.toolbarButtonStyleColorsClassName?this.styles.settings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,this.bottomToolbar.buttonActiveColorsClassName=this.styles.settings.toolbarActiveButtonStyleColorsClassName?this.styles.settings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name;var f=new si;f.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(f);var W=new Nt('<svg viewBox="0 0 24 24"><path d="M13 4.07V1L8.45 5.55 13 10V6.09c2.84.48 5 2.94 5 5.91s-2.16 5.43-5 5.91v2.02c3.95-.49 7-3.85 7-7.93s-3.05-7.44-7-7.93M7.1 18.32c1.16.9 2.51 1.44 3.9 1.61V17.9c-.87-.15-1.71-.49-2.46-1.03L7.1 18.32M6.09 13H4.07c.17 1.39.72 2.73 1.62 3.89l1.41-1.42c-.52-.75-.87-1.59-1.01-2.47m1.02-4.47L5.7 7.11C4.8 8.27 4.24 9.61 4.07 11h2.02c.14-.87.49-1.72 1.02-2.47z"/></svg>',"Rotate left");W.onClick=this.rotateLeftButtonClicked,f.addButton(W);var X=new Nt('<svg viewBox="0 0 24 24"><path d="M16.89 15.5l1.42 1.39c.9-1.16 1.45-2.5 1.62-3.89h-2.02c-.14.87-.48 1.72-1.02 2.5M13 17.9v2.02c1.39-.17 2.74-.71 3.9-1.61l-1.44-1.44c-.75.54-1.59.89-2.46 1.03m6.93-6.9a7.906 7.906 0 00-1.62-3.89l-1.42 1.42c.54.75.88 1.6 1.02 2.47m-2.36-5.45L11 1v3.07C7.06 4.56 4 7.92 4 12s3.05 7.44 7 7.93v-2.02c-2.84-.48-5-2.94-5-5.91s2.16-5.43 5-5.91V10l4.55-4.45z"/></svg>',"Rotate right");X.onClick=this.rotateRightButtonClicked,f.addButton(X);var H=new mt;H.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(H),this.straightener=new $r("Straighten"),this.straightener.className=this.toolbarStraightenerStyleClass.name,this.straightener.colorsClassName=this.styles.settings.toolbarStraightenerColorsClassName?this.styles.settings.toolbarStraightenerColorsClassName:this.toolbarStraightenerStyleColorsClass.name,this.straightener.onAngleChange=function(ft){s.rotateBy(ft),s.straightener.angle=s.rotationAngle},H.addElement(this.straightener.getUI());var ve=new si;ve.minWidth=2*this.toolbarHeight+"px",ve.contentAlign="end",this.bottomToolbar.addButtonBlock(ve);var He=new Nt('<svg viewBox="0 0 24 24"><path d="M15 21h2v-2h-2m4-10h2V7h-2M3 5v14c0 1.1.9 2 2 2h4v-2H5V5h4V3H5c-1.1 0-2 .9-2 2m16-2v2h2c0-1.1-.9-2-2-2m-8 20h2V1h-2m8 16h2v-2h-2M15 5h2V3h-2m4 10h2v-2h-2m0 10c1.1 0 2-.9 2-2h-2z"/></svg>',"Flip horizontal");He.onClick=this.flipHorizontallyButtonClicked,ve.addButton(He);var qe=new Nt('<svg viewBox="0 0 24 24"><path d="M3 15v2h2v-2m10 4v2h2v-2m2-16H5c-1.1 0-2 .9-2 2v4h2V5h14v4h2V5c0-1.1-.9-2-2-2m2 16h-2v2c1.1 0 2-.9 2-2M1 11v2h22v-2M7 19v2h2v-2m10-4v2h2v-2m-10 4v2h2v-2M3 19c0 1.1.9 2 2 2v-2z"/></svg>',"Flip vertical");qe.onClick=this.flipVerticallyButtonClicked,ve.addButton(qe)},z.prototype.ratioButtonClicked=function(s){this.aspectRatio=s,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},z.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=li.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},z.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new Ur(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},z.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},z.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},z.prototype.restoreState=function(s){if(s){var f=this.cropLayer.getRescaledRect(s.width,s.height,this.imageWidth,this.imageHeight,s.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(f),this.cropRectChanged(f),this.flippedHorizontally=s.flippedHorizontally,this.flippedVertically=s.flippedVertically,this.applyFlip(),this.rotationAngle=s.rotationAngle,this.applyRotation()}},z.prototype.clientToLocalCoordinates=function(s,f){var W=this.cropImage.getBoundingClientRect();return{x:s-W.left,y:f-W.top}},z.prototype.onWindowResize=function(){this.positionUI()},z.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var s=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=s+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px";break;case"popup":this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=this.windowHeight+"px",this.contentDiv.style.maxHeight="calc(100vh - "+(2*this.popupMargin+2*this.toolbarHeight)+"px)"}this.positionCropImage()},z.prototype.rotateLeftButtonClicked=function(){var s=this.rotationAngle-90;this.rotationAngle%90!=0&&(s+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(s)},z.prototype.rotateRightButtonClicked=function(){var s=this.rotationAngle+90;this.rotationAngle%90!=0&&(s-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(s)},z.prototype.rotateTo=function(s){s=(s=s>180?s-360:s)<=-180?s+360:s,this.rotationAngle=s,this.applyRotation()},z.prototype.rotateBy=function(s){this.rotateTo((this.rotationAngle+s)%360)},z.prototype.applyRotation=function(){var s=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var f=this.editingTargetRotationContainer.transform.baseVal.getItem(0);f.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(f,0);var W=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/W.width,this.imageHeight/W.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=s},z.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},z.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},z.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},z.prototype.startRenderAndClose=function(){return Ze(this,void 0,void 0,function(){var s,f;return Er(this,function(W){switch(W.label){case 0:return[4,this.render()];case 1:return s=W.sent(),f=this.getState(),this.renderEventListeners.forEach(function(X){return X(s,f)}),this.close(!0),[2]}})})},z.prototype.render=function(){return Ze(this,void 0,void 0,function(){var s;return Er(this,function(f){switch(f.label){case 0:return(s=new ui).naturalSize=this.renderAtNaturalSize,s.imageType=this.renderImageType,s.imageQuality=this.renderImageQuality,s.width=this.renderWidth,s.height=this.renderHeight,this.unzoomFromCrop(),bt.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,s.rasterize(this.cropImage,this.target,{x:this.cropRect.x,y:this.cropRect.y,width:this.cropRect.width,height:this.cropRect.height},this.CANVAS_MARGIN,this.rotationAngle,this.scaleFactor*(this.flippedHorizontally?-1:1),this.scaleFactor*(this.flippedVertically?-1:1))];case 1:return f.sent(),[4,s.rasterize(this.cropImage,this.target,{x:this.cropRect.x,y:this.cropRect.y,width:this.cropRect.width,height:this.cropRect.height},this.CANVAS_MARGIN,this.rotationAngle,this.scaleFactor*(this.flippedHorizontally?-1:1),this.scaleFactor*(this.flippedVertically?-1:1))];case 2:return[2,f.sent()]}})})},z.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new rr("toolbar",`
width: `+(this.displayMode==="inline"?"100%":"calc(100vw - "+2*this.popupMargin+"px)")+`;
flex-shrink: 0;
display: flex;
flex-direction: row;
justify-content: space-between;
height: `+this.toolbarHeight+`px;
box-sizing: content-box;
overflow: hidden;
line-height: 0px;
`)),this.toolbarStyleColorsClass=this.styles.addClass(new rr("toolbar_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarBlockStyleClass=this.styles.addClass(new rr("toolbar-block",`
display: flex;
align-items: center;
box-sizing: content-box;
`));var s=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new rr("toolbar_button",`
display: inline-block;
width: `+(this.toolbarHeight-2*s)+`px;
height: `+(this.toolbarHeight-2*s)+`px;
padding: `+s+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new rr("toolbar_button_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new rr("toolbar_active_button",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
`)),this.styles.addRule(new qt("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.toolbarHeight/2+`px;
`)),this.styles.addRule(new qt("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new rr("toolbar_dropdown",`
position: absolute;
max-width: `+4*this.toolbarHeight+`px;
z-index: 20;
white-space: normal;
box-sizing: content-box;
box-shadow: 3px 3px rgba(33, 33, 33, 0.1);
margin: `+(this.displayMode==="inline"?"0":this.popupMargin)+`px;
line-height: 0px;
`)),this.toolbarDropdownStyleColorsClass=this.styles.addClass(new rr("toolbar_dropdown_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new rr("toolbar_straightener_block",`
display: flex;
overflow: hidden;
justify-content: center;
-webkit-mask-image: linear-gradient(90deg, rgba(0,0,0,0) 0%, rgba(0,0,0,1) 30%, rgba(0,0,0,1) 70%, rgba(0,0,0,0) 100%);
`)),this.toolbarStraightenerStyleClass=this.styles.addClass(new rr("toolbar_straightener",`
display: flex;
overflow: hidden;
justify-content: center;
height: `+(this.toolbarHeight-2*s)+`px;
padding: `+s+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new rr("toolbar_straightener_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`))},z.instanceCounter=0,z}(),wt=le("8hTe"),di=le.n(wt),Li=/<pre[^>]*>/g;function hi(z){var s=document.createElement("div");return s.innerHTML=z,s.childNodes.length===0?"":s.childNodes[0].nodeValue}var ki=dt.a=function(z){var s=z.value,f=s===void 0?"":s,W=z.edit,X=W===void 0?!1:W,H=z.className,ve=z.showTextOnly,He=z.showLines,qe=z.replaces,ft=z.zoomImg,Ge=z.hasMask,Ct=z.style,Mt=Ct===void 0?{}:Ct,Vt=z.stylesPrev,jr=Vt===void 0?{}:Vt,Wr=String(f),sr=Object(R.useRef)(),Vr=Object(R.useRef)(),Hi=Object(R.useState)(""),Tr=Object(G.a)(Hi,2),Hr=Tr[0],Mr=Tr[1],gi=Object(R.useState)("office"),Zr=Object(G.a)(gi,2),ci=Zr[0],ri=Zr[1],hn=function(){var Ut=new Ve(Vr.current);Ut.displayMode="popup",Ut.addRenderEventListener(function(){var pr=Object(_.a)(I.a.mark(function Bt(ir){var Ht;return I.a.wrap(function(er){for(;;)switch(er.prev=er.next){case 0:return sr.current.style.display="none",er.next=3,Object(Oe.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:ir}});case 3:Ht=er.sent,Ht!=null&&Ht.id&&qe(Vr.current.getAttribute("src").replace(ee.a.API_SERVER,""),"/api/attachments/".concat(Ht==null?void 0:Ht.id,"?type=").concat(Ht.content_type));case 5:case"end":return er.stop()}},Bt)}));return function(Bt){return pr.apply(this,arguments)}}()),Ut.show()},Gi=function(){var Ut=new vt(Vr.current);Ut.settings.displayMode="popup",Ut.addEventListener("render",function(){var pr=Object(_.a)(I.a.mark(function Bt(ir){var Ht;return I.a.wrap(function(er){for(;;)switch(er.prev=er.next){case 0:if(sr.current.style.display="none",!Vr.current){er.next=6;break}return er.next=4,Object(Oe.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:ir.dataUrl}});case 4:Ht=er.sent,Ht!=null&&Ht.id&&qe(Vr.current.getAttribute("src").replace(ee.a.API_SERVER,""),"/api/attachments/".concat(Ht==null?void 0:Ht.id,"?type=").concat(Ht.content_type));case 6:case"end":return er.stop()}},Bt)}));return function(Bt){return pr.apply(this,arguments)}}()),Ut.show(),window.markerArea=Ut},Qr=Object(R.useMemo)(function(){try{var Qt=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Ut=/\"\/api\/attachments\/|\"\/attachments\/download\//g,pr=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;Wr=Wr.replace(Qt,"("+ee.a.API_SERVER+"/api/attachments/").replace(Ut,'"'+ee.a.API_SERVER+"/api/attachments/").replace(pr,'"'+ee.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,`
`),Wr=Wr.replace(new RegExp("(?<!\\n)\\n(?!\\n)","g"),`
`)}catch(ii){}var Bt=V(Wr),ir=E();if(Wr.match(/\[TOC\]/)&&(Bt=Bt.replace("<p>[TOC]</p>",k()),T()),Bt=Bt.replace(/(__special_katext_id_\d+__)/g,function(ii,er){var wr=ir[er],zi=wr.type,Ki=wr.expression;return Object(oe.renderToString)(hi(Ki)||"",{displayMode:zi==="block",throwOnError:!1,output:"html"})}),Bt=Bt.replace(/▁/g,"\u2581\u2581\u2581"),b(),ve){var Ht=document.createElement("div");return Ht.innerHTML=Bt,Ht.innerText}return setTimeout(function(){return Ri()},500),Bt},[Wr]),Gr=Object(R.useRef)();c.WebkitLineClamp=He,He&&(Mt=Object(B.a)(Object(B.a)({},Mt),c));function Di(Qt){var Ut=Qt.target;if(Ut.tagName.toUpperCase()==="IMG"){if(ft){var pr=Ut.getAttribute("src");Mr(pr),ri("image")}}else if(Ut.tagName.toUpperCase()==="A"){var Bt=Ut.getAttribute("href");if(Bt.indexOf("office")>-1)Qt.preventDefault(),Mr(Bt),ri("office");else if(Bt.indexOf("application/pdf")>-1)Qt.preventDefault(),Mr(Bt),ri("pdf");else if(Bt.indexOf("type=text")>-1)Qt.preventDefault(),Mr(Bt),ri("html");else if(Bt.startsWith("#")){Qt.preventDefault();var ir=document.getElementById(Bt.replace("#",""));ir&&ir.scrollIntoView(!0)}}}var Ri=function(){var Ut,pr=(Ut=Gr.current)===null||Ut===void 0?void 0:Ut.querySelectorAll("video");pr==null||pr.forEach(function(Bt){if(Bt.oncontextmenu=function(){return!1},Bt.src.indexOf(".m3u8")>-1&&!Bt.canPlayType("application/vnd.apple.mpegurl")){if($.a.isSupported()){var ir=new $.a;ir.loadSource(Bt.src),ir.attachMedia(Bt)}}})};Object(R.useEffect)(function(){if(Gr.current&&Qr&&(Qr.match(Li)&&window.PR.prettyPrint()),Gr.current)return Gr.current.addEventListener("click",Di),function(){Gr.current.removeEventListener("click",Di),b(),T()}},[Qr,Gr.current,Di]);var cn=function(Ut){if(!X)return;Ut.target.nodeName==="IMG"?(sr.current.style.display="flex",sr.current.style.width=Ut.target.clientWidth+"px",sr.current.style.height=Ut.target.clientHeight+"px",sr.current.style.top=Ut.target.offsetTop+"px",sr.current.style.left=Ut.target.offsetLeft+"px",Vr.current.src=Ut.target.getAttribute("src")):sr.current.style.display="none"};return v.a.createElement("div",{style:{position:"relative"}},v.a.createElement("div",{ref:Gr,style:Object(B.a)({},Mt),className:"".concat(H||""," markdown-body ").concat(di.a.mdBody),onMouseOver:cn,dangerouslySetInnerHTML:{__html:Qr}}),v.a.createElement("div",{ref:sr,className:di.a.button},v.a.createElement(J.a,null,v.a.createElement(Q.a,{onClick:function(){return hn()}},"\u88C1\u526A"),v.a.createElement(Q.a,{onClick:function(){return Gi()}},"\u7F16\u8F91"))),v.a.createElement("img",{ref:Vr,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),v.a.createElement(fe.a,{close:!0,data:Hr,hasMask:Ge,type:Hr!=null&&Hr.length?ci:"",style:Object(B.a)({},jr),onClose:function(){return Mr("")}}))}},"9VGf":function(Tt,dt,le){"use strict";le.d(dt,"a",function(){return D});var he=le("q1tI"),J=le.n(he);function D(Q,B){var _=Object(he.useRef)();Object(he.useEffect)(function(){_.current=Q}),Object(he.useEffect)(function(){function G(){_.current()}if(B!==null){var j=setInterval(G,B);return function(){return clearInterval(j)}}},[B])}},BU3w:function(Tt,dt,le){"use strict";le.d(dt,"a",function(){return _});var he=le("MNnm"),J="rc-util-key";function D(G){if(G.attachTo)return G.attachTo;var j=document.querySelector("head");return j||document.body}function Q(G){var j,I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(he.a)())return null;var R=document.createElement("style");if((j=I.csp)===null||j===void 0?void 0:j.nonce){var v;R.nonce=(v=I.csp)===null||v===void 0?void 0:v.nonce}R.innerHTML=G;var A=D(I),M=A.firstChild;return I.prepend&&A.prepend?A.prepend(R):I.prepend&&M?A.insertBefore(R,M):A.appendChild(R),R}var B=new Map;function _(G,j){var I=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},R=D(I);if(!B.has(R)){var v=Q("",I),A=v.parentNode;B.set(R,A),A.removeChild(v)}var M=Array.from(B.get(R).children).find(function(o){return o.tagName==="STYLE"&&o[J]===j});if(M){var L,w;if(((L=I.csp)===null||L===void 0?void 0:L.nonce)&&M.nonce!==((w=I.csp)===null||w===void 0?void 0:w.nonce)){var y;M.nonce=(y=I.csp)===null||y===void 0?void 0:y.nonce}return M.innerHTML!==G&&(M.innerHTML=G),M}var u=Q(G,I);return u[J]=j,u}},Bd2K:function(Tt,dt,le){(function(he){he(le("VrN/"),le("osHv"))})(function(he){he.defineOption("autoCloseTags",!1,function(I,R,v){if(v!=he.Init&&v&&I.removeKeyMap("autoCloseTags"),!R)return;var A={name:"autoCloseTags"};(typeof R!="object"||R.whenClosing!==!1)&&(A["'/'"]=function(M){return _(M)}),(typeof R!="object"||R.whenOpening!==!1)&&(A["'>'"]=function(M){return Q(M)}),I.addKeyMap(A)});var J=["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 Q(I){if(I.getOption("disableInput"))return he.Pass;for(var R=I.listSelections(),v=[],A=I.getOption("autoCloseTags"),M=0;M<R.length;M++){if(!R[M].empty())return he.Pass;var L=R[M].head,w=I.getTokenAt(L),y=he.innerMode(I.getMode(),w.state),u=y.state,o=y.mode.xmlCurrentTag&&y.mode.xmlCurrentTag(u),l=o&&o.name;if(!l)return he.Pass;var d=y.mode.configuration=="html",T=typeof A=="object"&&A.dontCloseTags||d&&J,c=typeof A=="object"&&A.indentTags||d&&D;w.end>L.ch&&(l=l.slice(0,l.length-w.end+L.ch));var p=l.toLowerCase();if(!l||w.type=="string"&&(w.end!=L.ch||!/[\"\']/.test(w.string.charAt(w.string.length-1))||w.string.length==1)||w.type=="tag"&&o.close||w.string.indexOf("/")==L.ch-w.start-1||T&&G(T,p)>-1||j(I,y.mode.xmlCurrentContext&&y.mode.xmlCurrentContext(u)||[],l,L,!0))return he.Pass;var k=typeof A=="object"&&A.emptyTags;if(k&&G(k,l)>-1){v[M]={text:"/>",newPos:he.Pos(L.line,L.ch+2)};continue}var x=c&&G(c,p)>-1;v[M]={indent:x,text:">"+(x?`
`:"")+"</"+l+">",newPos:x?he.Pos(L.line+1,0):he.Pos(L.line,L.ch+1)}}for(var m=typeof A=="object"&&A.dontIndentOnAutoClose,M=R.length-1;M>=0;M--){var g=v[M];I.replaceRange(g.text,R[M].head,R[M].anchor,"+insert");var h=I.listSelections().slice(0);h[M]={head:g.newPos,anchor:g.newPos},I.setSelections(h),!m&&g.indent&&(I.indentLine(g.newPos.line,null,!0),I.indentLine(g.newPos.line+1,null,!0))}}function B(I,R){for(var v=I.listSelections(),A=[],M=R?"/":"</",L=I.getOption("autoCloseTags"),w=typeof L=="object"&&L.dontIndentOnSlash,y=0;y<v.length;y++){if(!v[y].empty())return he.Pass;var u=v[y].head,o=I.getTokenAt(u),l=he.innerMode(I.getMode(),o.state),d=l.state;if(R&&(o.type=="string"||o.string.charAt(0)!="<"||o.start!=u.ch-1))return he.Pass;var T,c=l.mode.name!="xml"&&I.getMode().name=="htmlmixed";if(c&&l.mode.name=="javascript")T=M+"script";else if(c&&l.mode.name=="css")T=M+"style";else{var p=l.mode.xmlCurrentContext&&l.mode.xmlCurrentContext(d);if(!p||p.length&&j(I,p,p[p.length-1],u))return he.Pass;T=M+p[p.length-1]}I.getLine(u.line).charAt(o.end)!=">"&&(T+=">"),A[y]=T}if(I.replaceSelections(A),v=I.listSelections(),!w)for(var y=0;y<v.length;y++)(y==v.length-1||v[y].head.line<v[y+1].head.line)&&I.indentLine(v[y].head.line)}function _(I){return I.getOption("disableInput")?he.Pass:B(I,!0)}he.commands.closeTag=function(I){return B(I)};function G(I,R){if(I.indexOf)return I.indexOf(R);for(var v=0,A=I.length;v<A;++v)if(I[v]==R)return v;return-1}function j(I,R,v,A,M){if(!he.scanForClosingTag)return!1;var L=Math.min(I.lastLine()+1,A.line+500),w=he.scanForClosingTag(I,A,null,L);if(!w||w.tag!=v)return!1;for(var y=M?1:0,u=R.length-1;u>=0&&R[u]==v;u--)++y;A=w.to;for(var u=1;u<y;u++){var o=he.scanForClosingTag(I,A,null,L);if(!o||o.tag!=v)return!1;A=o.to}return!0}})},BjJ7:function(Tt,dt,le){"use strict";le.d(dt,"d",function(){return J}),le.d(dt,"c",function(){return D}),le.d(dt,"e",function(){return Q}),le.d(dt,"b",function(){return B}),le.d(dt,"a",function(){return G});var he=le("m3rI");function J(j){var I=!0;if(j.length>0){for(var R=0;R<j.length;R++)if(j[R].compile_success==0||!j[R].compile_success){I=!1;break}}else I=!1;return I}function D(j){for(var I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",R=[],v=0;v<j.length;v++){var A=j[v],M=I?"".concat(I,"/").concat(A.name):"".concat(A.name);R.push({title:A.name,isLeaf:!(A.type==="tree"),key:M})}return R}function Q(j,I,R){for(var v=0;v<j.length;v++){var A=j[v];if(A.key===I){A.children=R;break}A.children&&Q(A.children,I,R)}return j}function B(j,I,R){var v;return function(){var A=this,M=arguments,L=function(){v=null,R||j.apply(A,M)},w=R&&!v;clearTimeout(v),v=setTimeout(L,I),w&&j.apply(A,M)}}var _=!0,G=he.a.API_SERVER},"C+DQ":function(Tt,dt,le){},DlQD:function(Tt,dt,le){(function(he,J){Tt.exports=J()})(this,function(){"use strict";function he(Ee,ge){for(var ye=0;ye<ge.length;ye++){var re=ge[ye];re.enumerable=re.enumerable||!1,re.configurable=!0,"value"in re&&(re.writable=!0),Object.defineProperty(Ee,re.key,re)}}function J(Ee,ge,ye){return ge&&he(Ee.prototype,ge),ye&&he(Ee,ye),Ee}function D(Ee,ge){if(!Ee)return;if(typeof Ee=="string")return Q(Ee,ge);var ye=Object.prototype.toString.call(Ee).slice(8,-1);if(ye==="Object"&&Ee.constructor&&(ye=Ee.constructor.name),ye==="Map"||ye==="Set")return Array.from(Ee);if(ye==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(ye))return Q(Ee,ge)}function Q(Ee,ge){(ge==null||ge>Ee.length)&&(ge=Ee.length);for(var ye=0,re=new Array(ge);ye<ge;ye++)re[ye]=Ee[ye];return re}function B(Ee,ge){var ye;if(typeof Symbol=="undefined"||Ee[Symbol.iterator]==null){if(Array.isArray(Ee)||(ye=D(Ee))||ge&&Ee&&typeof Ee.length=="number"){ye&&(Ee=ye);var re=0;return function(){return re>=Ee.length?{done:!0}:{done:!1,value:Ee[re++]}}}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 ye=Ee[Symbol.iterator](),ye.next.bind(ye)}function _(Ee,ge){return ge={exports:{}},Ee(ge,ge.exports),ge.exports}var G=_(function(Ee){function ge(){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 ye(re){Ee.exports.defaults=re}Ee.exports={defaults:ge(),getDefaults:ge,changeDefaults:ye}}),j=G.defaults,I=G.getDefaults,R=G.changeDefaults,v=/[&<>"']/,A=/[&<>"']/g,M=/[<>"']|&(?!#?\w+;)/,L=/[<>"']|&(?!#?\w+;)/g,w={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},y=function(ge){return w[ge]};function u(Ee,ge){if(ge){if(v.test(Ee))return Ee.replace(A,y)}else if(M.test(Ee))return Ee.replace(L,y);return Ee}var o=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function l(Ee){return Ee.replace(o,function(ge,ye){return ye=ye.toLowerCase(),ye==="colon"?":":ye.charAt(0)==="#"?ye.charAt(1)==="x"?String.fromCharCode(parseInt(ye.substring(2),16)):String.fromCharCode(+ye.substring(1)):""})}var d=/(^|[^\[])\^/g;function T(Ee,ge){Ee=Ee.source||Ee,ge=ge||"";var ye={replace:function(ie,ae){return ae=ae.source||ae,ae=ae.replace(d,"$1"),Ee=Ee.replace(ie,ae),ye},getRegex:function(){return new RegExp(Ee,ge)}};return ye}var c=/[^\w:]/g,p=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function k(Ee,ge,ye){if(Ee){var re;try{re=decodeURIComponent(l(ye)).replace(c,"").toLowerCase()}catch(ie){return null}if(re.indexOf("javascript:")===0||re.indexOf("vbscript:")===0||re.indexOf("data:")===0)return null}ge&&!p.test(ye)&&(ye=a(ge,ye));try{ye=encodeURI(ye).replace(/%25/g,"%")}catch(ie){return null}return ye}var x={},m=/^[^:]+:\/*[^/]*$/,g=/^([^:]+:)[\s\S]*$/,h=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(Ee,ge){x[" "+Ee]||(m.test(Ee)?x[" "+Ee]=Ee+"/":x[" "+Ee]=N(Ee,"/",!0)),Ee=x[" "+Ee];var ye=Ee.indexOf(":")===-1;return ge.substring(0,2)==="//"?ye?ge:Ee.replace(g,"$1")+ge:ge.charAt(0)==="/"?ye?ge:Ee.replace(h,"$1")+ge:Ee+ge}var E={exec:function(){}};function b(Ee){for(var ge=1,ye,re;ge<arguments.length;ge++){ye=arguments[ge];for(re in ye)Object.prototype.hasOwnProperty.call(ye,re)&&(Ee[re]=ye[re])}return Ee}function S(Ee,ge){var ye=Ee.replace(/\|/g,function(ae,de,ke){for(var Se=!1,We=de;--We>=0&&ke[We]==="\\";)Se=!Se;return Se?"|":" |"}),re=ye.split(/ \|/),ie=0;if(re.length>ge)re.splice(ge);else for(;re.length<ge;)re.push("");for(;ie<re.length;ie++)re[ie]=re[ie].trim().replace(/\\\|/g,"|");return re}function N(Ee,ge,ye){var re=Ee.length;if(re===0)return"";for(var ie=0;ie<re;){var ae=Ee.charAt(re-ie-1);if(ae===ge&&!ye)ie++;else if(ae!==ge&&ye)ie++;else break}return Ee.substr(0,re-ie)}function U(Ee,ge){if(Ee.indexOf(ge[1])===-1)return-1;for(var ye=Ee.length,re=0,ie=0;ie<ye;ie++)if(Ee[ie]==="\\")ie++;else if(Ee[ie]===ge[0])re++;else if(Ee[ie]===ge[1]&&(re--,re<0))return ie;return-1}function K(Ee){Ee&&Ee.sanitize&&!Ee.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 V={escape:u,unescape:l,edit:T,cleanUrl:k,resolveUrl:a,noopTest:E,merge:b,splitCells:S,rtrim:N,findClosingBracket:U,checkSanitizeDeprecation:K},O=G.defaults,P=V.rtrim,$=V.splitCells,ee=V.escape,oe=V.findClosingBracket;function fe(Ee,ge,ye){var re=ge.href,ie=ge.title?ee(ge.title):null,ae=Ee[1].replace(/\\([\[\]])/g,"$1");return Ee[0].charAt(0)!=="!"?{type:"link",raw:ye,href:re,title:ie,text:ae}:{type:"image",raw:ye,href:re,title:ie,text:ee(ae)}}function Oe(Ee,ge){var ye=Ee.match(/^(\s+)(?:```)/);if(ye===null)return ge;var re=ye[1];return ge.split(`
`).map(function(ie){var ae=ie.match(/^\s+/);if(ae===null)return ie;var de=ae[0];return de.length>=re.length?ie.slice(re.length):ie}).join(`
`)}var Ce=function(){function Ee(ye){this.options=ye||O}var ge=Ee.prototype;return ge.space=function(re){var ie=this.rules.block.newline.exec(re);if(ie)return ie[0].length>1?{type:"space",raw:ie[0]}:{raw:`
`}},ge.code=function(re,ie){var ae=this.rules.block.code.exec(re);if(ae){var de=ie[ie.length-1];if(de&&de.type==="paragraph")return{raw:ae[0],text:ae[0].trimRight()};var ke=ae[0].replace(/^ {4}/gm,"");return{type:"code",raw:ae[0],codeBlockStyle:"indented",text:this.options.pedantic?ke:P(ke,`
`)}}},ge.fences=function(re){var ie=this.rules.block.fences.exec(re);if(ie){var ae=ie[0],de=Oe(ae,ie[3]||"");return{type:"code",raw:ae,lang:ie[2]?ie[2].trim():ie[2],text:de}}},ge.heading=function(re){var ie=this.rules.block.heading.exec(re);if(ie)return{type:"heading",raw:ie[0],depth:ie[1].length,text:ie[2]}},ge.nptable=function(re){var ie=this.rules.block.nptable.exec(re);if(ie){var ae={type:"table",header:$(ie[1].replace(/^ *| *\| *$/g,"")),align:ie[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ie[3]?ie[3].replace(/\n$/,"").split(`
`):[],raw:ie[0]};if(ae.header.length===ae.align.length){var de=ae.align.length,ke;for(ke=0;ke<de;ke++)/^ *-+: *$/.test(ae.align[ke])?ae.align[ke]="right":/^ *:-+: *$/.test(ae.align[ke])?ae.align[ke]="center":/^ *:-+ *$/.test(ae.align[ke])?ae.align[ke]="left":ae.align[ke]=null;for(de=ae.cells.length,ke=0;ke<de;ke++)ae.cells[ke]=$(ae.cells[ke],ae.header.length);return ae}}},ge.hr=function(re){var ie=this.rules.block.hr.exec(re);if(ie)return{type:"hr",raw:ie[0]}},ge.blockquote=function(re){var ie=this.rules.block.blockquote.exec(re);if(ie){var ae=ie[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:ie[0],text:ae}}},ge.list=function(re){var ie=this.rules.block.list.exec(re);if(ie){for(var ae=ie[0],de=ie[2],ke=de.length>1,Se=de[de.length-1]===")",We={type:"list",raw:ae,ordered:ke,start:ke?+de.slice(0,-1):"",loose:!1,items:[]},tt=ie[0].match(this.rules.block.item),ct=!1,lt,kt,Et,ht,jt,vt,At,Dt=tt.length,Ze=0;Ze<Dt;Ze++)lt=tt[Ze],ae=lt,kt=lt.length,lt=lt.replace(/^ *([*+-]|\d+[.)]) */,""),~lt.indexOf(`
`)&&(kt-=lt.length,lt=this.options.pedantic?lt.replace(/^ {1,4}/gm,""):lt.replace(new RegExp("^ {1,"+kt+"}","gm"),"")),Ze!==Dt-1&&(Et=this.rules.block.bullet.exec(tt[Ze+1])[0],(ke?Et.length===1||!Se&&Et[Et.length-1]===")":Et.length>1||this.options.smartLists&&Et!==de)&&(ht=tt.slice(Ze+1).join(`
`),We.raw=We.raw.substring(0,We.raw.length-ht.length),Ze=Dt-1)),jt=ct||/\n\n(?!\s*$)/.test(lt),Ze!==Dt-1&&(ct=lt.charAt(lt.length-1)===`
`,jt||(jt=ct)),jt&&(We.loose=!0),vt=/^\[[ xX]\] /.test(lt),At=void 0,vt&&(At=lt[1]!==" ",lt=lt.replace(/^\[[ xX]\] +/,"")),We.items.push({type:"list_item",raw:ae,task:vt,checked:At,loose:jt,text:lt});return We}},ge.html=function(re){var ie=this.rules.block.html.exec(re);if(ie)return{type:this.options.sanitize?"paragraph":"html",raw:ie[0],pre:!this.options.sanitizer&&(ie[1]==="pre"||ie[1]==="script"||ie[1]==="style"),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(ie[0]):ee(ie[0]):ie[0]}},ge.def=function(re){var ie=this.rules.block.def.exec(re);if(ie){ie[3]&&(ie[3]=ie[3].substring(1,ie[3].length-1));var ae=ie[1].toLowerCase().replace(/\s+/g," ");return{tag:ae,raw:ie[0],href:ie[2],title:ie[3]}}},ge.table=function(re){var ie=this.rules.block.table.exec(re);if(ie){var ae={type:"table",header:$(ie[1].replace(/^ *| *\| *$/g,"")),align:ie[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ie[3]?ie[3].replace(/\n$/,"").split(`
`):[]};if(ae.header.length===ae.align.length){ae.raw=ie[0];var de=ae.align.length,ke;for(ke=0;ke<de;ke++)/^ *-+: *$/.test(ae.align[ke])?ae.align[ke]="right":/^ *:-+: *$/.test(ae.align[ke])?ae.align[ke]="center":/^ *:-+ *$/.test(ae.align[ke])?ae.align[ke]="left":ae.align[ke]=null;for(de=ae.cells.length,ke=0;ke<de;ke++)ae.cells[ke]=$(ae.cells[ke].replace(/^ *\| *| *\| *$/g,""),ae.header.length);return ae}}},ge.lheading=function(re){var ie=this.rules.block.lheading.exec(re);if(ie)return{type:"heading",raw:ie[0],depth:ie[2].charAt(0)==="="?1:2,text:ie[1]}},ge.paragraph=function(re){var ie=this.rules.block.paragraph.exec(re);if(ie)return{type:"paragraph",raw:ie[0],text:ie[1].charAt(ie[1].length-1)===`
`?ie[1].slice(0,-1):ie[1]}},ge.text=function(re,ie){var ae=this.rules.block.text.exec(re);if(ae){var de=ie[ie.length-1];return de&&de.type==="text"?{raw:ae[0],text:ae[0]}:{type:"text",raw:ae[0],text:ae[0]}}},ge.escape=function(re){var ie=this.rules.inline.escape.exec(re);if(ie)return{type:"escape",raw:ie[0],text:ee(ie[1])}},ge.tag=function(re,ie,ae){var de=this.rules.inline.tag.exec(re);if(de)return!ie&&/^<a /i.test(de[0])?ie=!0:ie&&/^<\/a>/i.test(de[0])&&(ie=!1),!ae&&/^<(pre|code|kbd|script)(\s|>)/i.test(de[0])?ae=!0:ae&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(de[0])&&(ae=!1),{type:this.options.sanitize?"text":"html",raw:de[0],inLink:ie,inRawBlock:ae,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(de[0]):ee(de[0]):de[0]}},ge.link=function(re){var ie=this.rules.inline.link.exec(re);if(ie){var ae=oe(ie[2],"()");if(ae>-1){var de=ie[0].indexOf("!")===0?5:4,ke=de+ie[1].length+ae;ie[2]=ie[2].substring(0,ae),ie[0]=ie[0].substring(0,ke).trim(),ie[3]=""}var Se=ie[2],We="";if(this.options.pedantic){var tt=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Se);tt?(Se=tt[1],We=tt[3]):We=""}else We=ie[3]?ie[3].slice(1,-1):"";Se=Se.trim().replace(/^<([\s\S]*)>$/,"$1");var ct=fe(ie,{href:Se&&Se.replace(this.rules.inline._escapes,"$1"),title:We&&We.replace(this.rules.inline._escapes,"$1")},ie[0]);return ct}},ge.reflink=function(re,ie){var ae;if((ae=this.rules.inline.reflink.exec(re))||(ae=this.rules.inline.nolink.exec(re))){var de=(ae[2]||ae[1]).replace(/\s+/g," ");if(de=ie[de.toLowerCase()],!de||!de.href){var ke=ae[0].charAt(0);return{type:"text",raw:ke,text:ke}}var Se=fe(ae,de,ae[0]);return Se}},ge.strong=function(re,ie,ae){ae===void 0&&(ae="");var de=this.rules.inline.strong.start.exec(re);if(de&&(!de[1]||de[1]&&(ae===""||this.rules.inline.punctuation.exec(ae)))){ie=ie.slice(-1*re.length);var ke=de[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;ke.lastIndex=0;for(var Se;(de=ke.exec(ie))!=null;)if(Se=this.rules.inline.strong.middle.exec(ie.slice(0,de.index+3)),Se)return{type:"strong",raw:re.slice(0,Se[0].length),text:re.slice(2,Se[0].length-2)}}},ge.em=function(re,ie,ae){ae===void 0&&(ae="");var de=this.rules.inline.em.start.exec(re);if(de&&(!de[1]||de[1]&&(ae===""||this.rules.inline.punctuation.exec(ae)))){ie=ie.slice(-1*re.length);var ke=de[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;ke.lastIndex=0;for(var Se;(de=ke.exec(ie))!=null;)if(Se=this.rules.inline.em.middle.exec(ie.slice(0,de.index+2)),Se)return{type:"em",raw:re.slice(0,Se[0].length),text:re.slice(1,Se[0].length-1)}}},ge.codespan=function(re){var ie=this.rules.inline.code.exec(re);if(ie){var ae=ie[2].replace(/\n/g," "),de=/[^ ]/.test(ae),ke=ae.startsWith(" ")&&ae.endsWith(" ");return de&&ke&&(ae=ae.substring(1,ae.length-1)),ae=ee(ae,!0),{type:"codespan",raw:ie[0],text:ae}}},ge.br=function(re){var ie=this.rules.inline.br.exec(re);if(ie)return{type:"br",raw:ie[0]}},ge.del=function(re){var ie=this.rules.inline.del.exec(re);if(ie)return{type:"del",raw:ie[0],text:ie[1]}},ge.autolink=function(re,ie){var ae=this.rules.inline.autolink.exec(re);if(ae){var de,ke;return ae[2]==="@"?(de=ee(this.options.mangle?ie(ae[1]):ae[1]),ke="mailto:"+de):(de=ee(ae[1]),ke=de),{type:"link",raw:ae[0],text:de,href:ke,tokens:[{type:"text",raw:de,text:de}]}}},ge.url=function(re,ie){var ae;if(ae=this.rules.inline.url.exec(re)){var de,ke;if(ae[2]==="@")de=ee(this.options.mangle?ie(ae[0]):ae[0]),ke="mailto:"+de;else{var Se;do Se=ae[0],ae[0]=this.rules.inline._backpedal.exec(ae[0])[0];while(Se!==ae[0]);de=ee(ae[0]),ae[1]==="www."?ke="http://"+de:ke=de}return{type:"link",raw:ae[0],text:de,href:ke,tokens:[{type:"text",raw:de,text:de}]}}},ge.inlineText=function(re,ie,ae){var de=this.rules.inline.text.exec(re);if(de){var ke;return ie?ke=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(de[0]):ee(de[0]):de[0]:ke=ee(this.options.smartypants?ae(de[0]):de[0]),{type:"text",raw:de[0],text:ke}}},Ee}(),Ae=V.noopTest,Le=V.edit,be=V.merge,pe={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:Ae,table:Ae,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};pe._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,pe._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,pe.def=Le(pe.def).replace("label",pe._label).replace("title",pe._title).getRegex(),pe.bullet=/(?:[*+-]|\d{1,9}[.)])/,pe.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,pe.item=Le(pe.item,"gm").replace(/bull/g,pe.bullet).getRegex(),pe.list=Le(pe.list).replace(/bull/g,pe.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+pe.def.source+")").getRegex(),pe._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",pe._comment=/<!--(?!-?>)[\s\S]*?-->/,pe.html=Le(pe.html,"i").replace("comment",pe._comment).replace("tag",pe._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),pe.paragraph=Le(pe._paragraph).replace("hr",pe.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",pe._tag).getRegex(),pe.blockquote=Le(pe.blockquote).replace("paragraph",pe.paragraph).getRegex(),pe.normal=be({},pe),pe.gfm=be({},pe.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*|$)"}),pe.gfm.nptable=Le(pe.gfm.nptable).replace("hr",pe.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",pe._tag).getRegex(),pe.gfm.table=Le(pe.gfm.table).replace("hr",pe.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",pe._tag).getRegex(),pe.pedantic=be({},pe.normal,{html:Le(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",pe._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:Ae,paragraph:Le(pe.normal._paragraph).replace("hr",pe.hr).replace("heading",` *#{1,6} *[^
]`).replace("lheading",pe.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var se={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Ae,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:Ae,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};se._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",se.punctuation=Le(se.punctuation).replace(/punctuation/g,se._punctuation).getRegex(),se._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",se._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",se.em.start=Le(se.em.start).replace(/punctuation/g,se._punctuation).getRegex(),se.em.middle=Le(se.em.middle).replace(/punctuation/g,se._punctuation).replace(/overlapSkip/g,se._overlapSkip).getRegex(),se.em.endAst=Le(se.em.endAst,"g").replace(/punctuation/g,se._punctuation).getRegex(),se.em.endUnd=Le(se.em.endUnd,"g").replace(/punctuation/g,se._punctuation).getRegex(),se.strong.start=Le(se.strong.start).replace(/punctuation/g,se._punctuation).getRegex(),se.strong.middle=Le(se.strong.middle).replace(/punctuation/g,se._punctuation).replace(/blockSkip/g,se._blockSkip).getRegex(),se.strong.endAst=Le(se.strong.endAst,"g").replace(/punctuation/g,se._punctuation).getRegex(),se.strong.endUnd=Le(se.strong.endUnd,"g").replace(/punctuation/g,se._punctuation).getRegex(),se.blockSkip=Le(se._blockSkip,"g").getRegex(),se.overlapSkip=Le(se._overlapSkip,"g").getRegex(),se._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,se._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,se._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,se.autolink=Le(se.autolink).replace("scheme",se._scheme).replace("email",se._email).getRegex(),se._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,se.tag=Le(se.tag).replace("comment",pe._comment).replace("attribute",se._attribute).getRegex(),se._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,se._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,se._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,se.link=Le(se.link).replace("label",se._label).replace("href",se._href).replace("title",se._title).getRegex(),se.reflink=Le(se.reflink).replace("label",se._label).getRegex(),se.reflinkSearch=Le(se.reflinkSearch,"g").replace("reflink",se.reflink).replace("nolink",se.nolink).getRegex(),se.normal=be({},se),se.pedantic=be({},se.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:Le(/^!?\[(label)\]\((.*?)\)/).replace("label",se._label).getRegex(),reflink:Le(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",se._label).getRegex()}),se.gfm=be({},se.normal,{escape:Le(se.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^~+(?=\S)([\s\S]*?\S)~+/,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*~]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))|(?= {2,}\n|[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))/}),se.gfm.url=Le(se.gfm.url,"i").replace("email",se.gfm._extended_email).getRegex(),se.breaks=be({},se.gfm,{br:Le(se.br).replace("{2,}","*").getRegex(),text:Le(se.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var te={block:pe,inline:se},ue=G.defaults,ne=te.block,Te=te.inline;function Re(Ee){return Ee.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 xe(Ee){var ge="",ye,re,ie=Ee.length;for(ye=0;ye<ie;ye++)re=Ee.charCodeAt(ye),Math.random()>.5&&(re="x"+re.toString(16)),ge+="&#"+re+";";return ge}var Me=function(){function Ee(ye){this.tokens=[],this.tokens.links=Object.create(null),this.options=ye||ue,this.options.tokenizer=this.options.tokenizer||new Ce,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var re={block:ne.normal,inline:Te.normal};this.options.pedantic?(re.block=ne.pedantic,re.inline=Te.pedantic):this.options.gfm&&(re.block=ne.gfm,this.options.breaks?re.inline=Te.breaks:re.inline=Te.gfm),this.tokenizer.rules=re}Ee.lex=function(re,ie){var ae=new Ee(ie);return ae.lex(re)};var ge=Ee.prototype;return ge.lex=function(re){return re=re.replace(/\r\n|\r/g,`
`).replace(/\t/g," "),this.blockTokens(re,this.tokens,!0),this.inline(this.tokens),this.tokens},ge.blockTokens=function(re,ie,ae){ie===void 0&&(ie=[]),ae===void 0&&(ae=!0),re=re.replace(/^ +$/gm,"");for(var de,ke,Se,We;re;){if(de=this.tokenizer.space(re)){re=re.substring(de.raw.length),de.type&&ie.push(de);continue}if(de=this.tokenizer.code(re,ie)){re=re.substring(de.raw.length),de.type?ie.push(de):(We=ie[ie.length-1],We.raw+=`
`+de.raw,We.text+=`
`+de.text);continue}if(de=this.tokenizer.fences(re)){re=re.substring(de.raw.length),ie.push(de);continue}if(de=this.tokenizer.heading(re)){re=re.substring(de.raw.length),ie.push(de);continue}if(de=this.tokenizer.nptable(re)){re=re.substring(de.raw.length),ie.push(de);continue}if(de=this.tokenizer.hr(re)){re=re.substring(de.raw.length),ie.push(de);continue}if(de=this.tokenizer.blockquote(re)){re=re.substring(de.raw.length),de.tokens=this.blockTokens(de.text,[],ae),ie.push(de);continue}if(de=this.tokenizer.list(re)){for(re=re.substring(de.raw.length),Se=de.items.length,ke=0;ke<Se;ke++)de.items[ke].tokens=this.blockTokens(de.items[ke].text,[],!1);ie.push(de);continue}if(de=this.tokenizer.html(re)){re=re.substring(de.raw.length),ie.push(de);continue}if(ae&&(de=this.tokenizer.def(re))){re=re.substring(de.raw.length),this.tokens.links[de.tag]||(this.tokens.links[de.tag]={href:de.href,title:de.title});continue}if(de=this.tokenizer.table(re)){re=re.substring(de.raw.length),ie.push(de);continue}if(de=this.tokenizer.lheading(re)){re=re.substring(de.raw.length),ie.push(de);continue}if(ae&&(de=this.tokenizer.paragraph(re))){re=re.substring(de.raw.length),ie.push(de);continue}if(de=this.tokenizer.text(re,ie)){re=re.substring(de.raw.length),de.type?ie.push(de):(We=ie[ie.length-1],We.raw+=`
`+de.raw,We.text+=`
`+de.text);continue}if(re){var tt="Infinite loop on byte: "+re.charCodeAt(0);if(this.options.silent){console.error(tt);break}else throw new Error(tt)}}return ie},ge.inline=function(re){var ie,ae,de,ke,Se,We,tt=re.length;for(ie=0;ie<tt;ie++){We=re[ie];switch(We.type){case"paragraph":case"text":case"heading":{We.tokens=[],this.inlineTokens(We.text,We.tokens);break}case"table":{for(We.tokens={header:[],cells:[]},ke=We.header.length,ae=0;ae<ke;ae++)We.tokens.header[ae]=[],this.inlineTokens(We.header[ae],We.tokens.header[ae]);for(ke=We.cells.length,ae=0;ae<ke;ae++)for(Se=We.cells[ae],We.tokens.cells[ae]=[],de=0;de<Se.length;de++)We.tokens.cells[ae][de]=[],this.inlineTokens(Se[de],We.tokens.cells[ae][de]);break}case"blockquote":{this.inline(We.tokens);break}case"list":{for(ke=We.items.length,ae=0;ae<ke;ae++)this.inline(We.items[ae].tokens);break}}}return re},ge.inlineTokens=function(re,ie,ae,de,ke){ie===void 0&&(ie=[]),ae===void 0&&(ae=!1),de===void 0&&(de=!1),ke===void 0&&(ke="");var Se,We=re,tt;if(this.tokens.links){var ct=Object.keys(this.tokens.links);if(ct.length>0)for(;(tt=this.tokenizer.rules.inline.reflinkSearch.exec(We))!=null;)ct.includes(tt[0].slice(tt[0].lastIndexOf("[")+1,-1))&&(We=We.slice(0,tt.index)+"["+"a".repeat(tt[0].length-2)+"]"+We.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(tt=this.tokenizer.rules.inline.blockSkip.exec(We))!=null;)We=We.slice(0,tt.index)+"["+"a".repeat(tt[0].length-2)+"]"+We.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;re;){if(Se=this.tokenizer.escape(re)){re=re.substring(Se.raw.length),ie.push(Se);continue}if(Se=this.tokenizer.tag(re,ae,de)){re=re.substring(Se.raw.length),ae=Se.inLink,de=Se.inRawBlock,ie.push(Se);continue}if(Se=this.tokenizer.link(re)){re=re.substring(Se.raw.length),Se.type==="link"&&(Se.tokens=this.inlineTokens(Se.text,[],!0,de)),ie.push(Se);continue}if(Se=this.tokenizer.reflink(re,this.tokens.links)){re=re.substring(Se.raw.length),Se.type==="link"&&(Se.tokens=this.inlineTokens(Se.text,[],!0,de)),ie.push(Se);continue}if(Se=this.tokenizer.strong(re,We,ke)){re=re.substring(Se.raw.length),Se.tokens=this.inlineTokens(Se.text,[],ae,de),ie.push(Se);continue}if(Se=this.tokenizer.em(re,We,ke)){re=re.substring(Se.raw.length),Se.tokens=this.inlineTokens(Se.text,[],ae,de),ie.push(Se);continue}if(Se=this.tokenizer.codespan(re)){re=re.substring(Se.raw.length),ie.push(Se);continue}if(Se=this.tokenizer.br(re)){re=re.substring(Se.raw.length),ie.push(Se);continue}if(Se=this.tokenizer.del(re)){re=re.substring(Se.raw.length),Se.tokens=this.inlineTokens(Se.text,[],ae,de),ie.push(Se);continue}if(Se=this.tokenizer.autolink(re,xe)){re=re.substring(Se.raw.length),ie.push(Se);continue}if(!ae&&(Se=this.tokenizer.url(re,xe))){re=re.substring(Se.raw.length),ie.push(Se);continue}if(Se=this.tokenizer.inlineText(re,de,Re)){re=re.substring(Se.raw.length),ke=Se.raw.slice(-1),ie.push(Se);continue}if(re){var lt="Infinite loop on byte: "+re.charCodeAt(0);if(this.options.silent){console.error(lt);break}else throw new Error(lt)}}return ie},J(Ee,null,[{key:"rules",get:function(){return{block:ne,inline:Te}}}]),Ee}(),Pe=G.defaults,je=V.cleanUrl,Ue=V.escape,Ne=function(){function Ee(ye){this.options=ye||Pe}var ge=Ee.prototype;return ge.code=function(re,ie,ae){var de=(ie||"").match(/\S*/)[0];if(this.options.highlight){var ke=this.options.highlight(re,de);ke!=null&&ke!==re&&(ae=!0,re=ke)}return de?'<pre><code class="'+this.options.langPrefix+Ue(de,!0)+'">'+(ae?re:Ue(re,!0))+`</code></pre>
`:"<pre><code>"+(ae?re:Ue(re,!0))+`</code></pre>
`},ge.blockquote=function(re){return`<blockquote>
`+re+`</blockquote>
`},ge.html=function(re){return re},ge.heading=function(re,ie,ae,de){return this.options.headerIds?"<h"+ie+' id="'+this.options.headerPrefix+de.slug(ae)+'">'+re+"</h"+ie+`>
`:"<h"+ie+">"+re+"</h"+ie+`>
`},ge.hr=function(){return this.options.xhtml?`<hr/>
`:`<hr>
`},ge.list=function(re,ie,ae){var de=ie?"ol":"ul",ke=ie&&ae!==1?' start="'+ae+'"':"";return"<"+de+ke+`>
`+re+"</"+de+`>
`},ge.listitem=function(re){return"<li>"+re+`</li>
`},ge.checkbox=function(re){return"<input "+(re?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},ge.paragraph=function(re){return"<p>"+re+`</p>
`},ge.table=function(re,ie){return ie&&(ie="<tbody>"+ie+"</tbody>"),`<table>
<thead>
`+re+`</thead>
`+ie+`</table>
`},ge.tablerow=function(re){return`<tr>
`+re+`</tr>
`},ge.tablecell=function(re,ie){var ae=ie.header?"th":"td",de=ie.align?"<"+ae+' align="'+ie.align+'">':"<"+ae+">";return de+re+"</"+ae+`>
`},ge.strong=function(re){return"<strong>"+re+"</strong>"},ge.em=function(re){return"<em>"+re+"</em>"},ge.codespan=function(re){return"<code>"+re+"</code>"},ge.br=function(){return this.options.xhtml?"<br/>":"<br>"},ge.del=function(re){return"<del>"+re+"</del>"},ge.link=function(re,ie,ae){if(re=je(this.options.sanitize,this.options.baseUrl,re),re===null)return ae;var de='<a href="'+Ue(re)+'"';return ie&&(de+=' title="'+ie+'"'),de+=">"+ae+"</a>",de},ge.image=function(re,ie,ae){if(re=je(this.options.sanitize,this.options.baseUrl,re),re===null)return ae;var de='<img src="'+re+'" alt="'+ae+'"';return ie&&(de+=' title="'+ie+'"'),de+=this.options.xhtml?"/>":">",de},ge.text=function(re){return re},Ee}(),Ie=function(){function Ee(){}var ge=Ee.prototype;return ge.strong=function(re){return re},ge.em=function(re){return re},ge.codespan=function(re){return re},ge.del=function(re){return re},ge.html=function(re){return re},ge.text=function(re){return re},ge.link=function(re,ie,ae){return""+ae},ge.image=function(re,ie,ae){return""+ae},ge.br=function(){return""},Ee}(),Qe=function(){function Ee(){this.seen={}}var ge=Ee.prototype;return ge.slug=function(re){var ie=re.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(ie)){var ae=ie;do this.seen[ae]++,ie=ae+"-"+this.seen[ae];while(this.seen.hasOwnProperty(ie))}return this.seen[ie]=0,ie},Ee}(),rt=G.defaults,et=V.unescape,Je=function(){function Ee(ye){this.options=ye||rt,this.options.renderer=this.options.renderer||new Ne,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Ie,this.slugger=new Qe}Ee.parse=function(re,ie){var ae=new Ee(ie);return ae.parse(re)};var ge=Ee.prototype;return ge.parse=function(re,ie){ie===void 0&&(ie=!0);var ae="",de,ke,Se,We,tt,ct,lt,kt,Et,ht,jt,vt,At,Dt,Ze,Er,_r,bt,Yt=re.length;for(de=0;de<Yt;de++){ht=re[de];switch(ht.type){case"space":continue;case"hr":{ae+=this.renderer.hr();continue}case"heading":{ae+=this.renderer.heading(this.parseInline(ht.tokens),ht.depth,et(this.parseInline(ht.tokens,this.textRenderer)),this.slugger);continue}case"code":{ae+=this.renderer.code(ht.text,ht.lang,ht.escaped);continue}case"table":{for(kt="",lt="",We=ht.header.length,ke=0;ke<We;ke++)lt+=this.renderer.tablecell(this.parseInline(ht.tokens.header[ke]),{header:!0,align:ht.align[ke]});for(kt+=this.renderer.tablerow(lt),Et="",We=ht.cells.length,ke=0;ke<We;ke++){for(ct=ht.tokens.cells[ke],lt="",tt=ct.length,Se=0;Se<tt;Se++)lt+=this.renderer.tablecell(this.parseInline(ct[Se]),{header:!1,align:ht.align[Se]});Et+=this.renderer.tablerow(lt)}ae+=this.renderer.table(kt,Et);continue}case"blockquote":{Et=this.parse(ht.tokens),ae+=this.renderer.blockquote(Et);continue}case"list":{for(jt=ht.ordered,vt=ht.start,At=ht.loose,We=ht.items.length,Et="",ke=0;ke<We;ke++)Ze=ht.items[ke],Er=Ze.checked,_r=Ze.task,Dt="",Ze.task&&(bt=this.renderer.checkbox(Er),At?Ze.tokens.length>0&&Ze.tokens[0].type==="text"?(Ze.tokens[0].text=bt+" "+Ze.tokens[0].text,Ze.tokens[0].tokens&&Ze.tokens[0].tokens.length>0&&Ze.tokens[0].tokens[0].type==="text"&&(Ze.tokens[0].tokens[0].text=bt+" "+Ze.tokens[0].tokens[0].text)):Ze.tokens.unshift({type:"text",text:bt}):Dt+=bt),Dt+=this.parse(Ze.tokens,At),Et+=this.renderer.listitem(Dt,_r,Er);ae+=this.renderer.list(Et,jt,vt);continue}case"html":{ae+=this.renderer.html(ht.text);continue}case"paragraph":{ae+=this.renderer.paragraph(this.parseInline(ht.tokens));continue}case"text":{for(Et=ht.tokens?this.parseInline(ht.tokens):ht.text;de+1<Yt&&re[de+1].type==="text";)ht=re[++de],Et+=`
`+(ht.tokens?this.parseInline(ht.tokens):ht.text);ae+=ie?this.renderer.paragraph(Et):Et;continue}default:{var qt='Token with "'+ht.type+'" type was not found.';if(this.options.silent){console.error(qt);return}else throw new Error(qt)}}}return ae},ge.parseInline=function(re,ie){ie=ie||this.renderer;var ae="",de,ke,Se=re.length;for(de=0;de<Se;de++){ke=re[de];switch(ke.type){case"escape":{ae+=ie.text(ke.text);break}case"html":{ae+=ie.html(ke.text);break}case"link":{ae+=ie.link(ke.href,ke.title,this.parseInline(ke.tokens,ie));break}case"image":{ae+=ie.image(ke.href,ke.title,ke.text);break}case"strong":{ae+=ie.strong(this.parseInline(ke.tokens,ie));break}case"em":{ae+=ie.em(this.parseInline(ke.tokens,ie));break}case"codespan":{ae+=ie.codespan(ke.text);break}case"br":{ae+=ie.br();break}case"del":{ae+=ie.del(this.parseInline(ke.tokens,ie));break}case"text":{ae+=ie.text(ke.text);break}default:{var We='Token with "'+ke.type+'" type was not found.';if(this.options.silent){console.error(We);return}else throw new Error(We)}}}return ae},Ee}(),st=V.merge,Ye=V.checkSanitizeDeprecation,Xe=V.escape,_e=G.getDefaults,ot=G.changeDefaults,at=G.defaults;function Be(Ee,ge,ye){if(typeof Ee=="undefined"||Ee===null)throw new Error("marked(): input parameter is undefined or null");if(typeof Ee!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(Ee)+", string expected");if(typeof ge=="function"&&(ye=ge,ge=null),ge=st({},Be.defaults,ge||{}),Ye(ge),ye){var re=ge.highlight,ie;try{ie=Me.lex(Ee,ge)}catch(Se){return ye(Se)}var ae=function(We){var tt;if(!We)try{tt=Je.parse(ie,ge)}catch(ct){We=ct}return ge.highlight=re,We?ye(We):ye(null,tt)};if(!re||re.length<3)return ae();if(delete ge.highlight,!ie.length)return ae();var de=0;Be.walkTokens(ie,function(Se){Se.type==="code"&&(de++,setTimeout(function(){re(Se.text,Se.lang,function(We,tt){if(We)return ae(We);tt!=null&&tt!==Se.text&&(Se.text=tt,Se.escaped=!0),de--,de===0&&ae()})},0))}),de===0&&ae();return}try{var ke=Me.lex(Ee,ge);return ge.walkTokens&&Be.walkTokens(ke,ge.walkTokens),Je.parse(ke,ge)}catch(Se){if(Se.message+=`
Please report this to https://github.com/markedjs/marked.`,ge.silent)return"<p>An error occurred:</p><pre>"+Xe(Se.message+"",!0)+"</pre>";throw Se}}Be.options=Be.setOptions=function(Ee){return st(Be.defaults,Ee),ot(Be.defaults),Be},Be.getDefaults=_e,Be.defaults=at,Be.use=function(Ee){var ge=st({},Ee);if(Ee.renderer&&function(){var re=Be.defaults.renderer||new Ne,ie=function(ke){var Se=re[ke];re[ke]=function(){for(var We=arguments.length,tt=new Array(We),ct=0;ct<We;ct++)tt[ct]=arguments[ct];var lt=Ee.renderer[ke].apply(re,tt);return lt===!1&&(lt=Se.apply(re,tt)),lt}};for(var ae in Ee.renderer)ie(ae);ge.renderer=re}(),Ee.tokenizer&&function(){var re=Be.defaults.tokenizer||new Ce,ie=function(ke){var Se=re[ke];re[ke]=function(){for(var We=arguments.length,tt=new Array(We),ct=0;ct<We;ct++)tt[ct]=arguments[ct];var lt=Ee.tokenizer[ke].apply(re,tt);return lt===!1&&(lt=Se.apply(re,tt)),lt}};for(var ae in Ee.tokenizer)ie(ae);ge.tokenizer=re}(),Ee.walkTokens){var ye=Be.defaults.walkTokens;ge.walkTokens=function(re){Ee.walkTokens(re),ye&&ye(re)}}Be.setOptions(ge)},Be.walkTokens=function(Ee,ge){for(var ye=B(Ee),re;!(re=ye()).done;){var ie=re.value;ge(ie);switch(ie.type){case"table":{for(var ae=B(ie.tokens.header),de;!(de=ae()).done;){var ke=de.value;Be.walkTokens(ke,ge)}for(var Se=B(ie.tokens.cells),We;!(We=Se()).done;)for(var tt=We.value,ct=B(tt),lt;!(lt=ct()).done;){var kt=lt.value;Be.walkTokens(kt,ge)}break}case"list":{Be.walkTokens(ie.items,ge);break}default:ie.tokens&&Be.walkTokens(ie.tokens,ge)}}},Be.Parser=Je,Be.parser=Je.parse,Be.Renderer=Ne,Be.TextRenderer=Ie,Be.Lexer=Me,Be.lexer=Me.lex,Be.Tokenizer=Ce,Be.Slugger=Qe,Be.parse=Be;var Ke=Be;return Ke})},ELLl:function(Tt,dt,le){(function(he){he(le("VrN/"))})(function(he){var J={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},D=he.Pos;he.defineOption("autoCloseBrackets",!1,function(w,y,u){u&&u!=he.Init&&(w.removeKeyMap(B),w.state.closeBrackets=null),y&&(_(Q(y,"pairs")),w.state.closeBrackets=y,w.addKeyMap(B))});function Q(w,y){return y=="pairs"&&typeof w=="string"?w:typeof w=="object"&&w[y]!=null?w[y]:J[y]}var B={Backspace:I,Enter:R};function _(w){for(var y=0;y<w.length;y++){var u=w.charAt(y),o="'"+u+"'";B[o]||(B[o]=G(u))}}_(J.pairs+"`");function G(w){return function(y){return A(y,w)}}function j(w){var y=w.state.closeBrackets;if(!y||y.override)return y;var u=w.getModeAt(w.getCursor());return u.closeBrackets||y}function I(w){var y=j(w);if(!y||w.getOption("disableInput"))return he.Pass;for(var u=Q(y,"pairs"),o=w.listSelections(),l=0;l<o.length;l++){if(!o[l].empty())return he.Pass;var d=M(w,o[l].head);if(!d||u.indexOf(d)%2!=0)return he.Pass}for(var l=o.length-1;l>=0;l--){var T=o[l].head;w.replaceRange("",D(T.line,T.ch-1),D(T.line,T.ch+1),"+delete")}}function R(w){var y=j(w),u=y&&Q(y,"explode");if(!u||w.getOption("disableInput"))return he.Pass;for(var o=w.listSelections(),l=0;l<o.length;l++){if(!o[l].empty())return he.Pass;var d=M(w,o[l].head);if(!d||u.indexOf(d)%2!=0)return he.Pass}w.operation(function(){var T=w.lineSeparator()||`
`;w.replaceSelection(T+T,null),w.execCommand("goCharLeft"),o=w.listSelections();for(var c=0;c<o.length;c++){var p=o[c].head.line;w.indentLine(p,null,!0),w.indentLine(p+1,null,!0)}})}function v(w){var y=he.cmpPos(w.anchor,w.head)>0;return{anchor:new D(w.anchor.line,w.anchor.ch+(y?-1:1)),head:new D(w.head.line,w.head.ch+(y?1:-1))}}function A(w,y){var u=j(w);if(!u||w.getOption("disableInput"))return he.Pass;var o=Q(u,"pairs"),l=o.indexOf(y);if(l==-1)return he.Pass;for(var d=Q(u,"closeBefore"),T=Q(u,"triples"),c=o.charAt(l+1)==y,p=w.listSelections(),k=l%2==0,x,m=0;m<p.length;m++){var g=p[m],h=g.head,a,E=w.getRange(h,D(h.line,h.ch+1));if(k&&!g.empty())a="surround";else if((c||!k)&&E==y)c&&L(w,h)?a="both":T.indexOf(y)>=0&&w.getRange(h,D(h.line,h.ch+3))==y+y+y?a="skipThree":a="skip";else if(c&&h.ch>1&&T.indexOf(y)>=0&&w.getRange(D(h.line,h.ch-2),h)==y+y){if(h.ch>2&&/\bstring/.test(w.getTokenTypeAt(D(h.line,h.ch-2))))return he.Pass;a="addFour"}else if(c){var b=h.ch==0?" ":w.getRange(D(h.line,h.ch-1),h);if(!he.isWordChar(E)&&b!=y&&!he.isWordChar(b))a="both";else return he.Pass}else if(k&&(E.length===0||/\s/.test(E)||d.indexOf(E)>-1))a="both";else return he.Pass;if(!x)x=a;else if(x!=a)return he.Pass}var S=l%2?o.charAt(l-1):y,N=l%2?y:o.charAt(l+1);w.operation(function(){if(x=="skip")w.execCommand("goCharRight");else if(x=="skipThree")for(var U=0;U<3;U++)w.execCommand("goCharRight");else if(x=="surround"){for(var K=w.getSelections(),U=0;U<K.length;U++)K[U]=S+K[U]+N;w.replaceSelections(K,"around"),K=w.listSelections().slice();for(var U=0;U<K.length;U++)K[U]=v(K[U]);w.setSelections(K)}else x=="both"?(w.replaceSelection(S+N,null),w.triggerElectric(S+N),w.execCommand("goCharLeft")):x=="addFour"&&(w.replaceSelection(S+S+S+S,"before"),w.execCommand("goCharRight"))})}function M(w,y){var u=w.getRange(D(y.line,y.ch-1),D(y.line,y.ch+1));return u.length==2?u:null}function L(w,y){var u=w.getTokenAt(D(y.line,y.ch+1));return/\bstring/.test(u.type)&&u.start==y.ch&&(y.ch==0||!/\bstring/.test(w.getTokenTypeAt(y)))}})},GfqC:function(Tt,dt,le){"use strict";var he=le("q1tI"),J=le.n(he),D=le("TSYQ"),Q=le.n(D);function B(V,O){var P="cannot "+V.method+" "+V.action+" "+O.status+"'",$=new Error(P);return $.status=O.status,$.method=V.method,$.url=V.action,$}function _(V){var O=V.responseText||V.response;if(!O)return O;try{return JSON.parse(O)}catch(P){return O}}function G(V){var O=new XMLHttpRequest;V.onProgress&&O.upload&&(O.upload.onprogress=function(oe){oe.total>0&&(oe.percent=oe.loaded/oe.total*100),V.onProgress(oe)});var P=new FormData;V.data&&Object.keys(V.data).forEach(function(ee){var oe=V.data[ee];if(Array.isArray(oe)){oe.forEach(function(fe){P.append(ee+"[]",fe)});return}P.append(ee,V.data[ee])}),V.file instanceof Blob?P.append(V.filename,V.file,V.file.name):P.append(V.filename,V.file),O.onerror=function(oe){V.onError(oe)},O.onload=function(){return O.status<200||O.status>=300?V.onError(B(V,O),_(O)):V.onSuccess(_(O),O)},O.open(V.method,V.action,!0),V.withCredentials&&"withCredentials"in O&&(O.withCredentials=!0);var $=V.headers||{};return $["X-Requested-With"]!==null&&O.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys($).forEach(function(ee){$[ee]!==null&&O.setRequestHeader(ee,$[ee])}),O.send(P),{abort:function(){O.abort()}}}var j=+new Date,I=0;function R(){return"rc-upload-"+j+"-"+ ++I}function v(V,O){return V.indexOf(O,V.length-O.length)!==-1}var A=function(V,O){if(V&&O){var P=Array.isArray(O)?O:O.split(","),$=V.name||"",ee=V.type||"",oe=ee.replace(/\/.*$/,"");return P.some(function(fe){var Oe=fe.trim();return Oe.charAt(0)==="."?v($.toLowerCase(),Oe.toLowerCase()):/\/\*$/.test(Oe)?oe===Oe.replace(/\/.*$/,""):ee===Oe})}return!0};function M(V,O){var P=V.createReader(),$=[];function ee(){P.readEntries(function(oe){var fe=Array.prototype.slice.apply(oe);$=$.concat(fe);var Oe=!fe.length;Oe?O($):ee()})}ee()}var L=function(O,P,$){var ee=function oe(fe,Oe){Oe=Oe||"",fe.isFile?fe.file(function(Ce){$(Ce)&&(fe.fullPath&&!Ce.webkitRelativePath&&(Object.defineProperties(Ce,{webkitRelativePath:{writable:!0}}),Ce.webkitRelativePath=fe.fullPath.replace(/^\//,""),Object.defineProperties(Ce,{webkitRelativePath:{writable:!1}})),P([Ce]))}):fe.isDirectory&&M(fe,function(Ce){Ce.forEach(function(Ae){oe(Ae,""+Oe+fe.name+"/")})})};O.forEach(function(oe){ee(oe.webkitGetAsEntry())})},w=L,y=Object.assign||function(V){for(var O=1;O<arguments.length;O++){var P=arguments[O];for(var $ in P)Object.prototype.hasOwnProperty.call(P,$)&&(V[$]=P[$])}return V},u=function(){function V(O,P){var $=[],ee=!0,oe=!1,fe=void 0;try{for(var Oe=O[Symbol.iterator](),Ce;!(ee=(Ce=Oe.next()).done)&&!($.push(Ce.value),P&&$.length===P);ee=!0);}catch(Ae){oe=!0,fe=Ae}finally{try{!ee&&Oe.return&&Oe.return()}finally{if(oe)throw fe}}return $}return function(O,P){if(Array.isArray(O))return O;if(Symbol.iterator in Object(O))return V(O,P);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),o=function(){function V(O,P){for(var $=0;$<P.length;$++){var ee=P[$];ee.enumerable=ee.enumerable||!1,ee.configurable=!0,"value"in ee&&(ee.writable=!0),Object.defineProperty(O,ee.key,ee)}}return function(O,P,$){return P&&V(O.prototype,P),$&&V(O,$),O}}();function l(V,O,P){return O in V?Object.defineProperty(V,O,{value:P,enumerable:!0,configurable:!0,writable:!0}):V[O]=P,V}function d(V,O){var P={};for(var $ in V){if(O.indexOf($)>=0)continue;if(!Object.prototype.hasOwnProperty.call(V,$))continue;P[$]=V[$]}return P}function T(V,O){if(!(V instanceof O))throw new TypeError("Cannot call a class as a function")}function c(V,O){if(!V)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return O&&(typeof O=="object"||typeof O=="function")?O:V}function p(V,O){if(typeof O!="function"&&O!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof O);V.prototype=Object.create(O&&O.prototype,{constructor:{value:V,enumerable:!1,writable:!0,configurable:!0}}),O&&(Object.setPrototypeOf?Object.setPrototypeOf(V,O):V.__proto__=O)}var k=function(O){return Object.keys(O).reduce(function(P,$){return($.substr(0,5)==="data-"||$.substr(0,5)==="aria-"||$==="role")&&(P[$]=O[$]),P},{})},x=function(V){p(O,V);function O(){var P,$,ee,oe;T(this,O);for(var fe=arguments.length,Oe=Array(fe),Ce=0;Ce<fe;Ce++)Oe[Ce]=arguments[Ce];return oe=($=(ee=c(this,(P=O.__proto__||Object.getPrototypeOf(O)).call.apply(P,[this].concat(Oe))),ee),ee.state={uid:R()},ee.reqs={},ee.onChange=function(Ae){var Le=Ae.target.files;ee.uploadFiles(Le),ee.reset()},ee.onClick=function(Ae){var Le=ee.fileInput;if(!Le)return;var be=ee.props,pe=be.children,se=be.onClick;pe&&pe.type==="button"&&(Le.parentNode.focus(),Le.parentNode.querySelector("button").blur()),Le.click(),se&&se(Ae)},ee.onKeyDown=function(Ae){Ae.key==="Enter"&&ee.onClick()},ee.onFileDrop=function(Ae){var Le=ee.props.multiple;if(Ae.preventDefault(),Ae.type==="dragover")return;if(ee.props.directory)w(Array.prototype.slice.call(Ae.dataTransfer.items),ee.uploadFiles,function(pe){return A(pe,ee.props.accept)});else{var be=Array.prototype.slice.call(Ae.dataTransfer.files).filter(function(pe){return A(pe,ee.props.accept)});Le===!1&&(be=be.slice(0,1)),ee.uploadFiles(be)}},ee.uploadFiles=function(Ae){var Le=Array.prototype.slice.call(Ae);Le.map(function(be){return be.uid=R(),be}).forEach(function(be){ee.upload(be,Le)})},ee.saveFileInput=function(Ae){ee.fileInput=Ae},$),c(ee,oe)}return o(O,[{key:"componentDidMount",value:function(){this._isMounted=!0}},{key:"componentWillUnmount",value:function(){this._isMounted=!1,this.abort()}},{key:"upload",value:function($,ee){var oe=this,fe=this.props;if(!fe.beforeUpload)return setTimeout(function(){return oe.post($)},0);var Oe=fe.beforeUpload($,ee);Oe&&Oe.then?Oe.then(function(Ce){var Ae=Object.prototype.toString.call(Ce);return Ae==="[object File]"||Ae==="[object Blob]"?oe.post(Ce):oe.post($)}).catch(function(Ce){console.log(Ce)}):Oe!==!1&&setTimeout(function(){return oe.post($)},0);return}},{key:"post",value:function($){var ee=this;if(!this._isMounted)return;var oe=this.props,fe=oe.onStart,Oe=oe.onProgress,Ce=oe.transformFile,Ae=Ce===void 0?function(Le){return Le}:Ce;new Promise(function(Le){var be=oe.action;return typeof be=="function"&&(be=be($)),Le(be)}).then(function(Le){var be=$.uid,pe=oe.customRequest||G,se=Promise.resolve(Ae($)).then(function(te){var ue=oe.data;return typeof ue=="function"&&(ue=ue(te)),Promise.all([te,ue])}).catch(function(te){console.error(te)});se.then(function(te){var ue=u(te,2),ne=ue[0],Te=ue[1],Re={action:Le,filename:oe.name,data:Te,file:ne,headers:oe.headers,withCredentials:oe.withCredentials,method:oe.method||"post",onProgress:Oe?function(xe){Oe(xe,$)}:null,onSuccess:function(Me,Pe){delete ee.reqs[be],oe.onSuccess(Me,$,Pe)},onError:function(Me,Pe){delete ee.reqs[be],oe.onError(Me,Pe,$)}};fe($),ee.reqs[be]=pe(Re)})})}},{key:"reset",value:function(){this.setState({uid:R()})}},{key:"abort",value:function($){var ee=this.reqs;if($){var oe=$;$&&$.uid&&(oe=$.uid),ee[oe]&&ee[oe].abort&&ee[oe].abort(),delete ee[oe]}else Object.keys(ee).forEach(function(fe){ee[fe]&&ee[fe].abort&&ee[fe].abort(),delete ee[fe]})}},{key:"render",value:function(){var $,ee=this.props,oe=ee.component,fe=ee.prefixCls,Oe=ee.className,Ce=ee.disabled,Ae=ee.id,Le=ee.style,be=ee.multiple,pe=ee.accept,se=ee.children,te=ee.directory,ue=ee.openFileDialogOnClick,ne=ee.onMouseEnter,Te=ee.onMouseLeave,Re=d(ee,["component","prefixCls","className","disabled","id","style","multiple","accept","children","directory","openFileDialogOnClick","onMouseEnter","onMouseLeave"]),xe=Q()(($={},l($,fe,!0),l($,fe+"-disabled",Ce),l($,Oe,Oe),$)),Me=Ce?{}:{onClick:ue?this.onClick:function(){},onKeyDown:ue?this.onKeyDown:function(){},onMouseEnter:ne,onMouseLeave:Te,onDrop:this.onFileDrop,onDragOver:this.onFileDrop,tabIndex:"0"};return J.a.createElement(oe,y({},Me,{className:xe,role:"button",style:Le}),J.a.createElement("input",y({},k(Re),{id:Ae,type:"file",ref:this.saveFileInput,onClick:function(je){return je.stopPropagation()},key:this.state.uid,style:{display:"none"},accept:pe,directory:te?"directory":null,webkitdirectory:te?"webkitdirectory":null,multiple:be,onChange:this.onChange})),se)}}]),O}(he.Component),m=x,g=Object.assign||function(V){for(var O=1;O<arguments.length;O++){var P=arguments[O];for(var $ in P)Object.prototype.hasOwnProperty.call(P,$)&&(V[$]=P[$])}return V},h=function(){function V(O,P){for(var $=0;$<P.length;$++){var ee=P[$];ee.enumerable=ee.enumerable||!1,ee.configurable=!0,"value"in ee&&(ee.writable=!0),Object.defineProperty(O,ee.key,ee)}}return function(O,P,$){return P&&V(O.prototype,P),$&&V(O,$),O}}();function a(V,O){if(!(V instanceof O))throw new TypeError("Cannot call a class as a function")}function E(V,O){if(!V)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return O&&(typeof O=="object"||typeof O=="function")?O:V}function b(V,O){if(typeof O!="function"&&O!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof O);V.prototype=Object.create(O&&O.prototype,{constructor:{value:V,enumerable:!1,writable:!0,configurable:!0}}),O&&(Object.setPrototypeOf?Object.setPrototypeOf(V,O):V.__proto__=O)}function S(){}var N=function(V){b(O,V);function O(){var P,$,ee,oe;a(this,O);for(var fe=arguments.length,Oe=Array(fe),Ce=0;Ce<fe;Ce++)Oe[Ce]=arguments[Ce];return oe=($=(ee=E(this,(P=O.__proto__||Object.getPrototypeOf(O)).call.apply(P,[this].concat(Oe))),ee),ee.saveUploader=function(Ae){ee.uploader=Ae},$),E(ee,oe)}return h(O,[{key:"abort",value:function($){this.uploader.abort($)}},{key:"render",value:function(){return J.a.createElement(m,g({},this.props,{ref:this.saveUploader}))}}]),O}(he.Component);N.defaultProps={component:"span",prefixCls:"rc-upload",data:{},headers:{},name:"file",multipart:!1,onStart:S,onError:S,onSuccess:S,multiple:!1,beforeUpload:null,customRequest:null,withCredentials:!1,openFileDialogOnClick:!0};var U=N,K=dt.a=U},HmJG:function(Tt,dt,le){},LdHM:function(Tt,dt,le){"use strict";le.d(dt,"b",function(){return d}),le.d(dt,"a",function(){return c});var he=le("1OyB"),J=le("vuIU"),D=le("Ji7U"),Q=le("LK+K"),B=le("q1tI"),_=le("rePB"),G=le("Ff2n"),j=le("ODXe"),I=le("4IlW"),R=le("bX4T"),v=le("YrtM"),A=le("TSYQ"),M=le.n(A),L=le("+nKL"),w=le("8OUc"),y=function($,ee){var oe=$.prefixCls,fe=$.id,Oe=$.flattenOptions,Ce=$.childrenAsData,Ae=$.values,Le=$.searchValue,be=$.multiple,pe=$.defaultActiveFirstOption,se=$.height,te=$.itemHeight,ue=$.notFoundContent,ne=$.open,Te=$.menuItemSelectedIcon,Re=$.virtual,xe=$.onSelect,Me=$.onToggleOpen,Pe=$.onActiveValue,je=$.onScroll,Ue=$.onMouseEnter,Ne="".concat(oe,"-item"),Ie=Object(v.a)(function(){return Oe},[ne,Oe],function(Ke,Ee){return Ee[0]&&Ke[1]!==Ee[1]}),Qe=B.useRef(null),rt=function(Ee){Ee.preventDefault()},et=function(Ee){Qe.current&&Qe.current.scrollTo({index:Ee})},Je=function(Ee){for(var ge=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,ye=Ie.length,re=0;re<ye;re+=1){var ie=(Ee+re*ge+ye)%ye,ae=Ie[ie],de=ae.group,ke=ae.data;if(!de&&!ke.disabled)return ie}return-1},st=B.useState(function(){return Je(0)}),Ye=Object(j.a)(st,2),Xe=Ye[0],_e=Ye[1],ot=function(Ee){_e(Ee);var ge=Ie[Ee];if(!ge){Pe(null,-1);return}Pe(ge.data.value,Ee)};B.useEffect(function(){ot(pe!==!1?Je(0):-1)},[Ie.length,Le]),B.useEffect(function(){var Ke=setTimeout(function(){if(!be&&ne&&Ae.size===1){var Ee=Array.from(Ae)[0],ge=Ie.findIndex(function(ye){var re=ye.data;return re.value===Ee});ot(ge),et(ge)}});return function(){return clearTimeout(Ke)}},[ne]);var at=function(Ee){Ee!==void 0&&xe(Ee,{selected:!Ae.has(Ee)}),be||Me(!1)};if(B.useImperativeHandle(ee,function(){return{onKeyDown:function(Ee){var ge=Ee.which;switch(ge){case I.a.UP:case I.a.DOWN:{var ye=0;if(ge===I.a.UP?ye=-1:ge===I.a.DOWN&&(ye=1),ye!==0){var re=Je(Xe+ye,ye);et(re),ot(re)}break}case I.a.ENTER:{var ie=Ie[Xe];ie&&!ie.data.disabled?at(ie.data.value):at(void 0),ne&&Ee.preventDefault();break}case I.a.ESC:Me(!1)}},onKeyUp:function(){},scrollTo:function(Ee){et(Ee)}}}),Ie.length===0)return B.createElement("div",{role:"listbox",id:"".concat(fe,"_list"),className:"".concat(Ne,"-empty"),onMouseDown:rt},ue);function Be(Ke){var Ee=Ie[Ke];if(!Ee)return null;var ge=Ee.data||{},ye=ge.value,re=ge.label,ie=ge.children,ae=Object(R.a)(ge,!0),de=Ce?ie:re;return Ee?B.createElement("div",Object.assign({"aria-label":typeof de=="string"?de:null},ae,{key:Ke,role:"option",id:"".concat(fe,"_list_").concat(Ke),"aria-selected":Ae.has(ye)}),ye):null}return B.createElement(B.Fragment,null,B.createElement("div",{role:"listbox",id:"".concat(fe,"_list"),style:{height:0,width:0,overflow:"hidden"}},Be(Xe-1),Be(Xe),Be(Xe+1)),B.createElement(L.a,{itemKey:"key",ref:Qe,data:Ie,height:se,itemHeight:te,fullHeight:!1,onMouseDown:rt,onScroll:je,virtual:Re,onMouseEnter:Ue},function(Ke,Ee){var ge,ye=Ke.group,re=Ke.groupOption,ie=Ke.data,ae=ie.label,de=ie.key;if(ye)return B.createElement("div",{className:M()(Ne,"".concat(Ne,"-group"))},ae!==void 0?ae:de);var ke=ie.disabled,Se=ie.value,We=ie.title,tt=ie.children,ct=ie.style,lt=ie.className,kt=Object(G.a)(ie,["disabled","value","title","children","style","className"]),Et=Ae.has(Se),ht="".concat(Ne,"-option"),jt=M()(Ne,ht,lt,(ge={},Object(_.a)(ge,"".concat(ht,"-grouped"),re),Object(_.a)(ge,"".concat(ht,"-active"),Xe===Ee&&!ke),Object(_.a)(ge,"".concat(ht,"-disabled"),ke),Object(_.a)(ge,"".concat(ht,"-selected"),Et),ge)),vt=Ce?tt:ae,At=!Te||typeof Te=="function"||Et;return B.createElement("div",Object.assign({},kt,{"aria-selected":Et,className:jt,title:We,onMouseMove:function(){if(Xe===Ee||ke)return;ot(Ee)},onClick:function(){ke||at(Se)},style:ct}),B.createElement("div",{className:"".concat(ht,"-content")},vt||Se),B.isValidElement(Te)||Et,At&&B.createElement(w.a,{className:"".concat(Ne,"-option-state"),customizeIcon:Te,customizeIconProps:{isSelected:Et}},Et?"\u2713":null))}))},u=B.forwardRef(y);u.displayName="OptionList";var o=u,l=function(){return null};l.isSelectOption=!0;var d=l,T=function(){return null};T.isSelectOptGroup=!0;var c=T,p=le("VTBJ"),k=le("Zm9Q");function x(P){var $=P.key,ee=P.props,oe=ee.children,fe=ee.value,Oe=Object(G.a)(ee,["children","value"]);return Object(p.a)({key:$,value:fe!==void 0?fe:$,children:oe},Oe)}function m(P){var $=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(k.a)(P).map(function(ee,oe){if(!B.isValidElement(ee)||!ee.type)return null;var fe=ee.type.isSelectOptGroup,Oe=ee.key,Ce=ee.props,Ae=Ce.children,Le=Object(G.a)(Ce,["children"]);return $||!fe?x(ee):Object(p.a)(Object(p.a)({key:"__RC_SELECT_GRP__".concat(Oe===null?oe:Oe,"__"),label:Oe},Le),{},{options:m(Ae)})}).filter(function(ee){return ee})}var g=le("2Qr1"),h=le("qNPg"),a=le("U8pU"),E=le("Kwbf"),b=le("WKfj");function S(P){var $=P.mode,ee=P.options,oe=P.children,fe=P.backfill,Oe=P.allowClear,Ce=P.placeholder,Ae=P.getInputElement,Le=P.showSearch,be=P.onSearch,pe=P.defaultOpen,se=P.autoFocus,te=P.labelInValue,ue=P.value,ne=P.inputValue,Te=P.optionLabelProp,Re=$==="multiple"||$==="tags",xe=Le!==void 0?Le:Re||$==="combobox",Me=ee||m(oe);if(Object(E.a)($!=="tags"||Me.every(function(Ne){return!Ne.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),$==="tags"||$==="combobox"){var Pe=Me.some(function(Ne){return Ne.options?Ne.options.some(function(Ie){return typeof("value"in Ie?Ie.value:Ie.key)=="number"}):typeof("value"in Ne?Ne.value:Ne.key)=="number"});Object(E.a)(!Pe,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(E.a)($!=="combobox"||!Te,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(E.a)($==="combobox"||!fe,"`backfill` only works with `combobox` mode."),Object(E.a)($==="combobox"||!Ae,"`getInputElement` only work with `combobox` mode."),Object(E.b)($!=="combobox"||!Ae||!Oe||!Ce,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),be&&!xe&&$!=="combobox"&&$!=="tags"&&Object(E.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(E.b)(!pe||se,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),ue!=null){var je=Object(b.d)(ue);Object(E.a)(!te||je.every(function(Ne){return Object(a.a)(Ne)==="object"&&("key"in Ne||"value"in Ne)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(E.a)(!Re||Array.isArray(ue),"`value` should be array when `mode` is `multiple` or `tags`")}if(oe){var Ue=null;Object(k.a)(oe).some(function(Ne){if(!B.isValidElement(Ne)||!Ne.type)return!1;var Ie=Ne.type;if(Ie.isSelectOption)return!1;if(Ie.isSelectOptGroup){var Qe=Object(k.a)(Ne.props.children).every(function(rt){return!B.isValidElement(rt)||!Ne.type||rt.type.isSelectOption?!0:(Ue=rt.type,!1)});return!Qe}return Ue=Ie,!0}),Ue&&Object(E.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(Ue.displayName||Ue.name||Ue,"`.")),Object(E.a)(ne===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var N=S,U=Object(h.a)({prefixCls:"rc-select",components:{optionList:o},convertChildrenToData:m,flattenOptions:g.d,getLabeledValue:g.e,filterOptions:g.b,isValueDisabled:g.g,findValueOption:g.c,warningProps:N,fillOptionsWithMissingValue:g.a}),K=function(P){Object(D.a)(ee,P);var $=Object(Q.a)(ee);function ee(){var oe;return Object(he.a)(this,ee),oe=$.apply(this,arguments),oe.selectRef=B.createRef(),oe.focus=function(){oe.selectRef.current.focus()},oe.blur=function(){oe.selectRef.current.blur()},oe}return Object(J.a)(ee,[{key:"render",value:function(){return B.createElement(U,Object.assign({ref:this.selectRef},this.props))}}]),ee}(B.Component);K.Option=d,K.OptGroup=c;var V=K,O=dt.c=V},M8RZ:function(Tt,dt,le){"use strict";le.d(dt,"a",function(){return I});var he=le("fWQN"),J=le("mtLc"),D=le("yKVA"),Q=le("879j"),B=le("q1tI"),_=le.n(B),G=le("i8i4"),j=le.n(G),I=function(R){Object(D.a)(A,R);var v=Object(Q.a)(A);function A(M){var L;Object(he.a)(this,A),L=v.call(this,M);var w=window.document;return L.node=w.createElement("div"),w.body.appendChild(L.node),L}return Object(J.a)(A,[{key:"render",value:function(){var L=this.props.children;return Object(G.createPortal)(L,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),A}(_.a.Component)},Ot1p:function(Tt,dt,le){"use strict";var he=le("2qtc"),J=le("kLXV"),D=le("rAM+"),Q=le("miYZ"),B=le("tsqr"),_=le("9og8"),G=le("tJVT"),j=le("jrin"),I=le("WmNS"),R=le.n(I),v=le("q1tI"),A=le.n(v),M=le("VrN/"),L=le.n(M),w=le("bdgK"),y=le("p77/"),u=le("Bd2K"),o=le("ELLl"),l=le("19Vz"),d=le("lZu9"),T=le("+NIl"),c=le("kSUc"),p=le("9Bee"),k=function(Se){var We=Se.value,tt=We===void 0?"":We,ct=Se.className,lt=Se.showTextOnly,kt=Se.showLines,Et=Se.style,ht=Et===void 0?{}:Et,jt=Object(v.useMemo)(function(){return""},[tt]);return A.a.createElement(A.a.Fragment,null,A.a.createElement("div",{dangerouslySetInnerHTML:{__html:jt}}))},x=le("0Owb"),m=le("dejd"),g=le("C+DQ"),h=le("1vsH"),a=le("m3rI"),E=[{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(Se){var We=Se.onActionCallback,tt=Se.title,ct=Se.icon,lt=Se.actionName,kt=Se.className,Et=kt===void 0?"":kt,ht=Se.children;function jt(){We(lt)}return A.a.createElement("a",{title:tt,className:Et,onClick:jt},A.a.createElement("i",{className:"md-iconfont ".concat(ct)}),ht)}var S=function(Se){var We=Se.watch,tt=Se.showNullButton,ct=Se.onActionCallback,lt=Se.fullScreen,kt=Se.insertTemp,Et=Se.hidetoolBar,ht=Se.uuid,jt=Se.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(h.D)("_educoder_session_login"),"&_educoder_session=").concat(Object(h.D)("_educoder_session"),"&key=").concat(ht,"&api=").concat(encodeURIComponent(a.a.PROXY_SERVER)));var vt=[].concat(E,[{title:"".concat(We?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(We?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return A.a.createElement("ul",{className:"markdown-toolbar-container"},!Et&&vt.map(function(At,Dt){return A.a.createElement("li",{key:Dt},At.actionName?A.a.createElement(b,Object(x.a)({},At,{onActionCallback:ct})):A.a.createElement("span",{className:"v-line"}))}),tt?A.a.createElement("li",null,A.a.createElement(b,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:ct},A.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,kt&&A.a.createElement("li",null,A.a.createElement(b,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(kt),onActionCallback:ct},A.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),A.a.createElement("li",{className:"btn-full-screen"},A.a.createElement(b,{icon:"".concat(lt?"icon-shrink":"icon-enlarge"),title:lt?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:ct})))},N=le("M8RZ"),U=le("+L6B"),K=le("2/Rp"),V=le("y8nQ"),O=le("Vl3Y"),P=le("5NDa"),$=le("5rEg"),ee={labelCol:{span:4},wrapperCol:{span:20}},oe=function(Se){var We=Se.callback,tt=Se.onCancel;function ct(lt){We(lt)}return A.a.createElement(O.a,Object(x.a)({},ee,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:ct}),A.a.createElement(O.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},A.a.createElement($.a,null)),A.a.createElement(O.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},A.a.createElement($.a,null)),A.a.createElement("div",{className:"flex-container flex-end"},A.a.createElement(K.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),A.a.createElement(K.a,{type:"ghost",onClick:tt},"\u53D6\u6D88")))},fe=le("7ahc"),Oe=le("k1fw"),Ce=le("HmJG"),Ae=le("BjJ7"),Le=O.a.useForm,be={width:280,marginRight:10},pe={labelCol:{span:5},wrapperCol:{span:19}},se=function(Se){var We=Se.callback,tt=Se.onCancel,ct=Le(),lt=Object(G.a)(ct,1),kt=lt[0],Et=Object(v.useRef)();function ht(At){We(Object(Oe.a)(Object(Oe.a)({},At),{},{name:Et.current}))}function jt(At,Dt){kt.setFieldsValue({src:"/api/attachments/".concat(At.id,"?type=").concat(At.content_type),type:Dt.type})}function vt(At){var Dt=At.target.files[0];Et.current=Dt.name,ue(Dt,jt)}return A.a.createElement(O.a,Object(x.a)({form:kt},pe,{className:"upload-image-panel",onFinish:ht}),A.a.createElement(O.a.Item,{label:"\u6587\u4EF6\u5730\u5740",required:!0},A.a.createElement("div",{className:"flex-container"},A.a.createElement(O.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u6587\u4EF6\u5730\u5740"}]},A.a.createElement($.a,{style:be})),A.a.createElement(te,{onFileChange:vt}))),A.a.createElement(O.a.Item,{label:"\u6587\u4EF6\u63CF\u8FF0",name:"alt"},A.a.createElement($.a,{style:{width:264}})),A.a.createElement(O.a.Item,{style:{textAlign:"right"}},A.a.createElement(K.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),A.a.createElement(K.a,{type:"ghost",onClick:tt},"\u53D6\u6D88")))};function te(Se){var We=Se.onFileChange;return A.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",A.a.createElement("input",{type:"file",onChange:We}))}function ue(Se,We){if(!Se)throw new String("\u6CA1\u6709\u6587\u4EF6");var tt=new FormData;tt.append("editormd-image-file",Se),tt.append("file_param_name","editormd-image-file"),tt.append("byxhr","true");var ct=new window.XMLHttpRequest;ct.withCredentials=!0,ct.addEventListener("load",function(lt){We(JSON.parse(lt.target.responseText),Se)},!1),ct.addEventListener("error",function(lt){console.error(lt)},!1),ct.open("POST","".concat(Ae.a,"/api/attachments.json")),ct.send(tt)}var ne=le("giR+"),Te=le("fyUT"),Re=le("7Kak"),xe=le("9yH6"),Me=xe.a.Group,Pe={margin:"0 8px"},je=function(Se){var We=Se.callback,tt=Se.onCancel;function ct(lt){We(lt)}return A.a.createElement(O.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:ct},A.a.createElement("div",{className:"flex-container"},A.a.createElement("span",{style:Pe},"\u5355\u5143\u683C\u6570\uFF1A"),A.a.createElement("span",{style:Pe},"\u884C\u6570"),A.a.createElement(O.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},A.a.createElement(Te.a,null)),A.a.createElement("span",{style:Pe},"\u5217\u6570"),A.a.createElement(O.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},A.a.createElement(Te.a,null))),A.a.createElement("div",{className:"flex-container",style:{marginTop:12}},A.a.createElement("span",{style:Pe},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),A.a.createElement(O.a.Item,{name:"align"},A.a.createElement(Me,null,A.a.createElement(xe.a,{value:"default"},A.a.createElement("i",{className:"fa fa-align-justify"})),A.a.createElement(xe.a,{value:"left"},A.a.createElement("i",{className:"fa fa-align-left"})),A.a.createElement(xe.a,{value:"center"},A.a.createElement("i",{className:"fa fa-align-center"})),A.a.createElement(xe.a,{value:"right"},A.a.createElement("i",{className:"fa fa-align-right"}))))),A.a.createElement("div",{className:"flex-container flex-end"},A.a.createElement(K.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),A.a.createElement(K.a,{type:"ghost",onClick:tt},"\u53D6\u6D88")))},Ue=le("ErOA"),Ne=le("7Cbv"),Ie="link",Qe="upload-image",rt="code-block",et="add-table",Je="------------",st={default:Je,left:":".concat(Je),center:":".concat(Je,":"),right:"".concat(Je,":")},Ye=le("9VGf"),Xe,_e;function ot(){}var at=0,Be=1e4,Ke="\u2581",Ee=`
**\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 ge(Se){return/^\d+$/.test(Se)?"".concat(Se,"px"):Se}var ye=navigator.platform.toUpperCase().indexOf("MAC")>=0,re=ye?"Cmd":"Ctrl",ie=["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"],ae=(Xe={},Object(j.a)(Xe,re+"-B","bold"),Object(j.a)(Xe,re+"-I","italic"),Xe),de=(_e={},Object(j.a)(_e,Ie,"\u6DFB\u52A0\u94FE\u63A5"),Object(j.a)(_e,rt,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(j.a)(_e,Qe,"\u6DFB\u52A0\u6587\u4EF6"),Object(j.a)(_e,et,"\u6DFB\u52A0\u8868\u683C"),_e),ke=dt.a=function(Se){var We=Se.defaultValue,tt=We===void 0?"":We,ct=Se.onChange,lt=Se.width,kt=lt===void 0?"100%":lt,Et=Se.height,ht=Et===void 0?400:Et,jt=Se.miniToolbar,vt=jt===void 0?!1:jt,At=Se.isFocus,Dt=At===void 0?!1:At,Ze=Se.watch,Er=Se.insertTemp,_r=Se.mode,bt=_r===void 0?"markdown":_r,Yt=Se.id,qt=Yt===void 0?"markdown-editor-id":Yt,rr=Se.showResizeBar,Br=rr===void 0?!1:rr,Sr=Se.noStorage,si=Sr===void 0?!1:Sr,Nt=Se.showNullButton,mt=Nt===void 0?!1:Nt,Ur=Se.hidetoolBar,li=Ur===void 0?!1:Ur,Cr=Se.fullScreen,Ot=Cr===void 0?!1:Cr,Fr=Se.onBlur,$r=Se.onCMBeforeChange,ui=Se.onFullScreen,Ve=Se.className,wt=Ve===void 0?"":Ve,di=Se.disablePaste,Li=di===void 0?!1:di,hi=Se.placeholder,ki=hi===void 0?"":hi,z=Se.values,s=z===void 0?"":z,f=Object(v.useState)(null),W=Object(G.a)(f,2),X=W[0],H=W[1],ve=Object(v.useState)(tt),He=Object(G.a)(ve,2),qe=He[0],ft=He[1],Ge=Object(v.useState)(Ze),Ct=Object(G.a)(Ge,2),Mt=Ct[0],Vt=Ct[1],jr=Object(v.useState)(Ot),Wr=Object(G.a)(jr,2),sr=Wr[0],Vr=Wr[1],Hi=Object(v.useState)(""),Tr=Object(G.a)(Hi,2),Hr=Tr[0],Mr=Tr[1],gi=Object(v.useState)(0),Zr=Object(G.a)(gi,2),ci=Zr[0],ri=Zr[1],hn=Object(v.useState)(ht),Gi=Object(G.a)(hn,2),Qr=Gi[0],Gr=Gi[1],Di=Object(v.useState)(!1),Ri=Object(G.a)(Di,2),cn=Ri[0],Qt=Ri[1],Ut=Object(v.useRef)(Object(Ne.a)()),pr=Object(v.useRef)(!1),Bt=Object(v.useRef)(),ir=Object(v.useRef)(),Ht=Object(v.useRef)(),ii=Object(v.useRef)(),er=Object(v.useRef)(),wr=function(){var gt=Object(_.a)(R.a.mark(function Lt(){var xt,_t;return R.a.wrap(function(zt){for(;;)switch(zt.prev=zt.next){case 0:return zt.next=2,Object(Ue.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:Ut.current}});case 2:_t=zt.sent,_t!=null&&(xt=_t.attachments)!==null&&xt!==void 0&&xt.length&&(console.log("cm:",X,ir),_t.attachments.map(function(It){It.content_type.indexOf("image")>-1?X.replaceSelection("![,](/api/attachments/".concat(It.id,"?type=").concat(It.content_type,")")):It.content_type.indexOf("video")>-1?X.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):It.content_type.indexOf("pdf")>-1?X.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(It.id,"?type=").concat(It.content_type,'&disposition=inline" target="_blank">').concat(It.name,"</a>")):X.replaceSelection("[".concat(It.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(It.id,"?type=").concat(It.content_type,")"))}));case 4:case"end":return zt.stop()}},Lt)}));return function(){return gt.apply(this,arguments)}}();Object(v.useEffect)(function(){ft(s),X==null||X.setValue(s)},[s]),Object(v.useEffect)(function(){ui==null||ui(sr)},[sr]),Object(v.useEffect)(function(){if(ir.current){var gt=L.a.fromTextArea(ir.current,{mode:bt,lineNumbers:!vt,lineWrapping:!0,value:tt,autoCloseTags:!0,autoCloseBrackets:!0});Dt&&gt.focus();function Lt(xt,_t){if(Li){_t.preventDefault();return}var Ft=_t.clipboardData;if(Ft){var zt=Ft.types.toString(),It=Ft.items;if(zt==="Files"||Ft.types.indexOf("Files")>-1){if(_t.preventDefault(),bt=="stex")return;try{var nr,Ar=It[1];((nr=It[0])===null||nr===void 0?void 0:nr.kind)==="file"&&(Ar=It[0]);var Pt=Ar.getAsFile(),yi=Pt.name.split(".").pop();ue(Pt,function(Wt){if(Wt.id){var ur,Xr,Yr;(Pt==null||((ur=Pt.type)===null||ur===void 0)?void 0:ur.indexOf("image"))>-1?gt.replaceSelection("![,](/api/attachments/".concat(Wt.id,"?type=").concat(Wt.content_type,")")):(Pt==null||((Xr=Pt.type)===null||Xr===void 0)?void 0:Xr.indexOf("video"))>-1?gt.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Wt.id,'"></video>')):(Pt==null||((Yr=Pt.type)===null||Yr===void 0)?void 0:Yr.indexOf("pdf"))>-1?gt.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Wt.id,"?type=").concat(Pt.type,'&disposition=inline" target="_blank">').concat(Pt.name,"</a>")):ie.includes(yi)?gt.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Wt.id,'?type=office&disposition=inline" target="_blank">').concat(Pt.name,"</a>")):gt.replaceSelection("[".concat(Pt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(Wt.id,"?type=").concat(Wt.content_type,")"))}else(Wt==null?void 0:Wt.status)===401&&(document.location.href="/user/login")})}catch(Wt){B.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return gt.on("paste",Lt),gt.on("dragleave",function(xt,_t){Ht.current.classList.remove("mouse-hover-md")}),gt.on("dragover",function(xt,_t){Ht.current.classList.add("mouse-hover-md")}),gt.on("drop",function(xt,_t){Ht.current.classList.add("mouse-hover-md");var Ft;if(Ft=_t.dataTransfer.files,Ft.length>0){_t.preventDefault(),_t.stopPropagation();for(var zt=function(Ar){var Pt=Ft[Ar],yi=Pt.name.split(".").pop();ue(Pt,function(Wt){if(Wt.id){var ur,Xr,Yr;(Pt==null||((ur=Pt.type)===null||ur===void 0)?void 0:ur.indexOf("image"))>-1?gt.replaceSelection("![,](/api/attachments/".concat(Wt.id,"?type=").concat(Wt.content_type,")")):(Pt==null||((Xr=Pt.type)===null||Xr===void 0)?void 0:Xr.indexOf("video"))>-1?gt.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Wt.id,'"></video>')):(Pt==null||((Yr=Pt.type)===null||Yr===void 0)?void 0:Yr.indexOf("pdf"))>-1?gt.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Wt.id,"?type=").concat(Pt.type,'&disposition=inline" target="_blank">').concat(Pt.name,"</a>")):ie.includes(yi)?gt.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Wt.id,'?type=office&disposition=inline" target="_blank">').concat(Pt.name,"</a>")):gt.replaceSelection("[".concat(Pt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(Wt.id,"?type=").concat(Wt.content_type,")"))}else(Wt==null?void 0:Wt.status)===401&&(document.location.href="/user/login")})},It=0;It<Ft.length;It++)zt(It)}}),H(gt),function(){gt.off("paste",Lt)}}},[]);var zi=Object(v.useCallback)(function(){if(Ht.current)try{}catch(gt){console.log(gt,"---- to set md editor body height")}},[Qr,Ht,sr]);Object(v.useEffect)(function(){function gt(){var xt=new w.default(function(_t){var Ft=Object(D.a)(_t),zt;try{for(Ft.s();!(zt=Ft.n()).done;){var It=zt.value;(It.target.offsetHeight>0||It.target.offsetWidth>0)&&(zi(),X.setSize("100%","100%"),X.refresh())}}catch(nr){Ft.e(nr)}finally{Ft.f()}});return xt.observe(ir.current.parentElement),xt}if(X){var Lt=gt();return function(){Lt.unobserve(ir.current.parentElement)}}},[X,zi]),Object(v.useEffect)(function(){if(X){for(var gt=[],Lt=function(){var It=_t[xt];Ft=Object(G.a)(It,2);var nr=Ft[0],Ar=Ft[1],Pt=Object(j.a)({},nr,function(){Ki(Ar)});gt.push(Pt),X.addKeyMap(Pt)},xt=0,_t=Object.entries(ae);xt<_t.length;xt++){var Ft;Lt()}return Bt.current=setInterval(function(){pr.current&&wr()},4e3),function(){clearInterval(Bt.current);var zt=Object(D.a)(gt),It;try{for(zt.s();!(It=zt.n()).done;){var nr=It.value;X.removeKeyMap(nr)}}catch(Ar){zt.e(Ar)}finally{zt.f()}}}},[X]),Object(v.useEffect)(function(){Ot!==sr&&Vr(Ot)},[Ot]),Object(Ye.a)(function(){if(!si&&ci>0){var gt=new Date().getTime(),Lt=window.sessionStorage.getItem(qt);gt>=ci+Be&&(!Lt||Lt!==qe)&&(window.sessionStorage.setItem(qt,qe),Qt(!0))}},Be),Object(v.useEffect)(function(){Vt(Ze)},[X,Ze]),Object(v.useEffect)(function(){X&&(Dt&&X.focus())},[X,Dt]),Object(v.useEffect)(function(){if(Mt&&X){var gt=X.getScrollerElement();function Lt(xt){var _t=xt.target;if(er.current){var Ft=_t.scrollTop/_t.scrollHeight;er.current.scrollTop=er.current.scrollHeight*Ft}}return gt.addEventListener("scroll",Lt),function(){gt.removeEventListener("scroll",Lt)}}},[X,Mt]),Object(v.useEffect)(function(){if(X&&$r){function gt(Lt,xt){$r(Lt,xt)}return X.on("beforeChange",gt),function(){X.off("beforeChange",gt)}}},[X,$r]),Object(v.useEffect)(function(){if(X&&Fr){function gt(){Fr(X.getValue())}return X.on("blur",gt),function(){X.off("blur",gt)}}},[X,Fr]),Object(v.useEffect)(function(){if(X){function gt(Lt){var xt=Lt.getValue();ft(xt),ri(new Date().getTime()),Lt.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),ct&&ct(xt)}return X.on("change",gt),function(){X.off("change",gt)}}},[X,ct]),Object(v.useEffect)(function(){X&&(tt==null?(X.setValue(""),ft("")):tt!==X.getValue()&&(X.setValue(tt),ft(tt),X.setCursor(X.lineCount(),0)))},[X,tt]);var Ki=Object(v.useCallback)(function(gt){var Lt=X.getCursor(),xt=X.getSelection(),_t=xt.split(`
`);switch(gt){case"bold":return X.replaceSelection("**"+xt+"**"),xt===""&&X.setCursor(Lt.line,Lt.ch+2),X.focus();case"italic":return X.replaceSelection("*"+xt+"*"),xt===""&&X.setCursor(Lt.line,Lt.ch+1),X.focus();case"code":return X.replaceSelection("`"+xt+"`"),xt===""&&X.setCursor(Lt.line,Lt.ch+1),X.focus();case"inline-latex":return X.replaceSelection("`$$"+xt+"$$`"),xt===""&&X.setCursor(Lt.line,Lt.ch+3),X.focus();case"latex":return X.replaceSelection("```latex\n"+xt+"\n```"),X.setCursor(Lt.line+1,xt.length+1),X.focus();case"line-break":return X.replaceSelection(`<br/>
`),X.focus();case"list-ul":return xt===""?X.replaceSelection("- "+xt):X.replaceSelection(_t.map(function(Ft){return Ft===""?"":"- ".concat(Ft)}).join(`
`)),X.focus();case"list-ol":return xt===""?X.replaceSelection("1. "+xt):X.replaceSelection(_t.map(function(Ft,zt){return Ft===""?"":"".concat(zt+1,". ").concat(Ft)}).join(`
`)),X.focus();case"add-null-ch":return xt===""&&X.setCursor(Lt.line,Lt.ch+1),X.replaceSelection(Ke),X.focus();case"inster-template-1":return xt===""&&X.setCursor(Lt.line,Lt.ch),X.replaceSelection(Ee),X.focus();case"eraser":return X.setValue(""),X.focus();case"trigger-watch":return Vt(!Mt),X.focus();case"trigger-full-screen":return Vr(!sr),X.focus();case Ie:Mr(Ie);return;case rt:Mr(rt);return;case Qe:Mr(Qe);return;case et:Mr(et);return;default:throw new Error}},[X,Mt,sr]),vi=Object(v.useCallback)(function(gt){Mr("");switch(Hr){case Ie:var Lt=gt.title,xt=gt.link;return X.replaceSelection("[".concat(Lt,"](").concat(xt,")")),X.focus();case rt:var _t=gt.language,Ft=gt.content;return X.replaceSelection(["```"+_t,Ft,"```"].join(`
`)),X.focus();case Qe:var zt=gt.src,It=gt.alt,nr=gt.name;return zt.indexOf("type=image")>-1?X.replaceSelection("![ ".concat(It||""," ]( ").concat(zt,' "').concat(It||"",'" )')):zt.indexOf("type=application/pdf")>-1?X.replaceSelection('<a href="'.concat(zt,'&disposition=inline" target="_blank">').concat(nr,"</a>")):X.replaceSelection('<a href="'.concat(zt,'" target="_blank">').concat(nr,"</a>")),X.focus();case et:for(var Ar=gt.row,Pt=gt.col,yi=gt.align,Wt=`
`,ur=0;ur<Ar;ur++){for(var Xr=[],Yr=[],Wn=0;Wn<Pt;Wn++)ur===1&&Yr.push(st[yi]),Xr.push(" ");ur===1&&(Wt+="| ".concat(Yr.join(" | "),` |
`)),Wt+="| ".concat(Xr.join(Pt===1?"":" | "),` |
`)}return X.replaceSelection(Wt+`
`),X.focus();default:throw new Error}},[X,Hr]),Fn=Object(v.useMemo)(function(){switch(Hr){case Ie:return A.a.createElement(oe,{callback:vi,onCancel:Pr});case rt:return A.a.createElement(fe.b,{callback:vi,onCancel:Pr});case Qe:return A.a.createElement(se,{callback:vi,onCancel:Pr});case et:return A.a.createElement(je,{callback:vi,onCancel:Pr});default:return null}},[Hr]);function Pr(){Mr("")}Object(v.useEffect)(function(){if(ii.current){var gt=ii.current,Lt=!1,xt=0;function _t(It){Lt=!0,xt=It.pageY}function Ft(){Lt=!1}function zt(It){if(Lt){var nr=It.pageY-xt;nr<0&&(nr=0),nr>300&&(nr=300);var Ar=ht+nr+"px";Gr(Ar)}}return gt.addEventListener("mousedown",_t),document.addEventListener("mousemove",zt),document.addEventListener("mouseup",Ft),function(){gt.removeEventListener("mousedown",_t),document.removeEventListener("mousemove",zt),document.removeEventListener("mouseup",Ft)}}},[X,ii]),Object(v.useEffect)(function(){Gr(ht)},[ht]);var fn=ge(kt),Jr=ge(Qr),Vi={width:fn,height:Jr},jn=Object(v.useMemo)(function(){if(ci){var gt=new Date(ci),Lt=gt.getHours(),xt=gt.getMinutes(),_t=gt.getSeconds();return Lt=Lt<10?"0"+Lt:Lt,xt=xt<10?"0"+xt:xt,_t=_t<10?"0"+_t:_t,"".concat(Lt,":").concat(xt,":").concat(_t)}return 0},[ci]);function Oi(){window.sessionStorage.removeItem(qt),Qt(!1),ri(0)}function $a(){Qt(!1),ri(0),X.setValue(window.sessionStorage.getItem(qt))}function da(gt,Lt){var xt=X.getValue();xt=xt.replace(gt,Lt),ft(xt),X==null||X.setValue(xt)}return A.a.createElement(v.Fragment,null,A.a.createElement("div",{className:"markdown-editor-wrapper",ref:Ht},A.a.createElement("div",{className:"markdown-editor-container ".concat(wt," ").concat(Mt?"on-preview":""," ").concat(vt?"mini":""," ").concat(sr?"full-screen":""),style:Vi},A.a.createElement(S,{insertTemp:Er,watch:Mt,fullScreen:sr,showNullButton:mt,onActionCallback:Ki,hidetoolBar:li,uuid:Ut.current,setOpenPhones:function(){pr.current=!0}}),A.a.createElement("div",{className:"markdown-editor-body"},A.a.createElement("div",{className:"codemirror-container"},A.a.createElement("textarea",{ref:ir,placeholder:ki})),Mt?A.a.createElement("div",{ref:er,className:"preview-container"},bt==="stex"&&A.a.createElement(k,{value:qe}),bt!=="stex"&&A.a.createElement(p.a,{edit:!0,value:qe,replaces:da})):null))),Br?A.a.createElement("a",{ref:ii,className:"editor-resize"}):null,A.a.createElement(N.a,null,de[Hr]?A.a.createElement(J.a,{centered:!0,title:de[Hr],visible:!0,onCancel:Pr,footer:null},Fn):null))}},SJMd:function(Tt,dt){/**
* @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 le,he,J,D=!1,Q,B;window.PR_SHOULD_USE_CONTINUATION=!0;var _,G;(function(){var j=window,I=["break,continue,do,else,for,if,return,while"],R=[I,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,restrict,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],v=[R,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],A=[v,"alignas,alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,noexcept,noreturn,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],M=[v,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],L=[v,"abstract,add,alias,as,ascending,async,await,base,bool,by,byte,checked,decimal,delegate,descending,dynamic,event,finally,fixed,foreach,from,get,global,group,implicit,in,interface,internal,into,is,join,let,lock,null,object,out,override,orderby,params,partial,readonly,ref,remove,sbyte,sealed,select,set,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,value,var,virtual,where,yield"],w="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",y=[v,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],u="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",o=[I,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],l=[I,"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"],d=[I,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],T=[A,L,M,y,u,o,l,d],c=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,p="str",k="kwd",x="com",m="typ",g="lit",h="pun",a="pln",E="tag",b="dec",S="src",N="atn",U="atv",K="nocode",V="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function O(xe){for(var Me=0,Pe=!1,je=!1,Ue=0,Ne=xe.length;Ue<Ne;++Ue){var Ie=xe[Ue];if(Ie.ignoreCase)je=!0;else if(/[a-z]/i.test(Ie.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Pe=!0,je=!1;break}}var Qe={b:8,t:9,n:10,v:11,f:12,r:13};function rt(Xe){var _e=Xe.charCodeAt(0);if(_e!==92)return _e;var ot=Xe.charAt(1);return _e=Qe[ot],_e||("0"<=ot&&ot<="7"?parseInt(Xe.substring(1),8):ot==="u"||ot==="x"?parseInt(Xe.substring(2),16):Xe.charCodeAt(1))}function et(Xe){if(Xe<32)return(Xe<16?"\\x0":"\\x")+Xe.toString(16);var _e=String.fromCharCode(Xe);return _e==="\\"||_e==="-"||_e==="]"||_e==="^"?"\\"+_e:_e}function Je(Xe){var _e=Xe.substring(1,Xe.length-1).match(new RegExp("\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]","g")),ot=[],at=_e[0]==="^",Be=["["];at&&Be.push("^");for(var Ke=at?1:0,Ee=_e.length;Ke<Ee;++Ke){var ge=_e[Ke];if(/\\[bdsw]/i.test(ge))Be.push(ge);else{var ye=rt(ge),re;Ke+2<Ee&&_e[Ke+1]==="-"?(re=rt(_e[Ke+2]),Ke+=2):re=ye,ot.push([ye,re]),re<65||ye>122||(re<65||ye>90||ot.push([Math.max(65,ye)|32,Math.min(re,90)|32]),re<97||ye>122||ot.push([Math.max(97,ye)&~32,Math.min(re,122)&~32]))}}ot.sort(function(ke,Se){return ke[0]-Se[0]||Se[1]-ke[1]});for(var ie=[],ae=[],Ke=0;Ke<ot.length;++Ke){var de=ot[Ke];de[0]<=ae[1]+1?ae[1]=Math.max(ae[1],de[1]):ie.push(ae=de)}for(var Ke=0;Ke<ie.length;++Ke){var de=ie[Ke];Be.push(et(de[0])),de[1]>de[0]&&(de[1]+1>de[0]&&Be.push("-"),Be.push(et(de[1])))}return Be.push("]"),Be.join("")}function st(Xe){for(var _e=Xe.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g")),ot=_e.length,at=[],Be=0,Ke=0;Be<ot;++Be){var Ee=_e[Be];if(Ee==="(")++Ke;else if(Ee.charAt(0)==="\\"){var ge=+Ee.substring(1);ge&&(ge<=Ke?at[ge]=-1:_e[Be]=et(ge))}}for(var Be=1;Be<at.length;++Be)at[Be]===-1&&(at[Be]=++Me);for(var Be=0,Ke=0;Be<ot;++Be){var Ee=_e[Be];if(Ee==="(")++Ke,at[Ke]||(_e[Be]="(?:");else if(Ee.charAt(0)==="\\"){var ge=+Ee.substring(1);ge&&ge<=Ke&&(_e[Be]="\\"+at[ge])}}for(var Be=0;Be<ot;++Be)_e[Be]==="^"&&_e[Be+1]!=="^"&&(_e[Be]="");if(Xe.ignoreCase&&Pe)for(var Be=0;Be<ot;++Be){var Ee=_e[Be],ye=Ee.charAt(0);Ee.length>=2&&ye==="["?_e[Be]=Je(Ee):ye!=="\\"&&(_e[Be]=Ee.replace(/[a-zA-Z]/g,function(ae){var de=ae.charCodeAt(0);return"["+String.fromCharCode(de&~32,de|32)+"]"}))}return _e.join("")}for(var Ye=[],Ue=0,Ne=xe.length;Ue<Ne;++Ue){var Ie=xe[Ue];if(Ie.global||Ie.multiline)throw new Error(""+Ie);Ye.push("(?:"+st(Ie)+")")}return new RegExp(Ye.join("|"),je?"gi":"g")}function P(xe,Me){var Pe=/(?:^|\s)nocode(?:\s|$)/,je=[],Ue=0,Ne=[],Ie=0;function Qe(rt){var et=rt.nodeType;if(et==1){if(Pe.test(rt.className))return;for(var Je=rt.firstChild;Je;Je=Je.nextSibling)Qe(Je);var st=rt.nodeName.toLowerCase();(st==="br"||st==="li")&&(je[Ie]=`
`,Ne[Ie<<1]=Ue++,Ne[Ie++<<1|1]=rt)}else if(et==3||et==4){var Ye=rt.nodeValue;Ye.length&&(Me?Ye=Ye.replace(/\r\n?/g,`
`):Ye=Ye.replace(/[ \t\r\n]+/g," "),je[Ie]=Ye,Ne[Ie<<1]=Ue,Ue+=Ye.length,Ne[Ie++<<1|1]=rt)}}return Qe(xe),{sourceCode:je.join("").replace(/\n$/,""),spans:Ne}}function $(xe,Me,Pe,je,Ue){if(!Pe)return;var Ne={sourceNode:xe,pre:1,langExtension:null,numberLines:null,sourceCode:Pe,spans:null,basePos:Me,decorations:null};je(Ne),Ue.push.apply(Ue,Ne.decorations)}var ee=/\S/;function oe(xe){for(var Me=void 0,Pe=xe.firstChild;Pe;Pe=Pe.nextSibling){var je=Pe.nodeType;Me=je===1?Me?xe:Pe:je===3&&ee.test(Pe.nodeValue)?xe:Me}return Me===xe?void 0:Me}function fe(xe,Me){var Pe={},je;(function(){for(var Ie=xe.concat(Me),Qe=[],rt={},et=0,Je=Ie.length;et<Je;++et){var st=Ie[et],Ye=st[3];if(Ye)for(var Xe=Ye.length;--Xe>=0;)Pe[Ye.charAt(Xe)]=st;var _e=st[1],ot=""+_e;rt.hasOwnProperty(ot)||(Qe.push(_e),rt[ot]=null)}Qe.push(/[\0-\uffff]/),je=O(Qe)})();var Ue=Me.length,Ne=function(Ie){for(var Qe=Ie.sourceCode,rt=Ie.basePos,et=Ie.sourceNode,Je=[rt,a],st=0,Ye=Qe.match(je)||[],Xe={},_e=0,ot=Ye.length;_e<ot;++_e){var at=Ye[_e],Be=Xe[at],Ke=void 0,Ee;if(typeof Be=="string")Ee=!1;else{var ge=Pe[at.charAt(0)];if(ge)Ke=at.match(ge[1]),Be=ge[0];else{for(var ye=0;ye<Ue;++ye)if(ge=Me[ye],Ke=at.match(ge[1]),Ke){Be=ge[0];break}Ke||(Be=a)}Ee=Be.length>=5&&Be.substring(0,5)==="lang-",Ee&&!(Ke&&typeof Ke[1]=="string")&&(Ee=!1,Be=S),Ee||(Xe[at]=Be)}var re=st;if(st+=at.length,!Ee)Je.push(rt+re,Be);else{var ie=Ke[1],ae=at.indexOf(ie),de=ae+ie.length;Ke[2]&&(de=at.length-Ke[2].length,ae=de-ie.length);var ke=Be.substring(5);$(et,rt+re,at.substring(0,ae),Ne,Je),$(et,rt+re+ae,ie,se(ke,ie),Je),$(et,rt+re+de,at.substring(de),Ne,Je)}}Ie.decorations=Je};return Ne}function Oe(xe){var Me=[],Pe=[];xe.tripleQuotedStrings?Me.push([p,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):xe.multiLineStrings?Me.push([p,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):Me.push([p,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),xe.verbatimStrings&&Pe.push([p,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var je=xe.hashComments;je&&(xe.cStyleComments?(je>1?Me.push([x,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):Me.push([x,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Pe.push([p,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):Me.push([x,/^#[^\r\n]*/,null,"#"])),xe.cStyleComments&&(Pe.push([x,/^\/\/[^\r\n]*/,null]),Pe.push([x,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Ue=xe.regexLiterals;if(Ue){var Ne=Ue>1?"":`
\r`,Ie=Ne?".":"[\\S\\s]",Qe="/(?=[^/*"+Ne+"])(?:[^/\\x5B\\x5C"+Ne+"]|\\x5C"+Ie+"|\\x5B(?:[^\\x5C\\x5D"+Ne+"]|\\x5C"+Ie+")*(?:\\x5D|$))+/";Pe.push(["lang-regex",RegExp("^"+V+"("+Qe+")")])}var rt=xe.types;rt&&Pe.push([m,rt]);var et=(""+xe.keywords).replace(/^ | $/g,"");et.length&&Pe.push([k,new RegExp("^(?:"+et.replace(/[\s,]+/g,"|")+")\\b"),null]),Me.push([a,/^\s+/,null,` \r
\xA0`]);var Je="^.[^\\s\\w.$@'\"`/\\\\]*";return xe.regexLiterals&&(Je+="(?!s*/)"),Pe.push([g,/^@[a-z_$][a-z_$@0-9]*/i,null],[m,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[a,/^[a-z_$][a-z_$@0-9]*/i,null],[g,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[a,/^\\[\s\S]?/,null],[h,new RegExp(Je),null]),fe(Me,Pe)}var Ce=Oe({keywords:T,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function Ae(xe,Me,Pe){for(var je=/(?:^|\s)nocode(?:\s|$)/,Ue=/\r\n?|\n/,Ne=xe.ownerDocument,Ie=Ne.createElement("li");xe.firstChild;)Ie.appendChild(xe.firstChild);var Qe=[Ie];function rt(_e){var ot=_e.nodeType;if(ot==1&&!je.test(_e.className))if(_e.nodeName==="br")et(_e),_e.parentNode&&_e.parentNode.removeChild(_e);else for(var at=_e.firstChild;at;at=at.nextSibling)rt(at);else if((ot==3||ot==4)&&Pe){var Be=_e.nodeValue,Ke=Be.match(Ue);if(Ke){var Ee=Be.substring(0,Ke.index);_e.nodeValue=Ee;var ge=Be.substring(Ke.index+Ke[0].length);if(ge){var ye=_e.parentNode;ye.insertBefore(Ne.createTextNode(ge),_e.nextSibling)}et(_e),Ee||_e.parentNode.removeChild(_e)}}}function et(_e){for(;!_e.nextSibling;)if(_e=_e.parentNode,!_e)return;function ot(Ke,Ee){var ge=Ee?Ke.cloneNode(!1):Ke,ye=Ke.parentNode;if(ye){var re=ot(ye,1),ie=Ke.nextSibling;re.appendChild(ge);for(var ae=ie;ae;ae=ie)ie=ae.nextSibling,re.appendChild(ae)}return ge}for(var at=ot(_e.nextSibling,0),Be;(Be=at.parentNode)&&Be.nodeType===1;)at=Be;Qe.push(at)}for(var Je=0;Je<Qe.length;++Je)rt(Qe[Je]);Me===(Me|0)&&Qe[0].setAttribute("value",Me);var st=Ne.createElement("ol");st.className="linenums";for(var Ye=Math.max(0,Me-1|0)||0,Je=0,Xe=Qe.length;Je<Xe;++Je)Ie=Qe[Je],Ie.className="L"+(Je+Ye)%10,Ie.firstChild||Ie.appendChild(Ne.createTextNode("\xA0")),st.appendChild(Ie);xe.appendChild(st)}function Le(xe){var Me=/\bMSIE\s(\d+)/.exec(navigator.userAgent);Me=Me&&+Me[1]<=8;var Pe=/\n/g,je=xe.sourceCode,Ue=je.length,Ne=0,Ie=xe.spans,Qe=Ie.length,rt=0,et=xe.decorations,Je=et.length,st=0;et[Je]=Ue;var Ye,Xe;for(Xe=Ye=0;Xe<Je;)et[Xe]!==et[Xe+2]?(et[Ye++]=et[Xe++],et[Ye++]=et[Xe++]):Xe+=2;for(Je=Ye,Xe=Ye=0;Xe<Je;){for(var _e=et[Xe],ot=et[Xe+1],at=Xe+2;at+2<=Je&&et[at+1]===ot;)at+=2;et[Ye++]=_e,et[Ye++]=ot,Xe=at}Je=et.length=Ye;var Be=xe.sourceNode,Ke="";Be&&(Ke=Be.style.display,Be.style.display="none");try{for(var Ee=null;rt<Qe;){var ge=Ie[rt],ye=Ie[rt+2]||Ue,re=et[st+2]||Ue,at=Math.min(ye,re),ie=Ie[rt+1],ae;if(ie.nodeType!==1&&(ae=je.substring(Ne,at))){Me&&(ae=ae.replace(Pe,"\r")),ie.nodeValue=ae;var de=ie.ownerDocument,ke=de.createElement("span");ke.className=et[st+1];var Se=ie.parentNode;Se.replaceChild(ke,ie),ke.appendChild(ie),Ne<ye&&(Ie[rt+1]=ie=de.createTextNode(je.substring(at,ye)),Se.insertBefore(ie,ke.nextSibling))}Ne=at,Ne>=ye&&(rt+=2),Ne>=re&&(st+=2)}}finally{Be&&(Be.style.display=Ke)}}var be={};function pe(xe,Me){for(var Pe=Me.length;--Pe>=0;){var je=Me[Pe];be.hasOwnProperty(je)?j.console&&console.warn("cannot override language handler %s",je):be[je]=xe}}function se(xe,Me){return xe&&be.hasOwnProperty(xe)||(xe=/^\s*</.test(Me)?"default-markup":"default-code"),be[xe]}pe(Ce,["default-code"]),pe(fe([],[[a,/^[^<?]+/],[b,/^<!\w[^>]*(?:>|$)/],[x,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[h,/^(?:<[%?]|[%?]>)/],["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"]),pe(fe([[a,/^[\s]+/,null,` \r
`],[U,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[E,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[N,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[h,/^[=<>\/]+/],["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"]),pe(fe([],[[U,/^[\s\S]+/]]),["uq.val"]),pe(Oe({keywords:A,hashComments:!0,cStyleComments:!0,types:c}),["c","cc","cpp","cxx","cyc","m"]),pe(Oe({keywords:"null,true,false"}),["json"]),pe(Oe({keywords:L,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:c}),["cs"]),pe(Oe({keywords:M,cStyleComments:!0}),["java"]),pe(Oe({keywords:d,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),pe(Oe({keywords:o,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),pe(Oe({keywords:u,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),pe(Oe({keywords:l,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),pe(Oe({keywords:y,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),pe(Oe({keywords:w,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),pe(fe([],[[p,/^[\s\S]+/]]),["regex"]);function te(xe){var Me=xe.langExtension;try{var Pe=P(xe.sourceNode,xe.pre),je=Pe.sourceCode;xe.sourceCode=je,xe.spans=Pe.spans,xe.basePos=0,se(Me,je)(xe),Le(xe)}catch(Ue){j.console&&console.log(Ue&&Ue.stack||Ue)}}function ue(xe,Me,Pe){var je=Pe||!1,Ue=Me||null,Ne=document.createElement("div");Ne.innerHTML="<pre>"+xe+"</pre>",Ne=Ne.firstChild,je&&Ae(Ne,je,!0);var Ie={langExtension:Ue,numberLines:je,sourceNode:Ne,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return te(Ie),Ne.innerHTML}function ne(xe,Me){var Pe=Me||document.body,je=Pe.ownerDocument||document;function Ue(ge){return Pe.getElementsByTagName(ge)}for(var Ne=[Ue("pre"),Ue("code"),Ue("xmp")],Ie=[],Qe=0;Qe<Ne.length;++Qe)for(var rt=0,et=Ne[Qe].length;rt<et;++rt)Ie.push(Ne[Qe][rt]);Ne=null;var Je=Date;Je.now||(Je={now:function(){return+new Date}});var st=0,Ye=/\blang(?:uage)?-([\w.]+)(?!\S)/,Xe=/\bprettyprint\b/,_e=/\bprettyprinted\b/,ot=/pre|xmp/i,at=/^code$/i,Be=/^(?:pre|code|xmp)$/i,Ke={};function Ee(){for(var ge=j.PR_SHOULD_USE_CONTINUATION?Je.now()+250:Infinity;st<Ie.length&&Je.now()<ge;st++){for(var ye=Ie[st],re=Ke,ie=ye;ie=ie.previousSibling;){var ae=ie.nodeType,de=(ae===7||ae===8)&&ie.nodeValue;if(de?!/^\??prettify\b/.test(de):ae!==3||/\S/.test(ie.nodeValue))break;if(de){re={},de.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Dt,Ze,Er){re[Ze]=Er});break}}var ke=ye.className;if((re!==Ke||Xe.test(ke))&&!_e.test(ke)){for(var Se=!1,We=ye.parentNode;We;We=We.parentNode){var tt=We.tagName;if(Be.test(tt)&&We.className&&Xe.test(We.className)){Se=!0;break}}if(!Se){ye.className+=" prettyprinted";var ct=re.lang;if(!ct){ct=ke.match(Ye);var lt;!ct&&(lt=oe(ye))&&at.test(lt.tagName)&&(ct=lt.className.match(Ye)),ct&&(ct=ct[1])}var kt;if(ot.test(ye.tagName))kt=1;else{var Et=ye.currentStyle,ht=je.defaultView,jt=Et?Et.whiteSpace:ht&&ht.getComputedStyle?ht.getComputedStyle(ye,null).getPropertyValue("white-space"):0;kt=jt&&jt.substring(0,3)==="pre"}var vt=re.linenums;(vt=vt==="true"||+vt)||(vt=ke.match(/\blinenums\b(?::(\d+))?/),vt=vt?vt[1]&&vt[1].length?+vt[1]:!0:!1),vt&&Ae(ye,vt,kt);var At={langExtension:ct,sourceNode:ye,numberLines:vt,pre:kt,sourceCode:null,basePos:null,spans:null,decorations:null};te(At)}}}st<Ie.length?j.setTimeout(Ee,250):typeof xe=="function"&&xe()}Ee()}var Te=j.PR={createSimpleLexer:fe,registerLangHandler:pe,sourceDecorator:Oe,PR_ATTRIB_NAME:N,PR_ATTRIB_VALUE:U,PR_COMMENT:x,PR_DECLARATION:b,PR_KEYWORD:k,PR_LITERAL:g,PR_NOCODE:K,PR_PLAIN:a,PR_PUNCTUATION:h,PR_SOURCE:S,PR_STRING:p,PR_TAG:E,PR_TYPE:m,prettyPrintOne:D?j.prettyPrintOne=ue:_=ue,prettyPrint:G=D?j.prettyPrint=ne:G=ne},Re=j.define;typeof Re=="function"&&Re.amd&&Re("google-code-prettify",[],function(){return Te})})()},"T+//":function(Tt,dt,le){"use strict";le.r(dt);var he=le("Q9mQ"),J=le("diRs"),D=le("2qtc"),Q=le("kLXV"),B=le("miYZ"),_=le("tsqr"),G=le("9og8"),j=le("tJVT"),I=le("B9cy"),R=le("Ol7k"),v=le("lUTK"),A=le("BvKs"),M=le("WmNS"),L=le.n(M),w=le("q1tI"),y=le.n(w),u=le("m3rI"),o=le("p0QG"),l=le.n(o),d=le("ErOA"),T=le("9kvl"),c=le("RCxd"),p=le("xGfz"),k=le("xKgJ"),x=le("5NDa"),m=le("5rEg");function g(be){var pe=be.user,se=be.CategoryId,te=be.IsShow,ue=be.setIsShow,ne=be.dispatch,Te=be.init,Re=Object(w.useState)(),xe=Object(j.a)(Re,2),Me=xe[0],Pe=xe[1];return y.a.createElement(Q.a,{title:se?"\u65B0\u5EFA\u4E09\u7EA7\u7C7B\u76EE":"\u65B0\u5EFA\u4E8C\u7EA7\u7C7B\u76EE",width:424,onCancel:function(){ue(!1)},onOk:Object(G.a)(L.a.mark(function je(){var Ue;return L.a.wrap(function(Ie){for(;;)switch(Ie.prev=Ie.next){case 0:if(Me){Ie.next=3;break}return _.b.error("\u680F\u76EE\u540D\u4E0D\u80FD\u4E3A\u7A7A"),Ie.abrupt("return");case 3:return Ie.next=5,Object(d.a)("/api/programas.json",{method:"post",body:{name:Me,parent_id:se}});case 5:Ue=Ie.sent,Ue.status===0&&(_.b.info("\u521B\u5EFA\u6210\u529F"),ue(!1),Pe(""),Te());case 7:case"end":return Ie.stop()}},je)})),visible:te},y.a.createElement(m.a,{value:Me,onChange:function(Ue){return Pe(Ue.target.value)},placeholder:"\u8BF7\u8F93\u5165\u4E0D\u8D85\u8FC710\u4E2A\u6C49\u5B57\u7684\u540D\u79F0",maxLength:10}))}var h=Object(T.a)(function(be){var pe=be.user;return{user:pe}})(g);function a(be){var pe=be.user,se=be.CategoryId,te=be.name,ue=be.IsShow,ne=be.setIsShow,Te=be.dispatch,Re=be.init,xe=Object(w.useState)(),Me=Object(j.a)(xe,2),Pe=Me[0],je=Me[1];return Object(w.useEffect)(function(){je(te)},[te]),y.a.createElement(Q.a,{title:"\u76EE\u5F55\u91CD\u547D\u540D",width:424,onCancel:function(){ne(!1)},onOk:Object(G.a)(L.a.mark(function Ue(){var Ne;return L.a.wrap(function(Qe){for(;;)switch(Qe.prev=Qe.next){case 0:if(Pe){Qe.next=3;break}return _.b.error("\u680F\u76EE\u540D\u4E0D\u80FD\u4E3A\u7A7A"),Qe.abrupt("return");case 3:return Qe.next=5,Object(d.a)("/api/programas/".concat(se,"/rename.json"),{method:"put",body:{name:Pe,id:se}});case 5:Ne=Qe.sent,Ne.status===0&&(_.b.info("\u4FEE\u6539\u6210\u529F"),ne(!1),je(""),Re());case 7:case"end":return Qe.stop()}},Ue)})),visible:ue},y.a.createElement(m.a,{value:Pe,onChange:function(Ne){return je(Ne.target.value)},placeholder:"\u8BF7\u8F93\u5165\u4E0D\u8D85\u8FC710\u4E2A\u6C49\u5B57\u7684\u540D\u79F0",maxLength:10}))}var E=Object(T.a)(function(be){var pe=be.user;return{user:pe}})(a),b=le("+L6B"),S=le("2/Rp"),N=le("9Bee");function U(be){var pe,se,te,ue,ne=be.user,Te=be.ItemData,Re=be.setIssee,xe=be.dispatch,Me=be.init;return y.a.createElement("div",null,y.a.createElement("div",{style:{textAlign:"right"}},Object(k.v)()&&y.a.createElement(S.a,{onClick:function(){return Re(!1)}},"\u7F16\u8F91")),y.a.createElement(N.a,{value:Te.content}),(Te==null||((pe=Te.attachment)===null||pe===void 0)?void 0:pe.id)&&y.a.createElement("div",null,y.a.createElement("a",{href:Te==null||((se=Te.attachment)===null||se===void 0)?void 0:se.url,target:"_self",download:Te==null||((te=Te.attachment)===null||te===void 0)?void 0:te.title},y.a.createElement("i",{style:{color:"#29BD8B"},className:"font-14 color-green iconfont icon-fujian mr8"}),y.a.createElement("span",{style:{color:"#000000"}},Te==null||((ue=Te.attachment)===null||ue===void 0)?void 0:ue.title))))}var K=Object(T.a)(function(be){var pe=be.user;return{user:pe}})(U),V=le("DZo9"),O=le("8z0m"),P=le("Ot1p"),$=le("hJwl");function ee(be){var pe=be.user,se=be.ItemData,te=be.setIssee,ue=be.CategoryId,ne=be.dispatch,Te=be.init,Re=Object(w.useState)([]),xe=Object(j.a)(Re,2),Me=xe[0],Pe=xe[1],je=Object(w.useState)(se.content),Ue=Object(j.a)(je,2),Ne=Ue[0],Ie=Ue[1];function Qe(){var Ye,Xe=[];return se==null||((Ye=se.attachments)===null||Ye===void 0)||Ye.map(function(_e){var ot={uid:_e==null?void 0:_e.id,name:_e.title,response:{id:_e.id}};Xe.push(ot)}),Xe}var rt={name:"file",multiple:!0,action:u.a.API_SERVER+"/api/attachments.json",defaultFileList:Qe(),onRemove:function(Xe){Object($.t)({id:Xe.uid})},onChange:function(Xe){console.log("info",Xe);var _e=Xe.file.status;_e!=="uploading",_e==="removed"&&Pe(Xe.fileList),_e==="done"?(Pe(Xe.fileList),_.b.success("".concat(Xe.file.name," \u6587\u4EF6\u4E0A\u4F20\u6210\u529F"))):_e==="error"&&_.b.error("".concat(Xe.file.name," \u6587\u4EF6\u4E0A\u4F20\u5931\u8D25"))},beforeUpload:function(Xe){var _e=Xe.size/1024/1024<150;return _e||_.b.info("\u6587\u4EF6\u5927\u5C0F\u5FC5\u987B\u5C0F\u4E8E150MB"),_e}};function et(){return Je.apply(this,arguments)}function Je(){return Je=Object(G.a)(L.a.mark(function Ye(){var Xe;return L.a.wrap(function(ot){for(;;)switch(ot.prev=ot.next){case 0:return ot.next=2,Object(d.a)("/api/programas/".concat(ue,"/update_content.json"),{method:"put",body:{id:ue,content:Ne,attachment_id:st(Me)}});case 2:Xe=ot.sent,Xe&&(_.b.info("\u63D0\u4EA4\u6210\u529F"),te(!0));case 4:case"end":return ot.stop()}},Ye)})),Je.apply(this,arguments)}function st(Ye){var Xe;return Ye&&Ye.map(function(_e){Xe=_e.response.id}),Xe}return y.a.createElement("div",null,y.a.createElement(P.a,{defaultValue:Ne,onChange:function(Xe){return Ie(Xe)}}),y.a.createElement(O.a,rt,y.a.createElement(S.a,{className:"uploadBtn"},"\u4E0A\u4F20\u9644\u4EF6"),"(\u5355\u4E2A\u6587\u4EF6150M\u4EE5\u5185)"),y.a.createElement("p",{style:{marginTop:"10px"}},y.a.createElement(S.a,{style:{width:"90px"},onClick:function(){return et()}},"\u63D0\u4EA4"),y.a.createElement(S.a,{style:{marginLeft:"30px",width:"90px"},type:"primary",onClick:function(){return te(!0)}},"\u53D6\u6D88")))}var oe=Object(T.a)(function(be){var pe=be.user;return{user:pe}})(ee),fe=A.a.SubMenu,Oe=R.a.Content,Ce=R.a.Sider;function Ae(be){var pe,se=be.user,te=be.dispatch,ue=be.globalSetting,ne=Object(w.useState)(),Te=Object(j.a)(ne,2),Re=Te[0],xe=Te[1],Me=Object(w.useState)(!1),Pe=Object(j.a)(Me,2),je=Pe[0],Ue=Pe[1],Ne=Object(w.useState)(),Ie=Object(j.a)(Ne,2),Qe=Ie[0],rt=Ie[1],et=Object(w.useState)(),Je=Object(j.a)(et,2),st=Je[0],Ye=Je[1],Xe=Object(w.useState)(!1),_e=Object(j.a)(Xe,2),ot=_e[0],at=_e[1],Be=Object(w.useState)(""),Ke=Object(j.a)(Be,2),Ee=Ke[0],ge=Ke[1],ye=Object(w.useState)(""),re=Object(j.a)(ye,2),ie=re[0],ae=re[1],de=Object(w.useState)(!0),ke=Object(j.a)(de,2),Se=ke[0],We=ke[1];Object(w.useEffect)(function(){tt()},[]),console.log("globalSetting",ue);function tt(){return ct.apply(this,arguments)}function ct(){return ct=Object(G.a)(L.a.mark(function vt(){var At;return L.a.wrap(function(Ze){for(;;)switch(Ze.prev=Ze.next){case 0:return Ze.next=2,Object(d.a)("/api/programas.json",{method:"get"});case 2:At=Ze.sent,At&&rt(At==null?void 0:At.programas);case 4:case"end":return Ze.stop()}},vt)})),ct.apply(this,arguments)}var lt=function(){var vt=Object(G.a)(L.a.mark(function At(Dt,Ze,Er){var _r;return L.a.wrap(function(Yt){for(;;)switch(Yt.prev=Yt.next){case 0:Yt.t0=Dt,Yt.next=Yt.t0===1?3:Yt.t0===2?6:Yt.t0===3?10:Yt.t0===4?15:17;break;case 3:return Ye(Ze==null?void 0:Ze.id),Ue(!0),Yt.abrupt("break",17);case 6:return Ye(Ze==null?void 0:Ze.id),at(!0),ge(Ze==null?void 0:Ze.name),Yt.abrupt("break",17);case 10:return Yt.next=12,Object(d.a)("/api/programas/".concat(Ze==null?void 0:Ze.id,"/top.json"),{method:"post",body:{id:Ze==null?void 0:Ze.id}});case 12:return _r=Yt.sent,_r.status===0&&tt(),Yt.abrupt("break",17);case 15:return kt(y.a.createElement("p",null,"\u5220\u9664\u4E4B\u540E\u4E0D\u80FD\u6062\u590D,",y.a.createElement("br",null),"\u662F\u5426\u786E\u8BA4\u5220\u9664?"),Object(G.a)(L.a.mark(function qt(){var rr;return L.a.wrap(function(Sr){for(;;)switch(Sr.prev=Sr.next){case 0:return Sr.next=2,Object(d.a)("/api/programas/".concat(Ze==null?void 0:Ze.id,".json"),{method:"delete",body:{id:Ze==null?void 0:Ze.id}});case 2:rr=Sr.sent,rr.status===0&&(_.b.info("\u5220\u9664\u6210\u529F"),tt());case 4:case"end":return Sr.stop()}},qt)}))),Yt.abrupt("break",17);case 17:case"end":return Yt.stop()}},At)}));return function(Dt,Ze,Er){return vt.apply(this,arguments)}}(),kt=function(At,Dt){Q.a.confirm({centered:!0,title:"\u63D0\u793A",icon:y.a.createElement(c.a,null),content:At,okText:"\u786E\u8BA4",onOk:function(){return Dt()},cancelText:"\u53D6\u6D88"})},Et=function(At,Dt){return y.a.createElement("div",{className:l.a.leftMenuActions},Dt===1&&y.a.createElement("p",{className:"current",onClick:function(){return lt(1,At,Dt)}},"\u65B0\u5EFA"),y.a.createElement("p",{className:"current",onClick:function(){return lt(2,At,Dt)}},"\u91CD\u547D\u540D"),y.a.createElement("p",{className:"current",onClick:function(){return lt(3,At,Dt)}},"\u7F6E\u9876"),y.a.createElement("p",{className:"current",onClick:function(){return lt(4,At,Dt)}},"\u5220\u9664"))};function ht(){return jt.apply(this,arguments)}function jt(){return jt=Object(G.a)(L.a.mark(function vt(){var At;return L.a.wrap(function(Ze){for(;;)switch(Ze.prev=Ze.next){case 0:return Ze.next=2,Object(d.a)("/api/programas/".concat(st,"/content.json"),{method:"get",params:{id:st}});case 2:At=Ze.sent,At&&ae(At);case 4:case"end":return Ze.stop()}},vt)})),jt.apply(this,arguments)}return y.a.createElement("div",{style:{marginBottom:"40px"}},y.a.createElement("img",{style:{width:"100%"},src:u.a.IMG_SERVER+"/".concat(ue==null||((pe=ue.setting)===null||pe===void 0)?void 0:pe.shixun_banner_url)}),y.a.createElement("div",{className:"edu-container minH500",style:{display:"flex",width:"1200px"}},y.a.createElement(Ce,{width:244,className:l.a.leftMenus,style:{background:"none",marginTop:"20px",height:"auto"}},y.a.createElement(A.a,{mode:"inline"},Qe==null?void 0:Qe.map(function(vt,At){if((vt==null?void 0:vt.children.length)>0){var Dt;return y.a.createElement(fe,{title:y.a.createElement("span",{className:"font16"},y.a.createElement("span",null,vt.name),!Object(k.v)()&&y.a.createElement("span",null),Object(k.v)()&&y.a.createElement(J.a,{placement:"right",content:function(){return Et(vt,1)},trigger:"hover"},y.a.createElement("span",{className:["iconfont icon-sandian",l.a.actions].join(" ")})))},vt==null||((Dt=vt.children)===null||Dt===void 0)?void 0:Dt.map(function(Ze,Er){return y.a.createElement(A.a.Item,{className:l.a===null||l.a===void 0?void 0:l.a.SubMentItem,onClick:function(){Ye(Ze==null?void 0:Ze.id),st=Ze==null?void 0:Ze.id,ht()}},y.a.createElement("span",{style:{flex:"1"}},Ze==null?void 0:Ze.name),Object(k.v)()&&y.a.createElement(J.a,{placement:"right",content:function(){return Et(Ze,2)},trigger:"hover"},y.a.createElement("span",{className:["iconfont icon-sandian",l.a.actions].join(" ")})))}))}else return y.a.createElement(A.a.Item,{className:l.a===null||l.a===void 0?void 0:l.a.SubMentItem,onClick:function(){Ye(vt==null?void 0:vt.id),st=vt==null?void 0:vt.id,ht()}},y.a.createElement("span",{style:{flex:"1"}},vt==null?void 0:vt.name),Object(k.v)()&&y.a.createElement(J.a,{placement:"right",content:function(){return Et(vt,1)},trigger:"hover"},y.a.createElement("span",{className:["iconfont icon-sandian",l.a.actions].join(" ")})))}),y.a.createElement(A.a.Item,{onClick:function(){Ye(""),st="",Ue(!0)},style:{color:"#0152d9",fontSize:"16px",height:"40px",display:"flex",alignItems:"center"},icon:y.a.createElement(p.a,{style:{color:"#0152d9",fontSize:"16px"}})},"\u65B0\u589E\u4E8C\u7EA7\u7C7B\u76EE"))),y.a.createElement("div",{style:{width:"937px",marginLeft:"17px",background:"#fff",padding:"20px"}},Se&&y.a.createElement(K,{ItemData:ie,setIssee:We}),Se===!1&&y.a.createElement(oe,{ItemData:ie,setIssee:We,CategoryId:st}))),y.a.createElement(h,{CategoryId:st,IsShow:je,setIsShow:Ue,init:tt}),y.a.createElement(E,{CategoryId:st,name:Ee,IsShow:ot,setIsShow:at,init:tt}))}var Le=dt.default=Object(T.a)(function(be){var pe=be.user,se=be.globalSetting;return{user:pe,globalSetting:se}})(Ae)},"VrN/":function(Tt,dt,le){(function(he,J){Tt.exports=J()})(this,function(){"use strict";var he=navigator.userAgent,J=navigator.platform,D=/gecko\/\d/i.test(he),Q=/MSIE \d/.test(he),B=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(he),_=/Edge\/(\d+)/.exec(he),G=Q||B||_,j=G&&(Q?document.documentMode||6:+(_||B)[1]),I=!_&&/WebKit\//.test(he),R=I&&/Qt\/\d+\.\d+/.test(he),v=!_&&/Chrome\//.test(he),A=/Opera\//.test(he),M=/Apple Computer/.test(navigator.vendor),L=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(he),w=/PhantomJS/.test(he),y=!_&&/AppleWebKit/.test(he)&&/Mobile\/\w+/.test(he),u=/Android/.test(he),o=y||u||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(he),l=y||/Mac/.test(J),d=/\bCrOS\b/.test(he),T=/win/i.test(J),c=A&&he.match(/Version\/(\d*\.\d*)/);c&&(c=Number(c[1])),c&&c>=15&&(A=!1,I=!0);var p=l&&(R||A&&(c==null||c<12.11)),k=D||G&&j>=9;function x(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var m=function(e,t){var i=e.className,r=x(t).exec(i);if(r){var n=i.slice(r.index+r[0].length);e.className=i.slice(0,r.index)+(n?r[1]+n:"")}};function g(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function h(e,t){return g(e).appendChild(t)}function a(e,t,i,r){var n=document.createElement(e);if(i&&(n.className=i),r&&(n.style.cssText=r),typeof t=="string")n.appendChild(document.createTextNode(t));else if(t)for(var C=0;C<t.length;++C)n.appendChild(t[C]);return n}function E(e,t,i,r){var n=a(e,t,i,r);return n.setAttribute("role","presentation"),n}var b;document.createRange?b=function(e,t,i,r){var n=document.createRange();return n.setEnd(r||e,i),n.setStart(e,t),n}:b=function(e,t,i){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch(n){return r}return r.collapse(!0),r.moveEnd("character",i),r.moveStart("character",t),r};function S(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 N(){var e;try{e=document.activeElement}catch(t){e=document.body||null}for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e}function U(e,t){var i=e.className;x(t).test(i)||(e.className+=(i?" ":"")+t)}function K(e,t){for(var i=e.split(" "),r=0;r<i.length;r++)i[r]&&!x(i[r]).test(t)&&(t+=" "+i[r]);return t}var V=function(e){e.select()};y?V=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:G&&(V=function(e){try{e.select()}catch(t){}});function O(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function P(e,t,i){t||(t={});for(var r in e)e.hasOwnProperty(r)&&(i!==!1||!t.hasOwnProperty(r))&&(t[r]=e[r]);return t}function $(e,t,i,r,n){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var C=r||0,F=n||0;;){var Y=e.indexOf(" ",C);if(Y<0||Y>=t)return F+(t-C);F+=Y-C,F+=i-F%i,C=Y+1}}var ee=function(){this.id=null,this.f=null,this.time=0,this.handler=O(this.onTimeout,this)};ee.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},ee.prototype.set=function(e,t){this.f=t;var i=+new Date+e;(!this.id||i<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=i)};function oe(e,t){for(var i=0;i<e.length;++i)if(e[i]==t)return i;return-1}var fe=50,Oe={toString:function(){return"CodeMirror.Pass"}},Ce={scroll:!1},Ae={origin:"*mouse"},Le={origin:"+move"};function be(e,t,i){for(var r=0,n=0;;){var C=e.indexOf(" ",r);C==-1&&(C=e.length);var F=C-r;if(C==e.length||n+F>=t)return r+Math.min(F,t-n);if(n+=C-r,n+=i-n%i,r=C+1,n>=t)return r}}var pe=[""];function se(e){for(;pe.length<=e;)pe.push(te(pe)+" ");return pe[e]}function te(e){return e[e.length-1]}function ue(e,t){for(var i=[],r=0;r<e.length;r++)i[r]=t(e[r],r);return i}function ne(e,t,i){for(var r=0,n=i(t);r<e.length&&i(e[r])<=n;)r++;e.splice(r,0,t)}function Te(){}function Re(e,t){var i;return Object.create?i=Object.create(e):(Te.prototype=e,i=new Te),t&&P(t,i),i}var xe=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function Me(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||xe.test(e))}function Pe(e,t){return t?t.source.indexOf("\\w")>-1&&Me(e)?!0:t.test(e):Me(e)}function je(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var Ue=/[\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 Ne(e){return e.charCodeAt(0)>=768&&Ue.test(e)}function Ie(e,t,i){for(;(i<0?t>0:t<e.length)&&Ne(e.charAt(t));)t+=i;return t}function Qe(e,t,i){for(var r=t>i?-1:1;;){if(t==i)return t;var n=(t+i)/2,C=r<0?Math.ceil(n):Math.floor(n);if(C==t)return e(C)?t:i;e(C)?i=C:t=C+r}}function rt(e,t,i,r){if(!e)return r(t,i,"ltr",0);for(var n=!1,C=0;C<e.length;++C){var F=e[C];(F.from<i&&F.to>t||t==i&&F.to==t)&&(r(Math.max(F.from,t),Math.min(F.to,i),F.level==1?"rtl":"ltr",C),n=!0)}n||r(t,i,"ltr")}var et=null;function Je(e,t,i){var r;et=null;for(var n=0;n<e.length;++n){var C=e[n];if(C.from<t&&C.to>t)return n;C.to==t&&(C.from!=C.to&&i=="before"?r=n:et=n),C.from==t&&(C.from!=C.to&&i!="before"?r=n:et=n)}return r!=null?r:et}var st=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function i(q){return q<=247?e.charAt(q):1424<=q&&q<=1524?"R":1536<=q&&q<=1785?t.charAt(q-1536):1774<=q&&q<=2220?"r":8192<=q&&q<=8203?"w":q==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,n=/[stwN]/,C=/[LRr]/,F=/[Lb1n]/,Y=/[1n]/;function Z(q,ce,me){this.level=q,this.from=ce,this.to=me}return function(q,ce){var me=ce=="ltr"?"L":"R";if(q.length==0||ce=="ltr"&&!r.test(q))return!1;for(var De=q.length,we=[],Fe=0;Fe<De;++Fe)we.push(i(q.charCodeAt(Fe)));for(var ze=0,$e=me;ze<De;++ze){var it=we[ze];it=="m"?we[ze]=$e:$e=it}for(var ut=0,nt=me;ut<De;++ut){var pt=we[ut];pt=="1"&&nt=="r"?we[ut]="n":C.test(pt)&&(nt=pt,pt=="r"&&(we[ut]="R"))}for(var St=1,yt=we[0];St<De-1;++St){var Rt=we[St];Rt=="+"&&yt=="1"&&we[St+1]=="1"?we[St]="1":Rt==","&&yt==we[St+1]&&(yt=="1"||yt=="n")&&(we[St]=yt),yt=Rt}for(var Xt=0;Xt<De;++Xt){var cr=we[Xt];if(cr==",")we[Xt]="N";else if(cr=="%"){var Zt=void 0;for(Zt=Xt+1;Zt<De&&we[Zt]=="%";++Zt);for(var Nr=Xt&&we[Xt-1]=="!"||Zt<De&&we[Zt]=="1"?"1":"N",Dr=Xt;Dr<Zt;++Dr)we[Dr]=Nr;Xt=Zt-1}}for(var ar=0,Rr=me;ar<De;++ar){var gr=we[ar];Rr=="L"&&gr=="1"?we[ar]="L":C.test(gr)&&(Rr=gr)}for(var lr=0;lr<De;++lr)if(n.test(we[lr])){var or=void 0;for(or=lr+1;or<De&&n.test(we[or]);++or);for(var Jt=(lr?we[lr-1]:me)=="L",Or=(or<De?we[or]:me)=="L",un=Jt==Or?Jt?"L":"R":me,Ai=lr;Ai<or;++Ai)we[Ai]=un;lr=or-1}for(var yr=[],oi,fr=0;fr<De;)if(F.test(we[fr])){var Xa=fr;for(++fr;fr<De&&F.test(we[fr]);++fr);yr.push(new Z(0,Xa,fr))}else{var mi=fr,ji=yr.length,Wi=ce=="rtl"?1:0;for(++fr;fr<De&&we[fr]!="L";++fr);for(var xr=mi;xr<fr;)if(Y.test(we[xr])){mi<xr&&(yr.splice(ji,0,new Z(1,mi,xr)),ji+=Wi);var dn=xr;for(++xr;xr<fr&&Y.test(we[xr]);++xr);yr.splice(ji,0,new Z(2,dn,xr)),ji+=Wi,mi=xr}else++xr;mi<fr&&yr.splice(ji,0,new Z(1,mi,fr))}return ce=="ltr"&&(yr[0].level==1&&(oi=q.match(/^\s+/))&&(yr[0].from=oi[0].length,yr.unshift(new Z(0,0,oi[0].length))),te(yr).level==1&&(oi=q.match(/\s+$/))&&(te(yr).to-=oi[0].length,yr.push(new Z(0,De-oi[0].length,De)))),ce=="rtl"?yr.reverse():yr}}();function Ye(e,t){var i=e.order;return i==null&&(i=e.order=st(e.text,t)),i}var Xe=[],_e=function(e,t,i){if(e.addEventListener)e.addEventListener(t,i,!1);else if(e.attachEvent)e.attachEvent("on"+t,i);else{var r=e._handlers||(e._handlers={});r[t]=(r[t]||Xe).concat(i)}};function ot(e,t){return e._handlers&&e._handlers[t]||Xe}function at(e,t,i){if(e.removeEventListener)e.removeEventListener(t,i,!1);else if(e.detachEvent)e.detachEvent("on"+t,i);else{var r=e._handlers,n=r&&r[t];if(n){var C=oe(n,i);C>-1&&(r[t]=n.slice(0,C).concat(n.slice(C+1)))}}}function Be(e,t){var i=ot(e,t);if(!i.length)return;for(var r=Array.prototype.slice.call(arguments,2),n=0;n<i.length;++n)i[n].apply(null,r)}function Ke(e,t,i){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Be(e,i||t.type,e,t),ae(t)||t.codemirrorIgnore}function Ee(e){var t=e._handlers&&e._handlers.cursorActivity;if(!t)return;for(var i=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),r=0;r<t.length;++r)oe(i,t[r])==-1&&i.push(t[r])}function ge(e,t){return ot(e,t).length>0}function ye(e){e.prototype.on=function(t,i){_e(this,t,i)},e.prototype.off=function(t,i){at(this,t,i)}}function re(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function ie(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function ae(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function de(e){re(e),ie(e)}function ke(e){return e.target||e.srcElement}function Se(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),l&&e.ctrlKey&&t==1&&(t=3),t}var We=function(){if(G&&j<9)return!1;var e=a("div");return"draggable"in e||"dragDrop"in e}(),tt;function ct(e){if(tt==null){var t=a("span","\u200B");h(e,a("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(tt=t.offsetWidth<=1&&t.offsetHeight>2&&!(G&&j<8))}var i=tt?a("span","\u200B"):a("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return i.setAttribute("cm-text",""),i}var lt;function kt(e){if(lt!=null)return lt;var t=h(e,document.createTextNode("A\u062EA")),i=b(t,0,1).getBoundingClientRect(),r=b(t,1,2).getBoundingClientRect();return g(e),!i||i.left==i.right?!1:lt=r.right-i.right<3}var Et=`
b`.split(/\n/).length!=3?function(e){for(var t=0,i=[],r=e.length;t<=r;){var n=e.indexOf(`
`,t);n==-1&&(n=e.length);var C=e.slice(t,e.charAt(n-1)=="\r"?n-1:n),F=C.indexOf("\r");F!=-1?(i.push(C.slice(0,F)),t+=F+1):(i.push(C),t=n+1)}return i}:function(e){return e.split(/\r\n?|\n/)},ht=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(i){}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},jt=function(){var e=a("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),vt=null;function At(e){if(vt!=null)return vt;var t=h(e,a("span","x")),i=t.getBoundingClientRect(),r=b(t,0,1).getBoundingClientRect();return vt=Math.abs(i.left-r.left)>1}var Dt={},Ze={};function Er(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Dt[e]=t}function _r(e,t){Ze[e]=t}function bt(e){if(typeof e=="string"&&Ze.hasOwnProperty(e))e=Ze[e];else if(e&&typeof e.name=="string"&&Ze.hasOwnProperty(e.name)){var t=Ze[e.name];typeof t=="string"&&(t={name:t}),e=Re(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 Yt(e,t){t=bt(t);var i=Dt[t.name];if(!i)return Yt(e,"text/plain");var r=i(e,t);if(qt.hasOwnProperty(t.name)){var n=qt[t.name];for(var C in n){if(!n.hasOwnProperty(C))continue;r.hasOwnProperty(C)&&(r["_"+C]=r[C]),r[C]=n[C]}}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var F in t.modeProps)r[F]=t.modeProps[F];return r}var qt={};function rr(e,t){var i=qt.hasOwnProperty(e)?qt[e]:qt[e]={};P(t,i)}function Br(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var i={};for(var r in t){var n=t[r];n instanceof Array&&(n=n.concat([])),i[r]=n}return i}function Sr(e,t){for(var i;e.innerMode&&!(i=e.innerMode(t),!i||i.mode==e);)t=i.state,e=i.mode;return i||{mode:e,state:t}}function si(e,t,i){return e.startState?e.startState(t,i):!0}var Nt=function(e,t,i){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=i};Nt.prototype.eol=function(){return this.pos>=this.string.length},Nt.prototype.sol=function(){return this.pos==this.lineStart},Nt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Nt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Nt.prototype.eat=function(e){var t=this.string.charAt(this.pos),i;if(typeof e=="string"?i=t==e:i=t&&(e.test?e.test(t):e(t)),i)return++this.pos,t},Nt.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Nt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Nt.prototype.skipToEnd=function(){this.pos=this.string.length},Nt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Nt.prototype.backUp=function(e){this.pos-=e},Nt.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=$(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?$(this.string,this.lineStart,this.tabSize):0)},Nt.prototype.indentation=function(){return $(this.string,null,this.tabSize)-(this.lineStart?$(this.string,this.lineStart,this.tabSize):0)},Nt.prototype.match=function(e,t,i){if(typeof e=="string"){var r=function(F){return i?F.toLowerCase():F},n=this.string.substr(this.pos,e.length);if(r(n)==r(e))return t!==!1&&(this.pos+=e.length),!0}else{var C=this.string.slice(this.pos).match(e);return C&&C.index>0?null:(C&&t!==!1&&(this.pos+=C[0].length),C)}},Nt.prototype.current=function(){return this.string.slice(this.start,this.pos)},Nt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Nt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Nt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function mt(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 i=e;!i.lines;)for(var r=0;;++r){var n=i.children[r],C=n.chunkSize();if(t<C){i=n;break}t-=C}return i.lines[t]}function Ur(e,t,i){var r=[],n=t.line;return e.iter(t.line,i.line+1,function(C){var F=C.text;n==i.line&&(F=F.slice(0,i.ch)),n==t.line&&(F=F.slice(t.ch)),r.push(F),++n}),r}function li(e,t,i){var r=[];return e.iter(t,i,function(n){r.push(n.text)}),r}function Cr(e,t){var i=t-e.height;if(i)for(var r=e;r;r=r.parent)r.height+=i}function Ot(e){if(e.parent==null)return null;for(var t=e.parent,i=oe(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var n=0;!(r.children[n]==t);++n)i+=r.children[n].chunkSize();return i+t.first}function Fr(e,t){var i=e.first;e:do{for(var r=0;r<e.children.length;++r){var n=e.children[r],C=n.height;if(t<C){e=n;continue e}t-=C,i+=n.chunkSize()}return i}while(!e.lines);for(var F=0;F<e.lines.length;++F){var Y=e.lines[F],Z=Y.height;if(t<Z)break;t-=Z}return i+F}function $r(e,t){return t>=e.first&&t<e.first+e.size}function ui(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function Ve(e,t,i){if(i===void 0&&(i=null),!(this instanceof Ve))return new Ve(e,t,i);this.line=e,this.ch=t,this.sticky=i}function wt(e,t){return e.line-t.line||e.ch-t.ch}function di(e,t){return e.sticky==t.sticky&&wt(e,t)==0}function Li(e){return Ve(e.line,e.ch)}function hi(e,t){return wt(e,t)<0?t:e}function ki(e,t){return wt(e,t)<0?e:t}function z(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function s(e,t){if(t.line<e.first)return Ve(e.first,0);var i=e.first+e.size-1;return t.line>i?Ve(i,mt(e,i).text.length):f(t,mt(e,t.line).text.length)}function f(e,t){var i=e.ch;return i==null||i>t?Ve(e.line,t):i<0?Ve(e.line,0):e}function W(e,t){for(var i=[],r=0;r<t.length;r++)i[r]=s(e,t[r]);return i}var X=function(e,t){this.state=e,this.lookAhead=t},H=function(e,t,i,r){this.state=t,this.doc=e,this.line=i,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};H.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},H.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}},H.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},H.fromSaved=function(e,t,i){return t instanceof X?new H(e,Br(e.mode,t.state),i,t.lookAhead):new H(e,Br(e.mode,t),i)},H.prototype.save=function(e){var t=e!==!1?Br(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new X(t,this.maxLookAhead):t};function ve(e,t,i,r){var n=[e.state.modeGen],C={};Wr(e,t.text,e.doc.mode,i,function(q,ce){return n.push(q,ce)},C,r);for(var F=i.state,Y=function(q){i.baseTokens=n;var ce=e.state.overlays[q],me=1,De=0;i.state=!0,Wr(e,t.text,ce.mode,i,function(we,Fe){for(var ze=me;De<we;){var $e=n[me];$e>we&&n.splice(me,1,we,n[me+1],$e),me+=2,De=Math.min(we,$e)}if(!Fe)return;if(ce.opaque)n.splice(ze,me-ze,we,"overlay "+Fe),me=ze+2;else for(;ze<me;ze+=2){var it=n[ze+1];n[ze+1]=(it?it+" ":"")+"overlay "+Fe}},C),i.state=F,i.baseTokens=null,i.baseTokenPos=1},Z=0;Z<e.state.overlays.length;++Z)Y(Z);return{styles:n,classes:C.bgClass||C.textClass?C:null}}function He(e,t,i){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=qe(e,Ot(t)),n=t.text.length>e.options.maxHighlightLength&&Br(e.doc.mode,r.state),C=ve(e,t,r);n&&(r.state=n),t.stateAfter=r.save(!n),t.styles=C.styles,C.classes?t.styleClasses=C.classes:t.styleClasses&&(t.styleClasses=null),i===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function qe(e,t,i){var r=e.doc,n=e.display;if(!r.mode.startState)return new H(r,!0,t);var C=sr(e,t,i),F=C>r.first&&mt(r,C-1).stateAfter,Y=F?H.fromSaved(r,F,C):new H(r,si(r.mode),C);return r.iter(C,t,function(Z){ft(e,Z.text,Y);var q=Y.line;Z.stateAfter=q==t-1||q%5==0||q>=n.viewFrom&&q<n.viewTo?Y.save():null,Y.nextLine()}),i&&(r.modeFrontier=Y.line),Y}function ft(e,t,i,r){var n=e.doc.mode,C=new Nt(t,e.options.tabSize,i);for(C.start=C.pos=r||0,t==""&&Ge(n,i.state);!C.eol();)Ct(n,C,i.state),C.start=C.pos}function Ge(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var i=Sr(e,t);if(i.mode.blankLine)return i.mode.blankLine(i.state)}function Ct(e,t,i,r){for(var n=0;n<10;n++){r&&(r[0]=Sr(e,i).mode);var C=e.token(t,i);if(t.pos>t.start)return C}throw new Error("Mode "+e.name+" failed to advance stream.")}var Mt=function(e,t,i){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=i};function Vt(e,t,i,r){var n=e.doc,C=n.mode,F;t=s(n,t);var Y=mt(n,t.line),Z=qe(e,t.line,i),q=new Nt(Y.text,e.options.tabSize,Z),ce;for(r&&(ce=[]);(r||q.pos<t.ch)&&!q.eol();)q.start=q.pos,F=Ct(C,q,Z.state),r&&ce.push(new Mt(q,F,Br(n.mode,Z.state)));return r?ce:new Mt(q,F,Z.state)}function jr(e,t){if(e)for(;;){var i=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!i)break;e=e.slice(0,i.index)+e.slice(i.index+i[0].length);var r=i[1]?"bgClass":"textClass";t[r]==null?t[r]=i[2]:new RegExp("(?:^|\\s)"+i[2]+"(?:$|\\s)").test(t[r])||(t[r]+=" "+i[2])}return e}function Wr(e,t,i,r,n,C,F){var Y=i.flattenSpans;Y==null&&(Y=e.options.flattenSpans);var Z=0,q=null,ce=new Nt(t,e.options.tabSize,r),me,De=e.options.addModeClass&&[null];for(t==""&&jr(Ge(i,r.state),C);!ce.eol();){if(ce.pos>e.options.maxHighlightLength?(Y=!1,F&&ft(e,t,r,ce.pos),ce.pos=t.length,me=null):me=jr(Ct(i,ce,r.state,De),C),De){var we=De[0].name;we&&(me="m-"+(me?we+" "+me:we))}if(!Y||q!=me){for(;Z<ce.start;)Z=Math.min(ce.start,Z+5e3),n(Z,q);q=me}ce.start=ce.pos}for(;Z<ce.pos;){var Fe=Math.min(ce.pos,Z+5e3);n(Fe,q),Z=Fe}}function sr(e,t,i){for(var r,n,C=e.doc,F=i?-1:t-(e.doc.mode.innerMode?1e3:100),Y=t;Y>F;--Y){if(Y<=C.first)return C.first;var Z=mt(C,Y-1),q=Z.stateAfter;if(q&&(!i||Y+(q instanceof X?q.lookAhead:0)<=C.modeFrontier))return Y;var ce=$(Z.text,null,e.options.tabSize);(n==null||r>ce)&&(n=Y-1,r=ce)}return n}function Vr(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),e.highlightFrontier<t-10)return;for(var i=e.first,r=t-1;r>i;r--){var n=mt(e,r).stateAfter;if(n&&(!(n instanceof X)||r+n.lookAhead<t)){i=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,i)}var Hi=!1,Tr=!1;function Hr(){Hi=!0}function Mr(){Tr=!0}function gi(e,t,i){this.marker=e,this.from=t,this.to=i}function Zr(e,t){if(e)for(var i=0;i<e.length;++i){var r=e[i];if(r.marker==t)return r}}function ci(e,t){for(var i,r=0;r<e.length;++r)e[r]!=t&&(i||(i=[])).push(e[r]);return i}function ri(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function hn(e,t,i){var r;if(e)for(var n=0;n<e.length;++n){var C=e[n],F=C.marker,Y=C.from==null||(F.inclusiveLeft?C.from<=t:C.from<t);if(Y||C.from==t&&F.type=="bookmark"&&(!i||!C.marker.insertLeft)){var Z=C.to==null||(F.inclusiveRight?C.to>=t:C.to>t);(r||(r=[])).push(new gi(F,C.from,Z?null:C.to))}}return r}function Gi(e,t,i){var r;if(e)for(var n=0;n<e.length;++n){var C=e[n],F=C.marker,Y=C.to==null||(F.inclusiveRight?C.to>=t:C.to>t);if(Y||C.from==t&&F.type=="bookmark"&&(!i||C.marker.insertLeft)){var Z=C.from==null||(F.inclusiveLeft?C.from<=t:C.from<t);(r||(r=[])).push(new gi(F,Z?null:C.from-t,C.to==null?null:C.to-t))}}return r}function Qr(e,t){if(t.full)return null;var i=$r(e,t.from.line)&&mt(e,t.from.line).markedSpans,r=$r(e,t.to.line)&&mt(e,t.to.line).markedSpans;if(!i&&!r)return null;var n=t.from.ch,C=t.to.ch,F=wt(t.from,t.to)==0,Y=hn(i,n,F),Z=Gi(r,C,F),q=t.text.length==1,ce=te(t.text).length+(q?n:0);if(Y)for(var me=0;me<Y.length;++me){var De=Y[me];if(De.to==null){var we=Zr(Z,De.marker);we?q&&(De.to=we.to==null?null:we.to+ce):De.to=n}}if(Z)for(var Fe=0;Fe<Z.length;++Fe){var ze=Z[Fe];if(ze.to!=null&&(ze.to+=ce),ze.from==null){var $e=Zr(Y,ze.marker);$e||(ze.from=ce,q&&(Y||(Y=[])).push(ze))}else ze.from+=ce,q&&(Y||(Y=[])).push(ze)}Y&&(Y=Gr(Y)),Z&&Z!=Y&&(Z=Gr(Z));var it=[Y];if(!q){var ut=t.text.length-2,nt;if(ut>0&&Y)for(var pt=0;pt<Y.length;++pt)Y[pt].to==null&&(nt||(nt=[])).push(new gi(Y[pt].marker,null,null));for(var St=0;St<ut;++St)it.push(nt);it.push(Z)}return it}function Gr(e){for(var t=0;t<e.length;++t){var i=e[t];i.from!=null&&i.from==i.to&&i.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function Di(e,t,i){var r=null;if(e.iter(t.line,i.line+1,function(we){if(we.markedSpans)for(var Fe=0;Fe<we.markedSpans.length;++Fe){var ze=we.markedSpans[Fe].marker;ze.readOnly&&(!r||oe(r,ze)==-1)&&(r||(r=[])).push(ze)}}),!r)return null;for(var n=[{from:t,to:i}],C=0;C<r.length;++C)for(var F=r[C],Y=F.find(0),Z=0;Z<n.length;++Z){var q=n[Z];if(wt(q.to,Y.from)<0||wt(q.from,Y.to)>0)continue;var ce=[Z,1],me=wt(q.from,Y.from),De=wt(q.to,Y.to);(me<0||!F.inclusiveLeft&&!me)&&ce.push({from:q.from,to:Y.from}),(De>0||!F.inclusiveRight&&!De)&&ce.push({from:Y.to,to:q.to}),n.splice.apply(n,ce),Z+=ce.length-3}return n}function Ri(e){var t=e.markedSpans;if(!t)return;for(var i=0;i<t.length;++i)t[i].marker.detachLine(e);e.markedSpans=null}function cn(e,t){if(!t)return;for(var i=0;i<t.length;++i)t[i].marker.attachLine(e);e.markedSpans=t}function Qt(e){return e.inclusiveLeft?-1:0}function Ut(e){return e.inclusiveRight?1:0}function pr(e,t){var i=e.lines.length-t.lines.length;if(i!=0)return i;var r=e.find(),n=t.find(),C=wt(r.from,n.from)||Qt(e)-Qt(t);if(C)return-C;var F=wt(r.to,n.to)||Ut(e)-Ut(t);return F||t.id-e.id}function Bt(e,t){var i=Tr&&e.markedSpans,r;if(i)for(var n=void 0,C=0;C<i.length;++C)n=i[C],n.marker.collapsed&&(t?n.from:n.to)==null&&(!r||pr(r,n.marker)<0)&&(r=n.marker);return r}function ir(e){return Bt(e,!0)}function Ht(e){return Bt(e,!1)}function ii(e,t){var i=Tr&&e.markedSpans,r;if(i)for(var n=0;n<i.length;++n){var C=i[n];C.marker.collapsed&&(C.from==null||C.from<t)&&(C.to==null||C.to>t)&&(!r||pr(r,C.marker)<0)&&(r=C.marker)}return r}function er(e,t,i,r,n){var C=mt(e,t),F=Tr&&C.markedSpans;if(F)for(var Y=0;Y<F.length;++Y){var Z=F[Y];if(!Z.marker.collapsed)continue;var q=Z.marker.find(0),ce=wt(q.from,i)||Qt(Z.marker)-Qt(n),me=wt(q.to,r)||Ut(Z.marker)-Ut(n);if(ce>=0&&me<=0||ce<=0&&me>=0)continue;if(ce<=0&&(Z.marker.inclusiveRight&&n.inclusiveLeft?wt(q.to,i)>=0:wt(q.to,i)>0)||ce>=0&&(Z.marker.inclusiveRight&&n.inclusiveLeft?wt(q.from,r)<=0:wt(q.from,r)<0))return!0}}function wr(e){for(var t;t=ir(e);)e=t.find(-1,!0).line;return e}function zi(e){for(var t;t=Ht(e);)e=t.find(1,!0).line;return e}function Ki(e){for(var t,i;t=Ht(e);)e=t.find(1,!0).line,(i||(i=[])).push(e);return i}function vi(e,t){var i=mt(e,t),r=wr(i);return i==r?t:Ot(r)}function Fn(e,t){if(t>e.lastLine())return t;var i=mt(e,t),r;if(!Pr(e,i))return t;for(;r=Ht(i);)i=r.find(1,!0).line;return Ot(i)+1}function Pr(e,t){var i=Tr&&t.markedSpans;if(i)for(var r=void 0,n=0;n<i.length;++n){if(r=i[n],!r.marker.collapsed)continue;if(r.from==null)return!0;if(r.marker.widgetNode)continue;if(r.from==0&&r.marker.inclusiveLeft&&fn(e,t,r))return!0}}function fn(e,t,i){if(i.to==null){var r=i.marker.find(1,!0);return fn(e,r.line,Zr(r.line.markedSpans,i.marker))}if(i.marker.inclusiveRight&&i.to==t.text.length)return!0;for(var n=void 0,C=0;C<t.markedSpans.length;++C)if(n=t.markedSpans[C],n.marker.collapsed&&!n.marker.widgetNode&&n.from==i.to&&(n.to==null||n.to!=i.from)&&(n.marker.inclusiveLeft||i.marker.inclusiveRight)&&fn(e,t,n))return!0}function Jr(e){e=wr(e);for(var t=0,i=e.parent,r=0;r<i.lines.length;++r){var n=i.lines[r];if(n==e)break;t+=n.height}for(var C=i.parent;C;i=C,C=i.parent)for(var F=0;F<C.children.length;++F){var Y=C.children[F];if(Y==i)break;t+=Y.height}return t}function Vi(e){if(e.height==0)return 0;for(var t=e.text.length,i,r=e;i=ir(r);){var n=i.find(0,!0);r=n.from.line,t+=n.from.ch-n.to.ch}for(r=e;i=Ht(r);){var C=i.find(0,!0);t-=r.text.length-C.from.ch,r=C.to.line,t+=r.text.length-C.to.ch}return t}function jn(e){var t=e.display,i=e.doc;t.maxLine=mt(i,i.first),t.maxLineLength=Vi(t.maxLine),t.maxLineChanged=!0,i.iter(function(r){var n=Vi(r);n>t.maxLineLength&&(t.maxLineLength=n,t.maxLine=r)})}var Oi=function(e,t,i){this.text=e,cn(this,t),this.height=i?i(this):1};Oi.prototype.lineNo=function(){return Ot(this)},ye(Oi);function $a(e,t,i,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),Ri(e),cn(e,i);var n=r?r(e):1;n!=e.height&&Cr(e,n)}function da(e){e.parent=null,Ri(e)}var gt={},Lt={};function xt(e,t){if(!e||/^\s*$/.test(e))return null;var i=t.addModeClass?Lt:gt;return i[e]||(i[e]=e.replace(/\S+/g,"cm-$&"))}function _t(e,t){var i=E("span",null,null,I?"padding-right: .1px":null),r={pre:E("pre",[i],"CodeMirror-line"),content:i,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var n=0;n<=(t.rest?t.rest.length:0);n++){var C=n?t.rest[n-1]:t.line,F=void 0;r.pos=0,r.addToken=zt,kt(e.display.measure)&&(F=Ye(C,e.doc.direction))&&(r.addToken=nr(r.addToken,F)),r.map=[];var Y=t!=e.display.externalMeasured&&Ot(C);Pt(C,r,He(e,C,Y)),C.styleClasses&&(C.styleClasses.bgClass&&(r.bgClass=K(C.styleClasses.bgClass,r.bgClass||"")),C.styleClasses.textClass&&(r.textClass=K(C.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(ct(e.display.measure))),n==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(I){var Z=r.content.lastChild;(/\bcm-tab\b/.test(Z.className)||Z.querySelector&&Z.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return Be(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=K(r.pre.className,r.textClass||"")),r}function Ft(e){var t=a("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function zt(e,t,i,r,n,C,F){if(!t)return;var Y=e.splitSpaces?It(t,e.trailingSpace):t,Z=e.cm.state.specialChars,q=!1,ce;if(!Z.test(t))e.col+=t.length,ce=document.createTextNode(Y),e.map.push(e.pos,e.pos+t.length,ce),G&&j<9&&(q=!0),e.pos+=t.length;else{ce=document.createDocumentFragment();for(var me=0;;){Z.lastIndex=me;var De=Z.exec(t),we=De?De.index-me:t.length-me;if(we){var Fe=document.createTextNode(Y.slice(me,me+we));G&&j<9?ce.appendChild(a("span",[Fe])):ce.appendChild(Fe),e.map.push(e.pos,e.pos+we,Fe),e.col+=we,e.pos+=we}if(!De)break;me+=we+1;var ze=void 0;if(De[0]==" "){var $e=e.cm.options.tabSize,it=$e-e.col%$e;ze=ce.appendChild(a("span",se(it),"cm-tab")),ze.setAttribute("role","presentation"),ze.setAttribute("cm-text"," "),e.col+=it}else De[0]=="\r"||De[0]==`
`?(ze=ce.appendChild(a("span",De[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),ze.setAttribute("cm-text",De[0]),e.col+=1):(ze=e.cm.options.specialCharPlaceholder(De[0]),ze.setAttribute("cm-text",De[0]),G&&j<9?ce.appendChild(a("span",[ze])):ce.appendChild(ze),e.col+=1);e.map.push(e.pos,e.pos+1,ze),e.pos++}}if(e.trailingSpace=Y.charCodeAt(t.length-1)==32,i||r||n||q||C||F){var ut=i||"";r&&(ut+=r),n&&(ut+=n);var nt=a("span",[ce],ut,C);if(F)for(var pt in F)F.hasOwnProperty(pt)&&pt!="style"&&pt!="class"&&nt.setAttribute(pt,F[pt]);return e.content.appendChild(nt)}e.content.appendChild(ce)}function It(e,t){if(e.length>1&&!/ /.test(e))return e;for(var i=t,r="",n=0;n<e.length;n++){var C=e.charAt(n);C==" "&&i&&(n==e.length-1||e.charCodeAt(n+1)==32)&&(C="\xA0"),r+=C,i=C==" "}return r}function nr(e,t){return function(i,r,n,C,F,Y,Z){n=n?n+" cm-force-border":"cm-force-border";for(var q=i.pos,ce=q+r.length;;){for(var me=void 0,De=0;De<t.length&&!(me=t[De],me.to>q&&me.from<=q);De++);if(me.to>=ce)return e(i,r,n,C,F,Y,Z);e(i,r.slice(0,me.to-q),n,C,null,Y,Z),C=null,r=r.slice(me.to-q),q=me.to}}}function Ar(e,t,i,r){var n=!r&&i.widgetNode;n&&e.map.push(e.pos,e.pos+t,n),!r&&e.cm.display.input.needsContentAttribute&&(n||(n=e.content.appendChild(document.createElement("span"))),n.setAttribute("cm-marker",i.id)),n&&(e.cm.display.input.setUneditable(n),e.content.appendChild(n)),e.pos+=t,e.trailingSpace=!1}function Pt(e,t,i){var r=e.markedSpans,n=e.text,C=0;if(!r){for(var F=1;F<i.length;F+=2)t.addToken(t,n.slice(C,C=i[F]),xt(i[F+1],t.cm.options));return}for(var Y=n.length,Z=0,q=1,ce="",me,De,we=0,Fe,ze,$e,it,ut;;){if(we==Z){Fe=ze=$e=De="",ut=null,it=null,we=Infinity;for(var nt=[],pt=void 0,St=0;St<r.length;++St){var yt=r[St],Rt=yt.marker;if(Rt.type=="bookmark"&&yt.from==Z&&Rt.widgetNode)nt.push(Rt);else if(yt.from<=Z&&(yt.to==null||yt.to>Z||Rt.collapsed&&yt.to==Z&&yt.from==Z)){if(yt.to!=null&&yt.to!=Z&&we>yt.to&&(we=yt.to,ze=""),Rt.className&&(Fe+=" "+Rt.className),Rt.css&&(De=(De?De+";":"")+Rt.css),Rt.startStyle&&yt.from==Z&&($e+=" "+Rt.startStyle),Rt.endStyle&&yt.to==we&&(pt||(pt=[])).push(Rt.endStyle,yt.to),Rt.title&&((ut||(ut={})).title=Rt.title),Rt.attributes)for(var Xt in Rt.attributes)(ut||(ut={}))[Xt]=Rt.attributes[Xt];Rt.collapsed&&(!it||pr(it.marker,Rt)<0)&&(it=yt)}else yt.from>Z&&we>yt.from&&(we=yt.from)}if(pt)for(var cr=0;cr<pt.length;cr+=2)pt[cr+1]==we&&(ze+=" "+pt[cr]);if(!it||it.from==Z)for(var Zt=0;Zt<nt.length;++Zt)Ar(t,0,nt[Zt]);if(it&&(it.from||0)==Z){if(Ar(t,(it.to==null?Y+1:it.to)-Z,it.marker,it.from==null),it.to==null)return;it.to==Z&&(it=!1)}}if(Z>=Y)break;for(var Nr=Math.min(Y,we);;){if(ce){var Dr=Z+ce.length;if(!it){var ar=Dr>Nr?ce.slice(0,Nr-Z):ce;t.addToken(t,ar,me?me+Fe:Fe,$e,Z+ar.length==we?ze:"",De,ut)}if(Dr>=Nr){ce=ce.slice(Nr-Z),Z=Nr;break}Z=Dr,$e=""}ce=n.slice(C,C=i[q++]),me=xt(i[q++],t.cm.options)}}}function yi(e,t,i){this.line=t,this.rest=Ki(t),this.size=this.rest?Ot(te(this.rest))-i+1:1,this.node=this.text=null,this.hidden=Pr(e,t)}function Wt(e,t,i){for(var r=[],n,C=t;C<i;C=n){var F=new yi(e.doc,mt(e.doc,C),C);n=C+F.size,r.push(F)}return r}var ur=null;function Xr(e){ur?ur.ops.push(e):e.ownsGroup=ur={ops:[e],delayedCallbacks:[]}}function Yr(e){var t=e.delayedCallbacks,i=0;do{for(;i<t.length;i++)t[i].call(null);for(var r=0;r<e.ops.length;r++){var n=e.ops[r];if(n.cursorActivityHandlers)for(;n.cursorActivityCalled<n.cursorActivityHandlers.length;)n.cursorActivityHandlers[n.cursorActivityCalled++].call(null,n.cm)}}while(i<t.length)}function Wn(e,t){var i=e.ownsGroup;if(!i)return;try{Yr(i)}finally{ur=null,t(i)}}var pn=null;function mr(e,t){var i=ot(e,t);if(!i.length)return;var r=Array.prototype.slice.call(arguments,2),n;ur?n=ur.delayedCallbacks:pn?n=pn:(n=pn=[],setTimeout(_s,0));for(var C=function(Y){n.push(function(){return i[Y].apply(null,r)})},F=0;F<i.length;++F)C(F)}function _s(){var e=pn;pn=null;for(var t=0;t<e.length;++t)e[t]()}function Za(e,t,i,r){for(var n=0;n<t.changes.length;n++){var C=t.changes[n];C=="text"?Ps(e,t):C=="gutter"?Ja(e,t,i,r):C=="class"?ha(e,t):C=="widget"&&Is(e,t,r)}t.changes=null}function mn(e){return e.node==e.text&&(e.node=a("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),G&&j<8&&(e.node.style.zIndex=2)),e.node}function Ms(e,t){var i=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(i&&(i+=" CodeMirror-linebackground"),t.background)i?t.background.className=i:(t.background.parentNode.removeChild(t.background),t.background=null);else if(i){var r=mn(t);t.background=r.insertBefore(a("div",null,i),r.firstChild),e.display.input.setUneditable(t.background)}}function Qa(e,t){var i=e.display.externalMeasured;return i&&i.line==t.line?(e.display.externalMeasured=null,t.measure=i.measure,i.built):_t(e,t)}function Ps(e,t){var i=t.text.className,r=Qa(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,ha(e,t)):i&&(t.text.className=i)}function ha(e,t){Ms(e,t),t.line.wrapClass?mn(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var i=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=i||""}function Ja(e,t,i,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 n=mn(t);t.gutterBackground=a("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),n.insertBefore(t.gutterBackground,t.text)}var C=t.line.gutterMarkers;if(e.options.lineNumbers||C){var F=mn(t),Y=t.gutter=a("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(Y),F.insertBefore(Y,t.text),t.line.gutterClass&&(Y.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!C||!C["CodeMirror-linenumbers"])&&(t.lineNumber=Y.appendChild(a("div",ui(e.options,i),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),C)for(var Z=0;Z<e.display.gutterSpecs.length;++Z){var q=e.display.gutterSpecs[Z].className,ce=C.hasOwnProperty(q)&&C[q];ce&&Y.appendChild(a("div",[ce],"CodeMirror-gutter-elt","left: "+r.gutterLeft[q]+"px; width: "+r.gutterWidth[q]+"px"))}}}function Is(e,t,i){t.alignable&&(t.alignable=null);for(var r=x("CodeMirror-linewidget"),n=t.node.firstChild,C=void 0;n;n=C)C=n.nextSibling,r.test(n.className)&&t.node.removeChild(n);qa(e,t,i)}function Ns(e,t,i,r){var n=Qa(e,t);return t.text=t.node=n.pre,n.bgClass&&(t.bgClass=n.bgClass),n.textClass&&(t.textClass=n.textClass),ha(e,t),Ja(e,t,i,r),qa(e,t,r),t.node}function qa(e,t,i){if(eo(e,t.line,t,i,!0),t.rest)for(var r=0;r<t.rest.length;r++)eo(e,t.rest[r],t,i,!1)}function eo(e,t,i,r,n){if(!t.widgets)return;for(var C=mn(i),F=0,Y=t.widgets;F<Y.length;++F){var Z=Y[F],q=a("div",[Z.node],"CodeMirror-linewidget"+(Z.className?" "+Z.className:""));Z.handleMouseEvents||q.setAttribute("cm-ignore-events","true"),Bs(Z,q,i,r),e.display.input.setUneditable(q),n&&Z.above?C.insertBefore(q,i.gutter||i.text):C.appendChild(q),mr(Z,"redraw")}}function Bs(e,t,i,r){if(e.noHScroll){(i.alignable||(i.alignable=[])).push(t);var n=r.wrapperWidth;t.style.left=r.fixedPos+"px",e.coverGutter||(n-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=n+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function gn(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!S(document.body,e.node)){var i="position: relative;";e.coverGutter&&(i+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(i+="width: "+t.display.wrapper.clientWidth+"px;"),h(t.display.measure,a("div",[e.node],null,i))}return e.height=e.node.parentNode.offsetHeight}function fi(e,t){for(var i=ke(t);i!=e.wrapper;i=i.parentNode)if(!i||i.nodeType==1&&i.getAttribute("cm-ignore-events")=="true"||i.parentNode==e.sizer&&i!=e.mover)return!0}function Hn(e){return e.lineSpace.offsetTop}function ca(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function to(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=h(e.measure,a("pre","x","CodeMirror-line-like")),i=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r={left:parseInt(i.paddingLeft),right:parseInt(i.paddingRight)};return!isNaN(r.left)&&!isNaN(r.right)&&(e.cachedPaddingH=r),r}function ni(e){return fe-e.display.nativeBarWidth}function _i(e){return e.display.scroller.clientWidth-ni(e)-e.display.barWidth}function fa(e){return e.display.scroller.clientHeight-ni(e)-e.display.barHeight}function Us(e,t,i){var r=e.options.lineWrapping,n=r&&_i(e);if(!t.measure.heights||r&&t.measure.width!=n){var C=t.measure.heights=[];if(r){t.measure.width=n;for(var F=t.text.firstChild.getClientRects(),Y=0;Y<F.length-1;Y++){var Z=F[Y],q=F[Y+1];Math.abs(Z.bottom-q.bottom)>2&&C.push((Z.bottom+q.top)/2-i.top)}}C.push(i.bottom-i.top)}}function ro(e,t,i){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 n=0;n<e.rest.length;n++)if(Ot(e.rest[n])>i)return{map:e.measure.maps[n],cache:e.measure.caches[n],before:!0}}function Fs(e,t){t=wr(t);var i=Ot(t),r=e.display.externalMeasured=new yi(e.doc,t,i);r.lineN=i;var n=r.built=_t(e,r);return r.text=n.pre,h(e.display.lineMeasure,n.pre),r}function io(e,t,i,r){return ai(e,Xi(e,t),i,r)}function pa(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[Ii(e,t)];var i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size)return i}function Xi(e,t){var i=Ot(t),r=pa(e,i);r&&!r.text?r=null:r&&r.changes&&(Za(e,r,i,xa(e)),e.curOp.forceUpdate=!0),r||(r=Fs(e,t));var n=ro(r,t,i);return{line:t,view:r,rect:null,map:n.map,cache:n.cache,before:n.before,hasHeights:!1}}function ai(e,t,i,r,n){t.before&&(i=-1);var C=i+(r||""),F;return t.cache.hasOwnProperty(C)?F=t.cache[C]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Us(e,t.view,t.rect),t.hasHeights=!0),F=Ws(e,t,i,r),F.bogus||(t.cache[C]=F)),{left:F.left,right:F.right,top:n?F.rtop:F.top,bottom:n?F.rbottom:F.bottom}}var no={left:0,right:0,top:0,bottom:0};function ao(e,t,i){for(var r,n,C,F,Y,Z,q=0;q<e.length;q+=3)if(Y=e[q],Z=e[q+1],t<Y?(n=0,C=1,F="left"):t<Z?(n=t-Y,C=n+1):(q==e.length-3||t==Z&&e[q+3]>t)&&(C=Z-Y,n=C-1,t>=Z&&(F="right")),n!=null){if(r=e[q+2],Y==Z&&i==(r.insertLeft?"left":"right")&&(F=i),i=="left"&&n==0)for(;q&&e[q-2]==e[q-3]&&e[q-1].insertLeft;)r=e[(q-=3)+2],F="left";if(i=="right"&&n==Z-Y)for(;q<e.length-3&&e[q+3]==e[q+4]&&!e[q+5].insertLeft;)r=e[(q+=3)+2],F="right";break}return{node:r,start:n,end:C,collapse:F,coverStart:Y,coverEnd:Z}}function js(e,t){var i=no;if(t=="left")for(var r=0;r<e.length&&!((i=e[r]).left!=i.right);r++);else for(var n=e.length-1;n>=0&&!((i=e[n]).left!=i.right);n--);return i}function Ws(e,t,i,r){var n=ao(t.map,i,r),C=n.node,F=n.start,Y=n.end,Z=n.collapse,q;if(C.nodeType==3){for(var ce=0;ce<4;ce++){for(;F&&Ne(t.line.text.charAt(n.coverStart+F));)--F;for(;n.coverStart+Y<n.coverEnd&&Ne(t.line.text.charAt(n.coverStart+Y));)++Y;if(G&&j<9&&F==0&&Y==n.coverEnd-n.coverStart?q=C.parentNode.getBoundingClientRect():q=js(b(C,F,Y).getClientRects(),r),q.left||q.right||F==0)break;Y=F,F=F-1,Z="right"}G&&j<11&&(q=Hs(e.display.measure,q))}else{F>0&&(Z=r="right");var me;e.options.lineWrapping&&(me=C.getClientRects()).length>1?q=me[r=="right"?me.length-1:0]:q=C.getBoundingClientRect()}if(G&&j<9&&!F&&(!q||!q.left&&!q.right)){var De=C.parentNode.getClientRects()[0];De?q={left:De.left,right:De.left+$i(e.display),top:De.top,bottom:De.bottom}:q=no}for(var we=q.top-t.rect.top,Fe=q.bottom-t.rect.top,ze=(we+Fe)/2,$e=t.view.measure.heights,it=0;it<$e.length-1&&!(ze<$e[it]);it++);var ut=it?$e[it-1]:0,nt=$e[it],pt={left:(Z=="right"?q.right:q.left)-t.rect.left,right:(Z=="left"?q.left:q.right)-t.rect.left,top:ut,bottom:nt};return!q.left&&!q.right&&(pt.bogus=!0),e.options.singleCursorHeightPerLine||(pt.rtop=we,pt.rbottom=Fe),pt}function Hs(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!At(e))return t;var i=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*i,right:t.right*i,top:t.top*r,bottom:t.bottom*r}}function oo(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 so(e){e.display.externalMeasure=null,g(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)oo(e.display.view[t])}function vn(e){so(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function lo(){return v&&u?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function uo(){return v&&u?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function ma(e){var t=0;if(e.widgets)for(var i=0;i<e.widgets.length;++i)e.widgets[i].above&&(t+=gn(e.widgets[i]));return t}function Gn(e,t,i,r,n){if(!n){var C=ma(t);i.top+=C,i.bottom+=C}if(r=="line")return i;r||(r="local");var F=Jr(t);if(r=="local"?F+=Hn(e.display):F-=e.display.viewOffset,r=="page"||r=="window"){var Y=e.display.lineSpace.getBoundingClientRect();F+=Y.top+(r=="window"?0:uo());var Z=Y.left+(r=="window"?0:lo());i.left+=Z,i.right+=Z}return i.top+=F,i.bottom+=F,i}function ho(e,t,i){if(i=="div")return t;var r=t.left,n=t.top;if(i=="page")r-=lo(),n-=uo();else if(i=="local"||!i){var C=e.display.sizer.getBoundingClientRect();r+=C.left,n+=C.top}var F=e.display.lineSpace.getBoundingClientRect();return{left:r-F.left,top:n-F.top}}function ga(e,t,i,r,n){return r||(r=mt(e.doc,t.line)),Gn(e,r,io(e,r,t.ch,n),i)}function qr(e,t,i,r,n,C){r=r||mt(e.doc,t.line),n||(n=Xi(e,r));function F(Fe,ze){var $e=ai(e,n,Fe,ze?"right":"left",C);return ze?$e.left=$e.right:$e.right=$e.left,Gn(e,r,$e,i)}var Y=Ye(r,e.doc.direction),Z=t.ch,q=t.sticky;if(Z>=r.text.length?(Z=r.text.length,q="before"):Z<=0&&(Z=0,q="after"),!Y)return F(q=="before"?Z-1:Z,q=="before");function ce(Fe,ze,$e){var it=Y[ze],ut=it.level==1;return F($e?Fe-1:Fe,ut!=$e)}var me=Je(Y,Z,q),De=et,we=ce(Z,me,q=="before");return De!=null&&(we.other=ce(Z,De,q!="before")),we}function co(e,t){var i=0;t=s(e.doc,t),e.options.lineWrapping||(i=$i(e.display)*t.ch);var r=mt(e.doc,t.line),n=Jr(r)+Hn(e.display);return{left:i,right:i,top:n,bottom:n+r.height}}function va(e,t,i,r,n){var C=Ve(e,t,i);return C.xRel=n,r&&(C.outside=r),C}function ya(e,t,i){var r=e.doc;if(i+=e.display.viewOffset,i<0)return va(r.first,0,null,-1,-1);var n=Fr(r,i),C=r.first+r.size-1;if(n>C)return va(r.first+r.size-1,mt(r,C).text.length,null,1,1);t<0&&(t=0);for(var F=mt(r,n);;){var Y=Gs(e,F,n,t,i),Z=ii(F,Y.ch+(Y.xRel>0||Y.outside>0?1:0));if(!Z)return Y;var q=Z.find(1);if(q.line==n)return q;F=mt(r,n=q.line)}}function fo(e,t,i,r){r-=ma(t);var n=t.text.length,C=Qe(function(F){return ai(e,i,F-1).bottom<=r},n,0);return n=Qe(function(F){return ai(e,i,F).top>r},C,n),{begin:C,end:n}}function po(e,t,i,r){i||(i=Xi(e,t));var n=Gn(e,t,ai(e,i,r),"line").top;return fo(e,t,i,n)}function ba(e,t,i,r){return e.bottom<=i?!1:e.top>i?!0:(r?e.left:e.right)>t}function Gs(e,t,i,r,n){n-=Jr(t);var C=Xi(e,t),F=ma(t),Y=0,Z=t.text.length,q=!0,ce=Ye(t,e.doc.direction);if(ce){var me=(e.options.lineWrapping?Ks:zs)(e,t,i,C,ce,r,n);q=me.level!=1,Y=q?me.from:me.to-1,Z=q?me.to:me.from-1}var De=null,we=null,Fe=Qe(function(St){var yt=ai(e,C,St);return yt.top+=F,yt.bottom+=F,ba(yt,r,n,!1)?(yt.top<=n&&yt.left<=r&&(De=St,we=yt),!0):!1},Y,Z),ze,$e,it=!1;if(we){var ut=r-we.left<we.right-r,nt=ut==q;Fe=De+(nt?0:1),$e=nt?"after":"before",ze=ut?we.left:we.right}else{!q&&(Fe==Z||Fe==Y)&&Fe++,$e=Fe==0?"after":Fe==t.text.length?"before":ai(e,C,Fe-(q?1:0)).bottom+F<=n==q?"after":"before";var pt=qr(e,Ve(i,Fe,$e),"line",t,C);ze=pt.left,it=n<pt.top?-1:n>=pt.bottom?1:0}return Fe=Ie(t.text,Fe,1),va(i,Fe,$e,it,r-ze)}function zs(e,t,i,r,n,C,F){var Y=Qe(function(me){var De=n[me],we=De.level!=1;return ba(qr(e,Ve(i,we?De.to:De.from,we?"before":"after"),"line",t,r),C,F,!0)},0,n.length-1),Z=n[Y];if(Y>0){var q=Z.level!=1,ce=qr(e,Ve(i,q?Z.from:Z.to,q?"after":"before"),"line",t,r);ba(ce,C,F,!0)&&ce.top>F&&(Z=n[Y-1])}return Z}function Ks(e,t,i,r,n,C,F){var Y=fo(e,t,r,F),Z=Y.begin,q=Y.end;/\s/.test(t.text.charAt(q-1))&&q--;for(var ce=null,me=null,De=0;De<n.length;De++){var we=n[De];if(we.from>=q||we.to<=Z)continue;var Fe=we.level!=1,ze=ai(e,r,Fe?Math.min(q,we.to)-1:Math.max(Z,we.from)).right,$e=ze<C?C-ze+1e9:ze-C;(!ce||me>$e)&&(ce=we,me=$e)}return ce||(ce=n[n.length-1]),ce.from<Z&&(ce={from:Z,to:ce.to,level:ce.level}),ce.to>q&&(ce={from:ce.from,to:q,level:ce.level}),ce}var Mi;function Yi(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(Mi==null){Mi=a("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Mi.appendChild(document.createTextNode("x")),Mi.appendChild(a("br"));Mi.appendChild(document.createTextNode("x"))}h(e.measure,Mi);var i=Mi.offsetHeight/50;return i>3&&(e.cachedTextHeight=i),g(e.measure),i||1}function $i(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=a("span","xxxxxxxxxx"),i=a("pre",[t],"CodeMirror-line-like");h(e.measure,i);var r=t.getBoundingClientRect(),n=(r.right-r.left)/10;return n>2&&(e.cachedCharWidth=n),n||10}function xa(e){for(var t=e.display,i={},r={},n=t.gutters.clientLeft,C=t.gutters.firstChild,F=0;C;C=C.nextSibling,++F){var Y=e.display.gutterSpecs[F].className;i[Y]=C.offsetLeft+C.clientLeft+n,r[Y]=C.clientWidth}return{fixedPos:Ea(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:i,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Ea(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function mo(e){var t=Yi(e.display),i=e.options.lineWrapping,r=i&&Math.max(5,e.display.scroller.clientWidth/$i(e.display)-3);return function(n){if(Pr(e.doc,n))return 0;var C=0;if(n.widgets)for(var F=0;F<n.widgets.length;F++)n.widgets[F].height&&(C+=n.widgets[F].height);return i?C+(Math.ceil(n.text.length/r)||1)*t:C+t}}function Sa(e){var t=e.doc,i=mo(e);t.iter(function(r){var n=i(r);n!=r.height&&Cr(r,n)})}function Pi(e,t,i,r){var n=e.display;if(!i&&ke(t).getAttribute("cm-not-content")=="true")return null;var C,F,Y=n.lineSpace.getBoundingClientRect();try{C=t.clientX-Y.left,F=t.clientY-Y.top}catch(me){return null}var Z=ya(e,C,F),q;if(r&&Z.xRel>0&&(q=mt(e.doc,Z.line).text).length==Z.ch){var ce=$(q,q.length,e.options.tabSize)-q.length;Z=Ve(Z.line,Math.max(0,Math.round((C-to(e.display).left)/$i(e.display))-ce))}return Z}function Ii(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var i=e.display.view,r=0;r<i.length;r++)if(t-=i[r].size,t<0)return r}function Lr(e,t,i,r){t==null&&(t=e.doc.first),i==null&&(i=e.doc.first+e.doc.size),r||(r=0);var n=e.display;if(r&&i<n.viewTo&&(n.updateLineNumbers==null||n.updateLineNumbers>t)&&(n.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=n.viewTo)Tr&&vi(e.doc,t)<n.viewTo&&xi(e);else if(i<=n.viewFrom)Tr&&Fn(e.doc,i+r)>n.viewFrom?xi(e):(n.viewFrom+=r,n.viewTo+=r);else if(t<=n.viewFrom&&i>=n.viewTo)xi(e);else if(t<=n.viewFrom){var C=zn(e,i,i+r,1);C?(n.view=n.view.slice(C.index),n.viewFrom=C.lineN,n.viewTo+=r):xi(e)}else if(i>=n.viewTo){var F=zn(e,t,t,-1);F?(n.view=n.view.slice(0,F.index),n.viewTo=F.lineN):xi(e)}else{var Y=zn(e,t,t,-1),Z=zn(e,i,i+r,1);Y&&Z?(n.view=n.view.slice(0,Y.index).concat(Wt(e,Y.lineN,Z.lineN)).concat(n.view.slice(Z.index)),n.viewTo+=r):xi(e)}var q=n.externalMeasured;q&&(i<q.lineN?q.lineN+=r:t<q.lineN+q.size&&(n.externalMeasured=null))}function bi(e,t,i){e.curOp.viewChanged=!0;var r=e.display,n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size&&(r.externalMeasured=null),t<r.viewFrom||t>=r.viewTo)return;var C=r.view[Ii(e,t)];if(C.node==null)return;var F=C.changes||(C.changes=[]);oe(F,i)==-1&&F.push(i)}function xi(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function zn(e,t,i,r){var n=Ii(e,t),C,F=e.display.view;if(!Tr||i==e.doc.first+e.doc.size)return{index:n,lineN:i};for(var Y=e.display.viewFrom,Z=0;Z<n;Z++)Y+=F[Z].size;if(Y!=t){if(r>0){if(n==F.length-1)return null;C=Y+F[n].size-t,n++}else C=Y-t;t+=C,i+=C}for(;vi(e.doc,i)!=i;){if(n==(r<0?0:F.length-1))return null;i+=r*F[n-(r<0?1:0)].size,n+=r}return{index:n,lineN:i}}function Vs(e,t,i){var r=e.display,n=r.view;n.length==0||t>=r.viewTo||i<=r.viewFrom?(r.view=Wt(e,t,i),r.viewFrom=t):(r.viewFrom>t?r.view=Wt(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(Ii(e,t))),r.viewFrom=t,r.viewTo<i?r.view=r.view.concat(Wt(e,r.viewTo,i)):r.viewTo>i&&(r.view=r.view.slice(0,Ii(e,i)))),r.viewTo=i}function go(e){for(var t=e.display.view,i=0,r=0;r<t.length;r++){var n=t[r];!n.hidden&&(!n.node||n.changes)&&++i}return i}function yn(e){e.display.input.showSelection(e.display.input.prepareSelection())}function vo(e,t){t===void 0&&(t=!0);for(var i=e.doc,r={},n=r.cursors=document.createDocumentFragment(),C=r.selection=document.createDocumentFragment(),F=0;F<i.sel.ranges.length;F++){if(!t&&F==i.sel.primIndex)continue;var Y=i.sel.ranges[F];if(Y.from().line>=e.display.viewTo||Y.to().line<e.display.viewFrom)continue;var Z=Y.empty();(Z||e.options.showCursorWhenSelecting)&&yo(e,Y.head,n),Z||Xs(e,Y,C)}return r}function yo(e,t,i){var r=qr(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),n=i.appendChild(a("div","\xA0","CodeMirror-cursor"));if(n.style.left=r.left+"px",n.style.top=r.top+"px",n.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px",r.other){var C=i.appendChild(a("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));C.style.display="",C.style.left=r.other.left+"px",C.style.top=r.other.top+"px",C.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function Kn(e,t){return e.top-t.top||e.left-t.left}function Xs(e,t,i){var r=e.display,n=e.doc,C=document.createDocumentFragment(),F=to(e.display),Y=F.left,Z=Math.max(r.sizerWidth,_i(e)-r.sizer.offsetLeft)-F.right,q=n.direction=="ltr";function ce(nt,pt,St,yt){pt<0&&(pt=0),pt=Math.round(pt),yt=Math.round(yt),C.appendChild(a("div",null,"CodeMirror-selected","position: absolute; left: "+nt+`px;
top: `+pt+"px; width: "+(St==null?Z-nt:St)+`px;
height: `+(yt-pt)+"px"))}function me(nt,pt,St){var yt=mt(n,nt),Rt=yt.text.length,Xt,cr;function Zt(ar,Rr){return ga(e,Ve(nt,ar),"div",yt,Rr)}function Nr(ar,Rr,gr){var lr=po(e,yt,null,ar),or=Rr=="ltr"==(gr=="after")?"left":"right",Jt=gr=="after"?lr.begin:lr.end-(/\s/.test(yt.text.charAt(lr.end-1))?2:1);return Zt(Jt,or)[or]}var Dr=Ye(yt,n.direction);return rt(Dr,pt||0,St==null?Rt:St,function(ar,Rr,gr,lr){var or=gr=="ltr",Jt=Zt(ar,or?"left":"right"),Or=Zt(Rr-1,or?"right":"left"),un=pt==null&&ar==0,Ai=St==null&&Rr==Rt,yr=lr==0,oi=!Dr||lr==Dr.length-1;if(Or.top-Jt.top<=3){var fr=(q?un:Ai)&&yr,Xa=(q?Ai:un)&&oi,mi=fr?Y:(or?Jt:Or).left,ji=Xa?Z:(or?Or:Jt).right;ce(mi,Jt.top,ji-mi,Jt.bottom)}else{var Wi,xr,dn,Ya;or?(Wi=q&&un&&yr?Y:Jt.left,xr=q?Z:Nr(ar,gr,"before"),dn=q?Y:Nr(Rr,gr,"after"),Ya=q&&Ai&&oi?Z:Or.right):(Wi=q?Nr(ar,gr,"before"):Y,xr=!q&&un&&yr?Z:Jt.right,dn=!q&&Ai&&oi?Y:Or.left,Ya=q?Nr(Rr,gr,"after"):Z),ce(Wi,Jt.top,xr-Wi,Jt.bottom),Jt.bottom<Or.top&&ce(Y,Jt.bottom,null,Or.top),ce(dn,Or.top,Ya-dn,Or.bottom)}(!Xt||Kn(Jt,Xt)<0)&&(Xt=Jt),Kn(Or,Xt)<0&&(Xt=Or),(!cr||Kn(Jt,cr)<0)&&(cr=Jt),Kn(Or,cr)<0&&(cr=Or)}),{start:Xt,end:cr}}var De=t.from(),we=t.to();if(De.line==we.line)me(De.line,De.ch,we.ch);else{var Fe=mt(n,De.line),ze=mt(n,we.line),$e=wr(Fe)==wr(ze),it=me(De.line,De.ch,$e?Fe.text.length+1:null).end,ut=me(we.line,$e?0:null,we.ch).start;$e&&(it.top<ut.top-2?(ce(it.right,it.top,null,it.bottom),ce(Y,ut.top,ut.left,ut.bottom)):ce(it.right,it.top,ut.left-it.right,it.bottom)),it.bottom<ut.top&&ce(Y,it.bottom,null,ut.top)}i.appendChild(C)}function Ca(e){if(!e.state.focused)return;var t=e.display;clearInterval(t.blinker);var i=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){e.hasFocus()||Zi(e),t.cursorDiv.style.visibility=(i=!i)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function bo(e){e.state.focused||(e.display.input.focus(),Ta(e))}function xo(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Zi(e))},100)}function Ta(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(Be(e,"focus",e,t),e.state.focused=!0,U(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),I&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Ca(e)}function Zi(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(Be(e,"blur",e,t),e.state.focused=!1,m(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function Vn(e){for(var t=e.display,i=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var n=t.view[r],C=e.options.lineWrapping,F=void 0,Y=0;if(n.hidden)continue;if(G&&j<8){var Z=n.node.offsetTop+n.node.offsetHeight;F=Z-i,i=Z}else{var q=n.node.getBoundingClientRect();F=q.bottom-q.top,!C&&n.text.firstChild&&(Y=n.text.firstChild.getBoundingClientRect().right-q.left-1)}var ce=n.line.height-F;if((ce>.005||ce<-.005)&&(Cr(n.line,F),Eo(n.line),n.rest))for(var me=0;me<n.rest.length;me++)Eo(n.rest[me]);if(Y>e.display.sizerWidth){var De=Math.ceil(Y/$i(e.display));De>e.display.maxLineLength&&(e.display.maxLineLength=De,e.display.maxLine=n.line,e.display.maxLineChanged=!0)}}}function Eo(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var i=e.widgets[t],r=i.node.parentNode;r&&(i.height=r.offsetHeight)}}function Xn(e,t,i){var r=i&&i.top!=null?Math.max(0,i.top):e.scroller.scrollTop;r=Math.floor(r-Hn(e));var n=i&&i.bottom!=null?i.bottom:r+e.wrapper.clientHeight,C=Fr(t,r),F=Fr(t,n);if(i&&i.ensure){var Y=i.ensure.from.line,Z=i.ensure.to.line;Y<C?(C=Y,F=Fr(t,Jr(mt(t,Y))+e.wrapper.clientHeight)):Math.min(Z,t.lastLine())>=F&&(C=Fr(t,Jr(mt(t,Z))-e.wrapper.clientHeight),F=Z)}return{from:C,to:Math.max(F,C+1)}}function Ys(e,t){if(Ke(e,"scrollCursorIntoView"))return;var i=e.display,r=i.sizer.getBoundingClientRect(),n=null;if(t.top+r.top<0?n=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(n=!1),n!=null&&!w){var C=a("div","\u200B",null,`position: absolute;
top: `+(t.top-i.viewOffset-Hn(e.display))+`px;
height: `+(t.bottom-t.top+ni(e)+i.barHeight)+`px;
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(C),C.scrollIntoView(n),e.display.lineSpace.removeChild(C)}}function $s(e,t,i,r){r==null&&(r=0);var n;!e.options.lineWrapping&&t==i&&(t=t.ch?Ve(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,i=t.sticky=="before"?Ve(t.line,t.ch+1,"before"):t);for(var C=0;C<5;C++){var F=!1,Y=qr(e,t),Z=!i||i==t?Y:qr(e,i);n={left:Math.min(Y.left,Z.left),top:Math.min(Y.top,Z.top)-r,right:Math.max(Y.left,Z.left),bottom:Math.max(Y.bottom,Z.bottom)+r};var q=wa(e,n),ce=e.doc.scrollTop,me=e.doc.scrollLeft;if(q.scrollTop!=null&&(xn(e,q.scrollTop),Math.abs(e.doc.scrollTop-ce)>1&&(F=!0)),q.scrollLeft!=null&&(Ni(e,q.scrollLeft),Math.abs(e.doc.scrollLeft-me)>1&&(F=!0)),!F)break}return n}function Zs(e,t){var i=wa(e,t);i.scrollTop!=null&&xn(e,i.scrollTop),i.scrollLeft!=null&&Ni(e,i.scrollLeft)}function wa(e,t){var i=e.display,r=Yi(e.display);t.top<0&&(t.top=0);var n=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:i.scroller.scrollTop,C=fa(e),F={};t.bottom-t.top>C&&(t.bottom=t.top+C);var Y=e.doc.height+ca(i),Z=t.top<r,q=t.bottom>Y-r;if(t.top<n)F.scrollTop=Z?0:t.top;else if(t.bottom>n+C){var ce=Math.min(t.top,(q?Y:t.bottom)-C);ce!=n&&(F.scrollTop=ce)}var me=e.options.fixedGutter?0:i.gutters.offsetWidth,De=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:i.scroller.scrollLeft-me,we=_i(e)-i.gutters.offsetWidth,Fe=t.right-t.left>we;return Fe&&(t.right=t.left+we),t.left<10?F.scrollLeft=0:t.left<De?F.scrollLeft=Math.max(0,t.left+me-(Fe?0:10)):t.right>we+De-3&&(F.scrollLeft=t.right+(Fe?0:10)-we),F}function Aa(e,t){if(t==null)return;Yn(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function Qi(e){Yn(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function bn(e,t,i){(t!=null||i!=null)&&Yn(e),t!=null&&(e.curOp.scrollLeft=t),i!=null&&(e.curOp.scrollTop=i)}function Qs(e,t){Yn(e),e.curOp.scrollToPos=t}function Yn(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var i=co(e,t.from),r=co(e,t.to);So(e,i,r,t.margin)}}function So(e,t,i,r){var n=wa(e,{left:Math.min(t.left,i.left),top:Math.min(t.top,i.top)-r,right:Math.max(t.right,i.right),bottom:Math.max(t.bottom,i.bottom)+r});bn(e,n.scrollLeft,n.scrollTop)}function xn(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;D||ka(e,{top:t}),Co(e,t,!0),D&&ka(e),Cn(e,100)}function Co(e,t,i){if(t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),e.display.scroller.scrollTop==t&&!i)return;e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t)}function Ni(e,t,i,r){if(t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(i?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r)return;e.doc.scrollLeft=t,ko(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function En(e){var t=e.display,i=t.gutters.offsetWidth,r=Math.round(e.doc.height+ca(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?i:0,docHeight:r,scrollHeight:r+ni(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:i}}var Bi=function(e,t,i){this.cm=i;var r=this.vert=a("div",[a("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),n=this.horiz=a("div",[a("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=n.tabIndex=-1,e(r),e(n),_e(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),_e(n,"scroll",function(){n.clientWidth&&t(n.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,G&&j<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Bi.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,i=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(i){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var n=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+n)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=i?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var C=e.viewWidth-e.barLeft-(i?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+C)+"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:i?r:0,bottom:t?r:0}},Bi.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Bi.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Bi.prototype.zeroWidthHack=function(){var e=l&&!L?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new ee,this.disableVert=new ee},Bi.prototype.enableZeroWidthBar=function(e,t,i){e.style.pointerEvents="auto";function r(){var n=e.getBoundingClientRect(),C=i=="vert"?document.elementFromPoint(n.right-1,(n.top+n.bottom)/2):document.elementFromPoint((n.right+n.left)/2,n.bottom-1);C!=e?e.style.pointerEvents="none":t.set(1e3,r)}t.set(1e3,r)},Bi.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Sn=function(){};Sn.prototype.update=function(){return{bottom:0,right:0}},Sn.prototype.setScrollLeft=function(){},Sn.prototype.setScrollTop=function(){},Sn.prototype.clear=function(){};function Ji(e,t){t||(t=En(e));var i=e.display.barWidth,r=e.display.barHeight;To(e,t);for(var n=0;n<4&&i!=e.display.barWidth||r!=e.display.barHeight;n++)i!=e.display.barWidth&&e.options.lineWrapping&&Vn(e),To(e,En(e)),i=e.display.barWidth,r=e.display.barHeight}function To(e,t){var i=e.display,r=i.scrollbars.update(t);i.sizer.style.paddingRight=(i.barWidth=r.right)+"px",i.sizer.style.paddingBottom=(i.barHeight=r.bottom)+"px",i.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(i.scrollbarFiller.style.display="block",i.scrollbarFiller.style.height=r.bottom+"px",i.scrollbarFiller.style.width=r.right+"px"):i.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(i.gutterFiller.style.display="block",i.gutterFiller.style.height=r.bottom+"px",i.gutterFiller.style.width=t.gutterWidth+"px"):i.gutterFiller.style.display=""}var wo={native:Bi,null:Sn};function Ao(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&m(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new wo[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),_e(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,i){i=="horizontal"?Ni(e,t):xn(e,t)},e),e.display.scrollbars.addClass&&U(e.display.wrapper,e.display.scrollbars.addClass)}var Js=0;function Ui(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:++Js},Xr(e.curOp)}function Fi(e){var t=e.curOp;t&&Wn(t,function(i){for(var r=0;r<i.ops.length;r++)i.ops[r].cm.curOp=null;qs(i)})}function qs(e){for(var t=e.ops,i=0;i<t.length;i++)el(t[i]);for(var r=0;r<t.length;r++)tl(t[r]);for(var n=0;n<t.length;n++)rl(t[n]);for(var C=0;C<t.length;C++)il(t[C]);for(var F=0;F<t.length;F++)nl(t[F])}function el(e){var t=e.cm,i=t.display;ol(t),e.updateMaxLine&&jn(t),e.mustUpdate=e.viewChanged||e.forceUpdate||e.scrollTop!=null||e.scrollToPos&&(e.scrollToPos.from.line<i.viewFrom||e.scrollToPos.to.line>=i.viewTo)||i.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new $n(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,i=t.display;e.updatedDisplay&&Vn(t),e.barMeasure=En(t),i.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=io(t,i.maxLine,i.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(i.scroller.clientWidth,i.sizer.offsetLeft+e.adjustWidthTo+ni(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,i.sizer.offsetLeft+e.adjustWidthTo-_i(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=i.input.prepareSelection())}function il(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&Ni(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var i=e.focus&&e.focus==N();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,i),(e.updatedDisplay||e.startHeight!=t.doc.height)&&Ji(t,e.barMeasure),e.updatedDisplay&&Ra(t,e.barMeasure),e.selectionChanged&&Ca(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),i&&bo(e.cm)}function nl(e){var t=e.cm,i=t.display,r=t.doc;if(e.updatedDisplay&&Lo(t,e.update),i.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(i.wheelStartX=i.wheelStartY=null),e.scrollTop!=null&&Co(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&Ni(t,e.scrollLeft,!0,!0),e.scrollToPos){var n=$s(t,s(r,e.scrollToPos.from),s(r,e.scrollToPos.to),e.scrollToPos.margin);Ys(t,n)}var C=e.maybeHiddenMarkers,F=e.maybeUnhiddenMarkers;if(C)for(var Y=0;Y<C.length;++Y)C[Y].lines.length||Be(C[Y],"hide");if(F)for(var Z=0;Z<F.length;++Z)F[Z].lines.length&&Be(F[Z],"unhide");i.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Be(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Ir(e,t){if(e.curOp)return t();Ui(e);try{return t()}finally{Fi(e)}}function dr(e,t){return function(){if(e.curOp)return t.apply(e,arguments);Ui(e);try{return t.apply(e,arguments)}finally{Fi(e)}}}function br(e){return function(){if(this.curOp)return e.apply(this,arguments);Ui(this);try{return e.apply(this,arguments)}finally{Fi(this)}}}function hr(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);Ui(t);try{return e.apply(this,arguments)}finally{Fi(t)}}}function Cn(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,O(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var i=+new Date+e.options.workTime,r=qe(e,t.highlightFrontier),n=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(C){if(r.line>=e.display.viewFrom){var F=C.styles,Y=C.text.length>e.options.maxHighlightLength?Br(t.mode,r.state):null,Z=ve(e,C,r,!0);Y&&(r.state=Y),C.styles=Z.styles;var q=C.styleClasses,ce=Z.classes;ce?C.styleClasses=ce:q&&(C.styleClasses=null);for(var me=!F||F.length!=C.styles.length||q!=ce&&(!q||!ce||q.bgClass!=ce.bgClass||q.textClass!=ce.textClass),De=0;!me&&De<F.length;++De)me=F[De]!=C.styles[De];me&&n.push(r.line),C.stateAfter=r.save(),r.nextLine()}else C.text.length<=e.options.maxHighlightLength&&ft(e,C.text,r),C.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>i)return Cn(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),n.length&&Ir(e,function(){for(var C=0;C<n.length;C++)bi(e,n[C],"text")})}var $n=function(e,t,i){var r=e.display;this.viewport=t,this.visible=Xn(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=_i(e),this.force=i,this.dims=xa(e),this.events=[]};$n.prototype.signal=function(e,t){ge(e,t)&&this.events.push(arguments)},$n.prototype.finish=function(){for(var e=0;e<this.events.length;e++)Be.apply(null,this.events[e])};function ol(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=ni(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=ni(e)+"px",t.scrollbarsClipped=!0)}function sl(e){if(e.hasFocus())return null;var t=N();if(!t||!S(e.display.lineDiv,t))return null;var i={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&S(e.display.lineDiv,r.anchorNode)&&(i.anchorNode=r.anchorNode,i.anchorOffset=r.anchorOffset,i.focusNode=r.focusNode,i.focusOffset=r.focusOffset)}return i}function ll(e){if(!e||!e.activeElt||e.activeElt==N())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&S(document.body,e.anchorNode)&&S(document.body,e.focusNode)){var t=window.getSelection(),i=document.createRange();i.setEnd(e.anchorNode,e.anchorOffset),i.collapse(!1),t.removeAllRanges(),t.addRange(i),t.extend(e.focusNode,e.focusOffset)}}function La(e,t){var i=e.display,r=e.doc;if(t.editorIsHidden)return xi(e),!1;if(!t.force&&t.visible.from>=i.viewFrom&&t.visible.to<=i.viewTo&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo)&&i.renderedView==i.view&&go(e)==0)return!1;Do(e)&&(xi(e),t.dims=xa(e));var n=r.first+r.size,C=Math.max(t.visible.from-e.options.viewportMargin,r.first),F=Math.min(n,t.visible.to+e.options.viewportMargin);i.viewFrom<C&&C-i.viewFrom<20&&(C=Math.max(r.first,i.viewFrom)),i.viewTo>F&&i.viewTo-F<20&&(F=Math.min(n,i.viewTo)),Tr&&(C=vi(e.doc,C),F=Fn(e.doc,F));var Y=C!=i.viewFrom||F!=i.viewTo||i.lastWrapHeight!=t.wrapperHeight||i.lastWrapWidth!=t.wrapperWidth;Vs(e,C,F),i.viewOffset=Jr(mt(e.doc,i.viewFrom)),e.display.mover.style.top=i.viewOffset+"px";var Z=go(e);if(!Y&&Z==0&&!t.force&&i.renderedView==i.view&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo))return!1;var q=sl(e);return Z>4&&(i.lineDiv.style.display="none"),ul(e,i.updateLineNumbers,t.dims),Z>4&&(i.lineDiv.style.display=""),i.renderedView=i.view,ll(q),g(i.cursorDiv),g(i.selectionDiv),i.gutters.style.height=i.sizer.style.minHeight=0,Y&&(i.lastWrapHeight=t.wrapperHeight,i.lastWrapWidth=t.wrapperWidth,Cn(e,400)),i.updateLineNumbers=null,!0}function Lo(e,t){for(var i=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==_i(e)){if(i&&i.top!=null&&(i={top:Math.min(e.doc.height+ca(e.display)-fa(e),i.top)}),t.visible=Xn(e.display,e.doc,i),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=Xn(e.display,e.doc,i));if(!La(e,t))break;Vn(e);var n=En(e);yn(e),Ji(e,n),Ra(e,n),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 ka(e,t){var i=new $n(e,t);if(La(e,i)){Vn(e),Lo(e,i);var r=En(e);yn(e),Ji(e,r),Ra(e,r),i.finish()}}function ul(e,t,i){var r=e.display,n=e.options.lineNumbers,C=r.lineDiv,F=C.firstChild;function Y(Fe){var ze=Fe.nextSibling;return I&&l&&e.display.currentWheelTarget==Fe?Fe.style.display="none":Fe.parentNode.removeChild(Fe),ze}for(var Z=r.view,q=r.viewFrom,ce=0;ce<Z.length;ce++){var me=Z[ce];if(!me.hidden)if(!me.node||me.node.parentNode!=C){var De=Ns(e,me,q,i);C.insertBefore(De,F)}else{for(;F!=me.node;)F=Y(F);var we=n&&t!=null&&t<=q&&me.lineNumber;me.changes&&(oe(me.changes,"gutter")>-1&&(we=!1),Za(e,me,q,i)),we&&(g(me.lineNumber),me.lineNumber.appendChild(document.createTextNode(ui(e.options,q)))),F=me.node.nextSibling}q+=me.size}for(;F;)F=Y(F)}function Da(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+ni(e)+"px"}function ko(e){var t=e.display,i=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var r=Ea(t)-t.scroller.scrollLeft+e.doc.scrollLeft,n=t.gutters.offsetWidth,C=r+"px",F=0;F<i.length;F++)if(!i[F].hidden){e.options.fixedGutter&&(i[F].gutter&&(i[F].gutter.style.left=C),i[F].gutterBackground&&(i[F].gutterBackground.style.left=C));var Y=i[F].alignable;if(Y)for(var Z=0;Z<Y.length;Z++)Y[Z].style.left=C}e.options.fixedGutter&&(t.gutters.style.left=r+n+"px")}function Do(e){if(!e.options.lineNumbers)return!1;var t=e.doc,i=ui(e.options,t.first+t.size-1),r=e.display;if(i.length!=r.lineNumChars){var n=r.measure.appendChild(a("div",[a("div",i)],"CodeMirror-linenumber CodeMirror-gutter-elt")),C=n.firstChild.offsetWidth,F=n.offsetWidth-C;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(C,r.lineGutter.offsetWidth-F)+1,r.lineNumWidth=r.lineNumInnerWidth+F,r.lineNumChars=r.lineNumInnerWidth?i.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",Da(e.display),!0}return!1}function Oa(e,t){for(var i=[],r=!1,n=0;n<e.length;n++){var C=e[n],F=null;if(typeof C!="string"&&(F=C.style,C=C.className),C=="CodeMirror-linenumbers")if(t)r=!0;else continue;i.push({className:C,style:F})}return t&&!r&&i.push({className:"CodeMirror-linenumbers",style:null}),i}function Ro(e){var t=e.gutters,i=e.gutterSpecs;g(t),e.lineGutter=null;for(var r=0;r<i.length;++r){var n=i[r],C=n.className,F=n.style,Y=t.appendChild(a("div",null,"CodeMirror-gutter "+C));F&&(Y.style.cssText=F),C=="CodeMirror-linenumbers"&&(e.lineGutter=Y,Y.style.width=(e.lineNumWidth||1)+"px")}t.style.display=i.length?"":"none",Da(e)}function Tn(e){Ro(e.display),Lr(e),ko(e)}function dl(e,t,i,r){var n=this;this.input=i,n.scrollbarFiller=a("div",null,"CodeMirror-scrollbar-filler"),n.scrollbarFiller.setAttribute("cm-not-content","true"),n.gutterFiller=a("div",null,"CodeMirror-gutter-filler"),n.gutterFiller.setAttribute("cm-not-content","true"),n.lineDiv=E("div",null,"CodeMirror-code"),n.selectionDiv=a("div",null,null,"position: relative; z-index: 1"),n.cursorDiv=a("div",null,"CodeMirror-cursors"),n.measure=a("div",null,"CodeMirror-measure"),n.lineMeasure=a("div",null,"CodeMirror-measure"),n.lineSpace=E("div",[n.measure,n.lineMeasure,n.selectionDiv,n.cursorDiv,n.lineDiv],null,"position: relative; outline: none");var C=E("div",[n.lineSpace],"CodeMirror-lines");n.mover=a("div",[C],null,"position: relative"),n.sizer=a("div",[n.mover],"CodeMirror-sizer"),n.sizerWidth=null,n.heightForcer=a("div",null,null,"position: absolute; height: "+fe+"px; width: 1px;"),n.gutters=a("div",null,"CodeMirror-gutters"),n.lineGutter=null,n.scroller=a("div",[n.sizer,n.heightForcer,n.gutters],"CodeMirror-scroll"),n.scroller.setAttribute("tabIndex","-1"),n.wrapper=a("div",[n.scrollbarFiller,n.gutterFiller,n.scroller],"CodeMirror"),G&&j<8&&(n.gutters.style.zIndex=-1,n.scroller.style.paddingRight=0),!I&&!(D&&o)&&(n.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(n.wrapper):e(n.wrapper)),n.viewFrom=n.viewTo=t.first,n.reportedViewFrom=n.reportedViewTo=t.first,n.view=[],n.renderedView=null,n.externalMeasured=null,n.viewOffset=0,n.lastWrapHeight=n.lastWrapWidth=0,n.updateLineNumbers=null,n.nativeBarWidth=n.barHeight=n.barWidth=0,n.scrollbarsClipped=!1,n.lineNumWidth=n.lineNumInnerWidth=n.lineNumChars=null,n.alignWidgets=!1,n.cachedCharWidth=n.cachedTextHeight=n.cachedPaddingH=null,n.maxLine=null,n.maxLineLength=0,n.maxLineChanged=!1,n.wheelDX=n.wheelDY=n.wheelStartX=n.wheelStartY=null,n.shift=!1,n.selForContextMenu=null,n.activeTouch=null,n.gutterSpecs=Oa(r.gutters,r.lineNumbers),Ro(n),i.init(n)}var Zn=0,zr=null;G?zr=-.53:D?zr=15:v?zr=-.7:M&&(zr=-1/3);function Oo(e){var t=e.wheelDeltaX,i=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),i==null&&e.detail&&e.axis==e.VERTICAL_AXIS?i=e.detail:i==null&&(i=e.wheelDelta),{x:t,y:i}}function hl(e){var t=Oo(e);return t.x*=zr,t.y*=zr,t}function _o(e,t){var i=Oo(t),r=i.x,n=i.y,C=e.display,F=C.scroller,Y=F.scrollWidth>F.clientWidth,Z=F.scrollHeight>F.clientHeight;if(!(r&&Y||n&&Z))return;if(n&&l&&I){e:for(var q=t.target,ce=C.view;q!=F;q=q.parentNode)for(var me=0;me<ce.length;me++)if(ce[me].node==q){e.display.currentWheelTarget=q;break e}}if(r&&!D&&!A&&zr!=null){n&&Z&&xn(e,Math.max(0,F.scrollTop+n*zr)),Ni(e,Math.max(0,F.scrollLeft+r*zr)),(!n||n&&Z)&&re(t),C.wheelStartX=null;return}if(n&&zr!=null){var De=n*zr,we=e.doc.scrollTop,Fe=we+C.wrapper.clientHeight;De<0?we=Math.max(0,we+De-50):Fe=Math.min(e.doc.height,Fe+De+50),ka(e,{top:we,bottom:Fe})}Zn<20&&(C.wheelStartX==null?(C.wheelStartX=F.scrollLeft,C.wheelStartY=F.scrollTop,C.wheelDX=r,C.wheelDY=n,setTimeout(function(){if(C.wheelStartX==null)return;var ze=F.scrollLeft-C.wheelStartX,$e=F.scrollTop-C.wheelStartY,it=$e&&C.wheelDY&&$e/C.wheelDY||ze&&C.wheelDX&&ze/C.wheelDX;if(C.wheelStartX=C.wheelStartY=null,!it)return;zr=(zr*Zn+it)/(Zn+1),++Zn},200)):(C.wheelDX+=r,C.wheelDY+=n))}var Kr=function(e,t){this.ranges=e,this.primIndex=t};Kr.prototype.primary=function(){return this.ranges[this.primIndex]},Kr.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 i=this.ranges[t],r=e.ranges[t];if(!di(i.anchor,r.anchor)||!di(i.head,r.head))return!1}return!0},Kr.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new Gt(Li(this.ranges[t].anchor),Li(this.ranges[t].head));return new Kr(e,this.primIndex)},Kr.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},Kr.prototype.contains=function(e,t){t||(t=e);for(var i=0;i<this.ranges.length;i++){var r=this.ranges[i];if(wt(t,r.from())>=0&&wt(e,r.to())<=0)return i}return-1};var Gt=function(e,t){this.anchor=e,this.head=t};Gt.prototype.from=function(){return ki(this.anchor,this.head)},Gt.prototype.to=function(){return hi(this.anchor,this.head)},Gt.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function ei(e,t,i){var r=e&&e.options.selectionsMayTouch,n=t[i];t.sort(function(De,we){return wt(De.from(),we.from())}),i=oe(t,n);for(var C=1;C<t.length;C++){var F=t[C],Y=t[C-1],Z=wt(Y.to(),F.from());if(r&&!F.empty()?Z>0:Z>=0){var q=ki(Y.from(),F.from()),ce=hi(Y.to(),F.to()),me=Y.empty()?F.from()==F.head:Y.from()==Y.head;C<=i&&--i,t.splice(--C,2,new Gt(me?ce:q,me?q:ce))}}return new Kr(t,i)}function Ei(e,t){return new Kr([new Gt(e,t||e)],0)}function Si(e){return e.text?Ve(e.from.line+e.text.length-1,te(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Mo(e,t){if(wt(e,t.from)<0)return e;if(wt(e,t.to)<=0)return Si(t);var i=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=Si(t).ch-t.to.ch),Ve(i,r)}function _a(e,t){for(var i=[],r=0;r<e.sel.ranges.length;r++){var n=e.sel.ranges[r];i.push(new Gt(Mo(n.anchor,t),Mo(n.head,t)))}return ei(e.cm,i,e.sel.primIndex)}function Po(e,t,i){return e.line==t.line?Ve(i.line,e.ch-t.ch+i.ch):Ve(i.line+(e.line-t.line),e.ch)}function cl(e,t,i){for(var r=[],n=Ve(e.first,0),C=n,F=0;F<t.length;F++){var Y=t[F],Z=Po(Y.from,n,C),q=Po(Si(Y),n,C);if(n=Y.to,C=q,i=="around"){var ce=e.sel.ranges[F],me=wt(ce.head,ce.anchor)<0;r[F]=new Gt(me?q:Z,me?Z:q)}else r[F]=new Gt(Z,Z)}return new Kr(r,e.sel.primIndex)}function Ma(e){e.doc.mode=Yt(e.options,e.doc.modeOption),wn(e)}function wn(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,Cn(e,100),e.state.modeGen++,e.curOp&&Lr(e)}function Io(e,t){return t.from.ch==0&&t.to.ch==0&&te(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Pa(e,t,i,r){function n(ut){return i?i[ut]:null}function C(ut,nt,pt){$a(ut,nt,pt,r),mr(ut,"change",ut,t)}function F(ut,nt){for(var pt=[],St=ut;St<nt;++St)pt.push(new Oi(q[St],n(St),r));return pt}var Y=t.from,Z=t.to,q=t.text,ce=mt(e,Y.line),me=mt(e,Z.line),De=te(q),we=n(q.length-1),Fe=Z.line-Y.line;if(t.full)e.insert(0,F(0,q.length)),e.remove(q.length,e.size-q.length);else if(Io(e,t)){var ze=F(0,q.length-1);C(me,me.text,we),Fe&&e.remove(Y.line,Fe),ze.length&&e.insert(Y.line,ze)}else if(ce==me)if(q.length==1)C(ce,ce.text.slice(0,Y.ch)+De+ce.text.slice(Z.ch),we);else{var $e=F(1,q.length-1);$e.push(new Oi(De+ce.text.slice(Z.ch),we,r)),C(ce,ce.text.slice(0,Y.ch)+q[0],n(0)),e.insert(Y.line+1,$e)}else if(q.length==1)C(ce,ce.text.slice(0,Y.ch)+q[0]+me.text.slice(Z.ch),n(0)),e.remove(Y.line+1,Fe);else{C(ce,ce.text.slice(0,Y.ch)+q[0],n(0)),C(me,De+me.text.slice(Z.ch),we);var it=F(1,q.length-1);Fe>1&&e.remove(Y.line+1,Fe-1),e.insert(Y.line+1,it)}mr(e,"change",e,t)}function Ci(e,t,i){function r(n,C,F){if(n.linked)for(var Y=0;Y<n.linked.length;++Y){var Z=n.linked[Y];if(Z.doc==C)continue;var q=F&&Z.sharedHist;if(i&&!q)continue;t(Z.doc,q),r(Z.doc,n,q)}}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,Sa(e),Ma(e),Bo(e),e.options.lineWrapping||jn(e),e.options.mode=t.modeOption,Lr(e)}function Bo(e){(e.doc.direction=="rtl"?U:m)(e.display.lineDiv,"CodeMirror-rtl")}function fl(e){Ir(e,function(){Bo(e),Lr(e)})}function Qn(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 i={from:Li(t.from),to:Si(t),text:Ur(e,t.from,t.to)};return jo(e,i,t.from.line,t.to.line+1),Ci(e,function(r){return jo(r,i,t.from.line,t.to.line+1)},!0),i}function Uo(e){for(;e.length;){var t=te(e);if(t.ranges)e.pop();else break}}function pl(e,t){if(t)return Uo(e.done),te(e.done);if(e.done.length&&!te(e.done).ranges)return te(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),te(e.done)}function Fo(e,t,i,r){var n=e.history;n.undone.length=0;var C=+new Date,F,Y;if((n.lastOp==r||n.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&n.lastModTime>C-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(F=pl(n,n.lastOp==r)))Y=te(F.changes),wt(t.from,t.to)==0&&wt(t.from,Y.to)==0?Y.to=Si(t):F.changes.push(Ia(e,t));else{var Z=te(n.done);for((!Z||!Z.ranges)&&Jn(e.sel,n.done),F={changes:[Ia(e,t)],generation:n.generation},n.done.push(F);n.done.length>n.undoDepth;)n.done.shift(),n.done[0].ranges||n.done.shift()}n.done.push(i),n.generation=++n.maxGeneration,n.lastModTime=n.lastSelTime=C,n.lastOp=n.lastSelOp=r,n.lastOrigin=n.lastSelOrigin=t.origin,Y||Be(e,"historyAdded")}function ml(e,t,i,r){var n=t.charAt(0);return n=="*"||n=="+"&&i.ranges.length==r.ranges.length&&i.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function gl(e,t,i,r){var n=e.history,C=r&&r.origin;i==n.lastSelOp||C&&n.lastSelOrigin==C&&(n.lastModTime==n.lastSelTime&&n.lastOrigin==C||ml(e,C,te(n.done),t))?n.done[n.done.length-1]=t:Jn(t,n.done),n.lastSelTime=+new Date,n.lastSelOrigin=C,n.lastSelOp=i,r&&r.clearRedo!==!1&&Uo(n.undone)}function Jn(e,t){var i=te(t);i&&i.ranges&&i.equals(e)||t.push(e)}function jo(e,t,i,r){var n=t["spans_"+e.id],C=0;e.iter(Math.max(e.first,i),Math.min(e.first+e.size,r),function(F){F.markedSpans&&((n||(n=t["spans_"+e.id]={}))[C]=F.markedSpans),++C})}function vl(e){if(!e)return null;for(var t,i=0;i<e.length;++i)e[i].marker.explicitlyCleared?t||(t=e.slice(0,i)):t&&t.push(e[i]);return t?t.length?t:null:e}function yl(e,t){var i=t["spans_"+e.id];if(!i)return null;for(var r=[],n=0;n<t.text.length;++n)r.push(vl(i[n]));return r}function Wo(e,t){var i=yl(e,t),r=Qr(e,t);if(!i)return r;if(!r)return i;for(var n=0;n<i.length;++n){var C=i[n],F=r[n];if(C&&F){e:for(var Y=0;Y<F.length;++Y){for(var Z=F[Y],q=0;q<C.length;++q)if(C[q].marker==Z.marker)continue e;C.push(Z)}}else F&&(i[n]=F)}return i}function qi(e,t,i){for(var r=[],n=0;n<e.length;++n){var C=e[n];if(C.ranges){r.push(i?Kr.prototype.deepCopy.call(C):C);continue}var F=C.changes,Y=[];r.push({changes:Y});for(var Z=0;Z<F.length;++Z){var q=F[Z],ce=void 0;if(Y.push({from:q.from,to:q.to,text:q.text}),t)for(var me in q)(ce=me.match(/^spans_(\d+)$/))&&(oe(t,Number(ce[1]))>-1&&(te(Y)[me]=q[me],delete q[me]))}}return r}function Na(e,t,i,r){if(r){var n=e.anchor;if(i){var C=wt(t,n)<0;C!=wt(i,n)<0?(n=t,t=i):C!=wt(t,i)<0&&(t=i)}return new Gt(n,t)}else return new Gt(i||t,t)}function qn(e,t,i,r,n){n==null&&(n=e.cm&&(e.cm.display.shift||e.extend)),vr(e,new Kr([Na(e.sel.primary(),t,i,n)],0),r)}function Ho(e,t,i){for(var r=[],n=e.cm&&(e.cm.display.shift||e.extend),C=0;C<e.sel.ranges.length;C++)r[C]=Na(e.sel.ranges[C],t[C],null,n);var F=ei(e.cm,r,e.sel.primIndex);vr(e,F,i)}function Ba(e,t,i,r){var n=e.sel.ranges.slice(0);n[t]=i,vr(e,ei(e.cm,n,e.sel.primIndex),r)}function Go(e,t,i,r){vr(e,Ei(t,i),r)}function bl(e,t,i){var r={ranges:t.ranges,update:function(n){this.ranges=[];for(var C=0;C<n.length;C++)this.ranges[C]=new Gt(s(e,n[C].anchor),s(e,n[C].head))},origin:i&&i.origin};return Be(e,"beforeSelectionChange",e,r),e.cm&&Be(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?ei(e.cm,r.ranges,r.ranges.length-1):t}function zo(e,t,i){var r=e.history.done,n=te(r);n&&n.ranges?(r[r.length-1]=t,ea(e,t,i)):vr(e,t,i)}function vr(e,t,i){ea(e,t,i),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,i)}function ea(e,t,i){(ge(e,"beforeSelectionChange")||e.cm&&ge(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,i));var r=i&&i.bias||(wt(t.primary().head,e.sel.primary().head)<0?-1:1);Ko(e,Xo(e,t,r,!0)),!(i&&i.scroll===!1)&&e.cm&&Qi(e.cm)}function Ko(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,Ee(e.cm)),mr(e,"cursorActivity",e)}function Vo(e){Ko(e,Xo(e,e.sel,null,!1))}function Xo(e,t,i,r){for(var n,C=0;C<t.ranges.length;C++){var F=t.ranges[C],Y=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[C],Z=ta(e,F.anchor,Y&&Y.anchor,i,r),q=ta(e,F.head,Y&&Y.head,i,r);(n||Z!=F.anchor||q!=F.head)&&(n||(n=t.ranges.slice(0,C)),n[C]=new Gt(Z,q))}return n?ei(e.cm,n,t.primIndex):t}function en(e,t,i,r,n){var C=mt(e,t.line);if(C.markedSpans)for(var F=0;F<C.markedSpans.length;++F){var Y=C.markedSpans[F],Z=Y.marker,q="selectLeft"in Z?!Z.selectLeft:Z.inclusiveLeft,ce="selectRight"in Z?!Z.selectRight:Z.inclusiveRight;if((Y.from==null||(q?Y.from<=t.ch:Y.from<t.ch))&&(Y.to==null||(ce?Y.to>=t.ch:Y.to>t.ch))){if(n&&(Be(Z,"beforeCursorEnter"),Z.explicitlyCleared))if(C.markedSpans){--F;continue}else break;if(!Z.atomic)continue;if(i){var me=Z.find(r<0?1:-1),De=void 0;if((r<0?ce:q)&&(me=Yo(e,me,-r,me&&me.line==t.line?C:null)),me&&me.line==t.line&&(De=wt(me,i))&&(r<0?De<0:De>0))return en(e,me,t,r,n)}var we=Z.find(r<0?-1:1);return(r<0?q:ce)&&(we=Yo(e,we,r,we.line==t.line?C:null)),we?en(e,we,t,r,n):null}}return t}function ta(e,t,i,r,n){var C=r||1,F=en(e,t,i,C,n)||!n&&en(e,t,i,C,!0)||en(e,t,i,-C,n)||!n&&en(e,t,i,-C,!0);return F||(e.cantEdit=!0,Ve(e.first,0))}function Yo(e,t,i,r){return i<0&&t.ch==0?t.line>e.first?s(e,Ve(t.line-1)):null:i>0&&t.ch==(r||mt(e,t.line)).text.length?t.line<e.first+e.size-1?Ve(t.line+1,0):null:new Ve(t.line,t.ch+i)}function $o(e){e.setSelection(Ve(e.firstLine(),0),Ve(e.lastLine()),Ce)}function Zo(e,t,i){var r={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return r.canceled=!0}};return i&&(r.update=function(n,C,F,Y){n&&(r.from=s(e,n)),C&&(r.to=s(e,C)),F&&(r.text=F),Y!==void 0&&(r.origin=Y)}),Be(e,"beforeChange",e,r),e.cm&&Be(e.cm,"beforeChange",e.cm,r),r.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:r.from,to:r.to,text:r.text,origin:r.origin}}function tn(e,t,i){if(e.cm){if(!e.cm.curOp)return dr(e.cm,tn)(e,t,i);if(e.cm.state.suppressEdits)return}if((ge(e,"beforeChange")||e.cm&&ge(e.cm,"beforeChange"))&&(t=Zo(e,t,!0),!t))return;var r=Hi&&!i&&Di(e,t.from,t.to);if(r)for(var n=r.length-1;n>=0;--n)Qo(e,{from:r[n].from,to:r[n].to,text:n?[""]:t.text,origin:t.origin});else Qo(e,t)}function Qo(e,t){if(t.text.length==1&&t.text[0]==""&&wt(t.from,t.to)==0)return;var i=_a(e,t);Fo(e,t,i,e.cm?e.cm.curOp.id:NaN),An(e,t,i,Qr(e,t));var r=[];Ci(e,function(n,C){!C&&oe(r,n.history)==-1&&(ts(n.history,t),r.push(n.history)),An(n,t,null,Qr(n,t))})}function ra(e,t,i){var r=e.cm&&e.cm.state.suppressEdits;if(r&&!i)return;for(var n=e.history,C,F=e.sel,Y=t=="undo"?n.done:n.undone,Z=t=="undo"?n.undone:n.done,q=0;q<Y.length&&!(C=Y[q],i?C.ranges&&!C.equals(e.sel):!C.ranges);q++);if(q==Y.length)return;for(n.lastOrigin=n.lastSelOrigin=null;;)if(C=Y.pop(),C.ranges){if(Jn(C,Z),i&&!C.equals(e.sel)){vr(e,C,{clearRedo:!1});return}F=C}else if(r){Y.push(C);return}else break;var ce=[];Jn(F,Z),Z.push({changes:ce,generation:n.generation}),n.generation=C.generation||++n.maxGeneration;for(var me=ge(e,"beforeChange")||e.cm&&ge(e.cm,"beforeChange"),De=function(ze){var $e=C.changes[ze];if($e.origin=t,me&&!Zo(e,$e,!1))return Y.length=0,{};ce.push(Ia(e,$e));var it=ze?_a(e,$e):te(Y);An(e,$e,it,Wo(e,$e)),!ze&&e.cm&&e.cm.scrollIntoView({from:$e.from,to:Si($e)});var ut=[];Ci(e,function(nt,pt){!pt&&oe(ut,nt.history)==-1&&(ts(nt.history,$e),ut.push(nt.history)),An(nt,$e,null,Wo(nt,$e))})},we=C.changes.length-1;we>=0;--we){var Fe=De(we);if(Fe)return Fe.v}}function Jo(e,t){if(t==0)return;if(e.first+=t,e.sel=new Kr(ue(e.sel.ranges,function(n){return new Gt(Ve(n.anchor.line+t,n.anchor.ch),Ve(n.head.line+t,n.head.ch))}),e.sel.primIndex),e.cm){Lr(e.cm,e.first,e.first-t,t);for(var i=e.cm.display,r=i.viewFrom;r<i.viewTo;r++)bi(e.cm,r,"gutter")}}function An(e,t,i,r){if(e.cm&&!e.cm.curOp)return dr(e.cm,An)(e,t,i,r);if(t.to.line<e.first){Jo(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 n=t.text.length-1-(e.first-t.from.line);Jo(e,n),t={from:Ve(e.first,0),to:Ve(t.to.line+n,t.to.ch),text:[te(t.text)],origin:t.origin}}var C=e.lastLine();t.to.line>C&&(t={from:t.from,to:Ve(C,mt(e,C).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Ur(e,t.from,t.to),i||(i=_a(e,t)),e.cm?xl(e.cm,t,r):Pa(e,t,r),ea(e,i,Ce),e.cantEdit&&ta(e,Ve(e.firstLine(),0))&&(e.cantEdit=!1)}function xl(e,t,i){var r=e.doc,n=e.display,C=t.from,F=t.to,Y=!1,Z=C.line;e.options.lineWrapping||(Z=Ot(wr(mt(r,C.line))),r.iter(Z,F.line+1,function(we){if(we==n.maxLine)return Y=!0,!0})),r.sel.contains(t.from,t.to)>-1&&Ee(e),Pa(r,t,i,mo(e)),e.options.lineWrapping||(r.iter(Z,C.line+t.text.length,function(we){var Fe=Vi(we);Fe>n.maxLineLength&&(n.maxLine=we,n.maxLineLength=Fe,n.maxLineChanged=!0,Y=!1)}),Y&&(e.curOp.updateMaxLine=!0)),Vr(r,C.line),Cn(e,400);var q=t.text.length-(F.line-C.line)-1;t.full?Lr(e):C.line==F.line&&t.text.length==1&&!Io(e.doc,t)?bi(e,C.line,"text"):Lr(e,C.line,F.line+1,q);var ce=ge(e,"changes"),me=ge(e,"change");if(me||ce){var De={from:C,to:F,text:t.text,removed:t.removed,origin:t.origin};me&&mr(e,"change",e,De),ce&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(De)}e.display.selForContextMenu=null}function rn(e,t,i,r,n){var C;r||(r=i),wt(r,i)<0&&(C=[r,i],i=C[0],r=C[1]),typeof t=="string"&&(t=e.splitLines(t)),tn(e,{from:i,to:r,text:t,origin:n})}function qo(e,t,i,r){i<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function es(e,t,i,r){for(var n=0;n<e.length;++n){var C=e[n],F=!0;if(C.ranges){C.copied||(C=e[n]=C.deepCopy(),C.copied=!0);for(var Y=0;Y<C.ranges.length;Y++)qo(C.ranges[Y].anchor,t,i,r),qo(C.ranges[Y].head,t,i,r);continue}for(var Z=0;Z<C.changes.length;++Z){var q=C.changes[Z];if(i<q.from.line)q.from=Ve(q.from.line+r,q.from.ch),q.to=Ve(q.to.line+r,q.to.ch);else if(t<=q.to.line){F=!1;break}}F||(e.splice(0,n+1),n=0)}}function ts(e,t){var i=t.from.line,r=t.to.line,n=t.text.length-(r-i)-1;es(e.done,i,r,n),es(e.undone,i,r,n)}function Ln(e,t,i,r){var n=t,C=t;return typeof t=="number"?C=mt(e,z(e,t)):n=Ot(t),n==null?null:(r(C,n)&&e.cm&&bi(e.cm,n,i),C)}function kn(e){this.lines=e,this.parent=null;for(var t=0,i=0;i<e.length;++i)e[i].parent=this,t+=e[i].height;this.height=t}kn.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var i=e,r=e+t;i<r;++i){var n=this.lines[i];this.height-=n.height,da(n),mr(n,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,i){this.height+=i,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,i){for(var r=e+t;e<r;++e)if(i(this.lines[e]))return!0}};function Dn(e){this.children=e;for(var t=0,i=0,r=0;r<e.length;++r){var n=e[r];t+=n.chunkSize(),i+=n.height,n.parent=this}this.size=t,this.height=i,this.parent=null}Dn.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var i=0;i<this.children.length;++i){var r=this.children[i],n=r.chunkSize();if(e<n){var C=Math.min(t,n-e),F=r.height;if(r.removeInner(e,C),this.height-=F-r.height,n==C&&(this.children.splice(i--,1),r.parent=null),(t-=C)==0)break;e=0}else e-=n}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof kn))){var Y=[];this.collapse(Y),this.children=[new kn(Y)],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,i){this.size+=t.length,this.height+=i;for(var r=0;r<this.children.length;++r){var n=this.children[r],C=n.chunkSize();if(e<=C){if(n.insertInner(e,t,i),n.lines&&n.lines.length>50){for(var F=n.lines.length%25+25,Y=F;Y<n.lines.length;){var Z=new kn(n.lines.slice(Y,Y+=25));n.height-=Z.height,this.children.splice(++r,0,Z),Z.parent=this}n.lines=n.lines.slice(0,F),this.maybeSpill()}break}e-=C}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),i=new Dn(t);if(e.parent){e.size-=i.size,e.height-=i.height;var n=oe(e.parent.children,e);e.parent.children.splice(n+1,0,i)}else{var r=new Dn(e.children);r.parent=e,e.children=[r,i],e=r}i.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()},iterN:function(e,t,i){for(var r=0;r<this.children.length;++r){var n=this.children[r],C=n.chunkSize();if(e<C){var F=Math.min(t,C-e);if(n.iterN(e,F,i))return!0;if((t-=F)==0)break;e=0}else e-=C}}};var Rn=function(e,t,i){if(i)for(var r in i)i.hasOwnProperty(r)&&(this[r]=i[r]);this.doc=e,this.node=t};Rn.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,i=this.line,r=Ot(i);if(r==null||!t)return;for(var n=0;n<t.length;++n)t[n]==this&&t.splice(n--,1);t.length||(i.widgets=null);var C=gn(this);Cr(i,Math.max(0,i.height-C)),e&&(Ir(e,function(){rs(e,i,-C),bi(e,r,"widget")}),mr(e,"lineWidgetCleared",e,this,r))},Rn.prototype.changed=function(){var e=this,t=this.height,i=this.doc.cm,r=this.line;this.height=null;var n=gn(this)-t;if(!n)return;Pr(this.doc,r)||Cr(r,r.height+n),i&&Ir(i,function(){i.curOp.forceUpdate=!0,rs(i,r,n),mr(i,"lineWidgetChanged",i,e,Ot(r))})},ye(Rn);function rs(e,t,i){Jr(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Aa(e,i)}function El(e,t,i,r){var n=new Rn(e,i,r),C=e.cm;return C&&n.noHScroll&&(C.display.alignWidgets=!0),Ln(e,t,"widget",function(F){var Y=F.widgets||(F.widgets=[]);if(n.insertAt==null?Y.push(n):Y.splice(Math.min(Y.length-1,Math.max(0,n.insertAt)),0,n),n.line=F,C&&!Pr(e,F)){var Z=Jr(F)<e.scrollTop;Cr(F,F.height+gn(n)),Z&&Aa(C,n.height),C.curOp.forceUpdate=!0}return!0}),C&&mr(C,"lineWidgetAdded",C,n,typeof t=="number"?t:Ot(t)),n}var is=0,Ti=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++is};Ti.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&Ui(e),ge(this,"clear")){var i=this.find();i&&mr(this,"clear",i.from,i.to)}for(var r=null,n=null,C=0;C<this.lines.length;++C){var F=this.lines[C],Y=Zr(F.markedSpans,this);e&&!this.collapsed?bi(e,Ot(F),"text"):e&&(Y.to!=null&&(n=Ot(F)),Y.from!=null&&(r=Ot(F))),F.markedSpans=ci(F.markedSpans,Y),Y.from==null&&this.collapsed&&!Pr(this.doc,F)&&e&&Cr(F,Yi(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var Z=0;Z<this.lines.length;++Z){var q=wr(this.lines[Z]),ce=Vi(q);ce>e.display.maxLineLength&&(e.display.maxLine=q,e.display.maxLineLength=ce,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&Lr(e,r,n+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Vo(e.doc)),e&&mr(e,"markerCleared",e,this,r,n),t&&Fi(e),this.parent&&this.parent.clear()},Ti.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var i,r,n=0;n<this.lines.length;++n){var C=this.lines[n],F=Zr(C.markedSpans,this);if(F.from!=null&&(i=Ve(t?C:Ot(C),F.from),e==-1))return i;if(F.to!=null&&(r=Ve(t?C:Ot(C),F.to),e==1))return r}return i&&{from:i,to:r}},Ti.prototype.changed=function(){var e=this,t=this.find(-1,!0),i=this,r=this.doc.cm;if(!t||!r)return;Ir(r,function(){var n=t.line,C=Ot(t.line),F=pa(r,C);if(F&&(oo(F),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!Pr(i.doc,n)&&i.height!=null){var Y=i.height;i.height=null;var Z=gn(i)-Y;Z&&Cr(n,n.height+Z)}mr(r,"markerChanged",r,e)})},Ti.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||oe(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Ti.prototype.detachLine=function(e){if(this.lines.splice(oe(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},ye(Ti);function nn(e,t,i,r,n){if(r&&r.shared)return Sl(e,t,i,r,n);if(e.cm&&!e.cm.curOp)return dr(e.cm,nn)(e,t,i,r,n);var C=new Ti(e,n),F=wt(t,i);if(r&&P(r,C,!1),F>0||F==0&&C.clearWhenEmpty!==!1)return C;if(C.replacedWith&&(C.collapsed=!0,C.widgetNode=E("span",[C.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||C.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(C.widgetNode.insertLeft=!0)),C.collapsed){if(er(e,t.line,t,i,C)||t.line!=i.line&&er(e,i.line,t,i,C))throw new Error("Inserting collapsed marker partially overlapping an existing one");Mr()}C.addToHistory&&Fo(e,{from:t,to:i,origin:"markText"},e.sel,NaN);var Y=t.line,Z=e.cm,q;if(e.iter(Y,i.line+1,function(me){Z&&C.collapsed&&!Z.options.lineWrapping&&wr(me)==Z.display.maxLine&&(q=!0),C.collapsed&&Y!=t.line&&Cr(me,0),ri(me,new gi(C,Y==t.line?t.ch:null,Y==i.line?i.ch:null)),++Y}),C.collapsed&&e.iter(t.line,i.line+1,function(me){Pr(e,me)&&Cr(me,0)}),C.clearOnEnter&&_e(C,"beforeCursorEnter",function(){return C.clear()}),C.readOnly&&(Hr(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),C.collapsed&&(C.id=++is,C.atomic=!0),Z){if(q&&(Z.curOp.updateMaxLine=!0),C.collapsed)Lr(Z,t.line,i.line+1);else if(C.className||C.startStyle||C.endStyle||C.css||C.attributes||C.title)for(var ce=t.line;ce<=i.line;ce++)bi(Z,ce,"text");C.atomic&&Vo(Z.doc),mr(Z,"markerAdded",Z,C)}return C}var On=function(e,t){this.markers=e,this.primary=t;for(var i=0;i<e.length;++i)e[i].parent=this};On.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();mr(this,"clear")},On.prototype.find=function(e,t){return this.primary.find(e,t)},ye(On);function Sl(e,t,i,r,n){r=P(r),r.shared=!1;var C=[nn(e,t,i,r,n)],F=C[0],Y=r.widgetNode;return Ci(e,function(Z){Y&&(r.widgetNode=Y.cloneNode(!0)),C.push(nn(Z,s(Z,t),s(Z,i),r,n));for(var q=0;q<Z.linked.length;++q)if(Z.linked[q].isParent)return;F=te(C)}),new On(C,F)}function ns(e){return e.findMarks(Ve(e.first,0),e.clipPos(Ve(e.lastLine())),function(t){return t.parent})}function Cl(e,t){for(var i=0;i<t.length;i++){var r=t[i],n=r.find(),C=e.clipPos(n.from),F=e.clipPos(n.to);if(wt(C,F)){var Y=nn(e,C,F,r.primary,r.primary.type);r.markers.push(Y),Y.parent=r}}}function Tl(e){for(var t=function(r){var n=e[r],C=[n.primary.doc];Ci(n.primary.doc,function(Z){return C.push(Z)});for(var F=0;F<n.markers.length;F++){var Y=n.markers[F];oe(C,Y.doc)==-1&&(Y.parent=null,n.markers.splice(F--,1))}},i=0;i<e.length;i++)t(i)}var wl=0,kr=function(e,t,i,r,n){if(!(this instanceof kr))return new kr(e,t,i,r,n);i==null&&(i=0),Dn.call(this,[new kn([new Oi("",null)])]),this.first=i,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=i;var C=Ve(i,0);this.sel=Ei(C),this.history=new Qn(null),this.id=++wl,this.modeOption=t,this.lineSep=r,this.direction=n=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),Pa(this,{from:C,to:C,text:e}),vr(this,Ei(C),Ce)};kr.prototype=Re(Dn.prototype,{constructor:kr,iter:function(e,t,i){i?this.iterN(e-this.first,t-e,i):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var i=0,r=0;r<t.length;++r)i+=t[r].height;this.insertInner(e-this.first,t,i)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=li(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:hr(function(e){var t=Ve(this.first,0),i=this.first+this.size-1;tn(this,{from:t,to:Ve(i,mt(this,i).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&bn(this.cm,0,0),vr(this,Ei(t),Ce)}),replaceRange:function(e,t,i,r){t=s(this,t),i=i?s(this,i):t,rn(this,e,t,i,r)},getRange:function(e,t,i){var r=Ur(this,s(this,e),s(this,t));return i===!1?r:r.join(i||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if($r(this,e))return mt(this,e)},getLineNumber:function(e){return Ot(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=mt(this,e)),wr(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return s(this,e)},getCursor:function(e){var t=this.sel.primary(),i;return e==null||e=="head"?i=t.head:e=="anchor"?i=t.anchor:e=="end"||e=="to"||e===!1?i=t.to():i=t.from(),i},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:hr(function(e,t,i){Go(this,s(this,typeof e=="number"?Ve(e,t||0):e),null,i)}),setSelection:hr(function(e,t,i){Go(this,s(this,e),s(this,t||e),i)}),extendSelection:hr(function(e,t,i){qn(this,s(this,e),t&&s(this,t),i)}),extendSelections:hr(function(e,t){Ho(this,W(this,e),t)}),extendSelectionsBy:hr(function(e,t){var i=ue(this.sel.ranges,e);Ho(this,W(this,i),t)}),setSelections:hr(function(e,t,i){if(!e.length)return;for(var r=[],n=0;n<e.length;n++)r[n]=new Gt(s(this,e[n].anchor),s(this,e[n].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),vr(this,ei(this.cm,r,t),i)}),addSelection:hr(function(e,t,i){var r=this.sel.ranges.slice(0);r.push(new Gt(s(this,e),s(this,t||e))),vr(this,ei(this.cm,r,r.length-1),i)}),getSelection:function(e){for(var t=this.sel.ranges,i,r=0;r<t.length;r++){var n=Ur(this,t[r].from(),t[r].to());i=i?i.concat(n):n}return e===!1?i:i.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],i=this.sel.ranges,r=0;r<i.length;r++){var n=Ur(this,i[r].from(),i[r].to());e!==!1&&(n=n.join(e||this.lineSeparator())),t[r]=n}return t},replaceSelection:function(e,t,i){for(var r=[],n=0;n<this.sel.ranges.length;n++)r[n]=e;this.replaceSelections(r,t,i||"+input")},replaceSelections:hr(function(e,t,i){for(var r=[],n=this.sel,C=0;C<n.ranges.length;C++){var F=n.ranges[C];r[C]={from:F.from(),to:F.to(),text:this.splitLines(e[C]),origin:i}}for(var Y=t&&t!="end"&&cl(this,r,t),Z=r.length-1;Z>=0;Z--)tn(this,r[Z]);Y?zo(this,Y):this.cm&&Qi(this.cm)}),undo:hr(function(){ra(this,"undo")}),redo:hr(function(){ra(this,"redo")}),undoSelection:hr(function(){ra(this,"undo",!0)}),redoSelection:hr(function(){ra(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,i=0,r=0;r<e.done.length;r++)e.done[r].ranges||++t;for(var n=0;n<e.undone.length;n++)e.undone[n].ranges||++i;return{undo:t,redo:i}},clearHistory:function(){var e=this;this.history=new Qn(this.history.maxGeneration),Ci(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:qi(this.history.done),undone:qi(this.history.undone)}},setHistory:function(e){var t=this.history=new Qn(this.history.maxGeneration);t.done=qi(e.done.slice(0),null,!0),t.undone=qi(e.undone.slice(0),null,!0)},setGutterMarker:hr(function(e,t,i){return Ln(this,e,"gutter",function(r){var n=r.gutterMarkers||(r.gutterMarkers={});return n[t]=i,!i&&je(n)&&(r.gutterMarkers=null),!0})}),clearGutter:hr(function(e){var t=this;this.iter(function(i){i.gutterMarkers&&i.gutterMarkers[e]&&Ln(t,i,"gutter",function(){return i.gutterMarkers[e]=null,je(i.gutterMarkers)&&(i.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!$r(this,e))return null;if(t=e,e=mt(this,e),!e)return null}else if(t=Ot(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:hr(function(e,t,i){return Ln(this,e,t=="gutter"?"gutter":"class",function(r){var n=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!r[n])r[n]=i;else{if(x(i).test(r[n]))return!1;r[n]+=" "+i}return!0})}),removeLineClass:hr(function(e,t,i){return Ln(this,e,t=="gutter"?"gutter":"class",function(r){var n=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",C=r[n];if(C)if(i==null)r[n]=null;else{var F=C.match(x(i));if(!F)return!1;var Y=F.index+F[0].length;r[n]=C.slice(0,F.index)+(!F.index||Y==C.length?"":" ")+C.slice(Y)||null}else return!1;return!0})}),addLineWidget:hr(function(e,t,i){return El(this,e,t,i)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,i){return nn(this,s(this,e),s(this,t),i,i&&i.type||"range")},setBookmark:function(e,t){var i={replacedWith:t&&(t.nodeType==null?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=s(this,e),nn(this,e,e,i,"bookmark")},findMarksAt:function(e){e=s(this,e);var t=[],i=mt(this,e.line).markedSpans;if(i)for(var r=0;r<i.length;++r){var n=i[r];(n.from==null||n.from<=e.ch)&&(n.to==null||n.to>=e.ch)&&t.push(n.marker.parent||n.marker)}return t},findMarks:function(e,t,i){e=s(this,e),t=s(this,t);var r=[],n=e.line;return this.iter(e.line,t.line+1,function(C){var F=C.markedSpans;if(F)for(var Y=0;Y<F.length;Y++){var Z=F[Y];!(Z.to!=null&&n==e.line&&e.ch>=Z.to||Z.from==null&&n!=e.line||Z.from!=null&&n==t.line&&Z.from>=t.ch)&&(!i||i(Z.marker))&&r.push(Z.marker.parent||Z.marker)}++n}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var i=t.markedSpans;if(i)for(var r=0;r<i.length;++r)i[r].from!=null&&e.push(i[r].marker)}),e},posFromIndex:function(e){var t,i=this.first,r=this.lineSeparator().length;return this.iter(function(n){var C=n.text.length+r;if(C>e)return t=e,!0;e-=C,++i}),s(this,Ve(i,t))},indexFromPos:function(e){e=s(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var i=this.lineSeparator().length;return this.iter(this.first,e.line,function(r){t+=r.text.length+i}),t},copy:function(e){var t=new kr(li(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,i=this.first+this.size;e.from!=null&&e.from>t&&(t=e.from),e.to!=null&&e.to<i&&(i=e.to);var r=new kr(li(this,t,i),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}],Cl(r,ns(this)),r},unlinkDoc:function(e){if(e instanceof $t&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){var i=this.linked[t];if(i.doc!=e)continue;this.linked.splice(t,1),e.unlinkDoc(this),Tl(ns(this));break}if(e.history==this.history){var r=[e.id];Ci(e,function(n){return r.push(n.id)},!0),e.history=new Qn(null),e.history.done=qi(this.history.done,r),e.history.undone=qi(this.history.undone,r)}},iterLinkedDocs:function(e){Ci(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):Et(e)},lineSeparator:function(){return this.lineSep||`
`},setDirection:hr(function(e){if(e!="rtl"&&(e="ltr"),e==this.direction)return;this.direction=e,this.iter(function(t){return t.order=null}),this.cm&&fl(this.cm)})}),kr.prototype.eachLine=kr.prototype.iter;var as=0;function Al(e){var t=this;if(os(t),Ke(t,e)||fi(t.display,e))return;re(e),G&&(as=+new Date);var i=Pi(t,e,!0),r=e.dataTransfer.files;if(!i||t.isReadOnly())return;if(r&&r.length&&window.FileReader&&window.File)for(var n=r.length,C=Array(n),F=0,Y=function(){++F==n&&dr(t,function(){i=s(t.doc,i);var we={from:i,to:i,text:t.doc.splitLines(C.filter(function(Fe){return Fe!=null}).join(t.doc.lineSeparator())),origin:"paste"};tn(t.doc,we),zo(t.doc,Ei(s(t.doc,i),s(t.doc,Si(we))))})()},Z=function(we,Fe){if(t.options.allowDropFileTypes&&oe(t.options.allowDropFileTypes,we.type)==-1){Y();return}var ze=new FileReader;ze.onerror=function(){return Y()},ze.onload=function(){var $e=ze.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test($e)){Y();return}C[Fe]=$e,Y()},ze.readAsText(we)},q=0;q<r.length;q++)Z(r[q],q);else{if(t.state.draggingText&&t.doc.sel.contains(i)>-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var ce=e.dataTransfer.getData("Text");if(ce){var me;if(t.state.draggingText&&!t.state.draggingText.copy&&(me=t.listSelections()),ea(t.doc,Ei(i,i)),me)for(var De=0;De<me.length;++De)rn(t.doc,"",me[De].anchor,me[De].head,"drag");t.replaceSelection(ce,"around","paste"),t.display.input.focus()}}catch(we){}}}function Ll(e,t){if(G&&(!e.state.draggingText||+new Date-as<100)){de(t);return}if(Ke(e,t)||fi(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!M){var i=a("img",null,null,"position: fixed; left: 0; top: 0;");i.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",A&&(i.width=i.height=1,e.display.wrapper.appendChild(i),i._top=i.offsetTop),t.dataTransfer.setDragImage(i,0,0),A&&i.parentNode.removeChild(i)}}function kl(e,t){var i=Pi(e,t);if(!i)return;var r=document.createDocumentFragment();yo(e,i,r),e.display.dragCursor||(e.display.dragCursor=a("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),h(e.display.dragCursor,r)}function os(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function ss(e){if(!document.getElementsByClassName)return;for(var t=document.getElementsByClassName("CodeMirror"),i=[],r=0;r<t.length;r++){var n=t[r].CodeMirror;n&&i.push(n)}i.length&&i[0].operation(function(){for(var C=0;C<i.length;C++)e(i[C])})}var ls=!1;function Dl(){if(ls)return;Rl(),ls=!0}function Rl(){var e;_e(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,ss(Ol)},100))}),_e(window,"blur",function(){return ss(Zi)})}function Ol(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var wi={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"},_n=0;_n<10;_n++)wi[_n+48]=wi[_n+96]=String(_n);for(var ia=65;ia<=90;ia++)wi[ia]=String.fromCharCode(ia);for(var Mn=1;Mn<=12;Mn++)wi[Mn+111]=wi[Mn+63235]="F"+Mn;var pi={};pi.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"},pi.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"},pi.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"},pi.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"]},pi.default=l?pi.macDefault:pi.pcDefault;function _l(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var i,r,n,C,F=0;F<t.length-1;F++){var Y=t[F];if(/^(cmd|meta|m)$/i.test(Y))C=!0;else if(/^a(lt)?$/i.test(Y))i=!0;else if(/^(c|ctrl|control)$/i.test(Y))r=!0;else if(/^s(hift)?$/i.test(Y))n=!0;else throw new Error("Unrecognized modifier name: "+Y)}return i&&(e="Alt-"+e),r&&(e="Ctrl-"+e),C&&(e="Cmd-"+e),n&&(e="Shift-"+e),e}function Ml(e){var t={};for(var i in e)if(e.hasOwnProperty(i)){var r=e[i];if(/^(name|fallthrough|(de|at)tach)$/.test(i))continue;if(r=="..."){delete e[i];continue}for(var n=ue(i.split(" "),_l),C=0;C<n.length;C++){var F=void 0,Y=void 0;C==n.length-1?(Y=n.join(" "),F=r):(Y=n.slice(0,C+1).join(" "),F="...");var Z=t[Y];if(!Z)t[Y]=F;else if(Z!=F)throw new Error("Inconsistent bindings for "+Y)}delete e[i]}for(var q in t)e[q]=t[q];return e}function an(e,t,i,r){t=na(t);var n=t.call?t.call(e,r):t[e];if(n===!1)return"nothing";if(n==="...")return"multi";if(n!=null&&i(n))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return an(e,t.fallthrough,i,r);for(var C=0;C<t.fallthrough.length;C++){var F=an(e,t.fallthrough[C],i,r);if(F)return F}}}function us(e){var t=typeof e=="string"?e:wi[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function ds(e,t,i){var r=e;return t.altKey&&r!="Alt"&&(e="Alt-"+e),(p?t.metaKey:t.ctrlKey)&&r!="Ctrl"&&(e="Ctrl-"+e),(p?t.ctrlKey:t.metaKey)&&r!="Mod"&&(e="Cmd-"+e),!i&&t.shiftKey&&r!="Shift"&&(e="Shift-"+e),e}function hs(e,t){if(A&&e.keyCode==34&&e.char)return!1;var i=wi[e.keyCode];return i==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(i=e.code),ds(i,e,t))}function na(e){return typeof e=="string"?pi[e]:e}function on(e,t){for(var i=e.doc.sel.ranges,r=[],n=0;n<i.length;n++){for(var C=t(i[n]);r.length&&wt(C.from,te(r).to)<=0;){var F=r.pop();if(wt(F.from,C.from)<0){C.from=F.from;break}}r.push(C)}Ir(e,function(){for(var Y=r.length-1;Y>=0;Y--)rn(e.doc,"",r[Y].from,r[Y].to,"+delete");Qi(e)})}function Ua(e,t,i){var r=Ie(e.text,t+i,i);return r<0||r>e.text.length?null:r}function Fa(e,t,i){var r=Ua(e,t.ch,i);return r==null?null:new Ve(t.line,r,i<0?"after":"before")}function ja(e,t,i,r,n){if(e){t.doc.direction=="rtl"&&(n=-n);var C=Ye(i,t.doc.direction);if(C){var F=n<0?te(C):C[0],Y=n<0==(F.level==1),Z=Y?"after":"before",q;if(F.level>0||t.doc.direction=="rtl"){var ce=Xi(t,i);q=n<0?i.text.length-1:0;var me=ai(t,ce,q).top;q=Qe(function(De){return ai(t,ce,De).top==me},n<0==(F.level==1)?F.from:F.to-1,q),Z=="before"&&(q=Ua(i,q,1))}else q=n<0?F.to:F.from;return new Ve(r,q,Z)}}return new Ve(r,n<0?i.text.length:0,n<0?"before":"after")}function Pl(e,t,i,r){var n=Ye(t,e.doc.direction);if(!n)return Fa(t,i,r);i.ch>=t.text.length?(i.ch=t.text.length,i.sticky="before"):i.ch<=0&&(i.ch=0,i.sticky="after");var C=Je(n,i.ch,i.sticky),F=n[C];if(e.doc.direction=="ltr"&&F.level%2==0&&(r>0?F.to>i.ch:F.from<i.ch))return Fa(t,i,r);var Y=function(it,ut){return Ua(t,it instanceof Ve?it.ch:it,ut)},Z,q=function(it){return e.options.lineWrapping?(Z=Z||Xi(e,t),po(e,t,Z,it)):{begin:0,end:t.text.length}},ce=q(i.sticky=="before"?Y(i,-1):i.ch);if(e.doc.direction=="rtl"||F.level==1){var me=F.level==1==r<0,De=Y(i,me?1:-1);if(De!=null&&(me?De<=F.to&&De<=ce.end:De>=F.from&&De>=ce.begin)){var we=me?"before":"after";return new Ve(i.line,De,we)}}var Fe=function(it,ut,nt){for(var pt=function(Xt,cr){return cr?new Ve(i.line,Y(Xt,1),"before"):new Ve(i.line,Xt,"after")};it>=0&&it<n.length;it+=ut){var St=n[it],yt=ut>0==(St.level!=1),Rt=yt?nt.begin:Y(nt.end,-1);if(St.from<=Rt&&Rt<St.to)return pt(Rt,yt);if(Rt=yt?St.from:Y(St.to,-1),nt.begin<=Rt&&Rt<nt.end)return pt(Rt,yt)}},ze=Fe(C+r,r,ce);if(ze)return ze;var $e=r>0?ce.end:Y(ce.begin,-1);return $e!=null&&!(r>0&&$e==t.text.length)&&(ze=Fe(r>0?0:n.length-1,r,q($e)),ze)?ze:null}var Pn={selectAll:$o,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),Ce)},killLine:function(e){return on(e,function(t){if(t.empty()){var i=mt(e.doc,t.head.line).text.length;return t.head.ch==i&&t.head.line<e.lastLine()?{from:t.head,to:Ve(t.head.line+1,0)}:{from:t.head,to:Ve(t.head.line,i)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return on(e,function(t){return{from:Ve(t.from().line,0),to:s(e.doc,Ve(t.to().line+1,0))}})},delLineLeft:function(e){return on(e,function(t){return{from:Ve(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return on(e,function(t){var i=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:i},"div");return{from:r,to:t.from()}})},delWrappedLineRight:function(e){return on(e,function(t){var i=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:i},"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(Ve(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(Ve(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return cs(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return fs(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 i=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:i},"div")},Le)},goLineLeft:function(e){return e.extendSelectionsBy(function(t){var i=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:i},"div")},Le)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var i=e.cursorCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:i},"div");return r.ch<e.getLine(r.line).search(/\S/)?fs(e,t.head):r},Le)},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=[],i=e.listSelections(),r=e.options.tabSize,n=0;n<i.length;n++){var C=i[n].from(),F=$(e.getLine(C.line),C.ch,r);t.push(se(r-F%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return Ir(e,function(){for(var t=e.listSelections(),i=[],r=0;r<t.length;r++){if(!t[r].empty())continue;var n=t[r].head,C=mt(e.doc,n.line).text;if(C){if(n.ch==C.length&&(n=new Ve(n.line,n.ch-1)),n.ch>0)n=new Ve(n.line,n.ch+1),e.replaceRange(C.charAt(n.ch-1)+C.charAt(n.ch-2),Ve(n.line,n.ch-2),n,"+transpose");else if(n.line>e.doc.first){var F=mt(e.doc,n.line-1).text;F&&(n=new Ve(n.line,1),e.replaceRange(C.charAt(0)+e.doc.lineSeparator()+F.charAt(F.length-1),Ve(n.line-1,F.length-1),n,"+transpose"))}}i.push(new Gt(n,n))}e.setSelections(i)})},newlineAndIndent:function(e){return Ir(e,function(){for(var t=e.listSelections(),i=t.length-1;i>=0;i--)e.replaceRange(e.doc.lineSeparator(),t[i].anchor,t[i].head,"+input");t=e.listSelections();for(var r=0;r<t.length;r++)e.indentLine(t[r].from().line,null,!0);Qi(e)})},openLine:function(e){return e.replaceSelection(`
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function cs(e,t){var i=mt(e.doc,t),r=wr(i);return r!=i&&(t=Ot(r)),ja(!0,e,r,t,1)}function Il(e,t){var i=mt(e.doc,t),r=zi(i);return r!=i&&(t=Ot(r)),ja(!0,e,i,t,-1)}function fs(e,t){var i=cs(e,t.line),r=mt(e.doc,i.line),n=Ye(r,e.doc.direction);if(!n||n[0].level==0){var C=Math.max(i.ch,r.text.search(/\S/)),F=t.line==i.line&&t.ch<=C&&t.ch;return Ve(i.line,F?0:C,i.sticky)}return i}function aa(e,t,i){if(typeof t=="string"&&(t=Pn[t],!t))return!1;e.display.input.ensurePolled();var r=e.display.shift,n=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),i&&(e.display.shift=!1),n=t(e)!=Oe}finally{e.display.shift=r,e.state.suppressEdits=!1}return n}function Nl(e,t,i){for(var r=0;r<e.state.keyMaps.length;r++){var n=an(t,e.state.keyMaps[r],i,e);if(n)return n}return e.options.extraKeys&&an(t,e.options.extraKeys,i,e)||an(t,e.options.keyMap,i,e)}var Bl=new ee;function In(e,t,i,r){var n=e.state.keySeq;if(n){if(us(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Bl.set(50,function(){e.state.keySeq==n&&(e.state.keySeq=null,e.display.input.reset())}),ps(e,n+" "+t,i,r))return!0}return ps(e,t,i,r)}function ps(e,t,i,r){var n=Nl(e,t,r);return n=="multi"&&(e.state.keySeq=t),n=="handled"&&mr(e,"keyHandled",e,t,i),(n=="handled"||n=="multi")&&(re(i),Ca(e)),!!n}function ms(e,t){var i=hs(t,!0);return i?t.shiftKey&&!e.state.keySeq?In(e,"Shift-"+i,t,function(r){return aa(e,r,!0)})||In(e,i,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return aa(e,r)}):In(e,i,t,function(r){return aa(e,r)}):!1}function Ul(e,t,i){return In(e,"'"+i+"'",t,function(r){return aa(e,r,!0)})}var Wa=null;function gs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=N(),Ke(t,e))return;G&&j<11&&e.keyCode==27&&(e.returnValue=!1);var i=e.keyCode;t.display.shift=i==16||e.shiftKey;var r=ms(t,e);A&&(Wa=r?i:null,!r&&i==88&&!jt&&(l?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),D&&!l&&!r&&i==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),i==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Fl(t)}function Fl(e){var t=e.display.lineDiv;U(t,"CodeMirror-crosshair");function i(r){(r.keyCode==18||!r.altKey)&&(m(t,"CodeMirror-crosshair"),at(document,"keyup",i),at(document,"mouseover",i))}_e(document,"keyup",i),_e(document,"mouseover",i)}function vs(e){e.keyCode==16&&(this.doc.sel.shift=!1),Ke(this,e)}function ys(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(fi(t.display,e)||Ke(t,e)||e.ctrlKey&&!e.altKey||l&&e.metaKey)return;var i=e.keyCode,r=e.charCode;if(A&&i==Wa){Wa=null,re(e);return}if(A&&(!e.which||e.which<10)&&ms(t,e))return;var n=String.fromCharCode(r==null?i:r);if(n=="\b")return;if(Ul(t,e,n))return;t.display.input.onKeyPress(e)}var jl=400,Ha=function(e,t,i){this.time=e,this.pos=t,this.button=i};Ha.prototype.compare=function(e,t,i){return this.time+jl>e&&wt(t,this.pos)==0&&i==this.button};var Nn,Bn;function Wl(e,t){var i=+new Date;return Bn&&Bn.compare(i,e,t)?(Nn=Bn=null,"triple"):Nn&&Nn.compare(i,e,t)?(Bn=new Ha(i,e,t),Nn=null,"double"):(Nn=new Ha(i,e,t),Bn=null,"single")}function bs(e){var t=this,i=t.display;if(Ke(t,e)||i.activeTouch&&i.input.supportsTouch())return;if(i.input.ensurePolled(),i.shift=e.shiftKey,fi(i,e)){I||(i.scroller.draggable=!1,setTimeout(function(){return i.scroller.draggable=!0},100));return}if(Ga(t,e))return;var r=Pi(t,e),n=Se(e),C=r?Wl(r,n):"single";if(window.focus(),n==1&&t.state.selectingText&&t.state.selectingText(e),r&&Hl(t,n,r,C,e))return;n==1?r?zl(t,r,C,e):ke(e)==i.scroller&&re(e):n==2?(r&&qn(t.doc,r),setTimeout(function(){return i.input.focus()},20)):n==3&&(k?t.display.input.onContextMenu(e):xo(t))}function Hl(e,t,i,r,n){var C="Click";return r=="double"?C="Double"+C:r=="triple"&&(C="Triple"+C),C=(t==1?"Left":t==2?"Middle":"Right")+C,In(e,ds(C,n),n,function(F){if(typeof F=="string"&&(F=Pn[F]),!F)return!1;var Y=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),Y=F(e,i)!=Oe}finally{e.state.suppressEdits=!1}return Y})}function Gl(e,t,i){var r=e.getOption("configureMouse"),n=r?r(e,t,i):{};if(n.unit==null){var C=d?i.shiftKey&&i.metaKey:i.altKey;n.unit=C?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(n.extend==null||e.doc.extend)&&(n.extend=e.doc.extend||i.shiftKey),n.addNew==null&&(n.addNew=l?i.metaKey:i.ctrlKey),n.moveOnDrag==null&&(n.moveOnDrag=!(l?i.altKey:i.ctrlKey)),n}function zl(e,t,i,r){G?setTimeout(O(bo,e),0):e.curOp.focus=N();var n=Gl(e,i,r),C=e.doc.sel,F;e.options.dragDrop&&We&&!e.isReadOnly()&&i=="single"&&(F=C.contains(t))>-1&&(wt((F=C.ranges[F]).from(),t)<0||t.xRel>0)&&(wt(F.to(),t)>0||t.xRel<0)?Kl(e,r,t,n):Vl(e,r,t,n)}function Kl(e,t,i,r){var n=e.display,C=!1,F=dr(e,function(q){I&&(n.scroller.draggable=!1),e.state.draggingText=!1,at(n.wrapper.ownerDocument,"mouseup",F),at(n.wrapper.ownerDocument,"mousemove",Y),at(n.scroller,"dragstart",Z),at(n.scroller,"drop",F),C||(re(q),r.addNew||qn(e.doc,i,null,null,r.extend),I&&!M||G&&j==9?setTimeout(function(){n.wrapper.ownerDocument.body.focus({preventScroll:!0}),n.input.focus()},20):n.input.focus())}),Y=function(q){C=C||Math.abs(t.clientX-q.clientX)+Math.abs(t.clientY-q.clientY)>=10},Z=function(){return C=!0};I&&(n.scroller.draggable=!0),e.state.draggingText=F,F.copy=!r.moveOnDrag,n.scroller.dragDrop&&n.scroller.dragDrop(),_e(n.wrapper.ownerDocument,"mouseup",F),_e(n.wrapper.ownerDocument,"mousemove",Y),_e(n.scroller,"dragstart",Z),_e(n.scroller,"drop",F),xo(e),setTimeout(function(){return n.input.focus()},20)}function xs(e,t,i){if(i=="char")return new Gt(t,t);if(i=="word")return e.findWordAt(t);if(i=="line")return new Gt(Ve(t.line,0),s(e.doc,Ve(t.line+1,0)));var r=i(e,t);return new Gt(r.from,r.to)}function Vl(e,t,i,r){var n=e.display,C=e.doc;re(t);var F,Y,Z=C.sel,q=Z.ranges;if(r.addNew&&!r.extend?(Y=C.sel.contains(i),Y>-1?F=q[Y]:F=new Gt(i,i)):(F=C.sel.primary(),Y=C.sel.primIndex),r.unit=="rectangle")r.addNew||(F=new Gt(i,i)),i=Pi(e,t,!0,!0),Y=-1;else{var ce=xs(e,i,r.unit);r.extend?F=Na(F,ce.anchor,ce.head,r.extend):F=ce}r.addNew?Y==-1?(Y=q.length,vr(C,ei(e,q.concat([F]),Y),{scroll:!1,origin:"*mouse"})):q.length>1&&q[Y].empty()&&r.unit=="char"&&!r.extend?(vr(C,ei(e,q.slice(0,Y).concat(q.slice(Y+1)),0),{scroll:!1,origin:"*mouse"}),Z=C.sel):Ba(C,Y,F,Ae):(Y=0,vr(C,new Kr([F],0),Ae),Z=C.sel);var me=i;function De(nt){if(wt(me,nt)==0)return;if(me=nt,r.unit=="rectangle"){for(var pt=[],St=e.options.tabSize,yt=$(mt(C,i.line).text,i.ch,St),Rt=$(mt(C,nt.line).text,nt.ch,St),Xt=Math.min(yt,Rt),cr=Math.max(yt,Rt),Zt=Math.min(i.line,nt.line),Nr=Math.min(e.lastLine(),Math.max(i.line,nt.line));Zt<=Nr;Zt++){var Dr=mt(C,Zt).text,ar=be(Dr,Xt,St);Xt==cr?pt.push(new Gt(Ve(Zt,ar),Ve(Zt,ar))):Dr.length>ar&&pt.push(new Gt(Ve(Zt,ar),Ve(Zt,be(Dr,cr,St))))}pt.length||pt.push(new Gt(i,i)),vr(C,ei(e,Z.ranges.slice(0,Y).concat(pt),Y),{origin:"*mouse",scroll:!1}),e.scrollIntoView(nt)}else{var Rr=F,gr=xs(e,nt,r.unit),lr=Rr.anchor,or;wt(gr.anchor,lr)>0?(or=gr.head,lr=ki(Rr.from(),gr.anchor)):(or=gr.anchor,lr=hi(Rr.to(),gr.head));var Jt=Z.ranges.slice(0);Jt[Y]=Xl(e,new Gt(s(C,lr),or)),vr(C,ei(e,Jt,Y),Ae)}}var we=n.wrapper.getBoundingClientRect(),Fe=0;function ze(nt){var pt=++Fe,St=Pi(e,nt,!0,r.unit=="rectangle");if(!St)return;if(wt(St,me)!=0){e.curOp.focus=N(),De(St);var yt=Xn(n,C);(St.line>=yt.to||St.line<yt.from)&&setTimeout(dr(e,function(){Fe==pt&&ze(nt)}),150)}else{var Rt=nt.clientY<we.top?-20:nt.clientY>we.bottom?20:0;Rt&&setTimeout(dr(e,function(){if(Fe!=pt)return;n.scroller.scrollTop+=Rt,ze(nt)}),50)}}function $e(nt){e.state.selectingText=!1,Fe=Infinity,nt&&(re(nt),n.input.focus()),at(n.wrapper.ownerDocument,"mousemove",it),at(n.wrapper.ownerDocument,"mouseup",ut),C.history.lastSelOrigin=null}var it=dr(e,function(nt){nt.buttons===0||!Se(nt)?$e(nt):ze(nt)}),ut=dr(e,$e);e.state.selectingText=ut,_e(n.wrapper.ownerDocument,"mousemove",it),_e(n.wrapper.ownerDocument,"mouseup",ut)}function Xl(e,t){var i=t.anchor,r=t.head,n=mt(e.doc,i.line);if(wt(i,r)==0&&i.sticky==r.sticky)return t;var C=Ye(n);if(!C)return t;var F=Je(C,i.ch,i.sticky),Y=C[F];if(Y.from!=i.ch&&Y.to!=i.ch)return t;var Z=F+(Y.from==i.ch==(Y.level!=1)?0:1);if(Z==0||Z==C.length)return t;var q;if(r.line!=i.line)q=(r.line-i.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var ce=Je(C,r.ch,r.sticky),me=ce-F||(r.ch-i.ch)*(Y.level==1?-1:1);ce==Z-1||ce==Z?q=me<0:q=me>0}var De=C[Z+(q?-1:0)],we=q==(De.level==1),Fe=we?De.from:De.to,ze=we?"after":"before";return i.ch==Fe&&i.sticky==ze?t:new Gt(new Ve(i.line,Fe,ze),r)}function Es(e,t,i,r){var n,C;if(t.touches)n=t.touches[0].clientX,C=t.touches[0].clientY;else try{n=t.clientX,C=t.clientY}catch(De){return!1}if(n>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&re(t);var F=e.display,Y=F.lineDiv.getBoundingClientRect();if(C>Y.bottom||!ge(e,i))return ae(t);C-=Y.top-F.viewOffset;for(var Z=0;Z<e.display.gutterSpecs.length;++Z){var q=F.gutters.childNodes[Z];if(q&&q.getBoundingClientRect().right>=n){var ce=Fr(e.doc,C),me=e.display.gutterSpecs[Z];return Be(e,i,e,ce,me.className,t),ae(t)}}}function Ga(e,t){return Es(e,t,"gutterClick",!0)}function Ss(e,t){if(fi(e.display,t)||Yl(e,t))return;if(Ke(e,t,"contextmenu"))return;k||e.display.input.onContextMenu(t)}function Yl(e,t){return ge(e,"gutterContextMenu")?Es(e,t,"gutterContextMenu",!1):!1}function Cs(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),vn(e)}var sn={toString:function(){return"CodeMirror.Init"}},Ts={},oa={};function $l(e){var t=e.optionHandlers;function i(r,n,C,F){e.defaults[r]=n,C&&(t[r]=F?function(Y,Z,q){q!=sn&&C(Y,Z,q)}:C)}e.defineOption=i,e.Init=sn,i("value","",function(r,n){return r.setValue(n)},!0),i("mode",null,function(r,n){r.doc.modeOption=n,Ma(r)},!0),i("indentUnit",2,Ma,!0),i("indentWithTabs",!1),i("smartIndent",!0),i("tabSize",4,function(r){wn(r),vn(r),Lr(r)},!0),i("lineSeparator",null,function(r,n){if(r.doc.lineSep=n,!n)return;var C=[],F=r.doc.first;r.doc.iter(function(Z){for(var q=0;;){var ce=Z.text.indexOf(n,q);if(ce==-1)break;q=ce+n.length,C.push(Ve(F,ce))}F++});for(var Y=C.length-1;Y>=0;Y--)rn(r.doc,n,C[Y],Ve(C[Y].line,C[Y].ch+n.length))}),i("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,function(r,n,C){r.state.specialChars=new RegExp(n.source+(n.test(" ")?"":"| "),"g"),C!=sn&&r.refresh()}),i("specialCharPlaceholder",Ft,function(r){return r.refresh()},!0),i("electricChars",!0),i("inputStyle",o?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),i("spellcheck",!1,function(r,n){return r.getInputField().spellcheck=n},!0),i("autocorrect",!1,function(r,n){return r.getInputField().autocorrect=n},!0),i("autocapitalize",!1,function(r,n){return r.getInputField().autocapitalize=n},!0),i("rtlMoveVisually",!T),i("wholeLineUpdateBefore",!0),i("theme","default",function(r){Cs(r),Tn(r)},!0),i("keyMap","default",function(r,n,C){var F=na(n),Y=C!=sn&&na(C);Y&&Y.detach&&Y.detach(r,F),F.attach&&F.attach(r,Y||null)}),i("extraKeys",null),i("configureMouse",null),i("lineWrapping",!1,Ql,!0),i("gutters",[],function(r,n){r.display.gutterSpecs=Oa(n,r.options.lineNumbers),Tn(r)},!0),i("fixedGutter",!0,function(r,n){r.display.gutters.style.left=n?Ea(r.display)+"px":"0",r.refresh()},!0),i("coverGutterNextToScrollbar",!1,function(r){return Ji(r)},!0),i("scrollbarStyle","native",function(r){Ao(r),Ji(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)},!0),i("lineNumbers",!1,function(r,n){r.display.gutterSpecs=Oa(r.options.gutters,n),Tn(r)},!0),i("firstLineNumber",1,Tn,!0),i("lineNumberFormatter",function(r){return r},Tn,!0),i("showCursorWhenSelecting",!1,yn,!0),i("resetSelectionOnContextMenu",!0),i("lineWiseCopyCut",!0),i("pasteLinesPerSelection",!0),i("selectionsMayTouch",!1),i("readOnly",!1,function(r,n){n=="nocursor"&&(Zi(r),r.display.input.blur()),r.display.input.readOnlyChanged(n)}),i("screenReaderLabel",null,function(r,n){n=n===""?null:n,r.display.input.screenReaderLabelChanged(n)}),i("disableInput",!1,function(r,n){n||r.display.input.reset()},!0),i("dragDrop",!0,Zl),i("allowDropFileTypes",null),i("cursorBlinkRate",530),i("cursorScrollMargin",0),i("cursorHeight",1,yn,!0),i("singleCursorHeightPerLine",!0,yn,!0),i("workTime",100),i("workDelay",100),i("flattenSpans",!0,wn,!0),i("addModeClass",!1,wn,!0),i("pollInterval",100),i("undoDepth",200,function(r,n){return r.doc.history.undoDepth=n}),i("historyEventDelay",1250),i("viewportMargin",10,function(r){return r.refresh()},!0),i("maxHighlightLength",1e4,wn,!0),i("moveInputWithCursor",!0,function(r,n){n||r.display.input.resetPosition()}),i("tabindex",null,function(r,n){return r.display.input.getField().tabIndex=n||""}),i("autofocus",null),i("direction","ltr",function(r,n){return r.doc.setDirection(n)},!0),i("phrases",null)}function Zl(e,t,i){var r=i&&i!=sn;if(!t!=!r){var n=e.display.dragFunctions,C=t?_e:at;C(e.display.scroller,"dragstart",n.start),C(e.display.scroller,"dragenter",n.enter),C(e.display.scroller,"dragover",n.over),C(e.display.scroller,"dragleave",n.leave),C(e.display.scroller,"drop",n.drop)}}function Ql(e){e.options.lineWrapping?(U(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(m(e.display.wrapper,"CodeMirror-wrap"),jn(e)),Sa(e),Lr(e),vn(e),setTimeout(function(){return Ji(e)},100)}function $t(e,t){var i=this;if(!(this instanceof $t))return new $t(e,t);this.options=t=t?P(t):{},P(Ts,t,!1);var r=t.value;typeof r=="string"?r=new kr(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var n=new $t.inputStyles[t.inputStyle](this),C=this.display=new dl(e,r,n,t);C.wrapper.CodeMirror=this,Cs(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Ao(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new ee,keySeq:null,specialChars:null},t.autofocus&&!o&&C.input.focus(),G&&j<11&&setTimeout(function(){return i.display.input.reset(!0)},20),Jl(this),Dl(),Ui(this),this.curOp.forceUpdate=!0,No(this,r),t.autofocus&&!o||this.hasFocus()?setTimeout(function(){i.hasFocus()&&!i.state.focused&&Ta(i)},20):Zi(this);for(var F in oa)oa.hasOwnProperty(F)&&oa[F](this,t[F],sn);Do(this),t.finishInit&&t.finishInit(this);for(var Y=0;Y<za.length;++Y)za[Y](this);Fi(this),I&&t.lineWrapping&&getComputedStyle(C.lineDiv).textRendering=="optimizelegibility"&&(C.lineDiv.style.textRendering="auto")}$t.defaults=Ts,$t.optionHandlers=oa;function Jl(e){var t=e.display;_e(t.scroller,"mousedown",dr(e,bs)),G&&j<11?_e(t.scroller,"dblclick",dr(e,function(Z){if(Ke(e,Z))return;var q=Pi(e,Z);if(!q||Ga(e,Z)||fi(e.display,Z))return;re(Z);var ce=e.findWordAt(q);qn(e.doc,ce.anchor,ce.head)})):_e(t.scroller,"dblclick",function(Z){return Ke(e,Z)||re(Z)}),_e(t.scroller,"contextmenu",function(Z){return Ss(e,Z)}),_e(t.input.getField(),"contextmenu",function(Z){t.scroller.contains(Z.target)||Ss(e,Z)});var i,r={end:0};function n(){t.activeTouch&&(i=setTimeout(function(){return t.activeTouch=null},1e3),r=t.activeTouch,r.end=+new Date)}function C(Z){if(Z.touches.length!=1)return!1;var q=Z.touches[0];return q.radiusX<=1&&q.radiusY<=1}function F(Z,q){if(q.left==null)return!0;var ce=q.left-Z.left,me=q.top-Z.top;return ce*ce+me*me>20*20}_e(t.scroller,"touchstart",function(Z){if(!Ke(e,Z)&&!C(Z)&&!Ga(e,Z)){t.input.ensurePolled(),clearTimeout(i);var q=+new Date;t.activeTouch={start:q,moved:!1,prev:q-r.end<=300?r:null},Z.touches.length==1&&(t.activeTouch.left=Z.touches[0].pageX,t.activeTouch.top=Z.touches[0].pageY)}}),_e(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),_e(t.scroller,"touchend",function(Z){var q=t.activeTouch;if(q&&!fi(t,Z)&&q.left!=null&&!q.moved&&new Date-q.start<300){var ce=e.coordsChar(t.activeTouch,"page"),me;!q.prev||F(q,q.prev)?me=new Gt(ce,ce):!q.prev.prev||F(q,q.prev.prev)?me=e.findWordAt(ce):me=new Gt(Ve(ce.line,0),s(e.doc,Ve(ce.line+1,0))),e.setSelection(me.anchor,me.head),e.focus(),re(Z)}n()}),_e(t.scroller,"touchcancel",n),_e(t.scroller,"scroll",function(){t.scroller.clientHeight&&(xn(e,t.scroller.scrollTop),Ni(e,t.scroller.scrollLeft,!0),Be(e,"scroll",e))}),_e(t.scroller,"mousewheel",function(Z){return _o(e,Z)}),_e(t.scroller,"DOMMouseScroll",function(Z){return _o(e,Z)}),_e(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(Z){Ke(e,Z)||de(Z)},over:function(Z){Ke(e,Z)||(kl(e,Z),de(Z))},start:function(Z){return Ll(e,Z)},drop:dr(e,Al),leave:function(Z){Ke(e,Z)||os(e)}};var Y=t.input.getField();_e(Y,"keyup",function(Z){return vs.call(e,Z)}),_e(Y,"keydown",dr(e,gs)),_e(Y,"keypress",dr(e,ys)),_e(Y,"focus",function(Z){return Ta(e,Z)}),_e(Y,"blur",function(Z){return Zi(e,Z)})}var za=[];$t.defineInitHook=function(e){return za.push(e)};function Un(e,t,i,r){var n=e.doc,C;i==null&&(i="add"),i=="smart"&&(n.mode.indent?C=qe(e,t).state:i="prev");var F=e.options.tabSize,Y=mt(n,t),Z=$(Y.text,null,F);Y.stateAfter&&(Y.stateAfter=null);var q=Y.text.match(/^\s*/)[0],ce;if(!r&&!/\S/.test(Y.text))ce=0,i="not";else if(i=="smart"&&(ce=n.mode.indent(C,Y.text.slice(q.length),Y.text),ce==Oe||ce>150)){if(!r)return;i="prev"}i=="prev"?t>n.first?ce=$(mt(n,t-1).text,null,F):ce=0:i=="add"?ce=Z+e.options.indentUnit:i=="subtract"?ce=Z-e.options.indentUnit:typeof i=="number"&&(ce=Z+i),ce=Math.max(0,ce);var me="",De=0;if(e.options.indentWithTabs)for(var we=Math.floor(ce/F);we;--we)De+=F,me+=" ";if(De<ce&&(me+=se(ce-De)),me!=q)return rn(n,me,Ve(t,0),Ve(t,q.length),"+input"),Y.stateAfter=null,!0;for(var Fe=0;Fe<n.sel.ranges.length;Fe++){var ze=n.sel.ranges[Fe];if(ze.head.line==t&&ze.head.ch<q.length){var $e=Ve(t,q.length);Ba(n,Fe,new Gt($e,$e));break}}}var ti=null;function sa(e){ti=e}function Ka(e,t,i,r,n){var C=e.doc;e.display.shift=!1,r||(r=C.sel);var F=+new Date-200,Y=n=="paste"||e.state.pasteIncoming>F,Z=Et(t),q=null;if(Y&&r.ranges.length>1)if(ti&&ti.text.join(`
`)==t){if(r.ranges.length%ti.text.length==0){q=[];for(var ce=0;ce<ti.text.length;ce++)q.push(C.splitLines(ti.text[ce]))}}else Z.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(q=ue(Z,function(it){return[it]}));for(var me=e.curOp.updateInput,De=r.ranges.length-1;De>=0;De--){var we=r.ranges[De],Fe=we.from(),ze=we.to();we.empty()&&(i&&i>0?Fe=Ve(Fe.line,Fe.ch-i):e.state.overwrite&&!Y?ze=Ve(ze.line,Math.min(mt(C,ze.line).text.length,ze.ch+te(Z).length)):Y&&ti&&ti.lineWise&&ti.text.join(`
`)==Z.join(`
`)&&(Fe=ze=Ve(Fe.line,0)));var $e={from:Fe,to:ze,text:q?q[De%q.length]:Z,origin:n||(Y?"paste":e.state.cutIncoming>F?"cut":"+input")};tn(e.doc,$e),mr(e,"inputRead",e,$e)}t&&!Y&&As(e,t),Qi(e),e.curOp.updateInput<2&&(e.curOp.updateInput=me),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function ws(e,t){var i=e.clipboardData&&e.clipboardData.getData("Text");if(i)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&Ir(t,function(){return Ka(t,i,0,null,"paste")}),!0}function As(e,t){if(!e.options.electricChars||!e.options.smartIndent)return;for(var i=e.doc.sel,r=i.ranges.length-1;r>=0;r--){var n=i.ranges[r];if(n.head.ch>100||r&&i.ranges[r-1].head.line==n.head.line)continue;var C=e.getModeAt(n.head),F=!1;if(C.electricChars){for(var Y=0;Y<C.electricChars.length;Y++)if(t.indexOf(C.electricChars.charAt(Y))>-1){F=Un(e,n.head.line,"smart");break}}else C.electricInput&&(C.electricInput.test(mt(e.doc,n.head.line).text.slice(0,n.head.ch))&&(F=Un(e,n.head.line,"smart")));F&&mr(e,"electricInput",e,n.head.line)}}function Ls(e){for(var t=[],i=[],r=0;r<e.doc.sel.ranges.length;r++){var n=e.doc.sel.ranges[r].head.line,C={anchor:Ve(n,0),head:Ve(n+1,0)};i.push(C),t.push(e.getRange(C.anchor,C.head))}return{text:t,ranges:i}}function ks(e,t,i,r){e.setAttribute("autocorrect",i?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function Ds(){var e=a("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=a("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return I?e.style.width="1000px":e.setAttribute("wrap","off"),y&&(e.style.border="1px solid black"),ks(e),t}function ql(e){var t=e.optionHandlers,i=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(r,n){var C=this.options,F=C[r];if(C[r]==n&&r!="mode")return;C[r]=n,t.hasOwnProperty(r)&&dr(this,t[r])(this,n,F),Be(this,"optionChange",this,r)},getOption:function(r){return this.options[r]},getDoc:function(){return this.doc},addKeyMap:function(r,n){this.state.keyMaps[n?"push":"unshift"](na(r))},removeKeyMap:function(r){for(var n=this.state.keyMaps,C=0;C<n.length;++C)if(n[C]==r||n[C].name==r)return n.splice(C,1),!0},addOverlay:br(function(r,n){var C=r.token?r:e.getMode(this.options,r);if(C.startState)throw new Error("Overlays may not be stateful.");ne(this.state.overlays,{mode:C,modeSpec:r,opaque:n&&n.opaque,priority:n&&n.priority||0},function(F){return F.priority}),this.state.modeGen++,Lr(this)}),removeOverlay:br(function(r){for(var n=this.state.overlays,C=0;C<n.length;++C){var F=n[C].modeSpec;if(F==r||typeof r=="string"&&F.name==r){n.splice(C,1),this.state.modeGen++,Lr(this);return}}}),indentLine:br(function(r,n,C){typeof n!="string"&&typeof n!="number"&&(n==null?n=this.options.smartIndent?"smart":"prev":n=n?"add":"subtract"),$r(this.doc,r)&&Un(this,r,n,C)}),indentSelection:br(function(r){for(var n=this.doc.sel.ranges,C=-1,F=0;F<n.length;F++){var Y=n[F];if(Y.empty())Y.head.line>C&&(Un(this,Y.head.line,r,!0),C=Y.head.line,F==this.doc.sel.primIndex&&Qi(this));else{var Z=Y.from(),q=Y.to(),ce=Math.max(C,Z.line);C=Math.min(this.lastLine(),q.line-(q.ch?0:1))+1;for(var me=ce;me<C;++me)Un(this,me,r);var De=this.doc.sel.ranges;Z.ch==0&&n.length==De.length&&De[F].from().ch>0&&Ba(this.doc,F,new Gt(Z,De[F].to()),Ce)}}}),getTokenAt:function(r,n){return Vt(this,r,n)},getLineTokens:function(r,n){return Vt(this,Ve(r),n,!0)},getTokenTypeAt:function(r){r=s(this.doc,r);var n=He(this,mt(this.doc,r.line)),C=0,F=(n.length-1)/2,Y=r.ch,Z;if(Y==0)Z=n[2];else for(;;){var q=C+F>>1;if((q?n[q*2-1]:0)>=Y)F=q;else if(n[q*2+1]<Y)C=q+1;else{Z=n[q*2+2];break}}var ce=Z?Z.indexOf("overlay "):-1;return ce<0?Z:ce==0?null:Z.slice(0,ce-1)},getModeAt:function(r){var n=this.doc.mode;return n.innerMode?e.innerMode(n,this.getTokenAt(r).state).mode:n},getHelper:function(r,n){return this.getHelpers(r,n)[0]},getHelpers:function(r,n){var C=[];if(!i.hasOwnProperty(n))return C;var F=i[n],Y=this.getModeAt(r);if(typeof Y[n]=="string")F[Y[n]]&&C.push(F[Y[n]]);else if(Y[n])for(var Z=0;Z<Y[n].length;Z++){var q=F[Y[n][Z]];q&&C.push(q)}else Y.helperType&&F[Y.helperType]?C.push(F[Y.helperType]):F[Y.name]&&C.push(F[Y.name]);for(var ce=0;ce<F._global.length;ce++){var me=F._global[ce];me.pred(Y,this)&&oe(C,me.val)==-1&&C.push(me.val)}return C},getStateAfter:function(r,n){var C=this.doc;return r=z(C,r==null?C.first+C.size-1:r),qe(this,r+1,n).state},cursorCoords:function(r,n){var C,F=this.doc.sel.primary();return r==null?C=F.head:typeof r=="object"?C=s(this.doc,r):C=r?F.from():F.to(),qr(this,C,n||"page")},charCoords:function(r,n){return ga(this,s(this.doc,r),n||"page")},coordsChar:function(r,n){return r=ho(this,r,n||"page"),ya(this,r.left,r.top)},lineAtHeight:function(r,n){return r=ho(this,{top:r,left:0},n||"page").top,Fr(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,n,C){var F=!1,Y;if(typeof r=="number"){var Z=this.doc.first+this.doc.size-1;r<this.doc.first?r=this.doc.first:r>Z&&(r=Z,F=!0),Y=mt(this.doc,r)}else Y=r;return Gn(this,Y,{top:0,left:0},n||"page",C||F).top+(F?this.doc.height-Jr(Y):0)},defaultTextHeight:function(){return Yi(this.display)},defaultCharWidth:function(){return $i(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,n,C,F,Y){var Z=this.display;r=qr(this,s(this.doc,r));var q=r.bottom,ce=r.left;if(n.style.position="absolute",n.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(n),Z.sizer.appendChild(n),F=="over")q=r.top;else if(F=="above"||F=="near"){var me=Math.max(Z.wrapper.clientHeight,this.doc.height),De=Math.max(Z.sizer.clientWidth,Z.lineSpace.clientWidth);(F=="above"||r.bottom+n.offsetHeight>me)&&r.top>n.offsetHeight?q=r.top-n.offsetHeight:r.bottom+n.offsetHeight<=me&&(q=r.bottom),ce+n.offsetWidth>De&&(ce=De-n.offsetWidth)}n.style.top=q+"px",n.style.left=n.style.right="",Y=="right"?(ce=Z.sizer.clientWidth-n.offsetWidth,n.style.right="0px"):(Y=="left"?ce=0:Y=="middle"&&(ce=(Z.sizer.clientWidth-n.offsetWidth)/2),n.style.left=ce+"px"),C&&Zs(this,{left:ce,top:q,right:ce+n.offsetWidth,bottom:q+n.offsetHeight})},triggerOnKeyDown:br(gs),triggerOnKeyPress:br(ys),triggerOnKeyUp:vs,triggerOnMouseDown:br(bs),execCommand:function(r){if(Pn.hasOwnProperty(r))return Pn[r].call(null,this)},triggerElectric:br(function(r){As(this,r)}),findPosH:function(r,n,C,F){var Y=1;n<0&&(Y=-1,n=-n);for(var Z=s(this.doc,r),q=0;q<n&&!(Z=Va(this.doc,Z,Y,C,F),Z.hitSide);++q);return Z},moveH:br(function(r,n){var C=this;this.extendSelectionsBy(function(F){return C.display.shift||C.doc.extend||F.empty()?Va(C.doc,F.head,r,n,C.options.rtlMoveVisually):r<0?F.from():F.to()},Le)}),deleteH:br(function(r,n){var C=this.doc.sel,F=this.doc;C.somethingSelected()?F.replaceSelection("",null,"+delete"):on(this,function(Y){var Z=Va(F,Y.head,r,n,!1);return r<0?{from:Z,to:Y.head}:{from:Y.head,to:Z}})}),findPosV:function(r,n,C,F){var Y=1,Z=F;n<0&&(Y=-1,n=-n);for(var q=s(this.doc,r),ce=0;ce<n;++ce){var me=qr(this,q,"div");if(Z==null?Z=me.left:me.left=Z,q=Rs(this,me,Y,C),q.hitSide)break}return q},moveV:br(function(r,n){var C=this,F=this.doc,Y=[],Z=!this.display.shift&&!F.extend&&F.sel.somethingSelected();if(F.extendSelectionsBy(function(ce){if(Z)return r<0?ce.from():ce.to();var me=qr(C,ce.head,"div");ce.goalColumn!=null&&(me.left=ce.goalColumn),Y.push(me.left);var De=Rs(C,me,r,n);return n=="page"&&ce==F.sel.primary()&&Aa(C,ga(C,De,"div").top-me.top),De},Le),Y.length)for(var q=0;q<F.sel.ranges.length;q++)F.sel.ranges[q].goalColumn=Y[q]}),findWordAt:function(r){var n=this.doc,C=mt(n,r.line).text,F=r.ch,Y=r.ch;if(C){var Z=this.getHelper(r,"wordChars");(r.sticky=="before"||Y==C.length)&&F?--F:++Y;for(var q=C.charAt(F),ce=Pe(q,Z)?function(me){return Pe(me,Z)}:/\s/.test(q)?function(me){return/\s/.test(me)}:function(me){return!/\s/.test(me)&&!Pe(me)};F>0&&ce(C.charAt(F-1));)--F;for(;Y<C.length&&ce(C.charAt(Y));)++Y}return new Gt(Ve(r.line,F),Ve(r.line,Y))},toggleOverwrite:function(r){if(r!=null&&r==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?U(this.display.cursorDiv,"CodeMirror-overwrite"):m(this.display.cursorDiv,"CodeMirror-overwrite"),Be(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==N()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:br(function(r,n){bn(this,r,n)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-ni(this)-this.display.barHeight,width:r.scrollWidth-ni(this)-this.display.barWidth,clientHeight:fa(this),clientWidth:_i(this)}},scrollIntoView:br(function(r,n){r==null?(r={from:this.doc.sel.primary().head,to:null},n==null&&(n=this.options.cursorScrollMargin)):typeof r=="number"?r={from:Ve(r,0),to:null}:r.from==null&&(r={from:r,to:null}),r.to||(r.to=r.from),r.margin=n||0,r.from.line!=null?Qs(this,r):So(this,r.from,r.to,r.margin)}),setSize:br(function(r,n){var C=this,F=function(Z){return typeof Z=="number"||/^\d+$/.test(String(Z))?Z+"px":Z};r!=null&&(this.display.wrapper.style.width=F(r)),n!=null&&(this.display.wrapper.style.height=F(n)),this.options.lineWrapping&&so(this);var Y=this.display.viewFrom;this.doc.iter(Y,this.display.viewTo,function(Z){if(Z.widgets){for(var q=0;q<Z.widgets.length;q++)if(Z.widgets[q].noHScroll){bi(C,Y,"widget");break}}++Y}),this.curOp.forceUpdate=!0,Be(this,"refresh",this)}),operation:function(r){return Ir(this,r)},startOperation:function(){return Ui(this)},endOperation:function(){return Fi(this)},refresh:br(function(){var r=this.display.cachedTextHeight;Lr(this),this.curOp.forceUpdate=!0,vn(this),bn(this,this.doc.scrollLeft,this.doc.scrollTop),Da(this.display),(r==null||Math.abs(r-Yi(this.display))>.5||this.options.lineWrapping)&&Sa(this),Be(this,"refresh",this)}),swapDoc:br(function(r){var n=this.doc;return n.cm=null,this.state.selectingText&&this.state.selectingText(),No(this,r),vn(this),this.display.input.reset(),bn(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,mr(this,"swapDoc",this,n),n}),phrase:function(r){var n=this.options.phrases;return n&&Object.prototype.hasOwnProperty.call(n,r)?n[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}},ye(e),e.registerHelper=function(r,n,C){i.hasOwnProperty(r)||(i[r]=e[r]={_global:[]}),i[r][n]=C},e.registerGlobalHelper=function(r,n,C,F){e.registerHelper(r,n,F),i[r]._global.push({pred:C,val:F})}}function Va(e,t,i,r,n){var C=t,F=i,Y=mt(e,t.line),Z=n&&e.direction=="rtl"?-i:i;function q(){var ut=t.line+Z;return ut<e.first||ut>=e.first+e.size?!1:(t=new Ve(ut,t.ch,t.sticky),Y=mt(e,ut))}function ce(ut){var nt;if(r=="codepoint"){var pt=Y.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(pt)?nt=null:nt=new Ve(t.line,Math.max(0,Math.min(Y.text.length,t.ch+i*(pt>=55296&&pt<56320?2:1))),-i)}else n?nt=Pl(e.cm,Y,t,i):nt=Fa(Y,t,i);if(nt==null)if(!ut&&q())t=ja(n,e.cm,Y,t.line,Z);else return!1;else t=nt;return!0}if(r=="char"||r=="codepoint")ce();else if(r=="column")ce(!0);else if(r=="word"||r=="group")for(var me=null,De=r=="group",we=e.cm&&e.cm.getHelper(t,"wordChars"),Fe=!0;!(i<0&&!ce(!Fe));Fe=!1){var ze=Y.text.charAt(t.ch)||`
`,$e=Pe(ze,we)?"w":De&&ze==`
`?"n":!De||/\s/.test(ze)?null:"p";if(De&&!Fe&&!$e&&($e="s"),me&&me!=$e){i<0&&(i=1,ce(),t.sticky="after");break}if($e&&(me=$e),i>0&&!ce(!Fe))break}var it=ta(e,t,C,F,!0);return di(C,it)&&(it.hitSide=!0),it}function Rs(e,t,i,r){var n=e.doc,C=t.left,F;if(r=="page"){var Y=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),Z=Math.max(Y-.5*Yi(e.display),3);F=(i>0?t.bottom:t.top)+i*Z}else r=="line"&&(F=i>0?t.bottom+3:t.top-3);for(var q;!(q=ya(e,C,F),!q.outside);){if(i<0?F<=0:F>=n.height){q.hitSide=!0;break}F+=i*5}return q}var Kt=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new ee,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Kt.prototype.init=function(e){var t=this,i=this,r=i.cm,n=i.div=e.lineDiv;ks(n,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function C(Y){for(var Z=Y.target;Z;Z=Z.parentNode){if(Z==n)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(Z.className))break}return!1}_e(n,"paste",function(Y){if(!C(Y)||Ke(r,Y)||ws(Y,r))return;j<=11&&setTimeout(dr(r,function(){return t.updateFromDOM()}),20)}),_e(n,"compositionstart",function(Y){t.composing={data:Y.data,done:!1}}),_e(n,"compositionupdate",function(Y){t.composing||(t.composing={data:Y.data,done:!1})}),_e(n,"compositionend",function(Y){t.composing&&(Y.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),_e(n,"touchstart",function(){return i.forceCompositionEnd()}),_e(n,"input",function(){t.composing||t.readFromDOMSoon()});function F(Y){if(!C(Y)||Ke(r,Y))return;if(r.somethingSelected())sa({lineWise:!1,text:r.getSelections()}),Y.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var Z=Ls(r);sa({lineWise:!0,text:Z.text}),Y.type=="cut"&&r.operation(function(){r.setSelections(Z.ranges,0,Ce),r.replaceSelection("",null,"cut")})}else return;if(Y.clipboardData){Y.clipboardData.clearData();var q=ti.text.join(`
`);if(Y.clipboardData.setData("Text",q),Y.clipboardData.getData("Text")==q){Y.preventDefault();return}}var ce=Ds(),me=ce.firstChild;r.display.lineSpace.insertBefore(ce,r.display.lineSpace.firstChild),me.value=ti.text.join(`
`);var De=document.activeElement;V(me),setTimeout(function(){r.display.lineSpace.removeChild(ce),De.focus(),De==n&&i.showPrimarySelection()},50)}_e(n,"copy",F),_e(n,"cut",F)},Kt.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Kt.prototype.prepareSelection=function(){var e=vo(this.cm,!1);return e.focus=document.activeElement==this.div,e},Kt.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},Kt.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Kt.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,i=t.doc.sel.primary(),r=i.from(),n=i.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||n.line<t.display.viewFrom){e.removeAllRanges();return}var C=la(t,e.anchorNode,e.anchorOffset),F=la(t,e.focusNode,e.focusOffset);if(C&&!C.bad&&F&&!F.bad&&wt(ki(C,F),r)==0&&wt(hi(C,F),n)==0)return;var Y=t.display.view,Z=r.line>=t.display.viewFrom&&Os(t,r)||{node:Y[0].measure.map[2],offset:0},q=n.line<t.display.viewTo&&Os(t,n);if(!q){var ce=Y[Y.length-1].measure,me=ce.maps?ce.maps[ce.maps.length-1]:ce.map;q={node:me[me.length-1],offset:me[me.length-2]-me[me.length-3]}}if(!Z||!q){e.removeAllRanges();return}var De=e.rangeCount&&e.getRangeAt(0),we;try{we=b(Z.node,Z.offset,q.offset,q.node)}catch(Fe){}we&&(!D&&t.state.focused?(e.collapse(Z.node,Z.offset),we.collapsed||(e.removeAllRanges(),e.addRange(we))):(e.removeAllRanges(),e.addRange(we)),De&&e.anchorNode==null?e.addRange(De):D&&this.startGracePeriod()),this.rememberSelection()},Kt.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)},Kt.prototype.showMultipleSelections=function(e){h(this.cm.display.cursorDiv,e.cursors),h(this.cm.display.selectionDiv,e.selection)},Kt.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},Kt.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return S(this.div,t)},Kt.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},Kt.prototype.blur=function(){this.div.blur()},Kt.prototype.getField=function(){return this.div},Kt.prototype.supportsTouch=function(){return!0},Kt.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():Ir(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)},Kt.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},Kt.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(u&&v&&this.cm.display.gutterSpecs.length&&eu(e.anchorNode)){this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();return}if(this.composing)return;this.rememberSelection();var i=la(t,e.anchorNode,e.anchorOffset),r=la(t,e.focusNode,e.focusOffset);i&&r&&Ir(t,function(){vr(t.doc,Ei(i,r),Ce),(i.bad||r.bad)&&(t.curOp.selectionChanged=!0)})},Kt.prototype.pollContent=function(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,i=e.doc.sel.primary(),r=i.from(),n=i.to();if(r.ch==0&&r.line>e.firstLine()&&(r=Ve(r.line-1,mt(e.doc,r.line-1).length)),n.ch==mt(e.doc,n.line).text.length&&n.line<e.lastLine()&&(n=Ve(n.line+1,0)),r.line<t.viewFrom||n.line>t.viewTo-1)return!1;var C,F,Y;r.line==t.viewFrom||(C=Ii(e,r.line))==0?(F=Ot(t.view[0].line),Y=t.view[0].node):(F=Ot(t.view[C].line),Y=t.view[C-1].node.nextSibling);var Z=Ii(e,n.line),q,ce;if(Z==t.view.length-1?(q=t.viewTo-1,ce=t.lineDiv.lastChild):(q=Ot(t.view[Z+1].line)-1,ce=t.view[Z+1].node.previousSibling),!Y)return!1;for(var me=e.doc.splitLines(tu(e,Y,ce,F,q)),De=Ur(e.doc,Ve(F,0),Ve(q,mt(e.doc,q).text.length));me.length>1&&De.length>1;)if(te(me)==te(De))me.pop(),De.pop(),q--;else if(me[0]==De[0])me.shift(),De.shift(),F++;else break;for(var we=0,Fe=0,ze=me[0],$e=De[0],it=Math.min(ze.length,$e.length);we<it&&ze.charCodeAt(we)==$e.charCodeAt(we);)++we;for(var ut=te(me),nt=te(De),pt=Math.min(ut.length-(me.length==1?we:0),nt.length-(De.length==1?we:0));Fe<pt&&ut.charCodeAt(ut.length-Fe-1)==nt.charCodeAt(nt.length-Fe-1);)++Fe;if(me.length==1&&De.length==1&&F==r.line)for(;we&&we>r.ch&&ut.charCodeAt(ut.length-Fe-1)==nt.charCodeAt(nt.length-Fe-1);)we--,Fe++;me[me.length-1]=ut.slice(0,ut.length-Fe).replace(/^\u200b+/,""),me[0]=me[0].slice(we).replace(/\u200b+$/,"");var St=Ve(F,we),yt=Ve(q,De.length?te(De).length-Fe:0);if(me.length>1||me[0]||wt(St,yt))return rn(e.doc,me,St,yt,"+input"),!0},Kt.prototype.ensurePolled=function(){this.forceCompositionEnd()},Kt.prototype.reset=function(){this.forceCompositionEnd()},Kt.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},Kt.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)},Kt.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&Ir(this.cm,function(){return Lr(e.cm)})},Kt.prototype.setUneditable=function(e){e.contentEditable="false"},Kt.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||dr(this.cm,Ka)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},Kt.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},Kt.prototype.onContextMenu=function(){},Kt.prototype.resetPosition=function(){},Kt.prototype.needsContentAttribute=!0;function Os(e,t){var i=pa(e,t.line);if(!i||i.hidden)return null;var r=mt(e.doc,t.line),n=ro(i,r,t.line),C=Ye(r,e.doc.direction),F="left";if(C){var Y=Je(C,t.ch);F=Y%2?"right":"left"}var Z=ao(n.map,t.ch,F);return Z.offset=Z.collapse=="right"?Z.end:Z.start,Z}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function ln(e,t){return t&&(e.bad=!0),e}function tu(e,t,i,r,n){var C="",F=!1,Y=e.doc.lineSeparator(),Z=!1;function q(we){return function(Fe){return Fe.id==we}}function ce(){F&&(C+=Y,Z&&(C+=Y),F=Z=!1)}function me(we){we&&(ce(),C+=we)}function De(we){if(we.nodeType==1){var Fe=we.getAttribute("cm-text");if(Fe){me(Fe);return}var ze=we.getAttribute("cm-marker"),$e;if(ze){var it=e.findMarks(Ve(r,0),Ve(n+1,0),q(+ze));it.length&&($e=it[0].find(0))&&me(Ur(e.doc,$e.from,$e.to).join(Y));return}if(we.getAttribute("contenteditable")=="false")return;var ut=/^(pre|div|p|li|table|br)$/i.test(we.nodeName);if(!/^br$/i.test(we.nodeName)&&we.textContent.length==0)return;ut&&ce();for(var nt=0;nt<we.childNodes.length;nt++)De(we.childNodes[nt]);/^(pre|p)$/i.test(we.nodeName)&&(Z=!0),ut&&(F=!0)}else we.nodeType==3&&me(we.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(De(t),t==i);)t=t.nextSibling,Z=!1;return C}function la(e,t,i){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[i],!r)return ln(e.clipPos(Ve(e.display.viewTo-1)),!0);t=null,i=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 n=0;n<e.display.view.length;n++){var C=e.display.view[n];if(C.node==r)return ru(C,t,i)}}function ru(e,t,i){var r=e.text.firstChild,n=!1;if(!t||!S(r,t))return ln(Ve(Ot(e.line),0),!0);if(t==r&&(n=!0,t=r.childNodes[i],i=0,!t)){var C=e.rest?te(e.rest):e.line;return ln(Ve(Ot(C),C.text.length),n)}var F=t.nodeType==3?t:null,Y=t;for(!F&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(F=t.firstChild,i&&(i=F.nodeValue.length));Y.parentNode!=r;)Y=Y.parentNode;var Z=e.measure,q=Z.maps;function ce($e,it,ut){for(var nt=-1;nt<(q?q.length:0);nt++)for(var pt=nt<0?Z.map:q[nt],St=0;St<pt.length;St+=3){var yt=pt[St+2];if(yt==$e||yt==it){var Rt=Ot(nt<0?e.line:e.rest[nt]),Xt=pt[St]+ut;return(ut<0||yt!=$e)&&(Xt=pt[St+(ut?1:0)]),Ve(Rt,Xt)}}}var me=ce(F,Y,i);if(me)return ln(me,n);for(var De=Y.nextSibling,we=F?F.nodeValue.length-i:0;De;De=De.nextSibling){if(me=ce(De,De.firstChild,0),me)return ln(Ve(me.line,me.ch-we),n);we+=De.textContent.length}for(var Fe=Y.previousSibling,ze=i;Fe;Fe=Fe.previousSibling){if(me=ce(Fe,Fe.firstChild,-1),me)return ln(Ve(me.line,me.ch+ze),n);ze+=Fe.textContent.length}}var tr=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new ee,this.hasSelection=!1,this.composing=null};tr.prototype.init=function(e){var t=this,i=this,r=this.cm;this.createField(e);var n=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),y&&(n.style.width="0px"),_e(n,"input",function(){G&&j>=9&&t.hasSelection&&(t.hasSelection=null),i.poll()}),_e(n,"paste",function(F){if(Ke(r,F)||ws(F,r))return;r.state.pasteIncoming=+new Date,i.fastPoll()});function C(F){if(Ke(r,F))return;if(r.somethingSelected())sa({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var Y=Ls(r);sa({lineWise:!0,text:Y.text}),F.type=="cut"?r.setSelections(Y.ranges,null,Ce):(i.prevInput="",n.value=Y.text.join(`
`),V(n))}else return;F.type=="cut"&&(r.state.cutIncoming=+new Date)}_e(n,"cut",C),_e(n,"copy",C),_e(e.scroller,"paste",function(F){if(fi(e,F)||Ke(r,F))return;if(!n.dispatchEvent){r.state.pasteIncoming=+new Date,i.focus();return}var Y=new Event("paste");Y.clipboardData=F.clipboardData,n.dispatchEvent(Y)}),_e(e.lineSpace,"selectstart",function(F){fi(e,F)||re(F)}),_e(n,"compositionstart",function(){var F=r.getCursor("from");i.composing&&i.composing.range.clear(),i.composing={start:F,range:r.markText(F,r.getCursor("to"),{className:"CodeMirror-composing"})}}),_e(n,"compositionend",function(){i.composing&&(i.poll(),i.composing.range.clear(),i.composing=null)})},tr.prototype.createField=function(e){this.wrapper=Ds(),this.textarea=this.wrapper.firstChild},tr.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},tr.prototype.prepareSelection=function(){var e=this.cm,t=e.display,i=e.doc,r=vo(e);if(e.options.moveInputWithCursor){var n=qr(e,i.sel.primary().head,"div"),C=t.wrapper.getBoundingClientRect(),F=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,n.top+F.top-C.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,n.left+F.left-C.left))}return r},tr.prototype.showSelection=function(e){var t=this.cm,i=t.display;h(i.cursorDiv,e.cursors),h(i.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},tr.prototype.reset=function(e){if(this.contextMenuPending||this.composing)return;var t=this.cm;if(t.somethingSelected()){this.prevInput="";var i=t.getSelection();this.textarea.value=i,t.state.focused&&V(this.textarea),G&&j>=9&&(this.hasSelection=i)}else e||(this.prevInput=this.textarea.value="",G&&j>=9&&(this.hasSelection=null))},tr.prototype.getField=function(){return this.textarea},tr.prototype.supportsTouch=function(){return!1},tr.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!o||N()!=this.textarea))try{this.textarea.focus()}catch(e){}},tr.prototype.blur=function(){this.textarea.blur()},tr.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},tr.prototype.receivedFocus=function(){this.slowPoll()},tr.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()})},tr.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function i(){var r=t.poll();!r&&!e?(e=!0,t.polling.set(60,i)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,i)},tr.prototype.poll=function(){var e=this,t=this.cm,i=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||ht(i)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var n=i.value;if(n==r&&!t.somethingSelected())return!1;if(G&&j>=9&&this.hasSelection===n||l&&/[\uf700-\uf7ff]/.test(n))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var C=n.charCodeAt(0);if(C==8203&&!r&&(r="\u200B"),C==8666)return this.reset(),this.cm.execCommand("undo")}for(var F=0,Y=Math.min(r.length,n.length);F<Y&&r.charCodeAt(F)==n.charCodeAt(F);)++F;return Ir(t,function(){Ka(t,n.slice(F),r.length-F,null,e.composing?"*compose":null),n.length>1e3||n.indexOf(`
`)>-1?i.value=e.prevInput="":e.prevInput=n,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},tr.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},tr.prototype.onKeyPress=function(){G&&j>=9&&(this.hasSelection=null),this.fastPoll()},tr.prototype.onContextMenu=function(e){var t=this,i=t.cm,r=i.display,n=t.textarea;t.contextMenuPending&&t.contextMenuPending();var C=Pi(i,e),F=r.scroller.scrollTop;if(!C||A)return;var Y=i.options.resetSelectionOnContextMenu;Y&&i.doc.sel.contains(C)==-1&&dr(i,vr)(i.doc,Ei(C),Ce);var Z=n.style.cssText,q=t.wrapper.style.cssText,ce=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",n.style.cssText=`position: absolute; width: 30px; height: 30px;
top: `+(e.clientY-ce.top-5)+"px; left: "+(e.clientX-ce.left-5)+`px;
z-index: 1000; background: `+(G?"rgba(255, 255, 255, .05)":"transparent")+`;
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var me;I&&(me=window.scrollY),r.input.focus(),I&&window.scrollTo(null,me),r.input.reset(),i.somethingSelected()||(n.value=t.prevInput=" "),t.contextMenuPending=we,r.selForContextMenu=i.doc.sel,clearTimeout(r.detectingSelectAll);function De(){if(n.selectionStart!=null){var ze=i.somethingSelected(),$e="\u200B"+(ze?n.value:"");n.value="\u21DA",n.value=$e,t.prevInput=ze?"":"\u200B",n.selectionStart=1,n.selectionEnd=$e.length,r.selForContextMenu=i.doc.sel}}function we(){if(t.contextMenuPending!=we)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=q,n.style.cssText=Z,G&&j<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=F),n.selectionStart!=null){(!G||G&&j<9)&&De();var ze=0,$e=function(){r.selForContextMenu==i.doc.sel&&n.selectionStart==0&&n.selectionEnd>0&&t.prevInput=="\u200B"?dr(i,$o)(i):ze++<10?r.detectingSelectAll=setTimeout($e,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout($e,200)}}if(G&&j>=9&&De(),k){de(e);var Fe=function(){at(window,"mouseup",Fe),setTimeout(we,20)};_e(window,"mouseup",Fe)}else setTimeout(we,50)},tr.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},tr.prototype.setUneditable=function(){},tr.prototype.needsContentAttribute=!1;function iu(e,t){if(t=t?P(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),t.autofocus==null){var i=N();t.autofocus=i==e||e.getAttribute("autofocus")!=null&&i==document.body}function r(){e.value=Y.getValue()}var n;if(e.form&&(_e(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var C=e.form;n=C.submit;try{var F=C.submit=function(){r(),C.submit=n,C.submit(),C.submit=F}}catch(Z){}}t.finishInit=function(Z){Z.save=r,Z.getTextArea=function(){return e},Z.toTextArea=function(){Z.toTextArea=isNaN,r(),e.parentNode.removeChild(Z.getWrapperElement()),e.style.display="",e.form&&(at(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=n))}},e.style.display="none";var Y=$t(function(Z){return e.parentNode.insertBefore(Z,e.nextSibling)},t);return Y}function nu(e){e.off=at,e.on=_e,e.wheelEventPixels=hl,e.Doc=kr,e.splitLines=Et,e.countColumn=$,e.findColumn=be,e.isWordChar=Me,e.Pass=Oe,e.signal=Be,e.Line=Oi,e.changeEnd=Si,e.scrollbarModel=wo,e.Pos=Ve,e.cmpPos=wt,e.modes=Dt,e.mimeModes=Ze,e.resolveMode=bt,e.getMode=Yt,e.modeExtensions=qt,e.extendMode=rr,e.copyState=Br,e.startState=si,e.innerMode=Sr,e.commands=Pn,e.keyMap=pi,e.keyName=hs,e.isModifierKey=us,e.lookupKey=an,e.normalizeKeyMap=Ml,e.StringStream=Nt,e.SharedTextMarker=On,e.TextMarker=Ti,e.LineWidget=Rn,e.e_preventDefault=re,e.e_stopPropagation=ie,e.e_stop=de,e.addClass=U,e.contains=S,e.rmClass=m,e.keyNames=wi}$l($t),ql($t);var au="iter insert remove copy getEditor constructor".split(" ");for(var ua in kr.prototype)kr.prototype.hasOwnProperty(ua)&&oe(au,ua)<0&&($t.prototype[ua]=function(e){return function(){return e.apply(this.doc,arguments)}}(kr.prototype[ua]));return ye(kr),$t.inputStyles={textarea:tr,contenteditable:Kt},$t.defineMode=function(e){!$t.defaults.mode&&e!="null"&&($t.defaults.mode=e),Er.apply(this,arguments)},$t.defineMIME=_r,$t.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),$t.defineMIME("text/plain","null"),$t.defineExtension=function(e,t){$t.prototype[e]=t},$t.defineDocExtension=function(e,t){kr.prototype[e]=t},$t.fromTextArea=iu,nu($t),$t.version="5.58.2",$t})},Y1PL:function(Tt,dt,le){"use strict";le.r(dt),le.d(dt,"ResizableTextArea",function(){return oe});var he=le("wx14"),J=le("1OyB"),D=le("vuIU"),Q=le("Ji7U"),B=le("LK+K"),_=le("q1tI"),G=le("VTBJ"),j=le("rePB"),I=le("Zm9Q"),R=le("Kwbf"),v=le("c+Xe"),A=le("m+aA"),M=le("bdgK"),L=new Map;function w(Ce){Ce.forEach(function(Ae){var Le,be=Ae.target;(Le=L.get(be))===null||Le===void 0||Le.forEach(function(pe){return pe(be)})})}var y=new M.default(w),u=null,o=null;function l(Ce,Ae){L.has(Ce)||(L.set(Ce,new Set),y.observe(Ce)),L.get(Ce).add(Ae)}function d(Ce,Ae){L.has(Ce)&&(L.get(Ce).delete(Ae),L.get(Ce).size||(y.unobserve(Ce),L.delete(Ce)))}var T=function(Ce){Object(Q.a)(Le,Ce);var Ae=Object(B.a)(Le);function Le(){return Object(J.a)(this,Le),Ae.apply(this,arguments)}return Object(D.a)(Le,[{key:"render",value:function(){return this.props.children}}]),Le}(_.Component),c=_.createContext(null);function p(Ce){var Ae=Ce.children,Le=Ce.onBatchResize,be=_.useRef(0),pe=_.useRef([]),se=_.useContext(c),te=_.useCallback(function(ue,ne,Te){be.current+=1;var Re=be.current;pe.current.push({size:ue,element:ne,data:Te}),Promise.resolve().then(function(){Re===be.current&&(Le==null||Le(pe.current),pe.current=[])}),se==null||se(ue,ne,Te)},[Le,se]);return _.createElement(c.Provider,{value:te},Ae)}function k(Ce){var Ae=Ce.children,Le=Ce.disabled,be=_.useRef(null),pe=_.useRef(null),se=_.useContext(c),te=_.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),ue=_.isValidElement(Ae)&&Object(v.c)(Ae),ne=ue?Ae.ref:null,Te=_.useMemo(function(){return Object(v.a)(ne,be)},[ne,be]),Re=_.useRef(Ce);Re.current=Ce;var xe=_.useCallback(function(Me){var Pe=Re.current,je=Pe.onResize,Ue=Pe.data,Ne=Me.getBoundingClientRect(),Ie=Ne.width,Qe=Ne.height,rt=Me.offsetWidth,et=Me.offsetHeight,Je=Math.floor(Ie),st=Math.floor(Qe);if(te.current.width!==Je||te.current.height!==st||te.current.offsetWidth!==rt||te.current.offsetHeight!==et){var Ye={width:Je,height:st,offsetWidth:rt,offsetHeight:et};te.current=Ye;var Xe=rt===Math.round(Ie)?Ie:rt,_e=et===Math.round(Qe)?Qe:et,ot=Object(G.a)(Object(G.a)({},Ye),{},{offsetWidth:Xe,offsetHeight:_e});se==null||se(ot,Me,Ue),je&&Promise.resolve().then(function(){je(ot,Me)})}},[]);return _.useEffect(function(){var Me=Object(A.a)(be.current)||Object(A.a)(pe.current);return Me&&!Le&&l(Me,xe),function(){return d(Me,xe)}},[be.current,Le]),_.createElement(T,{ref:pe},ue?_.cloneElement(Ae,{ref:Te}):Ae)}var x="rc-observer-key";function m(Ce){var Ae=Ce.children,Le=Object(I.a)(Ae);return Le.map(function(be,pe){var se=(be==null?void 0:be.key)||"".concat(x,"-").concat(pe);return _.createElement(k,Object(he.a)({},Ce,{key:se}),be)})}m.Collection=p;var g=m,h=le("bT9E"),a=le("TSYQ"),E=le.n(a),b=`
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
`,S=["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={},U;function K(Ce){var Ae=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Le=Ce.getAttribute("id")||Ce.getAttribute("data-reactid")||Ce.getAttribute("name");if(Ae&&N[Le])return N[Le];var be=window.getComputedStyle(Ce),pe=be.getPropertyValue("box-sizing")||be.getPropertyValue("-moz-box-sizing")||be.getPropertyValue("-webkit-box-sizing"),se=parseFloat(be.getPropertyValue("padding-bottom"))+parseFloat(be.getPropertyValue("padding-top")),te=parseFloat(be.getPropertyValue("border-bottom-width"))+parseFloat(be.getPropertyValue("border-top-width")),ue=S.map(function(Te){return"".concat(Te,":").concat(be.getPropertyValue(Te))}).join(";"),ne={sizingStyle:ue,paddingSize:se,borderSize:te,boxSizing:pe};return Ae&&Le&&(N[Le]=ne),ne}function V(Ce){var Ae=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Le=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,be=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;U||(U=document.createElement("textarea"),U.setAttribute("tab-index","-1"),U.setAttribute("aria-hidden","true"),document.body.appendChild(U)),Ce.getAttribute("wrap")?U.setAttribute("wrap",Ce.getAttribute("wrap")):U.removeAttribute("wrap");var pe=K(Ce,Ae),se=pe.paddingSize,te=pe.borderSize,ue=pe.boxSizing,ne=pe.sizingStyle;U.setAttribute("style","".concat(ne,";").concat(b)),U.value=Ce.value||Ce.placeholder||"";var Te=Number.MIN_SAFE_INTEGER,Re=Number.MAX_SAFE_INTEGER,xe=U.scrollHeight,Me;if(ue==="border-box"?xe+=te:ue==="content-box"&&(xe-=se),Le!==null||be!==null){U.value=" ";var Pe=U.scrollHeight-se;Le!==null&&(Te=Pe*Le,ue==="border-box"&&(Te=Te+se+te),xe=Math.max(Te,xe)),be!==null&&(Re=Pe*be,ue==="border-box"&&(Re=Re+se+te),Me=xe>Re?"":"hidden",xe=Math.min(Re,xe))}return{height:xe,minHeight:Te,maxHeight:Re,overflowY:Me,resize:"none"}}var O=le("Gytx"),P=le.n(O),$;(function(Ce){Ce[Ce.NONE=0]="NONE",Ce[Ce.RESIZING=1]="RESIZING",Ce[Ce.RESIZED=2]="RESIZED"})($||($={}));var ee=function(Ce){Object(Q.a)(Le,Ce);var Ae=Object(B.a)(Le);function Le(be){var pe;return Object(J.a)(this,Le),pe=Ae.call(this,be),pe.nextFrameActionId=void 0,pe.resizeFrameId=void 0,pe.textArea=void 0,pe.saveTextArea=function(se){pe.textArea=se},pe.handleResize=function(se){var te=pe.state.resizeStatus,ue=pe.props,ne=ue.autoSize,Te=ue.onResize;if(te!==$.NONE)return;typeof Te=="function"&&Te(se),ne&&pe.resizeOnNextFrame()},pe.resizeOnNextFrame=function(){cancelAnimationFrame(pe.nextFrameActionId),pe.nextFrameActionId=requestAnimationFrame(pe.resizeTextarea)},pe.resizeTextarea=function(){var se=pe.props.autoSize;if(!se||!pe.textArea)return;var te=se.minRows,ue=se.maxRows,ne=V(pe.textArea,!1,te,ue);pe.setState({textareaStyles:ne,resizeStatus:$.RESIZING},function(){cancelAnimationFrame(pe.resizeFrameId),pe.resizeFrameId=requestAnimationFrame(function(){pe.setState({resizeStatus:$.RESIZED},function(){pe.resizeFrameId=requestAnimationFrame(function(){pe.setState({resizeStatus:$.NONE}),pe.fixFirefoxAutoScroll()})})})})},pe.renderTextArea=function(){var se=pe.props,te=se.prefixCls,ue=te===void 0?"rc-textarea":te,ne=se.autoSize,Te=se.onResize,Re=se.className,xe=se.disabled,Me=pe.state,Pe=Me.textareaStyles,je=Me.resizeStatus,Ue=Object(h.a)(pe.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Ne=E()(ue,Re,Object(j.a)({},"".concat(ue,"-disabled"),xe));"value"in Ue&&(Ue.value=Ue.value||"");var Ie=Object(G.a)(Object(G.a)(Object(G.a)({},pe.props.style),Pe),je===$.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return _.createElement(g,{onResize:pe.handleResize,disabled:!(ne||Te)},_.createElement("textarea",Object(he.a)({},Ue,{className:Ne,style:Ie,ref:pe.saveTextArea})))},pe.state={textareaStyles:{},resizeStatus:$.NONE},pe}return Object(D.a)(Le,[{key:"componentDidUpdate",value:function(pe){(pe.value!==this.props.value||!P()(pe.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 pe=this.textArea.selectionStart,se=this.textArea.selectionEnd;this.textArea.setSelectionRange(pe,se)}}catch(te){}}},{key:"render",value:function(){return this.renderTextArea()}}]),Le}(_.Component),oe=ee,fe=function(Ce){Object(Q.a)(Le,Ce);var Ae=Object(B.a)(Le);function Le(be){var pe;Object(J.a)(this,Le),pe=Ae.call(this,be),pe.resizableTextArea=void 0,pe.focus=function(){pe.resizableTextArea.textArea.focus()},pe.saveTextArea=function(te){pe.resizableTextArea=te},pe.handleChange=function(te){var ue=pe.props.onChange;pe.setValue(te.target.value,function(){pe.resizableTextArea.resizeTextarea()}),ue&&ue(te)},pe.handleKeyDown=function(te){var ue=pe.props,ne=ue.onPressEnter,Te=ue.onKeyDown;te.keyCode===13&&ne&&ne(te),Te&&Te(te)};var se=typeof be.value=="undefined"||be.value===null?be.defaultValue:be.value;return pe.state={value:se},pe}return Object(D.a)(Le,[{key:"setValue",value:function(pe,se){"value"in this.props||this.setState({value:pe},se)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return _.createElement(oe,Object(he.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(pe){return"value"in pe?{value:pe.value}:null}}]),Le}(_.Component),Oe=dt.default=fe},ZW9T:function(Tt,dt,le){"use strict";le.d(dt,"a",function(){return T});var he=le("k1fw"),J=le("miYZ"),D=le("tsqr"),Q=le("rAM+"),B=le("tJVT"),_=le("PpiC"),G=le("q1tI"),j=le.n(G),I=le("bdgK");function R(c,p,k,x,m){var g=p.getWordUntilPosition(k),h={startLineNumber:k.lineNumber,endLineNumber:k.lineNumber,startColumn:g.startColumn,endColumn:g.endColumn},a=x.map(function(E){return{label:E,kind:c.languages.CompletionItemKind.Keyword,insertText:E,insertTextRules:c.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:h}});return m.map(function(E){a.push(Object(he.a)(Object(he.a)({},E),{},{range:h}))}),a}var v=function(c){var p={label:"ifelse",kind:c.languages.CompletionItemKind.Method,insertText:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
`),insertTextRules:c.languages.CompletionItemInsertTextRule.InsertAsSnippet},k=["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(h,a){var E=R(c,h,a,k,[p]);return{suggestions:E}}});var x=["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(h,a){var E=[{label:"print",kind:c.languages.CompletionItemKind.Snippet,insertText:["print($0)"].join(`
`),insertTextRules:c.languages.CompletionItemInsertTextRule.InsertAsSnippet}],b=R(c,h,a,x,E);return{suggestions:b}}});var m=["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(h,a){var E=[p,{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}],b=R(c,h,a,m,E);return{suggestions:b}}})},A="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",M=le("LvDl");function L(c){return/^\d+$/.test(c)?"".concat(c,"px"):c}function w(){}var y=!1,u={"Python3.6":"python","Python2.7":"python",Dynamips:"cpp",Java:"java",Web:"php",Html:"html",Hive:"sql",Hadoop:"java",SDL:"cpp",PHP:"php",Matlab:"python",Git:"python",Python:"python","C/C++":"cpp","C++":"cpp",C:"cpp",Ruby:"ruby",Shell:"shell",JavaScript:"javascript",Perl6:"perl",Kotlin:"kotlin",Elixir:"elixir",Android:"java",JavaWeb:"java",Go:"go",Spark:"sql",MachineLearning:"python",Verilog:"xml","Verilog/VNC":"xml",Docker:"dockerfile","C#":"csharp",SQLite3:"sql",Oracle:"sql",Vhdl:"vhdl",R:"r",Swift:"swift",SQLServer:"mysql",MySQL:"mysql",Mongo:"sql",PostgreSql:"pgsql",Hbase:"powershell",Sqoop:"sql",Nasm:"cpp",Kafka:"java",Flink:"java",Sml:"javascript",OpenGL:"cpp",Perl5:"perl",Orange:"python"};function o(){var c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],p=c;if(Array.isArray(c)){for(var k=0;k<c.length;k++){var x=u[c[k]];if(x)return x}return p[0]}return u[p]||p}var l=null,d=dt.b=function(c){var p=c.width,k=p===void 0?"100%":p,x=c.height,m=x===void 0?"100%":x,g=c.value,h=c.language,a=h===void 0?"javascript":h,E=c.style,b=E===void 0?{}:E,S=c.options,N=S===void 0?{}:S,U=c.overrideServices,K=U===void 0?{}:U,V=c.theme,O=V===void 0?"vs-dark":V,P=c.onEditBlur,$=c.onSave,ee=c.autoHeight,oe=ee===void 0?!1:ee,fe=c.forbidCopy,Oe=fe===void 0?!1:fe,Ce=c.onChange,Ae=Ce===void 0?w:Ce,Le=c.editorDidMount,be=Le===void 0?w:Le,pe=c.onFocus,se=pe===void 0?w:pe,te=c.filename,ue=te===void 0?"educoder.txt":te,ne=Object(_.a)(c,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename"]),Te=Object(G.useRef)(),Re=Object(G.useRef)({}),xe=Object(G.useRef)(),Me=Object(G.useRef)(!1),Pe=Object(G.useRef)(),je=Object(G.useState)(!1),Ue=Object(B.a)(je,2),Ne=Ue[0],Ie=Ue[1];function Qe(){var ae;return Te.current&&(ae=new I.default(function(de){var ke=Object(Q.a)(de),Se;try{for(ke.s();!(Se=ke.n()).done;){var We=Se.value;(We.target.offsetHeight>0||We.target.offsetWidth>0)&&Re.current.instance.layout()}}catch(tt){ke.e(tt)}finally{ke.f()}}),ae.observe(Te.current)),ae}function rt(){D.b.warn(decodeURIComponent(A))}var et=function(){var de=Re.current.instance;if(g!=null&&de&&Ne){var ke=de.getModel();ke&&g!==ke.getValue()&&(y=!0,ke.setValue(g),de.layout(),y=!1)}};Object(G.useEffect)(function(){xe.current&&clearTimeout(xe.current),xe.current=setTimeout(function(){et()},500)},[g,Ne,Re.current]);function Je(){var ae=Re.current.instance;if(ae){var de=ae.getSelection(),ke=Re.current.pastePos||{},Se=new l.Range(ke.startLineNumber||de.endLineNumber,ke.startColumn||de.endColumn,ke.endLineNumber||de.endLineNumber,ke.endColumn||de.endColumn);setTimeout(function(){ae.executeEdits("",[{range:Se,text:""}])},300)}}function st(ae){(window.navigator.platform.match("Mac")?ae.metaKey:ae.ctrlKey)&&ae.keyCode==83&&(ae.preventDefault(),$())}var Ye=function(){if(oe&&Re.current.instance){var de=Re.current.instance.getContentHeight();re(de<m?m:de)}else re(m)};function Xe(ae){var de=document.createEvent("MouseEvents");de.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),ae.dispatchEvent(de)}function _e(ae,de){var ke=window.URL||window.webkitURL||window,Se=new Blob([de]),We=document.createElementNS("http://www.w3.org/1999/xhtml","a");We.href=ke.createObjectURL(Se),We.download=ae,Xe(We)}Object(G.useEffect)(function(){Ye()},[Ye]),Object(G.useEffect)(function(){Te.current&&!Ne&&le.e(27).then(le.t.bind(null,"M/lh",7)).then(function(ae){try{l=ae,Re.current.instance=l.editor.create(Te.current,{value:g,language:o(a),theme:O,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0},K);var de=Re.current.instance;if(be(de,l),setTimeout(function(){Ye(),Re.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){_e(ue||"educoder.txt",de.getValue())}})},500),Re.current.subscription=de.onDidChangeModelContent(function(Se){Me.current?clearTimeout(Pe.current):(Ye(),Ae(de.getValue(),Se)),Pe.current=setTimeout(function(){Me.current=!1},500)}),window.Monaco||v(l),Oe&&(de.addCommand(l.KeyMod.CtrlCmd|l.KeyMod.Shift|l.KeyCode.KEY_V,function(){return rt(),null}),de.addCommand(l.KeyMod.CtrlCmd|l.KeyCode.KEY_C,function(){return rt(),null})),window.Monaco=l,P&&de.onDidBlurEditorWidget(function(){P(de.getValue())}),se&&de.onDidFocusEditorText(function(){se(de.getValue())}),Oe){de.addCommand(l.KeyMod.CtrlCmd|l.KeyCode.KEY_V,function(){return rt(),null}),de.onDidPaste(function(Se){Re.current.pastePos=Se});try{window.addEventListener("paste",Je)}catch(Se){}}var ke=Qe();return Ie(!0),function(){var Se=Re.current.instance;Se.dispose();var We=Se.getModel();We&&We.dispose(),Re.current.subscription&&Re.current.subscription.dispose(),Oe&&window.removeEventListener("paste",Je),ke.unobserve(Te.current)}}catch(Se){}})},[]),Object(G.useEffect)(function(){var ae=Re.current.instance;if(ae&&Ne)return document.addEventListener("keydown",st,!1),function(){document.removeEventListener("keydown",st)}},[$,Ne]),Object(G.useEffect)(function(){var ae=Re.current.instance;if(ae&&Ne){var de=o(a);l.editor.setModelLanguage(ae.getModel(),de),console.log("language:",a,ae.getModel(),de)}},[a,Ne]),Object(G.useEffect)(function(){var ae=Re.current.instance;ae&&Ne&&l.editor.setTheme(O)},[O,Ne]),Object(G.useEffect)(function(){var ae=Re.current.instance;ae&&Ne&&(ae.updateOptions(Object(he.a)({},N)),setTimeout(function(){ae.getModel().updateOptions(Object(he.a)({},N))},200))},[JSON.stringify(N),Ne]),Object(G.useEffect)(function(){var ae=Re.current.instance;ae&&Ne&&ae.layout()},[k,m,Ne]);var ot=Object(G.useState)(L(k)),at=Object(B.a)(ot,2),Be=at[0],Ke=at[1],Ee=Object(G.useState)(L(m)),ge=Object(B.a)(Ee,2),ye=ge[0],re=ge[1],ie=Object(he.a)(Object(he.a)({},b),{},{width:Be,height:ye});return j.a.createElement("div",{className:"my-monaco-editor",ref:Te,style:ie})};function T(c){var p=c.width,k=p===void 0?"100%":p,x=c.height,m=x===void 0?"100%":x,g=c.original,h=c.modified,a=c.language,E=c.options,b=E===void 0?{}:E,S=Object(G.useRef)(),N=Object(G.useState)(null),U=Object(B.a)(N,2),K=U[0],V=U[1];function O(oe){var fe;return S.current&&(fe=new I.default(function(Oe){var Ce=Object(Q.a)(Oe),Ae;try{for(Ce.s();!(Ae=Ce.n()).done;){var Le=Ae.value;(Le.target.offsetHeight>0||Le.target.offsetWidth>0)&&oe.layout()}}catch(be){Ce.e(be)}finally{Ce.f()}}),fe.observe(S.current)),fe}Object(G.useEffect)(function(){S.current&&le.e(27).then(le.t.bind(null,"M/lh",7)).then(function(oe){l=oe;var fe=l.editor.createDiffEditor(S.current,Object(he.a)(Object(he.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},b),{},{wordWrap:!0}));V(fe);var Oe=O(fe);return function(){fe.dispose();var Ce=fe.getModel();Ce&&Ce.dispose(),Oe.unobserve(S.current)}})},[]),Object(G.useEffect)(function(){K&&K.setModel({original:l.editor.createModel(g,a),modified:l.editor.createModel(h,a)})},[g,h,a,K]);var P=L(k),$=L(m),ee={width:P,height:$};return j.a.createElement("div",{className:"my-diff-editor",ref:S,style:ee})}},ZpRC:function(Tt,dt,le){"use strict";function he(v){return typeof v=="object"&&v!=null&&v.nodeType===1}function J(v,A){return(!A||v!=="hidden")&&v!=="visible"&&v!=="clip"}function D(v,A){if(v.clientHeight<v.scrollHeight||v.clientWidth<v.scrollWidth){var M=getComputedStyle(v,null);return J(M.overflowY,A)||J(M.overflowX,A)||function(L){var w=function(y){if(!y.ownerDocument||!y.ownerDocument.defaultView)return null;try{return y.ownerDocument.defaultView.frameElement}catch(u){return null}}(L);return!!w&&(w.clientHeight<L.scrollHeight||w.clientWidth<L.scrollWidth)}(v)}return!1}function Q(v,A,M,L,w,y,u,o){return y<v&&u>A||y>v&&u<A?0:y<=v&&o<=M||u>=A&&o>=M?y-v-L:u>A&&o<M||y<v&&o>M?u-A+w:0}var B=function(v,A){var M=window,L=A.scrollMode,w=A.block,y=A.inline,u=A.boundary,o=A.skipOverflowHiddenElements,l=typeof u=="function"?u:function(Pe){return Pe!==u};if(!he(v))throw new TypeError("Invalid target");for(var d=document.scrollingElement||document.documentElement,T=[],c=v;he(c)&&l(c);){if((c=c.parentElement)===d){T.push(c);break}c!=null&&c===document.body&&D(c)&&!D(document.documentElement)||c!=null&&D(c,o)&&T.push(c)}for(var p=M.visualViewport?M.visualViewport.width:innerWidth,k=M.visualViewport?M.visualViewport.height:innerHeight,x=window.scrollX||pageXOffset,m=window.scrollY||pageYOffset,g=v.getBoundingClientRect(),h=g.height,a=g.width,E=g.top,b=g.right,S=g.bottom,N=g.left,U=w==="start"||w==="nearest"?E:w==="end"?S:E+h/2,K=y==="center"?N+a/2:y==="end"?b:N,V=[],O=0;O<T.length;O++){var P=T[O],$=P.getBoundingClientRect(),ee=$.height,oe=$.width,fe=$.top,Oe=$.right,Ce=$.bottom,Ae=$.left;if(L==="if-needed"&&E>=0&&N>=0&&S<=k&&b<=p&&E>=fe&&S<=Ce&&N>=Ae&&b<=Oe)return V;var Le=getComputedStyle(P),be=parseInt(Le.borderLeftWidth,10),pe=parseInt(Le.borderTopWidth,10),se=parseInt(Le.borderRightWidth,10),te=parseInt(Le.borderBottomWidth,10),ue=0,ne=0,Te="offsetWidth"in P?P.offsetWidth-P.clientWidth-be-se:0,Re="offsetHeight"in P?P.offsetHeight-P.clientHeight-pe-te:0;if(d===P)ue=w==="start"?U:w==="end"?U-k:w==="nearest"?Q(m,m+k,k,pe,te,m+U,m+U+h,h):U-k/2,ne=y==="start"?K:y==="center"?K-p/2:y==="end"?K-p:Q(x,x+p,p,be,se,x+K,x+K+a,a),ue=Math.max(0,ue+m),ne=Math.max(0,ne+x);else{ue=w==="start"?U-fe-pe:w==="end"?U-Ce+te+Re:w==="nearest"?Q(fe,Ce,ee,pe,te+Re,U,U+h,h):U-(fe+ee/2)+Re/2,ne=y==="start"?K-Ae-be:y==="center"?K-(Ae+oe/2)+Te/2:y==="end"?K-Oe+se+Te:Q(Ae,Oe,oe,be,se+Te,K,K+a,a);var xe=P.scrollLeft,Me=P.scrollTop;U+=Me-(ue=Math.max(0,Math.min(Me+ue,P.scrollHeight-ee+Re))),K+=xe-(ne=Math.max(0,Math.min(xe+ne,P.scrollWidth-oe+Te)))}V.push({el:P,top:ue,left:ne})}return V};function _(v){return v===Object(v)&&Object.keys(v).length!==0}function G(v,A){A===void 0&&(A="auto");var M="scrollBehavior"in document.body.style;v.forEach(function(L){var w=L.el,y=L.top,u=L.left;w.scroll&&M?w.scroll({top:y,left:u,behavior:A}):(w.scrollTop=y,w.scrollLeft=u)})}function j(v){return v===!1?{block:"end",inline:"nearest"}:_(v)?v:{block:"start",inline:"nearest"}}function I(v,A){var M=!v.ownerDocument.documentElement.contains(v);if(_(A)&&typeof A.behavior=="function")return A.behavior(M?[]:B(v,A));if(M)return;var L=j(A);return G(B(v,L),L.behavior)}var R=dt.a=I},Zss7:function(Tt,dt,le){var he;(function(J){var D=/^\s+/,Q=/\s+$/,B=0,_=J.round,G=J.min,j=J.max,I=J.random;function R(te,ue){if(te=te||"",ue=ue||{},te instanceof R)return te;if(!(this instanceof R))return new R(te,ue);var ne=v(te);this._originalInput=te,this._r=ne.r,this._g=ne.g,this._b=ne.b,this._a=ne.a,this._roundA=_(100*this._a)/100,this._format=ue.format||ne.format,this._gradientType=ue.gradientType,this._r<1&&(this._r=_(this._r)),this._g<1&&(this._g=_(this._g)),this._b<1&&(this._b=_(this._b)),this._ok=ne.ok,this._tc_id=B++}R.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 te=this.toRgb();return(te.r*299+te.g*587+te.b*114)/1e3},getLuminance:function(){var te=this.toRgb(),ue,ne,Te,Re,xe,Me;return ue=te.r/255,ne=te.g/255,Te=te.b/255,ue<=.03928?Re=ue/12.92:Re=J.pow((ue+.055)/1.055,2.4),ne<=.03928?xe=ne/12.92:xe=J.pow((ne+.055)/1.055,2.4),Te<=.03928?Me=Te/12.92:Me=J.pow((Te+.055)/1.055,2.4),.2126*Re+.7152*xe+.0722*Me},setAlpha:function(te){return this._a=V(te),this._roundA=_(100*this._a)/100,this},toHsv:function(){var te=w(this._r,this._g,this._b);return{h:te.h*360,s:te.s,v:te.v,a:this._a}},toHsvString:function(){var te=w(this._r,this._g,this._b),ue=_(te.h*360),ne=_(te.s*100),Te=_(te.v*100);return this._a==1?"hsv("+ue+", "+ne+"%, "+Te+"%)":"hsva("+ue+", "+ne+"%, "+Te+"%, "+this._roundA+")"},toHsl:function(){var te=M(this._r,this._g,this._b);return{h:te.h*360,s:te.s,l:te.l,a:this._a}},toHslString:function(){var te=M(this._r,this._g,this._b),ue=_(te.h*360),ne=_(te.s*100),Te=_(te.l*100);return this._a==1?"hsl("+ue+", "+ne+"%, "+Te+"%)":"hsla("+ue+", "+ne+"%, "+Te+"%, "+this._roundA+")"},toHex:function(te){return u(this._r,this._g,this._b,te)},toHexString:function(te){return"#"+this.toHex(te)},toHex8:function(te){return o(this._r,this._g,this._b,this._a,te)},toHex8String:function(te){return"#"+this.toHex8(te)},toRgb:function(){return{r:_(this._r),g:_(this._g),b:_(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+_(this._r)+", "+_(this._g)+", "+_(this._b)+")":"rgba("+_(this._r)+", "+_(this._g)+", "+_(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:_(O(this._r,255)*100)+"%",g:_(O(this._g,255)*100)+"%",b:_(O(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+_(O(this._r,255)*100)+"%, "+_(O(this._g,255)*100)+"%, "+_(O(this._b,255)*100)+"%)":"rgba("+_(O(this._r,255)*100)+"%, "+_(O(this._g,255)*100)+"%, "+_(O(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:U[u(this._r,this._g,this._b,!0)]||!1},toFilter:function(te){var ue="#"+l(this._r,this._g,this._b,this._a),ne=ue,Te=this._gradientType?"GradientType = 1, ":"";if(te){var Re=R(te);ne="#"+l(Re._r,Re._g,Re._b,Re._a)}return"progid:DXImageTransform.Microsoft.gradient("+Te+"startColorstr="+ue+",endColorstr="+ne+")"},toString:function(te){var ue=!!te;te=te||this._format;var ne=!1,Te=this._a<1&&this._a>=0,Re=!ue&&Te&&(te==="hex"||te==="hex6"||te==="hex3"||te==="hex4"||te==="hex8"||te==="name");return Re?te==="name"&&this._a===0?this.toName():this.toRgbString():(te==="rgb"&&(ne=this.toRgbString()),te==="prgb"&&(ne=this.toPercentageRgbString()),(te==="hex"||te==="hex6")&&(ne=this.toHexString()),te==="hex3"&&(ne=this.toHexString(!0)),te==="hex4"&&(ne=this.toHex8String(!0)),te==="hex8"&&(ne=this.toHex8String()),te==="name"&&(ne=this.toName()),te==="hsl"&&(ne=this.toHslString()),te==="hsv"&&(ne=this.toHsvString()),ne||this.toHexString())},clone:function(){return R(this.toString())},_applyModification:function(te,ue){var ne=te.apply(null,[this].concat([].slice.call(ue)));return this._r=ne._r,this._g=ne._g,this._b=ne._b,this.setAlpha(ne._a),this},lighten:function(){return this._applyModification(p,arguments)},brighten:function(){return this._applyModification(k,arguments)},darken:function(){return this._applyModification(x,arguments)},desaturate:function(){return this._applyModification(d,arguments)},saturate:function(){return this._applyModification(T,arguments)},greyscale:function(){return this._applyModification(c,arguments)},spin:function(){return this._applyModification(m,arguments)},_applyCombination:function(te,ue){return te.apply(null,[this].concat([].slice.call(ue)))},analogous:function(){return this._applyCombination(b,arguments)},complement:function(){return this._applyCombination(g,arguments)},monochromatic:function(){return this._applyCombination(S,arguments)},splitcomplement:function(){return this._applyCombination(E,arguments)},triad:function(){return this._applyCombination(h,arguments)},tetrad:function(){return this._applyCombination(a,arguments)}},R.fromRatio=function(te,ue){if(typeof te=="object"){var ne={};for(var Te in te)te.hasOwnProperty(Te)&&(Te==="a"?ne[Te]=te[Te]:ne[Te]=Oe(te[Te]));te=ne}return R(te,ue)};function v(te){var ue={r:0,g:0,b:0},ne=1,Te=null,Re=null,xe=null,Me=!1,Pe=!1;return typeof te=="string"&&(te=pe(te)),typeof te=="object"&&(be(te.r)&&be(te.g)&&be(te.b)?(ue=A(te.r,te.g,te.b),Me=!0,Pe=String(te.r).substr(-1)==="%"?"prgb":"rgb"):be(te.h)&&be(te.s)&&be(te.v)?(Te=Oe(te.s),Re=Oe(te.v),ue=y(te.h,Te,Re),Me=!0,Pe="hsv"):be(te.h)&&be(te.s)&&be(te.l)&&(Te=Oe(te.s),xe=Oe(te.l),ue=L(te.h,Te,xe),Me=!0,Pe="hsl"),te.hasOwnProperty("a")&&(ne=te.a)),ne=V(ne),{ok:Me,format:te.format||Pe,r:G(255,j(ue.r,0)),g:G(255,j(ue.g,0)),b:G(255,j(ue.b,0)),a:ne}}function A(te,ue,ne){return{r:O(te,255)*255,g:O(ue,255)*255,b:O(ne,255)*255}}function M(te,ue,ne){te=O(te,255),ue=O(ue,255),ne=O(ne,255);var Te=j(te,ue,ne),Re=G(te,ue,ne),xe,Me,Pe=(Te+Re)/2;if(Te==Re)xe=Me=0;else{var je=Te-Re;Me=Pe>.5?je/(2-Te-Re):je/(Te+Re);switch(Te){case te:xe=(ue-ne)/je+(ue<ne?6:0);break;case ue:xe=(ne-te)/je+2;break;case ne:xe=(te-ue)/je+4;break}xe/=6}return{h:xe,s:Me,l:Pe}}function L(te,ue,ne){var Te,Re,xe;te=O(te,360),ue=O(ue,100),ne=O(ne,100);function Me(Ue,Ne,Ie){return Ie<0&&(Ie+=1),Ie>1&&(Ie-=1),Ie<1/6?Ue+(Ne-Ue)*6*Ie:Ie<1/2?Ne:Ie<2/3?Ue+(Ne-Ue)*(2/3-Ie)*6:Ue}if(ue===0)Te=Re=xe=ne;else{var Pe=ne<.5?ne*(1+ue):ne+ue-ne*ue,je=2*ne-Pe;Te=Me(je,Pe,te+1/3),Re=Me(je,Pe,te),xe=Me(je,Pe,te-1/3)}return{r:Te*255,g:Re*255,b:xe*255}}function w(te,ue,ne){te=O(te,255),ue=O(ue,255),ne=O(ne,255);var Te=j(te,ue,ne),Re=G(te,ue,ne),xe,Me,Pe=Te,je=Te-Re;if(Me=Te===0?0:je/Te,Te==Re)xe=0;else{switch(Te){case te:xe=(ue-ne)/je+(ue<ne?6:0);break;case ue:xe=(ne-te)/je+2;break;case ne:xe=(te-ue)/je+4;break}xe/=6}return{h:xe,s:Me,v:Pe}}function y(te,ue,ne){te=O(te,360)*6,ue=O(ue,100),ne=O(ne,100);var Te=J.floor(te),Re=te-Te,xe=ne*(1-ue),Me=ne*(1-Re*ue),Pe=ne*(1-(1-Re)*ue),je=Te%6,Ue=[ne,Me,xe,xe,Pe,ne][je],Ne=[Pe,ne,ne,Me,xe,xe][je],Ie=[xe,xe,Pe,ne,ne,Me][je];return{r:Ue*255,g:Ne*255,b:Ie*255}}function u(te,ue,ne,Te){var Re=[fe(_(te).toString(16)),fe(_(ue).toString(16)),fe(_(ne).toString(16))];return Te&&Re[0].charAt(0)==Re[0].charAt(1)&&Re[1].charAt(0)==Re[1].charAt(1)&&Re[2].charAt(0)==Re[2].charAt(1)?Re[0].charAt(0)+Re[1].charAt(0)+Re[2].charAt(0):Re.join("")}function o(te,ue,ne,Te,Re){var xe=[fe(_(te).toString(16)),fe(_(ue).toString(16)),fe(_(ne).toString(16)),fe(Ce(Te))];return Re&&xe[0].charAt(0)==xe[0].charAt(1)&&xe[1].charAt(0)==xe[1].charAt(1)&&xe[2].charAt(0)==xe[2].charAt(1)&&xe[3].charAt(0)==xe[3].charAt(1)?xe[0].charAt(0)+xe[1].charAt(0)+xe[2].charAt(0)+xe[3].charAt(0):xe.join("")}function l(te,ue,ne,Te){var Re=[fe(Ce(Te)),fe(_(te).toString(16)),fe(_(ue).toString(16)),fe(_(ne).toString(16))];return Re.join("")}R.equals=function(te,ue){return!te||!ue?!1:R(te).toRgbString()==R(ue).toRgbString()},R.random=function(){return R.fromRatio({r:I(),g:I(),b:I()})};function d(te,ue){ue=ue===0?0:ue||10;var ne=R(te).toHsl();return ne.s-=ue/100,ne.s=P(ne.s),R(ne)}function T(te,ue){ue=ue===0?0:ue||10;var ne=R(te).toHsl();return ne.s+=ue/100,ne.s=P(ne.s),R(ne)}function c(te){return R(te).desaturate(100)}function p(te,ue){ue=ue===0?0:ue||10;var ne=R(te).toHsl();return ne.l+=ue/100,ne.l=P(ne.l),R(ne)}function k(te,ue){ue=ue===0?0:ue||10;var ne=R(te).toRgb();return ne.r=j(0,G(255,ne.r-_(255*-(ue/100)))),ne.g=j(0,G(255,ne.g-_(255*-(ue/100)))),ne.b=j(0,G(255,ne.b-_(255*-(ue/100)))),R(ne)}function x(te,ue){ue=ue===0?0:ue||10;var ne=R(te).toHsl();return ne.l-=ue/100,ne.l=P(ne.l),R(ne)}function m(te,ue){var ne=R(te).toHsl(),Te=(ne.h+ue)%360;return ne.h=Te<0?360+Te:Te,R(ne)}function g(te){var ue=R(te).toHsl();return ue.h=(ue.h+180)%360,R(ue)}function h(te){var ue=R(te).toHsl(),ne=ue.h;return[R(te),R({h:(ne+120)%360,s:ue.s,l:ue.l}),R({h:(ne+240)%360,s:ue.s,l:ue.l})]}function a(te){var ue=R(te).toHsl(),ne=ue.h;return[R(te),R({h:(ne+90)%360,s:ue.s,l:ue.l}),R({h:(ne+180)%360,s:ue.s,l:ue.l}),R({h:(ne+270)%360,s:ue.s,l:ue.l})]}function E(te){var ue=R(te).toHsl(),ne=ue.h;return[R(te),R({h:(ne+72)%360,s:ue.s,l:ue.l}),R({h:(ne+216)%360,s:ue.s,l:ue.l})]}function b(te,ue,ne){ue=ue||6,ne=ne||30;var Te=R(te).toHsl(),Re=360/ne,xe=[R(te)];for(Te.h=(Te.h-(Re*ue>>1)+720)%360;--ue;)Te.h=(Te.h+Re)%360,xe.push(R(Te));return xe}function S(te,ue){ue=ue||6;for(var ne=R(te).toHsv(),Te=ne.h,Re=ne.s,xe=ne.v,Me=[],Pe=1/ue;ue--;)Me.push(R({h:Te,s:Re,v:xe})),xe=(xe+Pe)%1;return Me}R.mix=function(te,ue,ne){ne=ne===0?0:ne||50;var Te=R(te).toRgb(),Re=R(ue).toRgb(),xe=ne/100,Me={r:(Re.r-Te.r)*xe+Te.r,g:(Re.g-Te.g)*xe+Te.g,b:(Re.b-Te.b)*xe+Te.b,a:(Re.a-Te.a)*xe+Te.a};return R(Me)},R.readability=function(te,ue){var ne=R(te),Te=R(ue);return(J.max(ne.getLuminance(),Te.getLuminance())+.05)/(J.min(ne.getLuminance(),Te.getLuminance())+.05)},R.isReadable=function(te,ue,ne){var Te=R.readability(te,ue),Re,xe;xe=!1,Re=se(ne);switch(Re.level+Re.size){case"AAsmall":case"AAAlarge":xe=Te>=4.5;break;case"AAlarge":xe=Te>=3;break;case"AAAsmall":xe=Te>=7;break}return xe},R.mostReadable=function(te,ue,ne){var Te=null,Re=0,xe,Me,Pe,je;ne=ne||{},Me=ne.includeFallbackColors,Pe=ne.level,je=ne.size;for(var Ue=0;Ue<ue.length;Ue++)xe=R.readability(te,ue[Ue]),xe>Re&&(Re=xe,Te=R(ue[Ue]));return R.isReadable(te,Te,{level:Pe,size:je})||!Me?Te:(ne.includeFallbackColors=!1,R.mostReadable(te,["#fff","#000"],ne))};var N=R.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},U=R.hexNames=K(N);function K(te){var ue={};for(var ne in te)te.hasOwnProperty(ne)&&(ue[te[ne]]=ne);return ue}function V(te){return te=parseFloat(te),(isNaN(te)||te<0||te>1)&&(te=1),te}function O(te,ue){ee(te)&&(te="100%");var ne=oe(te);return te=G(ue,j(0,parseFloat(te))),ne&&(te=parseInt(te*ue,10)/100),J.abs(te-ue)<1e-6?1:te%ue/parseFloat(ue)}function P(te){return G(1,j(0,te))}function $(te){return parseInt(te,16)}function ee(te){return typeof te=="string"&&te.indexOf(".")!=-1&&parseFloat(te)===1}function oe(te){return typeof te=="string"&&te.indexOf("%")!=-1}function fe(te){return te.length==1?"0"+te:""+te}function Oe(te){return te<=1&&(te=te*100+"%"),te}function Ce(te){return J.round(parseFloat(te)*255).toString(16)}function Ae(te){return $(te)/255}var Le=function(){var te="[-\\+]?\\d+%?",ue="[-\\+]?\\d*\\.\\d+%?",ne="(?:"+ue+")|(?:"+te+")",Te="[\\s|\\(]+("+ne+")[,|\\s]+("+ne+")[,|\\s]+("+ne+")\\s*\\)?",Re="[\\s|\\(]+("+ne+")[,|\\s]+("+ne+")[,|\\s]+("+ne+")[,|\\s]+("+ne+")\\s*\\)?";return{CSS_UNIT:new RegExp(ne),rgb:new RegExp("rgb"+Te),rgba:new RegExp("rgba"+Re),hsl:new RegExp("hsl"+Te),hsla:new RegExp("hsla"+Re),hsv:new RegExp("hsv"+Te),hsva:new RegExp("hsva"+Re),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 be(te){return!!Le.CSS_UNIT.exec(te)}function pe(te){te=te.replace(D,"").replace(Q,"").toLowerCase();var ue=!1;if(N[te])te=N[te],ue=!0;else if(te=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var ne;return(ne=Le.rgb.exec(te))?{r:ne[1],g:ne[2],b:ne[3]}:(ne=Le.rgba.exec(te))?{r:ne[1],g:ne[2],b:ne[3],a:ne[4]}:(ne=Le.hsl.exec(te))?{h:ne[1],s:ne[2],l:ne[3]}:(ne=Le.hsla.exec(te))?{h:ne[1],s:ne[2],l:ne[3],a:ne[4]}:(ne=Le.hsv.exec(te))?{h:ne[1],s:ne[2],v:ne[3]}:(ne=Le.hsva.exec(te))?{h:ne[1],s:ne[2],v:ne[3],a:ne[4]}:(ne=Le.hex8.exec(te))?{r:$(ne[1]),g:$(ne[2]),b:$(ne[3]),a:Ae(ne[4]),format:ue?"name":"hex8"}:(ne=Le.hex6.exec(te))?{r:$(ne[1]),g:$(ne[2]),b:$(ne[3]),format:ue?"name":"hex"}:(ne=Le.hex4.exec(te))?{r:$(ne[1]+""+ne[1]),g:$(ne[2]+""+ne[2]),b:$(ne[3]+""+ne[3]),a:Ae(ne[4]+""+ne[4]),format:ue?"name":"hex8"}:(ne=Le.hex3.exec(te))?{r:$(ne[1]+""+ne[1]),g:$(ne[2]+""+ne[2]),b:$(ne[3]+""+ne[3]),format:ue?"name":"hex"}:!1}function se(te){var ue,ne;return te=te||{level:"AA",size:"small"},ue=(te.level||"AA").toUpperCase(),ne=(te.size||"small").toLowerCase(),ue!=="AA"&&ue!=="AAA"&&(ue="AA"),ne!=="small"&&ne!=="large"&&(ne="small"),{level:ue,size:ne}}Tt.exports?Tt.exports=R:!(he=function(){return R}.call(dt,le,dt,Tt),he!==void 0&&(Tt.exports=he))})(Math)},bT9E:function(Tt,dt,le){"use strict";le.d(dt,"a",function(){return J});var he=le("VTBJ");function J(D,Q){var B=Object(he.a)({},D);return Array.isArray(Q)&&Q.forEach(function(_){delete B[_]}),B}},c5Ni:function(Tt,dt,le){},dejd:function(Tt,dt,le){},dmUQ:function(Tt,dt,le){"use strict";var he=le("Ff2n"),J=le("rePB"),D=le("1OyB"),Q=le("vuIU"),B=le("Ji7U"),_=le("md7G"),G=le("foSv"),j=le("q1tI"),I=le.n(j),R=le("TSYQ"),v=le.n(R),A=le("4IlW");function M(h,a){var E=Object.keys(h);if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(h);a&&(b=b.filter(function(S){return Object.getOwnPropertyDescriptor(h,S).enumerable})),E.push.apply(E,b)}return E}function L(h){for(var a=1;a<arguments.length;a++){var E=arguments[a]!=null?arguments[a]:{};a%2?M(Object(E),!0).forEach(function(b){Object(J.a)(h,b,E[b])}):Object.getOwnPropertyDescriptors?Object.defineProperties(h,Object.getOwnPropertyDescriptors(E)):M(Object(E)).forEach(function(b){Object.defineProperty(h,b,Object.getOwnPropertyDescriptor(E,b))})}return h}function w(h){var a=y();return function(){var b=Object(G.a)(h),S;if(a){var N=Object(G.a)(this).constructor;S=Reflect.construct(b,arguments,N)}else S=b.apply(this,arguments);return Object(_.a)(this,S)}}function y(){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(h){return!1}}function u(){}function o(h){h.preventDefault()}var l=function(a){return a.replace(/[^\w.-]+/g,"")},d=200,T=600,c=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,p=function(a){return a!=null},k=function(a,E){return E===a||typeof E=="number"&&typeof a=="number"&&isNaN(E)&&isNaN(a)},x=function(h){Object(B.a)(E,h);var a=w(E);function E(b){var S;Object(D.a)(this,E),S=a.call(this,b),S.onKeyDown=function(K){var V=S.props,O=V.onKeyDown,P=V.onPressEnter;if(K.keyCode===A.a.UP){var $=S.getRatio(K);S.up(K,$,null),S.stop()}else if(K.keyCode===A.a.DOWN){var ee=S.getRatio(K);S.down(K,ee,null),S.stop()}else K.keyCode===A.a.ENTER&&P&&P(K);if(S.recordCursorPosition(),S.lastKeyCode=K.keyCode,O){for(var oe=arguments.length,fe=new Array(oe>1?oe-1:0),Oe=1;Oe<oe;Oe++)fe[Oe-1]=arguments[Oe];O.apply(void 0,[K].concat(fe))}},S.onKeyUp=function(K){var V=S.props.onKeyUp;if(S.stop(),S.recordCursorPosition(),V){for(var O=arguments.length,P=new Array(O>1?O-1:0),$=1;$<O;$++)P[$-1]=arguments[$];V.apply(void 0,[K].concat(P))}},S.onChange=function(K){var V=S.props.onChange;S.state.focused&&(S.inputting=!0),S.rawInput=S.props.parser(S.getValueFromEvent(K)),S.setState({inputValue:S.rawInput}),V(S.toNumber(S.rawInput))},S.onMouseUp=function(){var K=S.props.onMouseUp;S.recordCursorPosition(),K&&K.apply(void 0,arguments)},S.onFocus=function(){var K;S.setState({focused:!0}),(K=S.props).onFocus.apply(K,arguments)},S.onBlur=function(){var K=S.props.onBlur;S.inputting=!1,S.setState({focused:!1});var V=S.getCurrentValidValue(S.state.inputValue),O=S.setValue(V,u);if(K){var P=S.input.value,$=S.getInputDisplayValue({focus:!1,value:O});S.input.value=$&&Number($),K.apply(void 0,arguments),S.input.value=P}},S.getRatio=function(K){var V=1;return K.metaKey||K.ctrlKey?V=.1:K.shiftKey&&(V=10),V},S.getFullNum=function(K){return isNaN(K)?K:/e/i.test(String(K))?Number(K).toFixed(18).replace(/\.?0+$/,""):K},S.getPrecision=function(K){if(p(S.props.precision))return S.props.precision;var V=String(K);if(V.indexOf("e-")>=0)return parseInt(V.slice(V.indexOf("e-")+2),10);var O=0;return V.indexOf(".")>=0&&(O=V.length-V.indexOf(".")-1),O},S.getInputDisplayValue=function(K){var V=K||S.state,O=V.focused,P=V.inputValue,$=V.value,ee;O?ee=P:ee=S.toPrecisionAsStep($),ee==null&&(ee="");var oe=S.formatWrapper(ee);return p(S.props.decimalSeparator)&&(oe=oe.toString().replace(".",S.props.decimalSeparator)),oe},S.recordCursorPosition=function(){try{S.cursorStart=S.input.selectionStart,S.cursorEnd=S.input.selectionEnd,S.currentValue=S.input.value,S.cursorBefore=S.input.value.substring(0,S.cursorStart),S.cursorAfter=S.input.value.substring(S.cursorEnd)}catch(K){}},S.restoreByAfter=function(K){if(K===void 0)return!1;var V=S.input.value,O=V.lastIndexOf(K);if(O===-1)return!1;var P=S.cursorBefore.length;return S.lastKeyCode===A.a.DELETE&&S.cursorBefore.charAt(P-1)===K[0]?(S.fixCaret(P,P),!0):O+K.length===V.length?(S.fixCaret(O,O),!0):!1},S.partRestoreByAfter=function(K){return K===void 0?!1:Array.prototype.some.call(K,function(V,O){var P=K.substring(O);return S.restoreByAfter(P)})},S.isNotCompleteNumber=function(K){return isNaN(K)||K===""||K===null||K&&K.toString().indexOf(".")===K.toString().length-1},S.stop=function(){S.autoStepTimer&&clearTimeout(S.autoStepTimer)},S.down=function(K,V,O){S.pressingUpOrDown=!0,S.step("down",K,V,O)},S.up=function(K,V,O){S.pressingUpOrDown=!0,S.step("up",K,V,O)},S.saveInput=function(K){S.input=K};var N=b.value;N===void 0&&(N=b.defaultValue),S.state={focused:b.autoFocus};var U=S.getValidValue(S.toNumber(N));return S.state=L(L({},S.state),{},{inputValue:S.toPrecisionAsStep(U),value:U}),S}return Object(Q.a)(E,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(S){var N=this.props,U=N.value,K=N.onChange,V=N.max,O=N.min,P=this.state.focused;if(S){if(!k(S.value,U)||!k(S.max,V)||!k(S.min,O)){var $=P?U:this.getValidValue(U),ee;this.pressingUpOrDown?ee=$:this.inputting?ee=this.rawInput:ee=this.toPrecisionAsStep($),this.setState({value:$,inputValue:ee})}var oe="value"in this.props?U:this.state.value;"max"in this.props&&S.max!==V&&typeof oe=="number"&&oe>V&&K&&K(V),"min"in this.props&&S.min!==O&&typeof oe=="number"&&oe<O&&K&&K(O)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var fe=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===A.a.BACKSPACE?fe=this.cursorStart-1:this.lastKeyCode===A.a.DELETE&&(fe=this.cursorStart):fe=this.input.value.length,this.fixCaret(fe,fe)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case A.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case A.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(Oe){}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(S){var N=S;return N===""?N="":this.isNotCompleteNumber(parseFloat(N))?N=this.state.value:N=this.getValidValue(N),this.toNumber(N)}},{key:"getValueFromEvent",value:function(S){var N=S.target.value.trim().replace(/。/g,".");return p(this.props.decimalSeparator)&&(N=N.replace(this.props.decimalSeparator,".")),N}},{key:"getValidValue",value:function(S){var N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,U=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,K=parseFloat(S);return isNaN(K)?S:(K<N&&(K=N),K>U&&(K=U),K)}},{key:"setValue",value:function(S,N){var U=this.props.precision,K=this.isNotCompleteNumber(parseFloat(S))?null:parseFloat(S),V=this.state.value,O=V===void 0?null:V,P=this.state.inputValue,$=P===void 0?null:P,ee=typeof K=="number"?K.toFixed(U):"".concat(K),oe=K!==O||ee!=="".concat($);return"value"in this.props?($=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:$},N)):this.setState({value:K,inputValue:this.toPrecisionAsStep(S)},N),oe&&this.props.onChange(K),K}},{key:"getMaxPrecision",value:function(S){var N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,U=this.props,K=U.precision,V=U.step;if(p(K))return K;var O=this.getPrecision(N),P=this.getPrecision(V),$=this.getPrecision(S);return S?Math.max($,O+P):O+P}},{key:"getPrecisionFactor",value:function(S){var N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,U=this.getMaxPrecision(S,N);return Math.pow(10,U)}},{key:"focus",value:function(){this.input.focus(),this.recordCursorPosition()}},{key:"blur",value:function(){this.input.blur()}},{key:"select",value:function(){this.input.select()}},{key:"formatWrapper",value:function(S){return this.props.formatter?this.props.formatter(S):S}},{key:"toPrecisionAsStep",value:function(S){if(this.isNotCompleteNumber(S)||S==="")return S;var N=Math.abs(this.getMaxPrecision(S));return isNaN(N)?S.toString():Number(S).toFixed(N)}},{key:"toNumber",value:function(S){var N=this.props.precision,U=this.state.focused,K=S&&S.length>16&&U;return this.isNotCompleteNumber(S)||K?S:p(N)?Math.round(S*Math.pow(10,N))/Math.pow(10,N):Number(S)}},{key:"upStep",value:function(S,N){var U=this.props.step,K=this.getPrecisionFactor(S,N),V=Math.abs(this.getMaxPrecision(S,N)),O=((K*S+K*U*N)/K).toFixed(V);return this.toNumber(O)}},{key:"downStep",value:function(S,N){var U=this.props.step,K=this.getPrecisionFactor(S,N),V=Math.abs(this.getMaxPrecision(S,N)),O=((K*S-K*U*N)/K).toFixed(V);return this.toNumber(O)}},{key:"step",value:function(S,N){var U=this,K=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,V=arguments.length>3?arguments[3]:void 0;this.stop(),N&&(N.persist(),N.preventDefault());var O=this.props;if(O.disabled)return;var P=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(P))return;var $=this["".concat(S,"Step")](P,K),ee=$>O.max||$<O.min;if($>O.max?$=O.max:$<O.min&&($=O.min),this.setValue($,null),this.setState({focused:!0},function(){U.pressingUpOrDown=!1}),ee)return;this.autoStepTimer=setTimeout(function(){U[S](N,K,!0)},V?d:T)}},{key:"fixCaret",value:function(S,N){if(S===void 0||N===void 0||!this.input||!this.input.value)return;try{var U=this.input.selectionStart,K=this.input.selectionEnd;(S!==U||N!==K)&&this.input.setSelectionRange(S,N)}catch(V){}}},{key:"render",value:function(){var S,N=this.props,U=N.prefixCls,K=N.disabled,V=N.readOnly,O=N.useTouch,P=N.autoComplete,$=N.upHandler,ee=N.downHandler,oe=N.className,fe=N.max,Oe=N.min,Ce=N.style,Ae=N.title,Le=N.onMouseEnter,be=N.onMouseLeave,pe=N.onMouseOver,se=N.onMouseOut,te=N.required,ue=N.onClick,ne=N.tabIndex,Te=N.type,Re=N.placeholder,xe=N.id,Me=N.inputMode,Pe=N.pattern,je=N.step,Ue=N.maxLength,Ne=N.autoFocus,Ie=N.name,Qe=N.onPaste,rt=N.onInput,et=Object(he.a)(N,["prefixCls","disabled","readOnly","useTouch","autoComplete","upHandler","downHandler","className","max","min","style","title","onMouseEnter","onMouseLeave","onMouseOver","onMouseOut","required","onClick","tabIndex","type","placeholder","id","inputMode","pattern","step","maxLength","autoFocus","name","onPaste","onInput"]),Je=this.state,st=Je.value,Ye=Je.focused,Xe=v()(U,(S={},Object(J.a)(S,oe,!!oe),Object(J.a)(S,"".concat(U,"-disabled"),K),Object(J.a)(S,"".concat(U,"-focused"),Ye),S)),_e={};Object.keys(et).forEach(function(de){(de.substr(0,5)==="data-"||de.substr(0,5)==="aria-"||de==="role")&&(_e[de]=et[de])});var ot=!V&&!K,at=this.getInputDisplayValue(null),Be=(st||st===0)&&(isNaN(st)||Number(st)>=fe),Ke=(st||st===0)&&(isNaN(st)||Number(st)<=Oe),Ee=Be||K||V,ge=Ke||K||V,ye=v()("".concat(U,"-handler"),"".concat(U,"-handler-up"),Object(J.a)({},"".concat(U,"-handler-up-disabled"),Ee)),re=v()("".concat(U,"-handler"),"".concat(U,"-handler-down"),Object(J.a)({},"".concat(U,"-handler-down-disabled"),ge)),ie=O?{onTouchStart:Ee?u:this.up,onTouchEnd:this.stop}:{onMouseDown:Ee?u:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},ae=O?{onTouchStart:ge?u:this.down,onTouchEnd:this.stop}:{onMouseDown:ge?u:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return I.a.createElement("div",{className:Xe,style:Ce,title:Ae,onMouseEnter:Le,onMouseLeave:be,onMouseOver:pe,onMouseOut:se,onFocus:function(){return null},onBlur:function(){return null}},I.a.createElement("div",{className:"".concat(U,"-handler-wrap")},I.a.createElement("span",Object.assign({unselectable:"on"},ie,{role:"button","aria-label":"Increase Value","aria-disabled":Ee,className:ye}),$||I.a.createElement("span",{unselectable:"on",className:"".concat(U,"-handler-up-inner"),onClick:o})),I.a.createElement("span",Object.assign({unselectable:"on"},ae,{role:"button","aria-label":"Decrease Value","aria-disabled":ge,className:re}),ee||I.a.createElement("span",{unselectable:"on",className:"".concat(U,"-handler-down-inner"),onClick:o}))),I.a.createElement("div",{className:"".concat(U,"-input-wrap")},I.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":Oe,"aria-valuemax":fe,"aria-valuenow":st,required:te,type:Te,placeholder:Re,onPaste:Qe,onClick:ue,onMouseUp:this.onMouseUp,className:"".concat(U,"-input"),tabIndex:ne,autoComplete:P,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:ot?this.onKeyDown:u,onKeyUp:ot?this.onKeyUp:u,autoFocus:Ne,maxLength:Ue,readOnly:V,disabled:K,max:fe,min:Oe,step:je,name:Ie,title:Ae,id:xe,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(at),pattern:Pe,inputMode:Me,onInput:rt},_e))))}}]),E}(I.a.Component);x.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:c,min:-c,step:1,style:{},onChange:u,onKeyDown:u,onPressEnter:u,onFocus:u,onBlur:u,parser:l,required:!1,autoComplete:"off"};var m=x,g=dt.a=m},h78n:function(Tt,dt,le){"use strict";le.d(dt,"a",function(){return S});var he=le("q1tI"),J=le.n(he),D=le("TSYQ"),Q=le.n(D),B={className:"",percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,style:{},trailColor:"#D9D9D9",trailWidth:1},_=function(K){var V=K.map(function(){return Object(he.useRef)()}),O=Object(he.useRef)();return Object(he.useEffect)(function(){var P=Date.now(),$=!1;Object.keys(V).forEach(function(ee){var oe=V[ee].current;if(!oe)return;$=!0;var fe=oe.style;fe.transitionDuration=".3s, .3s, .3s, .06s",O.current&&P-O.current<100&&(fe.transitionDuration="0s, 0s")}),$&&(O.current=Date.now())}),[V]};function G(){return G=Object.assign||function(U){for(var K=1;K<arguments.length;K++){var V=arguments[K];for(var O in V)Object.prototype.hasOwnProperty.call(V,O)&&(U[O]=V[O])}return U},G.apply(this,arguments)}function j(U,K){return M(U)||A(U,K)||R(U,K)||I()}function I(){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 R(U,K){if(!U)return;if(typeof U=="string")return v(U,K);var V=Object.prototype.toString.call(U).slice(8,-1);if(V==="Object"&&U.constructor&&(V=U.constructor.name),V==="Map"||V==="Set")return Array.from(U);if(V==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(V))return v(U,K)}function v(U,K){(K==null||K>U.length)&&(K=U.length);for(var V=0,O=new Array(K);V<K;V++)O[V]=U[V];return O}function A(U,K){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(U)))return;var V=[],O=!0,P=!1,$=void 0;try{for(var ee=U[Symbol.iterator](),oe;!(O=(oe=ee.next()).done)&&!(V.push(oe.value),K&&V.length===K);O=!0);}catch(fe){P=!0,$=fe}finally{try{!O&&ee.return!=null&&ee.return()}finally{if(P)throw $}}return V}function M(U){if(Array.isArray(U))return U}function L(U,K){if(U==null)return{};var V=w(U,K),O,P;if(Object.getOwnPropertySymbols){var $=Object.getOwnPropertySymbols(U);for(P=0;P<$.length;P++){if(O=$[P],K.indexOf(O)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(U,O))continue;V[O]=U[O]}}return V}function w(U,K){if(U==null)return{};var V={},O=Object.keys(U),P,$;for($=0;$<O.length;$++){if(P=O[$],K.indexOf(P)>=0)continue;V[P]=U[P]}return V}var y=function(K){var V=K.className,O=K.percent,P=K.prefixCls,$=K.strokeColor,ee=K.strokeLinecap,oe=K.strokeWidth,fe=K.style,Oe=K.trailColor,Ce=K.trailWidth,Ae=K.transition,Le=L(K,["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"]);delete Le.gapPosition;var be=Array.isArray(O)?O:[O],pe=Array.isArray($)?$:[$],se=_(be),te=j(se,1),ue=te[0],ne=oe/2,Te=100-oe/2,Re="M ".concat(ee==="round"?ne:0,",").concat(ne,`
L `).concat(ee==="round"?Te:100,",").concat(ne),xe="0 0 100 ".concat(oe),Me=0;return J.a.createElement("svg",G({className:Q()("".concat(P,"-line"),V),viewBox:xe,preserveAspectRatio:"none",style:fe},Le),J.a.createElement("path",{className:"".concat(P,"-line-trail"),d:Re,strokeLinecap:ee,stroke:Oe,strokeWidth:Ce||oe,fillOpacity:"0"}),be.map(function(Pe,je){var Ue={strokeDasharray:"".concat(Pe,"px, 100px"),strokeDashoffset:"-".concat(Me,"px"),transition:Ae||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},Ne=pe[je]||pe[pe.length-1];return Me+=Pe,J.a.createElement("path",{key:je,className:"".concat(P,"-line-path"),d:Re,strokeLinecap:ee,stroke:Ne,strokeWidth:oe,fillOpacity:"0",ref:ue[je],style:Ue})}))};y.defaultProps=B;var u=y;function o(){return o=Object.assign||function(U){for(var K=1;K<arguments.length;K++){var V=arguments[K];for(var O in V)Object.prototype.hasOwnProperty.call(V,O)&&(U[O]=V[O])}return U},o.apply(this,arguments)}function l(U,K){return k(U)||p(U,K)||T(U,K)||d()}function d(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function T(U,K){if(!U)return;if(typeof U=="string")return c(U,K);var V=Object.prototype.toString.call(U).slice(8,-1);if(V==="Object"&&U.constructor&&(V=U.constructor.name),V==="Map"||V==="Set")return Array.from(U);if(V==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(V))return c(U,K)}function c(U,K){(K==null||K>U.length)&&(K=U.length);for(var V=0,O=new Array(K);V<K;V++)O[V]=U[V];return O}function p(U,K){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(U)))return;var V=[],O=!0,P=!1,$=void 0;try{for(var ee=U[Symbol.iterator](),oe;!(O=(oe=ee.next()).done)&&!(V.push(oe.value),K&&V.length===K);O=!0);}catch(fe){P=!0,$=fe}finally{try{!O&&ee.return!=null&&ee.return()}finally{if(P)throw $}}return V}function k(U){if(Array.isArray(U))return U}function x(U,K){if(U==null)return{};var V=m(U,K),O,P;if(Object.getOwnPropertySymbols){var $=Object.getOwnPropertySymbols(U);for(P=0;P<$.length;P++){if(O=$[P],K.indexOf(O)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(U,O))continue;V[O]=U[O]}}return V}function m(U,K){if(U==null)return{};var V={},O=Object.keys(U),P,$;for($=0;$<O.length;$++){if(P=O[$],K.indexOf(P)>=0)continue;V[P]=U[P]}return V}var g=0;function h(U){return+U.replace("%","")}function a(U){return Array.isArray(U)?U:[U]}function E(U,K,V,O){var P=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,$=arguments.length>5?arguments[5]:void 0,ee=50-O/2,oe=0,fe=-ee,Oe=0,Ce=-2*ee;switch($){case"left":oe=-ee,fe=0,Oe=2*ee,Ce=0;break;case"right":oe=ee,fe=0,Oe=-2*ee,Ce=0;break;case"bottom":fe=ee,Ce=2*ee;break;default:}var Ae="M 50,50 m ".concat(oe,",").concat(fe,`
a `).concat(ee,",").concat(ee," 0 1 1 ").concat(Oe,",").concat(-Ce,`
a `).concat(ee,",").concat(ee," 0 1 1 ").concat(-Oe,",").concat(Ce),Le=Math.PI*2*ee,be={stroke:V,strokeDasharray:"".concat(K/100*(Le-P),"px ").concat(Le,"px"),strokeDashoffset:"-".concat(P/2+U/100*(Le-P),"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"};return{pathString:Ae,pathStyle:be}}var b=function(K){var V=K.prefixCls,O=K.strokeWidth,P=K.trailWidth,$=K.gapDegree,ee=K.gapPosition,oe=K.trailColor,fe=K.strokeLinecap,Oe=K.style,Ce=K.className,Ae=K.strokeColor,Le=K.percent,be=x(K,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"]),pe=Object(he.useMemo)(function(){return g+=1,g},[]),se=E(0,100,oe,O,$,ee),te=se.pathString,ue=se.pathStyle,ne=a(Le),Te=a(Ae),Re=Te.find(function(Ue){return Object.prototype.toString.call(Ue)==="[object Object]"}),xe=_(ne),Me=l(xe,1),Pe=Me[0],je=function(){var Ne=0;return ne.map(function(Ie,Qe){var rt=Te[Qe]||Te[Te.length-1],et=Object.prototype.toString.call(rt)==="[object Object]"?"url(#".concat(V,"-gradient-").concat(pe,")"):"",Je=E(Ne,Ie,rt,O,$,ee);return Ne+=Ie,J.a.createElement("path",{key:Qe,className:"".concat(V,"-circle-path"),d:Je.pathString,stroke:et,strokeLinecap:fe,strokeWidth:O,opacity:Ie===0?0:1,fillOpacity:"0",style:Je.pathStyle,ref:Pe[Qe]})})};return J.a.createElement("svg",o({className:Q()("".concat(V,"-circle"),Ce),viewBox:"0 0 100 100",style:Oe},be),Re&&J.a.createElement("defs",null,J.a.createElement("linearGradient",{id:"".concat(V,"-gradient-").concat(pe),x1:"100%",y1:"0%",x2:"0%",y2:"0%"},Object.keys(Re).sort(function(Ue,Ne){return h(Ue)-h(Ne)}).map(function(Ue,Ne){return J.a.createElement("stop",{key:Ne,offset:Ue,stopColor:Re[Ue]})}))),J.a.createElement("path",{className:"".concat(V,"-circle-trail"),d:te,stroke:oe,strokeLinecap:fe,strokeWidth:P||O,fillOpacity:"0",style:ue}),je().reverse())};b.defaultProps=B;var S=b,N={Line:u,Circle:S}},kSUc:function(Tt,dt,le){},lZu9:function(Tt,dt,le){(function(he){he(le("VrN/"),le("1eCo"),le("8EBN"))})(function(he){"use strict";he.defineMode("markdown",function(J,D){var Q=he.getMode(J,"text/html"),B=Q.name=="null";function _(O){if(he.findModeByName){var P=he.findModeByName(O);P&&(O=P.mime||P.mimes[0])}var $=he.getMode(J,O);return $.name=="null"?null:$}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 G={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 j in G)G.hasOwnProperty(j)&&D.tokenTypeOverrides[j]&&(G[j]=D.tokenTypeOverrides[j]);var I=/^([*\-_])(?:\s*\1){2,}\s*$/,R=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,v=/^\[(x| )\](?=\s)/i,A=D.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,M=/^ {0,3}(?:\={1,}|-{2,})\s*$/,L=/^[^#!\[\]*_\\<>` "'(~:]+/,w=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,y=/^\s*\[[^\]]+?\]:.*$/,u=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,o=" ";function l(O,P,$){return P.f=P.inline=$,$(O,P)}function d(O,P,$){return P.f=P.block=$,$(O,P)}function T(O){return!O||!/\S/.test(O.string)}function c(O){if(O.linkTitle=!1,O.linkHref=!1,O.linkText=!1,O.em=!1,O.strong=!1,O.strikethrough=!1,O.quote=0,O.indentedCode=!1,O.f==k){var P=B;if(!P){var $=he.innerMode(Q,O.htmlState);P=$.mode.name=="xml"&&$.state.tagStart===null&&!$.state.context&&$.state.tokenize.isInText}P&&(O.f=h,O.block=p,O.htmlState=null)}return O.trailingSpace=0,O.trailingSpaceNewLine=!1,O.prevLine=O.thisLine,O.thisLine={stream:null},null}function p(O,P){var $=O.column()===P.indentation,ee=T(P.prevLine.stream),oe=P.indentedCode,fe=P.prevLine.hr,Oe=P.list!==!1,Ce=(P.listStack[P.listStack.length-1]||0)+3;P.indentedCode=!1;var Ae=P.indentation;if(P.indentationDiff===null&&(P.indentationDiff=P.indentation,Oe)){for(P.list=null;Ae<P.listStack[P.listStack.length-1];)P.listStack.pop(),P.listStack.length?P.indentation=P.listStack[P.listStack.length-1]:P.list=!1;P.list!==!1&&(P.indentationDiff=Ae-P.listStack[P.listStack.length-1])}var Le=!ee&&!fe&&!P.prevLine.header&&(!Oe||!oe)&&!P.prevLine.fencedCodeEnd,be=(P.list===!1||fe||ee)&&P.indentation<=Ce&&O.match(I),pe=null;if(P.indentationDiff>=4&&(oe||P.prevLine.fencedCodeEnd||P.prevLine.header||ee))return O.skipToEnd(),P.indentedCode=!0,G.code;if(O.eatSpace())return null;if($&&P.indentation<=Ce&&(pe=O.match(A))&&pe[1].length<=6)return P.quote=0,P.header=pe[1].length,P.thisLine.header=!0,D.highlightFormatting&&(P.formatting="header"),P.f=P.inline,m(P);if(P.indentation<=Ce&&O.eat(">"))return P.quote=$?1:P.quote+1,D.highlightFormatting&&(P.formatting="quote"),O.eatSpace(),m(P);if(!be&&!P.setext&&$&&P.indentation<=Ce&&(pe=O.match(R))){var se=pe[1]?"ol":"ul";return P.indentation=Ae+O.current().length,P.list=!0,P.quote=0,P.listStack.push(P.indentation),P.em=!1,P.strong=!1,P.code=!1,P.strikethrough=!1,D.taskLists&&O.match(v,!1)&&(P.taskList=!0),P.f=P.inline,D.highlightFormatting&&(P.formatting=["list","list-"+se]),m(P)}else{if($&&P.indentation<=Ce&&(pe=O.match(w,!0)))return P.quote=0,P.fencedEndRE=new RegExp(pe[1]+"+ *$"),P.localMode=D.fencedCodeBlockHighlighting&&_(pe[2]||D.fencedCodeBlockDefaultMode),P.localMode&&(P.localState=he.startState(P.localMode)),P.f=P.block=x,D.highlightFormatting&&(P.formatting="code-block"),P.code=-1,m(P);if(P.setext||(!Le||!Oe)&&!P.quote&&P.list===!1&&!P.code&&!be&&!y.test(O.string)&&(pe=O.lookAhead(1))&&(pe=pe.match(M)))return P.setext?(P.header=P.setext,P.setext=0,O.skipToEnd(),D.highlightFormatting&&(P.formatting="header")):(P.header=pe[0].charAt(0)=="="?1:2,P.setext=P.header),P.thisLine.header=!0,P.f=P.inline,m(P);if(be)return O.skipToEnd(),P.hr=!0,P.thisLine.hr=!0,G.hr;if(O.peek()==="[")return l(O,P,N)}return l(O,P,P.inline)}function k(O,P){var $=Q.token(O,P.htmlState);if(!B){var ee=he.innerMode(Q,P.htmlState);(ee.mode.name=="xml"&&ee.state.tagStart===null&&!ee.state.context&&ee.state.tokenize.isInText||P.md_inside&&O.current().indexOf(">")>-1)&&(P.f=h,P.block=p,P.htmlState=null)}return $}function x(O,P){var $=P.listStack[P.listStack.length-1]||0,ee=P.indentation<$,oe=$+3;if(P.fencedEndRE&&P.indentation<=oe&&(ee||O.match(P.fencedEndRE))){D.highlightFormatting&&(P.formatting="code-block");var fe;return ee||(fe=m(P)),P.localMode=P.localState=null,P.block=p,P.f=h,P.fencedEndRE=null,P.code=0,P.thisLine.fencedCodeEnd=!0,ee?d(O,P,P.block):fe}else return P.localMode?P.localMode.token(O,P.localState):(O.skipToEnd(),G.code)}function m(O){var P=[];if(O.formatting){P.push(G.formatting),typeof O.formatting=="string"&&(O.formatting=[O.formatting]);for(var $=0;$<O.formatting.length;$++)P.push(G.formatting+"-"+O.formatting[$]),O.formatting[$]==="header"&&P.push(G.formatting+"-"+O.formatting[$]+"-"+O.header),O.formatting[$]==="quote"&&(!D.maxBlockquoteDepth||D.maxBlockquoteDepth>=O.quote?P.push(G.formatting+"-"+O.formatting[$]+"-"+O.quote):P.push("error"))}if(O.taskOpen)return P.push("meta"),P.length?P.join(" "):null;if(O.taskClosed)return P.push("property"),P.length?P.join(" "):null;if(O.linkHref?P.push(G.linkHref,"url"):(O.strong&&P.push(G.strong),O.em&&P.push(G.em),O.strikethrough&&P.push(G.strikethrough),O.emoji&&P.push(G.emoji),O.linkText&&P.push(G.linkText),O.code&&P.push(G.code),O.image&&P.push(G.image),O.imageAltText&&P.push(G.imageAltText,"link"),O.imageMarker&&P.push(G.imageMarker)),O.header&&P.push(G.header,G.header+"-"+O.header),O.quote&&(P.push(G.quote),!D.maxBlockquoteDepth||D.maxBlockquoteDepth>=O.quote?P.push(G.quote+"-"+O.quote):P.push(G.quote+"-"+D.maxBlockquoteDepth)),O.list!==!1){var ee=(O.listStack.length-1)%3;ee?ee===1?P.push(G.list2):P.push(G.list3):P.push(G.list1)}return O.trailingSpaceNewLine?P.push("trailing-space-new-line"):O.trailingSpace&&P.push("trailing-space-"+(O.trailingSpace%2?"a":"b")),P.length?P.join(" "):null}function g(O,P){return O.match(L,!0)?m(P):void 0}function h(O,P){var $=P.text(O,P);if(typeof $!="undefined")return $;if(P.list)return P.list=null,m(P);if(P.taskList){var ee=O.match(v,!0)[1]===" ";return ee?P.taskOpen=!0:P.taskClosed=!0,D.highlightFormatting&&(P.formatting="task"),P.taskList=!1,m(P)}if(P.taskOpen=!1,P.taskClosed=!1,P.header&&O.match(/^#+$/,!0))return D.highlightFormatting&&(P.formatting="header"),m(P);var oe=O.next();if(P.linkTitle){P.linkTitle=!1;var fe=oe;oe==="("&&(fe=")"),fe=(fe+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var Oe="^\\s*(?:[^"+fe+"\\\\]+|\\\\\\\\|\\\\.)"+fe;if(O.match(new RegExp(Oe),!0))return G.linkHref}if(oe==="`"){var Ce=P.formatting;D.highlightFormatting&&(P.formatting="code"),O.eatWhile("`");var Ae=O.current().length;if(P.code==0&&(!P.quote||Ae==1))return P.code=Ae,m(P);if(Ae==P.code){var Le=m(P);return P.code=0,Le}else return P.formatting=Ce,m(P)}else if(P.code)return m(P);if(oe==="\\"&&(O.next(),D.highlightFormatting)){var be=m(P),pe=G.formatting+"-escape";return be?be+" "+pe:pe}if(oe==="!"&&O.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return P.imageMarker=!0,P.image=!0,D.highlightFormatting&&(P.formatting="image"),m(P);if(oe==="["&&P.imageMarker&&O.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return P.imageMarker=!1,P.imageAltText=!0,D.highlightFormatting&&(P.formatting="image"),m(P);if(oe==="]"&&P.imageAltText){D.highlightFormatting&&(P.formatting="image");var be=m(P);return P.imageAltText=!1,P.image=!1,P.inline=P.f=E,be}if(oe==="["&&!P.image)return P.linkText&&O.match(/^.*?\]/)||(P.linkText=!0,D.highlightFormatting&&(P.formatting="link")),m(P);if(oe==="]"&&P.linkText){D.highlightFormatting&&(P.formatting="link");var be=m(P);return P.linkText=!1,P.inline=P.f=O.match(/\(.*?\)| ?\[.*?\]/,!1)?E:h,be}if(oe==="<"&&O.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){P.f=P.inline=a,D.highlightFormatting&&(P.formatting="link");var be=m(P);return be?be+=" ":be="",be+G.linkInline}if(oe==="<"&&O.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){P.f=P.inline=a,D.highlightFormatting&&(P.formatting="link");var be=m(P);return be?be+=" ":be="",be+G.linkEmail}if(D.xml&&oe==="<"&&O.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var se=O.string.indexOf(">",O.pos);if(se!=-1){var te=O.string.substring(O.start,se);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(te)&&(P.md_inside=!0)}return O.backUp(1),P.htmlState=he.startState(Q),d(O,P,k)}if(D.xml&&oe==="<"&&O.match(/^\/\w*?>/))return P.md_inside=!1,"tag";if(oe==="*"||oe==="_"){for(var ue=1,ne=O.pos==1?" ":O.string.charAt(O.pos-2);ue<3&&O.eat(oe);)ue++;var Te=O.peek()||" ",Re=!/\s/.test(Te)&&(!u.test(Te)||/\s/.test(ne)||u.test(ne)),xe=!/\s/.test(ne)&&(!u.test(ne)||/\s/.test(Te)||u.test(Te)),Me=null,Pe=null;if(ue%2&&(!P.em&&Re&&(oe==="*"||!xe||u.test(ne))?Me=!0:P.em==oe&&xe&&(oe==="*"||!Re||u.test(Te))&&(Me=!1)),ue>1&&(!P.strong&&Re&&(oe==="*"||!xe||u.test(ne))?Pe=!0:P.strong==oe&&xe&&(oe==="*"||!Re||u.test(Te))&&(Pe=!1)),Pe!=null||Me!=null){D.highlightFormatting&&(P.formatting=Me==null?"strong":Pe==null?"em":"strong em"),Me===!0&&(P.em=oe),Pe===!0&&(P.strong=oe);var Le=m(P);return Me===!1&&(P.em=!1),Pe===!1&&(P.strong=!1),Le}}else if(oe===" "&&(O.eat("*")||O.eat("_"))){if(O.peek()===" ")return m(P);O.backUp(1)}if(D.strikethrough){if(oe==="~"&&O.eatWhile(oe)){if(P.strikethrough){D.highlightFormatting&&(P.formatting="strikethrough");var Le=m(P);return P.strikethrough=!1,Le}else if(O.match(/^[^\s]/,!1))return P.strikethrough=!0,D.highlightFormatting&&(P.formatting="strikethrough"),m(P)}else if(oe===" "&&O.match(/^~~/,!0)){if(O.peek()===" ")return m(P);O.backUp(2)}}if(D.emoji&&oe===":"&&O.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){P.emoji=!0,D.highlightFormatting&&(P.formatting="emoji");var je=m(P);return P.emoji=!1,je}return oe===" "&&(O.match(/^ +$/,!1)?P.trailingSpace++:P.trailingSpace&&(P.trailingSpaceNewLine=!0)),m(P)}function a(O,P){var $=O.next();if($===">"){P.f=P.inline=h,D.highlightFormatting&&(P.formatting="link");var ee=m(P);return ee?ee+=" ":ee="",ee+G.linkInline}return O.match(/^[^>]+/,!0),G.linkInline}function E(O,P){if(O.eatSpace())return null;var $=O.next();return $==="("||$==="["?(P.f=P.inline=S($==="("?")":"]"),D.highlightFormatting&&(P.formatting="link-string"),P.linkHref=!0,m(P)):"error"}var b={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function S(O){return function(P,$){var ee=P.next();if(ee===O){$.f=$.inline=h,D.highlightFormatting&&($.formatting="link-string");var oe=m($);return $.linkHref=!1,oe}return P.match(b[O]),$.linkHref=!0,m($)}}function N(O,P){return O.match(/^([^\]\\]|\\.)*\]:/,!1)?(P.f=U,O.next(),D.highlightFormatting&&(P.formatting="link"),P.linkText=!0,m(P)):l(O,P,h)}function U(O,P){if(O.match(/^\]:/,!0)){P.f=P.inline=K,D.highlightFormatting&&(P.formatting="link");var $=m(P);return P.linkText=!1,$}return O.match(/^([^\]\\]|\\.)+/,!0),G.linkText}function K(O,P){return O.eatSpace()?null:(O.match(/^[^\s]+/,!0),O.peek()===void 0?P.linkTitle=!0:O.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),P.f=P.inline=h,G.linkHref+" url")}var V={startState:function(){return{f:p,prevLine:{stream:null},thisLine:{stream:null},block:p,htmlState:null,indentation:0,inline:h,text:g,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(O){return{f:O.f,prevLine:O.prevLine,thisLine:O.thisLine,block:O.block,htmlState:O.htmlState&&he.copyState(Q,O.htmlState),indentation:O.indentation,localMode:O.localMode,localState:O.localMode?he.copyState(O.localMode,O.localState):null,inline:O.inline,text:O.text,formatting:!1,linkText:O.linkText,linkTitle:O.linkTitle,linkHref:O.linkHref,code:O.code,em:O.em,strong:O.strong,strikethrough:O.strikethrough,emoji:O.emoji,header:O.header,setext:O.setext,hr:O.hr,taskList:O.taskList,list:O.list,listStack:O.listStack.slice(0),quote:O.quote,indentedCode:O.indentedCode,trailingSpace:O.trailingSpace,trailingSpaceNewLine:O.trailingSpaceNewLine,md_inside:O.md_inside,fencedEndRE:O.fencedEndRE}},token:function(O,P){if(P.formatting=!1,O!=P.thisLine.stream){if(P.header=0,P.hr=!1,O.match(/^\s*$/,!0))return c(P),null;if(P.prevLine=P.thisLine,P.thisLine={stream:O},P.taskList=!1,P.trailingSpace=0,P.trailingSpaceNewLine=!1,!P.localState&&(P.f=P.block,P.f!=k)){var $=O.match(/^\s*/,!0)[0].replace(/\t/g,o).length;if(P.indentation=$,P.indentationDiff=null,$>0)return null}}return P.f(O,P)},innerMode:function(O){return O.block==k?{state:O.htmlState,mode:Q}:O.localState?{state:O.localState,mode:O.localMode}:{state:O,mode:V}},indent:function(O,P,$){return O.block==k&&Q.indent?Q.indent(O.htmlState,P,$):O.localState&&O.localMode.indent?O.localMode.indent(O.localState,P,$):he.Pass},blankLine:c,getType:m,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return V},"xml"),he.defineMIME("text/markdown","markdown"),he.defineMIME("text/x-markdown","markdown")})},osHv:function(Tt,dt,le){(function(he){he(le("VrN/"))})(function(he){"use strict";var J=he.Pos;function D(u,o){return u.line-o.line||u.ch-o.ch}var Q="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",B=Q+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",_=new RegExp("<(/?)(["+Q+"]["+B+"]*)","g");function G(u,o,l,d){this.line=o,this.ch=l,this.cm=u,this.text=u.getLine(o),this.min=d?Math.max(d.from,u.firstLine()):u.firstLine(),this.max=d?Math.min(d.to-1,u.lastLine()):u.lastLine()}function j(u,o){var l=u.cm.getTokenTypeAt(J(u.line,o));return l&&/\btag\b/.test(l)}function I(u){return u.line>=u.max?void 0:(u.ch=0,u.text=u.cm.getLine(++u.line),!0)}function R(u){return u.line<=u.min?void 0:(u.text=u.cm.getLine(--u.line),u.ch=u.text.length,!0)}function v(u){for(;;){var o=u.text.indexOf(">",u.ch);if(o==-1){if(I(u))continue;return}if(!j(u,o+1)){u.ch=o+1;continue}var l=u.text.lastIndexOf("/",o),d=l>-1&&!/\S/.test(u.text.slice(l+1,o));return u.ch=o+1,d?"selfClose":"regular"}}function A(u){for(;;){var o=u.ch?u.text.lastIndexOf("<",u.ch-1):-1;if(o==-1){if(R(u))continue;return}if(!j(u,o+1)){u.ch=o;continue}_.lastIndex=o,u.ch=o;var l=_.exec(u.text);if(l&&l.index==o)return l}}function M(u){for(;;){_.lastIndex=u.ch;var o=_.exec(u.text);if(!o){if(I(u))continue;return}if(!j(u,o.index+1)){u.ch=o.index+1;continue}return u.ch=o.index+o[0].length,o}}function L(u){for(;;){var o=u.ch?u.text.lastIndexOf(">",u.ch-1):-1;if(o==-1){if(R(u))continue;return}if(!j(u,o+1)){u.ch=o;continue}var l=u.text.lastIndexOf("/",o),d=l>-1&&!/\S/.test(u.text.slice(l+1,o));return u.ch=o+1,d?"selfClose":"regular"}}function w(u,o){for(var l=[];;){var d=M(u),T,c=u.line,p=u.ch-(d?d[0].length:0);if(!d||!(T=v(u)))return;if(T=="selfClose")continue;if(d[1]){for(var k=l.length-1;k>=0;--k)if(l[k]==d[2]){l.length=k;break}if(k<0&&(!o||o==d[2]))return{tag:d[2],from:J(c,p),to:J(u.line,u.ch)}}else l.push(d[2])}}function y(u,o){for(var l=[];;){var d=L(u);if(!d)return;if(d=="selfClose"){A(u);continue}var T=u.line,c=u.ch,p=A(u);if(!p)return;if(p[1])l.push(p[2]);else{for(var k=l.length-1;k>=0;--k)if(l[k]==p[2]){l.length=k;break}if(k<0&&(!o||o==p[2]))return{tag:p[2],from:J(u.line,u.ch),to:J(T,c)}}}}he.registerHelper("fold","xml",function(u,o){for(var l=new G(u,o.line,0);;){var d=M(l);if(!d||l.line!=o.line)return;var T=v(l);if(!T)return;if(!d[1]&&T!="selfClose"){var c=J(l.line,l.ch),p=w(l,d[2]);return p&&D(p.from,c)>0?{from:c,to:p.from}:null}}}),he.findMatchingTag=function(u,o,l){var d=new G(u,o.line,o.ch,l);if(d.text.indexOf(">")==-1&&d.text.indexOf("<")==-1)return;var T=v(d),c=T&&J(d.line,d.ch),p=T&&A(d);if(!T||!p||D(d,o)>0)return;var k={from:J(d.line,d.ch),to:c,tag:p[2]};return T=="selfClose"?{open:k,close:null,at:"open"}:p[1]?{open:y(d,p[2]),close:k,at:"close"}:(d=new G(u,c.line,c.ch,l),{open:k,close:w(d,p[2]),at:"open"})},he.findEnclosingTag=function(u,o,l,d){for(var T=new G(u,o.line,o.ch,l);;){var c=y(T,d);if(!c)break;var p=new G(u,o.line,o.ch,l),k=w(p,c.tag);if(k)return{open:c,close:k}}},he.scanForClosingTag=function(u,o,l,d){var T=new G(u,o.line,o.ch,d?{from:0,to:d}:null);return w(T,l)}})},p0QG:function(Tt,dt,le){Tt.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(Tt,dt,le){"use strict";var he=le("+L6B"),J=le("2/Rp"),D=le("5Dmo"),Q=le("3S7+"),B=le("k1fw"),_=le("9og8"),G=le("tJVT"),j=le("WmNS"),I=le.n(j),R=le("q1tI"),v=le.n(R),A=le("vHTk"),M=le.n(A),L=le("yEEn"),w=le("ZW9T"),y=le("1vsH"),u=le("V0Rq"),o=le("m3rI"),l=function(T){var c=T.name,p=T.data,k=T.theme,x=T.type,m=T.filename,g=T.monacoEditor,h=T.className,a=T.style,E=T.close,b=T.onClose,S=T.hasMask,N=T.otherData,U=N===void 0?{}:N,K=Object(R.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),V=Object(G.a)(K,2),O=V[0],P=V[1],$=Object(R.useState)(""),ee=Object(G.a)($,2),oe=ee[0],fe=ee[1],Oe=Object(R.useState)(),Ce=Object(G.a)(Oe,2),Ae=Ce[0],Le=Ce[1],be=window.ENV==="build"?"/react/build/office.html":"/office.html",pe,se=1024*1024,te=10*se,ue=Object(R.useRef)();x==="office"&&(pe=Object(y.P)(p).filesize,pe>te&&(x="other")),m&&(g.filename=m),Object(R.useEffect)(function(){var xe,Me,Pe=(xe=document.cookie)===null||xe===void 0||((Me=xe.replace(/\s/g,""))===null||Me===void 0)?void 0:Me.split(";");Pe==null||Pe.map(function(je){var Ue=je.split("=");Ue[0]==="_educoder_session"&&fe(Ue[1])})},[]),Object(R.useEffect)(function(){x==="office"&&ne()},[x]);var ne=function(){var xe=Object(_.a)(I.a.mark(function Me(){var Pe,je,Ue;return I.a.wrap(function(Ie){for(;;)switch(Ie.prev=Ie.next){case 0:return console.log("data:",p),Pe=p,p.startsWith("http")||(Pe=location.origin+Pe),je=new URL(Pe).pathname.split("/").pop(),Ie.next=6,Object(u.U)({attachment_id:je});case 6:Ue=Ie.sent,Le(Ue);case 8:case"end":return Ie.stop()}},Me)}));return function(){return xe.apply(this,arguments)}}(),Te=function(){if(p.startsWith("http")||p.startsWith("blob:")){Re();return}Object(y.x)(m||"educoder",p,m)},Re=function(){Object(y.v)(m||"educoder",decodeURIComponent(p))};return v.a.createElement("div",{style:Object(B.a)({},a||{}),className:"".concat(S&&M.a.bgBlack," ").concat(x?M.a.wrp:"hide")},E&&v.a.createElement("div",{className:M.a.close,ref:ue},v.a.createElement(Q.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return ue.current}},v.a.createElement("span",{onClick:Re},v.a.createElement("i",{className:"icon-quxiaozhiding"}))),v.a.createElement(Q.a,{title:"\u5173\u95ED",getPopupContainer:function(){return ue.current}},v.a.createElement("span",{className:"",onClick:function(){b(),Le(null)}},v.a.createElement("i",{className:"icon-guanbi1"})))),v.a.createElement("div",{className:"".concat(M.a[h]," ").concat(h," ").concat(M.a.monaco," ").concat(x==="txt"?"show":"hide")},x==="txt"&&v.a.createElement(w.b,g)),x==="audio"&&v.a.createElement("audio",{src:"".concat((p==null?void 0:p.indexOf("http://"))>-1||(p==null?void 0:p.indexOf("https://"))>-1?"":"data:audio/mp3;base64,").concat(p),autoPlay:!0}),x==="video"&&v.a.createElement(v.a.Fragment,null,(p==null?void 0:p.indexOf("/api"))>-1?v.a.createElement("video",{controls:!0,src:"".concat(p),autoPlay:!0}):v.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(p),autoPlay:!0})),x==="office"&&Ae&&v.a.createElement("iframe",{src:"".concat(be,"?key=").concat(Ae.key,"&url=").concat(o.a.API_SERVER+Ae.url,"&callbackUrl=").concat(o.a.API_SERVER+Ae.callbackUrl,"&fileType=").concat(Ae.fileType,"&title=").concat(Ae.title,"&model=view")}),(x==="xlsx"||x==="doc"||x==="pptx"||x==="docx")&&v.a.createElement("iframe",{src:"".concat(be,"?key=").concat(U.key,"&url=").concat(o.a.API_SERVER+U.url,"&callbackUrl=").concat(o.a.API_SERVER+U.callbackUrl,"&fileType=").concat(U.fileType,"&title=").concat(U.title,"&model=").concat(U.model)}),x==="html"&&v.a.createElement("iframe",{src:p+"&disposition=inline"}),x==="pdf"&&v.a.createElement("embed",{className:M.a.embed,src:p,type:"application/pdf"}),x==="image"&&v.a.createElement("img",{src:"".concat((p==null?void 0:p.indexOf("http://"))>-1||(p==null?void 0:p.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(p)}),x==="other"&&v.a.createElement("div",null,v.a.createElement(J.a,{type:"primary",size:"large",onClick:Te},v.a.createElement(L.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),x==="download"&&v.a.createElement(J.a,{type:"primary",size:"large",onClick:Te},v.a.createElement(L.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))};dt.a=l},"p77/":function(Tt,dt,le){},"rAM+":function(Tt,dt,le){"use strict";le.d(dt,"a",function(){return J});var he=le("Qw5x");function J(D,Q){var B;if(typeof Symbol=="undefined"||D[Symbol.iterator]==null){if(Array.isArray(D)||(B=Object(he.a)(D))||Q&&D&&typeof D.length=="number"){B&&(D=B);var _=0,G=function(){};return{s:G,n:function(){return _>=D.length?{done:!0}:{done:!1,value:D[_++]}},e:function(A){throw A},f:G}}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 j=!0,I=!1,R;return{s:function(){B=D[Symbol.iterator]()},n:function(){var A=B.next();return j=A.done,A},e:function(A){I=!0,R=A},f:function(){try{!j&&B.return!=null&&B.return()}finally{if(I)throw R}}}}},rUJ1:function(Tt,dt){const le=/[&<>"']/,he=/[&<>"']/g,J=/[<>"']|&(?!#?\w+;)/,D=/[<>"']|&(?!#?\w+;)/g,Q={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},B=x=>Q[x];function _(x,m){if(m){if(le.test(x))return x.replace(he,B)}else if(J.test(x))return x.replace(D,B);return x}const G=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function j(x){return x.replace(G,(m,g)=>(g=g.toLowerCase(),g==="colon"?":":g.charAt(0)==="#"?g.charAt(1)==="x"?String.fromCharCode(parseInt(g.substring(2),16)):String.fromCharCode(+g.substring(1)):""))}const I=/(^|[^\[])\^/g;function R(x,m){x=x.source||x,m=m||"";const g={replace:(h,a)=>(a=a.source||a,a=a.replace(I,"$1"),x=x.replace(h,a),g),getRegex:()=>new RegExp(x,m)};return g}const v=/[^\w:]/g,A=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function M(x,m,g){if(x){let h;try{h=decodeURIComponent(j(g)).replace(v,"").toLowerCase()}catch(a){return null}if(h.indexOf("javascript:")===0||h.indexOf("vbscript:")===0||h.indexOf("data:")===0)return null}m&&!A.test(g)&&(g=o(m,g));try{g=encodeURI(g).replace(/%25/g,"%")}catch(h){return null}return g}const L={},w=/^[^:]+:\/*[^/]*$/,y=/^([^:]+:)[\s\S]*$/,u=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(x,m){L[" "+x]||(w.test(x)?L[" "+x]=x+"/":L[" "+x]=c(x,"/",!0)),x=L[" "+x];const g=x.indexOf(":")===-1;return m.substring(0,2)==="//"?g?m:x.replace(y,"$1")+m:m.charAt(0)==="/"?g?m:x.replace(u,"$1")+m:x+m}const l={exec:function(){}};function d(x){let m=1,g,h;for(;m<arguments.length;m++){g=arguments[m];for(h in g)Object.prototype.hasOwnProperty.call(g,h)&&(x[h]=g[h])}return x}function T(x,m){const g=x.replace(/\|/g,(E,b,S)=>{let N=!1,U=b;for(;--U>=0&&S[U]==="\\";)N=!N;return N?"|":" |"}),h=g.split(/ \|/);let a=0;if(h.length>m)h.splice(m);else for(;h.length<m;)h.push("");for(;a<h.length;a++)h[a]=h[a].trim().replace(/\\\|/g,"|");return h}function c(x,m,g){const h=x.length;if(h===0)return"";let a=0;for(;a<h;){const E=x.charAt(h-a-1);if(E===m&&!g)a++;else if(E!==m&&g)a++;else break}return x.substr(0,h-a)}function p(x,m){if(x.indexOf(m[1])===-1)return-1;const g=x.length;let h=0,a=0;for(;a<g;a++)if(x[a]==="\\")a++;else if(x[a]===m[0])h++;else if(x[a]===m[1]&&(h--,h<0))return a;return-1}function k(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")}Tt.exports={escape:_,unescape:j,edit:R,cleanUrl:M,resolveUrl:o,noopTest:l,merge:d,splitCells:T,rtrim:c,findClosingBracket:p,checkSanitizeDeprecation:k}},ulZh:function(Tt,dt,le){typeof window!="undefined"&&function(J,D){Tt.exports=D()}(this,function(){return function(he){var J={};function D(Q){if(J[Q])return J[Q].exports;var B=J[Q]={i:Q,l:!1,exports:{}};return he[Q].call(B.exports,B,B.exports,D),B.l=!0,B.exports}return D.m=he,D.c=J,D.d=function(Q,B,_){D.o(Q,B)||Object.defineProperty(Q,B,{enumerable:!0,get:_})},D.r=function(Q){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(Q,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(Q,"__esModule",{value:!0})},D.t=function(Q,B){if(B&1&&(Q=D(Q)),B&8)return Q;if(B&4&&typeof Q=="object"&&Q&&Q.__esModule)return Q;var _=Object.create(null);if(D.r(_),Object.defineProperty(_,"default",{enumerable:!0,value:Q}),B&2&&typeof Q!="string")for(var G in Q)D.d(_,G,function(j){return Q[j]}.bind(null,G));return _},D.n=function(Q){var B=Q&&Q.__esModule?function(){return Q.default}:function(){return Q};return D.d(B,"a",B),B},D.o=function(Q,B){return Object.prototype.hasOwnProperty.call(Q,B)},D.p="/dist/",D(D.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(he,J,D){"use strict";var Q=Object.prototype.hasOwnProperty,B="~";function _(){}Object.create&&(_.prototype=Object.create(null),new _().__proto__||(B=!1));function G(v,A,M){this.fn=v,this.context=A,this.once=M||!1}function j(v,A,M,L,w){if(typeof M!="function")throw new TypeError("The listener must be a function");var y=new G(M,L||v,w),u=B?B+A:A;return v._events[u]?v._events[u].fn?v._events[u]=[v._events[u],y]:v._events[u].push(y):(v._events[u]=y,v._eventsCount++),v}function I(v,A){--v._eventsCount===0?v._events=new _:delete v._events[A]}function R(){this._events=new _,this._eventsCount=0}R.prototype.eventNames=function(){var A=[],M,L;if(this._eventsCount===0)return A;for(L in M=this._events)Q.call(M,L)&&A.push(B?L.slice(1):L);return Object.getOwnPropertySymbols?A.concat(Object.getOwnPropertySymbols(M)):A},R.prototype.listeners=function(A){var M=B?B+A:A,L=this._events[M];if(!L)return[];if(L.fn)return[L.fn];for(var w=0,y=L.length,u=new Array(y);w<y;w++)u[w]=L[w].fn;return u},R.prototype.listenerCount=function(A){var M=B?B+A:A,L=this._events[M];return L?L.fn?1:L.length:0},R.prototype.emit=function(A,M,L,w,y,u){var o=B?B+A:A;if(!this._events[o])return!1;var l=this._events[o],d=arguments.length,T,c;if(l.fn){l.once&&this.removeListener(A,l.fn,void 0,!0);switch(d){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,M),!0;case 3:return l.fn.call(l.context,M,L),!0;case 4:return l.fn.call(l.context,M,L,w),!0;case 5:return l.fn.call(l.context,M,L,w,y),!0;case 6:return l.fn.call(l.context,M,L,w,y,u),!0}for(c=1,T=new Array(d-1);c<d;c++)T[c-1]=arguments[c];l.fn.apply(l.context,T)}else{var p=l.length,k;for(c=0;c<p;c++){l[c].once&&this.removeListener(A,l[c].fn,void 0,!0);switch(d){case 1:l[c].fn.call(l[c].context);break;case 2:l[c].fn.call(l[c].context,M);break;case 3:l[c].fn.call(l[c].context,M,L);break;case 4:l[c].fn.call(l[c].context,M,L,w);break;default:if(!T)for(k=1,T=new Array(d-1);k<d;k++)T[k-1]=arguments[k];l[c].fn.apply(l[c].context,T)}}}return!0},R.prototype.on=function(A,M,L){return j(this,A,M,L,!1)},R.prototype.once=function(A,M,L){return j(this,A,M,L,!0)},R.prototype.removeListener=function(A,M,L,w){var y=B?B+A:A;if(!this._events[y])return this;if(!M)return I(this,y),this;var u=this._events[y];if(u.fn)u.fn===M&&(!w||u.once)&&(!L||u.context===L)&&I(this,y);else{for(var o=0,l=[],d=u.length;o<d;o++)(u[o].fn!==M||w&&!u[o].once||L&&u[o].context!==L)&&l.push(u[o]);l.length?this._events[y]=l.length===1?l[0]:l:I(this,y)}return this},R.prototype.removeAllListeners=function(A){var M;return A?(M=B?B+A:A,this._events[M]&&I(this,M)):(this._events=new _,this._eventsCount=0),this},R.prototype.off=R.prototype.removeListener,R.prototype.addListener=R.prototype.on,R.prefixed=B,R.EventEmitter=R,he.exports=R},"./node_modules/url-toolkit/src/url-toolkit.js":function(he,J,D){(function(Q){var B=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,_=/^([^\/?#]*)([^]*)$/,G=/(?:\/|^)\.(?=\/)/g,j=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,I={buildAbsoluteURL:function(R,v,A){if(A=A||{},R=R.trim(),v=v.trim(),!v){if(!A.alwaysNormalize)return R;var M=I.parseURL(R);if(!M)throw new Error("Error trying to parse base URL.");return M.path=I.normalizePath(M.path),I.buildURLFromParts(M)}var L=I.parseURL(v);if(!L)throw new Error("Error trying to parse relative URL.");if(L.scheme)return A.alwaysNormalize?(L.path=I.normalizePath(L.path),I.buildURLFromParts(L)):v;var w=I.parseURL(R);if(!w)throw new Error("Error trying to parse base URL.");if(!w.netLoc&&w.path&&w.path[0]!=="/"){var y=_.exec(w.path);w.netLoc=y[1],w.path=y[2]}w.netLoc&&!w.path&&(w.path="/");var u={scheme:w.scheme,netLoc:L.netLoc,path:null,params:L.params,query:L.query,fragment:L.fragment};if(!L.netLoc&&(u.netLoc=w.netLoc,L.path[0]!=="/"))if(!L.path)u.path=w.path,L.params||(u.params=w.params,L.query||(u.query=w.query));else{var o=w.path,l=o.substring(0,o.lastIndexOf("/")+1)+L.path;u.path=I.normalizePath(l)}return u.path===null&&(u.path=A.alwaysNormalize?I.normalizePath(L.path):L.path),I.buildURLFromParts(u)},parseURL:function(R){var v=B.exec(R);return v?{scheme:v[1]||"",netLoc:v[2]||"",path:v[3]||"",params:v[4]||"",query:v[5]||"",fragment:v[6]||""}:null},normalizePath:function(R){for(R=R.split("").reverse().join("").replace(G,"");R.length!==(R=R.replace(j,"")).length;);return R.split("").reverse().join("")},buildURLFromParts:function(R){return R.scheme+R.netLoc+R.path+R.params+R.query+R.fragment}};he.exports=I})(this)},"./node_modules/webworkify-webpack/index.js":function(he,J,D){function Q(A){var M={};function L(y){if(M[y])return M[y].exports;var u=M[y]={i:y,l:!1,exports:{}};return A[y].call(u.exports,u,u.exports,L),u.l=!0,u.exports}L.m=A,L.c=M,L.i=function(y){return y},L.d=function(y,u,o){L.o(y,u)||Object.defineProperty(y,u,{configurable:!1,enumerable:!0,get:o})},L.r=function(y){Object.defineProperty(y,"__esModule",{value:!0})},L.n=function(y){var u=y&&y.__esModule?function(){return y.default}:function(){return y};return L.d(u,"a",u),u},L.o=function(y,u){return Object.prototype.hasOwnProperty.call(y,u)},L.p="/",L.oe=function(y){throw console.error(y),y};var w=L(L.s=ENTRY_MODULE);return w.default||w}var B="[\\.|\\-|\\+|\\w|/|@]+",_="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+B+").*?\\)";function G(A){return(A+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function j(A){return!isNaN(1*A)}function I(A,M,L){var w={};w[L]=[];var y=M.toString(),u=y.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!u)return w;for(var o=u[1],l=new RegExp("(\\\\n|\\W)"+G(o)+_,"g"),d;d=l.exec(y);){if(d[3]==="dll-reference")continue;w[L].push(d[3])}for(l=new RegExp("\\("+G(o)+'\\("(dll-reference\\s('+B+'))"\\)\\)'+_,"g");d=l.exec(y);)A[d[2]]||(w[L].push(d[1]),A[d[2]]=D(d[1]).m),w[d[2]]=w[d[2]]||[],w[d[2]].push(d[4]);for(var T=Object.keys(w),c=0;c<T.length;c++)for(var p=0;p<w[T[c]].length;p++)j(w[T[c]][p])&&(w[T[c]][p]=1*w[T[c]][p]);return w}function R(A){var M=Object.keys(A);return M.reduce(function(L,w){return L||A[w].length>0},!1)}function v(A,M){for(var L={main:[M]},w={main:[]},y={main:{}};R(L);)for(var u=Object.keys(L),o=0;o<u.length;o++){var l=u[o],d=L[l],T=d.pop();if(y[l]=y[l]||{},y[l][T]||!A[l][T])continue;y[l][T]=!0,w[l]=w[l]||[],w[l].push(T);for(var c=I(A,A[l][T],l),p=Object.keys(c),k=0;k<p.length;k++)L[p[k]]=L[p[k]]||[],L[p[k]]=L[p[k]].concat(c[p[k]])}return w}he.exports=function(A,M){M=M||{};var L={main:D.m},w=M.all?{main:Object.keys(L.main)}:v(L,A),y="";Object.keys(w).filter(function(T){return T!=="main"}).forEach(function(T){for(var c=0;w[T][c];)c++;w[T].push(c),L[T][c]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",y=y+"var "+T+" = ("+Q.toString().replace("ENTRY_MODULE",JSON.stringify(c))+")({"+w[T].map(function(p){return""+JSON.stringify(p)+": "+L[T][p].toString()}).join(",")+`});
`}),y=y+"new (("+Q.toString().replace("ENTRY_MODULE",JSON.stringify(A))+")({"+w.main.map(function(T){return""+JSON.stringify(T)+": "+L.main[T].toString()}).join(",")+"}))(self);";var u=new window.Blob([y],{type:"text/javascript"});if(M.bare)return u;var o=window.URL||window.webkitURL||window.mozURL||window.msURL,l=o.createObjectURL(u),d=new window.Worker(l);return d.objectURL=l,d}},"./src/config.ts":function(he,J,D){"use strict";D.r(J),D.d(J,"hlsDefaultConfig",function(){return k}),D.d(J,"mergeConfig",function(){return m}),D.d(J,"enableStreamingMode",function(){return g});var Q=D("./src/controller/abr-controller.ts"),B=D("./src/controller/audio-stream-controller.ts"),_=D("./src/controller/audio-track-controller.ts"),G=D("./src/controller/subtitle-stream-controller.ts"),j=D("./src/controller/subtitle-track-controller.ts"),I=D("./src/controller/buffer-controller.ts"),R=D("./src/controller/timeline-controller.ts"),v=D("./src/controller/cap-level-controller.ts"),A=D("./src/controller/fps-controller.ts"),M=D("./src/controller/eme-controller.ts"),L=D("./src/controller/cmcd-controller.ts"),w=D("./src/utils/xhr-loader.ts"),y=D("./src/utils/fetch-loader.ts"),u=D("./src/utils/cues.ts"),o=D("./src/utils/mediakeys-helper.ts"),l=D("./src/utils/logger.ts");function d(){return d=Object.assign||function(h){for(var a=1;a<arguments.length;a++){var E=arguments[a];for(var b in E)Object.prototype.hasOwnProperty.call(E,b)&&(h[b]=E[b])}return h},d.apply(this,arguments)}function T(h,a){var E=Object.keys(h);if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(h);a&&(b=b.filter(function(S){return Object.getOwnPropertyDescriptor(h,S).enumerable})),E.push.apply(E,b)}return E}function c(h){for(var a=1;a<arguments.length;a++){var E=arguments[a]!=null?arguments[a]:{};a%2?T(Object(E),!0).forEach(function(b){p(h,b,E[b])}):Object.getOwnPropertyDescriptors?Object.defineProperties(h,Object.getOwnPropertyDescriptors(E)):T(Object(E)).forEach(function(b){Object.defineProperty(h,b,Object.getOwnPropertyDescriptor(E,b))})}return h}function p(h,a,E){return a in h?Object.defineProperty(h,a,{value:E,enumerable:!0,configurable:!0,writable:!0}):h[a]=E,h}var k=c(c({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:w.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:Q.default,bufferController:I.default,capLevelController:v.default,fpsController:A.default,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:o.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},x()),{},{subtitleStreamController:G.SubtitleStreamController,subtitleTrackController:j.default,timelineController:R.TimelineController,audioStreamController:B.default,audioTrackController:_.default,emeController:M.default,cmcdController:L.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 m(h,a){if((a.liveSyncDurationCount||a.liveMaxLatencyDurationCount)&&(a.liveSyncDuration||a.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(a.liveMaxLatencyDurationCount!==void 0&&(a.liveSyncDurationCount===void 0||a.liveMaxLatencyDurationCount<=a.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(a.liveMaxLatencyDuration!==void 0&&(a.liveSyncDuration===void 0||a.liveMaxLatencyDuration<=a.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return d({},h,a)}function g(h){var a=h.loader;if(a!==y.default&&a!==w.default)l.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),h.progressive=!1;else{var E=Object(y.fetchSupported)();E&&(h.loader=y.default,h.progressive=!0,h.enableSoftwareAES=!0,l.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(he,J,D){"use strict";D.r(J);var Q=D("./src/polyfills/number.ts"),B=D("./src/utils/ewma-bandwidth-estimator.ts"),_=D("./src/events.ts"),G=D("./src/utils/buffer-helper.ts"),j=D("./src/errors.ts"),I=D("./src/types/loader.ts"),R=D("./src/utils/logger.ts");function v(L,w){for(var y=0;y<w.length;y++){var u=w[y];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(L,u.key,u)}}function A(L,w,y){return w&&v(L.prototype,w),y&&v(L,y),L}var M=function(){function L(y){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=y;var u=y.config;this.bwEstimator=new B.default(u.abrEwmaSlowVoD,u.abrEwmaFastVoD,u.abrEwmaDefaultEstimate),this.registerListeners()}var w=L.prototype;return w.registerListeners=function(){var u=this.hls;u.on(_.Events.FRAG_LOADING,this.onFragLoading,this),u.on(_.Events.FRAG_LOADED,this.onFragLoaded,this),u.on(_.Events.FRAG_BUFFERED,this.onFragBuffered,this),u.on(_.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.on(_.Events.ERROR,this.onError,this)},w.unregisterListeners=function(){var u=this.hls;u.off(_.Events.FRAG_LOADING,this.onFragLoading,this),u.off(_.Events.FRAG_LOADED,this.onFragLoaded,this),u.off(_.Events.FRAG_BUFFERED,this.onFragBuffered,this),u.off(_.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.off(_.Events.ERROR,this.onError,this)},w.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},w.onFragLoading=function(u,o){var l=o.frag;if(l.type===I.PlaylistLevelType.MAIN&&!this.timer){var d;this.fragCurrent=l,this.partCurrent=(d=o.part)!=null?d:null,this.timer=self.setInterval(this.onCheck,100)}},w.onLevelLoaded=function(u,o){var l=this.hls.config;o.details.live?this.bwEstimator.update(l.abrEwmaSlowLive,l.abrEwmaFastLive):this.bwEstimator.update(l.abrEwmaSlowVoD,l.abrEwmaFastVoD)},w._abandonRulesCheck=function(){var u=this.fragCurrent,o=this.partCurrent,l=this.hls,d=l.autoLevelEnabled,T=l.config,c=l.media;if(!u||!c)return;var p=o?o.stats:u.stats,k=o?o.duration:u.duration;if(p.aborted){R.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!d||c.paused||!c.playbackRate||!c.readyState)return;var x=performance.now()-p.loading.start,m=Math.abs(c.playbackRate);if(x<=500*k/m)return;var g=l.levels,h=l.minAutoLevel,a=g[u.level],E=p.total||Math.max(p.loaded,Math.round(k*a.maxBitrate/8)),b=Math.max(1,p.bwEstimate?p.bwEstimate/8:p.loaded*1e3/x),S=(E-p.loaded)/b,N=c.currentTime,U=(G.BufferHelper.bufferInfo(c,N,T.maxBufferHole).end-N)/m;if(U>=2*k/m||S<=U)return;var K=Number.POSITIVE_INFINITY,V;for(V=u.level-1;V>h;V--){var O=g[V].maxBitrate;if(K=k*O/(8*.8*b),K<U)break}if(K>=S)return;var P=this.bwEstimator.getEstimate();R.logger.warn("Fragment "+u.sn+(o?" part "+o.index:"")+" of level "+u.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+V+`
Current BW estimate: `+(Object(Q.isFiniteNumber)(P)?(P/1024).toFixed(3):"Unknown")+` Kb/s
Estimated load time for current fragment: `+S.toFixed(3)+` s
Estimated load time for the next fragment: `+K.toFixed(3)+` s
Time to underbuffer: `+U.toFixed(3)+" s"),l.nextLoadLevel=V,this.bwEstimator.sample(x,p.loaded),this.clearTimer(),u.loader&&(this.fragCurrent=this.partCurrent=null,u.loader.abort()),l.trigger(_.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:u,part:o,stats:p})},w.onFragLoaded=function(u,o){var l=o.frag,d=o.part;if(l.type===I.PlaylistLevelType.MAIN&&Object(Q.isFiniteNumber)(l.sn)){var T=d?d.stats:l.stats,c=d?d.duration:l.duration;if(this.clearTimer(),this.lastLoadedFragLevel=l.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var p=this.hls.levels[l.level],k=(p.loaded?p.loaded.bytes:0)+T.loaded,x=(p.loaded?p.loaded.duration:0)+c;p.loaded={bytes:k,duration:x},p.realBitrate=Math.round(8*k/x)}if(l.bitrateTest){var m={stats:T,frag:l,part:d,id:l.type};this.onFragBuffered(_.Events.FRAG_BUFFERED,m),l.bitrateTest=!1}}},w.onFragBuffered=function(u,o){var l=o.frag,d=o.part,T=d?d.stats:l.stats;if(T.aborted)return;if(l.type!==I.PlaylistLevelType.MAIN||l.sn==="initSegment")return;var c=T.parsing.end-T.loading.start;this.bwEstimator.sample(c,T.loaded),T.bwEstimate=this.bwEstimator.getEstimate(),l.bitrateTest?this.bitrateTestDelay=c/1e3:this.bitrateTestDelay=0},w.onError=function(u,o){switch(o.details){case j.ErrorDetails.FRAG_LOAD_ERROR:case j.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},w.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},w.getNextABRAutoLevel=function(){var u=this.fragCurrent,o=this.partCurrent,l=this.hls,d=l.maxAutoLevel,T=l.config,c=l.minAutoLevel,p=l.media,k=o?o.duration:u?u.duration:0,x=p?p.currentTime:0,m=p&&p.playbackRate!==0?Math.abs(p.playbackRate):1,g=this.bwEstimator?this.bwEstimator.getEstimate():T.abrEwmaDefaultEstimate,h=(G.BufferHelper.bufferInfo(p,x,T.maxBufferHole).end-x)/m,a=this.findBestLevel(g,c,d,h,T.abrBandWidthFactor,T.abrBandWidthUpFactor);if(a>=0)return a;R.logger.trace((h?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var E=k?Math.min(k,T.maxStarvationDelay):T.maxStarvationDelay,b=T.abrBandWidthFactor,S=T.abrBandWidthUpFactor;if(!h){var N=this.bitrateTestDelay;if(N){var U=k?Math.min(k,T.maxLoadingDelay):T.maxLoadingDelay;E=U-N,R.logger.trace("bitrate test took "+Math.round(1e3*N)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*E)+" ms"),b=S=1}}return a=this.findBestLevel(g,c,d,h+E,b,S),Math.max(a,0)},w.findBestLevel=function(u,o,l,d,T,c){for(var p,k=this.fragCurrent,x=this.partCurrent,m=this.lastLoadedFragLevel,g=this.hls.levels,h=g[m],a=!!(h!=null&&(p=h.details)!==null&&p!==void 0&&p.live),E=h==null?void 0:h.codecSet,b=x?x.duration:k?k.duration:0,S=l;S>=o;S--){var N=g[S];if(!N||E&&N.codecSet!==E)continue;var U=N.details,K=(x?U==null?void 0:U.partTarget:U==null?void 0:U.averagetargetduration)||b,V=void 0;S<=m?V=T*u:V=c*u;var O=g[S].maxBitrate,P=O*K/V;if(R.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+S+"/"+Math.round(V)+"/"+O+"/"+K+"/"+d+"/"+P),V>O&&(!P||a&&!this.bitrateTestDelay||P<d))return S}return-1},A(L,[{key:"nextAutoLevel",get:function(){var u=this._nextAutoLevel,o=this.bwEstimator;if(u!==-1&&(!o||!o.canEstimate()))return u;var l=this.getNextABRAutoLevel();return u!==-1&&(l=Math.min(u,l)),l},set:function(u){this._nextAutoLevel=u}}]),L}();J.default=M},"./src/controller/audio-stream-controller.ts":function(he,J,D){"use strict";D.r(J);var Q=D("./src/polyfills/number.ts"),B=D("./src/controller/base-stream-controller.ts"),_=D("./src/events.ts"),G=D("./src/utils/buffer-helper.ts"),j=D("./src/controller/fragment-tracker.ts"),I=D("./src/types/level.ts"),R=D("./src/types/loader.ts"),v=D("./src/loader/fragment.ts"),A=D("./src/demux/chunk-cache.ts"),M=D("./src/demux/transmuxer-interface.ts"),L=D("./src/types/transmuxer.ts"),w=D("./src/controller/fragment-finders.ts"),y=D("./src/utils/discontinuities.ts"),u=D("./src/errors.ts"),o=D("./src/utils/logger.ts");function l(){return l=Object.assign||function(k){for(var x=1;x<arguments.length;x++){var m=arguments[x];for(var g in m)Object.prototype.hasOwnProperty.call(m,g)&&(k[g]=m[g])}return k},l.apply(this,arguments)}function d(k,x){k.prototype=Object.create(x.prototype),k.prototype.constructor=k,T(k,x)}function T(k,x){return T=Object.setPrototypeOf||function(g,h){return g.__proto__=h,g},T(k,x)}var c=100,p=function(k){d(x,k);function x(g,h){var a;return a=k.call(this,g,h,"[audio-stream-controller]")||this,a.videoBuffer=null,a.videoTrackCC=-1,a.waitingVideoCC=-1,a.audioSwitch=!1,a.trackId=-1,a.waitingData=null,a.mainDetails=null,a.bufferFlushed=!1,a._registerListeners(),a}var m=x.prototype;return m.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},m._registerListeners=function(){var h=this.hls;h.on(_.Events.MEDIA_ATTACHED,this.onMediaAttached,this),h.on(_.Events.MEDIA_DETACHING,this.onMediaDetaching,this),h.on(_.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.on(_.Events.LEVEL_LOADED,this.onLevelLoaded,this),h.on(_.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),h.on(_.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),h.on(_.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),h.on(_.Events.ERROR,this.onError,this),h.on(_.Events.BUFFER_RESET,this.onBufferReset,this),h.on(_.Events.BUFFER_CREATED,this.onBufferCreated,this),h.on(_.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),h.on(_.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),h.on(_.Events.FRAG_BUFFERED,this.onFragBuffered,this)},m._unregisterListeners=function(){var h=this.hls;h.off(_.Events.MEDIA_ATTACHED,this.onMediaAttached,this),h.off(_.Events.MEDIA_DETACHING,this.onMediaDetaching,this),h.off(_.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.off(_.Events.LEVEL_LOADED,this.onLevelLoaded,this),h.off(_.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),h.off(_.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),h.off(_.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),h.off(_.Events.ERROR,this.onError,this),h.off(_.Events.BUFFER_RESET,this.onBufferReset,this),h.off(_.Events.BUFFER_CREATED,this.onBufferCreated,this),h.off(_.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),h.off(_.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),h.off(_.Events.FRAG_BUFFERED,this.onFragBuffered,this)},m.onInitPtsFound=function(h,a){var E=a.frag,b=a.id,S=a.initPTS;if(b==="main"){var N=E.cc;this.initPTS[E.cc]=S,this.log("InitPTS for cc: "+N+" found from main: "+S),this.videoTrackCC=N,this.state===B.State.WAITING_INIT_PTS&&this.tick()}},m.startLoad=function(h){if(!this.levels){this.startPosition=h,this.state=B.State.STOPPED;return}var a=this.lastCurrentTime;this.stopLoad(),this.setInterval(c),this.fragLoadError=0,a>0&&h===-1?(this.log("Override startPosition with lastCurrentTime @"+a.toFixed(3)),this.state=B.State.IDLE):(this.loadedmetadata=!1,this.state=B.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=h,this.tick()},m.doTick=function(){switch(this.state){case B.State.IDLE:this.doTickIdle();break;case B.State.WAITING_TRACK:{var h,a=this.levels,E=this.trackId,b=a==null||((h=a[E])===null||h===void 0)?void 0:h.details;if(b){if(this.waitForCdnTuneIn(b))break;this.state=B.State.WAITING_INIT_PTS}break}case B.State.FRAG_LOADING_WAITING_RETRY:{var S,N=performance.now(),U=this.retryDate;(!U||N>=U||(S=this.media)!==null&&S!==void 0&&S.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=B.State.IDLE);break}case B.State.WAITING_INIT_PTS:{var K=this.waitingData;if(K){var V=K.frag,O=K.part,P=K.cache,$=K.complete;if(this.initPTS[V.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=B.State.FRAG_LOADING;var ee=P.flush(),oe={frag:V,part:O,payload:ee,networkDetails:null};this._handleFragmentLoadProgress(oe),$&&k.prototype._handleFragmentLoadComplete.call(this,oe)}else if(this.videoTrackCC!==this.waitingVideoCC)o.logger.log("Waiting fragment cc ("+V.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var fe=this.getLoadPosition(),Oe=G.BufferHelper.bufferInfo(this.mediaBuffer,fe,this.config.maxBufferHole),Ce=Object(w.fragmentWithinToleranceTest)(Oe.end,this.config.maxFragLookUpTolerance,V);Ce<0&&(o.logger.log("Waiting fragment cc ("+V.cc+") @ "+V.start+" cancelled because another fragment at "+Oe.end+" is needed"),this.clearWaitingFragment())}}else this.state=B.State.IDLE}}this.onTickEnd()},m.clearWaitingFragment=function(){var h=this.waitingData;h&&(this.fragmentTracker.removeFragment(h.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=B.State.IDLE)},m.onTickEnd=function(){var h=this.media;if(!h||!h.readyState)return;var a=this.mediaBuffer?this.mediaBuffer:h,E=a.buffered;!this.loadedmetadata&&E.length&&(this.loadedmetadata=!0),this.lastCurrentTime=h.currentTime},m.doTickIdle=function(){var h,a,E=this.hls,b=this.levels,S=this.media,N=this.trackId,U=E.config;if(!b||!b[N])return;if(!S&&(this.startFragRequested||!U.startFragPrefetch))return;var K=b[N],V=K.details;if(!V||V.live&&this.levelLastLoaded!==N||this.waitForCdnTuneIn(V)){this.state=B.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,v.ElementaryStreamTypes.AUDIO,R.PlaylistLevelType.AUDIO));var O=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,R.PlaylistLevelType.AUDIO);if(O===null)return;var P=O.len,$=this.getMaxBufferLength(),ee=this.audioSwitch;if(P>=$&&!ee)return;if(!ee&&this._streamEnded(O,V)){E.trigger(_.Events.BUFFER_EOS,{type:"audio"}),this.state=B.State.ENDED;return}var oe=V.fragments,fe=oe[0].start,Oe=O.end;if(ee){var Ce=this.getLoadPosition();Oe=Ce,V.PTSKnown&&Ce<fe&&((O.end>fe||O.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),S.currentTime=fe+.05))}var Ae=this.getNextFragment(Oe,V);if(!Ae){this.bufferFlushed=!0;return}((h=Ae.decryptdata)===null||h===void 0?void 0:h.keyFormat)==="identity"&&!((a=Ae.decryptdata)!==null&&a!==void 0&&a.key)?this.loadKey(Ae,V):this.loadFragment(Ae,V,Oe)},m.getMaxBufferLength=function(){var h=k.prototype.getMaxBufferLength.call(this),a=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,R.PlaylistLevelType.MAIN);return a===null?h:Math.max(h,a.len)},m.onMediaDetaching=function(){this.videoBuffer=null,k.prototype.onMediaDetaching.call(this)},m.onAudioTracksUpdated=function(h,a){var E=a.audioTracks;this.resetTransmuxer(),this.levels=E.map(function(b){return new I.Level(b)})},m.onAudioTrackSwitching=function(h,a){var E=!!a.url;this.trackId=a.id;var b=this.fragCurrent;b!=null&&b.loader&&b.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),E?this.setInterval(c):this.resetTransmuxer(),E?(this.audioSwitch=!0,this.state=B.State.IDLE):this.state=B.State.STOPPED,this.tick()},m.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},m.onLevelLoaded=function(h,a){this.mainDetails=a.details},m.onAudioTrackLoaded=function(h,a){var E,b=this.levels,S=a.details,N=a.id;if(!b){this.warn("Audio tracks were reset while loading level "+N);return}this.log("Track "+N+" loaded ["+S.startSN+","+S.endSN+"],duration:"+S.totalduration);var U=b[N],K=0;if(S.live||(E=U.details)!==null&&E!==void 0&&E.live){var V=this.mainDetails;if(S.fragments[0]||(S.deltaUpdateFailed=!0),S.deltaUpdateFailed||!V)return;!U.details&&S.hasProgramDateTime&&V.hasProgramDateTime?(Object(y.alignMediaPlaylistByPDT)(S,V),K=S.fragments[0].start):K=this.alignPlaylists(S,U.details)}U.details=S,this.levelLastLoaded=N,!this.startFragRequested&&(this.mainDetails||!S.live)&&this.setStartPosition(U.details,K),this.state===B.State.WAITING_TRACK&&!this.waitForCdnTuneIn(S)&&(this.state=B.State.IDLE),this.tick()},m._handleFragmentLoadProgress=function(h){var a,E=h.frag,b=h.part,S=h.payload,N=this.config,U=this.trackId,K=this.levels;if(!K){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+E.sn+" of level "+E.level+" will not be buffered");return}var V=K[U];console.assert(V,"Audio track is defined on fragment load progress");var O=V.details;console.assert(O,"Audio track details are defined on fragment load progress");var P=N.defaultAudioCodec||V.audioCodec||"mp4a.40.2",$=this.transmuxer;$||($=this.transmuxer=new M.default(this.hls,R.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var ee=this.initPTS[E.cc],oe=(a=E.initSegment)===null||a===void 0?void 0:a.data;if(ee!==void 0){var fe=!1,Oe=b?b.index:-1,Ce=Oe!==-1,Ae=new L.ChunkMetadata(E.level,E.sn,E.stats.chunkCount,S.byteLength,Oe,Ce);$.push(S,oe,P,"",E,b,O.totalduration,fe,Ae,ee)}else{o.logger.log("Unknown video PTS for cc "+E.cc+", waiting for video PTS before demuxing audio frag "+E.sn+" of ["+O.startSN+" ,"+O.endSN+"],track "+U);var Le=this.waitingData=this.waitingData||{frag:E,part:b,cache:new A.default,complete:!1},be=Le.cache;be.push(new Uint8Array(S)),this.waitingVideoCC=this.videoTrackCC,this.state=B.State.WAITING_INIT_PTS}},m._handleFragmentLoadComplete=function(h){if(this.waitingData){this.waitingData.complete=!0;return}k.prototype._handleFragmentLoadComplete.call(this,h)},m.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},m.onBufferCreated=function(h,a){var E=a.tracks.audio;E&&(this.mediaBuffer=E.buffer),a.tracks.video&&(this.videoBuffer=a.tracks.video.buffer)},m.onFragBuffered=function(h,a){var E=a.frag,b=a.part;if(E.type!==R.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(E)){this.warn("Fragment "+E.sn+(b?" p: "+b.index:"")+" of level "+E.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}E.sn!=="initSegment"&&(this.fragPrevious=E,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(_.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(E,b)},m.onError=function(h,a){switch(a.details){case u.ErrorDetails.FRAG_LOAD_ERROR:case u.ErrorDetails.FRAG_LOAD_TIMEOUT:case u.ErrorDetails.KEY_LOAD_ERROR:case u.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(R.PlaylistLevelType.AUDIO,a);break;case u.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case u.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==B.State.ERROR&&this.state!==B.State.STOPPED&&(this.state=a.fatal?B.State.ERROR:B.State.IDLE,this.warn(a.details+" while loading frag, switching to "+this.state+" state"));break;case u.ErrorDetails.BUFFER_FULL_ERROR:if(a.parent==="audio"&&(this.state===B.State.PARSING||this.state===B.State.PARSED)){var E=!0,b=this.getFwdBufferInfo(this.mediaBuffer,R.PlaylistLevelType.AUDIO);b&&b.len>.5&&(E=!this.reduceMaxBufferLength(b.len)),E&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,k.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},m.onBufferFlushed=function(h,a){var E=a.type;E===v.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},m._handleTransmuxComplete=function(h){var a,E="audio",b=this.hls,S=h.remuxResult,N=h.chunkMeta,U=this.getCurrentContext(N);if(!U){this.warn("The loading context changed while buffering fragment "+N.sn+" of level "+N.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(N.level);return}var K=U.frag,V=U.part,O=S.audio,P=S.text,$=S.id3,ee=S.initSegment;if(this.fragContextChanged(K))return;if(this.state=B.State.PARSING,this.audioSwitch&&O&&this.completeAudioSwitch(),ee!=null&&ee.tracks&&(this._bufferInitSegment(ee.tracks,K,N),b.trigger(_.Events.FRAG_PARSING_INIT_SEGMENT,{frag:K,id:E,tracks:ee.tracks})),O){var oe=O.startPTS,fe=O.endPTS,Oe=O.startDTS,Ce=O.endDTS;V&&(V.elementaryStreams[v.ElementaryStreamTypes.AUDIO]={startPTS:oe,endPTS:fe,startDTS:Oe,endDTS:Ce}),K.setElementaryStreamInfo(v.ElementaryStreamTypes.AUDIO,oe,fe,Oe,Ce),this.bufferFragmentData(O,K,V,N)}if($!=null&&(a=$.samples)!==null&&a!==void 0&&a.length){var Ae=l({frag:K,id:E},$);b.trigger(_.Events.FRAG_PARSING_METADATA,Ae)}if(P){var Le=l({frag:K,id:E},P);b.trigger(_.Events.FRAG_PARSING_USERDATA,Le)}},m._bufferInitSegment=function(h,a,E){if(this.state!==B.State.PARSING)return;h.video&&delete h.video;var b=h.audio;if(!b)return;b.levelCodec=b.codec,b.id="audio",this.log("Init audio buffer, container:"+b.container+", codecs[parsed]=["+b.codec+"]"),this.hls.trigger(_.Events.BUFFER_CODECS,h);var S=b.initSegment;if(S!=null&&S.byteLength){var N={type:"audio",frag:a,part:null,chunkMeta:E,parent:a.type,data:S};this.hls.trigger(_.Events.BUFFER_APPENDING,N)}this.tick()},m.loadFragment=function(h,a,E){var b=this.fragmentTracker.getState(h);this.fragCurrent=h,(this.audioSwitch||b===j.FragmentState.NOT_LOADED||b===j.FragmentState.PARTIAL)&&(h.sn==="initSegment"?this._loadInitSegment(h):a.live&&!Object(Q.isFiniteNumber)(this.initPTS[h.cc])?(this.log("Waiting for video PTS in continuity counter "+h.cc+" of live stream before loading audio fragment "+h.sn+" of level "+this.trackId),this.state=B.State.WAITING_INIT_PTS):(this.startFragRequested=!0,k.prototype.loadFragment.call(this,h,a,E)))},m.completeAudioSwitch=function(){var h=this.hls,a=this.media,E=this.trackId;a&&(this.log("Switching audio track : flushing all audio"),k.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,h.trigger(_.Events.AUDIO_TRACK_SWITCHED,{id:E})},x}(B.default);J.default=p},"./src/controller/audio-track-controller.ts":function(he,J,D){"use strict";D.r(J);var Q=D("./src/events.ts"),B=D("./src/errors.ts"),_=D("./src/controller/base-playlist-controller.ts"),G=D("./src/types/loader.ts");function j(M,L){for(var w=0;w<L.length;w++){var y=L[w];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(M,y.key,y)}}function I(M,L,w){return L&&j(M.prototype,L),w&&j(M,w),M}function R(M,L){M.prototype=Object.create(L.prototype),M.prototype.constructor=M,v(M,L)}function v(M,L){return v=Object.setPrototypeOf||function(y,u){return y.__proto__=u,y},v(M,L)}var A=function(M){R(L,M);function L(y){var u;return u=M.call(this,y,"[audio-track-controller]")||this,u.tracks=[],u.groupId=null,u.tracksInGroup=[],u.trackId=-1,u.trackName="",u.selectDefaultTrack=!0,u.registerListeners(),u}var w=L.prototype;return w.registerListeners=function(){var u=this.hls;u.on(Q.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.on(Q.Events.MANIFEST_PARSED,this.onManifestParsed,this),u.on(Q.Events.LEVEL_LOADING,this.onLevelLoading,this),u.on(Q.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),u.on(Q.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),u.on(Q.Events.ERROR,this.onError,this)},w.unregisterListeners=function(){var u=this.hls;u.off(Q.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.off(Q.Events.MANIFEST_PARSED,this.onManifestParsed,this),u.off(Q.Events.LEVEL_LOADING,this.onLevelLoading,this),u.off(Q.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),u.off(Q.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),u.off(Q.Events.ERROR,this.onError,this)},w.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,M.prototype.destroy.call(this)},w.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},w.onManifestParsed=function(u,o){this.tracks=o.audioTracks||[]},w.onAudioTrackLoaded=function(u,o){var l=o.id,d=o.details,T=this.tracksInGroup[l];if(!T){this.warn("Invalid audio track id "+l);return}var c=T.details;T.details=o.details,this.log("audioTrack "+l+" loaded ["+d.startSN+"-"+d.endSN+"]"),l===this.trackId&&(this.retryCount=0,this.playlistLoaded(l,o,c))},w.onLevelLoading=function(u,o){this.switchLevel(o.level)},w.onLevelSwitching=function(u,o){this.switchLevel(o.level)},w.switchLevel=function(u){var o=this.hls.levels[u];if(!(o!=null&&o.audioGroupIds))return;var l=o.audioGroupIds[o.urlId];if(this.groupId!==l){this.groupId=l;var d=this.tracks.filter(function(c){return!l||c.groupId===l});this.selectDefaultTrack&&!d.some(function(c){return c.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=d;var T={audioTracks:d};this.log("Updating audio tracks, "+d.length+' track(s) found in "'+l+'" group-id'),this.hls.trigger(Q.Events.AUDIO_TRACKS_UPDATED,T),this.selectInitialTrack()}},w.onError=function(u,o){if(M.prototype.onError.call(this,u,o),o.fatal||!o.context)return;o.context.type===G.PlaylistContextType.AUDIO_TRACK&&o.context.id===this.trackId&&o.context.groupId===this.groupId&&this.retryLoadingOrFail(o)},w.setAudioTrack=function(u){var o=this.tracksInGroup;if(u<0||u>=o.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var l=o[this.trackId];this.log("Now switching to audio-track index "+u);var d=o[u],T=d.id,c=d.groupId,p=c===void 0?"":c,k=d.name,x=d.type,m=d.url;if(this.trackId=u,this.trackName=k,this.selectDefaultTrack=!1,this.hls.trigger(Q.Events.AUDIO_TRACK_SWITCHING,{id:T,groupId:p,name:k,type:x,url:m}),d.details&&!d.details.live)return;var g=this.switchParams(d.url,l==null?void 0:l.details);this.loadPlaylist(g)},w.selectInitialTrack=function(){var u=this.tracksInGroup;console.assert(u.length,"Initial audio track should be selected when tracks are known");var o=this.trackName,l=this.findTrackId(o)||this.findTrackId();l!==-1?this.setAudioTrack(l):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(Q.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},w.findTrackId=function(u){for(var o=this.tracksInGroup,l=0;l<o.length;l++){var d=o[l];if((!this.selectDefaultTrack||d.default)&&(!u||u===d.name))return d.id}return-1},w.loadPlaylist=function(u){var o=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(o)){var l=o.id,d=o.groupId,T=o.url;if(u)try{T=u.addDirectives(T)}catch(c){this.warn("Could not construct new URL with HLS Delivery Directives: "+c)}this.log("loading audio-track playlist for id: "+l),this.clearTimer(),this.hls.trigger(Q.Events.AUDIO_TRACK_LOADING,{url:T,id:l,groupId:d,deliveryDirectives:u||null})}},I(L,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(u){this.selectDefaultTrack=!1,this.setAudioTrack(u)}}]),L}(_.default);J.default=A},"./src/controller/base-playlist-controller.ts":function(he,J,D){"use strict";D.r(J),D.d(J,"default",function(){return I});var Q=D("./src/polyfills/number.ts"),B=D("./src/types/level.ts"),_=D("./src/controller/level-helper.ts"),G=D("./src/utils/logger.ts"),j=D("./src/errors.ts"),I=function(){function R(A,M){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=G.logger.log.bind(G.logger,M+":"),this.warn=G.logger.warn.bind(G.logger,M+":"),this.hls=A}var v=R.prototype;return v.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},v.onError=function(M,L){L.fatal&&L.type===j.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},v.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},v.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},v.stopLoad=function(){this.canLoad=!1,this.clearTimer()},v.switchParams=function(M,L){var w=L==null?void 0:L.renditionReports;if(w)for(var y=0;y<w.length;y++){var u=w[y],o=""+u.URI;if(o===M.substr(-o.length)){var l=parseInt(u["LAST-MSN"]),d=parseInt(u["LAST-PART"]);if(L&&this.hls.config.lowLatencyMode){var T=Math.min(L.age-L.partTarget,L.targetduration);d!==void 0&&T>L.partTarget&&(d+=1)}if(Object(Q.isFiniteNumber)(l))return new B.HlsUrlParameters(l,Object(Q.isFiniteNumber)(d)?d:void 0,B.HlsSkip.No)}}},v.loadPlaylist=function(M){},v.shouldLoadTrack=function(M){return this.canLoad&&M&&!!M.url&&(!M.details||M.details.live)},v.playlistLoaded=function(M,L,w){var y=this,u=L.details,o=L.stats,l=o.loading.end?Math.max(0,self.performance.now()-o.loading.end):0;if(u.advancedDateTime=Date.now()-l,u.live||w!=null&&w.live){if(u.reloaded(w),w&&this.log("live playlist "+M+" "+(u.advanced?"REFRESHED "+u.lastPartSn+"-"+u.lastPartIndex:"MISSED")),w&&u.fragments.length>0&&Object(_.mergeDetails)(w,u),!this.canLoad||!u.live)return;var d,T=void 0,c=void 0;if(u.canBlockReload&&u.endSN&&u.advanced){var p=this.hls.config.lowLatencyMode,k=u.lastPartSn,x=u.endSN,m=u.lastPartIndex,g=m!==-1,h=k===x,a=p?0:m;g?(T=h?x+1:k,c=h?a:m+1):T=x+1;var E=u.age,b=E+u.ageHeader,S=Math.min(b-u.partTarget,u.targetduration*1.5);if(S>0){if(w&&S>w.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+w.tuneInGoal+" to: "+S+" with playlist age: "+u.age),S=0;else{var N=Math.floor(S/u.targetduration);if(T+=N,c!==void 0){var U=Math.round(S%u.targetduration/u.partTarget);c+=U}this.log("CDN Tune-in age: "+u.ageHeader+"s last advanced "+E.toFixed(2)+"s goal: "+S+" skip sn "+N+" to part "+c)}u.tuneInGoal=S}if(d=this.getDeliveryDirectives(u,L.deliveryDirectives,T,c),p||!h){this.loadPlaylist(d);return}}else d=this.getDeliveryDirectives(u,L.deliveryDirectives,T,c);var K=Object(_.computeReloadInterval)(u,o);T!==void 0&&u.canBlockReload&&(K-=u.partTarget||1),this.log("reload live playlist "+M+" in "+Math.round(K)+" ms"),this.timer=self.setTimeout(function(){return y.loadPlaylist(d)},K)}else this.clearTimer()},v.getDeliveryDirectives=function(M,L,w,y){var u=Object(B.getSkipValue)(M,w);return L!=null&&L.skip&&M.deltaUpdateFailed&&(w=L.msn,y=L.part,u=B.HlsSkip.No),new B.HlsUrlParameters(w,y,u)},v.retryLoadingOrFail=function(M){var L=this,w=this.hls.config,y=this.retryCount<w.levelLoadingMaxRetry;if(y){var u;if(this.retryCount++,M.details.indexOf("LoadTimeOut")>-1&&(u=M.context)!==null&&u!==void 0&&u.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+M.details+'"'),this.loadPlaylist();else{var o=Math.min(Math.pow(2,this.retryCount)*w.levelLoadingRetryDelay,w.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return L.loadPlaylist()},o),this.warn("retry playlist loading #"+this.retryCount+" in "+o+' ms after "'+M.details+'"')}}else this.warn('cannot recover from error "'+M.details+'"'),this.clearTimer(),M.fatal=!0;return y},R}()},"./src/controller/base-stream-controller.ts":function(he,J,D){"use strict";D.r(J),D.d(J,"State",function(){return x}),D.d(J,"default",function(){return m});var Q=D("./src/polyfills/number.ts"),B=D("./src/task-loop.ts"),_=D("./src/controller/fragment-tracker.ts"),G=D("./src/utils/buffer-helper.ts"),j=D("./src/utils/logger.ts"),I=D("./src/events.ts"),R=D("./src/errors.ts"),v=D("./src/types/transmuxer.ts"),A=D("./src/utils/mp4-tools.ts"),M=D("./src/utils/discontinuities.ts"),L=D("./src/controller/fragment-finders.ts"),w=D("./src/controller/level-helper.ts"),y=D("./src/loader/fragment-loader.ts"),u=D("./src/crypt/decrypter.ts"),o=D("./src/utils/time-ranges.ts"),l=D("./src/types/loader.ts");function d(g,h){for(var a=0;a<h.length;a++){var E=h[a];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(g,E.key,E)}}function T(g,h,a){return h&&d(g.prototype,h),a&&d(g,a),g}function c(g){if(g===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return g}function p(g,h){g.prototype=Object.create(h.prototype),g.prototype.constructor=g,k(g,h)}function k(g,h){return k=Object.setPrototypeOf||function(E,b){return E.__proto__=b,E},k(g,h)}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"},m=function(g){p(h,g);function h(E,b,S){var N;return N=g.call(this)||this,N.hls=void 0,N.fragPrevious=null,N.fragCurrent=null,N.fragmentTracker=void 0,N.transmuxer=null,N._state=x.STOPPED,N.media=void 0,N.mediaBuffer=void 0,N.config=void 0,N.bitrateTest=!1,N.lastCurrentTime=0,N.nextLoadPosition=0,N.startPosition=0,N.loadedmetadata=!1,N.fragLoadError=0,N.retryDate=0,N.levels=null,N.fragmentLoader=void 0,N.levelLastLoaded=null,N.startFragRequested=!1,N.decrypter=void 0,N.initPTS=[],N.onvseeking=null,N.onvended=null,N.logPrefix="",N.log=void 0,N.warn=void 0,N.logPrefix=S,N.log=j.logger.log.bind(j.logger,S+":"),N.warn=j.logger.warn.bind(j.logger,S+":"),N.hls=E,N.fragmentLoader=new y.default(E.config),N.fragmentTracker=b,N.config=E.config,N.decrypter=new u.default(E,E.config),E.on(I.Events.KEY_LOADED,N.onKeyLoaded,c(N)),N}var a=h.prototype;return a.doTick=function(){this.onTickEnd()},a.onTickEnd=function(){},a.startLoad=function(b){},a.stopLoad=function(){this.fragmentLoader.abort();var b=this.fragCurrent;b&&this.fragmentTracker.removeFragment(b),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=x.STOPPED},a._streamEnded=function(b,S){var N=this.fragCurrent,U=this.fragmentTracker;if(!S.live&&N&&N.sn===S.endSN&&!b.nextStart){var K=U.getState(N);return K===_.FragmentState.PARTIAL||K===_.FragmentState.OK}return!1},a.onMediaAttached=function(b,S){var N=this.media=this.mediaBuffer=S.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),N.addEventListener("seeking",this.onvseeking),N.addEventListener("ended",this.onvended);var U=this.config;this.levels&&U.autoStartLoad&&this.state===x.STOPPED&&this.startLoad(U.startPosition)},a.onMediaDetaching=function(){var b=this.media;b!=null&&b.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),b&&(b.removeEventListener("seeking",this.onvseeking),b.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},a.onMediaSeeking=function(){var b=this.config,S=this.fragCurrent,N=this.media,U=this.mediaBuffer,K=this.state,V=N?N.currentTime:0,O=G.BufferHelper.bufferInfo(U||N,V,b.maxBufferHole);if(this.log("media seeking to "+(Object(Q.isFiniteNumber)(V)?V.toFixed(3):V)+", state: "+K),K===x.ENDED)this.resetLoadingState();else if(S&&!O.len){var P=b.maxFragLookUpTolerance,$=S.start-P,ee=S.start+S.duration+P,oe=V>ee;(V<$||oe)&&(oe&&S.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),S.loader.abort()),this.resetLoadingState())}N&&(this.lastCurrentTime=V),!this.loadedmetadata&&!O.len&&(this.nextLoadPosition=this.startPosition=V),this.tickImmediate()},a.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},a.onKeyLoaded=function(b,S){if(this.state!==x.KEY_LOADING||S.frag!==this.fragCurrent||!this.levels)return;this.state=x.IDLE;var N=this.levels[S.frag.level].details;N&&this.loadFragment(S.frag,N,S.frag.start)},a.onHandlerDestroying=function(){this.stopLoad(),g.prototype.onHandlerDestroying.call(this)},a.onHandlerDestroyed=function(){this.state=x.STOPPED,this.hls.off(I.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,g.prototype.onHandlerDestroyed.call(this)},a.loadKey=function(b,S){this.log("Loading key for "+b.sn+" of ["+S.startSN+"-"+S.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+b.level),this.state=x.KEY_LOADING,this.fragCurrent=b,this.hls.trigger(I.Events.KEY_LOADING,{frag:b})},a.loadFragment=function(b,S,N){this._loadFragForPlayback(b,S,N)},a._loadFragForPlayback=function(b,S,N){var U=this,K=function(O){if(U.fragContextChanged(b)){U.warn("Fragment "+b.sn+(O.part?" p: "+O.part.index:"")+" of level "+b.level+" was dropped during download."),U.fragmentTracker.removeFragment(b);return}b.stats.chunkCount++,U._handleFragmentLoadProgress(O)};this._doFragLoad(b,S,N,K).then(function(V){if(!V)return;U.fragLoadError=0;var O=U.state;if(U.fragContextChanged(b)){(O===x.FRAG_LOADING||O===x.BACKTRACKING||!U.fragCurrent&&O===x.PARSING)&&(U.fragmentTracker.removeFragment(b),U.state=x.IDLE);return}if("payload"in V&&(U.log("Loaded fragment "+b.sn+" of level "+b.level),U.hls.trigger(I.Events.FRAG_LOADED,V),U.state===x.BACKTRACKING)){U.fragmentTracker.backtrack(b,V),U.resetFragmentLoading(b);return}U._handleFragmentLoadComplete(V)}).catch(function(V){U.warn(V),U.resetFragmentLoading(b)})},a.flushMainBuffer=function(b,S,N){if(N===void 0&&(N=null),!(b-S))return;var U={startOffset:b,endOffset:S,type:N};this.fragLoadError=0,this.hls.trigger(I.Events.BUFFER_FLUSHING,U)},a._loadInitSegment=function(b){var S=this;this._doFragLoad(b).then(function(N){if(!N||S.fragContextChanged(b)||!S.levels)throw new Error("init load aborted");return N}).then(function(N){var U=S.hls,K=N.payload,V=b.decryptdata;if(K&&K.byteLength>0&&V&&V.key&&V.iv&&V.method==="AES-128"){var O=self.performance.now();return S.decrypter.webCryptoDecrypt(new Uint8Array(K),V.key.buffer,V.iv.buffer).then(function(P){var $=self.performance.now();return U.trigger(I.Events.FRAG_DECRYPTED,{frag:b,payload:P,stats:{tstart:O,tdecrypt:$}}),N.payload=P,N})}return N}).then(function(N){var U=S.fragCurrent,K=S.hls,V=S.levels;if(!V)throw new Error("init load aborted, missing levels");var O=V[b.level].details;console.assert(O,"Level details are defined when init segment is loaded");var P=b.stats;S.state=x.IDLE,S.fragLoadError=0,b.data=new Uint8Array(N.payload),P.parsing.start=P.buffering.start=self.performance.now(),P.parsing.end=P.buffering.end=self.performance.now(),N.frag===U&&K.trigger(I.Events.FRAG_BUFFERED,{stats:P,frag:U,part:null,id:b.type}),S.tick()}).catch(function(N){S.warn(N),S.resetFragmentLoading(b)})},a.fragContextChanged=function(b){var S=this.fragCurrent;return!b||!S||b.level!==S.level||b.sn!==S.sn||b.urlId!==S.urlId},a.fragBufferedComplete=function(b,S){var N=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+b.type+" sn: "+b.sn+(S?" part: "+S.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+b.level+" "+o.default.toString(G.BufferHelper.getBuffered(N))),this.state=x.IDLE,this.tick()},a._handleFragmentLoadComplete=function(b){var S=this.transmuxer;if(!S)return;var N=b.frag,U=b.part,K=b.partsLoaded,V=!K||K.length===0||K.some(function(P){return!P}),O=new v.ChunkMetadata(N.level,N.sn,N.stats.chunkCount+1,0,U?U.index:-1,!V);S.flush(O)},a._handleFragmentLoadProgress=function(b){},a._doFragLoad=function(b,S,N,U){var K=this;if(N===void 0&&(N=null),!this.levels)throw new Error("frag load aborted, missing levels");if(N=Math.max(b.start,N||0),this.config.lowLatencyMode&&S){var V=S.partList;if(V&&U){N>b.end&&S.fragmentHint&&(b=S.fragmentHint);var O=this.getNextPart(V,b,N);if(O>-1){var P=V[O];return this.log("Loading part sn: "+b.sn+" p: "+P.index+" cc: "+b.cc+" of playlist ["+S.startSN+"-"+S.endSN+"] parts [0-"+O+"-"+(V.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+b.level+", target: "+parseFloat(N.toFixed(3))),this.nextLoadPosition=P.start+P.duration,this.state=x.FRAG_LOADING,this.hls.trigger(I.Events.FRAG_LOADING,{frag:b,part:V[O],targetBufferTime:N}),this.doFragPartsLoad(b,V,O,U).catch(function($){return K.handleFragLoadError($)})}else if(!b.url||this.loadedEndOfParts(V,N))return Promise.resolve(null)}}return this.log("Loading fragment "+b.sn+" cc: "+b.cc+" "+(S?"of ["+S.startSN+"-"+S.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+b.level+", target: "+parseFloat(N.toFixed(3))),Object(Q.isFiniteNumber)(b.sn)&&!this.bitrateTest&&(this.nextLoadPosition=b.start+b.duration),this.state=x.FRAG_LOADING,this.hls.trigger(I.Events.FRAG_LOADING,{frag:b,targetBufferTime:N}),this.fragmentLoader.load(b,U).catch(function($){return K.handleFragLoadError($)})},a.doFragPartsLoad=function(b,S,N,U){var K=this;return new Promise(function(V,O){var P=[],$=function ee(oe){var fe=S[oe];K.fragmentLoader.loadPart(b,fe,U).then(function(Oe){P[fe.index]=Oe;var Ce=Oe.part;K.hls.trigger(I.Events.FRAG_LOADED,Oe);var Ae=S[oe+1];if(Ae&&Ae.fragment===b)ee(oe+1);else return V({frag:b,part:Ce,partsLoaded:P})}).catch(O)};$(N)})},a.handleFragLoadError=function(b){var S=b.data;return S&&S.details===R.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(S.frag,S.part):this.hls.trigger(I.Events.ERROR,S),null},a._handleTransmuxerFlush=function(b){var S=this.getCurrentContext(b);if(!S||this.state!==x.PARSING){this.fragCurrent||(this.state=x.IDLE);return}var N=S.frag,U=S.part,K=S.level,V=self.performance.now();N.stats.parsing.end=V,U&&(U.stats.parsing.end=V),this.updateLevelTiming(N,U,K,b.partial)},a.getCurrentContext=function(b){var S=this.levels,N=b.level,U=b.sn,K=b.part;if(!S||!S[N])return this.warn("Levels object was unset while buffering fragment "+U+" of level "+N+". The current chunk will not be buffered."),null;var V=S[N],O=K>-1?Object(w.getPartWith)(V,U,K):null,P=O?O.fragment:Object(w.getFragmentWithSN)(V,U,this.fragCurrent);return P?{frag:P,part:O,level:V}:null},a.bufferFragmentData=function(b,S,N,U){if(!b||this.state!==x.PARSING)return;var K=b.data1,V=b.data2,O=K;if(K&&V&&(O=Object(A.appendUint8Array)(K,V)),!O||!O.length)return;var P={type:b.type,frag:S,part:N,chunkMeta:U,parent:S.type,data:O};this.hls.trigger(I.Events.BUFFER_APPENDING,P),b.dropped&&b.independent&&!N&&this.flushBufferGap(S)},a.flushBufferGap=function(b){var S=this.media;if(!S)return;if(!G.BufferHelper.isBuffered(S,S.currentTime)){this.flushMainBuffer(0,b.start);return}var N=S.currentTime,U=G.BufferHelper.bufferInfo(S,N,0),K=b.duration,V=Math.min(this.config.maxFragLookUpTolerance*2,K*.25),O=Math.max(Math.min(b.start-V,U.end-V),N+V);b.start-O>V&&this.flushMainBuffer(O,b.start)},a.getFwdBufferInfo=function(b,S){var N=this.config,U=this.getLoadPosition();if(!Object(Q.isFiniteNumber)(U))return null;var K=G.BufferHelper.bufferInfo(b,U,N.maxBufferHole);if(K.len===0&&K.nextStart!==void 0){var V=this.fragmentTracker.getBufferedFrag(U,S);if(V&&K.nextStart<V.end)return G.BufferHelper.bufferInfo(b,U,Math.max(K.nextStart,N.maxBufferHole))}return K},a.getMaxBufferLength=function(b){var S=this.config,N;return b?N=Math.max(8*S.maxBufferSize/b,S.maxBufferLength):N=S.maxBufferLength,Math.min(N,S.maxMaxBufferLength)},a.reduceMaxBufferLength=function(b){var S=this.config,N=b||S.maxBufferLength;return S.maxMaxBufferLength>=N?(S.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+S.maxMaxBufferLength+"s"),!0):!1},a.getNextFragment=function(b,S){var N,U,K=S.fragments,V=K.length;if(!V)return null;var O=this.config,P=K[0].start,$;if(S.live){var ee=O.initialLiveManifestSize;if(V<ee)return this.warn("Not enough fragments to start playback (have: "+V+", need: "+ee+")"),null;!S.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&($=this.getInitialLiveFragment(S,K),this.startPosition=$?this.hls.liveSyncPosition||$.start:b)}else b<=P&&($=K[0]);if(!$){var oe=O.lowLatencyMode?S.partEnd:S.fragmentEnd;$=this.getFragmentAtPosition(b,oe,S)}return(N=$)!==null&&N!==void 0&&N.initSegment&&!((U=$)!==null&&U!==void 0&&U.initSegment.data)&&!this.bitrateTest&&($=$.initSegment),$},a.getNextPart=function(b,S,N){for(var U=-1,K=!1,V=!0,O=0,P=b.length;O<P;O++){var $=b[O];if(V=V&&!$.independent,U>-1&&N<$.start)break;var ee=$.loaded;!ee&&(K||$.independent||V)&&$.fragment===S&&(U=O),K=ee}return U},a.loadedEndOfParts=function(b,S){var N=b[b.length-1];return N&&S>N.start&&N.loaded},a.getInitialLiveFragment=function(b,S){var N=this.fragPrevious,U=null;if(N){if(b.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+N.programDateTime),U=Object(L.findFragmentByPDT)(S,N.endProgramDateTime,this.config.maxFragLookUpTolerance)),!U){var K=N.sn+1;if(K>=b.startSN&&K<=b.endSN){var V=S[K-b.startSN];N.cc===V.cc&&(U=V,this.log("Live playlist, switching playlist, load frag with next SN: "+U.sn))}U||(U=Object(L.findFragWithCC)(S,N.cc),U&&this.log("Live playlist, switching playlist, load frag with same CC: "+U.sn))}}else{var O=this.hls.liveSyncPosition;O!==null&&(U=this.getFragmentAtPosition(O,this.bitrateTest?b.fragmentEnd:b.edge,b))}return U},a.getFragmentAtPosition=function(b,S,N){var U=this.config,K=this.fragPrevious,V=N.fragments,O=N.endSN,P=N.fragmentHint,$=U.maxFragLookUpTolerance,ee=!!(U.lowLatencyMode&&N.partList&&P);ee&&P&&!this.bitrateTest&&(V=V.concat(P),O=P.sn);var oe;if(b<S){var fe=b>S-$?0:$;oe=Object(L.findFragmentByPTS)(K,V,b,fe)}else oe=V[V.length-1];if(oe){var Oe=oe.sn-N.startSN,Ce=K&&oe.level===K.level,Ae=V[Oe+1],Le=this.fragmentTracker.getState(oe);if(Le===_.FragmentState.BACKTRACKED){oe=null;for(var be=Oe;V[be]&&this.fragmentTracker.getState(V[be])===_.FragmentState.BACKTRACKED;)K?oe=V[be--]:oe=V[--be];oe||(oe=Ae)}else K&&oe.sn===K.sn&&!ee&&(Ce&&(oe.sn<O&&this.fragmentTracker.getState(Ae)!==_.FragmentState.OK?(this.log("SN "+oe.sn+" just loaded, load next one: "+Ae.sn),oe=Ae):oe=null))}return oe},a.synchronizeToLiveEdge=function(b){var S=this.config,N=this.media;if(!N)return;var U=this.hls.liveSyncPosition,K=N.currentTime,V=b.fragments[0].start,O=b.edge,P=K>=V-S.maxFragLookUpTolerance&&K<=O;if(U!==null&&N.duration>U&&(K<U||!P)){var $=S.liveMaxLatencyDuration!==void 0?S.liveMaxLatencyDuration:S.liveMaxLatencyDurationCount*b.targetduration;(!P&&N.readyState<4||K<O-$)&&(this.loadedmetadata||(this.nextLoadPosition=U),N.readyState&&(this.warn("Playback: "+K.toFixed(3)+" is located too far from the end of live sliding playlist: "+O+", reset currentTime to : "+U.toFixed(3)),N.currentTime=U))}},a.alignPlaylists=function(b,S){var N=this.levels,U=this.levelLastLoaded,K=this.fragPrevious,V=U!==null?N[U]:null,O=b.fragments.length;if(!O)return this.warn("No fragments in live playlist"),0;var P=b.fragments[0].start,$=!S,ee=b.alignedSliding&&Object(Q.isFiniteNumber)(P);if($||!ee&&!P){Object(M.alignStream)(K,V,b);var oe=b.fragments[0].start;return this.log("Live playlist sliding: "+oe.toFixed(2)+" start-sn: "+(S?S.startSN:"na")+"->"+b.startSN+" prev-sn: "+(K?K.sn:"na")+" fragments: "+O),oe}return P},a.waitForCdnTuneIn=function(b){var S=3;return b.live&&b.canBlockReload&&b.tuneInGoal>Math.max(b.partHoldBack,b.partTarget*S)},a.setStartPosition=function(b,S){var N=this.startPosition;if(N<S&&(N=-1),N===-1||this.lastCurrentTime===-1){var U=b.startTimeOffset;Object(Q.isFiniteNumber)(U)?(N=S+U,U<0&&(N+=b.totalduration),N=Math.min(Math.max(S,N),S+b.totalduration),this.log("Start time offset "+U+" found in playlist, adjust startPosition to "+N),this.startPosition=N):b.live?N=this.hls.liveSyncPosition||S:this.startPosition=N=0,this.lastCurrentTime=N}this.nextLoadPosition=N},a.getLoadPosition=function(){var b=this.media,S=0;return this.loadedmetadata&&b?S=b.currentTime:this.nextLoadPosition&&(S=this.nextLoadPosition),S},a.handleFragLoadAborted=function(b,S){this.transmuxer&&b.sn!=="initSegment"&&b.stats.aborted&&(this.warn("Fragment "+b.sn+(S?" part"+S.index:"")+" of level "+b.level+" was aborted"),this.resetFragmentLoading(b))},a.resetFragmentLoading=function(b){(!this.fragCurrent||!this.fragContextChanged(b))&&(this.state=x.IDLE)},a.onFragmentOrKeyLoadError=function(b,S){if(S.fatal)return;var N=S.frag;if(!N||N.type!==b)return;var U=this.fragCurrent;console.assert(U&&N.sn===U.sn&&N.level===U.level&&N.urlId===U.urlId,"Frag load error must match current frag to retry");var K=this.config;if(this.fragLoadError+1<=K.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(N.level))return;var V=Math.min(Math.pow(2,this.fragLoadError)*K.fragLoadingRetryDelay,K.fragLoadingMaxRetryTimeout);this.warn("Fragment "+N.sn+" of "+b+" "+N.level+" failed to load, retrying in "+V+"ms"),this.retryDate=self.performance.now()+V,this.fragLoadError++,this.state=x.FRAG_LOADING_WAITING_RETRY}else S.levelRetry?(b===l.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=x.IDLE):(j.logger.error(S.details+" reaches max retry, redispatch as fatal ..."),S.fatal=!0,this.hls.stopLoad(),this.state=x.ERROR)},a.afterBufferFlushed=function(b,S,N){if(!b)return;var U=G.BufferHelper.getBuffered(b);this.fragmentTracker.detectEvictedFragments(S,U,N),this.state===x.ENDED&&this.resetLoadingState()},a.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=x.IDLE},a.resetLiveStartWhenNotLoaded=function(b){if(!this.loadedmetadata){this.startFragRequested=!1;var S=this.levels?this.levels[b].details:null;if(S!=null&&S.live)return this.startPosition=-1,this.setStartPosition(S,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},a.updateLevelTiming=function(b,S,N,U){var K=this,V=N.details;console.assert(!!V,"level.details must be defined");var O=Object.keys(b.elementaryStreams).reduce(function(P,$){var ee=b.elementaryStreams[$];if(ee){var oe=ee.endPTS-ee.startPTS;if(oe<=0)return K.warn("Could not parse fragment "+b.sn+" "+$+" duration reliably ("+oe+") resetting transmuxer to fallback to playlist timing"),K.resetTransmuxer(),P||!1;var fe=U?0:Object(w.updateFragPTSDTS)(V,b,ee.startPTS,ee.endPTS,ee.startDTS,ee.endDTS);return K.hls.trigger(I.Events.LEVEL_PTS_UPDATED,{details:V,level:N,drift:fe,type:$,frag:b,start:ee.startPTS,end:ee.endPTS}),!0}return P},!1);O?(this.state=x.PARSED,this.hls.trigger(I.Events.FRAG_PARSED,{frag:b,part:S})):this.resetLoadingState()},a.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},T(h,[{key:"state",get:function(){return this._state},set:function(b){var S=this._state;S!==b&&(this._state=b,this.log(S+"->"+b))}}]),h}(B.default)},"./src/controller/buffer-controller.ts":function(he,J,D){"use strict";D.r(J),D.d(J,"default",function(){return L});var Q=D("./src/polyfills/number.ts"),B=D("./src/events.ts"),_=D("./src/utils/logger.ts"),G=D("./src/errors.ts"),j=D("./src/utils/buffer-helper.ts"),I=D("./src/utils/mediasource-helper.ts"),R=D("./src/loader/fragment.ts"),v=D("./src/controller/buffer-operation-queue.ts"),A=Object(I.getMediaSource)(),M=/([ha]vc.)(?:\.[^.,]+)+/,L=function(){function w(u){var o=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var l=o.hls,d=o.media,T=o.mediaSource;_.logger.log("[buffer-controller]: Media source opened"),d&&(o.updateMediaElementDuration(),l.trigger(B.Events.MEDIA_ATTACHED,{media:d})),T&&T.removeEventListener("sourceopen",o._onMediaSourceOpen),o.checkPendingTracks()},this._onMediaSourceClose=function(){_.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){_.logger.log("[buffer-controller]: Media source ended")},this.hls=u,this._initSourceBuffer(),this.registerListeners()}var y=w.prototype;return y.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},y.destroy=function(){this.unregisterListeners(),this.details=null},y.registerListeners=function(){var o=this.hls;o.on(B.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.on(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(B.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(B.Events.BUFFER_RESET,this.onBufferReset,this),o.on(B.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.on(B.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.on(B.Events.BUFFER_EOS,this.onBufferEos,this),o.on(B.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.on(B.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.on(B.Events.FRAG_PARSED,this.onFragParsed,this),o.on(B.Events.FRAG_CHANGED,this.onFragChanged,this)},y.unregisterListeners=function(){var o=this.hls;o.off(B.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.off(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(B.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(B.Events.BUFFER_RESET,this.onBufferReset,this),o.off(B.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.off(B.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.off(B.Events.BUFFER_EOS,this.onBufferEos,this),o.off(B.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.off(B.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.off(B.Events.FRAG_PARSED,this.onFragParsed,this),o.off(B.Events.FRAG_CHANGED,this.onFragChanged,this)},y._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new v.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},y.onManifestParsed=function(o,l){var d=2;(l.audio&&!l.video||!l.altAudio)&&(d=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=d,this.details=null,_.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},y.onMediaAttaching=function(o,l){var d=this.media=l.media;if(d&&A){var T=this.mediaSource=new A;T.addEventListener("sourceopen",this._onMediaSourceOpen),T.addEventListener("sourceended",this._onMediaSourceEnded),T.addEventListener("sourceclose",this._onMediaSourceClose),d.src=self.URL.createObjectURL(T),this._objectUrl=d.src}},y.onMediaDetaching=function(){var o=this.media,l=this.mediaSource,d=this._objectUrl;if(l){if(_.logger.log("[buffer-controller]: media source detaching"),l.readyState==="open")try{l.endOfStream()}catch(T){_.logger.warn("[buffer-controller]: onMediaDetaching: "+T.message+" while calling endOfStream")}this.onBufferReset(),l.removeEventListener("sourceopen",this._onMediaSourceOpen),l.removeEventListener("sourceended",this._onMediaSourceEnded),l.removeEventListener("sourceclose",this._onMediaSourceClose),o&&(d&&self.URL.revokeObjectURL(d),o.src===d?(o.removeAttribute("src"),o.load()):_.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(B.Events.MEDIA_DETACHED,void 0)},y.onBufferReset=function(){var o=this;this.getSourceBufferTypes().forEach(function(l){var d=o.sourceBuffer[l];try{d&&(o.removeBufferListeners(l),o.mediaSource&&o.mediaSource.removeSourceBuffer(d),o.sourceBuffer[l]=void 0)}catch(T){_.logger.warn("[buffer-controller]: Failed to reset the "+l+" buffer",T)}}),this._initSourceBuffer()},y.onBufferCodecs=function(o,l){var d=this,T=this.getSourceBufferTypes().length;if(Object.keys(l).forEach(function(c){if(T){var p=d.tracks[c];if(p&&typeof p.buffer.changeType=="function"){var k=l[c],x=k.codec,m=k.levelCodec,g=k.container,h=(p.levelCodec||p.codec).replace(M,"$1"),a=(m||x).replace(M,"$1");if(h!==a){var E=g+";codecs="+(m||x);d.appendChangeType(c,E)}}}else d.pendingTracks[c]=l[c]}),T)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},y.appendChangeType=function(o,l){var d=this,T=this.operationQueue,c={execute:function(){var k=d.sourceBuffer[o];k&&(_.logger.log("[buffer-controller]: changing "+o+" sourceBuffer type to "+l),k.changeType(l)),T.shiftAndExecuteNext(o)},onStart:function(){},onComplete:function(){},onError:function(k){_.logger.warn("[buffer-controller]: Failed to change "+o+" SourceBuffer type",k)}};T.append(c,o)},y.onBufferAppending=function(o,l){var d=this,T=this.hls,c=this.operationQueue,p=this.tracks,k=l.data,x=l.type,m=l.frag,g=l.part,h=l.chunkMeta,a=h.buffering[x],E=self.performance.now();a.start=E;var b=m.stats.buffering,S=g?g.stats.buffering:null;b.start===0&&(b.start=E),S&&S.start===0&&(S.start=E);var N=p.audio,U=x==="audio"&&h.id===1&&(N==null?void 0:N.container)==="audio/mpeg",K={execute:function(){if(a.executeStart=self.performance.now(),U){var O=d.sourceBuffer[x];if(O){var P=m.start-O.timestampOffset;Math.abs(P)>=.1&&(_.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+m.start+" (delta: "+P+") sn: "+m.sn+")"),O.timestampOffset=m.start)}}d.appendExecutor(k,x)},onStart:function(){},onComplete:function(){var O=self.performance.now();a.executeEnd=a.end=O,b.first===0&&(b.first=O),S&&S.first===0&&(S.first=O);var P=d.sourceBuffer,$={};for(var ee in P)$[ee]=j.BufferHelper.getBuffered(P[ee]);d.appendError=0,d.hls.trigger(B.Events.BUFFER_APPENDED,{type:x,frag:m,part:g,chunkMeta:h,parent:m.type,timeRanges:$})},onError:function(O){_.logger.error("[buffer-controller]: Error encountered while trying to append to the "+x+" SourceBuffer",O);var P={type:G.ErrorTypes.MEDIA_ERROR,parent:m.type,details:G.ErrorDetails.BUFFER_APPEND_ERROR,err:O,fatal:!1};O.code===DOMException.QUOTA_EXCEEDED_ERR?P.details=G.ErrorDetails.BUFFER_FULL_ERROR:(d.appendError++,P.details=G.ErrorDetails.BUFFER_APPEND_ERROR,d.appendError>T.config.appendErrorMaxRetry&&(_.logger.error("[buffer-controller]: Failed "+T.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),P.fatal=!0)),T.trigger(B.Events.ERROR,P)}};c.append(K,x)},y.onBufferFlushing=function(o,l){var d=this,T=this.operationQueue,c=function(k){return{execute:d.removeExecutor.bind(d,k,l.startOffset,l.endOffset),onStart:function(){},onComplete:function(){d.hls.trigger(B.Events.BUFFER_FLUSHED,{type:k})},onError:function(m){_.logger.warn("[buffer-controller]: Failed to remove from "+k+" SourceBuffer",m)}}};l.type?T.append(c(l.type),l.type):this.getSourceBufferTypes().forEach(function(p){T.append(c(p),p)})},y.onFragParsed=function(o,l){var d=this,T=l.frag,c=l.part,p=[],k=c?c.elementaryStreams:T.elementaryStreams;k[R.ElementaryStreamTypes.AUDIOVIDEO]?p.push("audiovideo"):(k[R.ElementaryStreamTypes.AUDIO]&&p.push("audio"),k[R.ElementaryStreamTypes.VIDEO]&&p.push("video"));var x=function(){var g=self.performance.now();T.stats.buffering.end=g,c&&(c.stats.buffering.end=g);var h=c?c.stats:T.stats;d.hls.trigger(B.Events.FRAG_BUFFERED,{frag:T,part:c,stats:h,id:T.type})};p.length===0&&_.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+T.type+" level: "+T.level+" sn: "+T.sn),this.blockBuffers(x,p)},y.onFragChanged=function(o,l){this.flushBackBuffer()},y.onBufferEos=function(o,l){var d=this,T=this.getSourceBufferTypes().reduce(function(c,p){var k=d.sourceBuffer[p];return(!l.type||l.type===p)&&(k&&!k.ended&&(k.ended=!0,_.logger.log("[buffer-controller]: "+p+" sourceBuffer now EOS"))),c&&!!(!k||k.ended)},!0);T&&this.blockBuffers(function(){var c=d.mediaSource;if(!c||c.readyState!=="open")return;c.endOfStream()})},y.onLevelUpdated=function(o,l){var d=l.details;if(!d.fragments.length)return;this.details=d,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},y.flushBackBuffer=function(){var o=this.hls,l=this.details,d=this.media,T=this.sourceBuffer;if(!d||l===null)return;var c=this.getSourceBufferTypes();if(!c.length)return;var p=l.live&&o.config.liveBackBufferLength!==null?o.config.liveBackBufferLength:o.config.backBufferLength;if(!Object(Q.isFiniteNumber)(p)||p<0)return;var k=d.currentTime,x=l.levelTargetDuration,m=Math.max(p,x),g=Math.floor(k/x)*x-m;c.forEach(function(h){var a=T[h];if(a){var E=j.BufferHelper.getBuffered(a);E.length>0&&g>E.start(0)&&(o.trigger(B.Events.BACK_BUFFER_REACHED,{bufferEnd:g}),l.live&&o.trigger(B.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:g}),o.trigger(B.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:g,type:h}))}})},y.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var o=this.details,l=this.hls,d=this.media,T=this.mediaSource,c=o.fragments[0].start+o.totalduration,p=d.duration,k=Object(Q.isFiniteNumber)(T.duration)?T.duration:0;o.live&&l.config.liveDurationInfinity?(_.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),T.duration=Infinity,this.updateSeekableRange(o)):(c>k&&c>p||!Object(Q.isFiniteNumber)(p))&&(_.logger.log("[buffer-controller]: Updating Media Source duration to "+c.toFixed(3)),T.duration=c)},y.updateSeekableRange=function(o){var l=this.mediaSource,d=o.fragments,T=d.length;if(T&&o.live&&l!==null&&l!==void 0&&l.setLiveSeekableRange){var c=Math.max(0,d[0].start),p=Math.max(c,c+o.totalduration);l.setLiveSeekableRange(c,p)}},y.checkPendingTracks=function(){var o=this.bufferCodecEventsExpected,l=this.operationQueue,d=this.pendingTracks,T=Object.keys(d).length;if(T&&!o||T===2){this.createSourceBuffers(d),this.pendingTracks={};var c=this.getSourceBufferTypes();if(c.length===0){this.hls.trigger(B.Events.ERROR,{type:G.ErrorTypes.MEDIA_ERROR,details:G.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}c.forEach(function(p){l.executeNext(p)})}},y.createSourceBuffers=function(o){var l=this.sourceBuffer,d=this.mediaSource;if(!d)throw Error("createSourceBuffers called when mediaSource was null");var T=0;for(var c in o)if(!l[c]){var p=o[c];if(!p)throw Error("source buffer exists for track "+c+", however track does not");var k=p.levelCodec||p.codec,x=p.container+";codecs="+k;_.logger.log("[buffer-controller]: creating sourceBuffer("+x+")");try{var m=l[c]=d.addSourceBuffer(x),g=c;this.addBufferListener(g,"updatestart",this._onSBUpdateStart),this.addBufferListener(g,"updateend",this._onSBUpdateEnd),this.addBufferListener(g,"error",this._onSBUpdateError),this.tracks[c]={buffer:m,codec:k,container:p.container,levelCodec:p.levelCodec,id:p.id},T++}catch(h){_.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+h.message),this.hls.trigger(B.Events.ERROR,{type:G.ErrorTypes.MEDIA_ERROR,details:G.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:h,mimeType:x})}}T&&this.hls.trigger(B.Events.BUFFER_CREATED,{tracks:this.tracks})},y._onSBUpdateStart=function(o){var l=this.operationQueue,d=l.current(o);d.onStart()},y._onSBUpdateEnd=function(o){var l=this.operationQueue,d=l.current(o);d.onComplete(),l.shiftAndExecuteNext(o)},y._onSBUpdateError=function(o,l){_.logger.error("[buffer-controller]: "+o+" SourceBuffer error",l),this.hls.trigger(B.Events.ERROR,{type:G.ErrorTypes.MEDIA_ERROR,details:G.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var d=this.operationQueue.current(o);d&&d.onError(l)},y.removeExecutor=function(o,l,d){var T=this.media,c=this.mediaSource,p=this.operationQueue,k=this.sourceBuffer,x=k[o];if(!T||!c||!x){_.logger.warn("[buffer-controller]: Attempting to remove from the "+o+" SourceBuffer, but it does not exist"),p.shiftAndExecuteNext(o);return}var m=Object(Q.isFiniteNumber)(T.duration)?T.duration:Infinity,g=Object(Q.isFiniteNumber)(c.duration)?c.duration:Infinity,h=Math.max(0,l),a=Math.min(d,m,g);a>h?(_.logger.log("[buffer-controller]: Removing ["+h+","+a+"] from the "+o+" SourceBuffer"),console.assert(!x.updating,o+" sourceBuffer must not be updating"),x.remove(h,a)):p.shiftAndExecuteNext(o)},y.appendExecutor=function(o,l){var d=this.operationQueue,T=this.sourceBuffer,c=T[l];if(!c){_.logger.warn("[buffer-controller]: Attempting to append to the "+l+" SourceBuffer, but it does not exist"),d.shiftAndExecuteNext(l);return}c.ended=!1,console.assert(!c.updating,l+" sourceBuffer must not be updating"),c.appendBuffer(o)},y.blockBuffers=function(o,l){var d=this;if(l===void 0&&(l=this.getSourceBufferTypes()),!l.length){_.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(o);return}var T=this.operationQueue,c=l.map(function(p){return T.appendBlocker(p)});Promise.all(c).then(function(){o(),l.forEach(function(p){var k=d.sourceBuffer[p];(!k||!k.updating)&&T.shiftAndExecuteNext(p)})})},y.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},y.addBufferListener=function(o,l,d){var T=this.sourceBuffer[o];if(!T)return;var c=d.bind(this,o);this.listeners[o].push({event:l,listener:c}),T.addEventListener(l,c)},y.removeBufferListeners=function(o){var l=this.sourceBuffer[o];if(!l)return;this.listeners[o].forEach(function(d){l.removeEventListener(d.event,d.listener)})},w}()},"./src/controller/buffer-operation-queue.ts":function(he,J,D){"use strict";D.r(J),D.d(J,"default",function(){return B});var Q=D("./src/utils/logger.ts"),B=function(){function _(j){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=j}var G=_.prototype;return G.append=function(I,R){var v=this.queues[R];v.push(I),v.length===1&&this.buffers[R]&&this.executeNext(R)},G.insertAbort=function(I,R){var v=this.queues[R];v.unshift(I),this.executeNext(R)},G.appendBlocker=function(I){var R,v=new Promise(function(M){R=M}),A={execute:R,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(A,I),v},G.executeNext=function(I){var R=this.buffers,v=this.queues,A=R[I],M=v[I];if(M.length){var L=M[0];try{L.execute()}catch(w){Q.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),L.onError(w),(!A||!A.updating)&&(M.shift(),this.executeNext(I))}}},G.shiftAndExecuteNext=function(I){this.queues[I].shift(),this.executeNext(I)},G.current=function(I){return this.queues[I][0]},_}()},"./src/controller/cap-level-controller.ts":function(he,J,D){"use strict";D.r(J);var Q=D("./src/events.ts");function B(j,I){for(var R=0;R<I.length;R++){var v=I[R];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(j,v.key,v)}}function _(j,I,R){return I&&B(j.prototype,I),R&&B(j,R),j}var G=function(){function j(R){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=R,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var I=j.prototype;return I.setStreamController=function(v){this.streamController=v},I.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},I.registerListeners=function(){var v=this.hls;v.on(Q.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),v.on(Q.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),v.on(Q.Events.MANIFEST_PARSED,this.onManifestParsed,this),v.on(Q.Events.BUFFER_CODECS,this.onBufferCodecs,this),v.on(Q.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},I.unregisterListener=function(){var v=this.hls;v.off(Q.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),v.off(Q.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),v.off(Q.Events.MANIFEST_PARSED,this.onManifestParsed,this),v.off(Q.Events.BUFFER_CODECS,this.onBufferCodecs,this),v.off(Q.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},I.onFpsDropLevelCapping=function(v,A){j.isLevelAllowed(A.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(A.droppedLevel)},I.onMediaAttaching=function(v,A){this.media=A.media instanceof HTMLVideoElement?A.media:null},I.onManifestParsed=function(v,A){var M=this.hls;this.restrictedLevels=[],this.firstLevel=A.firstLevel,M.config.capLevelToPlayerSize&&A.video&&this.startCapping()},I.onBufferCodecs=function(v,A){var M=this.hls;M.config.capLevelToPlayerSize&&A.video&&this.startCapping()},I.onMediaDetaching=function(){this.stopCapping()},I.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var v=this.hls.levels;if(v.length){var A=this.hls;A.autoLevelCapping=this.getMaxLevel(v.length-1),A.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=A.autoLevelCapping}}},I.getMaxLevel=function(v){var A=this,M=this.hls.levels;if(!M.length)return-1;var L=M.filter(function(w,y){return j.isLevelAllowed(y,A.restrictedLevels)&&y<=v});return this.clientRect=null,j.getMaxLevelByMediaSize(L,this.mediaWidth,this.mediaHeight)},I.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()},I.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},I.getDimensions=function(){if(this.clientRect)return this.clientRect;var v=this.media,A={width:0,height:0};if(v){var M=v.getBoundingClientRect();A.width=M.width,A.height=M.height,!A.width&&!A.height&&(A.width=M.right-M.left||v.width||0,A.height=M.bottom-M.top||v.height||0)}return this.clientRect=A,A},j.isLevelAllowed=function(v,A){return A===void 0&&(A=[]),A.indexOf(v)===-1},j.getMaxLevelByMediaSize=function(v,A,M){if(!v||!v.length)return-1;for(var L=function(l,d){return d?l.width!==d.width||l.height!==d.height:!0},w=v.length-1,y=0;y<v.length;y+=1){var u=v[y];if((u.width>=A||u.height>=M)&&L(u,v[y+1])){w=y;break}}return w},_(j,[{key:"mediaWidth",get:function(){return this.getDimensions().width*j.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*j.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var v=1;try{v=self.devicePixelRatio}catch(A){}return v}}]),j}();J.default=G},"./src/controller/cmcd-controller.ts":function(he,J,D){"use strict";D.r(J),D.d(J,"default",function(){return L});var Q=D("./src/events.ts"),B=D("./src/types/cmcd.ts"),_=D("./src/utils/buffer-helper.ts"),G=D("./src/utils/logger.ts");function j(w,y){for(var u=0;u<y.length;u++){var o=y[u];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(w,o.key,o)}}function I(w,y,u){return y&&j(w.prototype,y),u&&j(w,u),w}function R(w,y){var u=typeof Symbol!="undefined"&&w[Symbol.iterator]||w["@@iterator"];if(u)return(u=u.call(w)).next.bind(u);if(Array.isArray(w)||(u=v(w))||y&&w&&typeof w.length=="number"){u&&(w=u);var o=0;return function(){return o>=w.length?{done:!0}:{done:!1,value:w[o++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function v(w,y){if(!w)return;if(typeof w=="string")return A(w,y);var u=Object.prototype.toString.call(w).slice(8,-1);if(u==="Object"&&w.constructor&&(u=w.constructor.name),u==="Map"||u==="Set")return Array.from(w);if(u==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(u))return A(w,y)}function A(w,y){(y==null||y>w.length)&&(y=w.length);for(var u=0,o=new Array(y);u<y;u++)o[u]=w[u];return o}function M(){return M=Object.assign||function(w){for(var y=1;y<arguments.length;y++){var u=arguments[y];for(var o in u)Object.prototype.hasOwnProperty.call(u,o)&&(w[o]=u[o])}return w},M.apply(this,arguments)}var L=function(){function w(u){var o=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){o.initialized&&(o.starved=!0),o.buffering=!0},this.onPlaying=function(){o.initialized||(o.initialized=!0),o.buffering=!1},this.applyPlaylistData=function(T){try{o.apply(T,{ot:B.CMCDObjectType.MANIFEST,su:!o.initialized})}catch(c){G.logger.warn("Could not generate manifest CMCD data.",c)}},this.applyFragmentData=function(T){try{var c=T.frag,p=o.hls.levels[c.level],k=o.getObjectType(c),x={d:c.duration*1e3,ot:k};(k===B.CMCDObjectType.VIDEO||k===B.CMCDObjectType.AUDIO||k==B.CMCDObjectType.MUXED)&&(x.br=p.bitrate/1e3,x.tb=o.getTopBandwidth(k),x.bl=o.getBufferLength(k)),o.apply(T,x)}catch(m){G.logger.warn("Could not generate segment CMCD data.",m)}},this.hls=u;var l=this.config=u.config,d=l.cmcd;d!=null&&(l.pLoader=this.createPlaylistLoader(),l.fLoader=this.createFragmentLoader(),this.sid=d.sessionId||w.uuid(),this.cid=d.contentId,this.useHeaders=d.useHeaders===!0,this.registerListeners())}var y=w.prototype;return y.registerListeners=function(){var o=this.hls;o.on(Q.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(Q.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.on(Q.Events.BUFFER_CREATED,this.onBufferCreated,this)},y.unregisterListeners=function(){var o=this.hls;o.off(Q.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(Q.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.off(Q.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},y.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},y.onMediaAttached=function(o,l){this.media=l.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},y.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},y.onBufferCreated=function(o,l){var d,T;this.audioBuffer=(d=l.tracks.audio)===null||d===void 0?void 0:d.buffer,this.videoBuffer=(T=l.tracks.video)===null||T===void 0?void 0:T.buffer},y.createData=function(){var o;return{v:B.CMCDVersion,sf:B.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(o=this.media)===null||o===void 0?void 0:o.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},y.apply=function(o,l){l===void 0&&(l={}),M(l,this.createData());var d=l.ot===B.CMCDObjectType.INIT||l.ot===B.CMCDObjectType.VIDEO||l.ot===B.CMCDObjectType.MUXED;if(this.starved&&d&&(l.bs=!0,l.su=!0,this.starved=!1),l.su==null&&(l.su=this.buffering),this.useHeaders){var T=w.toHeaders(l);if(!Object.keys(T).length)return;o.headers||(o.headers={}),M(o.headers,T)}else{var c=w.toQuery(l);if(!c)return;o.url=w.appendQueryToUri(o.url,c)}},y.getObjectType=function(o){var l=o.type;return l==="subtitle"?B.CMCDObjectType.TIMED_TEXT:o.sn==="initSegment"?B.CMCDObjectType.INIT:l==="audio"?B.CMCDObjectType.AUDIO:l==="main"?this.hls.audioTracks.length?B.CMCDObjectType.VIDEO:B.CMCDObjectType.MUXED:void 0},y.getTopBandwidth=function(o){for(var l=0,d=o===B.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,T=R(d),c;!(c=T()).done;){var p=c.value;p.bitrate>l&&(l=p.bitrate)}return l>0?l:NaN},y.getBufferLength=function(o){var l=this.hls.media,d=o===B.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!d||!l)return NaN;var T=_.BufferHelper.bufferInfo(d,l.currentTime,this.config.maxBufferHole);return T.len*1e3},y.createPlaylistLoader=function(){var o=this.config.pLoader,l=this.applyPlaylistData,d=o||this.config.loader;return function(){function T(p){this.loader=void 0,this.loader=new d(p)}var c=T.prototype;return c.destroy=function(){this.loader.destroy()},c.abort=function(){this.loader.abort()},c.load=function(k,x,m){l(k),this.loader.load(k,x,m)},I(T,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),T}()},y.createFragmentLoader=function(){var o=this.config.fLoader,l=this.applyFragmentData,d=o||this.config.loader;return function(){function T(p){this.loader=void 0,this.loader=new d(p)}var c=T.prototype;return c.destroy=function(){this.loader.destroy()},c.abort=function(){this.loader.abort()},c.load=function(k,x,m){l(k),this.loader.load(k,x,m)},I(T,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),T}()},w.uuid=function(){var o=URL.createObjectURL(new Blob),l=o.toString();return URL.revokeObjectURL(o),l.substr(l.lastIndexOf("/")+1)},w.serialize=function(o){for(var l=[],d=function(U){return!Number.isNaN(U)&&U!=null&&U!==""&&U!==!1},T=function(U){return Math.round(U)},c=function(U){return T(U/100)*100},p=function(U){return encodeURIComponent(U)},k={br:T,d:T,bl:c,dl:c,mtp:c,nor:p,rtp:c,tb:T},x=Object.keys(o||{}).sort(),m=R(x),g;!(g=m()).done;){var h=g.value,a=o[h];if(!d(a))continue;if(h==="v"&&a===1)continue;if(h=="pr"&&a===1)continue;var E=k[h];E&&(a=E(a));var b=typeof a,S=void 0;h==="ot"||h==="sf"||h==="st"?S=h+"="+a:b==="boolean"?S=h:b==="number"?S=h+"="+a:S=h+"="+JSON.stringify(a),l.push(S)}return l.join(",")},w.toHeaders=function(o){for(var l=Object.keys(o),d={},T=["Object","Request","Session","Status"],c=[{},{},{},{}],p={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},k=0,x=l;k<x.length;k++){var m=x[k],g=p[m]!=null?p[m]:1;c[g][m]=o[m]}for(var h=0;h<c.length;h++){var a=w.serialize(c[h]);a&&(d["CMCD-"+T[h]]=a)}return d},w.toQuery=function(o){return"CMCD="+encodeURIComponent(w.serialize(o))},w.appendQueryToUri=function(o,l){if(!l)return o;var d=o.includes("?")?"&":"?";return""+o+d+l},w}()},"./src/controller/eme-controller.ts":function(he,J,D){"use strict";D.r(J);var Q=D("./src/events.ts"),B=D("./src/errors.ts"),_=D("./src/utils/logger.ts"),G=D("./src/utils/mediakeys-helper.ts");function j(L,w){for(var y=0;y<w.length;y++){var u=w[y];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(L,u.key,u)}}function I(L,w,y){return w&&j(L.prototype,w),y&&j(L,y),L}var R=3,v=function(w,y,u){var o={audioCapabilities:[],videoCapabilities:[]};return w.forEach(function(l){o.audioCapabilities.push({contentType:'audio/mp4; codecs="'+l+'"',robustness:u.audioRobustness||""})}),y.forEach(function(l){o.videoCapabilities.push({contentType:'video/mp4; codecs="'+l+'"',robustness:u.videoRobustness||""})}),[o]},A=function(w,y,u,o){switch(w){case G.KeySystems.WIDEVINE:return v(y,u,o);default:throw new Error("Unknown key-system: "+w)}},M=function(){function L(y){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=y,this._config=y.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 w=L.prototype;return w.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},w._registerListeners=function(){this.hls.on(Q.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(Q.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(Q.Events.MANIFEST_PARSED,this.onManifestParsed,this)},w._unregisterListeners=function(){this.hls.off(Q.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(Q.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(Q.Events.MANIFEST_PARSED,this.onManifestParsed,this)},w.getLicenseServerUrl=function(u){switch(u){case G.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+u+'"')},w._attemptKeySystemAccess=function(u,o,l){var d=this,T=A(u,o,l,this._drmSystemOptions);_.logger.log("Requesting encrypted media key-system access");var c=this.requestMediaKeySystemAccess(u,T);this.mediaKeysPromise=c.then(function(p){return d._onMediaKeySystemAccessObtained(u,p)}),c.catch(function(p){_.logger.error('Failed to obtain key-system "'+u+'" access:',p)})},w._onMediaKeySystemAccessObtained=function(u,o){var l=this;_.logger.log('Access for key-system "'+u+'" obtained');var d={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:o,mediaKeySystemDomain:u};this._mediaKeysList.push(d);var T=Promise.resolve().then(function(){return o.createMediaKeys()}).then(function(c){return d.mediaKeys=c,_.logger.log('Media-keys created for key-system "'+u+'"'),l._onMediaKeysCreated(),c});return T.catch(function(c){_.logger.error("Failed to create media-keys:",c)}),T},w._onMediaKeysCreated=function(){var u=this;this._mediaKeysList.forEach(function(o){o.mediaKeysSession||(o.mediaKeysSession=o.mediaKeys.createSession(),u._onNewMediaKeySession(o.mediaKeysSession))})},w._onNewMediaKeySession=function(u){var o=this;_.logger.log("New key-system session "+u.sessionId),u.addEventListener("message",function(l){o._onKeySessionMessage(u,l.message)},!1)},w._onKeySessionMessage=function(u,o){_.logger.log("Got EME message event, creating license request"),this._requestLicense(o,function(l){_.logger.log("Received license data (length: "+(l&&l.byteLength)+"), updating key-session"),u.update(l)})},w.onMediaEncrypted=function(u){var o=this;if(_.logger.log('Media is encrypted using "'+u.initDataType+'" init data type'),!this.mediaKeysPromise){_.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(Q.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var l=function(T){if(!o._media)return;o._attemptSetMediaKeys(T),o._generateRequestWithPreferredKeySession(u.initDataType,u.initData)};this.mediaKeysPromise.then(l).catch(l)},w._attemptSetMediaKeys=function(u){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var o=this._mediaKeysList[0];if(!o||!o.mediaKeys){_.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(Q.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}_.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(o.mediaKeys),this._hasSetMediaKeys=!0}},w._generateRequestWithPreferredKeySession=function(u,o){var l=this,d=this._mediaKeysList[0];if(!d){_.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(Q.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(d.mediaKeysSessionInitialized){_.logger.warn("Key-Session already initialized but requested again");return}var T=d.mediaKeysSession;if(!T){_.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(Q.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!o){_.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(Q.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}_.logger.log('Generating key-session request for "'+u+'" init data type'),d.mediaKeysSessionInitialized=!0,T.generateRequest(u,o).then(function(){_.logger.debug("Key-session generation succeeded")}).catch(function(c){_.logger.error("Error generating key-session request:",c),l.hls.trigger(Q.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},w._createLicenseXhr=function(u,o,l){var d=new XMLHttpRequest;d.responseType="arraybuffer",d.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,d,u,o,l);var T=this._licenseXhrSetup;if(T)try{T.call(this.hls,d,u),T=void 0}catch(c){_.logger.error(c)}try{d.readyState||d.open("POST",u,!0),T&&T.call(this.hls,d,u)}catch(c){throw new Error("issue setting up KeySystem license XHR "+c)}return d},w._onLicenseRequestReadyStageChange=function(u,o,l,d){switch(u.readyState){case 4:if(u.status===200){this._requestLicenseFailureCount=0,_.logger.log("License request succeeded");var T=u.response,c=this._licenseResponseCallback;if(c)try{T=c.call(this.hls,u,o)}catch(k){_.logger.error(k)}d(T)}else{if(_.logger.error("License Request XHR failed ("+o+"). Status: "+u.status+" ("+u.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>R){this.hls.trigger(Q.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var p=R-this._requestLicenseFailureCount+1;_.logger.warn("Retrying license request, "+p+" attempts left"),this._requestLicense(l,d)}break}},w._generateLicenseRequestChallenge=function(u,o){switch(u.mediaKeySystemDomain){case G.KeySystems.WIDEVINE:return o}throw new Error("unsupported key-system: "+u.mediaKeySystemDomain)},w._requestLicense=function(u,o){_.logger.log("Requesting content license for key-system");var l=this._mediaKeysList[0];if(!l){_.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(Q.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var d=this.getLicenseServerUrl(l.mediaKeySystemDomain),T=this._createLicenseXhr(d,u,o);_.logger.log("Sending license request to URL: "+d);var c=this._generateLicenseRequestChallenge(l,u);T.send(c)}catch(p){_.logger.error("Failure requesting DRM license: "+p),this.hls.trigger(Q.Events.ERROR,{type:B.ErrorTypes.KEY_SYSTEM_ERROR,details:B.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},w.onMediaAttached=function(u,o){if(!this._emeEnabled)return;var l=o.media;this._media=l,l.addEventListener("encrypted",this._onMediaEncrypted)},w.onMediaDetached=function(){var u=this._media,o=this._mediaKeysList;if(!u)return;u.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(o.map(function(l){if(l.mediaKeysSession)return l.mediaKeysSession.close().catch(function(){})})).then(function(){return u.setMediaKeys(null)}).catch(function(){})},w.onManifestParsed=function(u,o){if(!this._emeEnabled)return;var l=o.levels.map(function(T){return T.audioCodec}).filter(function(T){return!!T}),d=o.levels.map(function(T){return T.videoCodec}).filter(function(T){return!!T});this._attemptKeySystemAccess(G.KeySystems.WIDEVINE,l,d)},I(L,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),L}();J.default=M},"./src/controller/fps-controller.ts":function(he,J,D){"use strict";D.r(J);var Q=D("./src/events.ts"),B=D("./src/utils/logger.ts"),_=function(){function G(I){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=I,this.registerListeners()}var j=G.prototype;return j.setStreamController=function(R){this.streamController=R},j.registerListeners=function(){this.hls.on(Q.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},j.unregisterListeners=function(){this.hls.off(Q.Events.MEDIA_ATTACHING,this.onMediaAttaching)},j.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},j.onMediaAttaching=function(R,v){var A=this.hls.config;if(A.capLevelOnFPSDrop){var M=v.media instanceof self.HTMLVideoElement?v.media:null;this.media=M,M&&typeof M.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),A.fpsDroppedMonitoringPeriod)}},j.checkFPS=function(R,v,A){var M=performance.now();if(v){if(this.lastTime){var L=M-this.lastTime,w=A-this.lastDroppedFrames,y=v-this.lastDecodedFrames,u=1e3*w/L,o=this.hls;if(o.trigger(Q.Events.FPS_DROP,{currentDropped:w,currentDecoded:y,totalDroppedFrames:A}),u>0&&w>o.config.fpsDroppedMonitoringThreshold*y){var l=o.currentLevel;B.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+l),l>0&&(o.autoLevelCapping===-1||o.autoLevelCapping>=l)&&(l=l-1,o.trigger(Q.Events.FPS_DROP_LEVEL_CAPPING,{level:l,droppedLevel:o.currentLevel}),o.autoLevelCapping=l,this.streamController.nextLevelSwitch())}}this.lastTime=M,this.lastDroppedFrames=A,this.lastDecodedFrames=v}},j.checkFPSInterval=function(){var R=this.media;if(R)if(this.isVideoPlaybackQualityAvailable){var v=R.getVideoPlaybackQuality();this.checkFPS(R,v.totalVideoFrames,v.droppedVideoFrames)}else this.checkFPS(R,R.webkitDecodedFrameCount,R.webkitDroppedFrameCount)},G}();J.default=_},"./src/controller/fragment-finders.ts":function(he,J,D){"use strict";D.r(J),D.d(J,"findFragmentByPDT",function(){return _}),D.d(J,"findFragmentByPTS",function(){return G}),D.d(J,"fragmentWithinToleranceTest",function(){return j}),D.d(J,"pdtWithinToleranceTest",function(){return I}),D.d(J,"findFragWithCC",function(){return R});var Q=D("./src/polyfills/number.ts"),B=D("./src/utils/binary-search.ts");function _(v,A,M){if(A===null||!Array.isArray(v)||!v.length||!Object(Q.isFiniteNumber)(A))return null;var L=v[0].programDateTime;if(A<(L||0))return null;var w=v[v.length-1].endProgramDateTime;if(A>=(w||0))return null;M=M||0;for(var y=0;y<v.length;++y){var u=v[y];if(I(A,M,u))return u}return null}function G(v,A,M,L){M===void 0&&(M=0),L===void 0&&(L=0);var w=null;if(v?w=A[v.sn-A[0].sn+1]||null:M===0&&A[0].start===0&&(w=A[0]),w&&j(M,L,w)===0)return w;var y=B.default.search(A,j.bind(null,M,L));return y||w}function j(v,A,M){v===void 0&&(v=0),A===void 0&&(A=0);var L=Math.min(A,M.duration+(M.deltaPTS?M.deltaPTS:0));return M.start+M.duration-L<=v?1:M.start-L>v&&M.start?-1:0}function I(v,A,M){var L=Math.min(A,M.duration+(M.deltaPTS?M.deltaPTS:0))*1e3,w=M.endProgramDateTime||0;return w-L>v}function R(v,A){return B.default.search(v,function(M){return M.cc<A?1:M.cc>A?-1:0})}},"./src/controller/fragment-tracker.ts":function(he,J,D){"use strict";D.r(J),D.d(J,"FragmentState",function(){return _}),D.d(J,"FragmentTracker",function(){return G});var Q=D("./src/events.ts"),B=D("./src/types/loader.ts"),_;(function(R){R.NOT_LOADED="NOT_LOADED",R.BACKTRACKED="BACKTRACKED",R.APPENDING="APPENDING",R.PARTIAL="PARTIAL",R.OK="OK"})(_||(_={}));var G=function(){function R(A){this.activeFragment=null,this.activeParts=null,this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hls=A,this._registerListeners()}var v=R.prototype;return v._registerListeners=function(){var M=this.hls;M.on(Q.Events.BUFFER_APPENDED,this.onBufferAppended,this),M.on(Q.Events.FRAG_BUFFERED,this.onFragBuffered,this),M.on(Q.Events.FRAG_LOADED,this.onFragLoaded,this)},v._unregisterListeners=function(){var M=this.hls;M.off(Q.Events.BUFFER_APPENDED,this.onBufferAppended,this),M.off(Q.Events.FRAG_BUFFERED,this.onFragBuffered,this),M.off(Q.Events.FRAG_LOADED,this.onFragLoaded,this)},v.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},v.getAppendedFrag=function(M,L){if(L===B.PlaylistLevelType.MAIN){var w=this.activeFragment,y=this.activeParts;if(!w)return null;if(y)for(var u=y.length;u--;){var o=y[u],l=o?o.end:w.appendedPTS;if(o.start<=M&&l!==void 0&&M<=l)return u>9&&(this.activeParts=y.slice(u-9)),o}else if(w.start<=M&&w.appendedPTS!==void 0&&M<=w.appendedPTS)return w}return this.getBufferedFrag(M,L)},v.getBufferedFrag=function(M,L){for(var w=this.fragments,y=Object.keys(w),u=y.length;u--;){var o=w[y[u]];if((o==null?void 0:o.body.type)===L&&o.buffered){var l=o.body;if(l.start<=M&&M<=l.end)return l}}return null},v.detectEvictedFragments=function(M,L,w){var y=this;Object.keys(this.fragments).forEach(function(u){var o=y.fragments[u];if(!o)return;if(!o.buffered){o.body.type===w&&y.removeFragment(o.body);return}var l=o.range[M];if(!l)return;l.time.some(function(d){var T=!y.isTimeBuffered(d.startPTS,d.endPTS,L);return T&&y.removeFragment(o.body),T})})},v.detectPartialFragments=function(M){var L=this,w=this.timeRanges,y=M.frag,u=M.part;if(!w||y.sn==="initSegment")return;var o=I(y),l=this.fragments[o];if(!l)return;Object.keys(w).forEach(function(d){var T=y.elementaryStreams[d];if(!T)return;var c=w[d],p=u!==null||T.partial===!0;l.range[d]=L.getBufferedTimes(y,u,p,c)}),l.backtrack=l.loaded=null,Object.keys(l.range).length?l.buffered=!0:this.removeFragment(l.body)},v.fragBuffered=function(M){var L=I(M),w=this.fragments[L];w&&(w.backtrack=w.loaded=null,w.buffered=!0)},v.getBufferedTimes=function(M,L,w,y){for(var u={time:[],partial:w},o=L?L.start:M.start,l=L?L.end:M.end,d=M.minEndPTS||l,T=M.maxStartPTS||o,c=0;c<y.length;c++){var p=y.start(c)-this.bufferPadding,k=y.end(c)+this.bufferPadding;if(T>=p&&d<=k){u.time.push({startPTS:Math.max(o,y.start(c)),endPTS:Math.min(l,y.end(c))});break}else if(o<k&&l>p)u.partial=!0,u.time.push({startPTS:Math.max(o,y.start(c)),endPTS:Math.min(l,y.end(c))});else if(l<=p)break}return u},v.getPartialFragment=function(M){var L=null,w,y,u,o=0,l=this.bufferPadding,d=this.fragments;return Object.keys(d).forEach(function(T){var c=d[T];if(!c)return;j(c)&&(y=c.body.start-l,u=c.body.end+l,M>=y&&M<=u&&(w=Math.min(M-y,u-M),o<=w&&(L=c.body,o=w)))}),L},v.getState=function(M){var L=I(M),w=this.fragments[L];return w?w.buffered?j(w)?_.PARTIAL:_.OK:w.backtrack?_.BACKTRACKED:_.APPENDING:_.NOT_LOADED},v.backtrack=function(M,L){var w=I(M),y=this.fragments[w];if(!y||y.backtrack)return null;var u=y.backtrack=L||y.loaded;return y.loaded=null,u},v.getBacktrackData=function(M){var L=I(M),w=this.fragments[L];if(w){var y,u=w.backtrack;if(u!=null&&(y=u.payload)!==null&&y!==void 0&&y.byteLength)return u;this.removeFragment(M)}return null},v.isTimeBuffered=function(M,L,w){for(var y,u,o=0;o<w.length;o++){if(y=w.start(o)-this.bufferPadding,u=w.end(o)+this.bufferPadding,M>=y&&L<=u)return!0;if(L<=y)return!1}return!1},v.onFragLoaded=function(M,L){var w=L.frag,y=L.part;if(w.sn==="initSegment"||w.bitrateTest||y)return;var u=I(w);this.fragments[u]={body:w,loaded:L,backtrack:null,buffered:!1,range:Object.create(null)}},v.onBufferAppended=function(M,L){var w=this,y=L.frag,u=L.part,o=L.timeRanges;if(y.type===B.PlaylistLevelType.MAIN)if(this.activeFragment=y,u){var l=this.activeParts;l||(this.activeParts=l=[]),l.push(u)}else this.activeParts=null;this.timeRanges=o,Object.keys(o).forEach(function(d){var T=o[d];if(w.detectEvictedFragments(d,T),!u)for(var c=0;c<T.length;c++)y.appendedPTS=Math.max(T.end(c),y.appendedPTS||0)})},v.onFragBuffered=function(M,L){this.detectPartialFragments(L)},v.hasFragment=function(M){var L=I(M);return!!this.fragments[L]},v.removeFragmentsInRange=function(M,L,w){var y=this;Object.keys(this.fragments).forEach(function(u){var o=y.fragments[u];if(!o)return;if(o.buffered){var l=o.body;l.type===w&&l.start<L&&l.end>M&&y.removeFragment(l)}})},v.removeFragment=function(M){var L=I(M);M.stats.loaded=0,M.clearElementaryStreamInfo(),delete this.fragments[L]},v.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},R}();function j(R){var v,A;return R.buffered&&(((v=R.range.video)===null||v===void 0?void 0:v.partial)||((A=R.range.audio)===null||A===void 0?void 0:A.partial))}function I(R){return R.type+"_"+R.level+"_"+R.urlId+"_"+R.sn}},"./src/controller/gap-controller.ts":function(he,J,D){"use strict";D.r(J),D.d(J,"STALL_MINIMUM_DURATION_MS",function(){return j}),D.d(J,"MAX_START_GAP_JUMP",function(){return I}),D.d(J,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return R}),D.d(J,"SKIP_BUFFER_RANGE_START",function(){return v}),D.d(J,"default",function(){return A});var Q=D("./src/utils/buffer-helper.ts"),B=D("./src/errors.ts"),_=D("./src/events.ts"),G=D("./src/utils/logger.ts"),j=250,I=2,R=.1,v=.05,A=function(){function M(w,y,u,o){this.config=void 0,this.media=void 0,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=w,this.media=y,this.fragmentTracker=u,this.hls=o}var L=M.prototype;return L.destroy=function(){this.hls=this.fragmentTracker=this.media=null},L.poll=function(y){var u=this.config,o=this.media,l=this.stalled,d=o.currentTime,T=o.seeking,c=this.seeking&&!T,p=!this.seeking&&T;if(this.seeking=T,d!==y){if(this.moved=!0,l!==null){if(this.stallReported){var k=self.performance.now()-l;G.logger.warn("playback not stuck anymore @"+d+", after "+Math.round(k)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((p||c)&&(this.stalled=null),o.paused||o.ended||o.playbackRate===0||!Q.BufferHelper.getBuffered(o).length)return;var x=Q.BufferHelper.bufferInfo(o,d,0),m=x.len>0,g=x.nextStart||0;if(!m&&!g)return;if(T){var h=x.len>I,a=!g||g-d>I&&!this.fragmentTracker.getPartialFragment(d);if(h||a)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var E,b=Math.max(g,x.start||0)-d,S=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,N=S==null||((E=S.details)===null||E===void 0)?void 0:E.live,U=N?S.details.targetduration*2:I;if(b>0&&b<=U){this._trySkipBufferHole(null);return}}var K=self.performance.now();if(l===null){this.stalled=K;return}var V=K-l;!T&&V>=j&&this._reportStall(x.len);var O=Q.BufferHelper.bufferInfo(o,d,u.maxBufferHole);this._tryFixBufferStall(O,V)},L._tryFixBufferStall=function(y,u){var o=this.config,l=this.fragmentTracker,d=this.media,T=d.currentTime,c=l.getPartialFragment(T);if(c){var p=this._trySkipBufferHole(c);if(p)return}y.len>o.maxBufferHole&&u>o.highBufferWatchdogPeriod*1e3&&(G.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},L._reportStall=function(y){var u=this.hls,o=this.media,l=this.stallReported;l||(this.stallReported=!0,G.logger.warn("Playback stalling at @"+o.currentTime+" due to low buffer (buffer="+y+")"),u.trigger(_.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:y}))},L._trySkipBufferHole=function(y){for(var u=this.config,o=this.hls,l=this.media,d=l.currentTime,T=0,c=Q.BufferHelper.getBuffered(l),p=0;p<c.length;p++){var k=c.start(p);if(d+u.maxBufferHole>=T&&d<k){var x=Math.max(k+v,l.currentTime+R);return G.logger.warn("skipping hole, adjusting currentTime from "+d+" to "+x),this.moved=!0,this.stalled=null,l.currentTime=x,y&&o.trigger(_.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+d+" to "+x,frag:y}),x}T=c.end(p)}return 0},L._tryNudgeBuffer=function(){var y=this.config,u=this.hls,o=this.media,l=o.currentTime,d=(this.nudgeRetry||0)+1;if(this.nudgeRetry=d,d<y.nudgeMaxRetry){var T=l+d*y.nudgeOffset;G.logger.warn("Nudging 'currentTime' from "+l+" to "+T),o.currentTime=T,u.trigger(_.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else G.logger.error("Playhead still not moving while enough data buffered @"+l+" after "+y.nudgeMaxRetry+" nudges"),u.trigger(_.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},M}()},"./src/controller/id3-track-controller.ts":function(he,J,D){"use strict";D.r(J);var Q=D("./src/events.ts"),B=D("./src/utils/texttrack-utils.ts"),_=D("./src/demux/id3.ts"),G=.25,j=function(){function I(v){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=v,this._registerListeners()}var R=I.prototype;return R.destroy=function(){this._unregisterListeners()},R._registerListeners=function(){var A=this.hls;A.on(Q.Events.MEDIA_ATTACHED,this.onMediaAttached,this),A.on(Q.Events.MEDIA_DETACHING,this.onMediaDetaching,this),A.on(Q.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),A.on(Q.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},R._unregisterListeners=function(){var A=this.hls;A.off(Q.Events.MEDIA_ATTACHED,this.onMediaAttached,this),A.off(Q.Events.MEDIA_DETACHING,this.onMediaDetaching,this),A.off(Q.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),A.off(Q.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},R.onMediaAttached=function(A,M){this.media=M.media},R.onMediaDetaching=function(){if(!this.id3Track)return;Object(B.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},R.getID3Track=function(A){if(!this.media)return;for(var M=0;M<A.length;M++){var L=A[M];if(L.kind==="metadata"&&L.label==="id3")return Object(B.sendAddTrackEvent)(L,this.media),L}return this.media.addTextTrack("metadata","id3")},R.onFragParsingMetadata=function(A,M){if(!this.media)return;var L=M.frag,w=M.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var y=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,u=0;u<w.length;u++){var o=_.getID3Frames(w[u].data);if(o){var l=w[u].pts,d=u<w.length-1?w[u+1].pts:L.end,T=d-l;T<=0&&(d=l+G);for(var c=0;c<o.length;c++){var p=o[c];if(!_.isTimeStampFrame(p)){var k=new y(l,d,"");k.value=p,this.id3Track.addCue(k)}}}}},R.onBufferFlushing=function(A,M){var L=M.startOffset,w=M.endOffset,y=M.type;if(!y||y==="audio"){var u=this.id3Track;u&&Object(B.removeCuesInRange)(u,L,w)}},I}();J.default=j},"./src/controller/latency-controller.ts":function(he,J,D){"use strict";D.r(J),D.d(J,"default",function(){return I});var Q=D("./src/errors.ts"),B=D("./src/events.ts"),_=D("./src/utils/logger.ts");function G(R,v){for(var A=0;A<v.length;A++){var M=v[A];M.enumerable=M.enumerable||!1,M.configurable=!0,"value"in M&&(M.writable=!0),Object.defineProperty(R,M.key,M)}}function j(R,v,A){return v&&G(R.prototype,v),A&&G(R,A),R}var I=function(){function R(A){var M=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 M.timeupdate()},this.hls=A,this.config=A.config,this.registerListeners()}var v=R.prototype;return v.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},v.registerListeners=function(){this.hls.on(B.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(B.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(B.Events.ERROR,this.onError,this)},v.unregisterListeners=function(){this.hls.off(B.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(B.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(B.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(B.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(B.Events.ERROR,this.onError)},v.onMediaAttached=function(M,L){this.media=L.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},v.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},v.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},v.onLevelUpdated=function(M,L){var w=L.details;this.levelDetails=w,w.advanced&&this.timeupdate(),!w.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},v.onError=function(M,L){if(L.details!==Q.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,_.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},v.timeupdate=function(){var M=this.media,L=this.levelDetails;if(!M||!L)return;this.currentTime=M.currentTime;var w=this.computeLatency();if(w===null)return;this._latency=w;var y=this.config,u=y.lowLatencyMode,o=y.maxLiveSyncPlaybackRate;if(!u||o===1)return;var l=this.targetLatency;if(l===null)return;var d=w-l,T=Math.min(this.maxLatency,l+L.targetduration),c=d<T;if(L.live&&c&&d>.05&&this.forwardBufferLength>1){var p=Math.min(2,Math.max(1,o)),k=Math.round(2/(1+Math.exp(-.75*d-this.edgeStalled))*20)/20;M.playbackRate=Math.min(p,Math.max(1,k))}else M.playbackRate!==1&&M.playbackRate!==0&&(M.playbackRate=1)},v.estimateLiveEdge=function(){var M=this.levelDetails;return M===null?null:M.edge+M.age},v.computeLatency=function(){var M=this.estimateLiveEdge();return M===null?null:M-this.currentTime},j(R,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var M=this.config,L=this.levelDetails;return M.liveMaxLatencyDuration!==void 0?M.liveMaxLatencyDuration:L?M.liveMaxLatencyDurationCount*L.targetduration:0}},{key:"targetLatency",get:function(){var M=this.levelDetails;if(M===null)return null;var L=M.holdBack,w=M.partHoldBack,y=M.targetduration,u=this.config,o=u.liveSyncDuration,l=u.liveSyncDurationCount,d=u.lowLatencyMode,T=this.hls.userConfig,c=d&&w||L;(T.liveSyncDuration||T.liveSyncDurationCount||c===0)&&(c=o!==void 0?o:l*y);var p=y,k=1;return c+Math.min(this.stallCount*k,p)}},{key:"liveSyncPosition",get:function(){var M=this.estimateLiveEdge(),L=this.targetLatency,w=this.levelDetails;if(M===null||L===null||w===null)return null;var y=w.edge,u=M-L-this.edgeStalled,o=y-w.totalduration,l=y-(this.config.lowLatencyMode&&w.partTarget||w.targetduration);return Math.min(Math.max(o,u),l)}},{key:"drift",get:function(){var M=this.levelDetails;return M===null?1:M.drift}},{key:"edgeStalled",get:function(){var M=this.levelDetails;if(M===null)return 0;var L=(this.config.lowLatencyMode&&M.partTarget||M.targetduration)*3;return Math.max(M.age-L,0)}},{key:"forwardBufferLength",get:function(){var M=this.media,L=this.levelDetails;if(!M||!L)return 0;var w=M.buffered.length;return w?M.buffered.end(w-1):L.edge-this.currentTime}}]),R}()},"./src/controller/level-controller.ts":function(he,J,D){"use strict";D.r(J),D.d(J,"default",function(){return u});var Q=D("./src/types/level.ts"),B=D("./src/events.ts"),_=D("./src/errors.ts"),G=D("./src/utils/codecs.ts"),j=D("./src/controller/level-helper.ts"),I=D("./src/controller/base-playlist-controller.ts"),R=D("./src/types/loader.ts");function v(){return v=Object.assign||function(o){for(var l=1;l<arguments.length;l++){var d=arguments[l];for(var T in d)Object.prototype.hasOwnProperty.call(d,T)&&(o[T]=d[T])}return o},v.apply(this,arguments)}function A(o,l){for(var d=0;d<l.length;d++){var T=l[d];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(o,T.key,T)}}function M(o,l,d){return l&&A(o.prototype,l),d&&A(o,d),o}function L(o,l){o.prototype=Object.create(l.prototype),o.prototype.constructor=o,w(o,l)}function w(o,l){return w=Object.setPrototypeOf||function(T,c){return T.__proto__=c,T},w(o,l)}var y=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),u=function(o){L(l,o);function l(T){var c;return c=o.call(this,T,"[level-controller]")||this,c._levels=[],c._firstLevel=-1,c._startLevel=void 0,c.currentLevelIndex=-1,c.manualLevelIndex=-1,c.onParsedComplete=void 0,c._registerListeners(),c}var d=l.prototype;return d._registerListeners=function(){var c=this.hls;c.on(B.Events.MANIFEST_LOADED,this.onManifestLoaded,this),c.on(B.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.on(B.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),c.on(B.Events.FRAG_LOADED,this.onFragLoaded,this),c.on(B.Events.ERROR,this.onError,this)},d._unregisterListeners=function(){var c=this.hls;c.off(B.Events.MANIFEST_LOADED,this.onManifestLoaded,this),c.off(B.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.off(B.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),c.off(B.Events.FRAG_LOADED,this.onFragLoaded,this),c.off(B.Events.ERROR,this.onError,this)},d.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,o.prototype.destroy.call(this)},d.startLoad=function(){var c=this._levels;c.forEach(function(p){p.loadError=0}),o.prototype.startLoad.call(this)},d.onManifestLoaded=function(c,p){var k=[],x=[],m=[],g,h={},a,E=!1,b=!1,S=!1;if(p.levels.forEach(function(V){var O=V.attrs;E=E||!!(V.width&&V.height),b=b||!!V.videoCodec,S=S||!!V.audioCodec,y&&V.audioCodec&&V.audioCodec.indexOf("mp4a.40.34")!==-1&&(V.audioCodec=void 0);var P=V.bitrate+"-"+V.attrs.RESOLUTION+"-"+V.attrs.CODECS;a=h[P],a?a.url.push(V.url):(a=new Q.Level(V),h[P]=a,k.push(a)),O&&(O.AUDIO&&Object(j.addGroupId)(a,"audio",O.AUDIO),O.SUBTITLES&&Object(j.addGroupId)(a,"text",O.SUBTITLES))}),(E||b)&&S&&(k=k.filter(function(V){var O=V.videoCodec,P=V.width,$=V.height;return!!O||!!(P&&$)})),k=k.filter(function(V){var O=V.audioCodec,P=V.videoCodec;return(!O||Object(G.isCodecSupportedInMp4)(O,"audio"))&&(!P||Object(G.isCodecSupportedInMp4)(P,"video"))}),p.audioTracks&&(x=p.audioTracks.filter(function(V){return!V.audioCodec||Object(G.isCodecSupportedInMp4)(V.audioCodec,"audio")}),Object(j.assignTrackIdsByGroup)(x)),p.subtitles&&(m=p.subtitles,Object(j.assignTrackIdsByGroup)(m)),k.length>0){g=k[0].bitrate,k.sort(function(V,O){return V.bitrate-O.bitrate}),this._levels=k;for(var N=0;N<k.length;N++)if(k[N].bitrate===g){this._firstLevel=N,this.log("manifest loaded, "+k.length+" level(s) found, first bitrate: "+g);break}var U=S&&!b,K={levels:k,audioTracks:x,subtitleTracks:m,firstLevel:this._firstLevel,stats:p.stats,audio:S,video:b,altAudio:!U&&x.some(function(V){return!!V.url})};this.hls.trigger(B.Events.MANIFEST_PARSED,K),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(B.Events.ERROR,{type:_.ErrorTypes.MEDIA_ERROR,details:_.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:p.url,reason:"no level with compatible codecs found in manifest"})},d.onError=function(c,p){if(o.prototype.onError.call(this,c,p),p.fatal)return;var k=p.context,x=this._levels[this.currentLevelIndex];if(k&&(k.type===R.PlaylistContextType.AUDIO_TRACK&&x.audioGroupIds&&k.groupId===x.audioGroupIds[x.urlId]||k.type===R.PlaylistContextType.SUBTITLE_TRACK&&x.textGroupIds&&k.groupId===x.textGroupIds[x.urlId])){this.redundantFailover(this.currentLevelIndex);return}var m=!1,g=!0,h;switch(p.details){case _.ErrorDetails.FRAG_LOAD_ERROR:case _.ErrorDetails.FRAG_LOAD_TIMEOUT:case _.ErrorDetails.KEY_LOAD_ERROR:case _.ErrorDetails.KEY_LOAD_TIMEOUT:if(p.frag){var a=this._levels[p.frag.level];a?(a.fragmentError++,a.fragmentError>this.hls.config.fragLoadingMaxRetry&&(h=p.frag.level)):h=p.frag.level}break;case _.ErrorDetails.LEVEL_LOAD_ERROR:case _.ErrorDetails.LEVEL_LOAD_TIMEOUT:k&&(k.deliveryDirectives&&(g=!1),h=k.level),m=!0;break;case _.ErrorDetails.REMUX_ALLOC_ERROR:h=p.level,m=!0;break}h!==void 0&&this.recoverLevel(p,h,m,g)},d.recoverLevel=function(c,p,k,x){var m=c.details,g=this._levels[p];if(g.loadError++,k){var h=this.retryLoadingOrFail(c);if(h)c.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(x){var a=g.url.length;if(a>1&&g.loadError<a)c.levelRetry=!0,this.redundantFailover(p);else if(this.manualLevelIndex===-1){var E=p===0?this._levels.length-1:p-1;this.currentLevelIndex!==E&&this._levels[E].loadError===0&&(this.warn(m+": switch to "+E),c.levelRetry=!0,this.hls.nextAutoLevel=E)}}},d.redundantFailover=function(c){var p=this._levels[c],k=p.url.length;if(k>1){var x=(p.urlId+1)%k;this.warn("Switching to redundant URL-id "+x),this._levels.forEach(function(m){m.urlId=x}),this.level=c}},d.onFragLoaded=function(c,p){var k=p.frag;if(k!==void 0&&k.type===R.PlaylistLevelType.MAIN){var x=this._levels[k.level];x!==void 0&&(x.fragmentError=0,x.loadError=0)}},d.onLevelLoaded=function(c,p){var k,x=p.level,m=p.details,g=this._levels[x];if(!g){var h;this.warn("Invalid level index "+x),(h=p.deliveryDirectives)!==null&&h!==void 0&&h.skip&&(m.deltaUpdateFailed=!0);return}x===this.currentLevelIndex?(g.fragmentError===0&&(g.loadError=0,this.retryCount=0),this.playlistLoaded(x,p,g.details)):(k=p.deliveryDirectives)!==null&&k!==void 0&&k.skip&&(m.deltaUpdateFailed=!0)},d.onAudioTrackSwitched=function(c,p){var k=this.hls.levels[this.currentLevelIndex];if(!k)return;if(k.audioGroupIds){for(var x=-1,m=this.hls.audioTracks[p.id].groupId,g=0;g<k.audioGroupIds.length;g++)if(k.audioGroupIds[g]===m){x=g;break}x!==k.urlId&&(k.urlId=x,this.startLoad())}},d.loadPlaylist=function(c){var p=this.currentLevelIndex,k=this._levels[p];if(this.canLoad&&k&&k.url.length>0){var x=k.urlId,m=k.url[x];if(c)try{m=c.addDirectives(m)}catch(g){this.warn("Could not construct new URL with HLS Delivery Directives: "+g)}this.log("Attempt loading level index "+p+(c?" at sn "+c.msn+" part "+c.part:"")+" with URL-id "+x+" "+m),this.clearTimer(),this.hls.trigger(B.Events.LEVEL_LOADING,{url:m,level:p,id:x,deliveryDirectives:c||null})}},d.removeLevel=function(c,p){var k=function(g,h){return h!==p},x=this._levels.filter(function(m,g){return g!==c?!0:m.url.length>1&&p!==void 0?(m.url=m.url.filter(k),m.audioGroupIds&&(m.audioGroupIds=m.audioGroupIds.filter(k)),m.textGroupIds&&(m.textGroupIds=m.textGroupIds.filter(k)),m.urlId=0,!0):!1}).map(function(m,g){var h=m.details;return h!=null&&h.fragments&&h.fragments.forEach(function(a){a.level=g}),m});this._levels=x,this.hls.trigger(B.Events.LEVELS_UPDATED,{levels:x})},M(l,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(c){var p,k=this._levels;if(k.length===0)return;if(this.currentLevelIndex===c&&(p=k[c])!==null&&p!==void 0&&p.details)return;if(c<0||c>=k.length){var x=c<0;if(this.hls.trigger(B.Events.ERROR,{type:_.ErrorTypes.OTHER_ERROR,details:_.ErrorDetails.LEVEL_SWITCH_ERROR,level:c,fatal:x,reason:"invalid level idx"}),x)return;c=Math.min(c,k.length-1)}this.clearTimer();var m=this.currentLevelIndex,g=k[m],h=k[c];this.log("switching to level "+c+" from "+m),this.currentLevelIndex=c;var a=v({},h,{level:c,maxBitrate:h.maxBitrate,uri:h.uri,urlId:h.urlId});delete a._urlId,this.hls.trigger(B.Events.LEVEL_SWITCHING,a);var E=h.details;if(!E||E.live){var b=this.switchParams(h.uri,g==null?void 0:g.details);this.loadPlaylist(b)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(c){this.manualLevelIndex=c,this._startLevel===void 0&&(this._startLevel=c),c!==-1&&(this.level=c)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(c){this._firstLevel=c}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var c=this.hls.config.startLevel;return c!==void 0?c:this._firstLevel}else return this._startLevel},set:function(c){this._startLevel=c}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(c){this.level=c,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=c)}}]),l}(I.default)},"./src/controller/level-helper.ts":function(he,J,D){"use strict";D.r(J),D.d(J,"addGroupId",function(){return _}),D.d(J,"assignTrackIdsByGroup",function(){return G}),D.d(J,"updatePTS",function(){return j}),D.d(J,"updateFragPTSDTS",function(){return R}),D.d(J,"mergeDetails",function(){return v}),D.d(J,"mapPartIntersection",function(){return A}),D.d(J,"mapFragmentIntersection",function(){return M}),D.d(J,"adjustSliding",function(){return L}),D.d(J,"addSliding",function(){return w}),D.d(J,"computeReloadInterval",function(){return y}),D.d(J,"getFragmentWithSN",function(){return u}),D.d(J,"getPartWith",function(){return o});var Q=D("./src/polyfills/number.ts"),B=D("./src/utils/logger.ts");function _(l,d,T){switch(d){case"audio":l.audioGroupIds||(l.audioGroupIds=[]),l.audioGroupIds.push(T);break;case"text":l.textGroupIds||(l.textGroupIds=[]),l.textGroupIds.push(T);break}}function G(l){var d={};l.forEach(function(T){var c=T.groupId||"";T.id=d[c]=d[c]||0,d[c]++})}function j(l,d,T){var c=l[d],p=l[T];I(c,p)}function I(l,d){var T=d.startPTS;if(Object(Q.isFiniteNumber)(T)){var c=0,p;d.sn>l.sn?(c=T-l.start,p=l):(c=l.start-T,p=d),p.duration!==c&&(p.duration=c)}else if(d.sn>l.sn){var k=l.cc===d.cc;k&&l.minEndPTS?d.start=l.start+(l.minEndPTS-l.start):d.start=l.start+l.duration}else d.start=Math.max(l.start-d.duration,0)}function R(l,d,T,c,p,k){var x=c-T;x<=0&&(B.logger.warn("Fragment should have a positive duration",d),c=T+d.duration,k=p+d.duration);var m=T,g=c,h=d.startPTS,a=d.endPTS;if(Object(Q.isFiniteNumber)(h)){var E=Math.abs(h-T);Object(Q.isFiniteNumber)(d.deltaPTS)?d.deltaPTS=Math.max(E,d.deltaPTS):d.deltaPTS=E,m=Math.max(T,h),T=Math.min(T,h),p=Math.min(p,d.startDTS),g=Math.min(c,a),c=Math.max(c,a),k=Math.max(k,d.endDTS)}d.duration=c-T;var b=T-d.start;d.appendedPTS=c,d.start=d.startPTS=T,d.maxStartPTS=m,d.startDTS=p,d.endPTS=c,d.minEndPTS=g,d.endDTS=k;var S=d.sn;if(!l||S<l.startSN||S>l.endSN)return 0;var N,U=S-l.startSN,K=l.fragments;for(K[U]=d,N=U;N>0;N--)I(K[N],K[N-1]);for(N=U;N<K.length-1;N++)I(K[N],K[N+1]);return l.fragmentHint&&I(K[K.length-1],l.fragmentHint),l.PTSKnown=l.alignedSliding=!0,b}function v(l,d){for(var T=null,c=l.fragments,p=c.length-1;p>=0;p--){var k=c[p].initSegment;if(k){T=k;break}}l.fragmentHint&&delete l.fragmentHint.endPTS;var x=0,m;if(M(l,d,function(N,U){N.relurl&&(x=N.cc-U.cc),Object(Q.isFiniteNumber)(N.startPTS)&&Object(Q.isFiniteNumber)(N.endPTS)&&(U.start=U.startPTS=N.startPTS,U.startDTS=N.startDTS,U.appendedPTS=N.appendedPTS,U.maxStartPTS=N.maxStartPTS,U.endPTS=N.endPTS,U.endDTS=N.endDTS,U.minEndPTS=N.minEndPTS,U.duration=N.endPTS-N.startPTS,U.duration&&(m=U),d.PTSKnown=d.alignedSliding=!0),U.elementaryStreams=N.elementaryStreams,U.loader=N.loader,U.stats=N.stats,U.urlId=N.urlId,N.initSegment&&(U.initSegment=N.initSegment,T=N.initSegment)}),T){var g=d.fragmentHint?d.fragments.concat(d.fragmentHint):d.fragments;g.forEach(function(N){var U;(!N.initSegment||N.initSegment.relurl===((U=T)===null||U===void 0?void 0:U.relurl))&&(N.initSegment=T)})}if(d.skippedSegments&&(d.deltaUpdateFailed=d.fragments.some(function(N){return!N}),d.deltaUpdateFailed)){B.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var h=d.skippedSegments;h--;)d.fragments.shift();d.startSN=d.fragments[0].sn,d.startCC=d.fragments[0].cc}var a=d.fragments;if(x){B.logger.warn("discontinuity sliding from playlist, take drift into account");for(var E=0;E<a.length;E++)a[E].cc+=x}d.skippedSegments&&(d.startCC=d.fragments[0].cc),A(l.partList,d.partList,function(N,U){U.elementaryStreams=N.elementaryStreams,U.stats=N.stats}),m?R(d,m,m.startPTS,m.endPTS,m.startDTS,m.endDTS):L(l,d),a.length&&(d.totalduration=d.edge-a[0].start),d.driftStartTime=l.driftStartTime,d.driftStart=l.driftStart;var b=d.advancedDateTime;if(d.advanced&&b){var S=d.edge;d.driftStart||(d.driftStartTime=b,d.driftStart=S),d.driftEndTime=b,d.driftEnd=S}else d.driftEndTime=l.driftEndTime,d.driftEnd=l.driftEnd,d.advancedDateTime=l.advancedDateTime}function A(l,d,T){if(l&&d)for(var c=0,p=0,k=l.length;p<=k;p++){var x=l[p],m=d[p+c];x&&m&&x.index===m.index&&x.fragment.sn===m.fragment.sn?T(x,m):c--}}function M(l,d,T){for(var c=d.skippedSegments,p=Math.max(l.startSN,d.startSN)-d.startSN,k=(l.fragmentHint?1:0)+(c?d.endSN:Math.min(l.endSN,d.endSN))-d.startSN,x=d.startSN-l.startSN,m=d.fragmentHint?d.fragments.concat(d.fragmentHint):d.fragments,g=l.fragmentHint?l.fragments.concat(l.fragmentHint):l.fragments,h=p;h<=k;h++){var a=g[x+h],E=m[h];c&&!E&&h<c&&(E=d.fragments[h]=a),a&&E&&T(a,E)}}function L(l,d){var T=d.startSN+d.skippedSegments-l.startSN,c=l.fragments;if(T<0||T>=c.length)return;w(d,c[T].start)}function w(l,d){if(d){for(var T=l.fragments,c=l.skippedSegments;c<T.length;c++)T[c].start+=d;l.fragmentHint&&(l.fragmentHint.start+=d)}}function y(l,d){var T=1e3*l.levelTargetDuration,c=T/2,p=l.age,k=p>0&&p<T*3,x=d.loading.end-d.loading.start,m,g=l.availabilityDelay;if(l.updated===!1)if(k){var h=333*l.misses;m=Math.max(Math.min(c,x*2),h),l.availabilityDelay=(l.availabilityDelay||0)+m}else m=c;else k?(g=Math.min(g||T/2,p),l.availabilityDelay=g,m=g+T-p):m=T-x;return Math.round(m)}function u(l,d,T){if(!l||!l.details)return null;var c=l.details,p=c.fragments[d-c.startSN];return p||(p=c.fragmentHint,p&&p.sn===d?p:d<c.startSN&&T&&T.sn===d?T:null)}function o(l,d,T){if(!l||!l.details)return null;var c=l.details.partList;if(c)for(var p=c.length;p--;){var k=c[p];if(k.index===T&&k.fragment.sn===d)return k}return null}},"./src/controller/stream-controller.ts":function(he,J,D){"use strict";D.r(J),D.d(J,"default",function(){return c});var Q=D("./src/polyfills/number.ts"),B=D("./src/controller/base-stream-controller.ts"),_=D("./src/is-supported.ts"),G=D("./src/events.ts"),j=D("./src/utils/buffer-helper.ts"),I=D("./src/controller/fragment-tracker.ts"),R=D("./src/types/loader.ts"),v=D("./src/loader/fragment.ts"),A=D("./src/demux/transmuxer-interface.ts"),M=D("./src/types/transmuxer.ts"),L=D("./src/controller/gap-controller.ts"),w=D("./src/errors.ts"),y=D("./src/utils/logger.ts");function u(p,k){for(var x=0;x<k.length;x++){var m=k[x];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(p,m.key,m)}}function o(p,k,x){return k&&u(p.prototype,k),x&&u(p,x),p}function l(p,k){p.prototype=Object.create(k.prototype),p.prototype.constructor=p,d(p,k)}function d(p,k){return d=Object.setPrototypeOf||function(m,g){return m.__proto__=g,m},d(p,k)}var T=100,c=function(p){l(k,p);function k(m,g){var h;return h=p.call(this,m,g,"[stream-controller]")||this,h.audioCodecSwap=!1,h.gapController=null,h.level=-1,h._forceStartLoad=!1,h.altAudio=!1,h.audioOnly=!1,h.fragPlaying=null,h.onvplaying=null,h.onvseeked=null,h.fragLastKbps=0,h.stalled=!1,h.couldBacktrack=!1,h.audioCodecSwitch=!1,h.videoBuffer=null,h._registerListeners(),h}var x=k.prototype;return x._registerListeners=function(){var g=this.hls;g.on(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),g.on(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this),g.on(G.Events.MANIFEST_LOADING,this.onManifestLoading,this),g.on(G.Events.MANIFEST_PARSED,this.onManifestParsed,this),g.on(G.Events.LEVEL_LOADING,this.onLevelLoading,this),g.on(G.Events.LEVEL_LOADED,this.onLevelLoaded,this),g.on(G.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),g.on(G.Events.ERROR,this.onError,this),g.on(G.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),g.on(G.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),g.on(G.Events.BUFFER_CREATED,this.onBufferCreated,this),g.on(G.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),g.on(G.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),g.on(G.Events.FRAG_BUFFERED,this.onFragBuffered,this)},x._unregisterListeners=function(){var g=this.hls;g.off(G.Events.MEDIA_ATTACHED,this.onMediaAttached,this),g.off(G.Events.MEDIA_DETACHING,this.onMediaDetaching,this),g.off(G.Events.MANIFEST_LOADING,this.onManifestLoading,this),g.off(G.Events.MANIFEST_PARSED,this.onManifestParsed,this),g.off(G.Events.LEVEL_LOADED,this.onLevelLoaded,this),g.off(G.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),g.off(G.Events.ERROR,this.onError,this),g.off(G.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),g.off(G.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),g.off(G.Events.BUFFER_CREATED,this.onBufferCreated,this),g.off(G.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),g.off(G.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),g.off(G.Events.FRAG_BUFFERED,this.onFragBuffered,this)},x.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},x.startLoad=function(g){if(this.levels){var h=this.lastCurrentTime,a=this.hls;if(this.stopLoad(),this.setInterval(T),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var E=a.startLevel;E===-1&&(a.config.testBandwidth?(E=0,this.bitrateTest=!0):E=a.nextAutoLevel),this.level=a.nextLoadLevel=E,this.loadedmetadata=!1}h>0&&g===-1&&(this.log("Override startPosition with lastCurrentTime @"+h.toFixed(3)),g=h),this.state=B.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=g,this.tick()}else this._forceStartLoad=!0,this.state=B.State.STOPPED},x.stopLoad=function(){this._forceStartLoad=!1,p.prototype.stopLoad.call(this)},x.doTick=function(){switch(this.state){case B.State.IDLE:this.doTickIdle();break;case B.State.WAITING_LEVEL:{var g,h=this.levels,a=this.level,E=h==null||((g=h[a])===null||g===void 0)?void 0:g.details;if(E&&(!E.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(E))break;this.state=B.State.IDLE;break}break}case B.State.FRAG_LOADING_WAITING_RETRY:{var b,S=self.performance.now(),N=this.retryDate;(!N||S>=N||(b=this.media)!==null&&b!==void 0&&b.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=B.State.IDLE)}break;default:break}this.onTickEnd()},x.onTickEnd=function(){p.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},x.doTickIdle=function(){var g,h,a=this.hls,E=this.levelLastLoaded,b=this.levels,S=this.media,N=a.config,U=a.nextLoadLevel;if(E===null||!S&&(this.startFragRequested||!N.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!b||!b[U])return;var K=b[U];this.level=a.nextLoadLevel=U;var V=K.details;if(!V||this.state===B.State.WAITING_LEVEL||V.live&&this.levelLastLoaded!==U){this.state=B.State.WAITING_LEVEL;return}var O=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:S,R.PlaylistLevelType.MAIN);if(O===null)return;var P=O.len,$=this.getMaxBufferLength(K.maxBitrate);if(P>=$)return;if(this._streamEnded(O,V)){var ee={};this.altAudio&&(ee.type="video"),this.hls.trigger(G.Events.BUFFER_EOS,ee),this.state=B.State.ENDED;return}var oe=O.end,fe=this.getNextFragment(oe,V);if(this.couldBacktrack&&!this.fragPrevious&&fe&&fe.sn!=="initSegment"){var Oe=fe.sn-V.startSN;Oe>1&&(fe=V.fragments[Oe-1],this.fragmentTracker.removeFragment(fe))}if(fe&&this.fragmentTracker.getState(fe)===I.FragmentState.OK&&this.nextLoadPosition>oe){var Ce=this.audioOnly&&!this.altAudio?v.ElementaryStreamTypes.AUDIO:v.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(S,Ce,R.PlaylistLevelType.MAIN),fe=this.getNextFragment(this.nextLoadPosition,V)}if(!fe)return;fe.initSegment&&!fe.initSegment.data&&!this.bitrateTest&&(fe=fe.initSegment),((g=fe.decryptdata)===null||g===void 0?void 0:g.keyFormat)==="identity"&&!((h=fe.decryptdata)!==null&&h!==void 0&&h.key)?this.loadKey(fe,V):this.loadFragment(fe,V,oe)},x.loadFragment=function(g,h,a){var E,b=this.fragmentTracker.getState(g);if(this.fragCurrent=g,b===I.FragmentState.BACKTRACKED){var S=this.fragmentTracker.getBacktrackData(g);if(S){this._handleFragmentLoadProgress(S),this._handleFragmentLoadComplete(S);return}else b=I.FragmentState.NOT_LOADED}b===I.FragmentState.NOT_LOADED||b===I.FragmentState.PARTIAL?g.sn==="initSegment"?this._loadInitSegment(g):this.bitrateTest?(g.bitrateTest=!0,this.log("Fragment "+g.sn+" of level "+g.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(g)):(this.startFragRequested=!0,p.prototype.loadFragment.call(this,g,h,a)):b===I.FragmentState.APPENDING?this.reduceMaxBufferLength(g.duration)&&this.fragmentTracker.removeFragment(g):((E=this.media)===null||E===void 0?void 0:E.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},x.getAppendedFrag=function(g){var h=this.fragmentTracker.getAppendedFrag(g,R.PlaylistLevelType.MAIN);return h&&"fragment"in h?h.fragment:h},x.getBufferedFrag=function(g){return this.fragmentTracker.getBufferedFrag(g,R.PlaylistLevelType.MAIN)},x.followingBufferedFrag=function(g){return g?this.getBufferedFrag(g.end+.5):null},x.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},x.nextLevelSwitch=function(){var g=this.levels,h=this.media;if(h!=null&&h.readyState){var a,E=this.getAppendedFrag(h.currentTime);if(E&&E.start>1&&this.flushMainBuffer(0,E.start-1),!h.paused&&g){var b=this.hls.nextLoadLevel,S=g[b],N=this.fragLastKbps;N&&this.fragCurrent?a=this.fragCurrent.duration*S.maxBitrate/(1e3*N)+1:a=0}else a=0;var U=this.getBufferedFrag(h.currentTime+a);if(U){var K=this.followingBufferedFrag(U);if(K){this.abortCurrentFrag();var V=K.maxStartPTS?K.maxStartPTS:K.start,O=K.duration,P=Math.max(U.end,V+Math.min(Math.max(O-this.config.maxFragLookUpTolerance,O*.5),O*.75));this.flushMainBuffer(P,Number.POSITIVE_INFINITY)}}}},x.abortCurrentFrag=function(){var g=this.fragCurrent;this.fragCurrent=null,g!=null&&g.loader&&g.loader.abort(),this.state===B.State.KEY_LOADING&&(this.state=B.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},x.flushMainBuffer=function(g,h){p.prototype.flushMainBuffer.call(this,g,h,this.altAudio?"video":null)},x.onMediaAttached=function(g,h){p.prototype.onMediaAttached.call(this,g,h);var a=h.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),a.addEventListener("playing",this.onvplaying),a.addEventListener("seeked",this.onvseeked),this.gapController=new L.default(this.config,a,this.fragmentTracker,this.hls)},x.onMediaDetaching=function(){var g=this.media;g&&(g.removeEventListener("playing",this.onvplaying),g.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),p.prototype.onMediaDetaching.call(this)},x.onMediaPlaying=function(){this.tick()},x.onMediaSeeked=function(){var g=this.media,h=g?g.currentTime:null;Object(Q.isFiniteNumber)(h)&&this.log("Media seeked to "+h.toFixed(3)),this.tick()},x.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(G.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},x.onManifestParsed=function(g,h){var a=!1,E=!1,b;h.levels.forEach(function(S){b=S.audioCodec,b&&(b.indexOf("mp4a.40.2")!==-1&&(a=!0),b.indexOf("mp4a.40.5")!==-1&&(E=!0))}),this.audioCodecSwitch=a&&E&&!Object(_.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=h.levels,this.startFragRequested=!1},x.onLevelLoading=function(g,h){var a=this.levels;if(!a||this.state!==B.State.IDLE)return;var E=a[h.level];(!E.details||E.details.live&&this.levelLastLoaded!==h.level||this.waitForCdnTuneIn(E.details))&&(this.state=B.State.WAITING_LEVEL)},x.onLevelLoaded=function(g,h){var a,E=this.levels,b=h.level,S=h.details,N=S.totalduration;if(!E){this.warn("Levels were reset while loading level "+b);return}this.log("Level "+b+" loaded ["+S.startSN+","+S.endSN+"], cc ["+S.startCC+", "+S.endCC+"] duration:"+N);var U=this.fragCurrent;U&&(this.state===B.State.FRAG_LOADING||this.state===B.State.FRAG_LOADING_WAITING_RETRY)&&(U.level!==h.level&&U.loader&&(this.state=B.State.IDLE,U.loader.abort()));var K=E[b],V=0;if(S.live||(a=K.details)!==null&&a!==void 0&&a.live){if(S.fragments[0]||(S.deltaUpdateFailed=!0),S.deltaUpdateFailed)return;V=this.alignPlaylists(S,K.details)}if(K.details=S,this.levelLastLoaded=b,this.hls.trigger(G.Events.LEVEL_UPDATED,{details:S,level:b}),this.state===B.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(S))return;this.state=B.State.IDLE}this.startFragRequested?S.live&&this.synchronizeToLiveEdge(S):this.setStartPosition(S,V),this.tick()},x._handleFragmentLoadProgress=function(g){var h,a=g.frag,E=g.part,b=g.payload,S=this.levels;if(!S){this.warn("Levels were reset while fragment load was in progress. Fragment "+a.sn+" of level "+a.level+" will not be buffered");return}var N=S[a.level],U=N.details;if(!U){this.warn("Dropping fragment "+a.sn+" of level "+a.level+" after level details were reset");return}var K=N.videoCodec,V=U.PTSKnown||!U.live,O=(h=a.initSegment)===null||h===void 0?void 0:h.data,P=this._getAudioCodec(N),$=this.transmuxer=this.transmuxer||new A.default(this.hls,R.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),ee=E?E.index:-1,oe=ee!==-1,fe=new M.ChunkMetadata(a.level,a.sn,a.stats.chunkCount,b.byteLength,ee,oe),Oe=this.initPTS[a.cc];$.push(b,O,P,K,a,E,U.totalduration,V,fe,Oe)},x.onAudioTrackSwitching=function(g,h){var a=this.altAudio,E=!!h.url,b=h.id;if(!E){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var S=this.fragCurrent;S!=null&&S.loader&&(this.log("Switching to main audio track, cancel main fragment load"),S.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var N=this.hls;a&&N.trigger(G.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),N.trigger(G.Events.AUDIO_TRACK_SWITCHED,{id:b})}},x.onAudioTrackSwitched=function(g,h){var a=h.id,E=!!this.hls.audioTracks[a].url;if(E){var b=this.videoBuffer;b&&this.mediaBuffer!==b&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=b)}this.altAudio=E,this.tick()},x.onBufferCreated=function(g,h){var a=h.tracks,E,b,S=!1;for(var N in a){var U=a[N];if(U.id==="main"){if(b=N,E=U,N==="video"){var K=a[N];K&&(this.videoBuffer=K.buffer)}}else S=!0}S&&E?(this.log("Alternate track found, use "+b+".buffered to schedule main fragment loading"),this.mediaBuffer=E.buffer):this.mediaBuffer=this.media},x.onFragBuffered=function(g,h){var a=h.frag,E=h.part;if(a&&a.type!==R.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(a)){this.warn("Fragment "+a.sn+(E?" p: "+E.index:"")+" of level "+a.level+" finished buffering, but was aborted. state: "+this.state),this.state===B.State.PARSED&&(this.state=B.State.IDLE);return}var b=E?E.stats:a.stats;this.fragLastKbps=Math.round(8*b.total/(b.buffering.end-b.loading.first)),a.sn!=="initSegment"&&(this.fragPrevious=a),this.fragBufferedComplete(a,E)},x.onError=function(g,h){switch(h.details){case w.ErrorDetails.FRAG_LOAD_ERROR:case w.ErrorDetails.FRAG_LOAD_TIMEOUT:case w.ErrorDetails.KEY_LOAD_ERROR:case w.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(R.PlaylistLevelType.MAIN,h);break;case w.ErrorDetails.LEVEL_LOAD_ERROR:case w.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==B.State.ERROR&&(h.fatal?(this.warn(""+h.details),this.state=B.State.ERROR):!h.levelRetry&&this.state===B.State.WAITING_LEVEL&&(this.state=B.State.IDLE));break;case w.ErrorDetails.BUFFER_FULL_ERROR:if(h.parent==="main"&&(this.state===B.State.PARSING||this.state===B.State.PARSED)){var a=!0,E=this.getFwdBufferInfo(this.media,R.PlaylistLevelType.MAIN);E&&E.len>.5&&(a=!this.reduceMaxBufferLength(E.len)),a&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},x.checkBuffer=function(){var g=this.media,h=this.gapController;if(!g||!h||!g.readyState)return;var a=j.BufferHelper.getBuffered(g);!this.loadedmetadata&&a.length?(this.loadedmetadata=!0,this.seekToStartPos()):h.poll(this.lastCurrentTime),this.lastCurrentTime=g.currentTime},x.onFragLoadEmergencyAborted=function(){this.state=B.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},x.onBufferFlushed=function(g,h){var a=h.type;if(a!==v.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var E=(a===v.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(E,a,R.PlaylistLevelType.MAIN)}},x.onLevelsUpdated=function(g,h){this.levels=h.levels},x.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},x.seekToStartPos=function(){var g=this.media,h=g.currentTime,a=this.startPosition;if(a>=0&&h<a){if(g.seeking){y.logger.log("could not seek to "+a+", already seeking at "+h);return}var E=j.BufferHelper.getBuffered(g),b=E.length?E.start(0):0,S=b-a;S>0&&(S<this.config.maxBufferHole||S<this.config.maxFragLookUpTolerance)&&(y.logger.log("adjusting start position by "+S+" to match buffer start"),a+=S,this.startPosition=a),this.log("seek to target start position "+a+" from current time "+h),g.currentTime=a}},x._getAudioCodec=function(g){var h=this.config.defaultAudioCodec||g.audioCodec;return this.audioCodecSwap&&h&&(this.log("Swapping audio codec"),h.indexOf("mp4a.40.5")!==-1?h="mp4a.40.2":h="mp4a.40.5"),h},x._loadBitrateTestFrag=function(g){var h=this;this._doFragLoad(g).then(function(a){var E=h.hls;if(!a||E.nextLoadLevel||h.fragContextChanged(g))return;h.fragLoadError=0,h.state=B.State.IDLE,h.startFragRequested=!1,h.bitrateTest=!1;var b=g.stats;b.parsing.start=b.parsing.end=b.buffering.start=b.buffering.end=self.performance.now(),E.trigger(G.Events.FRAG_LOADED,a)})},x._handleTransmuxComplete=function(g){var h,a="main",E=this.hls,b=g.remuxResult,S=g.chunkMeta,N=this.getCurrentContext(S);if(!N){this.warn("The loading context changed while buffering fragment "+S.sn+" of level "+S.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(S.level);return}var U=N.frag,K=N.part,V=N.level,O=b.video,P=b.text,$=b.id3,ee=b.initSegment,oe=this.altAudio?void 0:b.audio;if(this.fragContextChanged(U))return;if(this.state=B.State.PARSING,ee){ee.tracks&&(this._bufferInitSegment(V,ee.tracks,U,S),E.trigger(G.Events.FRAG_PARSING_INIT_SEGMENT,{frag:U,id:a,tracks:ee.tracks}));var fe=ee.initPTS,Oe=ee.timescale;Object(Q.isFiniteNumber)(fe)&&(this.initPTS[U.cc]=fe,E.trigger(G.Events.INIT_PTS_FOUND,{frag:U,id:a,initPTS:fe,timescale:Oe}))}if(O&&b.independent!==!1){if(V.details){var Ce=O.startPTS,Ae=O.endPTS,Le=O.startDTS,be=O.endDTS;if(K)K.elementaryStreams[O.type]={startPTS:Ce,endPTS:Ae,startDTS:Le,endDTS:be};else if(O.firstKeyFrame&&O.independent&&(this.couldBacktrack=!0),O.dropped&&O.independent){var pe=this.getLoadPosition()+this.config.maxBufferHole;if(pe<Ce){this.backtrack(U);return}U.setElementaryStreamInfo(O.type,U.start,Ae,U.start,be,!0)}U.setElementaryStreamInfo(O.type,Ce,Ae,Le,be),this.bufferFragmentData(O,U,K,S)}}else if(b.independent===!1){this.backtrack(U);return}if(oe){var se=oe.startPTS,te=oe.endPTS,ue=oe.startDTS,ne=oe.endDTS;K&&(K.elementaryStreams[v.ElementaryStreamTypes.AUDIO]={startPTS:se,endPTS:te,startDTS:ue,endDTS:ne}),U.setElementaryStreamInfo(v.ElementaryStreamTypes.AUDIO,se,te,ue,ne),this.bufferFragmentData(oe,U,K,S)}if($!=null&&(h=$.samples)!==null&&h!==void 0&&h.length){var Te={frag:U,id:a,samples:$.samples};E.trigger(G.Events.FRAG_PARSING_METADATA,Te)}if(P){var Re={frag:U,id:a,samples:P.samples};E.trigger(G.Events.FRAG_PARSING_USERDATA,Re)}},x._bufferInitSegment=function(g,h,a,E){var b=this;if(this.state!==B.State.PARSING)return;this.audioOnly=!!h.audio&&!h.video,this.altAudio&&!this.audioOnly&&delete h.audio;var S=h.audio,N=h.video,U=h.audiovideo;if(S){var K=g.audioCodec,V=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(K&&(K.indexOf("mp4a.40.5")!==-1?K="mp4a.40.2":K="mp4a.40.5"),S.metadata.channelCount!==1&&V.indexOf("firefox")===-1&&(K="mp4a.40.5")),V.indexOf("android")!==-1&&S.container!=="audio/mpeg"&&(K="mp4a.40.2",this.log("Android: force audio codec to "+K)),g.audioCodec&&g.audioCodec!==K&&this.log('Swapping manifest audio codec "'+g.audioCodec+'" for "'+K+'"'),S.levelCodec=K,S.id="main",this.log("Init audio buffer, container:"+S.container+", codecs[selected/level/parsed]=["+(K||"")+"/"+(g.audioCodec||"")+"/"+S.codec+"]")}N&&(N.levelCodec=g.videoCodec,N.id="main",this.log("Init video buffer, container:"+N.container+", codecs[level/parsed]=["+(g.videoCodec||"")+"/"+N.codec+"]")),U&&this.log("Init audiovideo buffer, container:"+U.container+", codecs[level/parsed]=["+(g.attrs.CODECS||"")+"/"+U.codec+"]"),this.hls.trigger(G.Events.BUFFER_CODECS,h),Object.keys(h).forEach(function(O){var P=h[O],$=P.initSegment;$!=null&&$.byteLength&&b.hls.trigger(G.Events.BUFFER_APPENDING,{type:O,data:$,frag:a,part:null,chunkMeta:E,parent:a.type})}),this.tick()},x.backtrack=function(g){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(g);var h=this.fragmentTracker.backtrack(g);this.fragPrevious=null,this.nextLoadPosition=g.start,h?this.resetFragmentLoading(g):this.state=B.State.BACKTRACKING},x.checkFragmentChanged=function(){var g=this.media,h=null;if(g&&g.readyState>1&&g.seeking===!1){var a=g.currentTime;if(j.BufferHelper.isBuffered(g,a)?h=this.getAppendedFrag(a):j.BufferHelper.isBuffered(g,a+.1)&&(h=this.getAppendedFrag(a+.1)),h){var E=this.fragPlaying,b=h.level;(!E||h.sn!==E.sn||E.level!==b||h.urlId!==E.urlId)&&(this.hls.trigger(G.Events.FRAG_CHANGED,{frag:h}),(!E||E.level!==b)&&this.hls.trigger(G.Events.LEVEL_SWITCHED,{level:b}),this.fragPlaying=h)}}},o(k,[{key:"nextLevel",get:function(){var g=this.nextBufferedFrag;return g?g.level:-1}},{key:"currentLevel",get:function(){var g=this.media;if(g){var h=this.getAppendedFrag(g.currentTime);if(h)return h.level}return-1}},{key:"nextBufferedFrag",get:function(){var g=this.media;if(g){var h=this.getAppendedFrag(g.currentTime);return this.followingBufferedFrag(h)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),k}(B.default)},"./src/controller/subtitle-stream-controller.ts":function(he,J,D){"use strict";D.r(J),D.d(J,"SubtitleStreamController",function(){return l});var Q=D("./src/events.ts"),B=D("./src/utils/logger.ts"),_=D("./src/utils/buffer-helper.ts"),G=D("./src/controller/fragment-finders.ts"),j=D("./src/utils/discontinuities.ts"),I=D("./src/controller/level-helper.ts"),R=D("./src/controller/fragment-tracker.ts"),v=D("./src/controller/base-stream-controller.ts"),A=D("./src/types/loader.ts"),M=D("./src/types/level.ts");function L(d,T){for(var c=0;c<T.length;c++){var p=T[c];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(d,p.key,p)}}function w(d,T,c){return T&&L(d.prototype,T),c&&L(d,c),d}function y(d,T){d.prototype=Object.create(T.prototype),d.prototype.constructor=d,u(d,T)}function u(d,T){return u=Object.setPrototypeOf||function(p,k){return p.__proto__=k,p},u(d,T)}var o=500,l=function(d){y(T,d);function T(p,k){var x;return x=d.call(this,p,k,"[subtitle-stream-controller]")||this,x.levels=[],x.currentTrackId=-1,x.tracksBuffered=[],x.mainDetails=null,x._registerListeners(),x}var c=T.prototype;return c.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},c._registerListeners=function(){var k=this.hls;k.on(Q.Events.MEDIA_ATTACHED,this.onMediaAttached,this),k.on(Q.Events.MEDIA_DETACHING,this.onMediaDetaching,this),k.on(Q.Events.MANIFEST_LOADING,this.onManifestLoading,this),k.on(Q.Events.LEVEL_LOADED,this.onLevelLoaded,this),k.on(Q.Events.ERROR,this.onError,this),k.on(Q.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),k.on(Q.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),k.on(Q.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),k.on(Q.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),k.on(Q.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},c._unregisterListeners=function(){var k=this.hls;k.off(Q.Events.MEDIA_ATTACHED,this.onMediaAttached,this),k.off(Q.Events.MEDIA_DETACHING,this.onMediaDetaching,this),k.off(Q.Events.MANIFEST_LOADING,this.onManifestLoading,this),k.off(Q.Events.LEVEL_LOADED,this.onLevelLoaded,this),k.off(Q.Events.ERROR,this.onError,this),k.off(Q.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),k.off(Q.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),k.off(Q.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),k.off(Q.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),k.off(Q.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},c.startLoad=function(){this.stopLoad(),this.state=v.State.IDLE,this.setInterval(o),this.tick()},c.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},c.onLevelLoaded=function(k,x){this.mainDetails=x.details},c.onSubtitleFragProcessed=function(k,x){var m=x.frag,g=x.success;if(this.fragPrevious=m,this.state=v.State.IDLE,!g)return;var h=this.tracksBuffered[this.currentTrackId];if(!h)return;for(var a,E=m.start,b=0;b<h.length;b++)if(E>=h[b].start&&E<=h[b].end){a=h[b];break}var S=m.start+m.duration;a?a.end=S:(a={start:E,end:S},h.push(a)),this.fragmentTracker.fragBuffered(m)},c.onBufferFlushing=function(k,x){var m=x.startOffset,g=x.endOffset;if(m===0&&g!==Number.POSITIVE_INFINITY){var h=this.currentTrackId,a=this.levels;if(!a.length||!a[h]||!a[h].details)return;var E=a[h].details,b=E.targetduration,S=g-b;if(S<=0)return;x.endOffsetSubtitles=Math.max(0,S),this.tracksBuffered.forEach(function(N){for(var U=0;U<N.length;){if(N[U].end<=S){N.shift();continue}else if(N[U].start<S)N[U].start=S;else break;U++}}),this.fragmentTracker.removeFragmentsInRange(m,S,A.PlaylistLevelType.SUBTITLE)}},c.onError=function(k,x){var m,g=x.frag;if(!g||g.type!==A.PlaylistLevelType.SUBTITLE)return;(m=this.fragCurrent)!==null&&m!==void 0&&m.loader&&this.fragCurrent.loader.abort(),this.state=v.State.IDLE},c.onSubtitleTracksUpdated=function(k,x){var m=this,g=x.subtitleTracks;this.tracksBuffered=[],this.levels=g.map(function(h){return new M.Level(h)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(h){m.tracksBuffered[h.id]=[]}),this.mediaBuffer=null},c.onSubtitleTrackSwitch=function(k,x){if(this.currentTrackId=x.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var m=this.levels[this.currentTrackId];m!=null&&m.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,m&&this.setInterval(o)},c.onSubtitleTrackLoaded=function(k,x){var m,g=x.details,h=x.id,a=this.currentTrackId,E=this.levels;if(!E.length)return;var b=E[a];if(h>=E.length||h!==a||!b)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,g.live||(m=b.details)!==null&&m!==void 0&&m.live){var S=this.mainDetails;if(g.deltaUpdateFailed||!S)return;var N=S.fragments[0];if(!b.details)g.hasProgramDateTime&&S.hasProgramDateTime?Object(j.alignMediaPlaylistByPDT)(g,S):N&&Object(I.addSliding)(g,N.start);else{var U=this.alignPlaylists(g,b.details);U===0&&N&&Object(I.addSliding)(g,N.start)}}if(b.details=g,this.levelLastLoaded=h,this.tick(),g.live&&!this.fragCurrent&&this.media&&this.state===v.State.IDLE){var K=Object(G.findFragmentByPTS)(null,g.fragments,this.media.currentTime,0);K||(this.warn("Subtitle playlist not aligned with playback"),b.details=void 0)}},c._handleFragmentLoadComplete=function(k){var x=k.frag,m=k.payload,g=x.decryptdata,h=this.hls;if(this.fragContextChanged(x))return;if(m&&m.byteLength>0&&g&&g.key&&g.iv&&g.method==="AES-128"){var a=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(m),g.key.buffer,g.iv.buffer).then(function(E){var b=performance.now();h.trigger(Q.Events.FRAG_DECRYPTED,{frag:x,payload:E,stats:{tstart:a,tdecrypt:b}})})}},c.doTick=function(){if(!this.media){this.state=v.State.IDLE;return}if(this.state===v.State.IDLE){var k,x=this.currentTrackId,m=this.levels;if(!m.length||!m[x]||!m[x].details)return;var g=m[x].details,h=g.targetduration,a=this.config,E=this.media,b=_.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,E.currentTime-h,a.maxBufferHole),S=b.end,N=b.len,U=this.getMaxBufferLength()+h;if(N>U)return;console.assert(g,"Subtitle track details are defined on idle subtitle stream controller tick");var K=g.fragments,V=K.length,O=g.edge,P,$=this.fragPrevious;if(S<O){var ee=a.maxFragLookUpTolerance;$&&g.hasProgramDateTime&&(P=Object(G.findFragmentByPDT)(K,$.endProgramDateTime,ee)),P||(P=Object(G.findFragmentByPTS)($,K,S,ee),!P&&$&&$.start<K[0].start&&(P=K[0]))}else P=K[V-1];(k=P)!==null&&k!==void 0&&k.encrypted?(B.logger.log("Loading key for "+P.sn),this.state=v.State.KEY_LOADING,this.hls.trigger(Q.Events.KEY_LOADING,{frag:P})):P&&this.fragmentTracker.getState(P)===R.FragmentState.NOT_LOADED&&this.loadFragment(P,g,S)}},c.loadFragment=function(k,x,m){this.fragCurrent=k,d.prototype.loadFragment.call(this,k,x,m)},w(T,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),T}(v.default)},"./src/controller/subtitle-track-controller.ts":function(he,J,D){"use strict";D.r(J);var Q=D("./src/events.ts"),B=D("./src/utils/texttrack-utils.ts"),_=D("./src/controller/base-playlist-controller.ts"),G=D("./src/types/loader.ts");function j(L,w){for(var y=0;y<w.length;y++){var u=w[y];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(L,u.key,u)}}function I(L,w,y){return w&&j(L.prototype,w),y&&j(L,y),L}function R(L,w){L.prototype=Object.create(w.prototype),L.prototype.constructor=L,v(L,w)}function v(L,w){return v=Object.setPrototypeOf||function(u,o){return u.__proto__=o,u},v(L,w)}var A=function(L){R(w,L);function w(u){var o;return o=L.call(this,u,"[subtitle-track-controller]")||this,o.media=null,o.tracks=[],o.groupId=null,o.tracksInGroup=[],o.trackId=-1,o.selectDefaultTrack=!0,o.queuedDefaultTrack=-1,o.trackChangeListener=function(){return o.onTextTracksChanged()},o.asyncPollTrackChange=function(){return o.pollTrackChange(0)},o.useTextTrackPolling=!1,o.subtitlePollingInterval=-1,o.subtitleDisplay=!0,o.registerListeners(),o}var y=w.prototype;return y.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,L.prototype.destroy.call(this)},y.registerListeners=function(){var o=this.hls;o.on(Q.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(Q.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(Q.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(Q.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(Q.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(Q.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.on(Q.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.on(Q.Events.ERROR,this.onError,this)},y.unregisterListeners=function(){var o=this.hls;o.off(Q.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(Q.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(Q.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(Q.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(Q.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(Q.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.off(Q.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.off(Q.Events.ERROR,this.onError,this)},y.onMediaAttached=function(o,l){if(this.media=l.media,!this.media)return;this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange)},y.pollTrackChange=function(o){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,o)},y.onMediaDetaching=function(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId);var o=M(this.media.textTracks);o.forEach(function(l){Object(B.clearCurrentCues)(l)}),this.subtitleTrack=-1,this.media=null},y.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},y.onManifestParsed=function(o,l){this.tracks=l.subtitleTracks},y.onSubtitleTrackLoaded=function(o,l){var d=l.id,T=l.details,c=this.trackId,p=this.tracksInGroup[c];if(!p){this.warn("Invalid subtitle track id "+d);return}var k=p.details;p.details=l.details,this.log("subtitle track "+d+" loaded ["+T.startSN+"-"+T.endSN+"]"),d===this.trackId&&(this.retryCount=0,this.playlistLoaded(d,l,k))},y.onLevelLoading=function(o,l){this.switchLevel(l.level)},y.onLevelSwitching=function(o,l){this.switchLevel(l.level)},y.switchLevel=function(o){var l=this.hls.levels[o];if(!(l!=null&&l.textGroupIds))return;var d=l.textGroupIds[l.urlId];if(this.groupId!==d){var T=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,c=this.tracks.filter(function(x){return!d||x.groupId===d});this.tracksInGroup=c;var p=this.findTrackId(T==null?void 0:T.name)||this.findTrackId();this.groupId=d;var k={subtitleTracks:c};this.log("Updating subtitle tracks, "+c.length+' track(s) found in "'+d+'" group-id'),this.hls.trigger(Q.Events.SUBTITLE_TRACKS_UPDATED,k),p!==-1&&this.setSubtitleTrack(p,T)}},y.findTrackId=function(o){for(var l=this.tracksInGroup,d=0;d<l.length;d++){var T=l[d];if((!this.selectDefaultTrack||T.default)&&(!o||o===T.name))return T.id}return-1},y.onError=function(o,l){if(L.prototype.onError.call(this,o,l),l.fatal||!l.context)return;l.context.type===G.PlaylistContextType.SUBTITLE_TRACK&&l.context.id===this.trackId&&l.context.groupId===this.groupId&&this.retryLoadingOrFail(l)},y.loadPlaylist=function(o){var l=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(l)){var d=l.id,T=l.groupId,c=l.url;if(o)try{c=o.addDirectives(c)}catch(p){this.warn("Could not construct new URL with HLS Delivery Directives: "+p)}this.log("Loading subtitle playlist for id "+d),this.hls.trigger(Q.Events.SUBTITLE_TRACK_LOADING,{url:c,id:d,groupId:T,deliveryDirectives:o||null})}},y.toggleTrackModes=function(o){var l=this,d=this.media,T=this.subtitleDisplay,c=this.trackId;if(!d)return;var p=M(d.textTracks),k=p.filter(function(g){return g.groupId===l.groupId});if(o===-1)[].slice.call(p).forEach(function(g){g.mode="disabled"});else{var x=k[c];x&&(x.mode="disabled")}var m=k[o];m&&(m.mode=T?"showing":"hidden")},y.setSubtitleTrack=function(o,l){var d,T=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=o;return}if(this.trackId!==o&&this.toggleTrackModes(o),this.trackId===o&&(o===-1||(d=T[o])!==null&&d!==void 0&&d.details)||o<-1||o>=T.length)return;this.clearTimer();var c=T[o];if(this.log("Switching to subtitle track "+o),this.trackId=o,c){var p=c.id,k=c.groupId,x=k===void 0?"":k,m=c.name,g=c.type,h=c.url;this.hls.trigger(Q.Events.SUBTITLE_TRACK_SWITCH,{id:p,groupId:x,name:m,type:g,url:h});var a=this.switchParams(c.url,l==null?void 0:l.details);this.loadPlaylist(a)}else this.hls.trigger(Q.Events.SUBTITLE_TRACK_SWITCH,{id:o})},y.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var o=-1,l=M(this.media.textTracks),d=0;d<l.length;d++)if(l[d].mode==="hidden")o=d;else if(l[d].mode==="showing"){o=d;break}this.subtitleTrack!==o&&(this.subtitleTrack=o)},I(w,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(o){this.selectDefaultTrack=!1;var l=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(o,l)}}]),w}(_.default);function M(L){for(var w=[],y=0;y<L.length;y++){var u=L[y];u.kind==="subtitles"&&u.label&&w.push(L[y])}return w}J.default=A},"./src/controller/timeline-controller.ts":function(he,J,D){"use strict";D.r(J),D.d(J,"TimelineController",function(){return M});var Q=D("./src/polyfills/number.ts"),B=D("./src/events.ts"),_=D("./src/utils/cea-608-parser.ts"),G=D("./src/utils/output-filter.ts"),j=D("./src/utils/webvtt-parser.ts"),I=D("./src/utils/texttrack-utils.ts"),R=D("./src/utils/imsc1-ttml-parser.ts"),v=D("./src/types/loader.ts"),A=D("./src/utils/logger.ts"),M=function(){function u(l){if(this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.timescale=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=y(),this.captionsProperties=void 0,this.hls=l,this.config=l.config,this.Cues=l.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},this.config.enableCEA708Captions){var d=new G.default(this,"textTrack1"),T=new G.default(this,"textTrack2"),c=new G.default(this,"textTrack3"),p=new G.default(this,"textTrack4");this.cea608Parser1=new _.default(1,d,T),this.cea608Parser2=new _.default(3,c,p)}l.on(B.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),l.on(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.on(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.on(B.Events.MANIFEST_LOADED,this.onManifestLoaded,this),l.on(B.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),l.on(B.Events.FRAG_LOADING,this.onFragLoading,this),l.on(B.Events.FRAG_LOADED,this.onFragLoaded,this),l.on(B.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),l.on(B.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),l.on(B.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),l.on(B.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),l.on(B.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var o=u.prototype;return o.destroy=function(){var d=this.hls;d.off(B.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),d.off(B.Events.MEDIA_DETACHING,this.onMediaDetaching,this),d.off(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.off(B.Events.MANIFEST_LOADED,this.onManifestLoaded,this),d.off(B.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),d.off(B.Events.FRAG_LOADING,this.onFragLoading,this),d.off(B.Events.FRAG_LOADED,this.onFragLoaded,this),d.off(B.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),d.off(B.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),d.off(B.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),d.off(B.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),d.off(B.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},o.addCues=function(d,T,c,p,k){for(var x=!1,m=k.length;m--;){var g=k[m],h=w(g[0],g[1],T,c);if(h>=0&&(g[0]=Math.min(g[0],T),g[1]=Math.max(g[1],c),x=!0,h/(c-T)>.5))return}if(x||k.push([T,c]),this.config.renderTextTracksNatively){var a=this.captionsTracks[d];this.Cues.newCue(a,T,c,p)}else{var E=this.Cues.newCue(null,T,c,p);this.hls.trigger(B.Events.CUES_PARSED,{type:"captions",cues:E,track:d})}},o.onInitPtsFound=function(d,T){var c=this,p=T.frag,k=T.id,x=T.initPTS,m=T.timescale,g=this.unparsedVttFrags;k==="main"&&(this.initPTS[p.cc]=x,this.timescale[p.cc]=m),g.length&&(this.unparsedVttFrags=[],g.forEach(function(h){c.onFragLoaded(B.Events.FRAG_LOADED,h)}))},o.getExistingTrack=function(d){var T=this.media;if(T)for(var c=0;c<T.textTracks.length;c++){var p=T.textTracks[c];if(p[d])return p}return null},o.createCaptionsTrack=function(d){this.config.renderTextTracksNatively?this.createNativeTrack(d):this.createNonNativeTrack(d)},o.createNativeTrack=function(d){if(this.captionsTracks[d])return;var T=this.captionsProperties,c=this.captionsTracks,p=this.media,k=T[d],x=k.label,m=k.languageCode,g=this.getExistingTrack(d);if(g)c[d]=g,Object(I.clearCurrentCues)(c[d]),Object(I.sendAddTrackEvent)(c[d],p);else{var h=this.createTextTrack("captions",x,m);h&&(h[d]=!0,c[d]=h)}},o.createNonNativeTrack=function(d){if(this.nonNativeCaptionsTracks[d])return;var T=this.captionsProperties[d];if(!T)return;var c=T.label,p={_id:d,label:c,kind:"captions",default:T.media?!!T.media.default:!1,closedCaptions:T.media};this.nonNativeCaptionsTracks[d]=p,this.hls.trigger(B.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[p]})},o.createTextTrack=function(d,T,c){var p=this.media;return p?p.addTextTrack(d,T,c):void 0},o.onMediaAttaching=function(d,T){this.media=T.media,this._cleanTracks()},o.onMediaDetaching=function(){var d=this.captionsTracks;Object.keys(d).forEach(function(T){Object(I.clearCurrentCues)(d[T]),delete d[T]}),this.nonNativeCaptionsTracks={}},o.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=y(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.timescale=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},o._cleanTracks=function(){var d=this.media;if(!d)return;var T=d.textTracks;if(T)for(var c=0;c<T.length;c++)Object(I.clearCurrentCues)(T[c])},o.onSubtitleTracksUpdated=function(d,T){var c=this;this.textTracks=[];var p=T.subtitleTracks||[],k=p.some(function(h){return h.textCodec===R.IMSC1_CODEC});if(this.config.enableWebVTT||k&&this.config.enableIMSC1){var x=this.tracks&&p&&this.tracks.length===p.length;if(this.tracks=p||[],this.config.renderTextTracksNatively){var m=this.media?this.media.textTracks:[];this.tracks.forEach(function(h,a){var E;if(a<m.length){for(var b=null,S=0;S<m.length;S++)if(L(m[S],h)){b=m[S];break}b&&(E=b)}E?Object(I.clearCurrentCues)(E):(E=c.createTextTrack("subtitles",h.name,h.lang),E&&(E.mode="disabled")),E&&(E.groupId=h.groupId,c.textTracks.push(E))})}else if(!x&&this.tracks&&this.tracks.length){var g=this.tracks.map(function(h){return{label:h.name,kind:h.type.toLowerCase(),default:h.default,subtitleTrack:h}});this.hls.trigger(B.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:g})}}},o.onManifestLoaded=function(d,T){var c=this;this.config.enableCEA708Captions&&T.captions&&T.captions.forEach(function(p){var k=/(?:CC|SERVICE)([1-4])/.exec(p.instreamId);if(!k)return;var x="textTrack"+k[1],m=c.captionsProperties[x];if(!m)return;m.label=p.name,p.lang&&(m.languageCode=p.lang),m.media=p})},o.onFragLoading=function(d,T){var c=this.cea608Parser1,p=this.cea608Parser2,k=this.lastSn,x=this.lastPartIndex;if(!this.enabled||!(c&&p))return;if(T.frag.type===v.PlaylistLevelType.MAIN){var m,g,h=T.frag.sn,a=(m=T==null||((g=T.part)===null||g===void 0)?void 0:g.index)!=null?m:-1;h===k+1||h===k&&a===x+1||(c.reset(),p.reset()),this.lastSn=h,this.lastPartIndex=a}},o.onFragLoaded=function(d,T){var c=T.frag,p=T.payload,k=this.initPTS,x=this.unparsedVttFrags;if(c.type===v.PlaylistLevelType.SUBTITLE)if(p.byteLength){if(!Object(Q.isFiniteNumber)(k[c.cc])){x.push(T),k.length&&this.hls.trigger(B.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:c,error:new Error("Missing initial subtitle PTS")});return}var m=c.decryptdata;if(m==null||m.key==null||m.method!=="AES-128"){var g=this.tracks[c.level],h=this.vttCCs;h[c.cc]||(h[c.cc]={start:c.start,prevCC:this.prevCC,new:!0},this.prevCC=c.cc),g&&g.textCodec===R.IMSC1_CODEC?this._parseIMSC1(c,p):this._parseVTTs(c,p,h)}}else this.hls.trigger(B.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:c,error:new Error("Empty subtitle payload")})},o._parseIMSC1=function(d,T){var c=this,p=this.hls;Object(R.parseIMSC1)(T,this.initPTS[d.cc],this.timescale[d.cc],function(k){c._appendCues(k,d.level),p.trigger(B.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:d})},function(k){A.logger.log("Failed to parse IMSC1: "+k),p.trigger(B.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:d,error:k})})},o._parseVTTs=function(d,T,c){var p=this,k=this.hls;Object(j.parseWebVTT)(T,this.initPTS[d.cc],this.timescale[d.cc],c,d.cc,d.start,function(x){p._appendCues(x,d.level),k.trigger(B.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:d})},function(x){p._fallbackToIMSC1(d,T),A.logger.log("Failed to parse VTT cue: "+x),k.trigger(B.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:d,error:x})})},o._fallbackToIMSC1=function(d,T){var c=this,p=this.tracks[d.level];p.textCodec||Object(R.parseIMSC1)(T,this.initPTS[d.cc],this.timescale[d.cc],function(){p.textCodec=R.IMSC1_CODEC,c._parseIMSC1(d,T)},function(){p.textCodec="wvtt"})},o._appendCues=function(d,T){var c=this.hls;if(this.config.renderTextTracksNatively){var p=this.textTracks[T];if(p.mode==="disabled")return;d.forEach(function(m){return Object(I.addCueToTrack)(p,m)})}else{var k=this.tracks[T],x=k.default?"default":"subtitles"+T;c.trigger(B.Events.CUES_PARSED,{type:"subtitles",cues:d,track:x})}},o.onFragDecrypted=function(d,T){var c=T.frag;if(c.type===v.PlaylistLevelType.SUBTITLE){if(!Object(Q.isFiniteNumber)(this.initPTS[c.cc])){this.unparsedVttFrags.push(T);return}this.onFragLoaded(B.Events.FRAG_LOADED,T)}},o.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},o.onFragParsingUserdata=function(d,T){var c=this.cea608Parser1,p=this.cea608Parser2;if(!this.enabled||!(c&&p))return;for(var k=0;k<T.samples.length;k++){var x=T.samples[k].bytes;if(x){var m=this.extractCea608Data(x);c.addData(T.samples[k].pts,m[0]),p.addData(T.samples[k].pts,m[1])}}},o.onBufferFlushing=function(d,T){var c=T.startOffset,p=T.endOffset,k=T.endOffsetSubtitles,x=T.type,m=this.media;if(!m||m.currentTime<p)return;if(!x||x==="video"){var g=this.captionsTracks;Object.keys(g).forEach(function(a){return Object(I.removeCuesInRange)(g[a],c,p)})}if(this.config.renderTextTracksNatively&&(c===0&&k!==void 0)){var h=this.textTracks;Object.keys(h).forEach(function(a){return Object(I.removeCuesInRange)(h[a],c,k)})}},o.extractCea608Data=function(d){for(var T=d[0]&31,c=2,p=[[],[]],k=0;k<T;k++){var x=d[c++],m=127&d[c++],g=127&d[c++],h=(4&x)!==0,a=3&x;if(m===0&&g===0)continue;h&&((a===0||a===1)&&(p[a].push(m),p[a].push(g)))}return p},u}();function L(u,o){return u&&u.label===o.name&&!(u.textTrack1||u.textTrack2)}function w(u,o,l,d){return Math.min(o,d)-Math.max(u,l)}function y(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(he,J,D){"use strict";D.r(J),D.d(J,"default",function(){return Q});var Q=function(){function B(G,j){this.subtle=void 0,this.aesIV=void 0,this.subtle=G,this.aesIV=j}var _=B.prototype;return _.decrypt=function(j,I){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},I,j)},B}()},"./src/crypt/aes-decryptor.ts":function(he,J,D){"use strict";D.r(J),D.d(J,"removePadding",function(){return B}),D.d(J,"default",function(){return _});var Q=D("./src/utils/typed-array.ts");function B(G){var j=G.byteLength,I=j&&new DataView(G.buffer).getUint8(j-1);return I?Object(Q.sliceUint8)(G,0,j-I):G}var _=function(){function G(){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 j=G.prototype;return j.uint8ArrayToUint32Array_=function(R){for(var v=new DataView(R),A=new Uint32Array(4),M=0;M<4;M++)A[M]=v.getUint32(M*4);return A},j.initTable=function(){var R=this.sBox,v=this.invSBox,A=this.subMix,M=A[0],L=A[1],w=A[2],y=A[3],u=this.invSubMix,o=u[0],l=u[1],d=u[2],T=u[3],c=new Uint32Array(256),p=0,k=0,x=0;for(x=0;x<256;x++)x<128?c[x]=x<<1:c[x]=x<<1^283;for(x=0;x<256;x++){var m=k^k<<1^k<<2^k<<3^k<<4;m=m>>>8^m&255^99,R[p]=m,v[m]=p;var g=c[p],h=c[g],a=c[h],E=c[m]*257^m*16843008;M[p]=E<<24|E>>>8,L[p]=E<<16|E>>>16,w[p]=E<<8|E>>>24,y[p]=E,E=a*16843009^h*65537^g*257^p*16843008,o[m]=E<<24|E>>>8,l[m]=E<<16|E>>>16,d[m]=E<<8|E>>>24,T[m]=E,p?(p=g^c[c[c[a^g]]],k^=c[c[k]]):p=k=1}},j.expandKey=function(R){for(var v=this.uint8ArrayToUint32Array_(R),A=!0,M=0;M<v.length&&A;)A=v[M]===this.key[M],M++;if(A)return;this.key=v;var L=this.keySize=v.length;if(L!==4&&L!==6&&L!==8)throw new Error("Invalid aes key size="+L);var w=this.ksRows=(L+6+1)*4,y,u,o=this.keySchedule=new Uint32Array(w),l=this.invKeySchedule=new Uint32Array(w),d=this.sBox,T=this.rcon,c=this.invSubMix,p=c[0],k=c[1],x=c[2],m=c[3],g,h;for(y=0;y<w;y++){if(y<L){g=o[y]=v[y];continue}h=g,y%L===0?(h=h<<8|h>>>24,h=d[h>>>24]<<24|d[h>>>16&255]<<16|d[h>>>8&255]<<8|d[h&255],h^=T[y/L|0]<<24):L>6&&y%L===4&&(h=d[h>>>24]<<24|d[h>>>16&255]<<16|d[h>>>8&255]<<8|d[h&255]),o[y]=g=(o[y-L]^h)>>>0}for(u=0;u<w;u++)y=w-u,u&3?h=o[y]:h=o[y-4],u<4||y<=4?l[u]=h:l[u]=p[d[h>>>24]]^k[d[h>>>16&255]]^x[d[h>>>8&255]]^m[d[h&255]],l[u]=l[u]>>>0},j.networkToHostOrderSwap=function(R){return R<<24|(R&65280)<<8|(R&16711680)>>8|R>>>24},j.decrypt=function(R,v,A){for(var M=this.keySize+6,L=this.invKeySchedule,w=this.invSBox,y=this.invSubMix,u=y[0],o=y[1],l=y[2],d=y[3],T=this.uint8ArrayToUint32Array_(A),c=T[0],p=T[1],k=T[2],x=T[3],m=new Int32Array(R),g=new Int32Array(m.length),h,a,E,b,S,N,U,K,V,O,P,$,ee,oe,fe=this.networkToHostOrderSwap;v<m.length;){for(V=fe(m[v]),O=fe(m[v+1]),P=fe(m[v+2]),$=fe(m[v+3]),S=V^L[0],N=$^L[1],U=P^L[2],K=O^L[3],ee=4,oe=1;oe<M;oe++)h=u[S>>>24]^o[N>>16&255]^l[U>>8&255]^d[K&255]^L[ee],a=u[N>>>24]^o[U>>16&255]^l[K>>8&255]^d[S&255]^L[ee+1],E=u[U>>>24]^o[K>>16&255]^l[S>>8&255]^d[N&255]^L[ee+2],b=u[K>>>24]^o[S>>16&255]^l[N>>8&255]^d[U&255]^L[ee+3],S=h,N=a,U=E,K=b,ee=ee+4;h=w[S>>>24]<<24^w[N>>16&255]<<16^w[U>>8&255]<<8^w[K&255]^L[ee],a=w[N>>>24]<<24^w[U>>16&255]<<16^w[K>>8&255]<<8^w[S&255]^L[ee+1],E=w[U>>>24]<<24^w[K>>16&255]<<16^w[S>>8&255]<<8^w[N&255]^L[ee+2],b=w[K>>>24]<<24^w[S>>16&255]<<16^w[N>>8&255]<<8^w[U&255]^L[ee+3],g[v]=fe(h^c),g[v+1]=fe(b^p),g[v+2]=fe(E^k),g[v+3]=fe(a^x),c=V,p=O,k=P,x=$,v=v+4}return g.buffer},G}()},"./src/crypt/decrypter.ts":function(he,J,D){"use strict";D.r(J),D.d(J,"default",function(){return v});var Q=D("./src/crypt/aes-crypto.ts"),B=D("./src/crypt/fast-aes-key.ts"),_=D("./src/crypt/aes-decryptor.ts"),G=D("./src/utils/logger.ts"),j=D("./src/utils/mp4-tools.ts"),I=D("./src/utils/typed-array.ts"),R=16,v=function(){function A(L,w,y){var u=y===void 0?{}:y,o=u.removePKCS7Padding,l=o===void 0?!0:o;if(this.logEnabled=!0,this.observer=void 0,this.config=void 0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.observer=L,this.config=w,this.removePKCS7Padding=l,l)try{var d=self.crypto;d&&(this.subtle=d.subtle||d.webkitSubtle)}catch(T){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var M=A.prototype;return M.destroy=function(){this.observer=null},M.isSync=function(){return this.config.enableSoftwareAES},M.flush=function(){var w=this.currentResult;if(!w){this.reset();return}var y=new Uint8Array(w);return this.reset(),this.removePKCS7Padding?Object(_.removePadding)(y):y},M.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},M.decrypt=function(w,y,u,o){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(w),y,u);var l=this.flush();l&&o(l.buffer)}else this.webCryptoDecrypt(new Uint8Array(w),y,u).then(o)},M.softwareDecrypt=function(w,y,u){var o=this.currentIV,l=this.currentResult,d=this.remainderData;this.logOnce("JS AES decrypt"),d&&(w=Object(j.appendUint8Array)(d,w),this.remainderData=null);var T=this.getValidChunk(w);if(!T.length)return null;o&&(u=o);var c=this.softwareDecrypter;c||(c=this.softwareDecrypter=new _.default),c.expandKey(y);var p=l;return this.currentResult=c.decrypt(T.buffer,0,u),this.currentIV=Object(I.sliceUint8)(T,-16).buffer,p||null},M.webCryptoDecrypt=function(w,y,u){var o=this,l=this.subtle;return(this.key!==y||!this.fastAesKey)&&(this.key=y,this.fastAesKey=new B.default(l,y)),this.fastAesKey.expandKey().then(function(d){if(!l)return Promise.reject(new Error("web crypto not initialized"));var T=new Q.default(l,u);return T.decrypt(w.buffer,d)}).catch(function(d){return o.onWebCryptoError(d,w,y,u)})},M.onWebCryptoError=function(w,y,u,o){return G.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",w),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(y,u,o)},M.getValidChunk=function(w){var y=w,u=w.length-w.length%R;return u!==w.length&&(y=Object(I.sliceUint8)(w,0,u),this.remainderData=Object(I.sliceUint8)(w,u)),y},M.logOnce=function(w){if(!this.logEnabled)return;G.logger.log("[decrypter.ts]: "+w),this.logEnabled=!1},A}()},"./src/crypt/fast-aes-key.ts":function(he,J,D){"use strict";D.r(J),D.d(J,"default",function(){return Q});var Q=function(){function B(G,j){this.subtle=void 0,this.key=void 0,this.subtle=G,this.key=j}var _=B.prototype;return _.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},B}()},"./src/demux/aacdemuxer.ts":function(he,J,D){"use strict";D.r(J);var Q=D("./src/demux/base-audio-demuxer.ts"),B=D("./src/demux/adts.ts"),_=D("./src/utils/logger.ts"),G=D("./src/demux/id3.ts");function j(v,A){v.prototype=Object.create(A.prototype),v.prototype.constructor=v,I(v,A)}function I(v,A){return I=Object.setPrototypeOf||function(L,w){return L.__proto__=w,L},I(v,A)}var R=function(v){j(A,v);function A(L,w){var y;return y=v.call(this)||this,y.observer=void 0,y.config=void 0,y.observer=L,y.config=w,y}var M=A.prototype;return M.resetInitSegment=function(w,y,u){v.prototype.resetInitSegment.call(this,w,y,u),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:w,duration:u,inputTimeScale:9e4,dropped:0}},A.probe=function(w){if(!w)return!1;for(var y=G.getID3Data(w,0)||[],u=y.length,o=w.length;u<o;u++)if(B.probe(w,u))return _.logger.log("ADTS sync word found !"),!0;return!1},M.canParse=function(w,y){return B.canParse(w,y)},M.appendFrame=function(w,y,u){B.initTrackConfig(w,this.observer,y,u,w.manifestCodec);var o=B.appendFrame(w,y,u,this.initPTS,this.frameIndex);if(o&&o.missing===0)return o},A}(Q.default);R.minProbeByteLength=9,J.default=R},"./src/demux/adts.ts":function(he,J,D){"use strict";D.r(J),D.d(J,"getAudioConfig",function(){return G}),D.d(J,"isHeaderPattern",function(){return j}),D.d(J,"getHeaderLength",function(){return I}),D.d(J,"getFullFrameLength",function(){return R}),D.d(J,"canGetFrameLength",function(){return v}),D.d(J,"isHeader",function(){return A}),D.d(J,"canParse",function(){return M}),D.d(J,"probe",function(){return L}),D.d(J,"initTrackConfig",function(){return w}),D.d(J,"getFrameDuration",function(){return y}),D.d(J,"parseFrameHeader",function(){return u}),D.d(J,"appendFrame",function(){return o});var Q=D("./src/utils/logger.ts"),B=D("./src/errors.ts"),_=D("./src/events.ts");function G(l,d,T,c){var p,k,x,m,g=navigator.userAgent.toLowerCase(),h=c,a=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];p=((d[T+2]&192)>>>6)+1;var E=(d[T+2]&60)>>>2;if(E>a.length-1){l.trigger(_.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+E});return}return x=(d[T+2]&1)<<2,x|=(d[T+3]&192)>>>6,Q.logger.log("manifest codec:"+c+", ADTS type:"+p+", samplingIndex:"+E),/firefox/i.test(g)?E>=6?(p=5,m=new Array(4),k=E-3):(p=2,m=new Array(2),k=E):g.indexOf("android")!==-1?(p=2,m=new Array(2),k=E):(p=5,m=new Array(4),c&&(c.indexOf("mp4a.40.29")!==-1||c.indexOf("mp4a.40.5")!==-1)||!c&&E>=6?k=E-3:((c&&c.indexOf("mp4a.40.2")!==-1&&(E>=6&&x===1||/vivaldi/i.test(g))||!c&&x===1)&&(p=2,m=new Array(2)),k=E)),m[0]=p<<3,m[0]|=(E&14)>>1,m[1]|=(E&1)<<7,m[1]|=x<<3,p===5&&(m[1]|=(k&14)>>1,m[2]=(k&1)<<7,m[2]|=2<<2,m[3]=0),{config:m,samplerate:a[E],channelCount:x,codec:"mp4a.40."+p,manifestCodec:h}}function j(l,d){return l[d]===255&&(l[d+1]&246)===240}function I(l,d){return l[d+1]&1?7:9}function R(l,d){return(l[d+3]&3)<<11|l[d+4]<<3|(l[d+5]&224)>>>5}function v(l,d){return d+5<l.length}function A(l,d){return d+1<l.length&&j(l,d)}function M(l,d){return v(l,d)&&j(l,d)&&R(l,d)<=l.length-d}function L(l,d){if(A(l,d)){var T=I(l,d);if(d+T>=l.length)return!1;var c=R(l,d);if(c<=T)return!1;var p=d+c;return p===l.length||A(l,p)}return!1}function w(l,d,T,c,p){if(!l.samplerate){var k=G(d,T,c,p);if(!k)return;l.config=k.config,l.samplerate=k.samplerate,l.channelCount=k.channelCount,l.codec=k.codec,l.manifestCodec=k.manifestCodec,Q.logger.log("parsed codec:"+l.codec+", rate:"+k.samplerate+", channels:"+k.channelCount)}}function y(l){return 1024*9e4/l}function u(l,d,T,c,p){var k=I(l,d),x=R(l,d);if(x-=k,x>0){var m=T+c*p;return{headerLength:k,frameLength:x,stamp:m}}}function o(l,d,T,c,p){var k=y(l.samplerate),x=u(d,T,c,p,k);if(x){var m=x.frameLength,g=x.headerLength,h=x.stamp,a=g+m,E=Math.max(0,T+a-d.length),b;E?(b=new Uint8Array(a-g),b.set(d.subarray(T+g,d.length),0)):b=d.subarray(T+g,T+a);var S={unit:b,pts:h};return E||l.samples.push(S),{sample:S,length:a,missing:E}}}},"./src/demux/base-audio-demuxer.ts":function(he,J,D){"use strict";D.r(J),D.d(J,"initPTSFn",function(){return R});var Q=D("./src/polyfills/number.ts"),B=D("./src/demux/id3.ts"),_=D("./src/demux/dummy-demuxed-track.ts"),G=D("./src/utils/mp4-tools.ts"),j=D("./src/utils/typed-array.ts"),I=function(){function v(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var A=v.prototype;return A.resetInitSegment=function(L,w,y){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},A.resetTimeStamp=function(){},A.resetContiguity=function(){},A.canParse=function(L,w){return!1},A.appendFrame=function(L,w,y){},A.demux=function(L,w){this.cachedData&&(L=Object(G.appendUint8Array)(this.cachedData,L),this.cachedData=null);var y=B.getID3Data(L,0),u=y?y.length:0,o,l,d=this._audioTrack,T=this._id3Track,c=y?B.getTimeStamp(y):void 0,p=L.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=R(c,w)),y&&y.length>0&&T.samples.push({pts:this.initPTS,dts:this.initPTS,data:y}),l=this.initPTS;u<p;){if(this.canParse(L,u)){var k=this.appendFrame(d,L,u);k?(this.frameIndex++,l=k.sample.pts,u+=k.length,o=u):u=p}else B.canParse(L,u)?(y=B.getID3Data(L,u),T.samples.push({pts:l,dts:l,data:y}),u+=y.length,o=u):u++;if(u===p&&o!==p){var x=Object(j.sliceUint8)(L,o);this.cachedData?this.cachedData=Object(G.appendUint8Array)(this.cachedData,x):this.cachedData=x}}return{audioTrack:d,avcTrack:Object(_.dummyTrack)(),id3Track:T,textTrack:Object(_.dummyTrack)()}},A.demuxSampleAes=function(L,w,y){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},A.flush=function(L){var w=this.cachedData;return w&&(this.cachedData=null,this.demux(w,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(_.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(_.dummyTrack)()}},A.destroy=function(){},v}(),R=function(A,M){return Object(Q.isFiniteNumber)(A)?A*90:M*9e4};J.default=I},"./src/demux/chunk-cache.ts":function(he,J,D){"use strict";D.r(J),D.d(J,"default",function(){return Q});var Q=function(){function _(){this.chunks=[],this.dataLength=0}var G=_.prototype;return G.push=function(I){this.chunks.push(I),this.dataLength+=I.length},G.flush=function(){var I=this.chunks,R=this.dataLength,v;if(I.length)I.length===1?v=I[0]:v=B(I,R);else return new Uint8Array(0);return this.reset(),v},G.reset=function(){this.chunks.length=0,this.dataLength=0},_}();function B(_,G){for(var j=new Uint8Array(G),I=0,R=0;R<_.length;R++){var v=_[R];j.set(v,I),I+=v.length}return j}},"./src/demux/dummy-demuxed-track.ts":function(he,J,D){"use strict";D.r(J),D.d(J,"dummyTrack",function(){return Q});function Q(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(he,J,D){"use strict";D.r(J);var Q=D("./src/utils/logger.ts"),B=function(){function _(j){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=j,this.bytesAvailable=j.byteLength,this.word=0,this.bitsAvailable=0}var G=_.prototype;return G.loadWord=function(){var I=this.data,R=this.bytesAvailable,v=I.byteLength-R,A=new Uint8Array(4),M=Math.min(4,R);if(M===0)throw new Error("no bytes available");A.set(I.subarray(v,v+M)),this.word=new DataView(A.buffer).getUint32(0),this.bitsAvailable=M*8,this.bytesAvailable-=M},G.skipBits=function(I){var R;this.bitsAvailable>I?(this.word<<=I,this.bitsAvailable-=I):(I-=this.bitsAvailable,R=I>>3,I-=R>>3,this.bytesAvailable-=R,this.loadWord(),this.word<<=I,this.bitsAvailable-=I)},G.readBits=function(I){var R=Math.min(this.bitsAvailable,I),v=this.word>>>32-R;return I>32&&Q.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=R,this.bitsAvailable>0?this.word<<=R:this.bytesAvailable>0&&this.loadWord(),R=I-R,R>0&&this.bitsAvailable?v<<R|this.readBits(R):v},G.skipLZ=function(){var I;for(I=0;I<this.bitsAvailable;++I)if((this.word&2147483648>>>I)!==0)return this.word<<=I,this.bitsAvailable-=I,I;return this.loadWord(),I+this.skipLZ()},G.skipUEG=function(){this.skipBits(1+this.skipLZ())},G.skipEG=function(){this.skipBits(1+this.skipLZ())},G.readUEG=function(){var I=this.skipLZ();return this.readBits(I+1)-1},G.readEG=function(){var I=this.readUEG();return 1&I?1+I>>>1:-1*(I>>>1)},G.readBoolean=function(){return this.readBits(1)===1},G.readUByte=function(){return this.readBits(8)},G.readUShort=function(){return this.readBits(16)},G.readUInt=function(){return this.readBits(32)},G.skipScalingList=function(I){for(var R=8,v=8,A,M=0;M<I;M++)v!==0&&(A=this.readEG(),v=(R+A+256)%256),R=v===0?R:v},G.readSPS=function(){var I=0,R=0,v=0,A=0,M,L,w,y=this.readUByte.bind(this),u=this.readBits.bind(this),o=this.readUEG.bind(this),l=this.readBoolean.bind(this),d=this.skipBits.bind(this),T=this.skipEG.bind(this),c=this.skipUEG.bind(this),p=this.skipScalingList.bind(this);y();var k=y();if(u(5),d(3),y(),c(),k===100||k===110||k===122||k===244||k===44||k===83||k===86||k===118||k===128){var x=o();if(x===3&&d(1),c(),c(),d(1),l())for(L=x!==3?8:12,w=0;w<L;w++)l()&&(w<6?p(16):p(64))}c();var m=o();if(m===0)o();else if(m===1)for(d(1),T(),T(),M=o(),w=0;w<M;w++)T();c(),d(1);var g=o(),h=o(),a=u(1);a===0&&d(1),d(1),l()&&(I=o(),R=o(),v=o(),A=o());var E=[1,1];if(l()&&l()){var b=y();switch(b){case 1:E=[1,1];break;case 2:E=[12,11];break;case 3:E=[10,11];break;case 4:E=[16,11];break;case 5:E=[40,33];break;case 6:E=[24,11];break;case 7:E=[20,11];break;case 8:E=[32,11];break;case 9:E=[80,33];break;case 10:E=[18,11];break;case 11:E=[15,11];break;case 12:E=[64,33];break;case 13:E=[160,99];break;case 14:E=[4,3];break;case 15:E=[3,2];break;case 16:E=[2,1];break;case 255:{E=[y()<<8|y(),y()<<8|y()];break}}}return{width:Math.ceil((g+1)*16-I*2-R*2),height:(2-a)*(h+1)*16-(a?2:4)*(v+A),pixelRatio:E}},G.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},_}();J.default=B},"./src/demux/id3.ts":function(he,J,D){"use strict";D.r(J),D.d(J,"isHeader",function(){return Q}),D.d(J,"isFooter",function(){return B}),D.d(J,"getID3Data",function(){return _}),D.d(J,"canParse",function(){return j}),D.d(J,"getTimeStamp",function(){return I}),D.d(J,"isTimeStampFrame",function(){return R}),D.d(J,"getID3Frames",function(){return A}),D.d(J,"decodeFrame",function(){return M}),D.d(J,"utf8ArrayToStr",function(){return o}),D.d(J,"testables",function(){return l});var Q=function(p,k){return k+10<=p.length&&(p[k]===73&&p[k+1]===68&&p[k+2]===51&&(p[k+3]<255&&p[k+4]<255&&(p[k+6]<128&&p[k+7]<128&&p[k+8]<128&&p[k+9]<128)))},B=function(p,k){return k+10<=p.length&&(p[k]===51&&p[k+1]===68&&p[k+2]===73&&(p[k+3]<255&&p[k+4]<255&&(p[k+6]<128&&p[k+7]<128&&p[k+8]<128&&p[k+9]<128)))},_=function(p,k){for(var x=k,m=0;Q(p,k);){m+=10;var g=G(p,k+6);m+=g,B(p,k+10)&&(m+=10),k+=m}return m>0?p.subarray(x,x+m):void 0},G=function(p,k){var x=0;return x=(p[k]&127)<<21,x|=(p[k+1]&127)<<14,x|=(p[k+2]&127)<<7,x|=p[k+3]&127,x},j=function(p,k){return Q(p,k)&&G(p,k+6)+10<=p.length-k},I=function(p){for(var k=A(p),x=0;x<k.length;x++){var m=k[x];if(R(m))return u(m)}return},R=function(p){return p&&p.key==="PRIV"&&p.info==="com.apple.streaming.transportStreamTimestamp"},v=function(p){var k=String.fromCharCode(p[0],p[1],p[2],p[3]),x=G(p,4),m=10;return{type:k,size:x,data:p.subarray(m,m+x)}},A=function(p){for(var k=0,x=[];Q(p,k);){var m=G(p,k+6);k+=10;for(var g=k+m;k+8<g;){var h=v(p.subarray(k)),a=M(h);a&&x.push(a),k+=h.size+10}B(p,k)&&(k+=10)}return x},M=function(p){return p.type==="PRIV"?L(p):p.type[0]==="W"?y(p):w(p)},L=function(p){if(p.size<2)return;var k=o(p.data,!0),x=new Uint8Array(p.data.subarray(k.length+1));return{key:p.type,info:k,data:x.buffer}},w=function(p){if(p.size<2)return;if(p.type==="TXXX"){var k=1,x=o(p.data.subarray(k),!0);k+=x.length+1;var m=o(p.data.subarray(k));return{key:p.type,info:x,data:m}}var g=o(p.data.subarray(1));return{key:p.type,data:g}},y=function(p){if(p.type==="WXXX"){if(p.size<2)return;var k=1,x=o(p.data.subarray(k),!0);k+=x.length+1;var m=o(p.data.subarray(k));return{key:p.type,info:x,data:m}}var g=o(p.data);return{key:p.type,data:g}},u=function(p){if(p.data.byteLength===8){var k=new Uint8Array(p.data),x=k[3]&1,m=(k[4]<<23)+(k[5]<<15)+(k[6]<<7)+k[7];return m/=45,x&&(m+=4772185884e-2),Math.round(m)}return},o=function(p,k){k===void 0&&(k=!1);var x=T();if(x){var m=x.decode(p);if(k){var g=m.indexOf("\0");return g!==-1?m.substring(0,g):m}return m.replace(/\0/g,"")}for(var h=p.length,a,E,b,S="",N=0;N<h;){if(a=p[N++],a===0&&k)return S;if(a===0||a===3)continue;switch(a>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:S+=String.fromCharCode(a);break;case 12:case 13:E=p[N++],S+=String.fromCharCode((a&31)<<6|E&63);break;case 14:E=p[N++],b=p[N++],S+=String.fromCharCode((a&15)<<12|(E&63)<<6|(b&63)<<0);break;default:}}return S},l={decodeTextFrame:w},d;function T(){return!d&&typeof self.TextDecoder!="undefined"&&(d=new self.TextDecoder("utf-8")),d}},"./src/demux/mp3demuxer.ts":function(he,J,D){"use strict";D.r(J);var Q=D("./src/demux/base-audio-demuxer.ts"),B=D("./src/demux/id3.ts"),_=D("./src/utils/logger.ts"),G=D("./src/demux/mpegaudio.ts");function j(v,A){v.prototype=Object.create(A.prototype),v.prototype.constructor=v,I(v,A)}function I(v,A){return I=Object.setPrototypeOf||function(L,w){return L.__proto__=w,L},I(v,A)}var R=function(v){j(A,v);function A(){return v.apply(this,arguments)||this}var M=A.prototype;return M.resetInitSegment=function(w,y,u){v.prototype.resetInitSegment.call(this,w,y,u),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:w,duration:u,inputTimeScale:9e4,dropped:0}},A.probe=function(w){if(!w)return!1;for(var y=B.getID3Data(w,0)||[],u=y.length,o=w.length;u<o;u++)if(G.probe(w,u))return _.logger.log("MPEG Audio sync word found !"),!0;return!1},M.canParse=function(w,y){return G.canParse(w,y)},M.appendFrame=function(w,y,u){return this.initPTS===null?void 0:G.appendFrame(w,y,u,this.initPTS,this.frameIndex)},A}(Q.default);R.minProbeByteLength=4,J.default=R},"./src/demux/mp4demuxer.ts":function(he,J,D){"use strict";D.r(J);var Q=D("./src/utils/mp4-tools.ts"),B=D("./src/demux/dummy-demuxed-track.ts"),_=function(){function G(I,R){this.remainderData=null,this.config=void 0,this.config=R}var j=G.prototype;return j.resetTimeStamp=function(){},j.resetInitSegment=function(){},j.resetContiguity=function(){},G.probe=function(R){return Object(Q.findBox)({data:R,start:0,end:Math.min(R.length,16384)},["moof"]).length>0},j.demux=function(R){var v=R,A=Object(B.dummyTrack)();if(this.config.progressive){this.remainderData&&(v=Object(Q.appendUint8Array)(this.remainderData,R));var M=Object(Q.segmentValidRange)(v);this.remainderData=M.remainder,A.samples=M.valid||new Uint8Array}else A.samples=v;return{audioTrack:Object(B.dummyTrack)(),avcTrack:A,id3Track:Object(B.dummyTrack)(),textTrack:Object(B.dummyTrack)()}},j.flush=function(){var R=Object(B.dummyTrack)();return R.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(B.dummyTrack)(),avcTrack:R,id3Track:Object(B.dummyTrack)(),textTrack:Object(B.dummyTrack)()}},j.demuxSampleAes=function(R,v,A){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},j.destroy=function(){},G}();_.minProbeByteLength=1024,J.default=_},"./src/demux/mpegaudio.ts":function(he,J,D){"use strict";D.r(J),D.d(J,"appendFrame",function(){return I}),D.d(J,"parseHeader",function(){return R}),D.d(J,"isHeaderPattern",function(){return v}),D.d(J,"isHeader",function(){return A}),D.d(J,"canParse",function(){return M}),D.d(J,"probe",function(){return L});var Q=null,B=[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],_=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],G=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],j=[0,1,1,4];function I(w,y,u,o,l){if(u+24>y.length)return;var d=R(y,u);if(d&&u+d.frameLength<=y.length){var T=d.samplesPerFrame*9e4/d.sampleRate,c=o+l*T,p={unit:y.subarray(u,u+d.frameLength),pts:c,dts:c};return w.config=[],w.channelCount=d.channelCount,w.samplerate=d.sampleRate,w.samples.push(p),{sample:p,length:d.frameLength,missing:0}}}function R(w,y){var u=w[y+1]>>3&3,o=w[y+1]>>1&3,l=w[y+2]>>4&15,d=w[y+2]>>2&3;if(u!==1&&l!==0&&l!==15&&d!==3){var T=w[y+2]>>1&1,c=w[y+3]>>6,p=u===3?3-o:o===3?3:4,k=B[p*14+l-1]*1e3,x=u===3?0:u===2?1:2,m=_[x*3+d],g=c===3?1:2,h=G[u][o],a=j[o],E=h*8*a,b=Math.floor(h*k/m+T)*a;if(Q===null){var S=navigator.userAgent||"",N=S.match(/Chrome\/(\d+)/i);Q=N?parseInt(N[1]):0}var U=!!Q&&Q<=87;return U&&o===2&&k>=224e3&&c===0&&(w[y+3]=w[y+3]|128),{sampleRate:m,channelCount:g,frameLength:b,samplesPerFrame:E}}}function v(w,y){return w[y]===255&&(w[y+1]&224)===224&&(w[y+1]&6)!==0}function A(w,y){return y+1<w.length&&v(w,y)}function M(w,y){var u=4;return v(w,y)&&u<=w.length-y}function L(w,y){if(y+1<w.length&&v(w,y)){var u=4,o=R(w,y),l=u;o!=null&&o.frameLength&&(l=o.frameLength);var d=y+l;return d===w.length||A(w,d)}return!1}},"./src/demux/sample-aes.ts":function(he,J,D){"use strict";D.r(J);var Q=D("./src/crypt/decrypter.ts"),B=D("./src/demux/tsdemuxer.ts"),_=function(){function G(I,R,v){this.keyData=void 0,this.decrypter=void 0,this.keyData=v,this.decrypter=new Q.default(I,R,{removePKCS7Padding:!1})}var j=G.prototype;return j.decryptBuffer=function(R,v){this.decrypter.decrypt(R,this.keyData.key.buffer,this.keyData.iv.buffer,v)},j.decryptAacSample=function(R,v,A,M){var L=R[v].unit,w=L.subarray(16,L.length-L.length%16),y=w.buffer.slice(w.byteOffset,w.byteOffset+w.length),u=this;this.decryptBuffer(y,function(o){var l=new Uint8Array(o);L.set(l,16),M||u.decryptAacSamples(R,v+1,A)})},j.decryptAacSamples=function(R,v,A){for(;;v++){if(v>=R.length){A();return}if(R[v].unit.length<32)continue;var M=this.decrypter.isSync();if(this.decryptAacSample(R,v,A,M),!M)return}},j.getAvcEncryptedData=function(R){for(var v=Math.floor((R.length-48)/160)*16+16,A=new Int8Array(v),M=0,L=32;L<=R.length-16;L+=160,M+=16)A.set(R.subarray(L,L+16),M);return A},j.getAvcDecryptedUnit=function(R,v){for(var A=new Uint8Array(v),M=0,L=32;L<=R.length-16;L+=160,M+=16)R.set(A.subarray(M,M+16),L);return R},j.decryptAvcSample=function(R,v,A,M,L,w){var y=Object(B.discardEPB)(L.data),u=this.getAvcEncryptedData(y),o=this;this.decryptBuffer(u.buffer,function(l){L.data=o.getAvcDecryptedUnit(y,l),w||o.decryptAvcSamples(R,v,A+1,M)})},j.decryptAvcSamples=function(R,v,A,M){if(R instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;v++,A=0){if(v>=R.length){M();return}for(var L=R[v].units;!(A>=L.length);A++){var w=L[A];if(w.data.length<=48||w.type!==1&&w.type!==5)continue;var y=this.decrypter.isSync();if(this.decryptAvcSample(R,v,A,M,w,y),!y)return}}},G}();J.default=_},"./src/demux/transmuxer-interface.ts":function(he,J,D){"use strict";D.r(J),D.d(J,"default",function(){return L});var Q=D("./node_modules/webworkify-webpack/index.js"),B=D.n(Q),_=D("./src/events.ts"),G=D("./src/demux/transmuxer.ts"),j=D("./src/utils/logger.ts"),I=D("./src/errors.ts"),R=D("./src/utils/mediasource-helper.ts"),v=D("./node_modules/eventemitter3/index.js"),A=D.n(v),M=Object(R.getMediaSource)()||{isTypeSupported:function(){return!1}},L=function(){function w(u,o,l,d){var T=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=u,this.id=o,this.onTransmuxComplete=l,this.onFlush=d;var c=u.config,p=function(h,a){a=a||{},a.frag=T.frag,a.id=T.id,u.trigger(h,a)};this.observer=new v.EventEmitter,this.observer.on(_.Events.FRAG_DECRYPTED,p),this.observer.on(_.Events.ERROR,p);var k={mp4:M.isTypeSupported("video/mp4"),mpeg:M.isTypeSupported("audio/mpeg"),mp3:M.isTypeSupported('audio/mp4; codecs="mp3"')},x=navigator.vendor;if(c.enableWorker&&typeof Worker!="undefined"){j.logger.log("demuxing in webworker");var m;try{m=this.worker=Q("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),m.addEventListener("message",this.onwmsg),m.onerror=function(g){u.trigger(_.Events.ERROR,{type:I.ErrorTypes.OTHER_ERROR,details:I.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(g.message+" ("+g.filename+":"+g.lineno+")")})},m.postMessage({cmd:"init",typeSupported:k,vendor:x,id:o,config:JSON.stringify(c)})}catch(g){j.logger.warn("Error in worker:",g),j.logger.error("Error while initializing DemuxerWorker, fallback to inline"),m&&self.URL.revokeObjectURL(m.objectURL),this.transmuxer=new G.default(this.observer,k,c,x,o),this.worker=null}}else this.transmuxer=new G.default(this.observer,k,c,x,o)}var y=w.prototype;return y.destroy=function(){var o=this.worker;if(o)o.removeEventListener("message",this.onwmsg),o.terminate(),this.worker=null;else{var l=this.transmuxer;l&&(l.destroy(),this.transmuxer=null)}var d=this.observer;d&&d.removeAllListeners(),this.observer=null},y.push=function(o,l,d,T,c,p,k,x,m,g){var h=this;m.transmuxing.start=self.performance.now();var a=this.transmuxer,E=this.worker,b=p?p.start:c.start,S=c.decryptdata,N=this.frag,U=!(N&&c.cc===N.cc),K=!(N&&m.level===N.level),V=N?m.sn-N.sn:-1,O=this.part?m.part-this.part.index:1,P=!K&&(V===1||V===0&&O===1),$=self.performance.now();(K||V||c.stats.parsing.start===0)&&(c.stats.parsing.start=$),p&&(O||!P)&&(p.stats.parsing.start=$);var ee=new G.TransmuxState(U,P,x,K,b);if(!P||U){j.logger.log("[transmuxer-interface, "+c.type+"]: Starting new transmux session for sn: "+m.sn+" p: "+m.part+" level: "+m.level+" id: "+m.id+`
discontinuity: `+U+`
trackSwitch: `+K+`
contiguous: `+P+`
accurateTimeOffset: `+x+`
timeOffset: `+b);var oe=new G.TransmuxConfig(d,T,l,k,g);this.configureTransmuxer(oe)}if(this.frag=c,this.part=p,E)E.postMessage({cmd:"demux",data:o,decryptdata:S,chunkMeta:m,state:ee},o instanceof ArrayBuffer?[o]:[]);else if(a){var fe=a.push(o,S,m,ee);Object(G.isPromise)(fe)?fe.then(function(Oe){h.handleTransmuxComplete(Oe)}):this.handleTransmuxComplete(fe)}},y.flush=function(o){var l=this;o.transmuxing.start=self.performance.now();var d=this.transmuxer,T=this.worker;if(T)T.postMessage({cmd:"flush",chunkMeta:o});else if(d){var c=d.flush(o);Object(G.isPromise)(c)?c.then(function(p){l.handleFlushResult(p,o)}):this.handleFlushResult(c,o)}},y.handleFlushResult=function(o,l){var d=this;o.forEach(function(T){d.handleTransmuxComplete(T)}),this.onFlush(l)},y.onWorkerMessage=function(o){var l=o.data,d=this.hls;switch(l.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(l.data);break}case"flush":{this.onFlush(l.data);break}default:{l.data=l.data||{},l.data.frag=this.frag,l.data.id=this.id,d.trigger(l.event,l.data);break}}},y.configureTransmuxer=function(o){var l=this.worker,d=this.transmuxer;l?l.postMessage({cmd:"configure",config:o}):d&&d.configure(o)},y.handleTransmuxComplete=function(o){o.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(o)},w}()},"./src/demux/transmuxer-worker.ts":function(he,J,D){"use strict";D.r(J),D.d(J,"default",function(){return I});var Q=D("./src/demux/transmuxer.ts"),B=D("./src/events.ts"),_=D("./src/utils/logger.ts"),G=D("./node_modules/eventemitter3/index.js"),j=D.n(G);function I(L){var w=new G.EventEmitter,y=function(o,l){L.postMessage({event:o,data:l})};w.on(B.Events.FRAG_DECRYPTED,y),w.on(B.Events.ERROR,y),L.addEventListener("message",function(u){var o=u.data;switch(o.cmd){case"init":{var l=JSON.parse(o.config);L.transmuxer=new Q.default(w,o.typeSupported,l,o.vendor,o.id),Object(_.enableLogs)(l.debug),y("init",null);break}case"configure":{L.transmuxer.configure(o.config);break}case"demux":{var d=L.transmuxer.push(o.data,o.decryptdata,o.chunkMeta,o.state);Object(Q.isPromise)(d)?d.then(function(p){R(L,p)}):R(L,d);break}case"flush":{var T=o.chunkMeta,c=L.transmuxer.flush(T);Object(Q.isPromise)(c)?c.then(function(p){A(L,p,T)}):A(L,c,T);break}default:break}})}function R(L,w){if(M(w.remuxResult))return;var y=[],u=w.remuxResult,o=u.audio,l=u.video;o&&v(y,o),l&&v(y,l),L.postMessage({event:"transmuxComplete",data:w},y)}function v(L,w){w.data1&&L.push(w.data1.buffer),w.data2&&L.push(w.data2.buffer)}function A(L,w,y){w.forEach(function(u){R(L,u)}),L.postMessage({event:"flush",data:y})}function M(L){return!L.audio&&!L.video&&!L.text&&!L.id3&&!L.initSegment}},"./src/demux/transmuxer.ts":function(he,J,D){"use strict";D.r(J),D.d(J,"default",function(){return l}),D.d(J,"isPromise",function(){return c}),D.d(J,"TransmuxConfig",function(){return p}),D.d(J,"TransmuxState",function(){return k});var Q=D("./src/events.ts"),B=D("./src/errors.ts"),_=D("./src/crypt/decrypter.ts"),G=D("./src/demux/aacdemuxer.ts"),j=D("./src/demux/mp4demuxer.ts"),I=D("./src/demux/tsdemuxer.ts"),R=D("./src/demux/mp3demuxer.ts"),v=D("./src/remux/mp4-remuxer.ts"),A=D("./src/remux/passthrough-remuxer.ts"),M=D("./src/demux/chunk-cache.ts"),L=D("./src/utils/mp4-tools.ts"),w=D("./src/utils/logger.ts"),y;try{y=self.performance.now.bind(self.performance)}catch(x){w.logger.debug("Unable to use Performance API on this environment"),y=self.Date.now}var u=[{demux:I.default,remux:v.default},{demux:j.default,remux:A.default},{demux:G.default,remux:v.default},{demux:R.default,remux:v.default}],o=1024;u.forEach(function(x){var m=x.demux;o=Math.max(o,m.minProbeByteLength)});var l=function(){function x(g,h,a,E,b){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 M.default,this.observer=g,this.typeSupported=h,this.config=a,this.vendor=E,this.id=b}var m=x.prototype;return m.configure=function(h){this.transmuxConfig=h,this.decrypter&&this.decrypter.reset()},m.push=function(h,a,E,b){var S=this,N=E.transmuxing;N.executeStart=y();var U=new Uint8Array(h),K=this.cache,V=this.config,O=this.currentTransmuxState,P=this.transmuxConfig;b&&(this.currentTransmuxState=b);var $=d(U,a);if($&&$.method==="AES-128"){var ee=this.getDecrypter();if(V.enableSoftwareAES){var oe=ee.softwareDecrypt(U,$.key.buffer,$.iv.buffer);if(!oe)return N.executeEnd=y(),T(E);U=new Uint8Array(oe)}else return this.decryptionPromise=ee.webCryptoDecrypt(U,$.key.buffer,$.iv.buffer).then(function(Me){var Pe=S.push(Me,null,E);return S.decryptionPromise=null,Pe}),this.decryptionPromise}var fe=b||O,Oe=fe.contiguous,Ce=fe.discontinuity,Ae=fe.trackSwitch,Le=fe.accurateTimeOffset,be=fe.timeOffset,pe=P.audioCodec,se=P.videoCodec,te=P.defaultInitPts,ue=P.duration,ne=P.initSegmentData;if((Ce||Ae)&&this.resetInitSegment(ne,pe,se,ue),Ce&&this.resetInitialTimestamp(te),Oe||this.resetContiguity(),this.needsProbing(U,Ce,Ae)){if(K.dataLength){var Te=K.flush();U=Object(L.appendUint8Array)(Te,U)}this.configureTransmuxer(U,P)}var Re=this.transmux(U,$,be,Le,E),xe=this.currentTransmuxState;return xe.contiguous=!0,xe.discontinuity=!1,xe.trackSwitch=!1,N.executeEnd=y(),Re},m.flush=function(h){var a=this,E=h.transmuxing;E.executeStart=y();var b=this.decrypter,S=this.cache,N=this.currentTransmuxState,U=this.decryptionPromise;if(U)return U.then(function(){return a.flush(h)});var K=[],V=N.timeOffset;if(b){var O=b.flush();O&&K.push(this.push(O,null,h))}var P=S.dataLength;S.reset();var $=this.demuxer,ee=this.remuxer;if(!$||!ee)return P>=o&&this.observer.emit(Q.Events.ERROR,Q.Events.ERROR,{type:B.ErrorTypes.MEDIA_ERROR,details:B.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),E.executeEnd=y(),[T(h)];var oe=$.flush(V);return c(oe)?oe.then(function(fe){return a.flushRemux(K,fe,h),K}):(this.flushRemux(K,oe,h),K)},m.flushRemux=function(h,a,E){var b=a.audioTrack,S=a.avcTrack,N=a.id3Track,U=a.textTrack,K=this.currentTransmuxState,V=K.accurateTimeOffset,O=K.timeOffset;w.logger.log("[transmuxer.ts]: Flushed fragment "+E.sn+(E.part>-1?" p: "+E.part:"")+" of level "+E.level);var P=this.remuxer.remux(b,S,N,U,O,V,!0,this.id);h.push({remuxResult:P,chunkMeta:E}),E.transmuxing.executeEnd=y()},m.resetInitialTimestamp=function(h){var a=this.demuxer,E=this.remuxer;if(!a||!E)return;a.resetTimeStamp(h),E.resetTimeStamp(h)},m.resetContiguity=function(){var h=this.demuxer,a=this.remuxer;if(!h||!a)return;h.resetContiguity(),a.resetNextTimestamp()},m.resetInitSegment=function(h,a,E,b){var S=this.demuxer,N=this.remuxer;if(!S||!N)return;S.resetInitSegment(a,E,b),N.resetInitSegment(h,a,E)},m.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},m.transmux=function(h,a,E,b,S){var N;return a&&a.method==="SAMPLE-AES"?N=this.transmuxSampleAes(h,a,E,b,S):N=this.transmuxUnencrypted(h,E,b,S),N},m.transmuxUnencrypted=function(h,a,E,b){var S=this.demuxer.demux(h,a,!1,!this.config.progressive),N=S.audioTrack,U=S.avcTrack,K=S.id3Track,V=S.textTrack,O=this.remuxer.remux(N,U,K,V,a,E,!1,this.id);return{remuxResult:O,chunkMeta:b}},m.transmuxSampleAes=function(h,a,E,b,S){var N=this;return this.demuxer.demuxSampleAes(h,a,E).then(function(U){var K=N.remuxer.remux(U.audioTrack,U.avcTrack,U.id3Track,U.textTrack,E,b,!1,N.id);return{remuxResult:K,chunkMeta:S}})},m.configureTransmuxer=function(h,a){for(var E=this.config,b=this.observer,S=this.typeSupported,N=this.vendor,U=a.audioCodec,K=a.defaultInitPts,V=a.duration,O=a.initSegmentData,P=a.videoCodec,$,ee=0,oe=u.length;ee<oe;ee++)if(u[ee].demux.probe(h)){$=u[ee];break}$||(w.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),$={demux:j.default,remux:A.default});var fe=this.demuxer,Oe=this.remuxer,Ce=$.remux,Ae=$.demux;(!Oe||!(Oe instanceof Ce))&&(this.remuxer=new Ce(b,E,S,N)),(!fe||!(fe instanceof Ae))&&(this.demuxer=new Ae(b,E,S),this.probe=Ae.probe),this.resetInitSegment(O,U,P,V),this.resetInitialTimestamp(K)},m.needsProbing=function(h,a,E){return!this.demuxer||!this.remuxer||a||E},m.getDecrypter=function(){var h=this.decrypter;return h||(h=this.decrypter=new _.default(this.observer,this.config)),h},x}();function d(x,m){var g=null;return x.byteLength>0&&m!=null&&m.key!=null&&m.iv!==null&&m.method!=null&&(g=m),g}var T=function(m){return{remuxResult:{},chunkMeta:m}};function c(x){return"then"in x&&x.then instanceof Function}var p=function(m,g,h,a,E){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=m,this.videoCodec=g,this.initSegmentData=h,this.duration=a,this.defaultInitPts=E},k=function(m,g,h,a,E){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=m,this.contiguous=g,this.accurateTimeOffset=h,this.trackSwitch=a,this.timeOffset=E}},"./src/demux/tsdemuxer.ts":function(he,J,D){"use strict";D.r(J),D.d(J,"discardEPB",function(){return T});var Q=D("./src/demux/adts.ts"),B=D("./src/demux/mpegaudio.ts"),_=D("./src/demux/exp-golomb.ts"),G=D("./src/demux/id3.ts"),j=D("./src/demux/sample-aes.ts"),I=D("./src/events.ts"),R=D("./src/utils/mp4-tools.ts"),v=D("./src/utils/logger.ts"),A=D("./src/errors.ts"),M={video:1,audio:2,id3:3,text:4},L=function(){function c(k,x,m){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this.aacLastPTS=null,this._initPTS=null,this._initDTS=null,this._pmtId=-1,this._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=k,this.config=x,this.typeSupported=m}c.probe=function(x){var m=c.syncOffset(x);return m<0?!1:(m&&v.logger.warn("MPEG2-TS detected but first sync word found @ offset "+m+", junk ahead ?"),!0)},c.syncOffset=function(x){for(var m=Math.min(1e3,x.length-3*188),g=0;g<m;){if(x[g]===71&&x[g+188]===71&&x[g+2*188]===71)return g;g++}return-1},c.createTrack=function(x,m){return{container:x==="video"||x==="audio"?"video/mp2t":void 0,type:x,id:M[x],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:x==="audio"?m:void 0}};var p=c.prototype;return p.resetInitSegment=function(x,m,g){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=c.createTrack("video",g),this._audioTrack=c.createTrack("audio",g),this._id3Track=c.createTrack("id3",g),this._txtTrack=c.createTrack("text",g),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=x,this.videoCodec=m,this._duration=g},p.resetTimeStamp=function(){},p.resetContiguity=function(){var x=this._audioTrack,m=this._avcTrack,g=this._id3Track;x&&(x.pesData=null),m&&(m.pesData=null),g&&(g.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},p.demux=function(x,m,g,h){g===void 0&&(g=!1),h===void 0&&(h=!1),g||(this.sampleAes=null);var a,E=this._avcTrack,b=this._audioTrack,S=this._id3Track,N=E.pid,U=E.pesData,K=b.pid,V=S.pid,O=b.pesData,P=S.pesData,$=!1,ee=this.pmtParsed,oe=this._pmtId,fe=x.length;if(this.remainderData&&(x=Object(R.appendUint8Array)(this.remainderData,x),fe=x.length,this.remainderData=null),fe<188&&!h)return this.remainderData=x,{audioTrack:b,avcTrack:E,id3Track:S,textTrack:this._txtTrack};var Oe=Math.max(0,c.syncOffset(x));fe-=(fe+Oe)%188,fe<x.byteLength&&!h&&(this.remainderData=new Uint8Array(x.buffer,fe,x.buffer.byteLength-fe));for(var Ce=Oe;Ce<fe;Ce+=188)if(x[Ce]===71){var Ae=!!(x[Ce+1]&64),Le=((x[Ce+1]&31)<<8)+x[Ce+2],be=(x[Ce+3]&48)>>4,pe=void 0;if(be>1){if(pe=Ce+5+x[Ce+4],pe===Ce+188)continue}else pe=Ce+4;switch(Le){case N:Ae&&(U&&(a=o(U))&&this.parseAVCPES(a,!1),U={data:[],size:0}),U&&(U.data.push(x.subarray(pe,Ce+188)),U.size+=Ce+188-pe);break;case K:Ae&&(O&&(a=o(O))&&(b.isAAC?this.parseAACPES(a):this.parseMPEGPES(a)),O={data:[],size:0}),O&&(O.data.push(x.subarray(pe,Ce+188)),O.size+=Ce+188-pe);break;case V:Ae&&(P&&(a=o(P))&&this.parseID3PES(a),P={data:[],size:0}),P&&(P.data.push(x.subarray(pe,Ce+188)),P.size+=Ce+188-pe);break;case 0:Ae&&(pe+=x[pe]+1),oe=this._pmtId=y(x,pe);break;case oe:{Ae&&(pe+=x[pe]+1);var se=u(x,pe,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,g);N=se.avc,N>0&&(E.pid=N),K=se.audio,K>0&&(b.pid=K,b.isAAC=se.isAAC),V=se.id3,V>0&&(S.pid=V),$&&!ee&&(v.logger.log("reparse from beginning"),$=!1,Ce=Oe-188),ee=this.pmtParsed=!0;break}case 17:case 8191:break;default:$=!0;break}}else this.observer.emit(I.Events.ERROR,I.Events.ERROR,{type:A.ErrorTypes.MEDIA_ERROR,details:A.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});E.pesData=U,b.pesData=O,S.pesData=P;var te={audioTrack:b,avcTrack:E,id3Track:S,textTrack:this._txtTrack};return h&&this.extractRemainingSamples(te),te},p.flush=function(){var x=this.remainderData;this.remainderData=null;var m;return x?m=this.demux(x,-1,!1,!0):m={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(m),this.sampleAes?this.decrypt(m,this.sampleAes):m},p.extractRemainingSamples=function(x){var m=x.audioTrack,g=x.avcTrack,h=x.id3Track,a=g.pesData,E=m.pesData,b=h.pesData,S;a&&(S=o(a))?(this.parseAVCPES(S,!0),g.pesData=null):g.pesData=a,E&&(S=o(E))?(m.isAAC?this.parseAACPES(S):this.parseMPEGPES(S),m.pesData=null):(E!=null&&E.size&&v.logger.log("last AAC PES packet truncated,might overlap between fragments"),m.pesData=E),b&&(S=o(b))?(this.parseID3PES(S),h.pesData=null):h.pesData=b},p.demuxSampleAes=function(x,m,g){var h=this.demux(x,g,!0,!this.config.progressive),a=this.sampleAes=new j.default(this.observer,this.config,m);return this.decrypt(h,a)},p.decrypt=function(x,m){return new Promise(function(g){var h=x.audioTrack,a=x.avcTrack;h.samples&&h.isAAC?m.decryptAacSamples(h.samples,0,function(){a.samples?m.decryptAvcSamples(a.samples,0,0,function(){g(x)}):g(x)}):a.samples&&m.decryptAvcSamples(a.samples,0,0,function(){g(x)})})},p.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},p.parseAVCPES=function(x,m){var g=this,h=this._avcTrack,a=this.parseAVCNALu(x.data),E=!1,b=this.avcSample,S,N=!1;x.data=null,b&&a.length&&!h.audFound&&(l(b,h),b=this.avcSample=w(!1,x.pts,x.dts,"")),a.forEach(function(U){switch(U.type){case 1:{S=!0,b||(b=g.avcSample=w(!0,x.pts,x.dts,"")),E&&(b.debug+="NDR "),b.frame=!0;var K=U.data;if(N&&K.length>4){var V=new _.default(K).readSliceType();(V===2||V===4||V===7||V===9)&&(b.key=!0)}break}case 5:S=!0,b||(b=g.avcSample=w(!0,x.pts,x.dts,"")),E&&(b.debug+="IDR "),b.key=!0,b.frame=!0;break;case 6:{S=!0,E&&b&&(b.debug+="SEI ");var O=new _.default(T(U.data));O.readUByte();for(var P=0,$=0,ee=!1,oe=0;!ee&&O.bytesAvailable>1;){P=0;do oe=O.readUByte(),P+=oe;while(oe===255);$=0;do oe=O.readUByte(),$+=oe;while(oe===255);if(P===4&&O.bytesAvailable!==0){ee=!0;var fe=O.readUByte();if(fe===181){var Oe=O.readUShort();if(Oe===49){var Ce=O.readUInt();if(Ce===1195456820){var Ae=O.readUByte();if(Ae===3){for(var Le=O.readUByte(),be=O.readUByte(),pe=31&Le,se=[Le,be],te=0;te<pe;te++)se.push(O.readUByte()),se.push(O.readUByte()),se.push(O.readUByte());d(g._txtTrack.samples,{type:3,pts:x.pts,bytes:se})}}}}}else if(P===5&&O.bytesAvailable!==0){if(ee=!0,$>16){for(var ue=[],ne=0;ne<16;ne++)ue.push(O.readUByte().toString(16)),(ne===3||ne===5||ne===7||ne===9)&&ue.push("-");for(var Te=$-16,Re=new Uint8Array(Te),xe=0;xe<Te;xe++)Re[xe]=O.readUByte();d(g._txtTrack.samples,{pts:x.pts,payloadType:P,uuid:ue.join(""),userData:Object(G.utf8ArrayToStr)(Re),userDataBytes:Re})}}else if($<O.bytesAvailable)for(var Me=0;Me<$;Me++)O.readUByte()}break}case 7:if(S=!0,N=!0,E&&b&&(b.debug+="SPS "),!h.sps){var Pe=new _.default(U.data),je=Pe.readSPS();h.width=je.width,h.height=je.height,h.pixelRatio=je.pixelRatio,h.sps=[U.data],h.duration=g._duration;for(var Ue=U.data.subarray(1,4),Ne="avc1.",Ie=0;Ie<3;Ie++){var Qe=Ue[Ie].toString(16);Qe.length<2&&(Qe="0"+Qe),Ne+=Qe}h.codec=Ne}break;case 8:S=!0,E&&b&&(b.debug+="PPS "),h.pps||(h.pps=[U.data]);break;case 9:S=!1,h.audFound=!0,b&&l(b,h),b=g.avcSample=w(!1,x.pts,x.dts,E?"AUD ":"");break;case 12:S=!1;break;default:S=!1,b&&(b.debug+="unknown NAL "+U.type+" ");break}if(b&&S){var rt=b.units;rt.push(U)}}),m&&b&&(l(b,h),this.avcSample=null)},p.getLastNalUnit=function(){var x,m=this.avcSample,g;if(!m||m.units.length===0){var h=this._avcTrack.samples;m=h[h.length-1]}if((x=m)!==null&&x!==void 0&&x.units){var a=m.units;g=a[a.length-1]}return g},p.parseAVCNALu=function(x){var m=x.byteLength,g=this._avcTrack,h=g.naluState||0,a=h,E=[],b=0,S,N,U,K=-1,V=0;for(h===-1&&(K=0,V=x[0]&31,h=0,b=1);b<m;){if(S=x[b++],!h){h=S?0:1;continue}if(h===1){h=S?0:2;continue}if(!S)h=3;else if(S===1){if(K>=0){var O={data:x.subarray(K,b-h-1),type:V};E.push(O)}else{var P=this.getLastNalUnit();if(P&&(a&&b<=4-a&&(P.state&&(P.data=P.data.subarray(0,P.data.byteLength-a))),N=b-h-1,N>0)){var $=new Uint8Array(P.data.byteLength+N);$.set(P.data,0),$.set(x.subarray(0,N),P.data.byteLength),P.data=$,P.state=0}}b<m?(U=x[b]&31,K=b,V=U,h=0):h=-1}else h=0}if(K>=0&&h>=0){var ee={data:x.subarray(K,m),type:V,state:h};E.push(ee)}if(E.length===0){var oe=this.getLastNalUnit();if(oe){var fe=new Uint8Array(oe.data.byteLength+x.byteLength);fe.set(oe.data,0),fe.set(x,oe.data.byteLength),oe.data=fe}}return g.naluState=h,E},p.parseAACPES=function(x){var m=0,g=this._audioTrack,h=this.aacOverFlow,a=x.data;if(h){this.aacOverFlow=null;var E=h.sample.unit.byteLength,b=Math.min(h.missing,E),S=E-b;h.sample.unit.set(a.subarray(0,b),S),g.samples.push(h.sample),m=h.missing}var N,U;for(N=m,U=a.length;N<U-1&&!Q.isHeader(a,N);N++);if(N!==m){var K,V;if(N<U-1?(K="AAC PES did not start with ADTS header,offset:"+N,V=!1):(K="no ADTS header found in AAC PES",V=!0),v.logger.warn("parsing error:"+K),this.observer.emit(I.Events.ERROR,I.Events.ERROR,{type:A.ErrorTypes.MEDIA_ERROR,details:A.ErrorDetails.FRAG_PARSING_ERROR,fatal:V,reason:K}),V)return}Q.initTrackConfig(g,this.observer,a,N,this.audioCodec);var O;if(x.pts!==void 0)O=x.pts;else if(h){var P=Q.getFrameDuration(g.samplerate);O=h.sample.pts+P}else{v.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var $=0;N<U;)if(Q.isHeader(a,N)){if(N+5<U){var ee=Q.appendFrame(g,a,N,O,$);if(ee)if(ee.missing)this.aacOverFlow=ee;else{N+=ee.length,$++;continue}}break}else N++},p.parseMPEGPES=function(x){var m=x.data,g=m.length,h=0,a=0,E=x.pts;if(E===void 0){v.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;a<g;)if(B.isHeader(m,a)){var b=B.appendFrame(this._audioTrack,m,a,E,h);if(b)a+=b.length,h++;else break}else a++},p.parseID3PES=function(x){if(x.pts===void 0){v.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(x)},c}();L.minProbeByteLength=188;function w(c,p,k,x){return{key:c,frame:!1,pts:p,dts:k,units:[],debug:x,length:0}}function y(c,p){return(c[p+10]&31)<<8|c[p+11]}function u(c,p,k,x){var m={audio:-1,avc:-1,id3:-1,isAAC:!0},g=(c[p+1]&15)<<8|c[p+2],h=p+3+g-4,a=(c[p+10]&15)<<8|c[p+11];for(p+=12+a;p<h;){var E=(c[p+1]&31)<<8|c[p+2];switch(c[p]){case 207:if(!x){v.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:m.audio===-1&&(m.audio=E);break;case 21:m.id3===-1&&(m.id3=E);break;case 219:if(!x){v.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:m.avc===-1&&(m.avc=E);break;case 3:case 4:k?m.audio===-1&&(m.audio=E,m.isAAC=!1):v.logger.log("MPEG audio found, not supported in this browser");break;case 36:v.logger.warn("Unsupported HEVC stream type found");break;default:break}p+=((c[p+3]&15)<<8|c[p+4])+5}return m}function o(c){var p=0,k,x,m,g,h,a=c.data;if(!c||c.size===0)return null;for(;a[0].length<19&&a.length>1;){var E=new Uint8Array(a[0].length+a[1].length);E.set(a[0]),E.set(a[1],a[0].length),a[0]=E,a.splice(1,1)}k=a[0];var b=(k[0]<<16)+(k[1]<<8)+k[2];if(b===1){if(x=(k[4]<<8)+k[5],x&&x>c.size-6)return null;var S=k[7];S&192&&(g=(k[9]&14)*536870912+(k[10]&255)*4194304+(k[11]&254)*16384+(k[12]&255)*128+(k[13]&254)/2,S&64?(h=(k[14]&14)*536870912+(k[15]&255)*4194304+(k[16]&254)*16384+(k[17]&255)*128+(k[18]&254)/2,g-h>60*9e4&&(v.logger.warn(Math.round((g-h)/9e4)+"s delta between PTS and DTS, align them"),g=h)):h=g),m=k[8];var N=m+9;if(c.size<=N)return null;c.size-=N;for(var U=new Uint8Array(c.size),K=0,V=a.length;K<V;K++){k=a[K];var O=k.byteLength;if(N)if(N>O){N-=O;continue}else k=k.subarray(N),O-=N,N=0;U.set(k,p),p+=O}return x&&(x-=m+3),{data:U,pts:g,dts:h,len:x}}return null}function l(c,p){if(c.units.length&&c.frame){if(c.pts===void 0){var k=p.samples,x=k.length;if(x){var m=k[x-1];c.pts=m.pts,c.dts=m.dts}else{p.dropped++;return}}p.samples.push(c)}c.debug.length&&v.logger.log(c.pts+"/"+c.dts+":"+c.debug)}function d(c,p){var k=c.length;if(k>0){if(p.pts>=c[k-1].pts)c.push(p);else for(var x=k-1;x>=0;x--)if(p.pts<c[x].pts){c.splice(x,0,p);break}}else c.push(p)}function T(c){for(var p=c.byteLength,k=[],x=1;x<p-2;)c[x]===0&&c[x+1]===0&&c[x+2]===3?(k.push(x+2),x+=2):x++;if(k.length===0)return c;var m=p-k.length,g=new Uint8Array(m),h=0;for(x=0;x<m;h++,x++)h===k[0]&&(h++,k.shift()),g[x]=c[h];return g}J.default=L},"./src/errors.ts":function(he,J,D){"use strict";D.r(J),D.d(J,"ErrorTypes",function(){return Q}),D.d(J,"ErrorDetails",function(){return B});var Q;(function(_){_.NETWORK_ERROR="networkError",_.MEDIA_ERROR="mediaError",_.KEY_SYSTEM_ERROR="keySystemError",_.MUX_ERROR="muxError",_.OTHER_ERROR="otherError"})(Q||(Q={}));var B;(function(_){_.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",_.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",_.KEY_SYSTEM_NO_SESSION="keySystemNoSession",_.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",_.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",_.MANIFEST_LOAD_ERROR="manifestLoadError",_.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",_.MANIFEST_PARSING_ERROR="manifestParsingError",_.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",_.LEVEL_EMPTY_ERROR="levelEmptyError",_.LEVEL_LOAD_ERROR="levelLoadError",_.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",_.LEVEL_SWITCH_ERROR="levelSwitchError",_.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",_.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",_.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",_.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",_.FRAG_LOAD_ERROR="fragLoadError",_.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",_.FRAG_DECRYPT_ERROR="fragDecryptError",_.FRAG_PARSING_ERROR="fragParsingError",_.REMUX_ALLOC_ERROR="remuxAllocError",_.KEY_LOAD_ERROR="keyLoadError",_.KEY_LOAD_TIMEOUT="keyLoadTimeOut",_.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",_.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",_.BUFFER_APPEND_ERROR="bufferAppendError",_.BUFFER_APPENDING_ERROR="bufferAppendingError",_.BUFFER_STALLED_ERROR="bufferStalledError",_.BUFFER_FULL_ERROR="bufferFullError",_.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",_.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",_.INTERNAL_EXCEPTION="internalException",_.INTERNAL_ABORTED="aborted",_.UNKNOWN="unknown"})(B||(B={}))},"./src/events.ts":function(he,J,D){"use strict";D.r(J),D.d(J,"Events",function(){return Q});var Q;(function(B){B.MEDIA_ATTACHING="hlsMediaAttaching",B.MEDIA_ATTACHED="hlsMediaAttached",B.MEDIA_DETACHING="hlsMediaDetaching",B.MEDIA_DETACHED="hlsMediaDetached",B.BUFFER_RESET="hlsBufferReset",B.BUFFER_CODECS="hlsBufferCodecs",B.BUFFER_CREATED="hlsBufferCreated",B.BUFFER_APPENDING="hlsBufferAppending",B.BUFFER_APPENDED="hlsBufferAppended",B.BUFFER_EOS="hlsBufferEos",B.BUFFER_FLUSHING="hlsBufferFlushing",B.BUFFER_FLUSHED="hlsBufferFlushed",B.MANIFEST_LOADING="hlsManifestLoading",B.MANIFEST_LOADED="hlsManifestLoaded",B.MANIFEST_PARSED="hlsManifestParsed",B.LEVEL_SWITCHING="hlsLevelSwitching",B.LEVEL_SWITCHED="hlsLevelSwitched",B.LEVEL_LOADING="hlsLevelLoading",B.LEVEL_LOADED="hlsLevelLoaded",B.LEVEL_UPDATED="hlsLevelUpdated",B.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",B.LEVELS_UPDATED="hlsLevelsUpdated",B.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",B.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",B.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",B.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",B.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",B.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",B.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",B.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",B.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",B.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",B.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",B.CUES_PARSED="hlsCuesParsed",B.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",B.INIT_PTS_FOUND="hlsInitPtsFound",B.FRAG_LOADING="hlsFragLoading",B.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",B.FRAG_LOADED="hlsFragLoaded",B.FRAG_DECRYPTED="hlsFragDecrypted",B.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",B.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",B.FRAG_PARSING_METADATA="hlsFragParsingMetadata",B.FRAG_PARSED="hlsFragParsed",B.FRAG_BUFFERED="hlsFragBuffered",B.FRAG_CHANGED="hlsFragChanged",B.FPS_DROP="hlsFpsDrop",B.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",B.ERROR="hlsError",B.DESTROYING="hlsDestroying",B.KEY_LOADING="hlsKeyLoading",B.KEY_LOADED="hlsKeyLoaded",B.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",B.BACK_BUFFER_REACHED="hlsBackBufferReached"})(Q||(Q={}))},"./src/hls.ts":function(he,J,D){"use strict";D.r(J),D.d(J,"default",function(){return c});var Q=D("./node_modules/url-toolkit/src/url-toolkit.js"),B=D.n(Q),_=D("./src/loader/playlist-loader.ts"),G=D("./src/loader/key-loader.ts"),j=D("./src/controller/id3-track-controller.ts"),I=D("./src/controller/latency-controller.ts"),R=D("./src/controller/level-controller.ts"),v=D("./src/controller/fragment-tracker.ts"),A=D("./src/controller/stream-controller.ts"),M=D("./src/is-supported.ts"),L=D("./src/utils/logger.ts"),w=D("./src/config.ts"),y=D("./node_modules/eventemitter3/index.js"),u=D.n(y),o=D("./src/events.ts"),l=D("./src/errors.ts");function d(p,k){for(var x=0;x<k.length;x++){var m=k[x];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(p,m.key,m)}}function T(p,k,x){return k&&d(p.prototype,k),x&&d(p,x),p}var c=function(){p.isSupported=function(){return Object(M.isSupported)()};function p(x){x===void 0&&(x={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new y.EventEmitter,this._autoLevelCapping=void 0,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null;var m=this.config=Object(w.mergeConfig)(p.DefaultConfig,x);this.userConfig=x,Object(L.enableLogs)(m.debug),this._autoLevelCapping=-1,m.progressive&&Object(w.enableStreamingMode)(m);var g=m.abrController,h=m.bufferController,a=m.capLevelController,E=m.fpsController,b=this.abrController=new g(this),S=this.bufferController=new h(this),N=this.capLevelController=new a(this),U=new E(this),K=new _.default(this),V=new G.default(this),O=new j.default(this),P=this.levelController=new R.default(this),$=new v.FragmentTracker(this),ee=this.streamController=new A.default(this,$);N.setStreamController(ee),U.setStreamController(ee);var oe=[P,ee];this.networkControllers=oe;var fe=[K,V,b,S,N,U,O,$];this.audioTrackController=this.createController(m.audioTrackController,null,oe),this.createController(m.audioStreamController,$,oe),this.subtitleTrackController=this.createController(m.subtitleTrackController,null,oe),this.createController(m.subtitleStreamController,$,oe),this.createController(m.timelineController,null,fe),this.emeController=this.createController(m.emeController,null,fe),this.cmcdController=this.createController(m.cmcdController,null,fe),this.latencyController=this.createController(I.default,null,fe),this.coreComponents=fe}var k=p.prototype;return k.createController=function(m,g,h){if(m){var a=g?new m(this,g):new m(this);return h&&h.push(a),a}return null},k.on=function(m,g,h){h===void 0&&(h=this),this._emitter.on(m,g,h)},k.once=function(m,g,h){h===void 0&&(h=this),this._emitter.once(m,g,h)},k.removeAllListeners=function(m){this._emitter.removeAllListeners(m)},k.off=function(m,g,h,a){h===void 0&&(h=this),this._emitter.off(m,g,h,a)},k.listeners=function(m){return this._emitter.listeners(m)},k.emit=function(m,g,h){return this._emitter.emit(m,g,h)},k.trigger=function(m,g){if(this.config.debug)return this.emit(m,m,g);try{return this.emit(m,m,g)}catch(h){L.logger.error("An internal error happened while handling event "+m+'. Error message: "'+h.message+'". Here is a stacktrace:',h),this.trigger(o.Events.ERROR,{type:l.ErrorTypes.OTHER_ERROR,details:l.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:m,error:h})}return!1},k.listenerCount=function(m){return this._emitter.listenerCount(m)},k.destroy=function(){L.logger.log("destroy"),this.trigger(o.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(m){return m.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(m){return m.destroy()}),this.coreComponents.length=0},k.attachMedia=function(m){L.logger.log("attachMedia"),this._media=m,this.trigger(o.Events.MEDIA_ATTACHING,{media:m})},k.detachMedia=function(){L.logger.log("detachMedia"),this.trigger(o.Events.MEDIA_DETACHING,void 0),this._media=null},k.loadSource=function(m){this.stopLoad();var g=this.media,h=this.url,a=this.url=Q.buildAbsoluteURL(self.location.href,m,{alwaysNormalize:!0});L.logger.log("loadSource:"+a),g&&h&&h!==a&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(g)),this.trigger(o.Events.MANIFEST_LOADING,{url:m})},k.startLoad=function(m){m===void 0&&(m=-1),L.logger.log("startLoad("+m+")"),this.networkControllers.forEach(function(g){g.startLoad(m)})},k.stopLoad=function(){L.logger.log("stopLoad"),this.networkControllers.forEach(function(m){m.stopLoad()})},k.swapAudioCodec=function(){L.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},k.recoverMediaError=function(){L.logger.log("recoverMediaError");var m=this._media;this.detachMedia(),m&&this.attachMedia(m)},k.removeLevel=function(m,g){g===void 0&&(g=0),this.levelController.removeLevel(m,g)},T(p,[{key:"levels",get:function(){var m=this.levelController.levels;return m||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(m){L.logger.log("set currentLevel:"+m),this.loadLevel=m,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(m){L.logger.log("set nextLevel:"+m),this.levelController.manualLevel=m,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(m){L.logger.log("set loadLevel:"+m),this.levelController.manualLevel=m}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(m){this.levelController.nextLoadLevel=m}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(m){L.logger.log("set firstLevel:"+m),this.levelController.firstLevel=m}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(m){L.logger.log("set startLevel:"+m),m!==-1&&(m=Math.max(m,this.minAutoLevel)),this.levelController.startLevel=m}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(m){var g=!!m;g!==this.config.capLevelToPlayerSize&&(g?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=g)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(m){this._autoLevelCapping!==m&&(L.logger.log("set autoLevelCapping:"+m),this._autoLevelCapping=m)}},{key:"bandwidthEstimate",get:function(){var m=this.abrController.bwEstimator;return m?m.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var m=this.levels,g=this.config.minAutoBitrate;if(!m)return 0;for(var h=m.length,a=0;a<h;a++)if(m[a].maxBitrate>g)return a;return 0}},{key:"maxAutoLevel",get:function(){var m=this.levels,g=this.autoLevelCapping,h;return g===-1&&m&&m.length?h=m.length-1:h=g,h}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(m){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,m)}},{key:"audioTracks",get:function(){var m=this.audioTrackController;return m?m.audioTracks:[]}},{key:"audioTrack",get:function(){var m=this.audioTrackController;return m?m.audioTrack:-1},set:function(m){var g=this.audioTrackController;g&&(g.audioTrack=m)}},{key:"subtitleTracks",get:function(){var m=this.subtitleTrackController;return m?m.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var m=this.subtitleTrackController;return m?m.subtitleTrack:-1},set:function(m){var g=this.subtitleTrackController;g&&(g.subtitleTrack=m)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var m=this.subtitleTrackController;return m?m.subtitleDisplay:!1},set:function(m){var g=this.subtitleTrackController;g&&(g.subtitleDisplay=m)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(m){this.config.lowLatencyMode=m}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}],[{key:"version",get:function(){return"1.1.2"}},{key:"Events",get:function(){return o.Events}},{key:"ErrorTypes",get:function(){return l.ErrorTypes}},{key:"ErrorDetails",get:function(){return l.ErrorDetails}},{key:"DefaultConfig",get:function(){return p.defaultConfig?p.defaultConfig:w.hlsDefaultConfig},set:function(m){p.defaultConfig=m}}]),p}();c.defaultConfig=void 0},"./src/is-supported.ts":function(he,J,D){"use strict";D.r(J),D.d(J,"isSupported",function(){return _}),D.d(J,"changeTypeSupported",function(){return G});var Q=D("./src/utils/mediasource-helper.ts");function B(){return self.SourceBuffer||self.WebKitSourceBuffer}function _(){var j=Object(Q.getMediaSource)();if(!j)return!1;var I=B(),R=j&&typeof j.isTypeSupported=="function"&&j.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),v=!I||I.prototype&&typeof I.prototype.appendBuffer=="function"&&typeof I.prototype.remove=="function";return!!R&&!!v}function G(){var j,I=B();return typeof(I==null||((j=I.prototype)===null||j===void 0)?void 0:j.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(he,J,D){"use strict";D.r(J),D.d(J,"default",function(){return L}),D.d(J,"LoadError",function(){return y});var Q=D("./src/polyfills/number.ts"),B=D("./src/errors.ts");function _(u,o){u.prototype=Object.create(o.prototype),u.prototype.constructor=u,v(u,o)}function G(u){var o=typeof Map=="function"?new Map:void 0;return G=function(d){if(d===null||!R(d))return d;if(typeof d!="function")throw new TypeError("Super expression must either be null or a function");if(typeof o!="undefined"){if(o.has(d))return o.get(d);o.set(d,T)}function T(){return j(d,arguments,A(this).constructor)}return T.prototype=Object.create(d.prototype,{constructor:{value:T,enumerable:!1,writable:!0,configurable:!0}}),v(T,d)},G(u)}function j(u,o,l){return I()?j=Reflect.construct:j=function(T,c,p){var k=[null];k.push.apply(k,c);var x=Function.bind.apply(T,k),m=new x;return p&&v(m,p.prototype),m},j.apply(null,arguments)}function I(){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 R(u){return Function.toString.call(u).indexOf("[native code]")!==-1}function v(u,o){return v=Object.setPrototypeOf||function(d,T){return d.__proto__=T,d},v(u,o)}function A(u){return A=Object.setPrototypeOf?Object.getPrototypeOf:function(l){return l.__proto__||Object.getPrototypeOf(l)},A(u)}var M=Math.pow(2,17),L=function(){function u(l){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=l}var o=u.prototype;return o.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},o.abort=function(){this.loader&&this.loader.abort()},o.load=function(d,T){var c=this,p=d.url;if(!p)return Promise.reject(new y({type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:d,networkDetails:null},"Fragment does not have a "+(p?"part list":"url")));this.abort();var k=this.config,x=k.fLoader,m=k.loader;return new Promise(function(g,h){c.loader&&c.loader.destroy();var a=c.loader=d.loader=x?new x(k):new m(k),E=w(d),b={timeout:k.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:k.fragLoadingMaxRetryTimeout,highWaterMark:M};d.stats=a.stats,a.load(E,b,{onSuccess:function(N,U,K,V){c.resetLoader(d,a),g({frag:d,part:null,payload:N.data,networkDetails:V})},onError:function(N,U,K){c.resetLoader(d,a),h(new y({type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:d,response:N,networkDetails:K}))},onAbort:function(N,U,K){c.resetLoader(d,a),h(new y({type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:d,networkDetails:K}))},onTimeout:function(N,U,K){c.resetLoader(d,a),h(new y({type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:d,networkDetails:K}))},onProgress:function(N,U,K,V){T&&T({frag:d,part:null,payload:K,networkDetails:V})}})})},o.loadPart=function(d,T,c){var p=this;this.abort();var k=this.config,x=k.fLoader,m=k.loader;return new Promise(function(g,h){p.loader&&p.loader.destroy();var a=p.loader=d.loader=x?new x(k):new m(k),E=w(d,T),b={timeout:k.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:k.fragLoadingMaxRetryTimeout,highWaterMark:M};T.stats=a.stats,a.load(E,b,{onSuccess:function(N,U,K,V){p.resetLoader(d,a),p.updateStatsFromPart(d,T);var O={frag:d,part:T,payload:N.data,networkDetails:V};c(O),g(O)},onError:function(N,U,K){p.resetLoader(d,a),h(new y({type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:d,part:T,response:N,networkDetails:K}))},onAbort:function(N,U,K){d.stats.aborted=T.stats.aborted,p.resetLoader(d,a),h(new y({type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:d,part:T,networkDetails:K}))},onTimeout:function(N,U,K){p.resetLoader(d,a),h(new y({type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:d,part:T,networkDetails:K}))}})})},o.updateStatsFromPart=function(d,T){var c=d.stats,p=T.stats,k=p.total;if(c.loaded+=p.loaded,k){var x=Math.round(d.duration/T.duration),m=Math.min(Math.round(c.loaded/k),x),g=x-m,h=g*Math.round(c.loaded/m);c.total=c.loaded+h}else c.total=Math.max(c.loaded,c.total);var a=c.loading,E=p.loading;a.start?a.first+=E.first-E.start:(a.start=E.start,a.first=E.first),a.end=E.end},o.resetLoader=function(d,T){d.loader=null,this.loader===T&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),T.destroy()},u}();function w(u,o){o===void 0&&(o=null);var l=o||u,d={frag:u,part:o,responseType:"arraybuffer",url:l.url,headers:{},rangeStart:0,rangeEnd:0},T=l.byteRangeStartOffset,c=l.byteRangeEndOffset;return Object(Q.isFiniteNumber)(T)&&Object(Q.isFiniteNumber)(c)&&(d.rangeStart=T,d.rangeEnd=c),d}var y=function(u){_(o,u);function o(l){for(var d,T=arguments.length,c=new Array(T>1?T-1:0),p=1;p<T;p++)c[p-1]=arguments[p];return d=u.call.apply(u,[this].concat(c))||this,d.data=void 0,d.data=l,d}return o}(G(Error))},"./src/loader/fragment.ts":function(he,J,D){"use strict";D.r(J),D.d(J,"ElementaryStreamTypes",function(){return L}),D.d(J,"BaseSegment",function(){return w}),D.d(J,"Fragment",function(){return y}),D.d(J,"Part",function(){return u});var Q=D("./src/polyfills/number.ts"),B=D("./node_modules/url-toolkit/src/url-toolkit.js"),_=D.n(B),G=D("./src/utils/logger.ts"),j=D("./src/loader/level-key.ts"),I=D("./src/loader/load-stats.ts");function R(o,l){o.prototype=Object.create(l.prototype),o.prototype.constructor=o,v(o,l)}function v(o,l){return v=Object.setPrototypeOf||function(T,c){return T.__proto__=c,T},v(o,l)}function A(o,l){for(var d=0;d<l.length;d++){var T=l[d];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(o,T.key,T)}}function M(o,l,d){return l&&A(o.prototype,l),d&&A(o,d),o}var L;(function(o){o.AUDIO="audio",o.VIDEO="video",o.AUDIOVIDEO="audiovideo"})(L||(L={}));var w=function(){function o(d){var T;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(T={},T[L.AUDIO]=null,T[L.VIDEO]=null,T[L.AUDIOVIDEO]=null,T),this.baseurl=d}var l=o.prototype;return l.setByteRange=function(T,c){var p=T.split("@",2),k=[];p.length===1?k[0]=c?c.byteRangeEndOffset:0:k[0]=parseInt(p[1]),k[1]=parseInt(p[0])+k[0],this._byteRange=k},M(o,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Object(B.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(T){this._url=T}}]),o}(),y=function(o){R(l,o);function l(T,c){var p;return p=o.call(this,c)||this,p._decryptdata=null,p.rawProgramDateTime=null,p.programDateTime=null,p.tagList=[],p.duration=0,p.sn=0,p.levelkey=void 0,p.type=void 0,p.loader=null,p.level=-1,p.cc=0,p.startPTS=void 0,p.endPTS=void 0,p.appendedPTS=void 0,p.startDTS=void 0,p.endDTS=void 0,p.start=0,p.deltaPTS=void 0,p.maxStartPTS=void 0,p.minEndPTS=void 0,p.stats=new I.LoadStats,p.urlId=0,p.data=void 0,p.bitrateTest=!1,p.title=null,p.initSegment=null,p.type=T,p}var d=l.prototype;return d.createInitializationVector=function(c){for(var p=new Uint8Array(16),k=12;k<16;k++)p[k]=c>>8*(15-k)&255;return p},d.setDecryptDataFromLevelKey=function(c,p){var k=c;return(c==null?void 0:c.method)==="AES-128"&&c.uri&&!c.iv&&(k=j.LevelKey.fromURI(c.uri),k.method=c.method,k.iv=this.createInitializationVector(p),k.keyFormat="identity"),k},d.setElementaryStreamInfo=function(c,p,k,x,m,g){g===void 0&&(g=!1);var h=this.elementaryStreams,a=h[c];if(!a){h[c]={startPTS:p,endPTS:k,startDTS:x,endDTS:m,partial:g};return}a.startPTS=Math.min(a.startPTS,p),a.endPTS=Math.max(a.endPTS,k),a.startDTS=Math.min(a.startDTS,x),a.endDTS=Math.max(a.endDTS,m)},d.clearElementaryStreamInfo=function(){var c=this.elementaryStreams;c[L.AUDIO]=null,c[L.VIDEO]=null,c[L.AUDIOVIDEO]=null},M(l,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var c=this.sn;typeof c!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&G.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),c=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,c)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(Q.isFiniteNumber)(this.programDateTime))return null;var c=Object(Q.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+c*1e3}},{key:"encrypted",get:function(){var c;return!!((c=this.decryptdata)!==null&&c!==void 0&&c.keyFormat&&this.decryptdata.uri)}}]),l}(w),u=function(o){R(l,o);function l(d,T,c,p,k){var x;x=o.call(this,c)||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 I.LoadStats,x.duration=d.decimalFloatingPoint("DURATION"),x.gap=d.bool("GAP"),x.independent=d.bool("INDEPENDENT"),x.relurl=d.enumeratedString("URI"),x.fragment=T,x.index=p;var m=d.enumeratedString("BYTERANGE");return m&&x.setByteRange(m,k),k&&(x.fragOffset=k.fragOffset+k.duration),x}return M(l,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var T=this.elementaryStreams;return!!(T.audio||T.video||T.audiovideo)}}]),l}(w)},"./src/loader/key-loader.ts":function(he,J,D){"use strict";D.r(J),D.d(J,"default",function(){return G});var Q=D("./src/events.ts"),B=D("./src/errors.ts"),_=D("./src/utils/logger.ts"),G=function(){function j(R){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=R,this._registerListeners()}var I=j.prototype;return I._registerListeners=function(){this.hls.on(Q.Events.KEY_LOADING,this.onKeyLoading,this)},I._unregisterListeners=function(){this.hls.off(Q.Events.KEY_LOADING,this.onKeyLoading)},I.destroy=function(){this._unregisterListeners();for(var v in this.loaders){var A=this.loaders[v];A&&A.destroy()}this.loaders={}},I.onKeyLoading=function(v,A){var M=A.frag,L=M.type,w=this.loaders[L];if(!M.decryptdata){_.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var y=M.decryptdata.uri;if(y!==this.decrypturl||this.decryptkey===null){var u=this.hls.config;if(w&&(_.logger.warn("abort previous key loader for type:"+L),w.abort()),!y){_.logger.warn("key uri is falsy");return}var o=u.loader,l=M.loader=this.loaders[L]=new o(u);this.decrypturl=y,this.decryptkey=null;var d={url:y,frag:M,responseType:"arraybuffer"},T={timeout:u.fragLoadingTimeOut,maxRetry:0,retryDelay:u.fragLoadingRetryDelay,maxRetryDelay:u.fragLoadingMaxRetryTimeout,highWaterMark:0},c={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};l.load(d,T,c)}else this.decryptkey&&(M.decryptdata.key=this.decryptkey,this.hls.trigger(Q.Events.KEY_LOADED,{frag:M}))},I.loadsuccess=function(v,A,M){var L=M.frag;if(!L.decryptdata){_.logger.error("after key load, decryptdata unset");return}this.decryptkey=L.decryptdata.key=new Uint8Array(v.data),L.loader=null,delete this.loaders[L.type],this.hls.trigger(Q.Events.KEY_LOADED,{frag:L})},I.loaderror=function(v,A){var M=A.frag,L=M.loader;L&&L.abort(),delete this.loaders[M.type],this.hls.trigger(Q.Events.ERROR,{type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:M,response:v})},I.loadtimeout=function(v,A){var M=A.frag,L=M.loader;L&&L.abort(),delete this.loaders[M.type],this.hls.trigger(Q.Events.ERROR,{type:B.ErrorTypes.NETWORK_ERROR,details:B.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:M})},j}()},"./src/loader/level-details.ts":function(he,J,D){"use strict";D.r(J),D.d(J,"LevelDetails",function(){return j});var Q=D("./src/polyfills/number.ts");function B(I,R){for(var v=0;v<R.length;v++){var A=R[v];A.enumerable=A.enumerable||!1,A.configurable=!0,"value"in A&&(A.writable=!0),Object.defineProperty(I,A.key,A)}}function _(I,R,v){return R&&B(I.prototype,R),v&&B(I,v),I}var G=10,j=function(){function I(v){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.needSidxRanges=!1,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.fragments=[],this.url=v}var R=I.prototype;return R.reloaded=function(A){if(!A){this.advanced=!0,this.updated=!0;return}var M=this.lastPartSn-A.lastPartSn,L=this.lastPartIndex-A.lastPartIndex;this.updated=this.endSN!==A.endSN||!!L||!!M,this.advanced=this.endSN>A.endSN||M>0||M===0&&L>0,this.updated||this.advanced?this.misses=Math.floor(A.misses*.6):this.misses=A.misses+1,this.availabilityDelay=A.availabilityDelay},_(I,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(Q.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||G}},{key:"drift",get:function(){var A=this.driftEndTime-this.driftStartTime;if(A>0){var M=this.driftEnd-this.driftStart;return M*1e3/A}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var A;return(A=this.partList)!==null&&A!==void 0&&A.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var A;return(A=this.fragments)!==null&&A!==void 0&&A.length?this.fragments[this.fragments.length-1].end:0}},{key:"age",get:function(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}},{key:"lastPartIndex",get:function(){var A;return(A=this.partList)!==null&&A!==void 0&&A.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var A;return(A=this.partList)!==null&&A!==void 0&&A.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),I}()},"./src/loader/level-key.ts":function(he,J,D){"use strict";D.r(J),D.d(J,"LevelKey",function(){return j});var Q=D("./node_modules/url-toolkit/src/url-toolkit.js"),B=D.n(Q);function _(I,R){for(var v=0;v<R.length;v++){var A=R[v];A.enumerable=A.enumerable||!1,A.configurable=!0,"value"in A&&(A.writable=!0),Object.defineProperty(I,A.key,A)}}function G(I,R,v){return R&&_(I.prototype,R),v&&_(I,v),I}var j=function(){I.fromURL=function(v,A){return new I(v,A)},I.fromURI=function(v){return new I(v)};function I(R,v){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,v?this._uri=Object(Q.buildAbsoluteURL)(R,v,{alwaysNormalize:!0}):this._uri=R}return G(I,[{key:"uri",get:function(){return this._uri}}]),I}()},"./src/loader/load-stats.ts":function(he,J,D){"use strict";D.r(J),D.d(J,"LoadStats",function(){return Q});var Q=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(he,J,D){"use strict";D.r(J),D.d(J,"default",function(){return l});var Q=D("./src/polyfills/number.ts"),B=D("./node_modules/url-toolkit/src/url-toolkit.js"),_=D.n(B),G=D("./src/loader/fragment.ts"),j=D("./src/loader/level-details.ts"),I=D("./src/loader/level-key.ts"),R=D("./src/utils/attr-list.ts"),v=D("./src/utils/logger.ts"),A=D("./src/utils/codecs.ts"),M=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,L=/#EXT-X-MEDIA:(.*)/g,w=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),y=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(PLAYLIST-TYPE):(.+)/.source,/#EXT-X-(MEDIA-SEQUENCE): *(\d+)/.source,/#EXT-X-(SKIP):(.+)/.source,/#EXT-X-(TARGETDURATION): *(\d+)/.source,/#EXT-X-(KEY):(.+)/.source,/#EXT-X-(START):(.+)/.source,/#EXT-X-(ENDLIST)/.source,/#EXT-X-(DISCONTINUITY-SEQ)UENCE: *(\d+)/.source,/#EXT-X-(DIS)CONTINUITY/.source,/#EXT-X-(VERSION):(\d+)/.source,/#EXT-X-(MAP):(.+)/.source,/#EXT-X-(SERVER-CONTROL):(.+)/.source,/#EXT-X-(PART-INF):(.+)/.source,/#EXT-X-(GAP)/.source,/#EXT-X-(BITRATE):\s*(\d+)/.source,/#EXT-X-(PART):(.+)/.source,/#EXT-X-(PRELOAD-HINT):(.+)/.source,/#EXT-X-(RENDITION-REPORT):(.+)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),u=/\.(mp4|m4s|m4v|m4a)$/i;function o(k){var x,m;return u.test((x=(m=B.parseURL(k))===null||m===void 0?void 0:m.path)!=null?x:"")}var l=function(){function k(){}return k.findGroup=function(m,g){for(var h=0;h<m.length;h++){var a=m[h];if(a.id===g)return a}},k.convertAVC1ToAVCOTI=function(m){var g=m.split(".");if(g.length>2){var h=g.shift()+".";return h+=parseInt(g.shift()).toString(16),h+=("000"+parseInt(g.shift()).toString(16)).substr(-4),h}return m},k.resolve=function(m,g){return B.buildAbsoluteURL(g,m,{alwaysNormalize:!0})},k.parseMasterPlaylist=function(m,g){var h=[],a={},E=!1;M.lastIndex=0;for(var b;(b=M.exec(m))!=null;)if(b[1]){var S=new R.AttrList(b[1]),N={attrs:S,bitrate:S.decimalInteger("AVERAGE-BANDWIDTH")||S.decimalInteger("BANDWIDTH"),name:S.NAME,url:k.resolve(b[2],g)},U=S.decimalResolution("RESOLUTION");U&&(N.width=U.width,N.height=U.height),d((S.CODECS||"").split(/[ ,]+/).filter(function(V){return V}),N),N.videoCodec&&N.videoCodec.indexOf("avc1")!==-1&&(N.videoCodec=k.convertAVC1ToAVCOTI(N.videoCodec)),h.push(N)}else if(b[3]){var K=new R.AttrList(b[3]);K["DATA-ID"]&&(E=!0,a[K["DATA-ID"]]=K)}return{levels:h,sessionData:E?a:null}},k.parseMasterPlaylistMedia=function(m,g,h,a){a===void 0&&(a=[]);var E,b=[],S=0;for(L.lastIndex=0;(E=L.exec(m))!==null;){var N=new R.AttrList(E[1]);if(N.TYPE===h){var U={attrs:N,bitrate:0,id:S++,groupId:N["GROUP-ID"],instreamId:N["INSTREAM-ID"],name:N.NAME||N.LANGUAGE||"",type:h,default:N.bool("DEFAULT"),autoselect:N.bool("AUTOSELECT"),forced:N.bool("FORCED"),lang:N.LANGUAGE,url:N.URI?k.resolve(N.URI,g):""};if(a.length){var K=k.findGroup(a,U.groupId)||a[0];T(U,K,"audioCodec"),T(U,K,"textCodec")}b.push(U)}}return b},k.parseLevelPlaylist=function(m,g,h,a,E){var b=new j.LevelDetails(g),S=b.fragments,N=null,U=0,K=0,V=0,O=0,P=null,$=new G.Fragment(a,g),ee,oe,fe,Oe=-1,Ce=!1;for(w.lastIndex=0,b.m3u8=m;(ee=w.exec(m))!==null;){Ce&&(Ce=!1,$=new G.Fragment(a,g),$.start=V,$.sn=U,$.cc=O,$.level=h,N&&($.initSegment=N,$.rawProgramDateTime=N.rawProgramDateTime));var Ae=ee[1];if(Ae){$.duration=parseFloat(Ae);var Le=(" "+ee[2]).slice(1);$.title=Le||null,$.tagList.push(Le?["INF",Ae,Le]:["INF",Ae])}else if(ee[3])Object(Q.isFiniteNumber)($.duration)&&($.start=V,fe&&($.levelkey=fe),$.sn=U,$.level=h,$.cc=O,$.urlId=E,S.push($),$.relurl=(" "+ee[3]).slice(1),p($,P),P=$,V+=$.duration,U++,K=0,Ce=!0);else if(ee[4]){var be=(" "+ee[4]).slice(1);P?$.setByteRange(be,P):$.setByteRange(be)}else if(ee[5])$.rawProgramDateTime=(" "+ee[5]).slice(1),$.tagList.push(["PROGRAM-DATE-TIME",$.rawProgramDateTime]),Oe===-1&&(Oe=S.length);else{if(ee=ee[0].match(y),!ee){v.logger.warn("No matches on slow regex match for level playlist!");continue}for(oe=1;oe<ee.length&&!(typeof ee[oe]!="undefined");oe++);var pe=(" "+ee[oe]).slice(1),se=(" "+ee[oe+1]).slice(1),te=ee[oe+2]?(" "+ee[oe+2]).slice(1):"";switch(pe){case"PLAYLIST-TYPE":b.type=se.toUpperCase();break;case"MEDIA-SEQUENCE":U=b.startSN=parseInt(se);break;case"SKIP":{var ue=new R.AttrList(se),ne=ue.decimalInteger("SKIPPED-SEGMENTS");if(Object(Q.isFiniteNumber)(ne)){b.skippedSegments=ne;for(var Te=ne;Te--;)S.unshift(null);U+=ne}var Re=ue.enumeratedString("RECENTLY-REMOVED-DATERANGES");Re&&(b.recentlyRemovedDateranges=Re.split(" "));break}case"TARGETDURATION":b.targetduration=parseFloat(se);break;case"VERSION":b.version=parseInt(se);break;case"EXTM3U":break;case"ENDLIST":b.live=!1;break;case"#":(se||te)&&$.tagList.push(te?[se,te]:[se]);break;case"DIS":O++;case"GAP":$.tagList.push([pe]);break;case"BITRATE":$.tagList.push([pe,se]);break;case"DISCONTINUITY-SEQ":O=parseInt(se);break;case"KEY":{var xe,Me=new R.AttrList(se),Pe=Me.enumeratedString("METHOD"),je=Me.URI,Ue=Me.hexadecimalInteger("IV"),Ne=Me.enumeratedString("KEYFORMATVERSIONS"),Ie=Me.enumeratedString("KEYID"),Qe=(xe=Me.enumeratedString("KEYFORMAT"))!=null?xe:"identity",rt=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(rt.indexOf(Qe)>-1){v.logger.warn("Keyformat "+Qe+" is not supported from the manifest");continue}else if(Qe!=="identity")continue;Pe&&(fe=I.LevelKey.fromURL(g,je),je&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Pe)>=0&&(fe.method=Pe,fe.keyFormat=Qe,Ie&&(fe.keyID=Ie),Ne&&(fe.keyFormatVersions=Ne),fe.iv=Ue));break}case"START":{var et=new R.AttrList(se),Je=et.decimalFloatingPoint("TIME-OFFSET");Object(Q.isFiniteNumber)(Je)&&(b.startTimeOffset=Je);break}case"MAP":{var st=new R.AttrList(se);$.relurl=st.URI,st.BYTERANGE&&$.setByteRange(st.BYTERANGE),$.level=h,$.sn="initSegment",fe&&($.levelkey=fe),$.initSegment=null,N=$,Ce=!0;break}case"SERVER-CONTROL":{var Ye=new R.AttrList(se);b.canBlockReload=Ye.bool("CAN-BLOCK-RELOAD"),b.canSkipUntil=Ye.optionalFloat("CAN-SKIP-UNTIL",0),b.canSkipDateRanges=b.canSkipUntil>0&&Ye.bool("CAN-SKIP-DATERANGES"),b.partHoldBack=Ye.optionalFloat("PART-HOLD-BACK",0),b.holdBack=Ye.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var Xe=new R.AttrList(se);b.partTarget=Xe.decimalFloatingPoint("PART-TARGET");break}case"PART":{var _e=b.partList;_e||(_e=b.partList=[]);var ot=K>0?_e[_e.length-1]:void 0,at=K++,Be=new G.Part(new R.AttrList(se),$,g,at,ot);_e.push(Be),$.duration+=Be.duration;break}case"PRELOAD-HINT":{var Ke=new R.AttrList(se);b.preloadHint=Ke;break}case"RENDITION-REPORT":{var Ee=new R.AttrList(se);b.renditionReports=b.renditionReports||[],b.renditionReports.push(Ee);break}default:v.logger.warn("line parsed but not handled: "+ee);break}}}P&&!P.relurl?(S.pop(),V-=P.duration,b.partList&&(b.fragmentHint=P)):b.partList&&(p($,P),$.cc=O,b.fragmentHint=$);var ge=S.length,ye=S[0],re=S[ge-1];if(V+=b.skippedSegments*b.targetduration,V>0&&ge&&re){b.averagetargetduration=V/ge;var ie=re.sn;b.endSN=ie!=="initSegment"?ie:0,ye&&(b.startCC=ye.cc,ye.initSegment||b.fragments.every(function(ae){return ae.relurl&&o(ae.relurl)})&&(v.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),$=new G.Fragment(a,g),$.relurl=re.relurl,$.level=h,$.sn="initSegment",ye.initSegment=$,b.needSidxRanges=!0))}else b.endSN=0,b.startCC=0;return b.fragmentHint&&(V+=b.fragmentHint.duration),b.totalduration=V,b.endCC=O,Oe>0&&c(S,Oe),b},k}();function d(k,x){["video","audio","text"].forEach(function(m){var g=k.filter(function(a){return Object(A.isCodecType)(a,m)});if(g.length){var h=g.filter(function(a){return a.lastIndexOf("avc1",0)===0||a.lastIndexOf("mp4a",0)===0});x[m+"Codec"]=h.length>0?h[0]:g[0],k=k.filter(function(a){return g.indexOf(a)===-1})}}),x.unknownCodecs=k}function T(k,x,m){var g=x[m];g&&(k[m]=g)}function c(k,x){for(var m=k[x],g=x;g--;){var h=k[g];if(!h)return;h.programDateTime=m.programDateTime-h.duration*1e3,m=h}}function p(k,x){k.rawProgramDateTime?k.programDateTime=Date.parse(k.rawProgramDateTime):x!=null&&x.programDateTime&&(k.programDateTime=x.endProgramDateTime),Object(Q.isFiniteNumber)(k.programDateTime)||(k.programDateTime=null,k.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(he,J,D){"use strict";D.r(J);var Q=D("./src/polyfills/number.ts"),B=D("./src/events.ts"),_=D("./src/errors.ts"),G=D("./src/utils/logger.ts"),j=D("./src/utils/mp4-tools.ts"),I=D("./src/loader/m3u8-parser.ts"),R=D("./src/types/loader.ts"),v=D("./src/utils/attr-list.ts");function A(w){var y=w.type;switch(y){case R.PlaylistContextType.AUDIO_TRACK:return R.PlaylistLevelType.AUDIO;case R.PlaylistContextType.SUBTITLE_TRACK:return R.PlaylistLevelType.SUBTITLE;default:return R.PlaylistLevelType.MAIN}}function M(w,y){var u=w.url;return(u===void 0||u.indexOf("data:")===0)&&(u=y.url),u}var L=function(){function w(u){this.hls=void 0,this.loaders=Object.create(null),this.hls=u,this.registerListeners()}var y=w.prototype;return y.registerListeners=function(){var o=this.hls;o.on(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(B.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(B.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.on(B.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},y.unregisterListeners=function(){var o=this.hls;o.off(B.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(B.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(B.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.off(B.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},y.createInternalLoader=function(o){var l=this.hls.config,d=l.pLoader,T=l.loader,c=d||T,p=new c(l);return o.loader=p,this.loaders[o.type]=p,p},y.getInternalLoader=function(o){return this.loaders[o.type]},y.resetInternalLoader=function(o){this.loaders[o]&&delete this.loaders[o]},y.destroyInternalLoaders=function(){for(var o in this.loaders){var l=this.loaders[o];l&&l.destroy(),this.resetInternalLoader(o)}},y.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},y.onManifestLoading=function(o,l){var d=l.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:R.PlaylistContextType.MANIFEST,url:d,deliveryDirectives:null})},y.onLevelLoading=function(o,l){var d=l.id,T=l.level,c=l.url,p=l.deliveryDirectives;this.load({id:d,groupId:null,level:T,responseType:"text",type:R.PlaylistContextType.LEVEL,url:c,deliveryDirectives:p})},y.onAudioTrackLoading=function(o,l){var d=l.id,T=l.groupId,c=l.url,p=l.deliveryDirectives;this.load({id:d,groupId:T,level:null,responseType:"text",type:R.PlaylistContextType.AUDIO_TRACK,url:c,deliveryDirectives:p})},y.onSubtitleTrackLoading=function(o,l){var d=l.id,T=l.groupId,c=l.url,p=l.deliveryDirectives;this.load({id:d,groupId:T,level:null,responseType:"text",type:R.PlaylistContextType.SUBTITLE_TRACK,url:c,deliveryDirectives:p})},y.load=function(o){var l,d=this.hls.config,T=this.getInternalLoader(o);if(T){var c=T.context;if(c&&c.url===o.url){G.logger.trace("[playlist-loader]: playlist request ongoing");return}G.logger.log("[playlist-loader]: aborting previous loader for type: "+o.type),T.abort()}var p,k,x,m;switch(o.type){case R.PlaylistContextType.MANIFEST:p=d.manifestLoadingMaxRetry,k=d.manifestLoadingTimeOut,x=d.manifestLoadingRetryDelay,m=d.manifestLoadingMaxRetryTimeout;break;case R.PlaylistContextType.LEVEL:case R.PlaylistContextType.AUDIO_TRACK:case R.PlaylistContextType.SUBTITLE_TRACK:p=0,k=d.levelLoadingTimeOut;break;default:p=d.levelLoadingMaxRetry,k=d.levelLoadingTimeOut,x=d.levelLoadingRetryDelay,m=d.levelLoadingMaxRetryTimeout;break}if(T=this.createInternalLoader(o),(l=o.deliveryDirectives)!==null&&l!==void 0&&l.part){var g;if(o.type===R.PlaylistContextType.LEVEL&&o.level!==null?g=this.hls.levels[o.level].details:o.type===R.PlaylistContextType.AUDIO_TRACK&&o.id!==null?g=this.hls.audioTracks[o.id].details:o.type===R.PlaylistContextType.SUBTITLE_TRACK&&o.id!==null&&(g=this.hls.subtitleTracks[o.id].details),g){var h=g.partTarget,a=g.targetduration;h&&a&&(k=Math.min(Math.max(h*3,a*.8)*1e3,k))}}var E={timeout:k,maxRetry:p,retryDelay:x,maxRetryDelay:m,highWaterMark:0},b={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};T.load(o,E,b)},y.loadsuccess=function(o,l,d,T){if(T===void 0&&(T=null),d.isSidxRequest){this.handleSidxRequest(o,d),this.handlePlaylistLoaded(o,l,d,T);return}this.resetInternalLoader(d.type);var c=o.data;if(c.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(o,d,"no EXTM3U delimiter",T);return}l.parsing.start=performance.now(),c.indexOf("#EXTINF:")>0||c.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(o,l,d,T):this.handleMasterPlaylist(o,l,d,T)},y.loaderror=function(o,l,d){d===void 0&&(d=null),this.handleNetworkError(l,d,!1,o)},y.loadtimeout=function(o,l,d){d===void 0&&(d=null),this.handleNetworkError(l,d,!0)},y.handleMasterPlaylist=function(o,l,d,T){var c=this.hls,p=o.data,k=M(o,d),x=I.default.parseMasterPlaylist(p,k),m=x.levels,g=x.sessionData;if(!m.length){this.handleManifestParsingError(o,d,"no level found in manifest",T);return}var h=m.map(function(U){return{id:U.attrs.AUDIO,audioCodec:U.audioCodec}}),a=m.map(function(U){return{id:U.attrs.SUBTITLES,textCodec:U.textCodec}}),E=I.default.parseMasterPlaylistMedia(p,k,"AUDIO",h),b=I.default.parseMasterPlaylistMedia(p,k,"SUBTITLES",a),S=I.default.parseMasterPlaylistMedia(p,k,"CLOSED-CAPTIONS");if(E.length){var N=E.some(function(U){return!U.url});!N&&m[0].audioCodec&&!m[0].attrs.AUDIO&&(G.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),E.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new v.AttrList({}),bitrate:0,url:""}))}c.trigger(B.Events.MANIFEST_LOADED,{levels:m,audioTracks:E,subtitles:b,captions:S,url:k,stats:l,networkDetails:T,sessionData:g})},y.handleTrackOrLevelPlaylist=function(o,l,d,T){var c=this.hls,p=d.id,k=d.level,x=d.type,m=M(o,d),g=Object(Q.isFiniteNumber)(p)?p:0,h=Object(Q.isFiniteNumber)(k)?k:g,a=A(d),E=I.default.parseLevelPlaylist(o.data,m,h,a,g);if(!E.fragments.length){c.trigger(B.Events.ERROR,{type:_.ErrorTypes.NETWORK_ERROR,details:_.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:m,reason:"no fragments found in level",level:typeof d.level=="number"?d.level:void 0});return}if(x===R.PlaylistContextType.MANIFEST){var b={attrs:new v.AttrList({}),bitrate:0,details:E,name:"",url:m};c.trigger(B.Events.MANIFEST_LOADED,{levels:[b],audioTracks:[],url:m,stats:l,networkDetails:T,sessionData:null})}if(l.parsing.end=performance.now(),E.needSidxRanges){var S,N=(S=E.fragments[0].initSegment)===null||S===void 0?void 0:S.url;this.load({url:N,isSidxRequest:!0,type:x,level:k,levelDetails:E,id:p,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}d.levelDetails=E,this.handlePlaylistLoaded(o,l,d,T)},y.handleSidxRequest=function(o,l){var d=Object(j.parseSegmentIndex)(new Uint8Array(o.data));if(!d)return;var T=d.references,c=l.levelDetails;T.forEach(function(p,k){var x=p.info,m=c.fragments[k];m.byteRange.length===0&&m.setByteRange(String(1+x.end-x.start)+"@"+String(x.start)),m.initSegment&&m.initSegment.setByteRange(String(d.moovEndOffset)+"@0")})},y.handleManifestParsingError=function(o,l,d,T){this.hls.trigger(B.Events.ERROR,{type:_.ErrorTypes.NETWORK_ERROR,details:_.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:l.type===R.PlaylistContextType.MANIFEST,url:o.url,reason:d,response:o,context:l,networkDetails:T})},y.handleNetworkError=function(o,l,d,T){d===void 0&&(d=!1),G.logger.warn("[playlist-loader]: A network "+(d?"timeout":"error")+" occurred while loading "+o.type+" level: "+o.level+" id: "+o.id+' group-id: "'+o.groupId+'"');var c=_.ErrorDetails.UNKNOWN,p=!1,k=this.getInternalLoader(o);switch(o.type){case R.PlaylistContextType.MANIFEST:c=d?_.ErrorDetails.MANIFEST_LOAD_TIMEOUT:_.ErrorDetails.MANIFEST_LOAD_ERROR,p=!0;break;case R.PlaylistContextType.LEVEL:c=d?_.ErrorDetails.LEVEL_LOAD_TIMEOUT:_.ErrorDetails.LEVEL_LOAD_ERROR,p=!1;break;case R.PlaylistContextType.AUDIO_TRACK:c=d?_.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:_.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,p=!1;break;case R.PlaylistContextType.SUBTITLE_TRACK:c=d?_.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:_.ErrorDetails.SUBTITLE_LOAD_ERROR,p=!1;break}k&&this.resetInternalLoader(o.type);var x={type:_.ErrorTypes.NETWORK_ERROR,details:c,fatal:p,url:o.url,loader:k,context:o,networkDetails:l};T&&(x.response=T),this.hls.trigger(B.Events.ERROR,x)},y.handlePlaylistLoaded=function(o,l,d,T){var c=d.type,p=d.level,k=d.id,x=d.groupId,m=d.loader,g=d.levelDetails,h=d.deliveryDirectives;if(!(g!=null&&g.targetduration)){this.handleManifestParsingError(o,d,"invalid target duration",T);return}if(!m)return;g.live&&(m.getCacheAge&&(g.ageHeader=m.getCacheAge()||0),(!m.getCacheAge||isNaN(g.ageHeader))&&(g.ageHeader=0));switch(c){case R.PlaylistContextType.MANIFEST:case R.PlaylistContextType.LEVEL:this.hls.trigger(B.Events.LEVEL_LOADED,{details:g,level:p||0,id:k||0,stats:l,networkDetails:T,deliveryDirectives:h});break;case R.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(B.Events.AUDIO_TRACK_LOADED,{details:g,id:k||0,groupId:x||"",stats:l,networkDetails:T,deliveryDirectives:h});break;case R.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(B.Events.SUBTITLE_TRACK_LOADED,{details:g,id:k||0,groupId:x||"",stats:l,networkDetails:T,deliveryDirectives:h});break}},w}();J.default=L},"./src/polyfills/number.ts":function(he,J,D){"use strict";D.r(J),D.d(J,"isFiniteNumber",function(){return Q}),D.d(J,"MAX_SAFE_INTEGER",function(){return B});var Q=Number.isFinite||function(_){return typeof _=="number"&&isFinite(_)},B=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(he,J,D){"use strict";D.r(J);var Q=function(){function B(){}return B.getSilentFrame=function(G,j){switch(G){case"mp4a.40.2":if(j===1)return new Uint8Array([0,200,0,128,35,128]);if(j===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(j===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(j===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(j===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(j===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(j===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(j===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(j===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},B}();J.default=Q},"./src/remux/mp4-generator.ts":function(he,J,D){"use strict";D.r(J);var Q=Math.pow(2,32)-1,B=function(){function _(){}return _.init=function(){_.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 j;for(j in _.types)_.types.hasOwnProperty(j)&&(_.types[j]=[j.charCodeAt(0),j.charCodeAt(1),j.charCodeAt(2),j.charCodeAt(3)]);var I=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]),R=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]);_.HDLR_TYPES={video:I,audio:R};var v=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),A=new Uint8Array([0,0,0,0,0,0,0,0]);_.STTS=_.STSC=_.STCO=A,_.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),_.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),_.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),_.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var M=new Uint8Array([105,115,111,109]),L=new Uint8Array([97,118,99,49]),w=new Uint8Array([0,0,0,1]);_.FTYP=_.box(_.types.ftyp,M,w,M,L),_.DINF=_.box(_.types.dinf,_.box(_.types.dref,v))},_.box=function(j){for(var I=8,R=arguments.length,v=new Array(R>1?R-1:0),A=1;A<R;A++)v[A-1]=arguments[A];for(var M=v.length,L=M;M--;)I+=v[M].byteLength;var w=new Uint8Array(I);for(w[0]=I>>24&255,w[1]=I>>16&255,w[2]=I>>8&255,w[3]=I&255,w.set(j,4),M=0,I=8;M<L;M++)w.set(v[M],I),I+=v[M].byteLength;return w},_.hdlr=function(j){return _.box(_.types.hdlr,_.HDLR_TYPES[j])},_.mdat=function(j){return _.box(_.types.mdat,j)},_.mdhd=function(j,I){I*=j;var R=Math.floor(I/(Q+1)),v=Math.floor(I%(Q+1));return _.box(_.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,j>>24&255,j>>16&255,j>>8&255,j&255,R>>24,R>>16&255,R>>8&255,R&255,v>>24,v>>16&255,v>>8&255,v&255,85,196,0,0]))},_.mdia=function(j){return _.box(_.types.mdia,_.mdhd(j.timescale,j.duration),_.hdlr(j.type),_.minf(j))},_.mfhd=function(j){return _.box(_.types.mfhd,new Uint8Array([0,0,0,0,j>>24,j>>16&255,j>>8&255,j&255]))},_.minf=function(j){return j.type==="audio"?_.box(_.types.minf,_.box(_.types.smhd,_.SMHD),_.DINF,_.stbl(j)):_.box(_.types.minf,_.box(_.types.vmhd,_.VMHD),_.DINF,_.stbl(j))},_.moof=function(j,I,R){return _.box(_.types.moof,_.mfhd(j),_.traf(R,I))},_.moov=function(j){for(var I=j.length,R=[];I--;)R[I]=_.trak(j[I]);return _.box.apply(null,[_.types.moov,_.mvhd(j[0].timescale,j[0].duration)].concat(R).concat(_.mvex(j)))},_.mvex=function(j){for(var I=j.length,R=[];I--;)R[I]=_.trex(j[I]);return _.box.apply(null,[_.types.mvex].concat(R))},_.mvhd=function(j,I){I*=j;var R=Math.floor(I/(Q+1)),v=Math.floor(I%(Q+1)),A=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,j>>24&255,j>>16&255,j>>8&255,j&255,R>>24,R>>16&255,R>>8&255,R&255,v>>24,v>>16&255,v>>8&255,v&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return _.box(_.types.mvhd,A)},_.sdtp=function(j){var I=j.samples||[],R=new Uint8Array(4+I.length),v,A;for(v=0;v<I.length;v++)A=I[v].flags,R[v+4]=A.dependsOn<<4|A.isDependedOn<<2|A.hasRedundancy;return _.box(_.types.sdtp,R)},_.stbl=function(j){return _.box(_.types.stbl,_.stsd(j),_.box(_.types.stts,_.STTS),_.box(_.types.stsc,_.STSC),_.box(_.types.stsz,_.STSZ),_.box(_.types.stco,_.STCO))},_.avc1=function(j){var I=[],R=[],v,A,M;for(v=0;v<j.sps.length;v++)A=j.sps[v],M=A.byteLength,I.push(M>>>8&255),I.push(M&255),I=I.concat(Array.prototype.slice.call(A));for(v=0;v<j.pps.length;v++)A=j.pps[v],M=A.byteLength,R.push(M>>>8&255),R.push(M&255),R=R.concat(Array.prototype.slice.call(A));var L=_.box(_.types.avcC,new Uint8Array([1,I[3],I[4],I[5],252|3,224|j.sps.length].concat(I).concat([j.pps.length]).concat(R))),w=j.width,y=j.height,u=j.pixelRatio[0],o=j.pixelRatio[1];return _.box(_.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,w>>8&255,w&255,y>>8&255,y&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]),L,_.box(_.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),_.box(_.types.pasp,new Uint8Array([u>>24,u>>16&255,u>>8&255,u&255,o>>24,o>>16&255,o>>8&255,o&255])))},_.esds=function(j){var I=j.config.length;return new Uint8Array([0,0,0,0,3,23+I,0,1,0,4,15+I,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([I]).concat(j.config).concat([6,1,2]))},_.mp4a=function(j){var I=j.samplerate;return _.box(_.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,j.channelCount,0,16,0,0,0,0,I>>8&255,I&255,0,0]),_.box(_.types.esds,_.esds(j)))},_.mp3=function(j){var I=j.samplerate;return _.box(_.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,j.channelCount,0,16,0,0,0,0,I>>8&255,I&255,0,0]))},_.stsd=function(j){return j.type==="audio"?!j.isAAC&&j.codec==="mp3"?_.box(_.types.stsd,_.STSD,_.mp3(j)):_.box(_.types.stsd,_.STSD,_.mp4a(j)):_.box(_.types.stsd,_.STSD,_.avc1(j))},_.tkhd=function(j){var I=j.id,R=j.duration*j.timescale,v=j.width,A=j.height,M=Math.floor(R/(Q+1)),L=Math.floor(R%(Q+1));return _.box(_.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,I>>24&255,I>>16&255,I>>8&255,I&255,0,0,0,0,M>>24,M>>16&255,M>>8&255,M&255,L>>24,L>>16&255,L>>8&255,L&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,v>>8&255,v&255,0,0,A>>8&255,A&255,0,0]))},_.traf=function(j,I){var R=_.sdtp(j),v=j.id,A=Math.floor(I/(Q+1)),M=Math.floor(I%(Q+1));return _.box(_.types.traf,_.box(_.types.tfhd,new Uint8Array([0,0,0,0,v>>24,v>>16&255,v>>8&255,v&255])),_.box(_.types.tfdt,new Uint8Array([1,0,0,0,A>>24,A>>16&255,A>>8&255,A&255,M>>24,M>>16&255,M>>8&255,M&255])),_.trun(j,R.length+16+20+8+16+8+8),R)},_.trak=function(j){return j.duration=j.duration||4294967295,_.box(_.types.trak,_.tkhd(j),_.mdia(j))},_.trex=function(j){var I=j.id;return _.box(_.types.trex,new Uint8Array([0,0,0,0,I>>24,I>>16&255,I>>8&255,I&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},_.trun=function(j,I){var R=j.samples||[],v=R.length,A=12+16*v,M=new Uint8Array(A),L,w,y,u,o,l;for(I+=8+A,M.set([0,0,15,1,v>>>24&255,v>>>16&255,v>>>8&255,v&255,I>>>24&255,I>>>16&255,I>>>8&255,I&255],0),L=0;L<v;L++)w=R[L],y=w.duration,u=w.size,o=w.flags,l=w.cts,M.set([y>>>24&255,y>>>16&255,y>>>8&255,y&255,u>>>24&255,u>>>16&255,u>>>8&255,u&255,o.isLeading<<2|o.dependsOn,o.isDependedOn<<6|o.hasRedundancy<<4|o.paddingValue<<1|o.isNonSync,o.degradPrio&240<<8,o.degradPrio&15,l>>>24&255,l>>>16&255,l>>>8&255,l&255],12+16*L);return _.box(_.types.trun,M)},_.initSegment=function(j){_.types||_.init();var I=_.moov(j),R=new Uint8Array(_.FTYP.byteLength+I.byteLength);return R.set(_.FTYP),R.set(I,_.FTYP.byteLength),R},_}();B.types=void 0,B.HDLR_TYPES=void 0,B.STTS=void 0,B.STSC=void 0,B.STCO=void 0,B.STSZ=void 0,B.VMHD=void 0,B.SMHD=void 0,B.STSD=void 0,B.FTYP=void 0,B.DINF=void 0,J.default=B},"./src/remux/mp4-remuxer.ts":function(he,J,D){"use strict";D.r(J),D.d(J,"default",function(){return l}),D.d(J,"normalizePts",function(){return d});var Q=D("./src/polyfills/number.ts"),B=D("./src/remux/aac-helper.ts"),_=D("./src/remux/mp4-generator.ts"),G=D("./src/events.ts"),j=D("./src/errors.ts"),I=D("./src/utils/logger.ts"),R=D("./src/types/loader.ts"),v=D("./src/utils/timescale-conversion.ts");function A(){return A=Object.assign||function(k){for(var x=1;x<arguments.length;x++){var m=arguments[x];for(var g in m)Object.prototype.hasOwnProperty.call(m,g)&&(k[g]=m[g])}return k},A.apply(this,arguments)}var M=10*1e3,L=1024,w=1152,y=null,u=null,o=!1,l=function(){function k(m,g,h,a){if(a===void 0&&(a=""),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=m,this.config=g,this.typeSupported=h,this.ISGenerated=!1,y===null){var E=navigator.userAgent||"",b=E.match(/Chrome\/(\d+)/i);y=b?parseInt(b[1]):0}if(u===null){var S=navigator.userAgent.match(/Safari\/(\d+)/i);u=S?parseInt(S[1]):0}o=!!y&&y<75||!!u&&u<600}var x=k.prototype;return x.destroy=function(){},x.resetTimeStamp=function(g){I.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=g},x.resetNextTimestamp=function(){I.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},x.resetInitSegment=function(){I.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},x.getVideoStartPts=function(g){var h=!1,a=g.reduce(function(E,b){var S=b.pts-E;return S<-4294967296?(h=!0,d(E,b.pts)):S>0?E:b.pts},g[0].pts);return h&&I.logger.debug("PTS rollover detected"),a},x.remux=function(g,h,a,E,b,S,N,U){var K,V,O,P,$,ee,oe=b,fe=b,Oe=g.pid>-1,Ce=h.pid>-1,Ae=h.samples.length,Le=g.samples.length>0,be=Ae>1,pe=(!Oe||Le)&&(!Ce||be)||this.ISGenerated||N;if(pe){this.ISGenerated||(O=this.generateIS(g,h,b));var se=this.isVideoContiguous,te=-1;if(be&&(te=T(h.samples),!se&&this.config.forceKeyFrameOnDiscontinuity))if(ee=!0,te>0){I.logger.warn("[mp4-remuxer]: Dropped "+te+" out of "+Ae+" video samples due to a missing keyframe");var ue=this.getVideoStartPts(h.samples);h.samples=h.samples.slice(te),h.dropped+=te,fe+=(h.samples[0].pts-ue)/(h.timescale||9e4)}else te===-1&&(I.logger.warn("[mp4-remuxer]: No keyframe found out of "+Ae+" video samples"),ee=!1);if(this.ISGenerated){if(Le&&be){var ne=this.getVideoStartPts(h.samples),Te=d(g.samples[0].pts,ne)-ne,Re=Te/h.inputTimeScale;oe+=Math.max(0,Re),fe+=Math.max(0,-Re)}if(Le){if(g.samplerate||(I.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),O=this.generateIS(g,h,b)),V=this.remuxAudio(g,oe,this.isAudioContiguous,S,Ce||be||U===R.PlaylistLevelType.AUDIO?fe:void 0),be){var xe=V?V.endPTS-V.startPTS:0;h.inputTimeScale||(I.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),O=this.generateIS(g,h,b)),K=this.remuxVideo(h,fe,se,xe)}}else be&&(K=this.remuxVideo(h,fe,se,0));K&&(K.firstKeyFrame=te,K.independent=te!==-1)}}return this.ISGenerated&&(a.samples.length&&($=this.remuxID3(a,b)),E.samples.length&&(P=this.remuxText(E,b))),{audio:V,video:K,initSegment:O,independent:ee,text:P,id3:$}},x.generateIS=function(g,h,a){var E=g.samples,b=h.samples,S=this.typeSupported,N={},U=!Object(Q.isFiniteNumber)(this._initPTS),K="audio/mp4",V,O,P;if(U&&(V=O=Infinity),g.config&&E.length&&(g.timescale=g.samplerate,g.isAAC||(S.mpeg?(K="audio/mpeg",g.codec=""):S.mp3&&(g.codec="mp3")),N.audio={id:"audio",container:K,codec:g.codec,initSegment:!g.isAAC&&S.mpeg?new Uint8Array(0):_.default.initSegment([g]),metadata:{channelCount:g.channelCount}},U&&(P=g.inputTimeScale,V=O=E[0].pts-Math.round(P*a))),h.sps&&h.pps&&b.length&&(h.timescale=h.inputTimeScale,N.video={id:"main",container:"video/mp4",codec:h.codec,initSegment:_.default.initSegment([h]),metadata:{width:h.width,height:h.height}},U)){P=h.inputTimeScale;var $=this.getVideoStartPts(b),ee=Math.round(P*a);O=Math.min(O,d(b[0].dts,$)-ee),V=Math.min(V,$-ee)}if(Object.keys(N).length)return this.ISGenerated=!0,U&&(this._initPTS=V,this._initDTS=O),{tracks:N,initPTS:V,timescale:P}},x.remuxVideo=function(g,h,a,E){var b=g.inputTimeScale,S=g.samples,N=[],U=S.length,K=this._initPTS,V=this.nextAvcDts,O=8,P,$,ee,oe=Number.POSITIVE_INFINITY,fe=Number.NEGATIVE_INFINITY,Oe=0,Ce=!1;if(!a||V===null){var Ae=h*b,Le=S[0].pts-d(S[0].dts,S[0].pts);V=Ae-Le}for(var be=0;be<U;be++){var pe=S[be];if(pe.pts=d(pe.pts-K,V),pe.dts=d(pe.dts-K,V),pe.dts>pe.pts){var se=9e4*.2;Oe=Math.max(Math.min(Oe,pe.pts-pe.dts),-1*se)}pe.dts<S[be>0?be-1:be].dts&&(Ce=!0)}Ce&&S.sort(function(kt,Et){var ht=kt.dts-Et.dts,jt=kt.pts-Et.pts;return ht||jt}),$=S[0].dts,ee=S[S.length-1].dts;var te=Math.round((ee-$)/(U-1));if(Oe<0){if(Oe<te*-2){I.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(v.toMsFromMpegTsClock)(-te,!0)+" ms");for(var ue=Oe,ne=0;ne<U;ne++)S[ne].dts=ue=Math.max(ue,S[ne].pts-te),S[ne].pts=Math.max(ue,S[ne].pts)}else{I.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(v.toMsFromMpegTsClock)(Oe,!0)+" ms to overcome this issue");for(var Te=0;Te<U;Te++)S[Te].dts=S[Te].dts+Oe}$=S[0].dts}if(a){var Re=$-V,xe=Re>te,Me=Re<-1;if(xe||Me){xe?I.logger.warn("AVC: "+Object(v.toMsFromMpegTsClock)(Re,!0)+" ms ("+Re+"dts) hole between fragments detected, filling it"):I.logger.warn("AVC: "+Object(v.toMsFromMpegTsClock)(-Re,!0)+" ms ("+Re+"dts) overlapping between fragments detected"),$=V;var Pe=S[0].pts-Re;S[0].dts=$,S[0].pts=Pe,I.logger.log("Video: First PTS/DTS adjusted: "+Object(v.toMsFromMpegTsClock)(Pe,!0)+"/"+Object(v.toMsFromMpegTsClock)($,!0)+", delta: "+Object(v.toMsFromMpegTsClock)(Re,!0)+" ms")}}o&&($=Math.max(0,$));for(var je=0,Ue=0,Ne=0;Ne<U;Ne++){for(var Ie=S[Ne],Qe=Ie.units,rt=Qe.length,et=0,Je=0;Je<rt;Je++)et+=Qe[Je].data.length;Ue+=et,je+=rt,Ie.length=et,Ie.dts=Math.max(Ie.dts,$),Ie.pts=Math.max(Ie.pts,Ie.dts,0),oe=Math.min(Ie.pts,oe),fe=Math.max(Ie.pts,fe)}ee=S[U-1].dts;var st=Ue+4*je+8,Ye;try{Ye=new Uint8Array(st)}catch(kt){this.observer.emit(G.Events.ERROR,G.Events.ERROR,{type:j.ErrorTypes.MUX_ERROR,details:j.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:st,reason:"fail allocating video mdat "+st});return}var Xe=new DataView(Ye.buffer);Xe.setUint32(0,st),Ye.set(_.default.types.mdat,4);for(var _e=0;_e<U;_e++){for(var ot=S[_e],at=ot.units,Be=0,Ke=0,Ee=at.length;Ke<Ee;Ke++){var ge=at[Ke],ye=ge.data,re=ge.data.byteLength;Xe.setUint32(O,re),O+=4,Ye.set(ye,O),O+=re,Be+=4+re}if(_e<U-1)P=S[_e+1].dts-ot.dts;else{var ie=this.config,ae=ot.dts-S[_e>0?_e-1:_e].dts;if(ie.stretchShortVideoTrack&&this.nextAudioPts!==null){var de=Math.floor(ie.maxBufferHole*b),ke=(E?oe+E*b:this.nextAudioPts)-ot.pts;ke>de?(P=ke-ae,P<0&&(P=ae),I.logger.log("[mp4-remuxer]: It is approximately "+ke/90+" ms to the next segment; using duration "+P/90+" ms for the last video frame.")):P=ae}else P=ae}var Se=Math.round(ot.pts-ot.dts);N.push(new c(ot.key,P,Be,Se))}if(N.length&&y&&y<70){var We=N[0].flags;We.dependsOn=2,We.isNonSync=0}console.assert(P!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=V=ee+P,this.isVideoContiguous=!0;var tt=_.default.moof(g.sequenceNumber++,$,A({},g,{samples:N})),ct="video",lt={data1:tt,data2:Ye,startPTS:oe/b,endPTS:(fe+P)/b,startDTS:$/b,endDTS:V/b,type:ct,hasAudio:!1,hasVideo:!0,nb:N.length,dropped:g.dropped};return g.samples=[],g.dropped=0,console.assert(Ye.length,"MDAT length must not be zero"),lt},x.remuxAudio=function(g,h,a,E,b){var S=g.inputTimeScale,N=g.samplerate?g.samplerate:S,U=S/N,K=g.isAAC?L:w,V=K*U,O=this._initPTS,P=!g.isAAC&&this.typeSupported.mpeg,$=[],ee=g.samples,oe=P?0:8,fe=this.nextAudioPts||-1,Oe=h*S;if(this.isAudioContiguous=a=a||ee.length&&fe>0&&(E&&Math.abs(Oe-fe)<9e3||Math.abs(d(ee[0].pts-O,Oe)-fe)<20*V),ee.forEach(function(ye){ye.pts=d(ye.pts-O,Oe)}),!a||fe<0){if(ee=ee.filter(function(ye){return ye.pts>=0}),!ee.length)return;b===0?fe=0:E?fe=Math.max(0,Oe):fe=ee[0].pts}if(g.isAAC)for(var Ce=b!==void 0,Ae=this.config.maxAudioFramesDrift,Le=0,be=fe;Le<ee.length;Le++){var pe=ee[Le],se=pe.pts,te=se-be,ue=Math.abs(1e3*te/S);if(te<=-Ae*V&&Ce)Le===0&&(I.logger.warn("Audio frame @ "+(se/S).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*te/S)+" ms."),this.nextAudioPts=fe=be=se);else if(te>=Ae*V&&ue<M&&Ce){var ne=Math.round(te/V);be=se-ne*V,be<0&&(ne--,be+=V),Le===0&&(this.nextAudioPts=fe=be),I.logger.warn("[mp4-remuxer]: Injecting "+ne+" audio frame @ "+(be/S).toFixed(3)+"s due to "+Math.round(1e3*te/S)+" ms gap.");for(var Te=0;Te<ne;Te++){var Re=Math.max(be,0),xe=B.default.getSilentFrame(g.manifestCodec||g.codec,g.channelCount);xe||(I.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),xe=pe.unit.subarray()),ee.splice(Le,0,{unit:xe,pts:Re}),be+=V,Le++}}pe.pts=be,be+=V}for(var Me=null,Pe=null,je,Ue=0,Ne=ee.length;Ne--;)Ue+=ee[Ne].unit.byteLength;for(var Ie=0,Qe=ee.length;Ie<Qe;Ie++){var rt=ee[Ie],et=rt.unit,Je=rt.pts;if(Pe!==null){var st=$[Ie-1];st.duration=Math.round((Je-Pe)/U)}else if(a&&g.isAAC&&(Je=fe),Me=Je,Ue>0){Ue+=oe;try{je=new Uint8Array(Ue)}catch(ye){this.observer.emit(G.Events.ERROR,G.Events.ERROR,{type:j.ErrorTypes.MUX_ERROR,details:j.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Ue,reason:"fail allocating audio mdat "+Ue});return}if(!P){var Ye=new DataView(je.buffer);Ye.setUint32(0,Ue),je.set(_.default.types.mdat,4)}}else return;je.set(et,oe);var Xe=et.byteLength;oe+=Xe,$.push(new c(!0,K,Xe,0)),Pe=Je}var _e=$.length;if(!_e)return;var ot=$[$.length-1];this.nextAudioPts=fe=Pe+U*ot.duration;var at=P?new Uint8Array(0):_.default.moof(g.sequenceNumber++,Me/U,A({},g,{samples:$}));g.samples=[];var Be=Me/S,Ke=fe/S,Ee="audio",ge={data1:at,data2:je,startPTS:Be,endPTS:Ke,startDTS:Be,endDTS:Ke,type:Ee,hasAudio:!0,hasVideo:!1,nb:_e};return this.isAudioContiguous=!0,console.assert(je.length,"MDAT length must not be zero"),ge},x.remuxEmptyAudio=function(g,h,a,E){var b=g.inputTimeScale,S=g.samplerate?g.samplerate:b,N=b/S,U=this.nextAudioPts,K=(U!==null?U:E.startDTS*b)+this._initDTS,V=E.endDTS*b+this._initDTS,O=N*L,P=Math.ceil((V-K)/O),$=B.default.getSilentFrame(g.manifestCodec||g.codec,g.channelCount);if(I.logger.warn("[mp4-remuxer]: remux empty Audio"),!$){I.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var ee=[],oe=0;oe<P;oe++){var fe=K+oe*O;ee.push({unit:$,pts:fe,dts:fe})}return g.samples=ee,this.remuxAudio(g,h,a,!1)},x.remuxID3=function(g,h){var a=g.samples.length;if(!a)return;for(var E=g.inputTimeScale,b=this._initPTS,S=this._initDTS,N=0;N<a;N++){var U=g.samples[N];U.pts=d(U.pts-b,h*E)/E,U.dts=d(U.dts-S,h*E)/E}var K=g.samples;return g.samples=[],{samples:K}},x.remuxText=function(g,h){var a=g.samples.length;if(!a)return;for(var E=g.inputTimeScale,b=this._initPTS,S=0;S<a;S++){var N=g.samples[S];N.pts=d(N.pts-b,h*E)/E}g.samples.sort(function(K,V){return K.pts-V.pts});var U=g.samples;return g.samples=[],{samples:U}},k}();function d(k,x){var m;if(x===null)return k;for(x<k?m=-8589934592:m=8589934592;Math.abs(k-x)>4294967296;)k+=m;return k}function T(k){for(var x=0;x<k.length;x++)if(k[x].key)return x;return-1}var c=function(x,m,g,h){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=m,this.size=g,this.cts=h,this.flags=new p(x)},p=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(he,J,D){"use strict";D.r(J);var Q=D("./src/polyfills/number.ts"),B=D("./src/utils/mp4-tools.ts"),_=D("./src/loader/fragment.ts"),G=D("./src/utils/logger.ts"),j=function(){function v(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=void 0,this.initTracks=void 0,this.lastEndDTS=null}var A=v.prototype;return A.destroy=function(){},A.resetTimeStamp=function(L){this.initPTS=L,this.lastEndDTS=null},A.resetNextTimestamp=function(){this.lastEndDTS=null},A.resetInitSegment=function(L,w,y){this.audioCodec=w,this.videoCodec=y,this.generateInitSegment(L),this.emitInitSegment=!0},A.generateInitSegment=function(L){var w=this.audioCodec,y=this.videoCodec;if(!L||!L.byteLength){this.initTracks=void 0,this.initData=void 0;return}var u=this.initData=Object(B.parseInitSegment)(L);w||(w=R(u.audio,_.ElementaryStreamTypes.AUDIO)),y||(y=R(u.video,_.ElementaryStreamTypes.VIDEO));var o={};u.audio&&u.video?o.audiovideo={container:"video/mp4",codec:w+","+y,initSegment:L,id:"main"}:u.audio?o.audio={container:"audio/mp4",codec:w,initSegment:L,id:"audio"}:u.video?o.video={container:"video/mp4",codec:y,initSegment:L,id:"main"}:G.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=o},A.remux=function(L,w,y,u,o){var l=this.initPTS,d=this.lastEndDTS,T={audio:void 0,video:void 0,text:u,id3:y,initSegment:void 0};Object(Q.isFiniteNumber)(d)||(d=this.lastEndDTS=o||0);var c=w.samples;if(!c||!c.length)return T;var p={initPTS:void 0,timescale:1},k=this.initData;if((!k||!k.length)&&(this.generateInitSegment(c),k=this.initData),!k||!k.length)return G.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),T;this.emitInitSegment&&(p.tracks=this.initTracks,this.emitInitSegment=!1),Object(Q.isFiniteNumber)(l)||(this.initPTS=p.initPTS=l=I(k,c,d));var x=Object(B.getDuration)(c,k),m=d,g=x+m;Object(B.offsetStartDTS)(k,c,l),x>0?this.lastEndDTS=g:(G.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var h=!!k.audio,a=!!k.video,E="";h&&(E+="audio"),a&&(E+="video");var b={data1:c,startPTS:m,startDTS:m,endPTS:g,endDTS:g,type:E,hasAudio:h,hasVideo:a,nb:1,dropped:0};return T.audio=b.type==="audio"?b:void 0,T.video=b.type!=="audio"?b:void 0,T.text=u,T.id3=y,T.initSegment=p,T},v}(),I=function(A,M,L){return Object(B.getStartDTS)(A,M)-L};function R(v,A){var M=v==null?void 0:v.codec;return M&&M.length>4?M:M==="hvc1"?"hvc1.1.c.L120.90":M==="av01"?"av01.0.04M.08":M==="avc1"||A===_.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}J.default=j},"./src/task-loop.ts":function(he,J,D){"use strict";D.r(J),D.d(J,"default",function(){return Q});var Q=function(){function B(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var _=B.prototype;return _.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},_.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},_.onHandlerDestroyed=function(){},_.hasInterval=function(){return!!this._tickInterval},_.hasNextTick=function(){return!!this._tickTimer},_.setInterval=function(j){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,j),!0)},_.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},_.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},_.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},_.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},_.doTick=function(){},B}()},"./src/types/cmcd.ts":function(he,J,D){"use strict";D.r(J),D.d(J,"CMCDVersion",function(){return Q}),D.d(J,"CMCDObjectType",function(){return B}),D.d(J,"CMCDStreamingFormat",function(){return _}),D.d(J,"CMCDStreamType",function(){return G});var Q=1,B;(function(j){j.MANIFEST="m",j.AUDIO="a",j.VIDEO="v",j.MUXED="av",j.INIT="i",j.CAPTION="c",j.TIMED_TEXT="tt",j.KEY="k",j.OTHER="o"})(B||(B={}));var _;(function(j){j.DASH="d",j.HLS="h",j.SMOOTH="s",j.OTHER="o"})(_||(_={}));var G;(function(j){j.VOD="v",j.LIVE="l"})(G||(G={}))},"./src/types/level.ts":function(he,J,D){"use strict";D.r(J),D.d(J,"HlsSkip",function(){return _}),D.d(J,"getSkipValue",function(){return G}),D.d(J,"HlsUrlParameters",function(){return j}),D.d(J,"Level",function(){return I});function Q(R,v){for(var A=0;A<v.length;A++){var M=v[A];M.enumerable=M.enumerable||!1,M.configurable=!0,"value"in M&&(M.writable=!0),Object.defineProperty(R,M.key,M)}}function B(R,v,A){return v&&Q(R.prototype,v),A&&Q(R,A),R}var _;(function(R){R.No="",R.Yes="YES",R.v2="v2"})(_||(_={}));function G(R,v){var A=R.canSkipUntil,M=R.canSkipDateRanges,L=R.endSN,w=v!==void 0?v-L:0;return A&&w<A?M?_.v2:_.Yes:_.No}var j=function(){function R(A,M,L){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=A,this.part=M,this.skip=L}var v=R.prototype;return v.addDirectives=function(M){var L=new self.URL(M);return this.msn!==void 0&&L.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&L.searchParams.set("_HLS_part",this.part.toString()),this.skip&&L.searchParams.set("_HLS_skip",this.skip),L.toString()},R}(),I=function(){function R(v){this.attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.unknownCodecs=void 0,this.audioGroupIds=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.textGroupIds=void 0,this.url=void 0,this._urlId=0,this.url=[v.url],this.attrs=v.attrs,this.bitrate=v.bitrate,v.details&&(this.details=v.details),this.id=v.id||0,this.name=v.name,this.width=v.width||0,this.height=v.height||0,this.audioCodec=v.audioCodec,this.videoCodec=v.videoCodec,this.unknownCodecs=v.unknownCodecs,this.codecSet=[v.videoCodec,v.audioCodec].filter(function(A){return A}).join(",").replace(/\.[^.,]+/g,"")}return B(R,[{key:"maxBitrate",get:function(){return Math.max(this.realBitrate,this.bitrate)}},{key:"uri",get:function(){return this.url[this._urlId]||""}},{key:"urlId",get:function(){return this._urlId},set:function(A){var M=A%this.url.length;this._urlId!==M&&(this.details=void 0,this._urlId=M)}}]),R}()},"./src/types/loader.ts":function(he,J,D){"use strict";D.r(J),D.d(J,"PlaylistContextType",function(){return Q}),D.d(J,"PlaylistLevelType",function(){return B});var Q;(function(_){_.MANIFEST="manifest",_.LEVEL="level",_.AUDIO_TRACK="audioTrack",_.SUBTITLE_TRACK="subtitleTrack"})(Q||(Q={}));var B;(function(_){_.MAIN="main",_.AUDIO="audio",_.SUBTITLE="subtitle"})(B||(B={}))},"./src/types/transmuxer.ts":function(he,J,D){"use strict";D.r(J),D.d(J,"ChunkMetadata",function(){return Q});var Q=function(G,j,I,R,v,A){R===void 0&&(R=0),v===void 0&&(v=-1),A===void 0&&(A=!1),this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=B(),this.buffering={audio:B(),video:B(),audiovideo:B()},this.level=G,this.sn=j,this.id=I,this.size=R,this.part=v,this.partial=A};function B(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(he,J,D){"use strict";D.r(J),D.d(J,"AttrList",function(){return _});var Q=/^(\d+)x(\d+)$/,B=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,_=function(){function G(I){typeof I=="string"&&(I=G.parseAttrList(I));for(var R in I)I.hasOwnProperty(R)&&(this[R]=I[R])}var j=G.prototype;return j.decimalInteger=function(R){var v=parseInt(this[R],10);return v>Number.MAX_SAFE_INTEGER?Infinity:v},j.hexadecimalInteger=function(R){if(this[R]){var v=(this[R]||"0x").slice(2);v=(v.length&1?"0":"")+v;for(var A=new Uint8Array(v.length/2),M=0;M<v.length/2;M++)A[M]=parseInt(v.slice(M*2,M*2+2),16);return A}else return null},j.hexadecimalIntegerAsNumber=function(R){var v=parseInt(this[R],16);return v>Number.MAX_SAFE_INTEGER?Infinity:v},j.decimalFloatingPoint=function(R){return parseFloat(this[R])},j.optionalFloat=function(R,v){var A=this[R];return A?parseFloat(A):v},j.enumeratedString=function(R){return this[R]},j.bool=function(R){return this[R]==="YES"},j.decimalResolution=function(R){var v=Q.exec(this[R]);return v===null?void 0:{width:parseInt(v[1],10),height:parseInt(v[2],10)}},G.parseAttrList=function(R){var v,A={},M='"';for(B.lastIndex=0;(v=B.exec(R))!==null;){var L=v[2];L.indexOf(M)===0&&L.lastIndexOf(M)===L.length-1&&(L=L.slice(1,-1)),A[v[1]]=L}return A},G}()},"./src/utils/binary-search.ts":function(he,J,D){"use strict";D.r(J);var Q={search:function(_,G){for(var j=0,I=_.length-1,R=null,v=null;j<=I;){R=(j+I)/2|0,v=_[R];var A=G(v);if(A>0)j=R+1;else if(A<0)I=R-1;else return v}return null}};J.default=Q},"./src/utils/buffer-helper.ts":function(he,J,D){"use strict";D.r(J),D.d(J,"BufferHelper",function(){return _});var Q=D("./src/utils/logger.ts"),B={length:0,start:function(){return 0},end:function(){return 0}},_=function(){function G(){}return G.isBuffered=function(I,R){try{if(I){for(var v=G.getBuffered(I),A=0;A<v.length;A++)if(R>=v.start(A)&&R<=v.end(A))return!0}}catch(M){}return!1},G.bufferInfo=function(I,R,v){try{if(I){var A=G.getBuffered(I),M=[],L;for(L=0;L<A.length;L++)M.push({start:A.start(L),end:A.end(L)});return this.bufferedInfo(M,R,v)}}catch(w){}return{len:0,start:R,end:R,nextStart:void 0}},G.bufferedInfo=function(I,R,v){R=Math.max(0,R),I.sort(function(p,k){var x=p.start-k.start;return x||k.end-p.end});var A=[];if(v)for(var M=0;M<I.length;M++){var L=A.length;if(L){var w=A[L-1].end;I[M].start-w<v?I[M].end>w&&(A[L-1].end=I[M].end):A.push(I[M])}else A.push(I[M])}else A=I;for(var y=0,u,o=R,l=R,d=0;d<A.length;d++){var T=A[d].start,c=A[d].end;if(R+v>=T&&R<c)o=T,l=c,y=l-R;else if(R+v<T){u=T;break}}return{len:y,start:o||0,end:l||0,nextStart:u}},G.getBuffered=function(I){try{return I.buffered}catch(R){return Q.logger.log("failed to get media.buffered",R),B}},G}()},"./src/utils/cea-608-parser.ts":function(he,J,D){"use strict";D.r(J),D.d(J,"Row",function(){return l}),D.d(J,"CaptionScreen",function(){return d});var Q=D("./src/utils/logger.ts"),B={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},_=function(g){var h=g;return B.hasOwnProperty(g)&&(h=B[g]),String.fromCharCode(h)},G=15,j=100,I={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},R={17:2,18:4,21:6,22:8,23:10,19:13,20:15},v={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},A={25:2,26:4,29:6,30:8,31:10,27:13,28:15},M=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],L;(function(m){m[m.ERROR=0]="ERROR",m[m.TEXT=1]="TEXT",m[m.WARNING=2]="WARNING",m[m.INFO=2]="INFO",m[m.DEBUG=3]="DEBUG",m[m.DATA=3]="DATA"})(L||(L={}));var w=function(){function m(){this.time=null,this.verboseLevel=L.ERROR}var g=m.prototype;return g.log=function(a,E){this.verboseLevel>=a&&Q.logger.log(this.time+" ["+a+"] "+E)},m}(),y=function(g){for(var h=[],a=0;a<g.length;a++)h.push(g[a].toString(16));return h},u=function(){function m(h,a,E,b,S){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=h||"white",this.underline=a||!1,this.italics=E||!1,this.background=b||"black",this.flash=S||!1}var g=m.prototype;return g.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},g.setStyles=function(a){for(var E=["foreground","underline","italics","background","flash"],b=0;b<E.length;b++){var S=E[b];a.hasOwnProperty(S)&&(this[S]=a[S])}},g.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},g.equals=function(a){return this.foreground===a.foreground&&this.underline===a.underline&&this.italics===a.italics&&this.background===a.background&&this.flash===a.flash},g.copy=function(a){this.foreground=a.foreground,this.underline=a.underline,this.italics=a.italics,this.background=a.background,this.flash=a.flash},g.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},m}(),o=function(){function m(h,a,E,b,S,N){this.uchar=void 0,this.penState=void 0,this.uchar=h||" ",this.penState=new u(a,E,b,S,N)}var g=m.prototype;return g.reset=function(){this.uchar=" ",this.penState.reset()},g.setChar=function(a,E){this.uchar=a,this.penState.copy(E)},g.setPenState=function(a){this.penState.copy(a)},g.equals=function(a){return this.uchar===a.uchar&&this.penState.equals(a.penState)},g.copy=function(a){this.uchar=a.uchar,this.penState.copy(a.penState)},g.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},m}(),l=function(){function m(h){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var a=0;a<j;a++)this.chars.push(new o);this.logger=h,this.pos=0,this.currPenState=new u}var g=m.prototype;return g.equals=function(a){for(var E=!0,b=0;b<j;b++)if(!this.chars[b].equals(a.chars[b])){E=!1;break}return E},g.copy=function(a){for(var E=0;E<j;E++)this.chars[E].copy(a.chars[E])},g.isEmpty=function(){for(var a=!0,E=0;E<j;E++)if(!this.chars[E].isEmpty()){a=!1;break}return a},g.setCursor=function(a){this.pos!==a&&(this.pos=a),this.pos<0?(this.logger.log(L.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>j&&(this.logger.log(L.DEBUG,"Too large cursor position "+this.pos),this.pos=j)},g.moveCursor=function(a){var E=this.pos+a;if(a>1)for(var b=this.pos+1;b<E+1;b++)this.chars[b].setPenState(this.currPenState);this.setCursor(E)},g.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},g.insertChar=function(a){a>=144&&this.backSpace();var E=_(a);if(this.pos>=j){this.logger.log(L.ERROR,"Cannot insert "+a.toString(16)+" ("+E+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(E,this.currPenState),this.moveCursor(1)},g.clearFromPos=function(a){var E;for(E=a;E<j;E++)this.chars[E].reset()},g.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},g.clearToEndOfRow=function(){this.clearFromPos(this.pos)},g.getTextString=function(){for(var a=[],E=!0,b=0;b<j;b++){var S=this.chars[b].uchar;S!==" "&&(E=!1),a.push(S)}return E?"":a.join("")},g.setPenStyles=function(a){this.currPenState.setStyles(a);var E=this.chars[this.pos];E.setPenState(this.currPenState)},m}(),d=function(){function m(h){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var a=0;a<G;a++)this.rows.push(new l(h));this.logger=h,this.currRow=G-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var g=m.prototype;return g.reset=function(){for(var a=0;a<G;a++)this.rows[a].clear();this.currRow=G-1},g.equals=function(a){for(var E=!0,b=0;b<G;b++)if(!this.rows[b].equals(a.rows[b])){E=!1;break}return E},g.copy=function(a){for(var E=0;E<G;E++)this.rows[E].copy(a.rows[E])},g.isEmpty=function(){for(var a=!0,E=0;E<G;E++)if(!this.rows[E].isEmpty()){a=!1;break}return a},g.backSpace=function(){var a=this.rows[this.currRow];a.backSpace()},g.clearToEndOfRow=function(){var a=this.rows[this.currRow];a.clearToEndOfRow()},g.insertChar=function(a){var E=this.rows[this.currRow];E.insertChar(a)},g.setPen=function(a){var E=this.rows[this.currRow];E.setPenStyles(a)},g.moveCursor=function(a){var E=this.rows[this.currRow];E.moveCursor(a)},g.setCursor=function(a){this.logger.log(L.INFO,"setCursor: "+a);var E=this.rows[this.currRow];E.setCursor(a)},g.setPAC=function(a){this.logger.log(L.INFO,"pacData = "+JSON.stringify(a));var E=a.row-1;if(this.nrRollUpRows&&E<this.nrRollUpRows-1&&(E=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==E){for(var b=0;b<G;b++)this.rows[b].clear();var S=this.currRow+1-this.nrRollUpRows,N=this.lastOutputScreen;if(N){var U=N.rows[S].cueStartTime,K=this.logger.time;if(U&&K!==null&&U<K)for(var V=0;V<this.nrRollUpRows;V++)this.rows[E-this.nrRollUpRows+V+1].copy(N.rows[S+V])}}this.currRow=E;var O=this.rows[this.currRow];if(a.indent!==null){var P=a.indent,$=Math.max(P-1,0);O.setCursor(a.indent),a.color=O.chars[$].penState.foreground}var ee={foreground:a.color,underline:a.underline,italics:a.italics,background:"black",flash:!1};this.setPen(ee)},g.setBkgData=function(a){this.logger.log(L.INFO,"bkgData = "+JSON.stringify(a)),this.backSpace(),this.setPen(a),this.insertChar(32)},g.setRollUpRows=function(a){this.nrRollUpRows=a},g.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(L.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(L.TEXT,this.getDisplayText());var a=this.currRow+1-this.nrRollUpRows,E=this.rows.splice(a,1)[0];E.clear(),this.rows.splice(this.currRow,0,E),this.logger.log(L.INFO,"Rolling up")},g.getDisplayText=function(a){a=a||!1;for(var E=[],b="",S=-1,N=0;N<G;N++){var U=this.rows[N].getTextString();U&&(S=N+1,a?E.push("Row "+S+": '"+U+"'"):E.push(U.trim()))}return E.length>0&&(a?b="["+E.join(" | ")+"]":b=E.join(`
`)),b},g.getTextAndFormat=function(){return this.rows},m}(),T=function(){function m(h,a,E){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=h,this.outputFilter=a,this.mode=null,this.verbose=0,this.displayedMemory=new d(E),this.nonDisplayedMemory=new d(E),this.lastOutputScreen=new d(E),this.currRollUpRow=this.displayedMemory.rows[G-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=E}var g=m.prototype;return g.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[G-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},g.getHandler=function(){return this.outputFilter},g.setHandler=function(a){this.outputFilter=a},g.setPAC=function(a){this.writeScreen.setPAC(a)},g.setBkgData=function(a){this.writeScreen.setBkgData(a)},g.setMode=function(a){if(a===this.mode)return;this.mode=a,this.logger.log(L.INFO,"MODE="+a),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=a},g.insertChars=function(a){for(var E=0;E<a.length;E++)this.writeScreen.insertChar(a[E]);var b=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(L.INFO,b+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(L.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},g.ccRCL=function(){this.logger.log(L.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},g.ccBS=function(){if(this.logger.log(L.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},g.ccAOF=function(){},g.ccAON=function(){},g.ccDER=function(){this.logger.log(L.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},g.ccRU=function(a){this.logger.log(L.INFO,"RU("+a+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(a)},g.ccFON=function(){this.logger.log(L.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},g.ccRDC=function(){this.logger.log(L.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},g.ccTR=function(){this.logger.log(L.INFO,"TR"),this.setMode("MODE_TEXT")},g.ccRTD=function(){this.logger.log(L.INFO,"RTD"),this.setMode("MODE_TEXT")},g.ccEDM=function(){this.logger.log(L.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},g.ccCR=function(){this.logger.log(L.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},g.ccENM=function(){this.logger.log(L.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},g.ccEOC=function(){if(this.logger.log(L.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var a=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=a,this.writeScreen=this.nonDisplayedMemory,this.logger.log(L.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},g.ccTO=function(a){this.logger.log(L.INFO,"TO("+a+") - Tab Offset"),this.writeScreen.moveCursor(a)},g.ccMIDROW=function(a){var E={flash:!1};if(E.underline=a%2===1,E.italics=a>=46,E.italics)E.foreground="white";else{var b=Math.floor(a/2)-16,S=["white","green","blue","cyan","red","yellow","magenta"];E.foreground=S[b]}this.logger.log(L.INFO,"MIDROW: "+JSON.stringify(E)),this.writeScreen.setPen(E)},g.outputDataUpdate=function(a){a===void 0&&(a=!1);var E=this.logger.time;if(E===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=E:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,E,this.lastOutputScreen),a&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:E),this.lastOutputScreen.copy(this.displayedMemory))},g.cueSplitAtTime=function(a){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,a,this.displayedMemory),this.cueStartTime=a))},m}(),c=function(){function m(h,a,E){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var b=new w;this.channels=[null,new T(h,a,b),new T(h+1,E,b)],this.cmdHistory=x(),this.logger=b}var g=m.prototype;return g.getHandler=function(a){return this.channels[a].getHandler()},g.setHandler=function(a,E){this.channels[a].setHandler(E)},g.addData=function(a,E){var b,S,N,U=!1;this.logger.time=a;for(var K=0;K<E.length;K+=2){if(S=E[K]&127,N=E[K+1]&127,S===0&&N===0)continue;if(this.logger.log(L.DATA,"["+y([E[K],E[K+1]])+"] -> ("+y([S,N])+")"),b=this.parseCmd(S,N),b||(b=this.parseMidrow(S,N)),b||(b=this.parsePAC(S,N)),b||(b=this.parseBackgroundAttributes(S,N)),!b&&(U=this.parseChars(S,N),U)){var V=this.currentChannel;if(V&&V>0){var O=this.channels[V];O.insertChars(U)}else this.logger.log(L.WARNING,"No channel found yet. TEXT-MODE?")}!b&&!U&&this.logger.log(L.WARNING,"Couldn't parse cleaned data "+y([S,N])+" orig: "+y([E[K],E[K+1]]))}},g.parseCmd=function(a,E){var b=this.cmdHistory,S=(a===20||a===28||a===21||a===29)&&E>=32&&E<=47,N=(a===23||a===31)&&E>=33&&E<=35;if(!(S||N))return!1;if(k(a,E,b))return p(null,null,b),this.logger.log(L.DEBUG,"Repeated command ("+y([a,E])+") is dropped"),!0;var U=a===20||a===21||a===23?1:2,K=this.channels[U];return a===20||a===21||a===28||a===29?E===32?K.ccRCL():E===33?K.ccBS():E===34?K.ccAOF():E===35?K.ccAON():E===36?K.ccDER():E===37?K.ccRU(2):E===38?K.ccRU(3):E===39?K.ccRU(4):E===40?K.ccFON():E===41?K.ccRDC():E===42?K.ccTR():E===43?K.ccRTD():E===44?K.ccEDM():E===45?K.ccCR():E===46?K.ccENM():E===47&&K.ccEOC():K.ccTO(E-32),p(a,E,b),this.currentChannel=U,!0},g.parseMidrow=function(a,E){var b=0;if((a===17||a===25)&&E>=32&&E<=47){if(a===17?b=1:b=2,b!==this.currentChannel)return this.logger.log(L.ERROR,"Mismatch channel in midrow parsing"),!1;var S=this.channels[b];return S?(S.ccMIDROW(E),this.logger.log(L.DEBUG,"MIDROW ("+y([a,E])+")"),!0):!1}return!1},g.parsePAC=function(a,E){var b,S=this.cmdHistory,N=(a>=17&&a<=23||a>=25&&a<=31)&&E>=64&&E<=127,U=(a===16||a===24)&&E>=64&&E<=95;if(!(N||U))return!1;if(k(a,E,S))return p(null,null,S),!0;var K=a<=23?1:2;E>=64&&E<=95?b=K===1?I[a]:v[a]:b=K===1?R[a]:A[a];var V=this.channels[K];return V?(V.setPAC(this.interpretPAC(b,E)),p(a,E,S),this.currentChannel=K,!0):!1},g.interpretPAC=function(a,E){var b,S={color:null,italics:!1,indent:null,underline:!1,row:a};return E>95?b=E-96:b=E-64,S.underline=(b&1)===1,b<=13?S.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(b/2)]:b<=15?(S.italics=!0,S.color="white"):S.indent=Math.floor((b-16)/2)*4,S},g.parseChars=function(a,E){var b,S=null,N=null;if(a>=25?(b=2,N=a-8):(b=1,N=a),N>=17&&N<=19){var U;N===17?U=E+80:N===18?U=E+112:U=E+144,this.logger.log(L.INFO,"Special char '"+_(U)+"' in channel "+b),S=[U]}else a>=32&&a<=127&&(S=E===0?[a]:[a,E]);if(S){var K=y(S);this.logger.log(L.DEBUG,"Char codes = "+K.join(",")),p(a,E,this.cmdHistory)}return S},g.parseBackgroundAttributes=function(a,E){var b=(a===16||a===24)&&E>=32&&E<=47,S=(a===23||a===31)&&E>=45&&E<=47;if(!(b||S))return!1;var N,U={};a===16||a===24?(N=Math.floor((E-32)/2),U.background=M[N],E%2===1&&(U.background=U.background+"_semi")):E===45?U.background="transparent":(U.foreground="black",E===47&&(U.underline=!0));var K=a<=23?1:2,V=this.channels[K];return V.setBkgData(U),p(a,E,this.cmdHistory),!0},g.reset=function(){for(var a=0;a<Object.keys(this.channels).length;a++){var E=this.channels[a];E&&E.reset()}this.cmdHistory=x()},g.cueSplitAtTime=function(a){for(var E=0;E<this.channels.length;E++){var b=this.channels[E];b&&b.cueSplitAtTime(a)}},m}();function p(m,g,h){h.a=m,h.b=g}function k(m,g,h){return h.a===m&&h.b===g}function x(){return{a:null,b:null}}J.default=c},"./src/utils/codecs.ts":function(he,J,D){"use strict";D.r(J),D.d(J,"isCodecType",function(){return B}),D.d(J,"isCodecSupportedInMp4",function(){return _});var Q={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 B(G,j){var I=Q[j];return!!I&&I[G.slice(0,4)]===!0}function _(G,j){return MediaSource.isTypeSupported((j||"video")+'/mp4;codecs="'+G+'"')}},"./src/utils/cues.ts":function(he,J,D){"use strict";D.r(J);var Q=D("./src/utils/vttparser.ts"),B=D("./src/utils/webvtt-parser.ts"),_=D("./src/utils/texttrack-utils.ts"),G=/\s/,j={newCue:function(R,v,A,M){for(var L=[],w,y,u,o,l,d=self.VTTCue||self.TextTrackCue,T=0;T<M.rows.length;T++)if(w=M.rows[T],u=!0,o=0,l="",!w.isEmpty()){for(var c=0;c<w.chars.length;c++)G.test(w.chars[c].uchar)&&u?o++:(l+=w.chars[c].uchar,u=!1);w.cueStartTime=v,v===A&&(A+=1e-4),o>=16?o--:o++;var p=Object(Q.fixLineBreaks)(l.trim()),k=Object(B.generateCueId)(v,A,p);(!R||!R.cues||!R.cues.getCueById(k))&&(y=new d(v,A,p),y.id=k,y.line=T+1,y.align="left",y.position=10+Math.min(80,Math.floor(o*8/32)*10),L.push(y))}return R&&L.length&&(L.sort(function(x,m){return x.line==="auto"||m.line==="auto"?0:x.line>8&&m.line>8?m.line-x.line:x.line-m.line}),L.forEach(function(x){return Object(_.addCueToTrack)(R,x)})),L}};J.default=j},"./src/utils/discontinuities.ts":function(he,J,D){"use strict";D.r(J),D.d(J,"findFirstFragWithCC",function(){return G}),D.d(J,"shouldAlignOnDiscontinuities",function(){return j}),D.d(J,"findDiscontinuousReferenceFrag",function(){return I}),D.d(J,"adjustSlidingStart",function(){return v}),D.d(J,"alignStream",function(){return A}),D.d(J,"alignPDT",function(){return L}),D.d(J,"alignFragmentByPDTDelta",function(){return w}),D.d(J,"alignMediaPlaylistByPDT",function(){return y});var Q=D("./src/polyfills/number.ts"),B=D("./src/utils/logger.ts"),_=D("./src/controller/level-helper.ts");function G(u,o){for(var l=null,d=0,T=u.length;d<T;d++){var c=u[d];if(c&&c.cc===o){l=c;break}}return l}function j(u,o,l){return!!(o.details&&(l.endCC>l.startCC||u&&u.cc<l.startCC))}function I(u,o){var l=u.fragments,d=o.fragments;if(!d.length||!l.length){B.logger.log("No fragments to align");return}var T=G(l,d[0].cc);if(!T||T&&!T.startPTS){B.logger.log("No frag in previous level to align on");return}return T}function R(u,o){if(u){var l=u.start+o;u.start=u.startPTS=l,u.endPTS=l+u.duration}}function v(u,o){for(var l=o.fragments,d=0,T=l.length;d<T;d++)R(l[d],u);o.fragmentHint&&R(o.fragmentHint,u),o.alignedSliding=!0}function A(u,o,l){if(!o)return;M(u,l,o),!l.alignedSliding&&o.details&&L(l,o.details),!l.alignedSliding&&o.details&&!l.skippedSegments&&Object(_.adjustSliding)(o.details,l)}function M(u,o,l){if(j(u,l,o)){var d=I(l.details,o);d&&Object(Q.isFiniteNumber)(d.start)&&(B.logger.log("Adjusting PTS using last level due to CC increase within current level "+o.url),v(d.start,o))}}function L(u,o){if(!o.fragments.length||!u.hasProgramDateTime||!o.hasProgramDateTime)return;var l=o.fragments[0].programDateTime,d=u.fragments[0].programDateTime,T=(d-l)/1e3+o.fragments[0].start;T&&Object(Q.isFiniteNumber)(T)&&(B.logger.log("Adjusting PTS using programDateTime delta "+(d-l)+"ms, sliding:"+T.toFixed(3)+" "+u.url+" "),v(T,u))}function w(u,o){var l=u.programDateTime;if(!l)return;var d=(l-o)/1e3;u.start=u.startPTS=d,u.endPTS=d+u.duration}function y(u,o){if(!o.fragments.length||!u.hasProgramDateTime||!o.hasProgramDateTime)return;var l=o.fragments[0].programDateTime,d=o.fragments[0].start,T=l-d*1e3;u.fragments.forEach(function(c){w(c,T)}),u.fragmentHint&&w(u.fragmentHint,T),u.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(he,J,D){"use strict";D.r(J);var Q=D("./src/utils/ewma.ts"),B=function(){function _(j,I,R){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=R,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new Q.default(j),this.fast_=new Q.default(I)}var G=_.prototype;return G.update=function(I,R){var v=this.slow_,A=this.fast_;this.slow_.halfLife!==I&&(this.slow_=new Q.default(I,v.getEstimate(),v.getTotalWeight())),this.fast_.halfLife!==R&&(this.fast_=new Q.default(R,A.getEstimate(),A.getTotalWeight()))},G.sample=function(I,R){I=Math.max(I,this.minDelayMs_);var v=8*R,A=I/1e3,M=v/A;this.fast_.sample(A,M),this.slow_.sample(A,M)},G.canEstimate=function(){var I=this.fast_;return I&&I.getTotalWeight()>=this.minWeight_},G.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},G.destroy=function(){},_}();J.default=B},"./src/utils/ewma.ts":function(he,J,D){"use strict";D.r(J);var Q=function(){function B(G,j,I){j===void 0&&(j=0),I===void 0&&(I=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=G,this.alpha_=G?Math.exp(Math.log(.5)/G):0,this.estimate_=j,this.totalWeight_=I}var _=B.prototype;return _.sample=function(j,I){var R=Math.pow(this.alpha_,j);this.estimate_=I*(1-R)+R*this.estimate_,this.totalWeight_+=j},_.getTotalWeight=function(){return this.totalWeight_},_.getEstimate=function(){if(this.alpha_){var j=1-Math.pow(this.alpha_,this.totalWeight_);if(j)return this.estimate_/j}return this.estimate_},B}();J.default=Q},"./src/utils/fetch-loader.ts":function(he,J,D){"use strict";D.r(J),D.d(J,"fetchSupported",function(){return w});var Q=D("./src/polyfills/number.ts"),B=D("./src/loader/load-stats.ts"),_=D("./src/demux/chunk-cache.ts");function G(d,T){d.prototype=Object.create(T.prototype),d.prototype.constructor=d,A(d,T)}function j(d){var T=typeof Map=="function"?new Map:void 0;return j=function(p){if(p===null||!v(p))return p;if(typeof p!="function")throw new TypeError("Super expression must either be null or a function");if(typeof T!="undefined"){if(T.has(p))return T.get(p);T.set(p,k)}function k(){return I(p,arguments,M(this).constructor)}return k.prototype=Object.create(p.prototype,{constructor:{value:k,enumerable:!1,writable:!0,configurable:!0}}),A(k,p)},j(d)}function I(d,T,c){return R()?I=Reflect.construct:I=function(k,x,m){var g=[null];g.push.apply(g,x);var h=Function.bind.apply(k,g),a=new h;return m&&A(a,m.prototype),a},I.apply(null,arguments)}function R(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(d){return!1}}function v(d){return Function.toString.call(d).indexOf("[native code]")!==-1}function A(d,T){return A=Object.setPrototypeOf||function(p,k){return p.__proto__=k,p},A(d,T)}function M(d){return M=Object.setPrototypeOf?Object.getPrototypeOf:function(c){return c.__proto__||Object.getPrototypeOf(c)},M(d)}function L(){return L=Object.assign||function(d){for(var T=1;T<arguments.length;T++){var c=arguments[T];for(var p in c)Object.prototype.hasOwnProperty.call(c,p)&&(d[p]=c[p])}return d},L.apply(this,arguments)}function w(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(d){}return!1}var y=function(){function d(c){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=c.fetchSetup||o,this.controller=new self.AbortController,this.stats=new B.LoadStats}var T=d.prototype;return T.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},T.abortInternal=function(){var p=this.response;(!p||!p.ok)&&(this.stats.aborted=!0,this.controller.abort())},T.abort=function(){var p;this.abortInternal(),(p=this.callbacks)!==null&&p!==void 0&&p.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},T.load=function(p,k,x){var m=this,g=this.stats;if(g.loading.start)throw new Error("Loader can only be used once.");g.loading.start=self.performance.now();var h=u(p,this.controller.signal),a=x.onProgress,E=p.responseType==="arraybuffer",b=E?"byteLength":"length";this.context=p,this.config=k,this.callbacks=x,this.request=this.fetchSetup(p,h),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){m.abortInternal(),x.onTimeout(g,p,m.response)},k.timeout),self.fetch(this.request).then(function(S){if(m.response=m.loader=S,!S.ok){var N=S.status,U=S.statusText;throw new l(U||"fetch, bad network response",N,S)}return g.loading.first=Math.max(self.performance.now(),g.loading.start),g.total=parseInt(S.headers.get("Content-Length")||"0"),a&&Object(Q.isFiniteNumber)(k.highWaterMark)?m.loadProgressively(S,g,p,k.highWaterMark,a):E?S.arrayBuffer():S.text()}).then(function(S){var N=m.response;self.clearTimeout(m.requestTimeout),g.loading.end=Math.max(self.performance.now(),g.loading.first),g.loaded=g.total=S[b];var U={url:N.url,data:S};a&&!Object(Q.isFiniteNumber)(k.highWaterMark)&&a(g,p,S,N),x.onSuccess(U,g,p,N)}).catch(function(S){if(self.clearTimeout(m.requestTimeout),g.aborted)return;var N=S.code||0;x.onError({code:N,text:S.message},p,S.details)})},T.getCacheAge=function(){var p=null;if(this.response){var k=this.response.headers.get("age");p=k?parseFloat(k):null}return p},T.loadProgressively=function(p,k,x,m,g){m===void 0&&(m=0);var h=new _.default,a=p.body.getReader(),E=function b(){return a.read().then(function(S){if(S.done)return h.dataLength&&g(k,x,h.flush(),p),Promise.resolve(new ArrayBuffer(0));var N=S.value,U=N.length;return k.loaded+=U,U<m||h.dataLength?(h.push(N),h.dataLength>=m&&g(k,x,h.flush(),p)):g(k,x,N,p),b()}).catch(function(){return Promise.reject()})};return E()},d}();function u(d,T){var c={method:"GET",mode:"cors",credentials:"same-origin",signal:T,headers:new self.Headers(L({},d.headers))};return d.rangeEnd&&c.headers.set("Range","bytes="+d.rangeStart+"-"+String(d.rangeEnd-1)),c}function o(d,T){return new self.Request(d.url,T)}var l=function(d){G(T,d);function T(c,p,k){var x;return x=d.call(this,c)||this,x.code=void 0,x.details=void 0,x.code=p,x.details=k,x}return T}(j(Error));J.default=y},"./src/utils/imsc1-ttml-parser.ts":function(he,J,D){"use strict";D.r(J),D.d(J,"IMSC1_CODEC",function(){return v}),D.d(J,"parseIMSC1",function(){return w});var Q=D("./src/utils/mp4-tools.ts"),B=D("./src/utils/vttparser.ts"),_=D("./src/utils/vttcue.ts"),G=D("./src/demux/id3.ts"),j=D("./src/utils/timescale-conversion.ts"),I=D("./src/utils/webvtt-parser.ts");function R(){return R=Object.assign||function(m){for(var g=1;g<arguments.length;g++){var h=arguments[g];for(var a in h)Object.prototype.hasOwnProperty.call(h,a)&&(m[a]=h[a])}return m},R.apply(this,arguments)}var v="stpp.ttml.im1t",A=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,M=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,L={left:"start",center:"center",right:"end",start:"start",end:"end"};function w(m,g,h,a,E){var b=Object(Q.findBox)(new Uint8Array(m),["mdat"]);if(b.length===0){E(new Error("Could not parse IMSC1 mdat"));return}var S=b[0],N=Object(G.utf8ArrayToStr)(new Uint8Array(m,S.start,S.end-S.start)),U=Object(j.toTimescaleFromScale)(g,1,h);try{a(y(N,U))}catch(K){E(K)}}function y(m,g){var h=new DOMParser,a=h.parseFromString(m,"text/xml"),E=a.getElementsByTagName("tt")[0];if(!E)throw new Error("Invalid ttml");var b={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},S=Object.keys(b).reduce(function(O,P){return O[P]=E.getAttribute("ttp:"+P)||b[P],O},{}),N=E.getAttribute("xml:space")!=="preserve",U=o(u(E,"styling","style")),K=o(u(E,"layout","region")),V=u(E,"body","[begin]");return[].map.call(V,function(O){var P=l(O,N);if(!P||!O.hasAttribute("begin"))return null;var $=p(O.getAttribute("begin"),S),ee=p(O.getAttribute("dur"),S),oe=p(O.getAttribute("end"),S);if($===null)throw c(O);if(oe===null){if(ee===null)throw c(O);oe=$+ee}var fe=new _.default($-g,oe-g,P);fe.id=Object(I.generateCueId)(fe.startTime,fe.endTime,fe.text);var Oe=K[O.getAttribute("region")],Ce=U[O.getAttribute("style")];fe.position=10,fe.size=80;var Ae=d(Oe,Ce),Le=Ae.textAlign;if(Le){var be=L[Le];be&&(fe.lineAlign=be),fe.align=Le}return R(fe,Ae),fe}).filter(function(O){return O!==null})}function u(m,g,h){var a=m.getElementsByTagName(g)[0];return a?[].slice.call(a.querySelectorAll(h)):[]}function o(m){return m.reduce(function(g,h){var a=h.getAttribute("xml:id");return a&&(g[a]=h),g},{})}function l(m,g){return[].slice.call(m.childNodes).reduce(function(h,a,E){var b;return a.nodeName==="br"&&E?h+`
`:(b=a.childNodes)!==null&&b!==void 0&&b.length?l(a,g):g?h+a.textContent.trim().replace(/\s+/g," "):h+a.textContent},"")}function d(m,g){var h="http://www.w3.org/ns/ttml#styling",a=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return a.reduce(function(E,b){var S=T(g,h,b)||T(m,h,b);return S&&(E[b]=S),E},{})}function T(m,g,h){return m.hasAttributeNS(g,h)?m.getAttributeNS(g,h):null}function c(m){return new Error("Could not parse ttml timestamp "+m)}function p(m,g){if(!m)return null;var h=Object(B.parseTimeStamp)(m);return h===null&&(A.test(m)?h=k(m,g):M.test(m)&&(h=x(m,g))),h}function k(m,g){var h=A.exec(m),a=(h[4]|0)+(h[5]|0)/g.subFrameRate;return(h[1]|0)*3600+(h[2]|0)*60+(h[3]|0)+a/g.frameRate}function x(m,g){var h=M.exec(m),a=Number(h[1]),E=h[2];switch(E){case"h":return a*3600;case"m":return a*60;case"ms":return a*1e3;case"f":return a/g.frameRate;case"t":return a/g.tickRate}return a}},"./src/utils/logger.ts":function(he,J,D){"use strict";D.r(J),D.d(J,"enableLogs",function(){return I}),D.d(J,"logger",function(){return R});var Q=function(){},B={trace:Q,debug:Q,log:Q,warn:Q,info:Q,error:Q},_=B;function G(v){var A=self.console[v];return A?A.bind(self.console,"["+v+"] >"):Q}function j(v){for(var A=arguments.length,M=new Array(A>1?A-1:0),L=1;L<A;L++)M[L-1]=arguments[L];M.forEach(function(w){_[w]=v[w]?v[w].bind(v):G(w)})}function I(v){if(self.console&&v===!0||typeof v=="object"){j(v,"debug","log","info","warn","error");try{_.log()}catch(A){_=B}}else _=B}var R=_},"./src/utils/mediakeys-helper.ts":function(he,J,D){"use strict";D.r(J),D.d(J,"KeySystems",function(){return Q}),D.d(J,"requestMediaKeySystemAccess",function(){return B});var Q;(function(_){_.WIDEVINE="com.widevine.alpha",_.PLAYREADY="com.microsoft.playready"})(Q||(Q={}));var B=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(he,J,D){"use strict";D.r(J),D.d(J,"getMediaSource",function(){return Q});function Q(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(he,J,D){"use strict";D.r(J),D.d(J,"bin2str",function(){return j}),D.d(J,"readUint16",function(){return I}),D.d(J,"readUint32",function(){return R}),D.d(J,"writeUint32",function(){return v}),D.d(J,"findBox",function(){return A}),D.d(J,"parseSegmentIndex",function(){return M}),D.d(J,"parseInitSegment",function(){return L}),D.d(J,"getStartDTS",function(){return w}),D.d(J,"getDuration",function(){return y}),D.d(J,"computeRawDurationFromSamples",function(){return u}),D.d(J,"offsetStartDTS",function(){return o}),D.d(J,"segmentValidRange",function(){return l}),D.d(J,"appendUint8Array",function(){return d});var Q=D("./src/utils/typed-array.ts"),B=D("./src/loader/fragment.ts"),_=Math.pow(2,32)-1,G=[].push;function j(T){return String.fromCharCode.apply(null,T)}function I(T,c){"data"in T&&(c+=T.start,T=T.data);var p=T[c]<<8|T[c+1];return p<0?65536+p:p}function R(T,c){"data"in T&&(c+=T.start,T=T.data);var p=T[c]<<24|T[c+1]<<16|T[c+2]<<8|T[c+3];return p<0?4294967296+p:p}function v(T,c,p){"data"in T&&(c+=T.start,T=T.data),T[c]=p>>24,T[c+1]=p>>16&255,T[c+2]=p>>8&255,T[c+3]=p&255}function A(T,c){var p=[];if(!c.length)return p;var k,x,m;"data"in T?(k=T.data,x=T.start,m=T.end):(k=T,x=0,m=k.byteLength);for(var g=x;g<m;){var h=R(k,g),a=j(k.subarray(g+4,g+8)),E=h>1?g+h:m;if(a===c[0])if(c.length===1)p.push({data:k,start:g+8,end:E});else{var b=A({data:k,start:g+8,end:E},c.slice(1));b.length&&G.apply(p,b)}g=E}return p}function M(T){var c=A(T,["moov"]),p=c[0],k=p?p.end:null,x=A(T,["sidx"]);if(!x||!x[0])return null;var m=[],g=x[0],h=g.data[0],a=h===0?8:16,E=R(g,a);a+=4;var b=0,S=0;h===0?a+=8:a+=16,a+=2;var N=g.end+S,U=I(g,a);a+=2;for(var K=0;K<U;K++){var V=a,O=R(g,V);V+=4;var P=O&2147483647,$=(O&2147483648)>>>31;if($===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var ee=R(g,V);V+=4,m.push({referenceSize:P,subsegmentDuration:ee,info:{duration:ee/E,start:N,end:N+P-1}}),N+=P,V+=4,a=V}return{earliestPresentationTime:b,timescale:E,version:h,referencesCount:U,references:m,moovEndOffset:k}}function L(T){for(var c=[],p=A(T,["moov","trak"]),k=0;k<p.length;k++){var x=p[k],m=A(x,["tkhd"])[0];if(m){var g=m.data[m.start],h=g===0?12:20,a=R(m,h),E=A(x,["mdia","mdhd"])[0];if(E){g=E.data[E.start],h=g===0?12:20;var b=R(E,h),S=A(x,["mdia","hdlr"])[0];if(S){var N=j(S.data.subarray(S.start+8,S.start+12)),U={soun:B.ElementaryStreamTypes.AUDIO,vide:B.ElementaryStreamTypes.VIDEO}[N];if(U){var K=A(x,["mdia","minf","stbl","stsd"])[0],V=void 0;K&&(V=j(K.data.subarray(K.start+12,K.start+16))),c[a]={timescale:b,type:U},c[U]={timescale:b,id:a,codec:V}}}}}}var O=A(T,["moov","mvex","trex"]);return O.forEach(function(P){var $=R(P,4),ee=c[$];ee&&(ee.default={duration:R(P,12),flags:R(P,20)})}),c}function w(T,c){return A(c,["moof","traf"]).reduce(function(p,k){var x=A(k,["tfdt"])[0],m=x.data[x.start],g=A(k,["tfhd"]).reduce(function(h,a){var E=R(a,4),b=T[E];if(b){var S=R(x,4);m===1&&(S*=Math.pow(2,32),S+=R(x,8));var N=b.timescale||9e4,U=S/N;if(isFinite(U)&&(h===null||U<h))return U}return h},null);return g!==null&&isFinite(g)&&(p===null||g<p)?g:p},null)||0}function y(T,c){for(var p=0,k=0,x=0,m=A(T,["moof","traf"]),g=0;g<m.length;g++){var h=m[g],a=A(h,["tfhd"])[0],E=R(a,4),b=c[E];if(!b)continue;var S=b.default,N=R(a,0)|(S==null?void 0:S.flags),U=S==null?void 0:S.duration;N&8&&(N&2?U=R(a,12):U=R(a,8));for(var K=b.timescale||9e4,V=A(h,["trun"]),O=0;O<V.length;O++){if(U){var P=R(V[O],4);p=U*P}else p=u(V[O]);b.type===B.ElementaryStreamTypes.VIDEO?k+=p/K:b.type===B.ElementaryStreamTypes.AUDIO&&(x+=p/K)}}if(k===0&&x===0){var $=M(T);if($!=null&&$.references)return $.references.reduce(function(ee,oe){return ee+oe.info.duration||0},0)}return k||x}function u(T){var c=R(T,0),p=8;c&1&&(p+=4),c&4&&(p+=4);for(var k=0,x=R(T,4),m=0;m<x;m++){if(c&256){var g=R(T,p);k+=g,p+=4}c&512&&(p+=4),c&1024&&(p+=4),c&2048&&(p+=4)}return k}function o(T,c,p){A(c,["moof","traf"]).forEach(function(k){A(k,["tfhd"]).forEach(function(x){var m=R(x,4),g=T[m];if(!g)return;var h=g.timescale||9e4;A(k,["tfdt"]).forEach(function(a){var E=a.data[a.start],b=R(a,4);if(E===0)v(a,4,b-p*h);else{b*=Math.pow(2,32),b+=R(a,8),b-=p*h,b=Math.max(b,0);var S=Math.floor(b/(_+1)),N=Math.floor(b%(_+1));v(a,4,S),v(a,8,N)}})})})}function l(T){var c={valid:null,remainder:null},p=A(T,["moof"]);if(p){if(p.length<2)return c.remainder=T,c}else return c;var k=p[p.length-1];return c.valid=Object(Q.sliceUint8)(T,0,k.start-8),c.remainder=Object(Q.sliceUint8)(T,k.start-8),c}function d(T,c){var p=new Uint8Array(T.length+c.length);return p.set(T),p.set(c,T.length),p}},"./src/utils/output-filter.ts":function(he,J,D){"use strict";D.r(J),D.d(J,"default",function(){return Q});var Q=function(){function B(G,j){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=G,this.trackName=j}var _=B.prototype;return _.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},_.newCue=function(j,I,R){(this.startTime===null||this.startTime>j)&&(this.startTime=j),this.endTime=I,this.screen=R,this.timelineController.createCaptionsTrack(this.trackName)},_.reset=function(){this.cueRanges=[]},B}()},"./src/utils/texttrack-utils.ts":function(he,J,D){"use strict";D.r(J),D.d(J,"sendAddTrackEvent",function(){return B}),D.d(J,"addCueToTrack",function(){return _}),D.d(J,"clearCurrentCues",function(){return G}),D.d(J,"removeCuesInRange",function(){return j}),D.d(J,"getCuesInRange",function(){return R});var Q=D("./src/utils/logger.ts");function B(v,A){var M;try{M=new Event("addtrack")}catch(L){M=document.createEvent("Event"),M.initEvent("addtrack",!1,!1)}M.track=v,A.dispatchEvent(M)}function _(v,A){var M=v.mode;if(M==="disabled"&&(v.mode="hidden"),v.cues&&!v.cues.getCueById(A.id))try{if(v.addCue(A),!v.cues.getCueById(A.id))throw new Error("addCue is failed for: "+A)}catch(w){Q.logger.debug("[texttrack-utils]: "+w);var L=new self.TextTrackCue(A.startTime,A.endTime,A.text);L.id=A.id,v.addCue(L)}M==="disabled"&&(v.mode=M)}function G(v){var A=v.mode;if(A==="disabled"&&(v.mode="hidden"),v.cues)for(var M=v.cues.length;M--;)v.removeCue(v.cues[M]);A==="disabled"&&(v.mode=A)}function j(v,A,M){var L=v.mode;if(L==="disabled"&&(v.mode="hidden"),v.cues&&v.cues.length>0)for(var w=R(v.cues,A,M),y=0;y<w.length;y++)v.removeCue(w[y]);L==="disabled"&&(v.mode=L)}function I(v,A){if(A<v[0].startTime)return 0;var M=v.length-1;if(A>v[M].endTime)return-1;for(var L=0,w=M;L<=w;){var y=Math.floor((w+L)/2);if(A<v[y].startTime)w=y-1;else if(A>v[y].startTime&&L<M)L=y+1;else return y}return v[L].startTime-A<A-v[w].startTime?L:w}function R(v,A,M){var L=[],w=I(v,A);if(w>-1)for(var y=w,u=v.length;y<u;y++){var o=v[y];if(o.startTime>=A&&o.endTime<=M)L.push(o);else if(o.startTime>M)return L}return L}},"./src/utils/time-ranges.ts":function(he,J,D){"use strict";D.r(J);var Q={toString:function(_){for(var G="",j=_.length,I=0;I<j;I++)G+="["+_.start(I).toFixed(3)+","+_.end(I).toFixed(3)+"]";return G}};J.default=Q},"./src/utils/timescale-conversion.ts":function(he,J,D){"use strict";D.r(J),D.d(J,"toTimescaleFromBase",function(){return B}),D.d(J,"toTimescaleFromScale",function(){return _}),D.d(J,"toMsFromMpegTsClock",function(){return G}),D.d(J,"toMpegTsClockFromTimescale",function(){return j});var Q=9e4;function B(I,R,v,A){v===void 0&&(v=1),A===void 0&&(A=!1);var M=I*R*v;return A?Math.round(M):M}function _(I,R,v,A){return v===void 0&&(v=1),A===void 0&&(A=!1),B(I,R,1/v,A)}function G(I,R){return R===void 0&&(R=!1),B(I,1e3,1/Q,R)}function j(I,R){return R===void 0&&(R=1),B(I,Q,1/R)}},"./src/utils/typed-array.ts":function(he,J,D){"use strict";D.r(J),D.d(J,"sliceUint8",function(){return Q});function Q(B,_,G){return Uint8Array.prototype.slice?B.slice(_,G):new Uint8Array(Array.prototype.slice.call(B,_,G))}},"./src/utils/vttcue.ts":function(he,J,D){"use strict";D.r(J),J.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var Q=["","lr","rl"],B=["start","middle","end","left","right"];function _(v,A){if(typeof A!="string")return!1;if(!Array.isArray(v))return!1;var M=A.toLowerCase();return~v.indexOf(M)?M:!1}function G(v){return _(Q,v)}function j(v){return _(B,v)}function I(v){for(var A=arguments.length,M=new Array(A>1?A-1:0),L=1;L<A;L++)M[L-1]=arguments[L];for(var w=1;w<arguments.length;w++){var y=arguments[w];for(var u in y)v[u]=y[u]}return v}function R(v,A,M){var L=this,w={enumerable:!0};L.hasBeenReset=!1;var y="",u=!1,o=v,l=A,d=M,T=null,c="",p=!0,k="auto",x="start",m=50,g="middle",h=50,a="middle";Object.defineProperty(L,"id",I({},w,{get:function(){return y},set:function(b){y=""+b}})),Object.defineProperty(L,"pauseOnExit",I({},w,{get:function(){return u},set:function(b){u=!!b}})),Object.defineProperty(L,"startTime",I({},w,{get:function(){return o},set:function(b){if(typeof b!="number")throw new TypeError("Start time must be set to a number.");o=b,this.hasBeenReset=!0}})),Object.defineProperty(L,"endTime",I({},w,{get:function(){return l},set:function(b){if(typeof b!="number")throw new TypeError("End time must be set to a number.");l=b,this.hasBeenReset=!0}})),Object.defineProperty(L,"text",I({},w,{get:function(){return d},set:function(b){d=""+b,this.hasBeenReset=!0}})),Object.defineProperty(L,"region",I({},w,{get:function(){return T},set:function(b){T=b,this.hasBeenReset=!0}})),Object.defineProperty(L,"vertical",I({},w,{get:function(){return c},set:function(b){var S=G(b);if(S===!1)throw new SyntaxError("An invalid or illegal string was specified.");c=S,this.hasBeenReset=!0}})),Object.defineProperty(L,"snapToLines",I({},w,{get:function(){return p},set:function(b){p=!!b,this.hasBeenReset=!0}})),Object.defineProperty(L,"line",I({},w,{get:function(){return k},set:function(b){if(typeof b!="number"&&b!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");k=b,this.hasBeenReset=!0}})),Object.defineProperty(L,"lineAlign",I({},w,{get:function(){return x},set:function(b){var S=j(b);if(!S)throw new SyntaxError("An invalid or illegal string was specified.");x=S,this.hasBeenReset=!0}})),Object.defineProperty(L,"position",I({},w,{get:function(){return m},set:function(b){if(b<0||b>100)throw new Error("Position must be between 0 and 100.");m=b,this.hasBeenReset=!0}})),Object.defineProperty(L,"positionAlign",I({},w,{get:function(){return g},set:function(b){var S=j(b);if(!S)throw new SyntaxError("An invalid or illegal string was specified.");g=S,this.hasBeenReset=!0}})),Object.defineProperty(L,"size",I({},w,{get:function(){return h},set:function(b){if(b<0||b>100)throw new Error("Size must be between 0 and 100.");h=b,this.hasBeenReset=!0}})),Object.defineProperty(L,"align",I({},w,{get:function(){return a},set:function(b){var S=j(b);if(!S)throw new SyntaxError("An invalid or illegal string was specified.");a=S,this.hasBeenReset=!0}})),L.displayState=void 0}return R.prototype.getCueAsHTML=function(){var v=self.WebVTT;return v.convertCueToDOMTree(self,this.text)},R}()},"./src/utils/vttparser.ts":function(he,J,D){"use strict";D.r(J),D.d(J,"parseTimeStamp",function(){return _}),D.d(J,"fixLineBreaks",function(){return A}),D.d(J,"VTTParser",function(){return M});var Q=D("./src/utils/vttcue.ts"),B=function(){function L(){}var w=L.prototype;return w.decode=function(u,o){if(!u)return"";if(typeof u!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(u))},L}();function _(L){function w(u,o,l,d){return(u|0)*3600+(o|0)*60+(l|0)+parseFloat(d||0)}var y=L.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return y?parseFloat(y[2])>59?w(y[2],y[3],0,y[4]):w(y[1],y[2],y[3],y[4]):null}var G=function(){function L(){this.values=Object.create(null)}var w=L.prototype;return w.set=function(u,o){!this.get(u)&&o!==""&&(this.values[u]=o)},w.get=function(u,o,l){return l?this.has(u)?this.values[u]:o[l]:this.has(u)?this.values[u]:o},w.has=function(u){return u in this.values},w.alt=function(u,o,l){for(var d=0;d<l.length;++d)if(o===l[d]){this.set(u,o);break}},w.integer=function(u,o){/^-?\d+$/.test(o)&&this.set(u,parseInt(o,10))},w.percent=function(u,o){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(o)){var l=parseFloat(o);if(l>=0&&l<=100)return this.set(u,l),!0}return!1},L}();function j(L,w,y,u){var o=u?L.split(u):[L];for(var l in o){if(typeof o[l]!="string")continue;var d=o[l].split(y);if(d.length!==2)continue;var T=d[0],c=d[1];w(T,c)}}var I=new Q.default(0,0,""),R=I.align==="middle"?"middle":"center";function v(L,w,y){var u=L;function o(){var T=_(L);if(T===null)throw new Error("Malformed timestamp: "+u);return L=L.replace(/^[^\sa-zA-Z-]+/,""),T}function l(T,c){var p=new G;j(T,function(m,g){var h;switch(m){case"region":for(var a=y.length-1;a>=0;a--)if(y[a].id===g){p.set(m,y[a].region);break}break;case"vertical":p.alt(m,g,["rl","lr"]);break;case"line":h=g.split(","),p.integer(m,h[0]),p.percent(m,h[0])&&p.set("snapToLines",!1),p.alt(m,h[0],["auto"]),h.length===2&&p.alt("lineAlign",h[1],["start",R,"end"]);break;case"position":h=g.split(","),p.percent(m,h[0]),h.length===2&&p.alt("positionAlign",h[1],["start",R,"end","line-left","line-right","auto"]);break;case"size":p.percent(m,g);break;case"align":p.alt(m,g,["start",R,"end","left","right"]);break}},/:/,/\s/),c.region=p.get("region",null),c.vertical=p.get("vertical","");var k=p.get("line","auto");k==="auto"&&I.line===-1&&(k=-1),c.line=k,c.lineAlign=p.get("lineAlign","start"),c.snapToLines=p.get("snapToLines",!0),c.size=p.get("size",100),c.align=p.get("align",R);var x=p.get("position","auto");x==="auto"&&I.position===50&&(x=c.align==="start"||c.align==="left"?0:c.align==="end"||c.align==="right"?100:50),c.position=x}function d(){L=L.replace(/^\s+/,"")}if(d(),w.startTime=o(),d(),L.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+u);L=L.substr(3),d(),w.endTime=o(),d(),l(L,w)}function A(L){return L.replace(/<br(?: \/)?>/gi,`
`)}var M=function(){function L(){this.state="INITIAL",this.buffer="",this.decoder=new B,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var w=L.prototype;return w.parse=function(u){var o=this;u&&(o.buffer+=o.decoder.decode(u,{stream:!0}));function l(){var x=o.buffer,m=0;for(x=A(x);m<x.length&&x[m]!=="\r"&&x[m]!==`
`;)++m;var g=x.substr(0,m);return x[m]==="\r"&&++m,x[m]===`
`&&++m,o.buffer=x.substr(m),g}function d(x){j(x,function(m,g){},/:/)}try{var T="";if(o.state==="INITIAL"){if(!/\r\n|\n/.test(o.buffer))return this;T=l();var c=T.match(/^()?WEBVTT([ \t].*)?$/);if(!c||!c[0])throw new Error("Malformed WebVTT signature.");o.state="HEADER"}for(var p=!1;o.buffer;){if(!/\r\n|\n/.test(o.buffer))return this;p?p=!1:T=l();switch(o.state){case"HEADER":/:/.test(T)?d(T):T||(o.state="ID");continue;case"NOTE":T||(o.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(T)){o.state="NOTE";break}if(!T)continue;if(o.cue=new Q.default(0,0,""),o.state="CUE",T.indexOf("-->")===-1){o.cue.id=T;continue}case"CUE":if(!o.cue){o.state="BADCUE";continue}try{v(T,o.cue,o.regionList)}catch(x){o.cue=null,o.state="BADCUE";continue}o.state="CUETEXT";continue;case"CUETEXT":{var k=T.indexOf("-->")!==-1;if(!T||k&&(p=!0)){o.oncue&&o.cue&&o.oncue(o.cue),o.cue=null,o.state="ID";continue}if(o.cue===null)continue;o.cue.text&&(o.cue.text+=`
`),o.cue.text+=T}continue;case"BADCUE":T||(o.state="ID")}}}catch(x){o.state==="CUETEXT"&&o.cue&&o.oncue&&o.oncue(o.cue),o.cue=null,o.state=o.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},w.flush=function(){var u=this;try{if((u.cue||u.state==="HEADER")&&(u.buffer+=`
`,u.parse()),u.state==="INITIAL"||u.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(o){u.onparsingerror&&u.onparsingerror(o)}return u.onflush&&u.onflush(),this},L}()},"./src/utils/webvtt-parser.ts":function(he,J,D){"use strict";D.r(J),D.d(J,"generateCueId",function(){return M}),D.d(J,"parseWebVTT",function(){return w});var Q=D("./src/polyfills/number.ts"),B=D("./src/utils/vttparser.ts"),_=D("./src/demux/id3.ts"),G=D("./src/utils/timescale-conversion.ts"),j=D("./src/remux/mp4-remuxer.ts"),I=/\r\n|\n\r|\n|\r/g,R=function(u,o,l){return l===void 0&&(l=0),u.substr(l,o.length)===o},v=function(u){var o=parseInt(u.substr(-3)),l=parseInt(u.substr(-6,2)),d=parseInt(u.substr(-9,2)),T=u.length>9?parseInt(u.substr(0,u.indexOf(":"))):0;if(!Object(Q.isFiniteNumber)(o)||!Object(Q.isFiniteNumber)(l)||!Object(Q.isFiniteNumber)(d)||!Object(Q.isFiniteNumber)(T))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+u);return o+=1e3*l,o+=60*1e3*d,o+=60*60*1e3*T,o},A=function(u){for(var o=5381,l=u.length;l;)o=o*33^u.charCodeAt(--l);return(o>>>0).toString()};function M(y,u,o){return A(y.toString())+A(u.toString())+A(o)}var L=function(u,o,l){var d=u[o],T=u[d.prevCC];if(!T||!T.new&&d.new){u.ccOffset=u.presentationOffset=d.start,d.new=!1;return}for(;(c=T)!==null&&c!==void 0&&c.new;){var c;u.ccOffset+=d.start-T.start,d.new=!1,d=T,T=u[d.prevCC]}u.presentationOffset=l};function w(y,u,o,l,d,T,c,p){var k=new B.VTTParser,x=Object(_.utf8ArrayToStr)(new Uint8Array(y)).trim().replace(I,`
`).split(`
`),m=[],g=Object(G.toMpegTsClockFromTimescale)(u,o),h="00:00.000",a=0,E=0,b,S=!0,N=!1;k.oncue=function(U){var K=l[d],V=l.ccOffset,O=(a-g)/9e4;if(K!=null&&K.new&&(E!==void 0?V=l.ccOffset=K.start:L(l,d,O)),O&&(V=O-l.presentationOffset),N){var P=U.endTime-U.startTime,$=Object(j.normalizePts)((U.startTime+V-E)*9e4,T*9e4)/9e4;U.startTime=$,U.endTime=$+P}var ee=U.text.trim();U.text=decodeURIComponent(encodeURIComponent(ee)),U.id||(U.id=M(U.startTime,U.endTime,ee)),U.endTime>0&&m.push(U)},k.onparsingerror=function(U){b=U},k.onflush=function(){if(b){p(b);return}c(m)},x.forEach(function(U){if(S)if(R(U,"X-TIMESTAMP-MAP=")){S=!1,N=!0,U.substr(16).split(",").forEach(function(K){R(K,"LOCAL:")?h=K.substr(6):R(K,"MPEGTS:")&&(a=parseInt(K.substr(7)))});try{E=v(h)/1e3}catch(K){N=!1,b=K}return}else U===""&&(S=!1);k.parse(U+`
`)}),k.flush()}},"./src/utils/xhr-loader.ts":function(he,J,D){"use strict";D.r(J);var Q=D("./src/utils/logger.ts"),B=D("./src/loader/load-stats.ts"),_=/^age:\s*[\d.]+\s*$/m,G=function(){function j(R){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=R?R.xhrSetup:null,this.stats=new B.LoadStats,this.retryDelay=0}var I=j.prototype;return I.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},I.abortInternal=function(){var v=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),v&&(v.onreadystatechange=null,v.onprogress=null,v.readyState!==4&&(this.stats.aborted=!0,v.abort()))},I.abort=function(){var v;this.abortInternal(),(v=this.callbacks)!==null&&v!==void 0&&v.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},I.load=function(v,A,M){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=v,this.config=A,this.callbacks=M,this.retryDelay=A.retryDelay,this.loadInternal()},I.loadInternal=function(){var v=this.config,A=this.context;if(!v)return;var M=this.loader=new self.XMLHttpRequest,L=this.stats;L.loading.first=0,L.loaded=0;var w=this.xhrSetup;try{if(w)try{w(M,A.url)}catch(o){M.open("GET",A.url,!0),w(M,A.url)}M.readyState||M.open("GET",A.url,!0);var y=this.context.headers;if(y)for(var u in y)M.setRequestHeader(u,y[u])}catch(o){this.callbacks.onError({code:M.status,text:o.message},A,M);return}A.rangeEnd&&M.setRequestHeader("Range","bytes="+A.rangeStart+"-"+(A.rangeEnd-1)),M.onreadystatechange=this.readystatechange.bind(this),M.onprogress=this.loadprogress.bind(this),M.responseType=A.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),v.timeout),M.send()},I.readystatechange=function(){var v=this.context,A=this.loader,M=this.stats;if(!v||!A)return;var L=A.readyState,w=this.config;if(M.aborted)return;if(L>=2)if(self.clearTimeout(this.requestTimeout),M.loading.first===0&&(M.loading.first=Math.max(self.performance.now(),M.loading.start)),L===4){A.onreadystatechange=null,A.onprogress=null;var y=A.status;if(y>=200&&y<300){M.loading.end=Math.max(self.performance.now(),M.loading.first);var u,o;if(v.responseType==="arraybuffer"?(u=A.response,o=u.byteLength):(u=A.responseText,o=u.length),M.loaded=M.total=o,!this.callbacks)return;var l=this.callbacks.onProgress;if(l&&l(M,v,u,A),!this.callbacks)return;var d={url:A.responseURL,data:u};this.callbacks.onSuccess(d,M,v,A)}else M.retry>=w.maxRetry||y>=400&&y<499?(Q.logger.error(y+" while loading "+v.url),this.callbacks.onError({code:y,text:A.statusText},v,A)):(Q.logger.warn(y+" while loading "+v.url+", retrying in "+this.retryDelay+"..."),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,w.maxRetryDelay),M.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),w.timeout)},I.loadtimeout=function(){Q.logger.warn("timeout while loading "+this.context.url);var v=this.callbacks;v&&(this.abortInternal(),v.onTimeout(this.stats,this.context,this.loader))},I.loadprogress=function(v){var A=this.stats;A.loaded=v.loaded,v.lengthComputable&&(A.total=v.total)},I.getCacheAge=function(){var v=null;if(this.loader&&_.test(this.loader.getAllResponseHeaders())){var A=this.loader.getResponseHeader("age");v=A?parseFloat(A):null}return v},j}();J.default=G}}).default})},vHTk:function(Tt,dt,le){Tt.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}}}]);