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.bd8ab30b.async.js

372 lines
966 KiB

(window.webpackJsonp=window.webpackJsonp||[]).push([[237,5,6,7,17],{"+NIl":function(dt,at,se){(function(ne){ne(se("VrN/"))})(function(ne){"use strict";ne.defineMode("stex",function($,R){"use strict";function Q(w,E){w.cmdState.push(E)}function U(w){return w.cmdState.length>0?w.cmdState[w.cmdState.length-1]:null}function O(w){var E=w.cmdState.pop();E&&E.closeBracket()}function j(w){for(var E=w.cmdState,p=E.length-1;p>=0;p--){var u=E[p];if(u.name=="DEFAULT")continue;return u}return{styleIdentifier:function(){return null}}}function N(w,E,p){return function(){this.name=w,this.bracketNo=0,this.style=E,this.styles=p,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var _={};_.importmodule=N("importmodule","tag",["string","builtin"]),_.documentclass=N("documentclass","tag",["","atom"]),_.usepackage=N("usepackage","tag",["atom"]),_.begin=N("begin","tag",["atom"]),_.end=N("end","tag",["atom"]),_.label=N("label","tag",["atom"]),_.ref=N("ref","tag",["atom"]),_.eqref=N("eqref","tag",["atom"]),_.cite=N("cite","tag",["atom"]),_.bibitem=N("bibitem","tag",["atom"]),_.Bibitem=N("Bibitem","tag",["atom"]),_.RBibitem=N("RBibitem","tag",["atom"]),_.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function A(w,E){w.f=E}function f(w,E){var p;if(w.match(/^\\[a-zA-Z@]+/)){var u=w.current().slice(1);return p=_.hasOwnProperty(u)?_[u]:_.DEFAULT,p=new p,Q(E,p),A(E,P),p.style}if(w.match(/^\\[$&%#{}_]/))return"tag";if(w.match(/^\\[,;!\/\\]/))return"tag";if(w.match("\\["))return A(E,function(s,h){return x(s,h,"\\]")}),"keyword";if(w.match("\\("))return A(E,function(s,h){return x(s,h,"\\)")}),"keyword";if(w.match("$$"))return A(E,function(s,h){return x(s,h,"$$")}),"keyword";if(w.match("$"))return A(E,function(s,h){return x(s,h,"$")}),"keyword";var a=w.next();if(a=="%")return w.skipToEnd(),"comment";if(a=="}"||a=="]"){if(p=U(E),p)p.closeBracket(a),A(E,P);else return"error";return"bracket"}else return a=="{"||a=="["?(p=_.DEFAULT,p=new p,Q(E,p),"bracket"):/\d/.test(a)?(w.eatWhile(/[\w.%]/),"atom"):(w.eatWhile(/[\w\-_]/),p=j(E),p.name=="begin"&&(p.argument=w.current()),p.styleIdentifier())}function x(w,E,p){if(w.eatSpace())return null;if(p&&w.match(p))return A(E,f),"keyword";if(w.match(/^\\[a-zA-Z@]+/))return"tag";if(w.match(/^[a-zA-Z]+/))return"variable-2";if(w.match(/^\\[$&%#{}_]/))return"tag";if(w.match(/^\\[,;!\/]/))return"tag";if(w.match(/^[\^_&]/))return"tag";if(w.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(w.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var u=w.next();return u=="{"||u=="}"||u=="["||u=="]"||u=="("||u==")"?"bracket":u=="%"?(w.skipToEnd(),"comment"):"error"}function P(w,E){var p=w.peek(),u;return p=="{"||p=="["?(u=U(E),u.openBracket(p),w.eat(p),A(E,f),"bracket"):/[ \t\r]/.test(p)?(w.eat(p),null):(A(E,f),O(E),f(w,E))}return{startState:function(){var w=R.inMathMode?function(E,p){return x(E,p)}:f;return{cmdState:[],f:w}},copyState:function(w){return{cmdState:w.cmdState.slice(),f:w.f}},token:function(w,E){return E.f(w,E)},blankLine:function(w){w.f=f,w.cmdState.length=0},lineComment:"%"}}),ne.defineMIME("text/x-stex","stex"),ne.defineMIME("text/x-latex","stex")})},"19Vz":function(dt,at,se){(function(ne){ne(se("VrN/"))})(function(ne){ne.defineOption("placeholder","",function(N,_,A){var f=A&&A!=ne.Init;if(_&&!f)N.on("blur",U),N.on("change",O),N.on("swapDoc",O),ne.on(N.getInputField(),"compositionupdate",N.state.placeholderCompose=function(){Q(N)}),O(N);else if(!_&&f){N.off("blur",U),N.off("change",O),N.off("swapDoc",O),ne.off(N.getInputField(),"compositionupdate",N.state.placeholderCompose),$(N);var x=N.getWrapperElement();x.className=x.className.replace(" CodeMirror-empty","")}_&&!N.hasFocus()&&U(N)});function $(N){N.state.placeholder&&(N.state.placeholder.parentNode.removeChild(N.state.placeholder),N.state.placeholder=null)}function R(N){$(N);var _=N.state.placeholder=document.createElement("pre");_.style.cssText="height: 0; overflow: visible",_.style.direction=N.getOption("direction"),_.className="CodeMirror-placeholder CodeMirror-line-like";var A=N.getOption("placeholder");typeof A=="string"&&(A=document.createTextNode(A)),_.appendChild(A),N.display.lineSpace.insertBefore(_,N.display.lineSpace.firstChild)}function Q(N){setTimeout(function(){var _=!1,A=N.getInputField();A.nodeName=="TEXTAREA"?_=!A.value:N.lineCount()==1&&(_=!/[^\u200b]/.test(A.querySelector(".CodeMirror-line").textContent)),_?R(N):$(N)},20)}function U(N){j(N)&&R(N)}function O(N){var _=N.getWrapperElement(),A=j(N);_.className=_.className.replace(" CodeMirror-empty","")+(A?" CodeMirror-empty":""),A?R(N):$(N)}function j(N){return N.lineCount()===1&&N.getLine(0)===""}})},"1eCo":function(dt,at,se){(function(ne){ne(se("VrN/"))})(function(ne){"use strict";var $={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},R={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};ne.defineMode("xml",function(Q,U){var O=Q.indentUnit,j={},N=U.htmlMode?$:R;for(var _ in N)j[_]=N[_];for(var _ in U)j[_]=U[_];var A,f;function x(o,C){function S(F){return C.tokenize=F,F(o,C)}var y=o.next();if(y=="<")return o.eat("!")?o.eat("[")?o.match("CDATA[")?S(E("atom","]]>")):null:o.match("--")?S(E("comment","-->")):o.match("DOCTYPE",!0,!0)?(o.eatWhile(/[\w\._\-]/),S(p(1))):null:o.eat("?")?(o.eatWhile(/[\w\._\-]/),C.tokenize=E("meta","?>"),"meta"):(A=o.eat("/")?"closeTag":"openTag",C.tokenize=P,"tag bracket");if(y=="&"){var M;return o.eat("#")?o.eat("x")?M=o.eatWhile(/[a-fA-F\d]/)&&o.eat(";"):M=o.eatWhile(/[\d]/)&&o.eat(";"):M=o.eatWhile(/[\w\.\-:]/)&&o.eat(";"),M?"atom":"error"}else return o.eatWhile(/[^&<]/),null}x.isInText=!0;function P(o,C){var S=o.next();if(S==">"||S=="/"&&o.eat(">"))return C.tokenize=x,A=S==">"?"endTag":"selfcloseTag","tag bracket";if(S=="=")return A="equals",null;if(S=="<"){C.tokenize=x,C.state=h,C.tagName=C.tagStart=null;var y=C.tokenize(o,C);return y?y+" tag error":"tag error"}else return/[\'\"]/.test(S)?(C.tokenize=w(S),C.stringStartCol=o.column(),C.tokenize(o,C)):(o.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function w(o){var C=function(S,y){for(;!S.eol();)if(S.next()==o){y.tokenize=P;break}return"string"};return C.isInAttribute=!0,C}function E(o,C){return function(S,y){for(;!S.eol();){if(S.match(C)){y.tokenize=x;break}S.next()}return o}}function p(o){return function(C,S){for(var y;(y=C.next())!=null;){if(y=="<")return S.tokenize=p(o+1),S.tokenize(C,S);if(y==">")if(o==1){S.tokenize=x;break}else return S.tokenize=p(o-1),S.tokenize(C,S)}return"meta"}}function u(o,C,S){this.prev=o.context,this.tagName=C,this.indent=o.indented,this.startOfLine=S,(j.doNotIndent.hasOwnProperty(C)||o.context&&o.context.noIndent)&&(this.noIndent=!0)}function a(o){o.context&&(o.context=o.context.prev)}function s(o,C){for(var S;;){if(!o.context)return;if(S=o.context.tagName,!j.contextGrabbers.hasOwnProperty(S)||!j.contextGrabbers[S].hasOwnProperty(C))return;a(o)}}function h(o,C,S){return o=="openTag"?(S.tagStart=C.column(),k):o=="closeTag"?c:h}function k(o,C,S){return o=="word"?(S.tagName=C.current(),f="tag",T):j.allowMissingTagName&&o=="endTag"?(f="tag bracket",T(o,C,S)):(f="error",k)}function c(o,C,S){if(o=="word"){var y=C.current();return S.context&&S.context.tagName!=y&&j.implicitlyClosed.hasOwnProperty(S.context.tagName)&&a(S),S.context&&S.context.tagName==y||j.matchClosing===!1?(f="tag",b):(f="tag error",D)}else return j.allowMissingTagName&&o=="endTag"?(f="tag bracket",b(o,C,S)):(f="error",D)}function b(o,C,S){return o!="endTag"?(f="error",b):(a(S),h)}function D(o,C,S){return f="error",b(o,C,S)}function T(o,C,S){if(o=="word")return f="attribute",g;if(o=="endTag"||o=="selfcloseTag"){var y=S.tagName,M=S.tagStart;return S.tagName=S.tagStart=null,o=="selfcloseTag"||j.autoSelfClosers.hasOwnProperty(y)?s(S,y):(s(S,y),S.context=new u(S,y,M==S.indented)),h}return f="error",T}function g(o,C,S){return o=="equals"?v:(j.allowMissing||(f="error"),T(o,C,S))}function v(o,C,S){return o=="string"?d:o=="word"&&j.allowUnquoted?(f="string",T):(f="error",T(o,C,S))}function d(o,C,S){return o=="string"?d:T(o,C,S)}return{startState:function(o){var C={tokenize:x,state:h,indented:o||0,tagName:null,tagStart:null,context:null};return o!=null&&(C.baseIndent=o),C},token:function(o,C){if(!C.tagName&&o.sol()&&(C.indented=o.indentation()),o.eatSpace())return null;A=null;var S=C.tokenize(o,C);return(S||A)&&S!="comment"&&(f=null,C.state=C.state(A||S,o,C),f&&(S=f=="error"?S+" error":f)),S},indent:function(o,C,S){var y=o.context;if(o.tokenize.isInAttribute)return o.tagStart==o.indented?o.stringStartCol+1:o.indented+O;if(y&&y.noIndent)return ne.Pass;if(o.tokenize!=P&&o.tokenize!=x)return S?S.match(/^(\s*)/)[0].length:0;if(o.tagName)return j.multilineTagIndentPastTag!==!1?o.tagStart+o.tagName.length+2:o.tagStart+O*(j.multilineTagIndentFactor||1);if(j.alignCDATA&&/<!\[CDATA\[/.test(C))return 0;var M=C&&/^<(\/)?([\w_:\.-]*)/.exec(C);if(M&&M[1])for(;y;)if(y.tagName==M[2]){y=y.prev;break}else if(j.implicitlyClosed.hasOwnProperty(y.tagName))y=y.prev;else break;else if(M)for(;y;){var F=j.contextGrabbers[y.tagName];if(F&&F.hasOwnProperty(M[2]))y=y.prev;else break}for(;y&&y.prev&&!y.startOfLine;)y=y.prev;return y?y.indent+O:o.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:j.htmlMode?"html":"xml",helperType:j.htmlMode?"html":"xml",skipAttribute:function(o){o.state==v&&(o.state=T)},xmlCurrentTag:function(o){return o.tagName?{name:o.tagName,close:o.type=="closeTag"}:null},xmlCurrentContext:function(o){for(var C=[],S=o.context;S;S=S.prev)S.tagName&&C.push(S.tagName);return C.reverse()}}}),ne.defineMIME("text/xml","xml"),ne.defineMIME("application/xml","xml"),ne.mimeModes.hasOwnProperty("text/html")||ne.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"7Cbv":function(dt,at,se){"use strict";var ne=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),$=new Uint8Array(16);function R(){if(!ne)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ne($)}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 U(P){return typeof P=="string"&&Q.test(P)}for(var O=U,j=[],N=0;N<256;++N)j.push((N+256).toString(16).substr(1));function _(P){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,E=(j[P[w+0]]+j[P[w+1]]+j[P[w+2]]+j[P[w+3]]+"-"+j[P[w+4]]+j[P[w+5]]+"-"+j[P[w+6]]+j[P[w+7]]+"-"+j[P[w+8]]+j[P[w+9]]+"-"+j[P[w+10]]+j[P[w+11]]+j[P[w+12]]+j[P[w+13]]+j[P[w+14]]+j[P[w+15]]).toLowerCase();if(!O(E))throw TypeError("Stringified UUID is invalid");return E}var A=_;function f(P,w,E){P=P||{};var p=P.random||(P.rng||R)();if(p[6]=p[6]&15|64,p[8]=p[8]&63|128,w){E=E||0;for(var u=0;u<16;++u)w[E+u]=p[u];return w}return A(p)}var x=at.a=f},"7ahc":function(dt,at,se){"use strict";se.d(at,"a",function(){return k});var ne=se("k1fw"),$=se("0Owb"),R=se("+L6B"),Q=se("2/Rp"),U=se("y8nQ"),O=se("Vl3Y"),j=se("tJVT"),N=se("OaEy"),_=se("2fM7"),A=se("q1tI"),f=se.n(A),x=se("VrN/"),P=se.n(x),w=se("p77/"),E=se.n(w),p=se("c5Ni"),u=se.n(p),a=_.a.Option,s={labelCol:{span:4},wrapperCol:{span:20}},h={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"]};at.b=function(c){var b=c.callback,D=c.onCancel,T=Object(A.useState)("python"),g=Object(j.a)(T,2),v=g[0],d=g[1];function o(S){d(h[S][1])}function C(S){b(S)}return f.a.createElement(O.a,Object($.a)({},s,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:C}),f.a.createElement(O.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},f.a.createElement(_.a,{onChange:o},Object.keys(h).map(function(S){return f.a.createElement(a,{key:S,value:S},h[S][0])}))),f.a.createElement(O.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},f.a.createElement(k,{mode:v})),f.a.createElement("div",{className:"flex-container flex-end"},f.a.createElement(Q.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),f.a.createElement(Q.a,{type:"ghost",onClick:D},"\u53D6\u6D88")))};function k(c){var b=c.value,D=c.onChange,T=c.mode,g=c.options,v=g===void 0?{}:g,d=Object(A.useRef)(),o=Object(A.useState)(),C=Object(j.a)(o,2),S=C[0],y=C[1];return Object(A.useEffect)(function(){if(S){function M(F){var W=F.getValue();D&&D(W)}return S.on("change",M),function(){S.off("change",M)}}},[S,D]),Object(A.useEffect)(function(){S&&S.setOption("mode",T)},[S,T]),Object(A.useEffect)(function(){S&&((b!==S.getValue()||b==="")&&setTimeout(function(){S.setValue(b||" ")},300))},[S,b]),Object(A.useEffect)(function(){if(d.current&&!S){var M=P.a.fromTextArea(d.current,Object(ne.a)({mode:T,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},v));y(M)}},[d.current,S]),f.a.createElement("div",{className:"my-codemirror-container"},f.a.createElement("textarea",{ref:d}))}},"8EBN":function(dt,at,se){(function(ne){ne(se("VrN/"))})(function(ne){"use strict";ne.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 $=0;$<ne.modeInfo.length;$++){var R=ne.modeInfo[$];R.mimes&&(R.mime=R.mimes[0])}ne.findModeByMIME=function(Q){Q=Q.toLowerCase();for(var U=0;U<ne.modeInfo.length;U++){var O=ne.modeInfo[U];if(O.mime==Q)return O;if(O.mimes){for(var j=0;j<O.mimes.length;j++)if(O.mimes[j]==Q)return O}}if(/\+xml$/.test(Q))return ne.findModeByMIME("application/xml");if(/\+json$/.test(Q))return ne.findModeByMIME("application/json")},ne.findModeByExtension=function(Q){Q=Q.toLowerCase();for(var U=0;U<ne.modeInfo.length;U++){var O=ne.modeInfo[U];if(O.ext){for(var j=0;j<O.ext.length;j++)if(O.ext[j]==Q)return O}}},ne.findModeByFileName=function(Q){for(var U=0;U<ne.modeInfo.length;U++){var O=ne.modeInfo[U];if(O.file&&O.file.test(Q))return O}var j=Q.lastIndexOf("."),N=j>-1&&Q.substring(j+1,Q.length);if(N)return ne.findModeByExtension(N)},ne.findModeByName=function(Q){Q=Q.toLowerCase();for(var U=0;U<ne.modeInfo.length;U++){var O=ne.modeInfo[U];if(O.name.toLowerCase()==Q)return O;if(O.alias){for(var j=0;j<O.alias.length;j++)if(O.alias[j].toLowerCase()==Q)return O}}}})},"8hTe":function(dt,at,se){dt.exports={button:"button___1wy9m"}},"9Bee":function(dt,at,se){"use strict";var ne=se("DYRE"),$=se("zeV3"),R=se("+L6B"),Q=se("2/Rp"),U=se("k1fw"),O=se("9og8"),j=se("tJVT"),N=se("WmNS"),_=se.n(N),A=se("q1tI"),f=se.n(A),x=se("vg9a"),P=se("DlQD"),w=se.n(P),E=se("rUJ1");function p(K,l){var m=K.match(/^(\s+)(?:```)/);if(m===null)return l;var G=m[1];return l.split(`
`).map(function(J){var z=J.match(/^\s+/);if(z===null)return J;var ye=Object(j.a)(z,1),He=ye[0];return He.length>=G.length?J.slice(G.length):J}).join(`
`)}var u=[],a=["<ul>"],s=new w.a.Renderer,h=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function k(){u.length=0,a=["<ul>"]}var c={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function b(K,l,m,G){if(l>=K.length||K[l].level<=m)return l;var J=K[l];G.push("<li><a href='#"+J.anchor+"'>"+J.text+"</a>"),l++;var z=[];return l=b(K,l,J.level,z),z.length>0&&(G.push("<ul>"),z.forEach(function(ye){G.push(ye)}),G.push("</ul>")),G.push("</li>"),l=b(K,l,m,G),l}function D(){return b(u,0,0,a),a.push("</ul>"),a.join("")}var T={heading:function(l){var m=h.exec(l);if(m)return{type:"heading",raw:m[0],depth:m[1].length,text:m[2]}},fences:function(l){var m=this.rules.block.fences.exec(l);if(m){var G=m[0],J=p(G,m[3]||""),z=m[2]?m[2].trim():m[2];if(["latex","katex","math"].indexOf(z)>=0){var ye=d(),He=J;J=ye,o[ye]={type:"block",expression:He}}return{type:"code",raw:G,lang:z,text:J}}}},g=/(?:\${2})([^\n`]+?)(?:\${2})/gi,v=0,d=function(){return"__special_katext_id_".concat(v++,"__")},o={};function C(){return o}function S(){v=0,o={}}function y(K){return K=K.replace(g,function(l,m){var G=d();return o[G]={type:"inline",expression:m},G}),K}var M=s.listitem;s.listitem=function(K){return M(y(K))};var F=s.paragraph;s.paragraph=function(K){return F(y(K))};var W=s.tablecell;s.tablecell=function(K,l){return W(y(K),l)},s.code=function(K,l,m){var G=(l||"").match(/\S*/)[0];return G?["latex","katex","math"].indexOf(G)>=0?"<p class='editormd-tex'>".concat(K,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(l,'">').concat(m?K:Object(E.escape)(K,!0),`</code></pre>
`):'<pre class="prettyprint linenums"><code>'+(m?K:Object(E.escape)(K,!0))+"</code></pre>"},s.heading=function(K,l,m){var G=this.options.headerPrefix+m.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return u.push({anchor:G,level:l,text:K}),"<h"+l+' id="'+G+'">'+K+"</h"+l+">"},w.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),w.a.use({tokenizer:T,renderer:s});var V=w.a,I=se("SJMd"),B=se("ulZh"),X=se.n(B),ee=se("m3rI"),oe=se("Oy/b"),fe=se("p5ED"),ke=se("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 xe=function(K,l){return(xe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(m,G){m.__proto__=G}||function(m,G){for(var J in G)Object.prototype.hasOwnProperty.call(G,J)&&(m[J]=G[J])})(K,l)};function Te(K,l){function m(){this.constructor=K}xe(K,l),K.prototype=l===null?Object.create(l):(m.prototype=l.prototype,new m)}function Ce(K,l,m,G){return new(m||(m=Promise))(function(J,z){function ye(mt){try{Oe(G.next(mt))}catch(ze){z(ze)}}function He(mt){try{Oe(G.throw(mt))}catch(ze){z(ze)}}function Oe(mt){var ze;mt.done?J(mt.value):(ze=mt.value,ze instanceof m?ze:new m(function(wt){wt(ze)})).then(ye,He)}Oe((G=G.apply(K,l||[])).next())})}function ge(K,l){var m,G,J,z,ye={label:0,sent:function(){if(1&J[0])throw J[1];return J[1]},trys:[],ops:[]};return z={next:He(0),throw:He(1),return:He(2)},typeof Symbol=="function"&&(z[Symbol.iterator]=function(){return this}),z;function He(Oe){return function(mt){return function(ze){if(m)throw new TypeError("Generator is already executing.");for(;ye;)try{if(m=1,G&&(J=2&ze[0]?G.return:ze[0]?G.throw||((J=G.return)&&J.call(G),0):G.next)&&!(J=J.call(G,ze[1])).done)return J;switch(G=0,J&&(ze=[2&ze[0],J.value]),ze[0]){case 0:case 1:J=ze;break;case 4:return ye.label++,{value:ze[1],done:!1};case 5:ye.label++,G=ze[1],ze=[0];continue;case 7:ze=ye.ops.pop(),ye.trys.pop();continue;default:if(!(J=ye.trys,(J=J.length>0&&J[J.length-1])||ze[0]!==6&&ze[0]!==2)){ye=0;continue}if(ze[0]===3&&(!J||ze[1]>J[0]&&ze[1]<J[3])){ye.label=ze[1];break}if(ze[0]===6&&ye.label<J[1]){ye.label=J[1],J=ze;break}if(J&&ye.label<J[2]){ye.label=J[2],ye.ops.push(ze);break}J[2]&&ye.ops.pop(),ye.trys.pop();continue}ze=l.call(K,ye)}catch(wt){ze=[6,wt],G=0}finally{m=J=0}if(5&ze[0])throw ze[1];return{value:ze[0]?ze[1]:void 0,done:!0}}([Oe,mt])}}}function pe(){for(var K=0,l=0,m=arguments.length;l<m;l++)K+=arguments[l].length;var G=Array(K),J=0;for(l=0;l<m;l++)for(var z=arguments[l],ye=0,He=z.length;ye<He;ye++,J++)G[J]=z[ye];return G}var ue=function(){function K(){}return K.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},K.setAttributes=function(l,m){for(var G=0,J=m;G<J.length;G++){var z=J[G],ye=z[0],He=z[1];l.setAttribute(ye,He)}},K.createRect=function(l,m,G){var J=document.createElementNS("http://www.w3.org/2000/svg","rect");return J.setAttribute("width",l.toString()),J.setAttribute("height",m.toString()),G&&K.setAttributes(J,G),J},K.createLine=function(l,m,G,J,z){var ye=document.createElementNS("http://www.w3.org/2000/svg","line");return ye.setAttribute("x1",l.toString()),ye.setAttribute("y1",m.toString()),ye.setAttribute("x2",G.toString()),ye.setAttribute("y2",J.toString()),z&&K.setAttributes(ye,z),ye},K.createPolygon=function(l,m){var G=document.createElementNS("http://www.w3.org/2000/svg","polygon");return G.setAttribute("points",l),m&&K.setAttributes(G,m),G},K.createCircle=function(l,m){var G=document.createElementNS("http://www.w3.org/2000/svg","circle");return G.setAttribute("cx",(l/2).toString()),G.setAttribute("cy",(l/2).toString()),G.setAttribute("r",l.toString()),m&&K.setAttributes(G,m),G},K.createEllipse=function(l,m,G){var J=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return J.setAttribute("cx",(l/2).toString()),J.setAttribute("cy",(m/2).toString()),J.setAttribute("rx",(l/2).toString()),J.setAttribute("ry",(m/2).toString()),G&&K.setAttributes(J,G),J},K.createGroup=function(l){var m=document.createElementNS("http://www.w3.org/2000/svg","g");return l&&K.setAttributes(m,l),m},K.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},K.createMarker=function(l,m,G,J,z,ye,He){var Oe=document.createElementNS("http://www.w3.org/2000/svg","marker");return K.setAttributes(Oe,[["id",l],["orient",m],["markerWidth",G.toString()],["markerHeight",J.toString()],["refX",z.toString()],["refY",ye.toString()]]),Oe.appendChild(He),Oe},K.createText=function(l){var m=document.createElementNS("http://www.w3.org/2000/svg","text");return m.setAttribute("x","0"),m.setAttribute("y","0"),l&&K.setAttributes(m,l),m},K.createTSpan=function(l,m){var G=document.createElementNS("http://www.w3.org/2000/svg","tspan");return G.textContent=l,m&&K.setAttributes(G,m),G},K.createImage=function(l){var m=document.createElementNS("http://www.w3.org/2000/svg","image");return l&&K.setAttributes(m,l),m},K.createPoint=function(l,m){var G=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return G.x=l,G.y=m,G},K.createPath=function(l,m){var G=document.createElementNS("http://www.w3.org/2000/svg","path");return G.setAttribute("d",l),m&&K.setAttributes(G,m),G},K}(),te=function(){function K(){}return K.addKey=function(l){K.key=l},Object.defineProperty(K,"isLicensed",{get:function(){return!!K.key&&new RegExp(/^MJS2-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(K.key)},enumerable:!1,configurable:!0}),K}(),de=function(){function K(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return K.prototype.rasterize=function(l,m,G){var J=this;return new Promise(function(z){var ye=G!==void 0?G:document.createElement("canvas");l===null&&(J.markersOnly=!0,J.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",m.width.baseVal.valueAsString),He.setAttribute("height",m.height.baseVal.valueAsString),He.setAttribute("viewBox","0 0 "+m.viewBox.baseVal.width.toString()+" "+m.viewBox.baseVal.height.toString()),He.innerHTML=m.innerHTML,J.naturalSize===!0?(He.width.baseVal.value=l.naturalWidth,He.height.baseVal.value=l.naturalHeight):J.width!==void 0&&J.height!==void 0&&(He.width.baseVal.value=J.width,He.height.baseVal.value=J.height),ye.width=He.width.baseVal.value,ye.height=He.height.baseVal.value;var Oe=He.outerHTML,mt=ye.getContext("2d");J.markersOnly!==!0&&mt.drawImage(l,0,0,ye.width,ye.height);var ze=window.URL,wt=new Image(ye.width,ye.height);wt.setAttribute("crossOrigin","anonymous");var Nt=new Blob([Oe],{type:"image/svg+xml"}),Gt=ze.createObjectURL(Nt);wt.onload=function(){mt.drawImage(wt,0,0),ze.revokeObjectURL(Gt);var Wr=ye.toDataURL(J.imageType,J.imageQuality);z(Wr)},wt.src=Gt})},K}(),ae=function(){},we=function(){function K(l){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+l+"_"}return Object.defineProperty(K.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(K.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(K.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"fade_out"},enumerable:!1,configurable:!0}),K.prototype.addClass=function(l){return this.styleSheet===void 0&&this.addStyleSheet(),l.name=""+this.classNamePrefix+l.localName,this.classes.push(l),this.styleSheet.sheet.insertRule("."+l.name+" {"+l.style+"}",this.styleSheet.sheet.cssRules.length),l},K.prototype.addRule=function(l){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(l),this.styleSheet.sheet.insertRule(l.selector+" {"+l.style+"}",this.styleSheet.sheet.cssRules.length)},K.prototype.addStyleSheet=function(){var l;this.styleSheet=document.createElement("style"),((l=this.styleSheetRoot)!==null&&l!==void 0?l: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 Ee("fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new Ee("fade_out",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
`))},K.prototype.removeStyleSheet=function(){var l;this.styleSheet&&(((l=this.styleSheetRoot)!==null&&l!==void 0?l:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},K}(),Re=function(K,l){this.selector=K,this.style=l},Ee=function(K,l){this.localName=K,this.style=l},Me=function(){function K(l,m,G,J,z){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=l,this.displayMode=m,this.markerItems=G,this.uiStyleSettings=J,this.styles=z,this.addStyles(),this.adjustLayout=this.adjustLayout.bind(this),this.overflowButtonClicked=this.overflowButtonClicked.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this)}return K.prototype.show=function(l){var m=this;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=l,this.uiContainer.className=this.toolbarStyleClass.name+" "+this.styles.fadeInAnimationClassName+" "+(this.uiStyleSettings.toolbarStyleColorsClassName?this.uiStyleSettings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name);var G=document.createElement("div");G.className=this.toolbarBlockStyleClass.name,G.style.whiteSpace="nowrap",this.uiContainer.appendChild(G),this.addActionButton(G,'<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(G,'<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(G,'<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(G,'<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(G,'<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(G,'<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(G,'<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(G,'<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(z){var ye=document.createElement("div");ye.className=""+m.toolbarButtonStyleClass.name,ye.setAttribute("data-type-name",z.typeName),ye.innerHTML=z.icon,ye.addEventListener("click",function(){m.markerToolbarButtonClicked(ye,z)}),m.buttons.push(ye),m.markerButtons.push(ye)}),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 J=document.createElement("div");J.className=this.toolbarBlockStyleClass.name,J.style.whiteSpace="nowrap",J.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(J),this.addActionButton(J,'<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(J,'<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()},K.prototype.addButtonClickListener=function(l){this.buttonClickListeners.push(l)},K.prototype.removeButtonClickListener=function(l){this.buttonClickListeners.indexOf(l)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(l),1)},K.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},K.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var l=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var m=0;m<this.markerButtons.length;m++)m<l||m===l&&this.markerButtons.length-1===l?this.markerButtonBlock.appendChild(this.markerButtons[m]):(m===l&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[m]))}},K.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")},K.prototype.resetButtonStyles=function(){var l=this;this.buttons.forEach(function(m){m.className=m.className.replace(l.uiStyleSettings.toolbarButtonStyleColorsClassName?l.uiStyleSettings.toolbarButtonStyleColorsClassName:l.toolbarButtonStyleColorsClass.name,"").trim(),m.className=m.className.replace(l.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?l.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:l.toolbarActiveButtonStyleColorsClass.name,"").trim(),m.className+=" "+(l.uiStyleSettings.toolbarButtonStyleColorsClassName?l.uiStyleSettings.toolbarButtonStyleColorsClassName:l.toolbarButtonStyleColorsClass.name)})},K.prototype.addActionButton=function(l,m,G){var J=this,z=document.createElement("div");switch(z.className=""+this.toolbarButtonStyleClass.name,z.innerHTML=m,z.setAttribute("data-action",G),z.addEventListener("click",function(){J.actionToolbarButtonClicked(z,G)}),G){case"select":z.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":z.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"undo":case"redo":z.style.fill=this.uiStyleSettings.selectButtonColor;break;case"render":z.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":z.style.fill=this.uiStyleSettings.closeButtonColor}l.appendChild(z),this.buttons.push(z)},K.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new Ee("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 Ee("toolbar_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
box-shadow: 0px 3px rgba(33, 33, 33, 0.1);
`)),this.toolbarBlockStyleClass=this.styles.addClass(new Ee("toolbar-block",`
display: inline-block;
box-sizing: content-box;
`)),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new Ee("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 Ee("toolbar-overflow-block_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`));var l=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new Ee("toolbar_button",`
display: inline-block;
width: `+(this.uiStyleSettings.toolbarHeight-2*l)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*l)+`px;
padding: `+l+`px;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new Ee("toolbar_button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new Ee("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+`
`))},K.prototype.markerToolbarButtonClicked=function(l,m){this.setActiveButton(l),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(G){return G("marker",m)}),this.markerButtonOverflowBlock.style.display="none"},K.prototype.actionToolbarButtonClicked=function(l,m){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(G){return G("action",m)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},K.prototype.setActiveButton=function(l){this.resetButtonStyles(),l.className=l.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),l.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},K.prototype.setActiveMarkerButton=function(l){var m=this.markerButtons.find(function(G){return G.getAttribute("data-type-name")===l});m&&this.setActiveButton(m)},K.prototype.setCurrentMarker=function(l){var m=this;this.currentMarker=l,this.buttons.filter(function(G){return/delete|notes/.test(G.getAttribute("data-action"))}).forEach(function(G){m.currentMarker===void 0?(G.style.fillOpacity="0.4",G.style.pointerEvents="none"):(G.style.fillOpacity="1",G.style.pointerEvents="all")})},K}(),Ie=function(){function K(l,m,G,J){this.panels=[],this.panelButtons=[],this.markerjsContainer=l,this.displayMode=m,this.uiStyleSettings=G,this.styles=J,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return K.prototype.addStyles=function(){var l;this.toolboxStyleClass=this.styles.addClass(new Ee("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 Ee("toolbox_colors",`
color: `+this.uiStyleSettings.toolboxColor+`;
`));var m=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new Ee("toolbox-button-row",`
display: flex;
cursor: default;
box-sizing: content-box;
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new Ee("toolbox-button-row_colors",`
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new Ee("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 Ee("toolbox-panel-row_colors",`
background-color: `+((l=this.uiStyleSettings.toolboxBackgroundColor)!==null&&l!==void 0?l:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
`)),this.toolboxButtonStyleClass=this.styles.addClass(new Ee("toolbox_button",`
display: inline-block;
width: `+(this.uiStyleSettings.toolbarHeight-2*m)+`px;
height: `+(this.uiStyleSettings.toolbarHeight-2*m)+`px;
padding: `+m+`px;
box-sizing: content-box;
`)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new Ee("toolbox-button_colors",`
fill: `+this.uiStyleSettings.toolbarColor+`;
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new Ee("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;
`))},K.prototype.show=function(l){var m;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=l,this.uiContainer.className=this.toolboxStyleClass.name+" "+((m=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&m!==void 0?m:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},K.prototype.setPanelButtons=function(l){var m,G,J=this;this.panels=l,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((m=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&m!==void 0?m:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((G=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&G!==void 0?G:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(z){var ye;z.uiStyleSettings=J.uiStyleSettings;var He=document.createElement("div");He.className=J.toolboxButtonStyleClass.name+" "+((ye=J.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&ye!==void 0?ye:J.toolboxButtonStyleColorsClass.name),He.innerHTML=z.icon,He.title=z.title,He.addEventListener("click",function(){J.panelButtonClick(z)}),J.panelButtons.push(He),J.buttonRow.appendChild(He)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},K.prototype.panelButtonClick=function(l){var m=this,G=-1;if(l!==this.activePanel){G=this.panels.indexOf(l),this.panelRow.innerHTML="";var J=l.getUi();J.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(J),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=l}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){m.displayMode==="inline"?m.panelRow.style.display="none":m.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(z,ye){var He,Oe;z.className=m.toolboxButtonStyleClass.name+" "+(ye===G?""+((He=m.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&He!==void 0?He:m.toolboxActiveButtonStyleColorsClass.name):""+((Oe=m.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&Oe!==void 0?Oe:m.toolboxButtonStyleColorsClass.name))})},K}(),We=function(K,l){this.title=K,this.icon=l},je=function(K){function l(m,G,J,z){var ye=K.call(this,m,z||'<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 ye.colors=[],ye.addTransparent=!1,ye.colorBoxes=[],ye.colors=G,ye.currentColor=J,ye.setCurrentColor=ye.setCurrentColor.bind(ye),ye.getColorBox=ye.getColorBox.bind(ye),ye}return Te(l,K),l.prototype.getUi=function(){var m=this,G=document.createElement("div");return G.style.overflow="hidden",G.style.whiteSpace="nowrap",this.colors.forEach(function(J){var z=m.getColorBox(J);G.appendChild(z),m.colorBoxes.push(z)}),G},l.prototype.getColorBox=function(m){var G=this,J=this.uiStyleSettings.toolbarHeight/4,z=this.uiStyleSettings.toolbarHeight-J,ye=document.createElement("div");ye.style.display="inline-block",ye.style.boxSizing="content-box",ye.style.width=z-2+"px",ye.style.height=z-2+"px",ye.style.padding="1px",ye.style.marginRight="2px",ye.style.marginBottom="2px",ye.style.borderWidth="2px",ye.style.borderStyle="solid",ye.style.borderRadius=(z+2)/2+"px",ye.style.borderColor=m===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",ye.addEventListener("click",function(){G.setCurrentColor(m,ye)});var He=document.createElement("div");return He.style.display="inline-block",He.style.width=z-2+"px",He.style.height=z-2+"px",He.style.backgroundColor=m,He.style.borderRadius=z/2+"px",m==="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>`),ye.appendChild(He),ye},l.prototype.setCurrentColor=function(m,G){var J=this;this.currentColor=m,this.colorBoxes.forEach(function(z){z.style.borderColor=z===G?J.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(m)},l}(We),Be=function(){function K(l,m,G){this._state="new",this._isSelected=!1,this._container=l,this._overlayContainer=m,this.globalSettings=G,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(K.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),K.prototype.ownsTarget=function(l){return!1},Object.defineProperty(K.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),K.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},K.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},K.prototype.pointerDown=function(l,m){},K.prototype.dblClick=function(l,m){},K.prototype.manipulate=function(l){},K.prototype.pointerUp=function(l){this.stateChanged()},K.prototype.dispose=function(){},K.prototype.addMarkerVisualToContainer=function(l){this.container.childNodes.length>0?this.container.insertBefore(l,this.container.childNodes[0]):this.container.appendChild(l)},K.prototype.getState=function(){return{typeName:K.typeName,state:this.state,notes:this.notes}},K.prototype.restoreState=function(l){this._state=l.state,this.notes=l.notes},K.prototype.scale=function(l,m){},K.prototype.colorChanged=function(l){this.onColorChanged&&this.onColorChanged(l),this.stateChanged()},K.prototype.fillColorChanged=function(l){this.onFillColorChanged&&this.onFillColorChanged(l),this.stateChanged()},K.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var l=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),l.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(l)&&this.onStateChanged(this)}},K.typeName="MarkerBase",K}(),Ue=function(){function K(){this.findGripByVisual=this.findGripByVisual.bind(this)}return K.prototype.findGripByVisual=function(l){return this.topLeft.ownsTarget(l)?this.topLeft:this.topCenter.ownsTarget(l)?this.topCenter:this.topRight.ownsTarget(l)?this.topRight:this.centerLeft.ownsTarget(l)?this.centerLeft:this.centerRight.ownsTarget(l)?this.centerRight:this.bottomLeft.ownsTarget(l)?this.bottomLeft:this.bottomCenter.ownsTarget(l)?this.bottomCenter:this.bottomRight.ownsTarget(l)?this.bottomRight:void 0},K}(),et=function(){function K(){this.GRIP_SIZE=10,this.visual=ue.createGroup(),this.visual.appendChild(ue.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(ue.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return K.prototype.ownsTarget=function(l){return l===this.visual||l===this.visual.childNodes[0]||l===this.visual.childNodes[1]},K}(),ot=function(){function K(){}return K.toITransformMatrix=function(l){return{a:l.a,b:l.b,c:l.c,d:l.d,e:l.e,f:l.f}},K.toSVGMatrix=function(l,m){return l.a=m.a,l.b=m.b,l.c=m.c,l.d=m.d,l.e=m.e,l.f=m.f,l},K}(),nt=function(K){function l(m,G,J){var z=K.call(this,m,G,J)||this;return z.left=0,z.top=0,z.width=0,z.height=0,z.defaultSize={x:50,y:20},z.offsetX=0,z.offsetY=0,z.rotationAngle=0,z.CB_DISTANCE=10,z._suppressMarkerCreateEvent=!1,z.container.transform.baseVal.appendItem(ue.createTransform()),z.setupControlBox(),z}return Te(l,K),Object.defineProperty(l.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"visual",{get:function(){return this._visual},set:function(m){this._visual=m;var G=ue.createTransform();this._visual.transform.baseVal.appendItem(G)},enumerable:!1,configurable:!0}),l.prototype.ownsTarget=function(m){return!!K.prototype.ownsTarget.call(this,m)||!!(this.controlGrips.findGripByVisual(m)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(m))},l.prototype.pointerDown=function(m,G){K.prototype.pointerDown.call(this,m,G),this.state==="new"&&(this.left=m.x,this.top=m.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var J=this.unrotatePoint(m);if(this.manipulationStartX=J.x,this.manipulationStartY=J.y,this.offsetX=J.x-this.left,this.offsetY=J.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(G),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(G)){this.activeGrip=this.rotatorGrip;var z=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=z.x-this.width/2,this.top=z.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var ye=this.container.transform.baseVal.getItem(0);ye.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(ye,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},l.prototype.pointerUp=function(m){var G=this.state;K.prototype.pointerUp.call(this,m),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(m),this._state="select",G==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},l.prototype.moveVisual=function(m){this.visual.style.transform="translate("+m.x+"px, "+m.y+"px)"},l.prototype.manipulate=function(m){var G=this.unrotatePoint(m);this.state==="creating"?this.resize(m):this.state==="move"?(this.left=this.manipulationStartLeft+(G.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(G.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(G):this.state==="rotate"&&this.rotate(m)},l.prototype.resize=function(m){var G=this.manipulationStartLeft,J=this.manipulationStartWidth,z=this.manipulationStartTop,ye=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:G=this.manipulationStartLeft+m.x-this.manipulationStartX,J=this.manipulationStartWidth+this.manipulationStartLeft-G;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:J=this.manipulationStartWidth+m.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:z=this.manipulationStartTop+m.y-this.manipulationStartY,ye=this.manipulationStartHeight+this.manipulationStartTop-z;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:ye=this.manipulationStartHeight+m.y-this.manipulationStartY}J>=0?(this.left=G,this.width=J):(this.left=G+J,this.width=-J),ye>=0?(this.top=z,this.height=ye):(this.top=z+ye,this.height=-ye),this.setSize()},l.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},l.prototype.rotate=function(m){if(Math.abs(m.x-this.centerX)>.1){var G=Math.sign(m.x-this.centerX);this.rotationAngle=180*Math.atan((m.y-this.centerY)/(m.x-this.centerX))/Math.PI+90*G,this.applyRotation()}},l.prototype.applyRotation=function(){var m=this.container.transform.baseVal.getItem(0);m.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(m,0)},l.prototype.rotatePoint=function(m){if(this.rotationAngle===0)return m;var G=this.container.getCTM(),J=ue.createPoint(m.x,m.y);return{x:(J=J.matrixTransform(G)).x,y:J.y}},l.prototype.unrotatePoint=function(m){if(this.rotationAngle===0)return m;var G=this.container.getCTM();G=G.inverse();var J=ue.createPoint(m.x,m.y);return{x:(J=J.matrixTransform(G)).x,y:J.y}},l.prototype.select=function(){K.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},l.prototype.deselect=function(){K.prototype.deselect.call(this),this.controlBox.style.display="none"},l.prototype.setupControlBox=function(){this.controlBox=ue.createGroup();var m=ue.createTransform();m.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(m),this.container.appendChild(this.controlBox),this.controlRect=ue.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=ue.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 Ue,this.addControlGrips(),this.controlBox.style.display="none"},l.prototype.adjustControlBox=function(){var m=this.controlBox.transform.baseVal.getItem(0);m.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(m,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()},l.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()},l.prototype.createGrip=function(){var m=new et;return m.visual.transform.baseVal.appendItem(ue.createTransform()),this.controlBox.appendChild(m.visual),m},l.prototype.positionGrips=function(){var m=this.controlGrips.topLeft.GRIP_SIZE,G=-m/2,J=G,z=(this.width+this.CB_DISTANCE)/2-m/2,ye=(this.height+this.CB_DISTANCE)/2-m/2,He=this.height+this.CB_DISTANCE-m/2,Oe=this.width+this.CB_DISTANCE-m/2;this.positionGrip(this.controlGrips.topLeft.visual,G,J),this.positionGrip(this.controlGrips.topCenter.visual,z,J),this.positionGrip(this.controlGrips.topRight.visual,Oe,J),this.positionGrip(this.controlGrips.centerLeft.visual,G,ye),this.positionGrip(this.controlGrips.centerRight.visual,Oe,ye),this.positionGrip(this.controlGrips.bottomLeft.visual,G,He),this.positionGrip(this.controlGrips.bottomCenter.visual,z,He),this.positionGrip(this.controlGrips.bottomRight.visual,Oe,He),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,z,J-3*this.CB_DISTANCE)},l.prototype.positionGrip=function(m,G,J){var z=m.transform.baseVal.getItem(0);z.setTranslate(G,J),m.transform.baseVal.replaceItem(z,0)},l.prototype.hideControlBox=function(){this.controlBox.style.display="none"},l.prototype.showControlBox=function(){this.controlBox.style.display=""},l.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:ot.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:ot.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},K.prototype.getState.call(this))},l.prototype.restoreState=function(m){K.prototype.restoreState.call(this,m);var G=m;this.left=G.left,this.top=G.top,this.width=G.width,this.height=G.height,this.rotationAngle=G.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(ot.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,G.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(ot.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,G.containerTransformMatrix))},l.prototype.scale=function(m,G){K.prototype.scale.call(this,m,G);var J=this.rotatePoint({x:this.left,y:this.top}),z=this.unrotatePoint({x:J.x*m,y:J.y*G});this.left=z.x,this.top=z.y,this.width=this.width*m,this.height=this.height*G,this.adjustControlBox()},l}(Be),qe=function(K){function l(m,G,J){var z=K.call(this,m,G,J)||this;return z.fillColor="transparent",z.strokeColor="transparent",z.strokeWidth=0,z.strokeDasharray="",z.opacity=1,z.setStrokeColor=z.setStrokeColor.bind(z),z.setFillColor=z.setFillColor.bind(z),z.setStrokeWidth=z.setStrokeWidth.bind(z),z.setStrokeDasharray=z.setStrokeDasharray.bind(z),z.createVisual=z.createVisual.bind(z),z}return Te(l,K),l.prototype.ownsTarget=function(m){return!(!K.prototype.ownsTarget.call(this,m)&&m!==this.visual)},l.prototype.createVisual=function(){this.visual=ue.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)},l.prototype.pointerDown=function(m,G){K.prototype.pointerDown.call(this,m,G),this.state==="new"&&(this.createVisual(),this.moveVisual(m),this._state="creating")},l.prototype.manipulate=function(m){K.prototype.manipulate.call(this,m)},l.prototype.resize=function(m){K.prototype.resize.call(this,m),this.setSize()},l.prototype.setSize=function(){K.prototype.setSize.call(this),ue.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},l.prototype.pointerUp=function(m){K.prototype.pointerUp.call(this,m),this.setSize()},l.prototype.setStrokeColor=function(m){this.strokeColor=m,this.visual&&ue.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(m),this.stateChanged()},l.prototype.setFillColor=function(m){this.fillColor=m,this.visual&&ue.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},l.prototype.setStrokeWidth=function(m){this.strokeWidth=m,this.visual&&ue.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},l.prototype.setStrokeDasharray=function(m){this.strokeDasharray=m,this.visual&&ue.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},l.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},K.prototype.getState.call(this))},l.prototype.restoreState=function(m){var G=m;this.fillColor=G.fillColor,this.strokeColor=G.strokeColor,this.strokeWidth=G.strokeWidth,this.strokeDasharray=G.strokeDasharray,this.opacity=G.opacity,this.createVisual(),K.prototype.restoreState.call(this,m),this.setSize()},l.prototype.scale=function(m,G){K.prototype.scale.call(this,m,G),this.setSize()},l.title="Rectangle marker",l}(nt),st=function(K){function l(m,G,J,z){var ye=K.call(this,m,z||'<svg viewBox="0 0 24 24"><path d="M3 17h18v-2H3v2m0 3h18v-1H3v1m0-7h18v-3H3v3m0-9v4h18V4H3z"/></svg>')||this;return ye.widths=[],ye.widthBoxes=[],ye.widths=G,ye.currentWidth=J,ye.setCurrentWidth=ye.setCurrentWidth.bind(ye),ye}return Te(l,K),l.prototype.getUi=function(){var m=this,G=document.createElement("div");return G.style.display="flex",G.style.overflow="hidden",G.style.flexGrow="2",this.widths.forEach(function(J){var z=document.createElement("div");z.style.display="flex",z.style.flexGrow="2",z.style.alignItems="center",z.style.justifyContent="space-between",z.style.padding="5px",z.style.borderWidth="2px",z.style.borderStyle="solid",z.style.borderColor=J===m.currentWidth?m.uiStyleSettings.toolboxAccentColor:"transparent",z.addEventListener("click",function(){m.setCurrentWidth(J,z)}),G.appendChild(z);var ye=document.createElement("div");ye.innerText=J.toString(),ye.style.marginRight="5px",z.appendChild(ye);var He=document.createElement("div");He.style.minHeight="20px",He.style.flexGrow="2",He.style.display="flex",He.style.alignItems="center";var Oe=document.createElement("hr");Oe.style.minWidth="20px",Oe.style.border="0px",Oe.style.borderTop=J+"px solid "+m.uiStyleSettings.toolboxColor,Oe.style.flexGrow="2",He.appendChild(Oe),z.appendChild(He),m.widthBoxes.push(z)}),G},l.prototype.setCurrentWidth=function(m,G){var J=this;this.currentWidth=m,this.widthBoxes.forEach(function(z){z.style.borderColor=z===G?J.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},l}(We),$e=function(K){function l(m,G,J,z){var ye=K.call(this,m,z||'<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 ye.styles=[],ye.styleBoxes=[],ye.styles=G,ye.currentStyle=J,ye.setCurrentStyle=ye.setCurrentStyle.bind(ye),ye}return Te(l,K),l.prototype.getUi=function(){var m=this,G=document.createElement("div");return G.style.display="flex",G.style.overflow="hidden",G.style.flexGrow="2",this.styles.forEach(function(J){var z=document.createElement("div");z.style.display="flex",z.style.alignItems="center",z.style.justifyContent="space-between",z.style.padding="5px",z.style.borderWidth="2px",z.style.borderStyle="solid",z.style.overflow="hidden",z.style.maxWidth=100/m.styles.length-5+"%",z.style.borderColor=J===m.currentStyle?m.uiStyleSettings.toolboxAccentColor:"transparent",z.addEventListener("click",function(){m.setCurrentStyle(J,z)}),G.appendChild(z);var ye=document.createElement("div");ye.style.minHeight="20px",ye.style.flexGrow="2",ye.style.overflow="hidden";var He=`<svg width="100" height="20">
<line x1="0" y1="10" x2="100" y2="10" stroke="`+m.uiStyleSettings.toolboxColor+'" stroke-width="3" '+(J!==""?'stroke-dasharray="'+J+'"':"")+` />
</svg>`;ye.innerHTML=He,z.appendChild(ye),m.styleBoxes.push(z)}),G},l.prototype.setCurrentStyle=function(m,G){var J=this;this.currentStyle=m,this.styleBoxes.forEach(function(z){z.style.borderColor=z===G?J.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},l}(We),Qe=function(K){function l(m,G,J){var z=K.call(this,m,G,J)||this;return z.strokeColor=J.defaultColor,z.strokeWidth=J.defaultStrokeWidth,z.strokeDasharray=J.defaultStrokeDasharray,z.strokePanel=new je("Line color",J.defaultColorSet,J.defaultColor),z.strokePanel.onColorChanged=z.setStrokeColor,z.strokeWidthPanel=new st("Line width",J.defaultStrokeWidths,J.defaultStrokeWidth),z.strokeWidthPanel.onWidthChanged=z.setStrokeWidth,z.strokeStylePanel=new $e("Line style",J.defaultStrokeDasharrays,J.defaultStrokeDasharray),z.strokeStylePanel.onStyleChanged=z.setStrokeDasharray,z}return Te(l,K),Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var m=K.prototype.getState.call(this);return m.typeName=l.typeName,m},l.typeName="FrameMarker",l.title="Frame marker",l.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',l}(qe),_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},ut=function(K){function l(m,G,J){var z=K.call(this,m,G,J)||this;return z.x1=0,z.y1=0,z.x2=0,z.y2=0,z.defaultLength=50,z.manipulationStartX=0,z.manipulationStartY=0,z.manipulationStartX1=0,z.manipulationStartY1=0,z.manipulationStartX2=0,z.manipulationStartY2=0,z.setupControlBox(),z}return Te(l,K),l.prototype.ownsTarget=function(m){return!!K.prototype.ownsTarget.call(this,m)||!(!this.grip1.ownsTarget(m)&&!this.grip2.ownsTarget(m))},l.prototype.pointerDown=function(m,G){K.prototype.pointerDown.call(this,m,G),this.manipulationStartX=m.x,this.manipulationStartY=m.y,this.state==="new"&&(this.x1=m.x,this.y1=m.y,this.x2=m.x,this.y2=m.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(G)?this.activeGrip=this.grip1:this.grip2.ownsTarget(G)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},l.prototype.pointerUp=function(m){var G=this.state;K.prototype.pointerUp.call(this,m),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(m),this._state="select",G==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},l.prototype.adjustVisual=function(){},l.prototype.manipulate=function(m){this.state==="creating"?this.resize(m):this.state==="move"?(this.x1=this.manipulationStartX1+m.x-this.manipulationStartX,this.y1=this.manipulationStartY1+m.y-this.manipulationStartY,this.x2=this.manipulationStartX2+m.x-this.manipulationStartX,this.y2=this.manipulationStartY2+m.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(m)},l.prototype.resize=function(m){switch(this.activeGrip){case this.grip1:this.x1=m.x,this.y1=m.y;break;case this.grip2:case void 0:this.x2=m.x,this.y2=m.y}this.adjustVisual(),this.adjustControlBox()},l.prototype.select=function(){K.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},l.prototype.deselect=function(){K.prototype.deselect.call(this),this.controlBox.style.display="none"},l.prototype.setupControlBox=function(){this.controlBox=ue.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},l.prototype.adjustControlBox=function(){this.positionGrips()},l.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},l.prototype.createGrip=function(){var m=new et;return m.visual.transform.baseVal.appendItem(ue.createTransform()),this.controlBox.appendChild(m.visual),m},l.prototype.positionGrips=function(){var m=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-m/2,this.y1-m/2),this.positionGrip(this.grip2.visual,this.x2-m/2,this.y2-m/2)},l.prototype.positionGrip=function(m,G,J){var z=m.transform.baseVal.getItem(0);z.setTranslate(G,J),m.transform.baseVal.replaceItem(z,0)},l.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},K.prototype.getState.call(this))},l.prototype.restoreState=function(m){K.prototype.restoreState.call(this,m);var G=m;this.x1=G.x1,this.y1=G.y1,this.x2=G.x2,this.y2=G.y2},l.prototype.scale=function(m,G){K.prototype.scale.call(this,m,G),this.x1=this.x1*m,this.y1=this.y1*G,this.x2=this.x2*m,this.y2=this.y2*G,this.adjustVisual(),this.adjustControlBox()},l}(Be),lt=function(K){function l(m,G,J){var z=K.call(this,m,G,J)||this;return z.strokeColor="transparent",z.strokeWidth=0,z.strokeDasharray="",z.setStrokeColor=z.setStrokeColor.bind(z),z.setStrokeWidth=z.setStrokeWidth.bind(z),z.setStrokeDasharray=z.setStrokeDasharray.bind(z),z.strokeColor=J.defaultColor,z.strokeWidth=J.defaultStrokeWidth,z.strokeDasharray=J.defaultStrokeDasharray,z.strokePanel=new je("Line color",J.defaultColorSet,J.defaultColor),z.strokePanel.onColorChanged=z.setStrokeColor,z.strokeWidthPanel=new st("Line width",J.defaultStrokeWidths,J.defaultStrokeWidth),z.strokeWidthPanel.onWidthChanged=z.setStrokeWidth,z.strokeStylePanel=new $e("Line style",J.defaultStrokeDasharrays,J.defaultStrokeDasharray),z.strokeStylePanel.onStyleChanged=z.setStrokeDasharray,z}return Te(l,K),l.prototype.ownsTarget=function(m){return!(!K.prototype.ownsTarget.call(this,m)&&m!==this.visual&&m!==this.selectorLine&&m!==this.visibleLine)},l.prototype.createVisual=function(){this.visual=ue.createGroup(),this.selectorLine=ue.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=ue.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)},l.prototype.pointerDown=function(m,G){K.prototype.pointerDown.call(this,m,G),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},l.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()),ue.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),ue.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),ue.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},l.prototype.setStrokeColor=function(m){this.strokeColor=m,this.adjustVisual(),this.colorChanged(m)},l.prototype.setStrokeWidth=function(m){this.strokeWidth=m,this.adjustVisual()},l.prototype.setStrokeDasharray=function(m){this.strokeDasharray=m,this.adjustVisual(),this.stateChanged()},Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var m=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},K.prototype.getState.call(this));return m.typeName=l.typeName,m},l.prototype.restoreState=function(m){K.prototype.restoreState.call(this,m);var G=m;this.strokeColor=G.strokeColor,this.strokeWidth=G.strokeWidth,this.strokeDasharray=G.strokeDasharray,this.createVisual(),this.adjustVisual()},l.typeName="LineMarker",l.title="Line marker",l.icon='<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>',l}(ut),Ne=function(K){function l(m,G,J,z){var ye=K.call(this,m,z||'<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 ye.fonts=[],ye.fontBoxes=[],ye.fonts=G,ye.currentFont=J,ye.setCurrentFont=ye.setCurrentFont.bind(ye),ye}return Te(l,K),l.prototype.getUi=function(){var m=this,G=document.createElement("div");return G.style.overflow="hidden",G.style.flexGrow="2",this.fonts.forEach(function(J){var z=document.createElement("div");z.style.display="inline-block",z.style.alignItems="center",z.style.justifyContent="space-between",z.style.padding="5px",z.style.borderWidth="2px",z.style.borderStyle="solid",z.style.overflow="hidden",z.style.maxWidth=100/m.fonts.length-5+"%",z.style.borderColor=J===m.currentFont?m.uiStyleSettings.toolboxAccentColor:"transparent",z.addEventListener("click",function(){m.setCurrentFont(J,z)}),G.appendChild(z);var ye=document.createElement("div");ye.style.display="flex",ye.style.minHeight="20px",ye.style.flexGrow="2",ye.style.fontFamily=J,ye.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",ye.appendChild(He),z.appendChild(ye),m.fontBoxes.push(z)}),G},l.prototype.setCurrentFont=function(m,G){var J=this;this.currentFont=m,this.fontBoxes.forEach(function(z){z.style.borderColor=z===G?J.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},l}(We),Ke=function(K){function l(m,G,J){var z=K.call(this,m,G,J)||this;return z.color="transparent",z.padding=5,z.DEFAULT_TEXT="your text here",z.text=z.DEFAULT_TEXT,z.isMoved=!1,z.color=J.defaultColor,z.fontFamily=J.defaultFontFamily,z.defaultSize={x:100,y:30},z.setColor=z.setColor.bind(z),z.setFont=z.setFont.bind(z),z.renderText=z.renderText.bind(z),z.sizeText=z.sizeText.bind(z),z.textEditDivClicked=z.textEditDivClicked.bind(z),z.showTextEditor=z.showTextEditor.bind(z),z.setSize=z.setSize.bind(z),z.positionTextEditor=z.positionTextEditor.bind(z),z.colorPanel=new je("Color",J.defaultColorSet,J.defaultColor),z.colorPanel.onColorChanged=z.setColor,z.fontFamilyPanel=new Ne("Font",J.defaultFontFamilies,J.defaultFontFamily),z.fontFamilyPanel.onFontChanged=z.setFont,z}return Te(l,K),l.prototype.ownsTarget=function(m){if(K.prototype.ownsTarget.call(this,m)||m===this.visual||m===this.textElement||m===this.bgRectangle)return!0;var G=!1;return this.textElement.childNodes.forEach(function(J){J===m&&(G=!0)}),G},l.prototype.createVisual=function(){this.visual=ue.createGroup(),this.bgRectangle=ue.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=ue.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(ue.createTransform()),this.textElement.transform.baseVal.appendItem(ue.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},l.prototype.pointerDown=function(m,G){K.prototype.pointerDown.call(this,m,G),this.isMoved=!1,this.pointerDownPoint=m,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(m),this._state="creating")},l.prototype.renderText=function(){var m=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(G){m.textElement.appendChild(ue.createTSpan(G.trim()===""?" ":G.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},l.prototype.getTextScale=function(){var m=this.textElement.getBBox(),G=1;if(m.width>0&&m.height>0){var J=(1*this.width-this.width*this.padding*2/100)/m.width,z=(1*this.height-this.height*this.padding*2/100)/m.height;G=Math.min(J,z)}return G},l.prototype.getTextPosition=function(m){var G=this.textElement.getBBox(),J=0,z=0;return G.width>0&&G.height>0&&(J=(this.width-G.width*m)/2,z=this.height/2-G.height*m/2),{x:J,y:z}},l.prototype.sizeText=function(){var m=this.textElement.getBBox(),G=this.getTextScale(),J=this.getTextPosition(G);J.y-=m.y*G,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+J.x+"px, "+J.y+"px) scale("+G+", "+G+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(J.x,J.y),this.textElement.transform.baseVal.getItem(1).setScale(G,G))},l.prototype.manipulate=function(m){K.prototype.manipulate.call(this,m),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(m.x-this.pointerDownPoint.x)>5||Math.abs(m.y-this.pointerDownPoint.y)>5)},l.prototype.resize=function(m){K.prototype.resize.call(this,m),this.isMoved=!0,this.setSize(),this.sizeText()},l.prototype.setSize=function(){K.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(ue.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),ue.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},l.prototype.pointerUp=function(m){var G=this.state;G==="creating"&&(this._suppressMarkerCreateEvent=!0),K.prototype.pointerUp.call(this,m),this.setSize(),(G==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},l.prototype.showTextEditor=function(){var m=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(G){G.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var G=Number.parseFloat(m.textEditor.style.fontSize);m.textEditor.clientWidth>=Number.parseInt(m.textEditor.style.maxWidth)&&G>.9;)G-=.1,m.textEditor.style.fontSize=Math.max(G,.9)+"em"}),this.textEditor.addEventListener("keyup",function(G){G.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(G){if(G.clipboardData){var J=G.clipboardData.getData("text"),z=window.getSelection();if(!z.rangeCount)return!1;z.deleteFromDocument(),z.getRangeAt(0).insertNode(document.createTextNode(J)),G.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){m.textEditDivClicked(m.textEditor.innerText)}),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},l.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var m=this.getTextScale(),G=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),J=this.textElement.getBBox(),z={x:J.width*m,y:J.height*m};G.x-=z.x/2,G.y-=z.y/2,this.textEditor.style.top=G.y+"px",this.textEditor.style.left=G.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-G.x+"px",this.textEditor.style.fontSize=Math.max(16*m,12)+"px",this.textElement.style.display="none"}},l.prototype.textEditDivClicked=function(m){this.text=m.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},l.prototype.select=function(){K.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},l.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),K.prototype.deselect.call(this)},l.prototype.dblClick=function(m,G){K.prototype.dblClick.call(this,m,G),this.showTextEditor()},l.prototype.setColor=function(m){this.textElement&&ue.setAttributes(this.textElement,[["fill",m]]),this.color=m,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(m)},l.prototype.setFont=function(m){this.textElement&&ue.setAttributes(this.textElement,[["font-family",m]]),this.fontFamily=m,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},l.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},l.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var m=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},K.prototype.getState.call(this));return m.typeName=l.typeName,m},l.prototype.restoreState=function(m){var G=m;this.color=G.color,this.fontFamily=G.fontFamily,this.padding=G.padding,this.text=G.text,this.createVisual(),K.prototype.restoreState.call(this,m),this.setSize()},l.prototype.scale=function(m,G){K.prototype.scale.call(this,m,G),this.setSize(),this.sizeText(),this.positionTextEditor()},l.typeName="TextMarker",l.title="Text marker",l.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>',l}(nt),Se=function(K){function l(m,G,J){var z=K.call(this,m,G,J)||this;return z.color="transparent",z.lineWidth=3,z.drawing=!1,z.pixelRatio=1,z.color=J.defaultColor,z.lineWidth=J.defaultStrokeWidth,z.pixelRatio=J.freehandPixelRatio,z.setColor=z.setColor.bind(z),z.addCanvas=z.addCanvas.bind(z),z.finishCreation=z.finishCreation.bind(z),z.setLineWidth=z.setLineWidth.bind(z),z.colorPanel=new je("Color",J.defaultColorSet,J.defaultColor),z.colorPanel.onColorChanged=z.setColor,z.lineWidthPanel=new st("Line width",J.defaultStrokeWidths,J.defaultStrokeWidth),z.lineWidthPanel.onWidthChanged=z.setLineWidth,z}return Te(l,K),l.prototype.ownsTarget=function(m){return!(!K.prototype.ownsTarget.call(this,m)&&m!==this.visual&&m!==this.drawingImage)},l.prototype.createVisual=function(){this.visual=ue.createGroup(),this.drawingImage=ue.createImage(),this.visual.appendChild(this.drawingImage);var m=ue.createTransform();this.visual.transform.baseVal.appendItem(m),this.addMarkerVisualToContainer(this.visual)},l.prototype.pointerDown=function(m,G){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(m.x,m.y),this.drawing=!0):K.prototype.pointerDown.call(this,m,G)},l.prototype.manipulate=function(m){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(m.x,m.y),this.canvasContext.stroke()):K.prototype.manipulate.call(this,m)},l.prototype.resize=function(m){K.prototype.resize.call(this,m),ue.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),ue.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},l.prototype.pointerUp=function(m){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):K.prototype.pointerUp.call(this,m)},l.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)},l.prototype.select=function(){this.state==="creating"&&this.finishCreation(),K.prototype.select.call(this)},l.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),K.prototype.deselect.call(this)},l.prototype.finishCreation=function(){for(var m=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),G=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],J=G[0],z=G[1],ye=G[2],He=G[3],Oe=!1,mt=0;mt<this.canvasElement.height;mt++)for(var ze=0;ze<this.canvasElement.width;ze++)m.data[mt*this.canvasElement.width*4+4*ze+3]>0&&(Oe=!0,mt<z&&(z=mt),ze<J&&(J=ze),mt>He&&(He=mt),ze>ye&&(ye=ze));if(Oe){this.left=J/this.pixelRatio,this.top=z/this.pixelRatio,this.width=(ye-J)/this.pixelRatio,this.height=(He-z)/this.pixelRatio;var wt=document.createElement("canvas");wt.width=ye-J,wt.height=He-z,wt.getContext("2d").putImageData(this.canvasContext.getImageData(J,z,ye-J,He-z),0,0),this.drawingImgUrl=wt.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},l.prototype.setDrawingImage=function(){ue.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),ue.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},l.prototype.setColor=function(m){this.color=m,this.colorChanged(m)},l.prototype.setLineWidth=function(m){this.lineWidth=m},Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var m=Object.assign({drawingImgUrl:this.drawingImgUrl},K.prototype.getState.call(this));return m.typeName=l.typeName,m},l.prototype.restoreState=function(m){this.createVisual(),K.prototype.restoreState.call(this,m),this.drawingImgUrl=m.drawingImgUrl,this.setDrawingImage()},l.prototype.scale=function(m,G){K.prototype.scale.call(this,m,G),this.setDrawingImage()},l.typeName="FreehandMarker",l.title="Freehand marker",l.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>',l}(nt),ve=function(K){function l(m,G,J){var z=K.call(this,m,J||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>')||this;return z.typeBoxes=[],z.currentType=G,z.setCurrentType=z.setCurrentType.bind(z),z}return Te(l,K),l.prototype.getUi=function(){var m=this,G=document.createElement("div");G.style.display="flex",G.style.overflow="hidden",G.style.flexGrow="2";for(var J=function(He){var Oe="both";switch(He){case 0:Oe="both";break;case 1:Oe="start";break;case 2:Oe="end";break;case 3:Oe="none"}var mt=document.createElement("div");if(mt.style.display="flex",mt.style.flexGrow="2",mt.style.alignItems="center",mt.style.justifyContent="space-between",mt.style.padding="5px",mt.style.borderWidth="2px",mt.style.borderStyle="solid",mt.style.borderColor=Oe===z.currentType?z.uiStyleSettings.toolboxAccentColor:"transparent",mt.addEventListener("click",function(){m.setCurrentType(Oe,mt)}),G.appendChild(mt),Oe==="both"||Oe==="start"){var ze=document.createElement("div");ze.style.display="flex",ze.style.alignItems="center",ze.style.minHeight="20px",ze.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="`+(z.uiStyleSettings!==void 0?z.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,ze.style.marginLeft="5px",mt.appendChild(ze)}var wt=document.createElement("div");wt.style.display="flex",wt.style.alignItems="center",wt.style.minHeight="20px",wt.style.flexGrow="2";var Nt=document.createElement("hr");if(Nt.style.minWidth="20px",Nt.style.border="0px",Nt.style.borderTop="3px solid "+(z.uiStyleSettings!==void 0?z.uiStyleSettings.toolboxColor:"#eeeeee"),Nt.style.flexGrow="2",wt.appendChild(Nt),mt.appendChild(wt),Oe==="both"||Oe==="end"){var Gt=document.createElement("div");Gt.style.display="flex",Gt.style.alignItems="center",Gt.style.minHeight="20px",Gt.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="`+(z.uiStyleSettings!==void 0?z.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
</svg>`,Gt.style.marginRight="5px",mt.appendChild(Gt)}z.typeBoxes.push(mt)},z=this,ye=0;ye<4;ye++)J(ye);return G},l.prototype.setCurrentType=function(m,G){var J=this;this.currentType=m,this.typeBoxes.forEach(function(z){z.style.borderColor=z===G?J.uiStyleSettings!==void 0?J.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},l}(We),be=function(K){function l(m,G,J){var z=K.call(this,m,G,J)||this;return z.arrowType="end",z.arrowBaseHeight=10,z.arrowBaseWidth=10,z.getArrowPoints=z.getArrowPoints.bind(z),z.setArrowType=z.setArrowType.bind(z),z.arrowTypePanel=new ve("Arrow type","end"),z.arrowTypePanel.onArrowTypeChanged=z.setArrowType,z}return Te(l,K),l.prototype.ownsTarget=function(m){return!(!K.prototype.ownsTarget.call(this,m)&&m!==this.arrow1&&m!==this.arrow2)},l.prototype.getArrowPoints=function(m,G){var J=this.arrowBaseWidth+2*this.strokeWidth,z=this.arrowBaseHeight+2*this.strokeWidth;return m-J/2+","+(G+z/2)+" "+m+","+(G-z/2)+" "+(m+J/2)+","+(G+z/2)},l.prototype.createTips=function(){this.arrow1=ue.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(ue.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=ue.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(ue.createTransform()),this.visual.appendChild(this.arrow2)},l.prototype.pointerDown=function(m,G){K.prototype.pointerDown.call(this,m,G),this.state==="creating"&&this.createTips()},l.prototype.adjustVisual=function(){if(K.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",ue.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),ue.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var m=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),G=this.arrow1.transform.baseVal.getItem(0);G.setRotate(m,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(G,0);var J=this.arrow2.transform.baseVal.getItem(0);J.setRotate(m+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(J,0)}},l.prototype.setArrowType=function(m){this.arrowType=m,this.adjustVisual(),this.stateChanged()},Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var m=Object.assign({arrowType:this.arrowType},K.prototype.getState.call(this));return m.typeName=l.typeName,m},l.prototype.restoreState=function(m){K.prototype.restoreState.call(this,m);var G=m;this.arrowType=G.arrowType,this.createTips(),this.adjustVisual()},l.typeName="ArrowMarker",l.title="Arrow marker",l.icon='<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 7 15.59V9H5v10h10v-2H8.41L19 6.41z"/></svg>',l}(lt),re=function(K){function l(m,G,J){var z=K.call(this,m,G,J)||this;return z.fillColor=J.defaultFillColor,z.strokeWidth=0,z.fillPanel=new je("Color",J.defaultColorSet,J.defaultFillColor),z.fillPanel.onColorChanged=z.setFillColor,z}return Te(l,K),Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var m=K.prototype.getState.call(this);return m.typeName=l.typeName,m},l.typeName="CoverMarker",l.title="Cover marker",l.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',l}(qe),ie=function(K){function l(m,G,J,z){var ye=K.call(this,m,z||'<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 ye.opacities=[],ye.opacityBoxes=[],ye.opacities=G,ye.currentOpacity=J,ye.setCurrentOpacity=ye.setCurrentOpacity.bind(ye),ye}return Te(l,K),l.prototype.getUi=function(){var m=this,G=document.createElement("div");return G.style.display="flex",G.style.overflow="hidden",G.style.flexGrow="2",G.style.justifyContent="space-between",this.opacities.forEach(function(J){var z=document.createElement("div");z.style.display="flex",z.style.alignItems="center",z.style.justifyContent="center",z.style.padding="5px",z.style.borderWidth="2px",z.style.borderStyle="solid",z.style.borderColor=J===m.currentOpacity?m.uiStyleSettings.toolboxAccentColor:"transparent",z.addEventListener("click",function(){m.setCurrentOpacity(J,z)}),G.appendChild(z);var ye=document.createElement("div");ye.innerText=100*J+"%",z.appendChild(ye),m.opacityBoxes.push(z)}),G},l.prototype.setCurrentOpacity=function(m,G){var J=this;this.currentOpacity=m,this.opacityBoxes.forEach(function(z){z.style.borderColor=z===G?J.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},l}(We),le=function(K){function l(m,G,J){var z=K.call(this,m,G,J)||this;return z.setOpacity=z.setOpacity.bind(z),z.fillColor=J.defaultHighlightColor,z.strokeWidth=0,z.opacity=J.defaultHighlightOpacity,z.fillPanel=new je("Color",J.defaultColorSet,z.fillColor),z.fillPanel.onColorChanged=z.setFillColor,z.opacityPanel=new ie("Opacity",J.defaultOpacitySteps,z.opacity),z.opacityPanel.onOpacityChanged=z.setOpacity,z}return Te(l,K),l.prototype.setOpacity=function(m){this.opacity=m,this.visual&&ue.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var m=K.prototype.getState.call(this);return m.typeName=l.typeName,m},l.typeName="HighlightMarker",l.title="Highlight marker",l.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>',l}(re),he='<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>',Le=function(K){function l(m,G,J){var z=K.call(this,m,G,J)||this;return z.bgColor="transparent",z.tipPosition={x:0,y:0},z.tipBase1Position={x:0,y:0},z.tipBase2Position={x:0,y:0},z.tipMoving=!1,z.color=J.defaultStrokeColor,z.bgColor=J.defaultFillColor,z.fontFamily=J.defaultFontFamily,z.defaultSize={x:100,y:30},z.setBgColor=z.setBgColor.bind(z),z.getTipPoints=z.getTipPoints.bind(z),z.positionTip=z.positionTip.bind(z),z.setTipPoints=z.setTipPoints.bind(z),z.colorPanel=new je("Text color",J.defaultColorSet,z.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>'),z.colorPanel.onColorChanged=z.setColor,z.bgColorPanel=new je("Fill color",J.defaultColorSet,z.bgColor,he),z.bgColorPanel.onColorChanged=z.setBgColor,z.fontFamilyPanel=new Ne("Font",J.defaultFontFamilies,J.defaultFontFamily),z.fontFamilyPanel.onFontChanged=z.setFont,z.tipGrip=new et,z.tipGrip.visual.transform.baseVal.appendItem(ue.createTransform()),z.controlBox.appendChild(z.tipGrip.visual),z}return Te(l,K),l.prototype.ownsTarget=function(m){return K.prototype.ownsTarget.call(this,m)||this.tipGrip.ownsTarget(m)||this.tip===m},l.prototype.createTip=function(){ue.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=ue.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},l.prototype.pointerDown=function(m,G){this.state==="new"&&K.prototype.pointerDown.call(this,m,G),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(G)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):K.prototype.pointerDown.call(this,m,G)},l.prototype.pointerUp=function(m){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,K.prototype.pointerUp.call(this,m);else{var G=this.state==="creating";K.prototype.pointerUp.call(this,m),this.setTipPoints(G),this.positionTip()}},l.prototype.manipulate=function(m){if(this.tipMoving){var G=this.unrotatePoint(m);this.tipPosition={x:G.x-this.manipulationStartLeft,y:G.y-this.manipulationStartTop},this.positionTip()}else K.prototype.manipulate.call(this,m)},l.prototype.setBgColor=function(m){this.bgRectangle&&this.tip&&(ue.setAttributes(this.bgRectangle,[["fill",m]]),ue.setAttributes(this.tip,[["fill",m]])),this.bgColor=m,this.fillColorChanged(m)},l.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},l.prototype.setTipPoints=function(m){m===void 0&&(m=!1);var G=Math.min(this.height/2,15),J=this.height/5;m&&(this.tipPosition={x:G+J/2,y:this.height+20});var z=Math.atan(this.height/2/(this.width/2));this.tipPosition.x<this.width/2&&this.tipPosition.y<this.height/2?z<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?(J=this.width/5,G=Math.min(this.width/2,15),this.tipBase1Position={x:G,y:0},this.tipBase2Position={x:G+J,y:0}):(this.tipBase1Position={x:0,y:G},this.tipBase2Position={x:0,y:G+J}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?z<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?(J=this.width/5,G=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-G-J,y:0},this.tipBase2Position={x:this.width-G,y:0}):(this.tipBase1Position={x:this.width,y:G},this.tipBase2Position={x:this.width,y:G+J}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?z<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?(J=this.width/5,G=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-G-J,y:this.height},this.tipBase2Position={x:this.width-G,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-G-J},this.tipBase2Position={x:this.width,y:this.height-G}):z<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?(J=this.width/5,G=Math.min(this.width/2,15),this.tipBase1Position={x:G,y:this.height},this.tipBase2Position={x:G+J,y:this.height}):(this.tipBase1Position={x:0,y:this.height-G},this.tipBase2Position={x:0,y:this.height-G-J})},l.prototype.resize=function(m){K.prototype.resize.call(this,m),this.positionTip()},l.prototype.positionTip=function(){ue.setAttributes(this.tip,[["points",this.getTipPoints()]]);var m=this.tipGrip.visual.transform.baseVal.getItem(0);m.setTranslate(this.tipPosition.x,this.tipPosition.y),this.tipGrip.visual.transform.baseVal.replaceItem(m,0)},Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.bgColorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),l.prototype.select=function(){this.positionTip(),K.prototype.select.call(this)},l.prototype.getState=function(){var m=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},K.prototype.getState.call(this));return m.typeName=l.typeName,m},l.prototype.restoreState=function(m){var G=m;this.bgColor=G.bgColor,this.tipPosition=G.tipPosition,K.prototype.restoreState.call(this,m),this.createTip(),this.setTipPoints()},l.prototype.scale=function(m,G){K.prototype.scale.call(this,m,G),this.tipPosition={x:this.tipPosition.x*m,y:this.tipPosition.y*G},this.positionTip()},l.typeName="CalloutMarker",l.title="Callout marker",l.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>',l}(Ke),Pe=function(K){function l(m,G,J){var z=K.call(this,m,G,J)||this;return z.fillColor="transparent",z.strokeColor="transparent",z.strokeWidth=0,z.strokeDasharray="",z.opacity=1,z.strokeColor=J.defaultColor,z.strokeWidth=J.defaultStrokeWidth,z.strokeDasharray=J.defaultStrokeDasharray,z.fillColor=J.defaultFillColor,z.setStrokeColor=z.setStrokeColor.bind(z),z.setFillColor=z.setFillColor.bind(z),z.setStrokeWidth=z.setStrokeWidth.bind(z),z.setStrokeDasharray=z.setStrokeDasharray.bind(z),z.setOpacity=z.setOpacity.bind(z),z.createVisual=z.createVisual.bind(z),z.strokePanel=new je("Line color",pe(J.defaultColorSet,["transparent"]),J.defaultColor),z.strokePanel.onColorChanged=z.setStrokeColor,z.fillPanel=new je("Fill color",pe(J.defaultColorSet,["transparent"]),z.fillColor,he),z.fillPanel.onColorChanged=z.setFillColor,z.strokeWidthPanel=new st("Line width",J.defaultStrokeWidths,J.defaultStrokeWidth),z.strokeWidthPanel.onWidthChanged=z.setStrokeWidth,z.strokeStylePanel=new $e("Line style",J.defaultStrokeDasharrays,J.defaultStrokeDasharray),z.strokeStylePanel.onStyleChanged=z.setStrokeDasharray,z.opacityPanel=new ie("Opacity",J.defaultOpacitySteps,z.opacity),z.opacityPanel.onOpacityChanged=z.setOpacity,z}return Te(l,K),l.prototype.ownsTarget=function(m){return!(!K.prototype.ownsTarget.call(this,m)&&m!==this.visual)},l.prototype.createVisual=function(){this.visual=ue.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)},l.prototype.pointerDown=function(m,G){K.prototype.pointerDown.call(this,m,G),this.state==="new"&&(this.createVisual(),this.moveVisual(m),this._state="creating")},l.prototype.manipulate=function(m){K.prototype.manipulate.call(this,m)},l.prototype.resize=function(m){K.prototype.resize.call(this,m),this.setSize()},l.prototype.setSize=function(){K.prototype.setSize.call(this),ue.setAttributes(this.visual,[["cx",(this.width/2).toString()],["cy",(this.height/2).toString()],["rx",(this.width/2).toString()],["ry",(this.height/2).toString()]])},l.prototype.pointerUp=function(m){K.prototype.pointerUp.call(this,m),this.setSize()},l.prototype.setStrokeColor=function(m){this.strokeColor=m,this.visual&&ue.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(m),this.stateChanged()},l.prototype.setFillColor=function(m){this.fillColor=m,this.visual&&ue.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(m),this.stateChanged()},l.prototype.setStrokeWidth=function(m){this.strokeWidth=m,this.visual&&ue.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},l.prototype.setStrokeDasharray=function(m){this.strokeDasharray=m,this.visual&&ue.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},l.prototype.setOpacity=function(m){this.opacity=m,this.visual&&ue.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var m=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},K.prototype.getState.call(this));return m.typeName=l.typeName,m},l.prototype.restoreState=function(m){var G=m;this.fillColor=G.fillColor,this.strokeColor=G.strokeColor,this.strokeWidth=G.strokeWidth,this.strokeDasharray=G.strokeDasharray,this.opacity=G.opacity,this.createVisual(),K.prototype.restoreState.call(this,m),this.setSize()},l.prototype.scale=function(m,G){K.prototype.scale.call(this,m,G),this.setSize()},l.typeName="EllipseMarker",l.title="Ellipse marker",l.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>',l}(nt),Xe=function(K){function l(m,G,J){return K.call(this,m,G,J)||this}return Te(l,K),Object.defineProperty(l.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),l.prototype.ownsTarget=function(m){return!(!K.prototype.ownsTarget.call(this,m)&&m!==this.tip1&&m!==this.tip2)},l.prototype.createTips=function(){this.tip1=ue.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(ue.createTransform()),this.visual.appendChild(this.tip1),this.tip2=ue.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(ue.createTransform()),this.visual.appendChild(this.tip2)},l.prototype.pointerDown=function(m,G){K.prototype.pointerDown.call(this,m,G),this.state==="creating"&&this.createTips()},l.prototype.adjustVisual=function(){if(K.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(ue.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()]]),ue.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 m=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),G=this.tip1.transform.baseVal.getItem(0);G.setRotate(m,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(G,0);var J=this.tip2.transform.baseVal.getItem(0);J.setRotate(m+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(J,0)}},Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var m=K.prototype.getState.call(this);return m.typeName=l.typeName,m},l.prototype.restoreState=function(m){K.prototype.restoreState.call(this,m),this.createTips(),this.adjustVisual()},l.typeName="MeasurementMarker",l.title="Measurement marker",l.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>',l}(lt),vt=function(K){function l(m,G,J){var z=K.call(this,m,G,J)||this;return z.strokePanel.colors=J.defaultColorSet,z.fillColor="transparent",z}return Te(l,K),Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var m=K.prototype.getState.call(this);return m.typeName=l.typeName,m},l.typeName="EllipseFrameMarker",l.title="Ellipse frame marker",l.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>',l}(Pe),Dt=function(){function K(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(K.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),K.prototype.addUndoStep=function(l){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(l)||(this.undoStack.push(l),JSON.stringify(this.lastRedoStep)!==JSON.stringify(l)&&this.redoStack.splice(0,this.redoStack.length))},K.prototype.replaceLastUndoStep=function(l){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=l)},K.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},K.prototype.undo=function(){if(this.undoStack.length>1){var l=this.undoStack.pop();return l!==void 0&&this.redoStack.push(l),this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0}},K.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},K}(),Ge=function(K){function l(m,G,J){var z=K.call(this,m,G,J)||this;return z.strokeColor="transparent",z.strokeWidth=0,z.strokeDasharray="",z.curveX=0,z.curveY=0,z.manipulationStartCurveX=0,z.manipulationStartCurveY=0,z.setStrokeColor=z.setStrokeColor.bind(z),z.setStrokeWidth=z.setStrokeWidth.bind(z),z.setStrokeDasharray=z.setStrokeDasharray.bind(z),z.positionGrips=z.positionGrips.bind(z),z.addControlGrips=z.addControlGrips.bind(z),z.adjustVisual=z.adjustVisual.bind(z),z.setupControlBox=z.setupControlBox.bind(z),z.resize=z.resize.bind(z),z.strokeColor=J.defaultColor,z.strokeWidth=J.defaultStrokeWidth,z.strokeDasharray=J.defaultStrokeDasharray,z.strokePanel=new je("Line color",J.defaultColorSet,J.defaultColor),z.strokePanel.onColorChanged=z.setStrokeColor,z.strokeWidthPanel=new st("Line width",J.defaultStrokeWidths,J.defaultStrokeWidth),z.strokeWidthPanel.onWidthChanged=z.setStrokeWidth,z.strokeStylePanel=new $e("Line style",J.defaultStrokeDasharrays,J.defaultStrokeDasharray),z.strokeStylePanel.onStyleChanged=z.setStrokeDasharray,z}return Te(l,K),l.prototype.ownsTarget=function(m){return!(!K.prototype.ownsTarget.call(this,m)&&m!==this.visual&&m!==this.selectorCurve&&m!==this.visibleCurve&&!this.curveGrip.ownsTarget(m))},l.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},l.prototype.createVisual=function(){this.visual=ue.createGroup(),this.selectorCurve=ue.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=ue.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)},l.prototype.pointerDown=function(m,G){K.prototype.pointerDown.call(this,m,G),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=m.x,this.curveY=m.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(G)&&(this.activeGrip=this.curveGrip,this._state="resize")},l.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),ue.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),ue.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),ue.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},l.prototype.setupControlBox=function(){K.prototype.setupControlBox.call(this),this.curveControlLine1=ue.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=ue.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)},l.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,K.prototype.addControlGrips.call(this)},l.prototype.positionGrips=function(){K.prototype.positionGrips.call(this);var m=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-m/2,this.curveY-m/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()))},l.prototype.manipulate=function(m){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+m.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+m.y-this.manipulationStartY),K.prototype.manipulate.call(this,m)},l.prototype.resize=function(m){this.activeGrip===this.curveGrip&&(this.curveX=m.x,this.curveY=m.y),K.prototype.resize.call(this,m),this.state==="creating"&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},l.prototype.setStrokeColor=function(m){this.strokeColor=m,this.adjustVisual(),this.colorChanged(m)},l.prototype.setStrokeWidth=function(m){this.strokeWidth=m,this.adjustVisual()},l.prototype.setStrokeDasharray=function(m){this.strokeDasharray=m,this.adjustVisual()},l.prototype.scale=function(m,G){this.curveX=this.curveX*m,this.curveY=this.curveY*G,K.prototype.scale.call(this,m,G)},Object.defineProperty(l.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),l.prototype.getState=function(){var m=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},K.prototype.getState.call(this));return m.typeName=l.typeName,m},l.prototype.restoreState=function(m){K.prototype.restoreState.call(this,m);var G=m;this.strokeColor=G.strokeColor,this.strokeWidth=G.strokeWidth,this.strokeDasharray=G.strokeDasharray,this.curveX=G.curveX,this.curveY=G.curveY,this.createVisual(),this.adjustVisual()},l.typeName="CurveMarker",l.title="Curve marker",l.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>',l}(ut),Et=function(){function K(l,m){m===void 0&&(m=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=l,this.cancelable=m}return Object.defineProperty(K.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),K.prototype.preventDefault=function(){this._defaultPrevented=!0},K}(),ft=function(K){function l(m,G,J){var z=K.call(this,m,!1)||this;return z.dataUrl=G,z.state=J,z}return Te(l,K),l}(Et),it=function(K){function l(m,G,J){J===void 0&&(J=!1);var z=K.call(this,m,J)||this;return z.marker=G,z}return Te(l,K),l}(Et),Rt=function(){function K(){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 K.prototype.addEventListener=function(l,m){this[l].push(m)},K.prototype.removeEventListener=function(l,m){var G=this[l].indexOf(m);G>-1&&this[l].splice(G,1)},K}(),pt=function(){function K(l){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 Dt,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 Rt,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=K.instanceCounter++,this.styles=new we(this.instanceNo),this.uiStyleSettings=this.styles.settings,this.target=l,this.targetRoot=document.body,this.width=l.clientWidth,this.height=l.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(K.prototype,"ALL_MARKER_TYPES",{get:function(){return[Qe,Se,be,Ke,vt,Pe,le,Le,Xe,re,lt,Ge]},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[Qe,Se,be,Ke,Pe,le,Le]},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"BASIC_MARKER_TYPES",{get:function(){return[Qe,Se,be,Ke,le]},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(l){var m=this;this._availableMarkerTypes.splice(0),l.forEach(function(G){if(typeof G=="string"){var J=m.ALL_MARKER_TYPES.find(function(z){return z.typeName===G});J!==void 0&&m._availableMarkerTypes.push(J)}else m._availableMarkerTypes.push(G)})},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"zoomLevel",{get:function(){return this._zoomLevel},set:function(l){this._zoomLevel=l,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(K.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),K.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},K.prototype.show=function(){var l=this;this.styles.styleSheetRoot===void 0&&ae.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=ae.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(m){return m(new Et(l))})},K.prototype.render=function(){return Ce(this,void 0,void 0,function(){var l;return ge(this,function(m){switch(m.label){case 0:return this.setCurrentMarker(),(l=new de).naturalSize=this.renderAtNaturalSize,l.imageType=this.renderImageType,l.imageQuality=this.renderImageQuality,l.markersOnly=this.renderMarkersOnly,l.width=this.renderWidth,l.height=this.renderHeight,[4,l.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return m.sent(),[4,l.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,m.sent()]}})})},K.prototype.close=function(l){var m=this;if(l===void 0&&(l=!1),this.isOpen){var G=!1;l||this.eventListeners.beforeclose.forEach(function(J){var z=new Et(m,!0);J(z),z.defaultPrevented&&(G=!0)}),G||(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(J){return J(new Et(m))}),this.detachEvents(),this._isOpen=!1)}},K.prototype.addMarkersToToolbar=function(){for(var l,m=[],G=0;G<arguments.length;G++)m[G]=arguments[G];(l=this._availableMarkerTypes).push.apply(l,m)},K.prototype.addRenderEventListener=function(l){this.addEventListener("render",function(m){l(m.dataUrl,m.state)})},K.prototype.removeRenderEventListener=function(l){},K.prototype.addCloseEventListener=function(l){this.addEventListener("close",function(){l()})},K.prototype.removeCloseEventListener=function(l){},K.prototype.setupResizeObserver=function(){var l=this;this.settings.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){l.resize(l.target.clientWidth,l.target.clientHeight)}),this.targetObserver.observe(this.target)):this.settings.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){return l.onPopupTargetResize()}),this.targetObserver.observe(this.editorCanvas)),window.addEventListener("resize",this.setWindowHeight))},K.prototype.onPopupTargetResize=function(){var l=1*this.target.clientWidth/this.target.clientHeight,m=this.editorCanvas.clientWidth/l>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*l:this.editorCanvas.clientWidth,G=m<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/l;this.resize(m,G)},K.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},K.prototype.resize=function(l,m){this._isResizing=!0;var G=l/this.imageWidth,J=m/this.imageHeight;this.imageWidth=Math.round(l),this.imageHeight=Math.round(m),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(G,J),this._isResizing=!1},K.prototype.scaleMarkers=function(l,m){var G,J=this;this._currentMarker&&this._currentMarker instanceof Ke?this._currentMarker.scale(l,m):(G=this._currentMarker,this.setCurrentMarker()),this.markers.forEach(function(z){z!==J._currentMarker&&z.scale(l,m)}),G!==void 0&&this.setCurrentMarker(G)},K.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"},K.prototype.setTopLeft=function(){var l=this.editingTarget.getBoundingClientRect(),m=this.editorCanvas.getBoundingClientRect();this.left=l.left-m.left,this.top=l.top-m.top},K.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)},K.prototype.addDefs=function(){for(var l,m=[],G=0;G<arguments.length;G++)m[G]=arguments[G];this.defs=ue.createDefs(),this.addDefsToImage(),(l=this.defs).append.apply(l,m)},K.prototype.addDefsToImage=function(){this.defs&&this.markerImage.insertBefore(this.defs,this.markerImage.firstChild)},K.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)},K.prototype.positionMarkerImage=function(){this.markerImageHolder.style.top=this.top/this.zoomLevel+"px",this.markerImageHolder.style.left=this.left/this.zoomLevel+"px"},K.prototype.attachEvents=function(){this.markerImage.addEventListener("pointerdown",this.onPointerDown),this.markerImage.addEventListener("dblclick",this.onDblClick),this.attachWindowEvents()},K.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)},K.prototype.detachEvents=function(){this.markerImage.removeEventListener("pointerdown",this.onPointerDown),this.markerImage.removeEventListener("dblclick",this.onDblClick),this.detachWindowEvents()},K.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)},K.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 l=document.createElement("a");l.href="https://markerjs.com/",l.target="_blank",l.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>',l.title="Powered by marker.js",l.style.display="grid",l.style.alignItems="center",l.style.justifyItems="center",l.style.padding="3px",l.style.width="20px",l.style.height="20px",this.logoUI.appendChild(l),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},K.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")},K.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"},K.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},K.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 l=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=l+"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 Ie(this.uiDiv,this.settings.displayMode,this.uiStyleSettings,this.styles),this.toolbox.show(this._silentRenderMode||this.uiStyleSettings.hideToolbox?"hidden":"visible")},K.prototype.closeUI=function(){this.settings.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},K.prototype.removeMarker=function(l){this.markerImage.removeChild(l.container),this.markers.indexOf(l)>-1&&this.markers.splice(this.markers.indexOf(l),1),l.dispose()},K.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())},K.prototype.toolbarButtonClicked=function(l,m){if(l==="marker"&&m!==void 0)this.createNewMarker(m);else if(l==="action")switch(m){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()}},K.prototype.deleteSelectedMarker=function(){var l=this;if(this._currentMarker!==void 0){var m=!1;if(this.eventListeners.markerbeforedelete.forEach(function(J){var z=new it(l,l._currentMarker,!0);J(z),z.defaultPrevented&&(m=!0)}),!m){var G=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(J){return J(new it(l,G))})}}},K.prototype.clear=function(){var l=this,m=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(ye){var He=new it(l,void 0,!0);ye(He),He.defaultPrevented&&(m=!0)}),!m)){this.setCurrentMarker();for(var G=function(ye){var He=J.markers[ye];J.setCurrentMarker(J.markers[ye]),J._currentMarker.dispose(),J.markerImage.removeChild(J._currentMarker.container),J.markers.splice(J.markers.indexOf(J._currentMarker),1),J.eventListeners.markerdelete.forEach(function(Oe){return Oe(new it(l,He))})},J=this,z=this.markers.length-1;z>=0;z--)G(z);this.addUndoStep()}},Object.defineProperty(K.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),K.prototype.showNotesEditor=function(){var l;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=(l=this._currentMarker.notes)!==null&&l!==void 0?l:"",this.overlayContainer.appendChild(this.notesArea))},K.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)},K.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},K.prototype.addUndoStep=function(){var l=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var m=this.getState(),G=this.undoRedoManager.getLastUndoStep();if(!G||G.width===m.width&&G.height===m.height){var J=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(m),J<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach(function(z){return z(new Et(l))})}else this.undoRedoManager.replaceLastUndoStep(m),this.eventListeners.statechange.forEach(function(z){return z(new Et(l))})}},K.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},K.prototype.undoStep=function(){var l=this,m=this.undoRedoManager.undo();m!==void 0&&(this.restoreState(m),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(G){return G(new Et(l))}))},K.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},K.prototype.redoStep=function(){var l=this,m=this.undoRedoManager.redo();m!==void 0&&(this.restoreState(m),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(G){return G(new Et(l))}))},K.prototype.stepZoom=function(){var l=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=l<this.zoomSteps.length-1?this.zoomSteps[l+1]:this.zoomSteps[0]},K.prototype.panTo=function(l){this.contentDiv.scrollBy({left:this.prevPanPoint.x-l.x,top:this.prevPanPoint.y-l.y}),this.prevPanPoint=l},K.prototype.startRenderAndClose=function(){return Ce(this,void 0,void 0,function(){var l,m,G=this;return ge(this,function(J){switch(J.label){case 0:return[4,this.render()];case 1:return l=J.sent(),m=this.getState(),this.eventListeners.render.forEach(function(z){return z(new ft(G,l,m))}),this.close(!0),[2]}})})},K.prototype.getState=function(l){l===!0&&this.setCurrentMarker();var m={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach(function(G){return m.markers.push(G.getState())}),m},K.prototype.restoreState=function(l){var m=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);l.markers.forEach(function(G){var J=m._availableMarkerTypes.find(function(ye){return ye.typeName===G.typeName});if(J!==void 0){var z=m.addNewMarker(J);z.restoreState(G),m.markers.push(z)}}),l.width&&l.height&&(l.width!==this.imageWidth||l.height!==this.imageHeight)&&this.scaleMarkers(this.imageWidth/l.width,this.imageHeight/l.height),this.eventListeners.restorestate.forEach(function(G){return G(new Et(m))})},K.prototype.addNewMarker=function(l){var m=ue.createGroup();return this.markerImage.appendChild(m),new l(m,this.overlayContainer,this.settings)},K.prototype.createNewMarker=function(l){var m,G=this;(m=typeof l=="string"?this._availableMarkerTypes.find(function(J){return J.typeName===l}):l)&&(this.setCurrentMarker(),this.addUndoStep(),this._currentMarker=this.addNewMarker(m),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(m.typeName),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this.eventListeners.markercreating.forEach(function(J){return J(new it(G,G._currentMarker))}))},K.prototype.markerCreated=function(l){var m=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(l),this.setCurrentMarker(l),l instanceof Se&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(Se):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function(G){return G(new it(m,m._currentMarker))})},K.prototype.colorChanged=function(l){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=l,this.settings.defaultStrokeColor=l)},K.prototype.fillColorChanged=function(l){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=l)},K.prototype.markerStateChanged=function(l){var m=this;this.eventListeners.markerchange.forEach(function(G){return G(new it(m,l))})},K.prototype.setCurrentMarker=function(l){var m=this;this._currentMarker!==l&&this._currentMarker!==void 0&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach(function(G){return G(new it(m,m._currentMarker))})),this._currentMarker=l,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(G){return G(new it(m,m._currentMarker))}))},K.prototype.onPointerDown=function(l){if(this._isFocused||this.focus(),this.touchPoints++,this.touchPoints===1||l.pointerType!=="touch")if(this._currentMarker===void 0||this._currentMarker.state!=="new"&&this._currentMarker.state!=="creating"){if(this.mode==="select"){var m=this.markers.find(function(G){return G.ownsTarget(l.target)});m!==void 0?(this.setCurrentMarker(m),this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(l.clientX,l.clientY),l.target)):(this.setCurrentMarker(),this.isDragging=!0,this.prevPanPoint={x:l.clientX,y:l.clientY})}}else this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(l.clientX,l.clientY))},K.prototype.onDblClick=function(l){if(this._isFocused||this.focus(),this.mode==="select"){var m=this.markers.find(function(G){return G.ownsTarget(l.target)});m!==void 0&&m!==this._currentMarker&&this.setCurrentMarker(m),this._currentMarker!==void 0?this._currentMarker.dblClick(this.clientToLocalCoordinates(l.clientX,l.clientY),l.target):this.setCurrentMarker()}},K.prototype.onPointerMove=function(l){this.touchPoints!==1&&l.pointerType==="touch"||(this._currentMarker!==void 0||this.isDragging)&&(this._currentMarker!==void 0&&this._currentMarker.state==="edit"||l.preventDefault(),this._currentMarker!==void 0?this._currentMarker.manipulate(this.clientToLocalCoordinates(l.clientX,l.clientY)):this.zoomLevel>1&&this.panTo({x:l.clientX,y:l.clientY}))},K.prototype.onPointerUp=function(l){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(l.clientX,l.clientY)),this.isDragging=!1,this.addUndoStep()},K.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},K.prototype.onKeyUp=function(l){this._currentMarker===void 0||this.notesArea!==void 0||l.key!=="Delete"&&l.key!=="Backspace"||this.deleteSelectedMarker()},K.prototype.clientToLocalCoordinates=function(l,m){var G=this.markerImage.getBoundingClientRect();return{x:(l-G.left)/this.zoomLevel,y:(m-G.top)/this.zoomLevel}},K.prototype.onWindowResize=function(){this.positionUI()},K.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var l=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=l+"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()},K.prototype.addLicenseKey=function(l){te.addKey(l)},K.prototype.addEventListener=function(l,m){this.eventListeners.addEventListener(l,m)},K.prototype.removeEventListener=function(l,m){this.eventListeners.removeEventListener(l,m)},K.prototype.renderState=function(l){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(l),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(K.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),K.prototype.focus=function(){var l=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,this._previousCurrentMarker!==void 0&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach(function(m){return m(new Et(l))}))},K.prototype.blur=function(){var l=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(m){return m(new Et(l))}))},K.instanceCounter=0,K}();/* **********************************
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(K,l){return(At=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(m,G){m.__proto__=G}||function(m,G){for(var J in G)Object.prototype.hasOwnProperty.call(G,J)&&(m[J]=G[J])})(K,l)};function Lt(K,l){if(typeof l!="function"&&l!==null)throw new TypeError("Class extends value "+String(l)+" is not a constructor or null");function m(){this.constructor=K}At(K,l),K.prototype=l===null?Object.create(l):(m.prototype=l.prototype,new m)}function Ze(K,l,m,G){return new(m||(m=Promise))(function(J,z){function ye(mt){try{Oe(G.next(mt))}catch(ze){z(ze)}}function He(mt){try{Oe(G.throw(mt))}catch(ze){z(ze)}}function Oe(mt){var ze;mt.done?J(mt.value):(ze=mt.value,ze instanceof m?ze:new m(function(wt){wt(ze)})).then(ye,He)}Oe((G=G.apply(K,l||[])).next())})}function ir(K,l){var m,G,J,z,ye={label:0,sent:function(){if(1&J[0])throw J[1];return J[1]},trys:[],ops:[]};return z={next:He(0),throw:He(1),return:He(2)},typeof Symbol=="function"&&(z[Symbol.iterator]=function(){return this}),z;function He(Oe){return function(mt){return function(ze){if(m)throw new TypeError("Generator is already executing.");for(;ye;)try{if(m=1,G&&(J=2&ze[0]?G.return:ze[0]?G.throw||((J=G.return)&&J.call(G),0):G.next)&&!(J=J.call(G,ze[1])).done)return J;switch(G=0,J&&(ze=[2&ze[0],J.value]),ze[0]){case 0:case 1:J=ze;break;case 4:return ye.label++,{value:ze[1],done:!1};case 5:ye.label++,G=ze[1],ze=[0];continue;case 7:ze=ye.ops.pop(),ye.trys.pop();continue;default:if(!(J=ye.trys,(J=J.length>0&&J[J.length-1])||ze[0]!==6&&ze[0]!==2)){ye=0;continue}if(ze[0]===3&&(!J||ze[1]>J[0]&&ze[1]<J[3])){ye.label=ze[1];break}if(ze[0]===6&&ye.label<J[1]){ye.label=J[1],J=ze;break}if(J&&ye.label<J[2]){ye.label=J[2],ye.ops.push(ze);break}J[2]&&ye.ops.pop(),ye.trys.pop();continue}ze=l.call(K,ye)}catch(wt){ze=[6,wt],G=0}finally{m=J=0}if(5&ze[0])throw ze[1];return{value:ze[0]?ze[1]:void 0,done:!0}}([Oe,mt])}}}var Zt=function(){function K(){}return K.addKey=function(l){K.key=l},Object.defineProperty(K,"isLicensed",{get:function(){return!!K.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(K.key)},enumerable:!1,configurable:!0}),K}(),yt=function(){function K(){}return K.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},K.setAttributes=function(l,m){for(var G=0,J=m;G<J.length;G++){var z=J[G],ye=z[0],He=z[1];l.setAttribute(ye,He)}},K.createRect=function(l,m,G){var J=document.createElementNS("http://www.w3.org/2000/svg","rect");return J.setAttribute("width",l.toString()),J.setAttribute("height",m.toString()),G&&K.setAttributes(J,G),J},K.createLine=function(l,m,G,J,z){var ye=document.createElementNS("http://www.w3.org/2000/svg","line");return ye.setAttribute("x1",l.toString()),ye.setAttribute("y1",m.toString()),ye.setAttribute("x2",G.toString()),ye.setAttribute("y2",J.toString()),z&&K.setAttributes(ye,z),ye},K.createPolygon=function(l,m){var G=document.createElementNS("http://www.w3.org/2000/svg","polygon");return G.setAttribute("points",l),m&&K.setAttributes(G,m),G},K.createCircle=function(l,m){var G=document.createElementNS("http://www.w3.org/2000/svg","circle");return G.setAttribute("cx",(l/2).toString()),G.setAttribute("cy",(l/2).toString()),G.setAttribute("r",l.toString()),m&&K.setAttributes(G,m),G},K.createEllipse=function(l,m,G){var J=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return J.setAttribute("cx",(l/2).toString()),J.setAttribute("cy",(m/2).toString()),J.setAttribute("rx",(l/2).toString()),J.setAttribute("ry",(m/2).toString()),G&&K.setAttributes(J,G),J},K.createGroup=function(l){var m=document.createElementNS("http://www.w3.org/2000/svg","g");return l&&K.setAttributes(m,l),m},K.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},K.createMarker=function(l,m,G,J,z,ye,He){var Oe=document.createElementNS("http://www.w3.org/2000/svg","marker");return K.setAttributes(Oe,[["id",l],["orient",m],["markerWidth",G.toString()],["markerHeight",J.toString()],["refX",z.toString()],["refY",ye.toString()]]),Oe.appendChild(He),Oe},K.createText=function(l){var m=document.createElementNS("http://www.w3.org/2000/svg","text");return m.setAttribute("x","0"),m.setAttribute("y","0"),l&&K.setAttributes(m,l),m},K.createTSpan=function(l,m){var G=document.createElementNS("http://www.w3.org/2000/svg","tspan");return G.textContent=l,m&&K.setAttributes(G,m),G},K.createImage=function(l){var m=document.createElementNS("http://www.w3.org/2000/svg","image");return l&&K.setAttributes(m,l),m},K.createPoint=function(l,m){var G=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return G.x=l,G.y=m,G},K.createPath=function(l,m){var G=document.createElementNS("http://www.w3.org/2000/svg","path");return G.setAttribute("d",l),m&&K.setAttributes(G,m),G},K.createElement=function(l,m){var G=document.createElementNS("http://www.w3.org/2000/svg",l);return m&&K.setAttributes(G,m),G},K.getHollowRectanglePath=function(l,m,G,J,z,ye,He,Oe){return"M"+l+","+m+"V"+(m+J)+"H"+(l+G)+"V"+m+"H"+z+"V"+ye+"H"+(z+He)+"V"+(ye+Oe)+"H"+z+"V"+m+"Z"},K}(),Wt=function(){function K(l){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+l+"_"}return Object.defineProperty(K.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(K.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(K.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_out"},enumerable:!1,configurable:!0}),K.prototype.addClass=function(l){return this.styleSheet===void 0&&this.addStyleSheet(),l.name=""+this.classNamePrefix+l.localName,this.classes.push(l),this.styleSheet.sheet.insertRule("."+l.name+" {"+l.style+"}",this.styleSheet.sheet.cssRules.length),l},K.prototype.addRule=function(l){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(l),this.styleSheet.sheet.insertRule(l.selector+" {"+l.style+"}",this.styleSheet.sheet.cssRules.length)},K.prototype.addStyleSheet=function(){var l;this.styleSheet=document.createElement("style"),((l=this.styleSheetRoot)!==null&&l!==void 0?l:document.head).appendChild(this.styleSheet),this.addRule(new nr("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new nr("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
from {
opacity: 0;
}
to {
opacity: 1;
}
`)),this.addRule(new nr("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
from {
opacity: 1;
}
to {
opacity: 0;
}
`)),this.addClass(new ar("_fade_in",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
`)),this.addClass(new ar("_fade_out",`
animation-duration: 0.3s;
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
`))},K.prototype.removeStyleSheet=function(){var l;this.styleSheet&&(((l=this.styleSheetRoot)!==null&&l!==void 0?l:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},K}(),nr=function(K,l){this.selector=K,this.style=l},ar=function(K,l){this.localName=K,this.style=l},Cr=function(){function K(){this.blocks=[],this.display=""}return K.prototype.addButtonBlock=function(l){l.className=this.blockClassName,l.buttonClassName=this.buttonClassName,l.buttonColorsClassName=this.buttonColorsClassName,l.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(l)},K.prototype.addElementBlock=function(l){l.className===void 0&&(l.className=this.blockClassName),this.blocks.push(l)},K.prototype.getUI=function(){var l=document.createElement("div");return l.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,l.style.display=this.display,this.blocks.forEach(function(m){return l.appendChild(m.getUI())}),l},K}(),Ar=function(){function K(){}return K.prototype.getUI=function(){var l=document.createElement("div");if(l.className=this.className,this.minWidth!==void 0&&(l.style.minWidth=this.minWidth),this.contentAlign!==void 0)switch(this.contentAlign){case"start":l.style.justifyContent="flex-start";break;case"center":l.style.justifyContent="center";break;case"end":l.style.justifyContent="flex-end"}return l.style.whiteSpace="nowrap",l},K}(),Vr=function(K){function l(){var m=K!==null&&K.apply(this,arguments)||this;return m.buttons=[],m}return Lt(l,K),l.prototype.addButton=function(m){m.className=this.buttonClassName,m.colorsClassName=this.buttonColorsClassName,m.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(m)},l.prototype.getUI=function(){var m=K.prototype.getUI.call(this);return this.buttons.forEach(function(G){return m.appendChild(G.getUI())}),m},l}(Ar),Bt=function(){function K(l,m){this._isActive=!1,this._isHidden=!1,this._icon=l,this.title=m,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(K.prototype,"icon",{get:function(){return this._icon},set:function(l){this._icon=l,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"isActive",{get:function(){return this._isActive},set:function(l){this._isActive=l,this.adjustClassName()},enumerable:!1,configurable:!0}),K.prototype.getUI=function(){var l=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 l.onClick()}),this.uiContainer.appendChild(this.buttonContainer),this.uiContainer.style.display=this._isHidden?"none":"inline-block",this.uiContainer},K.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,"")))},K.prototype.hide=function(){this._isHidden=!0},K}(),gt=function(K){function l(){var m=K!==null&&K.apply(this,arguments)||this;return m.elements=[],m}return Lt(l,K),l.prototype.addElement=function(m){this.elements.push(m)},l.prototype.getUI=function(){var m=K.prototype.getUI.call(this);return this.elements.forEach(function(G){return m.appendChild(G)}),m},l}(Ar),jr=function(){function K(l,m){this.horizontal=l,this.vertical=m}return Object.defineProperty(K.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),K.prototype.getVerticalLength=function(l){return l/this.ratio},K.prototype.getHorizontalLength=function(l){return l*this.ratio},K}(),li=function(){function K(){}return K.getIcon=function(l,m){if(l>0&&m>0){var G=new jr(l,m),J=G.ratio>=1?20:G.getHorizontalLength(20),z=G.ratio<1?20:G.getVerticalLength(20),ye=document.createElementNS("http://www.w3.org/2000/svg","svg");ye.setAttribute("xmlns","http://www.w3.org/2000/svg"),ye.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(ye);var He=yt.createDefs();ye.appendChild(He);var Oe=yt.createElement("clipPath",[["id","text-bg-clip"]]);He.appendChild(Oe);var mt=yt.createPath(yt.getHollowRectanglePath((24-J)/2,(24-z)/2,J,z,(24-J)/2+2,(24-z)/2+2,J-4,z-4));ye.appendChild(mt);var ze=yt.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);ze.appendChild(yt.createTSpan(l+":"+m)),ye.appendChild(ze);var wt=ze.getBBox();yt.setAttributes(ze,[["x",((24-wt.width)/2).toString()],["y",((24-wt.height)/2-wt.y).toString()]]);var Nt=yt.createPath(yt.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(wt.width))/2,(24-Math.ceil(wt.height))/2,Math.ceil(wt.width),Math.ceil(wt.height)));return Oe.appendChild(Nt),yt.setAttributes(mt,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(ye),ye.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>'},K}(),Lr=function(K){function l(m,G,J){var z=K.call(this,m,G)||this;return z.isDropdownOpen=!1,z.onClick=z.dropdownButtonClicked,z.dropdownButtons=J,z}return Lt(l,K),l.prototype.setupDropdown=function(){var m=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(G){G.className=m.className,G.colorsClassName=m.colorsClassName,m.dropdownBlock.appendChild(G.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},l.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},l.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},l.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},l.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},l.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},l}(Bt),Pt=function(){function K(l,m){this.GRIP_SIZE=10,this.color=l,this.fillColor=m,this.visual=yt.createGroup(),this.visual.appendChild(yt.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(yt.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return K.prototype.ownsTarget=function(l){return l===this.visual||l===this.visual.childNodes[0]||l===this.visual.childNodes[1]},K.prototype.setCenter=function(l,m){this.visual.childNodes.forEach(function(G){return yt.setAttributes(G,[["cx",l.toString()],["cy",m.toString()]])})},K}(),Xr=function(){function K(l,m,G,J){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=l,this.canvasHeight=m,this.margin=G,this.container=J,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(K.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(l){this._aspectRatio=l,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(l){this._isGridVisible=l,this.gridContainer&&yt.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(l){this._zoomFactor=l,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),K.prototype.open=function(){var l=this;this.cropShadeElement=yt.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=yt.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var m=0;m<this.numberOfGridLines;m++)this.horizontalGridLines.push(yt.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(yt.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach(function(G){return l.gridContainer.appendChild(G)}),this.verticalGridLines.forEach(function(G){return l.gridContainer.appendChild(G)}),this.cropRectElement=yt.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new Pt(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new Pt(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new Pt(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new Pt(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},K.prototype.setCropRectangle=function(l){this.cropRect=l;var m=Object.assign({},this.cropRect);this.zoomFactor!==1&&(m.width=this.cropRect.width*this.zoomFactor,m.height=this.cropRect.height*this.zoomFactor,m.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-m.width/2,m.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-m.height/2),yt.setAttributes(this.cropRectElement,[["x",m.x.toString()],["y",m.y.toString()],["width",m.width.toString()],["height",m.height.toString()]]);var G=m.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(z,ye){var He=m.y+G*(ye+1);yt.setAttributes(z,[["x1",""+m.x],["y1",""+He],["x2",""+(m.x+m.width)],["y2",""+He]])});var J=m.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(z,ye){var He=m.x+J*(ye+1);yt.setAttributes(z,[["x1",""+He],["y1",""+m.y],["x2",""+He],["y2",""+(m.y+m.height)]])}),yt.setAttributes(this.cropShadeElement,[["d",yt.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,m.x,m.y,m.width,m.height)]]),this.topLeftGrip.setCenter(m.x,m.y),this.topRightGrip.setCenter(m.x+m.width,m.y),this.bottomLeftGrip.setCenter(m.x,m.y+m.height),this.bottomRightGrip.setCenter(m.x+m.width,m.y+m.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},K.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)},K.prototype.clientToLocalCoordinates=function(l,m){var G=this.container.getBoundingClientRect();return{x:l-G.left+this.margin,y:m-G.top+this.margin}},K.prototype.onPointerDown=function(l){this.container.setPointerCapture(l.pointerId),this.previousPoint=this.clientToLocalCoordinates(l.clientX,l.clientY),this.cropRectElement===l.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(l.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(l.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(l.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(l.target)&&(this.activeGrip=this.bottomRightGrip)},K.prototype.onPointerMove=function(l){if(this.isMoving)this.move(this.clientToLocalCoordinates(l.clientX,l.clientY));else if(this.activeGrip){var m=this.clientToLocalCoordinates(l.clientX,l.clientY);this.resize(m)}l.preventDefault()},K.prototype.onPointerUp=function(l){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(l.pointerId)},K.prototype.move=function(l){var m=l.x-this.previousPoint.x,G=l.y-this.previousPoint.y;this.zoomFactor!==1&&(m=-m/this.zoomFactor,G=-G/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+m),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+G),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=l},K.prototype.resize=function(l){var m=Object.assign({},this.cropRect),G=l.x-this.previousPoint.x,J=l.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:m.x+G<this.margin&&(G=this.margin-m.x),m.x+=G,m.width=this.cropRect.x+this.cropRect.width-m.x;break;case this.bottomRightGrip:case this.topRightGrip:m.width+G>this.canvasWidth*this.zoomFactor&&(G=this.canvasWidth*this.zoomFactor-m.width),m.width+=G}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(m.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(G),m.height=this.aspectRatio.getVerticalLength(m.width)):(m.y+=J,m.height=this.cropRect.y+this.cropRect.height-m.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?m.height=this.aspectRatio.getVerticalLength(m.width):m.height+=J}m.width<10&&(m.x=this.cropRect.x,m.width=10),m.height<10&&(m.y=this.cropRect.y,m.height=10),this.previousPoint=l,m.x>=this.margin&&m.y>=this.margin&&m.x-this.margin+m.width<=this.canvasWidth&&m.y-this.margin+m.height<=this.canvasHeight&&(this.cropRect=m,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},K.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var l=this.cropRect.x+this.cropRect.width/2,m=this.cropRect.y+this.cropRect.height/2,G=this.aspectRatio.getHorizontalLength(this.cropRect.height),J=this.aspectRatio.getVerticalLength(this.cropRect.width);G/this.canvasWidth<J/this.canvasHeight?this.cropRect.width=G:this.cropRect.height=J,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=l-this.cropRect.width/2,this.cropRect.y=m-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)}},K.prototype.getRescaledRect=function(l,m,G,J,z,ye){var He=G/l,Oe=J/m;return{x:(z.x-ye)*He+ye,y:(z.y-ye)*Oe+ye,width:z.width*He,height:z.height*Oe}},K.prototype.scaleCanvas=function(l,m){var G=this.getRescaledRect(this.canvasWidth,this.canvasHeight,l,m,this.cropRect,this.margin);this.canvasWidth=l,this.canvasHeight=m,this.onCropChange&&this.onCropChange(G),this.setCropRectangle(G)},K}(),ui=function(){function K(l){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=l,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(K.prototype,"angle",{get:function(){return this._angle},set:function(l){this._angle=l,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),K.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},K.prototype.onPointerDown=function(l){this.controlContainer.setPointerCapture(l.pointerId),this.isDragging=!0,this.previousPoint={x:l.clientX,y:l.clientY}},K.prototype.onPointerMove=function(l){this.isDragging&&(this.onAngleChange&&this.onAngleChange((l.clientX-this.previousPoint.x)/5),this.previousPoint.x=l.clientX)},K.prototype.onPointerUp=function(l){this.isDragging&&this.onAngleChange&&this.onAngleChange((l.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(l.pointerId)},K.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var l=this.angleLabelText.getBBox();yt.setAttributes(this.angleLabelElement,[["x",((this.width-l.width)/2).toString()],["y",(this.height/2).toString()]])}},K.prototype.positionScaleShape=function(){if(this.scaleShape){var l=this.scaleShape.transform.baseVal.getItem(0);l.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(l,0)}},K.prototype.getVisual=function(){var l=document.createElementNS("http://www.w3.org/2000/svg","svg");l.setAttribute("xmlns","http://www.w3.org/2000/svg"),l.setAttribute("width",this.width+"px"),l.setAttribute("height",this.height+"px"),l.setAttribute("viewBox","0 0 "+this.width+" "+this.height),l.style.flexShrink="0",document.body.appendChild(l);for(var m="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,G=1;G<=this.width/5+10;G++){var J=G%5==0?this.height/3:this.height/6;m+="h4v"+-J+"h1v"+J}m+="v1H0Z",this.scaleShape=yt.createPath(m);var z=yt.createTransform();this.scaleShape.transform.baseVal.appendItem(z),l.appendChild(this.scaleShape),this.angleLabelElement=yt.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=yt.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var ye=yt.createTSpan("");return ye.innerHTML="&deg;",this.angleLabelElement.appendChild(ye),l.appendChild(this.angleLabelElement),document.body.removeChild(l),l},K}(),gi=function(){function K(){this.naturalSize=!1,this.imageType="image/png"}return K.prototype.rasterize=function(l,m,G,J,z,ye,He){var Oe=this;return new Promise(function(mt){var ze=document.createElement("canvas");ze.width=l.width.baseVal.value-2*J,ze.height=l.height.baseVal.value-2*J;var wt=1,Nt=1;Oe.naturalSize===!0?(wt=m.naturalWidth/(l.width.baseVal.value-2*J)/ye,Nt=m.naturalHeight/(l.height.baseVal.value-2*J)/He,ze.width=m.naturalWidth/ye,ze.height=m.naturalHeight/He):Oe.width!==void 0&&Oe.height!==void 0&&(wt=Oe.width/G.width,Nt=Oe.height/G.height,ze.width*=wt,ze.height*=Nt);var Gt=ze.getContext("2d");Gt.translate(ze.width/2,ze.height/2),Gt.rotate(z*Math.PI/180),Gt.scale(ye,He),Gt.translate(-ze.width/2,-ze.height/2),Gt.drawImage(m,0,0,ze.width,ze.height);var Wr=document.createElement("canvas");Wr.width=G.width*wt,Wr.height=G.height*Nt,Wr.getContext("2d").putImageData(Gt.getImageData((G.x-J)*wt,(G.y-J)*Nt,G.width*wt,G.height*Nt),0,0),mt(Wr.toDataURL(Oe.imageType,Oe.imageQuality))})},K}(),Ye=function(){function K(l){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=K.instanceCounter++,this.styles=new Wt(this.instanceNo),this.target=l,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(K.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(l){this._zoomToCropEnabled=l,l?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(l){this._isGridVisible=l,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"gridLines",{get:function(){return this._gridLines},set:function(l){this._gridLines=l,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(l){this._rotationAngle=l,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"aspectRatio",{get:function(){var l;return(l=this._aspectRatio)!==null&&l!==void 0?l:this.aspectRatios[0]},set:function(l){this._aspectRatio=l},enumerable:!1,configurable:!0}),K.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},K.prototype.show=function(){this.showUI(),this.open()},K.prototype.close=function(l){l===void 0&&(l=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),l||this.closeEventListeners.forEach(function(m){return m()}),this._isOpen=!1)},K.prototype.addRenderEventListener=function(l){this.renderEventListeners.push(l)},K.prototype.removeRenderEventListener=function(l){this.renderEventListeners.indexOf(l)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(l),1)},K.prototype.addCloseEventListener=function(l){this.closeEventListeners.push(l)},K.prototype.removeCloseEventListener=function(l){this.closeEventListeners.indexOf(l)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(l),1)},K.prototype.setupResizeObserver=function(){var l=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){l.resize(l.target.clientWidth,l.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))},K.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var l=1*this.target.clientWidth/this.target.clientHeight,m=this.contentDiv.clientWidth/l>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*l:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,G=m+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/l;this.resize(m,G)}},K.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},K.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",yt.setAttributes(this.editingTarget,[["width",""+this.imageWidth],["height",""+this.imageHeight]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px"},K.prototype.resize=function(l,m){this.imageWidth=Math.round(l),this.imageHeight=Math.round(m),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()},K.prototype.setEditingTarget=function(){var l=document.createElement("canvas");l.width=this.target.naturalWidth,l.height=this.target.naturalHeight,l.getContext("2d").drawImage(this.target,0,0,this.target.naturalWidth,this.target.naturalHeight);var m=l.toDataURL();yt.setAttributes(this.editingTarget,[["href",m]]),this.setEditingTargetSize()},K.prototype.setTopLeft=function(){var l=this.target.getBoundingClientRect(),m=this.editorCanvas.getBoundingClientRect();this.left=l.left-m.left-this.CANVAS_MARGIN,this.top=l.top-m.top-this.CANVAS_MARGIN},K.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=yt.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=yt.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=yt.createGroup(),this.editingTargetRotationScaleContainer=yt.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var l=yt.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(l);var m=yt.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(m),this.editingTargetContainer=yt.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)},K.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},K.prototype.initCropLayer=function(){this.cropRect={x:this.CANVAS_MARGIN,y:this.CANVAS_MARGIN,width:this.imageWidth,height:this.imageHeight},this.cropLayerContainer=yt.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new Xr(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()},K.prototype.zoomToCrop=function(){if(this.cropRect){var l=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,m=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=l+"px "+m+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-l+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-m+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},K.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)},K.prototype.cropRectChanged=function(l){this.cropRect=l,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1},K.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},K.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"},K.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},K.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 l=this.styles.settings.hideTopToolbar?0:this.toolbarHeight,m=this.target.offsetTop>l+this.CANVAS_MARGIN?this.target.offsetTop-(l+this.CANVAS_MARGIN):0;this.coverDiv.style.top=m+"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},K.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},K.prototype.addTopToolbar=function(){var l=this;this.topToolbar=new Cr,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 m=new Vr;m.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(m);var G=[];this.aspectRatios.forEach(function(Nt){var Gt=new Bt(li.getIcon(Nt.horizontal,Nt.vertical),Nt.horizontal===0&&Nt.vertical===0?"FREE":Nt.horizontal+":"+Nt.vertical);Gt.onClick=function(){return l.ratioButtonClicked(Nt)},G.push(Gt)}),this.aspectRatioButton=new Lr(li.getIcon(0,0),"Aspect ratio",G),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,m.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var J=new Bt('<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");J.isActive=this.isGridVisible,J.onClick=function(){l.isGridVisible=!l.isGridVisible,J.isActive=l.isGridVisible},m.addButton(J);var z=new Bt('<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(z.isActive=this.zoomToCropEnabled,z.onClick=function(){l.zoomToCropEnabled=!l.zoomToCropEnabled,z.isActive=l.zoomToCropEnabled},m.addButton(z),!Zt.isLicensed){var ye=new gt;this.topToolbar.addElementBlock(ye);var He=document.createElement("div");He.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var Oe=document.createElement("a");Oe.style.color="currentColor",Oe.href="https://markerjs.com/products/cropro",Oe.target="_blank",Oe.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(Oe),ye.addElement(He)}var mt=new Vr;mt.minWidth=3*this.toolbarHeight+"px",mt.contentAlign="end",this.topToolbar.addButtonBlock(mt);var ze=new Bt('<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");ze.onClick=this.startRenderAndClose,mt.addButton(ze),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(ze.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var wt=new Bt('<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");wt.onClick=this.close,mt.addButton(wt),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(wt.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},K.prototype.addBottomToolbar=function(){var l=this;this.bottomToolbar=new Cr,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 m=new Vr;m.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(m);var G=new Bt('<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");G.onClick=this.rotateLeftButtonClicked,m.addButton(G);var J=new Bt('<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");J.onClick=this.rotateRightButtonClicked,m.addButton(J);var z=new gt;z.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(z),this.straightener=new ui("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(mt){l.rotateBy(mt),l.straightener.angle=l.rotationAngle},z.addElement(this.straightener.getUI());var ye=new Vr;ye.minWidth=2*this.toolbarHeight+"px",ye.contentAlign="end",this.bottomToolbar.addButtonBlock(ye);var He=new Bt('<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,ye.addButton(He);var Oe=new Bt('<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");Oe.onClick=this.flipVerticallyButtonClicked,ye.addButton(Oe)},K.prototype.ratioButtonClicked=function(l){this.aspectRatio=l,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},K.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=li.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},K.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new jr(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},K.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},K.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},K.prototype.restoreState=function(l){if(l){var m=this.cropLayer.getRescaledRect(l.width,l.height,this.imageWidth,this.imageHeight,l.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(m),this.cropRectChanged(m),this.flippedHorizontally=l.flippedHorizontally,this.flippedVertically=l.flippedVertically,this.applyFlip(),this.rotationAngle=l.rotationAngle,this.applyRotation()}},K.prototype.clientToLocalCoordinates=function(l,m){var G=this.cropImage.getBoundingClientRect();return{x:l-G.left,y:m-G.top}},K.prototype.onWindowResize=function(){this.positionUI()},K.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var l=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=l+"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()},K.prototype.rotateLeftButtonClicked=function(){var l=this.rotationAngle-90;this.rotationAngle%90!=0&&(l+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(l)},K.prototype.rotateRightButtonClicked=function(){var l=this.rotationAngle+90;this.rotationAngle%90!=0&&(l-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(l)},K.prototype.rotateTo=function(l){l=(l=l>180?l-360:l)<=-180?l+360:l,this.rotationAngle=l,this.applyRotation()},K.prototype.rotateBy=function(l){this.rotateTo((this.rotationAngle+l)%360)},K.prototype.applyRotation=function(){var l=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var m=this.editingTargetRotationContainer.transform.baseVal.getItem(0);m.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(m,0);var G=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/G.width,this.imageHeight/G.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=l},K.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},K.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},K.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},K.prototype.startRenderAndClose=function(){return Ze(this,void 0,void 0,function(){var l,m;return ir(this,function(G){switch(G.label){case 0:return[4,this.render()];case 1:return l=G.sent(),m=this.getState(),this.renderEventListeners.forEach(function(J){return J(l,m)}),this.close(!0),[2]}})})},K.prototype.render=function(){return Ze(this,void 0,void 0,function(){var l;return ir(this,function(m){switch(m.label){case 0:return(l=new gi).naturalSize=this.renderAtNaturalSize,l.imageType=this.renderImageType,l.imageQuality=this.renderImageQuality,l.width=this.renderWidth,l.height=this.renderHeight,this.unzoomFromCrop(),yt.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,l.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 m.sent(),[4,l.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,m.sent()]}})})},K.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new ar("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 ar("toolbar_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarBlockStyleClass=this.styles.addClass(new ar("toolbar-block",`
display: flex;
align-items: center;
box-sizing: content-box;
`));var l=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new ar("toolbar_button",`
display: inline-block;
width: `+(this.toolbarHeight-2*l)+`px;
height: `+(this.toolbarHeight-2*l)+`px;
padding: `+l+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new ar("toolbar_button_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new ar("toolbar_active_button",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
`)),this.styles.addRule(new nr("."+this.toolbarButtonStyleClass.name+" svg",`
height: `+this.toolbarHeight/2+`px;
`)),this.styles.addRule(new nr("."+this.toolbarButtonStyleColorsClass.name+":hover",`
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new ar("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 ar("toolbar_dropdown_colors",`
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new ar("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 ar("toolbar_straightener",`
display: flex;
overflow: hidden;
justify-content: center;
height: `+(this.toolbarHeight-2*l)+`px;
padding: `+l+`px;
cursor: default;
user-select: none;
box-sizing: content-box;
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new ar("toolbar_straightener_colors",`
color: `+this.styles.settings.toolbarColor+`;
fill: currentColor;
`))},K.instanceCounter=0,K}(),Tt=se("8hTe"),ti=se.n(Tt),hi=/<pre[^>]*>/g;function di(K){var l=document.createElement("div");return l.innerHTML=K,l.childNodes.length===0?"":l.childNodes[0].nodeValue}var Ri=at.a=function(K){var l=K.value,m=l===void 0?"":l,G=K.edit,J=G===void 0?!1:G,z=K.className,ye=K.showTextOnly,He=K.showLines,Oe=K.replaces,mt=K.zoomImg,ze=K.hasMask,wt=K.style,Nt=wt===void 0?{}:wt,Gt=K.stylesPrev,Wr=Gt===void 0?{}:Gt,Hr=String(m),dr=Object(A.useRef)(),Yr=Object(A.useRef)(),Ki=Object(A.useState)(""),kr=Object(j.a)(Ki,2),Dr=kr[0],ri=kr[1],vi=Object(A.useState)("office"),Qr=Object(j.a)(vi,2),ii=Qr[0],Gr=Qr[1],fn=function(){var Ft=new Ye(Yr.current);Ft.displayMode="popup",Ft.addRenderEventListener(function(){var vr=Object(O.a)(_.a.mark(function jt(yr){var Yt;return _.a.wrap(function(lr){for(;;)switch(lr.prev=lr.next){case 0:return dr.current.style.display="none",lr.next=3,Object(ke.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:yr}});case 3:Yt=lr.sent,Yt!=null&&Yt.id&&Oe(Yr.current.getAttribute("src").replace(ee.a.API_SERVER,""),"/api/attachments/".concat(Yt==null?void 0:Yt.id,"?type=").concat(Yt.content_type));case 5:case"end":return lr.stop()}},jt)}));return function(jt){return vr.apply(this,arguments)}}()),Ft.show()},Vi=function(){var Ft=new pt(Yr.current);Ft.settings.displayMode="popup",Ft.addEventListener("render",function(){var vr=Object(O.a)(_.a.mark(function jt(yr){var Yt;return _.a.wrap(function(lr){for(;;)switch(lr.prev=lr.next){case 0:if(dr.current.style.display="none",!Yr.current){lr.next=6;break}return lr.next=4,Object(ke.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:yr.dataUrl}});case 4:Yt=lr.sent,Yt!=null&&Yt.id&&Oe(Yr.current.getAttribute("src").replace(ee.a.API_SERVER,""),"/api/attachments/".concat(Yt==null?void 0:Yt.id,"?type=").concat(Yt.content_type));case 6:case"end":return lr.stop()}},jt)}));return function(jt){return vr.apply(this,arguments)}}()),Ft.show(),window.markerArea=Ft},Ir=Object(A.useMemo)(function(){try{var tr=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,Ft=/\"\/api\/attachments\/|\"\/attachments\/download\//g,vr=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;Hr=Hr.replace(tr,"("+ee.a.API_SERVER+"/api/attachments/").replace(Ft,'"'+ee.a.API_SERVER+"/api/attachments/").replace(vr,'"'+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,`
`),Hr=Hr.replace(new RegExp("(?<!\\n)\\n(?!\\n)","g"),`
`)}catch(yi){}var jt=V(Hr),yr=C();if(Hr.match(/\[TOC\]/)&&(jt=jt.replace("<p>[TOC]</p>",D()),k()),jt=jt.replace(/(__special_katext_id_\d+__)/g,function(yi,lr){var ur=yr[lr],ni=ur.type,bi=ur.expression;return Object(oe.renderToString)(di(bi)||"",{displayMode:ni==="block",throwOnError:!1,output:"html"})}),jt=jt.replace(/▁/g,"\u2581\u2581\u2581"),S(),ye){var Yt=document.createElement("div");return Yt.innerHTML=jt,Yt.innerText}return setTimeout(function(){return _i()},500),jt},[Hr]),Nr=Object(A.useRef)();c.WebkitLineClamp=He,He&&(Nt=Object(U.a)(Object(U.a)({},Nt),c));function Oi(tr){var Ft=tr.target;if(Ft.tagName.toUpperCase()==="IMG"){if(mt){var vr=Ft.getAttribute("src");ri(vr),Gr("image")}}else if(Ft.tagName.toUpperCase()==="A"){var jt=Ft.getAttribute("href");if(jt.indexOf("office")>-1)tr.preventDefault(),ri(jt),Gr("office");else if(jt.indexOf("application/pdf")>-1)tr.preventDefault(),ri(jt),Gr("pdf");else if(jt.indexOf("type=text")>-1)tr.preventDefault(),ri(jt),Gr("html");else if(jt.startsWith("#")){tr.preventDefault();var yr=document.getElementById(jt.replace("#",""));yr&&yr.scrollIntoView(!0)}}}var _i=function(){var Ft,vr=(Ft=Nr.current)===null||Ft===void 0?void 0:Ft.querySelectorAll("video");vr==null||vr.forEach(function(jt){if(jt.oncontextmenu=function(){return!1},jt.src.indexOf(".m3u8")>-1&&!jt.canPlayType("application/vnd.apple.mpegurl")){if(X.a.isSupported()){var yr=new X.a;yr.loadSource(jt.src),yr.attachMedia(jt)}}})};Object(A.useEffect)(function(){if(Nr.current&&Ir&&(Ir.match(hi)&&window.PR.prettyPrint()),Nr.current)return Nr.current.addEventListener("click",Oi),function(){Nr.current.removeEventListener("click",Oi),S(),k()}},[Ir,Nr.current,Oi]);var Mi=function(Ft){if(!J)return;Ft.target.nodeName==="IMG"?(dr.current.style.display="flex",dr.current.style.width=Ft.target.clientWidth+"px",dr.current.style.height=Ft.target.clientHeight+"px",dr.current.style.top=Ft.target.offsetTop+"px",dr.current.style.left=Ft.target.offsetLeft+"px",Yr.current.src=Ft.target.getAttribute("src")):dr.current.style.display="none"};return f.a.createElement("div",{style:{position:"relative"}},f.a.createElement("div",{ref:Nr,style:Object(U.a)({},Nt),className:"".concat(z||""," markdown-body ").concat(ti.a.mdBody),onMouseOver:Mi,dangerouslySetInnerHTML:{__html:Ir}}),f.a.createElement("div",{ref:dr,className:ti.a.button},f.a.createElement($.a,null,f.a.createElement(Q.a,{onClick:function(){return fn()}},"\u88C1\u526A"),f.a.createElement(Q.a,{onClick:function(){return Vi()}},"\u7F16\u8F91"))),f.a.createElement("img",{ref:Yr,src:"https://ali-cdn.educoder.net/images/avatars/PortalImage/170?t=1659681136",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),f.a.createElement(fe.a,{close:!0,data:Dr,hasMask:ze,type:Dr!=null&&Dr.length?ii:"",style:Object(U.a)({},Wr),onClose:function(){return ri("")}}))}},"9VGf":function(dt,at,se){"use strict";se.d(at,"a",function(){return R});var ne=se("q1tI"),$=se.n(ne);function R(Q,U){var O=Object(ne.useRef)();Object(ne.useEffect)(function(){O.current=Q}),Object(ne.useEffect)(function(){function j(){O.current()}if(U!==null){var N=setInterval(j,U);return function(){return clearInterval(N)}}},[U])}},BU3w:function(dt,at,se){"use strict";se.d(at,"a",function(){return O});var ne=se("MNnm"),$="rc-util-key";function R(j){if(j.attachTo)return j.attachTo;var N=document.querySelector("head");return N||document.body}function Q(j){var N,_=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(ne.a)())return null;var A=document.createElement("style");if((N=_.csp)===null||N===void 0?void 0:N.nonce){var f;A.nonce=(f=_.csp)===null||f===void 0?void 0:f.nonce}A.innerHTML=j;var x=R(_),P=x.firstChild;return _.prepend&&x.prepend?x.prepend(A):_.prepend&&P?x.insertBefore(A,P):x.appendChild(A),A}var U=new Map;function O(j,N){var _=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},A=R(_);if(!U.has(A)){var f=Q("",_),x=f.parentNode;U.set(A,x),x.removeChild(f)}var P=Array.from(U.get(A).children).find(function(a){return a.tagName==="STYLE"&&a[$]===N});if(P){var w,E;if(((w=_.csp)===null||w===void 0?void 0:w.nonce)&&P.nonce!==((E=_.csp)===null||E===void 0?void 0:E.nonce)){var p;P.nonce=(p=_.csp)===null||p===void 0?void 0:p.nonce}return P.innerHTML!==j&&(P.innerHTML=j),P}var u=Q(j,_);return u[$]=N,u}},Bd2K:function(dt,at,se){(function(ne){ne(se("VrN/"),se("osHv"))})(function(ne){ne.defineOption("autoCloseTags",!1,function(_,A,f){if(f!=ne.Init&&f&&_.removeKeyMap("autoCloseTags"),!A)return;var x={name:"autoCloseTags"};(typeof A!="object"||A.whenClosing!==!1)&&(x["'/'"]=function(P){return O(P)}),(typeof A!="object"||A.whenOpening!==!1)&&(x["'>'"]=function(P){return Q(P)}),_.addKeyMap(x)});var $=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],R=["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(_){if(_.getOption("disableInput"))return ne.Pass;for(var A=_.listSelections(),f=[],x=_.getOption("autoCloseTags"),P=0;P<A.length;P++){if(!A[P].empty())return ne.Pass;var w=A[P].head,E=_.getTokenAt(w),p=ne.innerMode(_.getMode(),E.state),u=p.state,a=p.mode.xmlCurrentTag&&p.mode.xmlCurrentTag(u),s=a&&a.name;if(!s)return ne.Pass;var h=p.mode.configuration=="html",k=typeof x=="object"&&x.dontCloseTags||h&&$,c=typeof x=="object"&&x.indentTags||h&&R;E.end>w.ch&&(s=s.slice(0,s.length-E.end+w.ch));var b=s.toLowerCase();if(!s||E.type=="string"&&(E.end!=w.ch||!/[\"\']/.test(E.string.charAt(E.string.length-1))||E.string.length==1)||E.type=="tag"&&a.close||E.string.indexOf("/")==w.ch-E.start-1||k&&j(k,b)>-1||N(_,p.mode.xmlCurrentContext&&p.mode.xmlCurrentContext(u)||[],s,w,!0))return ne.Pass;var D=typeof x=="object"&&x.emptyTags;if(D&&j(D,s)>-1){f[P]={text:"/>",newPos:ne.Pos(w.line,w.ch+2)};continue}var T=c&&j(c,b)>-1;f[P]={indent:T,text:">"+(T?`
`:"")+"</"+s+">",newPos:T?ne.Pos(w.line+1,0):ne.Pos(w.line,w.ch+1)}}for(var g=typeof x=="object"&&x.dontIndentOnAutoClose,P=A.length-1;P>=0;P--){var v=f[P];_.replaceRange(v.text,A[P].head,A[P].anchor,"+insert");var d=_.listSelections().slice(0);d[P]={head:v.newPos,anchor:v.newPos},_.setSelections(d),!g&&v.indent&&(_.indentLine(v.newPos.line,null,!0),_.indentLine(v.newPos.line+1,null,!0))}}function U(_,A){for(var f=_.listSelections(),x=[],P=A?"/":"</",w=_.getOption("autoCloseTags"),E=typeof w=="object"&&w.dontIndentOnSlash,p=0;p<f.length;p++){if(!f[p].empty())return ne.Pass;var u=f[p].head,a=_.getTokenAt(u),s=ne.innerMode(_.getMode(),a.state),h=s.state;if(A&&(a.type=="string"||a.string.charAt(0)!="<"||a.start!=u.ch-1))return ne.Pass;var k,c=s.mode.name!="xml"&&_.getMode().name=="htmlmixed";if(c&&s.mode.name=="javascript")k=P+"script";else if(c&&s.mode.name=="css")k=P+"style";else{var b=s.mode.xmlCurrentContext&&s.mode.xmlCurrentContext(h);if(!b||b.length&&N(_,b,b[b.length-1],u))return ne.Pass;k=P+b[b.length-1]}_.getLine(u.line).charAt(a.end)!=">"&&(k+=">"),x[p]=k}if(_.replaceSelections(x),f=_.listSelections(),!E)for(var p=0;p<f.length;p++)(p==f.length-1||f[p].head.line<f[p+1].head.line)&&_.indentLine(f[p].head.line)}function O(_){return _.getOption("disableInput")?ne.Pass:U(_,!0)}ne.commands.closeTag=function(_){return U(_)};function j(_,A){if(_.indexOf)return _.indexOf(A);for(var f=0,x=_.length;f<x;++f)if(_[f]==A)return f;return-1}function N(_,A,f,x,P){if(!ne.scanForClosingTag)return!1;var w=Math.min(_.lastLine()+1,x.line+500),E=ne.scanForClosingTag(_,x,null,w);if(!E||E.tag!=f)return!1;for(var p=P?1:0,u=A.length-1;u>=0&&A[u]==f;u--)++p;x=E.to;for(var u=1;u<p;u++){var a=ne.scanForClosingTag(_,x,null,w);if(!a||a.tag!=f)return!1;x=a.to}return!0}})},BjJ7:function(dt,at,se){"use strict";se.d(at,"d",function(){return $}),se.d(at,"c",function(){return R}),se.d(at,"e",function(){return Q}),se.d(at,"b",function(){return U}),se.d(at,"a",function(){return j});var ne=se("m3rI");function $(N){var _=!0;if(N.length>0){for(var A=0;A<N.length;A++)if(N[A].compile_success==0||!N[A].compile_success){_=!1;break}}else _=!1;return _}function R(N){for(var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",A=[],f=0;f<N.length;f++){var x=N[f],P=_?"".concat(_,"/").concat(x.name):"".concat(x.name);A.push({title:x.name,isLeaf:!(x.type==="tree"),key:P})}return A}function Q(N,_,A){for(var f=0;f<N.length;f++){var x=N[f];if(x.key===_){x.children=A;break}x.children&&Q(x.children,_,A)}return N}function U(N,_,A){var f;return function(){var x=this,P=arguments,w=function(){f=null,A||N.apply(x,P)},E=A&&!f;clearTimeout(f),f=setTimeout(w,_),E&&N.apply(x,P)}}var O=!0,j=ne.a.API_SERVER},"C+DQ":function(dt,at,se){},D1Df:function(dt,at,se){"use strict";function ne(y){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ne=function(F){return typeof F}:ne=function(F){return F&&typeof Symbol=="function"&&F.constructor===Symbol&&F!==Symbol.prototype?"symbol":typeof F},ne(y)}function $(){return $=Object.assign||function(y){for(var M=1;M<arguments.length;M++){var F=arguments[M];for(var W in F)Object.prototype.hasOwnProperty.call(F,W)&&(y[W]=F[W])}return y},$.apply(this,arguments)}function R(y,M){var F=Object.keys(y);if(Object.getOwnPropertySymbols){var W=Object.getOwnPropertySymbols(y);M&&(W=W.filter(function(V){return Object.getOwnPropertyDescriptor(y,V).enumerable})),F.push.apply(F,W)}return F}function Q(y){for(var M=1;M<arguments.length;M++){var F=arguments[M]!=null?arguments[M]:{};M%2?R(F,!0).forEach(function(W){E(y,W,F[W])}):Object.getOwnPropertyDescriptors?Object.defineProperties(y,Object.getOwnPropertyDescriptors(F)):R(F).forEach(function(W){Object.defineProperty(y,W,Object.getOwnPropertyDescriptor(F,W))})}return y}function U(y,M){if(y==null)return{};var F=O(y,M),W,V;if(Object.getOwnPropertySymbols){var I=Object.getOwnPropertySymbols(y);for(V=0;V<I.length;V++){if(W=I[V],M.indexOf(W)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(y,W))continue;F[W]=y[W]}}return F}function O(y,M){if(y==null)return{};var F={},W=Object.keys(y),V,I;for(I=0;I<W.length;I++){if(V=W[I],M.indexOf(V)>=0)continue;F[V]=y[V]}return F}function j(y,M){if(!(y instanceof M))throw new TypeError("Cannot call a class as a function")}function N(y,M){for(var F=0;F<M.length;F++){var W=M[F];W.enumerable=W.enumerable||!1,W.configurable=!0,"value"in W&&(W.writable=!0),Object.defineProperty(y,W.key,W)}}function _(y,M,F){return M&&N(y.prototype,M),F&&N(y,F),y}function A(y,M){return M&&(ne(M)==="object"||typeof M=="function")?M:x(y)}function f(y){return f=Object.setPrototypeOf?Object.getPrototypeOf:function(F){return F.__proto__||Object.getPrototypeOf(F)},f(y)}function x(y){if(y===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return y}function P(y,M){if(typeof M!="function"&&M!==null)throw new TypeError("Super expression must either be null or a function");y.prototype=Object.create(M&&M.prototype,{constructor:{value:y,writable:!0,configurable:!0}}),M&&w(y,M)}function w(y,M){return w=Object.setPrototypeOf||function(W,V){return W.__proto__=V,W},w(y,M)}function E(y,M,F){return M in y?Object.defineProperty(y,M,{value:F,enumerable:!0,configurable:!0,writable:!0}):y[M]=F,y}var p=se("q1tI"),u=se("17x9"),a=se("H38U"),s=se("aRTE");function h(y){for(var M="",F=0;F<y.length;F++){var W=y.charCodeAt(F);W<128?M+=String.fromCharCode(W):W<2048?(M+=String.fromCharCode(192|W>>6),M+=String.fromCharCode(128|W&63)):W<55296||W>=57344?(M+=String.fromCharCode(224|W>>12),M+=String.fromCharCode(128|W>>6&63),M+=String.fromCharCode(128|W&63)):(F++,W=65536+((W&1023)<<10|y.charCodeAt(F)&1023),M+=String.fromCharCode(240|W>>18),M+=String.fromCharCode(128|W>>12&63),M+=String.fromCharCode(128|W>>6&63),M+=String.fromCharCode(128|W&63))}return M}var k={size:128,level:"L",bgColor:"#FFFFFF",fgColor:"#000000",includeMargin:!1},c={},b=4,D=.1;function T(y){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,F=[];return y.forEach(function(W,V){var I=null;W.forEach(function(B,X){if(!B&&I!==null){F.push("M".concat(I+M," ").concat(V+M,"h").concat(X-I,"v1H").concat(I+M,"z")),I=null;return}if(X===W.length-1){if(!B)return;I===null?F.push("M".concat(X+M,",").concat(V+M," h1v1H").concat(X+M,"z")):F.push("M".concat(I+M,",").concat(V+M," h").concat(X+1-I,"v1H").concat(I+M,"z"));return}B&&I===null&&(I=X)})}),F.join("")}function g(y,M){return y.slice().map(function(F,W){return W<M.y||W>=M.y+M.h?F:F.map(function(V,I){return I<M.x||I>=M.x+M.w?V:!1})})}function v(y,M){var F=y.imageSettings,W=y.size,V=y.includeMargin;if(F==null)return null;var I=V?b:0,B=M.length+I*2,X=Math.floor(W*D),ee=B/W,oe=(F.width||X)*ee,fe=(F.height||X)*ee,ke=F.x==null?M.length/2-oe/2:F.x*ee,xe=F.y==null?M.length/2-fe/2:F.y*ee,Te=null;if(F.excavate){var Ce=Math.floor(ke),ge=Math.floor(xe),pe=Math.ceil(oe+ke-Ce),ue=Math.ceil(fe+xe-ge);Te={x:Ce,y:ge,w:pe,h:ue}}return{x:ke,y:xe,h:fe,w:oe,excavation:Te}}var d=function(){try{new Path2D().addPath(new Path2D)}catch(y){return!1}return!0}(),o=function(y){P(M,y);function M(){var F,W;j(this,M);for(var V=arguments.length,I=new Array(V),B=0;B<V;B++)I[B]=arguments[B];return W=A(this,(F=f(M)).call.apply(F,[this].concat(I))),E(x(W),"_canvas",void 0),E(x(W),"_image",void 0),E(x(W),"state",{imgLoaded:!1}),E(x(W),"handleImageLoad",function(){W.setState({imgLoaded:!0})}),W}return _(M,[{key:"componentDidMount",value:function(){this.update()}},{key:"componentDidUpdate",value:function(){this.update()}},{key:"update",value:function(){var W=this.props,V=W.value,I=W.size,B=W.level,X=W.bgColor,ee=W.fgColor,oe=W.includeMargin,fe=W.imageSettings,ke=new a(-1,s[B]);if(ke.addData(h(V)),ke.make(),this._canvas!=null){var xe=this._canvas,Te=xe.getContext("2d");if(!Te)return;var Ce=ke.modules;if(Ce===null)return;var ge=oe?b:0,pe=Ce.length+ge*2,ue=v(this.props,Ce);fe!=null&&ue!=null&&(ue.excavation!=null&&(Ce=g(Ce,ue.excavation)));var te=window.devicePixelRatio||1;xe.height=xe.width=I*te;var de=I/pe*te;Te.scale(de,de),Te.fillStyle=X,Te.fillRect(0,0,pe,pe),Te.fillStyle=ee,d?Te.fill(new Path2D(T(Ce,ge))):Ce.forEach(function(ae,we){ae.forEach(function(Re,Ee){Re&&Te.fillRect(Ee+ge,we+ge,1,1)})}),this.state.imgLoaded&&this._image&&ue!=null&&Te.drawImage(this._image,ue.x+ge,ue.y+ge,ue.w,ue.h)}}},{key:"render",value:function(){var W=this,V=this.props,I=V.value,B=V.size,X=V.level,ee=V.bgColor,oe=V.fgColor,fe=V.style,ke=V.includeMargin,xe=V.imageSettings,Te=U(V,["value","size","level","bgColor","fgColor","style","includeMargin","imageSettings"]),Ce=Q({height:B,width:B},fe),ge=null,pe=xe&&xe.src;return xe!=null&&pe!=null&&(ge=p.createElement("img",{src:pe,style:{display:"none"},onLoad:this.handleImageLoad,ref:function(te){return W._image=te}})),p.createElement(p.Fragment,null,p.createElement("canvas",$({style:Ce,height:B,width:B,ref:function(te){return W._canvas=te}},Te)),ge)}}]),M}(p.PureComponent);E(o,"defaultProps",k);var C=function(y){P(M,y);function M(){return j(this,M),A(this,f(M).apply(this,arguments))}return _(M,[{key:"render",value:function(){var W=this.props,V=W.value,I=W.size,B=W.level,X=W.bgColor,ee=W.fgColor,oe=W.includeMargin,fe=W.imageSettings,ke=U(W,["value","size","level","bgColor","fgColor","includeMargin","imageSettings"]),xe=new a(-1,s[B]);xe.addData(h(V)),xe.make();var Te=xe.modules;if(Te===null)return null;var Ce=oe?b:0,ge=Te.length+Ce*2,pe=v(this.props,Te),ue=null;fe!=null&&pe!=null&&(pe.excavation!=null&&(Te=g(Te,pe.excavation)),ue=p.createElement("image",{xlinkHref:fe.src,height:pe.h,width:pe.w,x:pe.x+Ce,y:pe.y+Ce,preserveAspectRatio:"none"}));var te=T(Te,Ce);return p.createElement("svg",$({shapeRendering:"crispEdges",height:I,width:I,viewBox:"0 0 ".concat(ge," ").concat(ge)},ke),p.createElement("path",{fill:X,d:"M0,0 h".concat(ge,"v").concat(ge,"H0z")}),p.createElement("path",{fill:ee,d:te}),ue)}}]),M}(p.PureComponent);E(C,"defaultProps",k);var S=function(M){var F=M.renderAs,W=U(M,["renderAs"]),V=F==="svg"?C:o;return p.createElement(V,W)};S.defaultProps=Q({renderAs:"canvas"},k),dt.exports=S},DlQD:function(dt,at,se){(function(ne,$){dt.exports=$()})(this,function(){"use strict";function ne(Se,ve){for(var be=0;be<ve.length;be++){var re=ve[be];re.enumerable=re.enumerable||!1,re.configurable=!0,"value"in re&&(re.writable=!0),Object.defineProperty(Se,re.key,re)}}function $(Se,ve,be){return ve&&ne(Se.prototype,ve),be&&ne(Se,be),Se}function R(Se,ve){if(!Se)return;if(typeof Se=="string")return Q(Se,ve);var be=Object.prototype.toString.call(Se).slice(8,-1);if(be==="Object"&&Se.constructor&&(be=Se.constructor.name),be==="Map"||be==="Set")return Array.from(Se);if(be==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(be))return Q(Se,ve)}function Q(Se,ve){(ve==null||ve>Se.length)&&(ve=Se.length);for(var be=0,re=new Array(ve);be<ve;be++)re[be]=Se[be];return re}function U(Se,ve){var be;if(typeof Symbol=="undefined"||Se[Symbol.iterator]==null){if(Array.isArray(Se)||(be=R(Se))||ve&&Se&&typeof Se.length=="number"){be&&(Se=be);var re=0;return function(){return re>=Se.length?{done:!0}:{done:!1,value:Se[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 be=Se[Symbol.iterator](),be.next.bind(be)}function O(Se,ve){return ve={exports:{}},Se(ve,ve.exports),ve.exports}var j=O(function(Se){function ve(){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 be(re){Se.exports.defaults=re}Se.exports={defaults:ve(),getDefaults:ve,changeDefaults:be}}),N=j.defaults,_=j.getDefaults,A=j.changeDefaults,f=/[&<>"']/,x=/[&<>"']/g,P=/[<>"']|&(?!#?\w+;)/,w=/[<>"']|&(?!#?\w+;)/g,E={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},p=function(ve){return E[ve]};function u(Se,ve){if(ve){if(f.test(Se))return Se.replace(x,p)}else if(P.test(Se))return Se.replace(w,p);return Se}var a=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function s(Se){return Se.replace(a,function(ve,be){return be=be.toLowerCase(),be==="colon"?":":be.charAt(0)==="#"?be.charAt(1)==="x"?String.fromCharCode(parseInt(be.substring(2),16)):String.fromCharCode(+be.substring(1)):""})}var h=/(^|[^\[])\^/g;function k(Se,ve){Se=Se.source||Se,ve=ve||"";var be={replace:function(ie,le){return le=le.source||le,le=le.replace(h,"$1"),Se=Se.replace(ie,le),be},getRegex:function(){return new RegExp(Se,ve)}};return be}var c=/[^\w:]/g,b=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function D(Se,ve,be){if(Se){var re;try{re=decodeURIComponent(s(be)).replace(c,"").toLowerCase()}catch(ie){return null}if(re.indexOf("javascript:")===0||re.indexOf("vbscript:")===0||re.indexOf("data:")===0)return null}ve&&!b.test(be)&&(be=o(ve,be));try{be=encodeURI(be).replace(/%25/g,"%")}catch(ie){return null}return be}var T={},g=/^[^:]+:\/*[^/]*$/,v=/^([^:]+:)[\s\S]*$/,d=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(Se,ve){T[" "+Se]||(g.test(Se)?T[" "+Se]=Se+"/":T[" "+Se]=M(Se,"/",!0)),Se=T[" "+Se];var be=Se.indexOf(":")===-1;return ve.substring(0,2)==="//"?be?ve:Se.replace(v,"$1")+ve:ve.charAt(0)==="/"?be?ve:Se.replace(d,"$1")+ve:Se+ve}var C={exec:function(){}};function S(Se){for(var ve=1,be,re;ve<arguments.length;ve++){be=arguments[ve];for(re in be)Object.prototype.hasOwnProperty.call(be,re)&&(Se[re]=be[re])}return Se}function y(Se,ve){var be=Se.replace(/\|/g,function(le,he,Le){for(var Pe=!1,Xe=he;--Xe>=0&&Le[Xe]==="\\";)Pe=!Pe;return Pe?"|":" |"}),re=be.split(/ \|/),ie=0;if(re.length>ve)re.splice(ve);else for(;re.length<ve;)re.push("");for(;ie<re.length;ie++)re[ie]=re[ie].trim().replace(/\\\|/g,"|");return re}function M(Se,ve,be){var re=Se.length;if(re===0)return"";for(var ie=0;ie<re;){var le=Se.charAt(re-ie-1);if(le===ve&&!be)ie++;else if(le!==ve&&be)ie++;else break}return Se.substr(0,re-ie)}function F(Se,ve){if(Se.indexOf(ve[1])===-1)return-1;for(var be=Se.length,re=0,ie=0;ie<be;ie++)if(Se[ie]==="\\")ie++;else if(Se[ie]===ve[0])re++;else if(Se[ie]===ve[1]&&(re--,re<0))return ie;return-1}function W(Se){Se&&Se.sanitize&&!Se.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:s,edit:k,cleanUrl:D,resolveUrl:o,noopTest:C,merge:S,splitCells:y,rtrim:M,findClosingBracket:F,checkSanitizeDeprecation:W},I=j.defaults,B=V.rtrim,X=V.splitCells,ee=V.escape,oe=V.findClosingBracket;function fe(Se,ve,be){var re=ve.href,ie=ve.title?ee(ve.title):null,le=Se[1].replace(/\\([\[\]])/g,"$1");return Se[0].charAt(0)!=="!"?{type:"link",raw:be,href:re,title:ie,text:le}:{type:"image",raw:be,href:re,title:ie,text:ee(le)}}function ke(Se,ve){var be=Se.match(/^(\s+)(?:```)/);if(be===null)return ve;var re=be[1];return ve.split(`
`).map(function(ie){var le=ie.match(/^\s+/);if(le===null)return ie;var he=le[0];return he.length>=re.length?ie.slice(re.length):ie}).join(`
`)}var xe=function(){function Se(be){this.options=be||I}var ve=Se.prototype;return ve.space=function(re){var ie=this.rules.block.newline.exec(re);if(ie)return ie[0].length>1?{type:"space",raw:ie[0]}:{raw:`
`}},ve.code=function(re,ie){var le=this.rules.block.code.exec(re);if(le){var he=ie[ie.length-1];if(he&&he.type==="paragraph")return{raw:le[0],text:le[0].trimRight()};var Le=le[0].replace(/^ {4}/gm,"");return{type:"code",raw:le[0],codeBlockStyle:"indented",text:this.options.pedantic?Le:B(Le,`
`)}}},ve.fences=function(re){var ie=this.rules.block.fences.exec(re);if(ie){var le=ie[0],he=ke(le,ie[3]||"");return{type:"code",raw:le,lang:ie[2]?ie[2].trim():ie[2],text:he}}},ve.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]}},ve.nptable=function(re){var ie=this.rules.block.nptable.exec(re);if(ie){var le={type:"table",header:X(ie[1].replace(/^ *| *\| *$/g,"")),align:ie[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ie[3]?ie[3].replace(/\n$/,"").split(`
`):[],raw:ie[0]};if(le.header.length===le.align.length){var he=le.align.length,Le;for(Le=0;Le<he;Le++)/^ *-+: *$/.test(le.align[Le])?le.align[Le]="right":/^ *:-+: *$/.test(le.align[Le])?le.align[Le]="center":/^ *:-+ *$/.test(le.align[Le])?le.align[Le]="left":le.align[Le]=null;for(he=le.cells.length,Le=0;Le<he;Le++)le.cells[Le]=X(le.cells[Le],le.header.length);return le}}},ve.hr=function(re){var ie=this.rules.block.hr.exec(re);if(ie)return{type:"hr",raw:ie[0]}},ve.blockquote=function(re){var ie=this.rules.block.blockquote.exec(re);if(ie){var le=ie[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:ie[0],text:le}}},ve.list=function(re){var ie=this.rules.block.list.exec(re);if(ie){for(var le=ie[0],he=ie[2],Le=he.length>1,Pe=he[he.length-1]===")",Xe={type:"list",raw:le,ordered:Le,start:Le?+he.slice(0,-1):"",loose:!1,items:[]},vt=ie[0].match(this.rules.block.item),Dt=!1,Ge,Et,ft,it,Rt,pt,At,Lt=vt.length,Ze=0;Ze<Lt;Ze++)Ge=vt[Ze],le=Ge,Et=Ge.length,Ge=Ge.replace(/^ *([*+-]|\d+[.)]) */,""),~Ge.indexOf(`
`)&&(Et-=Ge.length,Ge=this.options.pedantic?Ge.replace(/^ {1,4}/gm,""):Ge.replace(new RegExp("^ {1,"+Et+"}","gm"),"")),Ze!==Lt-1&&(ft=this.rules.block.bullet.exec(vt[Ze+1])[0],(Le?ft.length===1||!Pe&&ft[ft.length-1]===")":ft.length>1||this.options.smartLists&&ft!==he)&&(it=vt.slice(Ze+1).join(`
`),Xe.raw=Xe.raw.substring(0,Xe.raw.length-it.length),Ze=Lt-1)),Rt=Dt||/\n\n(?!\s*$)/.test(Ge),Ze!==Lt-1&&(Dt=Ge.charAt(Ge.length-1)===`
`,Rt||(Rt=Dt)),Rt&&(Xe.loose=!0),pt=/^\[[ xX]\] /.test(Ge),At=void 0,pt&&(At=Ge[1]!==" ",Ge=Ge.replace(/^\[[ xX]\] +/,"")),Xe.items.push({type:"list_item",raw:le,task:pt,checked:At,loose:Rt,text:Ge});return Xe}},ve.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]}},ve.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 le=ie[1].toLowerCase().replace(/\s+/g," ");return{tag:le,raw:ie[0],href:ie[2],title:ie[3]}}},ve.table=function(re){var ie=this.rules.block.table.exec(re);if(ie){var le={type:"table",header:X(ie[1].replace(/^ *| *\| *$/g,"")),align:ie[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ie[3]?ie[3].replace(/\n$/,"").split(`
`):[]};if(le.header.length===le.align.length){le.raw=ie[0];var he=le.align.length,Le;for(Le=0;Le<he;Le++)/^ *-+: *$/.test(le.align[Le])?le.align[Le]="right":/^ *:-+: *$/.test(le.align[Le])?le.align[Le]="center":/^ *:-+ *$/.test(le.align[Le])?le.align[Le]="left":le.align[Le]=null;for(he=le.cells.length,Le=0;Le<he;Le++)le.cells[Le]=X(le.cells[Le].replace(/^ *\| *| *\| *$/g,""),le.header.length);return le}}},ve.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]}},ve.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]}},ve.text=function(re,ie){var le=this.rules.block.text.exec(re);if(le){var he=ie[ie.length-1];return he&&he.type==="text"?{raw:le[0],text:le[0]}:{type:"text",raw:le[0],text:le[0]}}},ve.escape=function(re){var ie=this.rules.inline.escape.exec(re);if(ie)return{type:"escape",raw:ie[0],text:ee(ie[1])}},ve.tag=function(re,ie,le){var he=this.rules.inline.tag.exec(re);if(he)return!ie&&/^<a /i.test(he[0])?ie=!0:ie&&/^<\/a>/i.test(he[0])&&(ie=!1),!le&&/^<(pre|code|kbd|script)(\s|>)/i.test(he[0])?le=!0:le&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(he[0])&&(le=!1),{type:this.options.sanitize?"text":"html",raw:he[0],inLink:ie,inRawBlock:le,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(he[0]):ee(he[0]):he[0]}},ve.link=function(re){var ie=this.rules.inline.link.exec(re);if(ie){var le=oe(ie[2],"()");if(le>-1){var he=ie[0].indexOf("!")===0?5:4,Le=he+ie[1].length+le;ie[2]=ie[2].substring(0,le),ie[0]=ie[0].substring(0,Le).trim(),ie[3]=""}var Pe=ie[2],Xe="";if(this.options.pedantic){var vt=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Pe);vt?(Pe=vt[1],Xe=vt[3]):Xe=""}else Xe=ie[3]?ie[3].slice(1,-1):"";Pe=Pe.trim().replace(/^<([\s\S]*)>$/,"$1");var Dt=fe(ie,{href:Pe&&Pe.replace(this.rules.inline._escapes,"$1"),title:Xe&&Xe.replace(this.rules.inline._escapes,"$1")},ie[0]);return Dt}},ve.reflink=function(re,ie){var le;if((le=this.rules.inline.reflink.exec(re))||(le=this.rules.inline.nolink.exec(re))){var he=(le[2]||le[1]).replace(/\s+/g," ");if(he=ie[he.toLowerCase()],!he||!he.href){var Le=le[0].charAt(0);return{type:"text",raw:Le,text:Le}}var Pe=fe(le,he,le[0]);return Pe}},ve.strong=function(re,ie,le){le===void 0&&(le="");var he=this.rules.inline.strong.start.exec(re);if(he&&(!he[1]||he[1]&&(le===""||this.rules.inline.punctuation.exec(le)))){ie=ie.slice(-1*re.length);var Le=he[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;Le.lastIndex=0;for(var Pe;(he=Le.exec(ie))!=null;)if(Pe=this.rules.inline.strong.middle.exec(ie.slice(0,he.index+3)),Pe)return{type:"strong",raw:re.slice(0,Pe[0].length),text:re.slice(2,Pe[0].length-2)}}},ve.em=function(re,ie,le){le===void 0&&(le="");var he=this.rules.inline.em.start.exec(re);if(he&&(!he[1]||he[1]&&(le===""||this.rules.inline.punctuation.exec(le)))){ie=ie.slice(-1*re.length);var Le=he[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;Le.lastIndex=0;for(var Pe;(he=Le.exec(ie))!=null;)if(Pe=this.rules.inline.em.middle.exec(ie.slice(0,he.index+2)),Pe)return{type:"em",raw:re.slice(0,Pe[0].length),text:re.slice(1,Pe[0].length-1)}}},ve.codespan=function(re){var ie=this.rules.inline.code.exec(re);if(ie){var le=ie[2].replace(/\n/g," "),he=/[^ ]/.test(le),Le=le.startsWith(" ")&&le.endsWith(" ");return he&&Le&&(le=le.substring(1,le.length-1)),le=ee(le,!0),{type:"codespan",raw:ie[0],text:le}}},ve.br=function(re){var ie=this.rules.inline.br.exec(re);if(ie)return{type:"br",raw:ie[0]}},ve.del=function(re){var ie=this.rules.inline.del.exec(re);if(ie)return{type:"del",raw:ie[0],text:ie[1]}},ve.autolink=function(re,ie){var le=this.rules.inline.autolink.exec(re);if(le){var he,Le;return le[2]==="@"?(he=ee(this.options.mangle?ie(le[1]):le[1]),Le="mailto:"+he):(he=ee(le[1]),Le=he),{type:"link",raw:le[0],text:he,href:Le,tokens:[{type:"text",raw:he,text:he}]}}},ve.url=function(re,ie){var le;if(le=this.rules.inline.url.exec(re)){var he,Le;if(le[2]==="@")he=ee(this.options.mangle?ie(le[0]):le[0]),Le="mailto:"+he;else{var Pe;do Pe=le[0],le[0]=this.rules.inline._backpedal.exec(le[0])[0];while(Pe!==le[0]);he=ee(le[0]),le[1]==="www."?Le="http://"+he:Le=he}return{type:"link",raw:le[0],text:he,href:Le,tokens:[{type:"text",raw:he,text:he}]}}},ve.inlineText=function(re,ie,le){var he=this.rules.inline.text.exec(re);if(he){var Le;return ie?Le=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(he[0]):ee(he[0]):he[0]:Le=ee(this.options.smartypants?le(he[0]):he[0]),{type:"text",raw:he[0],text:Le}}},Se}(),Te=V.noopTest,Ce=V.edit,ge=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:Te,table:Te,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=Ce(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=Ce(pe.item,"gm").replace(/bull/g,pe.bullet).getRegex(),pe.list=Ce(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=Ce(pe.html,"i").replace("comment",pe._comment).replace("tag",pe._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),pe.paragraph=Ce(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=Ce(pe.blockquote).replace("paragraph",pe.paragraph).getRegex(),pe.normal=ge({},pe),pe.gfm=ge({},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=Ce(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=Ce(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=ge({},pe.normal,{html:Ce(`^ *(?: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:Te,paragraph:Ce(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 ue={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Te,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:Te,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};ue._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",ue.punctuation=Ce(ue.punctuation).replace(/punctuation/g,ue._punctuation).getRegex(),ue._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",ue._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",ue.em.start=Ce(ue.em.start).replace(/punctuation/g,ue._punctuation).getRegex(),ue.em.middle=Ce(ue.em.middle).replace(/punctuation/g,ue._punctuation).replace(/overlapSkip/g,ue._overlapSkip).getRegex(),ue.em.endAst=Ce(ue.em.endAst,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.em.endUnd=Ce(ue.em.endUnd,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.strong.start=Ce(ue.strong.start).replace(/punctuation/g,ue._punctuation).getRegex(),ue.strong.middle=Ce(ue.strong.middle).replace(/punctuation/g,ue._punctuation).replace(/blockSkip/g,ue._blockSkip).getRegex(),ue.strong.endAst=Ce(ue.strong.endAst,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.strong.endUnd=Ce(ue.strong.endUnd,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.blockSkip=Ce(ue._blockSkip,"g").getRegex(),ue.overlapSkip=Ce(ue._overlapSkip,"g").getRegex(),ue._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,ue._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,ue._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])?)+(?![-_])/,ue.autolink=Ce(ue.autolink).replace("scheme",ue._scheme).replace("email",ue._email).getRegex(),ue._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,ue.tag=Ce(ue.tag).replace("comment",pe._comment).replace("attribute",ue._attribute).getRegex(),ue._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,ue._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,ue._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,ue.link=Ce(ue.link).replace("label",ue._label).replace("href",ue._href).replace("title",ue._title).getRegex(),ue.reflink=Ce(ue.reflink).replace("label",ue._label).getRegex(),ue.reflinkSearch=Ce(ue.reflinkSearch,"g").replace("reflink",ue.reflink).replace("nolink",ue.nolink).getRegex(),ue.normal=ge({},ue),ue.pedantic=ge({},ue.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:Ce(/^!?\[(label)\]\((.*?)\)/).replace("label",ue._label).getRegex(),reflink:Ce(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ue._label).getRegex()}),ue.gfm=ge({},ue.normal,{escape:Ce(ue.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),ue.gfm.url=Ce(ue.gfm.url,"i").replace("email",ue.gfm._extended_email).getRegex(),ue.breaks=ge({},ue.gfm,{br:Ce(ue.br).replace("{2,}","*").getRegex(),text:Ce(ue.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var te={block:pe,inline:ue},de=j.defaults,ae=te.block,we=te.inline;function Re(Se){return Se.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 Ee(Se){var ve="",be,re,ie=Se.length;for(be=0;be<ie;be++)re=Se.charCodeAt(be),Math.random()>.5&&(re="x"+re.toString(16)),ve+="&#"+re+";";return ve}var Me=function(){function Se(be){this.tokens=[],this.tokens.links=Object.create(null),this.options=be||de,this.options.tokenizer=this.options.tokenizer||new xe,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var re={block:ae.normal,inline:we.normal};this.options.pedantic?(re.block=ae.pedantic,re.inline=we.pedantic):this.options.gfm&&(re.block=ae.gfm,this.options.breaks?re.inline=we.breaks:re.inline=we.gfm),this.tokenizer.rules=re}Se.lex=function(re,ie){var le=new Se(ie);return le.lex(re)};var ve=Se.prototype;return ve.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},ve.blockTokens=function(re,ie,le){ie===void 0&&(ie=[]),le===void 0&&(le=!0),re=re.replace(/^ +$/gm,"");for(var he,Le,Pe,Xe;re;){if(he=this.tokenizer.space(re)){re=re.substring(he.raw.length),he.type&&ie.push(he);continue}if(he=this.tokenizer.code(re,ie)){re=re.substring(he.raw.length),he.type?ie.push(he):(Xe=ie[ie.length-1],Xe.raw+=`
`+he.raw,Xe.text+=`
`+he.text);continue}if(he=this.tokenizer.fences(re)){re=re.substring(he.raw.length),ie.push(he);continue}if(he=this.tokenizer.heading(re)){re=re.substring(he.raw.length),ie.push(he);continue}if(he=this.tokenizer.nptable(re)){re=re.substring(he.raw.length),ie.push(he);continue}if(he=this.tokenizer.hr(re)){re=re.substring(he.raw.length),ie.push(he);continue}if(he=this.tokenizer.blockquote(re)){re=re.substring(he.raw.length),he.tokens=this.blockTokens(he.text,[],le),ie.push(he);continue}if(he=this.tokenizer.list(re)){for(re=re.substring(he.raw.length),Pe=he.items.length,Le=0;Le<Pe;Le++)he.items[Le].tokens=this.blockTokens(he.items[Le].text,[],!1);ie.push(he);continue}if(he=this.tokenizer.html(re)){re=re.substring(he.raw.length),ie.push(he);continue}if(le&&(he=this.tokenizer.def(re))){re=re.substring(he.raw.length),this.tokens.links[he.tag]||(this.tokens.links[he.tag]={href:he.href,title:he.title});continue}if(he=this.tokenizer.table(re)){re=re.substring(he.raw.length),ie.push(he);continue}if(he=this.tokenizer.lheading(re)){re=re.substring(he.raw.length),ie.push(he);continue}if(le&&(he=this.tokenizer.paragraph(re))){re=re.substring(he.raw.length),ie.push(he);continue}if(he=this.tokenizer.text(re,ie)){re=re.substring(he.raw.length),he.type?ie.push(he):(Xe=ie[ie.length-1],Xe.raw+=`
`+he.raw,Xe.text+=`
`+he.text);continue}if(re){var vt="Infinite loop on byte: "+re.charCodeAt(0);if(this.options.silent){console.error(vt);break}else throw new Error(vt)}}return ie},ve.inline=function(re){var ie,le,he,Le,Pe,Xe,vt=re.length;for(ie=0;ie<vt;ie++){Xe=re[ie];switch(Xe.type){case"paragraph":case"text":case"heading":{Xe.tokens=[],this.inlineTokens(Xe.text,Xe.tokens);break}case"table":{for(Xe.tokens={header:[],cells:[]},Le=Xe.header.length,le=0;le<Le;le++)Xe.tokens.header[le]=[],this.inlineTokens(Xe.header[le],Xe.tokens.header[le]);for(Le=Xe.cells.length,le=0;le<Le;le++)for(Pe=Xe.cells[le],Xe.tokens.cells[le]=[],he=0;he<Pe.length;he++)Xe.tokens.cells[le][he]=[],this.inlineTokens(Pe[he],Xe.tokens.cells[le][he]);break}case"blockquote":{this.inline(Xe.tokens);break}case"list":{for(Le=Xe.items.length,le=0;le<Le;le++)this.inline(Xe.items[le].tokens);break}}}return re},ve.inlineTokens=function(re,ie,le,he,Le){ie===void 0&&(ie=[]),le===void 0&&(le=!1),he===void 0&&(he=!1),Le===void 0&&(Le="");var Pe,Xe=re,vt;if(this.tokens.links){var Dt=Object.keys(this.tokens.links);if(Dt.length>0)for(;(vt=this.tokenizer.rules.inline.reflinkSearch.exec(Xe))!=null;)Dt.includes(vt[0].slice(vt[0].lastIndexOf("[")+1,-1))&&(Xe=Xe.slice(0,vt.index)+"["+"a".repeat(vt[0].length-2)+"]"+Xe.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(vt=this.tokenizer.rules.inline.blockSkip.exec(Xe))!=null;)Xe=Xe.slice(0,vt.index)+"["+"a".repeat(vt[0].length-2)+"]"+Xe.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;re;){if(Pe=this.tokenizer.escape(re)){re=re.substring(Pe.raw.length),ie.push(Pe);continue}if(Pe=this.tokenizer.tag(re,le,he)){re=re.substring(Pe.raw.length),le=Pe.inLink,he=Pe.inRawBlock,ie.push(Pe);continue}if(Pe=this.tokenizer.link(re)){re=re.substring(Pe.raw.length),Pe.type==="link"&&(Pe.tokens=this.inlineTokens(Pe.text,[],!0,he)),ie.push(Pe);continue}if(Pe=this.tokenizer.reflink(re,this.tokens.links)){re=re.substring(Pe.raw.length),Pe.type==="link"&&(Pe.tokens=this.inlineTokens(Pe.text,[],!0,he)),ie.push(Pe);continue}if(Pe=this.tokenizer.strong(re,Xe,Le)){re=re.substring(Pe.raw.length),Pe.tokens=this.inlineTokens(Pe.text,[],le,he),ie.push(Pe);continue}if(Pe=this.tokenizer.em(re,Xe,Le)){re=re.substring(Pe.raw.length),Pe.tokens=this.inlineTokens(Pe.text,[],le,he),ie.push(Pe);continue}if(Pe=this.tokenizer.codespan(re)){re=re.substring(Pe.raw.length),ie.push(Pe);continue}if(Pe=this.tokenizer.br(re)){re=re.substring(Pe.raw.length),ie.push(Pe);continue}if(Pe=this.tokenizer.del(re)){re=re.substring(Pe.raw.length),Pe.tokens=this.inlineTokens(Pe.text,[],le,he),ie.push(Pe);continue}if(Pe=this.tokenizer.autolink(re,Ee)){re=re.substring(Pe.raw.length),ie.push(Pe);continue}if(!le&&(Pe=this.tokenizer.url(re,Ee))){re=re.substring(Pe.raw.length),ie.push(Pe);continue}if(Pe=this.tokenizer.inlineText(re,he,Re)){re=re.substring(Pe.raw.length),Le=Pe.raw.slice(-1),ie.push(Pe);continue}if(re){var Ge="Infinite loop on byte: "+re.charCodeAt(0);if(this.options.silent){console.error(Ge);break}else throw new Error(Ge)}}return ie},$(Se,null,[{key:"rules",get:function(){return{block:ae,inline:we}}}]),Se}(),Ie=j.defaults,We=V.cleanUrl,je=V.escape,Be=function(){function Se(be){this.options=be||Ie}var ve=Se.prototype;return ve.code=function(re,ie,le){var he=(ie||"").match(/\S*/)[0];if(this.options.highlight){var Le=this.options.highlight(re,he);Le!=null&&Le!==re&&(le=!0,re=Le)}return he?'<pre><code class="'+this.options.langPrefix+je(he,!0)+'">'+(le?re:je(re,!0))+`</code></pre>
`:"<pre><code>"+(le?re:je(re,!0))+`</code></pre>
`},ve.blockquote=function(re){return`<blockquote>
`+re+`</blockquote>
`},ve.html=function(re){return re},ve.heading=function(re,ie,le,he){return this.options.headerIds?"<h"+ie+' id="'+this.options.headerPrefix+he.slug(le)+'">'+re+"</h"+ie+`>
`:"<h"+ie+">"+re+"</h"+ie+`>
`},ve.hr=function(){return this.options.xhtml?`<hr/>
`:`<hr>
`},ve.list=function(re,ie,le){var he=ie?"ol":"ul",Le=ie&&le!==1?' start="'+le+'"':"";return"<"+he+Le+`>
`+re+"</"+he+`>
`},ve.listitem=function(re){return"<li>"+re+`</li>
`},ve.checkbox=function(re){return"<input "+(re?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},ve.paragraph=function(re){return"<p>"+re+`</p>
`},ve.table=function(re,ie){return ie&&(ie="<tbody>"+ie+"</tbody>"),`<table>
<thead>
`+re+`</thead>
`+ie+`</table>
`},ve.tablerow=function(re){return`<tr>
`+re+`</tr>
`},ve.tablecell=function(re,ie){var le=ie.header?"th":"td",he=ie.align?"<"+le+' align="'+ie.align+'">':"<"+le+">";return he+re+"</"+le+`>
`},ve.strong=function(re){return"<strong>"+re+"</strong>"},ve.em=function(re){return"<em>"+re+"</em>"},ve.codespan=function(re){return"<code>"+re+"</code>"},ve.br=function(){return this.options.xhtml?"<br/>":"<br>"},ve.del=function(re){return"<del>"+re+"</del>"},ve.link=function(re,ie,le){if(re=We(this.options.sanitize,this.options.baseUrl,re),re===null)return le;var he='<a href="'+je(re)+'"';return ie&&(he+=' title="'+ie+'"'),he+=">"+le+"</a>",he},ve.image=function(re,ie,le){if(re=We(this.options.sanitize,this.options.baseUrl,re),re===null)return le;var he='<img src="'+re+'" alt="'+le+'"';return ie&&(he+=' title="'+ie+'"'),he+=this.options.xhtml?"/>":">",he},ve.text=function(re){return re},Se}(),Ue=function(){function Se(){}var ve=Se.prototype;return ve.strong=function(re){return re},ve.em=function(re){return re},ve.codespan=function(re){return re},ve.del=function(re){return re},ve.html=function(re){return re},ve.text=function(re){return re},ve.link=function(re,ie,le){return""+le},ve.image=function(re,ie,le){return""+le},ve.br=function(){return""},Se}(),et=function(){function Se(){this.seen={}}var ve=Se.prototype;return ve.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 le=ie;do this.seen[le]++,ie=le+"-"+this.seen[le];while(this.seen.hasOwnProperty(ie))}return this.seen[ie]=0,ie},Se}(),ot=j.defaults,nt=V.unescape,qe=function(){function Se(be){this.options=be||ot,this.options.renderer=this.options.renderer||new Be,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Ue,this.slugger=new et}Se.parse=function(re,ie){var le=new Se(ie);return le.parse(re)};var ve=Se.prototype;return ve.parse=function(re,ie){ie===void 0&&(ie=!0);var le="",he,Le,Pe,Xe,vt,Dt,Ge,Et,ft,it,Rt,pt,At,Lt,Ze,ir,Zt,yt,Wt=re.length;for(he=0;he<Wt;he++){it=re[he];switch(it.type){case"space":continue;case"hr":{le+=this.renderer.hr();continue}case"heading":{le+=this.renderer.heading(this.parseInline(it.tokens),it.depth,nt(this.parseInline(it.tokens,this.textRenderer)),this.slugger);continue}case"code":{le+=this.renderer.code(it.text,it.lang,it.escaped);continue}case"table":{for(Et="",Ge="",Xe=it.header.length,Le=0;Le<Xe;Le++)Ge+=this.renderer.tablecell(this.parseInline(it.tokens.header[Le]),{header:!0,align:it.align[Le]});for(Et+=this.renderer.tablerow(Ge),ft="",Xe=it.cells.length,Le=0;Le<Xe;Le++){for(Dt=it.tokens.cells[Le],Ge="",vt=Dt.length,Pe=0;Pe<vt;Pe++)Ge+=this.renderer.tablecell(this.parseInline(Dt[Pe]),{header:!1,align:it.align[Pe]});ft+=this.renderer.tablerow(Ge)}le+=this.renderer.table(Et,ft);continue}case"blockquote":{ft=this.parse(it.tokens),le+=this.renderer.blockquote(ft);continue}case"list":{for(Rt=it.ordered,pt=it.start,At=it.loose,Xe=it.items.length,ft="",Le=0;Le<Xe;Le++)Ze=it.items[Le],ir=Ze.checked,Zt=Ze.task,Lt="",Ze.task&&(yt=this.renderer.checkbox(ir),At?Ze.tokens.length>0&&Ze.tokens[0].type==="text"?(Ze.tokens[0].text=yt+" "+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=yt+" "+Ze.tokens[0].tokens[0].text)):Ze.tokens.unshift({type:"text",text:yt}):Lt+=yt),Lt+=this.parse(Ze.tokens,At),ft+=this.renderer.listitem(Lt,Zt,ir);le+=this.renderer.list(ft,Rt,pt);continue}case"html":{le+=this.renderer.html(it.text);continue}case"paragraph":{le+=this.renderer.paragraph(this.parseInline(it.tokens));continue}case"text":{for(ft=it.tokens?this.parseInline(it.tokens):it.text;he+1<Wt&&re[he+1].type==="text";)it=re[++he],ft+=`
`+(it.tokens?this.parseInline(it.tokens):it.text);le+=ie?this.renderer.paragraph(ft):ft;continue}default:{var nr='Token with "'+it.type+'" type was not found.';if(this.options.silent){console.error(nr);return}else throw new Error(nr)}}}return le},ve.parseInline=function(re,ie){ie=ie||this.renderer;var le="",he,Le,Pe=re.length;for(he=0;he<Pe;he++){Le=re[he];switch(Le.type){case"escape":{le+=ie.text(Le.text);break}case"html":{le+=ie.html(Le.text);break}case"link":{le+=ie.link(Le.href,Le.title,this.parseInline(Le.tokens,ie));break}case"image":{le+=ie.image(Le.href,Le.title,Le.text);break}case"strong":{le+=ie.strong(this.parseInline(Le.tokens,ie));break}case"em":{le+=ie.em(this.parseInline(Le.tokens,ie));break}case"codespan":{le+=ie.codespan(Le.text);break}case"br":{le+=ie.br();break}case"del":{le+=ie.del(this.parseInline(Le.tokens,ie));break}case"text":{le+=ie.text(Le.text);break}default:{var Xe='Token with "'+Le.type+'" type was not found.';if(this.options.silent){console.error(Xe);return}else throw new Error(Xe)}}}return le},Se}(),st=V.merge,$e=V.checkSanitizeDeprecation,Qe=V.escape,_e=j.getDefaults,ut=j.changeDefaults,lt=j.defaults;function Ne(Se,ve,be){if(typeof Se=="undefined"||Se===null)throw new Error("marked(): input parameter is undefined or null");if(typeof Se!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(Se)+", string expected");if(typeof ve=="function"&&(be=ve,ve=null),ve=st({},Ne.defaults,ve||{}),$e(ve),be){var re=ve.highlight,ie;try{ie=Me.lex(Se,ve)}catch(Pe){return be(Pe)}var le=function(Xe){var vt;if(!Xe)try{vt=qe.parse(ie,ve)}catch(Dt){Xe=Dt}return ve.highlight=re,Xe?be(Xe):be(null,vt)};if(!re||re.length<3)return le();if(delete ve.highlight,!ie.length)return le();var he=0;Ne.walkTokens(ie,function(Pe){Pe.type==="code"&&(he++,setTimeout(function(){re(Pe.text,Pe.lang,function(Xe,vt){if(Xe)return le(Xe);vt!=null&&vt!==Pe.text&&(Pe.text=vt,Pe.escaped=!0),he--,he===0&&le()})},0))}),he===0&&le();return}try{var Le=Me.lex(Se,ve);return ve.walkTokens&&Ne.walkTokens(Le,ve.walkTokens),qe.parse(Le,ve)}catch(Pe){if(Pe.message+=`
Please report this to https://github.com/markedjs/marked.`,ve.silent)return"<p>An error occurred:</p><pre>"+Qe(Pe.message+"",!0)+"</pre>";throw Pe}}Ne.options=Ne.setOptions=function(Se){return st(Ne.defaults,Se),ut(Ne.defaults),Ne},Ne.getDefaults=_e,Ne.defaults=lt,Ne.use=function(Se){var ve=st({},Se);if(Se.renderer&&function(){var re=Ne.defaults.renderer||new Be,ie=function(Le){var Pe=re[Le];re[Le]=function(){for(var Xe=arguments.length,vt=new Array(Xe),Dt=0;Dt<Xe;Dt++)vt[Dt]=arguments[Dt];var Ge=Se.renderer[Le].apply(re,vt);return Ge===!1&&(Ge=Pe.apply(re,vt)),Ge}};for(var le in Se.renderer)ie(le);ve.renderer=re}(),Se.tokenizer&&function(){var re=Ne.defaults.tokenizer||new xe,ie=function(Le){var Pe=re[Le];re[Le]=function(){for(var Xe=arguments.length,vt=new Array(Xe),Dt=0;Dt<Xe;Dt++)vt[Dt]=arguments[Dt];var Ge=Se.tokenizer[Le].apply(re,vt);return Ge===!1&&(Ge=Pe.apply(re,vt)),Ge}};for(var le in Se.tokenizer)ie(le);ve.tokenizer=re}(),Se.walkTokens){var be=Ne.defaults.walkTokens;ve.walkTokens=function(re){Se.walkTokens(re),be&&be(re)}}Ne.setOptions(ve)},Ne.walkTokens=function(Se,ve){for(var be=U(Se),re;!(re=be()).done;){var ie=re.value;ve(ie);switch(ie.type){case"table":{for(var le=U(ie.tokens.header),he;!(he=le()).done;){var Le=he.value;Ne.walkTokens(Le,ve)}for(var Pe=U(ie.tokens.cells),Xe;!(Xe=Pe()).done;)for(var vt=Xe.value,Dt=U(vt),Ge;!(Ge=Dt()).done;){var Et=Ge.value;Ne.walkTokens(Et,ve)}break}case"list":{Ne.walkTokens(ie.items,ve);break}default:ie.tokens&&Ne.walkTokens(ie.tokens,ve)}}},Ne.Parser=qe,Ne.parser=qe.parse,Ne.Renderer=Be,Ne.TextRenderer=Ue,Ne.Lexer=Me,Ne.lexer=Me.lex,Ne.Tokenizer=xe,Ne.Slugger=et,Ne.parse=Ne;var Ke=Ne;return Ke})},ELLl:function(dt,at,se){(function(ne){ne(se("VrN/"))})(function(ne){var $={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},R=ne.Pos;ne.defineOption("autoCloseBrackets",!1,function(E,p,u){u&&u!=ne.Init&&(E.removeKeyMap(U),E.state.closeBrackets=null),p&&(O(Q(p,"pairs")),E.state.closeBrackets=p,E.addKeyMap(U))});function Q(E,p){return p=="pairs"&&typeof E=="string"?E:typeof E=="object"&&E[p]!=null?E[p]:$[p]}var U={Backspace:_,Enter:A};function O(E){for(var p=0;p<E.length;p++){var u=E.charAt(p),a="'"+u+"'";U[a]||(U[a]=j(u))}}O($.pairs+"`");function j(E){return function(p){return x(p,E)}}function N(E){var p=E.state.closeBrackets;if(!p||p.override)return p;var u=E.getModeAt(E.getCursor());return u.closeBrackets||p}function _(E){var p=N(E);if(!p||E.getOption("disableInput"))return ne.Pass;for(var u=Q(p,"pairs"),a=E.listSelections(),s=0;s<a.length;s++){if(!a[s].empty())return ne.Pass;var h=P(E,a[s].head);if(!h||u.indexOf(h)%2!=0)return ne.Pass}for(var s=a.length-1;s>=0;s--){var k=a[s].head;E.replaceRange("",R(k.line,k.ch-1),R(k.line,k.ch+1),"+delete")}}function A(E){var p=N(E),u=p&&Q(p,"explode");if(!u||E.getOption("disableInput"))return ne.Pass;for(var a=E.listSelections(),s=0;s<a.length;s++){if(!a[s].empty())return ne.Pass;var h=P(E,a[s].head);if(!h||u.indexOf(h)%2!=0)return ne.Pass}E.operation(function(){var k=E.lineSeparator()||`
`;E.replaceSelection(k+k,null),E.execCommand("goCharLeft"),a=E.listSelections();for(var c=0;c<a.length;c++){var b=a[c].head.line;E.indentLine(b,null,!0),E.indentLine(b+1,null,!0)}})}function f(E){var p=ne.cmpPos(E.anchor,E.head)>0;return{anchor:new R(E.anchor.line,E.anchor.ch+(p?-1:1)),head:new R(E.head.line,E.head.ch+(p?1:-1))}}function x(E,p){var u=N(E);if(!u||E.getOption("disableInput"))return ne.Pass;var a=Q(u,"pairs"),s=a.indexOf(p);if(s==-1)return ne.Pass;for(var h=Q(u,"closeBefore"),k=Q(u,"triples"),c=a.charAt(s+1)==p,b=E.listSelections(),D=s%2==0,T,g=0;g<b.length;g++){var v=b[g],d=v.head,o,C=E.getRange(d,R(d.line,d.ch+1));if(D&&!v.empty())o="surround";else if((c||!D)&&C==p)c&&w(E,d)?o="both":k.indexOf(p)>=0&&E.getRange(d,R(d.line,d.ch+3))==p+p+p?o="skipThree":o="skip";else if(c&&d.ch>1&&k.indexOf(p)>=0&&E.getRange(R(d.line,d.ch-2),d)==p+p){if(d.ch>2&&/\bstring/.test(E.getTokenTypeAt(R(d.line,d.ch-2))))return ne.Pass;o="addFour"}else if(c){var S=d.ch==0?" ":E.getRange(R(d.line,d.ch-1),d);if(!ne.isWordChar(C)&&S!=p&&!ne.isWordChar(S))o="both";else return ne.Pass}else if(D&&(C.length===0||/\s/.test(C)||h.indexOf(C)>-1))o="both";else return ne.Pass;if(!T)T=o;else if(T!=o)return ne.Pass}var y=s%2?a.charAt(s-1):p,M=s%2?p:a.charAt(s+1);E.operation(function(){if(T=="skip")E.execCommand("goCharRight");else if(T=="skipThree")for(var F=0;F<3;F++)E.execCommand("goCharRight");else if(T=="surround"){for(var W=E.getSelections(),F=0;F<W.length;F++)W[F]=y+W[F]+M;E.replaceSelections(W,"around"),W=E.listSelections().slice();for(var F=0;F<W.length;F++)W[F]=f(W[F]);E.setSelections(W)}else T=="both"?(E.replaceSelection(y+M,null),E.triggerElectric(y+M),E.execCommand("goCharLeft")):T=="addFour"&&(E.replaceSelection(y+y+y+y,"before"),E.execCommand("goCharRight"))})}function P(E,p){var u=E.getRange(R(p.line,p.ch-1),R(p.line,p.ch+1));return u.length==2?u:null}function w(E,p){var u=E.getTokenAt(R(p.line,p.ch+1));return/\bstring/.test(u.type)&&u.start==p.ch&&(p.ch==0||!/\bstring/.test(E.getTokenTypeAt(p)))}})},GfqC:function(dt,at,se){"use strict";var ne=se("q1tI"),$=se.n(ne),R=se("TSYQ"),Q=se.n(R);function U(V,I){var B="cannot "+V.method+" "+V.action+" "+I.status+"'",X=new Error(B);return X.status=I.status,X.method=V.method,X.url=V.action,X}function O(V){var I=V.responseText||V.response;if(!I)return I;try{return JSON.parse(I)}catch(B){return I}}function j(V){var I=new XMLHttpRequest;V.onProgress&&I.upload&&(I.upload.onprogress=function(oe){oe.total>0&&(oe.percent=oe.loaded/oe.total*100),V.onProgress(oe)});var B=new FormData;V.data&&Object.keys(V.data).forEach(function(ee){var oe=V.data[ee];if(Array.isArray(oe)){oe.forEach(function(fe){B.append(ee+"[]",fe)});return}B.append(ee,V.data[ee])}),V.file instanceof Blob?B.append(V.filename,V.file,V.file.name):B.append(V.filename,V.file),I.onerror=function(oe){V.onError(oe)},I.onload=function(){return I.status<200||I.status>=300?V.onError(U(V,I),O(I)):V.onSuccess(O(I),I)},I.open(V.method,V.action,!0),V.withCredentials&&"withCredentials"in I&&(I.withCredentials=!0);var X=V.headers||{};return X["X-Requested-With"]!==null&&I.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(X).forEach(function(ee){X[ee]!==null&&I.setRequestHeader(ee,X[ee])}),I.send(B),{abort:function(){I.abort()}}}var N=+new Date,_=0;function A(){return"rc-upload-"+N+"-"+ ++_}function f(V,I){return V.indexOf(I,V.length-I.length)!==-1}var x=function(V,I){if(V&&I){var B=Array.isArray(I)?I:I.split(","),X=V.name||"",ee=V.type||"",oe=ee.replace(/\/.*$/,"");return B.some(function(fe){var ke=fe.trim();return ke.charAt(0)==="."?f(X.toLowerCase(),ke.toLowerCase()):/\/\*$/.test(ke)?oe===ke.replace(/\/.*$/,""):ee===ke})}return!0};function P(V,I){var B=V.createReader(),X=[];function ee(){B.readEntries(function(oe){var fe=Array.prototype.slice.apply(oe);X=X.concat(fe);var ke=!fe.length;ke?I(X):ee()})}ee()}var w=function(I,B,X){var ee=function oe(fe,ke){ke=ke||"",fe.isFile?fe.file(function(xe){X(xe)&&(fe.fullPath&&!xe.webkitRelativePath&&(Object.defineProperties(xe,{webkitRelativePath:{writable:!0}}),xe.webkitRelativePath=fe.fullPath.replace(/^\//,""),Object.defineProperties(xe,{webkitRelativePath:{writable:!1}})),B([xe]))}):fe.isDirectory&&P(fe,function(xe){xe.forEach(function(Te){oe(Te,""+ke+fe.name+"/")})})};I.forEach(function(oe){ee(oe.webkitGetAsEntry())})},E=w,p=Object.assign||function(V){for(var I=1;I<arguments.length;I++){var B=arguments[I];for(var X in B)Object.prototype.hasOwnProperty.call(B,X)&&(V[X]=B[X])}return V},u=function(){function V(I,B){var X=[],ee=!0,oe=!1,fe=void 0;try{for(var ke=I[Symbol.iterator](),xe;!(ee=(xe=ke.next()).done)&&!(X.push(xe.value),B&&X.length===B);ee=!0);}catch(Te){oe=!0,fe=Te}finally{try{!ee&&ke.return&&ke.return()}finally{if(oe)throw fe}}return X}return function(I,B){if(Array.isArray(I))return I;if(Symbol.iterator in Object(I))return V(I,B);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),a=function(){function V(I,B){for(var X=0;X<B.length;X++){var ee=B[X];ee.enumerable=ee.enumerable||!1,ee.configurable=!0,"value"in ee&&(ee.writable=!0),Object.defineProperty(I,ee.key,ee)}}return function(I,B,X){return B&&V(I.prototype,B),X&&V(I,X),I}}();function s(V,I,B){return I in V?Object.defineProperty(V,I,{value:B,enumerable:!0,configurable:!0,writable:!0}):V[I]=B,V}function h(V,I){var B={};for(var X in V){if(I.indexOf(X)>=0)continue;if(!Object.prototype.hasOwnProperty.call(V,X))continue;B[X]=V[X]}return B}function k(V,I){if(!(V instanceof I))throw new TypeError("Cannot call a class as a function")}function c(V,I){if(!V)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return I&&(typeof I=="object"||typeof I=="function")?I:V}function b(V,I){if(typeof I!="function"&&I!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof I);V.prototype=Object.create(I&&I.prototype,{constructor:{value:V,enumerable:!1,writable:!0,configurable:!0}}),I&&(Object.setPrototypeOf?Object.setPrototypeOf(V,I):V.__proto__=I)}var D=function(I){return Object.keys(I).reduce(function(B,X){return(X.substr(0,5)==="data-"||X.substr(0,5)==="aria-"||X==="role")&&(B[X]=I[X]),B},{})},T=function(V){b(I,V);function I(){var B,X,ee,oe;k(this,I);for(var fe=arguments.length,ke=Array(fe),xe=0;xe<fe;xe++)ke[xe]=arguments[xe];return oe=(X=(ee=c(this,(B=I.__proto__||Object.getPrototypeOf(I)).call.apply(B,[this].concat(ke))),ee),ee.state={uid:A()},ee.reqs={},ee.onChange=function(Te){var Ce=Te.target.files;ee.uploadFiles(Ce),ee.reset()},ee.onClick=function(Te){var Ce=ee.fileInput;if(!Ce)return;var ge=ee.props,pe=ge.children,ue=ge.onClick;pe&&pe.type==="button"&&(Ce.parentNode.focus(),Ce.parentNode.querySelector("button").blur()),Ce.click(),ue&&ue(Te)},ee.onKeyDown=function(Te){Te.key==="Enter"&&ee.onClick()},ee.onFileDrop=function(Te){var Ce=ee.props.multiple;if(Te.preventDefault(),Te.type==="dragover")return;if(ee.props.directory)E(Array.prototype.slice.call(Te.dataTransfer.items),ee.uploadFiles,function(pe){return x(pe,ee.props.accept)});else{var ge=Array.prototype.slice.call(Te.dataTransfer.files).filter(function(pe){return x(pe,ee.props.accept)});Ce===!1&&(ge=ge.slice(0,1)),ee.uploadFiles(ge)}},ee.uploadFiles=function(Te){var Ce=Array.prototype.slice.call(Te);Ce.map(function(ge){return ge.uid=A(),ge}).forEach(function(ge){ee.upload(ge,Ce)})},ee.saveFileInput=function(Te){ee.fileInput=Te},X),c(ee,oe)}return a(I,[{key:"componentDidMount",value:function(){this._isMounted=!0}},{key:"componentWillUnmount",value:function(){this._isMounted=!1,this.abort()}},{key:"upload",value:function(X,ee){var oe=this,fe=this.props;if(!fe.beforeUpload)return setTimeout(function(){return oe.post(X)},0);var ke=fe.beforeUpload(X,ee);ke&&ke.then?ke.then(function(xe){var Te=Object.prototype.toString.call(xe);return Te==="[object File]"||Te==="[object Blob]"?oe.post(xe):oe.post(X)}).catch(function(xe){console.log(xe)}):ke!==!1&&setTimeout(function(){return oe.post(X)},0);return}},{key:"post",value:function(X){var ee=this;if(!this._isMounted)return;var oe=this.props,fe=oe.onStart,ke=oe.onProgress,xe=oe.transformFile,Te=xe===void 0?function(Ce){return Ce}:xe;new Promise(function(Ce){var ge=oe.action;return typeof ge=="function"&&(ge=ge(X)),Ce(ge)}).then(function(Ce){var ge=X.uid,pe=oe.customRequest||j,ue=Promise.resolve(Te(X)).then(function(te){var de=oe.data;return typeof de=="function"&&(de=de(te)),Promise.all([te,de])}).catch(function(te){console.error(te)});ue.then(function(te){var de=u(te,2),ae=de[0],we=de[1],Re={action:Ce,filename:oe.name,data:we,file:ae,headers:oe.headers,withCredentials:oe.withCredentials,method:oe.method||"post",onProgress:ke?function(Ee){ke(Ee,X)}:null,onSuccess:function(Me,Ie){delete ee.reqs[ge],oe.onSuccess(Me,X,Ie)},onError:function(Me,Ie){delete ee.reqs[ge],oe.onError(Me,Ie,X)}};fe(X),ee.reqs[ge]=pe(Re)})})}},{key:"reset",value:function(){this.setState({uid:A()})}},{key:"abort",value:function(X){var ee=this.reqs;if(X){var oe=X;X&&X.uid&&(oe=X.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 X,ee=this.props,oe=ee.component,fe=ee.prefixCls,ke=ee.className,xe=ee.disabled,Te=ee.id,Ce=ee.style,ge=ee.multiple,pe=ee.accept,ue=ee.children,te=ee.directory,de=ee.openFileDialogOnClick,ae=ee.onMouseEnter,we=ee.onMouseLeave,Re=h(ee,["component","prefixCls","className","disabled","id","style","multiple","accept","children","directory","openFileDialogOnClick","onMouseEnter","onMouseLeave"]),Ee=Q()((X={},s(X,fe,!0),s(X,fe+"-disabled",xe),s(X,ke,ke),X)),Me=xe?{}:{onClick:de?this.onClick:function(){},onKeyDown:de?this.onKeyDown:function(){},onMouseEnter:ae,onMouseLeave:we,onDrop:this.onFileDrop,onDragOver:this.onFileDrop,tabIndex:"0"};return $.a.createElement(oe,p({},Me,{className:Ee,role:"button",style:Ce}),$.a.createElement("input",p({},D(Re),{id:Te,type:"file",ref:this.saveFileInput,onClick:function(We){return We.stopPropagation()},key:this.state.uid,style:{display:"none"},accept:pe,directory:te?"directory":null,webkitdirectory:te?"webkitdirectory":null,multiple:ge,onChange:this.onChange})),ue)}}]),I}(ne.Component),g=T,v=Object.assign||function(V){for(var I=1;I<arguments.length;I++){var B=arguments[I];for(var X in B)Object.prototype.hasOwnProperty.call(B,X)&&(V[X]=B[X])}return V},d=function(){function V(I,B){for(var X=0;X<B.length;X++){var ee=B[X];ee.enumerable=ee.enumerable||!1,ee.configurable=!0,"value"in ee&&(ee.writable=!0),Object.defineProperty(I,ee.key,ee)}}return function(I,B,X){return B&&V(I.prototype,B),X&&V(I,X),I}}();function o(V,I){if(!(V instanceof I))throw new TypeError("Cannot call a class as a function")}function C(V,I){if(!V)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return I&&(typeof I=="object"||typeof I=="function")?I:V}function S(V,I){if(typeof I!="function"&&I!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof I);V.prototype=Object.create(I&&I.prototype,{constructor:{value:V,enumerable:!1,writable:!0,configurable:!0}}),I&&(Object.setPrototypeOf?Object.setPrototypeOf(V,I):V.__proto__=I)}function y(){}var M=function(V){S(I,V);function I(){var B,X,ee,oe;o(this,I);for(var fe=arguments.length,ke=Array(fe),xe=0;xe<fe;xe++)ke[xe]=arguments[xe];return oe=(X=(ee=C(this,(B=I.__proto__||Object.getPrototypeOf(I)).call.apply(B,[this].concat(ke))),ee),ee.saveUploader=function(Te){ee.uploader=Te},X),C(ee,oe)}return d(I,[{key:"abort",value:function(X){this.uploader.abort(X)}},{key:"render",value:function(){return $.a.createElement(g,v({},this.props,{ref:this.saveUploader}))}}]),I}(ne.Component);M.defaultProps={component:"span",prefixCls:"rc-upload",data:{},headers:{},name:"file",multipart:!1,onStart:y,onError:y,onSuccess:y,multiple:!1,beforeUpload:null,customRequest:null,withCredentials:!1,openFileDialogOnClick:!0};var F=M,W=at.a=F},H38U:function(dt,at,se){var ne=se("f4xo"),$=se("rcnY"),R=se("wU8J"),Q=se("Iq15"),U=se("dWSS");function O(N,_){this.typeNumber=N,this.errorCorrectLevel=_,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}var j=O.prototype;j.addData=function(N){var _=new ne(N);this.dataList.push(_),this.dataCache=null},j.isDark=function(N,_){if(N<0||this.moduleCount<=N||_<0||this.moduleCount<=_)throw new Error(N+","+_);return this.modules[N][_]},j.getModuleCount=function(){return this.moduleCount},j.make=function(){if(this.typeNumber<1){var N=1;for(N=1;N<40;N++){for(var _=$.getRSBlocks(N,this.errorCorrectLevel),A=new R,f=0,x=0;x<_.length;x++)f+=_[x].dataCount;for(var x=0;x<this.dataList.length;x++){var P=this.dataList[x];A.put(P.mode,4),A.put(P.getLength(),Q.getLengthInBits(P.mode,N)),P.write(A)}if(A.getLengthInBits()<=f*8)break}this.typeNumber=N}this.makeImpl(!1,this.getBestMaskPattern())},j.makeImpl=function(N,_){this.moduleCount=this.typeNumber*4+17,this.modules=new Array(this.moduleCount);for(var A=0;A<this.moduleCount;A++){this.modules[A]=new Array(this.moduleCount);for(var f=0;f<this.moduleCount;f++)this.modules[A][f]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(N,_),this.typeNumber>=7&&this.setupTypeNumber(N),this.dataCache==null&&(this.dataCache=O.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,_)},j.setupPositionProbePattern=function(N,_){for(var A=-1;A<=7;A++){if(N+A<=-1||this.moduleCount<=N+A)continue;for(var f=-1;f<=7;f++){if(_+f<=-1||this.moduleCount<=_+f)continue;0<=A&&A<=6&&(f==0||f==6)||0<=f&&f<=6&&(A==0||A==6)||2<=A&&A<=4&&2<=f&&f<=4?this.modules[N+A][_+f]=!0:this.modules[N+A][_+f]=!1}}},j.getBestMaskPattern=function(){for(var N=0,_=0,A=0;A<8;A++){this.makeImpl(!0,A);var f=Q.getLostPoint(this);(A==0||N>f)&&(N=f,_=A)}return _},j.createMovieClip=function(N,_,A){var f=N.createEmptyMovieClip(_,A),x=1;this.make();for(var P=0;P<this.modules.length;P++)for(var w=P*x,E=0;E<this.modules[P].length;E++){var p=E*x,u=this.modules[P][E];u&&(f.beginFill(0,100),f.moveTo(p,w),f.lineTo(p+x,w),f.lineTo(p+x,w+x),f.lineTo(p,w+x),f.endFill())}return f},j.setupTimingPattern=function(){for(var N=8;N<this.moduleCount-8;N++){if(this.modules[N][6]!=null)continue;this.modules[N][6]=N%2==0}for(var _=8;_<this.moduleCount-8;_++){if(this.modules[6][_]!=null)continue;this.modules[6][_]=_%2==0}},j.setupPositionAdjustPattern=function(){for(var N=Q.getPatternPosition(this.typeNumber),_=0;_<N.length;_++)for(var A=0;A<N.length;A++){var f=N[_],x=N[A];if(this.modules[f][x]!=null)continue;for(var P=-2;P<=2;P++)for(var w=-2;w<=2;w++)P==-2||P==2||w==-2||w==2||P==0&&w==0?this.modules[f+P][x+w]=!0:this.modules[f+P][x+w]=!1}},j.setupTypeNumber=function(N){for(var _=Q.getBCHTypeNumber(this.typeNumber),A=0;A<18;A++){var f=!N&&(_>>A&1)==1;this.modules[Math.floor(A/3)][A%3+this.moduleCount-8-3]=f}for(var A=0;A<18;A++){var f=!N&&(_>>A&1)==1;this.modules[A%3+this.moduleCount-8-3][Math.floor(A/3)]=f}},j.setupTypeInfo=function(N,_){for(var A=this.errorCorrectLevel<<3|_,f=Q.getBCHTypeInfo(A),x=0;x<15;x++){var P=!N&&(f>>x&1)==1;x<6?this.modules[x][8]=P:x<8?this.modules[x+1][8]=P:this.modules[this.moduleCount-15+x][8]=P}for(var x=0;x<15;x++){var P=!N&&(f>>x&1)==1;x<8?this.modules[8][this.moduleCount-x-1]=P:x<9?this.modules[8][15-x-1+1]=P:this.modules[8][15-x-1]=P}this.modules[this.moduleCount-8][8]=!N},j.mapData=function(N,_){for(var A=-1,f=this.moduleCount-1,x=7,P=0,w=this.moduleCount-1;w>0;w-=2)for(w==6&&w--;;){for(var E=0;E<2;E++)if(this.modules[f][w-E]==null){var p=!1;P<N.length&&(p=(N[P]>>>x&1)==1);var u=Q.getMask(_,f,w-E);u&&(p=!p),this.modules[f][w-E]=p,x--,x==-1&&(P++,x=7)}if(f+=A,f<0||this.moduleCount<=f){f-=A,A=-A;break}}},O.PAD0=236,O.PAD1=17,O.createData=function(N,_,A){for(var f=$.getRSBlocks(N,_),x=new R,P=0;P<A.length;P++){var w=A[P];x.put(w.mode,4),x.put(w.getLength(),Q.getLengthInBits(w.mode,N)),w.write(x)}for(var E=0,P=0;P<f.length;P++)E+=f[P].dataCount;if(x.getLengthInBits()>E*8)throw new Error("code length overflow. ("+x.getLengthInBits()+">"+E*8+")");for(x.getLengthInBits()+4<=E*8&&x.put(0,4);x.getLengthInBits()%8!=0;)x.putBit(!1);for(;!(x.getLengthInBits()>=E*8);){if(x.put(O.PAD0,8),x.getLengthInBits()>=E*8)break;x.put(O.PAD1,8)}return O.createBytes(x,f)},O.createBytes=function(N,_){for(var A=0,f=0,x=0,P=new Array(_.length),w=new Array(_.length),E=0;E<_.length;E++){var p=_[E].dataCount,u=_[E].totalCount-p;f=Math.max(f,p),x=Math.max(x,u),P[E]=new Array(p);for(var a=0;a<P[E].length;a++)P[E][a]=255&N.buffer[a+A];A+=p;var s=Q.getErrorCorrectPolynomial(u),h=new U(P[E],s.getLength()-1),k=h.mod(s);w[E]=new Array(s.getLength()-1);for(var a=0;a<w[E].length;a++){var c=a+k.getLength()-w[E].length;w[E][a]=c>=0?k.get(c):0}}for(var b=0,a=0;a<_.length;a++)b+=_[a].totalCount;for(var D=new Array(b),T=0,a=0;a<f;a++)for(var E=0;E<_.length;E++)a<P[E].length&&(D[T++]=P[E][a]);for(var a=0;a<x;a++)for(var E=0;E<_.length;E++)a<w[E].length&&(D[T++]=w[E][a]);return D},dt.exports=O},HmJG:function(dt,at,se){},Iq15:function(dt,at,se){var ne=se("nVVt"),$=se("dWSS"),R=se("dQei"),Q={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},U={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1<<10|1<<8|1<<5|1<<4|1<<2|1<<1|1<<0,G18:1<<12|1<<11|1<<10|1<<9|1<<8|1<<5|1<<2|1<<0,G15_MASK:1<<14|1<<12|1<<10|1<<4|1<<1,getBCHTypeInfo:function(O){for(var j=O<<10;U.getBCHDigit(j)-U.getBCHDigit(U.G15)>=0;)j^=U.G15<<U.getBCHDigit(j)-U.getBCHDigit(U.G15);return(O<<10|j)^U.G15_MASK},getBCHTypeNumber:function(O){for(var j=O<<12;U.getBCHDigit(j)-U.getBCHDigit(U.G18)>=0;)j^=U.G18<<U.getBCHDigit(j)-U.getBCHDigit(U.G18);return O<<12|j},getBCHDigit:function(O){for(var j=0;O!=0;)j++,O>>>=1;return j},getPatternPosition:function(O){return U.PATTERN_POSITION_TABLE[O-1]},getMask:function(O,j,N){switch(O){case Q.PATTERN000:return(j+N)%2==0;case Q.PATTERN001:return j%2==0;case Q.PATTERN010:return N%3==0;case Q.PATTERN011:return(j+N)%3==0;case Q.PATTERN100:return(Math.floor(j/2)+Math.floor(N/3))%2==0;case Q.PATTERN101:return j*N%2+j*N%3==0;case Q.PATTERN110:return(j*N%2+j*N%3)%2==0;case Q.PATTERN111:return(j*N%3+(j+N)%2)%2==0;default:throw new Error("bad maskPattern:"+O)}},getErrorCorrectPolynomial:function(O){for(var j=new $([1],0),N=0;N<O;N++)j=j.multiply(new $([1,R.gexp(N)],0));return j},getLengthInBits:function(O,j){if(1<=j&&j<10)switch(O){case ne.MODE_NUMBER:return 10;case ne.MODE_ALPHA_NUM:return 9;case ne.MODE_8BIT_BYTE:return 8;case ne.MODE_KANJI:return 8;default:throw new Error("mode:"+O)}else if(j<27)switch(O){case ne.MODE_NUMBER:return 12;case ne.MODE_ALPHA_NUM:return 11;case ne.MODE_8BIT_BYTE:return 16;case ne.MODE_KANJI:return 10;default:throw new Error("mode:"+O)}else if(j<41)switch(O){case ne.MODE_NUMBER:return 14;case ne.MODE_ALPHA_NUM:return 13;case ne.MODE_8BIT_BYTE:return 16;case ne.MODE_KANJI:return 12;default:throw new Error("mode:"+O)}else throw new Error("type:"+j)},getLostPoint:function(O){for(var j=O.getModuleCount(),N=0,_=0;_<j;_++)for(var A=0;A<j;A++){for(var f=0,x=O.isDark(_,A),P=-1;P<=1;P++){if(_+P<0||j<=_+P)continue;for(var w=-1;w<=1;w++){if(A+w<0||j<=A+w)continue;if(P==0&&w==0)continue;x==O.isDark(_+P,A+w)&&f++}}f>5&&(N+=3+f-5)}for(var _=0;_<j-1;_++)for(var A=0;A<j-1;A++){var E=0;O.isDark(_,A)&&E++,O.isDark(_+1,A)&&E++,O.isDark(_,A+1)&&E++,O.isDark(_+1,A+1)&&E++,(E==0||E==4)&&(N+=3)}for(var _=0;_<j;_++)for(var A=0;A<j-6;A++)O.isDark(_,A)&&!O.isDark(_,A+1)&&O.isDark(_,A+2)&&O.isDark(_,A+3)&&O.isDark(_,A+4)&&!O.isDark(_,A+5)&&O.isDark(_,A+6)&&(N+=40);for(var A=0;A<j;A++)for(var _=0;_<j-6;_++)O.isDark(_,A)&&!O.isDark(_+1,A)&&O.isDark(_+2,A)&&O.isDark(_+3,A)&&O.isDark(_+4,A)&&!O.isDark(_+5,A)&&O.isDark(_+6,A)&&(N+=40);for(var p=0,A=0;A<j;A++)for(var _=0;_<j;_++)O.isDark(_,A)&&p++;var u=Math.abs(100*p/j/j-50)/5;return N+=u*10,N}};dt.exports=U},LdHM:function(dt,at,se){"use strict";se.d(at,"b",function(){return h}),se.d(at,"a",function(){return c});var ne=se("1OyB"),$=se("vuIU"),R=se("Ji7U"),Q=se("LK+K"),U=se("q1tI"),O=se("rePB"),j=se("Ff2n"),N=se("ODXe"),_=se("4IlW"),A=se("bX4T"),f=se("YrtM"),x=se("TSYQ"),P=se.n(x),w=se("+nKL"),E=se("8OUc"),p=function(X,ee){var oe=X.prefixCls,fe=X.id,ke=X.flattenOptions,xe=X.childrenAsData,Te=X.values,Ce=X.searchValue,ge=X.multiple,pe=X.defaultActiveFirstOption,ue=X.height,te=X.itemHeight,de=X.notFoundContent,ae=X.open,we=X.menuItemSelectedIcon,Re=X.virtual,Ee=X.onSelect,Me=X.onToggleOpen,Ie=X.onActiveValue,We=X.onScroll,je=X.onMouseEnter,Be="".concat(oe,"-item"),Ue=Object(f.a)(function(){return ke},[ae,ke],function(Ke,Se){return Se[0]&&Ke[1]!==Se[1]}),et=U.useRef(null),ot=function(Se){Se.preventDefault()},nt=function(Se){et.current&&et.current.scrollTo({index:Se})},qe=function(Se){for(var ve=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,be=Ue.length,re=0;re<be;re+=1){var ie=(Se+re*ve+be)%be,le=Ue[ie],he=le.group,Le=le.data;if(!he&&!Le.disabled)return ie}return-1},st=U.useState(function(){return qe(0)}),$e=Object(N.a)(st,2),Qe=$e[0],_e=$e[1],ut=function(Se){_e(Se);var ve=Ue[Se];if(!ve){Ie(null,-1);return}Ie(ve.data.value,Se)};U.useEffect(function(){ut(pe!==!1?qe(0):-1)},[Ue.length,Ce]),U.useEffect(function(){var Ke=setTimeout(function(){if(!ge&&ae&&Te.size===1){var Se=Array.from(Te)[0],ve=Ue.findIndex(function(be){var re=be.data;return re.value===Se});ut(ve),nt(ve)}});return function(){return clearTimeout(Ke)}},[ae]);var lt=function(Se){Se!==void 0&&Ee(Se,{selected:!Te.has(Se)}),ge||Me(!1)};if(U.useImperativeHandle(ee,function(){return{onKeyDown:function(Se){var ve=Se.which;switch(ve){case _.a.UP:case _.a.DOWN:{var be=0;if(ve===_.a.UP?be=-1:ve===_.a.DOWN&&(be=1),be!==0){var re=qe(Qe+be,be);nt(re),ut(re)}break}case _.a.ENTER:{var ie=Ue[Qe];ie&&!ie.data.disabled?lt(ie.data.value):lt(void 0),ae&&Se.preventDefault();break}case _.a.ESC:Me(!1)}},onKeyUp:function(){},scrollTo:function(Se){nt(Se)}}}),Ue.length===0)return U.createElement("div",{role:"listbox",id:"".concat(fe,"_list"),className:"".concat(Be,"-empty"),onMouseDown:ot},de);function Ne(Ke){var Se=Ue[Ke];if(!Se)return null;var ve=Se.data||{},be=ve.value,re=ve.label,ie=ve.children,le=Object(A.a)(ve,!0),he=xe?ie:re;return Se?U.createElement("div",Object.assign({"aria-label":typeof he=="string"?he:null},le,{key:Ke,role:"option",id:"".concat(fe,"_list_").concat(Ke),"aria-selected":Te.has(be)}),be):null}return U.createElement(U.Fragment,null,U.createElement("div",{role:"listbox",id:"".concat(fe,"_list"),style:{height:0,width:0,overflow:"hidden"}},Ne(Qe-1),Ne(Qe),Ne(Qe+1)),U.createElement(w.a,{itemKey:"key",ref:et,data:Ue,height:ue,itemHeight:te,fullHeight:!1,onMouseDown:ot,onScroll:We,virtual:Re,onMouseEnter:je},function(Ke,Se){var ve,be=Ke.group,re=Ke.groupOption,ie=Ke.data,le=ie.label,he=ie.key;if(be)return U.createElement("div",{className:P()(Be,"".concat(Be,"-group"))},le!==void 0?le:he);var Le=ie.disabled,Pe=ie.value,Xe=ie.title,vt=ie.children,Dt=ie.style,Ge=ie.className,Et=Object(j.a)(ie,["disabled","value","title","children","style","className"]),ft=Te.has(Pe),it="".concat(Be,"-option"),Rt=P()(Be,it,Ge,(ve={},Object(O.a)(ve,"".concat(it,"-grouped"),re),Object(O.a)(ve,"".concat(it,"-active"),Qe===Se&&!Le),Object(O.a)(ve,"".concat(it,"-disabled"),Le),Object(O.a)(ve,"".concat(it,"-selected"),ft),ve)),pt=xe?vt:le,At=!we||typeof we=="function"||ft;return U.createElement("div",Object.assign({},Et,{"aria-selected":ft,className:Rt,title:Xe,onMouseMove:function(){if(Qe===Se||Le)return;ut(Se)},onClick:function(){Le||lt(Pe)},style:Dt}),U.createElement("div",{className:"".concat(it,"-content")},pt||Pe),U.isValidElement(we)||ft,At&&U.createElement(E.a,{className:"".concat(Be,"-option-state"),customizeIcon:we,customizeIconProps:{isSelected:ft}},ft?"\u2713":null))}))},u=U.forwardRef(p);u.displayName="OptionList";var a=u,s=function(){return null};s.isSelectOption=!0;var h=s,k=function(){return null};k.isSelectOptGroup=!0;var c=k,b=se("VTBJ"),D=se("Zm9Q");function T(B){var X=B.key,ee=B.props,oe=ee.children,fe=ee.value,ke=Object(j.a)(ee,["children","value"]);return Object(b.a)({key:X,value:fe!==void 0?fe:X,children:oe},ke)}function g(B){var X=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(D.a)(B).map(function(ee,oe){if(!U.isValidElement(ee)||!ee.type)return null;var fe=ee.type.isSelectOptGroup,ke=ee.key,xe=ee.props,Te=xe.children,Ce=Object(j.a)(xe,["children"]);return X||!fe?T(ee):Object(b.a)(Object(b.a)({key:"__RC_SELECT_GRP__".concat(ke===null?oe:ke,"__"),label:ke},Ce),{},{options:g(Te)})}).filter(function(ee){return ee})}var v=se("2Qr1"),d=se("qNPg"),o=se("U8pU"),C=se("Kwbf"),S=se("WKfj");function y(B){var X=B.mode,ee=B.options,oe=B.children,fe=B.backfill,ke=B.allowClear,xe=B.placeholder,Te=B.getInputElement,Ce=B.showSearch,ge=B.onSearch,pe=B.defaultOpen,ue=B.autoFocus,te=B.labelInValue,de=B.value,ae=B.inputValue,we=B.optionLabelProp,Re=X==="multiple"||X==="tags",Ee=Ce!==void 0?Ce:Re||X==="combobox",Me=ee||g(oe);if(Object(C.a)(X!=="tags"||Me.every(function(Be){return!Be.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),X==="tags"||X==="combobox"){var Ie=Me.some(function(Be){return Be.options?Be.options.some(function(Ue){return typeof("value"in Ue?Ue.value:Ue.key)=="number"}):typeof("value"in Be?Be.value:Be.key)=="number"});Object(C.a)(!Ie,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(C.a)(X!=="combobox"||!we,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(C.a)(X==="combobox"||!fe,"`backfill` only works with `combobox` mode."),Object(C.a)(X==="combobox"||!Te,"`getInputElement` only work with `combobox` mode."),Object(C.b)(X!=="combobox"||!Te||!ke||!xe,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),ge&&!Ee&&X!=="combobox"&&X!=="tags"&&Object(C.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(C.b)(!pe||ue,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),de!=null){var We=Object(S.d)(de);Object(C.a)(!te||We.every(function(Be){return Object(o.a)(Be)==="object"&&("key"in Be||"value"in Be)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(C.a)(!Re||Array.isArray(de),"`value` should be array when `mode` is `multiple` or `tags`")}if(oe){var je=null;Object(D.a)(oe).some(function(Be){if(!U.isValidElement(Be)||!Be.type)return!1;var Ue=Be.type;if(Ue.isSelectOption)return!1;if(Ue.isSelectOptGroup){var et=Object(D.a)(Be.props.children).every(function(ot){return!U.isValidElement(ot)||!Be.type||ot.type.isSelectOption?!0:(je=ot.type,!1)});return!et}return je=Ue,!0}),je&&Object(C.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(je.displayName||je.name||je,"`.")),Object(C.a)(ae===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var M=y,F=Object(d.a)({prefixCls:"rc-select",components:{optionList:a},convertChildrenToData:g,flattenOptions:v.d,getLabeledValue:v.e,filterOptions:v.b,isValueDisabled:v.g,findValueOption:v.c,warningProps:M,fillOptionsWithMissingValue:v.a}),W=function(B){Object(R.a)(ee,B);var X=Object(Q.a)(ee);function ee(){var oe;return Object(ne.a)(this,ee),oe=X.apply(this,arguments),oe.selectRef=U.createRef(),oe.focus=function(){oe.selectRef.current.focus()},oe.blur=function(){oe.selectRef.current.blur()},oe}return Object($.a)(ee,[{key:"render",value:function(){return U.createElement(F,Object.assign({ref:this.selectRef},this.props))}}]),ee}(U.Component);W.Option=h,W.OptGroup=c;var V=W,I=at.c=V},M8RZ:function(dt,at,se){"use strict";se.d(at,"a",function(){return _});var ne=se("fWQN"),$=se("mtLc"),R=se("yKVA"),Q=se("879j"),U=se("q1tI"),O=se.n(U),j=se("i8i4"),N=se.n(j),_=function(A){Object(R.a)(x,A);var f=Object(Q.a)(x);function x(P){var w;Object(ne.a)(this,x),w=f.call(this,P);var E=window.document;return w.node=E.createElement("div"),E.body.appendChild(w.node),w}return Object($.a)(x,[{key:"render",value:function(){var w=this.props.children;return Object(j.createPortal)(w,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),x}(O.a.Component)},Ot1p:function(dt,at,se){"use strict";var ne=se("2qtc"),$=se("kLXV"),R=se("rAM+"),Q=se("miYZ"),U=se("tsqr"),O=se("9og8"),j=se("tJVT"),N=se("jrin"),_=se("WmNS"),A=se.n(_),f=se("q1tI"),x=se.n(f),P=se("VrN/"),w=se.n(P),E=se("bdgK"),p=se("p77/"),u=se("Bd2K"),a=se("ELLl"),s=se("19Vz"),h=se("lZu9"),k=se("+NIl"),c=se("kSUc"),b=se("9Bee"),D=function(Ge){var Et=Ge.value,ft=Et===void 0?"":Et,it=Ge.className,Rt=Ge.showTextOnly,pt=Ge.showLines,At=Ge.style,Lt=At===void 0?{}:At,Ze=Object(f.useMemo)(function(){return""},[ft]);return x.a.createElement(x.a.Fragment,null,x.a.createElement("div",{dangerouslySetInnerHTML:{__html:Ze}}))},T=se("Q9mQ"),g=se("diRs"),v=se("0Owb"),d=se("dejd"),o=se("C+DQ"),C=se("D1Df"),S=se.n(C),y=se("1vsH"),M=se("m3rI"),F=[{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 W(Ge){var Et=Ge.onActionCallback,ft=Ge.title,it=Ge.icon,Rt=Ge.actionName,pt=Ge.className,At=pt===void 0?"":pt,Lt=Ge.children;function Ze(){Et(Rt)}return x.a.createElement("a",{title:ft,className:At,onClick:Ze},x.a.createElement("i",{className:"md-iconfont ".concat(it)}),Lt)}var V=function(Ge){var Et=Ge.watch,ft=Ge.showNullButton,it=Ge.onActionCallback,Rt=Ge.fullScreen,pt=Ge.insertTemp,At=Ge.hidetoolBar,Lt=Ge.uuid,Ze=Ge.setOpenPhones,ir=Object(y.E)("_educoder_session_login"),Zt=Object(y.E)("_educoder_session"),yt=[].concat(F,[{title:"".concat(Et?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(Et?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return x.a.createElement("ul",{className:"markdown-toolbar-container"},!At&&yt.map(function(Wt,nr){return x.a.createElement("li",{key:nr},Wt.actionName?x.a.createElement(W,Object(v.a)({},Wt,{onActionCallback:it})):x.a.createElement("span",{className:"v-line"}))}),ft?x.a.createElement("li",null,x.a.createElement(W,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:it},x.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,pt&&x.a.createElement("li",null,x.a.createElement(W,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(pt),onActionCallback:it},x.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),x.a.createElement("li",null,x.a.createElement(g.a,{title:"\u6253\u5F00\u624B\u673A\u626B\u4E00\u626B",content:x.a.createElement("div",null,x.a.createElement("span",{style:{display:"none"}},"test----",location.origin+"/upload.html?_educoder_session_login="+ir+"&_educoder_session="+Zt+"&key="+Lt+"&api="+encodeURIComponent(M.a.API_SERVER)),x.a.createElement(S.a,{size:150,fgColor:"#000",value:location.origin+"/upload.html?_educoder_session_login="+ir+"&_educoder_session="+Zt+"&key="+Lt+"&api="+encodeURIComponent(M.a.API_SERVER)}))},x.a.createElement("span",{className:"fill-tip",onMouseOver:function(){return Ze(!0)}},"\u624B\u673A\u4E0A\u4F20\u6587\u4EF6"))),x.a.createElement("li",{className:"btn-full-screen"},x.a.createElement(W,{icon:"".concat(Rt?"icon-shrink":"icon-enlarge"),title:Rt?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:it})))},I=se("M8RZ"),B=se("+L6B"),X=se("2/Rp"),ee=se("y8nQ"),oe=se("Vl3Y"),fe=se("5NDa"),ke=se("5rEg"),xe={labelCol:{span:4},wrapperCol:{span:20}},Te=function(Ge){var Et=Ge.callback,ft=Ge.onCancel;function it(Rt){Et(Rt)}return x.a.createElement(oe.a,Object(v.a)({},xe,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:it}),x.a.createElement(oe.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},x.a.createElement(ke.a,null)),x.a.createElement(oe.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},x.a.createElement(ke.a,null)),x.a.createElement("div",{className:"flex-container flex-end"},x.a.createElement(X.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),x.a.createElement(X.a,{type:"ghost",onClick:ft},"\u53D6\u6D88")))},Ce=se("7ahc"),ge=se("k1fw"),pe=se("HmJG"),ue=se("BjJ7"),te=oe.a.useForm,de={width:280,marginRight:10},ae={labelCol:{span:5},wrapperCol:{span:19}},we=function(Ge){var Et=Ge.callback,ft=Ge.onCancel,it=te(),Rt=Object(j.a)(it,1),pt=Rt[0],At=Object(f.useRef)();function Lt(Zt){Et(Object(ge.a)(Object(ge.a)({},Zt),{},{name:At.current}))}function Ze(Zt,yt){pt.setFieldsValue({src:"/api/attachments/".concat(Zt.id,"?type=").concat(Zt.content_type),type:yt.type})}function ir(Zt){var yt=Zt.target.files[0];At.current=yt.name,Ee(yt,Ze)}return x.a.createElement(oe.a,Object(v.a)({form:pt},ae,{className:"upload-image-panel",onFinish:Lt}),x.a.createElement(oe.a.Item,{label:"\u6587\u4EF6\u5730\u5740",required:!0},x.a.createElement("div",{className:"flex-container"},x.a.createElement(oe.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u6587\u4EF6\u5730\u5740"}]},x.a.createElement(ke.a,{style:de})),x.a.createElement(Re,{onFileChange:ir}))),x.a.createElement(oe.a.Item,{label:"\u6587\u4EF6\u63CF\u8FF0",name:"alt"},x.a.createElement(ke.a,{style:{width:264}})),x.a.createElement(oe.a.Item,{style:{textAlign:"right"}},x.a.createElement(X.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),x.a.createElement(X.a,{type:"ghost",onClick:ft},"\u53D6\u6D88")))};function Re(Ge){var Et=Ge.onFileChange;return x.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",x.a.createElement("input",{type:"file",onChange:Et}))}function Ee(Ge,Et){if(!Ge)throw new String("\u6CA1\u6709\u6587\u4EF6");var ft=new FormData;ft.append("editormd-image-file",Ge),ft.append("file_param_name","editormd-image-file"),ft.append("byxhr","true");var it=new window.XMLHttpRequest;it.withCredentials=!0,it.addEventListener("load",function(Rt){Et(JSON.parse(Rt.target.responseText),Ge)},!1),it.addEventListener("error",function(Rt){console.error(Rt)},!1),it.open("POST","".concat(ue.a,"/api/attachments.json")),it.send(ft)}var Me=se("giR+"),Ie=se("fyUT"),We=se("7Kak"),je=se("9yH6"),Be=je.a.Group,Ue={margin:"0 8px"},et=function(Ge){var Et=Ge.callback,ft=Ge.onCancel;function it(Rt){Et(Rt)}return x.a.createElement(oe.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:it},x.a.createElement("div",{className:"flex-container"},x.a.createElement("span",{style:Ue},"\u5355\u5143\u683C\u6570\uFF1A"),x.a.createElement("span",{style:Ue},"\u884C\u6570"),x.a.createElement(oe.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},x.a.createElement(Ie.a,null)),x.a.createElement("span",{style:Ue},"\u5217\u6570"),x.a.createElement(oe.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},x.a.createElement(Ie.a,null))),x.a.createElement("div",{className:"flex-container",style:{marginTop:12}},x.a.createElement("span",{style:Ue},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),x.a.createElement(oe.a.Item,{name:"align"},x.a.createElement(Be,null,x.a.createElement(je.a,{value:"default"},x.a.createElement("i",{className:"fa fa-align-justify"})),x.a.createElement(je.a,{value:"left"},x.a.createElement("i",{className:"fa fa-align-left"})),x.a.createElement(je.a,{value:"center"},x.a.createElement("i",{className:"fa fa-align-center"})),x.a.createElement(je.a,{value:"right"},x.a.createElement("i",{className:"fa fa-align-right"}))))),x.a.createElement("div",{className:"flex-container flex-end"},x.a.createElement(X.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),x.a.createElement(X.a,{type:"ghost",onClick:ft},"\u53D6\u6D88")))},ot=se("ErOA"),nt=se("7Cbv"),qe="link",st="upload-image",$e="code-block",Qe="add-table",_e="------------",ut={default:_e,left:":".concat(_e),center:":".concat(_e,":"),right:"".concat(_e,":")},lt=se("9VGf"),Ne,Ke;function Se(){}var ve=0,be=1e4,re="\u2581",ie=`
**\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 le(Ge){return/^\d+$/.test(Ge)?"".concat(Ge,"px"):Ge}var he=navigator.platform.toUpperCase().indexOf("MAC")>=0,Le=he?"Cmd":"Ctrl",Pe=["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"],Xe=(Ne={},Object(N.a)(Ne,Le+"-B","bold"),Object(N.a)(Ne,Le+"-I","italic"),Ne),vt=(Ke={},Object(N.a)(Ke,qe,"\u6DFB\u52A0\u94FE\u63A5"),Object(N.a)(Ke,$e,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(N.a)(Ke,st,"\u6DFB\u52A0\u6587\u4EF6"),Object(N.a)(Ke,Qe,"\u6DFB\u52A0\u8868\u683C"),Ke),Dt=at.a=function(Ge){var Et=Ge.defaultValue,ft=Et===void 0?"":Et,it=Ge.onChange,Rt=Ge.width,pt=Rt===void 0?"100%":Rt,At=Ge.height,Lt=At===void 0?400:At,Ze=Ge.miniToolbar,ir=Ze===void 0?!1:Ze,Zt=Ge.isFocus,yt=Zt===void 0?!1:Zt,Wt=Ge.watch,nr=Ge.insertTemp,ar=Ge.mode,Cr=ar===void 0?"markdown":ar,Ar=Ge.id,Vr=Ar===void 0?"markdown-editor-id":Ar,Bt=Ge.showResizeBar,gt=Bt===void 0?!1:Bt,jr=Ge.noStorage,li=jr===void 0?!1:jr,Lr=Ge.showNullButton,Pt=Lr===void 0?!1:Lr,Xr=Ge.hidetoolBar,ui=Xr===void 0?!1:Xr,gi=Ge.fullScreen,Ye=gi===void 0?!1:gi,Tt=Ge.onBlur,ti=Ge.onCMBeforeChange,hi=Ge.onFullScreen,di=Ge.className,Ri=di===void 0?"":di,K=Ge.disablePaste,l=K===void 0?!1:K,m=Ge.placeholder,G=m===void 0?"":m,J=Ge.values,z=J===void 0?"":J,ye=Object(f.useState)(null),He=Object(j.a)(ye,2),Oe=He[0],mt=He[1],ze=Object(f.useState)(ft),wt=Object(j.a)(ze,2),Nt=wt[0],Gt=wt[1],Wr=Object(f.useState)(Wt),Hr=Object(j.a)(Wr,2),dr=Hr[0],Yr=Hr[1],Ki=Object(f.useState)(Ye),kr=Object(j.a)(Ki,2),Dr=kr[0],ri=kr[1],vi=Object(f.useState)(""),Qr=Object(j.a)(vi,2),ii=Qr[0],Gr=Qr[1],fn=Object(f.useState)(0),Vi=Object(j.a)(fn,2),Ir=Vi[0],Nr=Vi[1],Oi=Object(f.useState)(Lt),_i=Object(j.a)(Oi,2),Mi=_i[0],tr=_i[1],Ft=Object(f.useState)(!1),vr=Object(j.a)(Ft,2),jt=vr[0],yr=vr[1],Yt=Object(f.useRef)(Object(nt.a)()),yi=Object(f.useRef)(!1),lr=Object(f.useRef)(),ur=Object(f.useRef)(),ni=Object(f.useRef)(),bi=Object(f.useRef)(),xi=Object(f.useRef)(),Fn=function(){var bt=Object(O.a)(A.a.mark(function kt(){var St,_t;return A.a.wrap(function(zt){for(;;)switch(zt.prev=zt.next){case 0:return zt.next=2,Object(ot.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:Yt.current}});case 2:_t=zt.sent,_t!=null&&(St=_t.attachments)!==null&&St!==void 0&&St.length&&(console.log("cm:",Oe,ur),_t.attachments.map(function(It){It.content_type.indexOf("image")>-1?Oe.replaceSelection("![,](/api/attachments/".concat(It.id,"?type=").concat(It.content_type,")")):It.content_type.indexOf("video")>-1?Oe.replaceSelection('<video width="100%" controls src="'.concat(M.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):It.content_type.indexOf("pdf")>-1?Oe.replaceSelection('<a href="'.concat(M.a.API_SERVER,"/api/attachments/").concat(It.id,"?type=").concat(It.content_type,'&disposition=inline" target="_blank">').concat(It.name,"</a>")):Oe.replaceSelection("[".concat(It.name,"](").concat(M.a.API_SERVER,"/api/attachments/").concat(It.id,"?type=").concat(It.content_type,")"))}));case 4:case"end":return zt.stop()}},kt)}));return function(){return bt.apply(this,arguments)}}();Object(f.useEffect)(function(){Gt(z),Oe==null||Oe.setValue(z)},[z]),Object(f.useEffect)(function(){hi==null||hi(Dr)},[Dr]),Object(f.useEffect)(function(){if(ur.current){var bt=w.a.fromTextArea(ur.current,{mode:Cr,lineNumbers:!ir,lineWrapping:!0,value:ft,autoCloseTags:!0,autoCloseBrackets:!0});yt&&bt.focus();function kt(St,_t){if(l){_t.preventDefault();return}var Ut=_t.clipboardData;if(Ut){var zt=Ut.types.toString(),It=Ut.items;if(zt==="Files"||Ut.types.indexOf("Files")>-1){if(_t.preventDefault(),Cr=="stex")return;try{var Jt,cr=It[1];((Jt=It[0])===null||Jt===void 0?void 0:Jt.kind)==="file"&&(cr=It[0]);var Mt=cr.getAsFile(),Pi=Mt.name.split(".").pop();Ee(Mt,function(Kt){if(Kt.id){var br,Xt,$r;(Mt==null||((br=Mt.type)===null||br===void 0)?void 0:br.indexOf("image"))>-1?bt.replaceSelection("![,](/api/attachments/".concat(Kt.id,"?type=").concat(Kt.content_type,")")):(Mt==null||((Xt=Mt.type)===null||Xt===void 0)?void 0:Xt.indexOf("video"))>-1?bt.replaceSelection('<video width="100%" controls src="'.concat(M.a.API_SERVER,"/api/attachments/").concat(Kt.id,'"></video>')):(Mt==null||(($r=Mt.type)===null||$r===void 0)?void 0:$r.indexOf("pdf"))>-1?bt.replaceSelection('<a href="'.concat(M.a.API_SERVER,"/api/attachments/").concat(Kt.id,"?type=").concat(Mt.type,'&disposition=inline" target="_blank">').concat(Mt.name,"</a>")):Pe.includes(Pi)?bt.replaceSelection('<a href="'.concat(M.a.API_SERVER,"/api/attachments/").concat(Kt.id,'?type=office&disposition=inline" target="_blank">').concat(Mt.name,"</a>")):bt.replaceSelection("[".concat(Mt.name,"](").concat(M.a.API_SERVER,"/api/attachments/").concat(Kt.id,"?type=").concat(Kt.content_type,")"))}else(Kt==null?void 0:Kt.status)===401&&(document.location.href="/user/login")})}catch(Kt){U.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return bt.on("paste",kt),bt.on("dragleave",function(St,_t){ni.current.classList.remove("mouse-hover-md")}),bt.on("dragover",function(St,_t){ni.current.classList.add("mouse-hover-md")}),bt.on("drop",function(St,_t){ni.current.classList.add("mouse-hover-md");var Ut;if(Ut=_t.dataTransfer.files,Ut.length>0){_t.preventDefault(),_t.stopPropagation();for(var zt=function(cr){var Mt=Ut[cr],Pi=Mt.name.split(".").pop();Ee(Mt,function(Kt){if(Kt.id){var br,Xt,$r;(Mt==null||((br=Mt.type)===null||br===void 0)?void 0:br.indexOf("image"))>-1?bt.replaceSelection("![,](/api/attachments/".concat(Kt.id,"?type=").concat(Kt.content_type,")")):(Mt==null||((Xt=Mt.type)===null||Xt===void 0)?void 0:Xt.indexOf("video"))>-1?bt.replaceSelection('<video width="100%" controls src="'.concat(M.a.API_SERVER,"/api/attachments/").concat(Kt.id,'"></video>')):(Mt==null||(($r=Mt.type)===null||$r===void 0)?void 0:$r.indexOf("pdf"))>-1?bt.replaceSelection('<a href="'.concat(M.a.API_SERVER,"/api/attachments/").concat(Kt.id,"?type=").concat(Mt.type,'&disposition=inline" target="_blank">').concat(Mt.name,"</a>")):Pe.includes(Pi)?bt.replaceSelection('<a href="'.concat(M.a.API_SERVER,"/api/attachments/").concat(Kt.id,'?type=office&disposition=inline" target="_blank">').concat(Mt.name,"</a>")):bt.replaceSelection("[".concat(Mt.name,"](").concat(M.a.API_SERVER,"/api/attachments/").concat(Kt.id,"?type=").concat(Kt.content_type,")"))}else(Kt==null?void 0:Kt.status)===401&&(document.location.href="/user/login")})},It=0;It<Ut.length;It++)zt(It)}}),mt(bt),function(){bt.off("paste",kt)}}},[]);var Zr=Object(f.useCallback)(function(){if(ni.current)try{}catch(bt){console.log(bt,"---- to set md editor body height")}},[Mi,ni,Dr]);Object(f.useEffect)(function(){function bt(){var St=new E.default(function(_t){var Ut=Object(R.a)(_t),zt;try{for(Ut.s();!(zt=Ut.n()).done;){var It=zt.value;(It.target.offsetHeight>0||It.target.offsetWidth>0)&&(Zr(),Oe.setSize("100%","100%"),Oe.refresh())}}catch(Jt){Ut.e(Jt)}finally{Ut.f()}});return St.observe(ur.current.parentElement),St}if(Oe){var kt=bt();return function(){kt.unobserve(ur.current.parentElement)}}},[Oe,Zr]),Object(f.useEffect)(function(){if(Oe){for(var bt=[],kt=function(){var It=_t[St];Ut=Object(j.a)(It,2);var Jt=Ut[0],cr=Ut[1],Mt=Object(N.a)({},Jt,function(){Xi(cr)});bt.push(Mt),Oe.addKeyMap(Mt)},St=0,_t=Object.entries(Xe);St<_t.length;St++){var Ut;kt()}return lr.current=setInterval(function(){yi.current&&Fn()},4e3),function(){clearInterval(lr.current);var zt=Object(R.a)(bt),It;try{for(zt.s();!(It=zt.n()).done;){var Jt=It.value;Oe.removeKeyMap(Jt)}}catch(cr){zt.e(cr)}finally{zt.f()}}}},[Oe]),Object(f.useEffect)(function(){Ye!==Dr&&ri(Ye)},[Ye]),Object(lt.a)(function(){if(!li&&Ir>0){var bt=new Date().getTime(),kt=window.sessionStorage.getItem(Vr);bt>=Ir+be&&(!kt||kt!==Nt)&&(window.sessionStorage.setItem(Vr,Nt),yr(!0))}},be),Object(f.useEffect)(function(){Yr(Wt)},[Oe,Wt]),Object(f.useEffect)(function(){Oe&&(yt&&Oe.focus())},[Oe,yt]),Object(f.useEffect)(function(){if(dr&&Oe){var bt=Oe.getScrollerElement();function kt(St){var _t=St.target;if(xi.current){var Ut=_t.scrollTop/_t.scrollHeight;xi.current.scrollTop=xi.current.scrollHeight*Ut}}return bt.addEventListener("scroll",kt),function(){bt.removeEventListener("scroll",kt)}}},[Oe,dr]),Object(f.useEffect)(function(){if(Oe&&ti){function bt(kt,St){ti(kt,St)}return Oe.on("beforeChange",bt),function(){Oe.off("beforeChange",bt)}}},[Oe,ti]),Object(f.useEffect)(function(){if(Oe&&Tt){function bt(){Tt(Oe.getValue())}return Oe.on("blur",bt),function(){Oe.off("blur",bt)}}},[Oe,Tt]),Object(f.useEffect)(function(){if(Oe){function bt(kt){var St=kt.getValue();Gt(St),Nr(new Date().getTime()),kt.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),it&&it(St)}return Oe.on("change",bt),function(){Oe.off("change",bt)}}},[Oe,it]),Object(f.useEffect)(function(){Oe&&(ft==null?(Oe.setValue(""),Gt("")):ft!==Oe.getValue()&&(Oe.setValue(ft),Gt(ft),Oe.setCursor(Oe.lineCount(),0)))},[Oe,ft]);var Xi=Object(f.useCallback)(function(bt){var kt=Oe.getCursor(),St=Oe.getSelection(),_t=St.split(`
`);switch(bt){case"bold":return Oe.replaceSelection("**"+St+"**"),St===""&&Oe.setCursor(kt.line,kt.ch+2),Oe.focus();case"italic":return Oe.replaceSelection("*"+St+"*"),St===""&&Oe.setCursor(kt.line,kt.ch+1),Oe.focus();case"code":return Oe.replaceSelection("`"+St+"`"),St===""&&Oe.setCursor(kt.line,kt.ch+1),Oe.focus();case"inline-latex":return Oe.replaceSelection("`$$"+St+"$$`"),St===""&&Oe.setCursor(kt.line,kt.ch+3),Oe.focus();case"latex":return Oe.replaceSelection("```latex\n"+St+"\n```"),Oe.setCursor(kt.line+1,St.length+1),Oe.focus();case"line-break":return Oe.replaceSelection(`<br/>
`),Oe.focus();case"list-ul":return St===""?Oe.replaceSelection("- "+St):Oe.replaceSelection(_t.map(function(Ut){return Ut===""?"":"- ".concat(Ut)}).join(`
`)),Oe.focus();case"list-ol":return St===""?Oe.replaceSelection("1. "+St):Oe.replaceSelection(_t.map(function(Ut,zt){return Ut===""?"":"".concat(zt+1,". ").concat(Ut)}).join(`
`)),Oe.focus();case"add-null-ch":return St===""&&Oe.setCursor(kt.line,kt.ch+1),Oe.replaceSelection(re),Oe.focus();case"inster-template-1":return St===""&&Oe.setCursor(kt.line,kt.ch),Oe.replaceSelection(ie),Oe.focus();case"eraser":return Oe.setValue(""),Oe.focus();case"trigger-watch":return Yr(!dr),Oe.focus();case"trigger-full-screen":return ri(!Dr),Oe.focus();case qe:Gr(qe);return;case $e:Gr($e);return;case st:Gr(st);return;case Qe:Gr(Qe);return;default:throw new Error}},[Oe,dr,Dr]),Br=Object(f.useCallback)(function(bt){Gr("");switch(ii){case qe:var kt=bt.title,St=bt.link;return Oe.replaceSelection("[".concat(kt,"](").concat(St,")")),Oe.focus();case $e:var _t=bt.language,Ut=bt.content;return Oe.replaceSelection(["```"+_t,Ut,"```"].join(`
`)),Oe.focus();case st:var zt=bt.src,It=bt.alt,Jt=bt.name;return zt.indexOf("type=image")>-1?Oe.replaceSelection("![ ".concat(It||""," ]( ").concat(zt,' "').concat(It||"",'" )')):zt.indexOf("type=application/pdf")>-1?Oe.replaceSelection('<a href="'.concat(zt,'&disposition=inline" target="_blank">').concat(Jt,"</a>")):Oe.replaceSelection('<a href="'.concat(zt,'" target="_blank">').concat(Jt,"</a>")),Oe.focus();case Qe:for(var cr=bt.row,Mt=bt.col,Pi=bt.align,Kt=`
`,br=0;br<cr;br++){for(var Xt=[],$r=[],pn=0;pn<Mt;pn++)br===1&&$r.push(ut[Pi]),Xt.push(" ");br===1&&(Kt+="| ".concat($r.join(" | "),` |
`)),Kt+="| ".concat(Xt.join(Mt===1?"":" | "),` |
`)}return Oe.replaceSelection(Kt+`
`),Oe.focus();default:throw new Error}},[Oe,ii]),Yi=Object(f.useMemo)(function(){switch(ii){case qe:return x.a.createElement(Te,{callback:Br,onCancel:ci});case $e:return x.a.createElement(Ce.b,{callback:Br,onCancel:ci});case st:return x.a.createElement(we,{callback:Br,onCancel:ci});case Qe:return x.a.createElement(et,{callback:Br,onCancel:ci});default:return null}},[ii]);function ci(){Gr("")}Object(f.useEffect)(function(){if(bi.current){var bt=bi.current,kt=!1,St=0;function _t(It){kt=!0,St=It.pageY}function Ut(){kt=!1}function zt(It){if(kt){var Jt=It.pageY-St;Jt<0&&(Jt=0),Jt>300&&(Jt=300);var cr=Lt+Jt+"px";tr(cr)}}return bt.addEventListener("mousedown",_t),document.addEventListener("mousemove",zt),document.addEventListener("mouseup",Ut),function(){bt.removeEventListener("mousedown",_t),document.removeEventListener("mousemove",zt),document.removeEventListener("mouseup",Ut)}}},[Oe,bi]),Object(f.useEffect)(function(){tr(Lt)},[Lt]);var Ei=le(pt),ua=le(Mi),ha={width:Ei,height:ua},Qa=Object(f.useMemo)(function(){if(Ir){var bt=new Date(Ir),kt=bt.getHours(),St=bt.getMinutes(),_t=bt.getSeconds();return kt=kt<10?"0"+kt:kt,St=St<10?"0"+St:St,_t=_t<10?"0"+_t:_t,"".concat(kt,":").concat(St,":").concat(_t)}return 0},[Ir]);function Za(){window.sessionStorage.removeItem(Vr),yr(!1),Nr(0)}function da(){yr(!1),Nr(0),Oe.setValue(window.sessionStorage.getItem(Vr))}function jn(bt,kt){var St=Oe.getValue();St=St.replace(bt,kt),Gt(St),Oe==null||Oe.setValue(St)}return x.a.createElement(f.Fragment,null,x.a.createElement("div",{className:"markdown-editor-wrapper",ref:ni},x.a.createElement("div",{className:"markdown-editor-container ".concat(Ri," ").concat(dr?"on-preview":""," ").concat(ir?"mini":""," ").concat(Dr?"full-screen":""),style:ha},x.a.createElement(V,{insertTemp:nr,watch:dr,fullScreen:Dr,showNullButton:Pt,onActionCallback:Xi,hidetoolBar:ui,uuid:Yt.current,setOpenPhones:function(){yi.current=!0}}),x.a.createElement("div",{className:"markdown-editor-body"},x.a.createElement("div",{className:"codemirror-container"},x.a.createElement("textarea",{ref:ur,placeholder:G})),dr?x.a.createElement("div",{ref:xi,className:"preview-container"},Cr==="stex"&&x.a.createElement(D,{value:Nt}),Cr!=="stex"&&x.a.createElement(b.a,{edit:!0,value:Nt,replaces:jn})):null))),gt?x.a.createElement("a",{ref:bi,className:"editor-resize"}):null,x.a.createElement(I.a,null,vt[ii]?x.a.createElement($.a,{centered:!0,title:vt[ii],visible:!0,onCancel:ci,footer:null},Yi):null))}},SJMd:function(dt,at){/**
* @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 se,ne,$,R=!1,Q,U;window.PR_SHOULD_USE_CONTINUATION=!0;var O,j;(function(){var N=window,_=["break,continue,do,else,for,if,return,while"],A=[_,"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"],f=[A,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],x=[f,"alignas,alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,noexcept,noreturn,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],P=[f,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],w=[f,"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"],E="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",p=[f,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],u="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",a=[_,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],s=[_,"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"],h=[_,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],k=[x,w,P,p,u,a,s,h],c=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,b="str",D="kwd",T="com",g="typ",v="lit",d="pun",o="pln",C="tag",S="dec",y="src",M="atn",F="atv",W="nocode",V="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function I(Ee){for(var Me=0,Ie=!1,We=!1,je=0,Be=Ee.length;je<Be;++je){var Ue=Ee[je];if(Ue.ignoreCase)We=!0;else if(/[a-z]/i.test(Ue.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){Ie=!0,We=!1;break}}var et={b:8,t:9,n:10,v:11,f:12,r:13};function ot(Qe){var _e=Qe.charCodeAt(0);if(_e!==92)return _e;var ut=Qe.charAt(1);return _e=et[ut],_e||("0"<=ut&&ut<="7"?parseInt(Qe.substring(1),8):ut==="u"||ut==="x"?parseInt(Qe.substring(2),16):Qe.charCodeAt(1))}function nt(Qe){if(Qe<32)return(Qe<16?"\\x0":"\\x")+Qe.toString(16);var _e=String.fromCharCode(Qe);return _e==="\\"||_e==="-"||_e==="]"||_e==="^"?"\\"+_e:_e}function qe(Qe){var _e=Qe.substring(1,Qe.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")),ut=[],lt=_e[0]==="^",Ne=["["];lt&&Ne.push("^");for(var Ke=lt?1:0,Se=_e.length;Ke<Se;++Ke){var ve=_e[Ke];if(/\\[bdsw]/i.test(ve))Ne.push(ve);else{var be=ot(ve),re;Ke+2<Se&&_e[Ke+1]==="-"?(re=ot(_e[Ke+2]),Ke+=2):re=be,ut.push([be,re]),re<65||be>122||(re<65||be>90||ut.push([Math.max(65,be)|32,Math.min(re,90)|32]),re<97||be>122||ut.push([Math.max(97,be)&~32,Math.min(re,122)&~32]))}}ut.sort(function(Le,Pe){return Le[0]-Pe[0]||Pe[1]-Le[1]});for(var ie=[],le=[],Ke=0;Ke<ut.length;++Ke){var he=ut[Ke];he[0]<=le[1]+1?le[1]=Math.max(le[1],he[1]):ie.push(le=he)}for(var Ke=0;Ke<ie.length;++Ke){var he=ie[Ke];Ne.push(nt(he[0])),he[1]>he[0]&&(he[1]+1>he[0]&&Ne.push("-"),Ne.push(nt(he[1])))}return Ne.push("]"),Ne.join("")}function st(Qe){for(var _e=Qe.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")),ut=_e.length,lt=[],Ne=0,Ke=0;Ne<ut;++Ne){var Se=_e[Ne];if(Se==="(")++Ke;else if(Se.charAt(0)==="\\"){var ve=+Se.substring(1);ve&&(ve<=Ke?lt[ve]=-1:_e[Ne]=nt(ve))}}for(var Ne=1;Ne<lt.length;++Ne)lt[Ne]===-1&&(lt[Ne]=++Me);for(var Ne=0,Ke=0;Ne<ut;++Ne){var Se=_e[Ne];if(Se==="(")++Ke,lt[Ke]||(_e[Ne]="(?:");else if(Se.charAt(0)==="\\"){var ve=+Se.substring(1);ve&&ve<=Ke&&(_e[Ne]="\\"+lt[ve])}}for(var Ne=0;Ne<ut;++Ne)_e[Ne]==="^"&&_e[Ne+1]!=="^"&&(_e[Ne]="");if(Qe.ignoreCase&&Ie)for(var Ne=0;Ne<ut;++Ne){var Se=_e[Ne],be=Se.charAt(0);Se.length>=2&&be==="["?_e[Ne]=qe(Se):be!=="\\"&&(_e[Ne]=Se.replace(/[a-zA-Z]/g,function(le){var he=le.charCodeAt(0);return"["+String.fromCharCode(he&~32,he|32)+"]"}))}return _e.join("")}for(var $e=[],je=0,Be=Ee.length;je<Be;++je){var Ue=Ee[je];if(Ue.global||Ue.multiline)throw new Error(""+Ue);$e.push("(?:"+st(Ue)+")")}return new RegExp($e.join("|"),We?"gi":"g")}function B(Ee,Me){var Ie=/(?:^|\s)nocode(?:\s|$)/,We=[],je=0,Be=[],Ue=0;function et(ot){var nt=ot.nodeType;if(nt==1){if(Ie.test(ot.className))return;for(var qe=ot.firstChild;qe;qe=qe.nextSibling)et(qe);var st=ot.nodeName.toLowerCase();(st==="br"||st==="li")&&(We[Ue]=`
`,Be[Ue<<1]=je++,Be[Ue++<<1|1]=ot)}else if(nt==3||nt==4){var $e=ot.nodeValue;$e.length&&(Me?$e=$e.replace(/\r\n?/g,`
`):$e=$e.replace(/[ \t\r\n]+/g," "),We[Ue]=$e,Be[Ue<<1]=je,je+=$e.length,Be[Ue++<<1|1]=ot)}}return et(Ee),{sourceCode:We.join("").replace(/\n$/,""),spans:Be}}function X(Ee,Me,Ie,We,je){if(!Ie)return;var Be={sourceNode:Ee,pre:1,langExtension:null,numberLines:null,sourceCode:Ie,spans:null,basePos:Me,decorations:null};We(Be),je.push.apply(je,Be.decorations)}var ee=/\S/;function oe(Ee){for(var Me=void 0,Ie=Ee.firstChild;Ie;Ie=Ie.nextSibling){var We=Ie.nodeType;Me=We===1?Me?Ee:Ie:We===3&&ee.test(Ie.nodeValue)?Ee:Me}return Me===Ee?void 0:Me}function fe(Ee,Me){var Ie={},We;(function(){for(var Ue=Ee.concat(Me),et=[],ot={},nt=0,qe=Ue.length;nt<qe;++nt){var st=Ue[nt],$e=st[3];if($e)for(var Qe=$e.length;--Qe>=0;)Ie[$e.charAt(Qe)]=st;var _e=st[1],ut=""+_e;ot.hasOwnProperty(ut)||(et.push(_e),ot[ut]=null)}et.push(/[\0-\uffff]/),We=I(et)})();var je=Me.length,Be=function(Ue){for(var et=Ue.sourceCode,ot=Ue.basePos,nt=Ue.sourceNode,qe=[ot,o],st=0,$e=et.match(We)||[],Qe={},_e=0,ut=$e.length;_e<ut;++_e){var lt=$e[_e],Ne=Qe[lt],Ke=void 0,Se;if(typeof Ne=="string")Se=!1;else{var ve=Ie[lt.charAt(0)];if(ve)Ke=lt.match(ve[1]),Ne=ve[0];else{for(var be=0;be<je;++be)if(ve=Me[be],Ke=lt.match(ve[1]),Ke){Ne=ve[0];break}Ke||(Ne=o)}Se=Ne.length>=5&&Ne.substring(0,5)==="lang-",Se&&!(Ke&&typeof Ke[1]=="string")&&(Se=!1,Ne=y),Se||(Qe[lt]=Ne)}var re=st;if(st+=lt.length,!Se)qe.push(ot+re,Ne);else{var ie=Ke[1],le=lt.indexOf(ie),he=le+ie.length;Ke[2]&&(he=lt.length-Ke[2].length,le=he-ie.length);var Le=Ne.substring(5);X(nt,ot+re,lt.substring(0,le),Be,qe),X(nt,ot+re+le,ie,ue(Le,ie),qe),X(nt,ot+re+he,lt.substring(he),Be,qe)}}Ue.decorations=qe};return Be}function ke(Ee){var Me=[],Ie=[];Ee.tripleQuotedStrings?Me.push([b,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):Ee.multiLineStrings?Me.push([b,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):Me.push([b,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),Ee.verbatimStrings&&Ie.push([b,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var We=Ee.hashComments;We&&(Ee.cStyleComments?(We>1?Me.push([T,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):Me.push([T,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Ie.push([b,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):Me.push([T,/^#[^\r\n]*/,null,"#"])),Ee.cStyleComments&&(Ie.push([T,/^\/\/[^\r\n]*/,null]),Ie.push([T,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var je=Ee.regexLiterals;if(je){var Be=je>1?"":`
\r`,Ue=Be?".":"[\\S\\s]",et="/(?=[^/*"+Be+"])(?:[^/\\x5B\\x5C"+Be+"]|\\x5C"+Ue+"|\\x5B(?:[^\\x5C\\x5D"+Be+"]|\\x5C"+Ue+")*(?:\\x5D|$))+/";Ie.push(["lang-regex",RegExp("^"+V+"("+et+")")])}var ot=Ee.types;ot&&Ie.push([g,ot]);var nt=(""+Ee.keywords).replace(/^ | $/g,"");nt.length&&Ie.push([D,new RegExp("^(?:"+nt.replace(/[\s,]+/g,"|")+")\\b"),null]),Me.push([o,/^\s+/,null,` \r
\xA0`]);var qe="^.[^\\s\\w.$@'\"`/\\\\]*";return Ee.regexLiterals&&(qe+="(?!s*/)"),Ie.push([v,/^@[a-z_$][a-z_$@0-9]*/i,null],[g,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[o,/^[a-z_$][a-z_$@0-9]*/i,null],[v,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[o,/^\\[\s\S]?/,null],[d,new RegExp(qe),null]),fe(Me,Ie)}var xe=ke({keywords:k,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function Te(Ee,Me,Ie){for(var We=/(?:^|\s)nocode(?:\s|$)/,je=/\r\n?|\n/,Be=Ee.ownerDocument,Ue=Be.createElement("li");Ee.firstChild;)Ue.appendChild(Ee.firstChild);var et=[Ue];function ot(_e){var ut=_e.nodeType;if(ut==1&&!We.test(_e.className))if(_e.nodeName==="br")nt(_e),_e.parentNode&&_e.parentNode.removeChild(_e);else for(var lt=_e.firstChild;lt;lt=lt.nextSibling)ot(lt);else if((ut==3||ut==4)&&Ie){var Ne=_e.nodeValue,Ke=Ne.match(je);if(Ke){var Se=Ne.substring(0,Ke.index);_e.nodeValue=Se;var ve=Ne.substring(Ke.index+Ke[0].length);if(ve){var be=_e.parentNode;be.insertBefore(Be.createTextNode(ve),_e.nextSibling)}nt(_e),Se||_e.parentNode.removeChild(_e)}}}function nt(_e){for(;!_e.nextSibling;)if(_e=_e.parentNode,!_e)return;function ut(Ke,Se){var ve=Se?Ke.cloneNode(!1):Ke,be=Ke.parentNode;if(be){var re=ut(be,1),ie=Ke.nextSibling;re.appendChild(ve);for(var le=ie;le;le=ie)ie=le.nextSibling,re.appendChild(le)}return ve}for(var lt=ut(_e.nextSibling,0),Ne;(Ne=lt.parentNode)&&Ne.nodeType===1;)lt=Ne;et.push(lt)}for(var qe=0;qe<et.length;++qe)ot(et[qe]);Me===(Me|0)&&et[0].setAttribute("value",Me);var st=Be.createElement("ol");st.className="linenums";for(var $e=Math.max(0,Me-1|0)||0,qe=0,Qe=et.length;qe<Qe;++qe)Ue=et[qe],Ue.className="L"+(qe+$e)%10,Ue.firstChild||Ue.appendChild(Be.createTextNode("\xA0")),st.appendChild(Ue);Ee.appendChild(st)}function Ce(Ee){var Me=/\bMSIE\s(\d+)/.exec(navigator.userAgent);Me=Me&&+Me[1]<=8;var Ie=/\n/g,We=Ee.sourceCode,je=We.length,Be=0,Ue=Ee.spans,et=Ue.length,ot=0,nt=Ee.decorations,qe=nt.length,st=0;nt[qe]=je;var $e,Qe;for(Qe=$e=0;Qe<qe;)nt[Qe]!==nt[Qe+2]?(nt[$e++]=nt[Qe++],nt[$e++]=nt[Qe++]):Qe+=2;for(qe=$e,Qe=$e=0;Qe<qe;){for(var _e=nt[Qe],ut=nt[Qe+1],lt=Qe+2;lt+2<=qe&&nt[lt+1]===ut;)lt+=2;nt[$e++]=_e,nt[$e++]=ut,Qe=lt}qe=nt.length=$e;var Ne=Ee.sourceNode,Ke="";Ne&&(Ke=Ne.style.display,Ne.style.display="none");try{for(var Se=null;ot<et;){var ve=Ue[ot],be=Ue[ot+2]||je,re=nt[st+2]||je,lt=Math.min(be,re),ie=Ue[ot+1],le;if(ie.nodeType!==1&&(le=We.substring(Be,lt))){Me&&(le=le.replace(Ie,"\r")),ie.nodeValue=le;var he=ie.ownerDocument,Le=he.createElement("span");Le.className=nt[st+1];var Pe=ie.parentNode;Pe.replaceChild(Le,ie),Le.appendChild(ie),Be<be&&(Ue[ot+1]=ie=he.createTextNode(We.substring(lt,be)),Pe.insertBefore(ie,Le.nextSibling))}Be=lt,Be>=be&&(ot+=2),Be>=re&&(st+=2)}}finally{Ne&&(Ne.style.display=Ke)}}var ge={};function pe(Ee,Me){for(var Ie=Me.length;--Ie>=0;){var We=Me[Ie];ge.hasOwnProperty(We)?N.console&&console.warn("cannot override language handler %s",We):ge[We]=Ee}}function ue(Ee,Me){return Ee&&ge.hasOwnProperty(Ee)||(Ee=/^\s*</.test(Me)?"default-markup":"default-code"),ge[Ee]}pe(xe,["default-code"]),pe(fe([],[[o,/^[^<?]+/],[S,/^<!\w[^>]*(?:>|$)/],[T,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[d,/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),pe(fe([[o,/^[\s]+/,null,` \r
`],[F,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[C,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[M,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[d,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]),pe(fe([],[[F,/^[\s\S]+/]]),["uq.val"]),pe(ke({keywords:x,hashComments:!0,cStyleComments:!0,types:c}),["c","cc","cpp","cxx","cyc","m"]),pe(ke({keywords:"null,true,false"}),["json"]),pe(ke({keywords:w,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:c}),["cs"]),pe(ke({keywords:P,cStyleComments:!0}),["java"]),pe(ke({keywords:h,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),pe(ke({keywords:a,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),pe(ke({keywords:u,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),pe(ke({keywords:s,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),pe(ke({keywords:p,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),pe(ke({keywords:E,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),pe(fe([],[[b,/^[\s\S]+/]]),["regex"]);function te(Ee){var Me=Ee.langExtension;try{var Ie=B(Ee.sourceNode,Ee.pre),We=Ie.sourceCode;Ee.sourceCode=We,Ee.spans=Ie.spans,Ee.basePos=0,ue(Me,We)(Ee),Ce(Ee)}catch(je){N.console&&console.log(je&&je.stack||je)}}function de(Ee,Me,Ie){var We=Ie||!1,je=Me||null,Be=document.createElement("div");Be.innerHTML="<pre>"+Ee+"</pre>",Be=Be.firstChild,We&&Te(Be,We,!0);var Ue={langExtension:je,numberLines:We,sourceNode:Be,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return te(Ue),Be.innerHTML}function ae(Ee,Me){var Ie=Me||document.body,We=Ie.ownerDocument||document;function je(ve){return Ie.getElementsByTagName(ve)}for(var Be=[je("pre"),je("code"),je("xmp")],Ue=[],et=0;et<Be.length;++et)for(var ot=0,nt=Be[et].length;ot<nt;++ot)Ue.push(Be[et][ot]);Be=null;var qe=Date;qe.now||(qe={now:function(){return+new Date}});var st=0,$e=/\blang(?:uage)?-([\w.]+)(?!\S)/,Qe=/\bprettyprint\b/,_e=/\bprettyprinted\b/,ut=/pre|xmp/i,lt=/^code$/i,Ne=/^(?:pre|code|xmp)$/i,Ke={};function Se(){for(var ve=N.PR_SHOULD_USE_CONTINUATION?qe.now()+250:Infinity;st<Ue.length&&qe.now()<ve;st++){for(var be=Ue[st],re=Ke,ie=be;ie=ie.previousSibling;){var le=ie.nodeType,he=(le===7||le===8)&&ie.nodeValue;if(he?!/^\??prettify\b/.test(he):le!==3||/\S/.test(ie.nodeValue))break;if(he){re={},he.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Lt,Ze,ir){re[Ze]=ir});break}}var Le=be.className;if((re!==Ke||Qe.test(Le))&&!_e.test(Le)){for(var Pe=!1,Xe=be.parentNode;Xe;Xe=Xe.parentNode){var vt=Xe.tagName;if(Ne.test(vt)&&Xe.className&&Qe.test(Xe.className)){Pe=!0;break}}if(!Pe){be.className+=" prettyprinted";var Dt=re.lang;if(!Dt){Dt=Le.match($e);var Ge;!Dt&&(Ge=oe(be))&&lt.test(Ge.tagName)&&(Dt=Ge.className.match($e)),Dt&&(Dt=Dt[1])}var Et;if(ut.test(be.tagName))Et=1;else{var ft=be.currentStyle,it=We.defaultView,Rt=ft?ft.whiteSpace:it&&it.getComputedStyle?it.getComputedStyle(be,null).getPropertyValue("white-space"):0;Et=Rt&&Rt.substring(0,3)==="pre"}var pt=re.linenums;(pt=pt==="true"||+pt)||(pt=Le.match(/\blinenums\b(?::(\d+))?/),pt=pt?pt[1]&&pt[1].length?+pt[1]:!0:!1),pt&&Te(be,pt,Et);var At={langExtension:Dt,sourceNode:be,numberLines:pt,pre:Et,sourceCode:null,basePos:null,spans:null,decorations:null};te(At)}}}st<Ue.length?N.setTimeout(Se,250):typeof Ee=="function"&&Ee()}Se()}var we=N.PR={createSimpleLexer:fe,registerLangHandler:pe,sourceDecorator:ke,PR_ATTRIB_NAME:M,PR_ATTRIB_VALUE:F,PR_COMMENT:T,PR_DECLARATION:S,PR_KEYWORD:D,PR_LITERAL:v,PR_NOCODE:W,PR_PLAIN:o,PR_PUNCTUATION:d,PR_SOURCE:y,PR_STRING:b,PR_TAG:C,PR_TYPE:g,prettyPrintOne:R?N.prettyPrintOne=de:O=de,prettyPrint:j=R?N.prettyPrint=ae:j=ae},Re=N.define;typeof Re=="function"&&Re.amd&&Re("google-code-prettify",[],function(){return we})})()},"T+//":function(dt,at,se){"use strict";se.r(at);var ne=se("Q9mQ"),$=se("diRs"),R=se("2qtc"),Q=se("kLXV"),U=se("miYZ"),O=se("tsqr"),j=se("9og8"),N=se("tJVT"),_=se("B9cy"),A=se("Ol7k"),f=se("lUTK"),x=se("BvKs"),P=se("WmNS"),w=se.n(P),E=se("q1tI"),p=se.n(E),u=se("m3rI"),a=se("p0QG"),s=se.n(a),h=se("ErOA"),k=se("9kvl"),c=se("RCxd"),b=se("xGfz"),D=se("xKgJ"),T=se("5NDa"),g=se("5rEg");function v(ge){var pe=ge.user,ue=ge.CategoryId,te=ge.IsShow,de=ge.setIsShow,ae=ge.dispatch,we=ge.init,Re=Object(E.useState)(),Ee=Object(N.a)(Re,2),Me=Ee[0],Ie=Ee[1];return p.a.createElement(Q.a,{title:ue?"\u65B0\u5EFA\u4E09\u7EA7\u7C7B\u76EE":"\u65B0\u5EFA\u4E8C\u7EA7\u7C7B\u76EE",width:424,onCancel:function(){de(!1)},onOk:Object(j.a)(w.a.mark(function We(){var je;return w.a.wrap(function(Ue){for(;;)switch(Ue.prev=Ue.next){case 0:if(Me){Ue.next=3;break}return O.b.error("\u680F\u76EE\u540D\u4E0D\u80FD\u4E3A\u7A7A"),Ue.abrupt("return");case 3:return Ue.next=5,Object(h.a)("/api/programas.json",{method:"post",body:{name:Me,parent_id:ue}});case 5:je=Ue.sent,je.status===0&&(O.b.info("\u521B\u5EFA\u6210\u529F"),de(!1),Ie(""),we());case 7:case"end":return Ue.stop()}},We)})),visible:te},p.a.createElement(g.a,{value:Me,onChange:function(je){return Ie(je.target.value)},placeholder:"\u8BF7\u8F93\u5165\u4E0D\u8D85\u8FC710\u4E2A\u6C49\u5B57\u7684\u540D\u79F0",maxLength:10}))}var d=Object(k.a)(function(ge){var pe=ge.user;return{user:pe}})(v);function o(ge){var pe=ge.user,ue=ge.CategoryId,te=ge.name,de=ge.IsShow,ae=ge.setIsShow,we=ge.dispatch,Re=ge.init,Ee=Object(E.useState)(),Me=Object(N.a)(Ee,2),Ie=Me[0],We=Me[1];return Object(E.useEffect)(function(){We(te)},[te]),p.a.createElement(Q.a,{title:"\u76EE\u5F55\u91CD\u547D\u540D",width:424,onCancel:function(){ae(!1)},onOk:Object(j.a)(w.a.mark(function je(){var Be;return w.a.wrap(function(et){for(;;)switch(et.prev=et.next){case 0:if(Ie){et.next=3;break}return O.b.error("\u680F\u76EE\u540D\u4E0D\u80FD\u4E3A\u7A7A"),et.abrupt("return");case 3:return et.next=5,Object(h.a)("/api/programas/".concat(ue,"/rename.json"),{method:"put",body:{name:Ie,id:ue}});case 5:Be=et.sent,Be.status===0&&(O.b.info("\u4FEE\u6539\u6210\u529F"),ae(!1),We(""),Re());case 7:case"end":return et.stop()}},je)})),visible:de},p.a.createElement(g.a,{value:Ie,onChange:function(Be){return We(Be.target.value)},placeholder:"\u8BF7\u8F93\u5165\u4E0D\u8D85\u8FC710\u4E2A\u6C49\u5B57\u7684\u540D\u79F0",maxLength:10}))}var C=Object(k.a)(function(ge){var pe=ge.user;return{user:pe}})(o),S=se("+L6B"),y=se("2/Rp"),M=se("9Bee");function F(ge){var pe,ue,te,de,ae=ge.user,we=ge.ItemData,Re=ge.setIssee,Ee=ge.dispatch,Me=ge.init;return p.a.createElement("div",null,p.a.createElement("div",{style:{textAlign:"right"}},Object(D.v)()&&p.a.createElement(y.a,{onClick:function(){return Re(!1)}},"\u7F16\u8F91")),p.a.createElement(M.a,{value:we.content}),(we==null||((pe=we.attachment)===null||pe===void 0)?void 0:pe.id)&&p.a.createElement("div",null,p.a.createElement("a",{href:we==null||((ue=we.attachment)===null||ue===void 0)?void 0:ue.url,target:"_self",download:we==null||((te=we.attachment)===null||te===void 0)?void 0:te.title},p.a.createElement("i",{style:{color:"#29BD8B"},className:"font-14 color-green iconfont icon-fujian mr8"}),p.a.createElement("span",{style:{color:"#000000"}},we==null||((de=we.attachment)===null||de===void 0)?void 0:de.title))))}var W=Object(k.a)(function(ge){var pe=ge.user;return{user:pe}})(F),V=se("DZo9"),I=se("8z0m"),B=se("Ot1p"),X=se("hJwl");function ee(ge){var pe=ge.user,ue=ge.ItemData,te=ge.setIssee,de=ge.CategoryId,ae=ge.dispatch,we=ge.init,Re=Object(E.useState)([]),Ee=Object(N.a)(Re,2),Me=Ee[0],Ie=Ee[1],We=Object(E.useState)(ue.content),je=Object(N.a)(We,2),Be=je[0],Ue=je[1];function et(){var $e,Qe=[];return ue==null||(($e=ue.attachments)===null||$e===void 0)||$e.map(function(_e){var ut={uid:_e==null?void 0:_e.id,name:_e.title,response:{id:_e.id}};Qe.push(ut)}),Qe}var ot={name:"file",multiple:!0,action:u.a.API_SERVER+"/api/attachments.json",defaultFileList:et(),onRemove:function(Qe){Object(X.t)({id:Qe.uid})},onChange:function(Qe){console.log("info",Qe);var _e=Qe.file.status;_e!=="uploading",_e==="removed"&&Ie(Qe.fileList),_e==="done"?(Ie(Qe.fileList),O.b.success("".concat(Qe.file.name," \u6587\u4EF6\u4E0A\u4F20\u6210\u529F"))):_e==="error"&&O.b.error("".concat(Qe.file.name," \u6587\u4EF6\u4E0A\u4F20\u5931\u8D25"))},beforeUpload:function(Qe){var _e=Qe.size/1024/1024<150;return _e||O.b.info("\u6587\u4EF6\u5927\u5C0F\u5FC5\u987B\u5C0F\u4E8E150MB"),_e}};function nt(){return qe.apply(this,arguments)}function qe(){return qe=Object(j.a)(w.a.mark(function $e(){var Qe;return w.a.wrap(function(ut){for(;;)switch(ut.prev=ut.next){case 0:return ut.next=2,Object(h.a)("/api/programas/".concat(de,"/update_content.json"),{method:"put",body:{id:de,content:Be,attachment_id:st(Me)}});case 2:Qe=ut.sent,Qe&&(O.b.info("\u63D0\u4EA4\u6210\u529F"),te(!0));case 4:case"end":return ut.stop()}},$e)})),qe.apply(this,arguments)}function st($e){var Qe;return $e&&$e.map(function(_e){Qe=_e.response.id}),Qe}return p.a.createElement("div",null,p.a.createElement(B.a,{defaultValue:Be,onChange:function(Qe){return Ue(Qe)}}),p.a.createElement(I.a,ot,p.a.createElement(y.a,{className:"uploadBtn"},"\u4E0A\u4F20\u9644\u4EF6"),"(\u5355\u4E2A\u6587\u4EF6150M\u4EE5\u5185)"),p.a.createElement("p",{style:{marginTop:"10px"}},p.a.createElement(y.a,{style:{width:"90px"},onClick:function(){return nt()}},"\u63D0\u4EA4"),p.a.createElement(y.a,{style:{marginLeft:"30px",width:"90px"},type:"primary",onClick:function(){return te(!0)}},"\u53D6\u6D88")))}var oe=Object(k.a)(function(ge){var pe=ge.user;return{user:pe}})(ee),fe=x.a.SubMenu,ke=A.a.Content,xe=A.a.Sider;function Te(ge){var pe,ue=ge.user,te=ge.dispatch,de=ge.globalSetting,ae=Object(E.useState)(),we=Object(N.a)(ae,2),Re=we[0],Ee=we[1],Me=Object(E.useState)(!1),Ie=Object(N.a)(Me,2),We=Ie[0],je=Ie[1],Be=Object(E.useState)(),Ue=Object(N.a)(Be,2),et=Ue[0],ot=Ue[1],nt=Object(E.useState)(),qe=Object(N.a)(nt,2),st=qe[0],$e=qe[1],Qe=Object(E.useState)(!1),_e=Object(N.a)(Qe,2),ut=_e[0],lt=_e[1],Ne=Object(E.useState)(""),Ke=Object(N.a)(Ne,2),Se=Ke[0],ve=Ke[1],be=Object(E.useState)(""),re=Object(N.a)(be,2),ie=re[0],le=re[1],he=Object(E.useState)(!0),Le=Object(N.a)(he,2),Pe=Le[0],Xe=Le[1];Object(E.useEffect)(function(){vt()},[]),console.log("globalSetting",de);function vt(){return Dt.apply(this,arguments)}function Dt(){return Dt=Object(j.a)(w.a.mark(function pt(){var At;return w.a.wrap(function(Ze){for(;;)switch(Ze.prev=Ze.next){case 0:return Ze.next=2,Object(h.a)("/api/programas.json",{method:"get"});case 2:At=Ze.sent,At&&ot(At==null?void 0:At.programas);case 4:case"end":return Ze.stop()}},pt)})),Dt.apply(this,arguments)}var Ge=function(){var pt=Object(j.a)(w.a.mark(function At(Lt,Ze,ir){var Zt;return w.a.wrap(function(Wt){for(;;)switch(Wt.prev=Wt.next){case 0:Wt.t0=Lt,Wt.next=Wt.t0===1?3:Wt.t0===2?6:Wt.t0===3?10:Wt.t0===4?15:17;break;case 3:return $e(Ze==null?void 0:Ze.id),je(!0),Wt.abrupt("break",17);case 6:return $e(Ze==null?void 0:Ze.id),lt(!0),ve(Ze==null?void 0:Ze.name),Wt.abrupt("break",17);case 10:return Wt.next=12,Object(h.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 Zt=Wt.sent,Zt.status===0&&vt(),Wt.abrupt("break",17);case 15:return Et(p.a.createElement("p",null,"\u5220\u9664\u4E4B\u540E\u4E0D\u80FD\u6062\u590D,",p.a.createElement("br",null),"\u662F\u5426\u786E\u8BA4\u5220\u9664?"),Object(j.a)(w.a.mark(function nr(){var ar;return w.a.wrap(function(Ar){for(;;)switch(Ar.prev=Ar.next){case 0:return Ar.next=2,Object(h.a)("/api/programas/".concat(Ze==null?void 0:Ze.id,".json"),{method:"delete",body:{id:Ze==null?void 0:Ze.id}});case 2:ar=Ar.sent,ar.status===0&&(O.b.info("\u5220\u9664\u6210\u529F"),vt());case 4:case"end":return Ar.stop()}},nr)}))),Wt.abrupt("break",17);case 17:case"end":return Wt.stop()}},At)}));return function(Lt,Ze,ir){return pt.apply(this,arguments)}}(),Et=function(At,Lt){Q.a.confirm({centered:!0,title:"\u63D0\u793A",icon:p.a.createElement(c.a,null),content:At,okText:"\u786E\u8BA4",onOk:function(){return Lt()},cancelText:"\u53D6\u6D88"})},ft=function(At,Lt){return p.a.createElement("div",{className:s.a.leftMenuActions},Lt===1&&p.a.createElement("p",{className:"current",onClick:function(){return Ge(1,At,Lt)}},"\u65B0\u5EFA"),p.a.createElement("p",{className:"current",onClick:function(){return Ge(2,At,Lt)}},"\u91CD\u547D\u540D"),p.a.createElement("p",{className:"current",onClick:function(){return Ge(3,At,Lt)}},"\u7F6E\u9876"),p.a.createElement("p",{className:"current",onClick:function(){return Ge(4,At,Lt)}},"\u5220\u9664"))};function it(){return Rt.apply(this,arguments)}function Rt(){return Rt=Object(j.a)(w.a.mark(function pt(){var At;return w.a.wrap(function(Ze){for(;;)switch(Ze.prev=Ze.next){case 0:return Ze.next=2,Object(h.a)("/api/programas/".concat(st,"/content.json"),{method:"get",params:{id:st}});case 2:At=Ze.sent,At&&le(At);case 4:case"end":return Ze.stop()}},pt)})),Rt.apply(this,arguments)}return p.a.createElement("div",{style:{marginBottom:"40px"}},p.a.createElement("img",{style:{width:"100%"},src:u.a.IMG_SERVER+"/".concat(de==null||((pe=de.setting)===null||pe===void 0)?void 0:pe.shixun_banner_url)}),p.a.createElement("div",{className:"edu-container minH500",style:{display:"flex",width:"1200px"}},p.a.createElement(xe,{width:244,className:s.a.leftMenus,style:{background:"none",marginTop:"20px",height:"auto"}},p.a.createElement(x.a,{mode:"inline"},et==null?void 0:et.map(function(pt,At){if((pt==null?void 0:pt.children.length)>0){var Lt;return p.a.createElement(fe,{title:p.a.createElement("span",{className:"font16"},p.a.createElement("span",null,pt.name),!Object(D.v)()&&p.a.createElement("span",null),Object(D.v)()&&p.a.createElement($.a,{placement:"right",content:function(){return ft(pt,1)},trigger:"hover"},p.a.createElement("span",{className:["iconfont icon-sandian",s.a.actions].join(" ")})))},pt==null||((Lt=pt.children)===null||Lt===void 0)?void 0:Lt.map(function(Ze,ir){return p.a.createElement(x.a.Item,{className:s.a===null||s.a===void 0?void 0:s.a.SubMentItem,onClick:function(){$e(Ze==null?void 0:Ze.id),st=Ze==null?void 0:Ze.id,it()}},p.a.createElement("span",{style:{flex:"1"}},Ze==null?void 0:Ze.name),Object(D.v)()&&p.a.createElement($.a,{placement:"right",content:function(){return ft(Ze,2)},trigger:"hover"},p.a.createElement("span",{className:["iconfont icon-sandian",s.a.actions].join(" ")})))}))}else return p.a.createElement(x.a.Item,{className:s.a===null||s.a===void 0?void 0:s.a.SubMentItem,onClick:function(){$e(pt==null?void 0:pt.id),st=pt==null?void 0:pt.id,it()}},p.a.createElement("span",{style:{flex:"1"}},pt==null?void 0:pt.name),Object(D.v)()&&p.a.createElement($.a,{placement:"right",content:function(){return ft(pt,1)},trigger:"hover"},p.a.createElement("span",{className:["iconfont icon-sandian",s.a.actions].join(" ")})))}),p.a.createElement(x.a.Item,{onClick:function(){$e(""),st="",je(!0)},style:{color:"#0152d9",fontSize:"16px",height:"40px",display:"flex",alignItems:"center"},icon:p.a.createElement(b.a,{style:{color:"#0152d9",fontSize:"16px"}})},"\u65B0\u589E\u4E8C\u7EA7\u7C7B\u76EE"))),p.a.createElement("div",{style:{width:"937px",marginLeft:"17px",background:"#fff",padding:"20px"}},Pe&&p.a.createElement(W,{ItemData:ie,setIssee:Xe}),Pe===!1&&p.a.createElement(oe,{ItemData:ie,setIssee:Xe,CategoryId:st}))),p.a.createElement(d,{CategoryId:st,IsShow:We,setIsShow:je,init:vt}),p.a.createElement(C,{CategoryId:st,name:Se,IsShow:ut,setIsShow:lt,init:vt}))}var Ce=at.default=Object(k.a)(function(ge){var pe=ge.user,ue=ge.globalSetting;return{user:pe,globalSetting:ue}})(Te)},"VrN/":function(dt,at,se){(function(ne,$){dt.exports=$()})(this,function(){"use strict";var ne=navigator.userAgent,$=navigator.platform,R=/gecko\/\d/i.test(ne),Q=/MSIE \d/.test(ne),U=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ne),O=/Edge\/(\d+)/.exec(ne),j=Q||U||O,N=j&&(Q?document.documentMode||6:+(O||U)[1]),_=!O&&/WebKit\//.test(ne),A=_&&/Qt\/\d+\.\d+/.test(ne),f=!O&&/Chrome\//.test(ne),x=/Opera\//.test(ne),P=/Apple Computer/.test(navigator.vendor),w=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(ne),E=/PhantomJS/.test(ne),p=!O&&/AppleWebKit/.test(ne)&&/Mobile\/\w+/.test(ne),u=/Android/.test(ne),a=p||u||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(ne),s=p||/Mac/.test($),h=/\bCrOS\b/.test(ne),k=/win/i.test($),c=x&&ne.match(/Version\/(\d*\.\d*)/);c&&(c=Number(c[1])),c&&c>=15&&(x=!1,_=!0);var b=s&&(A||x&&(c==null||c<12.11)),D=R||j&&N>=9;function T(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var g=function(e,t){var i=e.className,r=T(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 v(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function d(e,t){return v(e).appendChild(t)}function o(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 L=0;L<t.length;++L)n.appendChild(t[L]);return n}function C(e,t,i,r){var n=o(e,t,i,r);return n.setAttribute("role","presentation"),n}var S;document.createRange?S=function(e,t,i,r){var n=document.createRange();return n.setEnd(r||e,i),n.setStart(e,t),n}:S=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 y(e,t){if(t.nodeType==3&&(t=t.parentNode),e.contains)return e.contains(t);do if(t.nodeType==11&&(t=t.host),t==e)return!0;while(t=t.parentNode)}function M(){var e;try{e=document.activeElement}catch(t){e=document.body||null}for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e}function F(e,t){var i=e.className;T(t).test(i)||(e.className+=(i?" ":"")+t)}function W(e,t){for(var i=e.split(" "),r=0;r<i.length;r++)i[r]&&!T(i[r]).test(t)&&(t+=" "+i[r]);return t}var V=function(e){e.select()};p?V=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:j&&(V=function(e){try{e.select()}catch(t){}});function I(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function B(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 X(e,t,i,r,n){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var L=r||0,H=n||0;;){var Y=e.indexOf(" ",L);if(Y<0||Y>=t)return H+(t-L);H+=Y-L,H+=i-H%i,L=Y+1}}var ee=function(){this.id=null,this.f=null,this.time=0,this.handler=I(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,ke={toString:function(){return"CodeMirror.Pass"}},xe={scroll:!1},Te={origin:"*mouse"},Ce={origin:"+move"};function ge(e,t,i){for(var r=0,n=0;;){var L=e.indexOf(" ",r);L==-1&&(L=e.length);var H=L-r;if(L==e.length||n+H>=t)return r+Math.min(H,t-n);if(n+=L-r,n+=i-n%i,r=L+1,n>=t)return r}}var pe=[""];function ue(e){for(;pe.length<=e;)pe.push(te(pe)+" ");return pe[e]}function te(e){return e[e.length-1]}function de(e,t){for(var i=[],r=0;r<e.length;r++)i[r]=t(e[r],r);return i}function ae(e,t,i){for(var r=0,n=i(t);r<e.length&&i(e[r])<=n;)r++;e.splice(r,0,t)}function we(){}function Re(e,t){var i;return Object.create?i=Object.create(e):(we.prototype=e,i=new we),t&&B(t,i),i}var Ee=/[\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()||Ee.test(e))}function Ie(e,t){return t?t.source.indexOf("\\w")>-1&&Me(e)?!0:t.test(e):Me(e)}function We(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var je=/[\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 Be(e){return e.charCodeAt(0)>=768&&je.test(e)}function Ue(e,t,i){for(;(i<0?t>0:t<e.length)&&Be(e.charAt(t));)t+=i;return t}function et(e,t,i){for(var r=t>i?-1:1;;){if(t==i)return t;var n=(t+i)/2,L=r<0?Math.ceil(n):Math.floor(n);if(L==t)return e(L)?t:i;e(L)?i=L:t=L+r}}function ot(e,t,i,r){if(!e)return r(t,i,"ltr",0);for(var n=!1,L=0;L<e.length;++L){var H=e[L];(H.from<i&&H.to>t||t==i&&H.to==t)&&(r(Math.max(H.from,t),Math.min(H.to,i),H.level==1?"rtl":"ltr",L),n=!0)}n||r(t,i,"ltr")}var nt=null;function qe(e,t,i){var r;nt=null;for(var n=0;n<e.length;++n){var L=e[n];if(L.from<t&&L.to>t)return n;L.to==t&&(L.from!=L.to&&i=="before"?r=n:nt=n),L.from==t&&(L.from!=L.to&&i!="before"?r=n:nt=n)}return r!=null?r:nt}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]/,L=/[LRr]/,H=/[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,Ae=[],Fe=0;Fe<De;++Fe)Ae.push(i(q.charCodeAt(Fe)));for(var Ve=0,Je=me;Ve<De;++Ve){var tt=Ae[Ve];tt=="m"?Ae[Ve]=Je:Je=tt}for(var ht=0,rt=me;ht<De;++ht){var ct=Ae[ht];ct=="1"&&rt=="r"?Ae[ht]="n":L.test(ct)&&(rt=ct,ct=="r"&&(Ae[ht]="R"))}for(var Ct=1,xt=Ae[0];Ct<De-1;++Ct){var Ot=Ae[Ct];Ot=="+"&&xt=="1"&&Ae[Ct+1]=="1"?Ae[Ct]="1":Ot==","&&xt==Ae[Ct+1]&&(xt=="1"||xt=="n")&&(Ae[Ct]=xt),xt=Ot}for(var $t=0;$t<De;++$t){var mr=Ae[$t];if(mr==",")Ae[$t]="N";else if(mr=="%"){var qt=void 0;for(qt=$t+1;qt<De&&Ae[qt]=="%";++qt);for(var Fr=$t&&Ae[$t-1]=="!"||qt<De&&Ae[qt]=="1"?"1":"N",_r=$t;_r<qt;++_r)Ae[_r]=Fr;$t=qt-1}}for(var or=0,Mr=me;or<De;++or){var xr=Ae[or];Mr=="L"&&xr=="1"?Ae[or]="L":L.test(xr)&&(Mr=xr)}for(var hr=0;hr<De;++hr)if(n.test(Ae[hr])){var sr=void 0;for(sr=hr+1;sr<De&&n.test(Ae[sr]);++sr);for(var er=(hr?Ae[hr-1]:me)=="L",Pr=(sr<De?Ae[sr]:me)=="L",dn=er==Pr?er?"L":"R":me,Di=hr;Di<sr;++Di)Ae[Di]=dn;hr=sr-1}for(var Sr=[],si,gr=0;gr<De;)if(H.test(Ae[gr])){var Ya=gr;for(++gr;gr<De&&H.test(Ae[gr]);++gr);Sr.push(new Z(0,Ya,gr))}else{var mi=gr,Gi=Sr.length,zi=ce=="rtl"?1:0;for(++gr;gr<De&&Ae[gr]!="L";++gr);for(var wr=mi;wr<gr;)if(Y.test(Ae[wr])){mi<wr&&(Sr.splice(Gi,0,new Z(1,mi,wr)),Gi+=zi);var cn=wr;for(++wr;wr<gr&&Y.test(Ae[wr]);++wr);Sr.splice(Gi,0,new Z(2,cn,wr)),Gi+=zi,mi=wr}else++wr;mi<gr&&Sr.splice(Gi,0,new Z(1,mi,gr))}return ce=="ltr"&&(Sr[0].level==1&&(si=q.match(/^\s+/))&&(Sr[0].from=si[0].length,Sr.unshift(new Z(0,0,si[0].length))),te(Sr).level==1&&(si=q.match(/\s+$/))&&(te(Sr).to-=si[0].length,Sr.push(new Z(0,De-si[0].length,De)))),ce=="rtl"?Sr.reverse():Sr}}();function $e(e,t){var i=e.order;return i==null&&(i=e.order=st(e.text,t)),i}var Qe=[],_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]||Qe).concat(i)}};function ut(e,t){return e._handlers&&e._handlers[t]||Qe}function lt(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 L=oe(n,i);L>-1&&(r[t]=n.slice(0,L).concat(n.slice(L+1)))}}}function Ne(e,t){var i=ut(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}}),Ne(e,i||t.type,e,t),le(t)||t.codemirrorIgnore}function Se(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 ve(e,t){return ut(e,t).length>0}function be(e){e.prototype.on=function(t,i){_e(this,t,i)},e.prototype.off=function(t,i){lt(this,t,i)}}function re(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function ie(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function le(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function he(e){re(e),ie(e)}function Le(e){return e.target||e.srcElement}function Pe(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),s&&e.ctrlKey&&t==1&&(t=3),t}var Xe=function(){if(j&&N<9)return!1;var e=o("div");return"draggable"in e||"dragDrop"in e}(),vt;function Dt(e){if(vt==null){var t=o("span","\u200B");d(e,o("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(vt=t.offsetWidth<=1&&t.offsetHeight>2&&!(j&&N<8))}var i=vt?o("span","\u200B"):o("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return i.setAttribute("cm-text",""),i}var Ge;function Et(e){if(Ge!=null)return Ge;var t=d(e,document.createTextNode("A\u062EA")),i=S(t,0,1).getBoundingClientRect(),r=S(t,1,2).getBoundingClientRect();return v(e),!i||i.left==i.right?!1:Ge=r.right-i.right<3}var ft=`
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 L=e.slice(t,e.charAt(n-1)=="\r"?n-1:n),H=L.indexOf("\r");H!=-1?(i.push(L.slice(0,H)),t+=H+1):(i.push(L),t=n+1)}return i}:function(e){return e.split(/\r\n?|\n/)},it=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},Rt=function(){var e=o("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),pt=null;function At(e){if(pt!=null)return pt;var t=d(e,o("span","x")),i=t.getBoundingClientRect(),r=S(t,0,1).getBoundingClientRect();return pt=Math.abs(i.left-r.left)>1}var Lt={},Ze={};function ir(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Lt[e]=t}function Zt(e,t){Ze[e]=t}function yt(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 yt("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return yt("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function Wt(e,t){t=yt(t);var i=Lt[t.name];if(!i)return Wt(e,"text/plain");var r=i(e,t);if(nr.hasOwnProperty(t.name)){var n=nr[t.name];for(var L in n){if(!n.hasOwnProperty(L))continue;r.hasOwnProperty(L)&&(r["_"+L]=r[L]),r[L]=n[L]}}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var H in t.modeProps)r[H]=t.modeProps[H];return r}var nr={};function ar(e,t){var i=nr.hasOwnProperty(e)?nr[e]:nr[e]={};B(t,i)}function Cr(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 Ar(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 Vr(e,t,i){return e.startState?e.startState(t,i):!0}var Bt=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};Bt.prototype.eol=function(){return this.pos>=this.string.length},Bt.prototype.sol=function(){return this.pos==this.lineStart},Bt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Bt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Bt.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},Bt.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Bt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Bt.prototype.skipToEnd=function(){this.pos=this.string.length},Bt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Bt.prototype.backUp=function(e){this.pos-=e},Bt.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=X(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?X(this.string,this.lineStart,this.tabSize):0)},Bt.prototype.indentation=function(){return X(this.string,null,this.tabSize)-(this.lineStart?X(this.string,this.lineStart,this.tabSize):0)},Bt.prototype.match=function(e,t,i){if(typeof e=="string"){var r=function(H){return i?H.toLowerCase():H},n=this.string.substr(this.pos,e.length);if(r(n)==r(e))return t!==!1&&(this.pos+=e.length),!0}else{var L=this.string.slice(this.pos).match(e);return L&&L.index>0?null:(L&&t!==!1&&(this.pos+=L[0].length),L)}},Bt.prototype.current=function(){return this.string.slice(this.start,this.pos)},Bt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Bt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Bt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function gt(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],L=n.chunkSize();if(t<L){i=n;break}t-=L}return i.lines[t]}function jr(e,t,i){var r=[],n=t.line;return e.iter(t.line,i.line+1,function(L){var H=L.text;n==i.line&&(H=H.slice(0,i.ch)),n==t.line&&(H=H.slice(t.ch)),r.push(H),++n}),r}function li(e,t,i){var r=[];return e.iter(t,i,function(n){r.push(n.text)}),r}function Lr(e,t){var i=t-e.height;if(i)for(var r=e;r;r=r.parent)r.height+=i}function Pt(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 Xr(e,t){var i=e.first;e:do{for(var r=0;r<e.children.length;++r){var n=e.children[r],L=n.height;if(t<L){e=n;continue e}t-=L,i+=n.chunkSize()}return i}while(!e.lines);for(var H=0;H<e.lines.length;++H){var Y=e.lines[H],Z=Y.height;if(t<Z)break;t-=Z}return i+H}function ui(e,t){return t>=e.first&&t<e.first+e.size}function gi(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function Ye(e,t,i){if(i===void 0&&(i=null),!(this instanceof Ye))return new Ye(e,t,i);this.line=e,this.ch=t,this.sticky=i}function Tt(e,t){return e.line-t.line||e.ch-t.ch}function ti(e,t){return e.sticky==t.sticky&&Tt(e,t)==0}function hi(e){return Ye(e.line,e.ch)}function di(e,t){return Tt(e,t)<0?t:e}function Ri(e,t){return Tt(e,t)<0?e:t}function K(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function l(e,t){if(t.line<e.first)return Ye(e.first,0);var i=e.first+e.size-1;return t.line>i?Ye(i,gt(e,i).text.length):m(t,gt(e,t.line).text.length)}function m(e,t){var i=e.ch;return i==null||i>t?Ye(e.line,t):i<0?Ye(e.line,0):e}function G(e,t){for(var i=[],r=0;r<t.length;r++)i[r]=l(e,t[r]);return i}var J=function(e,t){this.state=e,this.lookAhead=t},z=function(e,t,i,r){this.state=t,this.doc=e,this.line=i,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};z.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},z.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}},z.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},z.fromSaved=function(e,t,i){return t instanceof J?new z(e,Cr(e.mode,t.state),i,t.lookAhead):new z(e,Cr(e.mode,t),i)},z.prototype.save=function(e){var t=e!==!1?Cr(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new J(t,this.maxLookAhead):t};function ye(e,t,i,r){var n=[e.state.modeGen],L={};Hr(e,t.text,e.doc.mode,i,function(q,ce){return n.push(q,ce)},L,r);for(var H=i.state,Y=function(q){i.baseTokens=n;var ce=e.state.overlays[q],me=1,De=0;i.state=!0,Hr(e,t.text,ce.mode,i,function(Ae,Fe){for(var Ve=me;De<Ae;){var Je=n[me];Je>Ae&&n.splice(me,1,Ae,n[me+1],Je),me+=2,De=Math.min(Ae,Je)}if(!Fe)return;if(ce.opaque)n.splice(Ve,me-Ve,Ae,"overlay "+Fe),me=Ve+2;else for(;Ve<me;Ve+=2){var tt=n[Ve+1];n[Ve+1]=(tt?tt+" ":"")+"overlay "+Fe}},L),i.state=H,i.baseTokens=null,i.baseTokenPos=1},Z=0;Z<e.state.overlays.length;++Z)Y(Z);return{styles:n,classes:L.bgClass||L.textClass?L:null}}function He(e,t,i){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=Oe(e,Pt(t)),n=t.text.length>e.options.maxHighlightLength&&Cr(e.doc.mode,r.state),L=ye(e,t,r);n&&(r.state=n),t.stateAfter=r.save(!n),t.styles=L.styles,L.classes?t.styleClasses=L.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 Oe(e,t,i){var r=e.doc,n=e.display;if(!r.mode.startState)return new z(r,!0,t);var L=dr(e,t,i),H=L>r.first&&gt(r,L-1).stateAfter,Y=H?z.fromSaved(r,H,L):new z(r,Vr(r.mode),L);return r.iter(L,t,function(Z){mt(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 mt(e,t,i,r){var n=e.doc.mode,L=new Bt(t,e.options.tabSize,i);for(L.start=L.pos=r||0,t==""&&ze(n,i.state);!L.eol();)wt(n,L,i.state),L.start=L.pos}function ze(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var i=Ar(e,t);if(i.mode.blankLine)return i.mode.blankLine(i.state)}function wt(e,t,i,r){for(var n=0;n<10;n++){r&&(r[0]=Ar(e,i).mode);var L=e.token(t,i);if(t.pos>t.start)return L}throw new Error("Mode "+e.name+" failed to advance stream.")}var Nt=function(e,t,i){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=i};function Gt(e,t,i,r){var n=e.doc,L=n.mode,H;t=l(n,t);var Y=gt(n,t.line),Z=Oe(e,t.line,i),q=new Bt(Y.text,e.options.tabSize,Z),ce;for(r&&(ce=[]);(r||q.pos<t.ch)&&!q.eol();)q.start=q.pos,H=wt(L,q,Z.state),r&&ce.push(new Nt(q,H,Cr(n.mode,Z.state)));return r?ce:new Nt(q,H,Z.state)}function Wr(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 Hr(e,t,i,r,n,L,H){var Y=i.flattenSpans;Y==null&&(Y=e.options.flattenSpans);var Z=0,q=null,ce=new Bt(t,e.options.tabSize,r),me,De=e.options.addModeClass&&[null];for(t==""&&Wr(ze(i,r.state),L);!ce.eol();){if(ce.pos>e.options.maxHighlightLength?(Y=!1,H&&mt(e,t,r,ce.pos),ce.pos=t.length,me=null):me=Wr(wt(i,ce,r.state,De),L),De){var Ae=De[0].name;Ae&&(me="m-"+(me?Ae+" "+me:Ae))}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 dr(e,t,i){for(var r,n,L=e.doc,H=i?-1:t-(e.doc.mode.innerMode?1e3:100),Y=t;Y>H;--Y){if(Y<=L.first)return L.first;var Z=gt(L,Y-1),q=Z.stateAfter;if(q&&(!i||Y+(q instanceof J?q.lookAhead:0)<=L.modeFrontier))return Y;var ce=X(Z.text,null,e.options.tabSize);(n==null||r>ce)&&(n=Y-1,r=ce)}return n}function Yr(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=gt(e,r).stateAfter;if(n&&(!(n instanceof J)||r+n.lookAhead<t)){i=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,i)}var Ki=!1,kr=!1;function Dr(){Ki=!0}function ri(){kr=!0}function vi(e,t,i){this.marker=e,this.from=t,this.to=i}function Qr(e,t){if(e)for(var i=0;i<e.length;++i){var r=e[i];if(r.marker==t)return r}}function ii(e,t){for(var i,r=0;r<e.length;++r)e[r]!=t&&(i||(i=[])).push(e[r]);return i}function Gr(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function fn(e,t,i){var r;if(e)for(var n=0;n<e.length;++n){var L=e[n],H=L.marker,Y=L.from==null||(H.inclusiveLeft?L.from<=t:L.from<t);if(Y||L.from==t&&H.type=="bookmark"&&(!i||!L.marker.insertLeft)){var Z=L.to==null||(H.inclusiveRight?L.to>=t:L.to>t);(r||(r=[])).push(new vi(H,L.from,Z?null:L.to))}}return r}function Vi(e,t,i){var r;if(e)for(var n=0;n<e.length;++n){var L=e[n],H=L.marker,Y=L.to==null||(H.inclusiveRight?L.to>=t:L.to>t);if(Y||L.from==t&&H.type=="bookmark"&&(!i||L.marker.insertLeft)){var Z=L.from==null||(H.inclusiveLeft?L.from<=t:L.from<t);(r||(r=[])).push(new vi(H,Z?null:L.from-t,L.to==null?null:L.to-t))}}return r}function Ir(e,t){if(t.full)return null;var i=ui(e,t.from.line)&&gt(e,t.from.line).markedSpans,r=ui(e,t.to.line)&&gt(e,t.to.line).markedSpans;if(!i&&!r)return null;var n=t.from.ch,L=t.to.ch,H=Tt(t.from,t.to)==0,Y=fn(i,n,H),Z=Vi(r,L,H),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 Ae=Qr(Z,De.marker);Ae?q&&(De.to=Ae.to==null?null:Ae.to+ce):De.to=n}}if(Z)for(var Fe=0;Fe<Z.length;++Fe){var Ve=Z[Fe];if(Ve.to!=null&&(Ve.to+=ce),Ve.from==null){var Je=Qr(Y,Ve.marker);Je||(Ve.from=ce,q&&(Y||(Y=[])).push(Ve))}else Ve.from+=ce,q&&(Y||(Y=[])).push(Ve)}Y&&(Y=Nr(Y)),Z&&Z!=Y&&(Z=Nr(Z));var tt=[Y];if(!q){var ht=t.text.length-2,rt;if(ht>0&&Y)for(var ct=0;ct<Y.length;++ct)Y[ct].to==null&&(rt||(rt=[])).push(new vi(Y[ct].marker,null,null));for(var Ct=0;Ct<ht;++Ct)tt.push(rt);tt.push(Z)}return tt}function Nr(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 Oi(e,t,i){var r=null;if(e.iter(t.line,i.line+1,function(Ae){if(Ae.markedSpans)for(var Fe=0;Fe<Ae.markedSpans.length;++Fe){var Ve=Ae.markedSpans[Fe].marker;Ve.readOnly&&(!r||oe(r,Ve)==-1)&&(r||(r=[])).push(Ve)}}),!r)return null;for(var n=[{from:t,to:i}],L=0;L<r.length;++L)for(var H=r[L],Y=H.find(0),Z=0;Z<n.length;++Z){var q=n[Z];if(Tt(q.to,Y.from)<0||Tt(q.from,Y.to)>0)continue;var ce=[Z,1],me=Tt(q.from,Y.from),De=Tt(q.to,Y.to);(me<0||!H.inclusiveLeft&&!me)&&ce.push({from:q.from,to:Y.from}),(De>0||!H.inclusiveRight&&!De)&&ce.push({from:Y.to,to:q.to}),n.splice.apply(n,ce),Z+=ce.length-3}return n}function _i(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 Mi(e,t){if(!t)return;for(var i=0;i<t.length;++i)t[i].marker.attachLine(e);e.markedSpans=t}function tr(e){return e.inclusiveLeft?-1:0}function Ft(e){return e.inclusiveRight?1:0}function vr(e,t){var i=e.lines.length-t.lines.length;if(i!=0)return i;var r=e.find(),n=t.find(),L=Tt(r.from,n.from)||tr(e)-tr(t);if(L)return-L;var H=Tt(r.to,n.to)||Ft(e)-Ft(t);return H||t.id-e.id}function jt(e,t){var i=kr&&e.markedSpans,r;if(i)for(var n=void 0,L=0;L<i.length;++L)n=i[L],n.marker.collapsed&&(t?n.from:n.to)==null&&(!r||vr(r,n.marker)<0)&&(r=n.marker);return r}function yr(e){return jt(e,!0)}function Yt(e){return jt(e,!1)}function yi(e,t){var i=kr&&e.markedSpans,r;if(i)for(var n=0;n<i.length;++n){var L=i[n];L.marker.collapsed&&(L.from==null||L.from<t)&&(L.to==null||L.to>t)&&(!r||vr(r,L.marker)<0)&&(r=L.marker)}return r}function lr(e,t,i,r,n){var L=gt(e,t),H=kr&&L.markedSpans;if(H)for(var Y=0;Y<H.length;++Y){var Z=H[Y];if(!Z.marker.collapsed)continue;var q=Z.marker.find(0),ce=Tt(q.from,i)||tr(Z.marker)-tr(n),me=Tt(q.to,r)||Ft(Z.marker)-Ft(n);if(ce>=0&&me<=0||ce<=0&&me>=0)continue;if(ce<=0&&(Z.marker.inclusiveRight&&n.inclusiveLeft?Tt(q.to,i)>=0:Tt(q.to,i)>0)||ce>=0&&(Z.marker.inclusiveRight&&n.inclusiveLeft?Tt(q.from,r)<=0:Tt(q.from,r)<0))return!0}}function ur(e){for(var t;t=yr(e);)e=t.find(-1,!0).line;return e}function ni(e){for(var t;t=Yt(e);)e=t.find(1,!0).line;return e}function bi(e){for(var t,i;t=Yt(e);)e=t.find(1,!0).line,(i||(i=[])).push(e);return i}function xi(e,t){var i=gt(e,t),r=ur(i);return i==r?t:Pt(r)}function Fn(e,t){if(t>e.lastLine())return t;var i=gt(e,t),r;if(!Zr(e,i))return t;for(;r=Yt(i);)i=r.find(1,!0).line;return Pt(i)+1}function Zr(e,t){var i=kr&&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&&Xi(e,t,r))return!0}}function Xi(e,t,i){if(i.to==null){var r=i.marker.find(1,!0);return Xi(e,r.line,Qr(r.line.markedSpans,i.marker))}if(i.marker.inclusiveRight&&i.to==t.text.length)return!0;for(var n=void 0,L=0;L<t.markedSpans.length;++L)if(n=t.markedSpans[L],n.marker.collapsed&&!n.marker.widgetNode&&n.from==i.to&&(n.to==null||n.to!=i.from)&&(n.marker.inclusiveLeft||i.marker.inclusiveRight)&&Xi(e,t,n))return!0}function Br(e){e=ur(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 L=i.parent;L;i=L,L=i.parent)for(var H=0;H<L.children.length;++H){var Y=L.children[H];if(Y==i)break;t+=Y.height}return t}function Yi(e){if(e.height==0)return 0;for(var t=e.text.length,i,r=e;i=yr(r);){var n=i.find(0,!0);r=n.from.line,t+=n.from.ch-n.to.ch}for(r=e;i=Yt(r);){var L=i.find(0,!0);t-=r.text.length-L.from.ch,r=L.to.line,t+=r.text.length-L.to.ch}return t}function ci(e){var t=e.display,i=e.doc;t.maxLine=gt(i,i.first),t.maxLineLength=Yi(t.maxLine),t.maxLineChanged=!0,i.iter(function(r){var n=Yi(r);n>t.maxLineLength&&(t.maxLineLength=n,t.maxLine=r)})}var Ei=function(e,t,i){this.text=e,Mi(this,t),this.height=i?i(this):1};Ei.prototype.lineNo=function(){return Pt(this)},be(Ei);function ua(e,t,i,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),_i(e),Mi(e,i);var n=r?r(e):1;n!=e.height&&Lr(e,n)}function ha(e){e.parent=null,_i(e)}var Qa={},Za={};function da(e,t){if(!e||/^\s*$/.test(e))return null;var i=t.addModeClass?Za:Qa;return i[e]||(i[e]=e.replace(/\S+/g,"cm-$&"))}function jn(e,t){var i=C("span",null,null,_?"padding-right: .1px":null),r={pre:C("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 L=n?t.rest[n-1]:t.line,H=void 0;r.pos=0,r.addToken=kt,Et(e.display.measure)&&(H=$e(L,e.doc.direction))&&(r.addToken=_t(r.addToken,H)),r.map=[];var Y=t!=e.display.externalMeasured&&Pt(L);zt(L,r,He(e,L,Y)),L.styleClasses&&(L.styleClasses.bgClass&&(r.bgClass=W(L.styleClasses.bgClass,r.bgClass||"")),L.styleClasses.textClass&&(r.textClass=W(L.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(Dt(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(_){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 Ne(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=W(r.pre.className,r.textClass||"")),r}function bt(e){var t=o("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function kt(e,t,i,r,n,L,H){if(!t)return;var Y=e.splitSpaces?St(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),j&&N<9&&(q=!0),e.pos+=t.length;else{ce=document.createDocumentFragment();for(var me=0;;){Z.lastIndex=me;var De=Z.exec(t),Ae=De?De.index-me:t.length-me;if(Ae){var Fe=document.createTextNode(Y.slice(me,me+Ae));j&&N<9?ce.appendChild(o("span",[Fe])):ce.appendChild(Fe),e.map.push(e.pos,e.pos+Ae,Fe),e.col+=Ae,e.pos+=Ae}if(!De)break;me+=Ae+1;var Ve=void 0;if(De[0]==" "){var Je=e.cm.options.tabSize,tt=Je-e.col%Je;Ve=ce.appendChild(o("span",ue(tt),"cm-tab")),Ve.setAttribute("role","presentation"),Ve.setAttribute("cm-text"," "),e.col+=tt}else De[0]=="\r"||De[0]==`
`?(Ve=ce.appendChild(o("span",De[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Ve.setAttribute("cm-text",De[0]),e.col+=1):(Ve=e.cm.options.specialCharPlaceholder(De[0]),Ve.setAttribute("cm-text",De[0]),j&&N<9?ce.appendChild(o("span",[Ve])):ce.appendChild(Ve),e.col+=1);e.map.push(e.pos,e.pos+1,Ve),e.pos++}}if(e.trailingSpace=Y.charCodeAt(t.length-1)==32,i||r||n||q||L||H){var ht=i||"";r&&(ht+=r),n&&(ht+=n);var rt=o("span",[ce],ht,L);if(H)for(var ct in H)H.hasOwnProperty(ct)&&ct!="style"&&ct!="class"&&rt.setAttribute(ct,H[ct]);return e.content.appendChild(rt)}e.content.appendChild(ce)}function St(e,t){if(e.length>1&&!/ /.test(e))return e;for(var i=t,r="",n=0;n<e.length;n++){var L=e.charAt(n);L==" "&&i&&(n==e.length-1||e.charCodeAt(n+1)==32)&&(L="\xA0"),r+=L,i=L==" "}return r}function _t(e,t){return function(i,r,n,L,H,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,L,H,Y,Z);e(i,r.slice(0,me.to-q),n,L,null,Y,Z),L=null,r=r.slice(me.to-q),q=me.to}}}function Ut(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 zt(e,t,i){var r=e.markedSpans,n=e.text,L=0;if(!r){for(var H=1;H<i.length;H+=2)t.addToken(t,n.slice(L,L=i[H]),da(i[H+1],t.cm.options));return}for(var Y=n.length,Z=0,q=1,ce="",me,De,Ae=0,Fe,Ve,Je,tt,ht;;){if(Ae==Z){Fe=Ve=Je=De="",ht=null,tt=null,Ae=Infinity;for(var rt=[],ct=void 0,Ct=0;Ct<r.length;++Ct){var xt=r[Ct],Ot=xt.marker;if(Ot.type=="bookmark"&&xt.from==Z&&Ot.widgetNode)rt.push(Ot);else if(xt.from<=Z&&(xt.to==null||xt.to>Z||Ot.collapsed&&xt.to==Z&&xt.from==Z)){if(xt.to!=null&&xt.to!=Z&&Ae>xt.to&&(Ae=xt.to,Ve=""),Ot.className&&(Fe+=" "+Ot.className),Ot.css&&(De=(De?De+";":"")+Ot.css),Ot.startStyle&&xt.from==Z&&(Je+=" "+Ot.startStyle),Ot.endStyle&&xt.to==Ae&&(ct||(ct=[])).push(Ot.endStyle,xt.to),Ot.title&&((ht||(ht={})).title=Ot.title),Ot.attributes)for(var $t in Ot.attributes)(ht||(ht={}))[$t]=Ot.attributes[$t];Ot.collapsed&&(!tt||vr(tt.marker,Ot)<0)&&(tt=xt)}else xt.from>Z&&Ae>xt.from&&(Ae=xt.from)}if(ct)for(var mr=0;mr<ct.length;mr+=2)ct[mr+1]==Ae&&(Ve+=" "+ct[mr]);if(!tt||tt.from==Z)for(var qt=0;qt<rt.length;++qt)Ut(t,0,rt[qt]);if(tt&&(tt.from||0)==Z){if(Ut(t,(tt.to==null?Y+1:tt.to)-Z,tt.marker,tt.from==null),tt.to==null)return;tt.to==Z&&(tt=!1)}}if(Z>=Y)break;for(var Fr=Math.min(Y,Ae);;){if(ce){var _r=Z+ce.length;if(!tt){var or=_r>Fr?ce.slice(0,Fr-Z):ce;t.addToken(t,or,me?me+Fe:Fe,Je,Z+or.length==Ae?Ve:"",De,ht)}if(_r>=Fr){ce=ce.slice(Fr-Z),Z=Fr;break}Z=_r,Je=""}ce=n.slice(L,L=i[q++]),me=da(i[q++],t.cm.options)}}}function It(e,t,i){this.line=t,this.rest=bi(t),this.size=this.rest?Pt(te(this.rest))-i+1:1,this.node=this.text=null,this.hidden=Zr(e,t)}function Jt(e,t,i){for(var r=[],n,L=t;L<i;L=n){var H=new It(e.doc,gt(e.doc,L),L);n=L+H.size,r.push(H)}return r}var cr=null;function Mt(e){cr?cr.ops.push(e):e.ownsGroup=cr={ops:[e],delayedCallbacks:[]}}function Pi(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 Kt(e,t){var i=e.ownsGroup;if(!i)return;try{Pi(i)}finally{cr=null,t(i)}}var br=null;function Xt(e,t){var i=ut(e,t);if(!i.length)return;var r=Array.prototype.slice.call(arguments,2),n;cr?n=cr.delayedCallbacks:br?n=br:(n=br=[],setTimeout($r,0));for(var L=function(Y){n.push(function(){return i[Y].apply(null,r)})},H=0;H<i.length;++H)L(H)}function $r(){var e=br;br=null;for(var t=0;t<e.length;++t)e[t]()}function pn(e,t,i,r){for(var n=0;n<t.changes.length;n++){var L=t.changes[n];L=="text"?Ps(e,t):L=="gutter"?qa(e,t,i,r):L=="class"?ca(e,t):L=="widget"&&Is(e,t,r)}t.changes=null}function mn(e){return e.node==e.text&&(e.node=o("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),j&&N<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(o("div",null,i),r.firstChild),e.display.input.setUneditable(t.background)}}function Ja(e,t){var i=e.display.externalMeasured;return i&&i.line==t.line?(e.display.externalMeasured=null,t.measure=i.measure,i.built):jn(e,t)}function Ps(e,t){var i=t.text.className,r=Ja(e,t);t.text==t.node&&(t.node=r.pre),t.text.parentNode.replaceChild(r.pre,t.text),t.text=r.pre,r.bgClass!=t.bgClass||r.textClass!=t.textClass?(t.bgClass=r.bgClass,t.textClass=r.textClass,ca(e,t)):i&&(t.text.className=i)}function ca(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 qa(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=o("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),n.insertBefore(t.gutterBackground,t.text)}var L=t.line.gutterMarkers;if(e.options.lineNumbers||L){var H=mn(t),Y=t.gutter=o("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(Y),H.insertBefore(Y,t.text),t.line.gutterClass&&(Y.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!L||!L["CodeMirror-linenumbers"])&&(t.lineNumber=Y.appendChild(o("div",gi(e.options,i),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),L)for(var Z=0;Z<e.display.gutterSpecs.length;++Z){var q=e.display.gutterSpecs[Z].className,ce=L.hasOwnProperty(q)&&L[q];ce&&Y.appendChild(o("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=T("CodeMirror-linewidget"),n=t.node.firstChild,L=void 0;n;n=L)L=n.nextSibling,r.test(n.className)&&t.node.removeChild(n);eo(e,t,i)}function Ns(e,t,i,r){var n=Ja(e,t);return t.text=t.node=n.pre,n.bgClass&&(t.bgClass=n.bgClass),n.textClass&&(t.textClass=n.textClass),ca(e,t),qa(e,t,i,r),eo(e,t,r),t.node}function eo(e,t,i){if(to(e,t.line,t,i,!0),t.rest)for(var r=0;r<t.rest.length;r++)to(e,t.rest[r],t,i,!1)}function to(e,t,i,r,n){if(!t.widgets)return;for(var L=mn(i),H=0,Y=t.widgets;H<Y.length;++H){var Z=Y[H],q=o("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?L.insertBefore(q,i.gutter||i.text):L.appendChild(q),Xt(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(!y(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;"),d(t.display.measure,o("div",[e.node],null,i))}return e.height=e.node.parentNode.offsetHeight}function fi(e,t){for(var i=Le(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 Wn(e){return e.lineSpace.offsetTop}function fa(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function ro(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=d(e.measure,o("pre","x","CodeMirror-line-like")),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 ai(e){return fe-e.display.nativeBarWidth}function Ii(e){return e.display.scroller.clientWidth-ai(e)-e.display.barWidth}function pa(e){return e.display.scroller.clientHeight-ai(e)-e.display.barHeight}function Us(e,t,i){var r=e.options.lineWrapping,n=r&&Ii(e);if(!t.measure.heights||r&&t.measure.width!=n){var L=t.measure.heights=[];if(r){t.measure.width=n;for(var H=t.text.firstChild.getClientRects(),Y=0;Y<H.length-1;Y++){var Z=H[Y],q=H[Y+1];Math.abs(Z.bottom-q.bottom)>2&&L.push((Z.bottom+q.top)/2-i.top)}}L.push(i.bottom-i.top)}}function io(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(Pt(e.rest[n])>i)return{map:e.measure.maps[n],cache:e.measure.caches[n],before:!0}}function Fs(e,t){t=ur(t);var i=Pt(t),r=e.display.externalMeasured=new It(e.doc,t,i);r.lineN=i;var n=r.built=jn(e,r);return r.text=n.pre,d(e.display.lineMeasure,n.pre),r}function no(e,t,i,r){return oi(e,$i(e,t),i,r)}function ma(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[Ui(e,t)];var i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size)return i}function $i(e,t){var i=Pt(t),r=ma(e,i);r&&!r.text?r=null:r&&r.changes&&(pn(e,r,i,Ea(e)),e.curOp.forceUpdate=!0),r||(r=Fs(e,t));var n=io(r,t,i);return{line:t,view:r,rect:null,map:n.map,cache:n.cache,before:n.before,hasHeights:!1}}function oi(e,t,i,r,n){t.before&&(i=-1);var L=i+(r||""),H;return t.cache.hasOwnProperty(L)?H=t.cache[L]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Us(e,t.view,t.rect),t.hasHeights=!0),H=Ws(e,t,i,r),H.bogus||(t.cache[L]=H)),{left:H.left,right:H.right,top:n?H.rtop:H.top,bottom:n?H.rbottom:H.bottom}}var ao={left:0,right:0,top:0,bottom:0};function oo(e,t,i){for(var r,n,L,H,Y,Z,q=0;q<e.length;q+=3)if(Y=e[q],Z=e[q+1],t<Y?(n=0,L=1,H="left"):t<Z?(n=t-Y,L=n+1):(q==e.length-3||t==Z&&e[q+3]>t)&&(L=Z-Y,n=L-1,t>=Z&&(H="right")),n!=null){if(r=e[q+2],Y==Z&&i==(r.insertLeft?"left":"right")&&(H=i),i=="left"&&n==0)for(;q&&e[q-2]==e[q-3]&&e[q-1].insertLeft;)r=e[(q-=3)+2],H="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],H="right";break}return{node:r,start:n,end:L,collapse:H,coverStart:Y,coverEnd:Z}}function js(e,t){var i=ao;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=oo(t.map,i,r),L=n.node,H=n.start,Y=n.end,Z=n.collapse,q;if(L.nodeType==3){for(var ce=0;ce<4;ce++){for(;H&&Be(t.line.text.charAt(n.coverStart+H));)--H;for(;n.coverStart+Y<n.coverEnd&&Be(t.line.text.charAt(n.coverStart+Y));)++Y;if(j&&N<9&&H==0&&Y==n.coverEnd-n.coverStart?q=L.parentNode.getBoundingClientRect():q=js(S(L,H,Y).getClientRects(),r),q.left||q.right||H==0)break;Y=H,H=H-1,Z="right"}j&&N<11&&(q=Hs(e.display.measure,q))}else{H>0&&(Z=r="right");var me;e.options.lineWrapping&&(me=L.getClientRects()).length>1?q=me[r=="right"?me.length-1:0]:q=L.getBoundingClientRect()}if(j&&N<9&&!H&&(!q||!q.left&&!q.right)){var De=L.parentNode.getClientRects()[0];De?q={left:De.left,right:De.left+Zi(e.display),top:De.top,bottom:De.bottom}:q=ao}for(var Ae=q.top-t.rect.top,Fe=q.bottom-t.rect.top,Ve=(Ae+Fe)/2,Je=t.view.measure.heights,tt=0;tt<Je.length-1&&!(Ve<Je[tt]);tt++);var ht=tt?Je[tt-1]:0,rt=Je[tt],ct={left:(Z=="right"?q.right:q.left)-t.rect.left,right:(Z=="left"?q.left:q.right)-t.rect.left,top:ht,bottom:rt};return!q.left&&!q.right&&(ct.bogus=!0),e.options.singleCursorHeightPerLine||(ct.rtop=Ae,ct.rbottom=Fe),ct}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 so(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function lo(e){e.display.externalMeasure=null,v(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)so(e.display.view[t])}function vn(e){lo(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function uo(){return f&&u?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function ho(){return f&&u?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function ga(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 Hn(e,t,i,r,n){if(!n){var L=ga(t);i.top+=L,i.bottom+=L}if(r=="line")return i;r||(r="local");var H=Br(t);if(r=="local"?H+=Wn(e.display):H-=e.display.viewOffset,r=="page"||r=="window"){var Y=e.display.lineSpace.getBoundingClientRect();H+=Y.top+(r=="window"?0:ho());var Z=Y.left+(r=="window"?0:uo());i.left+=Z,i.right+=Z}return i.top+=H,i.bottom+=H,i}function co(e,t,i){if(i=="div")return t;var r=t.left,n=t.top;if(i=="page")r-=uo(),n-=ho();else if(i=="local"||!i){var L=e.display.sizer.getBoundingClientRect();r+=L.left,n+=L.top}var H=e.display.lineSpace.getBoundingClientRect();return{left:r-H.left,top:n-H.top}}function va(e,t,i,r,n){return r||(r=gt(e.doc,t.line)),Hn(e,r,no(e,r,t.ch,n),i)}function Jr(e,t,i,r,n,L){r=r||gt(e.doc,t.line),n||(n=$i(e,r));function H(Fe,Ve){var Je=oi(e,n,Fe,Ve?"right":"left",L);return Ve?Je.left=Je.right:Je.right=Je.left,Hn(e,r,Je,i)}var Y=$e(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 H(q=="before"?Z-1:Z,q=="before");function ce(Fe,Ve,Je){var tt=Y[Ve],ht=tt.level==1;return H(Je?Fe-1:Fe,ht!=Je)}var me=qe(Y,Z,q),De=nt,Ae=ce(Z,me,q=="before");return De!=null&&(Ae.other=ce(Z,De,q!="before")),Ae}function fo(e,t){var i=0;t=l(e.doc,t),e.options.lineWrapping||(i=Zi(e.display)*t.ch);var r=gt(e.doc,t.line),n=Br(r)+Wn(e.display);return{left:i,right:i,top:n,bottom:n+r.height}}function ya(e,t,i,r,n){var L=Ye(e,t,i);return L.xRel=n,r&&(L.outside=r),L}function ba(e,t,i){var r=e.doc;if(i+=e.display.viewOffset,i<0)return ya(r.first,0,null,-1,-1);var n=Xr(r,i),L=r.first+r.size-1;if(n>L)return ya(r.first+r.size-1,gt(r,L).text.length,null,1,1);t<0&&(t=0);for(var H=gt(r,n);;){var Y=Gs(e,H,n,t,i),Z=yi(H,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;H=gt(r,n=q.line)}}function po(e,t,i,r){r-=ga(t);var n=t.text.length,L=et(function(H){return oi(e,i,H-1).bottom<=r},n,0);return n=et(function(H){return oi(e,i,H).top>r},L,n),{begin:L,end:n}}function mo(e,t,i,r){i||(i=$i(e,t));var n=Hn(e,t,oi(e,i,r),"line").top;return po(e,t,i,n)}function xa(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-=Br(t);var L=$i(e,t),H=ga(t),Y=0,Z=t.text.length,q=!0,ce=$e(t,e.doc.direction);if(ce){var me=(e.options.lineWrapping?Ks:zs)(e,t,i,L,ce,r,n);q=me.level!=1,Y=q?me.from:me.to-1,Z=q?me.to:me.from-1}var De=null,Ae=null,Fe=et(function(Ct){var xt=oi(e,L,Ct);return xt.top+=H,xt.bottom+=H,xa(xt,r,n,!1)?(xt.top<=n&&xt.left<=r&&(De=Ct,Ae=xt),!0):!1},Y,Z),Ve,Je,tt=!1;if(Ae){var ht=r-Ae.left<Ae.right-r,rt=ht==q;Fe=De+(rt?0:1),Je=rt?"after":"before",Ve=ht?Ae.left:Ae.right}else{!q&&(Fe==Z||Fe==Y)&&Fe++,Je=Fe==0?"after":Fe==t.text.length?"before":oi(e,L,Fe-(q?1:0)).bottom+H<=n==q?"after":"before";var ct=Jr(e,Ye(i,Fe,Je),"line",t,L);Ve=ct.left,tt=n<ct.top?-1:n>=ct.bottom?1:0}return Fe=Ue(t.text,Fe,1),ya(i,Fe,Je,tt,r-Ve)}function zs(e,t,i,r,n,L,H){var Y=et(function(me){var De=n[me],Ae=De.level!=1;return xa(Jr(e,Ye(i,Ae?De.to:De.from,Ae?"before":"after"),"line",t,r),L,H,!0)},0,n.length-1),Z=n[Y];if(Y>0){var q=Z.level!=1,ce=Jr(e,Ye(i,q?Z.from:Z.to,q?"after":"before"),"line",t,r);xa(ce,L,H,!0)&&ce.top>H&&(Z=n[Y-1])}return Z}function Ks(e,t,i,r,n,L,H){var Y=po(e,t,r,H),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 Ae=n[De];if(Ae.from>=q||Ae.to<=Z)continue;var Fe=Ae.level!=1,Ve=oi(e,r,Fe?Math.min(q,Ae.to)-1:Math.max(Z,Ae.from)).right,Je=Ve<L?L-Ve+1e9:Ve-L;(!ce||me>Je)&&(ce=Ae,me=Je)}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 Ni;function Qi(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(Ni==null){Ni=o("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Ni.appendChild(document.createTextNode("x")),Ni.appendChild(o("br"));Ni.appendChild(document.createTextNode("x"))}d(e.measure,Ni);var i=Ni.offsetHeight/50;return i>3&&(e.cachedTextHeight=i),v(e.measure),i||1}function Zi(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=o("span","xxxxxxxxxx"),i=o("pre",[t],"CodeMirror-line-like");d(e.measure,i);var r=t.getBoundingClientRect(),n=(r.right-r.left)/10;return n>2&&(e.cachedCharWidth=n),n||10}function Ea(e){for(var t=e.display,i={},r={},n=t.gutters.clientLeft,L=t.gutters.firstChild,H=0;L;L=L.nextSibling,++H){var Y=e.display.gutterSpecs[H].className;i[Y]=L.offsetLeft+L.clientLeft+n,r[Y]=L.clientWidth}return{fixedPos:Sa(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:i,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Sa(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function go(e){var t=Qi(e.display),i=e.options.lineWrapping,r=i&&Math.max(5,e.display.scroller.clientWidth/Zi(e.display)-3);return function(n){if(Zr(e.doc,n))return 0;var L=0;if(n.widgets)for(var H=0;H<n.widgets.length;H++)n.widgets[H].height&&(L+=n.widgets[H].height);return i?L+(Math.ceil(n.text.length/r)||1)*t:L+t}}function Ca(e){var t=e.doc,i=go(e);t.iter(function(r){var n=i(r);n!=r.height&&Lr(r,n)})}function Bi(e,t,i,r){var n=e.display;if(!i&&Le(t).getAttribute("cm-not-content")=="true")return null;var L,H,Y=n.lineSpace.getBoundingClientRect();try{L=t.clientX-Y.left,H=t.clientY-Y.top}catch(me){return null}var Z=ba(e,L,H),q;if(r&&Z.xRel>0&&(q=gt(e.doc,Z.line).text).length==Z.ch){var ce=X(q,q.length,e.options.tabSize)-q.length;Z=Ye(Z.line,Math.max(0,Math.round((L-ro(e.display).left)/Zi(e.display))-ce))}return Z}function Ui(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 Rr(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)kr&&xi(e.doc,t)<n.viewTo&&Ci(e);else if(i<=n.viewFrom)kr&&Fn(e.doc,i+r)>n.viewFrom?Ci(e):(n.viewFrom+=r,n.viewTo+=r);else if(t<=n.viewFrom&&i>=n.viewTo)Ci(e);else if(t<=n.viewFrom){var L=Gn(e,i,i+r,1);L?(n.view=n.view.slice(L.index),n.viewFrom=L.lineN,n.viewTo+=r):Ci(e)}else if(i>=n.viewTo){var H=Gn(e,t,t,-1);H?(n.view=n.view.slice(0,H.index),n.viewTo=H.lineN):Ci(e)}else{var Y=Gn(e,t,t,-1),Z=Gn(e,i,i+r,1);Y&&Z?(n.view=n.view.slice(0,Y.index).concat(Jt(e,Y.lineN,Z.lineN)).concat(n.view.slice(Z.index)),n.viewTo+=r):Ci(e)}var q=n.externalMeasured;q&&(i<q.lineN?q.lineN+=r:t<q.lineN+q.size&&(n.externalMeasured=null))}function Si(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 L=r.view[Ui(e,t)];if(L.node==null)return;var H=L.changes||(L.changes=[]);oe(H,i)==-1&&H.push(i)}function Ci(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Gn(e,t,i,r){var n=Ui(e,t),L,H=e.display.view;if(!kr||i==e.doc.first+e.doc.size)return{index:n,lineN:i};for(var Y=e.display.viewFrom,Z=0;Z<n;Z++)Y+=H[Z].size;if(Y!=t){if(r>0){if(n==H.length-1)return null;L=Y+H[n].size-t,n++}else L=Y-t;t+=L,i+=L}for(;xi(e.doc,i)!=i;){if(n==(r<0?0:H.length-1))return null;i+=r*H[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=Jt(e,t,i),r.viewFrom=t):(r.viewFrom>t?r.view=Jt(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(Ui(e,t))),r.viewFrom=t,r.viewTo<i?r.view=r.view.concat(Jt(e,r.viewTo,i)):r.viewTo>i&&(r.view=r.view.slice(0,Ui(e,i)))),r.viewTo=i}function vo(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 yo(e,t){t===void 0&&(t=!0);for(var i=e.doc,r={},n=r.cursors=document.createDocumentFragment(),L=r.selection=document.createDocumentFragment(),H=0;H<i.sel.ranges.length;H++){if(!t&&H==i.sel.primIndex)continue;var Y=i.sel.ranges[H];if(Y.from().line>=e.display.viewTo||Y.to().line<e.display.viewFrom)continue;var Z=Y.empty();(Z||e.options.showCursorWhenSelecting)&&bo(e,Y.head,n),Z||Xs(e,Y,L)}return r}function bo(e,t,i){var r=Jr(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),n=i.appendChild(o("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 L=i.appendChild(o("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));L.style.display="",L.style.left=r.other.left+"px",L.style.top=r.other.top+"px",L.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function zn(e,t){return e.top-t.top||e.left-t.left}function Xs(e,t,i){var r=e.display,n=e.doc,L=document.createDocumentFragment(),H=ro(e.display),Y=H.left,Z=Math.max(r.sizerWidth,Ii(e)-r.sizer.offsetLeft)-H.right,q=n.direction=="ltr";function ce(rt,ct,Ct,xt){ct<0&&(ct=0),ct=Math.round(ct),xt=Math.round(xt),L.appendChild(o("div",null,"CodeMirror-selected","position: absolute; left: "+rt+`px;
top: `+ct+"px; width: "+(Ct==null?Z-rt:Ct)+`px;
height: `+(xt-ct)+"px"))}function me(rt,ct,Ct){var xt=gt(n,rt),Ot=xt.text.length,$t,mr;function qt(or,Mr){return va(e,Ye(rt,or),"div",xt,Mr)}function Fr(or,Mr,xr){var hr=mo(e,xt,null,or),sr=Mr=="ltr"==(xr=="after")?"left":"right",er=xr=="after"?hr.begin:hr.end-(/\s/.test(xt.text.charAt(hr.end-1))?2:1);return qt(er,sr)[sr]}var _r=$e(xt,n.direction);return ot(_r,ct||0,Ct==null?Ot:Ct,function(or,Mr,xr,hr){var sr=xr=="ltr",er=qt(or,sr?"left":"right"),Pr=qt(Mr-1,sr?"right":"left"),dn=ct==null&&or==0,Di=Ct==null&&Mr==Ot,Sr=hr==0,si=!_r||hr==_r.length-1;if(Pr.top-er.top<=3){var gr=(q?dn:Di)&&Sr,Ya=(q?Di:dn)&&si,mi=gr?Y:(sr?er:Pr).left,Gi=Ya?Z:(sr?Pr:er).right;ce(mi,er.top,Gi-mi,er.bottom)}else{var zi,wr,cn,$a;sr?(zi=q&&dn&&Sr?Y:er.left,wr=q?Z:Fr(or,xr,"before"),cn=q?Y:Fr(Mr,xr,"after"),$a=q&&Di&&si?Z:Pr.right):(zi=q?Fr(or,xr,"before"):Y,wr=!q&&dn&&Sr?Z:er.right,cn=!q&&Di&&si?Y:Pr.left,$a=q?Fr(Mr,xr,"after"):Z),ce(zi,er.top,wr-zi,er.bottom),er.bottom<Pr.top&&ce(Y,er.bottom,null,Pr.top),ce(cn,Pr.top,$a-cn,Pr.bottom)}(!$t||zn(er,$t)<0)&&($t=er),zn(Pr,$t)<0&&($t=Pr),(!mr||zn(er,mr)<0)&&(mr=er),zn(Pr,mr)<0&&(mr=Pr)}),{start:$t,end:mr}}var De=t.from(),Ae=t.to();if(De.line==Ae.line)me(De.line,De.ch,Ae.ch);else{var Fe=gt(n,De.line),Ve=gt(n,Ae.line),Je=ur(Fe)==ur(Ve),tt=me(De.line,De.ch,Je?Fe.text.length+1:null).end,ht=me(Ae.line,Je?0:null,Ae.ch).start;Je&&(tt.top<ht.top-2?(ce(tt.right,tt.top,null,tt.bottom),ce(Y,ht.top,ht.left,ht.bottom)):ce(tt.right,tt.top,ht.left-tt.right,tt.bottom)),tt.bottom<ht.top&&ce(Y,tt.bottom,null,ht.top)}i.appendChild(L)}function Ta(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()||Ji(e),t.cursorDiv.style.visibility=(i=!i)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function xo(e){e.state.focused||(e.display.input.focus(),wa(e))}function Eo(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Ji(e))},100)}function wa(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(Ne(e,"focus",e,t),e.state.focused=!0,F(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),_&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Ta(e)}function Ji(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(Ne(e,"blur",e,t),e.state.focused=!1,g(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function Kn(e){for(var t=e.display,i=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var n=t.view[r],L=e.options.lineWrapping,H=void 0,Y=0;if(n.hidden)continue;if(j&&N<8){var Z=n.node.offsetTop+n.node.offsetHeight;H=Z-i,i=Z}else{var q=n.node.getBoundingClientRect();H=q.bottom-q.top,!L&&n.text.firstChild&&(Y=n.text.firstChild.getBoundingClientRect().right-q.left-1)}var ce=n.line.height-H;if((ce>.005||ce<-.005)&&(Lr(n.line,H),So(n.line),n.rest))for(var me=0;me<n.rest.length;me++)So(n.rest[me]);if(Y>e.display.sizerWidth){var De=Math.ceil(Y/Zi(e.display));De>e.display.maxLineLength&&(e.display.maxLineLength=De,e.display.maxLine=n.line,e.display.maxLineChanged=!0)}}}function So(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 Vn(e,t,i){var r=i&&i.top!=null?Math.max(0,i.top):e.scroller.scrollTop;r=Math.floor(r-Wn(e));var n=i&&i.bottom!=null?i.bottom:r+e.wrapper.clientHeight,L=Xr(t,r),H=Xr(t,n);if(i&&i.ensure){var Y=i.ensure.from.line,Z=i.ensure.to.line;Y<L?(L=Y,H=Xr(t,Br(gt(t,Y))+e.wrapper.clientHeight)):Math.min(Z,t.lastLine())>=H&&(L=Xr(t,Br(gt(t,Z))-e.wrapper.clientHeight),H=Z)}return{from:L,to:Math.max(H,L+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&&!E){var L=o("div","\u200B",null,`position: absolute;
top: `+(t.top-i.viewOffset-Wn(e.display))+`px;
height: `+(t.bottom-t.top+ai(e)+i.barHeight)+`px;
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(L),L.scrollIntoView(n),e.display.lineSpace.removeChild(L)}}function $s(e,t,i,r){r==null&&(r=0);var n;!e.options.lineWrapping&&t==i&&(t=t.ch?Ye(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,i=t.sticky=="before"?Ye(t.line,t.ch+1,"before"):t);for(var L=0;L<5;L++){var H=!1,Y=Jr(e,t),Z=!i||i==t?Y:Jr(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=Aa(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&&(H=!0)),q.scrollLeft!=null&&(Fi(e,q.scrollLeft),Math.abs(e.doc.scrollLeft-me)>1&&(H=!0)),!H)break}return n}function Qs(e,t){var i=Aa(e,t);i.scrollTop!=null&&xn(e,i.scrollTop),i.scrollLeft!=null&&Fi(e,i.scrollLeft)}function Aa(e,t){var i=e.display,r=Qi(e.display);t.top<0&&(t.top=0);var n=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:i.scroller.scrollTop,L=pa(e),H={};t.bottom-t.top>L&&(t.bottom=t.top+L);var Y=e.doc.height+fa(i),Z=t.top<r,q=t.bottom>Y-r;if(t.top<n)H.scrollTop=Z?0:t.top;else if(t.bottom>n+L){var ce=Math.min(t.top,(q?Y:t.bottom)-L);ce!=n&&(H.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,Ae=Ii(e)-i.gutters.offsetWidth,Fe=t.right-t.left>Ae;return Fe&&(t.right=t.left+Ae),t.left<10?H.scrollLeft=0:t.left<De?H.scrollLeft=Math.max(0,t.left+me-(Fe?0:10)):t.right>Ae+De-3&&(H.scrollLeft=t.right+(Fe?0:10)-Ae),H}function La(e,t){if(t==null)return;Xn(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function qi(e){Xn(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)&&Xn(e),t!=null&&(e.curOp.scrollLeft=t),i!=null&&(e.curOp.scrollTop=i)}function Zs(e,t){Xn(e),e.curOp.scrollToPos=t}function Xn(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var i=fo(e,t.from),r=fo(e,t.to);Co(e,i,r,t.margin)}}function Co(e,t,i,r){var n=Aa(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;R||Da(e,{top:t}),To(e,t,!0),R&&Da(e),Cn(e,100)}function To(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 Fi(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,Do(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+fa(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?i:0,docHeight:r,scrollHeight:r+ai(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:i}}var ji=function(e,t,i){this.cm=i;var r=this.vert=o("div",[o("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),n=this.horiz=o("div",[o("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,j&&N<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};ji.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 L=e.viewWidth-e.barLeft-(i?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+L)+"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}},ji.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},ji.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},ji.prototype.zeroWidthHack=function(){var e=s&&!w?"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},ji.prototype.enableZeroWidthBar=function(e,t,i){e.style.pointerEvents="auto";function r(){var n=e.getBoundingClientRect(),L=i=="vert"?document.elementFromPoint(n.right-1,(n.top+n.bottom)/2):document.elementFromPoint((n.right+n.left)/2,n.bottom-1);L!=e?e.style.pointerEvents="none":t.set(1e3,r)}t.set(1e3,r)},ji.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 en(e,t){t||(t=En(e));var i=e.display.barWidth,r=e.display.barHeight;wo(e,t);for(var n=0;n<4&&i!=e.display.barWidth||r!=e.display.barHeight;n++)i!=e.display.barWidth&&e.options.lineWrapping&&Kn(e),wo(e,En(e)),i=e.display.barWidth,r=e.display.barHeight}function wo(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 Ao={native:ji,null:Sn};function Lo(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&g(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Ao[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),_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"?Fi(e,t):xn(e,t)},e),e.display.scrollbars.addClass&&F(e.display.wrapper,e.display.scrollbars.addClass)}var Js=0;function Wi(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},Mt(e.curOp)}function Hi(e){var t=e.curOp;t&&Kt(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 L=0;L<t.length;L++)il(t[L]);for(var H=0;H<t.length;H++)nl(t[H])}function el(e){var t=e.cm,i=t.display;ol(t),e.updateMaxLine&&ci(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 Yn(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&ka(e.cm,e.update)}function rl(e){var t=e.cm,i=t.display;e.updatedDisplay&&Kn(t),e.barMeasure=En(t),i.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=no(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+ai(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,i.sizer.offsetLeft+e.adjustWidthTo-Ii(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&&Fi(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var i=e.focus&&e.focus==M();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,i),(e.updatedDisplay||e.startHeight!=t.doc.height)&&en(t,e.barMeasure),e.updatedDisplay&&Oa(t,e.barMeasure),e.selectionChanged&&Ta(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),i&&xo(e.cm)}function nl(e){var t=e.cm,i=t.display,r=t.doc;if(e.updatedDisplay&&ko(t,e.update),i.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(i.wheelStartX=i.wheelStartY=null),e.scrollTop!=null&&To(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&Fi(t,e.scrollLeft,!0,!0),e.scrollToPos){var n=$s(t,l(r,e.scrollToPos.from),l(r,e.scrollToPos.to),e.scrollToPos.margin);Ys(t,n)}var L=e.maybeHiddenMarkers,H=e.maybeUnhiddenMarkers;if(L)for(var Y=0;Y<L.length;++Y)L[Y].lines.length||Ne(L[Y],"hide");if(H)for(var Z=0;Z<H.length;++Z)H[Z].lines.length&&Ne(H[Z],"unhide");i.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Ne(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Ur(e,t){if(e.curOp)return t();Wi(e);try{return t()}finally{Hi(e)}}function fr(e,t){return function(){if(e.curOp)return t.apply(e,arguments);Wi(e);try{return t.apply(e,arguments)}finally{Hi(e)}}}function Tr(e){return function(){if(this.curOp)return e.apply(this,arguments);Wi(this);try{return e.apply(this,arguments)}finally{Hi(this)}}}function pr(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);Wi(t);try{return e.apply(this,arguments)}finally{Hi(t)}}}function Cn(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,I(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var i=+new Date+e.options.workTime,r=Oe(e,t.highlightFrontier),n=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(L){if(r.line>=e.display.viewFrom){var H=L.styles,Y=L.text.length>e.options.maxHighlightLength?Cr(t.mode,r.state):null,Z=ye(e,L,r,!0);Y&&(r.state=Y),L.styles=Z.styles;var q=L.styleClasses,ce=Z.classes;ce?L.styleClasses=ce:q&&(L.styleClasses=null);for(var me=!H||H.length!=L.styles.length||q!=ce&&(!q||!ce||q.bgClass!=ce.bgClass||q.textClass!=ce.textClass),De=0;!me&&De<H.length;++De)me=H[De]!=L.styles[De];me&&n.push(r.line),L.stateAfter=r.save(),r.nextLine()}else L.text.length<=e.options.maxHighlightLength&&mt(e,L.text,r),L.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&&Ur(e,function(){for(var L=0;L<n.length;L++)Si(e,n[L],"text")})}var Yn=function(e,t,i){var r=e.display;this.viewport=t,this.visible=Vn(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=Ii(e),this.force=i,this.dims=Ea(e),this.events=[]};Yn.prototype.signal=function(e,t){ve(e,t)&&this.events.push(arguments)},Yn.prototype.finish=function(){for(var e=0;e<this.events.length;e++)Ne.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=ai(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=ai(e)+"px",t.scrollbarsClipped=!0)}function sl(e){if(e.hasFocus())return null;var t=M();if(!t||!y(e.display.lineDiv,t))return null;var i={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&y(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==M())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&y(document.body,e.anchorNode)&&y(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 ka(e,t){var i=e.display,r=e.doc;if(t.editorIsHidden)return Ci(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&&vo(e)==0)return!1;Ro(e)&&(Ci(e),t.dims=Ea(e));var n=r.first+r.size,L=Math.max(t.visible.from-e.options.viewportMargin,r.first),H=Math.min(n,t.visible.to+e.options.viewportMargin);i.viewFrom<L&&L-i.viewFrom<20&&(L=Math.max(r.first,i.viewFrom)),i.viewTo>H&&i.viewTo-H<20&&(H=Math.min(n,i.viewTo)),kr&&(L=xi(e.doc,L),H=Fn(e.doc,H));var Y=L!=i.viewFrom||H!=i.viewTo||i.lastWrapHeight!=t.wrapperHeight||i.lastWrapWidth!=t.wrapperWidth;Vs(e,L,H),i.viewOffset=Br(gt(e.doc,i.viewFrom)),e.display.mover.style.top=i.viewOffset+"px";var Z=vo(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),v(i.cursorDiv),v(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 ko(e,t){for(var i=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==Ii(e)){if(i&&i.top!=null&&(i={top:Math.min(e.doc.height+fa(e.display)-pa(e),i.top)}),t.visible=Vn(e.display,e.doc,i),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=Vn(e.display,e.doc,i));if(!ka(e,t))break;Kn(e);var n=En(e);yn(e),en(e,n),Oa(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 Da(e,t){var i=new Yn(e,t);if(ka(e,i)){Kn(e),ko(e,i);var r=En(e);yn(e),en(e,r),Oa(e,r),i.finish()}}function ul(e,t,i){var r=e.display,n=e.options.lineNumbers,L=r.lineDiv,H=L.firstChild;function Y(Fe){var Ve=Fe.nextSibling;return _&&s&&e.display.currentWheelTarget==Fe?Fe.style.display="none":Fe.parentNode.removeChild(Fe),Ve}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!=L){var De=Ns(e,me,q,i);L.insertBefore(De,H)}else{for(;H!=me.node;)H=Y(H);var Ae=n&&t!=null&&t<=q&&me.lineNumber;me.changes&&(oe(me.changes,"gutter")>-1&&(Ae=!1),pn(e,me,q,i)),Ae&&(v(me.lineNumber),me.lineNumber.appendChild(document.createTextNode(gi(e.options,q)))),H=me.node.nextSibling}q+=me.size}for(;H;)H=Y(H)}function Ra(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Oa(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+ai(e)+"px"}function Do(e){var t=e.display,i=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var r=Sa(t)-t.scroller.scrollLeft+e.doc.scrollLeft,n=t.gutters.offsetWidth,L=r+"px",H=0;H<i.length;H++)if(!i[H].hidden){e.options.fixedGutter&&(i[H].gutter&&(i[H].gutter.style.left=L),i[H].gutterBackground&&(i[H].gutterBackground.style.left=L));var Y=i[H].alignable;if(Y)for(var Z=0;Z<Y.length;Z++)Y[Z].style.left=L}e.options.fixedGutter&&(t.gutters.style.left=r+n+"px")}function Ro(e){if(!e.options.lineNumbers)return!1;var t=e.doc,i=gi(e.options,t.first+t.size-1),r=e.display;if(i.length!=r.lineNumChars){var n=r.measure.appendChild(o("div",[o("div",i)],"CodeMirror-linenumber CodeMirror-gutter-elt")),L=n.firstChild.offsetWidth,H=n.offsetWidth-L;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(L,r.lineGutter.offsetWidth-H)+1,r.lineNumWidth=r.lineNumInnerWidth+H,r.lineNumChars=r.lineNumInnerWidth?i.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",Ra(e.display),!0}return!1}function _a(e,t){for(var i=[],r=!1,n=0;n<e.length;n++){var L=e[n],H=null;if(typeof L!="string"&&(H=L.style,L=L.className),L=="CodeMirror-linenumbers")if(t)r=!0;else continue;i.push({className:L,style:H})}return t&&!r&&i.push({className:"CodeMirror-linenumbers",style:null}),i}function Oo(e){var t=e.gutters,i=e.gutterSpecs;v(t),e.lineGutter=null;for(var r=0;r<i.length;++r){var n=i[r],L=n.className,H=n.style,Y=t.appendChild(o("div",null,"CodeMirror-gutter "+L));H&&(Y.style.cssText=H),L=="CodeMirror-linenumbers"&&(e.lineGutter=Y,Y.style.width=(e.lineNumWidth||1)+"px")}t.style.display=i.length?"":"none",Ra(e)}function Tn(e){Oo(e.display),Rr(e),Do(e)}function hl(e,t,i,r){var n=this;this.input=i,n.scrollbarFiller=o("div",null,"CodeMirror-scrollbar-filler"),n.scrollbarFiller.setAttribute("cm-not-content","true"),n.gutterFiller=o("div",null,"CodeMirror-gutter-filler"),n.gutterFiller.setAttribute("cm-not-content","true"),n.lineDiv=C("div",null,"CodeMirror-code"),n.selectionDiv=o("div",null,null,"position: relative; z-index: 1"),n.cursorDiv=o("div",null,"CodeMirror-cursors"),n.measure=o("div",null,"CodeMirror-measure"),n.lineMeasure=o("div",null,"CodeMirror-measure"),n.lineSpace=C("div",[n.measure,n.lineMeasure,n.selectionDiv,n.cursorDiv,n.lineDiv],null,"position: relative; outline: none");var L=C("div",[n.lineSpace],"CodeMirror-lines");n.mover=o("div",[L],null,"position: relative"),n.sizer=o("div",[n.mover],"CodeMirror-sizer"),n.sizerWidth=null,n.heightForcer=o("div",null,null,"position: absolute; height: "+fe+"px; width: 1px;"),n.gutters=o("div",null,"CodeMirror-gutters"),n.lineGutter=null,n.scroller=o("div",[n.sizer,n.heightForcer,n.gutters],"CodeMirror-scroll"),n.scroller.setAttribute("tabIndex","-1"),n.wrapper=o("div",[n.scrollbarFiller,n.gutterFiller,n.scroller],"CodeMirror"),j&&N<8&&(n.gutters.style.zIndex=-1,n.scroller.style.paddingRight=0),!_&&!(R&&a)&&(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=_a(r.gutters,r.lineNumbers),Oo(n),i.init(n)}var $n=0,zr=null;j?zr=-.53:R?zr=15:f?zr=-.7:P&&(zr=-1/3);function _o(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 dl(e){var t=_o(e);return t.x*=zr,t.y*=zr,t}function Mo(e,t){var i=_o(t),r=i.x,n=i.y,L=e.display,H=L.scroller,Y=H.scrollWidth>H.clientWidth,Z=H.scrollHeight>H.clientHeight;if(!(r&&Y||n&&Z))return;if(n&&s&&_){e:for(var q=t.target,ce=L.view;q!=H;q=q.parentNode)for(var me=0;me<ce.length;me++)if(ce[me].node==q){e.display.currentWheelTarget=q;break e}}if(r&&!R&&!x&&zr!=null){n&&Z&&xn(e,Math.max(0,H.scrollTop+n*zr)),Fi(e,Math.max(0,H.scrollLeft+r*zr)),(!n||n&&Z)&&re(t),L.wheelStartX=null;return}if(n&&zr!=null){var De=n*zr,Ae=e.doc.scrollTop,Fe=Ae+L.wrapper.clientHeight;De<0?Ae=Math.max(0,Ae+De-50):Fe=Math.min(e.doc.height,Fe+De+50),Da(e,{top:Ae,bottom:Fe})}$n<20&&(L.wheelStartX==null?(L.wheelStartX=H.scrollLeft,L.wheelStartY=H.scrollTop,L.wheelDX=r,L.wheelDY=n,setTimeout(function(){if(L.wheelStartX==null)return;var Ve=H.scrollLeft-L.wheelStartX,Je=H.scrollTop-L.wheelStartY,tt=Je&&L.wheelDY&&Je/L.wheelDY||Ve&&L.wheelDX&&Ve/L.wheelDX;if(L.wheelStartX=L.wheelStartY=null,!tt)return;zr=(zr*$n+tt)/($n+1),++$n},200)):(L.wheelDX+=r,L.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(!ti(i.anchor,r.anchor)||!ti(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 Ht(hi(this.ranges[t].anchor),hi(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(Tt(t,r.from())>=0&&Tt(e,r.to())<=0)return i}return-1};var Ht=function(e,t){this.anchor=e,this.head=t};Ht.prototype.from=function(){return Ri(this.anchor,this.head)},Ht.prototype.to=function(){return di(this.anchor,this.head)},Ht.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function qr(e,t,i){var r=e&&e.options.selectionsMayTouch,n=t[i];t.sort(function(De,Ae){return Tt(De.from(),Ae.from())}),i=oe(t,n);for(var L=1;L<t.length;L++){var H=t[L],Y=t[L-1],Z=Tt(Y.to(),H.from());if(r&&!H.empty()?Z>0:Z>=0){var q=Ri(Y.from(),H.from()),ce=di(Y.to(),H.to()),me=Y.empty()?H.from()==H.head:Y.from()==Y.head;L<=i&&--i,t.splice(--L,2,new Ht(me?ce:q,me?q:ce))}}return new Kr(t,i)}function Ti(e,t){return new Kr([new Ht(e,t||e)],0)}function wi(e){return e.text?Ye(e.from.line+e.text.length-1,te(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Po(e,t){if(Tt(e,t.from)<0)return e;if(Tt(e,t.to)<=0)return wi(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+=wi(t).ch-t.to.ch),Ye(i,r)}function Ma(e,t){for(var i=[],r=0;r<e.sel.ranges.length;r++){var n=e.sel.ranges[r];i.push(new Ht(Po(n.anchor,t),Po(n.head,t)))}return qr(e.cm,i,e.sel.primIndex)}function Io(e,t,i){return e.line==t.line?Ye(i.line,e.ch-t.ch+i.ch):Ye(i.line+(e.line-t.line),e.ch)}function cl(e,t,i){for(var r=[],n=Ye(e.first,0),L=n,H=0;H<t.length;H++){var Y=t[H],Z=Io(Y.from,n,L),q=Io(wi(Y),n,L);if(n=Y.to,L=q,i=="around"){var ce=e.sel.ranges[H],me=Tt(ce.head,ce.anchor)<0;r[H]=new Ht(me?q:Z,me?Z:q)}else r[H]=new Ht(Z,Z)}return new Kr(r,e.sel.primIndex)}function Pa(e){e.doc.mode=Wt(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&&Rr(e)}function No(e,t){return t.from.ch==0&&t.to.ch==0&&te(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Ia(e,t,i,r){function n(ht){return i?i[ht]:null}function L(ht,rt,ct){ua(ht,rt,ct,r),Xt(ht,"change",ht,t)}function H(ht,rt){for(var ct=[],Ct=ht;Ct<rt;++Ct)ct.push(new Ei(q[Ct],n(Ct),r));return ct}var Y=t.from,Z=t.to,q=t.text,ce=gt(e,Y.line),me=gt(e,Z.line),De=te(q),Ae=n(q.length-1),Fe=Z.line-Y.line;if(t.full)e.insert(0,H(0,q.length)),e.remove(q.length,e.size-q.length);else if(No(e,t)){var Ve=H(0,q.length-1);L(me,me.text,Ae),Fe&&e.remove(Y.line,Fe),Ve.length&&e.insert(Y.line,Ve)}else if(ce==me)if(q.length==1)L(ce,ce.text.slice(0,Y.ch)+De+ce.text.slice(Z.ch),Ae);else{var Je=H(1,q.length-1);Je.push(new Ei(De+ce.text.slice(Z.ch),Ae,r)),L(ce,ce.text.slice(0,Y.ch)+q[0],n(0)),e.insert(Y.line+1,Je)}else if(q.length==1)L(ce,ce.text.slice(0,Y.ch)+q[0]+me.text.slice(Z.ch),n(0)),e.remove(Y.line+1,Fe);else{L(ce,ce.text.slice(0,Y.ch)+q[0],n(0)),L(me,De+me.text.slice(Z.ch),Ae);var tt=H(1,q.length-1);Fe>1&&e.remove(Y.line+1,Fe-1),e.insert(Y.line+1,tt)}Xt(e,"change",e,t)}function Ai(e,t,i){function r(n,L,H){if(n.linked)for(var Y=0;Y<n.linked.length;++Y){var Z=n.linked[Y];if(Z.doc==L)continue;var q=H&&Z.sharedHist;if(i&&!q)continue;t(Z.doc,q),r(Z.doc,n,q)}}r(e,null,!0)}function Bo(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,Ca(e),Pa(e),Uo(e),e.options.lineWrapping||ci(e),e.options.mode=t.modeOption,Rr(e)}function Uo(e){(e.doc.direction=="rtl"?F:g)(e.display.lineDiv,"CodeMirror-rtl")}function fl(e){Ur(e,function(){Uo(e),Rr(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 Na(e,t){var i={from:hi(t.from),to:wi(t),text:jr(e,t.from,t.to)};return Wo(e,i,t.from.line,t.to.line+1),Ai(e,function(r){return Wo(r,i,t.from.line,t.to.line+1)},!0),i}function Fo(e){for(;e.length;){var t=te(e);if(t.ranges)e.pop();else break}}function pl(e,t){if(t)return Fo(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 jo(e,t,i,r){var n=e.history;n.undone.length=0;var L=+new Date,H,Y;if((n.lastOp==r||n.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&n.lastModTime>L-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(H=pl(n,n.lastOp==r)))Y=te(H.changes),Tt(t.from,t.to)==0&&Tt(t.from,Y.to)==0?Y.to=wi(t):H.changes.push(Na(e,t));else{var Z=te(n.done);for((!Z||!Z.ranges)&&Zn(e.sel,n.done),H={changes:[Na(e,t)],generation:n.generation},n.done.push(H);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=L,n.lastOp=n.lastSelOp=r,n.lastOrigin=n.lastSelOrigin=t.origin,Y||Ne(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,L=r&&r.origin;i==n.lastSelOp||L&&n.lastSelOrigin==L&&(n.lastModTime==n.lastSelTime&&n.lastOrigin==L||ml(e,L,te(n.done),t))?n.done[n.done.length-1]=t:Zn(t,n.done),n.lastSelTime=+new Date,n.lastSelOrigin=L,n.lastSelOp=i,r&&r.clearRedo!==!1&&Fo(n.undone)}function Zn(e,t){var i=te(t);i&&i.ranges&&i.equals(e)||t.push(e)}function Wo(e,t,i,r){var n=t["spans_"+e.id],L=0;e.iter(Math.max(e.first,i),Math.min(e.first+e.size,r),function(H){H.markedSpans&&((n||(n=t["spans_"+e.id]={}))[L]=H.markedSpans),++L})}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 Ho(e,t){var i=yl(e,t),r=Ir(e,t);if(!i)return r;if(!r)return i;for(var n=0;n<i.length;++n){var L=i[n],H=r[n];if(L&&H){e:for(var Y=0;Y<H.length;++Y){for(var Z=H[Y],q=0;q<L.length;++q)if(L[q].marker==Z.marker)continue e;L.push(Z)}}else H&&(i[n]=H)}return i}function tn(e,t,i){for(var r=[],n=0;n<e.length;++n){var L=e[n];if(L.ranges){r.push(i?Kr.prototype.deepCopy.call(L):L);continue}var H=L.changes,Y=[];r.push({changes:Y});for(var Z=0;Z<H.length;++Z){var q=H[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 Ba(e,t,i,r){if(r){var n=e.anchor;if(i){var L=Tt(t,n)<0;L!=Tt(i,n)<0?(n=t,t=i):L!=Tt(t,i)<0&&(t=i)}return new Ht(n,t)}else return new Ht(i||t,t)}function Jn(e,t,i,r,n){n==null&&(n=e.cm&&(e.cm.display.shift||e.extend)),Er(e,new Kr([Ba(e.sel.primary(),t,i,n)],0),r)}function Go(e,t,i){for(var r=[],n=e.cm&&(e.cm.display.shift||e.extend),L=0;L<e.sel.ranges.length;L++)r[L]=Ba(e.sel.ranges[L],t[L],null,n);var H=qr(e.cm,r,e.sel.primIndex);Er(e,H,i)}function Ua(e,t,i,r){var n=e.sel.ranges.slice(0);n[t]=i,Er(e,qr(e.cm,n,e.sel.primIndex),r)}function zo(e,t,i,r){Er(e,Ti(t,i),r)}function bl(e,t,i){var r={ranges:t.ranges,update:function(n){this.ranges=[];for(var L=0;L<n.length;L++)this.ranges[L]=new Ht(l(e,n[L].anchor),l(e,n[L].head))},origin:i&&i.origin};return Ne(e,"beforeSelectionChange",e,r),e.cm&&Ne(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?qr(e.cm,r.ranges,r.ranges.length-1):t}function Ko(e,t,i){var r=e.history.done,n=te(r);n&&n.ranges?(r[r.length-1]=t,qn(e,t,i)):Er(e,t,i)}function Er(e,t,i){qn(e,t,i),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,i)}function qn(e,t,i){(ve(e,"beforeSelectionChange")||e.cm&&ve(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,i));var r=i&&i.bias||(Tt(t.primary().head,e.sel.primary().head)<0?-1:1);Vo(e,Yo(e,t,r,!0)),!(i&&i.scroll===!1)&&e.cm&&qi(e.cm)}function Vo(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,Se(e.cm)),Xt(e,"cursorActivity",e)}function Xo(e){Vo(e,Yo(e,e.sel,null,!1))}function Yo(e,t,i,r){for(var n,L=0;L<t.ranges.length;L++){var H=t.ranges[L],Y=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[L],Z=ea(e,H.anchor,Y&&Y.anchor,i,r),q=ea(e,H.head,Y&&Y.head,i,r);(n||Z!=H.anchor||q!=H.head)&&(n||(n=t.ranges.slice(0,L)),n[L]=new Ht(Z,q))}return n?qr(e.cm,n,t.primIndex):t}function rn(e,t,i,r,n){var L=gt(e,t.line);if(L.markedSpans)for(var H=0;H<L.markedSpans.length;++H){var Y=L.markedSpans[H],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&&(Ne(Z,"beforeCursorEnter"),Z.explicitlyCleared))if(L.markedSpans){--H;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=$o(e,me,-r,me&&me.line==t.line?L:null)),me&&me.line==t.line&&(De=Tt(me,i))&&(r<0?De<0:De>0))return rn(e,me,t,r,n)}var Ae=Z.find(r<0?-1:1);return(r<0?q:ce)&&(Ae=$o(e,Ae,r,Ae.line==t.line?L:null)),Ae?rn(e,Ae,t,r,n):null}}return t}function ea(e,t,i,r,n){var L=r||1,H=rn(e,t,i,L,n)||!n&&rn(e,t,i,L,!0)||rn(e,t,i,-L,n)||!n&&rn(e,t,i,-L,!0);return H||(e.cantEdit=!0,Ye(e.first,0))}function $o(e,t,i,r){return i<0&&t.ch==0?t.line>e.first?l(e,Ye(t.line-1)):null:i>0&&t.ch==(r||gt(e,t.line)).text.length?t.line<e.first+e.size-1?Ye(t.line+1,0):null:new Ye(t.line,t.ch+i)}function Qo(e){e.setSelection(Ye(e.firstLine(),0),Ye(e.lastLine()),xe)}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,L,H,Y){n&&(r.from=l(e,n)),L&&(r.to=l(e,L)),H&&(r.text=H),Y!==void 0&&(r.origin=Y)}),Ne(e,"beforeChange",e,r),e.cm&&Ne(e.cm,"beforeChange",e.cm,r),r.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:r.from,to:r.to,text:r.text,origin:r.origin}}function nn(e,t,i){if(e.cm){if(!e.cm.curOp)return fr(e.cm,nn)(e,t,i);if(e.cm.state.suppressEdits)return}if((ve(e,"beforeChange")||e.cm&&ve(e.cm,"beforeChange"))&&(t=Zo(e,t,!0),!t))return;var r=Ki&&!i&&Oi(e,t.from,t.to);if(r)for(var n=r.length-1;n>=0;--n)Jo(e,{from:r[n].from,to:r[n].to,text:n?[""]:t.text,origin:t.origin});else Jo(e,t)}function Jo(e,t){if(t.text.length==1&&t.text[0]==""&&Tt(t.from,t.to)==0)return;var i=Ma(e,t);jo(e,t,i,e.cm?e.cm.curOp.id:NaN),An(e,t,i,Ir(e,t));var r=[];Ai(e,function(n,L){!L&&oe(r,n.history)==-1&&(rs(n.history,t),r.push(n.history)),An(n,t,null,Ir(n,t))})}function ta(e,t,i){var r=e.cm&&e.cm.state.suppressEdits;if(r&&!i)return;for(var n=e.history,L,H=e.sel,Y=t=="undo"?n.done:n.undone,Z=t=="undo"?n.undone:n.done,q=0;q<Y.length&&!(L=Y[q],i?L.ranges&&!L.equals(e.sel):!L.ranges);q++);if(q==Y.length)return;for(n.lastOrigin=n.lastSelOrigin=null;;)if(L=Y.pop(),L.ranges){if(Zn(L,Z),i&&!L.equals(e.sel)){Er(e,L,{clearRedo:!1});return}H=L}else if(r){Y.push(L);return}else break;var ce=[];Zn(H,Z),Z.push({changes:ce,generation:n.generation}),n.generation=L.generation||++n.maxGeneration;for(var me=ve(e,"beforeChange")||e.cm&&ve(e.cm,"beforeChange"),De=function(Ve){var Je=L.changes[Ve];if(Je.origin=t,me&&!Zo(e,Je,!1))return Y.length=0,{};ce.push(Na(e,Je));var tt=Ve?Ma(e,Je):te(Y);An(e,Je,tt,Ho(e,Je)),!Ve&&e.cm&&e.cm.scrollIntoView({from:Je.from,to:wi(Je)});var ht=[];Ai(e,function(rt,ct){!ct&&oe(ht,rt.history)==-1&&(rs(rt.history,Je),ht.push(rt.history)),An(rt,Je,null,Ho(rt,Je))})},Ae=L.changes.length-1;Ae>=0;--Ae){var Fe=De(Ae);if(Fe)return Fe.v}}function qo(e,t){if(t==0)return;if(e.first+=t,e.sel=new Kr(de(e.sel.ranges,function(n){return new Ht(Ye(n.anchor.line+t,n.anchor.ch),Ye(n.head.line+t,n.head.ch))}),e.sel.primIndex),e.cm){Rr(e.cm,e.first,e.first-t,t);for(var i=e.cm.display,r=i.viewFrom;r<i.viewTo;r++)Si(e.cm,r,"gutter")}}function An(e,t,i,r){if(e.cm&&!e.cm.curOp)return fr(e.cm,An)(e,t,i,r);if(t.to.line<e.first){qo(e,t.text.length-1-(t.to.line-t.from.line));return}if(t.from.line>e.lastLine())return;if(t.from.line<e.first){var n=t.text.length-1-(e.first-t.from.line);qo(e,n),t={from:Ye(e.first,0),to:Ye(t.to.line+n,t.to.ch),text:[te(t.text)],origin:t.origin}}var L=e.lastLine();t.to.line>L&&(t={from:t.from,to:Ye(L,gt(e,L).text.length),text:[t.text[0]],origin:t.origin}),t.removed=jr(e,t.from,t.to),i||(i=Ma(e,t)),e.cm?xl(e.cm,t,r):Ia(e,t,r),qn(e,i,xe),e.cantEdit&&ea(e,Ye(e.firstLine(),0))&&(e.cantEdit=!1)}function xl(e,t,i){var r=e.doc,n=e.display,L=t.from,H=t.to,Y=!1,Z=L.line;e.options.lineWrapping||(Z=Pt(ur(gt(r,L.line))),r.iter(Z,H.line+1,function(Ae){if(Ae==n.maxLine)return Y=!0,!0})),r.sel.contains(t.from,t.to)>-1&&Se(e),Ia(r,t,i,go(e)),e.options.lineWrapping||(r.iter(Z,L.line+t.text.length,function(Ae){var Fe=Yi(Ae);Fe>n.maxLineLength&&(n.maxLine=Ae,n.maxLineLength=Fe,n.maxLineChanged=!0,Y=!1)}),Y&&(e.curOp.updateMaxLine=!0)),Yr(r,L.line),Cn(e,400);var q=t.text.length-(H.line-L.line)-1;t.full?Rr(e):L.line==H.line&&t.text.length==1&&!No(e.doc,t)?Si(e,L.line,"text"):Rr(e,L.line,H.line+1,q);var ce=ve(e,"changes"),me=ve(e,"change");if(me||ce){var De={from:L,to:H,text:t.text,removed:t.removed,origin:t.origin};me&&Xt(e,"change",e,De),ce&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(De)}e.display.selForContextMenu=null}function an(e,t,i,r,n){var L;r||(r=i),Tt(r,i)<0&&(L=[r,i],i=L[0],r=L[1]),typeof t=="string"&&(t=e.splitLines(t)),nn(e,{from:i,to:r,text:t,origin:n})}function es(e,t,i,r){i<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function ts(e,t,i,r){for(var n=0;n<e.length;++n){var L=e[n],H=!0;if(L.ranges){L.copied||(L=e[n]=L.deepCopy(),L.copied=!0);for(var Y=0;Y<L.ranges.length;Y++)es(L.ranges[Y].anchor,t,i,r),es(L.ranges[Y].head,t,i,r);continue}for(var Z=0;Z<L.changes.length;++Z){var q=L.changes[Z];if(i<q.from.line)q.from=Ye(q.from.line+r,q.from.ch),q.to=Ye(q.to.line+r,q.to.ch);else if(t<=q.to.line){H=!1;break}}H||(e.splice(0,n+1),n=0)}}function rs(e,t){var i=t.from.line,r=t.to.line,n=t.text.length-(r-i)-1;ts(e.done,i,r,n),ts(e.undone,i,r,n)}function Ln(e,t,i,r){var n=t,L=t;return typeof t=="number"?L=gt(e,K(e,t)):n=Pt(t),n==null?null:(r(L,n)&&e.cm&&Si(e.cm,n,i),L)}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,ha(n),Xt(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 L=Math.min(t,n-e),H=r.height;if(r.removeInner(e,L),this.height-=H-r.height,n==L&&(this.children.splice(i--,1),r.parent=null),(t-=L)==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],L=n.chunkSize();if(e<=L){if(n.insertInner(e,t,i),n.lines&&n.lines.length>50){for(var H=n.lines.length%25+25,Y=H;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,H),this.maybeSpill()}break}e-=L}},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],L=n.chunkSize();if(e<L){var H=Math.min(t,L-e);if(n.iterN(e,H,i))return!0;if((t-=H)==0)break;e=0}else e-=L}}};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=Pt(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 L=gn(this);Lr(i,Math.max(0,i.height-L)),e&&(Ur(e,function(){is(e,i,-L),Si(e,r,"widget")}),Xt(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;Zr(this.doc,r)||Lr(r,r.height+n),i&&Ur(i,function(){i.curOp.forceUpdate=!0,is(i,r,n),Xt(i,"lineWidgetChanged",i,e,Pt(r))})},be(Rn);function is(e,t,i){Br(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&La(e,i)}function El(e,t,i,r){var n=new Rn(e,i,r),L=e.cm;return L&&n.noHScroll&&(L.display.alignWidgets=!0),Ln(e,t,"widget",function(H){var Y=H.widgets||(H.widgets=[]);if(n.insertAt==null?Y.push(n):Y.splice(Math.min(Y.length-1,Math.max(0,n.insertAt)),0,n),n.line=H,L&&!Zr(e,H)){var Z=Br(H)<e.scrollTop;Lr(H,H.height+gn(n)),Z&&La(L,n.height),L.curOp.forceUpdate=!0}return!0}),L&&Xt(L,"lineWidgetAdded",L,n,typeof t=="number"?t:Pt(t)),n}var ns=0,Li=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++ns};Li.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&Wi(e),ve(this,"clear")){var i=this.find();i&&Xt(this,"clear",i.from,i.to)}for(var r=null,n=null,L=0;L<this.lines.length;++L){var H=this.lines[L],Y=Qr(H.markedSpans,this);e&&!this.collapsed?Si(e,Pt(H),"text"):e&&(Y.to!=null&&(n=Pt(H)),Y.from!=null&&(r=Pt(H))),H.markedSpans=ii(H.markedSpans,Y),Y.from==null&&this.collapsed&&!Zr(this.doc,H)&&e&&Lr(H,Qi(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var Z=0;Z<this.lines.length;++Z){var q=ur(this.lines[Z]),ce=Yi(q);ce>e.display.maxLineLength&&(e.display.maxLine=q,e.display.maxLineLength=ce,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&Rr(e,r,n+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Xo(e.doc)),e&&Xt(e,"markerCleared",e,this,r,n),t&&Hi(e),this.parent&&this.parent.clear()},Li.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var i,r,n=0;n<this.lines.length;++n){var L=this.lines[n],H=Qr(L.markedSpans,this);if(H.from!=null&&(i=Ye(t?L:Pt(L),H.from),e==-1))return i;if(H.to!=null&&(r=Ye(t?L:Pt(L),H.to),e==1))return r}return i&&{from:i,to:r}},Li.prototype.changed=function(){var e=this,t=this.find(-1,!0),i=this,r=this.doc.cm;if(!t||!r)return;Ur(r,function(){var n=t.line,L=Pt(t.line),H=ma(r,L);if(H&&(so(H),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!Zr(i.doc,n)&&i.height!=null){var Y=i.height;i.height=null;var Z=gn(i)-Y;Z&&Lr(n,n.height+Z)}Xt(r,"markerChanged",r,e)})},Li.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)},Li.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)}},be(Li);function on(e,t,i,r,n){if(r&&r.shared)return Sl(e,t,i,r,n);if(e.cm&&!e.cm.curOp)return fr(e.cm,on)(e,t,i,r,n);var L=new Li(e,n),H=Tt(t,i);if(r&&B(r,L,!1),H>0||H==0&&L.clearWhenEmpty!==!1)return L;if(L.replacedWith&&(L.collapsed=!0,L.widgetNode=C("span",[L.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||L.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(L.widgetNode.insertLeft=!0)),L.collapsed){if(lr(e,t.line,t,i,L)||t.line!=i.line&&lr(e,i.line,t,i,L))throw new Error("Inserting collapsed marker partially overlapping an existing one");ri()}L.addToHistory&&jo(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&&L.collapsed&&!Z.options.lineWrapping&&ur(me)==Z.display.maxLine&&(q=!0),L.collapsed&&Y!=t.line&&Lr(me,0),Gr(me,new vi(L,Y==t.line?t.ch:null,Y==i.line?i.ch:null)),++Y}),L.collapsed&&e.iter(t.line,i.line+1,function(me){Zr(e,me)&&Lr(me,0)}),L.clearOnEnter&&_e(L,"beforeCursorEnter",function(){return L.clear()}),L.readOnly&&(Dr(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),L.collapsed&&(L.id=++ns,L.atomic=!0),Z){if(q&&(Z.curOp.updateMaxLine=!0),L.collapsed)Rr(Z,t.line,i.line+1);else if(L.className||L.startStyle||L.endStyle||L.css||L.attributes||L.title)for(var ce=t.line;ce<=i.line;ce++)Si(Z,ce,"text");L.atomic&&Xo(Z.doc),Xt(Z,"markerAdded",Z,L)}return L}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();Xt(this,"clear")},On.prototype.find=function(e,t){return this.primary.find(e,t)},be(On);function Sl(e,t,i,r,n){r=B(r),r.shared=!1;var L=[on(e,t,i,r,n)],H=L[0],Y=r.widgetNode;return Ai(e,function(Z){Y&&(r.widgetNode=Y.cloneNode(!0)),L.push(on(Z,l(Z,t),l(Z,i),r,n));for(var q=0;q<Z.linked.length;++q)if(Z.linked[q].isParent)return;H=te(L)}),new On(L,H)}function as(e){return e.findMarks(Ye(e.first,0),e.clipPos(Ye(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(),L=e.clipPos(n.from),H=e.clipPos(n.to);if(Tt(L,H)){var Y=on(e,L,H,r.primary,r.primary.type);r.markers.push(Y),Y.parent=r}}}function Tl(e){for(var t=function(r){var n=e[r],L=[n.primary.doc];Ai(n.primary.doc,function(Z){return L.push(Z)});for(var H=0;H<n.markers.length;H++){var Y=n.markers[H];oe(L,Y.doc)==-1&&(Y.parent=null,n.markers.splice(H--,1))}},i=0;i<e.length;i++)t(i)}var wl=0,Or=function(e,t,i,r,n){if(!(this instanceof Or))return new Or(e,t,i,r,n);i==null&&(i=0),Dn.call(this,[new kn([new Ei("",null)])]),this.first=i,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=i;var L=Ye(i,0);this.sel=Ti(L),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)),Ia(this,{from:L,to:L,text:e}),Er(this,Ti(L),xe)};Or.prototype=Re(Dn.prototype,{constructor:Or,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:pr(function(e){var t=Ye(this.first,0),i=this.first+this.size-1;nn(this,{from:t,to:Ye(i,gt(this,i).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&bn(this.cm,0,0),Er(this,Ti(t),xe)}),replaceRange:function(e,t,i,r){t=l(this,t),i=i?l(this,i):t,an(this,e,t,i,r)},getRange:function(e,t,i){var r=jr(this,l(this,e),l(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(ui(this,e))return gt(this,e)},getLineNumber:function(e){return Pt(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=gt(this,e)),ur(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return l(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:pr(function(e,t,i){zo(this,l(this,typeof e=="number"?Ye(e,t||0):e),null,i)}),setSelection:pr(function(e,t,i){zo(this,l(this,e),l(this,t||e),i)}),extendSelection:pr(function(e,t,i){Jn(this,l(this,e),t&&l(this,t),i)}),extendSelections:pr(function(e,t){Go(this,G(this,e),t)}),extendSelectionsBy:pr(function(e,t){var i=de(this.sel.ranges,e);Go(this,G(this,i),t)}),setSelections:pr(function(e,t,i){if(!e.length)return;for(var r=[],n=0;n<e.length;n++)r[n]=new Ht(l(this,e[n].anchor),l(this,e[n].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),Er(this,qr(this.cm,r,t),i)}),addSelection:pr(function(e,t,i){var r=this.sel.ranges.slice(0);r.push(new Ht(l(this,e),l(this,t||e))),Er(this,qr(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=jr(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=jr(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:pr(function(e,t,i){for(var r=[],n=this.sel,L=0;L<n.ranges.length;L++){var H=n.ranges[L];r[L]={from:H.from(),to:H.to(),text:this.splitLines(e[L]),origin:i}}for(var Y=t&&t!="end"&&cl(this,r,t),Z=r.length-1;Z>=0;Z--)nn(this,r[Z]);Y?Ko(this,Y):this.cm&&qi(this.cm)}),undo:pr(function(){ta(this,"undo")}),redo:pr(function(){ta(this,"redo")}),undoSelection:pr(function(){ta(this,"undo",!0)}),redoSelection:pr(function(){ta(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),Ai(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:tn(this.history.done),undone:tn(this.history.undone)}},setHistory:function(e){var t=this.history=new Qn(this.history.maxGeneration);t.done=tn(e.done.slice(0),null,!0),t.undone=tn(e.undone.slice(0),null,!0)},setGutterMarker:pr(function(e,t,i){return Ln(this,e,"gutter",function(r){var n=r.gutterMarkers||(r.gutterMarkers={});return n[t]=i,!i&&We(n)&&(r.gutterMarkers=null),!0})}),clearGutter:pr(function(e){var t=this;this.iter(function(i){i.gutterMarkers&&i.gutterMarkers[e]&&Ln(t,i,"gutter",function(){return i.gutterMarkers[e]=null,We(i.gutterMarkers)&&(i.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!ui(this,e))return null;if(t=e,e=gt(this,e),!e)return null}else if(t=Pt(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:pr(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(T(i).test(r[n]))return!1;r[n]+=" "+i}return!0})}),removeLineClass:pr(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",L=r[n];if(L)if(i==null)r[n]=null;else{var H=L.match(T(i));if(!H)return!1;var Y=H.index+H[0].length;r[n]=L.slice(0,H.index)+(!H.index||Y==L.length?"":" ")+L.slice(Y)||null}else return!1;return!0})}),addLineWidget:pr(function(e,t,i){return El(this,e,t,i)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,i){return on(this,l(this,e),l(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=l(this,e),on(this,e,e,i,"bookmark")},findMarksAt:function(e){e=l(this,e);var t=[],i=gt(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=l(this,e),t=l(this,t);var r=[],n=e.line;return this.iter(e.line,t.line+1,function(L){var H=L.markedSpans;if(H)for(var Y=0;Y<H.length;Y++){var Z=H[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 L=n.text.length+r;if(L>e)return t=e,!0;e-=L,++i}),l(this,Ye(i,t))},indexFromPos:function(e){e=l(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 Or(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 Or(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,as(this)),r},unlinkDoc:function(e){if(e instanceof Qt&&(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(as(this));break}if(e.history==this.history){var r=[e.id];Ai(e,function(n){return r.push(n.id)},!0),e.history=new Qn(null),e.history.done=tn(this.history.done,r),e.history.undone=tn(this.history.undone,r)}},iterLinkedDocs:function(e){Ai(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):ft(e)},lineSeparator:function(){return this.lineSep||`
`},setDirection:pr(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)})}),Or.prototype.eachLine=Or.prototype.iter;var os=0;function Al(e){var t=this;if(ss(t),Ke(t,e)||fi(t.display,e))return;re(e),j&&(os=+new Date);var i=Bi(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,L=Array(n),H=0,Y=function(){++H==n&&fr(t,function(){i=l(t.doc,i);var Ae={from:i,to:i,text:t.doc.splitLines(L.filter(function(Fe){return Fe!=null}).join(t.doc.lineSeparator())),origin:"paste"};nn(t.doc,Ae),Ko(t.doc,Ti(l(t.doc,i),l(t.doc,wi(Ae))))})()},Z=function(Ae,Fe){if(t.options.allowDropFileTypes&&oe(t.options.allowDropFileTypes,Ae.type)==-1){Y();return}var Ve=new FileReader;Ve.onerror=function(){return Y()},Ve.onload=function(){var Je=Ve.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(Je)){Y();return}L[Fe]=Je,Y()},Ve.readAsText(Ae)},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()),qn(t.doc,Ti(i,i)),me)for(var De=0;De<me.length;++De)an(t.doc,"",me[De].anchor,me[De].head,"drag");t.replaceSelection(ce,"around","paste"),t.display.input.focus()}}catch(Ae){}}}function Ll(e,t){if(j&&(!e.state.draggingText||+new Date-os<100)){he(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&&!P){var i=o("img",null,null,"position: fixed; left: 0; top: 0;");i.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",x&&(i.width=i.height=1,e.display.wrapper.appendChild(i),i._top=i.offsetTop),t.dataTransfer.setDragImage(i,0,0),x&&i.parentNode.removeChild(i)}}function kl(e,t){var i=Bi(e,t);if(!i)return;var r=document.createDocumentFragment();bo(e,i,r),e.display.dragCursor||(e.display.dragCursor=o("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),d(e.display.dragCursor,r)}function ss(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function ls(e){if(!document.getElementsByClassName)return;for(var t=document.getElementsByClassName("CodeMirror"),i=[],r=0;r<t.length;r++){var n=t[r].CodeMirror;n&&i.push(n)}i.length&&i[0].operation(function(){for(var L=0;L<i.length;L++)e(i[L])})}var us=!1;function Dl(){if(us)return;Rl(),us=!0}function Rl(){var e;_e(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,ls(Ol)},100))}),_e(window,"blur",function(){return ls(Ji)})}function Ol(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var ki={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++)ki[_n+48]=ki[_n+96]=String(_n);for(var ra=65;ra<=90;ra++)ki[ra]=String.fromCharCode(ra);for(var Mn=1;Mn<=12;Mn++)ki[Mn+111]=ki[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=s?pi.macDefault:pi.pcDefault;function _l(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var i,r,n,L,H=0;H<t.length-1;H++){var Y=t[H];if(/^(cmd|meta|m)$/i.test(Y))L=!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),L&&(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=de(i.split(" "),_l),L=0;L<n.length;L++){var H=void 0,Y=void 0;L==n.length-1?(Y=n.join(" "),H=r):(Y=n.slice(0,L+1).join(" "),H="...");var Z=t[Y];if(!Z)t[Y]=H;else if(Z!=H)throw new Error("Inconsistent bindings for "+Y)}delete e[i]}for(var q in t)e[q]=t[q];return e}function sn(e,t,i,r){t=ia(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 sn(e,t.fallthrough,i,r);for(var L=0;L<t.fallthrough.length;L++){var H=sn(e,t.fallthrough[L],i,r);if(H)return H}}}function hs(e){var t=typeof e=="string"?e:ki[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),(b?t.metaKey:t.ctrlKey)&&r!="Ctrl"&&(e="Ctrl-"+e),(b?t.ctrlKey:t.metaKey)&&r!="Mod"&&(e="Cmd-"+e),!i&&t.shiftKey&&r!="Shift"&&(e="Shift-"+e),e}function cs(e,t){if(x&&e.keyCode==34&&e.char)return!1;var i=ki[e.keyCode];return i==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(i=e.code),ds(i,e,t))}function ia(e){return typeof e=="string"?pi[e]:e}function ln(e,t){for(var i=e.doc.sel.ranges,r=[],n=0;n<i.length;n++){for(var L=t(i[n]);r.length&&Tt(L.from,te(r).to)<=0;){var H=r.pop();if(Tt(H.from,L.from)<0){L.from=H.from;break}}r.push(L)}Ur(e,function(){for(var Y=r.length-1;Y>=0;Y--)an(e.doc,"",r[Y].from,r[Y].to,"+delete");qi(e)})}function Fa(e,t,i){var r=Ue(e.text,t+i,i);return r<0||r>e.text.length?null:r}function ja(e,t,i){var r=Fa(e,t.ch,i);return r==null?null:new Ye(t.line,r,i<0?"after":"before")}function Wa(e,t,i,r,n){if(e){t.doc.direction=="rtl"&&(n=-n);var L=$e(i,t.doc.direction);if(L){var H=n<0?te(L):L[0],Y=n<0==(H.level==1),Z=Y?"after":"before",q;if(H.level>0||t.doc.direction=="rtl"){var ce=$i(t,i);q=n<0?i.text.length-1:0;var me=oi(t,ce,q).top;q=et(function(De){return oi(t,ce,De).top==me},n<0==(H.level==1)?H.from:H.to-1,q),Z=="before"&&(q=Fa(i,q,1))}else q=n<0?H.to:H.from;return new Ye(r,q,Z)}}return new Ye(r,n<0?i.text.length:0,n<0?"before":"after")}function Pl(e,t,i,r){var n=$e(t,e.doc.direction);if(!n)return ja(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 L=qe(n,i.ch,i.sticky),H=n[L];if(e.doc.direction=="ltr"&&H.level%2==0&&(r>0?H.to>i.ch:H.from<i.ch))return ja(t,i,r);var Y=function(tt,ht){return Fa(t,tt instanceof Ye?tt.ch:tt,ht)},Z,q=function(tt){return e.options.lineWrapping?(Z=Z||$i(e,t),mo(e,t,Z,tt)):{begin:0,end:t.text.length}},ce=q(i.sticky=="before"?Y(i,-1):i.ch);if(e.doc.direction=="rtl"||H.level==1){var me=H.level==1==r<0,De=Y(i,me?1:-1);if(De!=null&&(me?De<=H.to&&De<=ce.end:De>=H.from&&De>=ce.begin)){var Ae=me?"before":"after";return new Ye(i.line,De,Ae)}}var Fe=function(tt,ht,rt){for(var ct=function($t,mr){return mr?new Ye(i.line,Y($t,1),"before"):new Ye(i.line,$t,"after")};tt>=0&&tt<n.length;tt+=ht){var Ct=n[tt],xt=ht>0==(Ct.level!=1),Ot=xt?rt.begin:Y(rt.end,-1);if(Ct.from<=Ot&&Ot<Ct.to)return ct(Ot,xt);if(Ot=xt?Ct.from:Y(Ct.to,-1),rt.begin<=Ot&&Ot<rt.end)return ct(Ot,xt)}},Ve=Fe(L+r,r,ce);if(Ve)return Ve;var Je=r>0?ce.end:Y(ce.begin,-1);return Je!=null&&!(r>0&&Je==t.text.length)&&(Ve=Fe(r>0?0:n.length-1,r,q(Je)),Ve)?Ve:null}var Pn={selectAll:Qo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),xe)},killLine:function(e){return ln(e,function(t){if(t.empty()){var i=gt(e.doc,t.head.line).text.length;return t.head.ch==i&&t.head.line<e.lastLine()?{from:t.head,to:Ye(t.head.line+1,0)}:{from:t.head,to:Ye(t.head.line,i)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return ln(e,function(t){return{from:Ye(t.from().line,0),to:l(e.doc,Ye(t.to().line+1,0))}})},delLineLeft:function(e){return ln(e,function(t){return{from:Ye(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return ln(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 ln(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(Ye(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(Ye(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return fs(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return ps(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")},Ce)},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")},Ce)},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/)?ps(e,t.head):r},Ce)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"codepoint")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection(" ")},insertSoftTab:function(e){for(var t=[],i=e.listSelections(),r=e.options.tabSize,n=0;n<i.length;n++){var L=i[n].from(),H=X(e.getLine(L.line),L.ch,r);t.push(ue(r-H%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return Ur(e,function(){for(var t=e.listSelections(),i=[],r=0;r<t.length;r++){if(!t[r].empty())continue;var n=t[r].head,L=gt(e.doc,n.line).text;if(L){if(n.ch==L.length&&(n=new Ye(n.line,n.ch-1)),n.ch>0)n=new Ye(n.line,n.ch+1),e.replaceRange(L.charAt(n.ch-1)+L.charAt(n.ch-2),Ye(n.line,n.ch-2),n,"+transpose");else if(n.line>e.doc.first){var H=gt(e.doc,n.line-1).text;H&&(n=new Ye(n.line,1),e.replaceRange(L.charAt(0)+e.doc.lineSeparator()+H.charAt(H.length-1),Ye(n.line-1,H.length-1),n,"+transpose"))}}i.push(new Ht(n,n))}e.setSelections(i)})},newlineAndIndent:function(e){return Ur(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 fs(e,t){var i=gt(e.doc,t),r=ur(i);return r!=i&&(t=Pt(r)),Wa(!0,e,r,t,1)}function Il(e,t){var i=gt(e.doc,t),r=ni(i);return r!=i&&(t=Pt(r)),Wa(!0,e,i,t,-1)}function ps(e,t){var i=fs(e,t.line),r=gt(e.doc,i.line),n=$e(r,e.doc.direction);if(!n||n[0].level==0){var L=Math.max(i.ch,r.text.search(/\S/)),H=t.line==i.line&&t.ch<=L&&t.ch;return Ye(i.line,H?0:L,i.sticky)}return i}function na(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)!=ke}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=sn(t,e.state.keyMaps[r],i,e);if(n)return n}return e.options.extraKeys&&sn(t,e.options.extraKeys,i,e)||sn(t,e.options.keyMap,i,e)}var Bl=new ee;function In(e,t,i,r){var n=e.state.keySeq;if(n){if(hs(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())}),ms(e,n+" "+t,i,r))return!0}return ms(e,t,i,r)}function ms(e,t,i,r){var n=Nl(e,t,r);return n=="multi"&&(e.state.keySeq=t),n=="handled"&&Xt(e,"keyHandled",e,t,i),(n=="handled"||n=="multi")&&(re(i),Ta(e)),!!n}function gs(e,t){var i=cs(t,!0);return i?t.shiftKey&&!e.state.keySeq?In(e,"Shift-"+i,t,function(r){return na(e,r,!0)})||In(e,i,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return na(e,r)}):In(e,i,t,function(r){return na(e,r)}):!1}function Ul(e,t,i){return In(e,"'"+i+"'",t,function(r){return na(e,r,!0)})}var Ha=null;function vs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=M(),Ke(t,e))return;j&&N<11&&e.keyCode==27&&(e.returnValue=!1);var i=e.keyCode;t.display.shift=i==16||e.shiftKey;var r=gs(t,e);x&&(Ha=r?i:null,!r&&i==88&&!Rt&&(s?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),R&&!s&&!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;F(t,"CodeMirror-crosshair");function i(r){(r.keyCode==18||!r.altKey)&&(g(t,"CodeMirror-crosshair"),lt(document,"keyup",i),lt(document,"mouseover",i))}_e(document,"keyup",i),_e(document,"mouseover",i)}function ys(e){e.keyCode==16&&(this.doc.sel.shift=!1),Ke(this,e)}function bs(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||s&&e.metaKey)return;var i=e.keyCode,r=e.charCode;if(x&&i==Ha){Ha=null,re(e);return}if(x&&(!e.which||e.which<10)&&gs(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,Ga=function(e,t,i){this.time=e,this.pos=t,this.button=i};Ga.prototype.compare=function(e,t,i){return this.time+jl>e&&Tt(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 Ga(i,e,t),Nn=null,"double"):(Nn=new Ga(i,e,t),Bn=null,"single")}function xs(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.scroller.draggable=!1,setTimeout(function(){return i.scroller.draggable=!0},100));return}if(za(t,e))return;var r=Bi(t,e),n=Pe(e),L=r?Wl(r,n):"single";if(window.focus(),n==1&&t.state.selectingText&&t.state.selectingText(e),r&&Hl(t,n,r,L,e))return;n==1?r?zl(t,r,L,e):Le(e)==i.scroller&&re(e):n==2?(r&&Jn(t.doc,r),setTimeout(function(){return i.input.focus()},20)):n==3&&(D?t.display.input.onContextMenu(e):Eo(t))}function Hl(e,t,i,r,n){var L="Click";return r=="double"?L="Double"+L:r=="triple"&&(L="Triple"+L),L=(t==1?"Left":t==2?"Middle":"Right")+L,In(e,ds(L,n),n,function(H){if(typeof H=="string"&&(H=Pn[H]),!H)return!1;var Y=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),Y=H(e,i)!=ke}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 L=h?i.shiftKey&&i.metaKey:i.altKey;n.unit=L?"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=s?i.metaKey:i.ctrlKey),n.moveOnDrag==null&&(n.moveOnDrag=!(s?i.altKey:i.ctrlKey)),n}function zl(e,t,i,r){j?setTimeout(I(xo,e),0):e.curOp.focus=M();var n=Gl(e,i,r),L=e.doc.sel,H;e.options.dragDrop&&Xe&&!e.isReadOnly()&&i=="single"&&(H=L.contains(t))>-1&&(Tt((H=L.ranges[H]).from(),t)<0||t.xRel>0)&&(Tt(H.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,L=!1,H=fr(e,function(q){_&&(n.scroller.draggable=!1),e.state.draggingText=!1,lt(n.wrapper.ownerDocument,"mouseup",H),lt(n.wrapper.ownerDocument,"mousemove",Y),lt(n.scroller,"dragstart",Z),lt(n.scroller,"drop",H),L||(re(q),r.addNew||Jn(e.doc,i,null,null,r.extend),_&&!P||j&&N==9?setTimeout(function(){n.wrapper.ownerDocument.body.focus({preventScroll:!0}),n.input.focus()},20):n.input.focus())}),Y=function(q){L=L||Math.abs(t.clientX-q.clientX)+Math.abs(t.clientY-q.clientY)>=10},Z=function(){return L=!0};_&&(n.scroller.draggable=!0),e.state.draggingText=H,H.copy=!r.moveOnDrag,n.scroller.dragDrop&&n.scroller.dragDrop(),_e(n.wrapper.ownerDocument,"mouseup",H),_e(n.wrapper.ownerDocument,"mousemove",Y),_e(n.scroller,"dragstart",Z),_e(n.scroller,"drop",H),Eo(e),setTimeout(function(){return n.input.focus()},20)}function Es(e,t,i){if(i=="char")return new Ht(t,t);if(i=="word")return e.findWordAt(t);if(i=="line")return new Ht(Ye(t.line,0),l(e.doc,Ye(t.line+1,0)));var r=i(e,t);return new Ht(r.from,r.to)}function Vl(e,t,i,r){var n=e.display,L=e.doc;re(t);var H,Y,Z=L.sel,q=Z.ranges;if(r.addNew&&!r.extend?(Y=L.sel.contains(i),Y>-1?H=q[Y]:H=new Ht(i,i)):(H=L.sel.primary(),Y=L.sel.primIndex),r.unit=="rectangle")r.addNew||(H=new Ht(i,i)),i=Bi(e,t,!0,!0),Y=-1;else{var ce=Es(e,i,r.unit);r.extend?H=Ba(H,ce.anchor,ce.head,r.extend):H=ce}r.addNew?Y==-1?(Y=q.length,Er(L,qr(e,q.concat([H]),Y),{scroll:!1,origin:"*mouse"})):q.length>1&&q[Y].empty()&&r.unit=="char"&&!r.extend?(Er(L,qr(e,q.slice(0,Y).concat(q.slice(Y+1)),0),{scroll:!1,origin:"*mouse"}),Z=L.sel):Ua(L,Y,H,Te):(Y=0,Er(L,new Kr([H],0),Te),Z=L.sel);var me=i;function De(rt){if(Tt(me,rt)==0)return;if(me=rt,r.unit=="rectangle"){for(var ct=[],Ct=e.options.tabSize,xt=X(gt(L,i.line).text,i.ch,Ct),Ot=X(gt(L,rt.line).text,rt.ch,Ct),$t=Math.min(xt,Ot),mr=Math.max(xt,Ot),qt=Math.min(i.line,rt.line),Fr=Math.min(e.lastLine(),Math.max(i.line,rt.line));qt<=Fr;qt++){var _r=gt(L,qt).text,or=ge(_r,$t,Ct);$t==mr?ct.push(new Ht(Ye(qt,or),Ye(qt,or))):_r.length>or&&ct.push(new Ht(Ye(qt,or),Ye(qt,ge(_r,mr,Ct))))}ct.length||ct.push(new Ht(i,i)),Er(L,qr(e,Z.ranges.slice(0,Y).concat(ct),Y),{origin:"*mouse",scroll:!1}),e.scrollIntoView(rt)}else{var Mr=H,xr=Es(e,rt,r.unit),hr=Mr.anchor,sr;Tt(xr.anchor,hr)>0?(sr=xr.head,hr=Ri(Mr.from(),xr.anchor)):(sr=xr.anchor,hr=di(Mr.to(),xr.head));var er=Z.ranges.slice(0);er[Y]=Xl(e,new Ht(l(L,hr),sr)),Er(L,qr(e,er,Y),Te)}}var Ae=n.wrapper.getBoundingClientRect(),Fe=0;function Ve(rt){var ct=++Fe,Ct=Bi(e,rt,!0,r.unit=="rectangle");if(!Ct)return;if(Tt(Ct,me)!=0){e.curOp.focus=M(),De(Ct);var xt=Vn(n,L);(Ct.line>=xt.to||Ct.line<xt.from)&&setTimeout(fr(e,function(){Fe==ct&&Ve(rt)}),150)}else{var Ot=rt.clientY<Ae.top?-20:rt.clientY>Ae.bottom?20:0;Ot&&setTimeout(fr(e,function(){if(Fe!=ct)return;n.scroller.scrollTop+=Ot,Ve(rt)}),50)}}function Je(rt){e.state.selectingText=!1,Fe=Infinity,rt&&(re(rt),n.input.focus()),lt(n.wrapper.ownerDocument,"mousemove",tt),lt(n.wrapper.ownerDocument,"mouseup",ht),L.history.lastSelOrigin=null}var tt=fr(e,function(rt){rt.buttons===0||!Pe(rt)?Je(rt):Ve(rt)}),ht=fr(e,Je);e.state.selectingText=ht,_e(n.wrapper.ownerDocument,"mousemove",tt),_e(n.wrapper.ownerDocument,"mouseup",ht)}function Xl(e,t){var i=t.anchor,r=t.head,n=gt(e.doc,i.line);if(Tt(i,r)==0&&i.sticky==r.sticky)return t;var L=$e(n);if(!L)return t;var H=qe(L,i.ch,i.sticky),Y=L[H];if(Y.from!=i.ch&&Y.to!=i.ch)return t;var Z=H+(Y.from==i.ch==(Y.level!=1)?0:1);if(Z==0||Z==L.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=qe(L,r.ch,r.sticky),me=ce-H||(r.ch-i.ch)*(Y.level==1?-1:1);ce==Z-1||ce==Z?q=me<0:q=me>0}var De=L[Z+(q?-1:0)],Ae=q==(De.level==1),Fe=Ae?De.from:De.to,Ve=Ae?"after":"before";return i.ch==Fe&&i.sticky==Ve?t:new Ht(new Ye(i.line,Fe,Ve),r)}function Ss(e,t,i,r){var n,L;if(t.touches)n=t.touches[0].clientX,L=t.touches[0].clientY;else try{n=t.clientX,L=t.clientY}catch(De){return!1}if(n>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&re(t);var H=e.display,Y=H.lineDiv.getBoundingClientRect();if(L>Y.bottom||!ve(e,i))return le(t);L-=Y.top-H.viewOffset;for(var Z=0;Z<e.display.gutterSpecs.length;++Z){var q=H.gutters.childNodes[Z];if(q&&q.getBoundingClientRect().right>=n){var ce=Xr(e.doc,L),me=e.display.gutterSpecs[Z];return Ne(e,i,e,ce,me.className,t),le(t)}}}function za(e,t){return Ss(e,t,"gutterClick",!0)}function Cs(e,t){if(fi(e.display,t)||Yl(e,t))return;if(Ke(e,t,"contextmenu"))return;D||e.display.input.onContextMenu(t)}function Yl(e,t){return ve(e,"gutterContextMenu")?Ss(e,t,"gutterContextMenu",!1):!1}function Ts(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 un={toString:function(){return"CodeMirror.Init"}},ws={},aa={};function $l(e){var t=e.optionHandlers;function i(r,n,L,H){e.defaults[r]=n,L&&(t[r]=H?function(Y,Z,q){q!=un&&L(Y,Z,q)}:L)}e.defineOption=i,e.Init=un,i("value","",function(r,n){return r.setValue(n)},!0),i("mode",null,function(r,n){r.doc.modeOption=n,Pa(r)},!0),i("indentUnit",2,Pa,!0),i("indentWithTabs",!1),i("smartIndent",!0),i("tabSize",4,function(r){wn(r),vn(r),Rr(r)},!0),i("lineSeparator",null,function(r,n){if(r.doc.lineSep=n,!n)return;var L=[],H=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,L.push(Ye(H,ce))}H++});for(var Y=L.length-1;Y>=0;Y--)an(r.doc,n,L[Y],Ye(L[Y].line,L[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,L){r.state.specialChars=new RegExp(n.source+(n.test(" ")?"":"| "),"g"),L!=un&&r.refresh()}),i("specialCharPlaceholder",bt,function(r){return r.refresh()},!0),i("electricChars",!0),i("inputStyle",a?"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",!k),i("wholeLineUpdateBefore",!0),i("theme","default",function(r){Ts(r),Tn(r)},!0),i("keyMap","default",function(r,n,L){var H=ia(n),Y=L!=un&&ia(L);Y&&Y.detach&&Y.detach(r,H),H.attach&&H.attach(r,Y||null)}),i("extraKeys",null),i("configureMouse",null),i("lineWrapping",!1,Zl,!0),i("gutters",[],function(r,n){r.display.gutterSpecs=_a(n,r.options.lineNumbers),Tn(r)},!0),i("fixedGutter",!0,function(r,n){r.display.gutters.style.left=n?Sa(r.display)+"px":"0",r.refresh()},!0),i("coverGutterNextToScrollbar",!1,function(r){return en(r)},!0),i("scrollbarStyle","native",function(r){Lo(r),en(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=_a(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"&&(Ji(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,Ql),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 Ql(e,t,i){var r=i&&i!=un;if(!t!=!r){var n=e.display.dragFunctions,L=t?_e:lt;L(e.display.scroller,"dragstart",n.start),L(e.display.scroller,"dragenter",n.enter),L(e.display.scroller,"dragover",n.over),L(e.display.scroller,"dragleave",n.leave),L(e.display.scroller,"drop",n.drop)}}function Zl(e){e.options.lineWrapping?(F(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(g(e.display.wrapper,"CodeMirror-wrap"),ci(e)),Ca(e),Rr(e),vn(e),setTimeout(function(){return en(e)},100)}function Qt(e,t){var i=this;if(!(this instanceof Qt))return new Qt(e,t);this.options=t=t?B(t):{},B(ws,t,!1);var r=t.value;typeof r=="string"?r=new Or(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var n=new Qt.inputStyles[t.inputStyle](this),L=this.display=new hl(e,r,n,t);L.wrapper.CodeMirror=this,Ts(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Lo(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new ee,keySeq:null,specialChars:null},t.autofocus&&!a&&L.input.focus(),j&&N<11&&setTimeout(function(){return i.display.input.reset(!0)},20),Jl(this),Dl(),Wi(this),this.curOp.forceUpdate=!0,Bo(this,r),t.autofocus&&!a||this.hasFocus()?setTimeout(function(){i.hasFocus()&&!i.state.focused&&wa(i)},20):Ji(this);for(var H in aa)aa.hasOwnProperty(H)&&aa[H](this,t[H],un);Ro(this),t.finishInit&&t.finishInit(this);for(var Y=0;Y<Ka.length;++Y)Ka[Y](this);Hi(this),_&&t.lineWrapping&&getComputedStyle(L.lineDiv).textRendering=="optimizelegibility"&&(L.lineDiv.style.textRendering="auto")}Qt.defaults=ws,Qt.optionHandlers=aa;function Jl(e){var t=e.display;_e(t.scroller,"mousedown",fr(e,xs)),j&&N<11?_e(t.scroller,"dblclick",fr(e,function(Z){if(Ke(e,Z))return;var q=Bi(e,Z);if(!q||za(e,Z)||fi(e.display,Z))return;re(Z);var ce=e.findWordAt(q);Jn(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 Cs(e,Z)}),_e(t.input.getField(),"contextmenu",function(Z){t.scroller.contains(Z.target)||Cs(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 L(Z){if(Z.touches.length!=1)return!1;var q=Z.touches[0];return q.radiusX<=1&&q.radiusY<=1}function H(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)&&!L(Z)&&!za(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||H(q,q.prev)?me=new Ht(ce,ce):!q.prev.prev||H(q,q.prev.prev)?me=e.findWordAt(ce):me=new Ht(Ye(ce.line,0),l(e.doc,Ye(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),Fi(e,t.scroller.scrollLeft,!0),Ne(e,"scroll",e))}),_e(t.scroller,"mousewheel",function(Z){return Mo(e,Z)}),_e(t.scroller,"DOMMouseScroll",function(Z){return Mo(e,Z)}),_e(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(Z){Ke(e,Z)||he(Z)},over:function(Z){Ke(e,Z)||(kl(e,Z),he(Z))},start:function(Z){return Ll(e,Z)},drop:fr(e,Al),leave:function(Z){Ke(e,Z)||ss(e)}};var Y=t.input.getField();_e(Y,"keyup",function(Z){return ys.call(e,Z)}),_e(Y,"keydown",fr(e,vs)),_e(Y,"keypress",fr(e,bs)),_e(Y,"focus",function(Z){return wa(e,Z)}),_e(Y,"blur",function(Z){return Ji(e,Z)})}var Ka=[];Qt.defineInitHook=function(e){return Ka.push(e)};function Un(e,t,i,r){var n=e.doc,L;i==null&&(i="add"),i=="smart"&&(n.mode.indent?L=Oe(e,t).state:i="prev");var H=e.options.tabSize,Y=gt(n,t),Z=X(Y.text,null,H);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(L,Y.text.slice(q.length),Y.text),ce==ke||ce>150)){if(!r)return;i="prev"}i=="prev"?t>n.first?ce=X(gt(n,t-1).text,null,H):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 Ae=Math.floor(ce/H);Ae;--Ae)De+=H,me+=" ";if(De<ce&&(me+=ue(ce-De)),me!=q)return an(n,me,Ye(t,0),Ye(t,q.length),"+input"),Y.stateAfter=null,!0;for(var Fe=0;Fe<n.sel.ranges.length;Fe++){var Ve=n.sel.ranges[Fe];if(Ve.head.line==t&&Ve.head.ch<q.length){var Je=Ye(t,q.length);Ua(n,Fe,new Ht(Je,Je));break}}}var ei=null;function oa(e){ei=e}function Va(e,t,i,r,n){var L=e.doc;e.display.shift=!1,r||(r=L.sel);var H=+new Date-200,Y=n=="paste"||e.state.pasteIncoming>H,Z=ft(t),q=null;if(Y&&r.ranges.length>1)if(ei&&ei.text.join(`
`)==t){if(r.ranges.length%ei.text.length==0){q=[];for(var ce=0;ce<ei.text.length;ce++)q.push(L.splitLines(ei.text[ce]))}}else Z.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(q=de(Z,function(tt){return[tt]}));for(var me=e.curOp.updateInput,De=r.ranges.length-1;De>=0;De--){var Ae=r.ranges[De],Fe=Ae.from(),Ve=Ae.to();Ae.empty()&&(i&&i>0?Fe=Ye(Fe.line,Fe.ch-i):e.state.overwrite&&!Y?Ve=Ye(Ve.line,Math.min(gt(L,Ve.line).text.length,Ve.ch+te(Z).length)):Y&&ei&&ei.lineWise&&ei.text.join(`
`)==Z.join(`
`)&&(Fe=Ve=Ye(Fe.line,0)));var Je={from:Fe,to:Ve,text:q?q[De%q.length]:Z,origin:n||(Y?"paste":e.state.cutIncoming>H?"cut":"+input")};nn(e.doc,Je),Xt(e,"inputRead",e,Je)}t&&!Y&&Ls(e,t),qi(e),e.curOp.updateInput<2&&(e.curOp.updateInput=me),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function As(e,t){var i=e.clipboardData&&e.clipboardData.getData("Text");if(i)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&Ur(t,function(){return Va(t,i,0,null,"paste")}),!0}function Ls(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 L=e.getModeAt(n.head),H=!1;if(L.electricChars){for(var Y=0;Y<L.electricChars.length;Y++)if(t.indexOf(L.electricChars.charAt(Y))>-1){H=Un(e,n.head.line,"smart");break}}else L.electricInput&&(L.electricInput.test(gt(e.doc,n.head.line).text.slice(0,n.head.ch))&&(H=Un(e,n.head.line,"smart")));H&&Xt(e,"electricInput",e,n.head.line)}}function ks(e){for(var t=[],i=[],r=0;r<e.doc.sel.ranges.length;r++){var n=e.doc.sel.ranges[r].head.line,L={anchor:Ye(n,0),head:Ye(n+1,0)};i.push(L),t.push(e.getRange(L.anchor,L.head))}return{text:t,ranges:i}}function Ds(e,t,i,r){e.setAttribute("autocorrect",i?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function Rs(){var e=o("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=o("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return _?e.style.width="1000px":e.setAttribute("wrap","off"),p&&(e.style.border="1px solid black"),Ds(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 L=this.options,H=L[r];if(L[r]==n&&r!="mode")return;L[r]=n,t.hasOwnProperty(r)&&fr(this,t[r])(this,n,H),Ne(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"](ia(r))},removeKeyMap:function(r){for(var n=this.state.keyMaps,L=0;L<n.length;++L)if(n[L]==r||n[L].name==r)return n.splice(L,1),!0},addOverlay:Tr(function(r,n){var L=r.token?r:e.getMode(this.options,r);if(L.startState)throw new Error("Overlays may not be stateful.");ae(this.state.overlays,{mode:L,modeSpec:r,opaque:n&&n.opaque,priority:n&&n.priority||0},function(H){return H.priority}),this.state.modeGen++,Rr(this)}),removeOverlay:Tr(function(r){for(var n=this.state.overlays,L=0;L<n.length;++L){var H=n[L].modeSpec;if(H==r||typeof r=="string"&&H.name==r){n.splice(L,1),this.state.modeGen++,Rr(this);return}}}),indentLine:Tr(function(r,n,L){typeof n!="string"&&typeof n!="number"&&(n==null?n=this.options.smartIndent?"smart":"prev":n=n?"add":"subtract"),ui(this.doc,r)&&Un(this,r,n,L)}),indentSelection:Tr(function(r){for(var n=this.doc.sel.ranges,L=-1,H=0;H<n.length;H++){var Y=n[H];if(Y.empty())Y.head.line>L&&(Un(this,Y.head.line,r,!0),L=Y.head.line,H==this.doc.sel.primIndex&&qi(this));else{var Z=Y.from(),q=Y.to(),ce=Math.max(L,Z.line);L=Math.min(this.lastLine(),q.line-(q.ch?0:1))+1;for(var me=ce;me<L;++me)Un(this,me,r);var De=this.doc.sel.ranges;Z.ch==0&&n.length==De.length&&De[H].from().ch>0&&Ua(this.doc,H,new Ht(Z,De[H].to()),xe)}}}),getTokenAt:function(r,n){return Gt(this,r,n)},getLineTokens:function(r,n){return Gt(this,Ye(r),n,!0)},getTokenTypeAt:function(r){r=l(this.doc,r);var n=He(this,gt(this.doc,r.line)),L=0,H=(n.length-1)/2,Y=r.ch,Z;if(Y==0)Z=n[2];else for(;;){var q=L+H>>1;if((q?n[q*2-1]:0)>=Y)H=q;else if(n[q*2+1]<Y)L=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 L=[];if(!i.hasOwnProperty(n))return L;var H=i[n],Y=this.getModeAt(r);if(typeof Y[n]=="string")H[Y[n]]&&L.push(H[Y[n]]);else if(Y[n])for(var Z=0;Z<Y[n].length;Z++){var q=H[Y[n][Z]];q&&L.push(q)}else Y.helperType&&H[Y.helperType]?L.push(H[Y.helperType]):H[Y.name]&&L.push(H[Y.name]);for(var ce=0;ce<H._global.length;ce++){var me=H._global[ce];me.pred(Y,this)&&oe(L,me.val)==-1&&L.push(me.val)}return L},getStateAfter:function(r,n){var L=this.doc;return r=K(L,r==null?L.first+L.size-1:r),Oe(this,r+1,n).state},cursorCoords:function(r,n){var L,H=this.doc.sel.primary();return r==null?L=H.head:typeof r=="object"?L=l(this.doc,r):L=r?H.from():H.to(),Jr(this,L,n||"page")},charCoords:function(r,n){return va(this,l(this.doc,r),n||"page")},coordsChar:function(r,n){return r=co(this,r,n||"page"),ba(this,r.left,r.top)},lineAtHeight:function(r,n){return r=co(this,{top:r,left:0},n||"page").top,Xr(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,n,L){var H=!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,H=!0),Y=gt(this.doc,r)}else Y=r;return Hn(this,Y,{top:0,left:0},n||"page",L||H).top+(H?this.doc.height-Br(Y):0)},defaultTextHeight:function(){return Qi(this.display)},defaultCharWidth:function(){return Zi(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,n,L,H,Y){var Z=this.display;r=Jr(this,l(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),H=="over")q=r.top;else if(H=="above"||H=="near"){var me=Math.max(Z.wrapper.clientHeight,this.doc.height),De=Math.max(Z.sizer.clientWidth,Z.lineSpace.clientWidth);(H=="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"),L&&Qs(this,{left:ce,top:q,right:ce+n.offsetWidth,bottom:q+n.offsetHeight})},triggerOnKeyDown:Tr(vs),triggerOnKeyPress:Tr(bs),triggerOnKeyUp:ys,triggerOnMouseDown:Tr(xs),execCommand:function(r){if(Pn.hasOwnProperty(r))return Pn[r].call(null,this)},triggerElectric:Tr(function(r){Ls(this,r)}),findPosH:function(r,n,L,H){var Y=1;n<0&&(Y=-1,n=-n);for(var Z=l(this.doc,r),q=0;q<n&&!(Z=Xa(this.doc,Z,Y,L,H),Z.hitSide);++q);return Z},moveH:Tr(function(r,n){var L=this;this.extendSelectionsBy(function(H){return L.display.shift||L.doc.extend||H.empty()?Xa(L.doc,H.head,r,n,L.options.rtlMoveVisually):r<0?H.from():H.to()},Ce)}),deleteH:Tr(function(r,n){var L=this.doc.sel,H=this.doc;L.somethingSelected()?H.replaceSelection("",null,"+delete"):ln(this,function(Y){var Z=Xa(H,Y.head,r,n,!1);return r<0?{from:Z,to:Y.head}:{from:Y.head,to:Z}})}),findPosV:function(r,n,L,H){var Y=1,Z=H;n<0&&(Y=-1,n=-n);for(var q=l(this.doc,r),ce=0;ce<n;++ce){var me=Jr(this,q,"div");if(Z==null?Z=me.left:me.left=Z,q=Os(this,me,Y,L),q.hitSide)break}return q},moveV:Tr(function(r,n){var L=this,H=this.doc,Y=[],Z=!this.display.shift&&!H.extend&&H.sel.somethingSelected();if(H.extendSelectionsBy(function(ce){if(Z)return r<0?ce.from():ce.to();var me=Jr(L,ce.head,"div");ce.goalColumn!=null&&(me.left=ce.goalColumn),Y.push(me.left);var De=Os(L,me,r,n);return n=="page"&&ce==H.sel.primary()&&La(L,va(L,De,"div").top-me.top),De},Ce),Y.length)for(var q=0;q<H.sel.ranges.length;q++)H.sel.ranges[q].goalColumn=Y[q]}),findWordAt:function(r){var n=this.doc,L=gt(n,r.line).text,H=r.ch,Y=r.ch;if(L){var Z=this.getHelper(r,"wordChars");(r.sticky=="before"||Y==L.length)&&H?--H:++Y;for(var q=L.charAt(H),ce=Ie(q,Z)?function(me){return Ie(me,Z)}:/\s/.test(q)?function(me){return/\s/.test(me)}:function(me){return!/\s/.test(me)&&!Ie(me)};H>0&&ce(L.charAt(H-1));)--H;for(;Y<L.length&&ce(L.charAt(Y));)++Y}return new Ht(Ye(r.line,H),Ye(r.line,Y))},toggleOverwrite:function(r){if(r!=null&&r==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?F(this.display.cursorDiv,"CodeMirror-overwrite"):g(this.display.cursorDiv,"CodeMirror-overwrite"),Ne(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==M()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:Tr(function(r,n){bn(this,r,n)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-ai(this)-this.display.barHeight,width:r.scrollWidth-ai(this)-this.display.barWidth,clientHeight:pa(this),clientWidth:Ii(this)}},scrollIntoView:Tr(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:Ye(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?Zs(this,r):Co(this,r.from,r.to,r.margin)}),setSize:Tr(function(r,n){var L=this,H=function(Z){return typeof Z=="number"||/^\d+$/.test(String(Z))?Z+"px":Z};r!=null&&(this.display.wrapper.style.width=H(r)),n!=null&&(this.display.wrapper.style.height=H(n)),this.options.lineWrapping&&lo(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){Si(L,Y,"widget");break}}++Y}),this.curOp.forceUpdate=!0,Ne(this,"refresh",this)}),operation:function(r){return Ur(this,r)},startOperation:function(){return Wi(this)},endOperation:function(){return Hi(this)},refresh:Tr(function(){var r=this.display.cachedTextHeight;Rr(this),this.curOp.forceUpdate=!0,vn(this),bn(this,this.doc.scrollLeft,this.doc.scrollTop),Ra(this.display),(r==null||Math.abs(r-Qi(this.display))>.5||this.options.lineWrapping)&&Ca(this),Ne(this,"refresh",this)}),swapDoc:Tr(function(r){var n=this.doc;return n.cm=null,this.state.selectingText&&this.state.selectingText(),Bo(this,r),vn(this),this.display.input.reset(),bn(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,Xt(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}},be(e),e.registerHelper=function(r,n,L){i.hasOwnProperty(r)||(i[r]=e[r]={_global:[]}),i[r][n]=L},e.registerGlobalHelper=function(r,n,L,H){e.registerHelper(r,n,H),i[r]._global.push({pred:L,val:H})}}function Xa(e,t,i,r,n){var L=t,H=i,Y=gt(e,t.line),Z=n&&e.direction=="rtl"?-i:i;function q(){var ht=t.line+Z;return ht<e.first||ht>=e.first+e.size?!1:(t=new Ye(ht,t.ch,t.sticky),Y=gt(e,ht))}function ce(ht){var rt;if(r=="codepoint"){var ct=Y.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(ct)?rt=null:rt=new Ye(t.line,Math.max(0,Math.min(Y.text.length,t.ch+i*(ct>=55296&&ct<56320?2:1))),-i)}else n?rt=Pl(e.cm,Y,t,i):rt=ja(Y,t,i);if(rt==null)if(!ht&&q())t=Wa(n,e.cm,Y,t.line,Z);else return!1;else t=rt;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",Ae=e.cm&&e.cm.getHelper(t,"wordChars"),Fe=!0;!(i<0&&!ce(!Fe));Fe=!1){var Ve=Y.text.charAt(t.ch)||`
`,Je=Ie(Ve,Ae)?"w":De&&Ve==`
`?"n":!De||/\s/.test(Ve)?null:"p";if(De&&!Fe&&!Je&&(Je="s"),me&&me!=Je){i<0&&(i=1,ce(),t.sticky="after");break}if(Je&&(me=Je),i>0&&!ce(!Fe))break}var tt=ea(e,t,L,H,!0);return ti(L,tt)&&(tt.hitSide=!0),tt}function Os(e,t,i,r){var n=e.doc,L=t.left,H;if(r=="page"){var Y=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),Z=Math.max(Y-.5*Qi(e.display),3);H=(i>0?t.bottom:t.top)+i*Z}else r=="line"&&(H=i>0?t.bottom+3:t.top-3);for(var q;!(q=ba(e,L,H),!q.outside);){if(i<0?H<=0:H>=n.height){q.hitSide=!0;break}H+=i*5}return q}var Vt=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};Vt.prototype.init=function(e){var t=this,i=this,r=i.cm,n=i.div=e.lineDiv;Ds(n,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function L(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(!L(Y)||Ke(r,Y)||As(Y,r))return;N<=11&&setTimeout(fr(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 H(Y){if(!L(Y)||Ke(r,Y))return;if(r.somethingSelected())oa({lineWise:!1,text:r.getSelections()}),Y.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var Z=ks(r);oa({lineWise:!0,text:Z.text}),Y.type=="cut"&&r.operation(function(){r.setSelections(Z.ranges,0,xe),r.replaceSelection("",null,"cut")})}else return;if(Y.clipboardData){Y.clipboardData.clearData();var q=ei.text.join(`
`);if(Y.clipboardData.setData("Text",q),Y.clipboardData.getData("Text")==q){Y.preventDefault();return}}var ce=Rs(),me=ce.firstChild;r.display.lineSpace.insertBefore(ce,r.display.lineSpace.firstChild),me.value=ei.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",H),_e(n,"cut",H)},Vt.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Vt.prototype.prepareSelection=function(){var e=yo(this.cm,!1);return e.focus=document.activeElement==this.div,e},Vt.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},Vt.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Vt.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 L=sa(t,e.anchorNode,e.anchorOffset),H=sa(t,e.focusNode,e.focusOffset);if(L&&!L.bad&&H&&!H.bad&&Tt(Ri(L,H),r)==0&&Tt(di(L,H),n)==0)return;var Y=t.display.view,Z=r.line>=t.display.viewFrom&&_s(t,r)||{node:Y[0].measure.map[2],offset:0},q=n.line<t.display.viewTo&&_s(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),Ae;try{Ae=S(Z.node,Z.offset,q.offset,q.node)}catch(Fe){}Ae&&(!R&&t.state.focused?(e.collapse(Z.node,Z.offset),Ae.collapsed||(e.removeAllRanges(),e.addRange(Ae))):(e.removeAllRanges(),e.addRange(Ae)),De&&e.anchorNode==null?e.addRange(De):R&&this.startGracePeriod()),this.rememberSelection()},Vt.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)},Vt.prototype.showMultipleSelections=function(e){d(this.cm.display.cursorDiv,e.cursors),d(this.cm.display.selectionDiv,e.selection)},Vt.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},Vt.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return y(this.div,t)},Vt.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},Vt.prototype.blur=function(){this.div.blur()},Vt.prototype.getField=function(){return this.div},Vt.prototype.supportsTouch=function(){return!0},Vt.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():Ur(this.cm,function(){return e.cm.curOp.selectionChanged=!0});function t(){e.cm.state.focused&&(e.pollSelection(),e.polling.set(e.cm.options.pollInterval,t))}this.polling.set(this.cm.options.pollInterval,t)},Vt.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},Vt.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(u&&f&&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=sa(t,e.anchorNode,e.anchorOffset),r=sa(t,e.focusNode,e.focusOffset);i&&r&&Ur(t,function(){Er(t.doc,Ti(i,r),xe),(i.bad||r.bad)&&(t.curOp.selectionChanged=!0)})},Vt.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=Ye(r.line-1,gt(e.doc,r.line-1).length)),n.ch==gt(e.doc,n.line).text.length&&n.line<e.lastLine()&&(n=Ye(n.line+1,0)),r.line<t.viewFrom||n.line>t.viewTo-1)return!1;var L,H,Y;r.line==t.viewFrom||(L=Ui(e,r.line))==0?(H=Pt(t.view[0].line),Y=t.view[0].node):(H=Pt(t.view[L].line),Y=t.view[L-1].node.nextSibling);var Z=Ui(e,n.line),q,ce;if(Z==t.view.length-1?(q=t.viewTo-1,ce=t.lineDiv.lastChild):(q=Pt(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,H,q)),De=jr(e.doc,Ye(H,0),Ye(q,gt(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(),H++;else break;for(var Ae=0,Fe=0,Ve=me[0],Je=De[0],tt=Math.min(Ve.length,Je.length);Ae<tt&&Ve.charCodeAt(Ae)==Je.charCodeAt(Ae);)++Ae;for(var ht=te(me),rt=te(De),ct=Math.min(ht.length-(me.length==1?Ae:0),rt.length-(De.length==1?Ae:0));Fe<ct&&ht.charCodeAt(ht.length-Fe-1)==rt.charCodeAt(rt.length-Fe-1);)++Fe;if(me.length==1&&De.length==1&&H==r.line)for(;Ae&&Ae>r.ch&&ht.charCodeAt(ht.length-Fe-1)==rt.charCodeAt(rt.length-Fe-1);)Ae--,Fe++;me[me.length-1]=ht.slice(0,ht.length-Fe).replace(/^\u200b+/,""),me[0]=me[0].slice(Ae).replace(/\u200b+$/,"");var Ct=Ye(H,Ae),xt=Ye(q,De.length?te(De).length-Fe:0);if(me.length>1||me[0]||Tt(Ct,xt))return an(e.doc,me,Ct,xt,"+input"),!0},Vt.prototype.ensurePolled=function(){this.forceCompositionEnd()},Vt.prototype.reset=function(){this.forceCompositionEnd()},Vt.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},Vt.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)},Vt.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&Ur(this.cm,function(){return Rr(e.cm)})},Vt.prototype.setUneditable=function(e){e.contentEditable="false"},Vt.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||fr(this.cm,Va)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},Vt.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},Vt.prototype.onContextMenu=function(){},Vt.prototype.resetPosition=function(){},Vt.prototype.needsContentAttribute=!0;function _s(e,t){var i=ma(e,t.line);if(!i||i.hidden)return null;var r=gt(e.doc,t.line),n=io(i,r,t.line),L=$e(r,e.doc.direction),H="left";if(L){var Y=qe(L,t.ch);H=Y%2?"right":"left"}var Z=oo(n.map,t.ch,H);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 hn(e,t){return t&&(e.bad=!0),e}function tu(e,t,i,r,n){var L="",H=!1,Y=e.doc.lineSeparator(),Z=!1;function q(Ae){return function(Fe){return Fe.id==Ae}}function ce(){H&&(L+=Y,Z&&(L+=Y),H=Z=!1)}function me(Ae){Ae&&(ce(),L+=Ae)}function De(Ae){if(Ae.nodeType==1){var Fe=Ae.getAttribute("cm-text");if(Fe){me(Fe);return}var Ve=Ae.getAttribute("cm-marker"),Je;if(Ve){var tt=e.findMarks(Ye(r,0),Ye(n+1,0),q(+Ve));tt.length&&(Je=tt[0].find(0))&&me(jr(e.doc,Je.from,Je.to).join(Y));return}if(Ae.getAttribute("contenteditable")=="false")return;var ht=/^(pre|div|p|li|table|br)$/i.test(Ae.nodeName);if(!/^br$/i.test(Ae.nodeName)&&Ae.textContent.length==0)return;ht&&ce();for(var rt=0;rt<Ae.childNodes.length;rt++)De(Ae.childNodes[rt]);/^(pre|p)$/i.test(Ae.nodeName)&&(Z=!0),ht&&(H=!0)}else Ae.nodeType==3&&me(Ae.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(De(t),t==i);)t=t.nextSibling,Z=!1;return L}function sa(e,t,i){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[i],!r)return hn(e.clipPos(Ye(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 L=e.display.view[n];if(L.node==r)return ru(L,t,i)}}function ru(e,t,i){var r=e.text.firstChild,n=!1;if(!t||!y(r,t))return hn(Ye(Pt(e.line),0),!0);if(t==r&&(n=!0,t=r.childNodes[i],i=0,!t)){var L=e.rest?te(e.rest):e.line;return hn(Ye(Pt(L),L.text.length),n)}var H=t.nodeType==3?t:null,Y=t;for(!H&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(H=t.firstChild,i&&(i=H.nodeValue.length));Y.parentNode!=r;)Y=Y.parentNode;var Z=e.measure,q=Z.maps;function ce(Je,tt,ht){for(var rt=-1;rt<(q?q.length:0);rt++)for(var ct=rt<0?Z.map:q[rt],Ct=0;Ct<ct.length;Ct+=3){var xt=ct[Ct+2];if(xt==Je||xt==tt){var Ot=Pt(rt<0?e.line:e.rest[rt]),$t=ct[Ct]+ht;return(ht<0||xt!=Je)&&($t=ct[Ct+(ht?1:0)]),Ye(Ot,$t)}}}var me=ce(H,Y,i);if(me)return hn(me,n);for(var De=Y.nextSibling,Ae=H?H.nodeValue.length-i:0;De;De=De.nextSibling){if(me=ce(De,De.firstChild,0),me)return hn(Ye(me.line,me.ch-Ae),n);Ae+=De.textContent.length}for(var Fe=Y.previousSibling,Ve=i;Fe;Fe=Fe.previousSibling){if(me=ce(Fe,Fe.firstChild,-1),me)return hn(Ye(me.line,me.ch+Ve),n);Ve+=Fe.textContent.length}}var rr=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new ee,this.hasSelection=!1,this.composing=null};rr.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),p&&(n.style.width="0px"),_e(n,"input",function(){j&&N>=9&&t.hasSelection&&(t.hasSelection=null),i.poll()}),_e(n,"paste",function(H){if(Ke(r,H)||As(H,r))return;r.state.pasteIncoming=+new Date,i.fastPoll()});function L(H){if(Ke(r,H))return;if(r.somethingSelected())oa({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var Y=ks(r);oa({lineWise:!0,text:Y.text}),H.type=="cut"?r.setSelections(Y.ranges,null,xe):(i.prevInput="",n.value=Y.text.join(`
`),V(n))}else return;H.type=="cut"&&(r.state.cutIncoming=+new Date)}_e(n,"cut",L),_e(n,"copy",L),_e(e.scroller,"paste",function(H){if(fi(e,H)||Ke(r,H))return;if(!n.dispatchEvent){r.state.pasteIncoming=+new Date,i.focus();return}var Y=new Event("paste");Y.clipboardData=H.clipboardData,n.dispatchEvent(Y)}),_e(e.lineSpace,"selectstart",function(H){fi(e,H)||re(H)}),_e(n,"compositionstart",function(){var H=r.getCursor("from");i.composing&&i.composing.range.clear(),i.composing={start:H,range:r.markText(H,r.getCursor("to"),{className:"CodeMirror-composing"})}}),_e(n,"compositionend",function(){i.composing&&(i.poll(),i.composing.range.clear(),i.composing=null)})},rr.prototype.createField=function(e){this.wrapper=Rs(),this.textarea=this.wrapper.firstChild},rr.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},rr.prototype.prepareSelection=function(){var e=this.cm,t=e.display,i=e.doc,r=yo(e);if(e.options.moveInputWithCursor){var n=Jr(e,i.sel.primary().head,"div"),L=t.wrapper.getBoundingClientRect(),H=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,n.top+H.top-L.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,n.left+H.left-L.left))}return r},rr.prototype.showSelection=function(e){var t=this.cm,i=t.display;d(i.cursorDiv,e.cursors),d(i.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},rr.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),j&&N>=9&&(this.hasSelection=i)}else e||(this.prevInput=this.textarea.value="",j&&N>=9&&(this.hasSelection=null))},rr.prototype.getField=function(){return this.textarea},rr.prototype.supportsTouch=function(){return!1},rr.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!a||M()!=this.textarea))try{this.textarea.focus()}catch(e){}},rr.prototype.blur=function(){this.textarea.blur()},rr.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},rr.prototype.receivedFocus=function(){this.slowPoll()},rr.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()})},rr.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)},rr.prototype.poll=function(){var e=this,t=this.cm,i=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||it(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(j&&N>=9&&this.hasSelection===n||s&&/[\uf700-\uf7ff]/.test(n))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var L=n.charCodeAt(0);if(L==8203&&!r&&(r="\u200B"),L==8666)return this.reset(),this.cm.execCommand("undo")}for(var H=0,Y=Math.min(r.length,n.length);H<Y&&r.charCodeAt(H)==n.charCodeAt(H);)++H;return Ur(t,function(){Va(t,n.slice(H),r.length-H,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},rr.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},rr.prototype.onKeyPress=function(){j&&N>=9&&(this.hasSelection=null),this.fastPoll()},rr.prototype.onContextMenu=function(e){var t=this,i=t.cm,r=i.display,n=t.textarea;t.contextMenuPending&&t.contextMenuPending();var L=Bi(i,e),H=r.scroller.scrollTop;if(!L||x)return;var Y=i.options.resetSelectionOnContextMenu;Y&&i.doc.sel.contains(L)==-1&&fr(i,Er)(i.doc,Ti(L),xe);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: `+(j?"rgba(255, 255, 255, .05)":"transparent")+`;
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var me;_&&(me=window.scrollY),r.input.focus(),_&&window.scrollTo(null,me),r.input.reset(),i.somethingSelected()||(n.value=t.prevInput=" "),t.contextMenuPending=Ae,r.selForContextMenu=i.doc.sel,clearTimeout(r.detectingSelectAll);function De(){if(n.selectionStart!=null){var Ve=i.somethingSelected(),Je="\u200B"+(Ve?n.value:"");n.value="\u21DA",n.value=Je,t.prevInput=Ve?"":"\u200B",n.selectionStart=1,n.selectionEnd=Je.length,r.selForContextMenu=i.doc.sel}}function Ae(){if(t.contextMenuPending!=Ae)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=q,n.style.cssText=Z,j&&N<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=H),n.selectionStart!=null){(!j||j&&N<9)&&De();var Ve=0,Je=function(){r.selForContextMenu==i.doc.sel&&n.selectionStart==0&&n.selectionEnd>0&&t.prevInput=="\u200B"?fr(i,Qo)(i):Ve++<10?r.detectingSelectAll=setTimeout(Je,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(Je,200)}}if(j&&N>=9&&De(),D){he(e);var Fe=function(){lt(window,"mouseup",Fe),setTimeout(Ae,20)};_e(window,"mouseup",Fe)}else setTimeout(Ae,50)},rr.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},rr.prototype.setUneditable=function(){},rr.prototype.needsContentAttribute=!1;function iu(e,t){if(t=t?B(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=M();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 L=e.form;n=L.submit;try{var H=L.submit=function(){r(),L.submit=n,L.submit(),L.submit=H}}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&&(lt(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=n))}},e.style.display="none";var Y=Qt(function(Z){return e.parentNode.insertBefore(Z,e.nextSibling)},t);return Y}function nu(e){e.off=lt,e.on=_e,e.wheelEventPixels=dl,e.Doc=Or,e.splitLines=ft,e.countColumn=X,e.findColumn=ge,e.isWordChar=Me,e.Pass=ke,e.signal=Ne,e.Line=Ei,e.changeEnd=wi,e.scrollbarModel=Ao,e.Pos=Ye,e.cmpPos=Tt,e.modes=Lt,e.mimeModes=Ze,e.resolveMode=yt,e.getMode=Wt,e.modeExtensions=nr,e.extendMode=ar,e.copyState=Cr,e.startState=Vr,e.innerMode=Ar,e.commands=Pn,e.keyMap=pi,e.keyName=cs,e.isModifierKey=hs,e.lookupKey=sn,e.normalizeKeyMap=Ml,e.StringStream=Bt,e.SharedTextMarker=On,e.TextMarker=Li,e.LineWidget=Rn,e.e_preventDefault=re,e.e_stopPropagation=ie,e.e_stop=he,e.addClass=F,e.contains=y,e.rmClass=g,e.keyNames=ki}$l(Qt),ql(Qt);var au="iter insert remove copy getEditor constructor".split(" ");for(var la in Or.prototype)Or.prototype.hasOwnProperty(la)&&oe(au,la)<0&&(Qt.prototype[la]=function(e){return function(){return e.apply(this.doc,arguments)}}(Or.prototype[la]));return be(Or),Qt.inputStyles={textarea:rr,contenteditable:Vt},Qt.defineMode=function(e){!Qt.defaults.mode&&e!="null"&&(Qt.defaults.mode=e),ir.apply(this,arguments)},Qt.defineMIME=Zt,Qt.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Qt.defineMIME("text/plain","null"),Qt.defineExtension=function(e,t){Qt.prototype[e]=t},Qt.defineDocExtension=function(e,t){Or.prototype[e]=t},Qt.fromTextArea=iu,nu(Qt),Qt.version="5.58.2",Qt})},Y1PL:function(dt,at,se){"use strict";se.r(at),se.d(at,"ResizableTextArea",function(){return oe});var ne=se("wx14"),$=se("1OyB"),R=se("vuIU"),Q=se("Ji7U"),U=se("LK+K"),O=se("q1tI"),j=se("VTBJ"),N=se("rePB"),_=se("Zm9Q"),A=se("Kwbf"),f=se("c+Xe"),x=se("m+aA"),P=se("bdgK"),w=new Map;function E(xe){xe.forEach(function(Te){var Ce,ge=Te.target;(Ce=w.get(ge))===null||Ce===void 0||Ce.forEach(function(pe){return pe(ge)})})}var p=new P.default(E),u=null,a=null;function s(xe,Te){w.has(xe)||(w.set(xe,new Set),p.observe(xe)),w.get(xe).add(Te)}function h(xe,Te){w.has(xe)&&(w.get(xe).delete(Te),w.get(xe).size||(p.unobserve(xe),w.delete(xe)))}var k=function(xe){Object(Q.a)(Ce,xe);var Te=Object(U.a)(Ce);function Ce(){return Object($.a)(this,Ce),Te.apply(this,arguments)}return Object(R.a)(Ce,[{key:"render",value:function(){return this.props.children}}]),Ce}(O.Component),c=O.createContext(null);function b(xe){var Te=xe.children,Ce=xe.onBatchResize,ge=O.useRef(0),pe=O.useRef([]),ue=O.useContext(c),te=O.useCallback(function(de,ae,we){ge.current+=1;var Re=ge.current;pe.current.push({size:de,element:ae,data:we}),Promise.resolve().then(function(){Re===ge.current&&(Ce==null||Ce(pe.current),pe.current=[])}),ue==null||ue(de,ae,we)},[Ce,ue]);return O.createElement(c.Provider,{value:te},Te)}function D(xe){var Te=xe.children,Ce=xe.disabled,ge=O.useRef(null),pe=O.useRef(null),ue=O.useContext(c),te=O.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),de=O.isValidElement(Te)&&Object(f.c)(Te),ae=de?Te.ref:null,we=O.useMemo(function(){return Object(f.a)(ae,ge)},[ae,ge]),Re=O.useRef(xe);Re.current=xe;var Ee=O.useCallback(function(Me){var Ie=Re.current,We=Ie.onResize,je=Ie.data,Be=Me.getBoundingClientRect(),Ue=Be.width,et=Be.height,ot=Me.offsetWidth,nt=Me.offsetHeight,qe=Math.floor(Ue),st=Math.floor(et);if(te.current.width!==qe||te.current.height!==st||te.current.offsetWidth!==ot||te.current.offsetHeight!==nt){var $e={width:qe,height:st,offsetWidth:ot,offsetHeight:nt};te.current=$e;var Qe=ot===Math.round(Ue)?Ue:ot,_e=nt===Math.round(et)?et:nt,ut=Object(j.a)(Object(j.a)({},$e),{},{offsetWidth:Qe,offsetHeight:_e});ue==null||ue(ut,Me,je),We&&Promise.resolve().then(function(){We(ut,Me)})}},[]);return O.useEffect(function(){var Me=Object(x.a)(ge.current)||Object(x.a)(pe.current);return Me&&!Ce&&s(Me,Ee),function(){return h(Me,Ee)}},[ge.current,Ce]),O.createElement(k,{ref:pe},de?O.cloneElement(Te,{ref:we}):Te)}var T="rc-observer-key";function g(xe){var Te=xe.children,Ce=Object(_.a)(Te);return Ce.map(function(ge,pe){var ue=(ge==null?void 0:ge.key)||"".concat(T,"-").concat(pe);return O.createElement(D,Object(ne.a)({},xe,{key:ue}),ge)})}g.Collection=b;var v=g,d=se("bT9E"),o=se("TSYQ"),C=se.n(o),S=`
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
`,y=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break"],M={},F;function W(xe){var Te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Ce=xe.getAttribute("id")||xe.getAttribute("data-reactid")||xe.getAttribute("name");if(Te&&M[Ce])return M[Ce];var ge=window.getComputedStyle(xe),pe=ge.getPropertyValue("box-sizing")||ge.getPropertyValue("-moz-box-sizing")||ge.getPropertyValue("-webkit-box-sizing"),ue=parseFloat(ge.getPropertyValue("padding-bottom"))+parseFloat(ge.getPropertyValue("padding-top")),te=parseFloat(ge.getPropertyValue("border-bottom-width"))+parseFloat(ge.getPropertyValue("border-top-width")),de=y.map(function(we){return"".concat(we,":").concat(ge.getPropertyValue(we))}).join(";"),ae={sizingStyle:de,paddingSize:ue,borderSize:te,boxSizing:pe};return Te&&Ce&&(M[Ce]=ae),ae}function V(xe){var Te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Ce=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,ge=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;F||(F=document.createElement("textarea"),F.setAttribute("tab-index","-1"),F.setAttribute("aria-hidden","true"),document.body.appendChild(F)),xe.getAttribute("wrap")?F.setAttribute("wrap",xe.getAttribute("wrap")):F.removeAttribute("wrap");var pe=W(xe,Te),ue=pe.paddingSize,te=pe.borderSize,de=pe.boxSizing,ae=pe.sizingStyle;F.setAttribute("style","".concat(ae,";").concat(S)),F.value=xe.value||xe.placeholder||"";var we=Number.MIN_SAFE_INTEGER,Re=Number.MAX_SAFE_INTEGER,Ee=F.scrollHeight,Me;if(de==="border-box"?Ee+=te:de==="content-box"&&(Ee-=ue),Ce!==null||ge!==null){F.value=" ";var Ie=F.scrollHeight-ue;Ce!==null&&(we=Ie*Ce,de==="border-box"&&(we=we+ue+te),Ee=Math.max(we,Ee)),ge!==null&&(Re=Ie*ge,de==="border-box"&&(Re=Re+ue+te),Me=Ee>Re?"":"hidden",Ee=Math.min(Re,Ee))}return{height:Ee,minHeight:we,maxHeight:Re,overflowY:Me,resize:"none"}}var I=se("Gytx"),B=se.n(I),X;(function(xe){xe[xe.NONE=0]="NONE",xe[xe.RESIZING=1]="RESIZING",xe[xe.RESIZED=2]="RESIZED"})(X||(X={}));var ee=function(xe){Object(Q.a)(Ce,xe);var Te=Object(U.a)(Ce);function Ce(ge){var pe;return Object($.a)(this,Ce),pe=Te.call(this,ge),pe.nextFrameActionId=void 0,pe.resizeFrameId=void 0,pe.textArea=void 0,pe.saveTextArea=function(ue){pe.textArea=ue},pe.handleResize=function(ue){var te=pe.state.resizeStatus,de=pe.props,ae=de.autoSize,we=de.onResize;if(te!==X.NONE)return;typeof we=="function"&&we(ue),ae&&pe.resizeOnNextFrame()},pe.resizeOnNextFrame=function(){cancelAnimationFrame(pe.nextFrameActionId),pe.nextFrameActionId=requestAnimationFrame(pe.resizeTextarea)},pe.resizeTextarea=function(){var ue=pe.props.autoSize;if(!ue||!pe.textArea)return;var te=ue.minRows,de=ue.maxRows,ae=V(pe.textArea,!1,te,de);pe.setState({textareaStyles:ae,resizeStatus:X.RESIZING},function(){cancelAnimationFrame(pe.resizeFrameId),pe.resizeFrameId=requestAnimationFrame(function(){pe.setState({resizeStatus:X.RESIZED},function(){pe.resizeFrameId=requestAnimationFrame(function(){pe.setState({resizeStatus:X.NONE}),pe.fixFirefoxAutoScroll()})})})})},pe.renderTextArea=function(){var ue=pe.props,te=ue.prefixCls,de=te===void 0?"rc-textarea":te,ae=ue.autoSize,we=ue.onResize,Re=ue.className,Ee=ue.disabled,Me=pe.state,Ie=Me.textareaStyles,We=Me.resizeStatus,je=Object(d.a)(pe.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Be=C()(de,Re,Object(N.a)({},"".concat(de,"-disabled"),Ee));"value"in je&&(je.value=je.value||"");var Ue=Object(j.a)(Object(j.a)(Object(j.a)({},pe.props.style),Ie),We===X.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return O.createElement(v,{onResize:pe.handleResize,disabled:!(ae||we)},O.createElement("textarea",Object(ne.a)({},je,{className:Be,style:Ue,ref:pe.saveTextArea})))},pe.state={textareaStyles:{},resizeStatus:X.NONE},pe}return Object(R.a)(Ce,[{key:"componentDidUpdate",value:function(pe){(pe.value!==this.props.value||!B()(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,ue=this.textArea.selectionEnd;this.textArea.setSelectionRange(pe,ue)}}catch(te){}}},{key:"render",value:function(){return this.renderTextArea()}}]),Ce}(O.Component),oe=ee,fe=function(xe){Object(Q.a)(Ce,xe);var Te=Object(U.a)(Ce);function Ce(ge){var pe;Object($.a)(this,Ce),pe=Te.call(this,ge),pe.resizableTextArea=void 0,pe.focus=function(){pe.resizableTextArea.textArea.focus()},pe.saveTextArea=function(te){pe.resizableTextArea=te},pe.handleChange=function(te){var de=pe.props.onChange;pe.setValue(te.target.value,function(){pe.resizableTextArea.resizeTextarea()}),de&&de(te)},pe.handleKeyDown=function(te){var de=pe.props,ae=de.onPressEnter,we=de.onKeyDown;te.keyCode===13&&ae&&ae(te),we&&we(te)};var ue=typeof ge.value=="undefined"||ge.value===null?ge.defaultValue:ge.value;return pe.state={value:ue},pe}return Object(R.a)(Ce,[{key:"setValue",value:function(pe,ue){"value"in this.props||this.setState({value:pe},ue)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return O.createElement(oe,Object(ne.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}}]),Ce}(O.Component),ke=at.default=fe},ZW9T:function(dt,at,se){"use strict";se.d(at,"a",function(){return k});var ne=se("k1fw"),$=se("miYZ"),R=se("tsqr"),Q=se("rAM+"),U=se("tJVT"),O=se("PpiC"),j=se("q1tI"),N=se.n(j),_=se("bdgK");function A(c,b,D,T,g){var v=b.getWordUntilPosition(D),d={startLineNumber:D.lineNumber,endLineNumber:D.lineNumber,startColumn:v.startColumn,endColumn:v.endColumn},o=T.map(function(C){return{label:C,kind:c.languages.CompletionItemKind.Keyword,insertText:C,insertTextRules:c.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:d}});return g.map(function(C){o.push(Object(ne.a)(Object(ne.a)({},C),{},{range:d}))}),o}var f=function(c){var b={label:"ifelse",kind:c.languages.CompletionItemKind.Method,insertText:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
`),insertTextRules:c.languages.CompletionItemInsertTextRule.InsertAsSnippet},D=["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(d,o){var C=A(c,d,o,D,[b]);return{suggestions:C}}});var T=["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(d,o){var C=[{label:"print",kind:c.languages.CompletionItemKind.Snippet,insertText:["print($0)"].join(`
`),insertTextRules:c.languages.CompletionItemInsertTextRule.InsertAsSnippet}],S=A(c,d,o,T,C);return{suggestions:S}}});var g=["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(d,o){var C=[b,{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}],S=A(c,d,o,g,C);return{suggestions:S}}})},x="\u8BE5\u4EFB\u52A1\u5173\u5361\u8BBE\u7F6E\u4E86\u7981\u6B62\u590D\u5236\u7C98\u8D34\uFF0C\u8BF7\u624B\u52A8\u8F93\u5165\u4EE3\u7801\u3002",P=se("LvDl");function w(c){return/^\d+$/.test(c)?"".concat(c,"px"):c}function E(){}var p=!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 a(){var c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],b=c;if(Array.isArray(c)){for(var D=0;D<c.length;D++){var T=u[c[D]];if(T)return T}return b[0]}return u[b]||b}var s=null,h=at.b=function(c){var b=c.width,D=b===void 0?"100%":b,T=c.height,g=T===void 0?"100%":T,v=c.value,d=c.language,o=d===void 0?"javascript":d,C=c.style,S=C===void 0?{}:C,y=c.options,M=y===void 0?{}:y,F=c.overrideServices,W=F===void 0?{}:F,V=c.theme,I=V===void 0?"vs-dark":V,B=c.onEditBlur,X=c.onSave,ee=c.autoHeight,oe=ee===void 0?!1:ee,fe=c.forbidCopy,ke=fe===void 0?!1:fe,xe=c.onChange,Te=xe===void 0?E:xe,Ce=c.editorDidMount,ge=Ce===void 0?E:Ce,pe=c.onFocus,ue=pe===void 0?E:pe,te=c.filename,de=te===void 0?"educoder.txt":te,ae=Object(O.a)(c,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename"]),we=Object(j.useRef)(),Re=Object(j.useRef)({}),Ee=Object(j.useRef)(),Me=Object(j.useRef)(!1),Ie=Object(j.useRef)(),We=Object(j.useState)(!1),je=Object(U.a)(We,2),Be=je[0],Ue=je[1];function et(){var le;return we.current&&(le=new _.default(function(he){var Le=Object(Q.a)(he),Pe;try{for(Le.s();!(Pe=Le.n()).done;){var Xe=Pe.value;(Xe.target.offsetHeight>0||Xe.target.offsetWidth>0)&&Re.current.instance.layout()}}catch(vt){Le.e(vt)}finally{Le.f()}}),le.observe(we.current)),le}function ot(){R.b.warn(decodeURIComponent(x))}var nt=function(){var he=Re.current.instance;if(v!=null&&he&&Be){var Le=he.getModel();Le&&v!==Le.getValue()&&(p=!0,Le.setValue(v),he.layout(),p=!1)}};Object(j.useEffect)(function(){Ee.current&&clearTimeout(Ee.current),Ee.current=setTimeout(function(){nt()},500)},[v,Be,Re.current]);function qe(){var le=Re.current.instance;if(le){var he=le.getSelection(),Le=Re.current.pastePos||{},Pe=new s.Range(Le.startLineNumber||he.endLineNumber,Le.startColumn||he.endColumn,Le.endLineNumber||he.endLineNumber,Le.endColumn||he.endColumn);setTimeout(function(){le.executeEdits("",[{range:Pe,text:""}])},300)}}function st(le){(window.navigator.platform.match("Mac")?le.metaKey:le.ctrlKey)&&le.keyCode==83&&(le.preventDefault(),X())}var $e=function(){if(oe&&Re.current.instance){var he=Re.current.instance.getContentHeight();re(he<g?g:he)}else re(g)};function Qe(le){var he=document.createEvent("MouseEvents");he.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),le.dispatchEvent(he)}function _e(le,he){var Le=window.URL||window.webkitURL||window,Pe=new Blob([he]),Xe=document.createElementNS("http://www.w3.org/1999/xhtml","a");Xe.href=Le.createObjectURL(Pe),Xe.download=le,Qe(Xe)}Object(j.useEffect)(function(){$e()},[$e]),Object(j.useEffect)(function(){we.current&&!Be&&se.e(27).then(se.t.bind(null,"M/lh",7)).then(function(le){try{s=le,Re.current.instance=s.editor.create(we.current,{value:v,language:a(o),theme:I,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0},W);var he=Re.current.instance;if(ge(he,s),setTimeout(function(){$e(),Re.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){_e(de||"educoder.txt",he.getValue())}})},500),Re.current.subscription=he.onDidChangeModelContent(function(Pe){Me.current?clearTimeout(Ie.current):($e(),Te(he.getValue(),Pe)),Ie.current=setTimeout(function(){Me.current=!1},500)}),window.Monaco||f(s),ke&&(he.addCommand(s.KeyMod.CtrlCmd|s.KeyMod.Shift|s.KeyCode.KEY_V,function(){return ot(),null}),he.addCommand(s.KeyMod.CtrlCmd|s.KeyCode.KEY_C,function(){return ot(),null})),window.Monaco=s,B&&he.onDidBlurEditorWidget(function(){B(he.getValue())}),ue&&he.onDidFocusEditorText(function(){ue(he.getValue())}),ke){he.addCommand(s.KeyMod.CtrlCmd|s.KeyCode.KEY_V,function(){return ot(),null}),he.onDidPaste(function(Pe){Re.current.pastePos=Pe});try{window.addEventListener("paste",qe)}catch(Pe){}}var Le=et();return Ue(!0),function(){var Pe=Re.current.instance;Pe.dispose();var Xe=Pe.getModel();Xe&&Xe.dispose(),Re.current.subscription&&Re.current.subscription.dispose(),ke&&window.removeEventListener("paste",qe),Le.unobserve(we.current)}}catch(Pe){}})},[]),Object(j.useEffect)(function(){var le=Re.current.instance;if(le&&Be)return document.addEventListener("keydown",st,!1),function(){document.removeEventListener("keydown",st)}},[X,Be]),Object(j.useEffect)(function(){var le=Re.current.instance;if(le&&Be){var he=a(o);s.editor.setModelLanguage(le.getModel(),he),console.log("language:",o,le.getModel(),he)}},[o,Be]),Object(j.useEffect)(function(){var le=Re.current.instance;le&&Be&&s.editor.setTheme(I)},[I,Be]),Object(j.useEffect)(function(){var le=Re.current.instance;le&&Be&&(le.updateOptions(Object(ne.a)({},M)),setTimeout(function(){le.getModel().updateOptions(Object(ne.a)({},M))},200))},[JSON.stringify(M),Be]),Object(j.useEffect)(function(){var le=Re.current.instance;le&&Be&&le.layout()},[D,g,Be]);var ut=Object(j.useState)(w(D)),lt=Object(U.a)(ut,2),Ne=lt[0],Ke=lt[1],Se=Object(j.useState)(w(g)),ve=Object(U.a)(Se,2),be=ve[0],re=ve[1],ie=Object(ne.a)(Object(ne.a)({},S),{},{width:Ne,height:be});return N.a.createElement("div",{className:"my-monaco-editor",ref:we,style:ie})};function k(c){var b=c.width,D=b===void 0?"100%":b,T=c.height,g=T===void 0?"100%":T,v=c.original,d=c.modified,o=c.language,C=c.options,S=C===void 0?{}:C,y=Object(j.useRef)(),M=Object(j.useState)(null),F=Object(U.a)(M,2),W=F[0],V=F[1];function I(oe){var fe;return y.current&&(fe=new _.default(function(ke){var xe=Object(Q.a)(ke),Te;try{for(xe.s();!(Te=xe.n()).done;){var Ce=Te.value;(Ce.target.offsetHeight>0||Ce.target.offsetWidth>0)&&oe.layout()}}catch(ge){xe.e(ge)}finally{xe.f()}}),fe.observe(y.current)),fe}Object(j.useEffect)(function(){y.current&&se.e(27).then(se.t.bind(null,"M/lh",7)).then(function(oe){s=oe;var fe=s.editor.createDiffEditor(y.current,Object(ne.a)(Object(ne.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},S),{},{wordWrap:!0}));V(fe);var ke=I(fe);return function(){fe.dispose();var xe=fe.getModel();xe&&xe.dispose(),ke.unobserve(y.current)}})},[]),Object(j.useEffect)(function(){W&&W.setModel({original:s.editor.createModel(v,o),modified:s.editor.createModel(d,o)})},[v,d,o,W]);var B=w(D),X=w(g),ee={width:B,height:X};return N.a.createElement("div",{className:"my-diff-editor",ref:y,style:ee})}},ZpRC:function(dt,at,se){"use strict";function ne(f){return typeof f=="object"&&f!=null&&f.nodeType===1}function $(f,x){return(!x||f!=="hidden")&&f!=="visible"&&f!=="clip"}function R(f,x){if(f.clientHeight<f.scrollHeight||f.clientWidth<f.scrollWidth){var P=getComputedStyle(f,null);return $(P.overflowY,x)||$(P.overflowX,x)||function(w){var E=function(p){if(!p.ownerDocument||!p.ownerDocument.defaultView)return null;try{return p.ownerDocument.defaultView.frameElement}catch(u){return null}}(w);return!!E&&(E.clientHeight<w.scrollHeight||E.clientWidth<w.scrollWidth)}(f)}return!1}function Q(f,x,P,w,E,p,u,a){return p<f&&u>x||p>f&&u<x?0:p<=f&&a<=P||u>=x&&a>=P?p-f-w:u>x&&a<P||p<f&&a>P?u-x+E:0}var U=function(f,x){var P=window,w=x.scrollMode,E=x.block,p=x.inline,u=x.boundary,a=x.skipOverflowHiddenElements,s=typeof u=="function"?u:function(Ie){return Ie!==u};if(!ne(f))throw new TypeError("Invalid target");for(var h=document.scrollingElement||document.documentElement,k=[],c=f;ne(c)&&s(c);){if((c=c.parentElement)===h){k.push(c);break}c!=null&&c===document.body&&R(c)&&!R(document.documentElement)||c!=null&&R(c,a)&&k.push(c)}for(var b=P.visualViewport?P.visualViewport.width:innerWidth,D=P.visualViewport?P.visualViewport.height:innerHeight,T=window.scrollX||pageXOffset,g=window.scrollY||pageYOffset,v=f.getBoundingClientRect(),d=v.height,o=v.width,C=v.top,S=v.right,y=v.bottom,M=v.left,F=E==="start"||E==="nearest"?C:E==="end"?y:C+d/2,W=p==="center"?M+o/2:p==="end"?S:M,V=[],I=0;I<k.length;I++){var B=k[I],X=B.getBoundingClientRect(),ee=X.height,oe=X.width,fe=X.top,ke=X.right,xe=X.bottom,Te=X.left;if(w==="if-needed"&&C>=0&&M>=0&&y<=D&&S<=b&&C>=fe&&y<=xe&&M>=Te&&S<=ke)return V;var Ce=getComputedStyle(B),ge=parseInt(Ce.borderLeftWidth,10),pe=parseInt(Ce.borderTopWidth,10),ue=parseInt(Ce.borderRightWidth,10),te=parseInt(Ce.borderBottomWidth,10),de=0,ae=0,we="offsetWidth"in B?B.offsetWidth-B.clientWidth-ge-ue:0,Re="offsetHeight"in B?B.offsetHeight-B.clientHeight-pe-te:0;if(h===B)de=E==="start"?F:E==="end"?F-D:E==="nearest"?Q(g,g+D,D,pe,te,g+F,g+F+d,d):F-D/2,ae=p==="start"?W:p==="center"?W-b/2:p==="end"?W-b:Q(T,T+b,b,ge,ue,T+W,T+W+o,o),de=Math.max(0,de+g),ae=Math.max(0,ae+T);else{de=E==="start"?F-fe-pe:E==="end"?F-xe+te+Re:E==="nearest"?Q(fe,xe,ee,pe,te+Re,F,F+d,d):F-(fe+ee/2)+Re/2,ae=p==="start"?W-Te-ge:p==="center"?W-(Te+oe/2)+we/2:p==="end"?W-ke+ue+we:Q(Te,ke,oe,ge,ue+we,W,W+o,o);var Ee=B.scrollLeft,Me=B.scrollTop;F+=Me-(de=Math.max(0,Math.min(Me+de,B.scrollHeight-ee+Re))),W+=Ee-(ae=Math.max(0,Math.min(Ee+ae,B.scrollWidth-oe+we)))}V.push({el:B,top:de,left:ae})}return V};function O(f){return f===Object(f)&&Object.keys(f).length!==0}function j(f,x){x===void 0&&(x="auto");var P="scrollBehavior"in document.body.style;f.forEach(function(w){var E=w.el,p=w.top,u=w.left;E.scroll&&P?E.scroll({top:p,left:u,behavior:x}):(E.scrollTop=p,E.scrollLeft=u)})}function N(f){return f===!1?{block:"end",inline:"nearest"}:O(f)?f:{block:"start",inline:"nearest"}}function _(f,x){var P=!f.ownerDocument.documentElement.contains(f);if(O(x)&&typeof x.behavior=="function")return x.behavior(P?[]:U(f,x));if(P)return;var w=N(x);return j(U(f,w),w.behavior)}var A=at.a=_},Zss7:function(dt,at,se){var ne;(function($){var R=/^\s+/,Q=/\s+$/,U=0,O=$.round,j=$.min,N=$.max,_=$.random;function A(te,de){if(te=te||"",de=de||{},te instanceof A)return te;if(!(this instanceof A))return new A(te,de);var ae=f(te);this._originalInput=te,this._r=ae.r,this._g=ae.g,this._b=ae.b,this._a=ae.a,this._roundA=O(100*this._a)/100,this._format=de.format||ae.format,this._gradientType=de.gradientType,this._r<1&&(this._r=O(this._r)),this._g<1&&(this._g=O(this._g)),this._b<1&&(this._b=O(this._b)),this._ok=ae.ok,this._tc_id=U++}A.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(),de,ae,we,Re,Ee,Me;return de=te.r/255,ae=te.g/255,we=te.b/255,de<=.03928?Re=de/12.92:Re=$.pow((de+.055)/1.055,2.4),ae<=.03928?Ee=ae/12.92:Ee=$.pow((ae+.055)/1.055,2.4),we<=.03928?Me=we/12.92:Me=$.pow((we+.055)/1.055,2.4),.2126*Re+.7152*Ee+.0722*Me},setAlpha:function(te){return this._a=V(te),this._roundA=O(100*this._a)/100,this},toHsv:function(){var te=E(this._r,this._g,this._b);return{h:te.h*360,s:te.s,v:te.v,a:this._a}},toHsvString:function(){var te=E(this._r,this._g,this._b),de=O(te.h*360),ae=O(te.s*100),we=O(te.v*100);return this._a==1?"hsv("+de+", "+ae+"%, "+we+"%)":"hsva("+de+", "+ae+"%, "+we+"%, "+this._roundA+")"},toHsl:function(){var te=P(this._r,this._g,this._b);return{h:te.h*360,s:te.s,l:te.l,a:this._a}},toHslString:function(){var te=P(this._r,this._g,this._b),de=O(te.h*360),ae=O(te.s*100),we=O(te.l*100);return this._a==1?"hsl("+de+", "+ae+"%, "+we+"%)":"hsla("+de+", "+ae+"%, "+we+"%, "+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 a(this._r,this._g,this._b,this._a,te)},toHex8String:function(te){return"#"+this.toHex8(te)},toRgb:function(){return{r:O(this._r),g:O(this._g),b:O(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+O(this._r)+", "+O(this._g)+", "+O(this._b)+")":"rgba("+O(this._r)+", "+O(this._g)+", "+O(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:O(I(this._r,255)*100)+"%",g:O(I(this._g,255)*100)+"%",b:O(I(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+O(I(this._r,255)*100)+"%, "+O(I(this._g,255)*100)+"%, "+O(I(this._b,255)*100)+"%)":"rgba("+O(I(this._r,255)*100)+"%, "+O(I(this._g,255)*100)+"%, "+O(I(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:F[u(this._r,this._g,this._b,!0)]||!1},toFilter:function(te){var de="#"+s(this._r,this._g,this._b,this._a),ae=de,we=this._gradientType?"GradientType = 1, ":"";if(te){var Re=A(te);ae="#"+s(Re._r,Re._g,Re._b,Re._a)}return"progid:DXImageTransform.Microsoft.gradient("+we+"startColorstr="+de+",endColorstr="+ae+")"},toString:function(te){var de=!!te;te=te||this._format;var ae=!1,we=this._a<1&&this._a>=0,Re=!de&&we&&(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"&&(ae=this.toRgbString()),te==="prgb"&&(ae=this.toPercentageRgbString()),(te==="hex"||te==="hex6")&&(ae=this.toHexString()),te==="hex3"&&(ae=this.toHexString(!0)),te==="hex4"&&(ae=this.toHex8String(!0)),te==="hex8"&&(ae=this.toHex8String()),te==="name"&&(ae=this.toName()),te==="hsl"&&(ae=this.toHslString()),te==="hsv"&&(ae=this.toHsvString()),ae||this.toHexString())},clone:function(){return A(this.toString())},_applyModification:function(te,de){var ae=te.apply(null,[this].concat([].slice.call(de)));return this._r=ae._r,this._g=ae._g,this._b=ae._b,this.setAlpha(ae._a),this},lighten:function(){return this._applyModification(b,arguments)},brighten:function(){return this._applyModification(D,arguments)},darken:function(){return this._applyModification(T,arguments)},desaturate:function(){return this._applyModification(h,arguments)},saturate:function(){return this._applyModification(k,arguments)},greyscale:function(){return this._applyModification(c,arguments)},spin:function(){return this._applyModification(g,arguments)},_applyCombination:function(te,de){return te.apply(null,[this].concat([].slice.call(de)))},analogous:function(){return this._applyCombination(S,arguments)},complement:function(){return this._applyCombination(v,arguments)},monochromatic:function(){return this._applyCombination(y,arguments)},splitcomplement:function(){return this._applyCombination(C,arguments)},triad:function(){return this._applyCombination(d,arguments)},tetrad:function(){return this._applyCombination(o,arguments)}},A.fromRatio=function(te,de){if(typeof te=="object"){var ae={};for(var we in te)te.hasOwnProperty(we)&&(we==="a"?ae[we]=te[we]:ae[we]=ke(te[we]));te=ae}return A(te,de)};function f(te){var de={r:0,g:0,b:0},ae=1,we=null,Re=null,Ee=null,Me=!1,Ie=!1;return typeof te=="string"&&(te=pe(te)),typeof te=="object"&&(ge(te.r)&&ge(te.g)&&ge(te.b)?(de=x(te.r,te.g,te.b),Me=!0,Ie=String(te.r).substr(-1)==="%"?"prgb":"rgb"):ge(te.h)&&ge(te.s)&&ge(te.v)?(we=ke(te.s),Re=ke(te.v),de=p(te.h,we,Re),Me=!0,Ie="hsv"):ge(te.h)&&ge(te.s)&&ge(te.l)&&(we=ke(te.s),Ee=ke(te.l),de=w(te.h,we,Ee),Me=!0,Ie="hsl"),te.hasOwnProperty("a")&&(ae=te.a)),ae=V(ae),{ok:Me,format:te.format||Ie,r:j(255,N(de.r,0)),g:j(255,N(de.g,0)),b:j(255,N(de.b,0)),a:ae}}function x(te,de,ae){return{r:I(te,255)*255,g:I(de,255)*255,b:I(ae,255)*255}}function P(te,de,ae){te=I(te,255),de=I(de,255),ae=I(ae,255);var we=N(te,de,ae),Re=j(te,de,ae),Ee,Me,Ie=(we+Re)/2;if(we==Re)Ee=Me=0;else{var We=we-Re;Me=Ie>.5?We/(2-we-Re):We/(we+Re);switch(we){case te:Ee=(de-ae)/We+(de<ae?6:0);break;case de:Ee=(ae-te)/We+2;break;case ae:Ee=(te-de)/We+4;break}Ee/=6}return{h:Ee,s:Me,l:Ie}}function w(te,de,ae){var we,Re,Ee;te=I(te,360),de=I(de,100),ae=I(ae,100);function Me(je,Be,Ue){return Ue<0&&(Ue+=1),Ue>1&&(Ue-=1),Ue<1/6?je+(Be-je)*6*Ue:Ue<1/2?Be:Ue<2/3?je+(Be-je)*(2/3-Ue)*6:je}if(de===0)we=Re=Ee=ae;else{var Ie=ae<.5?ae*(1+de):ae+de-ae*de,We=2*ae-Ie;we=Me(We,Ie,te+1/3),Re=Me(We,Ie,te),Ee=Me(We,Ie,te-1/3)}return{r:we*255,g:Re*255,b:Ee*255}}function E(te,de,ae){te=I(te,255),de=I(de,255),ae=I(ae,255);var we=N(te,de,ae),Re=j(te,de,ae),Ee,Me,Ie=we,We=we-Re;if(Me=we===0?0:We/we,we==Re)Ee=0;else{switch(we){case te:Ee=(de-ae)/We+(de<ae?6:0);break;case de:Ee=(ae-te)/We+2;break;case ae:Ee=(te-de)/We+4;break}Ee/=6}return{h:Ee,s:Me,v:Ie}}function p(te,de,ae){te=I(te,360)*6,de=I(de,100),ae=I(ae,100);var we=$.floor(te),Re=te-we,Ee=ae*(1-de),Me=ae*(1-Re*de),Ie=ae*(1-(1-Re)*de),We=we%6,je=[ae,Me,Ee,Ee,Ie,ae][We],Be=[Ie,ae,ae,Me,Ee,Ee][We],Ue=[Ee,Ee,Ie,ae,ae,Me][We];return{r:je*255,g:Be*255,b:Ue*255}}function u(te,de,ae,we){var Re=[fe(O(te).toString(16)),fe(O(de).toString(16)),fe(O(ae).toString(16))];return we&&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 a(te,de,ae,we,Re){var Ee=[fe(O(te).toString(16)),fe(O(de).toString(16)),fe(O(ae).toString(16)),fe(xe(we))];return Re&&Ee[0].charAt(0)==Ee[0].charAt(1)&&Ee[1].charAt(0)==Ee[1].charAt(1)&&Ee[2].charAt(0)==Ee[2].charAt(1)&&Ee[3].charAt(0)==Ee[3].charAt(1)?Ee[0].charAt(0)+Ee[1].charAt(0)+Ee[2].charAt(0)+Ee[3].charAt(0):Ee.join("")}function s(te,de,ae,we){var Re=[fe(xe(we)),fe(O(te).toString(16)),fe(O(de).toString(16)),fe(O(ae).toString(16))];return Re.join("")}A.equals=function(te,de){return!te||!de?!1:A(te).toRgbString()==A(de).toRgbString()},A.random=function(){return A.fromRatio({r:_(),g:_(),b:_()})};function h(te,de){de=de===0?0:de||10;var ae=A(te).toHsl();return ae.s-=de/100,ae.s=B(ae.s),A(ae)}function k(te,de){de=de===0?0:de||10;var ae=A(te).toHsl();return ae.s+=de/100,ae.s=B(ae.s),A(ae)}function c(te){return A(te).desaturate(100)}function b(te,de){de=de===0?0:de||10;var ae=A(te).toHsl();return ae.l+=de/100,ae.l=B(ae.l),A(ae)}function D(te,de){de=de===0?0:de||10;var ae=A(te).toRgb();return ae.r=N(0,j(255,ae.r-O(255*-(de/100)))),ae.g=N(0,j(255,ae.g-O(255*-(de/100)))),ae.b=N(0,j(255,ae.b-O(255*-(de/100)))),A(ae)}function T(te,de){de=de===0?0:de||10;var ae=A(te).toHsl();return ae.l-=de/100,ae.l=B(ae.l),A(ae)}function g(te,de){var ae=A(te).toHsl(),we=(ae.h+de)%360;return ae.h=we<0?360+we:we,A(ae)}function v(te){var de=A(te).toHsl();return de.h=(de.h+180)%360,A(de)}function d(te){var de=A(te).toHsl(),ae=de.h;return[A(te),A({h:(ae+120)%360,s:de.s,l:de.l}),A({h:(ae+240)%360,s:de.s,l:de.l})]}function o(te){var de=A(te).toHsl(),ae=de.h;return[A(te),A({h:(ae+90)%360,s:de.s,l:de.l}),A({h:(ae+180)%360,s:de.s,l:de.l}),A({h:(ae+270)%360,s:de.s,l:de.l})]}function C(te){var de=A(te).toHsl(),ae=de.h;return[A(te),A({h:(ae+72)%360,s:de.s,l:de.l}),A({h:(ae+216)%360,s:de.s,l:de.l})]}function S(te,de,ae){de=de||6,ae=ae||30;var we=A(te).toHsl(),Re=360/ae,Ee=[A(te)];for(we.h=(we.h-(Re*de>>1)+720)%360;--de;)we.h=(we.h+Re)%360,Ee.push(A(we));return Ee}function y(te,de){de=de||6;for(var ae=A(te).toHsv(),we=ae.h,Re=ae.s,Ee=ae.v,Me=[],Ie=1/de;de--;)Me.push(A({h:we,s:Re,v:Ee})),Ee=(Ee+Ie)%1;return Me}A.mix=function(te,de,ae){ae=ae===0?0:ae||50;var we=A(te).toRgb(),Re=A(de).toRgb(),Ee=ae/100,Me={r:(Re.r-we.r)*Ee+we.r,g:(Re.g-we.g)*Ee+we.g,b:(Re.b-we.b)*Ee+we.b,a:(Re.a-we.a)*Ee+we.a};return A(Me)},A.readability=function(te,de){var ae=A(te),we=A(de);return($.max(ae.getLuminance(),we.getLuminance())+.05)/($.min(ae.getLuminance(),we.getLuminance())+.05)},A.isReadable=function(te,de,ae){var we=A.readability(te,de),Re,Ee;Ee=!1,Re=ue(ae);switch(Re.level+Re.size){case"AAsmall":case"AAAlarge":Ee=we>=4.5;break;case"AAlarge":Ee=we>=3;break;case"AAAsmall":Ee=we>=7;break}return Ee},A.mostReadable=function(te,de,ae){var we=null,Re=0,Ee,Me,Ie,We;ae=ae||{},Me=ae.includeFallbackColors,Ie=ae.level,We=ae.size;for(var je=0;je<de.length;je++)Ee=A.readability(te,de[je]),Ee>Re&&(Re=Ee,we=A(de[je]));return A.isReadable(te,we,{level:Ie,size:We})||!Me?we:(ae.includeFallbackColors=!1,A.mostReadable(te,["#fff","#000"],ae))};var M=A.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},F=A.hexNames=W(M);function W(te){var de={};for(var ae in te)te.hasOwnProperty(ae)&&(de[te[ae]]=ae);return de}function V(te){return te=parseFloat(te),(isNaN(te)||te<0||te>1)&&(te=1),te}function I(te,de){ee(te)&&(te="100%");var ae=oe(te);return te=j(de,N(0,parseFloat(te))),ae&&(te=parseInt(te*de,10)/100),$.abs(te-de)<1e-6?1:te%de/parseFloat(de)}function B(te){return j(1,N(0,te))}function X(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 ke(te){return te<=1&&(te=te*100+"%"),te}function xe(te){return $.round(parseFloat(te)*255).toString(16)}function Te(te){return X(te)/255}var Ce=function(){var te="[-\\+]?\\d+%?",de="[-\\+]?\\d*\\.\\d+%?",ae="(?:"+de+")|(?:"+te+")",we="[\\s|\\(]+("+ae+")[,|\\s]+("+ae+")[,|\\s]+("+ae+")\\s*\\)?",Re="[\\s|\\(]+("+ae+")[,|\\s]+("+ae+")[,|\\s]+("+ae+")[,|\\s]+("+ae+")\\s*\\)?";return{CSS_UNIT:new RegExp(ae),rgb:new RegExp("rgb"+we),rgba:new RegExp("rgba"+Re),hsl:new RegExp("hsl"+we),hsla:new RegExp("hsla"+Re),hsv:new RegExp("hsv"+we),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 ge(te){return!!Ce.CSS_UNIT.exec(te)}function pe(te){te=te.replace(R,"").replace(Q,"").toLowerCase();var de=!1;if(M[te])te=M[te],de=!0;else if(te=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var ae;return(ae=Ce.rgb.exec(te))?{r:ae[1],g:ae[2],b:ae[3]}:(ae=Ce.rgba.exec(te))?{r:ae[1],g:ae[2],b:ae[3],a:ae[4]}:(ae=Ce.hsl.exec(te))?{h:ae[1],s:ae[2],l:ae[3]}:(ae=Ce.hsla.exec(te))?{h:ae[1],s:ae[2],l:ae[3],a:ae[4]}:(ae=Ce.hsv.exec(te))?{h:ae[1],s:ae[2],v:ae[3]}:(ae=Ce.hsva.exec(te))?{h:ae[1],s:ae[2],v:ae[3],a:ae[4]}:(ae=Ce.hex8.exec(te))?{r:X(ae[1]),g:X(ae[2]),b:X(ae[3]),a:Te(ae[4]),format:de?"name":"hex8"}:(ae=Ce.hex6.exec(te))?{r:X(ae[1]),g:X(ae[2]),b:X(ae[3]),format:de?"name":"hex"}:(ae=Ce.hex4.exec(te))?{r:X(ae[1]+""+ae[1]),g:X(ae[2]+""+ae[2]),b:X(ae[3]+""+ae[3]),a:Te(ae[4]+""+ae[4]),format:de?"name":"hex8"}:(ae=Ce.hex3.exec(te))?{r:X(ae[1]+""+ae[1]),g:X(ae[2]+""+ae[2]),b:X(ae[3]+""+ae[3]),format:de?"name":"hex"}:!1}function ue(te){var de,ae;return te=te||{level:"AA",size:"small"},de=(te.level||"AA").toUpperCase(),ae=(te.size||"small").toLowerCase(),de!=="AA"&&de!=="AAA"&&(de="AA"),ae!=="small"&&ae!=="large"&&(ae="small"),{level:de,size:ae}}dt.exports?dt.exports=A:!(ne=function(){return A}.call(at,se,at,dt),ne!==void 0&&(dt.exports=ne))})(Math)},aRTE:function(dt,at){dt.exports={L:1,M:0,Q:3,H:2}},bT9E:function(dt,at,se){"use strict";se.d(at,"a",function(){return $});var ne=se("VTBJ");function $(R,Q){var U=Object(ne.a)({},R);return Array.isArray(Q)&&Q.forEach(function(O){delete U[O]}),U}},c5Ni:function(dt,at,se){},dQei:function(dt,at){for(var se={glog:function($){if($<1)throw new Error("glog("+$+")");return se.LOG_TABLE[$]},gexp:function($){for(;$<0;)$+=255;for(;$>=256;)$-=255;return se.EXP_TABLE[$]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)},ne=0;ne<8;ne++)se.EXP_TABLE[ne]=1<<ne;for(var ne=8;ne<256;ne++)se.EXP_TABLE[ne]=se.EXP_TABLE[ne-4]^se.EXP_TABLE[ne-5]^se.EXP_TABLE[ne-6]^se.EXP_TABLE[ne-8];for(var ne=0;ne<255;ne++)se.LOG_TABLE[se.EXP_TABLE[ne]]=ne;dt.exports=se},dWSS:function(dt,at,se){var ne=se("dQei");function $(R,Q){if(R.length==null)throw new Error(R.length+"/"+Q);for(var U=0;U<R.length&&R[U]==0;)U++;this.num=new Array(R.length-U+Q);for(var O=0;O<R.length-U;O++)this.num[O]=R[O+U]}$.prototype={get:function(R){return this.num[R]},getLength:function(){return this.num.length},multiply:function(R){for(var Q=new Array(this.getLength()+R.getLength()-1),U=0;U<this.getLength();U++)for(var O=0;O<R.getLength();O++)Q[U+O]^=ne.gexp(ne.glog(this.get(U))+ne.glog(R.get(O)));return new $(Q,0)},mod:function(R){if(this.getLength()-R.getLength()<0)return this;for(var Q=ne.glog(this.get(0))-ne.glog(R.get(0)),U=new Array(this.getLength()),O=0;O<this.getLength();O++)U[O]=this.get(O);for(var O=0;O<R.getLength();O++)U[O]^=ne.gexp(ne.glog(R.get(O))+Q);return new $(U,0).mod(R)}},dt.exports=$},dejd:function(dt,at,se){},dmUQ:function(dt,at,se){"use strict";var ne=se("Ff2n"),$=se("rePB"),R=se("1OyB"),Q=se("vuIU"),U=se("Ji7U"),O=se("md7G"),j=se("foSv"),N=se("q1tI"),_=se.n(N),A=se("TSYQ"),f=se.n(A),x=se("4IlW");function P(d,o){var C=Object.keys(d);if(Object.getOwnPropertySymbols){var S=Object.getOwnPropertySymbols(d);o&&(S=S.filter(function(y){return Object.getOwnPropertyDescriptor(d,y).enumerable})),C.push.apply(C,S)}return C}function w(d){for(var o=1;o<arguments.length;o++){var C=arguments[o]!=null?arguments[o]:{};o%2?P(Object(C),!0).forEach(function(S){Object($.a)(d,S,C[S])}):Object.getOwnPropertyDescriptors?Object.defineProperties(d,Object.getOwnPropertyDescriptors(C)):P(Object(C)).forEach(function(S){Object.defineProperty(d,S,Object.getOwnPropertyDescriptor(C,S))})}return d}function E(d){var o=p();return function(){var S=Object(j.a)(d),y;if(o){var M=Object(j.a)(this).constructor;y=Reflect.construct(S,arguments,M)}else y=S.apply(this,arguments);return Object(O.a)(this,y)}}function p(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(d){return!1}}function u(){}function a(d){d.preventDefault()}var s=function(o){return o.replace(/[^\w.-]+/g,"")},h=200,k=600,c=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,b=function(o){return o!=null},D=function(o,C){return C===o||typeof C=="number"&&typeof o=="number"&&isNaN(C)&&isNaN(o)},T=function(d){Object(U.a)(C,d);var o=E(C);function C(S){var y;Object(R.a)(this,C),y=o.call(this,S),y.onKeyDown=function(W){var V=y.props,I=V.onKeyDown,B=V.onPressEnter;if(W.keyCode===x.a.UP){var X=y.getRatio(W);y.up(W,X,null),y.stop()}else if(W.keyCode===x.a.DOWN){var ee=y.getRatio(W);y.down(W,ee,null),y.stop()}else W.keyCode===x.a.ENTER&&B&&B(W);if(y.recordCursorPosition(),y.lastKeyCode=W.keyCode,I){for(var oe=arguments.length,fe=new Array(oe>1?oe-1:0),ke=1;ke<oe;ke++)fe[ke-1]=arguments[ke];I.apply(void 0,[W].concat(fe))}},y.onKeyUp=function(W){var V=y.props.onKeyUp;if(y.stop(),y.recordCursorPosition(),V){for(var I=arguments.length,B=new Array(I>1?I-1:0),X=1;X<I;X++)B[X-1]=arguments[X];V.apply(void 0,[W].concat(B))}},y.onChange=function(W){var V=y.props.onChange;y.state.focused&&(y.inputting=!0),y.rawInput=y.props.parser(y.getValueFromEvent(W)),y.setState({inputValue:y.rawInput}),V(y.toNumber(y.rawInput))},y.onMouseUp=function(){var W=y.props.onMouseUp;y.recordCursorPosition(),W&&W.apply(void 0,arguments)},y.onFocus=function(){var W;y.setState({focused:!0}),(W=y.props).onFocus.apply(W,arguments)},y.onBlur=function(){var W=y.props.onBlur;y.inputting=!1,y.setState({focused:!1});var V=y.getCurrentValidValue(y.state.inputValue),I=y.setValue(V,u);if(W){var B=y.input.value,X=y.getInputDisplayValue({focus:!1,value:I});y.input.value=X&&Number(X),W.apply(void 0,arguments),y.input.value=B}},y.getRatio=function(W){var V=1;return W.metaKey||W.ctrlKey?V=.1:W.shiftKey&&(V=10),V},y.getFullNum=function(W){return isNaN(W)?W:/e/i.test(String(W))?Number(W).toFixed(18).replace(/\.?0+$/,""):W},y.getPrecision=function(W){if(b(y.props.precision))return y.props.precision;var V=String(W);if(V.indexOf("e-")>=0)return parseInt(V.slice(V.indexOf("e-")+2),10);var I=0;return V.indexOf(".")>=0&&(I=V.length-V.indexOf(".")-1),I},y.getInputDisplayValue=function(W){var V=W||y.state,I=V.focused,B=V.inputValue,X=V.value,ee;I?ee=B:ee=y.toPrecisionAsStep(X),ee==null&&(ee="");var oe=y.formatWrapper(ee);return b(y.props.decimalSeparator)&&(oe=oe.toString().replace(".",y.props.decimalSeparator)),oe},y.recordCursorPosition=function(){try{y.cursorStart=y.input.selectionStart,y.cursorEnd=y.input.selectionEnd,y.currentValue=y.input.value,y.cursorBefore=y.input.value.substring(0,y.cursorStart),y.cursorAfter=y.input.value.substring(y.cursorEnd)}catch(W){}},y.restoreByAfter=function(W){if(W===void 0)return!1;var V=y.input.value,I=V.lastIndexOf(W);if(I===-1)return!1;var B=y.cursorBefore.length;return y.lastKeyCode===x.a.DELETE&&y.cursorBefore.charAt(B-1)===W[0]?(y.fixCaret(B,B),!0):I+W.length===V.length?(y.fixCaret(I,I),!0):!1},y.partRestoreByAfter=function(W){return W===void 0?!1:Array.prototype.some.call(W,function(V,I){var B=W.substring(I);return y.restoreByAfter(B)})},y.isNotCompleteNumber=function(W){return isNaN(W)||W===""||W===null||W&&W.toString().indexOf(".")===W.toString().length-1},y.stop=function(){y.autoStepTimer&&clearTimeout(y.autoStepTimer)},y.down=function(W,V,I){y.pressingUpOrDown=!0,y.step("down",W,V,I)},y.up=function(W,V,I){y.pressingUpOrDown=!0,y.step("up",W,V,I)},y.saveInput=function(W){y.input=W};var M=S.value;M===void 0&&(M=S.defaultValue),y.state={focused:S.autoFocus};var F=y.getValidValue(y.toNumber(M));return y.state=w(w({},y.state),{},{inputValue:y.toPrecisionAsStep(F),value:F}),y}return Object(Q.a)(C,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(y){var M=this.props,F=M.value,W=M.onChange,V=M.max,I=M.min,B=this.state.focused;if(y){if(!D(y.value,F)||!D(y.max,V)||!D(y.min,I)){var X=B?F:this.getValidValue(F),ee;this.pressingUpOrDown?ee=X:this.inputting?ee=this.rawInput:ee=this.toPrecisionAsStep(X),this.setState({value:X,inputValue:ee})}var oe="value"in this.props?F:this.state.value;"max"in this.props&&y.max!==V&&typeof oe=="number"&&oe>V&&W&&W(V),"min"in this.props&&y.min!==I&&typeof oe=="number"&&oe<I&&W&&W(I)}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===x.a.BACKSPACE?fe=this.cursorStart-1:this.lastKeyCode===x.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 x.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case x.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(ke){}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(y){var M=y;return M===""?M="":this.isNotCompleteNumber(parseFloat(M))?M=this.state.value:M=this.getValidValue(M),this.toNumber(M)}},{key:"getValueFromEvent",value:function(y){var M=y.target.value.trim().replace(/。/g,".");return b(this.props.decimalSeparator)&&(M=M.replace(this.props.decimalSeparator,".")),M}},{key:"getValidValue",value:function(y){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,W=parseFloat(y);return isNaN(W)?y:(W<M&&(W=M),W>F&&(W=F),W)}},{key:"setValue",value:function(y,M){var F=this.props.precision,W=this.isNotCompleteNumber(parseFloat(y))?null:parseFloat(y),V=this.state.value,I=V===void 0?null:V,B=this.state.inputValue,X=B===void 0?null:B,ee=typeof W=="number"?W.toFixed(F):"".concat(W),oe=W!==I||ee!=="".concat(X);return"value"in this.props?(X=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:X},M)):this.setState({value:W,inputValue:this.toPrecisionAsStep(y)},M),oe&&this.props.onChange(W),W}},{key:"getMaxPrecision",value:function(y){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,F=this.props,W=F.precision,V=F.step;if(b(W))return W;var I=this.getPrecision(M),B=this.getPrecision(V),X=this.getPrecision(y);return y?Math.max(X,I+B):I+B}},{key:"getPrecisionFactor",value:function(y){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,F=this.getMaxPrecision(y,M);return Math.pow(10,F)}},{key:"focus",value:function(){this.input.focus(),this.recordCursorPosition()}},{key:"blur",value:function(){this.input.blur()}},{key:"select",value:function(){this.input.select()}},{key:"formatWrapper",value:function(y){return this.props.formatter?this.props.formatter(y):y}},{key:"toPrecisionAsStep",value:function(y){if(this.isNotCompleteNumber(y)||y==="")return y;var M=Math.abs(this.getMaxPrecision(y));return isNaN(M)?y.toString():Number(y).toFixed(M)}},{key:"toNumber",value:function(y){var M=this.props.precision,F=this.state.focused,W=y&&y.length>16&&F;return this.isNotCompleteNumber(y)||W?y:b(M)?Math.round(y*Math.pow(10,M))/Math.pow(10,M):Number(y)}},{key:"upStep",value:function(y,M){var F=this.props.step,W=this.getPrecisionFactor(y,M),V=Math.abs(this.getMaxPrecision(y,M)),I=((W*y+W*F*M)/W).toFixed(V);return this.toNumber(I)}},{key:"downStep",value:function(y,M){var F=this.props.step,W=this.getPrecisionFactor(y,M),V=Math.abs(this.getMaxPrecision(y,M)),I=((W*y-W*F*M)/W).toFixed(V);return this.toNumber(I)}},{key:"step",value:function(y,M){var F=this,W=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,V=arguments.length>3?arguments[3]:void 0;this.stop(),M&&(M.persist(),M.preventDefault());var I=this.props;if(I.disabled)return;var B=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(B))return;var X=this["".concat(y,"Step")](B,W),ee=X>I.max||X<I.min;if(X>I.max?X=I.max:X<I.min&&(X=I.min),this.setValue(X,null),this.setState({focused:!0},function(){F.pressingUpOrDown=!1}),ee)return;this.autoStepTimer=setTimeout(function(){F[y](M,W,!0)},V?h:k)}},{key:"fixCaret",value:function(y,M){if(y===void 0||M===void 0||!this.input||!this.input.value)return;try{var F=this.input.selectionStart,W=this.input.selectionEnd;(y!==F||M!==W)&&this.input.setSelectionRange(y,M)}catch(V){}}},{key:"render",value:function(){var y,M=this.props,F=M.prefixCls,W=M.disabled,V=M.readOnly,I=M.useTouch,B=M.autoComplete,X=M.upHandler,ee=M.downHandler,oe=M.className,fe=M.max,ke=M.min,xe=M.style,Te=M.title,Ce=M.onMouseEnter,ge=M.onMouseLeave,pe=M.onMouseOver,ue=M.onMouseOut,te=M.required,de=M.onClick,ae=M.tabIndex,we=M.type,Re=M.placeholder,Ee=M.id,Me=M.inputMode,Ie=M.pattern,We=M.step,je=M.maxLength,Be=M.autoFocus,Ue=M.name,et=M.onPaste,ot=M.onInput,nt=Object(ne.a)(M,["prefixCls","disabled","readOnly","useTouch","autoComplete","upHandler","downHandler","className","max","min","style","title","onMouseEnter","onMouseLeave","onMouseOver","onMouseOut","required","onClick","tabIndex","type","placeholder","id","inputMode","pattern","step","maxLength","autoFocus","name","onPaste","onInput"]),qe=this.state,st=qe.value,$e=qe.focused,Qe=f()(F,(y={},Object($.a)(y,oe,!!oe),Object($.a)(y,"".concat(F,"-disabled"),W),Object($.a)(y,"".concat(F,"-focused"),$e),y)),_e={};Object.keys(nt).forEach(function(he){(he.substr(0,5)==="data-"||he.substr(0,5)==="aria-"||he==="role")&&(_e[he]=nt[he])});var ut=!V&&!W,lt=this.getInputDisplayValue(null),Ne=(st||st===0)&&(isNaN(st)||Number(st)>=fe),Ke=(st||st===0)&&(isNaN(st)||Number(st)<=ke),Se=Ne||W||V,ve=Ke||W||V,be=f()("".concat(F,"-handler"),"".concat(F,"-handler-up"),Object($.a)({},"".concat(F,"-handler-up-disabled"),Se)),re=f()("".concat(F,"-handler"),"".concat(F,"-handler-down"),Object($.a)({},"".concat(F,"-handler-down-disabled"),ve)),ie=I?{onTouchStart:Se?u:this.up,onTouchEnd:this.stop}:{onMouseDown:Se?u:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},le=I?{onTouchStart:ve?u:this.down,onTouchEnd:this.stop}:{onMouseDown:ve?u:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return _.a.createElement("div",{className:Qe,style:xe,title:Te,onMouseEnter:Ce,onMouseLeave:ge,onMouseOver:pe,onMouseOut:ue,onFocus:function(){return null},onBlur:function(){return null}},_.a.createElement("div",{className:"".concat(F,"-handler-wrap")},_.a.createElement("span",Object.assign({unselectable:"on"},ie,{role:"button","aria-label":"Increase Value","aria-disabled":Se,className:be}),X||_.a.createElement("span",{unselectable:"on",className:"".concat(F,"-handler-up-inner"),onClick:a})),_.a.createElement("span",Object.assign({unselectable:"on"},le,{role:"button","aria-label":"Decrease Value","aria-disabled":ve,className:re}),ee||_.a.createElement("span",{unselectable:"on",className:"".concat(F,"-handler-down-inner"),onClick:a}))),_.a.createElement("div",{className:"".concat(F,"-input-wrap")},_.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":ke,"aria-valuemax":fe,"aria-valuenow":st,required:te,type:we,placeholder:Re,onPaste:et,onClick:de,onMouseUp:this.onMouseUp,className:"".concat(F,"-input"),tabIndex:ae,autoComplete:B,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:ut?this.onKeyDown:u,onKeyUp:ut?this.onKeyUp:u,autoFocus:Be,maxLength:je,readOnly:V,disabled:W,max:fe,min:ke,step:We,name:Ue,title:Te,id:Ee,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(lt),pattern:Ie,inputMode:Me,onInput:ot},_e))))}}]),C}(_.a.Component);T.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:s,required:!1,autoComplete:"off"};var g=T,v=at.a=g},f4xo:function(dt,at,se){var ne=se("nVVt");function $(R){this.mode=ne.MODE_8BIT_BYTE,this.data=R}$.prototype={getLength:function(R){return this.data.length},write:function(R){for(var Q=0;Q<this.data.length;Q++)R.put(this.data.charCodeAt(Q),8)}},dt.exports=$},h78n:function(dt,at,se){"use strict";se.d(at,"a",function(){return y});var ne=se("q1tI"),$=se.n(ne),R=se("TSYQ"),Q=se.n(R),U={className:"",percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,style:{},trailColor:"#D9D9D9",trailWidth:1},O=function(W){var V=W.map(function(){return Object(ne.useRef)()}),I=Object(ne.useRef)();return Object(ne.useEffect)(function(){var B=Date.now(),X=!1;Object.keys(V).forEach(function(ee){var oe=V[ee].current;if(!oe)return;X=!0;var fe=oe.style;fe.transitionDuration=".3s, .3s, .3s, .06s",I.current&&B-I.current<100&&(fe.transitionDuration="0s, 0s")}),X&&(I.current=Date.now())}),[V]};function j(){return j=Object.assign||function(F){for(var W=1;W<arguments.length;W++){var V=arguments[W];for(var I in V)Object.prototype.hasOwnProperty.call(V,I)&&(F[I]=V[I])}return F},j.apply(this,arguments)}function N(F,W){return P(F)||x(F,W)||A(F,W)||_()}function _(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function A(F,W){if(!F)return;if(typeof F=="string")return f(F,W);var V=Object.prototype.toString.call(F).slice(8,-1);if(V==="Object"&&F.constructor&&(V=F.constructor.name),V==="Map"||V==="Set")return Array.from(F);if(V==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(V))return f(F,W)}function f(F,W){(W==null||W>F.length)&&(W=F.length);for(var V=0,I=new Array(W);V<W;V++)I[V]=F[V];return I}function x(F,W){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(F)))return;var V=[],I=!0,B=!1,X=void 0;try{for(var ee=F[Symbol.iterator](),oe;!(I=(oe=ee.next()).done)&&!(V.push(oe.value),W&&V.length===W);I=!0);}catch(fe){B=!0,X=fe}finally{try{!I&&ee.return!=null&&ee.return()}finally{if(B)throw X}}return V}function P(F){if(Array.isArray(F))return F}function w(F,W){if(F==null)return{};var V=E(F,W),I,B;if(Object.getOwnPropertySymbols){var X=Object.getOwnPropertySymbols(F);for(B=0;B<X.length;B++){if(I=X[B],W.indexOf(I)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(F,I))continue;V[I]=F[I]}}return V}function E(F,W){if(F==null)return{};var V={},I=Object.keys(F),B,X;for(X=0;X<I.length;X++){if(B=I[X],W.indexOf(B)>=0)continue;V[B]=F[B]}return V}var p=function(W){var V=W.className,I=W.percent,B=W.prefixCls,X=W.strokeColor,ee=W.strokeLinecap,oe=W.strokeWidth,fe=W.style,ke=W.trailColor,xe=W.trailWidth,Te=W.transition,Ce=w(W,["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"]);delete Ce.gapPosition;var ge=Array.isArray(I)?I:[I],pe=Array.isArray(X)?X:[X],ue=O(ge),te=N(ue,1),de=te[0],ae=oe/2,we=100-oe/2,Re="M ".concat(ee==="round"?ae:0,",").concat(ae,`
L `).concat(ee==="round"?we:100,",").concat(ae),Ee="0 0 100 ".concat(oe),Me=0;return $.a.createElement("svg",j({className:Q()("".concat(B,"-line"),V),viewBox:Ee,preserveAspectRatio:"none",style:fe},Ce),$.a.createElement("path",{className:"".concat(B,"-line-trail"),d:Re,strokeLinecap:ee,stroke:ke,strokeWidth:xe||oe,fillOpacity:"0"}),ge.map(function(Ie,We){var je={strokeDasharray:"".concat(Ie,"px, 100px"),strokeDashoffset:"-".concat(Me,"px"),transition:Te||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},Be=pe[We]||pe[pe.length-1];return Me+=Ie,$.a.createElement("path",{key:We,className:"".concat(B,"-line-path"),d:Re,strokeLinecap:ee,stroke:Be,strokeWidth:oe,fillOpacity:"0",ref:de[We],style:je})}))};p.defaultProps=U;var u=p;function a(){return a=Object.assign||function(F){for(var W=1;W<arguments.length;W++){var V=arguments[W];for(var I in V)Object.prototype.hasOwnProperty.call(V,I)&&(F[I]=V[I])}return F},a.apply(this,arguments)}function s(F,W){return D(F)||b(F,W)||k(F,W)||h()}function h(){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 k(F,W){if(!F)return;if(typeof F=="string")return c(F,W);var V=Object.prototype.toString.call(F).slice(8,-1);if(V==="Object"&&F.constructor&&(V=F.constructor.name),V==="Map"||V==="Set")return Array.from(F);if(V==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(V))return c(F,W)}function c(F,W){(W==null||W>F.length)&&(W=F.length);for(var V=0,I=new Array(W);V<W;V++)I[V]=F[V];return I}function b(F,W){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(F)))return;var V=[],I=!0,B=!1,X=void 0;try{for(var ee=F[Symbol.iterator](),oe;!(I=(oe=ee.next()).done)&&!(V.push(oe.value),W&&V.length===W);I=!0);}catch(fe){B=!0,X=fe}finally{try{!I&&ee.return!=null&&ee.return()}finally{if(B)throw X}}return V}function D(F){if(Array.isArray(F))return F}function T(F,W){if(F==null)return{};var V=g(F,W),I,B;if(Object.getOwnPropertySymbols){var X=Object.getOwnPropertySymbols(F);for(B=0;B<X.length;B++){if(I=X[B],W.indexOf(I)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(F,I))continue;V[I]=F[I]}}return V}function g(F,W){if(F==null)return{};var V={},I=Object.keys(F),B,X;for(X=0;X<I.length;X++){if(B=I[X],W.indexOf(B)>=0)continue;V[B]=F[B]}return V}var v=0;function d(F){return+F.replace("%","")}function o(F){return Array.isArray(F)?F:[F]}function C(F,W,V,I){var B=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,X=arguments.length>5?arguments[5]:void 0,ee=50-I/2,oe=0,fe=-ee,ke=0,xe=-2*ee;switch(X){case"left":oe=-ee,fe=0,ke=2*ee,xe=0;break;case"right":oe=ee,fe=0,ke=-2*ee,xe=0;break;case"bottom":fe=ee,xe=2*ee;break;default:}var Te="M 50,50 m ".concat(oe,",").concat(fe,`
a `).concat(ee,",").concat(ee," 0 1 1 ").concat(ke,",").concat(-xe,`
a `).concat(ee,",").concat(ee," 0 1 1 ").concat(-ke,",").concat(xe),Ce=Math.PI*2*ee,ge={stroke:V,strokeDasharray:"".concat(W/100*(Ce-B),"px ").concat(Ce,"px"),strokeDashoffset:"-".concat(B/2+F/100*(Ce-B),"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"};return{pathString:Te,pathStyle:ge}}var S=function(W){var V=W.prefixCls,I=W.strokeWidth,B=W.trailWidth,X=W.gapDegree,ee=W.gapPosition,oe=W.trailColor,fe=W.strokeLinecap,ke=W.style,xe=W.className,Te=W.strokeColor,Ce=W.percent,ge=T(W,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"]),pe=Object(ne.useMemo)(function(){return v+=1,v},[]),ue=C(0,100,oe,I,X,ee),te=ue.pathString,de=ue.pathStyle,ae=o(Ce),we=o(Te),Re=we.find(function(je){return Object.prototype.toString.call(je)==="[object Object]"}),Ee=O(ae),Me=s(Ee,1),Ie=Me[0],We=function(){var Be=0;return ae.map(function(Ue,et){var ot=we[et]||we[we.length-1],nt=Object.prototype.toString.call(ot)==="[object Object]"?"url(#".concat(V,"-gradient-").concat(pe,")"):"",qe=C(Be,Ue,ot,I,X,ee);return Be+=Ue,$.a.createElement("path",{key:et,className:"".concat(V,"-circle-path"),d:qe.pathString,stroke:nt,strokeLinecap:fe,strokeWidth:I,opacity:Ue===0?0:1,fillOpacity:"0",style:qe.pathStyle,ref:Ie[et]})})};return $.a.createElement("svg",a({className:Q()("".concat(V,"-circle"),xe),viewBox:"0 0 100 100",style:ke},ge),Re&&$.a.createElement("defs",null,$.a.createElement("linearGradient",{id:"".concat(V,"-gradient-").concat(pe),x1:"100%",y1:"0%",x2:"0%",y2:"0%"},Object.keys(Re).sort(function(je,Be){return d(je)-d(Be)}).map(function(je,Be){return $.a.createElement("stop",{key:Be,offset:je,stopColor:Re[je]})}))),$.a.createElement("path",{className:"".concat(V,"-circle-trail"),d:te,stroke:oe,strokeLinecap:fe,strokeWidth:B||I,fillOpacity:"0",style:de}),We().reverse())};S.defaultProps=U;var y=S,M={Line:u,Circle:y}},kSUc:function(dt,at,se){},lZu9:function(dt,at,se){(function(ne){ne(se("VrN/"),se("1eCo"),se("8EBN"))})(function(ne){"use strict";ne.defineMode("markdown",function($,R){var Q=ne.getMode($,"text/html"),U=Q.name=="null";function O(I){if(ne.findModeByName){var B=ne.findModeByName(I);B&&(I=B.mime||B.mimes[0])}var X=ne.getMode($,I);return X.name=="null"?null:X}R.highlightFormatting===void 0&&(R.highlightFormatting=!1),R.maxBlockquoteDepth===void 0&&(R.maxBlockquoteDepth=0),R.taskLists===void 0&&(R.taskLists=!1),R.strikethrough===void 0&&(R.strikethrough=!1),R.emoji===void 0&&(R.emoji=!1),R.fencedCodeBlockHighlighting===void 0&&(R.fencedCodeBlockHighlighting=!0),R.fencedCodeBlockDefaultMode===void 0&&(R.fencedCodeBlockDefaultMode="text/plain"),R.xml===void 0&&(R.xml=!0),R.tokenTypeOverrides===void 0&&(R.tokenTypeOverrides={});var j={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 N in j)j.hasOwnProperty(N)&&R.tokenTypeOverrides[N]&&(j[N]=R.tokenTypeOverrides[N]);var _=/^([*\-_])(?:\s*\1){2,}\s*$/,A=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,f=/^\[(x| )\](?=\s)/i,x=R.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,P=/^ {0,3}(?:\={1,}|-{2,})\s*$/,w=/^[^#!\[\]*_\\<>` "'(~:]+/,E=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,p=/^\s*\[[^\]]+?\]:.*$/,u=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,a=" ";function s(I,B,X){return B.f=B.inline=X,X(I,B)}function h(I,B,X){return B.f=B.block=X,X(I,B)}function k(I){return!I||!/\S/.test(I.string)}function c(I){if(I.linkTitle=!1,I.linkHref=!1,I.linkText=!1,I.em=!1,I.strong=!1,I.strikethrough=!1,I.quote=0,I.indentedCode=!1,I.f==D){var B=U;if(!B){var X=ne.innerMode(Q,I.htmlState);B=X.mode.name=="xml"&&X.state.tagStart===null&&!X.state.context&&X.state.tokenize.isInText}B&&(I.f=d,I.block=b,I.htmlState=null)}return I.trailingSpace=0,I.trailingSpaceNewLine=!1,I.prevLine=I.thisLine,I.thisLine={stream:null},null}function b(I,B){var X=I.column()===B.indentation,ee=k(B.prevLine.stream),oe=B.indentedCode,fe=B.prevLine.hr,ke=B.list!==!1,xe=(B.listStack[B.listStack.length-1]||0)+3;B.indentedCode=!1;var Te=B.indentation;if(B.indentationDiff===null&&(B.indentationDiff=B.indentation,ke)){for(B.list=null;Te<B.listStack[B.listStack.length-1];)B.listStack.pop(),B.listStack.length?B.indentation=B.listStack[B.listStack.length-1]:B.list=!1;B.list!==!1&&(B.indentationDiff=Te-B.listStack[B.listStack.length-1])}var Ce=!ee&&!fe&&!B.prevLine.header&&(!ke||!oe)&&!B.prevLine.fencedCodeEnd,ge=(B.list===!1||fe||ee)&&B.indentation<=xe&&I.match(_),pe=null;if(B.indentationDiff>=4&&(oe||B.prevLine.fencedCodeEnd||B.prevLine.header||ee))return I.skipToEnd(),B.indentedCode=!0,j.code;if(I.eatSpace())return null;if(X&&B.indentation<=xe&&(pe=I.match(x))&&pe[1].length<=6)return B.quote=0,B.header=pe[1].length,B.thisLine.header=!0,R.highlightFormatting&&(B.formatting="header"),B.f=B.inline,g(B);if(B.indentation<=xe&&I.eat(">"))return B.quote=X?1:B.quote+1,R.highlightFormatting&&(B.formatting="quote"),I.eatSpace(),g(B);if(!ge&&!B.setext&&X&&B.indentation<=xe&&(pe=I.match(A))){var ue=pe[1]?"ol":"ul";return B.indentation=Te+I.current().length,B.list=!0,B.quote=0,B.listStack.push(B.indentation),B.em=!1,B.strong=!1,B.code=!1,B.strikethrough=!1,R.taskLists&&I.match(f,!1)&&(B.taskList=!0),B.f=B.inline,R.highlightFormatting&&(B.formatting=["list","list-"+ue]),g(B)}else{if(X&&B.indentation<=xe&&(pe=I.match(E,!0)))return B.quote=0,B.fencedEndRE=new RegExp(pe[1]+"+ *$"),B.localMode=R.fencedCodeBlockHighlighting&&O(pe[2]||R.fencedCodeBlockDefaultMode),B.localMode&&(B.localState=ne.startState(B.localMode)),B.f=B.block=T,R.highlightFormatting&&(B.formatting="code-block"),B.code=-1,g(B);if(B.setext||(!Ce||!ke)&&!B.quote&&B.list===!1&&!B.code&&!ge&&!p.test(I.string)&&(pe=I.lookAhead(1))&&(pe=pe.match(P)))return B.setext?(B.header=B.setext,B.setext=0,I.skipToEnd(),R.highlightFormatting&&(B.formatting="header")):(B.header=pe[0].charAt(0)=="="?1:2,B.setext=B.header),B.thisLine.header=!0,B.f=B.inline,g(B);if(ge)return I.skipToEnd(),B.hr=!0,B.thisLine.hr=!0,j.hr;if(I.peek()==="[")return s(I,B,M)}return s(I,B,B.inline)}function D(I,B){var X=Q.token(I,B.htmlState);if(!U){var ee=ne.innerMode(Q,B.htmlState);(ee.mode.name=="xml"&&ee.state.tagStart===null&&!ee.state.context&&ee.state.tokenize.isInText||B.md_inside&&I.current().indexOf(">")>-1)&&(B.f=d,B.block=b,B.htmlState=null)}return X}function T(I,B){var X=B.listStack[B.listStack.length-1]||0,ee=B.indentation<X,oe=X+3;if(B.fencedEndRE&&B.indentation<=oe&&(ee||I.match(B.fencedEndRE))){R.highlightFormatting&&(B.formatting="code-block");var fe;return ee||(fe=g(B)),B.localMode=B.localState=null,B.block=b,B.f=d,B.fencedEndRE=null,B.code=0,B.thisLine.fencedCodeEnd=!0,ee?h(I,B,B.block):fe}else return B.localMode?B.localMode.token(I,B.localState):(I.skipToEnd(),j.code)}function g(I){var B=[];if(I.formatting){B.push(j.formatting),typeof I.formatting=="string"&&(I.formatting=[I.formatting]);for(var X=0;X<I.formatting.length;X++)B.push(j.formatting+"-"+I.formatting[X]),I.formatting[X]==="header"&&B.push(j.formatting+"-"+I.formatting[X]+"-"+I.header),I.formatting[X]==="quote"&&(!R.maxBlockquoteDepth||R.maxBlockquoteDepth>=I.quote?B.push(j.formatting+"-"+I.formatting[X]+"-"+I.quote):B.push("error"))}if(I.taskOpen)return B.push("meta"),B.length?B.join(" "):null;if(I.taskClosed)return B.push("property"),B.length?B.join(" "):null;if(I.linkHref?B.push(j.linkHref,"url"):(I.strong&&B.push(j.strong),I.em&&B.push(j.em),I.strikethrough&&B.push(j.strikethrough),I.emoji&&B.push(j.emoji),I.linkText&&B.push(j.linkText),I.code&&B.push(j.code),I.image&&B.push(j.image),I.imageAltText&&B.push(j.imageAltText,"link"),I.imageMarker&&B.push(j.imageMarker)),I.header&&B.push(j.header,j.header+"-"+I.header),I.quote&&(B.push(j.quote),!R.maxBlockquoteDepth||R.maxBlockquoteDepth>=I.quote?B.push(j.quote+"-"+I.quote):B.push(j.quote+"-"+R.maxBlockquoteDepth)),I.list!==!1){var ee=(I.listStack.length-1)%3;ee?ee===1?B.push(j.list2):B.push(j.list3):B.push(j.list1)}return I.trailingSpaceNewLine?B.push("trailing-space-new-line"):I.trailingSpace&&B.push("trailing-space-"+(I.trailingSpace%2?"a":"b")),B.length?B.join(" "):null}function v(I,B){return I.match(w,!0)?g(B):void 0}function d(I,B){var X=B.text(I,B);if(typeof X!="undefined")return X;if(B.list)return B.list=null,g(B);if(B.taskList){var ee=I.match(f,!0)[1]===" ";return ee?B.taskOpen=!0:B.taskClosed=!0,R.highlightFormatting&&(B.formatting="task"),B.taskList=!1,g(B)}if(B.taskOpen=!1,B.taskClosed=!1,B.header&&I.match(/^#+$/,!0))return R.highlightFormatting&&(B.formatting="header"),g(B);var oe=I.next();if(B.linkTitle){B.linkTitle=!1;var fe=oe;oe==="("&&(fe=")"),fe=(fe+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var ke="^\\s*(?:[^"+fe+"\\\\]+|\\\\\\\\|\\\\.)"+fe;if(I.match(new RegExp(ke),!0))return j.linkHref}if(oe==="`"){var xe=B.formatting;R.highlightFormatting&&(B.formatting="code"),I.eatWhile("`");var Te=I.current().length;if(B.code==0&&(!B.quote||Te==1))return B.code=Te,g(B);if(Te==B.code){var Ce=g(B);return B.code=0,Ce}else return B.formatting=xe,g(B)}else if(B.code)return g(B);if(oe==="\\"&&(I.next(),R.highlightFormatting)){var ge=g(B),pe=j.formatting+"-escape";return ge?ge+" "+pe:pe}if(oe==="!"&&I.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return B.imageMarker=!0,B.image=!0,R.highlightFormatting&&(B.formatting="image"),g(B);if(oe==="["&&B.imageMarker&&I.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return B.imageMarker=!1,B.imageAltText=!0,R.highlightFormatting&&(B.formatting="image"),g(B);if(oe==="]"&&B.imageAltText){R.highlightFormatting&&(B.formatting="image");var ge=g(B);return B.imageAltText=!1,B.image=!1,B.inline=B.f=C,ge}if(oe==="["&&!B.image)return B.linkText&&I.match(/^.*?\]/)||(B.linkText=!0,R.highlightFormatting&&(B.formatting="link")),g(B);if(oe==="]"&&B.linkText){R.highlightFormatting&&(B.formatting="link");var ge=g(B);return B.linkText=!1,B.inline=B.f=I.match(/\(.*?\)| ?\[.*?\]/,!1)?C:d,ge}if(oe==="<"&&I.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){B.f=B.inline=o,R.highlightFormatting&&(B.formatting="link");var ge=g(B);return ge?ge+=" ":ge="",ge+j.linkInline}if(oe==="<"&&I.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){B.f=B.inline=o,R.highlightFormatting&&(B.formatting="link");var ge=g(B);return ge?ge+=" ":ge="",ge+j.linkEmail}if(R.xml&&oe==="<"&&I.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var ue=I.string.indexOf(">",I.pos);if(ue!=-1){var te=I.string.substring(I.start,ue);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(te)&&(B.md_inside=!0)}return I.backUp(1),B.htmlState=ne.startState(Q),h(I,B,D)}if(R.xml&&oe==="<"&&I.match(/^\/\w*?>/))return B.md_inside=!1,"tag";if(oe==="*"||oe==="_"){for(var de=1,ae=I.pos==1?" ":I.string.charAt(I.pos-2);de<3&&I.eat(oe);)de++;var we=I.peek()||" ",Re=!/\s/.test(we)&&(!u.test(we)||/\s/.test(ae)||u.test(ae)),Ee=!/\s/.test(ae)&&(!u.test(ae)||/\s/.test(we)||u.test(we)),Me=null,Ie=null;if(de%2&&(!B.em&&Re&&(oe==="*"||!Ee||u.test(ae))?Me=!0:B.em==oe&&Ee&&(oe==="*"||!Re||u.test(we))&&(Me=!1)),de>1&&(!B.strong&&Re&&(oe==="*"||!Ee||u.test(ae))?Ie=!0:B.strong==oe&&Ee&&(oe==="*"||!Re||u.test(we))&&(Ie=!1)),Ie!=null||Me!=null){R.highlightFormatting&&(B.formatting=Me==null?"strong":Ie==null?"em":"strong em"),Me===!0&&(B.em=oe),Ie===!0&&(B.strong=oe);var Ce=g(B);return Me===!1&&(B.em=!1),Ie===!1&&(B.strong=!1),Ce}}else if(oe===" "&&(I.eat("*")||I.eat("_"))){if(I.peek()===" ")return g(B);I.backUp(1)}if(R.strikethrough){if(oe==="~"&&I.eatWhile(oe)){if(B.strikethrough){R.highlightFormatting&&(B.formatting="strikethrough");var Ce=g(B);return B.strikethrough=!1,Ce}else if(I.match(/^[^\s]/,!1))return B.strikethrough=!0,R.highlightFormatting&&(B.formatting="strikethrough"),g(B)}else if(oe===" "&&I.match(/^~~/,!0)){if(I.peek()===" ")return g(B);I.backUp(2)}}if(R.emoji&&oe===":"&&I.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){B.emoji=!0,R.highlightFormatting&&(B.formatting="emoji");var We=g(B);return B.emoji=!1,We}return oe===" "&&(I.match(/^ +$/,!1)?B.trailingSpace++:B.trailingSpace&&(B.trailingSpaceNewLine=!0)),g(B)}function o(I,B){var X=I.next();if(X===">"){B.f=B.inline=d,R.highlightFormatting&&(B.formatting="link");var ee=g(B);return ee?ee+=" ":ee="",ee+j.linkInline}return I.match(/^[^>]+/,!0),j.linkInline}function C(I,B){if(I.eatSpace())return null;var X=I.next();return X==="("||X==="["?(B.f=B.inline=y(X==="("?")":"]"),R.highlightFormatting&&(B.formatting="link-string"),B.linkHref=!0,g(B)):"error"}var S={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function y(I){return function(B,X){var ee=B.next();if(ee===I){X.f=X.inline=d,R.highlightFormatting&&(X.formatting="link-string");var oe=g(X);return X.linkHref=!1,oe}return B.match(S[I]),X.linkHref=!0,g(X)}}function M(I,B){return I.match(/^([^\]\\]|\\.)*\]:/,!1)?(B.f=F,I.next(),R.highlightFormatting&&(B.formatting="link"),B.linkText=!0,g(B)):s(I,B,d)}function F(I,B){if(I.match(/^\]:/,!0)){B.f=B.inline=W,R.highlightFormatting&&(B.formatting="link");var X=g(B);return B.linkText=!1,X}return I.match(/^([^\]\\]|\\.)+/,!0),j.linkText}function W(I,B){return I.eatSpace()?null:(I.match(/^[^\s]+/,!0),I.peek()===void 0?B.linkTitle=!0:I.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),B.f=B.inline=d,j.linkHref+" url")}var V={startState:function(){return{f:b,prevLine:{stream:null},thisLine:{stream:null},block:b,htmlState:null,indentation:0,inline:d,text:v,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(I){return{f:I.f,prevLine:I.prevLine,thisLine:I.thisLine,block:I.block,htmlState:I.htmlState&&ne.copyState(Q,I.htmlState),indentation:I.indentation,localMode:I.localMode,localState:I.localMode?ne.copyState(I.localMode,I.localState):null,inline:I.inline,text:I.text,formatting:!1,linkText:I.linkText,linkTitle:I.linkTitle,linkHref:I.linkHref,code:I.code,em:I.em,strong:I.strong,strikethrough:I.strikethrough,emoji:I.emoji,header:I.header,setext:I.setext,hr:I.hr,taskList:I.taskList,list:I.list,listStack:I.listStack.slice(0),quote:I.quote,indentedCode:I.indentedCode,trailingSpace:I.trailingSpace,trailingSpaceNewLine:I.trailingSpaceNewLine,md_inside:I.md_inside,fencedEndRE:I.fencedEndRE}},token:function(I,B){if(B.formatting=!1,I!=B.thisLine.stream){if(B.header=0,B.hr=!1,I.match(/^\s*$/,!0))return c(B),null;if(B.prevLine=B.thisLine,B.thisLine={stream:I},B.taskList=!1,B.trailingSpace=0,B.trailingSpaceNewLine=!1,!B.localState&&(B.f=B.block,B.f!=D)){var X=I.match(/^\s*/,!0)[0].replace(/\t/g,a).length;if(B.indentation=X,B.indentationDiff=null,X>0)return null}}return B.f(I,B)},innerMode:function(I){return I.block==D?{state:I.htmlState,mode:Q}:I.localState?{state:I.localState,mode:I.localMode}:{state:I,mode:V}},indent:function(I,B,X){return I.block==D&&Q.indent?Q.indent(I.htmlState,B,X):I.localState&&I.localMode.indent?I.localMode.indent(I.localState,B,X):ne.Pass},blankLine:c,getType:g,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return V},"xml"),ne.defineMIME("text/markdown","markdown"),ne.defineMIME("text/x-markdown","markdown")})},nVVt:function(dt,at){dt.exports={MODE_NUMBER:1<<0,MODE_ALPHA_NUM:1<<1,MODE_8BIT_BYTE:1<<2,MODE_KANJI:1<<3}},osHv:function(dt,at,se){(function(ne){ne(se("VrN/"))})(function(ne){"use strict";var $=ne.Pos;function R(u,a){return u.line-a.line||u.ch-a.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",U=Q+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",O=new RegExp("<(/?)(["+Q+"]["+U+"]*)","g");function j(u,a,s,h){this.line=a,this.ch=s,this.cm=u,this.text=u.getLine(a),this.min=h?Math.max(h.from,u.firstLine()):u.firstLine(),this.max=h?Math.min(h.to-1,u.lastLine()):u.lastLine()}function N(u,a){var s=u.cm.getTokenTypeAt($(u.line,a));return s&&/\btag\b/.test(s)}function _(u){return u.line>=u.max?void 0:(u.ch=0,u.text=u.cm.getLine(++u.line),!0)}function A(u){return u.line<=u.min?void 0:(u.text=u.cm.getLine(--u.line),u.ch=u.text.length,!0)}function f(u){for(;;){var a=u.text.indexOf(">",u.ch);if(a==-1){if(_(u))continue;return}if(!N(u,a+1)){u.ch=a+1;continue}var s=u.text.lastIndexOf("/",a),h=s>-1&&!/\S/.test(u.text.slice(s+1,a));return u.ch=a+1,h?"selfClose":"regular"}}function x(u){for(;;){var a=u.ch?u.text.lastIndexOf("<",u.ch-1):-1;if(a==-1){if(A(u))continue;return}if(!N(u,a+1)){u.ch=a;continue}O.lastIndex=a,u.ch=a;var s=O.exec(u.text);if(s&&s.index==a)return s}}function P(u){for(;;){O.lastIndex=u.ch;var a=O.exec(u.text);if(!a){if(_(u))continue;return}if(!N(u,a.index+1)){u.ch=a.index+1;continue}return u.ch=a.index+a[0].length,a}}function w(u){for(;;){var a=u.ch?u.text.lastIndexOf(">",u.ch-1):-1;if(a==-1){if(A(u))continue;return}if(!N(u,a+1)){u.ch=a;continue}var s=u.text.lastIndexOf("/",a),h=s>-1&&!/\S/.test(u.text.slice(s+1,a));return u.ch=a+1,h?"selfClose":"regular"}}function E(u,a){for(var s=[];;){var h=P(u),k,c=u.line,b=u.ch-(h?h[0].length:0);if(!h||!(k=f(u)))return;if(k=="selfClose")continue;if(h[1]){for(var D=s.length-1;D>=0;--D)if(s[D]==h[2]){s.length=D;break}if(D<0&&(!a||a==h[2]))return{tag:h[2],from:$(c,b),to:$(u.line,u.ch)}}else s.push(h[2])}}function p(u,a){for(var s=[];;){var h=w(u);if(!h)return;if(h=="selfClose"){x(u);continue}var k=u.line,c=u.ch,b=x(u);if(!b)return;if(b[1])s.push(b[2]);else{for(var D=s.length-1;D>=0;--D)if(s[D]==b[2]){s.length=D;break}if(D<0&&(!a||a==b[2]))return{tag:b[2],from:$(u.line,u.ch),to:$(k,c)}}}}ne.registerHelper("fold","xml",function(u,a){for(var s=new j(u,a.line,0);;){var h=P(s);if(!h||s.line!=a.line)return;var k=f(s);if(!k)return;if(!h[1]&&k!="selfClose"){var c=$(s.line,s.ch),b=E(s,h[2]);return b&&R(b.from,c)>0?{from:c,to:b.from}:null}}}),ne.findMatchingTag=function(u,a,s){var h=new j(u,a.line,a.ch,s);if(h.text.indexOf(">")==-1&&h.text.indexOf("<")==-1)return;var k=f(h),c=k&&$(h.line,h.ch),b=k&&x(h);if(!k||!b||R(h,a)>0)return;var D={from:$(h.line,h.ch),to:c,tag:b[2]};return k=="selfClose"?{open:D,close:null,at:"open"}:b[1]?{open:p(h,b[2]),close:D,at:"close"}:(h=new j(u,c.line,c.ch,s),{open:D,close:E(h,b[2]),at:"open"})},ne.findEnclosingTag=function(u,a,s,h){for(var k=new j(u,a.line,a.ch,s);;){var c=p(k,h);if(!c)break;var b=new j(u,a.line,a.ch,s),D=E(b,c.tag);if(D)return{open:c,close:D}}},ne.scanForClosingTag=function(u,a,s,h){var k=new j(u,a.line,a.ch,h?{from:0,to:h}:null);return E(k,s)}})},p0QG:function(dt,at,se){dt.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(dt,at,se){"use strict";var ne=se("+L6B"),$=se("2/Rp"),R=se("5Dmo"),Q=se("3S7+"),U=se("k1fw"),O=se("tJVT"),j=se("q1tI"),N=se.n(j),_=se("vHTk"),A=se.n(_),f=se("yEEn"),x=se("ZW9T"),P=se("1vsH");at.a=function(w){var E=w.name,p=w.data,u=w.theme,a=w.type,s=w.filename,h=w.monacoEditor,k=w.className,c=w.style,b=w.close,D=w.onClose,T=w.hasMask,g=Object(j.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),v=Object(O.a)(g,2),d=v[0],o=v[1],C=Object(j.useState)(""),S=Object(O.a)(C,2),y=S[0],M=S[1],F=Object(j.useRef)();s&&(h.filename=s),Object(j.useEffect)(function(){var I,B,X=(I=document.cookie)===null||I===void 0||((B=I.replace(/\s/g,""))===null||B===void 0)?void 0:B.split(";");X==null||X.map(function(ee){var oe=ee.split("=");oe[0]==="_educoder_session"&&M(oe[1])})},[]);var W=function(){if(p.startsWith("http")||p.startsWith("/")){V();return}Object(P.x)(s||"educoder",p,s)},V=function(){Object(P.v)(s||E,p)};return console.log("data:",p,"fileanme:",s," name:",E),N.a.createElement("div",{style:Object(U.a)({},c||{}),className:"".concat(T&&A.a.bgBlack," ").concat(a?A.a.wrp:"hide")},b&&N.a.createElement("div",{className:A.a.close,ref:F},N.a.createElement(Q.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return F.current}},N.a.createElement("span",{onClick:V},N.a.createElement("i",{className:"icon-quxiaozhiding"}))),N.a.createElement(Q.a,{title:"\u5173\u95ED",getPopupContainer:function(){return F.current}},N.a.createElement("span",{className:"",onClick:D},N.a.createElement("i",{className:"icon-guanbi1"})))),N.a.createElement("div",{className:"".concat(A.a[k]," ").concat(k," ").concat(A.a.monaco," ").concat(a==="txt"?"show":"hide")},a==="txt"&&N.a.createElement(x.b,h)),a==="audio"&&N.a.createElement("audio",{src:"".concat(p!=null&&p.startsWith("/")||(p==null?void 0:p.indexOf("https://"))>-1?p:"data:audio/mp3;base64,").concat(p),autoPlay:!0}),a==="video"&&N.a.createElement(N.a.Fragment,null,p!=null&&p.startsWith("/")?N.a.createElement("video",{controls:!0,src:"".concat(p),autoPlay:!0}):N.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(p),autoPlay:!0})),a==="html"&&N.a.createElement("iframe",{src:p+"&disposition=inline"}),a==="pdf"&&N.a.createElement("embed",{className:A.a.embed,src:p}),a==="pdfeditor"&&N.a.createElement("div",null,N.a.createElement("iframe",{src:"https://a1office.co/solutions/editor/pdf-editor/\u67E5\u91CD\u6587\u68631-8839d79b81e8bda0d298ca058913ab88.pdf"}),N.a.createElement("div",{style:{position:"absolute",left:"1px",top:"1px",width:180,height:60,background:"#f9f9f9"}})),a==="image"&&N.a.createElement(N.a.Fragment,null,N.a.createElement("img",{src:"".concat(p!=null&&p.startsWith("/")||(p==null?void 0:p.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(p)})),a==="other"&&N.a.createElement("div",null,N.a.createElement($.a,{type:"primary",size:"large",onClick:W},N.a.createElement(f.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),(a==="download"||a==="office")&&N.a.createElement($.a,{type:"primary",size:"large",onClick:W},N.a.createElement(f.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(dt,at,se){},"rAM+":function(dt,at,se){"use strict";se.d(at,"a",function(){return $});var ne=se("Qw5x");function $(R,Q){var U;if(typeof Symbol=="undefined"||R[Symbol.iterator]==null){if(Array.isArray(R)||(U=Object(ne.a)(R))||Q&&R&&typeof R.length=="number"){U&&(R=U);var O=0,j=function(){};return{s:j,n:function(){return O>=R.length?{done:!0}:{done:!1,value:R[O++]}},e:function(x){throw x},f:j}}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 N=!0,_=!1,A;return{s:function(){U=R[Symbol.iterator]()},n:function(){var x=U.next();return N=x.done,x},e:function(x){_=!0,A=x},f:function(){try{!N&&U.return!=null&&U.return()}finally{if(_)throw A}}}}},rUJ1:function(dt,at){const se=/[&<>"']/,ne=/[&<>"']/g,$=/[<>"']|&(?!#?\w+;)/,R=/[<>"']|&(?!#?\w+;)/g,Q={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},U=T=>Q[T];function O(T,g){if(g){if(se.test(T))return T.replace(ne,U)}else if($.test(T))return T.replace(R,U);return T}const j=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function N(T){return T.replace(j,(g,v)=>(v=v.toLowerCase(),v==="colon"?":":v.charAt(0)==="#"?v.charAt(1)==="x"?String.fromCharCode(parseInt(v.substring(2),16)):String.fromCharCode(+v.substring(1)):""))}const _=/(^|[^\[])\^/g;function A(T,g){T=T.source||T,g=g||"";const v={replace:(d,o)=>(o=o.source||o,o=o.replace(_,"$1"),T=T.replace(d,o),v),getRegex:()=>new RegExp(T,g)};return v}const f=/[^\w:]/g,x=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function P(T,g,v){if(T){let d;try{d=decodeURIComponent(N(v)).replace(f,"").toLowerCase()}catch(o){return null}if(d.indexOf("javascript:")===0||d.indexOf("vbscript:")===0||d.indexOf("data:")===0)return null}g&&!x.test(v)&&(v=a(g,v));try{v=encodeURI(v).replace(/%25/g,"%")}catch(d){return null}return v}const w={},E=/^[^:]+:\/*[^/]*$/,p=/^([^:]+:)[\s\S]*$/,u=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(T,g){w[" "+T]||(E.test(T)?w[" "+T]=T+"/":w[" "+T]=c(T,"/",!0)),T=w[" "+T];const v=T.indexOf(":")===-1;return g.substring(0,2)==="//"?v?g:T.replace(p,"$1")+g:g.charAt(0)==="/"?v?g:T.replace(u,"$1")+g:T+g}const s={exec:function(){}};function h(T){let g=1,v,d;for(;g<arguments.length;g++){v=arguments[g];for(d in v)Object.prototype.hasOwnProperty.call(v,d)&&(T[d]=v[d])}return T}function k(T,g){const v=T.replace(/\|/g,(C,S,y)=>{let M=!1,F=S;for(;--F>=0&&y[F]==="\\";)M=!M;return M?"|":" |"}),d=v.split(/ \|/);let o=0;if(d.length>g)d.splice(g);else for(;d.length<g;)d.push("");for(;o<d.length;o++)d[o]=d[o].trim().replace(/\\\|/g,"|");return d}function c(T,g,v){const d=T.length;if(d===0)return"";let o=0;for(;o<d;){const C=T.charAt(d-o-1);if(C===g&&!v)o++;else if(C!==g&&v)o++;else break}return T.substr(0,d-o)}function b(T,g){if(T.indexOf(g[1])===-1)return-1;const v=T.length;let d=0,o=0;for(;o<v;o++)if(T[o]==="\\")o++;else if(T[o]===g[0])d++;else if(T[o]===g[1]&&(d--,d<0))return o;return-1}function D(T){T&&T.sanitize&&!T.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}dt.exports={escape:O,unescape:N,edit:A,cleanUrl:P,resolveUrl:a,noopTest:s,merge:h,splitCells:k,rtrim:c,findClosingBracket:b,checkSanitizeDeprecation:D}},rcnY:function(dt,at,se){var ne=se("aRTE");function $(R,Q){this.totalCount=R,this.dataCount=Q}$.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],$.getRSBlocks=function(R,Q){var U=$.getRsBlockTable(R,Q);if(U==null)throw new Error("bad rs block @ typeNumber:"+R+"/errorCorrectLevel:"+Q);for(var O=U.length/3,j=new Array,N=0;N<O;N++)for(var _=U[N*3+0],A=U[N*3+1],f=U[N*3+2],x=0;x<_;x++)j.push(new $(A,f));return j},$.getRsBlockTable=function(R,Q){switch(Q){case ne.L:return $.RS_BLOCK_TABLE[(R-1)*4+0];case ne.M:return $.RS_BLOCK_TABLE[(R-1)*4+1];case ne.Q:return $.RS_BLOCK_TABLE[(R-1)*4+2];case ne.H:return $.RS_BLOCK_TABLE[(R-1)*4+3];default:return}},dt.exports=$},ulZh:function(dt,at,se){typeof window!="undefined"&&function($,R){dt.exports=R()}(this,function(){return function(ne){var $={};function R(Q){if($[Q])return $[Q].exports;var U=$[Q]={i:Q,l:!1,exports:{}};return ne[Q].call(U.exports,U,U.exports,R),U.l=!0,U.exports}return R.m=ne,R.c=$,R.d=function(Q,U,O){R.o(Q,U)||Object.defineProperty(Q,U,{enumerable:!0,get:O})},R.r=function(Q){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(Q,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(Q,"__esModule",{value:!0})},R.t=function(Q,U){if(U&1&&(Q=R(Q)),U&8)return Q;if(U&4&&typeof Q=="object"&&Q&&Q.__esModule)return Q;var O=Object.create(null);if(R.r(O),Object.defineProperty(O,"default",{enumerable:!0,value:Q}),U&2&&typeof Q!="string")for(var j in Q)R.d(O,j,function(N){return Q[N]}.bind(null,j));return O},R.n=function(Q){var U=Q&&Q.__esModule?function(){return Q.default}:function(){return Q};return R.d(U,"a",U),U},R.o=function(Q,U){return Object.prototype.hasOwnProperty.call(Q,U)},R.p="/dist/",R(R.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(ne,$,R){"use strict";var Q=Object.prototype.hasOwnProperty,U="~";function O(){}Object.create&&(O.prototype=Object.create(null),new O().__proto__||(U=!1));function j(f,x,P){this.fn=f,this.context=x,this.once=P||!1}function N(f,x,P,w,E){if(typeof P!="function")throw new TypeError("The listener must be a function");var p=new j(P,w||f,E),u=U?U+x:x;return f._events[u]?f._events[u].fn?f._events[u]=[f._events[u],p]:f._events[u].push(p):(f._events[u]=p,f._eventsCount++),f}function _(f,x){--f._eventsCount===0?f._events=new O:delete f._events[x]}function A(){this._events=new O,this._eventsCount=0}A.prototype.eventNames=function(){var x=[],P,w;if(this._eventsCount===0)return x;for(w in P=this._events)Q.call(P,w)&&x.push(U?w.slice(1):w);return Object.getOwnPropertySymbols?x.concat(Object.getOwnPropertySymbols(P)):x},A.prototype.listeners=function(x){var P=U?U+x:x,w=this._events[P];if(!w)return[];if(w.fn)return[w.fn];for(var E=0,p=w.length,u=new Array(p);E<p;E++)u[E]=w[E].fn;return u},A.prototype.listenerCount=function(x){var P=U?U+x:x,w=this._events[P];return w?w.fn?1:w.length:0},A.prototype.emit=function(x,P,w,E,p,u){var a=U?U+x:x;if(!this._events[a])return!1;var s=this._events[a],h=arguments.length,k,c;if(s.fn){s.once&&this.removeListener(x,s.fn,void 0,!0);switch(h){case 1:return s.fn.call(s.context),!0;case 2:return s.fn.call(s.context,P),!0;case 3:return s.fn.call(s.context,P,w),!0;case 4:return s.fn.call(s.context,P,w,E),!0;case 5:return s.fn.call(s.context,P,w,E,p),!0;case 6:return s.fn.call(s.context,P,w,E,p,u),!0}for(c=1,k=new Array(h-1);c<h;c++)k[c-1]=arguments[c];s.fn.apply(s.context,k)}else{var b=s.length,D;for(c=0;c<b;c++){s[c].once&&this.removeListener(x,s[c].fn,void 0,!0);switch(h){case 1:s[c].fn.call(s[c].context);break;case 2:s[c].fn.call(s[c].context,P);break;case 3:s[c].fn.call(s[c].context,P,w);break;case 4:s[c].fn.call(s[c].context,P,w,E);break;default:if(!k)for(D=1,k=new Array(h-1);D<h;D++)k[D-1]=arguments[D];s[c].fn.apply(s[c].context,k)}}}return!0},A.prototype.on=function(x,P,w){return N(this,x,P,w,!1)},A.prototype.once=function(x,P,w){return N(this,x,P,w,!0)},A.prototype.removeListener=function(x,P,w,E){var p=U?U+x:x;if(!this._events[p])return this;if(!P)return _(this,p),this;var u=this._events[p];if(u.fn)u.fn===P&&(!E||u.once)&&(!w||u.context===w)&&_(this,p);else{for(var a=0,s=[],h=u.length;a<h;a++)(u[a].fn!==P||E&&!u[a].once||w&&u[a].context!==w)&&s.push(u[a]);s.length?this._events[p]=s.length===1?s[0]:s:_(this,p)}return this},A.prototype.removeAllListeners=function(x){var P;return x?(P=U?U+x:x,this._events[P]&&_(this,P)):(this._events=new O,this._eventsCount=0),this},A.prototype.off=A.prototype.removeListener,A.prototype.addListener=A.prototype.on,A.prefixed=U,A.EventEmitter=A,ne.exports=A},"./node_modules/url-toolkit/src/url-toolkit.js":function(ne,$,R){(function(Q){var U=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,O=/^([^\/?#]*)([^]*)$/,j=/(?:\/|^)\.(?=\/)/g,N=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,_={buildAbsoluteURL:function(A,f,x){if(x=x||{},A=A.trim(),f=f.trim(),!f){if(!x.alwaysNormalize)return A;var P=_.parseURL(A);if(!P)throw new Error("Error trying to parse base URL.");return P.path=_.normalizePath(P.path),_.buildURLFromParts(P)}var w=_.parseURL(f);if(!w)throw new Error("Error trying to parse relative URL.");if(w.scheme)return x.alwaysNormalize?(w.path=_.normalizePath(w.path),_.buildURLFromParts(w)):f;var E=_.parseURL(A);if(!E)throw new Error("Error trying to parse base URL.");if(!E.netLoc&&E.path&&E.path[0]!=="/"){var p=O.exec(E.path);E.netLoc=p[1],E.path=p[2]}E.netLoc&&!E.path&&(E.path="/");var u={scheme:E.scheme,netLoc:w.netLoc,path:null,params:w.params,query:w.query,fragment:w.fragment};if(!w.netLoc&&(u.netLoc=E.netLoc,w.path[0]!=="/"))if(!w.path)u.path=E.path,w.params||(u.params=E.params,w.query||(u.query=E.query));else{var a=E.path,s=a.substring(0,a.lastIndexOf("/")+1)+w.path;u.path=_.normalizePath(s)}return u.path===null&&(u.path=x.alwaysNormalize?_.normalizePath(w.path):w.path),_.buildURLFromParts(u)},parseURL:function(A){var f=U.exec(A);return f?{scheme:f[1]||"",netLoc:f[2]||"",path:f[3]||"",params:f[4]||"",query:f[5]||"",fragment:f[6]||""}:null},normalizePath:function(A){for(A=A.split("").reverse().join("").replace(j,"");A.length!==(A=A.replace(N,"")).length;);return A.split("").reverse().join("")},buildURLFromParts:function(A){return A.scheme+A.netLoc+A.path+A.params+A.query+A.fragment}};ne.exports=_})(this)},"./node_modules/webworkify-webpack/index.js":function(ne,$,R){function Q(x){var P={};function w(p){if(P[p])return P[p].exports;var u=P[p]={i:p,l:!1,exports:{}};return x[p].call(u.exports,u,u.exports,w),u.l=!0,u.exports}w.m=x,w.c=P,w.i=function(p){return p},w.d=function(p,u,a){w.o(p,u)||Object.defineProperty(p,u,{configurable:!1,enumerable:!0,get:a})},w.r=function(p){Object.defineProperty(p,"__esModule",{value:!0})},w.n=function(p){var u=p&&p.__esModule?function(){return p.default}:function(){return p};return w.d(u,"a",u),u},w.o=function(p,u){return Object.prototype.hasOwnProperty.call(p,u)},w.p="/",w.oe=function(p){throw console.error(p),p};var E=w(w.s=ENTRY_MODULE);return E.default||E}var U="[\\.|\\-|\\+|\\w|/|@]+",O="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+U+").*?\\)";function j(x){return(x+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function N(x){return!isNaN(1*x)}function _(x,P,w){var E={};E[w]=[];var p=P.toString(),u=p.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!u)return E;for(var a=u[1],s=new RegExp("(\\\\n|\\W)"+j(a)+O,"g"),h;h=s.exec(p);){if(h[3]==="dll-reference")continue;E[w].push(h[3])}for(s=new RegExp("\\("+j(a)+'\\("(dll-reference\\s('+U+'))"\\)\\)'+O,"g");h=s.exec(p);)x[h[2]]||(E[w].push(h[1]),x[h[2]]=R(h[1]).m),E[h[2]]=E[h[2]]||[],E[h[2]].push(h[4]);for(var k=Object.keys(E),c=0;c<k.length;c++)for(var b=0;b<E[k[c]].length;b++)N(E[k[c]][b])&&(E[k[c]][b]=1*E[k[c]][b]);return E}function A(x){var P=Object.keys(x);return P.reduce(function(w,E){return w||x[E].length>0},!1)}function f(x,P){for(var w={main:[P]},E={main:[]},p={main:{}};A(w);)for(var u=Object.keys(w),a=0;a<u.length;a++){var s=u[a],h=w[s],k=h.pop();if(p[s]=p[s]||{},p[s][k]||!x[s][k])continue;p[s][k]=!0,E[s]=E[s]||[],E[s].push(k);for(var c=_(x,x[s][k],s),b=Object.keys(c),D=0;D<b.length;D++)w[b[D]]=w[b[D]]||[],w[b[D]]=w[b[D]].concat(c[b[D]])}return E}ne.exports=function(x,P){P=P||{};var w={main:R.m},E=P.all?{main:Object.keys(w.main)}:f(w,x),p="";Object.keys(E).filter(function(k){return k!=="main"}).forEach(function(k){for(var c=0;E[k][c];)c++;E[k].push(c),w[k][c]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",p=p+"var "+k+" = ("+Q.toString().replace("ENTRY_MODULE",JSON.stringify(c))+")({"+E[k].map(function(b){return""+JSON.stringify(b)+": "+w[k][b].toString()}).join(",")+`});
`}),p=p+"new (("+Q.toString().replace("ENTRY_MODULE",JSON.stringify(x))+")({"+E.main.map(function(k){return""+JSON.stringify(k)+": "+w.main[k].toString()}).join(",")+"}))(self);";var u=new window.Blob([p],{type:"text/javascript"});if(P.bare)return u;var a=window.URL||window.webkitURL||window.mozURL||window.msURL,s=a.createObjectURL(u),h=new window.Worker(s);return h.objectURL=s,h}},"./src/config.ts":function(ne,$,R){"use strict";R.r($),R.d($,"hlsDefaultConfig",function(){return D}),R.d($,"mergeConfig",function(){return g}),R.d($,"enableStreamingMode",function(){return v});var Q=R("./src/controller/abr-controller.ts"),U=R("./src/controller/audio-stream-controller.ts"),O=R("./src/controller/audio-track-controller.ts"),j=R("./src/controller/subtitle-stream-controller.ts"),N=R("./src/controller/subtitle-track-controller.ts"),_=R("./src/controller/buffer-controller.ts"),A=R("./src/controller/timeline-controller.ts"),f=R("./src/controller/cap-level-controller.ts"),x=R("./src/controller/fps-controller.ts"),P=R("./src/controller/eme-controller.ts"),w=R("./src/controller/cmcd-controller.ts"),E=R("./src/utils/xhr-loader.ts"),p=R("./src/utils/fetch-loader.ts"),u=R("./src/utils/cues.ts"),a=R("./src/utils/mediakeys-helper.ts"),s=R("./src/utils/logger.ts");function h(){return h=Object.assign||function(d){for(var o=1;o<arguments.length;o++){var C=arguments[o];for(var S in C)Object.prototype.hasOwnProperty.call(C,S)&&(d[S]=C[S])}return d},h.apply(this,arguments)}function k(d,o){var C=Object.keys(d);if(Object.getOwnPropertySymbols){var S=Object.getOwnPropertySymbols(d);o&&(S=S.filter(function(y){return Object.getOwnPropertyDescriptor(d,y).enumerable})),C.push.apply(C,S)}return C}function c(d){for(var o=1;o<arguments.length;o++){var C=arguments[o]!=null?arguments[o]:{};o%2?k(Object(C),!0).forEach(function(S){b(d,S,C[S])}):Object.getOwnPropertyDescriptors?Object.defineProperties(d,Object.getOwnPropertyDescriptors(C)):k(Object(C)).forEach(function(S){Object.defineProperty(d,S,Object.getOwnPropertyDescriptor(C,S))})}return d}function b(d,o,C){return o in d?Object.defineProperty(d,o,{value:C,enumerable:!0,configurable:!0,writable:!0}):d[o]=C,d}var D=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:E.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:Q.default,bufferController:_.default,capLevelController:f.default,fpsController:x.default,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:a.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},T()),{},{subtitleStreamController:j.SubtitleStreamController,subtitleTrackController:N.default,timelineController:A.TimelineController,audioStreamController:U.default,audioTrackController:O.default,emeController:P.default,cmcdController:w.default});function T(){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 g(d,o){if((o.liveSyncDurationCount||o.liveMaxLatencyDurationCount)&&(o.liveSyncDuration||o.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(o.liveMaxLatencyDurationCount!==void 0&&(o.liveSyncDurationCount===void 0||o.liveMaxLatencyDurationCount<=o.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(o.liveMaxLatencyDuration!==void 0&&(o.liveSyncDuration===void 0||o.liveMaxLatencyDuration<=o.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return h({},d,o)}function v(d){var o=d.loader;if(o!==p.default&&o!==E.default)s.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),d.progressive=!1;else{var C=Object(p.fetchSupported)();C&&(d.loader=p.default,d.progressive=!0,d.enableSoftwareAES=!0,s.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(ne,$,R){"use strict";R.r($);var Q=R("./src/polyfills/number.ts"),U=R("./src/utils/ewma-bandwidth-estimator.ts"),O=R("./src/events.ts"),j=R("./src/utils/buffer-helper.ts"),N=R("./src/errors.ts"),_=R("./src/types/loader.ts"),A=R("./src/utils/logger.ts");function f(w,E){for(var p=0;p<E.length;p++){var u=E[p];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(w,u.key,u)}}function x(w,E,p){return E&&f(w.prototype,E),p&&f(w,p),w}var P=function(){function w(p){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=p;var u=p.config;this.bwEstimator=new U.default(u.abrEwmaSlowVoD,u.abrEwmaFastVoD,u.abrEwmaDefaultEstimate),this.registerListeners()}var E=w.prototype;return E.registerListeners=function(){var u=this.hls;u.on(O.Events.FRAG_LOADING,this.onFragLoading,this),u.on(O.Events.FRAG_LOADED,this.onFragLoaded,this),u.on(O.Events.FRAG_BUFFERED,this.onFragBuffered,this),u.on(O.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.on(O.Events.ERROR,this.onError,this)},E.unregisterListeners=function(){var u=this.hls;u.off(O.Events.FRAG_LOADING,this.onFragLoading,this),u.off(O.Events.FRAG_LOADED,this.onFragLoaded,this),u.off(O.Events.FRAG_BUFFERED,this.onFragBuffered,this),u.off(O.Events.LEVEL_LOADED,this.onLevelLoaded,this),u.off(O.Events.ERROR,this.onError,this)},E.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},E.onFragLoading=function(u,a){var s=a.frag;if(s.type===_.PlaylistLevelType.MAIN&&!this.timer){var h;this.fragCurrent=s,this.partCurrent=(h=a.part)!=null?h:null,this.timer=self.setInterval(this.onCheck,100)}},E.onLevelLoaded=function(u,a){var s=this.hls.config;a.details.live?this.bwEstimator.update(s.abrEwmaSlowLive,s.abrEwmaFastLive):this.bwEstimator.update(s.abrEwmaSlowVoD,s.abrEwmaFastVoD)},E._abandonRulesCheck=function(){var u=this.fragCurrent,a=this.partCurrent,s=this.hls,h=s.autoLevelEnabled,k=s.config,c=s.media;if(!u||!c)return;var b=a?a.stats:u.stats,D=a?a.duration:u.duration;if(b.aborted){A.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!h||c.paused||!c.playbackRate||!c.readyState)return;var T=performance.now()-b.loading.start,g=Math.abs(c.playbackRate);if(T<=500*D/g)return;var v=s.levels,d=s.minAutoLevel,o=v[u.level],C=b.total||Math.max(b.loaded,Math.round(D*o.maxBitrate/8)),S=Math.max(1,b.bwEstimate?b.bwEstimate/8:b.loaded*1e3/T),y=(C-b.loaded)/S,M=c.currentTime,F=(j.BufferHelper.bufferInfo(c,M,k.maxBufferHole).end-M)/g;if(F>=2*D/g||y<=F)return;var W=Number.POSITIVE_INFINITY,V;for(V=u.level-1;V>d;V--){var I=v[V].maxBitrate;if(W=D*I/(8*.8*S),W<F)break}if(W>=y)return;var B=this.bwEstimator.getEstimate();A.logger.warn("Fragment "+u.sn+(a?" part "+a.index:"")+" of level "+u.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+V+`
Current BW estimate: `+(Object(Q.isFiniteNumber)(B)?(B/1024).toFixed(3):"Unknown")+` Kb/s
Estimated load time for current fragment: `+y.toFixed(3)+` s
Estimated load time for the next fragment: `+W.toFixed(3)+` s
Time to underbuffer: `+F.toFixed(3)+" s"),s.nextLoadLevel=V,this.bwEstimator.sample(T,b.loaded),this.clearTimer(),u.loader&&(this.fragCurrent=this.partCurrent=null,u.loader.abort()),s.trigger(O.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:u,part:a,stats:b})},E.onFragLoaded=function(u,a){var s=a.frag,h=a.part;if(s.type===_.PlaylistLevelType.MAIN&&Object(Q.isFiniteNumber)(s.sn)){var k=h?h.stats:s.stats,c=h?h.duration:s.duration;if(this.clearTimer(),this.lastLoadedFragLevel=s.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var b=this.hls.levels[s.level],D=(b.loaded?b.loaded.bytes:0)+k.loaded,T=(b.loaded?b.loaded.duration:0)+c;b.loaded={bytes:D,duration:T},b.realBitrate=Math.round(8*D/T)}if(s.bitrateTest){var g={stats:k,frag:s,part:h,id:s.type};this.onFragBuffered(O.Events.FRAG_BUFFERED,g),s.bitrateTest=!1}}},E.onFragBuffered=function(u,a){var s=a.frag,h=a.part,k=h?h.stats:s.stats;if(k.aborted)return;if(s.type!==_.PlaylistLevelType.MAIN||s.sn==="initSegment")return;var c=k.parsing.end-k.loading.start;this.bwEstimator.sample(c,k.loaded),k.bwEstimate=this.bwEstimator.getEstimate(),s.bitrateTest?this.bitrateTestDelay=c/1e3:this.bitrateTestDelay=0},E.onError=function(u,a){switch(a.details){case N.ErrorDetails.FRAG_LOAD_ERROR:case N.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},E.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},E.getNextABRAutoLevel=function(){var u=this.fragCurrent,a=this.partCurrent,s=this.hls,h=s.maxAutoLevel,k=s.config,c=s.minAutoLevel,b=s.media,D=a?a.duration:u?u.duration:0,T=b?b.currentTime:0,g=b&&b.playbackRate!==0?Math.abs(b.playbackRate):1,v=this.bwEstimator?this.bwEstimator.getEstimate():k.abrEwmaDefaultEstimate,d=(j.BufferHelper.bufferInfo(b,T,k.maxBufferHole).end-T)/g,o=this.findBestLevel(v,c,h,d,k.abrBandWidthFactor,k.abrBandWidthUpFactor);if(o>=0)return o;A.logger.trace((d?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var C=D?Math.min(D,k.maxStarvationDelay):k.maxStarvationDelay,S=k.abrBandWidthFactor,y=k.abrBandWidthUpFactor;if(!d){var M=this.bitrateTestDelay;if(M){var F=D?Math.min(D,k.maxLoadingDelay):k.maxLoadingDelay;C=F-M,A.logger.trace("bitrate test took "+Math.round(1e3*M)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*C)+" ms"),S=y=1}}return o=this.findBestLevel(v,c,h,d+C,S,y),Math.max(o,0)},E.findBestLevel=function(u,a,s,h,k,c){for(var b,D=this.fragCurrent,T=this.partCurrent,g=this.lastLoadedFragLevel,v=this.hls.levels,d=v[g],o=!!(d!=null&&(b=d.details)!==null&&b!==void 0&&b.live),C=d==null?void 0:d.codecSet,S=T?T.duration:D?D.duration:0,y=s;y>=a;y--){var M=v[y];if(!M||C&&M.codecSet!==C)continue;var F=M.details,W=(T?F==null?void 0:F.partTarget:F==null?void 0:F.averagetargetduration)||S,V=void 0;y<=g?V=k*u:V=c*u;var I=v[y].maxBitrate,B=I*W/V;if(A.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+y+"/"+Math.round(V)+"/"+I+"/"+W+"/"+h+"/"+B),V>I&&(!B||o&&!this.bitrateTestDelay||B<h))return y}return-1},x(w,[{key:"nextAutoLevel",get:function(){var u=this._nextAutoLevel,a=this.bwEstimator;if(u!==-1&&(!a||!a.canEstimate()))return u;var s=this.getNextABRAutoLevel();return u!==-1&&(s=Math.min(u,s)),s},set:function(u){this._nextAutoLevel=u}}]),w}();$.default=P},"./src/controller/audio-stream-controller.ts":function(ne,$,R){"use strict";R.r($);var Q=R("./src/polyfills/number.ts"),U=R("./src/controller/base-stream-controller.ts"),O=R("./src/events.ts"),j=R("./src/utils/buffer-helper.ts"),N=R("./src/controller/fragment-tracker.ts"),_=R("./src/types/level.ts"),A=R("./src/types/loader.ts"),f=R("./src/loader/fragment.ts"),x=R("./src/demux/chunk-cache.ts"),P=R("./src/demux/transmuxer-interface.ts"),w=R("./src/types/transmuxer.ts"),E=R("./src/controller/fragment-finders.ts"),p=R("./src/utils/discontinuities.ts"),u=R("./src/errors.ts"),a=R("./src/utils/logger.ts");function s(){return s=Object.assign||function(D){for(var T=1;T<arguments.length;T++){var g=arguments[T];for(var v in g)Object.prototype.hasOwnProperty.call(g,v)&&(D[v]=g[v])}return D},s.apply(this,arguments)}function h(D,T){D.prototype=Object.create(T.prototype),D.prototype.constructor=D,k(D,T)}function k(D,T){return k=Object.setPrototypeOf||function(v,d){return v.__proto__=d,v},k(D,T)}var c=100,b=function(D){h(T,D);function T(v,d){var o;return o=D.call(this,v,d,"[audio-stream-controller]")||this,o.videoBuffer=null,o.videoTrackCC=-1,o.waitingVideoCC=-1,o.audioSwitch=!1,o.trackId=-1,o.waitingData=null,o.mainDetails=null,o.bufferFlushed=!1,o._registerListeners(),o}var g=T.prototype;return g.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},g._registerListeners=function(){var d=this.hls;d.on(O.Events.MEDIA_ATTACHED,this.onMediaAttached,this),d.on(O.Events.MEDIA_DETACHING,this.onMediaDetaching,this),d.on(O.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.on(O.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.on(O.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),d.on(O.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),d.on(O.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.on(O.Events.ERROR,this.onError,this),d.on(O.Events.BUFFER_RESET,this.onBufferReset,this),d.on(O.Events.BUFFER_CREATED,this.onBufferCreated,this),d.on(O.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),d.on(O.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),d.on(O.Events.FRAG_BUFFERED,this.onFragBuffered,this)},g._unregisterListeners=function(){var d=this.hls;d.off(O.Events.MEDIA_ATTACHED,this.onMediaAttached,this),d.off(O.Events.MEDIA_DETACHING,this.onMediaDetaching,this),d.off(O.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.off(O.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.off(O.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),d.off(O.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),d.off(O.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.off(O.Events.ERROR,this.onError,this),d.off(O.Events.BUFFER_RESET,this.onBufferReset,this),d.off(O.Events.BUFFER_CREATED,this.onBufferCreated,this),d.off(O.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),d.off(O.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),d.off(O.Events.FRAG_BUFFERED,this.onFragBuffered,this)},g.onInitPtsFound=function(d,o){var C=o.frag,S=o.id,y=o.initPTS;if(S==="main"){var M=C.cc;this.initPTS[C.cc]=y,this.log("InitPTS for cc: "+M+" found from main: "+y),this.videoTrackCC=M,this.state===U.State.WAITING_INIT_PTS&&this.tick()}},g.startLoad=function(d){if(!this.levels){this.startPosition=d,this.state=U.State.STOPPED;return}var o=this.lastCurrentTime;this.stopLoad(),this.setInterval(c),this.fragLoadError=0,o>0&&d===-1?(this.log("Override startPosition with lastCurrentTime @"+o.toFixed(3)),this.state=U.State.IDLE):(this.loadedmetadata=!1,this.state=U.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=d,this.tick()},g.doTick=function(){switch(this.state){case U.State.IDLE:this.doTickIdle();break;case U.State.WAITING_TRACK:{var d,o=this.levels,C=this.trackId,S=o==null||((d=o[C])===null||d===void 0)?void 0:d.details;if(S){if(this.waitForCdnTuneIn(S))break;this.state=U.State.WAITING_INIT_PTS}break}case U.State.FRAG_LOADING_WAITING_RETRY:{var y,M=performance.now(),F=this.retryDate;(!F||M>=F||(y=this.media)!==null&&y!==void 0&&y.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=U.State.IDLE);break}case U.State.WAITING_INIT_PTS:{var W=this.waitingData;if(W){var V=W.frag,I=W.part,B=W.cache,X=W.complete;if(this.initPTS[V.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=U.State.FRAG_LOADING;var ee=B.flush(),oe={frag:V,part:I,payload:ee,networkDetails:null};this._handleFragmentLoadProgress(oe),X&&D.prototype._handleFragmentLoadComplete.call(this,oe)}else if(this.videoTrackCC!==this.waitingVideoCC)a.logger.log("Waiting fragment cc ("+V.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var fe=this.getLoadPosition(),ke=j.BufferHelper.bufferInfo(this.mediaBuffer,fe,this.config.maxBufferHole),xe=Object(E.fragmentWithinToleranceTest)(ke.end,this.config.maxFragLookUpTolerance,V);xe<0&&(a.logger.log("Waiting fragment cc ("+V.cc+") @ "+V.start+" cancelled because another fragment at "+ke.end+" is needed"),this.clearWaitingFragment())}}else this.state=U.State.IDLE}}this.onTickEnd()},g.clearWaitingFragment=function(){var d=this.waitingData;d&&(this.fragmentTracker.removeFragment(d.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=U.State.IDLE)},g.onTickEnd=function(){var d=this.media;if(!d||!d.readyState)return;var o=this.mediaBuffer?this.mediaBuffer:d,C=o.buffered;!this.loadedmetadata&&C.length&&(this.loadedmetadata=!0),this.lastCurrentTime=d.currentTime},g.doTickIdle=function(){var d,o,C=this.hls,S=this.levels,y=this.media,M=this.trackId,F=C.config;if(!S||!S[M])return;if(!y&&(this.startFragRequested||!F.startFragPrefetch))return;var W=S[M],V=W.details;if(!V||V.live&&this.levelLastLoaded!==M||this.waitForCdnTuneIn(V)){this.state=U.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,f.ElementaryStreamTypes.AUDIO,A.PlaylistLevelType.AUDIO));var I=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,A.PlaylistLevelType.AUDIO);if(I===null)return;var B=I.len,X=this.getMaxBufferLength(),ee=this.audioSwitch;if(B>=X&&!ee)return;if(!ee&&this._streamEnded(I,V)){C.trigger(O.Events.BUFFER_EOS,{type:"audio"}),this.state=U.State.ENDED;return}var oe=V.fragments,fe=oe[0].start,ke=I.end;if(ee){var xe=this.getLoadPosition();ke=xe,V.PTSKnown&&xe<fe&&((I.end>fe||I.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),y.currentTime=fe+.05))}var Te=this.getNextFragment(ke,V);if(!Te){this.bufferFlushed=!0;return}((d=Te.decryptdata)===null||d===void 0?void 0:d.keyFormat)==="identity"&&!((o=Te.decryptdata)!==null&&o!==void 0&&o.key)?this.loadKey(Te,V):this.loadFragment(Te,V,ke)},g.getMaxBufferLength=function(){var d=D.prototype.getMaxBufferLength.call(this),o=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,A.PlaylistLevelType.MAIN);return o===null?d:Math.max(d,o.len)},g.onMediaDetaching=function(){this.videoBuffer=null,D.prototype.onMediaDetaching.call(this)},g.onAudioTracksUpdated=function(d,o){var C=o.audioTracks;this.resetTransmuxer(),this.levels=C.map(function(S){return new _.Level(S)})},g.onAudioTrackSwitching=function(d,o){var C=!!o.url;this.trackId=o.id;var S=this.fragCurrent;S!=null&&S.loader&&S.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),C?this.setInterval(c):this.resetTransmuxer(),C?(this.audioSwitch=!0,this.state=U.State.IDLE):this.state=U.State.STOPPED,this.tick()},g.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},g.onLevelLoaded=function(d,o){this.mainDetails=o.details},g.onAudioTrackLoaded=function(d,o){var C,S=this.levels,y=o.details,M=o.id;if(!S){this.warn("Audio tracks were reset while loading level "+M);return}this.log("Track "+M+" loaded ["+y.startSN+","+y.endSN+"],duration:"+y.totalduration);var F=S[M],W=0;if(y.live||(C=F.details)!==null&&C!==void 0&&C.live){var V=this.mainDetails;if(y.fragments[0]||(y.deltaUpdateFailed=!0),y.deltaUpdateFailed||!V)return;!F.details&&y.hasProgramDateTime&&V.hasProgramDateTime?(Object(p.alignMediaPlaylistByPDT)(y,V),W=y.fragments[0].start):W=this.alignPlaylists(y,F.details)}F.details=y,this.levelLastLoaded=M,!this.startFragRequested&&(this.mainDetails||!y.live)&&this.setStartPosition(F.details,W),this.state===U.State.WAITING_TRACK&&!this.waitForCdnTuneIn(y)&&(this.state=U.State.IDLE),this.tick()},g._handleFragmentLoadProgress=function(d){var o,C=d.frag,S=d.part,y=d.payload,M=this.config,F=this.trackId,W=this.levels;if(!W){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+C.sn+" of level "+C.level+" will not be buffered");return}var V=W[F];console.assert(V,"Audio track is defined on fragment load progress");var I=V.details;console.assert(I,"Audio track details are defined on fragment load progress");var B=M.defaultAudioCodec||V.audioCodec||"mp4a.40.2",X=this.transmuxer;X||(X=this.transmuxer=new P.default(this.hls,A.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var ee=this.initPTS[C.cc],oe=(o=C.initSegment)===null||o===void 0?void 0:o.data;if(ee!==void 0){var fe=!1,ke=S?S.index:-1,xe=ke!==-1,Te=new w.ChunkMetadata(C.level,C.sn,C.stats.chunkCount,y.byteLength,ke,xe);X.push(y,oe,B,"",C,S,I.totalduration,fe,Te,ee)}else{a.logger.log("Unknown video PTS for cc "+C.cc+", waiting for video PTS before demuxing audio frag "+C.sn+" of ["+I.startSN+" ,"+I.endSN+"],track "+F);var Ce=this.waitingData=this.waitingData||{frag:C,part:S,cache:new x.default,complete:!1},ge=Ce.cache;ge.push(new Uint8Array(y)),this.waitingVideoCC=this.videoTrackCC,this.state=U.State.WAITING_INIT_PTS}},g._handleFragmentLoadComplete=function(d){if(this.waitingData){this.waitingData.complete=!0;return}D.prototype._handleFragmentLoadComplete.call(this,d)},g.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},g.onBufferCreated=function(d,o){var C=o.tracks.audio;C&&(this.mediaBuffer=C.buffer),o.tracks.video&&(this.videoBuffer=o.tracks.video.buffer)},g.onFragBuffered=function(d,o){var C=o.frag,S=o.part;if(C.type!==A.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(C)){this.warn("Fragment "+C.sn+(S?" p: "+S.index:"")+" of level "+C.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}C.sn!=="initSegment"&&(this.fragPrevious=C,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(O.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(C,S)},g.onError=function(d,o){switch(o.details){case u.ErrorDetails.FRAG_LOAD_ERROR:case u.ErrorDetails.FRAG_LOAD_TIMEOUT:case u.ErrorDetails.KEY_LOAD_ERROR:case u.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(A.PlaylistLevelType.AUDIO,o);break;case u.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case u.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==U.State.ERROR&&this.state!==U.State.STOPPED&&(this.state=o.fatal?U.State.ERROR:U.State.IDLE,this.warn(o.details+" while loading frag, switching to "+this.state+" state"));break;case u.ErrorDetails.BUFFER_FULL_ERROR:if(o.parent==="audio"&&(this.state===U.State.PARSING||this.state===U.State.PARSED)){var C=!0,S=this.getFwdBufferInfo(this.mediaBuffer,A.PlaylistLevelType.AUDIO);S&&S.len>.5&&(C=!this.reduceMaxBufferLength(S.len)),C&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,D.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},g.onBufferFlushed=function(d,o){var C=o.type;C===f.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},g._handleTransmuxComplete=function(d){var o,C="audio",S=this.hls,y=d.remuxResult,M=d.chunkMeta,F=this.getCurrentContext(M);if(!F){this.warn("The loading context changed while buffering fragment "+M.sn+" of level "+M.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(M.level);return}var W=F.frag,V=F.part,I=y.audio,B=y.text,X=y.id3,ee=y.initSegment;if(this.fragContextChanged(W))return;if(this.state=U.State.PARSING,this.audioSwitch&&I&&this.completeAudioSwitch(),ee!=null&&ee.tracks&&(this._bufferInitSegment(ee.tracks,W,M),S.trigger(O.Events.FRAG_PARSING_INIT_SEGMENT,{frag:W,id:C,tracks:ee.tracks})),I){var oe=I.startPTS,fe=I.endPTS,ke=I.startDTS,xe=I.endDTS;V&&(V.elementaryStreams[f.ElementaryStreamTypes.AUDIO]={startPTS:oe,endPTS:fe,startDTS:ke,endDTS:xe}),W.setElementaryStreamInfo(f.ElementaryStreamTypes.AUDIO,oe,fe,ke,xe),this.bufferFragmentData(I,W,V,M)}if(X!=null&&(o=X.samples)!==null&&o!==void 0&&o.length){var Te=s({frag:W,id:C},X);S.trigger(O.Events.FRAG_PARSING_METADATA,Te)}if(B){var Ce=s({frag:W,id:C},B);S.trigger(O.Events.FRAG_PARSING_USERDATA,Ce)}},g._bufferInitSegment=function(d,o,C){if(this.state!==U.State.PARSING)return;d.video&&delete d.video;var S=d.audio;if(!S)return;S.levelCodec=S.codec,S.id="audio",this.log("Init audio buffer, container:"+S.container+", codecs[parsed]=["+S.codec+"]"),this.hls.trigger(O.Events.BUFFER_CODECS,d);var y=S.initSegment;if(y!=null&&y.byteLength){var M={type:"audio",frag:o,part:null,chunkMeta:C,parent:o.type,data:y};this.hls.trigger(O.Events.BUFFER_APPENDING,M)}this.tick()},g.loadFragment=function(d,o,C){var S=this.fragmentTracker.getState(d);this.fragCurrent=d,(this.audioSwitch||S===N.FragmentState.NOT_LOADED||S===N.FragmentState.PARTIAL)&&(d.sn==="initSegment"?this._loadInitSegment(d):o.live&&!Object(Q.isFiniteNumber)(this.initPTS[d.cc])?(this.log("Waiting for video PTS in continuity counter "+d.cc+" of live stream before loading audio fragment "+d.sn+" of level "+this.trackId),this.state=U.State.WAITING_INIT_PTS):(this.startFragRequested=!0,D.prototype.loadFragment.call(this,d,o,C)))},g.completeAudioSwitch=function(){var d=this.hls,o=this.media,C=this.trackId;o&&(this.log("Switching audio track : flushing all audio"),D.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,d.trigger(O.Events.AUDIO_TRACK_SWITCHED,{id:C})},T}(U.default);$.default=b},"./src/controller/audio-track-controller.ts":function(ne,$,R){"use strict";R.r($);var Q=R("./src/events.ts"),U=R("./src/errors.ts"),O=R("./src/controller/base-playlist-controller.ts"),j=R("./src/types/loader.ts");function N(P,w){for(var E=0;E<w.length;E++){var p=w[E];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(P,p.key,p)}}function _(P,w,E){return w&&N(P.prototype,w),E&&N(P,E),P}function A(P,w){P.prototype=Object.create(w.prototype),P.prototype.constructor=P,f(P,w)}function f(P,w){return f=Object.setPrototypeOf||function(p,u){return p.__proto__=u,p},f(P,w)}var x=function(P){A(w,P);function w(p){var u;return u=P.call(this,p,"[audio-track-controller]")||this,u.tracks=[],u.groupId=null,u.tracksInGroup=[],u.trackId=-1,u.trackName="",u.selectDefaultTrack=!0,u.registerListeners(),u}var E=w.prototype;return E.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)},E.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)},E.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,P.prototype.destroy.call(this)},E.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},E.onManifestParsed=function(u,a){this.tracks=a.audioTracks||[]},E.onAudioTrackLoaded=function(u,a){var s=a.id,h=a.details,k=this.tracksInGroup[s];if(!k){this.warn("Invalid audio track id "+s);return}var c=k.details;k.details=a.details,this.log("audioTrack "+s+" loaded ["+h.startSN+"-"+h.endSN+"]"),s===this.trackId&&(this.retryCount=0,this.playlistLoaded(s,a,c))},E.onLevelLoading=function(u,a){this.switchLevel(a.level)},E.onLevelSwitching=function(u,a){this.switchLevel(a.level)},E.switchLevel=function(u){var a=this.hls.levels[u];if(!(a!=null&&a.audioGroupIds))return;var s=a.audioGroupIds[a.urlId];if(this.groupId!==s){this.groupId=s;var h=this.tracks.filter(function(c){return!s||c.groupId===s});this.selectDefaultTrack&&!h.some(function(c){return c.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=h;var k={audioTracks:h};this.log("Updating audio tracks, "+h.length+' track(s) found in "'+s+'" group-id'),this.hls.trigger(Q.Events.AUDIO_TRACKS_UPDATED,k),this.selectInitialTrack()}},E.onError=function(u,a){if(P.prototype.onError.call(this,u,a),a.fatal||!a.context)return;a.context.type===j.PlaylistContextType.AUDIO_TRACK&&a.context.id===this.trackId&&a.context.groupId===this.groupId&&this.retryLoadingOrFail(a)},E.setAudioTrack=function(u){var a=this.tracksInGroup;if(u<0||u>=a.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var s=a[this.trackId];this.log("Now switching to audio-track index "+u);var h=a[u],k=h.id,c=h.groupId,b=c===void 0?"":c,D=h.name,T=h.type,g=h.url;if(this.trackId=u,this.trackName=D,this.selectDefaultTrack=!1,this.hls.trigger(Q.Events.AUDIO_TRACK_SWITCHING,{id:k,groupId:b,name:D,type:T,url:g}),h.details&&!h.details.live)return;var v=this.switchParams(h.url,s==null?void 0:s.details);this.loadPlaylist(v)},E.selectInitialTrack=function(){var u=this.tracksInGroup;console.assert(u.length,"Initial audio track should be selected when tracks are known");var a=this.trackName,s=this.findTrackId(a)||this.findTrackId();s!==-1?this.setAudioTrack(s):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(Q.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},E.findTrackId=function(u){for(var a=this.tracksInGroup,s=0;s<a.length;s++){var h=a[s];if((!this.selectDefaultTrack||h.default)&&(!u||u===h.name))return h.id}return-1},E.loadPlaylist=function(u){var a=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(a)){var s=a.id,h=a.groupId,k=a.url;if(u)try{k=u.addDirectives(k)}catch(c){this.warn("Could not construct new URL with HLS Delivery Directives: "+c)}this.log("loading audio-track playlist for id: "+s),this.clearTimer(),this.hls.trigger(Q.Events.AUDIO_TRACK_LOADING,{url:k,id:s,groupId:h,deliveryDirectives:u||null})}},_(w,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(u){this.selectDefaultTrack=!1,this.setAudioTrack(u)}}]),w}(O.default);$.default=x},"./src/controller/base-playlist-controller.ts":function(ne,$,R){"use strict";R.r($),R.d($,"default",function(){return _});var Q=R("./src/polyfills/number.ts"),U=R("./src/types/level.ts"),O=R("./src/controller/level-helper.ts"),j=R("./src/utils/logger.ts"),N=R("./src/errors.ts"),_=function(){function A(x,P){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=j.logger.log.bind(j.logger,P+":"),this.warn=j.logger.warn.bind(j.logger,P+":"),this.hls=x}var f=A.prototype;return f.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},f.onError=function(P,w){w.fatal&&w.type===N.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},f.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},f.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},f.stopLoad=function(){this.canLoad=!1,this.clearTimer()},f.switchParams=function(P,w){var E=w==null?void 0:w.renditionReports;if(E)for(var p=0;p<E.length;p++){var u=E[p],a=""+u.URI;if(a===P.substr(-a.length)){var s=parseInt(u["LAST-MSN"]),h=parseInt(u["LAST-PART"]);if(w&&this.hls.config.lowLatencyMode){var k=Math.min(w.age-w.partTarget,w.targetduration);h!==void 0&&k>w.partTarget&&(h+=1)}if(Object(Q.isFiniteNumber)(s))return new U.HlsUrlParameters(s,Object(Q.isFiniteNumber)(h)?h:void 0,U.HlsSkip.No)}}},f.loadPlaylist=function(P){},f.shouldLoadTrack=function(P){return this.canLoad&&P&&!!P.url&&(!P.details||P.details.live)},f.playlistLoaded=function(P,w,E){var p=this,u=w.details,a=w.stats,s=a.loading.end?Math.max(0,self.performance.now()-a.loading.end):0;if(u.advancedDateTime=Date.now()-s,u.live||E!=null&&E.live){if(u.reloaded(E),E&&this.log("live playlist "+P+" "+(u.advanced?"REFRESHED "+u.lastPartSn+"-"+u.lastPartIndex:"MISSED")),E&&u.fragments.length>0&&Object(O.mergeDetails)(E,u),!this.canLoad||!u.live)return;var h,k=void 0,c=void 0;if(u.canBlockReload&&u.endSN&&u.advanced){var b=this.hls.config.lowLatencyMode,D=u.lastPartSn,T=u.endSN,g=u.lastPartIndex,v=g!==-1,d=D===T,o=b?0:g;v?(k=d?T+1:D,c=d?o:g+1):k=T+1;var C=u.age,S=C+u.ageHeader,y=Math.min(S-u.partTarget,u.targetduration*1.5);if(y>0){if(E&&y>E.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+E.tuneInGoal+" to: "+y+" with playlist age: "+u.age),y=0;else{var M=Math.floor(y/u.targetduration);if(k+=M,c!==void 0){var F=Math.round(y%u.targetduration/u.partTarget);c+=F}this.log("CDN Tune-in age: "+u.ageHeader+"s last advanced "+C.toFixed(2)+"s goal: "+y+" skip sn "+M+" to part "+c)}u.tuneInGoal=y}if(h=this.getDeliveryDirectives(u,w.deliveryDirectives,k,c),b||!d){this.loadPlaylist(h);return}}else h=this.getDeliveryDirectives(u,w.deliveryDirectives,k,c);var W=Object(O.computeReloadInterval)(u,a);k!==void 0&&u.canBlockReload&&(W-=u.partTarget||1),this.log("reload live playlist "+P+" in "+Math.round(W)+" ms"),this.timer=self.setTimeout(function(){return p.loadPlaylist(h)},W)}else this.clearTimer()},f.getDeliveryDirectives=function(P,w,E,p){var u=Object(U.getSkipValue)(P,E);return w!=null&&w.skip&&P.deltaUpdateFailed&&(E=w.msn,p=w.part,u=U.HlsSkip.No),new U.HlsUrlParameters(E,p,u)},f.retryLoadingOrFail=function(P){var w=this,E=this.hls.config,p=this.retryCount<E.levelLoadingMaxRetry;if(p){var u;if(this.retryCount++,P.details.indexOf("LoadTimeOut")>-1&&(u=P.context)!==null&&u!==void 0&&u.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+P.details+'"'),this.loadPlaylist();else{var a=Math.min(Math.pow(2,this.retryCount)*E.levelLoadingRetryDelay,E.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return w.loadPlaylist()},a),this.warn("retry playlist loading #"+this.retryCount+" in "+a+' ms after "'+P.details+'"')}}else this.warn('cannot recover from error "'+P.details+'"'),this.clearTimer(),P.fatal=!0;return p},A}()},"./src/controller/base-stream-controller.ts":function(ne,$,R){"use strict";R.r($),R.d($,"State",function(){return T}),R.d($,"default",function(){return g});var Q=R("./src/polyfills/number.ts"),U=R("./src/task-loop.ts"),O=R("./src/controller/fragment-tracker.ts"),j=R("./src/utils/buffer-helper.ts"),N=R("./src/utils/logger.ts"),_=R("./src/events.ts"),A=R("./src/errors.ts"),f=R("./src/types/transmuxer.ts"),x=R("./src/utils/mp4-tools.ts"),P=R("./src/utils/discontinuities.ts"),w=R("./src/controller/fragment-finders.ts"),E=R("./src/controller/level-helper.ts"),p=R("./src/loader/fragment-loader.ts"),u=R("./src/crypt/decrypter.ts"),a=R("./src/utils/time-ranges.ts"),s=R("./src/types/loader.ts");function h(v,d){for(var o=0;o<d.length;o++){var C=d[o];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(v,C.key,C)}}function k(v,d,o){return d&&h(v.prototype,d),o&&h(v,o),v}function c(v){if(v===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return v}function b(v,d){v.prototype=Object.create(d.prototype),v.prototype.constructor=v,D(v,d)}function D(v,d){return D=Object.setPrototypeOf||function(C,S){return C.__proto__=S,C},D(v,d)}var T={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",BACKTRACKING:"BACKTRACKING",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"},g=function(v){b(d,v);function d(C,S,y){var M;return M=v.call(this)||this,M.hls=void 0,M.fragPrevious=null,M.fragCurrent=null,M.fragmentTracker=void 0,M.transmuxer=null,M._state=T.STOPPED,M.media=void 0,M.mediaBuffer=void 0,M.config=void 0,M.bitrateTest=!1,M.lastCurrentTime=0,M.nextLoadPosition=0,M.startPosition=0,M.loadedmetadata=!1,M.fragLoadError=0,M.retryDate=0,M.levels=null,M.fragmentLoader=void 0,M.levelLastLoaded=null,M.startFragRequested=!1,M.decrypter=void 0,M.initPTS=[],M.onvseeking=null,M.onvended=null,M.logPrefix="",M.log=void 0,M.warn=void 0,M.logPrefix=y,M.log=N.logger.log.bind(N.logger,y+":"),M.warn=N.logger.warn.bind(N.logger,y+":"),M.hls=C,M.fragmentLoader=new p.default(C.config),M.fragmentTracker=S,M.config=C.config,M.decrypter=new u.default(C,C.config),C.on(_.Events.KEY_LOADED,M.onKeyLoaded,c(M)),M}var o=d.prototype;return o.doTick=function(){this.onTickEnd()},o.onTickEnd=function(){},o.startLoad=function(S){},o.stopLoad=function(){this.fragmentLoader.abort();var S=this.fragCurrent;S&&this.fragmentTracker.removeFragment(S),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=T.STOPPED},o._streamEnded=function(S,y){var M=this.fragCurrent,F=this.fragmentTracker;if(!y.live&&M&&M.sn===y.endSN&&!S.nextStart){var W=F.getState(M);return W===O.FragmentState.PARTIAL||W===O.FragmentState.OK}return!1},o.onMediaAttached=function(S,y){var M=this.media=this.mediaBuffer=y.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),M.addEventListener("seeking",this.onvseeking),M.addEventListener("ended",this.onvended);var F=this.config;this.levels&&F.autoStartLoad&&this.state===T.STOPPED&&this.startLoad(F.startPosition)},o.onMediaDetaching=function(){var S=this.media;S!=null&&S.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),S&&(S.removeEventListener("seeking",this.onvseeking),S.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},o.onMediaSeeking=function(){var S=this.config,y=this.fragCurrent,M=this.media,F=this.mediaBuffer,W=this.state,V=M?M.currentTime:0,I=j.BufferHelper.bufferInfo(F||M,V,S.maxBufferHole);if(this.log("media seeking to "+(Object(Q.isFiniteNumber)(V)?V.toFixed(3):V)+", state: "+W),W===T.ENDED)this.resetLoadingState();else if(y&&!I.len){var B=S.maxFragLookUpTolerance,X=y.start-B,ee=y.start+y.duration+B,oe=V>ee;(V<X||oe)&&(oe&&y.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),y.loader.abort()),this.resetLoadingState())}M&&(this.lastCurrentTime=V),!this.loadedmetadata&&!I.len&&(this.nextLoadPosition=this.startPosition=V),this.tickImmediate()},o.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},o.onKeyLoaded=function(S,y){if(this.state!==T.KEY_LOADING||y.frag!==this.fragCurrent||!this.levels)return;this.state=T.IDLE;var M=this.levels[y.frag.level].details;M&&this.loadFragment(y.frag,M,y.frag.start)},o.onHandlerDestroying=function(){this.stopLoad(),v.prototype.onHandlerDestroying.call(this)},o.onHandlerDestroyed=function(){this.state=T.STOPPED,this.hls.off(_.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,v.prototype.onHandlerDestroyed.call(this)},o.loadKey=function(S,y){this.log("Loading key for "+S.sn+" of ["+y.startSN+"-"+y.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+S.level),this.state=T.KEY_LOADING,this.fragCurrent=S,this.hls.trigger(_.Events.KEY_LOADING,{frag:S})},o.loadFragment=function(S,y,M){this._loadFragForPlayback(S,y,M)},o._loadFragForPlayback=function(S,y,M){var F=this,W=function(I){if(F.fragContextChanged(S)){F.warn("Fragment "+S.sn+(I.part?" p: "+I.part.index:"")+" of level "+S.level+" was dropped during download."),F.fragmentTracker.removeFragment(S);return}S.stats.chunkCount++,F._handleFragmentLoadProgress(I)};this._doFragLoad(S,y,M,W).then(function(V){if(!V)return;F.fragLoadError=0;var I=F.state;if(F.fragContextChanged(S)){(I===T.FRAG_LOADING||I===T.BACKTRACKING||!F.fragCurrent&&I===T.PARSING)&&(F.fragmentTracker.removeFragment(S),F.state=T.IDLE);return}if("payload"in V&&(F.log("Loaded fragment "+S.sn+" of level "+S.level),F.hls.trigger(_.Events.FRAG_LOADED,V),F.state===T.BACKTRACKING)){F.fragmentTracker.backtrack(S,V),F.resetFragmentLoading(S);return}F._handleFragmentLoadComplete(V)}).catch(function(V){F.warn(V),F.resetFragmentLoading(S)})},o.flushMainBuffer=function(S,y,M){if(M===void 0&&(M=null),!(S-y))return;var F={startOffset:S,endOffset:y,type:M};this.fragLoadError=0,this.hls.trigger(_.Events.BUFFER_FLUSHING,F)},o._loadInitSegment=function(S){var y=this;this._doFragLoad(S).then(function(M){if(!M||y.fragContextChanged(S)||!y.levels)throw new Error("init load aborted");return M}).then(function(M){var F=y.hls,W=M.payload,V=S.decryptdata;if(W&&W.byteLength>0&&V&&V.key&&V.iv&&V.method==="AES-128"){var I=self.performance.now();return y.decrypter.webCryptoDecrypt(new Uint8Array(W),V.key.buffer,V.iv.buffer).then(function(B){var X=self.performance.now();return F.trigger(_.Events.FRAG_DECRYPTED,{frag:S,payload:B,stats:{tstart:I,tdecrypt:X}}),M.payload=B,M})}return M}).then(function(M){var F=y.fragCurrent,W=y.hls,V=y.levels;if(!V)throw new Error("init load aborted, missing levels");var I=V[S.level].details;console.assert(I,"Level details are defined when init segment is loaded");var B=S.stats;y.state=T.IDLE,y.fragLoadError=0,S.data=new Uint8Array(M.payload),B.parsing.start=B.buffering.start=self.performance.now(),B.parsing.end=B.buffering.end=self.performance.now(),M.frag===F&&W.trigger(_.Events.FRAG_BUFFERED,{stats:B,frag:F,part:null,id:S.type}),y.tick()}).catch(function(M){y.warn(M),y.resetFragmentLoading(S)})},o.fragContextChanged=function(S){var y=this.fragCurrent;return!S||!y||S.level!==y.level||S.sn!==y.sn||S.urlId!==y.urlId},o.fragBufferedComplete=function(S,y){var M=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+S.type+" sn: "+S.sn+(y?" part: "+y.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+S.level+" "+a.default.toString(j.BufferHelper.getBuffered(M))),this.state=T.IDLE,this.tick()},o._handleFragmentLoadComplete=function(S){var y=this.transmuxer;if(!y)return;var M=S.frag,F=S.part,W=S.partsLoaded,V=!W||W.length===0||W.some(function(B){return!B}),I=new f.ChunkMetadata(M.level,M.sn,M.stats.chunkCount+1,0,F?F.index:-1,!V);y.flush(I)},o._handleFragmentLoadProgress=function(S){},o._doFragLoad=function(S,y,M,F){var W=this;if(M===void 0&&(M=null),!this.levels)throw new Error("frag load aborted, missing levels");if(M=Math.max(S.start,M||0),this.config.lowLatencyMode&&y){var V=y.partList;if(V&&F){M>S.end&&y.fragmentHint&&(S=y.fragmentHint);var I=this.getNextPart(V,S,M);if(I>-1){var B=V[I];return this.log("Loading part sn: "+S.sn+" p: "+B.index+" cc: "+S.cc+" of playlist ["+y.startSN+"-"+y.endSN+"] parts [0-"+I+"-"+(V.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+S.level+", target: "+parseFloat(M.toFixed(3))),this.nextLoadPosition=B.start+B.duration,this.state=T.FRAG_LOADING,this.hls.trigger(_.Events.FRAG_LOADING,{frag:S,part:V[I],targetBufferTime:M}),this.doFragPartsLoad(S,V,I,F).catch(function(X){return W.handleFragLoadError(X)})}else if(!S.url||this.loadedEndOfParts(V,M))return Promise.resolve(null)}}return this.log("Loading fragment "+S.sn+" cc: "+S.cc+" "+(y?"of ["+y.startSN+"-"+y.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+S.level+", target: "+parseFloat(M.toFixed(3))),Object(Q.isFiniteNumber)(S.sn)&&!this.bitrateTest&&(this.nextLoadPosition=S.start+S.duration),this.state=T.FRAG_LOADING,this.hls.trigger(_.Events.FRAG_LOADING,{frag:S,targetBufferTime:M}),this.fragmentLoader.load(S,F).catch(function(X){return W.handleFragLoadError(X)})},o.doFragPartsLoad=function(S,y,M,F){var W=this;return new Promise(function(V,I){var B=[],X=function ee(oe){var fe=y[oe];W.fragmentLoader.loadPart(S,fe,F).then(function(ke){B[fe.index]=ke;var xe=ke.part;W.hls.trigger(_.Events.FRAG_LOADED,ke);var Te=y[oe+1];if(Te&&Te.fragment===S)ee(oe+1);else return V({frag:S,part:xe,partsLoaded:B})}).catch(I)};X(M)})},o.handleFragLoadError=function(S){var y=S.data;return y&&y.details===A.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(y.frag,y.part):this.hls.trigger(_.Events.ERROR,y),null},o._handleTransmuxerFlush=function(S){var y=this.getCurrentContext(S);if(!y||this.state!==T.PARSING){this.fragCurrent||(this.state=T.IDLE);return}var M=y.frag,F=y.part,W=y.level,V=self.performance.now();M.stats.parsing.end=V,F&&(F.stats.parsing.end=V),this.updateLevelTiming(M,F,W,S.partial)},o.getCurrentContext=function(S){var y=this.levels,M=S.level,F=S.sn,W=S.part;if(!y||!y[M])return this.warn("Levels object was unset while buffering fragment "+F+" of level "+M+". The current chunk will not be buffered."),null;var V=y[M],I=W>-1?Object(E.getPartWith)(V,F,W):null,B=I?I.fragment:Object(E.getFragmentWithSN)(V,F,this.fragCurrent);return B?{frag:B,part:I,level:V}:null},o.bufferFragmentData=function(S,y,M,F){if(!S||this.state!==T.PARSING)return;var W=S.data1,V=S.data2,I=W;if(W&&V&&(I=Object(x.appendUint8Array)(W,V)),!I||!I.length)return;var B={type:S.type,frag:y,part:M,chunkMeta:F,parent:y.type,data:I};this.hls.trigger(_.Events.BUFFER_APPENDING,B),S.dropped&&S.independent&&!M&&this.flushBufferGap(y)},o.flushBufferGap=function(S){var y=this.media;if(!y)return;if(!j.BufferHelper.isBuffered(y,y.currentTime)){this.flushMainBuffer(0,S.start);return}var M=y.currentTime,F=j.BufferHelper.bufferInfo(y,M,0),W=S.duration,V=Math.min(this.config.maxFragLookUpTolerance*2,W*.25),I=Math.max(Math.min(S.start-V,F.end-V),M+V);S.start-I>V&&this.flushMainBuffer(I,S.start)},o.getFwdBufferInfo=function(S,y){var M=this.config,F=this.getLoadPosition();if(!Object(Q.isFiniteNumber)(F))return null;var W=j.BufferHelper.bufferInfo(S,F,M.maxBufferHole);if(W.len===0&&W.nextStart!==void 0){var V=this.fragmentTracker.getBufferedFrag(F,y);if(V&&W.nextStart<V.end)return j.BufferHelper.bufferInfo(S,F,Math.max(W.nextStart,M.maxBufferHole))}return W},o.getMaxBufferLength=function(S){var y=this.config,M;return S?M=Math.max(8*y.maxBufferSize/S,y.maxBufferLength):M=y.maxBufferLength,Math.min(M,y.maxMaxBufferLength)},o.reduceMaxBufferLength=function(S){var y=this.config,M=S||y.maxBufferLength;return y.maxMaxBufferLength>=M?(y.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+y.maxMaxBufferLength+"s"),!0):!1},o.getNextFragment=function(S,y){var M,F,W=y.fragments,V=W.length;if(!V)return null;var I=this.config,B=W[0].start,X;if(y.live){var ee=I.initialLiveManifestSize;if(V<ee)return this.warn("Not enough fragments to start playback (have: "+V+", need: "+ee+")"),null;!y.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&(X=this.getInitialLiveFragment(y,W),this.startPosition=X?this.hls.liveSyncPosition||X.start:S)}else S<=B&&(X=W[0]);if(!X){var oe=I.lowLatencyMode?y.partEnd:y.fragmentEnd;X=this.getFragmentAtPosition(S,oe,y)}return(M=X)!==null&&M!==void 0&&M.initSegment&&!((F=X)!==null&&F!==void 0&&F.initSegment.data)&&!this.bitrateTest&&(X=X.initSegment),X},o.getNextPart=function(S,y,M){for(var F=-1,W=!1,V=!0,I=0,B=S.length;I<B;I++){var X=S[I];if(V=V&&!X.independent,F>-1&&M<X.start)break;var ee=X.loaded;!ee&&(W||X.independent||V)&&X.fragment===y&&(F=I),W=ee}return F},o.loadedEndOfParts=function(S,y){var M=S[S.length-1];return M&&y>M.start&&M.loaded},o.getInitialLiveFragment=function(S,y){var M=this.fragPrevious,F=null;if(M){if(S.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+M.programDateTime),F=Object(w.findFragmentByPDT)(y,M.endProgramDateTime,this.config.maxFragLookUpTolerance)),!F){var W=M.sn+1;if(W>=S.startSN&&W<=S.endSN){var V=y[W-S.startSN];M.cc===V.cc&&(F=V,this.log("Live playlist, switching playlist, load frag with next SN: "+F.sn))}F||(F=Object(w.findFragWithCC)(y,M.cc),F&&this.log("Live playlist, switching playlist, load frag with same CC: "+F.sn))}}else{var I=this.hls.liveSyncPosition;I!==null&&(F=this.getFragmentAtPosition(I,this.bitrateTest?S.fragmentEnd:S.edge,S))}return F},o.getFragmentAtPosition=function(S,y,M){var F=this.config,W=this.fragPrevious,V=M.fragments,I=M.endSN,B=M.fragmentHint,X=F.maxFragLookUpTolerance,ee=!!(F.lowLatencyMode&&M.partList&&B);ee&&B&&!this.bitrateTest&&(V=V.concat(B),I=B.sn);var oe;if(S<y){var fe=S>y-X?0:X;oe=Object(w.findFragmentByPTS)(W,V,S,fe)}else oe=V[V.length-1];if(oe){var ke=oe.sn-M.startSN,xe=W&&oe.level===W.level,Te=V[ke+1],Ce=this.fragmentTracker.getState(oe);if(Ce===O.FragmentState.BACKTRACKED){oe=null;for(var ge=ke;V[ge]&&this.fragmentTracker.getState(V[ge])===O.FragmentState.BACKTRACKED;)W?oe=V[ge--]:oe=V[--ge];oe||(oe=Te)}else W&&oe.sn===W.sn&&!ee&&(xe&&(oe.sn<I&&this.fragmentTracker.getState(Te)!==O.FragmentState.OK?(this.log("SN "+oe.sn+" just loaded, load next one: "+Te.sn),oe=Te):oe=null))}return oe},o.synchronizeToLiveEdge=function(S){var y=this.config,M=this.media;if(!M)return;var F=this.hls.liveSyncPosition,W=M.currentTime,V=S.fragments[0].start,I=S.edge,B=W>=V-y.maxFragLookUpTolerance&&W<=I;if(F!==null&&M.duration>F&&(W<F||!B)){var X=y.liveMaxLatencyDuration!==void 0?y.liveMaxLatencyDuration:y.liveMaxLatencyDurationCount*S.targetduration;(!B&&M.readyState<4||W<I-X)&&(this.loadedmetadata||(this.nextLoadPosition=F),M.readyState&&(this.warn("Playback: "+W.toFixed(3)+" is located too far from the end of live sliding playlist: "+I+", reset currentTime to : "+F.toFixed(3)),M.currentTime=F))}},o.alignPlaylists=function(S,y){var M=this.levels,F=this.levelLastLoaded,W=this.fragPrevious,V=F!==null?M[F]:null,I=S.fragments.length;if(!I)return this.warn("No fragments in live playlist"),0;var B=S.fragments[0].start,X=!y,ee=S.alignedSliding&&Object(Q.isFiniteNumber)(B);if(X||!ee&&!B){Object(P.alignStream)(W,V,S);var oe=S.fragments[0].start;return this.log("Live playlist sliding: "+oe.toFixed(2)+" start-sn: "+(y?y.startSN:"na")+"->"+S.startSN+" prev-sn: "+(W?W.sn:"na")+" fragments: "+I),oe}return B},o.waitForCdnTuneIn=function(S){var y=3;return S.live&&S.canBlockReload&&S.tuneInGoal>Math.max(S.partHoldBack,S.partTarget*y)},o.setStartPosition=function(S,y){var M=this.startPosition;if(M<y&&(M=-1),M===-1||this.lastCurrentTime===-1){var F=S.startTimeOffset;Object(Q.isFiniteNumber)(F)?(M=y+F,F<0&&(M+=S.totalduration),M=Math.min(Math.max(y,M),y+S.totalduration),this.log("Start time offset "+F+" found in playlist, adjust startPosition to "+M),this.startPosition=M):S.live?M=this.hls.liveSyncPosition||y:this.startPosition=M=0,this.lastCurrentTime=M}this.nextLoadPosition=M},o.getLoadPosition=function(){var S=this.media,y=0;return this.loadedmetadata&&S?y=S.currentTime:this.nextLoadPosition&&(y=this.nextLoadPosition),y},o.handleFragLoadAborted=function(S,y){this.transmuxer&&S.sn!=="initSegment"&&S.stats.aborted&&(this.warn("Fragment "+S.sn+(y?" part"+y.index:"")+" of level "+S.level+" was aborted"),this.resetFragmentLoading(S))},o.resetFragmentLoading=function(S){(!this.fragCurrent||!this.fragContextChanged(S))&&(this.state=T.IDLE)},o.onFragmentOrKeyLoadError=function(S,y){if(y.fatal)return;var M=y.frag;if(!M||M.type!==S)return;var F=this.fragCurrent;console.assert(F&&M.sn===F.sn&&M.level===F.level&&M.urlId===F.urlId,"Frag load error must match current frag to retry");var W=this.config;if(this.fragLoadError+1<=W.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(M.level))return;var V=Math.min(Math.pow(2,this.fragLoadError)*W.fragLoadingRetryDelay,W.fragLoadingMaxRetryTimeout);this.warn("Fragment "+M.sn+" of "+S+" "+M.level+" failed to load, retrying in "+V+"ms"),this.retryDate=self.performance.now()+V,this.fragLoadError++,this.state=T.FRAG_LOADING_WAITING_RETRY}else y.levelRetry?(S===s.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=T.IDLE):(N.logger.error(y.details+" reaches max retry, redispatch as fatal ..."),y.fatal=!0,this.hls.stopLoad(),this.state=T.ERROR)},o.afterBufferFlushed=function(S,y,M){if(!S)return;var F=j.BufferHelper.getBuffered(S);this.fragmentTracker.detectEvictedFragments(y,F,M),this.state===T.ENDED&&this.resetLoadingState()},o.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=T.IDLE},o.resetLiveStartWhenNotLoaded=function(S){if(!this.loadedmetadata){this.startFragRequested=!1;var y=this.levels?this.levels[S].details:null;if(y!=null&&y.live)return this.startPosition=-1,this.setStartPosition(y,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},o.updateLevelTiming=function(S,y,M,F){var W=this,V=M.details;console.assert(!!V,"level.details must be defined");var I=Object.keys(S.elementaryStreams).reduce(function(B,X){var ee=S.elementaryStreams[X];if(ee){var oe=ee.endPTS-ee.startPTS;if(oe<=0)return W.warn("Could not parse fragment "+S.sn+" "+X+" duration reliably ("+oe+") resetting transmuxer to fallback to playlist timing"),W.resetTransmuxer(),B||!1;var fe=F?0:Object(E.updateFragPTSDTS)(V,S,ee.startPTS,ee.endPTS,ee.startDTS,ee.endDTS);return W.hls.trigger(_.Events.LEVEL_PTS_UPDATED,{details:V,level:M,drift:fe,type:X,frag:S,start:ee.startPTS,end:ee.endPTS}),!0}return B},!1);I?(this.state=T.PARSED,this.hls.trigger(_.Events.FRAG_PARSED,{frag:S,part:y})):this.resetLoadingState()},o.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},k(d,[{key:"state",get:function(){return this._state},set:function(S){var y=this._state;y!==S&&(this._state=S,this.log(y+"->"+S))}}]),d}(U.default)},"./src/controller/buffer-controller.ts":function(ne,$,R){"use strict";R.r($),R.d($,"default",function(){return w});var Q=R("./src/polyfills/number.ts"),U=R("./src/events.ts"),O=R("./src/utils/logger.ts"),j=R("./src/errors.ts"),N=R("./src/utils/buffer-helper.ts"),_=R("./src/utils/mediasource-helper.ts"),A=R("./src/loader/fragment.ts"),f=R("./src/controller/buffer-operation-queue.ts"),x=Object(_.getMediaSource)(),P=/([ha]vc.)(?:\.[^.,]+)+/,w=function(){function E(u){var a=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var s=a.hls,h=a.media,k=a.mediaSource;O.logger.log("[buffer-controller]: Media source opened"),h&&(a.updateMediaElementDuration(),s.trigger(U.Events.MEDIA_ATTACHED,{media:h})),k&&k.removeEventListener("sourceopen",a._onMediaSourceOpen),a.checkPendingTracks()},this._onMediaSourceClose=function(){O.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){O.logger.log("[buffer-controller]: Media source ended")},this.hls=u,this._initSourceBuffer(),this.registerListeners()}var p=E.prototype;return p.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},p.destroy=function(){this.unregisterListeners(),this.details=null},p.registerListeners=function(){var a=this.hls;a.on(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),a.on(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.on(U.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.on(U.Events.BUFFER_RESET,this.onBufferReset,this),a.on(U.Events.BUFFER_APPENDING,this.onBufferAppending,this),a.on(U.Events.BUFFER_CODECS,this.onBufferCodecs,this),a.on(U.Events.BUFFER_EOS,this.onBufferEos,this),a.on(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),a.on(U.Events.LEVEL_UPDATED,this.onLevelUpdated,this),a.on(U.Events.FRAG_PARSED,this.onFragParsed,this),a.on(U.Events.FRAG_CHANGED,this.onFragChanged,this)},p.unregisterListeners=function(){var a=this.hls;a.off(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),a.off(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),a.off(U.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.off(U.Events.BUFFER_RESET,this.onBufferReset,this),a.off(U.Events.BUFFER_APPENDING,this.onBufferAppending,this),a.off(U.Events.BUFFER_CODECS,this.onBufferCodecs,this),a.off(U.Events.BUFFER_EOS,this.onBufferEos,this),a.off(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),a.off(U.Events.LEVEL_UPDATED,this.onLevelUpdated,this),a.off(U.Events.FRAG_PARSED,this.onFragParsed,this),a.off(U.Events.FRAG_CHANGED,this.onFragChanged,this)},p._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new f.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},p.onManifestParsed=function(a,s){var h=2;(s.audio&&!s.video||!s.altAudio)&&(h=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=h,this.details=null,O.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},p.onMediaAttaching=function(a,s){var h=this.media=s.media;if(h&&x){var k=this.mediaSource=new x;k.addEventListener("sourceopen",this._onMediaSourceOpen),k.addEventListener("sourceended",this._onMediaSourceEnded),k.addEventListener("sourceclose",this._onMediaSourceClose),h.src=self.URL.createObjectURL(k),this._objectUrl=h.src}},p.onMediaDetaching=function(){var a=this.media,s=this.mediaSource,h=this._objectUrl;if(s){if(O.logger.log("[buffer-controller]: media source detaching"),s.readyState==="open")try{s.endOfStream()}catch(k){O.logger.warn("[buffer-controller]: onMediaDetaching: "+k.message+" while calling endOfStream")}this.onBufferReset(),s.removeEventListener("sourceopen",this._onMediaSourceOpen),s.removeEventListener("sourceended",this._onMediaSourceEnded),s.removeEventListener("sourceclose",this._onMediaSourceClose),a&&(h&&self.URL.revokeObjectURL(h),a.src===h?(a.removeAttribute("src"),a.load()):O.logger.warn("[buffer-controller]: media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(U.Events.MEDIA_DETACHED,void 0)},p.onBufferReset=function(){var a=this;this.getSourceBufferTypes().forEach(function(s){var h=a.sourceBuffer[s];try{h&&(a.removeBufferListeners(s),a.mediaSource&&a.mediaSource.removeSourceBuffer(h),a.sourceBuffer[s]=void 0)}catch(k){O.logger.warn("[buffer-controller]: Failed to reset the "+s+" buffer",k)}}),this._initSourceBuffer()},p.onBufferCodecs=function(a,s){var h=this,k=this.getSourceBufferTypes().length;if(Object.keys(s).forEach(function(c){if(k){var b=h.tracks[c];if(b&&typeof b.buffer.changeType=="function"){var D=s[c],T=D.codec,g=D.levelCodec,v=D.container,d=(b.levelCodec||b.codec).replace(P,"$1"),o=(g||T).replace(P,"$1");if(d!==o){var C=v+";codecs="+(g||T);h.appendChangeType(c,C)}}}else h.pendingTracks[c]=s[c]}),k)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},p.appendChangeType=function(a,s){var h=this,k=this.operationQueue,c={execute:function(){var D=h.sourceBuffer[a];D&&(O.logger.log("[buffer-controller]: changing "+a+" sourceBuffer type to "+s),D.changeType(s)),k.shiftAndExecuteNext(a)},onStart:function(){},onComplete:function(){},onError:function(D){O.logger.warn("[buffer-controller]: Failed to change "+a+" SourceBuffer type",D)}};k.append(c,a)},p.onBufferAppending=function(a,s){var h=this,k=this.hls,c=this.operationQueue,b=this.tracks,D=s.data,T=s.type,g=s.frag,v=s.part,d=s.chunkMeta,o=d.buffering[T],C=self.performance.now();o.start=C;var S=g.stats.buffering,y=v?v.stats.buffering:null;S.start===0&&(S.start=C),y&&y.start===0&&(y.start=C);var M=b.audio,F=T==="audio"&&d.id===1&&(M==null?void 0:M.container)==="audio/mpeg",W={execute:function(){if(o.executeStart=self.performance.now(),F){var I=h.sourceBuffer[T];if(I){var B=g.start-I.timestampOffset;Math.abs(B)>=.1&&(O.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+g.start+" (delta: "+B+") sn: "+g.sn+")"),I.timestampOffset=g.start)}}h.appendExecutor(D,T)},onStart:function(){},onComplete:function(){var I=self.performance.now();o.executeEnd=o.end=I,S.first===0&&(S.first=I),y&&y.first===0&&(y.first=I);var B=h.sourceBuffer,X={};for(var ee in B)X[ee]=N.BufferHelper.getBuffered(B[ee]);h.appendError=0,h.hls.trigger(U.Events.BUFFER_APPENDED,{type:T,frag:g,part:v,chunkMeta:d,parent:g.type,timeRanges:X})},onError:function(I){O.logger.error("[buffer-controller]: Error encountered while trying to append to the "+T+" SourceBuffer",I);var B={type:j.ErrorTypes.MEDIA_ERROR,parent:g.type,details:j.ErrorDetails.BUFFER_APPEND_ERROR,err:I,fatal:!1};I.code===DOMException.QUOTA_EXCEEDED_ERR?B.details=j.ErrorDetails.BUFFER_FULL_ERROR:(h.appendError++,B.details=j.ErrorDetails.BUFFER_APPEND_ERROR,h.appendError>k.config.appendErrorMaxRetry&&(O.logger.error("[buffer-controller]: Failed "+k.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),B.fatal=!0)),k.trigger(U.Events.ERROR,B)}};c.append(W,T)},p.onBufferFlushing=function(a,s){var h=this,k=this.operationQueue,c=function(D){return{execute:h.removeExecutor.bind(h,D,s.startOffset,s.endOffset),onStart:function(){},onComplete:function(){h.hls.trigger(U.Events.BUFFER_FLUSHED,{type:D})},onError:function(g){O.logger.warn("[buffer-controller]: Failed to remove from "+D+" SourceBuffer",g)}}};s.type?k.append(c(s.type),s.type):this.getSourceBufferTypes().forEach(function(b){k.append(c(b),b)})},p.onFragParsed=function(a,s){var h=this,k=s.frag,c=s.part,b=[],D=c?c.elementaryStreams:k.elementaryStreams;D[A.ElementaryStreamTypes.AUDIOVIDEO]?b.push("audiovideo"):(D[A.ElementaryStreamTypes.AUDIO]&&b.push("audio"),D[A.ElementaryStreamTypes.VIDEO]&&b.push("video"));var T=function(){var v=self.performance.now();k.stats.buffering.end=v,c&&(c.stats.buffering.end=v);var d=c?c.stats:k.stats;h.hls.trigger(U.Events.FRAG_BUFFERED,{frag:k,part:c,stats:d,id:k.type})};b.length===0&&O.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+k.type+" level: "+k.level+" sn: "+k.sn),this.blockBuffers(T,b)},p.onFragChanged=function(a,s){this.flushBackBuffer()},p.onBufferEos=function(a,s){var h=this,k=this.getSourceBufferTypes().reduce(function(c,b){var D=h.sourceBuffer[b];return(!s.type||s.type===b)&&(D&&!D.ended&&(D.ended=!0,O.logger.log("[buffer-controller]: "+b+" sourceBuffer now EOS"))),c&&!!(!D||D.ended)},!0);k&&this.blockBuffers(function(){var c=h.mediaSource;if(!c||c.readyState!=="open")return;c.endOfStream()})},p.onLevelUpdated=function(a,s){var h=s.details;if(!h.fragments.length)return;this.details=h,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},p.flushBackBuffer=function(){var a=this.hls,s=this.details,h=this.media,k=this.sourceBuffer;if(!h||s===null)return;var c=this.getSourceBufferTypes();if(!c.length)return;var b=s.live&&a.config.liveBackBufferLength!==null?a.config.liveBackBufferLength:a.config.backBufferLength;if(!Object(Q.isFiniteNumber)(b)||b<0)return;var D=h.currentTime,T=s.levelTargetDuration,g=Math.max(b,T),v=Math.floor(D/T)*T-g;c.forEach(function(d){var o=k[d];if(o){var C=N.BufferHelper.getBuffered(o);C.length>0&&v>C.start(0)&&(a.trigger(U.Events.BACK_BUFFER_REACHED,{bufferEnd:v}),s.live&&a.trigger(U.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:v}),a.trigger(U.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:v,type:d}))}})},p.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var a=this.details,s=this.hls,h=this.media,k=this.mediaSource,c=a.fragments[0].start+a.totalduration,b=h.duration,D=Object(Q.isFiniteNumber)(k.duration)?k.duration:0;a.live&&s.config.liveDurationInfinity?(O.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),k.duration=Infinity,this.updateSeekableRange(a)):(c>D&&c>b||!Object(Q.isFiniteNumber)(b))&&(O.logger.log("[buffer-controller]: Updating Media Source duration to "+c.toFixed(3)),k.duration=c)},p.updateSeekableRange=function(a){var s=this.mediaSource,h=a.fragments,k=h.length;if(k&&a.live&&s!==null&&s!==void 0&&s.setLiveSeekableRange){var c=Math.max(0,h[0].start),b=Math.max(c,c+a.totalduration);s.setLiveSeekableRange(c,b)}},p.checkPendingTracks=function(){var a=this.bufferCodecEventsExpected,s=this.operationQueue,h=this.pendingTracks,k=Object.keys(h).length;if(k&&!a||k===2){this.createSourceBuffers(h),this.pendingTracks={};var c=this.getSourceBufferTypes();if(c.length===0){this.hls.trigger(U.Events.ERROR,{type:j.ErrorTypes.MEDIA_ERROR,details:j.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}c.forEach(function(b){s.executeNext(b)})}},p.createSourceBuffers=function(a){var s=this.sourceBuffer,h=this.mediaSource;if(!h)throw Error("createSourceBuffers called when mediaSource was null");var k=0;for(var c in a)if(!s[c]){var b=a[c];if(!b)throw Error("source buffer exists for track "+c+", however track does not");var D=b.levelCodec||b.codec,T=b.container+";codecs="+D;O.logger.log("[buffer-controller]: creating sourceBuffer("+T+")");try{var g=s[c]=h.addSourceBuffer(T),v=c;this.addBufferListener(v,"updatestart",this._onSBUpdateStart),this.addBufferListener(v,"updateend",this._onSBUpdateEnd),this.addBufferListener(v,"error",this._onSBUpdateError),this.tracks[c]={buffer:g,codec:D,container:b.container,levelCodec:b.levelCodec,id:b.id},k++}catch(d){O.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+d.message),this.hls.trigger(U.Events.ERROR,{type:j.ErrorTypes.MEDIA_ERROR,details:j.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:d,mimeType:T})}}k&&this.hls.trigger(U.Events.BUFFER_CREATED,{tracks:this.tracks})},p._onSBUpdateStart=function(a){var s=this.operationQueue,h=s.current(a);h.onStart()},p._onSBUpdateEnd=function(a){var s=this.operationQueue,h=s.current(a);h.onComplete(),s.shiftAndExecuteNext(a)},p._onSBUpdateError=function(a,s){O.logger.error("[buffer-controller]: "+a+" SourceBuffer error",s),this.hls.trigger(U.Events.ERROR,{type:j.ErrorTypes.MEDIA_ERROR,details:j.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var h=this.operationQueue.current(a);h&&h.onError(s)},p.removeExecutor=function(a,s,h){var k=this.media,c=this.mediaSource,b=this.operationQueue,D=this.sourceBuffer,T=D[a];if(!k||!c||!T){O.logger.warn("[buffer-controller]: Attempting to remove from the "+a+" SourceBuffer, but it does not exist"),b.shiftAndExecuteNext(a);return}var g=Object(Q.isFiniteNumber)(k.duration)?k.duration:Infinity,v=Object(Q.isFiniteNumber)(c.duration)?c.duration:Infinity,d=Math.max(0,s),o=Math.min(h,g,v);o>d?(O.logger.log("[buffer-controller]: Removing ["+d+","+o+"] from the "+a+" SourceBuffer"),console.assert(!T.updating,a+" sourceBuffer must not be updating"),T.remove(d,o)):b.shiftAndExecuteNext(a)},p.appendExecutor=function(a,s){var h=this.operationQueue,k=this.sourceBuffer,c=k[s];if(!c){O.logger.warn("[buffer-controller]: Attempting to append to the "+s+" SourceBuffer, but it does not exist"),h.shiftAndExecuteNext(s);return}c.ended=!1,console.assert(!c.updating,s+" sourceBuffer must not be updating"),c.appendBuffer(a)},p.blockBuffers=function(a,s){var h=this;if(s===void 0&&(s=this.getSourceBufferTypes()),!s.length){O.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(a);return}var k=this.operationQueue,c=s.map(function(b){return k.appendBlocker(b)});Promise.all(c).then(function(){a(),s.forEach(function(b){var D=h.sourceBuffer[b];(!D||!D.updating)&&k.shiftAndExecuteNext(b)})})},p.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},p.addBufferListener=function(a,s,h){var k=this.sourceBuffer[a];if(!k)return;var c=h.bind(this,a);this.listeners[a].push({event:s,listener:c}),k.addEventListener(s,c)},p.removeBufferListeners=function(a){var s=this.sourceBuffer[a];if(!s)return;this.listeners[a].forEach(function(h){s.removeEventListener(h.event,h.listener)})},E}()},"./src/controller/buffer-operation-queue.ts":function(ne,$,R){"use strict";R.r($),R.d($,"default",function(){return U});var Q=R("./src/utils/logger.ts"),U=function(){function O(N){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=N}var j=O.prototype;return j.append=function(_,A){var f=this.queues[A];f.push(_),f.length===1&&this.buffers[A]&&this.executeNext(A)},j.insertAbort=function(_,A){var f=this.queues[A];f.unshift(_),this.executeNext(A)},j.appendBlocker=function(_){var A,f=new Promise(function(P){A=P}),x={execute:A,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(x,_),f},j.executeNext=function(_){var A=this.buffers,f=this.queues,x=A[_],P=f[_];if(P.length){var w=P[0];try{w.execute()}catch(E){Q.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),w.onError(E),(!x||!x.updating)&&(P.shift(),this.executeNext(_))}}},j.shiftAndExecuteNext=function(_){this.queues[_].shift(),this.executeNext(_)},j.current=function(_){return this.queues[_][0]},O}()},"./src/controller/cap-level-controller.ts":function(ne,$,R){"use strict";R.r($);var Q=R("./src/events.ts");function U(N,_){for(var A=0;A<_.length;A++){var f=_[A];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(N,f.key,f)}}function O(N,_,A){return _&&U(N.prototype,_),A&&U(N,A),N}var j=function(){function N(A){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=A,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var _=N.prototype;return _.setStreamController=function(f){this.streamController=f},_.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},_.registerListeners=function(){var f=this.hls;f.on(Q.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),f.on(Q.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),f.on(Q.Events.MANIFEST_PARSED,this.onManifestParsed,this),f.on(Q.Events.BUFFER_CODECS,this.onBufferCodecs,this),f.on(Q.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},_.unregisterListener=function(){var f=this.hls;f.off(Q.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),f.off(Q.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),f.off(Q.Events.MANIFEST_PARSED,this.onManifestParsed,this),f.off(Q.Events.BUFFER_CODECS,this.onBufferCodecs,this),f.off(Q.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},_.onFpsDropLevelCapping=function(f,x){N.isLevelAllowed(x.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(x.droppedLevel)},_.onMediaAttaching=function(f,x){this.media=x.media instanceof HTMLVideoElement?x.media:null},_.onManifestParsed=function(f,x){var P=this.hls;this.restrictedLevels=[],this.firstLevel=x.firstLevel,P.config.capLevelToPlayerSize&&x.video&&this.startCapping()},_.onBufferCodecs=function(f,x){var P=this.hls;P.config.capLevelToPlayerSize&&x.video&&this.startCapping()},_.onMediaDetaching=function(){this.stopCapping()},_.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var f=this.hls.levels;if(f.length){var x=this.hls;x.autoLevelCapping=this.getMaxLevel(f.length-1),x.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=x.autoLevelCapping}}},_.getMaxLevel=function(f){var x=this,P=this.hls.levels;if(!P.length)return-1;var w=P.filter(function(E,p){return N.isLevelAllowed(p,x.restrictedLevels)&&p<=f});return this.clientRect=null,N.getMaxLevelByMediaSize(w,this.mediaWidth,this.mediaHeight)},_.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()},_.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},_.getDimensions=function(){if(this.clientRect)return this.clientRect;var f=this.media,x={width:0,height:0};if(f){var P=f.getBoundingClientRect();x.width=P.width,x.height=P.height,!x.width&&!x.height&&(x.width=P.right-P.left||f.width||0,x.height=P.bottom-P.top||f.height||0)}return this.clientRect=x,x},N.isLevelAllowed=function(f,x){return x===void 0&&(x=[]),x.indexOf(f)===-1},N.getMaxLevelByMediaSize=function(f,x,P){if(!f||!f.length)return-1;for(var w=function(s,h){return h?s.width!==h.width||s.height!==h.height:!0},E=f.length-1,p=0;p<f.length;p+=1){var u=f[p];if((u.width>=x||u.height>=P)&&w(u,f[p+1])){E=p;break}}return E},O(N,[{key:"mediaWidth",get:function(){return this.getDimensions().width*N.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*N.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var f=1;try{f=self.devicePixelRatio}catch(x){}return f}}]),N}();$.default=j},"./src/controller/cmcd-controller.ts":function(ne,$,R){"use strict";R.r($),R.d($,"default",function(){return w});var Q=R("./src/events.ts"),U=R("./src/types/cmcd.ts"),O=R("./src/utils/buffer-helper.ts"),j=R("./src/utils/logger.ts");function N(E,p){for(var u=0;u<p.length;u++){var a=p[u];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(E,a.key,a)}}function _(E,p,u){return p&&N(E.prototype,p),u&&N(E,u),E}function A(E,p){var u=typeof Symbol!="undefined"&&E[Symbol.iterator]||E["@@iterator"];if(u)return(u=u.call(E)).next.bind(u);if(Array.isArray(E)||(u=f(E))||p&&E&&typeof E.length=="number"){u&&(E=u);var a=0;return function(){return a>=E.length?{done:!0}:{done:!1,value:E[a++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function f(E,p){if(!E)return;if(typeof E=="string")return x(E,p);var u=Object.prototype.toString.call(E).slice(8,-1);if(u==="Object"&&E.constructor&&(u=E.constructor.name),u==="Map"||u==="Set")return Array.from(E);if(u==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(u))return x(E,p)}function x(E,p){(p==null||p>E.length)&&(p=E.length);for(var u=0,a=new Array(p);u<p;u++)a[u]=E[u];return a}function P(){return P=Object.assign||function(E){for(var p=1;p<arguments.length;p++){var u=arguments[p];for(var a in u)Object.prototype.hasOwnProperty.call(u,a)&&(E[a]=u[a])}return E},P.apply(this,arguments)}var w=function(){function E(u){var a=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){a.initialized&&(a.starved=!0),a.buffering=!0},this.onPlaying=function(){a.initialized||(a.initialized=!0),a.buffering=!1},this.applyPlaylistData=function(k){try{a.apply(k,{ot:U.CMCDObjectType.MANIFEST,su:!a.initialized})}catch(c){j.logger.warn("Could not generate manifest CMCD data.",c)}},this.applyFragmentData=function(k){try{var c=k.frag,b=a.hls.levels[c.level],D=a.getObjectType(c),T={d:c.duration*1e3,ot:D};(D===U.CMCDObjectType.VIDEO||D===U.CMCDObjectType.AUDIO||D==U.CMCDObjectType.MUXED)&&(T.br=b.bitrate/1e3,T.tb=a.getTopBandwidth(D),T.bl=a.getBufferLength(D)),a.apply(k,T)}catch(g){j.logger.warn("Could not generate segment CMCD data.",g)}},this.hls=u;var s=this.config=u.config,h=s.cmcd;h!=null&&(s.pLoader=this.createPlaylistLoader(),s.fLoader=this.createFragmentLoader(),this.sid=h.sessionId||E.uuid(),this.cid=h.contentId,this.useHeaders=h.useHeaders===!0,this.registerListeners())}var p=E.prototype;return p.registerListeners=function(){var a=this.hls;a.on(Q.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.on(Q.Events.MEDIA_DETACHED,this.onMediaDetached,this),a.on(Q.Events.BUFFER_CREATED,this.onBufferCreated,this)},p.unregisterListeners=function(){var a=this.hls;a.off(Q.Events.MEDIA_ATTACHED,this.onMediaAttached,this),a.off(Q.Events.MEDIA_DETACHED,this.onMediaDetached,this),a.off(Q.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},p.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},p.onMediaAttached=function(a,s){this.media=s.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},p.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},p.onBufferCreated=function(a,s){var h,k;this.audioBuffer=(h=s.tracks.audio)===null||h===void 0?void 0:h.buffer,this.videoBuffer=(k=s.tracks.video)===null||k===void 0?void 0:k.buffer},p.createData=function(){var a;return{v:U.CMCDVersion,sf:U.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(a=this.media)===null||a===void 0?void 0:a.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},p.apply=function(a,s){s===void 0&&(s={}),P(s,this.createData());var h=s.ot===U.CMCDObjectType.INIT||s.ot===U.CMCDObjectType.VIDEO||s.ot===U.CMCDObjectType.MUXED;if(this.starved&&h&&(s.bs=!0,s.su=!0,this.starved=!1),s.su==null&&(s.su=this.buffering),this.useHeaders){var k=E.toHeaders(s);if(!Object.keys(k).length)return;a.headers||(a.headers={}),P(a.headers,k)}else{var c=E.toQuery(s);if(!c)return;a.url=E.appendQueryToUri(a.url,c)}},p.getObjectType=function(a){var s=a.type;return s==="subtitle"?U.CMCDObjectType.TIMED_TEXT:a.sn==="initSegment"?U.CMCDObjectType.INIT:s==="audio"?U.CMCDObjectType.AUDIO:s==="main"?this.hls.audioTracks.length?U.CMCDObjectType.VIDEO:U.CMCDObjectType.MUXED:void 0},p.getTopBandwidth=function(a){for(var s=0,h=a===U.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,k=A(h),c;!(c=k()).done;){var b=c.value;b.bitrate>s&&(s=b.bitrate)}return s>0?s:NaN},p.getBufferLength=function(a){var s=this.hls.media,h=a===U.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!h||!s)return NaN;var k=O.BufferHelper.bufferInfo(h,s.currentTime,this.config.maxBufferHole);return k.len*1e3},p.createPlaylistLoader=function(){var a=this.config.pLoader,s=this.applyPlaylistData,h=a||this.config.loader;return function(){function k(b){this.loader=void 0,this.loader=new h(b)}var c=k.prototype;return c.destroy=function(){this.loader.destroy()},c.abort=function(){this.loader.abort()},c.load=function(D,T,g){s(D),this.loader.load(D,T,g)},_(k,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),k}()},p.createFragmentLoader=function(){var a=this.config.fLoader,s=this.applyFragmentData,h=a||this.config.loader;return function(){function k(b){this.loader=void 0,this.loader=new h(b)}var c=k.prototype;return c.destroy=function(){this.loader.destroy()},c.abort=function(){this.loader.abort()},c.load=function(D,T,g){s(D),this.loader.load(D,T,g)},_(k,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),k}()},E.uuid=function(){var a=URL.createObjectURL(new Blob),s=a.toString();return URL.revokeObjectURL(a),s.substr(s.lastIndexOf("/")+1)},E.serialize=function(a){for(var s=[],h=function(F){return!Number.isNaN(F)&&F!=null&&F!==""&&F!==!1},k=function(F){return Math.round(F)},c=function(F){return k(F/100)*100},b=function(F){return encodeURIComponent(F)},D={br:k,d:k,bl:c,dl:c,mtp:c,nor:b,rtp:c,tb:k},T=Object.keys(a||{}).sort(),g=A(T),v;!(v=g()).done;){var d=v.value,o=a[d];if(!h(o))continue;if(d==="v"&&o===1)continue;if(d=="pr"&&o===1)continue;var C=D[d];C&&(o=C(o));var S=typeof o,y=void 0;d==="ot"||d==="sf"||d==="st"?y=d+"="+o:S==="boolean"?y=d:S==="number"?y=d+"="+o:y=d+"="+JSON.stringify(o),s.push(y)}return s.join(",")},E.toHeaders=function(a){for(var s=Object.keys(a),h={},k=["Object","Request","Session","Status"],c=[{},{},{},{}],b={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},D=0,T=s;D<T.length;D++){var g=T[D],v=b[g]!=null?b[g]:1;c[v][g]=a[g]}for(var d=0;d<c.length;d++){var o=E.serialize(c[d]);o&&(h["CMCD-"+k[d]]=o)}return h},E.toQuery=function(a){return"CMCD="+encodeURIComponent(E.serialize(a))},E.appendQueryToUri=function(a,s){if(!s)return a;var h=a.includes("?")?"&":"?";return""+a+h+s},E}()},"./src/controller/eme-controller.ts":function(ne,$,R){"use strict";R.r($);var Q=R("./src/events.ts"),U=R("./src/errors.ts"),O=R("./src/utils/logger.ts"),j=R("./src/utils/mediakeys-helper.ts");function N(w,E){for(var p=0;p<E.length;p++){var u=E[p];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(w,u.key,u)}}function _(w,E,p){return E&&N(w.prototype,E),p&&N(w,p),w}var A=3,f=function(E,p,u){var a={audioCapabilities:[],videoCapabilities:[]};return E.forEach(function(s){a.audioCapabilities.push({contentType:'audio/mp4; codecs="'+s+'"',robustness:u.audioRobustness||""})}),p.forEach(function(s){a.videoCapabilities.push({contentType:'video/mp4; codecs="'+s+'"',robustness:u.videoRobustness||""})}),[a]},x=function(E,p,u,a){switch(E){case j.KeySystems.WIDEVINE:return f(p,u,a);default:throw new Error("Unknown key-system: "+E)}},P=function(){function w(p){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=p,this._config=p.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 E=w.prototype;return E.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},E._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)},E._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)},E.getLicenseServerUrl=function(u){switch(u){case j.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+u+'"')},E._attemptKeySystemAccess=function(u,a,s){var h=this,k=x(u,a,s,this._drmSystemOptions);O.logger.log("Requesting encrypted media key-system access");var c=this.requestMediaKeySystemAccess(u,k);this.mediaKeysPromise=c.then(function(b){return h._onMediaKeySystemAccessObtained(u,b)}),c.catch(function(b){O.logger.error('Failed to obtain key-system "'+u+'" access:',b)})},E._onMediaKeySystemAccessObtained=function(u,a){var s=this;O.logger.log('Access for key-system "'+u+'" obtained');var h={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:a,mediaKeySystemDomain:u};this._mediaKeysList.push(h);var k=Promise.resolve().then(function(){return a.createMediaKeys()}).then(function(c){return h.mediaKeys=c,O.logger.log('Media-keys created for key-system "'+u+'"'),s._onMediaKeysCreated(),c});return k.catch(function(c){O.logger.error("Failed to create media-keys:",c)}),k},E._onMediaKeysCreated=function(){var u=this;this._mediaKeysList.forEach(function(a){a.mediaKeysSession||(a.mediaKeysSession=a.mediaKeys.createSession(),u._onNewMediaKeySession(a.mediaKeysSession))})},E._onNewMediaKeySession=function(u){var a=this;O.logger.log("New key-system session "+u.sessionId),u.addEventListener("message",function(s){a._onKeySessionMessage(u,s.message)},!1)},E._onKeySessionMessage=function(u,a){O.logger.log("Got EME message event, creating license request"),this._requestLicense(a,function(s){O.logger.log("Received license data (length: "+(s&&s.byteLength)+"), updating key-session"),u.update(s)})},E.onMediaEncrypted=function(u){var a=this;if(O.logger.log('Media is encrypted using "'+u.initDataType+'" init data type'),!this.mediaKeysPromise){O.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(Q.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var s=function(k){if(!a._media)return;a._attemptSetMediaKeys(k),a._generateRequestWithPreferredKeySession(u.initDataType,u.initData)};this.mediaKeysPromise.then(s).catch(s)},E._attemptSetMediaKeys=function(u){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var a=this._mediaKeysList[0];if(!a||!a.mediaKeys){O.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(Q.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}O.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(a.mediaKeys),this._hasSetMediaKeys=!0}},E._generateRequestWithPreferredKeySession=function(u,a){var s=this,h=this._mediaKeysList[0];if(!h){O.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(Q.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(h.mediaKeysSessionInitialized){O.logger.warn("Key-Session already initialized but requested again");return}var k=h.mediaKeysSession;if(!k){O.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(Q.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!a){O.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(Q.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}O.logger.log('Generating key-session request for "'+u+'" init data type'),h.mediaKeysSessionInitialized=!0,k.generateRequest(u,a).then(function(){O.logger.debug("Key-session generation succeeded")}).catch(function(c){O.logger.error("Error generating key-session request:",c),s.hls.trigger(Q.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},E._createLicenseXhr=function(u,a,s){var h=new XMLHttpRequest;h.responseType="arraybuffer",h.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,h,u,a,s);var k=this._licenseXhrSetup;if(k)try{k.call(this.hls,h,u),k=void 0}catch(c){O.logger.error(c)}try{h.readyState||h.open("POST",u,!0),k&&k.call(this.hls,h,u)}catch(c){throw new Error("issue setting up KeySystem license XHR "+c)}return h},E._onLicenseRequestReadyStageChange=function(u,a,s,h){switch(u.readyState){case 4:if(u.status===200){this._requestLicenseFailureCount=0,O.logger.log("License request succeeded");var k=u.response,c=this._licenseResponseCallback;if(c)try{k=c.call(this.hls,u,a)}catch(D){O.logger.error(D)}h(k)}else{if(O.logger.error("License Request XHR failed ("+a+"). Status: "+u.status+" ("+u.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>A){this.hls.trigger(Q.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var b=A-this._requestLicenseFailureCount+1;O.logger.warn("Retrying license request, "+b+" attempts left"),this._requestLicense(s,h)}break}},E._generateLicenseRequestChallenge=function(u,a){switch(u.mediaKeySystemDomain){case j.KeySystems.WIDEVINE:return a}throw new Error("unsupported key-system: "+u.mediaKeySystemDomain)},E._requestLicense=function(u,a){O.logger.log("Requesting content license for key-system");var s=this._mediaKeysList[0];if(!s){O.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(Q.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var h=this.getLicenseServerUrl(s.mediaKeySystemDomain),k=this._createLicenseXhr(h,u,a);O.logger.log("Sending license request to URL: "+h);var c=this._generateLicenseRequestChallenge(s,u);k.send(c)}catch(b){O.logger.error("Failure requesting DRM license: "+b),this.hls.trigger(Q.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},E.onMediaAttached=function(u,a){if(!this._emeEnabled)return;var s=a.media;this._media=s,s.addEventListener("encrypted",this._onMediaEncrypted)},E.onMediaDetached=function(){var u=this._media,a=this._mediaKeysList;if(!u)return;u.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(a.map(function(s){if(s.mediaKeysSession)return s.mediaKeysSession.close().catch(function(){})})).then(function(){return u.setMediaKeys(null)}).catch(function(){})},E.onManifestParsed=function(u,a){if(!this._emeEnabled)return;var s=a.levels.map(function(k){return k.audioCodec}).filter(function(k){return!!k}),h=a.levels.map(function(k){return k.videoCodec}).filter(function(k){return!!k});this._attemptKeySystemAccess(j.KeySystems.WIDEVINE,s,h)},_(w,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),w}();$.default=P},"./src/controller/fps-controller.ts":function(ne,$,R){"use strict";R.r($);var Q=R("./src/events.ts"),U=R("./src/utils/logger.ts"),O=function(){function j(_){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=_,this.registerListeners()}var N=j.prototype;return N.setStreamController=function(A){this.streamController=A},N.registerListeners=function(){this.hls.on(Q.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},N.unregisterListeners=function(){this.hls.off(Q.Events.MEDIA_ATTACHING,this.onMediaAttaching)},N.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},N.onMediaAttaching=function(A,f){var x=this.hls.config;if(x.capLevelOnFPSDrop){var P=f.media instanceof self.HTMLVideoElement?f.media:null;this.media=P,P&&typeof P.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),x.fpsDroppedMonitoringPeriod)}},N.checkFPS=function(A,f,x){var P=performance.now();if(f){if(this.lastTime){var w=P-this.lastTime,E=x-this.lastDroppedFrames,p=f-this.lastDecodedFrames,u=1e3*E/w,a=this.hls;if(a.trigger(Q.Events.FPS_DROP,{currentDropped:E,currentDecoded:p,totalDroppedFrames:x}),u>0&&E>a.config.fpsDroppedMonitoringThreshold*p){var s=a.currentLevel;U.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+s),s>0&&(a.autoLevelCapping===-1||a.autoLevelCapping>=s)&&(s=s-1,a.trigger(Q.Events.FPS_DROP_LEVEL_CAPPING,{level:s,droppedLevel:a.currentLevel}),a.autoLevelCapping=s,this.streamController.nextLevelSwitch())}}this.lastTime=P,this.lastDroppedFrames=x,this.lastDecodedFrames=f}},N.checkFPSInterval=function(){var A=this.media;if(A)if(this.isVideoPlaybackQualityAvailable){var f=A.getVideoPlaybackQuality();this.checkFPS(A,f.totalVideoFrames,f.droppedVideoFrames)}else this.checkFPS(A,A.webkitDecodedFrameCount,A.webkitDroppedFrameCount)},j}();$.default=O},"./src/controller/fragment-finders.ts":function(ne,$,R){"use strict";R.r($),R.d($,"findFragmentByPDT",function(){return O}),R.d($,"findFragmentByPTS",function(){return j}),R.d($,"fragmentWithinToleranceTest",function(){return N}),R.d($,"pdtWithinToleranceTest",function(){return _}),R.d($,"findFragWithCC",function(){return A});var Q=R("./src/polyfills/number.ts"),U=R("./src/utils/binary-search.ts");function O(f,x,P){if(x===null||!Array.isArray(f)||!f.length||!Object(Q.isFiniteNumber)(x))return null;var w=f[0].programDateTime;if(x<(w||0))return null;var E=f[f.length-1].endProgramDateTime;if(x>=(E||0))return null;P=P||0;for(var p=0;p<f.length;++p){var u=f[p];if(_(x,P,u))return u}return null}function j(f,x,P,w){P===void 0&&(P=0),w===void 0&&(w=0);var E=null;if(f?E=x[f.sn-x[0].sn+1]||null:P===0&&x[0].start===0&&(E=x[0]),E&&N(P,w,E)===0)return E;var p=U.default.search(x,N.bind(null,P,w));return p||E}function N(f,x,P){f===void 0&&(f=0),x===void 0&&(x=0);var w=Math.min(x,P.duration+(P.deltaPTS?P.deltaPTS:0));return P.start+P.duration-w<=f?1:P.start-w>f&&P.start?-1:0}function _(f,x,P){var w=Math.min(x,P.duration+(P.deltaPTS?P.deltaPTS:0))*1e3,E=P.endProgramDateTime||0;return E-w>f}function A(f,x){return U.default.search(f,function(P){return P.cc<x?1:P.cc>x?-1:0})}},"./src/controller/fragment-tracker.ts":function(ne,$,R){"use strict";R.r($),R.d($,"FragmentState",function(){return O}),R.d($,"FragmentTracker",function(){return j});var Q=R("./src/events.ts"),U=R("./src/types/loader.ts"),O;(function(A){A.NOT_LOADED="NOT_LOADED",A.BACKTRACKED="BACKTRACKED",A.APPENDING="APPENDING",A.PARTIAL="PARTIAL",A.OK="OK"})(O||(O={}));var j=function(){function A(x){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=x,this._registerListeners()}var f=A.prototype;return f._registerListeners=function(){var P=this.hls;P.on(Q.Events.BUFFER_APPENDED,this.onBufferAppended,this),P.on(Q.Events.FRAG_BUFFERED,this.onFragBuffered,this),P.on(Q.Events.FRAG_LOADED,this.onFragLoaded,this)},f._unregisterListeners=function(){var P=this.hls;P.off(Q.Events.BUFFER_APPENDED,this.onBufferAppended,this),P.off(Q.Events.FRAG_BUFFERED,this.onFragBuffered,this),P.off(Q.Events.FRAG_LOADED,this.onFragLoaded,this)},f.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},f.getAppendedFrag=function(P,w){if(w===U.PlaylistLevelType.MAIN){var E=this.activeFragment,p=this.activeParts;if(!E)return null;if(p)for(var u=p.length;u--;){var a=p[u],s=a?a.end:E.appendedPTS;if(a.start<=P&&s!==void 0&&P<=s)return u>9&&(this.activeParts=p.slice(u-9)),a}else if(E.start<=P&&E.appendedPTS!==void 0&&P<=E.appendedPTS)return E}return this.getBufferedFrag(P,w)},f.getBufferedFrag=function(P,w){for(var E=this.fragments,p=Object.keys(E),u=p.length;u--;){var a=E[p[u]];if((a==null?void 0:a.body.type)===w&&a.buffered){var s=a.body;if(s.start<=P&&P<=s.end)return s}}return null},f.detectEvictedFragments=function(P,w,E){var p=this;Object.keys(this.fragments).forEach(function(u){var a=p.fragments[u];if(!a)return;if(!a.buffered){a.body.type===E&&p.removeFragment(a.body);return}var s=a.range[P];if(!s)return;s.time.some(function(h){var k=!p.isTimeBuffered(h.startPTS,h.endPTS,w);return k&&p.removeFragment(a.body),k})})},f.detectPartialFragments=function(P){var w=this,E=this.timeRanges,p=P.frag,u=P.part;if(!E||p.sn==="initSegment")return;var a=_(p),s=this.fragments[a];if(!s)return;Object.keys(E).forEach(function(h){var k=p.elementaryStreams[h];if(!k)return;var c=E[h],b=u!==null||k.partial===!0;s.range[h]=w.getBufferedTimes(p,u,b,c)}),s.backtrack=s.loaded=null,Object.keys(s.range).length?s.buffered=!0:this.removeFragment(s.body)},f.fragBuffered=function(P){var w=_(P),E=this.fragments[w];E&&(E.backtrack=E.loaded=null,E.buffered=!0)},f.getBufferedTimes=function(P,w,E,p){for(var u={time:[],partial:E},a=w?w.start:P.start,s=w?w.end:P.end,h=P.minEndPTS||s,k=P.maxStartPTS||a,c=0;c<p.length;c++){var b=p.start(c)-this.bufferPadding,D=p.end(c)+this.bufferPadding;if(k>=b&&h<=D){u.time.push({startPTS:Math.max(a,p.start(c)),endPTS:Math.min(s,p.end(c))});break}else if(a<D&&s>b)u.partial=!0,u.time.push({startPTS:Math.max(a,p.start(c)),endPTS:Math.min(s,p.end(c))});else if(s<=b)break}return u},f.getPartialFragment=function(P){var w=null,E,p,u,a=0,s=this.bufferPadding,h=this.fragments;return Object.keys(h).forEach(function(k){var c=h[k];if(!c)return;N(c)&&(p=c.body.start-s,u=c.body.end+s,P>=p&&P<=u&&(E=Math.min(P-p,u-P),a<=E&&(w=c.body,a=E)))}),w},f.getState=function(P){var w=_(P),E=this.fragments[w];return E?E.buffered?N(E)?O.PARTIAL:O.OK:E.backtrack?O.BACKTRACKED:O.APPENDING:O.NOT_LOADED},f.backtrack=function(P,w){var E=_(P),p=this.fragments[E];if(!p||p.backtrack)return null;var u=p.backtrack=w||p.loaded;return p.loaded=null,u},f.getBacktrackData=function(P){var w=_(P),E=this.fragments[w];if(E){var p,u=E.backtrack;if(u!=null&&(p=u.payload)!==null&&p!==void 0&&p.byteLength)return u;this.removeFragment(P)}return null},f.isTimeBuffered=function(P,w,E){for(var p,u,a=0;a<E.length;a++){if(p=E.start(a)-this.bufferPadding,u=E.end(a)+this.bufferPadding,P>=p&&w<=u)return!0;if(w<=p)return!1}return!1},f.onFragLoaded=function(P,w){var E=w.frag,p=w.part;if(E.sn==="initSegment"||E.bitrateTest||p)return;var u=_(E);this.fragments[u]={body:E,loaded:w,backtrack:null,buffered:!1,range:Object.create(null)}},f.onBufferAppended=function(P,w){var E=this,p=w.frag,u=w.part,a=w.timeRanges;if(p.type===U.PlaylistLevelType.MAIN)if(this.activeFragment=p,u){var s=this.activeParts;s||(this.activeParts=s=[]),s.push(u)}else this.activeParts=null;this.timeRanges=a,Object.keys(a).forEach(function(h){var k=a[h];if(E.detectEvictedFragments(h,k),!u)for(var c=0;c<k.length;c++)p.appendedPTS=Math.max(k.end(c),p.appendedPTS||0)})},f.onFragBuffered=function(P,w){this.detectPartialFragments(w)},f.hasFragment=function(P){var w=_(P);return!!this.fragments[w]},f.removeFragmentsInRange=function(P,w,E){var p=this;Object.keys(this.fragments).forEach(function(u){var a=p.fragments[u];if(!a)return;if(a.buffered){var s=a.body;s.type===E&&s.start<w&&s.end>P&&p.removeFragment(s)}})},f.removeFragment=function(P){var w=_(P);P.stats.loaded=0,P.clearElementaryStreamInfo(),delete this.fragments[w]},f.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},A}();function N(A){var f,x;return A.buffered&&(((f=A.range.video)===null||f===void 0?void 0:f.partial)||((x=A.range.audio)===null||x===void 0?void 0:x.partial))}function _(A){return A.type+"_"+A.level+"_"+A.urlId+"_"+A.sn}},"./src/controller/gap-controller.ts":function(ne,$,R){"use strict";R.r($),R.d($,"STALL_MINIMUM_DURATION_MS",function(){return N}),R.d($,"MAX_START_GAP_JUMP",function(){return _}),R.d($,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return A}),R.d($,"SKIP_BUFFER_RANGE_START",function(){return f}),R.d($,"default",function(){return x});var Q=R("./src/utils/buffer-helper.ts"),U=R("./src/errors.ts"),O=R("./src/events.ts"),j=R("./src/utils/logger.ts"),N=250,_=2,A=.1,f=.05,x=function(){function P(E,p,u,a){this.config=void 0,this.media=void 0,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=E,this.media=p,this.fragmentTracker=u,this.hls=a}var w=P.prototype;return w.destroy=function(){this.hls=this.fragmentTracker=this.media=null},w.poll=function(p){var u=this.config,a=this.media,s=this.stalled,h=a.currentTime,k=a.seeking,c=this.seeking&&!k,b=!this.seeking&&k;if(this.seeking=k,h!==p){if(this.moved=!0,s!==null){if(this.stallReported){var D=self.performance.now()-s;j.logger.warn("playback not stuck anymore @"+h+", after "+Math.round(D)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((b||c)&&(this.stalled=null),a.paused||a.ended||a.playbackRate===0||!Q.BufferHelper.getBuffered(a).length)return;var T=Q.BufferHelper.bufferInfo(a,h,0),g=T.len>0,v=T.nextStart||0;if(!g&&!v)return;if(k){var d=T.len>_,o=!v||v-h>_&&!this.fragmentTracker.getPartialFragment(h);if(d||o)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var C,S=Math.max(v,T.start||0)-h,y=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,M=y==null||((C=y.details)===null||C===void 0)?void 0:C.live,F=M?y.details.targetduration*2:_;if(S>0&&S<=F){this._trySkipBufferHole(null);return}}var W=self.performance.now();if(s===null){this.stalled=W;return}var V=W-s;!k&&V>=N&&this._reportStall(T.len);var I=Q.BufferHelper.bufferInfo(a,h,u.maxBufferHole);this._tryFixBufferStall(I,V)},w._tryFixBufferStall=function(p,u){var a=this.config,s=this.fragmentTracker,h=this.media,k=h.currentTime,c=s.getPartialFragment(k);if(c){var b=this._trySkipBufferHole(c);if(b)return}p.len>a.maxBufferHole&&u>a.highBufferWatchdogPeriod*1e3&&(j.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},w._reportStall=function(p){var u=this.hls,a=this.media,s=this.stallReported;s||(this.stallReported=!0,j.logger.warn("Playback stalling at @"+a.currentTime+" due to low buffer (buffer="+p+")"),u.trigger(O.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:p}))},w._trySkipBufferHole=function(p){for(var u=this.config,a=this.hls,s=this.media,h=s.currentTime,k=0,c=Q.BufferHelper.getBuffered(s),b=0;b<c.length;b++){var D=c.start(b);if(h+u.maxBufferHole>=k&&h<D){var T=Math.max(D+f,s.currentTime+A);return j.logger.warn("skipping hole, adjusting currentTime from "+h+" to "+T),this.moved=!0,this.stalled=null,s.currentTime=T,p&&a.trigger(O.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+h+" to "+T,frag:p}),T}k=c.end(b)}return 0},w._tryNudgeBuffer=function(){var p=this.config,u=this.hls,a=this.media,s=a.currentTime,h=(this.nudgeRetry||0)+1;if(this.nudgeRetry=h,h<p.nudgeMaxRetry){var k=s+h*p.nudgeOffset;j.logger.warn("Nudging 'currentTime' from "+s+" to "+k),a.currentTime=k,u.trigger(O.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else j.logger.error("Playhead still not moving while enough data buffered @"+s+" after "+p.nudgeMaxRetry+" nudges"),u.trigger(O.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},P}()},"./src/controller/id3-track-controller.ts":function(ne,$,R){"use strict";R.r($);var Q=R("./src/events.ts"),U=R("./src/utils/texttrack-utils.ts"),O=R("./src/demux/id3.ts"),j=.25,N=function(){function _(f){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=f,this._registerListeners()}var A=_.prototype;return A.destroy=function(){this._unregisterListeners()},A._registerListeners=function(){var x=this.hls;x.on(Q.Events.MEDIA_ATTACHED,this.onMediaAttached,this),x.on(Q.Events.MEDIA_DETACHING,this.onMediaDetaching,this),x.on(Q.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),x.on(Q.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},A._unregisterListeners=function(){var x=this.hls;x.off(Q.Events.MEDIA_ATTACHED,this.onMediaAttached,this),x.off(Q.Events.MEDIA_DETACHING,this.onMediaDetaching,this),x.off(Q.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),x.off(Q.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},A.onMediaAttached=function(x,P){this.media=P.media},A.onMediaDetaching=function(){if(!this.id3Track)return;Object(U.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},A.getID3Track=function(x){if(!this.media)return;for(var P=0;P<x.length;P++){var w=x[P];if(w.kind==="metadata"&&w.label==="id3")return Object(U.sendAddTrackEvent)(w,this.media),w}return this.media.addTextTrack("metadata","id3")},A.onFragParsingMetadata=function(x,P){if(!this.media)return;var w=P.frag,E=P.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var p=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,u=0;u<E.length;u++){var a=O.getID3Frames(E[u].data);if(a){var s=E[u].pts,h=u<E.length-1?E[u+1].pts:w.end,k=h-s;k<=0&&(h=s+j);for(var c=0;c<a.length;c++){var b=a[c];if(!O.isTimeStampFrame(b)){var D=new p(s,h,"");D.value=b,this.id3Track.addCue(D)}}}}},A.onBufferFlushing=function(x,P){var w=P.startOffset,E=P.endOffset,p=P.type;if(!p||p==="audio"){var u=this.id3Track;u&&Object(U.removeCuesInRange)(u,w,E)}},_}();$.default=N},"./src/controller/latency-controller.ts":function(ne,$,R){"use strict";R.r($),R.d($,"default",function(){return _});var Q=R("./src/errors.ts"),U=R("./src/events.ts"),O=R("./src/utils/logger.ts");function j(A,f){for(var x=0;x<f.length;x++){var P=f[x];P.enumerable=P.enumerable||!1,P.configurable=!0,"value"in P&&(P.writable=!0),Object.defineProperty(A,P.key,P)}}function N(A,f,x){return f&&j(A.prototype,f),x&&j(A,x),A}var _=function(){function A(x){var P=this;this.hls=void 0,this.config=void 0,this.media=null,this.levelDetails=null,this.currentTime=0,this.stallCount=0,this._latency=null,this.timeupdateHandler=function(){return P.timeupdate()},this.hls=x,this.config=x.config,this.registerListeners()}var f=A.prototype;return f.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},f.registerListeners=function(){this.hls.on(U.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(U.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(U.Events.ERROR,this.onError,this)},f.unregisterListeners=function(){this.hls.off(U.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(U.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(U.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(U.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(U.Events.ERROR,this.onError)},f.onMediaAttached=function(P,w){this.media=w.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},f.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},f.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},f.onLevelUpdated=function(P,w){var E=w.details;this.levelDetails=E,E.advanced&&this.timeupdate(),!E.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},f.onError=function(P,w){if(w.details!==Q.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,O.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},f.timeupdate=function(){var P=this.media,w=this.levelDetails;if(!P||!w)return;this.currentTime=P.currentTime;var E=this.computeLatency();if(E===null)return;this._latency=E;var p=this.config,u=p.lowLatencyMode,a=p.maxLiveSyncPlaybackRate;if(!u||a===1)return;var s=this.targetLatency;if(s===null)return;var h=E-s,k=Math.min(this.maxLatency,s+w.targetduration),c=h<k;if(w.live&&c&&h>.05&&this.forwardBufferLength>1){var b=Math.min(2,Math.max(1,a)),D=Math.round(2/(1+Math.exp(-.75*h-this.edgeStalled))*20)/20;P.playbackRate=Math.min(b,Math.max(1,D))}else P.playbackRate!==1&&P.playbackRate!==0&&(P.playbackRate=1)},f.estimateLiveEdge=function(){var P=this.levelDetails;return P===null?null:P.edge+P.age},f.computeLatency=function(){var P=this.estimateLiveEdge();return P===null?null:P-this.currentTime},N(A,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var P=this.config,w=this.levelDetails;return P.liveMaxLatencyDuration!==void 0?P.liveMaxLatencyDuration:w?P.liveMaxLatencyDurationCount*w.targetduration:0}},{key:"targetLatency",get:function(){var P=this.levelDetails;if(P===null)return null;var w=P.holdBack,E=P.partHoldBack,p=P.targetduration,u=this.config,a=u.liveSyncDuration,s=u.liveSyncDurationCount,h=u.lowLatencyMode,k=this.hls.userConfig,c=h&&E||w;(k.liveSyncDuration||k.liveSyncDurationCount||c===0)&&(c=a!==void 0?a:s*p);var b=p,D=1;return c+Math.min(this.stallCount*D,b)}},{key:"liveSyncPosition",get:function(){var P=this.estimateLiveEdge(),w=this.targetLatency,E=this.levelDetails;if(P===null||w===null||E===null)return null;var p=E.edge,u=P-w-this.edgeStalled,a=p-E.totalduration,s=p-(this.config.lowLatencyMode&&E.partTarget||E.targetduration);return Math.min(Math.max(a,u),s)}},{key:"drift",get:function(){var P=this.levelDetails;return P===null?1:P.drift}},{key:"edgeStalled",get:function(){var P=this.levelDetails;if(P===null)return 0;var w=(this.config.lowLatencyMode&&P.partTarget||P.targetduration)*3;return Math.max(P.age-w,0)}},{key:"forwardBufferLength",get:function(){var P=this.media,w=this.levelDetails;if(!P||!w)return 0;var E=P.buffered.length;return E?P.buffered.end(E-1):w.edge-this.currentTime}}]),A}()},"./src/controller/level-controller.ts":function(ne,$,R){"use strict";R.r($),R.d($,"default",function(){return u});var Q=R("./src/types/level.ts"),U=R("./src/events.ts"),O=R("./src/errors.ts"),j=R("./src/utils/codecs.ts"),N=R("./src/controller/level-helper.ts"),_=R("./src/controller/base-playlist-controller.ts"),A=R("./src/types/loader.ts");function f(){return f=Object.assign||function(a){for(var s=1;s<arguments.length;s++){var h=arguments[s];for(var k in h)Object.prototype.hasOwnProperty.call(h,k)&&(a[k]=h[k])}return a},f.apply(this,arguments)}function x(a,s){for(var h=0;h<s.length;h++){var k=s[h];k.enumerable=k.enumerable||!1,k.configurable=!0,"value"in k&&(k.writable=!0),Object.defineProperty(a,k.key,k)}}function P(a,s,h){return s&&x(a.prototype,s),h&&x(a,h),a}function w(a,s){a.prototype=Object.create(s.prototype),a.prototype.constructor=a,E(a,s)}function E(a,s){return E=Object.setPrototypeOf||function(k,c){return k.__proto__=c,k},E(a,s)}var p=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),u=function(a){w(s,a);function s(k){var c;return c=a.call(this,k,"[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 h=s.prototype;return h._registerListeners=function(){var c=this.hls;c.on(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),c.on(U.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.on(U.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),c.on(U.Events.FRAG_LOADED,this.onFragLoaded,this),c.on(U.Events.ERROR,this.onError,this)},h._unregisterListeners=function(){var c=this.hls;c.off(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),c.off(U.Events.LEVEL_LOADED,this.onLevelLoaded,this),c.off(U.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),c.off(U.Events.FRAG_LOADED,this.onFragLoaded,this),c.off(U.Events.ERROR,this.onError,this)},h.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,a.prototype.destroy.call(this)},h.startLoad=function(){var c=this._levels;c.forEach(function(b){b.loadError=0}),a.prototype.startLoad.call(this)},h.onManifestLoaded=function(c,b){var D=[],T=[],g=[],v,d={},o,C=!1,S=!1,y=!1;if(b.levels.forEach(function(V){var I=V.attrs;C=C||!!(V.width&&V.height),S=S||!!V.videoCodec,y=y||!!V.audioCodec,p&&V.audioCodec&&V.audioCodec.indexOf("mp4a.40.34")!==-1&&(V.audioCodec=void 0);var B=V.bitrate+"-"+V.attrs.RESOLUTION+"-"+V.attrs.CODECS;o=d[B],o?o.url.push(V.url):(o=new Q.Level(V),d[B]=o,D.push(o)),I&&(I.AUDIO&&Object(N.addGroupId)(o,"audio",I.AUDIO),I.SUBTITLES&&Object(N.addGroupId)(o,"text",I.SUBTITLES))}),(C||S)&&y&&(D=D.filter(function(V){var I=V.videoCodec,B=V.width,X=V.height;return!!I||!!(B&&X)})),D=D.filter(function(V){var I=V.audioCodec,B=V.videoCodec;return(!I||Object(j.isCodecSupportedInMp4)(I,"audio"))&&(!B||Object(j.isCodecSupportedInMp4)(B,"video"))}),b.audioTracks&&(T=b.audioTracks.filter(function(V){return!V.audioCodec||Object(j.isCodecSupportedInMp4)(V.audioCodec,"audio")}),Object(N.assignTrackIdsByGroup)(T)),b.subtitles&&(g=b.subtitles,Object(N.assignTrackIdsByGroup)(g)),D.length>0){v=D[0].bitrate,D.sort(function(V,I){return V.bitrate-I.bitrate}),this._levels=D;for(var M=0;M<D.length;M++)if(D[M].bitrate===v){this._firstLevel=M,this.log("manifest loaded, "+D.length+" level(s) found, first bitrate: "+v);break}var F=y&&!S,W={levels:D,audioTracks:T,subtitleTracks:g,firstLevel:this._firstLevel,stats:b.stats,audio:y,video:S,altAudio:!F&&T.some(function(V){return!!V.url})};this.hls.trigger(U.Events.MANIFEST_PARSED,W),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(U.Events.ERROR,{type:O.ErrorTypes.MEDIA_ERROR,details:O.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:b.url,reason:"no level with compatible codecs found in manifest"})},h.onError=function(c,b){if(a.prototype.onError.call(this,c,b),b.fatal)return;var D=b.context,T=this._levels[this.currentLevelIndex];if(D&&(D.type===A.PlaylistContextType.AUDIO_TRACK&&T.audioGroupIds&&D.groupId===T.audioGroupIds[T.urlId]||D.type===A.PlaylistContextType.SUBTITLE_TRACK&&T.textGroupIds&&D.groupId===T.textGroupIds[T.urlId])){this.redundantFailover(this.currentLevelIndex);return}var g=!1,v=!0,d;switch(b.details){case O.ErrorDetails.FRAG_LOAD_ERROR:case O.ErrorDetails.FRAG_LOAD_TIMEOUT:case O.ErrorDetails.KEY_LOAD_ERROR:case O.ErrorDetails.KEY_LOAD_TIMEOUT:if(b.frag){var o=this._levels[b.frag.level];o?(o.fragmentError++,o.fragmentError>this.hls.config.fragLoadingMaxRetry&&(d=b.frag.level)):d=b.frag.level}break;case O.ErrorDetails.LEVEL_LOAD_ERROR:case O.ErrorDetails.LEVEL_LOAD_TIMEOUT:D&&(D.deliveryDirectives&&(v=!1),d=D.level),g=!0;break;case O.ErrorDetails.REMUX_ALLOC_ERROR:d=b.level,g=!0;break}d!==void 0&&this.recoverLevel(b,d,g,v)},h.recoverLevel=function(c,b,D,T){var g=c.details,v=this._levels[b];if(v.loadError++,D){var d=this.retryLoadingOrFail(c);if(d)c.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(T){var o=v.url.length;if(o>1&&v.loadError<o)c.levelRetry=!0,this.redundantFailover(b);else if(this.manualLevelIndex===-1){var C=b===0?this._levels.length-1:b-1;this.currentLevelIndex!==C&&this._levels[C].loadError===0&&(this.warn(g+": switch to "+C),c.levelRetry=!0,this.hls.nextAutoLevel=C)}}},h.redundantFailover=function(c){var b=this._levels[c],D=b.url.length;if(D>1){var T=(b.urlId+1)%D;this.warn("Switching to redundant URL-id "+T),this._levels.forEach(function(g){g.urlId=T}),this.level=c}},h.onFragLoaded=function(c,b){var D=b.frag;if(D!==void 0&&D.type===A.PlaylistLevelType.MAIN){var T=this._levels[D.level];T!==void 0&&(T.fragmentError=0,T.loadError=0)}},h.onLevelLoaded=function(c,b){var D,T=b.level,g=b.details,v=this._levels[T];if(!v){var d;this.warn("Invalid level index "+T),(d=b.deliveryDirectives)!==null&&d!==void 0&&d.skip&&(g.deltaUpdateFailed=!0);return}T===this.currentLevelIndex?(v.fragmentError===0&&(v.loadError=0,this.retryCount=0),this.playlistLoaded(T,b,v.details)):(D=b.deliveryDirectives)!==null&&D!==void 0&&D.skip&&(g.deltaUpdateFailed=!0)},h.onAudioTrackSwitched=function(c,b){var D=this.hls.levels[this.currentLevelIndex];if(!D)return;if(D.audioGroupIds){for(var T=-1,g=this.hls.audioTracks[b.id].groupId,v=0;v<D.audioGroupIds.length;v++)if(D.audioGroupIds[v]===g){T=v;break}T!==D.urlId&&(D.urlId=T,this.startLoad())}},h.loadPlaylist=function(c){var b=this.currentLevelIndex,D=this._levels[b];if(this.canLoad&&D&&D.url.length>0){var T=D.urlId,g=D.url[T];if(c)try{g=c.addDirectives(g)}catch(v){this.warn("Could not construct new URL with HLS Delivery Directives: "+v)}this.log("Attempt loading level index "+b+(c?" at sn "+c.msn+" part "+c.part:"")+" with URL-id "+T+" "+g),this.clearTimer(),this.hls.trigger(U.Events.LEVEL_LOADING,{url:g,level:b,id:T,deliveryDirectives:c||null})}},h.removeLevel=function(c,b){var D=function(v,d){return d!==b},T=this._levels.filter(function(g,v){return v!==c?!0:g.url.length>1&&b!==void 0?(g.url=g.url.filter(D),g.audioGroupIds&&(g.audioGroupIds=g.audioGroupIds.filter(D)),g.textGroupIds&&(g.textGroupIds=g.textGroupIds.filter(D)),g.urlId=0,!0):!1}).map(function(g,v){var d=g.details;return d!=null&&d.fragments&&d.fragments.forEach(function(o){o.level=v}),g});this._levels=T,this.hls.trigger(U.Events.LEVELS_UPDATED,{levels:T})},P(s,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(c){var b,D=this._levels;if(D.length===0)return;if(this.currentLevelIndex===c&&(b=D[c])!==null&&b!==void 0&&b.details)return;if(c<0||c>=D.length){var T=c<0;if(this.hls.trigger(U.Events.ERROR,{type:O.ErrorTypes.OTHER_ERROR,details:O.ErrorDetails.LEVEL_SWITCH_ERROR,level:c,fatal:T,reason:"invalid level idx"}),T)return;c=Math.min(c,D.length-1)}this.clearTimer();var g=this.currentLevelIndex,v=D[g],d=D[c];this.log("switching to level "+c+" from "+g),this.currentLevelIndex=c;var o=f({},d,{level:c,maxBitrate:d.maxBitrate,uri:d.uri,urlId:d.urlId});delete o._urlId,this.hls.trigger(U.Events.LEVEL_SWITCHING,o);var C=d.details;if(!C||C.live){var S=this.switchParams(d.uri,v==null?void 0:v.details);this.loadPlaylist(S)}}},{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)}}]),s}(_.default)},"./src/controller/level-helper.ts":function(ne,$,R){"use strict";R.r($),R.d($,"addGroupId",function(){return O}),R.d($,"assignTrackIdsByGroup",function(){return j}),R.d($,"updatePTS",function(){return N}),R.d($,"updateFragPTSDTS",function(){return A}),R.d($,"mergeDetails",function(){return f}),R.d($,"mapPartIntersection",function(){return x}),R.d($,"mapFragmentIntersection",function(){return P}),R.d($,"adjustSliding",function(){return w}),R.d($,"addSliding",function(){return E}),R.d($,"computeReloadInterval",function(){return p}),R.d($,"getFragmentWithSN",function(){return u}),R.d($,"getPartWith",function(){return a});var Q=R("./src/polyfills/number.ts"),U=R("./src/utils/logger.ts");function O(s,h,k){switch(h){case"audio":s.audioGroupIds||(s.audioGroupIds=[]),s.audioGroupIds.push(k);break;case"text":s.textGroupIds||(s.textGroupIds=[]),s.textGroupIds.push(k);break}}function j(s){var h={};s.forEach(function(k){var c=k.groupId||"";k.id=h[c]=h[c]||0,h[c]++})}function N(s,h,k){var c=s[h],b=s[k];_(c,b)}function _(s,h){var k=h.startPTS;if(Object(Q.isFiniteNumber)(k)){var c=0,b;h.sn>s.sn?(c=k-s.start,b=s):(c=s.start-k,b=h),b.duration!==c&&(b.duration=c)}else if(h.sn>s.sn){var D=s.cc===h.cc;D&&s.minEndPTS?h.start=s.start+(s.minEndPTS-s.start):h.start=s.start+s.duration}else h.start=Math.max(s.start-h.duration,0)}function A(s,h,k,c,b,D){var T=c-k;T<=0&&(U.logger.warn("Fragment should have a positive duration",h),c=k+h.duration,D=b+h.duration);var g=k,v=c,d=h.startPTS,o=h.endPTS;if(Object(Q.isFiniteNumber)(d)){var C=Math.abs(d-k);Object(Q.isFiniteNumber)(h.deltaPTS)?h.deltaPTS=Math.max(C,h.deltaPTS):h.deltaPTS=C,g=Math.max(k,d),k=Math.min(k,d),b=Math.min(b,h.startDTS),v=Math.min(c,o),c=Math.max(c,o),D=Math.max(D,h.endDTS)}h.duration=c-k;var S=k-h.start;h.appendedPTS=c,h.start=h.startPTS=k,h.maxStartPTS=g,h.startDTS=b,h.endPTS=c,h.minEndPTS=v,h.endDTS=D;var y=h.sn;if(!s||y<s.startSN||y>s.endSN)return 0;var M,F=y-s.startSN,W=s.fragments;for(W[F]=h,M=F;M>0;M--)_(W[M],W[M-1]);for(M=F;M<W.length-1;M++)_(W[M],W[M+1]);return s.fragmentHint&&_(W[W.length-1],s.fragmentHint),s.PTSKnown=s.alignedSliding=!0,S}function f(s,h){for(var k=null,c=s.fragments,b=c.length-1;b>=0;b--){var D=c[b].initSegment;if(D){k=D;break}}s.fragmentHint&&delete s.fragmentHint.endPTS;var T=0,g;if(P(s,h,function(M,F){M.relurl&&(T=M.cc-F.cc),Object(Q.isFiniteNumber)(M.startPTS)&&Object(Q.isFiniteNumber)(M.endPTS)&&(F.start=F.startPTS=M.startPTS,F.startDTS=M.startDTS,F.appendedPTS=M.appendedPTS,F.maxStartPTS=M.maxStartPTS,F.endPTS=M.endPTS,F.endDTS=M.endDTS,F.minEndPTS=M.minEndPTS,F.duration=M.endPTS-M.startPTS,F.duration&&(g=F),h.PTSKnown=h.alignedSliding=!0),F.elementaryStreams=M.elementaryStreams,F.loader=M.loader,F.stats=M.stats,F.urlId=M.urlId,M.initSegment&&(F.initSegment=M.initSegment,k=M.initSegment)}),k){var v=h.fragmentHint?h.fragments.concat(h.fragmentHint):h.fragments;v.forEach(function(M){var F;(!M.initSegment||M.initSegment.relurl===((F=k)===null||F===void 0?void 0:F.relurl))&&(M.initSegment=k)})}if(h.skippedSegments&&(h.deltaUpdateFailed=h.fragments.some(function(M){return!M}),h.deltaUpdateFailed)){U.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var d=h.skippedSegments;d--;)h.fragments.shift();h.startSN=h.fragments[0].sn,h.startCC=h.fragments[0].cc}var o=h.fragments;if(T){U.logger.warn("discontinuity sliding from playlist, take drift into account");for(var C=0;C<o.length;C++)o[C].cc+=T}h.skippedSegments&&(h.startCC=h.fragments[0].cc),x(s.partList,h.partList,function(M,F){F.elementaryStreams=M.elementaryStreams,F.stats=M.stats}),g?A(h,g,g.startPTS,g.endPTS,g.startDTS,g.endDTS):w(s,h),o.length&&(h.totalduration=h.edge-o[0].start),h.driftStartTime=s.driftStartTime,h.driftStart=s.driftStart;var S=h.advancedDateTime;if(h.advanced&&S){var y=h.edge;h.driftStart||(h.driftStartTime=S,h.driftStart=y),h.driftEndTime=S,h.driftEnd=y}else h.driftEndTime=s.driftEndTime,h.driftEnd=s.driftEnd,h.advancedDateTime=s.advancedDateTime}function x(s,h,k){if(s&&h)for(var c=0,b=0,D=s.length;b<=D;b++){var T=s[b],g=h[b+c];T&&g&&T.index===g.index&&T.fragment.sn===g.fragment.sn?k(T,g):c--}}function P(s,h,k){for(var c=h.skippedSegments,b=Math.max(s.startSN,h.startSN)-h.startSN,D=(s.fragmentHint?1:0)+(c?h.endSN:Math.min(s.endSN,h.endSN))-h.startSN,T=h.startSN-s.startSN,g=h.fragmentHint?h.fragments.concat(h.fragmentHint):h.fragments,v=s.fragmentHint?s.fragments.concat(s.fragmentHint):s.fragments,d=b;d<=D;d++){var o=v[T+d],C=g[d];c&&!C&&d<c&&(C=h.fragments[d]=o),o&&C&&k(o,C)}}function w(s,h){var k=h.startSN+h.skippedSegments-s.startSN,c=s.fragments;if(k<0||k>=c.length)return;E(h,c[k].start)}function E(s,h){if(h){for(var k=s.fragments,c=s.skippedSegments;c<k.length;c++)k[c].start+=h;s.fragmentHint&&(s.fragmentHint.start+=h)}}function p(s,h){var k=1e3*s.levelTargetDuration,c=k/2,b=s.age,D=b>0&&b<k*3,T=h.loading.end-h.loading.start,g,v=s.availabilityDelay;if(s.updated===!1)if(D){var d=333*s.misses;g=Math.max(Math.min(c,T*2),d),s.availabilityDelay=(s.availabilityDelay||0)+g}else g=c;else D?(v=Math.min(v||k/2,b),s.availabilityDelay=v,g=v+k-b):g=k-T;return Math.round(g)}function u(s,h,k){if(!s||!s.details)return null;var c=s.details,b=c.fragments[h-c.startSN];return b||(b=c.fragmentHint,b&&b.sn===h?b:h<c.startSN&&k&&k.sn===h?k:null)}function a(s,h,k){if(!s||!s.details)return null;var c=s.details.partList;if(c)for(var b=c.length;b--;){var D=c[b];if(D.index===k&&D.fragment.sn===h)return D}return null}},"./src/controller/stream-controller.ts":function(ne,$,R){"use strict";R.r($),R.d($,"default",function(){return c});var Q=R("./src/polyfills/number.ts"),U=R("./src/controller/base-stream-controller.ts"),O=R("./src/is-supported.ts"),j=R("./src/events.ts"),N=R("./src/utils/buffer-helper.ts"),_=R("./src/controller/fragment-tracker.ts"),A=R("./src/types/loader.ts"),f=R("./src/loader/fragment.ts"),x=R("./src/demux/transmuxer-interface.ts"),P=R("./src/types/transmuxer.ts"),w=R("./src/controller/gap-controller.ts"),E=R("./src/errors.ts"),p=R("./src/utils/logger.ts");function u(b,D){for(var T=0;T<D.length;T++){var g=D[T];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(b,g.key,g)}}function a(b,D,T){return D&&u(b.prototype,D),T&&u(b,T),b}function s(b,D){b.prototype=Object.create(D.prototype),b.prototype.constructor=b,h(b,D)}function h(b,D){return h=Object.setPrototypeOf||function(g,v){return g.__proto__=v,g},h(b,D)}var k=100,c=function(b){s(D,b);function D(g,v){var d;return d=b.call(this,g,v,"[stream-controller]")||this,d.audioCodecSwap=!1,d.gapController=null,d.level=-1,d._forceStartLoad=!1,d.altAudio=!1,d.audioOnly=!1,d.fragPlaying=null,d.onvplaying=null,d.onvseeked=null,d.fragLastKbps=0,d.stalled=!1,d.couldBacktrack=!1,d.audioCodecSwitch=!1,d.videoBuffer=null,d._registerListeners(),d}var T=D.prototype;return T._registerListeners=function(){var v=this.hls;v.on(j.Events.MEDIA_ATTACHED,this.onMediaAttached,this),v.on(j.Events.MEDIA_DETACHING,this.onMediaDetaching,this),v.on(j.Events.MANIFEST_LOADING,this.onManifestLoading,this),v.on(j.Events.MANIFEST_PARSED,this.onManifestParsed,this),v.on(j.Events.LEVEL_LOADING,this.onLevelLoading,this),v.on(j.Events.LEVEL_LOADED,this.onLevelLoaded,this),v.on(j.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),v.on(j.Events.ERROR,this.onError,this),v.on(j.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),v.on(j.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),v.on(j.Events.BUFFER_CREATED,this.onBufferCreated,this),v.on(j.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),v.on(j.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),v.on(j.Events.FRAG_BUFFERED,this.onFragBuffered,this)},T._unregisterListeners=function(){var v=this.hls;v.off(j.Events.MEDIA_ATTACHED,this.onMediaAttached,this),v.off(j.Events.MEDIA_DETACHING,this.onMediaDetaching,this),v.off(j.Events.MANIFEST_LOADING,this.onManifestLoading,this),v.off(j.Events.MANIFEST_PARSED,this.onManifestParsed,this),v.off(j.Events.LEVEL_LOADED,this.onLevelLoaded,this),v.off(j.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),v.off(j.Events.ERROR,this.onError,this),v.off(j.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),v.off(j.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),v.off(j.Events.BUFFER_CREATED,this.onBufferCreated,this),v.off(j.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),v.off(j.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),v.off(j.Events.FRAG_BUFFERED,this.onFragBuffered,this)},T.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},T.startLoad=function(v){if(this.levels){var d=this.lastCurrentTime,o=this.hls;if(this.stopLoad(),this.setInterval(k),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var C=o.startLevel;C===-1&&(o.config.testBandwidth?(C=0,this.bitrateTest=!0):C=o.nextAutoLevel),this.level=o.nextLoadLevel=C,this.loadedmetadata=!1}d>0&&v===-1&&(this.log("Override startPosition with lastCurrentTime @"+d.toFixed(3)),v=d),this.state=U.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=v,this.tick()}else this._forceStartLoad=!0,this.state=U.State.STOPPED},T.stopLoad=function(){this._forceStartLoad=!1,b.prototype.stopLoad.call(this)},T.doTick=function(){switch(this.state){case U.State.IDLE:this.doTickIdle();break;case U.State.WAITING_LEVEL:{var v,d=this.levels,o=this.level,C=d==null||((v=d[o])===null||v===void 0)?void 0:v.details;if(C&&(!C.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(C))break;this.state=U.State.IDLE;break}break}case U.State.FRAG_LOADING_WAITING_RETRY:{var S,y=self.performance.now(),M=this.retryDate;(!M||y>=M||(S=this.media)!==null&&S!==void 0&&S.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=U.State.IDLE)}break;default:break}this.onTickEnd()},T.onTickEnd=function(){b.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},T.doTickIdle=function(){var v,d,o=this.hls,C=this.levelLastLoaded,S=this.levels,y=this.media,M=o.config,F=o.nextLoadLevel;if(C===null||!y&&(this.startFragRequested||!M.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!S||!S[F])return;var W=S[F];this.level=o.nextLoadLevel=F;var V=W.details;if(!V||this.state===U.State.WAITING_LEVEL||V.live&&this.levelLastLoaded!==F){this.state=U.State.WAITING_LEVEL;return}var I=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:y,A.PlaylistLevelType.MAIN);if(I===null)return;var B=I.len,X=this.getMaxBufferLength(W.maxBitrate);if(B>=X)return;if(this._streamEnded(I,V)){var ee={};this.altAudio&&(ee.type="video"),this.hls.trigger(j.Events.BUFFER_EOS,ee),this.state=U.State.ENDED;return}var oe=I.end,fe=this.getNextFragment(oe,V);if(this.couldBacktrack&&!this.fragPrevious&&fe&&fe.sn!=="initSegment"){var ke=fe.sn-V.startSN;ke>1&&(fe=V.fragments[ke-1],this.fragmentTracker.removeFragment(fe))}if(fe&&this.fragmentTracker.getState(fe)===_.FragmentState.OK&&this.nextLoadPosition>oe){var xe=this.audioOnly&&!this.altAudio?f.ElementaryStreamTypes.AUDIO:f.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(y,xe,A.PlaylistLevelType.MAIN),fe=this.getNextFragment(this.nextLoadPosition,V)}if(!fe)return;fe.initSegment&&!fe.initSegment.data&&!this.bitrateTest&&(fe=fe.initSegment),((v=fe.decryptdata)===null||v===void 0?void 0:v.keyFormat)==="identity"&&!((d=fe.decryptdata)!==null&&d!==void 0&&d.key)?this.loadKey(fe,V):this.loadFragment(fe,V,oe)},T.loadFragment=function(v,d,o){var C,S=this.fragmentTracker.getState(v);if(this.fragCurrent=v,S===_.FragmentState.BACKTRACKED){var y=this.fragmentTracker.getBacktrackData(v);if(y){this._handleFragmentLoadProgress(y),this._handleFragmentLoadComplete(y);return}else S=_.FragmentState.NOT_LOADED}S===_.FragmentState.NOT_LOADED||S===_.FragmentState.PARTIAL?v.sn==="initSegment"?this._loadInitSegment(v):this.bitrateTest?(v.bitrateTest=!0,this.log("Fragment "+v.sn+" of level "+v.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(v)):(this.startFragRequested=!0,b.prototype.loadFragment.call(this,v,d,o)):S===_.FragmentState.APPENDING?this.reduceMaxBufferLength(v.duration)&&this.fragmentTracker.removeFragment(v):((C=this.media)===null||C===void 0?void 0:C.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},T.getAppendedFrag=function(v){var d=this.fragmentTracker.getAppendedFrag(v,A.PlaylistLevelType.MAIN);return d&&"fragment"in d?d.fragment:d},T.getBufferedFrag=function(v){return this.fragmentTracker.getBufferedFrag(v,A.PlaylistLevelType.MAIN)},T.followingBufferedFrag=function(v){return v?this.getBufferedFrag(v.end+.5):null},T.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},T.nextLevelSwitch=function(){var v=this.levels,d=this.media;if(d!=null&&d.readyState){var o,C=this.getAppendedFrag(d.currentTime);if(C&&C.start>1&&this.flushMainBuffer(0,C.start-1),!d.paused&&v){var S=this.hls.nextLoadLevel,y=v[S],M=this.fragLastKbps;M&&this.fragCurrent?o=this.fragCurrent.duration*y.maxBitrate/(1e3*M)+1:o=0}else o=0;var F=this.getBufferedFrag(d.currentTime+o);if(F){var W=this.followingBufferedFrag(F);if(W){this.abortCurrentFrag();var V=W.maxStartPTS?W.maxStartPTS:W.start,I=W.duration,B=Math.max(F.end,V+Math.min(Math.max(I-this.config.maxFragLookUpTolerance,I*.5),I*.75));this.flushMainBuffer(B,Number.POSITIVE_INFINITY)}}}},T.abortCurrentFrag=function(){var v=this.fragCurrent;this.fragCurrent=null,v!=null&&v.loader&&v.loader.abort(),this.state===U.State.KEY_LOADING&&(this.state=U.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},T.flushMainBuffer=function(v,d){b.prototype.flushMainBuffer.call(this,v,d,this.altAudio?"video":null)},T.onMediaAttached=function(v,d){b.prototype.onMediaAttached.call(this,v,d);var o=d.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),o.addEventListener("playing",this.onvplaying),o.addEventListener("seeked",this.onvseeked),this.gapController=new w.default(this.config,o,this.fragmentTracker,this.hls)},T.onMediaDetaching=function(){var v=this.media;v&&(v.removeEventListener("playing",this.onvplaying),v.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),b.prototype.onMediaDetaching.call(this)},T.onMediaPlaying=function(){this.tick()},T.onMediaSeeked=function(){var v=this.media,d=v?v.currentTime:null;Object(Q.isFiniteNumber)(d)&&this.log("Media seeked to "+d.toFixed(3)),this.tick()},T.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(j.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},T.onManifestParsed=function(v,d){var o=!1,C=!1,S;d.levels.forEach(function(y){S=y.audioCodec,S&&(S.indexOf("mp4a.40.2")!==-1&&(o=!0),S.indexOf("mp4a.40.5")!==-1&&(C=!0))}),this.audioCodecSwitch=o&&C&&!Object(O.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=d.levels,this.startFragRequested=!1},T.onLevelLoading=function(v,d){var o=this.levels;if(!o||this.state!==U.State.IDLE)return;var C=o[d.level];(!C.details||C.details.live&&this.levelLastLoaded!==d.level||this.waitForCdnTuneIn(C.details))&&(this.state=U.State.WAITING_LEVEL)},T.onLevelLoaded=function(v,d){var o,C=this.levels,S=d.level,y=d.details,M=y.totalduration;if(!C){this.warn("Levels were reset while loading level "+S);return}this.log("Level "+S+" loaded ["+y.startSN+","+y.endSN+"], cc ["+y.startCC+", "+y.endCC+"] duration:"+M);var F=this.fragCurrent;F&&(this.state===U.State.FRAG_LOADING||this.state===U.State.FRAG_LOADING_WAITING_RETRY)&&(F.level!==d.level&&F.loader&&(this.state=U.State.IDLE,F.loader.abort()));var W=C[S],V=0;if(y.live||(o=W.details)!==null&&o!==void 0&&o.live){if(y.fragments[0]||(y.deltaUpdateFailed=!0),y.deltaUpdateFailed)return;V=this.alignPlaylists(y,W.details)}if(W.details=y,this.levelLastLoaded=S,this.hls.trigger(j.Events.LEVEL_UPDATED,{details:y,level:S}),this.state===U.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(y))return;this.state=U.State.IDLE}this.startFragRequested?y.live&&this.synchronizeToLiveEdge(y):this.setStartPosition(y,V),this.tick()},T._handleFragmentLoadProgress=function(v){var d,o=v.frag,C=v.part,S=v.payload,y=this.levels;if(!y){this.warn("Levels were reset while fragment load was in progress. Fragment "+o.sn+" of level "+o.level+" will not be buffered");return}var M=y[o.level],F=M.details;if(!F){this.warn("Dropping fragment "+o.sn+" of level "+o.level+" after level details were reset");return}var W=M.videoCodec,V=F.PTSKnown||!F.live,I=(d=o.initSegment)===null||d===void 0?void 0:d.data,B=this._getAudioCodec(M),X=this.transmuxer=this.transmuxer||new x.default(this.hls,A.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),ee=C?C.index:-1,oe=ee!==-1,fe=new P.ChunkMetadata(o.level,o.sn,o.stats.chunkCount,S.byteLength,ee,oe),ke=this.initPTS[o.cc];X.push(S,I,B,W,o,C,F.totalduration,V,fe,ke)},T.onAudioTrackSwitching=function(v,d){var o=this.altAudio,C=!!d.url,S=d.id;if(!C){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var y=this.fragCurrent;y!=null&&y.loader&&(this.log("Switching to main audio track, cancel main fragment load"),y.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var M=this.hls;o&&M.trigger(j.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),M.trigger(j.Events.AUDIO_TRACK_SWITCHED,{id:S})}},T.onAudioTrackSwitched=function(v,d){var o=d.id,C=!!this.hls.audioTracks[o].url;if(C){var S=this.videoBuffer;S&&this.mediaBuffer!==S&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=S)}this.altAudio=C,this.tick()},T.onBufferCreated=function(v,d){var o=d.tracks,C,S,y=!1;for(var M in o){var F=o[M];if(F.id==="main"){if(S=M,C=F,M==="video"){var W=o[M];W&&(this.videoBuffer=W.buffer)}}else y=!0}y&&C?(this.log("Alternate track found, use "+S+".buffered to schedule main fragment loading"),this.mediaBuffer=C.buffer):this.mediaBuffer=this.media},T.onFragBuffered=function(v,d){var o=d.frag,C=d.part;if(o&&o.type!==A.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(o)){this.warn("Fragment "+o.sn+(C?" p: "+C.index:"")+" of level "+o.level+" finished buffering, but was aborted. state: "+this.state),this.state===U.State.PARSED&&(this.state=U.State.IDLE);return}var S=C?C.stats:o.stats;this.fragLastKbps=Math.round(8*S.total/(S.buffering.end-S.loading.first)),o.sn!=="initSegment"&&(this.fragPrevious=o),this.fragBufferedComplete(o,C)},T.onError=function(v,d){switch(d.details){case E.ErrorDetails.FRAG_LOAD_ERROR:case E.ErrorDetails.FRAG_LOAD_TIMEOUT:case E.ErrorDetails.KEY_LOAD_ERROR:case E.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(A.PlaylistLevelType.MAIN,d);break;case E.ErrorDetails.LEVEL_LOAD_ERROR:case E.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==U.State.ERROR&&(d.fatal?(this.warn(""+d.details),this.state=U.State.ERROR):!d.levelRetry&&this.state===U.State.WAITING_LEVEL&&(this.state=U.State.IDLE));break;case E.ErrorDetails.BUFFER_FULL_ERROR:if(d.parent==="main"&&(this.state===U.State.PARSING||this.state===U.State.PARSED)){var o=!0,C=this.getFwdBufferInfo(this.media,A.PlaylistLevelType.MAIN);C&&C.len>.5&&(o=!this.reduceMaxBufferLength(C.len)),o&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},T.checkBuffer=function(){var v=this.media,d=this.gapController;if(!v||!d||!v.readyState)return;var o=N.BufferHelper.getBuffered(v);!this.loadedmetadata&&o.length?(this.loadedmetadata=!0,this.seekToStartPos()):d.poll(this.lastCurrentTime),this.lastCurrentTime=v.currentTime},T.onFragLoadEmergencyAborted=function(){this.state=U.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},T.onBufferFlushed=function(v,d){var o=d.type;if(o!==f.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var C=(o===f.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(C,o,A.PlaylistLevelType.MAIN)}},T.onLevelsUpdated=function(v,d){this.levels=d.levels},T.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},T.seekToStartPos=function(){var v=this.media,d=v.currentTime,o=this.startPosition;if(o>=0&&d<o){if(v.seeking){p.logger.log("could not seek to "+o+", already seeking at "+d);return}var C=N.BufferHelper.getBuffered(v),S=C.length?C.start(0):0,y=S-o;y>0&&(y<this.config.maxBufferHole||y<this.config.maxFragLookUpTolerance)&&(p.logger.log("adjusting start position by "+y+" to match buffer start"),o+=y,this.startPosition=o),this.log("seek to target start position "+o+" from current time "+d),v.currentTime=o}},T._getAudioCodec=function(v){var d=this.config.defaultAudioCodec||v.audioCodec;return this.audioCodecSwap&&d&&(this.log("Swapping audio codec"),d.indexOf("mp4a.40.5")!==-1?d="mp4a.40.2":d="mp4a.40.5"),d},T._loadBitrateTestFrag=function(v){var d=this;this._doFragLoad(v).then(function(o){var C=d.hls;if(!o||C.nextLoadLevel||d.fragContextChanged(v))return;d.fragLoadError=0,d.state=U.State.IDLE,d.startFragRequested=!1,d.bitrateTest=!1;var S=v.stats;S.parsing.start=S.parsing.end=S.buffering.start=S.buffering.end=self.performance.now(),C.trigger(j.Events.FRAG_LOADED,o)})},T._handleTransmuxComplete=function(v){var d,o="main",C=this.hls,S=v.remuxResult,y=v.chunkMeta,M=this.getCurrentContext(y);if(!M){this.warn("The loading context changed while buffering fragment "+y.sn+" of level "+y.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(y.level);return}var F=M.frag,W=M.part,V=M.level,I=S.video,B=S.text,X=S.id3,ee=S.initSegment,oe=this.altAudio?void 0:S.audio;if(this.fragContextChanged(F))return;if(this.state=U.State.PARSING,ee){ee.tracks&&(this._bufferInitSegment(V,ee.tracks,F,y),C.trigger(j.Events.FRAG_PARSING_INIT_SEGMENT,{frag:F,id:o,tracks:ee.tracks}));var fe=ee.initPTS,ke=ee.timescale;Object(Q.isFiniteNumber)(fe)&&(this.initPTS[F.cc]=fe,C.trigger(j.Events.INIT_PTS_FOUND,{frag:F,id:o,initPTS:fe,timescale:ke}))}if(I&&S.independent!==!1){if(V.details){var xe=I.startPTS,Te=I.endPTS,Ce=I.startDTS,ge=I.endDTS;if(W)W.elementaryStreams[I.type]={startPTS:xe,endPTS:Te,startDTS:Ce,endDTS:ge};else if(I.firstKeyFrame&&I.independent&&(this.couldBacktrack=!0),I.dropped&&I.independent){var pe=this.getLoadPosition()+this.config.maxBufferHole;if(pe<xe){this.backtrack(F);return}F.setElementaryStreamInfo(I.type,F.start,Te,F.start,ge,!0)}F.setElementaryStreamInfo(I.type,xe,Te,Ce,ge),this.bufferFragmentData(I,F,W,y)}}else if(S.independent===!1){this.backtrack(F);return}if(oe){var ue=oe.startPTS,te=oe.endPTS,de=oe.startDTS,ae=oe.endDTS;W&&(W.elementaryStreams[f.ElementaryStreamTypes.AUDIO]={startPTS:ue,endPTS:te,startDTS:de,endDTS:ae}),F.setElementaryStreamInfo(f.ElementaryStreamTypes.AUDIO,ue,te,de,ae),this.bufferFragmentData(oe,F,W,y)}if(X!=null&&(d=X.samples)!==null&&d!==void 0&&d.length){var we={frag:F,id:o,samples:X.samples};C.trigger(j.Events.FRAG_PARSING_METADATA,we)}if(B){var Re={frag:F,id:o,samples:B.samples};C.trigger(j.Events.FRAG_PARSING_USERDATA,Re)}},T._bufferInitSegment=function(v,d,o,C){var S=this;if(this.state!==U.State.PARSING)return;this.audioOnly=!!d.audio&&!d.video,this.altAudio&&!this.audioOnly&&delete d.audio;var y=d.audio,M=d.video,F=d.audiovideo;if(y){var W=v.audioCodec,V=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(W&&(W.indexOf("mp4a.40.5")!==-1?W="mp4a.40.2":W="mp4a.40.5"),y.metadata.channelCount!==1&&V.indexOf("firefox")===-1&&(W="mp4a.40.5")),V.indexOf("android")!==-1&&y.container!=="audio/mpeg"&&(W="mp4a.40.2",this.log("Android: force audio codec to "+W)),v.audioCodec&&v.audioCodec!==W&&this.log('Swapping manifest audio codec "'+v.audioCodec+'" for "'+W+'"'),y.levelCodec=W,y.id="main",this.log("Init audio buffer, container:"+y.container+", codecs[selected/level/parsed]=["+(W||"")+"/"+(v.audioCodec||"")+"/"+y.codec+"]")}M&&(M.levelCodec=v.videoCodec,M.id="main",this.log("Init video buffer, container:"+M.container+", codecs[level/parsed]=["+(v.videoCodec||"")+"/"+M.codec+"]")),F&&this.log("Init audiovideo buffer, container:"+F.container+", codecs[level/parsed]=["+(v.attrs.CODECS||"")+"/"+F.codec+"]"),this.hls.trigger(j.Events.BUFFER_CODECS,d),Object.keys(d).forEach(function(I){var B=d[I],X=B.initSegment;X!=null&&X.byteLength&&S.hls.trigger(j.Events.BUFFER_APPENDING,{type:I,data:X,frag:o,part:null,chunkMeta:C,parent:o.type})}),this.tick()},T.backtrack=function(v){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(v);var d=this.fragmentTracker.backtrack(v);this.fragPrevious=null,this.nextLoadPosition=v.start,d?this.resetFragmentLoading(v):this.state=U.State.BACKTRACKING},T.checkFragmentChanged=function(){var v=this.media,d=null;if(v&&v.readyState>1&&v.seeking===!1){var o=v.currentTime;if(N.BufferHelper.isBuffered(v,o)?d=this.getAppendedFrag(o):N.BufferHelper.isBuffered(v,o+.1)&&(d=this.getAppendedFrag(o+.1)),d){var C=this.fragPlaying,S=d.level;(!C||d.sn!==C.sn||C.level!==S||d.urlId!==C.urlId)&&(this.hls.trigger(j.Events.FRAG_CHANGED,{frag:d}),(!C||C.level!==S)&&this.hls.trigger(j.Events.LEVEL_SWITCHED,{level:S}),this.fragPlaying=d)}}},a(D,[{key:"nextLevel",get:function(){var v=this.nextBufferedFrag;return v?v.level:-1}},{key:"currentLevel",get:function(){var v=this.media;if(v){var d=this.getAppendedFrag(v.currentTime);if(d)return d.level}return-1}},{key:"nextBufferedFrag",get:function(){var v=this.media;if(v){var d=this.getAppendedFrag(v.currentTime);return this.followingBufferedFrag(d)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),D}(U.default)},"./src/controller/subtitle-stream-controller.ts":function(ne,$,R){"use strict";R.r($),R.d($,"SubtitleStreamController",function(){return s});var Q=R("./src/events.ts"),U=R("./src/utils/logger.ts"),O=R("./src/utils/buffer-helper.ts"),j=R("./src/controller/fragment-finders.ts"),N=R("./src/utils/discontinuities.ts"),_=R("./src/controller/level-helper.ts"),A=R("./src/controller/fragment-tracker.ts"),f=R("./src/controller/base-stream-controller.ts"),x=R("./src/types/loader.ts"),P=R("./src/types/level.ts");function w(h,k){for(var c=0;c<k.length;c++){var b=k[c];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(h,b.key,b)}}function E(h,k,c){return k&&w(h.prototype,k),c&&w(h,c),h}function p(h,k){h.prototype=Object.create(k.prototype),h.prototype.constructor=h,u(h,k)}function u(h,k){return u=Object.setPrototypeOf||function(b,D){return b.__proto__=D,b},u(h,k)}var a=500,s=function(h){p(k,h);function k(b,D){var T;return T=h.call(this,b,D,"[subtitle-stream-controller]")||this,T.levels=[],T.currentTrackId=-1,T.tracksBuffered=[],T.mainDetails=null,T._registerListeners(),T}var c=k.prototype;return c.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},c._registerListeners=function(){var D=this.hls;D.on(Q.Events.MEDIA_ATTACHED,this.onMediaAttached,this),D.on(Q.Events.MEDIA_DETACHING,this.onMediaDetaching,this),D.on(Q.Events.MANIFEST_LOADING,this.onManifestLoading,this),D.on(Q.Events.LEVEL_LOADED,this.onLevelLoaded,this),D.on(Q.Events.ERROR,this.onError,this),D.on(Q.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),D.on(Q.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),D.on(Q.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),D.on(Q.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),D.on(Q.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},c._unregisterListeners=function(){var D=this.hls;D.off(Q.Events.MEDIA_ATTACHED,this.onMediaAttached,this),D.off(Q.Events.MEDIA_DETACHING,this.onMediaDetaching,this),D.off(Q.Events.MANIFEST_LOADING,this.onManifestLoading,this),D.off(Q.Events.LEVEL_LOADED,this.onLevelLoaded,this),D.off(Q.Events.ERROR,this.onError,this),D.off(Q.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),D.off(Q.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),D.off(Q.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),D.off(Q.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),D.off(Q.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},c.startLoad=function(){this.stopLoad(),this.state=f.State.IDLE,this.setInterval(a),this.tick()},c.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},c.onLevelLoaded=function(D,T){this.mainDetails=T.details},c.onSubtitleFragProcessed=function(D,T){var g=T.frag,v=T.success;if(this.fragPrevious=g,this.state=f.State.IDLE,!v)return;var d=this.tracksBuffered[this.currentTrackId];if(!d)return;for(var o,C=g.start,S=0;S<d.length;S++)if(C>=d[S].start&&C<=d[S].end){o=d[S];break}var y=g.start+g.duration;o?o.end=y:(o={start:C,end:y},d.push(o)),this.fragmentTracker.fragBuffered(g)},c.onBufferFlushing=function(D,T){var g=T.startOffset,v=T.endOffset;if(g===0&&v!==Number.POSITIVE_INFINITY){var d=this.currentTrackId,o=this.levels;if(!o.length||!o[d]||!o[d].details)return;var C=o[d].details,S=C.targetduration,y=v-S;if(y<=0)return;T.endOffsetSubtitles=Math.max(0,y),this.tracksBuffered.forEach(function(M){for(var F=0;F<M.length;){if(M[F].end<=y){M.shift();continue}else if(M[F].start<y)M[F].start=y;else break;F++}}),this.fragmentTracker.removeFragmentsInRange(g,y,x.PlaylistLevelType.SUBTITLE)}},c.onError=function(D,T){var g,v=T.frag;if(!v||v.type!==x.PlaylistLevelType.SUBTITLE)return;(g=this.fragCurrent)!==null&&g!==void 0&&g.loader&&this.fragCurrent.loader.abort(),this.state=f.State.IDLE},c.onSubtitleTracksUpdated=function(D,T){var g=this,v=T.subtitleTracks;this.tracksBuffered=[],this.levels=v.map(function(d){return new P.Level(d)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(d){g.tracksBuffered[d.id]=[]}),this.mediaBuffer=null},c.onSubtitleTrackSwitch=function(D,T){if(this.currentTrackId=T.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var g=this.levels[this.currentTrackId];g!=null&&g.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,g&&this.setInterval(a)},c.onSubtitleTrackLoaded=function(D,T){var g,v=T.details,d=T.id,o=this.currentTrackId,C=this.levels;if(!C.length)return;var S=C[o];if(d>=C.length||d!==o||!S)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,v.live||(g=S.details)!==null&&g!==void 0&&g.live){var y=this.mainDetails;if(v.deltaUpdateFailed||!y)return;var M=y.fragments[0];if(!S.details)v.hasProgramDateTime&&y.hasProgramDateTime?Object(N.alignMediaPlaylistByPDT)(v,y):M&&Object(_.addSliding)(v,M.start);else{var F=this.alignPlaylists(v,S.details);F===0&&M&&Object(_.addSliding)(v,M.start)}}if(S.details=v,this.levelLastLoaded=d,this.tick(),v.live&&!this.fragCurrent&&this.media&&this.state===f.State.IDLE){var W=Object(j.findFragmentByPTS)(null,v.fragments,this.media.currentTime,0);W||(this.warn("Subtitle playlist not aligned with playback"),S.details=void 0)}},c._handleFragmentLoadComplete=function(D){var T=D.frag,g=D.payload,v=T.decryptdata,d=this.hls;if(this.fragContextChanged(T))return;if(g&&g.byteLength>0&&v&&v.key&&v.iv&&v.method==="AES-128"){var o=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(g),v.key.buffer,v.iv.buffer).then(function(C){var S=performance.now();d.trigger(Q.Events.FRAG_DECRYPTED,{frag:T,payload:C,stats:{tstart:o,tdecrypt:S}})})}},c.doTick=function(){if(!this.media){this.state=f.State.IDLE;return}if(this.state===f.State.IDLE){var D,T=this.currentTrackId,g=this.levels;if(!g.length||!g[T]||!g[T].details)return;var v=g[T].details,d=v.targetduration,o=this.config,C=this.media,S=O.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,C.currentTime-d,o.maxBufferHole),y=S.end,M=S.len,F=this.getMaxBufferLength()+d;if(M>F)return;console.assert(v,"Subtitle track details are defined on idle subtitle stream controller tick");var W=v.fragments,V=W.length,I=v.edge,B,X=this.fragPrevious;if(y<I){var ee=o.maxFragLookUpTolerance;X&&v.hasProgramDateTime&&(B=Object(j.findFragmentByPDT)(W,X.endProgramDateTime,ee)),B||(B=Object(j.findFragmentByPTS)(X,W,y,ee),!B&&X&&X.start<W[0].start&&(B=W[0]))}else B=W[V-1];(D=B)!==null&&D!==void 0&&D.encrypted?(U.logger.log("Loading key for "+B.sn),this.state=f.State.KEY_LOADING,this.hls.trigger(Q.Events.KEY_LOADING,{frag:B})):B&&this.fragmentTracker.getState(B)===A.FragmentState.NOT_LOADED&&this.loadFragment(B,v,y)}},c.loadFragment=function(D,T,g){this.fragCurrent=D,h.prototype.loadFragment.call(this,D,T,g)},E(k,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),k}(f.default)},"./src/controller/subtitle-track-controller.ts":function(ne,$,R){"use strict";R.r($);var Q=R("./src/events.ts"),U=R("./src/utils/texttrack-utils.ts"),O=R("./src/controller/base-playlist-controller.ts"),j=R("./src/types/loader.ts");function N(w,E){for(var p=0;p<E.length;p++){var u=E[p];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(w,u.key,u)}}function _(w,E,p){return E&&N(w.prototype,E),p&&N(w,p),w}function A(w,E){w.prototype=Object.create(E.prototype),w.prototype.constructor=w,f(w,E)}function f(w,E){return f=Object.setPrototypeOf||function(u,a){return u.__proto__=a,u},f(w,E)}var x=function(w){A(E,w);function E(u){var a;return a=w.call(this,u,"[subtitle-track-controller]")||this,a.media=null,a.tracks=[],a.groupId=null,a.tracksInGroup=[],a.trackId=-1,a.selectDefaultTrack=!0,a.queuedDefaultTrack=-1,a.trackChangeListener=function(){return a.onTextTracksChanged()},a.asyncPollTrackChange=function(){return a.pollTrackChange(0)},a.useTextTrackPolling=!1,a.subtitlePollingInterval=-1,a.subtitleDisplay=!0,a.registerListeners(),a}var p=E.prototype;return p.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,w.prototype.destroy.call(this)},p.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.MANIFEST_LOADING,this.onManifestLoading,this),a.on(Q.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.on(Q.Events.LEVEL_LOADING,this.onLevelLoading,this),a.on(Q.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),a.on(Q.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),a.on(Q.Events.ERROR,this.onError,this)},p.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.MANIFEST_LOADING,this.onManifestLoading,this),a.off(Q.Events.MANIFEST_PARSED,this.onManifestParsed,this),a.off(Q.Events.LEVEL_LOADING,this.onLevelLoading,this),a.off(Q.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),a.off(Q.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),a.off(Q.Events.ERROR,this.onError,this)},p.onMediaAttached=function(a,s){if(this.media=s.media,!this.media)return;this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange)},p.pollTrackChange=function(a){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,a)},p.onMediaDetaching=function(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId);var a=P(this.media.textTracks);a.forEach(function(s){Object(U.clearCurrentCues)(s)}),this.subtitleTrack=-1,this.media=null},p.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},p.onManifestParsed=function(a,s){this.tracks=s.subtitleTracks},p.onSubtitleTrackLoaded=function(a,s){var h=s.id,k=s.details,c=this.trackId,b=this.tracksInGroup[c];if(!b){this.warn("Invalid subtitle track id "+h);return}var D=b.details;b.details=s.details,this.log("subtitle track "+h+" loaded ["+k.startSN+"-"+k.endSN+"]"),h===this.trackId&&(this.retryCount=0,this.playlistLoaded(h,s,D))},p.onLevelLoading=function(a,s){this.switchLevel(s.level)},p.onLevelSwitching=function(a,s){this.switchLevel(s.level)},p.switchLevel=function(a){var s=this.hls.levels[a];if(!(s!=null&&s.textGroupIds))return;var h=s.textGroupIds[s.urlId];if(this.groupId!==h){var k=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,c=this.tracks.filter(function(T){return!h||T.groupId===h});this.tracksInGroup=c;var b=this.findTrackId(k==null?void 0:k.name)||this.findTrackId();this.groupId=h;var D={subtitleTracks:c};this.log("Updating subtitle tracks, "+c.length+' track(s) found in "'+h+'" group-id'),this.hls.trigger(Q.Events.SUBTITLE_TRACKS_UPDATED,D),b!==-1&&this.setSubtitleTrack(b,k)}},p.findTrackId=function(a){for(var s=this.tracksInGroup,h=0;h<s.length;h++){var k=s[h];if((!this.selectDefaultTrack||k.default)&&(!a||a===k.name))return k.id}return-1},p.onError=function(a,s){if(w.prototype.onError.call(this,a,s),s.fatal||!s.context)return;s.context.type===j.PlaylistContextType.SUBTITLE_TRACK&&s.context.id===this.trackId&&s.context.groupId===this.groupId&&this.retryLoadingOrFail(s)},p.loadPlaylist=function(a){var s=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(s)){var h=s.id,k=s.groupId,c=s.url;if(a)try{c=a.addDirectives(c)}catch(b){this.warn("Could not construct new URL with HLS Delivery Directives: "+b)}this.log("Loading subtitle playlist for id "+h),this.hls.trigger(Q.Events.SUBTITLE_TRACK_LOADING,{url:c,id:h,groupId:k,deliveryDirectives:a||null})}},p.toggleTrackModes=function(a){var s=this,h=this.media,k=this.subtitleDisplay,c=this.trackId;if(!h)return;var b=P(h.textTracks),D=b.filter(function(v){return v.groupId===s.groupId});if(a===-1)[].slice.call(b).forEach(function(v){v.mode="disabled"});else{var T=D[c];T&&(T.mode="disabled")}var g=D[a];g&&(g.mode=k?"showing":"hidden")},p.setSubtitleTrack=function(a,s){var h,k=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=a;return}if(this.trackId!==a&&this.toggleTrackModes(a),this.trackId===a&&(a===-1||(h=k[a])!==null&&h!==void 0&&h.details)||a<-1||a>=k.length)return;this.clearTimer();var c=k[a];if(this.log("Switching to subtitle track "+a),this.trackId=a,c){var b=c.id,D=c.groupId,T=D===void 0?"":D,g=c.name,v=c.type,d=c.url;this.hls.trigger(Q.Events.SUBTITLE_TRACK_SWITCH,{id:b,groupId:T,name:g,type:v,url:d});var o=this.switchParams(c.url,s==null?void 0:s.details);this.loadPlaylist(o)}else this.hls.trigger(Q.Events.SUBTITLE_TRACK_SWITCH,{id:a})},p.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var a=-1,s=P(this.media.textTracks),h=0;h<s.length;h++)if(s[h].mode==="hidden")a=h;else if(s[h].mode==="showing"){a=h;break}this.subtitleTrack!==a&&(this.subtitleTrack=a)},_(E,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(a){this.selectDefaultTrack=!1;var s=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(a,s)}}]),E}(O.default);function P(w){for(var E=[],p=0;p<w.length;p++){var u=w[p];u.kind==="subtitles"&&u.label&&E.push(w[p])}return E}$.default=x},"./src/controller/timeline-controller.ts":function(ne,$,R){"use strict";R.r($),R.d($,"TimelineController",function(){return P});var Q=R("./src/polyfills/number.ts"),U=R("./src/events.ts"),O=R("./src/utils/cea-608-parser.ts"),j=R("./src/utils/output-filter.ts"),N=R("./src/utils/webvtt-parser.ts"),_=R("./src/utils/texttrack-utils.ts"),A=R("./src/utils/imsc1-ttml-parser.ts"),f=R("./src/types/loader.ts"),x=R("./src/utils/logger.ts"),P=function(){function u(s){if(this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.timescale=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=p(),this.captionsProperties=void 0,this.hls=s,this.config=s.config,this.Cues=s.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},this.config.enableCEA708Captions){var h=new j.default(this,"textTrack1"),k=new j.default(this,"textTrack2"),c=new j.default(this,"textTrack3"),b=new j.default(this,"textTrack4");this.cea608Parser1=new O.default(1,h,k),this.cea608Parser2=new O.default(3,c,b)}s.on(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),s.on(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),s.on(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),s.on(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),s.on(U.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),s.on(U.Events.FRAG_LOADING,this.onFragLoading,this),s.on(U.Events.FRAG_LOADED,this.onFragLoaded,this),s.on(U.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),s.on(U.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),s.on(U.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),s.on(U.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),s.on(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var a=u.prototype;return a.destroy=function(){var h=this.hls;h.off(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),h.off(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),h.off(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.off(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),h.off(U.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),h.off(U.Events.FRAG_LOADING,this.onFragLoading,this),h.off(U.Events.FRAG_LOADED,this.onFragLoaded,this),h.off(U.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),h.off(U.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),h.off(U.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),h.off(U.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),h.off(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},a.addCues=function(h,k,c,b,D){for(var T=!1,g=D.length;g--;){var v=D[g],d=E(v[0],v[1],k,c);if(d>=0&&(v[0]=Math.min(v[0],k),v[1]=Math.max(v[1],c),T=!0,d/(c-k)>.5))return}if(T||D.push([k,c]),this.config.renderTextTracksNatively){var o=this.captionsTracks[h];this.Cues.newCue(o,k,c,b)}else{var C=this.Cues.newCue(null,k,c,b);this.hls.trigger(U.Events.CUES_PARSED,{type:"captions",cues:C,track:h})}},a.onInitPtsFound=function(h,k){var c=this,b=k.frag,D=k.id,T=k.initPTS,g=k.timescale,v=this.unparsedVttFrags;D==="main"&&(this.initPTS[b.cc]=T,this.timescale[b.cc]=g),v.length&&(this.unparsedVttFrags=[],v.forEach(function(d){c.onFragLoaded(U.Events.FRAG_LOADED,d)}))},a.getExistingTrack=function(h){var k=this.media;if(k)for(var c=0;c<k.textTracks.length;c++){var b=k.textTracks[c];if(b[h])return b}return null},a.createCaptionsTrack=function(h){this.config.renderTextTracksNatively?this.createNativeTrack(h):this.createNonNativeTrack(h)},a.createNativeTrack=function(h){if(this.captionsTracks[h])return;var k=this.captionsProperties,c=this.captionsTracks,b=this.media,D=k[h],T=D.label,g=D.languageCode,v=this.getExistingTrack(h);if(v)c[h]=v,Object(_.clearCurrentCues)(c[h]),Object(_.sendAddTrackEvent)(c[h],b);else{var d=this.createTextTrack("captions",T,g);d&&(d[h]=!0,c[h]=d)}},a.createNonNativeTrack=function(h){if(this.nonNativeCaptionsTracks[h])return;var k=this.captionsProperties[h];if(!k)return;var c=k.label,b={_id:h,label:c,kind:"captions",default:k.media?!!k.media.default:!1,closedCaptions:k.media};this.nonNativeCaptionsTracks[h]=b,this.hls.trigger(U.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[b]})},a.createTextTrack=function(h,k,c){var b=this.media;return b?b.addTextTrack(h,k,c):void 0},a.onMediaAttaching=function(h,k){this.media=k.media,this._cleanTracks()},a.onMediaDetaching=function(){var h=this.captionsTracks;Object.keys(h).forEach(function(k){Object(_.clearCurrentCues)(h[k]),delete h[k]}),this.nonNativeCaptionsTracks={}},a.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=p(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.timescale=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},a._cleanTracks=function(){var h=this.media;if(!h)return;var k=h.textTracks;if(k)for(var c=0;c<k.length;c++)Object(_.clearCurrentCues)(k[c])},a.onSubtitleTracksUpdated=function(h,k){var c=this;this.textTracks=[];var b=k.subtitleTracks||[],D=b.some(function(d){return d.textCodec===A.IMSC1_CODEC});if(this.config.enableWebVTT||D&&this.config.enableIMSC1){var T=this.tracks&&b&&this.tracks.length===b.length;if(this.tracks=b||[],this.config.renderTextTracksNatively){var g=this.media?this.media.textTracks:[];this.tracks.forEach(function(d,o){var C;if(o<g.length){for(var S=null,y=0;y<g.length;y++)if(w(g[y],d)){S=g[y];break}S&&(C=S)}C?Object(_.clearCurrentCues)(C):(C=c.createTextTrack("subtitles",d.name,d.lang),C&&(C.mode="disabled")),C&&(C.groupId=d.groupId,c.textTracks.push(C))})}else if(!T&&this.tracks&&this.tracks.length){var v=this.tracks.map(function(d){return{label:d.name,kind:d.type.toLowerCase(),default:d.default,subtitleTrack:d}});this.hls.trigger(U.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:v})}}},a.onManifestLoaded=function(h,k){var c=this;this.config.enableCEA708Captions&&k.captions&&k.captions.forEach(function(b){var D=/(?:CC|SERVICE)([1-4])/.exec(b.instreamId);if(!D)return;var T="textTrack"+D[1],g=c.captionsProperties[T];if(!g)return;g.label=b.name,b.lang&&(g.languageCode=b.lang),g.media=b})},a.onFragLoading=function(h,k){var c=this.cea608Parser1,b=this.cea608Parser2,D=this.lastSn,T=this.lastPartIndex;if(!this.enabled||!(c&&b))return;if(k.frag.type===f.PlaylistLevelType.MAIN){var g,v,d=k.frag.sn,o=(g=k==null||((v=k.part)===null||v===void 0)?void 0:v.index)!=null?g:-1;d===D+1||d===D&&o===T+1||(c.reset(),b.reset()),this.lastSn=d,this.lastPartIndex=o}},a.onFragLoaded=function(h,k){var c=k.frag,b=k.payload,D=this.initPTS,T=this.unparsedVttFrags;if(c.type===f.PlaylistLevelType.SUBTITLE)if(b.byteLength){if(!Object(Q.isFiniteNumber)(D[c.cc])){T.push(k),D.length&&this.hls.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:c,error:new Error("Missing initial subtitle PTS")});return}var g=c.decryptdata;if(g==null||g.key==null||g.method!=="AES-128"){var v=this.tracks[c.level],d=this.vttCCs;d[c.cc]||(d[c.cc]={start:c.start,prevCC:this.prevCC,new:!0},this.prevCC=c.cc),v&&v.textCodec===A.IMSC1_CODEC?this._parseIMSC1(c,b):this._parseVTTs(c,b,d)}}else this.hls.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:c,error:new Error("Empty subtitle payload")})},a._parseIMSC1=function(h,k){var c=this,b=this.hls;Object(A.parseIMSC1)(k,this.initPTS[h.cc],this.timescale[h.cc],function(D){c._appendCues(D,h.level),b.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:h})},function(D){x.logger.log("Failed to parse IMSC1: "+D),b.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:h,error:D})})},a._parseVTTs=function(h,k,c){var b=this,D=this.hls;Object(N.parseWebVTT)(k,this.initPTS[h.cc],this.timescale[h.cc],c,h.cc,h.start,function(T){b._appendCues(T,h.level),D.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:h})},function(T){b._fallbackToIMSC1(h,k),x.logger.log("Failed to parse VTT cue: "+T),D.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:h,error:T})})},a._fallbackToIMSC1=function(h,k){var c=this,b=this.tracks[h.level];b.textCodec||Object(A.parseIMSC1)(k,this.initPTS[h.cc],this.timescale[h.cc],function(){b.textCodec=A.IMSC1_CODEC,c._parseIMSC1(h,k)},function(){b.textCodec="wvtt"})},a._appendCues=function(h,k){var c=this.hls;if(this.config.renderTextTracksNatively){var b=this.textTracks[k];if(b.mode==="disabled")return;h.forEach(function(g){return Object(_.addCueToTrack)(b,g)})}else{var D=this.tracks[k],T=D.default?"default":"subtitles"+k;c.trigger(U.Events.CUES_PARSED,{type:"subtitles",cues:h,track:T})}},a.onFragDecrypted=function(h,k){var c=k.frag;if(c.type===f.PlaylistLevelType.SUBTITLE){if(!Object(Q.isFiniteNumber)(this.initPTS[c.cc])){this.unparsedVttFrags.push(k);return}this.onFragLoaded(U.Events.FRAG_LOADED,k)}},a.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},a.onFragParsingUserdata=function(h,k){var c=this.cea608Parser1,b=this.cea608Parser2;if(!this.enabled||!(c&&b))return;for(var D=0;D<k.samples.length;D++){var T=k.samples[D].bytes;if(T){var g=this.extractCea608Data(T);c.addData(k.samples[D].pts,g[0]),b.addData(k.samples[D].pts,g[1])}}},a.onBufferFlushing=function(h,k){var c=k.startOffset,b=k.endOffset,D=k.endOffsetSubtitles,T=k.type,g=this.media;if(!g||g.currentTime<b)return;if(!T||T==="video"){var v=this.captionsTracks;Object.keys(v).forEach(function(o){return Object(_.removeCuesInRange)(v[o],c,b)})}if(this.config.renderTextTracksNatively&&(c===0&&D!==void 0)){var d=this.textTracks;Object.keys(d).forEach(function(o){return Object(_.removeCuesInRange)(d[o],c,D)})}},a.extractCea608Data=function(h){for(var k=h[0]&31,c=2,b=[[],[]],D=0;D<k;D++){var T=h[c++],g=127&h[c++],v=127&h[c++],d=(4&T)!==0,o=3&T;if(g===0&&v===0)continue;d&&((o===0||o===1)&&(b[o].push(g),b[o].push(v)))}return b},u}();function w(u,a){return u&&u.label===a.name&&!(u.textTrack1||u.textTrack2)}function E(u,a,s,h){return Math.min(a,h)-Math.max(u,s)}function p(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(ne,$,R){"use strict";R.r($),R.d($,"default",function(){return Q});var Q=function(){function U(j,N){this.subtle=void 0,this.aesIV=void 0,this.subtle=j,this.aesIV=N}var O=U.prototype;return O.decrypt=function(N,_){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},_,N)},U}()},"./src/crypt/aes-decryptor.ts":function(ne,$,R){"use strict";R.r($),R.d($,"removePadding",function(){return U}),R.d($,"default",function(){return O});var Q=R("./src/utils/typed-array.ts");function U(j){var N=j.byteLength,_=N&&new DataView(j.buffer).getUint8(N-1);return _?Object(Q.sliceUint8)(j,0,N-_):j}var O=function(){function j(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}var N=j.prototype;return N.uint8ArrayToUint32Array_=function(A){for(var f=new DataView(A),x=new Uint32Array(4),P=0;P<4;P++)x[P]=f.getUint32(P*4);return x},N.initTable=function(){var A=this.sBox,f=this.invSBox,x=this.subMix,P=x[0],w=x[1],E=x[2],p=x[3],u=this.invSubMix,a=u[0],s=u[1],h=u[2],k=u[3],c=new Uint32Array(256),b=0,D=0,T=0;for(T=0;T<256;T++)T<128?c[T]=T<<1:c[T]=T<<1^283;for(T=0;T<256;T++){var g=D^D<<1^D<<2^D<<3^D<<4;g=g>>>8^g&255^99,A[b]=g,f[g]=b;var v=c[b],d=c[v],o=c[d],C=c[g]*257^g*16843008;P[b]=C<<24|C>>>8,w[b]=C<<16|C>>>16,E[b]=C<<8|C>>>24,p[b]=C,C=o*16843009^d*65537^v*257^b*16843008,a[g]=C<<24|C>>>8,s[g]=C<<16|C>>>16,h[g]=C<<8|C>>>24,k[g]=C,b?(b=v^c[c[c[o^v]]],D^=c[c[D]]):b=D=1}},N.expandKey=function(A){for(var f=this.uint8ArrayToUint32Array_(A),x=!0,P=0;P<f.length&&x;)x=f[P]===this.key[P],P++;if(x)return;this.key=f;var w=this.keySize=f.length;if(w!==4&&w!==6&&w!==8)throw new Error("Invalid aes key size="+w);var E=this.ksRows=(w+6+1)*4,p,u,a=this.keySchedule=new Uint32Array(E),s=this.invKeySchedule=new Uint32Array(E),h=this.sBox,k=this.rcon,c=this.invSubMix,b=c[0],D=c[1],T=c[2],g=c[3],v,d;for(p=0;p<E;p++){if(p<w){v=a[p]=f[p];continue}d=v,p%w===0?(d=d<<8|d>>>24,d=h[d>>>24]<<24|h[d>>>16&255]<<16|h[d>>>8&255]<<8|h[d&255],d^=k[p/w|0]<<24):w>6&&p%w===4&&(d=h[d>>>24]<<24|h[d>>>16&255]<<16|h[d>>>8&255]<<8|h[d&255]),a[p]=v=(a[p-w]^d)>>>0}for(u=0;u<E;u++)p=E-u,u&3?d=a[p]:d=a[p-4],u<4||p<=4?s[u]=d:s[u]=b[h[d>>>24]]^D[h[d>>>16&255]]^T[h[d>>>8&255]]^g[h[d&255]],s[u]=s[u]>>>0},N.networkToHostOrderSwap=function(A){return A<<24|(A&65280)<<8|(A&16711680)>>8|A>>>24},N.decrypt=function(A,f,x){for(var P=this.keySize+6,w=this.invKeySchedule,E=this.invSBox,p=this.invSubMix,u=p[0],a=p[1],s=p[2],h=p[3],k=this.uint8ArrayToUint32Array_(x),c=k[0],b=k[1],D=k[2],T=k[3],g=new Int32Array(A),v=new Int32Array(g.length),d,o,C,S,y,M,F,W,V,I,B,X,ee,oe,fe=this.networkToHostOrderSwap;f<g.length;){for(V=fe(g[f]),I=fe(g[f+1]),B=fe(g[f+2]),X=fe(g[f+3]),y=V^w[0],M=X^w[1],F=B^w[2],W=I^w[3],ee=4,oe=1;oe<P;oe++)d=u[y>>>24]^a[M>>16&255]^s[F>>8&255]^h[W&255]^w[ee],o=u[M>>>24]^a[F>>16&255]^s[W>>8&255]^h[y&255]^w[ee+1],C=u[F>>>24]^a[W>>16&255]^s[y>>8&255]^h[M&255]^w[ee+2],S=u[W>>>24]^a[y>>16&255]^s[M>>8&255]^h[F&255]^w[ee+3],y=d,M=o,F=C,W=S,ee=ee+4;d=E[y>>>24]<<24^E[M>>16&255]<<16^E[F>>8&255]<<8^E[W&255]^w[ee],o=E[M>>>24]<<24^E[F>>16&255]<<16^E[W>>8&255]<<8^E[y&255]^w[ee+1],C=E[F>>>24]<<24^E[W>>16&255]<<16^E[y>>8&255]<<8^E[M&255]^w[ee+2],S=E[W>>>24]<<24^E[y>>16&255]<<16^E[M>>8&255]<<8^E[F&255]^w[ee+3],v[f]=fe(d^c),v[f+1]=fe(S^b),v[f+2]=fe(C^D),v[f+3]=fe(o^T),c=V,b=I,D=B,T=X,f=f+4}return v.buffer},j}()},"./src/crypt/decrypter.ts":function(ne,$,R){"use strict";R.r($),R.d($,"default",function(){return f});var Q=R("./src/crypt/aes-crypto.ts"),U=R("./src/crypt/fast-aes-key.ts"),O=R("./src/crypt/aes-decryptor.ts"),j=R("./src/utils/logger.ts"),N=R("./src/utils/mp4-tools.ts"),_=R("./src/utils/typed-array.ts"),A=16,f=function(){function x(w,E,p){var u=p===void 0?{}:p,a=u.removePKCS7Padding,s=a===void 0?!0:a;if(this.logEnabled=!0,this.observer=void 0,this.config=void 0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.observer=w,this.config=E,this.removePKCS7Padding=s,s)try{var h=self.crypto;h&&(this.subtle=h.subtle||h.webkitSubtle)}catch(k){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var P=x.prototype;return P.destroy=function(){this.observer=null},P.isSync=function(){return this.config.enableSoftwareAES},P.flush=function(){var E=this.currentResult;if(!E){this.reset();return}var p=new Uint8Array(E);return this.reset(),this.removePKCS7Padding?Object(O.removePadding)(p):p},P.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},P.decrypt=function(E,p,u,a){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(E),p,u);var s=this.flush();s&&a(s.buffer)}else this.webCryptoDecrypt(new Uint8Array(E),p,u).then(a)},P.softwareDecrypt=function(E,p,u){var a=this.currentIV,s=this.currentResult,h=this.remainderData;this.logOnce("JS AES decrypt"),h&&(E=Object(N.appendUint8Array)(h,E),this.remainderData=null);var k=this.getValidChunk(E);if(!k.length)return null;a&&(u=a);var c=this.softwareDecrypter;c||(c=this.softwareDecrypter=new O.default),c.expandKey(p);var b=s;return this.currentResult=c.decrypt(k.buffer,0,u),this.currentIV=Object(_.sliceUint8)(k,-16).buffer,b||null},P.webCryptoDecrypt=function(E,p,u){var a=this,s=this.subtle;return(this.key!==p||!this.fastAesKey)&&(this.key=p,this.fastAesKey=new U.default(s,p)),this.fastAesKey.expandKey().then(function(h){if(!s)return Promise.reject(new Error("web crypto not initialized"));var k=new Q.default(s,u);return k.decrypt(E.buffer,h)}).catch(function(h){return a.onWebCryptoError(h,E,p,u)})},P.onWebCryptoError=function(E,p,u,a){return j.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",E),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(p,u,a)},P.getValidChunk=function(E){var p=E,u=E.length-E.length%A;return u!==E.length&&(p=Object(_.sliceUint8)(E,0,u),this.remainderData=Object(_.sliceUint8)(E,u)),p},P.logOnce=function(E){if(!this.logEnabled)return;j.logger.log("[decrypter.ts]: "+E),this.logEnabled=!1},x}()},"./src/crypt/fast-aes-key.ts":function(ne,$,R){"use strict";R.r($),R.d($,"default",function(){return Q});var Q=function(){function U(j,N){this.subtle=void 0,this.key=void 0,this.subtle=j,this.key=N}var O=U.prototype;return O.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},U}()},"./src/demux/aacdemuxer.ts":function(ne,$,R){"use strict";R.r($);var Q=R("./src/demux/base-audio-demuxer.ts"),U=R("./src/demux/adts.ts"),O=R("./src/utils/logger.ts"),j=R("./src/demux/id3.ts");function N(f,x){f.prototype=Object.create(x.prototype),f.prototype.constructor=f,_(f,x)}function _(f,x){return _=Object.setPrototypeOf||function(w,E){return w.__proto__=E,w},_(f,x)}var A=function(f){N(x,f);function x(w,E){var p;return p=f.call(this)||this,p.observer=void 0,p.config=void 0,p.observer=w,p.config=E,p}var P=x.prototype;return P.resetInitSegment=function(E,p,u){f.prototype.resetInitSegment.call(this,E,p,u),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:E,duration:u,inputTimeScale:9e4,dropped:0}},x.probe=function(E){if(!E)return!1;for(var p=j.getID3Data(E,0)||[],u=p.length,a=E.length;u<a;u++)if(U.probe(E,u))return O.logger.log("ADTS sync word found !"),!0;return!1},P.canParse=function(E,p){return U.canParse(E,p)},P.appendFrame=function(E,p,u){U.initTrackConfig(E,this.observer,p,u,E.manifestCodec);var a=U.appendFrame(E,p,u,this.initPTS,this.frameIndex);if(a&&a.missing===0)return a},x}(Q.default);A.minProbeByteLength=9,$.default=A},"./src/demux/adts.ts":function(ne,$,R){"use strict";R.r($),R.d($,"getAudioConfig",function(){return j}),R.d($,"isHeaderPattern",function(){return N}),R.d($,"getHeaderLength",function(){return _}),R.d($,"getFullFrameLength",function(){return A}),R.d($,"canGetFrameLength",function(){return f}),R.d($,"isHeader",function(){return x}),R.d($,"canParse",function(){return P}),R.d($,"probe",function(){return w}),R.d($,"initTrackConfig",function(){return E}),R.d($,"getFrameDuration",function(){return p}),R.d($,"parseFrameHeader",function(){return u}),R.d($,"appendFrame",function(){return a});var Q=R("./src/utils/logger.ts"),U=R("./src/errors.ts"),O=R("./src/events.ts");function j(s,h,k,c){var b,D,T,g,v=navigator.userAgent.toLowerCase(),d=c,o=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];b=((h[k+2]&192)>>>6)+1;var C=(h[k+2]&60)>>>2;if(C>o.length-1){s.trigger(O.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+C});return}return T=(h[k+2]&1)<<2,T|=(h[k+3]&192)>>>6,Q.logger.log("manifest codec:"+c+", ADTS type:"+b+", samplingIndex:"+C),/firefox/i.test(v)?C>=6?(b=5,g=new Array(4),D=C-3):(b=2,g=new Array(2),D=C):v.indexOf("android")!==-1?(b=2,g=new Array(2),D=C):(b=5,g=new Array(4),c&&(c.indexOf("mp4a.40.29")!==-1||c.indexOf("mp4a.40.5")!==-1)||!c&&C>=6?D=C-3:((c&&c.indexOf("mp4a.40.2")!==-1&&(C>=6&&T===1||/vivaldi/i.test(v))||!c&&T===1)&&(b=2,g=new Array(2)),D=C)),g[0]=b<<3,g[0]|=(C&14)>>1,g[1]|=(C&1)<<7,g[1]|=T<<3,b===5&&(g[1]|=(D&14)>>1,g[2]=(D&1)<<7,g[2]|=2<<2,g[3]=0),{config:g,samplerate:o[C],channelCount:T,codec:"mp4a.40."+b,manifestCodec:d}}function N(s,h){return s[h]===255&&(s[h+1]&246)===240}function _(s,h){return s[h+1]&1?7:9}function A(s,h){return(s[h+3]&3)<<11|s[h+4]<<3|(s[h+5]&224)>>>5}function f(s,h){return h+5<s.length}function x(s,h){return h+1<s.length&&N(s,h)}function P(s,h){return f(s,h)&&N(s,h)&&A(s,h)<=s.length-h}function w(s,h){if(x(s,h)){var k=_(s,h);if(h+k>=s.length)return!1;var c=A(s,h);if(c<=k)return!1;var b=h+c;return b===s.length||x(s,b)}return!1}function E(s,h,k,c,b){if(!s.samplerate){var D=j(h,k,c,b);if(!D)return;s.config=D.config,s.samplerate=D.samplerate,s.channelCount=D.channelCount,s.codec=D.codec,s.manifestCodec=D.manifestCodec,Q.logger.log("parsed codec:"+s.codec+", rate:"+D.samplerate+", channels:"+D.channelCount)}}function p(s){return 1024*9e4/s}function u(s,h,k,c,b){var D=_(s,h),T=A(s,h);if(T-=D,T>0){var g=k+c*b;return{headerLength:D,frameLength:T,stamp:g}}}function a(s,h,k,c,b){var D=p(s.samplerate),T=u(h,k,c,b,D);if(T){var g=T.frameLength,v=T.headerLength,d=T.stamp,o=v+g,C=Math.max(0,k+o-h.length),S;C?(S=new Uint8Array(o-v),S.set(h.subarray(k+v,h.length),0)):S=h.subarray(k+v,k+o);var y={unit:S,pts:d};return C||s.samples.push(y),{sample:y,length:o,missing:C}}}},"./src/demux/base-audio-demuxer.ts":function(ne,$,R){"use strict";R.r($),R.d($,"initPTSFn",function(){return A});var Q=R("./src/polyfills/number.ts"),U=R("./src/demux/id3.ts"),O=R("./src/demux/dummy-demuxed-track.ts"),j=R("./src/utils/mp4-tools.ts"),N=R("./src/utils/typed-array.ts"),_=function(){function f(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var x=f.prototype;return x.resetInitSegment=function(w,E,p){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},x.resetTimeStamp=function(){},x.resetContiguity=function(){},x.canParse=function(w,E){return!1},x.appendFrame=function(w,E,p){},x.demux=function(w,E){this.cachedData&&(w=Object(j.appendUint8Array)(this.cachedData,w),this.cachedData=null);var p=U.getID3Data(w,0),u=p?p.length:0,a,s,h=this._audioTrack,k=this._id3Track,c=p?U.getTimeStamp(p):void 0,b=w.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=A(c,E)),p&&p.length>0&&k.samples.push({pts:this.initPTS,dts:this.initPTS,data:p}),s=this.initPTS;u<b;){if(this.canParse(w,u)){var D=this.appendFrame(h,w,u);D?(this.frameIndex++,s=D.sample.pts,u+=D.length,a=u):u=b}else U.canParse(w,u)?(p=U.getID3Data(w,u),k.samples.push({pts:s,dts:s,data:p}),u+=p.length,a=u):u++;if(u===b&&a!==b){var T=Object(N.sliceUint8)(w,a);this.cachedData?this.cachedData=Object(j.appendUint8Array)(this.cachedData,T):this.cachedData=T}}return{audioTrack:h,avcTrack:Object(O.dummyTrack)(),id3Track:k,textTrack:Object(O.dummyTrack)()}},x.demuxSampleAes=function(w,E,p){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},x.flush=function(w){var E=this.cachedData;return E&&(this.cachedData=null,this.demux(E,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(O.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(O.dummyTrack)()}},x.destroy=function(){},f}(),A=function(x,P){return Object(Q.isFiniteNumber)(x)?x*90:P*9e4};$.default=_},"./src/demux/chunk-cache.ts":function(ne,$,R){"use strict";R.r($),R.d($,"default",function(){return Q});var Q=function(){function O(){this.chunks=[],this.dataLength=0}var j=O.prototype;return j.push=function(_){this.chunks.push(_),this.dataLength+=_.length},j.flush=function(){var _=this.chunks,A=this.dataLength,f;if(_.length)_.length===1?f=_[0]:f=U(_,A);else return new Uint8Array(0);return this.reset(),f},j.reset=function(){this.chunks.length=0,this.dataLength=0},O}();function U(O,j){for(var N=new Uint8Array(j),_=0,A=0;A<O.length;A++){var f=O[A];N.set(f,_),_+=f.length}return N}},"./src/demux/dummy-demuxed-track.ts":function(ne,$,R){"use strict";R.r($),R.d($,"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(ne,$,R){"use strict";R.r($);var Q=R("./src/utils/logger.ts"),U=function(){function O(N){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=N,this.bytesAvailable=N.byteLength,this.word=0,this.bitsAvailable=0}var j=O.prototype;return j.loadWord=function(){var _=this.data,A=this.bytesAvailable,f=_.byteLength-A,x=new Uint8Array(4),P=Math.min(4,A);if(P===0)throw new Error("no bytes available");x.set(_.subarray(f,f+P)),this.word=new DataView(x.buffer).getUint32(0),this.bitsAvailable=P*8,this.bytesAvailable-=P},j.skipBits=function(_){var A;this.bitsAvailable>_?(this.word<<=_,this.bitsAvailable-=_):(_-=this.bitsAvailable,A=_>>3,_-=A>>3,this.bytesAvailable-=A,this.loadWord(),this.word<<=_,this.bitsAvailable-=_)},j.readBits=function(_){var A=Math.min(this.bitsAvailable,_),f=this.word>>>32-A;return _>32&&Q.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=A,this.bitsAvailable>0?this.word<<=A:this.bytesAvailable>0&&this.loadWord(),A=_-A,A>0&&this.bitsAvailable?f<<A|this.readBits(A):f},j.skipLZ=function(){var _;for(_=0;_<this.bitsAvailable;++_)if((this.word&2147483648>>>_)!==0)return this.word<<=_,this.bitsAvailable-=_,_;return this.loadWord(),_+this.skipLZ()},j.skipUEG=function(){this.skipBits(1+this.skipLZ())},j.skipEG=function(){this.skipBits(1+this.skipLZ())},j.readUEG=function(){var _=this.skipLZ();return this.readBits(_+1)-1},j.readEG=function(){var _=this.readUEG();return 1&_?1+_>>>1:-1*(_>>>1)},j.readBoolean=function(){return this.readBits(1)===1},j.readUByte=function(){return this.readBits(8)},j.readUShort=function(){return this.readBits(16)},j.readUInt=function(){return this.readBits(32)},j.skipScalingList=function(_){for(var A=8,f=8,x,P=0;P<_;P++)f!==0&&(x=this.readEG(),f=(A+x+256)%256),A=f===0?A:f},j.readSPS=function(){var _=0,A=0,f=0,x=0,P,w,E,p=this.readUByte.bind(this),u=this.readBits.bind(this),a=this.readUEG.bind(this),s=this.readBoolean.bind(this),h=this.skipBits.bind(this),k=this.skipEG.bind(this),c=this.skipUEG.bind(this),b=this.skipScalingList.bind(this);p();var D=p();if(u(5),h(3),p(),c(),D===100||D===110||D===122||D===244||D===44||D===83||D===86||D===118||D===128){var T=a();if(T===3&&h(1),c(),c(),h(1),s())for(w=T!==3?8:12,E=0;E<w;E++)s()&&(E<6?b(16):b(64))}c();var g=a();if(g===0)a();else if(g===1)for(h(1),k(),k(),P=a(),E=0;E<P;E++)k();c(),h(1);var v=a(),d=a(),o=u(1);o===0&&h(1),h(1),s()&&(_=a(),A=a(),f=a(),x=a());var C=[1,1];if(s()&&s()){var S=p();switch(S){case 1:C=[1,1];break;case 2:C=[12,11];break;case 3:C=[10,11];break;case 4:C=[16,11];break;case 5:C=[40,33];break;case 6:C=[24,11];break;case 7:C=[20,11];break;case 8:C=[32,11];break;case 9:C=[80,33];break;case 10:C=[18,11];break;case 11:C=[15,11];break;case 12:C=[64,33];break;case 13:C=[160,99];break;case 14:C=[4,3];break;case 15:C=[3,2];break;case 16:C=[2,1];break;case 255:{C=[p()<<8|p(),p()<<8|p()];break}}}return{width:Math.ceil((v+1)*16-_*2-A*2),height:(2-o)*(d+1)*16-(o?2:4)*(f+x),pixelRatio:C}},j.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},O}();$.default=U},"./src/demux/id3.ts":function(ne,$,R){"use strict";R.r($),R.d($,"isHeader",function(){return Q}),R.d($,"isFooter",function(){return U}),R.d($,"getID3Data",function(){return O}),R.d($,"canParse",function(){return N}),R.d($,"getTimeStamp",function(){return _}),R.d($,"isTimeStampFrame",function(){return A}),R.d($,"getID3Frames",function(){return x}),R.d($,"decodeFrame",function(){return P}),R.d($,"utf8ArrayToStr",function(){return a}),R.d($,"testables",function(){return s});var Q=function(b,D){return D+10<=b.length&&(b[D]===73&&b[D+1]===68&&b[D+2]===51&&(b[D+3]<255&&b[D+4]<255&&(b[D+6]<128&&b[D+7]<128&&b[D+8]<128&&b[D+9]<128)))},U=function(b,D){return D+10<=b.length&&(b[D]===51&&b[D+1]===68&&b[D+2]===73&&(b[D+3]<255&&b[D+4]<255&&(b[D+6]<128&&b[D+7]<128&&b[D+8]<128&&b[D+9]<128)))},O=function(b,D){for(var T=D,g=0;Q(b,D);){g+=10;var v=j(b,D+6);g+=v,U(b,D+10)&&(g+=10),D+=g}return g>0?b.subarray(T,T+g):void 0},j=function(b,D){var T=0;return T=(b[D]&127)<<21,T|=(b[D+1]&127)<<14,T|=(b[D+2]&127)<<7,T|=b[D+3]&127,T},N=function(b,D){return Q(b,D)&&j(b,D+6)+10<=b.length-D},_=function(b){for(var D=x(b),T=0;T<D.length;T++){var g=D[T];if(A(g))return u(g)}return},A=function(b){return b&&b.key==="PRIV"&&b.info==="com.apple.streaming.transportStreamTimestamp"},f=function(b){var D=String.fromCharCode(b[0],b[1],b[2],b[3]),T=j(b,4),g=10;return{type:D,size:T,data:b.subarray(g,g+T)}},x=function(b){for(var D=0,T=[];Q(b,D);){var g=j(b,D+6);D+=10;for(var v=D+g;D+8<v;){var d=f(b.subarray(D)),o=P(d);o&&T.push(o),D+=d.size+10}U(b,D)&&(D+=10)}return T},P=function(b){return b.type==="PRIV"?w(b):b.type[0]==="W"?p(b):E(b)},w=function(b){if(b.size<2)return;var D=a(b.data,!0),T=new Uint8Array(b.data.subarray(D.length+1));return{key:b.type,info:D,data:T.buffer}},E=function(b){if(b.size<2)return;if(b.type==="TXXX"){var D=1,T=a(b.data.subarray(D),!0);D+=T.length+1;var g=a(b.data.subarray(D));return{key:b.type,info:T,data:g}}var v=a(b.data.subarray(1));return{key:b.type,data:v}},p=function(b){if(b.type==="WXXX"){if(b.size<2)return;var D=1,T=a(b.data.subarray(D),!0);D+=T.length+1;var g=a(b.data.subarray(D));return{key:b.type,info:T,data:g}}var v=a(b.data);return{key:b.type,data:v}},u=function(b){if(b.data.byteLength===8){var D=new Uint8Array(b.data),T=D[3]&1,g=(D[4]<<23)+(D[5]<<15)+(D[6]<<7)+D[7];return g/=45,T&&(g+=4772185884e-2),Math.round(g)}return},a=function(b,D){D===void 0&&(D=!1);var T=k();if(T){var g=T.decode(b);if(D){var v=g.indexOf("\0");return v!==-1?g.substring(0,v):g}return g.replace(/\0/g,"")}for(var d=b.length,o,C,S,y="",M=0;M<d;){if(o=b[M++],o===0&&D)return y;if(o===0||o===3)continue;switch(o>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:y+=String.fromCharCode(o);break;case 12:case 13:C=b[M++],y+=String.fromCharCode((o&31)<<6|C&63);break;case 14:C=b[M++],S=b[M++],y+=String.fromCharCode((o&15)<<12|(C&63)<<6|(S&63)<<0);break;default:}}return y},s={decodeTextFrame:E},h;function k(){return!h&&typeof self.TextDecoder!="undefined"&&(h=new self.TextDecoder("utf-8")),h}},"./src/demux/mp3demuxer.ts":function(ne,$,R){"use strict";R.r($);var Q=R("./src/demux/base-audio-demuxer.ts"),U=R("./src/demux/id3.ts"),O=R("./src/utils/logger.ts"),j=R("./src/demux/mpegaudio.ts");function N(f,x){f.prototype=Object.create(x.prototype),f.prototype.constructor=f,_(f,x)}function _(f,x){return _=Object.setPrototypeOf||function(w,E){return w.__proto__=E,w},_(f,x)}var A=function(f){N(x,f);function x(){return f.apply(this,arguments)||this}var P=x.prototype;return P.resetInitSegment=function(E,p,u){f.prototype.resetInitSegment.call(this,E,p,u),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:E,duration:u,inputTimeScale:9e4,dropped:0}},x.probe=function(E){if(!E)return!1;for(var p=U.getID3Data(E,0)||[],u=p.length,a=E.length;u<a;u++)if(j.probe(E,u))return O.logger.log("MPEG Audio sync word found !"),!0;return!1},P.canParse=function(E,p){return j.canParse(E,p)},P.appendFrame=function(E,p,u){return this.initPTS===null?void 0:j.appendFrame(E,p,u,this.initPTS,this.frameIndex)},x}(Q.default);A.minProbeByteLength=4,$.default=A},"./src/demux/mp4demuxer.ts":function(ne,$,R){"use strict";R.r($);var Q=R("./src/utils/mp4-tools.ts"),U=R("./src/demux/dummy-demuxed-track.ts"),O=function(){function j(_,A){this.remainderData=null,this.config=void 0,this.config=A}var N=j.prototype;return N.resetTimeStamp=function(){},N.resetInitSegment=function(){},N.resetContiguity=function(){},j.probe=function(A){return Object(Q.findBox)({data:A,start:0,end:Math.min(A.length,16384)},["moof"]).length>0},N.demux=function(A){var f=A,x=Object(U.dummyTrack)();if(this.config.progressive){this.remainderData&&(f=Object(Q.appendUint8Array)(this.remainderData,A));var P=Object(Q.segmentValidRange)(f);this.remainderData=P.remainder,x.samples=P.valid||new Uint8Array}else x.samples=f;return{audioTrack:Object(U.dummyTrack)(),avcTrack:x,id3Track:Object(U.dummyTrack)(),textTrack:Object(U.dummyTrack)()}},N.flush=function(){var A=Object(U.dummyTrack)();return A.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(U.dummyTrack)(),avcTrack:A,id3Track:Object(U.dummyTrack)(),textTrack:Object(U.dummyTrack)()}},N.demuxSampleAes=function(A,f,x){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},N.destroy=function(){},j}();O.minProbeByteLength=1024,$.default=O},"./src/demux/mpegaudio.ts":function(ne,$,R){"use strict";R.r($),R.d($,"appendFrame",function(){return _}),R.d($,"parseHeader",function(){return A}),R.d($,"isHeaderPattern",function(){return f}),R.d($,"isHeader",function(){return x}),R.d($,"canParse",function(){return P}),R.d($,"probe",function(){return w});var Q=null,U=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],O=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],j=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],N=[0,1,1,4];function _(E,p,u,a,s){if(u+24>p.length)return;var h=A(p,u);if(h&&u+h.frameLength<=p.length){var k=h.samplesPerFrame*9e4/h.sampleRate,c=a+s*k,b={unit:p.subarray(u,u+h.frameLength),pts:c,dts:c};return E.config=[],E.channelCount=h.channelCount,E.samplerate=h.sampleRate,E.samples.push(b),{sample:b,length:h.frameLength,missing:0}}}function A(E,p){var u=E[p+1]>>3&3,a=E[p+1]>>1&3,s=E[p+2]>>4&15,h=E[p+2]>>2&3;if(u!==1&&s!==0&&s!==15&&h!==3){var k=E[p+2]>>1&1,c=E[p+3]>>6,b=u===3?3-a:a===3?3:4,D=U[b*14+s-1]*1e3,T=u===3?0:u===2?1:2,g=O[T*3+h],v=c===3?1:2,d=j[u][a],o=N[a],C=d*8*o,S=Math.floor(d*D/g+k)*o;if(Q===null){var y=navigator.userAgent||"",M=y.match(/Chrome\/(\d+)/i);Q=M?parseInt(M[1]):0}var F=!!Q&&Q<=87;return F&&a===2&&D>=224e3&&c===0&&(E[p+3]=E[p+3]|128),{sampleRate:g,channelCount:v,frameLength:S,samplesPerFrame:C}}}function f(E,p){return E[p]===255&&(E[p+1]&224)===224&&(E[p+1]&6)!==0}function x(E,p){return p+1<E.length&&f(E,p)}function P(E,p){var u=4;return f(E,p)&&u<=E.length-p}function w(E,p){if(p+1<E.length&&f(E,p)){var u=4,a=A(E,p),s=u;a!=null&&a.frameLength&&(s=a.frameLength);var h=p+s;return h===E.length||x(E,h)}return!1}},"./src/demux/sample-aes.ts":function(ne,$,R){"use strict";R.r($);var Q=R("./src/crypt/decrypter.ts"),U=R("./src/demux/tsdemuxer.ts"),O=function(){function j(_,A,f){this.keyData=void 0,this.decrypter=void 0,this.keyData=f,this.decrypter=new Q.default(_,A,{removePKCS7Padding:!1})}var N=j.prototype;return N.decryptBuffer=function(A,f){this.decrypter.decrypt(A,this.keyData.key.buffer,this.keyData.iv.buffer,f)},N.decryptAacSample=function(A,f,x,P){var w=A[f].unit,E=w.subarray(16,w.length-w.length%16),p=E.buffer.slice(E.byteOffset,E.byteOffset+E.length),u=this;this.decryptBuffer(p,function(a){var s=new Uint8Array(a);w.set(s,16),P||u.decryptAacSamples(A,f+1,x)})},N.decryptAacSamples=function(A,f,x){for(;;f++){if(f>=A.length){x();return}if(A[f].unit.length<32)continue;var P=this.decrypter.isSync();if(this.decryptAacSample(A,f,x,P),!P)return}},N.getAvcEncryptedData=function(A){for(var f=Math.floor((A.length-48)/160)*16+16,x=new Int8Array(f),P=0,w=32;w<=A.length-16;w+=160,P+=16)x.set(A.subarray(w,w+16),P);return x},N.getAvcDecryptedUnit=function(A,f){for(var x=new Uint8Array(f),P=0,w=32;w<=A.length-16;w+=160,P+=16)A.set(x.subarray(P,P+16),w);return A},N.decryptAvcSample=function(A,f,x,P,w,E){var p=Object(U.discardEPB)(w.data),u=this.getAvcEncryptedData(p),a=this;this.decryptBuffer(u.buffer,function(s){w.data=a.getAvcDecryptedUnit(p,s),E||a.decryptAvcSamples(A,f,x+1,P)})},N.decryptAvcSamples=function(A,f,x,P){if(A instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;f++,x=0){if(f>=A.length){P();return}for(var w=A[f].units;!(x>=w.length);x++){var E=w[x];if(E.data.length<=48||E.type!==1&&E.type!==5)continue;var p=this.decrypter.isSync();if(this.decryptAvcSample(A,f,x,P,E,p),!p)return}}},j}();$.default=O},"./src/demux/transmuxer-interface.ts":function(ne,$,R){"use strict";R.r($),R.d($,"default",function(){return w});var Q=R("./node_modules/webworkify-webpack/index.js"),U=R.n(Q),O=R("./src/events.ts"),j=R("./src/demux/transmuxer.ts"),N=R("./src/utils/logger.ts"),_=R("./src/errors.ts"),A=R("./src/utils/mediasource-helper.ts"),f=R("./node_modules/eventemitter3/index.js"),x=R.n(f),P=Object(A.getMediaSource)()||{isTypeSupported:function(){return!1}},w=function(){function E(u,a,s,h){var k=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=u,this.id=a,this.onTransmuxComplete=s,this.onFlush=h;var c=u.config,b=function(d,o){o=o||{},o.frag=k.frag,o.id=k.id,u.trigger(d,o)};this.observer=new f.EventEmitter,this.observer.on(O.Events.FRAG_DECRYPTED,b),this.observer.on(O.Events.ERROR,b);var D={mp4:P.isTypeSupported("video/mp4"),mpeg:P.isTypeSupported("audio/mpeg"),mp3:P.isTypeSupported('audio/mp4; codecs="mp3"')},T=navigator.vendor;if(c.enableWorker&&typeof Worker!="undefined"){N.logger.log("demuxing in webworker");var g;try{g=this.worker=Q("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),g.addEventListener("message",this.onwmsg),g.onerror=function(v){u.trigger(O.Events.ERROR,{type:_.ErrorTypes.OTHER_ERROR,details:_.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(v.message+" ("+v.filename+":"+v.lineno+")")})},g.postMessage({cmd:"init",typeSupported:D,vendor:T,id:a,config:JSON.stringify(c)})}catch(v){N.logger.warn("Error in worker:",v),N.logger.error("Error while initializing DemuxerWorker, fallback to inline"),g&&self.URL.revokeObjectURL(g.objectURL),this.transmuxer=new j.default(this.observer,D,c,T,a),this.worker=null}}else this.transmuxer=new j.default(this.observer,D,c,T,a)}var p=E.prototype;return p.destroy=function(){var a=this.worker;if(a)a.removeEventListener("message",this.onwmsg),a.terminate(),this.worker=null;else{var s=this.transmuxer;s&&(s.destroy(),this.transmuxer=null)}var h=this.observer;h&&h.removeAllListeners(),this.observer=null},p.push=function(a,s,h,k,c,b,D,T,g,v){var d=this;g.transmuxing.start=self.performance.now();var o=this.transmuxer,C=this.worker,S=b?b.start:c.start,y=c.decryptdata,M=this.frag,F=!(M&&c.cc===M.cc),W=!(M&&g.level===M.level),V=M?g.sn-M.sn:-1,I=this.part?g.part-this.part.index:1,B=!W&&(V===1||V===0&&I===1),X=self.performance.now();(W||V||c.stats.parsing.start===0)&&(c.stats.parsing.start=X),b&&(I||!B)&&(b.stats.parsing.start=X);var ee=new j.TransmuxState(F,B,T,W,S);if(!B||F){N.logger.log("[transmuxer-interface, "+c.type+"]: Starting new transmux session for sn: "+g.sn+" p: "+g.part+" level: "+g.level+" id: "+g.id+`
discontinuity: `+F+`
trackSwitch: `+W+`
contiguous: `+B+`
accurateTimeOffset: `+T+`
timeOffset: `+S);var oe=new j.TransmuxConfig(h,k,s,D,v);this.configureTransmuxer(oe)}if(this.frag=c,this.part=b,C)C.postMessage({cmd:"demux",data:a,decryptdata:y,chunkMeta:g,state:ee},a instanceof ArrayBuffer?[a]:[]);else if(o){var fe=o.push(a,y,g,ee);Object(j.isPromise)(fe)?fe.then(function(ke){d.handleTransmuxComplete(ke)}):this.handleTransmuxComplete(fe)}},p.flush=function(a){var s=this;a.transmuxing.start=self.performance.now();var h=this.transmuxer,k=this.worker;if(k)k.postMessage({cmd:"flush",chunkMeta:a});else if(h){var c=h.flush(a);Object(j.isPromise)(c)?c.then(function(b){s.handleFlushResult(b,a)}):this.handleFlushResult(c,a)}},p.handleFlushResult=function(a,s){var h=this;a.forEach(function(k){h.handleTransmuxComplete(k)}),this.onFlush(s)},p.onWorkerMessage=function(a){var s=a.data,h=this.hls;switch(s.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(s.data);break}case"flush":{this.onFlush(s.data);break}default:{s.data=s.data||{},s.data.frag=this.frag,s.data.id=this.id,h.trigger(s.event,s.data);break}}},p.configureTransmuxer=function(a){var s=this.worker,h=this.transmuxer;s?s.postMessage({cmd:"configure",config:a}):h&&h.configure(a)},p.handleTransmuxComplete=function(a){a.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(a)},E}()},"./src/demux/transmuxer-worker.ts":function(ne,$,R){"use strict";R.r($),R.d($,"default",function(){return _});var Q=R("./src/demux/transmuxer.ts"),U=R("./src/events.ts"),O=R("./src/utils/logger.ts"),j=R("./node_modules/eventemitter3/index.js"),N=R.n(j);function _(w){var E=new j.EventEmitter,p=function(a,s){w.postMessage({event:a,data:s})};E.on(U.Events.FRAG_DECRYPTED,p),E.on(U.Events.ERROR,p),w.addEventListener("message",function(u){var a=u.data;switch(a.cmd){case"init":{var s=JSON.parse(a.config);w.transmuxer=new Q.default(E,a.typeSupported,s,a.vendor,a.id),Object(O.enableLogs)(s.debug),p("init",null);break}case"configure":{w.transmuxer.configure(a.config);break}case"demux":{var h=w.transmuxer.push(a.data,a.decryptdata,a.chunkMeta,a.state);Object(Q.isPromise)(h)?h.then(function(b){A(w,b)}):A(w,h);break}case"flush":{var k=a.chunkMeta,c=w.transmuxer.flush(k);Object(Q.isPromise)(c)?c.then(function(b){x(w,b,k)}):x(w,c,k);break}default:break}})}function A(w,E){if(P(E.remuxResult))return;var p=[],u=E.remuxResult,a=u.audio,s=u.video;a&&f(p,a),s&&f(p,s),w.postMessage({event:"transmuxComplete",data:E},p)}function f(w,E){E.data1&&w.push(E.data1.buffer),E.data2&&w.push(E.data2.buffer)}function x(w,E,p){E.forEach(function(u){A(w,u)}),w.postMessage({event:"flush",data:p})}function P(w){return!w.audio&&!w.video&&!w.text&&!w.id3&&!w.initSegment}},"./src/demux/transmuxer.ts":function(ne,$,R){"use strict";R.r($),R.d($,"default",function(){return s}),R.d($,"isPromise",function(){return c}),R.d($,"TransmuxConfig",function(){return b}),R.d($,"TransmuxState",function(){return D});var Q=R("./src/events.ts"),U=R("./src/errors.ts"),O=R("./src/crypt/decrypter.ts"),j=R("./src/demux/aacdemuxer.ts"),N=R("./src/demux/mp4demuxer.ts"),_=R("./src/demux/tsdemuxer.ts"),A=R("./src/demux/mp3demuxer.ts"),f=R("./src/remux/mp4-remuxer.ts"),x=R("./src/remux/passthrough-remuxer.ts"),P=R("./src/demux/chunk-cache.ts"),w=R("./src/utils/mp4-tools.ts"),E=R("./src/utils/logger.ts"),p;try{p=self.performance.now.bind(self.performance)}catch(T){E.logger.debug("Unable to use Performance API on this environment"),p=self.Date.now}var u=[{demux:_.default,remux:f.default},{demux:N.default,remux:x.default},{demux:j.default,remux:f.default},{demux:A.default,remux:f.default}],a=1024;u.forEach(function(T){var g=T.demux;a=Math.max(a,g.minProbeByteLength)});var s=function(){function T(v,d,o,C,S){this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.cache=new P.default,this.observer=v,this.typeSupported=d,this.config=o,this.vendor=C,this.id=S}var g=T.prototype;return g.configure=function(d){this.transmuxConfig=d,this.decrypter&&this.decrypter.reset()},g.push=function(d,o,C,S){var y=this,M=C.transmuxing;M.executeStart=p();var F=new Uint8Array(d),W=this.cache,V=this.config,I=this.currentTransmuxState,B=this.transmuxConfig;S&&(this.currentTransmuxState=S);var X=h(F,o);if(X&&X.method==="AES-128"){var ee=this.getDecrypter();if(V.enableSoftwareAES){var oe=ee.softwareDecrypt(F,X.key.buffer,X.iv.buffer);if(!oe)return M.executeEnd=p(),k(C);F=new Uint8Array(oe)}else return this.decryptionPromise=ee.webCryptoDecrypt(F,X.key.buffer,X.iv.buffer).then(function(Me){var Ie=y.push(Me,null,C);return y.decryptionPromise=null,Ie}),this.decryptionPromise}var fe=S||I,ke=fe.contiguous,xe=fe.discontinuity,Te=fe.trackSwitch,Ce=fe.accurateTimeOffset,ge=fe.timeOffset,pe=B.audioCodec,ue=B.videoCodec,te=B.defaultInitPts,de=B.duration,ae=B.initSegmentData;if((xe||Te)&&this.resetInitSegment(ae,pe,ue,de),xe&&this.resetInitialTimestamp(te),ke||this.resetContiguity(),this.needsProbing(F,xe,Te)){if(W.dataLength){var we=W.flush();F=Object(w.appendUint8Array)(we,F)}this.configureTransmuxer(F,B)}var Re=this.transmux(F,X,ge,Ce,C),Ee=this.currentTransmuxState;return Ee.contiguous=!0,Ee.discontinuity=!1,Ee.trackSwitch=!1,M.executeEnd=p(),Re},g.flush=function(d){var o=this,C=d.transmuxing;C.executeStart=p();var S=this.decrypter,y=this.cache,M=this.currentTransmuxState,F=this.decryptionPromise;if(F)return F.then(function(){return o.flush(d)});var W=[],V=M.timeOffset;if(S){var I=S.flush();I&&W.push(this.push(I,null,d))}var B=y.dataLength;y.reset();var X=this.demuxer,ee=this.remuxer;if(!X||!ee)return B>=a&&this.observer.emit(Q.Events.ERROR,Q.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),C.executeEnd=p(),[k(d)];var oe=X.flush(V);return c(oe)?oe.then(function(fe){return o.flushRemux(W,fe,d),W}):(this.flushRemux(W,oe,d),W)},g.flushRemux=function(d,o,C){var S=o.audioTrack,y=o.avcTrack,M=o.id3Track,F=o.textTrack,W=this.currentTransmuxState,V=W.accurateTimeOffset,I=W.timeOffset;E.logger.log("[transmuxer.ts]: Flushed fragment "+C.sn+(C.part>-1?" p: "+C.part:"")+" of level "+C.level);var B=this.remuxer.remux(S,y,M,F,I,V,!0,this.id);d.push({remuxResult:B,chunkMeta:C}),C.transmuxing.executeEnd=p()},g.resetInitialTimestamp=function(d){var o=this.demuxer,C=this.remuxer;if(!o||!C)return;o.resetTimeStamp(d),C.resetTimeStamp(d)},g.resetContiguity=function(){var d=this.demuxer,o=this.remuxer;if(!d||!o)return;d.resetContiguity(),o.resetNextTimestamp()},g.resetInitSegment=function(d,o,C,S){var y=this.demuxer,M=this.remuxer;if(!y||!M)return;y.resetInitSegment(o,C,S),M.resetInitSegment(d,o,C)},g.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},g.transmux=function(d,o,C,S,y){var M;return o&&o.method==="SAMPLE-AES"?M=this.transmuxSampleAes(d,o,C,S,y):M=this.transmuxUnencrypted(d,C,S,y),M},g.transmuxUnencrypted=function(d,o,C,S){var y=this.demuxer.demux(d,o,!1,!this.config.progressive),M=y.audioTrack,F=y.avcTrack,W=y.id3Track,V=y.textTrack,I=this.remuxer.remux(M,F,W,V,o,C,!1,this.id);return{remuxResult:I,chunkMeta:S}},g.transmuxSampleAes=function(d,o,C,S,y){var M=this;return this.demuxer.demuxSampleAes(d,o,C).then(function(F){var W=M.remuxer.remux(F.audioTrack,F.avcTrack,F.id3Track,F.textTrack,C,S,!1,M.id);return{remuxResult:W,chunkMeta:y}})},g.configureTransmuxer=function(d,o){for(var C=this.config,S=this.observer,y=this.typeSupported,M=this.vendor,F=o.audioCodec,W=o.defaultInitPts,V=o.duration,I=o.initSegmentData,B=o.videoCodec,X,ee=0,oe=u.length;ee<oe;ee++)if(u[ee].demux.probe(d)){X=u[ee];break}X||(E.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),X={demux:N.default,remux:x.default});var fe=this.demuxer,ke=this.remuxer,xe=X.remux,Te=X.demux;(!ke||!(ke instanceof xe))&&(this.remuxer=new xe(S,C,y,M)),(!fe||!(fe instanceof Te))&&(this.demuxer=new Te(S,C,y),this.probe=Te.probe),this.resetInitSegment(I,F,B,V),this.resetInitialTimestamp(W)},g.needsProbing=function(d,o,C){return!this.demuxer||!this.remuxer||o||C},g.getDecrypter=function(){var d=this.decrypter;return d||(d=this.decrypter=new O.default(this.observer,this.config)),d},T}();function h(T,g){var v=null;return T.byteLength>0&&g!=null&&g.key!=null&&g.iv!==null&&g.method!=null&&(v=g),v}var k=function(g){return{remuxResult:{},chunkMeta:g}};function c(T){return"then"in T&&T.then instanceof Function}var b=function(g,v,d,o,C){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=g,this.videoCodec=v,this.initSegmentData=d,this.duration=o,this.defaultInitPts=C},D=function(g,v,d,o,C){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=g,this.contiguous=v,this.accurateTimeOffset=d,this.trackSwitch=o,this.timeOffset=C}},"./src/demux/tsdemuxer.ts":function(ne,$,R){"use strict";R.r($),R.d($,"discardEPB",function(){return k});var Q=R("./src/demux/adts.ts"),U=R("./src/demux/mpegaudio.ts"),O=R("./src/demux/exp-golomb.ts"),j=R("./src/demux/id3.ts"),N=R("./src/demux/sample-aes.ts"),_=R("./src/events.ts"),A=R("./src/utils/mp4-tools.ts"),f=R("./src/utils/logger.ts"),x=R("./src/errors.ts"),P={video:1,audio:2,id3:3,text:4},w=function(){function c(D,T,g){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=D,this.config=T,this.typeSupported=g}c.probe=function(T){var g=c.syncOffset(T);return g<0?!1:(g&&f.logger.warn("MPEG2-TS detected but first sync word found @ offset "+g+", junk ahead ?"),!0)},c.syncOffset=function(T){for(var g=Math.min(1e3,T.length-3*188),v=0;v<g;){if(T[v]===71&&T[v+188]===71&&T[v+2*188]===71)return v;v++}return-1},c.createTrack=function(T,g){return{container:T==="video"||T==="audio"?"video/mp2t":void 0,type:T,id:P[T],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:T==="audio"?g:void 0}};var b=c.prototype;return b.resetInitSegment=function(T,g,v){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=c.createTrack("video",v),this._audioTrack=c.createTrack("audio",v),this._id3Track=c.createTrack("id3",v),this._txtTrack=c.createTrack("text",v),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=T,this.videoCodec=g,this._duration=v},b.resetTimeStamp=function(){},b.resetContiguity=function(){var T=this._audioTrack,g=this._avcTrack,v=this._id3Track;T&&(T.pesData=null),g&&(g.pesData=null),v&&(v.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},b.demux=function(T,g,v,d){v===void 0&&(v=!1),d===void 0&&(d=!1),v||(this.sampleAes=null);var o,C=this._avcTrack,S=this._audioTrack,y=this._id3Track,M=C.pid,F=C.pesData,W=S.pid,V=y.pid,I=S.pesData,B=y.pesData,X=!1,ee=this.pmtParsed,oe=this._pmtId,fe=T.length;if(this.remainderData&&(T=Object(A.appendUint8Array)(this.remainderData,T),fe=T.length,this.remainderData=null),fe<188&&!d)return this.remainderData=T,{audioTrack:S,avcTrack:C,id3Track:y,textTrack:this._txtTrack};var ke=Math.max(0,c.syncOffset(T));fe-=(fe+ke)%188,fe<T.byteLength&&!d&&(this.remainderData=new Uint8Array(T.buffer,fe,T.buffer.byteLength-fe));for(var xe=ke;xe<fe;xe+=188)if(T[xe]===71){var Te=!!(T[xe+1]&64),Ce=((T[xe+1]&31)<<8)+T[xe+2],ge=(T[xe+3]&48)>>4,pe=void 0;if(ge>1){if(pe=xe+5+T[xe+4],pe===xe+188)continue}else pe=xe+4;switch(Ce){case M:Te&&(F&&(o=a(F))&&this.parseAVCPES(o,!1),F={data:[],size:0}),F&&(F.data.push(T.subarray(pe,xe+188)),F.size+=xe+188-pe);break;case W:Te&&(I&&(o=a(I))&&(S.isAAC?this.parseAACPES(o):this.parseMPEGPES(o)),I={data:[],size:0}),I&&(I.data.push(T.subarray(pe,xe+188)),I.size+=xe+188-pe);break;case V:Te&&(B&&(o=a(B))&&this.parseID3PES(o),B={data:[],size:0}),B&&(B.data.push(T.subarray(pe,xe+188)),B.size+=xe+188-pe);break;case 0:Te&&(pe+=T[pe]+1),oe=this._pmtId=p(T,pe);break;case oe:{Te&&(pe+=T[pe]+1);var ue=u(T,pe,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,v);M=ue.avc,M>0&&(C.pid=M),W=ue.audio,W>0&&(S.pid=W,S.isAAC=ue.isAAC),V=ue.id3,V>0&&(y.pid=V),X&&!ee&&(f.logger.log("reparse from beginning"),X=!1,xe=ke-188),ee=this.pmtParsed=!0;break}case 17:case 8191:break;default:X=!0;break}}else this.observer.emit(_.Events.ERROR,_.Events.ERROR,{type:x.ErrorTypes.MEDIA_ERROR,details:x.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});C.pesData=F,S.pesData=I,y.pesData=B;var te={audioTrack:S,avcTrack:C,id3Track:y,textTrack:this._txtTrack};return d&&this.extractRemainingSamples(te),te},b.flush=function(){var T=this.remainderData;this.remainderData=null;var g;return T?g=this.demux(T,-1,!1,!0):g={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(g),this.sampleAes?this.decrypt(g,this.sampleAes):g},b.extractRemainingSamples=function(T){var g=T.audioTrack,v=T.avcTrack,d=T.id3Track,o=v.pesData,C=g.pesData,S=d.pesData,y;o&&(y=a(o))?(this.parseAVCPES(y,!0),v.pesData=null):v.pesData=o,C&&(y=a(C))?(g.isAAC?this.parseAACPES(y):this.parseMPEGPES(y),g.pesData=null):(C!=null&&C.size&&f.logger.log("last AAC PES packet truncated,might overlap between fragments"),g.pesData=C),S&&(y=a(S))?(this.parseID3PES(y),d.pesData=null):d.pesData=S},b.demuxSampleAes=function(T,g,v){var d=this.demux(T,v,!0,!this.config.progressive),o=this.sampleAes=new N.default(this.observer,this.config,g);return this.decrypt(d,o)},b.decrypt=function(T,g){return new Promise(function(v){var d=T.audioTrack,o=T.avcTrack;d.samples&&d.isAAC?g.decryptAacSamples(d.samples,0,function(){o.samples?g.decryptAvcSamples(o.samples,0,0,function(){v(T)}):v(T)}):o.samples&&g.decryptAvcSamples(o.samples,0,0,function(){v(T)})})},b.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},b.parseAVCPES=function(T,g){var v=this,d=this._avcTrack,o=this.parseAVCNALu(T.data),C=!1,S=this.avcSample,y,M=!1;T.data=null,S&&o.length&&!d.audFound&&(s(S,d),S=this.avcSample=E(!1,T.pts,T.dts,"")),o.forEach(function(F){switch(F.type){case 1:{y=!0,S||(S=v.avcSample=E(!0,T.pts,T.dts,"")),C&&(S.debug+="NDR "),S.frame=!0;var W=F.data;if(M&&W.length>4){var V=new O.default(W).readSliceType();(V===2||V===4||V===7||V===9)&&(S.key=!0)}break}case 5:y=!0,S||(S=v.avcSample=E(!0,T.pts,T.dts,"")),C&&(S.debug+="IDR "),S.key=!0,S.frame=!0;break;case 6:{y=!0,C&&S&&(S.debug+="SEI ");var I=new O.default(k(F.data));I.readUByte();for(var B=0,X=0,ee=!1,oe=0;!ee&&I.bytesAvailable>1;){B=0;do oe=I.readUByte(),B+=oe;while(oe===255);X=0;do oe=I.readUByte(),X+=oe;while(oe===255);if(B===4&&I.bytesAvailable!==0){ee=!0;var fe=I.readUByte();if(fe===181){var ke=I.readUShort();if(ke===49){var xe=I.readUInt();if(xe===1195456820){var Te=I.readUByte();if(Te===3){for(var Ce=I.readUByte(),ge=I.readUByte(),pe=31&Ce,ue=[Ce,ge],te=0;te<pe;te++)ue.push(I.readUByte()),ue.push(I.readUByte()),ue.push(I.readUByte());h(v._txtTrack.samples,{type:3,pts:T.pts,bytes:ue})}}}}}else if(B===5&&I.bytesAvailable!==0){if(ee=!0,X>16){for(var de=[],ae=0;ae<16;ae++)de.push(I.readUByte().toString(16)),(ae===3||ae===5||ae===7||ae===9)&&de.push("-");for(var we=X-16,Re=new Uint8Array(we),Ee=0;Ee<we;Ee++)Re[Ee]=I.readUByte();h(v._txtTrack.samples,{pts:T.pts,payloadType:B,uuid:de.join(""),userData:Object(j.utf8ArrayToStr)(Re),userDataBytes:Re})}}else if(X<I.bytesAvailable)for(var Me=0;Me<X;Me++)I.readUByte()}break}case 7:if(y=!0,M=!0,C&&S&&(S.debug+="SPS "),!d.sps){var Ie=new O.default(F.data),We=Ie.readSPS();d.width=We.width,d.height=We.height,d.pixelRatio=We.pixelRatio,d.sps=[F.data],d.duration=v._duration;for(var je=F.data.subarray(1,4),Be="avc1.",Ue=0;Ue<3;Ue++){var et=je[Ue].toString(16);et.length<2&&(et="0"+et),Be+=et}d.codec=Be}break;case 8:y=!0,C&&S&&(S.debug+="PPS "),d.pps||(d.pps=[F.data]);break;case 9:y=!1,d.audFound=!0,S&&s(S,d),S=v.avcSample=E(!1,T.pts,T.dts,C?"AUD ":"");break;case 12:y=!1;break;default:y=!1,S&&(S.debug+="unknown NAL "+F.type+" ");break}if(S&&y){var ot=S.units;ot.push(F)}}),g&&S&&(s(S,d),this.avcSample=null)},b.getLastNalUnit=function(){var T,g=this.avcSample,v;if(!g||g.units.length===0){var d=this._avcTrack.samples;g=d[d.length-1]}if((T=g)!==null&&T!==void 0&&T.units){var o=g.units;v=o[o.length-1]}return v},b.parseAVCNALu=function(T){var g=T.byteLength,v=this._avcTrack,d=v.naluState||0,o=d,C=[],S=0,y,M,F,W=-1,V=0;for(d===-1&&(W=0,V=T[0]&31,d=0,S=1);S<g;){if(y=T[S++],!d){d=y?0:1;continue}if(d===1){d=y?0:2;continue}if(!y)d=3;else if(y===1){if(W>=0){var I={data:T.subarray(W,S-d-1),type:V};C.push(I)}else{var B=this.getLastNalUnit();if(B&&(o&&S<=4-o&&(B.state&&(B.data=B.data.subarray(0,B.data.byteLength-o))),M=S-d-1,M>0)){var X=new Uint8Array(B.data.byteLength+M);X.set(B.data,0),X.set(T.subarray(0,M),B.data.byteLength),B.data=X,B.state=0}}S<g?(F=T[S]&31,W=S,V=F,d=0):d=-1}else d=0}if(W>=0&&d>=0){var ee={data:T.subarray(W,g),type:V,state:d};C.push(ee)}if(C.length===0){var oe=this.getLastNalUnit();if(oe){var fe=new Uint8Array(oe.data.byteLength+T.byteLength);fe.set(oe.data,0),fe.set(T,oe.data.byteLength),oe.data=fe}}return v.naluState=d,C},b.parseAACPES=function(T){var g=0,v=this._audioTrack,d=this.aacOverFlow,o=T.data;if(d){this.aacOverFlow=null;var C=d.sample.unit.byteLength,S=Math.min(d.missing,C),y=C-S;d.sample.unit.set(o.subarray(0,S),y),v.samples.push(d.sample),g=d.missing}var M,F;for(M=g,F=o.length;M<F-1&&!Q.isHeader(o,M);M++);if(M!==g){var W,V;if(M<F-1?(W="AAC PES did not start with ADTS header,offset:"+M,V=!1):(W="no ADTS header found in AAC PES",V=!0),f.logger.warn("parsing error:"+W),this.observer.emit(_.Events.ERROR,_.Events.ERROR,{type:x.ErrorTypes.MEDIA_ERROR,details:x.ErrorDetails.FRAG_PARSING_ERROR,fatal:V,reason:W}),V)return}Q.initTrackConfig(v,this.observer,o,M,this.audioCodec);var I;if(T.pts!==void 0)I=T.pts;else if(d){var B=Q.getFrameDuration(v.samplerate);I=d.sample.pts+B}else{f.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var X=0;M<F;)if(Q.isHeader(o,M)){if(M+5<F){var ee=Q.appendFrame(v,o,M,I,X);if(ee)if(ee.missing)this.aacOverFlow=ee;else{M+=ee.length,X++;continue}}break}else M++},b.parseMPEGPES=function(T){var g=T.data,v=g.length,d=0,o=0,C=T.pts;if(C===void 0){f.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;o<v;)if(U.isHeader(g,o)){var S=U.appendFrame(this._audioTrack,g,o,C,d);if(S)o+=S.length,d++;else break}else o++},b.parseID3PES=function(T){if(T.pts===void 0){f.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(T)},c}();w.minProbeByteLength=188;function E(c,b,D,T){return{key:c,frame:!1,pts:b,dts:D,units:[],debug:T,length:0}}function p(c,b){return(c[b+10]&31)<<8|c[b+11]}function u(c,b,D,T){var g={audio:-1,avc:-1,id3:-1,isAAC:!0},v=(c[b+1]&15)<<8|c[b+2],d=b+3+v-4,o=(c[b+10]&15)<<8|c[b+11];for(b+=12+o;b<d;){var C=(c[b+1]&31)<<8|c[b+2];switch(c[b]){case 207:if(!T){f.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:g.audio===-1&&(g.audio=C);break;case 21:g.id3===-1&&(g.id3=C);break;case 219:if(!T){f.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:g.avc===-1&&(g.avc=C);break;case 3:case 4:D?g.audio===-1&&(g.audio=C,g.isAAC=!1):f.logger.log("MPEG audio found, not supported in this browser");break;case 36:f.logger.warn("Unsupported HEVC stream type found");break;default:break}b+=((c[b+3]&15)<<8|c[b+4])+5}return g}function a(c){var b=0,D,T,g,v,d,o=c.data;if(!c||c.size===0)return null;for(;o[0].length<19&&o.length>1;){var C=new Uint8Array(o[0].length+o[1].length);C.set(o[0]),C.set(o[1],o[0].length),o[0]=C,o.splice(1,1)}D=o[0];var S=(D[0]<<16)+(D[1]<<8)+D[2];if(S===1){if(T=(D[4]<<8)+D[5],T&&T>c.size-6)return null;var y=D[7];y&192&&(v=(D[9]&14)*536870912+(D[10]&255)*4194304+(D[11]&254)*16384+(D[12]&255)*128+(D[13]&254)/2,y&64?(d=(D[14]&14)*536870912+(D[15]&255)*4194304+(D[16]&254)*16384+(D[17]&255)*128+(D[18]&254)/2,v-d>60*9e4&&(f.logger.warn(Math.round((v-d)/9e4)+"s delta between PTS and DTS, align them"),v=d)):d=v),g=D[8];var M=g+9;if(c.size<=M)return null;c.size-=M;for(var F=new Uint8Array(c.size),W=0,V=o.length;W<V;W++){D=o[W];var I=D.byteLength;if(M)if(M>I){M-=I;continue}else D=D.subarray(M),I-=M,M=0;F.set(D,b),b+=I}return T&&(T-=g+3),{data:F,pts:v,dts:d,len:T}}return null}function s(c,b){if(c.units.length&&c.frame){if(c.pts===void 0){var D=b.samples,T=D.length;if(T){var g=D[T-1];c.pts=g.pts,c.dts=g.dts}else{b.dropped++;return}}b.samples.push(c)}c.debug.length&&f.logger.log(c.pts+"/"+c.dts+":"+c.debug)}function h(c,b){var D=c.length;if(D>0){if(b.pts>=c[D-1].pts)c.push(b);else for(var T=D-1;T>=0;T--)if(b.pts<c[T].pts){c.splice(T,0,b);break}}else c.push(b)}function k(c){for(var b=c.byteLength,D=[],T=1;T<b-2;)c[T]===0&&c[T+1]===0&&c[T+2]===3?(D.push(T+2),T+=2):T++;if(D.length===0)return c;var g=b-D.length,v=new Uint8Array(g),d=0;for(T=0;T<g;d++,T++)d===D[0]&&(d++,D.shift()),v[T]=c[d];return v}$.default=w},"./src/errors.ts":function(ne,$,R){"use strict";R.r($),R.d($,"ErrorTypes",function(){return Q}),R.d($,"ErrorDetails",function(){return U});var Q;(function(O){O.NETWORK_ERROR="networkError",O.MEDIA_ERROR="mediaError",O.KEY_SYSTEM_ERROR="keySystemError",O.MUX_ERROR="muxError",O.OTHER_ERROR="otherError"})(Q||(Q={}));var U;(function(O){O.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",O.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",O.KEY_SYSTEM_NO_SESSION="keySystemNoSession",O.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",O.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",O.MANIFEST_LOAD_ERROR="manifestLoadError",O.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",O.MANIFEST_PARSING_ERROR="manifestParsingError",O.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",O.LEVEL_EMPTY_ERROR="levelEmptyError",O.LEVEL_LOAD_ERROR="levelLoadError",O.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",O.LEVEL_SWITCH_ERROR="levelSwitchError",O.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",O.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",O.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",O.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",O.FRAG_LOAD_ERROR="fragLoadError",O.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",O.FRAG_DECRYPT_ERROR="fragDecryptError",O.FRAG_PARSING_ERROR="fragParsingError",O.REMUX_ALLOC_ERROR="remuxAllocError",O.KEY_LOAD_ERROR="keyLoadError",O.KEY_LOAD_TIMEOUT="keyLoadTimeOut",O.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",O.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",O.BUFFER_APPEND_ERROR="bufferAppendError",O.BUFFER_APPENDING_ERROR="bufferAppendingError",O.BUFFER_STALLED_ERROR="bufferStalledError",O.BUFFER_FULL_ERROR="bufferFullError",O.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",O.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",O.INTERNAL_EXCEPTION="internalException",O.INTERNAL_ABORTED="aborted",O.UNKNOWN="unknown"})(U||(U={}))},"./src/events.ts":function(ne,$,R){"use strict";R.r($),R.d($,"Events",function(){return Q});var Q;(function(U){U.MEDIA_ATTACHING="hlsMediaAttaching",U.MEDIA_ATTACHED="hlsMediaAttached",U.MEDIA_DETACHING="hlsMediaDetaching",U.MEDIA_DETACHED="hlsMediaDetached",U.BUFFER_RESET="hlsBufferReset",U.BUFFER_CODECS="hlsBufferCodecs",U.BUFFER_CREATED="hlsBufferCreated",U.BUFFER_APPENDING="hlsBufferAppending",U.BUFFER_APPENDED="hlsBufferAppended",U.BUFFER_EOS="hlsBufferEos",U.BUFFER_FLUSHING="hlsBufferFlushing",U.BUFFER_FLUSHED="hlsBufferFlushed",U.MANIFEST_LOADING="hlsManifestLoading",U.MANIFEST_LOADED="hlsManifestLoaded",U.MANIFEST_PARSED="hlsManifestParsed",U.LEVEL_SWITCHING="hlsLevelSwitching",U.LEVEL_SWITCHED="hlsLevelSwitched",U.LEVEL_LOADING="hlsLevelLoading",U.LEVEL_LOADED="hlsLevelLoaded",U.LEVEL_UPDATED="hlsLevelUpdated",U.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",U.LEVELS_UPDATED="hlsLevelsUpdated",U.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",U.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",U.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",U.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",U.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",U.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",U.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",U.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",U.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",U.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",U.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",U.CUES_PARSED="hlsCuesParsed",U.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",U.INIT_PTS_FOUND="hlsInitPtsFound",U.FRAG_LOADING="hlsFragLoading",U.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",U.FRAG_LOADED="hlsFragLoaded",U.FRAG_DECRYPTED="hlsFragDecrypted",U.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",U.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",U.FRAG_PARSING_METADATA="hlsFragParsingMetadata",U.FRAG_PARSED="hlsFragParsed",U.FRAG_BUFFERED="hlsFragBuffered",U.FRAG_CHANGED="hlsFragChanged",U.FPS_DROP="hlsFpsDrop",U.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",U.ERROR="hlsError",U.DESTROYING="hlsDestroying",U.KEY_LOADING="hlsKeyLoading",U.KEY_LOADED="hlsKeyLoaded",U.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",U.BACK_BUFFER_REACHED="hlsBackBufferReached"})(Q||(Q={}))},"./src/hls.ts":function(ne,$,R){"use strict";R.r($),R.d($,"default",function(){return c});var Q=R("./node_modules/url-toolkit/src/url-toolkit.js"),U=R.n(Q),O=R("./src/loader/playlist-loader.ts"),j=R("./src/loader/key-loader.ts"),N=R("./src/controller/id3-track-controller.ts"),_=R("./src/controller/latency-controller.ts"),A=R("./src/controller/level-controller.ts"),f=R("./src/controller/fragment-tracker.ts"),x=R("./src/controller/stream-controller.ts"),P=R("./src/is-supported.ts"),w=R("./src/utils/logger.ts"),E=R("./src/config.ts"),p=R("./node_modules/eventemitter3/index.js"),u=R.n(p),a=R("./src/events.ts"),s=R("./src/errors.ts");function h(b,D){for(var T=0;T<D.length;T++){var g=D[T];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(b,g.key,g)}}function k(b,D,T){return D&&h(b.prototype,D),T&&h(b,T),b}var c=function(){b.isSupported=function(){return Object(P.isSupported)()};function b(T){T===void 0&&(T={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new p.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 g=this.config=Object(E.mergeConfig)(b.DefaultConfig,T);this.userConfig=T,Object(w.enableLogs)(g.debug),this._autoLevelCapping=-1,g.progressive&&Object(E.enableStreamingMode)(g);var v=g.abrController,d=g.bufferController,o=g.capLevelController,C=g.fpsController,S=this.abrController=new v(this),y=this.bufferController=new d(this),M=this.capLevelController=new o(this),F=new C(this),W=new O.default(this),V=new j.default(this),I=new N.default(this),B=this.levelController=new A.default(this),X=new f.FragmentTracker(this),ee=this.streamController=new x.default(this,X);M.setStreamController(ee),F.setStreamController(ee);var oe=[B,ee];this.networkControllers=oe;var fe=[W,V,S,y,M,F,I,X];this.audioTrackController=this.createController(g.audioTrackController,null,oe),this.createController(g.audioStreamController,X,oe),this.subtitleTrackController=this.createController(g.subtitleTrackController,null,oe),this.createController(g.subtitleStreamController,X,oe),this.createController(g.timelineController,null,fe),this.emeController=this.createController(g.emeController,null,fe),this.cmcdController=this.createController(g.cmcdController,null,fe),this.latencyController=this.createController(_.default,null,fe),this.coreComponents=fe}var D=b.prototype;return D.createController=function(g,v,d){if(g){var o=v?new g(this,v):new g(this);return d&&d.push(o),o}return null},D.on=function(g,v,d){d===void 0&&(d=this),this._emitter.on(g,v,d)},D.once=function(g,v,d){d===void 0&&(d=this),this._emitter.once(g,v,d)},D.removeAllListeners=function(g){this._emitter.removeAllListeners(g)},D.off=function(g,v,d,o){d===void 0&&(d=this),this._emitter.off(g,v,d,o)},D.listeners=function(g){return this._emitter.listeners(g)},D.emit=function(g,v,d){return this._emitter.emit(g,v,d)},D.trigger=function(g,v){if(this.config.debug)return this.emit(g,g,v);try{return this.emit(g,g,v)}catch(d){w.logger.error("An internal error happened while handling event "+g+'. Error message: "'+d.message+'". Here is a stacktrace:',d),this.trigger(a.Events.ERROR,{type:s.ErrorTypes.OTHER_ERROR,details:s.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:g,error:d})}return!1},D.listenerCount=function(g){return this._emitter.listenerCount(g)},D.destroy=function(){w.logger.log("destroy"),this.trigger(a.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(g){return g.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(g){return g.destroy()}),this.coreComponents.length=0},D.attachMedia=function(g){w.logger.log("attachMedia"),this._media=g,this.trigger(a.Events.MEDIA_ATTACHING,{media:g})},D.detachMedia=function(){w.logger.log("detachMedia"),this.trigger(a.Events.MEDIA_DETACHING,void 0),this._media=null},D.loadSource=function(g){this.stopLoad();var v=this.media,d=this.url,o=this.url=Q.buildAbsoluteURL(self.location.href,g,{alwaysNormalize:!0});w.logger.log("loadSource:"+o),v&&d&&d!==o&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(v)),this.trigger(a.Events.MANIFEST_LOADING,{url:g})},D.startLoad=function(g){g===void 0&&(g=-1),w.logger.log("startLoad("+g+")"),this.networkControllers.forEach(function(v){v.startLoad(g)})},D.stopLoad=function(){w.logger.log("stopLoad"),this.networkControllers.forEach(function(g){g.stopLoad()})},D.swapAudioCodec=function(){w.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},D.recoverMediaError=function(){w.logger.log("recoverMediaError");var g=this._media;this.detachMedia(),g&&this.attachMedia(g)},D.removeLevel=function(g,v){v===void 0&&(v=0),this.levelController.removeLevel(g,v)},k(b,[{key:"levels",get:function(){var g=this.levelController.levels;return g||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(g){w.logger.log("set currentLevel:"+g),this.loadLevel=g,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(g){w.logger.log("set nextLevel:"+g),this.levelController.manualLevel=g,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(g){w.logger.log("set loadLevel:"+g),this.levelController.manualLevel=g}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(g){this.levelController.nextLoadLevel=g}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(g){w.logger.log("set firstLevel:"+g),this.levelController.firstLevel=g}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(g){w.logger.log("set startLevel:"+g),g!==-1&&(g=Math.max(g,this.minAutoLevel)),this.levelController.startLevel=g}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(g){var v=!!g;v!==this.config.capLevelToPlayerSize&&(v?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=v)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(g){this._autoLevelCapping!==g&&(w.logger.log("set autoLevelCapping:"+g),this._autoLevelCapping=g)}},{key:"bandwidthEstimate",get:function(){var g=this.abrController.bwEstimator;return g?g.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var g=this.levels,v=this.config.minAutoBitrate;if(!g)return 0;for(var d=g.length,o=0;o<d;o++)if(g[o].maxBitrate>v)return o;return 0}},{key:"maxAutoLevel",get:function(){var g=this.levels,v=this.autoLevelCapping,d;return v===-1&&g&&g.length?d=g.length-1:d=v,d}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(g){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,g)}},{key:"audioTracks",get:function(){var g=this.audioTrackController;return g?g.audioTracks:[]}},{key:"audioTrack",get:function(){var g=this.audioTrackController;return g?g.audioTrack:-1},set:function(g){var v=this.audioTrackController;v&&(v.audioTrack=g)}},{key:"subtitleTracks",get:function(){var g=this.subtitleTrackController;return g?g.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var g=this.subtitleTrackController;return g?g.subtitleTrack:-1},set:function(g){var v=this.subtitleTrackController;v&&(v.subtitleTrack=g)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var g=this.subtitleTrackController;return g?g.subtitleDisplay:!1},set:function(g){var v=this.subtitleTrackController;v&&(v.subtitleDisplay=g)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(g){this.config.lowLatencyMode=g}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}],[{key:"version",get:function(){return"1.1.2"}},{key:"Events",get:function(){return a.Events}},{key:"ErrorTypes",get:function(){return s.ErrorTypes}},{key:"ErrorDetails",get:function(){return s.ErrorDetails}},{key:"DefaultConfig",get:function(){return b.defaultConfig?b.defaultConfig:E.hlsDefaultConfig},set:function(g){b.defaultConfig=g}}]),b}();c.defaultConfig=void 0},"./src/is-supported.ts":function(ne,$,R){"use strict";R.r($),R.d($,"isSupported",function(){return O}),R.d($,"changeTypeSupported",function(){return j});var Q=R("./src/utils/mediasource-helper.ts");function U(){return self.SourceBuffer||self.WebKitSourceBuffer}function O(){var N=Object(Q.getMediaSource)();if(!N)return!1;var _=U(),A=N&&typeof N.isTypeSupported=="function"&&N.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),f=!_||_.prototype&&typeof _.prototype.appendBuffer=="function"&&typeof _.prototype.remove=="function";return!!A&&!!f}function j(){var N,_=U();return typeof(_==null||((N=_.prototype)===null||N===void 0)?void 0:N.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(ne,$,R){"use strict";R.r($),R.d($,"default",function(){return w}),R.d($,"LoadError",function(){return p});var Q=R("./src/polyfills/number.ts"),U=R("./src/errors.ts");function O(u,a){u.prototype=Object.create(a.prototype),u.prototype.constructor=u,f(u,a)}function j(u){var a=typeof Map=="function"?new Map:void 0;return j=function(h){if(h===null||!A(h))return h;if(typeof h!="function")throw new TypeError("Super expression must either be null or a function");if(typeof a!="undefined"){if(a.has(h))return a.get(h);a.set(h,k)}function k(){return N(h,arguments,x(this).constructor)}return k.prototype=Object.create(h.prototype,{constructor:{value:k,enumerable:!1,writable:!0,configurable:!0}}),f(k,h)},j(u)}function N(u,a,s){return _()?N=Reflect.construct:N=function(k,c,b){var D=[null];D.push.apply(D,c);var T=Function.bind.apply(k,D),g=new T;return b&&f(g,b.prototype),g},N.apply(null,arguments)}function _(){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 A(u){return Function.toString.call(u).indexOf("[native code]")!==-1}function f(u,a){return f=Object.setPrototypeOf||function(h,k){return h.__proto__=k,h},f(u,a)}function x(u){return x=Object.setPrototypeOf?Object.getPrototypeOf:function(s){return s.__proto__||Object.getPrototypeOf(s)},x(u)}var P=Math.pow(2,17),w=function(){function u(s){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=s}var a=u.prototype;return a.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},a.abort=function(){this.loader&&this.loader.abort()},a.load=function(h,k){var c=this,b=h.url;if(!b)return Promise.reject(new p({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:h,networkDetails:null},"Fragment does not have a "+(b?"part list":"url")));this.abort();var D=this.config,T=D.fLoader,g=D.loader;return new Promise(function(v,d){c.loader&&c.loader.destroy();var o=c.loader=h.loader=T?new T(D):new g(D),C=E(h),S={timeout:D.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:D.fragLoadingMaxRetryTimeout,highWaterMark:P};h.stats=o.stats,o.load(C,S,{onSuccess:function(M,F,W,V){c.resetLoader(h,o),v({frag:h,part:null,payload:M.data,networkDetails:V})},onError:function(M,F,W){c.resetLoader(h,o),d(new p({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:h,response:M,networkDetails:W}))},onAbort:function(M,F,W){c.resetLoader(h,o),d(new p({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:h,networkDetails:W}))},onTimeout:function(M,F,W){c.resetLoader(h,o),d(new p({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:h,networkDetails:W}))},onProgress:function(M,F,W,V){k&&k({frag:h,part:null,payload:W,networkDetails:V})}})})},a.loadPart=function(h,k,c){var b=this;this.abort();var D=this.config,T=D.fLoader,g=D.loader;return new Promise(function(v,d){b.loader&&b.loader.destroy();var o=b.loader=h.loader=T?new T(D):new g(D),C=E(h,k),S={timeout:D.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:D.fragLoadingMaxRetryTimeout,highWaterMark:P};k.stats=o.stats,o.load(C,S,{onSuccess:function(M,F,W,V){b.resetLoader(h,o),b.updateStatsFromPart(h,k);var I={frag:h,part:k,payload:M.data,networkDetails:V};c(I),v(I)},onError:function(M,F,W){b.resetLoader(h,o),d(new p({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:h,part:k,response:M,networkDetails:W}))},onAbort:function(M,F,W){h.stats.aborted=k.stats.aborted,b.resetLoader(h,o),d(new p({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:h,part:k,networkDetails:W}))},onTimeout:function(M,F,W){b.resetLoader(h,o),d(new p({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:h,part:k,networkDetails:W}))}})})},a.updateStatsFromPart=function(h,k){var c=h.stats,b=k.stats,D=b.total;if(c.loaded+=b.loaded,D){var T=Math.round(h.duration/k.duration),g=Math.min(Math.round(c.loaded/D),T),v=T-g,d=v*Math.round(c.loaded/g);c.total=c.loaded+d}else c.total=Math.max(c.loaded,c.total);var o=c.loading,C=b.loading;o.start?o.first+=C.first-C.start:(o.start=C.start,o.first=C.first),o.end=C.end},a.resetLoader=function(h,k){h.loader=null,this.loader===k&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),k.destroy()},u}();function E(u,a){a===void 0&&(a=null);var s=a||u,h={frag:u,part:a,responseType:"arraybuffer",url:s.url,headers:{},rangeStart:0,rangeEnd:0},k=s.byteRangeStartOffset,c=s.byteRangeEndOffset;return Object(Q.isFiniteNumber)(k)&&Object(Q.isFiniteNumber)(c)&&(h.rangeStart=k,h.rangeEnd=c),h}var p=function(u){O(a,u);function a(s){for(var h,k=arguments.length,c=new Array(k>1?k-1:0),b=1;b<k;b++)c[b-1]=arguments[b];return h=u.call.apply(u,[this].concat(c))||this,h.data=void 0,h.data=s,h}return a}(j(Error))},"./src/loader/fragment.ts":function(ne,$,R){"use strict";R.r($),R.d($,"ElementaryStreamTypes",function(){return w}),R.d($,"BaseSegment",function(){return E}),R.d($,"Fragment",function(){return p}),R.d($,"Part",function(){return u});var Q=R("./src/polyfills/number.ts"),U=R("./node_modules/url-toolkit/src/url-toolkit.js"),O=R.n(U),j=R("./src/utils/logger.ts"),N=R("./src/loader/level-key.ts"),_=R("./src/loader/load-stats.ts");function A(a,s){a.prototype=Object.create(s.prototype),a.prototype.constructor=a,f(a,s)}function f(a,s){return f=Object.setPrototypeOf||function(k,c){return k.__proto__=c,k},f(a,s)}function x(a,s){for(var h=0;h<s.length;h++){var k=s[h];k.enumerable=k.enumerable||!1,k.configurable=!0,"value"in k&&(k.writable=!0),Object.defineProperty(a,k.key,k)}}function P(a,s,h){return s&&x(a.prototype,s),h&&x(a,h),a}var w;(function(a){a.AUDIO="audio",a.VIDEO="video",a.AUDIOVIDEO="audiovideo"})(w||(w={}));var E=function(){function a(h){var k;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(k={},k[w.AUDIO]=null,k[w.VIDEO]=null,k[w.AUDIOVIDEO]=null,k),this.baseurl=h}var s=a.prototype;return s.setByteRange=function(k,c){var b=k.split("@",2),D=[];b.length===1?D[0]=c?c.byteRangeEndOffset:0:D[0]=parseInt(b[1]),D[1]=parseInt(b[0])+D[0],this._byteRange=D},P(a,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Object(U.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(k){this._url=k}}]),a}(),p=function(a){A(s,a);function s(k,c){var b;return b=a.call(this,c)||this,b._decryptdata=null,b.rawProgramDateTime=null,b.programDateTime=null,b.tagList=[],b.duration=0,b.sn=0,b.levelkey=void 0,b.type=void 0,b.loader=null,b.level=-1,b.cc=0,b.startPTS=void 0,b.endPTS=void 0,b.appendedPTS=void 0,b.startDTS=void 0,b.endDTS=void 0,b.start=0,b.deltaPTS=void 0,b.maxStartPTS=void 0,b.minEndPTS=void 0,b.stats=new _.LoadStats,b.urlId=0,b.data=void 0,b.bitrateTest=!1,b.title=null,b.initSegment=null,b.type=k,b}var h=s.prototype;return h.createInitializationVector=function(c){for(var b=new Uint8Array(16),D=12;D<16;D++)b[D]=c>>8*(15-D)&255;return b},h.setDecryptDataFromLevelKey=function(c,b){var D=c;return(c==null?void 0:c.method)==="AES-128"&&c.uri&&!c.iv&&(D=N.LevelKey.fromURI(c.uri),D.method=c.method,D.iv=this.createInitializationVector(b),D.keyFormat="identity"),D},h.setElementaryStreamInfo=function(c,b,D,T,g,v){v===void 0&&(v=!1);var d=this.elementaryStreams,o=d[c];if(!o){d[c]={startPTS:b,endPTS:D,startDTS:T,endDTS:g,partial:v};return}o.startPTS=Math.min(o.startPTS,b),o.endPTS=Math.max(o.endPTS,D),o.startDTS=Math.min(o.startDTS,T),o.endDTS=Math.max(o.endDTS,g)},h.clearElementaryStreamInfo=function(){var c=this.elementaryStreams;c[w.AUDIO]=null,c[w.VIDEO]=null,c[w.AUDIOVIDEO]=null},P(s,[{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&&j.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)}}]),s}(E),u=function(a){A(s,a);function s(h,k,c,b,D){var T;T=a.call(this,c)||this,T.fragOffset=0,T.duration=0,T.gap=!1,T.independent=!1,T.relurl=void 0,T.fragment=void 0,T.index=void 0,T.stats=new _.LoadStats,T.duration=h.decimalFloatingPoint("DURATION"),T.gap=h.bool("GAP"),T.independent=h.bool("INDEPENDENT"),T.relurl=h.enumeratedString("URI"),T.fragment=k,T.index=b;var g=h.enumeratedString("BYTERANGE");return g&&T.setByteRange(g,D),D&&(T.fragOffset=D.fragOffset+D.duration),T}return P(s,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var k=this.elementaryStreams;return!!(k.audio||k.video||k.audiovideo)}}]),s}(E)},"./src/loader/key-loader.ts":function(ne,$,R){"use strict";R.r($),R.d($,"default",function(){return j});var Q=R("./src/events.ts"),U=R("./src/errors.ts"),O=R("./src/utils/logger.ts"),j=function(){function N(A){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=A,this._registerListeners()}var _=N.prototype;return _._registerListeners=function(){this.hls.on(Q.Events.KEY_LOADING,this.onKeyLoading,this)},_._unregisterListeners=function(){this.hls.off(Q.Events.KEY_LOADING,this.onKeyLoading)},_.destroy=function(){this._unregisterListeners();for(var f in this.loaders){var x=this.loaders[f];x&&x.destroy()}this.loaders={}},_.onKeyLoading=function(f,x){var P=x.frag,w=P.type,E=this.loaders[w];if(!P.decryptdata){O.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var p=P.decryptdata.uri;if(p!==this.decrypturl||this.decryptkey===null){var u=this.hls.config;if(E&&(O.logger.warn("abort previous key loader for type:"+w),E.abort()),!p){O.logger.warn("key uri is falsy");return}var a=u.loader,s=P.loader=this.loaders[w]=new a(u);this.decrypturl=p,this.decryptkey=null;var h={url:p,frag:P,responseType:"arraybuffer"},k={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)};s.load(h,k,c)}else this.decryptkey&&(P.decryptdata.key=this.decryptkey,this.hls.trigger(Q.Events.KEY_LOADED,{frag:P}))},_.loadsuccess=function(f,x,P){var w=P.frag;if(!w.decryptdata){O.logger.error("after key load, decryptdata unset");return}this.decryptkey=w.decryptdata.key=new Uint8Array(f.data),w.loader=null,delete this.loaders[w.type],this.hls.trigger(Q.Events.KEY_LOADED,{frag:w})},_.loaderror=function(f,x){var P=x.frag,w=P.loader;w&&w.abort(),delete this.loaders[P.type],this.hls.trigger(Q.Events.ERROR,{type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:P,response:f})},_.loadtimeout=function(f,x){var P=x.frag,w=P.loader;w&&w.abort(),delete this.loaders[P.type],this.hls.trigger(Q.Events.ERROR,{type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:P})},N}()},"./src/loader/level-details.ts":function(ne,$,R){"use strict";R.r($),R.d($,"LevelDetails",function(){return N});var Q=R("./src/polyfills/number.ts");function U(_,A){for(var f=0;f<A.length;f++){var x=A[f];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(_,x.key,x)}}function O(_,A,f){return A&&U(_.prototype,A),f&&U(_,f),_}var j=10,N=function(){function _(f){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=f}var A=_.prototype;return A.reloaded=function(x){if(!x){this.advanced=!0,this.updated=!0;return}var P=this.lastPartSn-x.lastPartSn,w=this.lastPartIndex-x.lastPartIndex;this.updated=this.endSN!==x.endSN||!!w||!!P,this.advanced=this.endSN>x.endSN||P>0||P===0&&w>0,this.updated||this.advanced?this.misses=Math.floor(x.misses*.6):this.misses=x.misses+1,this.availabilityDelay=x.availabilityDelay},O(_,[{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||j}},{key:"drift",get:function(){var x=this.driftEndTime-this.driftStartTime;if(x>0){var P=this.driftEnd-this.driftStart;return P*1e3/x}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var x;return(x=this.partList)!==null&&x!==void 0&&x.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var x;return(x=this.fragments)!==null&&x!==void 0&&x.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 x;return(x=this.partList)!==null&&x!==void 0&&x.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var x;return(x=this.partList)!==null&&x!==void 0&&x.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),_}()},"./src/loader/level-key.ts":function(ne,$,R){"use strict";R.r($),R.d($,"LevelKey",function(){return N});var Q=R("./node_modules/url-toolkit/src/url-toolkit.js"),U=R.n(Q);function O(_,A){for(var f=0;f<A.length;f++){var x=A[f];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(_,x.key,x)}}function j(_,A,f){return A&&O(_.prototype,A),f&&O(_,f),_}var N=function(){_.fromURL=function(f,x){return new _(f,x)},_.fromURI=function(f){return new _(f)};function _(A,f){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,f?this._uri=Object(Q.buildAbsoluteURL)(A,f,{alwaysNormalize:!0}):this._uri=A}return j(_,[{key:"uri",get:function(){return this._uri}}]),_}()},"./src/loader/load-stats.ts":function(ne,$,R){"use strict";R.r($),R.d($,"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(ne,$,R){"use strict";R.r($),R.d($,"default",function(){return s});var Q=R("./src/polyfills/number.ts"),U=R("./node_modules/url-toolkit/src/url-toolkit.js"),O=R.n(U),j=R("./src/loader/fragment.ts"),N=R("./src/loader/level-details.ts"),_=R("./src/loader/level-key.ts"),A=R("./src/utils/attr-list.ts"),f=R("./src/utils/logger.ts"),x=R("./src/utils/codecs.ts"),P=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,w=/#EXT-X-MEDIA:(.*)/g,E=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),p=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(PLAYLIST-TYPE):(.+)/.source,/#EXT-X-(MEDIA-SEQUENCE): *(\d+)/.source,/#EXT-X-(SKIP):(.+)/.source,/#EXT-X-(TARGETDURATION): *(\d+)/.source,/#EXT-X-(KEY):(.+)/.source,/#EXT-X-(START):(.+)/.source,/#EXT-X-(ENDLIST)/.source,/#EXT-X-(DISCONTINUITY-SEQ)UENCE: *(\d+)/.source,/#EXT-X-(DIS)CONTINUITY/.source,/#EXT-X-(VERSION):(\d+)/.source,/#EXT-X-(MAP):(.+)/.source,/#EXT-X-(SERVER-CONTROL):(.+)/.source,/#EXT-X-(PART-INF):(.+)/.source,/#EXT-X-(GAP)/.source,/#EXT-X-(BITRATE):\s*(\d+)/.source,/#EXT-X-(PART):(.+)/.source,/#EXT-X-(PRELOAD-HINT):(.+)/.source,/#EXT-X-(RENDITION-REPORT):(.+)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),u=/\.(mp4|m4s|m4v|m4a)$/i;function a(D){var T,g;return u.test((T=(g=U.parseURL(D))===null||g===void 0?void 0:g.path)!=null?T:"")}var s=function(){function D(){}return D.findGroup=function(g,v){for(var d=0;d<g.length;d++){var o=g[d];if(o.id===v)return o}},D.convertAVC1ToAVCOTI=function(g){var v=g.split(".");if(v.length>2){var d=v.shift()+".";return d+=parseInt(v.shift()).toString(16),d+=("000"+parseInt(v.shift()).toString(16)).substr(-4),d}return g},D.resolve=function(g,v){return U.buildAbsoluteURL(v,g,{alwaysNormalize:!0})},D.parseMasterPlaylist=function(g,v){var d=[],o={},C=!1;P.lastIndex=0;for(var S;(S=P.exec(g))!=null;)if(S[1]){var y=new A.AttrList(S[1]),M={attrs:y,bitrate:y.decimalInteger("AVERAGE-BANDWIDTH")||y.decimalInteger("BANDWIDTH"),name:y.NAME,url:D.resolve(S[2],v)},F=y.decimalResolution("RESOLUTION");F&&(M.width=F.width,M.height=F.height),h((y.CODECS||"").split(/[ ,]+/).filter(function(V){return V}),M),M.videoCodec&&M.videoCodec.indexOf("avc1")!==-1&&(M.videoCodec=D.convertAVC1ToAVCOTI(M.videoCodec)),d.push(M)}else if(S[3]){var W=new A.AttrList(S[3]);W["DATA-ID"]&&(C=!0,o[W["DATA-ID"]]=W)}return{levels:d,sessionData:C?o:null}},D.parseMasterPlaylistMedia=function(g,v,d,o){o===void 0&&(o=[]);var C,S=[],y=0;for(w.lastIndex=0;(C=w.exec(g))!==null;){var M=new A.AttrList(C[1]);if(M.TYPE===d){var F={attrs:M,bitrate:0,id:y++,groupId:M["GROUP-ID"],instreamId:M["INSTREAM-ID"],name:M.NAME||M.LANGUAGE||"",type:d,default:M.bool("DEFAULT"),autoselect:M.bool("AUTOSELECT"),forced:M.bool("FORCED"),lang:M.LANGUAGE,url:M.URI?D.resolve(M.URI,v):""};if(o.length){var W=D.findGroup(o,F.groupId)||o[0];k(F,W,"audioCodec"),k(F,W,"textCodec")}S.push(F)}}return S},D.parseLevelPlaylist=function(g,v,d,o,C){var S=new N.LevelDetails(v),y=S.fragments,M=null,F=0,W=0,V=0,I=0,B=null,X=new j.Fragment(o,v),ee,oe,fe,ke=-1,xe=!1;for(E.lastIndex=0,S.m3u8=g;(ee=E.exec(g))!==null;){xe&&(xe=!1,X=new j.Fragment(o,v),X.start=V,X.sn=F,X.cc=I,X.level=d,M&&(X.initSegment=M,X.rawProgramDateTime=M.rawProgramDateTime));var Te=ee[1];if(Te){X.duration=parseFloat(Te);var Ce=(" "+ee[2]).slice(1);X.title=Ce||null,X.tagList.push(Ce?["INF",Te,Ce]:["INF",Te])}else if(ee[3])Object(Q.isFiniteNumber)(X.duration)&&(X.start=V,fe&&(X.levelkey=fe),X.sn=F,X.level=d,X.cc=I,X.urlId=C,y.push(X),X.relurl=(" "+ee[3]).slice(1),b(X,B),B=X,V+=X.duration,F++,W=0,xe=!0);else if(ee[4]){var ge=(" "+ee[4]).slice(1);B?X.setByteRange(ge,B):X.setByteRange(ge)}else if(ee[5])X.rawProgramDateTime=(" "+ee[5]).slice(1),X.tagList.push(["PROGRAM-DATE-TIME",X.rawProgramDateTime]),ke===-1&&(ke=y.length);else{if(ee=ee[0].match(p),!ee){f.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),ue=(" "+ee[oe+1]).slice(1),te=ee[oe+2]?(" "+ee[oe+2]).slice(1):"";switch(pe){case"PLAYLIST-TYPE":S.type=ue.toUpperCase();break;case"MEDIA-SEQUENCE":F=S.startSN=parseInt(ue);break;case"SKIP":{var de=new A.AttrList(ue),ae=de.decimalInteger("SKIPPED-SEGMENTS");if(Object(Q.isFiniteNumber)(ae)){S.skippedSegments=ae;for(var we=ae;we--;)y.unshift(null);F+=ae}var Re=de.enumeratedString("RECENTLY-REMOVED-DATERANGES");Re&&(S.recentlyRemovedDateranges=Re.split(" "));break}case"TARGETDURATION":S.targetduration=parseFloat(ue);break;case"VERSION":S.version=parseInt(ue);break;case"EXTM3U":break;case"ENDLIST":S.live=!1;break;case"#":(ue||te)&&X.tagList.push(te?[ue,te]:[ue]);break;case"DIS":I++;case"GAP":X.tagList.push([pe]);break;case"BITRATE":X.tagList.push([pe,ue]);break;case"DISCONTINUITY-SEQ":I=parseInt(ue);break;case"KEY":{var Ee,Me=new A.AttrList(ue),Ie=Me.enumeratedString("METHOD"),We=Me.URI,je=Me.hexadecimalInteger("IV"),Be=Me.enumeratedString("KEYFORMATVERSIONS"),Ue=Me.enumeratedString("KEYID"),et=(Ee=Me.enumeratedString("KEYFORMAT"))!=null?Ee:"identity",ot=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(ot.indexOf(et)>-1){f.logger.warn("Keyformat "+et+" is not supported from the manifest");continue}else if(et!=="identity")continue;Ie&&(fe=_.LevelKey.fromURL(v,We),We&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Ie)>=0&&(fe.method=Ie,fe.keyFormat=et,Ue&&(fe.keyID=Ue),Be&&(fe.keyFormatVersions=Be),fe.iv=je));break}case"START":{var nt=new A.AttrList(ue),qe=nt.decimalFloatingPoint("TIME-OFFSET");Object(Q.isFiniteNumber)(qe)&&(S.startTimeOffset=qe);break}case"MAP":{var st=new A.AttrList(ue);X.relurl=st.URI,st.BYTERANGE&&X.setByteRange(st.BYTERANGE),X.level=d,X.sn="initSegment",fe&&(X.levelkey=fe),X.initSegment=null,M=X,xe=!0;break}case"SERVER-CONTROL":{var $e=new A.AttrList(ue);S.canBlockReload=$e.bool("CAN-BLOCK-RELOAD"),S.canSkipUntil=$e.optionalFloat("CAN-SKIP-UNTIL",0),S.canSkipDateRanges=S.canSkipUntil>0&&$e.bool("CAN-SKIP-DATERANGES"),S.partHoldBack=$e.optionalFloat("PART-HOLD-BACK",0),S.holdBack=$e.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var Qe=new A.AttrList(ue);S.partTarget=Qe.decimalFloatingPoint("PART-TARGET");break}case"PART":{var _e=S.partList;_e||(_e=S.partList=[]);var ut=W>0?_e[_e.length-1]:void 0,lt=W++,Ne=new j.Part(new A.AttrList(ue),X,v,lt,ut);_e.push(Ne),X.duration+=Ne.duration;break}case"PRELOAD-HINT":{var Ke=new A.AttrList(ue);S.preloadHint=Ke;break}case"RENDITION-REPORT":{var Se=new A.AttrList(ue);S.renditionReports=S.renditionReports||[],S.renditionReports.push(Se);break}default:f.logger.warn("line parsed but not handled: "+ee);break}}}B&&!B.relurl?(y.pop(),V-=B.duration,S.partList&&(S.fragmentHint=B)):S.partList&&(b(X,B),X.cc=I,S.fragmentHint=X);var ve=y.length,be=y[0],re=y[ve-1];if(V+=S.skippedSegments*S.targetduration,V>0&&ve&&re){S.averagetargetduration=V/ve;var ie=re.sn;S.endSN=ie!=="initSegment"?ie:0,be&&(S.startCC=be.cc,be.initSegment||S.fragments.every(function(le){return le.relurl&&a(le.relurl)})&&(f.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),X=new j.Fragment(o,v),X.relurl=re.relurl,X.level=d,X.sn="initSegment",be.initSegment=X,S.needSidxRanges=!0))}else S.endSN=0,S.startCC=0;return S.fragmentHint&&(V+=S.fragmentHint.duration),S.totalduration=V,S.endCC=I,ke>0&&c(y,ke),S},D}();function h(D,T){["video","audio","text"].forEach(function(g){var v=D.filter(function(o){return Object(x.isCodecType)(o,g)});if(v.length){var d=v.filter(function(o){return o.lastIndexOf("avc1",0)===0||o.lastIndexOf("mp4a",0)===0});T[g+"Codec"]=d.length>0?d[0]:v[0],D=D.filter(function(o){return v.indexOf(o)===-1})}}),T.unknownCodecs=D}function k(D,T,g){var v=T[g];v&&(D[g]=v)}function c(D,T){for(var g=D[T],v=T;v--;){var d=D[v];if(!d)return;d.programDateTime=g.programDateTime-d.duration*1e3,g=d}}function b(D,T){D.rawProgramDateTime?D.programDateTime=Date.parse(D.rawProgramDateTime):T!=null&&T.programDateTime&&(D.programDateTime=T.endProgramDateTime),Object(Q.isFiniteNumber)(D.programDateTime)||(D.programDateTime=null,D.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(ne,$,R){"use strict";R.r($);var Q=R("./src/polyfills/number.ts"),U=R("./src/events.ts"),O=R("./src/errors.ts"),j=R("./src/utils/logger.ts"),N=R("./src/utils/mp4-tools.ts"),_=R("./src/loader/m3u8-parser.ts"),A=R("./src/types/loader.ts"),f=R("./src/utils/attr-list.ts");function x(E){var p=E.type;switch(p){case A.PlaylistContextType.AUDIO_TRACK:return A.PlaylistLevelType.AUDIO;case A.PlaylistContextType.SUBTITLE_TRACK:return A.PlaylistLevelType.SUBTITLE;default:return A.PlaylistLevelType.MAIN}}function P(E,p){var u=E.url;return(u===void 0||u.indexOf("data:")===0)&&(u=p.url),u}var w=function(){function E(u){this.hls=void 0,this.loaders=Object.create(null),this.hls=u,this.registerListeners()}var p=E.prototype;return p.registerListeners=function(){var a=this.hls;a.on(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.on(U.Events.LEVEL_LOADING,this.onLevelLoading,this),a.on(U.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),a.on(U.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},p.unregisterListeners=function(){var a=this.hls;a.off(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),a.off(U.Events.LEVEL_LOADING,this.onLevelLoading,this),a.off(U.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),a.off(U.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},p.createInternalLoader=function(a){var s=this.hls.config,h=s.pLoader,k=s.loader,c=h||k,b=new c(s);return a.loader=b,this.loaders[a.type]=b,b},p.getInternalLoader=function(a){return this.loaders[a.type]},p.resetInternalLoader=function(a){this.loaders[a]&&delete this.loaders[a]},p.destroyInternalLoaders=function(){for(var a in this.loaders){var s=this.loaders[a];s&&s.destroy(),this.resetInternalLoader(a)}},p.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},p.onManifestLoading=function(a,s){var h=s.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:A.PlaylistContextType.MANIFEST,url:h,deliveryDirectives:null})},p.onLevelLoading=function(a,s){var h=s.id,k=s.level,c=s.url,b=s.deliveryDirectives;this.load({id:h,groupId:null,level:k,responseType:"text",type:A.PlaylistContextType.LEVEL,url:c,deliveryDirectives:b})},p.onAudioTrackLoading=function(a,s){var h=s.id,k=s.groupId,c=s.url,b=s.deliveryDirectives;this.load({id:h,groupId:k,level:null,responseType:"text",type:A.PlaylistContextType.AUDIO_TRACK,url:c,deliveryDirectives:b})},p.onSubtitleTrackLoading=function(a,s){var h=s.id,k=s.groupId,c=s.url,b=s.deliveryDirectives;this.load({id:h,groupId:k,level:null,responseType:"text",type:A.PlaylistContextType.SUBTITLE_TRACK,url:c,deliveryDirectives:b})},p.load=function(a){var s,h=this.hls.config,k=this.getInternalLoader(a);if(k){var c=k.context;if(c&&c.url===a.url){j.logger.trace("[playlist-loader]: playlist request ongoing");return}j.logger.log("[playlist-loader]: aborting previous loader for type: "+a.type),k.abort()}var b,D,T,g;switch(a.type){case A.PlaylistContextType.MANIFEST:b=h.manifestLoadingMaxRetry,D=h.manifestLoadingTimeOut,T=h.manifestLoadingRetryDelay,g=h.manifestLoadingMaxRetryTimeout;break;case A.PlaylistContextType.LEVEL:case A.PlaylistContextType.AUDIO_TRACK:case A.PlaylistContextType.SUBTITLE_TRACK:b=0,D=h.levelLoadingTimeOut;break;default:b=h.levelLoadingMaxRetry,D=h.levelLoadingTimeOut,T=h.levelLoadingRetryDelay,g=h.levelLoadingMaxRetryTimeout;break}if(k=this.createInternalLoader(a),(s=a.deliveryDirectives)!==null&&s!==void 0&&s.part){var v;if(a.type===A.PlaylistContextType.LEVEL&&a.level!==null?v=this.hls.levels[a.level].details:a.type===A.PlaylistContextType.AUDIO_TRACK&&a.id!==null?v=this.hls.audioTracks[a.id].details:a.type===A.PlaylistContextType.SUBTITLE_TRACK&&a.id!==null&&(v=this.hls.subtitleTracks[a.id].details),v){var d=v.partTarget,o=v.targetduration;d&&o&&(D=Math.min(Math.max(d*3,o*.8)*1e3,D))}}var C={timeout:D,maxRetry:b,retryDelay:T,maxRetryDelay:g,highWaterMark:0},S={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};k.load(a,C,S)},p.loadsuccess=function(a,s,h,k){if(k===void 0&&(k=null),h.isSidxRequest){this.handleSidxRequest(a,h),this.handlePlaylistLoaded(a,s,h,k);return}this.resetInternalLoader(h.type);var c=a.data;if(c.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(a,h,"no EXTM3U delimiter",k);return}s.parsing.start=performance.now(),c.indexOf("#EXTINF:")>0||c.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(a,s,h,k):this.handleMasterPlaylist(a,s,h,k)},p.loaderror=function(a,s,h){h===void 0&&(h=null),this.handleNetworkError(s,h,!1,a)},p.loadtimeout=function(a,s,h){h===void 0&&(h=null),this.handleNetworkError(s,h,!0)},p.handleMasterPlaylist=function(a,s,h,k){var c=this.hls,b=a.data,D=P(a,h),T=_.default.parseMasterPlaylist(b,D),g=T.levels,v=T.sessionData;if(!g.length){this.handleManifestParsingError(a,h,"no level found in manifest",k);return}var d=g.map(function(F){return{id:F.attrs.AUDIO,audioCodec:F.audioCodec}}),o=g.map(function(F){return{id:F.attrs.SUBTITLES,textCodec:F.textCodec}}),C=_.default.parseMasterPlaylistMedia(b,D,"AUDIO",d),S=_.default.parseMasterPlaylistMedia(b,D,"SUBTITLES",o),y=_.default.parseMasterPlaylistMedia(b,D,"CLOSED-CAPTIONS");if(C.length){var M=C.some(function(F){return!F.url});!M&&g[0].audioCodec&&!g[0].attrs.AUDIO&&(j.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),C.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new f.AttrList({}),bitrate:0,url:""}))}c.trigger(U.Events.MANIFEST_LOADED,{levels:g,audioTracks:C,subtitles:S,captions:y,url:D,stats:s,networkDetails:k,sessionData:v})},p.handleTrackOrLevelPlaylist=function(a,s,h,k){var c=this.hls,b=h.id,D=h.level,T=h.type,g=P(a,h),v=Object(Q.isFiniteNumber)(b)?b:0,d=Object(Q.isFiniteNumber)(D)?D:v,o=x(h),C=_.default.parseLevelPlaylist(a.data,g,d,o,v);if(!C.fragments.length){c.trigger(U.Events.ERROR,{type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:g,reason:"no fragments found in level",level:typeof h.level=="number"?h.level:void 0});return}if(T===A.PlaylistContextType.MANIFEST){var S={attrs:new f.AttrList({}),bitrate:0,details:C,name:"",url:g};c.trigger(U.Events.MANIFEST_LOADED,{levels:[S],audioTracks:[],url:g,stats:s,networkDetails:k,sessionData:null})}if(s.parsing.end=performance.now(),C.needSidxRanges){var y,M=(y=C.fragments[0].initSegment)===null||y===void 0?void 0:y.url;this.load({url:M,isSidxRequest:!0,type:T,level:D,levelDetails:C,id:b,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}h.levelDetails=C,this.handlePlaylistLoaded(a,s,h,k)},p.handleSidxRequest=function(a,s){var h=Object(N.parseSegmentIndex)(new Uint8Array(a.data));if(!h)return;var k=h.references,c=s.levelDetails;k.forEach(function(b,D){var T=b.info,g=c.fragments[D];g.byteRange.length===0&&g.setByteRange(String(1+T.end-T.start)+"@"+String(T.start)),g.initSegment&&g.initSegment.setByteRange(String(h.moovEndOffset)+"@0")})},p.handleManifestParsingError=function(a,s,h,k){this.hls.trigger(U.Events.ERROR,{type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:s.type===A.PlaylistContextType.MANIFEST,url:a.url,reason:h,response:a,context:s,networkDetails:k})},p.handleNetworkError=function(a,s,h,k){h===void 0&&(h=!1),j.logger.warn("[playlist-loader]: A network "+(h?"timeout":"error")+" occurred while loading "+a.type+" level: "+a.level+" id: "+a.id+' group-id: "'+a.groupId+'"');var c=O.ErrorDetails.UNKNOWN,b=!1,D=this.getInternalLoader(a);switch(a.type){case A.PlaylistContextType.MANIFEST:c=h?O.ErrorDetails.MANIFEST_LOAD_TIMEOUT:O.ErrorDetails.MANIFEST_LOAD_ERROR,b=!0;break;case A.PlaylistContextType.LEVEL:c=h?O.ErrorDetails.LEVEL_LOAD_TIMEOUT:O.ErrorDetails.LEVEL_LOAD_ERROR,b=!1;break;case A.PlaylistContextType.AUDIO_TRACK:c=h?O.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:O.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,b=!1;break;case A.PlaylistContextType.SUBTITLE_TRACK:c=h?O.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:O.ErrorDetails.SUBTITLE_LOAD_ERROR,b=!1;break}D&&this.resetInternalLoader(a.type);var T={type:O.ErrorTypes.NETWORK_ERROR,details:c,fatal:b,url:a.url,loader:D,context:a,networkDetails:s};k&&(T.response=k),this.hls.trigger(U.Events.ERROR,T)},p.handlePlaylistLoaded=function(a,s,h,k){var c=h.type,b=h.level,D=h.id,T=h.groupId,g=h.loader,v=h.levelDetails,d=h.deliveryDirectives;if(!(v!=null&&v.targetduration)){this.handleManifestParsingError(a,h,"invalid target duration",k);return}if(!g)return;v.live&&(g.getCacheAge&&(v.ageHeader=g.getCacheAge()||0),(!g.getCacheAge||isNaN(v.ageHeader))&&(v.ageHeader=0));switch(c){case A.PlaylistContextType.MANIFEST:case A.PlaylistContextType.LEVEL:this.hls.trigger(U.Events.LEVEL_LOADED,{details:v,level:b||0,id:D||0,stats:s,networkDetails:k,deliveryDirectives:d});break;case A.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(U.Events.AUDIO_TRACK_LOADED,{details:v,id:D||0,groupId:T||"",stats:s,networkDetails:k,deliveryDirectives:d});break;case A.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(U.Events.SUBTITLE_TRACK_LOADED,{details:v,id:D||0,groupId:T||"",stats:s,networkDetails:k,deliveryDirectives:d});break}},E}();$.default=w},"./src/polyfills/number.ts":function(ne,$,R){"use strict";R.r($),R.d($,"isFiniteNumber",function(){return Q}),R.d($,"MAX_SAFE_INTEGER",function(){return U});var Q=Number.isFinite||function(O){return typeof O=="number"&&isFinite(O)},U=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(ne,$,R){"use strict";R.r($);var Q=function(){function U(){}return U.getSilentFrame=function(j,N){switch(j){case"mp4a.40.2":if(N===1)return new Uint8Array([0,200,0,128,35,128]);if(N===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(N===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(N===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(N===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(N===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(N===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(N===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(N===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}return},U}();$.default=Q},"./src/remux/mp4-generator.ts":function(ne,$,R){"use strict";R.r($);var Q=Math.pow(2,32)-1,U=function(){function O(){}return O.init=function(){O.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var N;for(N in O.types)O.types.hasOwnProperty(N)&&(O.types[N]=[N.charCodeAt(0),N.charCodeAt(1),N.charCodeAt(2),N.charCodeAt(3)]);var _=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]),A=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);O.HDLR_TYPES={video:_,audio:A};var f=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),x=new Uint8Array([0,0,0,0,0,0,0,0]);O.STTS=O.STSC=O.STCO=x,O.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),O.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),O.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),O.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var P=new Uint8Array([105,115,111,109]),w=new Uint8Array([97,118,99,49]),E=new Uint8Array([0,0,0,1]);O.FTYP=O.box(O.types.ftyp,P,E,P,w),O.DINF=O.box(O.types.dinf,O.box(O.types.dref,f))},O.box=function(N){for(var _=8,A=arguments.length,f=new Array(A>1?A-1:0),x=1;x<A;x++)f[x-1]=arguments[x];for(var P=f.length,w=P;P--;)_+=f[P].byteLength;var E=new Uint8Array(_);for(E[0]=_>>24&255,E[1]=_>>16&255,E[2]=_>>8&255,E[3]=_&255,E.set(N,4),P=0,_=8;P<w;P++)E.set(f[P],_),_+=f[P].byteLength;return E},O.hdlr=function(N){return O.box(O.types.hdlr,O.HDLR_TYPES[N])},O.mdat=function(N){return O.box(O.types.mdat,N)},O.mdhd=function(N,_){_*=N;var A=Math.floor(_/(Q+1)),f=Math.floor(_%(Q+1));return O.box(O.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,N>>24&255,N>>16&255,N>>8&255,N&255,A>>24,A>>16&255,A>>8&255,A&255,f>>24,f>>16&255,f>>8&255,f&255,85,196,0,0]))},O.mdia=function(N){return O.box(O.types.mdia,O.mdhd(N.timescale,N.duration),O.hdlr(N.type),O.minf(N))},O.mfhd=function(N){return O.box(O.types.mfhd,new Uint8Array([0,0,0,0,N>>24,N>>16&255,N>>8&255,N&255]))},O.minf=function(N){return N.type==="audio"?O.box(O.types.minf,O.box(O.types.smhd,O.SMHD),O.DINF,O.stbl(N)):O.box(O.types.minf,O.box(O.types.vmhd,O.VMHD),O.DINF,O.stbl(N))},O.moof=function(N,_,A){return O.box(O.types.moof,O.mfhd(N),O.traf(A,_))},O.moov=function(N){for(var _=N.length,A=[];_--;)A[_]=O.trak(N[_]);return O.box.apply(null,[O.types.moov,O.mvhd(N[0].timescale,N[0].duration)].concat(A).concat(O.mvex(N)))},O.mvex=function(N){for(var _=N.length,A=[];_--;)A[_]=O.trex(N[_]);return O.box.apply(null,[O.types.mvex].concat(A))},O.mvhd=function(N,_){_*=N;var A=Math.floor(_/(Q+1)),f=Math.floor(_%(Q+1)),x=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,N>>24&255,N>>16&255,N>>8&255,N&255,A>>24,A>>16&255,A>>8&255,A&255,f>>24,f>>16&255,f>>8&255,f&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return O.box(O.types.mvhd,x)},O.sdtp=function(N){var _=N.samples||[],A=new Uint8Array(4+_.length),f,x;for(f=0;f<_.length;f++)x=_[f].flags,A[f+4]=x.dependsOn<<4|x.isDependedOn<<2|x.hasRedundancy;return O.box(O.types.sdtp,A)},O.stbl=function(N){return O.box(O.types.stbl,O.stsd(N),O.box(O.types.stts,O.STTS),O.box(O.types.stsc,O.STSC),O.box(O.types.stsz,O.STSZ),O.box(O.types.stco,O.STCO))},O.avc1=function(N){var _=[],A=[],f,x,P;for(f=0;f<N.sps.length;f++)x=N.sps[f],P=x.byteLength,_.push(P>>>8&255),_.push(P&255),_=_.concat(Array.prototype.slice.call(x));for(f=0;f<N.pps.length;f++)x=N.pps[f],P=x.byteLength,A.push(P>>>8&255),A.push(P&255),A=A.concat(Array.prototype.slice.call(x));var w=O.box(O.types.avcC,new Uint8Array([1,_[3],_[4],_[5],252|3,224|N.sps.length].concat(_).concat([N.pps.length]).concat(A))),E=N.width,p=N.height,u=N.pixelRatio[0],a=N.pixelRatio[1];return O.box(O.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,E>>8&255,E&255,p>>8&255,p&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),w,O.box(O.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),O.box(O.types.pasp,new Uint8Array([u>>24,u>>16&255,u>>8&255,u&255,a>>24,a>>16&255,a>>8&255,a&255])))},O.esds=function(N){var _=N.config.length;return new Uint8Array([0,0,0,0,3,23+_,0,1,0,4,15+_,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([_]).concat(N.config).concat([6,1,2]))},O.mp4a=function(N){var _=N.samplerate;return O.box(O.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,N.channelCount,0,16,0,0,0,0,_>>8&255,_&255,0,0]),O.box(O.types.esds,O.esds(N)))},O.mp3=function(N){var _=N.samplerate;return O.box(O.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,N.channelCount,0,16,0,0,0,0,_>>8&255,_&255,0,0]))},O.stsd=function(N){return N.type==="audio"?!N.isAAC&&N.codec==="mp3"?O.box(O.types.stsd,O.STSD,O.mp3(N)):O.box(O.types.stsd,O.STSD,O.mp4a(N)):O.box(O.types.stsd,O.STSD,O.avc1(N))},O.tkhd=function(N){var _=N.id,A=N.duration*N.timescale,f=N.width,x=N.height,P=Math.floor(A/(Q+1)),w=Math.floor(A%(Q+1));return O.box(O.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,_>>24&255,_>>16&255,_>>8&255,_&255,0,0,0,0,P>>24,P>>16&255,P>>8&255,P&255,w>>24,w>>16&255,w>>8&255,w&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,f>>8&255,f&255,0,0,x>>8&255,x&255,0,0]))},O.traf=function(N,_){var A=O.sdtp(N),f=N.id,x=Math.floor(_/(Q+1)),P=Math.floor(_%(Q+1));return O.box(O.types.traf,O.box(O.types.tfhd,new Uint8Array([0,0,0,0,f>>24,f>>16&255,f>>8&255,f&255])),O.box(O.types.tfdt,new Uint8Array([1,0,0,0,x>>24,x>>16&255,x>>8&255,x&255,P>>24,P>>16&255,P>>8&255,P&255])),O.trun(N,A.length+16+20+8+16+8+8),A)},O.trak=function(N){return N.duration=N.duration||4294967295,O.box(O.types.trak,O.tkhd(N),O.mdia(N))},O.trex=function(N){var _=N.id;return O.box(O.types.trex,new Uint8Array([0,0,0,0,_>>24,_>>16&255,_>>8&255,_&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},O.trun=function(N,_){var A=N.samples||[],f=A.length,x=12+16*f,P=new Uint8Array(x),w,E,p,u,a,s;for(_+=8+x,P.set([0,0,15,1,f>>>24&255,f>>>16&255,f>>>8&255,f&255,_>>>24&255,_>>>16&255,_>>>8&255,_&255],0),w=0;w<f;w++)E=A[w],p=E.duration,u=E.size,a=E.flags,s=E.cts,P.set([p>>>24&255,p>>>16&255,p>>>8&255,p&255,u>>>24&255,u>>>16&255,u>>>8&255,u&255,a.isLeading<<2|a.dependsOn,a.isDependedOn<<6|a.hasRedundancy<<4|a.paddingValue<<1|a.isNonSync,a.degradPrio&240<<8,a.degradPrio&15,s>>>24&255,s>>>16&255,s>>>8&255,s&255],12+16*w);return O.box(O.types.trun,P)},O.initSegment=function(N){O.types||O.init();var _=O.moov(N),A=new Uint8Array(O.FTYP.byteLength+_.byteLength);return A.set(O.FTYP),A.set(_,O.FTYP.byteLength),A},O}();U.types=void 0,U.HDLR_TYPES=void 0,U.STTS=void 0,U.STSC=void 0,U.STCO=void 0,U.STSZ=void 0,U.VMHD=void 0,U.SMHD=void 0,U.STSD=void 0,U.FTYP=void 0,U.DINF=void 0,$.default=U},"./src/remux/mp4-remuxer.ts":function(ne,$,R){"use strict";R.r($),R.d($,"default",function(){return s}),R.d($,"normalizePts",function(){return h});var Q=R("./src/polyfills/number.ts"),U=R("./src/remux/aac-helper.ts"),O=R("./src/remux/mp4-generator.ts"),j=R("./src/events.ts"),N=R("./src/errors.ts"),_=R("./src/utils/logger.ts"),A=R("./src/types/loader.ts"),f=R("./src/utils/timescale-conversion.ts");function x(){return x=Object.assign||function(D){for(var T=1;T<arguments.length;T++){var g=arguments[T];for(var v in g)Object.prototype.hasOwnProperty.call(g,v)&&(D[v]=g[v])}return D},x.apply(this,arguments)}var P=10*1e3,w=1024,E=1152,p=null,u=null,a=!1,s=function(){function D(g,v,d,o){if(o===void 0&&(o=""),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=g,this.config=v,this.typeSupported=d,this.ISGenerated=!1,p===null){var C=navigator.userAgent||"",S=C.match(/Chrome\/(\d+)/i);p=S?parseInt(S[1]):0}if(u===null){var y=navigator.userAgent.match(/Safari\/(\d+)/i);u=y?parseInt(y[1]):0}a=!!p&&p<75||!!u&&u<600}var T=D.prototype;return T.destroy=function(){},T.resetTimeStamp=function(v){_.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=v},T.resetNextTimestamp=function(){_.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},T.resetInitSegment=function(){_.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},T.getVideoStartPts=function(v){var d=!1,o=v.reduce(function(C,S){var y=S.pts-C;return y<-4294967296?(d=!0,h(C,S.pts)):y>0?C:S.pts},v[0].pts);return d&&_.logger.debug("PTS rollover detected"),o},T.remux=function(v,d,o,C,S,y,M,F){var W,V,I,B,X,ee,oe=S,fe=S,ke=v.pid>-1,xe=d.pid>-1,Te=d.samples.length,Ce=v.samples.length>0,ge=Te>1,pe=(!ke||Ce)&&(!xe||ge)||this.ISGenerated||M;if(pe){this.ISGenerated||(I=this.generateIS(v,d,S));var ue=this.isVideoContiguous,te=-1;if(ge&&(te=k(d.samples),!ue&&this.config.forceKeyFrameOnDiscontinuity))if(ee=!0,te>0){_.logger.warn("[mp4-remuxer]: Dropped "+te+" out of "+Te+" video samples due to a missing keyframe");var de=this.getVideoStartPts(d.samples);d.samples=d.samples.slice(te),d.dropped+=te,fe+=(d.samples[0].pts-de)/(d.timescale||9e4)}else te===-1&&(_.logger.warn("[mp4-remuxer]: No keyframe found out of "+Te+" video samples"),ee=!1);if(this.ISGenerated){if(Ce&&ge){var ae=this.getVideoStartPts(d.samples),we=h(v.samples[0].pts,ae)-ae,Re=we/d.inputTimeScale;oe+=Math.max(0,Re),fe+=Math.max(0,-Re)}if(Ce){if(v.samplerate||(_.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),I=this.generateIS(v,d,S)),V=this.remuxAudio(v,oe,this.isAudioContiguous,y,xe||ge||F===A.PlaylistLevelType.AUDIO?fe:void 0),ge){var Ee=V?V.endPTS-V.startPTS:0;d.inputTimeScale||(_.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),I=this.generateIS(v,d,S)),W=this.remuxVideo(d,fe,ue,Ee)}}else ge&&(W=this.remuxVideo(d,fe,ue,0));W&&(W.firstKeyFrame=te,W.independent=te!==-1)}}return this.ISGenerated&&(o.samples.length&&(X=this.remuxID3(o,S)),C.samples.length&&(B=this.remuxText(C,S))),{audio:V,video:W,initSegment:I,independent:ee,text:B,id3:X}},T.generateIS=function(v,d,o){var C=v.samples,S=d.samples,y=this.typeSupported,M={},F=!Object(Q.isFiniteNumber)(this._initPTS),W="audio/mp4",V,I,B;if(F&&(V=I=Infinity),v.config&&C.length&&(v.timescale=v.samplerate,v.isAAC||(y.mpeg?(W="audio/mpeg",v.codec=""):y.mp3&&(v.codec="mp3")),M.audio={id:"audio",container:W,codec:v.codec,initSegment:!v.isAAC&&y.mpeg?new Uint8Array(0):O.default.initSegment([v]),metadata:{channelCount:v.channelCount}},F&&(B=v.inputTimeScale,V=I=C[0].pts-Math.round(B*o))),d.sps&&d.pps&&S.length&&(d.timescale=d.inputTimeScale,M.video={id:"main",container:"video/mp4",codec:d.codec,initSegment:O.default.initSegment([d]),metadata:{width:d.width,height:d.height}},F)){B=d.inputTimeScale;var X=this.getVideoStartPts(S),ee=Math.round(B*o);I=Math.min(I,h(S[0].dts,X)-ee),V=Math.min(V,X-ee)}if(Object.keys(M).length)return this.ISGenerated=!0,F&&(this._initPTS=V,this._initDTS=I),{tracks:M,initPTS:V,timescale:B}},T.remuxVideo=function(v,d,o,C){var S=v.inputTimeScale,y=v.samples,M=[],F=y.length,W=this._initPTS,V=this.nextAvcDts,I=8,B,X,ee,oe=Number.POSITIVE_INFINITY,fe=Number.NEGATIVE_INFINITY,ke=0,xe=!1;if(!o||V===null){var Te=d*S,Ce=y[0].pts-h(y[0].dts,y[0].pts);V=Te-Ce}for(var ge=0;ge<F;ge++){var pe=y[ge];if(pe.pts=h(pe.pts-W,V),pe.dts=h(pe.dts-W,V),pe.dts>pe.pts){var ue=9e4*.2;ke=Math.max(Math.min(ke,pe.pts-pe.dts),-1*ue)}pe.dts<y[ge>0?ge-1:ge].dts&&(xe=!0)}xe&&y.sort(function(Et,ft){var it=Et.dts-ft.dts,Rt=Et.pts-ft.pts;return it||Rt}),X=y[0].dts,ee=y[y.length-1].dts;var te=Math.round((ee-X)/(F-1));if(ke<0){if(ke<te*-2){_.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(f.toMsFromMpegTsClock)(-te,!0)+" ms");for(var de=ke,ae=0;ae<F;ae++)y[ae].dts=de=Math.max(de,y[ae].pts-te),y[ae].pts=Math.max(de,y[ae].pts)}else{_.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(f.toMsFromMpegTsClock)(ke,!0)+" ms to overcome this issue");for(var we=0;we<F;we++)y[we].dts=y[we].dts+ke}X=y[0].dts}if(o){var Re=X-V,Ee=Re>te,Me=Re<-1;if(Ee||Me){Ee?_.logger.warn("AVC: "+Object(f.toMsFromMpegTsClock)(Re,!0)+" ms ("+Re+"dts) hole between fragments detected, filling it"):_.logger.warn("AVC: "+Object(f.toMsFromMpegTsClock)(-Re,!0)+" ms ("+Re+"dts) overlapping between fragments detected"),X=V;var Ie=y[0].pts-Re;y[0].dts=X,y[0].pts=Ie,_.logger.log("Video: First PTS/DTS adjusted: "+Object(f.toMsFromMpegTsClock)(Ie,!0)+"/"+Object(f.toMsFromMpegTsClock)(X,!0)+", delta: "+Object(f.toMsFromMpegTsClock)(Re,!0)+" ms")}}a&&(X=Math.max(0,X));for(var We=0,je=0,Be=0;Be<F;Be++){for(var Ue=y[Be],et=Ue.units,ot=et.length,nt=0,qe=0;qe<ot;qe++)nt+=et[qe].data.length;je+=nt,We+=ot,Ue.length=nt,Ue.dts=Math.max(Ue.dts,X),Ue.pts=Math.max(Ue.pts,Ue.dts,0),oe=Math.min(Ue.pts,oe),fe=Math.max(Ue.pts,fe)}ee=y[F-1].dts;var st=je+4*We+8,$e;try{$e=new Uint8Array(st)}catch(Et){this.observer.emit(j.Events.ERROR,j.Events.ERROR,{type:N.ErrorTypes.MUX_ERROR,details:N.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:st,reason:"fail allocating video mdat "+st});return}var Qe=new DataView($e.buffer);Qe.setUint32(0,st),$e.set(O.default.types.mdat,4);for(var _e=0;_e<F;_e++){for(var ut=y[_e],lt=ut.units,Ne=0,Ke=0,Se=lt.length;Ke<Se;Ke++){var ve=lt[Ke],be=ve.data,re=ve.data.byteLength;Qe.setUint32(I,re),I+=4,$e.set(be,I),I+=re,Ne+=4+re}if(_e<F-1)B=y[_e+1].dts-ut.dts;else{var ie=this.config,le=ut.dts-y[_e>0?_e-1:_e].dts;if(ie.stretchShortVideoTrack&&this.nextAudioPts!==null){var he=Math.floor(ie.maxBufferHole*S),Le=(C?oe+C*S:this.nextAudioPts)-ut.pts;Le>he?(B=Le-le,B<0&&(B=le),_.logger.log("[mp4-remuxer]: It is approximately "+Le/90+" ms to the next segment; using duration "+B/90+" ms for the last video frame.")):B=le}else B=le}var Pe=Math.round(ut.pts-ut.dts);M.push(new c(ut.key,B,Ne,Pe))}if(M.length&&p&&p<70){var Xe=M[0].flags;Xe.dependsOn=2,Xe.isNonSync=0}console.assert(B!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=V=ee+B,this.isVideoContiguous=!0;var vt=O.default.moof(v.sequenceNumber++,X,x({},v,{samples:M})),Dt="video",Ge={data1:vt,data2:$e,startPTS:oe/S,endPTS:(fe+B)/S,startDTS:X/S,endDTS:V/S,type:Dt,hasAudio:!1,hasVideo:!0,nb:M.length,dropped:v.dropped};return v.samples=[],v.dropped=0,console.assert($e.length,"MDAT length must not be zero"),Ge},T.remuxAudio=function(v,d,o,C,S){var y=v.inputTimeScale,M=v.samplerate?v.samplerate:y,F=y/M,W=v.isAAC?w:E,V=W*F,I=this._initPTS,B=!v.isAAC&&this.typeSupported.mpeg,X=[],ee=v.samples,oe=B?0:8,fe=this.nextAudioPts||-1,ke=d*y;if(this.isAudioContiguous=o=o||ee.length&&fe>0&&(C&&Math.abs(ke-fe)<9e3||Math.abs(h(ee[0].pts-I,ke)-fe)<20*V),ee.forEach(function(be){be.pts=h(be.pts-I,ke)}),!o||fe<0){if(ee=ee.filter(function(be){return be.pts>=0}),!ee.length)return;S===0?fe=0:C?fe=Math.max(0,ke):fe=ee[0].pts}if(v.isAAC)for(var xe=S!==void 0,Te=this.config.maxAudioFramesDrift,Ce=0,ge=fe;Ce<ee.length;Ce++){var pe=ee[Ce],ue=pe.pts,te=ue-ge,de=Math.abs(1e3*te/y);if(te<=-Te*V&&xe)Ce===0&&(_.logger.warn("Audio frame @ "+(ue/y).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*te/y)+" ms."),this.nextAudioPts=fe=ge=ue);else if(te>=Te*V&&de<P&&xe){var ae=Math.round(te/V);ge=ue-ae*V,ge<0&&(ae--,ge+=V),Ce===0&&(this.nextAudioPts=fe=ge),_.logger.warn("[mp4-remuxer]: Injecting "+ae+" audio frame @ "+(ge/y).toFixed(3)+"s due to "+Math.round(1e3*te/y)+" ms gap.");for(var we=0;we<ae;we++){var Re=Math.max(ge,0),Ee=U.default.getSilentFrame(v.manifestCodec||v.codec,v.channelCount);Ee||(_.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),Ee=pe.unit.subarray()),ee.splice(Ce,0,{unit:Ee,pts:Re}),ge+=V,Ce++}}pe.pts=ge,ge+=V}for(var Me=null,Ie=null,We,je=0,Be=ee.length;Be--;)je+=ee[Be].unit.byteLength;for(var Ue=0,et=ee.length;Ue<et;Ue++){var ot=ee[Ue],nt=ot.unit,qe=ot.pts;if(Ie!==null){var st=X[Ue-1];st.duration=Math.round((qe-Ie)/F)}else if(o&&v.isAAC&&(qe=fe),Me=qe,je>0){je+=oe;try{We=new Uint8Array(je)}catch(be){this.observer.emit(j.Events.ERROR,j.Events.ERROR,{type:N.ErrorTypes.MUX_ERROR,details:N.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:je,reason:"fail allocating audio mdat "+je});return}if(!B){var $e=new DataView(We.buffer);$e.setUint32(0,je),We.set(O.default.types.mdat,4)}}else return;We.set(nt,oe);var Qe=nt.byteLength;oe+=Qe,X.push(new c(!0,W,Qe,0)),Ie=qe}var _e=X.length;if(!_e)return;var ut=X[X.length-1];this.nextAudioPts=fe=Ie+F*ut.duration;var lt=B?new Uint8Array(0):O.default.moof(v.sequenceNumber++,Me/F,x({},v,{samples:X}));v.samples=[];var Ne=Me/y,Ke=fe/y,Se="audio",ve={data1:lt,data2:We,startPTS:Ne,endPTS:Ke,startDTS:Ne,endDTS:Ke,type:Se,hasAudio:!0,hasVideo:!1,nb:_e};return this.isAudioContiguous=!0,console.assert(We.length,"MDAT length must not be zero"),ve},T.remuxEmptyAudio=function(v,d,o,C){var S=v.inputTimeScale,y=v.samplerate?v.samplerate:S,M=S/y,F=this.nextAudioPts,W=(F!==null?F:C.startDTS*S)+this._initDTS,V=C.endDTS*S+this._initDTS,I=M*w,B=Math.ceil((V-W)/I),X=U.default.getSilentFrame(v.manifestCodec||v.codec,v.channelCount);if(_.logger.warn("[mp4-remuxer]: remux empty Audio"),!X){_.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<B;oe++){var fe=W+oe*I;ee.push({unit:X,pts:fe,dts:fe})}return v.samples=ee,this.remuxAudio(v,d,o,!1)},T.remuxID3=function(v,d){var o=v.samples.length;if(!o)return;for(var C=v.inputTimeScale,S=this._initPTS,y=this._initDTS,M=0;M<o;M++){var F=v.samples[M];F.pts=h(F.pts-S,d*C)/C,F.dts=h(F.dts-y,d*C)/C}var W=v.samples;return v.samples=[],{samples:W}},T.remuxText=function(v,d){var o=v.samples.length;if(!o)return;for(var C=v.inputTimeScale,S=this._initPTS,y=0;y<o;y++){var M=v.samples[y];M.pts=h(M.pts-S,d*C)/C}v.samples.sort(function(W,V){return W.pts-V.pts});var F=v.samples;return v.samples=[],{samples:F}},D}();function h(D,T){var g;if(T===null)return D;for(T<D?g=-8589934592:g=8589934592;Math.abs(D-T)>4294967296;)D+=g;return D}function k(D){for(var T=0;T<D.length;T++)if(D[T].key)return T;return-1}var c=function(T,g,v,d){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=g,this.size=v,this.cts=d,this.flags=new b(T)},b=function(T){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=T?2:1,this.isNonSync=T?0:1}},"./src/remux/passthrough-remuxer.ts":function(ne,$,R){"use strict";R.r($);var Q=R("./src/polyfills/number.ts"),U=R("./src/utils/mp4-tools.ts"),O=R("./src/loader/fragment.ts"),j=R("./src/utils/logger.ts"),N=function(){function f(){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 x=f.prototype;return x.destroy=function(){},x.resetTimeStamp=function(w){this.initPTS=w,this.lastEndDTS=null},x.resetNextTimestamp=function(){this.lastEndDTS=null},x.resetInitSegment=function(w,E,p){this.audioCodec=E,this.videoCodec=p,this.generateInitSegment(w),this.emitInitSegment=!0},x.generateInitSegment=function(w){var E=this.audioCodec,p=this.videoCodec;if(!w||!w.byteLength){this.initTracks=void 0,this.initData=void 0;return}var u=this.initData=Object(U.parseInitSegment)(w);E||(E=A(u.audio,O.ElementaryStreamTypes.AUDIO)),p||(p=A(u.video,O.ElementaryStreamTypes.VIDEO));var a={};u.audio&&u.video?a.audiovideo={container:"video/mp4",codec:E+","+p,initSegment:w,id:"main"}:u.audio?a.audio={container:"audio/mp4",codec:E,initSegment:w,id:"audio"}:u.video?a.video={container:"video/mp4",codec:p,initSegment:w,id:"main"}:j.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=a},x.remux=function(w,E,p,u,a){var s=this.initPTS,h=this.lastEndDTS,k={audio:void 0,video:void 0,text:u,id3:p,initSegment:void 0};Object(Q.isFiniteNumber)(h)||(h=this.lastEndDTS=a||0);var c=E.samples;if(!c||!c.length)return k;var b={initPTS:void 0,timescale:1},D=this.initData;if((!D||!D.length)&&(this.generateInitSegment(c),D=this.initData),!D||!D.length)return j.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),k;this.emitInitSegment&&(b.tracks=this.initTracks,this.emitInitSegment=!1),Object(Q.isFiniteNumber)(s)||(this.initPTS=b.initPTS=s=_(D,c,h));var T=Object(U.getDuration)(c,D),g=h,v=T+g;Object(U.offsetStartDTS)(D,c,s),T>0?this.lastEndDTS=v:(j.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var d=!!D.audio,o=!!D.video,C="";d&&(C+="audio"),o&&(C+="video");var S={data1:c,startPTS:g,startDTS:g,endPTS:v,endDTS:v,type:C,hasAudio:d,hasVideo:o,nb:1,dropped:0};return k.audio=S.type==="audio"?S:void 0,k.video=S.type!=="audio"?S:void 0,k.text=u,k.id3=p,k.initSegment=b,k},f}(),_=function(x,P,w){return Object(U.getStartDTS)(x,P)-w};function A(f,x){var P=f==null?void 0:f.codec;return P&&P.length>4?P:P==="hvc1"?"hvc1.1.c.L120.90":P==="av01"?"av01.0.04M.08":P==="avc1"||x===O.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}$.default=N},"./src/task-loop.ts":function(ne,$,R){"use strict";R.r($),R.d($,"default",function(){return Q});var Q=function(){function U(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var O=U.prototype;return O.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},O.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},O.onHandlerDestroyed=function(){},O.hasInterval=function(){return!!this._tickInterval},O.hasNextTick=function(){return!!this._tickTimer},O.setInterval=function(N){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,N),!0)},O.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},O.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},O.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},O.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},O.doTick=function(){},U}()},"./src/types/cmcd.ts":function(ne,$,R){"use strict";R.r($),R.d($,"CMCDVersion",function(){return Q}),R.d($,"CMCDObjectType",function(){return U}),R.d($,"CMCDStreamingFormat",function(){return O}),R.d($,"CMCDStreamType",function(){return j});var Q=1,U;(function(N){N.MANIFEST="m",N.AUDIO="a",N.VIDEO="v",N.MUXED="av",N.INIT="i",N.CAPTION="c",N.TIMED_TEXT="tt",N.KEY="k",N.OTHER="o"})(U||(U={}));var O;(function(N){N.DASH="d",N.HLS="h",N.SMOOTH="s",N.OTHER="o"})(O||(O={}));var j;(function(N){N.VOD="v",N.LIVE="l"})(j||(j={}))},"./src/types/level.ts":function(ne,$,R){"use strict";R.r($),R.d($,"HlsSkip",function(){return O}),R.d($,"getSkipValue",function(){return j}),R.d($,"HlsUrlParameters",function(){return N}),R.d($,"Level",function(){return _});function Q(A,f){for(var x=0;x<f.length;x++){var P=f[x];P.enumerable=P.enumerable||!1,P.configurable=!0,"value"in P&&(P.writable=!0),Object.defineProperty(A,P.key,P)}}function U(A,f,x){return f&&Q(A.prototype,f),x&&Q(A,x),A}var O;(function(A){A.No="",A.Yes="YES",A.v2="v2"})(O||(O={}));function j(A,f){var x=A.canSkipUntil,P=A.canSkipDateRanges,w=A.endSN,E=f!==void 0?f-w:0;return x&&E<x?P?O.v2:O.Yes:O.No}var N=function(){function A(x,P,w){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=x,this.part=P,this.skip=w}var f=A.prototype;return f.addDirectives=function(P){var w=new self.URL(P);return this.msn!==void 0&&w.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&w.searchParams.set("_HLS_part",this.part.toString()),this.skip&&w.searchParams.set("_HLS_skip",this.skip),w.toString()},A}(),_=function(){function A(f){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=[f.url],this.attrs=f.attrs,this.bitrate=f.bitrate,f.details&&(this.details=f.details),this.id=f.id||0,this.name=f.name,this.width=f.width||0,this.height=f.height||0,this.audioCodec=f.audioCodec,this.videoCodec=f.videoCodec,this.unknownCodecs=f.unknownCodecs,this.codecSet=[f.videoCodec,f.audioCodec].filter(function(x){return x}).join(",").replace(/\.[^.,]+/g,"")}return U(A,[{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(x){var P=x%this.url.length;this._urlId!==P&&(this.details=void 0,this._urlId=P)}}]),A}()},"./src/types/loader.ts":function(ne,$,R){"use strict";R.r($),R.d($,"PlaylistContextType",function(){return Q}),R.d($,"PlaylistLevelType",function(){return U});var Q;(function(O){O.MANIFEST="manifest",O.LEVEL="level",O.AUDIO_TRACK="audioTrack",O.SUBTITLE_TRACK="subtitleTrack"})(Q||(Q={}));var U;(function(O){O.MAIN="main",O.AUDIO="audio",O.SUBTITLE="subtitle"})(U||(U={}))},"./src/types/transmuxer.ts":function(ne,$,R){"use strict";R.r($),R.d($,"ChunkMetadata",function(){return Q});var Q=function(j,N,_,A,f,x){A===void 0&&(A=0),f===void 0&&(f=-1),x===void 0&&(x=!1),this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=U(),this.buffering={audio:U(),video:U(),audiovideo:U()},this.level=j,this.sn=N,this.id=_,this.size=A,this.part=f,this.partial=x};function U(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(ne,$,R){"use strict";R.r($),R.d($,"AttrList",function(){return O});var Q=/^(\d+)x(\d+)$/,U=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,O=function(){function j(_){typeof _=="string"&&(_=j.parseAttrList(_));for(var A in _)_.hasOwnProperty(A)&&(this[A]=_[A])}var N=j.prototype;return N.decimalInteger=function(A){var f=parseInt(this[A],10);return f>Number.MAX_SAFE_INTEGER?Infinity:f},N.hexadecimalInteger=function(A){if(this[A]){var f=(this[A]||"0x").slice(2);f=(f.length&1?"0":"")+f;for(var x=new Uint8Array(f.length/2),P=0;P<f.length/2;P++)x[P]=parseInt(f.slice(P*2,P*2+2),16);return x}else return null},N.hexadecimalIntegerAsNumber=function(A){var f=parseInt(this[A],16);return f>Number.MAX_SAFE_INTEGER?Infinity:f},N.decimalFloatingPoint=function(A){return parseFloat(this[A])},N.optionalFloat=function(A,f){var x=this[A];return x?parseFloat(x):f},N.enumeratedString=function(A){return this[A]},N.bool=function(A){return this[A]==="YES"},N.decimalResolution=function(A){var f=Q.exec(this[A]);return f===null?void 0:{width:parseInt(f[1],10),height:parseInt(f[2],10)}},j.parseAttrList=function(A){var f,x={},P='"';for(U.lastIndex=0;(f=U.exec(A))!==null;){var w=f[2];w.indexOf(P)===0&&w.lastIndexOf(P)===w.length-1&&(w=w.slice(1,-1)),x[f[1]]=w}return x},j}()},"./src/utils/binary-search.ts":function(ne,$,R){"use strict";R.r($);var Q={search:function(O,j){for(var N=0,_=O.length-1,A=null,f=null;N<=_;){A=(N+_)/2|0,f=O[A];var x=j(f);if(x>0)N=A+1;else if(x<0)_=A-1;else return f}return null}};$.default=Q},"./src/utils/buffer-helper.ts":function(ne,$,R){"use strict";R.r($),R.d($,"BufferHelper",function(){return O});var Q=R("./src/utils/logger.ts"),U={length:0,start:function(){return 0},end:function(){return 0}},O=function(){function j(){}return j.isBuffered=function(_,A){try{if(_){for(var f=j.getBuffered(_),x=0;x<f.length;x++)if(A>=f.start(x)&&A<=f.end(x))return!0}}catch(P){}return!1},j.bufferInfo=function(_,A,f){try{if(_){var x=j.getBuffered(_),P=[],w;for(w=0;w<x.length;w++)P.push({start:x.start(w),end:x.end(w)});return this.bufferedInfo(P,A,f)}}catch(E){}return{len:0,start:A,end:A,nextStart:void 0}},j.bufferedInfo=function(_,A,f){A=Math.max(0,A),_.sort(function(b,D){var T=b.start-D.start;return T||D.end-b.end});var x=[];if(f)for(var P=0;P<_.length;P++){var w=x.length;if(w){var E=x[w-1].end;_[P].start-E<f?_[P].end>E&&(x[w-1].end=_[P].end):x.push(_[P])}else x.push(_[P])}else x=_;for(var p=0,u,a=A,s=A,h=0;h<x.length;h++){var k=x[h].start,c=x[h].end;if(A+f>=k&&A<c)a=k,s=c,p=s-A;else if(A+f<k){u=k;break}}return{len:p,start:a||0,end:s||0,nextStart:u}},j.getBuffered=function(_){try{return _.buffered}catch(A){return Q.logger.log("failed to get media.buffered",A),U}},j}()},"./src/utils/cea-608-parser.ts":function(ne,$,R){"use strict";R.r($),R.d($,"Row",function(){return s}),R.d($,"CaptionScreen",function(){return h});var Q=R("./src/utils/logger.ts"),U={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},O=function(v){var d=v;return U.hasOwnProperty(v)&&(d=U[v]),String.fromCharCode(d)},j=15,N=100,_={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},A={17:2,18:4,21:6,22:8,23:10,19:13,20:15},f={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},x={25:2,26:4,29:6,30:8,31:10,27:13,28:15},P=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],w;(function(g){g[g.ERROR=0]="ERROR",g[g.TEXT=1]="TEXT",g[g.WARNING=2]="WARNING",g[g.INFO=2]="INFO",g[g.DEBUG=3]="DEBUG",g[g.DATA=3]="DATA"})(w||(w={}));var E=function(){function g(){this.time=null,this.verboseLevel=w.ERROR}var v=g.prototype;return v.log=function(o,C){this.verboseLevel>=o&&Q.logger.log(this.time+" ["+o+"] "+C)},g}(),p=function(v){for(var d=[],o=0;o<v.length;o++)d.push(v[o].toString(16));return d},u=function(){function g(d,o,C,S,y){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=d||"white",this.underline=o||!1,this.italics=C||!1,this.background=S||"black",this.flash=y||!1}var v=g.prototype;return v.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},v.setStyles=function(o){for(var C=["foreground","underline","italics","background","flash"],S=0;S<C.length;S++){var y=C[S];o.hasOwnProperty(y)&&(this[y]=o[y])}},v.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},v.equals=function(o){return this.foreground===o.foreground&&this.underline===o.underline&&this.italics===o.italics&&this.background===o.background&&this.flash===o.flash},v.copy=function(o){this.foreground=o.foreground,this.underline=o.underline,this.italics=o.italics,this.background=o.background,this.flash=o.flash},v.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},g}(),a=function(){function g(d,o,C,S,y,M){this.uchar=void 0,this.penState=void 0,this.uchar=d||" ",this.penState=new u(o,C,S,y,M)}var v=g.prototype;return v.reset=function(){this.uchar=" ",this.penState.reset()},v.setChar=function(o,C){this.uchar=o,this.penState.copy(C)},v.setPenState=function(o){this.penState.copy(o)},v.equals=function(o){return this.uchar===o.uchar&&this.penState.equals(o.penState)},v.copy=function(o){this.uchar=o.uchar,this.penState.copy(o.penState)},v.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},g}(),s=function(){function g(d){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var o=0;o<N;o++)this.chars.push(new a);this.logger=d,this.pos=0,this.currPenState=new u}var v=g.prototype;return v.equals=function(o){for(var C=!0,S=0;S<N;S++)if(!this.chars[S].equals(o.chars[S])){C=!1;break}return C},v.copy=function(o){for(var C=0;C<N;C++)this.chars[C].copy(o.chars[C])},v.isEmpty=function(){for(var o=!0,C=0;C<N;C++)if(!this.chars[C].isEmpty()){o=!1;break}return o},v.setCursor=function(o){this.pos!==o&&(this.pos=o),this.pos<0?(this.logger.log(w.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>N&&(this.logger.log(w.DEBUG,"Too large cursor position "+this.pos),this.pos=N)},v.moveCursor=function(o){var C=this.pos+o;if(o>1)for(var S=this.pos+1;S<C+1;S++)this.chars[S].setPenState(this.currPenState);this.setCursor(C)},v.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},v.insertChar=function(o){o>=144&&this.backSpace();var C=O(o);if(this.pos>=N){this.logger.log(w.ERROR,"Cannot insert "+o.toString(16)+" ("+C+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(C,this.currPenState),this.moveCursor(1)},v.clearFromPos=function(o){var C;for(C=o;C<N;C++)this.chars[C].reset()},v.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},v.clearToEndOfRow=function(){this.clearFromPos(this.pos)},v.getTextString=function(){for(var o=[],C=!0,S=0;S<N;S++){var y=this.chars[S].uchar;y!==" "&&(C=!1),o.push(y)}return C?"":o.join("")},v.setPenStyles=function(o){this.currPenState.setStyles(o);var C=this.chars[this.pos];C.setPenState(this.currPenState)},g}(),h=function(){function g(d){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var o=0;o<j;o++)this.rows.push(new s(d));this.logger=d,this.currRow=j-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var v=g.prototype;return v.reset=function(){for(var o=0;o<j;o++)this.rows[o].clear();this.currRow=j-1},v.equals=function(o){for(var C=!0,S=0;S<j;S++)if(!this.rows[S].equals(o.rows[S])){C=!1;break}return C},v.copy=function(o){for(var C=0;C<j;C++)this.rows[C].copy(o.rows[C])},v.isEmpty=function(){for(var o=!0,C=0;C<j;C++)if(!this.rows[C].isEmpty()){o=!1;break}return o},v.backSpace=function(){var o=this.rows[this.currRow];o.backSpace()},v.clearToEndOfRow=function(){var o=this.rows[this.currRow];o.clearToEndOfRow()},v.insertChar=function(o){var C=this.rows[this.currRow];C.insertChar(o)},v.setPen=function(o){var C=this.rows[this.currRow];C.setPenStyles(o)},v.moveCursor=function(o){var C=this.rows[this.currRow];C.moveCursor(o)},v.setCursor=function(o){this.logger.log(w.INFO,"setCursor: "+o);var C=this.rows[this.currRow];C.setCursor(o)},v.setPAC=function(o){this.logger.log(w.INFO,"pacData = "+JSON.stringify(o));var C=o.row-1;if(this.nrRollUpRows&&C<this.nrRollUpRows-1&&(C=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==C){for(var S=0;S<j;S++)this.rows[S].clear();var y=this.currRow+1-this.nrRollUpRows,M=this.lastOutputScreen;if(M){var F=M.rows[y].cueStartTime,W=this.logger.time;if(F&&W!==null&&F<W)for(var V=0;V<this.nrRollUpRows;V++)this.rows[C-this.nrRollUpRows+V+1].copy(M.rows[y+V])}}this.currRow=C;var I=this.rows[this.currRow];if(o.indent!==null){var B=o.indent,X=Math.max(B-1,0);I.setCursor(o.indent),o.color=I.chars[X].penState.foreground}var ee={foreground:o.color,underline:o.underline,italics:o.italics,background:"black",flash:!1};this.setPen(ee)},v.setBkgData=function(o){this.logger.log(w.INFO,"bkgData = "+JSON.stringify(o)),this.backSpace(),this.setPen(o),this.insertChar(32)},v.setRollUpRows=function(o){this.nrRollUpRows=o},v.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(w.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(w.TEXT,this.getDisplayText());var o=this.currRow+1-this.nrRollUpRows,C=this.rows.splice(o,1)[0];C.clear(),this.rows.splice(this.currRow,0,C),this.logger.log(w.INFO,"Rolling up")},v.getDisplayText=function(o){o=o||!1;for(var C=[],S="",y=-1,M=0;M<j;M++){var F=this.rows[M].getTextString();F&&(y=M+1,o?C.push("Row "+y+": '"+F+"'"):C.push(F.trim()))}return C.length>0&&(o?S="["+C.join(" | ")+"]":S=C.join(`
`)),S},v.getTextAndFormat=function(){return this.rows},g}(),k=function(){function g(d,o,C){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=d,this.outputFilter=o,this.mode=null,this.verbose=0,this.displayedMemory=new h(C),this.nonDisplayedMemory=new h(C),this.lastOutputScreen=new h(C),this.currRollUpRow=this.displayedMemory.rows[j-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=C}var v=g.prototype;return v.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[j-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},v.getHandler=function(){return this.outputFilter},v.setHandler=function(o){this.outputFilter=o},v.setPAC=function(o){this.writeScreen.setPAC(o)},v.setBkgData=function(o){this.writeScreen.setBkgData(o)},v.setMode=function(o){if(o===this.mode)return;this.mode=o,this.logger.log(w.INFO,"MODE="+o),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=o},v.insertChars=function(o){for(var C=0;C<o.length;C++)this.writeScreen.insertChar(o[C]);var S=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(w.INFO,S+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(w.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},v.ccRCL=function(){this.logger.log(w.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},v.ccBS=function(){if(this.logger.log(w.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},v.ccAOF=function(){},v.ccAON=function(){},v.ccDER=function(){this.logger.log(w.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},v.ccRU=function(o){this.logger.log(w.INFO,"RU("+o+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(o)},v.ccFON=function(){this.logger.log(w.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},v.ccRDC=function(){this.logger.log(w.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},v.ccTR=function(){this.logger.log(w.INFO,"TR"),this.setMode("MODE_TEXT")},v.ccRTD=function(){this.logger.log(w.INFO,"RTD"),this.setMode("MODE_TEXT")},v.ccEDM=function(){this.logger.log(w.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},v.ccCR=function(){this.logger.log(w.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},v.ccENM=function(){this.logger.log(w.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},v.ccEOC=function(){if(this.logger.log(w.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var o=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=o,this.writeScreen=this.nonDisplayedMemory,this.logger.log(w.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},v.ccTO=function(o){this.logger.log(w.INFO,"TO("+o+") - Tab Offset"),this.writeScreen.moveCursor(o)},v.ccMIDROW=function(o){var C={flash:!1};if(C.underline=o%2===1,C.italics=o>=46,C.italics)C.foreground="white";else{var S=Math.floor(o/2)-16,y=["white","green","blue","cyan","red","yellow","magenta"];C.foreground=y[S]}this.logger.log(w.INFO,"MIDROW: "+JSON.stringify(C)),this.writeScreen.setPen(C)},v.outputDataUpdate=function(o){o===void 0&&(o=!1);var C=this.logger.time;if(C===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=C:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,C,this.lastOutputScreen),o&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:C),this.lastOutputScreen.copy(this.displayedMemory))},v.cueSplitAtTime=function(o){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,o,this.displayedMemory),this.cueStartTime=o))},g}(),c=function(){function g(d,o,C){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var S=new E;this.channels=[null,new k(d,o,S),new k(d+1,C,S)],this.cmdHistory=T(),this.logger=S}var v=g.prototype;return v.getHandler=function(o){return this.channels[o].getHandler()},v.setHandler=function(o,C){this.channels[o].setHandler(C)},v.addData=function(o,C){var S,y,M,F=!1;this.logger.time=o;for(var W=0;W<C.length;W+=2){if(y=C[W]&127,M=C[W+1]&127,y===0&&M===0)continue;if(this.logger.log(w.DATA,"["+p([C[W],C[W+1]])+"] -> ("+p([y,M])+")"),S=this.parseCmd(y,M),S||(S=this.parseMidrow(y,M)),S||(S=this.parsePAC(y,M)),S||(S=this.parseBackgroundAttributes(y,M)),!S&&(F=this.parseChars(y,M),F)){var V=this.currentChannel;if(V&&V>0){var I=this.channels[V];I.insertChars(F)}else this.logger.log(w.WARNING,"No channel found yet. TEXT-MODE?")}!S&&!F&&this.logger.log(w.WARNING,"Couldn't parse cleaned data "+p([y,M])+" orig: "+p([C[W],C[W+1]]))}},v.parseCmd=function(o,C){var S=this.cmdHistory,y=(o===20||o===28||o===21||o===29)&&C>=32&&C<=47,M=(o===23||o===31)&&C>=33&&C<=35;if(!(y||M))return!1;if(D(o,C,S))return b(null,null,S),this.logger.log(w.DEBUG,"Repeated command ("+p([o,C])+") is dropped"),!0;var F=o===20||o===21||o===23?1:2,W=this.channels[F];return o===20||o===21||o===28||o===29?C===32?W.ccRCL():C===33?W.ccBS():C===34?W.ccAOF():C===35?W.ccAON():C===36?W.ccDER():C===37?W.ccRU(2):C===38?W.ccRU(3):C===39?W.ccRU(4):C===40?W.ccFON():C===41?W.ccRDC():C===42?W.ccTR():C===43?W.ccRTD():C===44?W.ccEDM():C===45?W.ccCR():C===46?W.ccENM():C===47&&W.ccEOC():W.ccTO(C-32),b(o,C,S),this.currentChannel=F,!0},v.parseMidrow=function(o,C){var S=0;if((o===17||o===25)&&C>=32&&C<=47){if(o===17?S=1:S=2,S!==this.currentChannel)return this.logger.log(w.ERROR,"Mismatch channel in midrow parsing"),!1;var y=this.channels[S];return y?(y.ccMIDROW(C),this.logger.log(w.DEBUG,"MIDROW ("+p([o,C])+")"),!0):!1}return!1},v.parsePAC=function(o,C){var S,y=this.cmdHistory,M=(o>=17&&o<=23||o>=25&&o<=31)&&C>=64&&C<=127,F=(o===16||o===24)&&C>=64&&C<=95;if(!(M||F))return!1;if(D(o,C,y))return b(null,null,y),!0;var W=o<=23?1:2;C>=64&&C<=95?S=W===1?_[o]:f[o]:S=W===1?A[o]:x[o];var V=this.channels[W];return V?(V.setPAC(this.interpretPAC(S,C)),b(o,C,y),this.currentChannel=W,!0):!1},v.interpretPAC=function(o,C){var S,y={color:null,italics:!1,indent:null,underline:!1,row:o};return C>95?S=C-96:S=C-64,y.underline=(S&1)===1,S<=13?y.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(S/2)]:S<=15?(y.italics=!0,y.color="white"):y.indent=Math.floor((S-16)/2)*4,y},v.parseChars=function(o,C){var S,y=null,M=null;if(o>=25?(S=2,M=o-8):(S=1,M=o),M>=17&&M<=19){var F;M===17?F=C+80:M===18?F=C+112:F=C+144,this.logger.log(w.INFO,"Special char '"+O(F)+"' in channel "+S),y=[F]}else o>=32&&o<=127&&(y=C===0?[o]:[o,C]);if(y){var W=p(y);this.logger.log(w.DEBUG,"Char codes = "+W.join(",")),b(o,C,this.cmdHistory)}return y},v.parseBackgroundAttributes=function(o,C){var S=(o===16||o===24)&&C>=32&&C<=47,y=(o===23||o===31)&&C>=45&&C<=47;if(!(S||y))return!1;var M,F={};o===16||o===24?(M=Math.floor((C-32)/2),F.background=P[M],C%2===1&&(F.background=F.background+"_semi")):C===45?F.background="transparent":(F.foreground="black",C===47&&(F.underline=!0));var W=o<=23?1:2,V=this.channels[W];return V.setBkgData(F),b(o,C,this.cmdHistory),!0},v.reset=function(){for(var o=0;o<Object.keys(this.channels).length;o++){var C=this.channels[o];C&&C.reset()}this.cmdHistory=T()},v.cueSplitAtTime=function(o){for(var C=0;C<this.channels.length;C++){var S=this.channels[C];S&&S.cueSplitAtTime(o)}},g}();function b(g,v,d){d.a=g,d.b=v}function D(g,v,d){return d.a===g&&d.b===v}function T(){return{a:null,b:null}}$.default=c},"./src/utils/codecs.ts":function(ne,$,R){"use strict";R.r($),R.d($,"isCodecType",function(){return U}),R.d($,"isCodecSupportedInMp4",function(){return O});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 U(j,N){var _=Q[N];return!!_&&_[j.slice(0,4)]===!0}function O(j,N){return MediaSource.isTypeSupported((N||"video")+'/mp4;codecs="'+j+'"')}},"./src/utils/cues.ts":function(ne,$,R){"use strict";R.r($);var Q=R("./src/utils/vttparser.ts"),U=R("./src/utils/webvtt-parser.ts"),O=R("./src/utils/texttrack-utils.ts"),j=/\s/,N={newCue:function(A,f,x,P){for(var w=[],E,p,u,a,s,h=self.VTTCue||self.TextTrackCue,k=0;k<P.rows.length;k++)if(E=P.rows[k],u=!0,a=0,s="",!E.isEmpty()){for(var c=0;c<E.chars.length;c++)j.test(E.chars[c].uchar)&&u?a++:(s+=E.chars[c].uchar,u=!1);E.cueStartTime=f,f===x&&(x+=1e-4),a>=16?a--:a++;var b=Object(Q.fixLineBreaks)(s.trim()),D=Object(U.generateCueId)(f,x,b);(!A||!A.cues||!A.cues.getCueById(D))&&(p=new h(f,x,b),p.id=D,p.line=k+1,p.align="left",p.position=10+Math.min(80,Math.floor(a*8/32)*10),w.push(p))}return A&&w.length&&(w.sort(function(T,g){return T.line==="auto"||g.line==="auto"?0:T.line>8&&g.line>8?g.line-T.line:T.line-g.line}),w.forEach(function(T){return Object(O.addCueToTrack)(A,T)})),w}};$.default=N},"./src/utils/discontinuities.ts":function(ne,$,R){"use strict";R.r($),R.d($,"findFirstFragWithCC",function(){return j}),R.d($,"shouldAlignOnDiscontinuities",function(){return N}),R.d($,"findDiscontinuousReferenceFrag",function(){return _}),R.d($,"adjustSlidingStart",function(){return f}),R.d($,"alignStream",function(){return x}),R.d($,"alignPDT",function(){return w}),R.d($,"alignFragmentByPDTDelta",function(){return E}),R.d($,"alignMediaPlaylistByPDT",function(){return p});var Q=R("./src/polyfills/number.ts"),U=R("./src/utils/logger.ts"),O=R("./src/controller/level-helper.ts");function j(u,a){for(var s=null,h=0,k=u.length;h<k;h++){var c=u[h];if(c&&c.cc===a){s=c;break}}return s}function N(u,a,s){return!!(a.details&&(s.endCC>s.startCC||u&&u.cc<s.startCC))}function _(u,a){var s=u.fragments,h=a.fragments;if(!h.length||!s.length){U.logger.log("No fragments to align");return}var k=j(s,h[0].cc);if(!k||k&&!k.startPTS){U.logger.log("No frag in previous level to align on");return}return k}function A(u,a){if(u){var s=u.start+a;u.start=u.startPTS=s,u.endPTS=s+u.duration}}function f(u,a){for(var s=a.fragments,h=0,k=s.length;h<k;h++)A(s[h],u);a.fragmentHint&&A(a.fragmentHint,u),a.alignedSliding=!0}function x(u,a,s){if(!a)return;P(u,s,a),!s.alignedSliding&&a.details&&w(s,a.details),!s.alignedSliding&&a.details&&!s.skippedSegments&&Object(O.adjustSliding)(a.details,s)}function P(u,a,s){if(N(u,s,a)){var h=_(s.details,a);h&&Object(Q.isFiniteNumber)(h.start)&&(U.logger.log("Adjusting PTS using last level due to CC increase within current level "+a.url),f(h.start,a))}}function w(u,a){if(!a.fragments.length||!u.hasProgramDateTime||!a.hasProgramDateTime)return;var s=a.fragments[0].programDateTime,h=u.fragments[0].programDateTime,k=(h-s)/1e3+a.fragments[0].start;k&&Object(Q.isFiniteNumber)(k)&&(U.logger.log("Adjusting PTS using programDateTime delta "+(h-s)+"ms, sliding:"+k.toFixed(3)+" "+u.url+" "),f(k,u))}function E(u,a){var s=u.programDateTime;if(!s)return;var h=(s-a)/1e3;u.start=u.startPTS=h,u.endPTS=h+u.duration}function p(u,a){if(!a.fragments.length||!u.hasProgramDateTime||!a.hasProgramDateTime)return;var s=a.fragments[0].programDateTime,h=a.fragments[0].start,k=s-h*1e3;u.fragments.forEach(function(c){E(c,k)}),u.fragmentHint&&E(u.fragmentHint,k),u.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(ne,$,R){"use strict";R.r($);var Q=R("./src/utils/ewma.ts"),U=function(){function O(N,_,A){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=A,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new Q.default(N),this.fast_=new Q.default(_)}var j=O.prototype;return j.update=function(_,A){var f=this.slow_,x=this.fast_;this.slow_.halfLife!==_&&(this.slow_=new Q.default(_,f.getEstimate(),f.getTotalWeight())),this.fast_.halfLife!==A&&(this.fast_=new Q.default(A,x.getEstimate(),x.getTotalWeight()))},j.sample=function(_,A){_=Math.max(_,this.minDelayMs_);var f=8*A,x=_/1e3,P=f/x;this.fast_.sample(x,P),this.slow_.sample(x,P)},j.canEstimate=function(){var _=this.fast_;return _&&_.getTotalWeight()>=this.minWeight_},j.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},j.destroy=function(){},O}();$.default=U},"./src/utils/ewma.ts":function(ne,$,R){"use strict";R.r($);var Q=function(){function U(j,N,_){N===void 0&&(N=0),_===void 0&&(_=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=j,this.alpha_=j?Math.exp(Math.log(.5)/j):0,this.estimate_=N,this.totalWeight_=_}var O=U.prototype;return O.sample=function(N,_){var A=Math.pow(this.alpha_,N);this.estimate_=_*(1-A)+A*this.estimate_,this.totalWeight_+=N},O.getTotalWeight=function(){return this.totalWeight_},O.getEstimate=function(){if(this.alpha_){var N=1-Math.pow(this.alpha_,this.totalWeight_);if(N)return this.estimate_/N}return this.estimate_},U}();$.default=Q},"./src/utils/fetch-loader.ts":function(ne,$,R){"use strict";R.r($),R.d($,"fetchSupported",function(){return E});var Q=R("./src/polyfills/number.ts"),U=R("./src/loader/load-stats.ts"),O=R("./src/demux/chunk-cache.ts");function j(h,k){h.prototype=Object.create(k.prototype),h.prototype.constructor=h,x(h,k)}function N(h){var k=typeof Map=="function"?new Map:void 0;return N=function(b){if(b===null||!f(b))return b;if(typeof b!="function")throw new TypeError("Super expression must either be null or a function");if(typeof k!="undefined"){if(k.has(b))return k.get(b);k.set(b,D)}function D(){return _(b,arguments,P(this).constructor)}return D.prototype=Object.create(b.prototype,{constructor:{value:D,enumerable:!1,writable:!0,configurable:!0}}),x(D,b)},N(h)}function _(h,k,c){return A()?_=Reflect.construct:_=function(D,T,g){var v=[null];v.push.apply(v,T);var d=Function.bind.apply(D,v),o=new d;return g&&x(o,g.prototype),o},_.apply(null,arguments)}function A(){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(h){return!1}}function f(h){return Function.toString.call(h).indexOf("[native code]")!==-1}function x(h,k){return x=Object.setPrototypeOf||function(b,D){return b.__proto__=D,b},x(h,k)}function P(h){return P=Object.setPrototypeOf?Object.getPrototypeOf:function(c){return c.__proto__||Object.getPrototypeOf(c)},P(h)}function w(){return w=Object.assign||function(h){for(var k=1;k<arguments.length;k++){var c=arguments[k];for(var b in c)Object.prototype.hasOwnProperty.call(c,b)&&(h[b]=c[b])}return h},w.apply(this,arguments)}function E(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(h){}return!1}var p=function(){function h(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||a,this.controller=new self.AbortController,this.stats=new U.LoadStats}var k=h.prototype;return k.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},k.abortInternal=function(){var b=this.response;(!b||!b.ok)&&(this.stats.aborted=!0,this.controller.abort())},k.abort=function(){var b;this.abortInternal(),(b=this.callbacks)!==null&&b!==void 0&&b.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},k.load=function(b,D,T){var g=this,v=this.stats;if(v.loading.start)throw new Error("Loader can only be used once.");v.loading.start=self.performance.now();var d=u(b,this.controller.signal),o=T.onProgress,C=b.responseType==="arraybuffer",S=C?"byteLength":"length";this.context=b,this.config=D,this.callbacks=T,this.request=this.fetchSetup(b,d),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){g.abortInternal(),T.onTimeout(v,b,g.response)},D.timeout),self.fetch(this.request).then(function(y){if(g.response=g.loader=y,!y.ok){var M=y.status,F=y.statusText;throw new s(F||"fetch, bad network response",M,y)}return v.loading.first=Math.max(self.performance.now(),v.loading.start),v.total=parseInt(y.headers.get("Content-Length")||"0"),o&&Object(Q.isFiniteNumber)(D.highWaterMark)?g.loadProgressively(y,v,b,D.highWaterMark,o):C?y.arrayBuffer():y.text()}).then(function(y){var M=g.response;self.clearTimeout(g.requestTimeout),v.loading.end=Math.max(self.performance.now(),v.loading.first),v.loaded=v.total=y[S];var F={url:M.url,data:y};o&&!Object(Q.isFiniteNumber)(D.highWaterMark)&&o(v,b,y,M),T.onSuccess(F,v,b,M)}).catch(function(y){if(self.clearTimeout(g.requestTimeout),v.aborted)return;var M=y.code||0;T.onError({code:M,text:y.message},b,y.details)})},k.getCacheAge=function(){var b=null;if(this.response){var D=this.response.headers.get("age");b=D?parseFloat(D):null}return b},k.loadProgressively=function(b,D,T,g,v){g===void 0&&(g=0);var d=new O.default,o=b.body.getReader(),C=function S(){return o.read().then(function(y){if(y.done)return d.dataLength&&v(D,T,d.flush(),b),Promise.resolve(new ArrayBuffer(0));var M=y.value,F=M.length;return D.loaded+=F,F<g||d.dataLength?(d.push(M),d.dataLength>=g&&v(D,T,d.flush(),b)):v(D,T,M,b),S()}).catch(function(){return Promise.reject()})};return C()},h}();function u(h,k){var c={method:"GET",mode:"cors",credentials:"same-origin",signal:k,headers:new self.Headers(w({},h.headers))};return h.rangeEnd&&c.headers.set("Range","bytes="+h.rangeStart+"-"+String(h.rangeEnd-1)),c}function a(h,k){return new self.Request(h.url,k)}var s=function(h){j(k,h);function k(c,b,D){var T;return T=h.call(this,c)||this,T.code=void 0,T.details=void 0,T.code=b,T.details=D,T}return k}(N(Error));$.default=p},"./src/utils/imsc1-ttml-parser.ts":function(ne,$,R){"use strict";R.r($),R.d($,"IMSC1_CODEC",function(){return f}),R.d($,"parseIMSC1",function(){return E});var Q=R("./src/utils/mp4-tools.ts"),U=R("./src/utils/vttparser.ts"),O=R("./src/utils/vttcue.ts"),j=R("./src/demux/id3.ts"),N=R("./src/utils/timescale-conversion.ts"),_=R("./src/utils/webvtt-parser.ts");function A(){return A=Object.assign||function(g){for(var v=1;v<arguments.length;v++){var d=arguments[v];for(var o in d)Object.prototype.hasOwnProperty.call(d,o)&&(g[o]=d[o])}return g},A.apply(this,arguments)}var f="stpp.ttml.im1t",x=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,P=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,w={left:"start",center:"center",right:"end",start:"start",end:"end"};function E(g,v,d,o,C){var S=Object(Q.findBox)(new Uint8Array(g),["mdat"]);if(S.length===0){C(new Error("Could not parse IMSC1 mdat"));return}var y=S[0],M=Object(j.utf8ArrayToStr)(new Uint8Array(g,y.start,y.end-y.start)),F=Object(N.toTimescaleFromScale)(v,1,d);try{o(p(M,F))}catch(W){C(W)}}function p(g,v){var d=new DOMParser,o=d.parseFromString(g,"text/xml"),C=o.getElementsByTagName("tt")[0];if(!C)throw new Error("Invalid ttml");var S={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},y=Object.keys(S).reduce(function(I,B){return I[B]=C.getAttribute("ttp:"+B)||S[B],I},{}),M=C.getAttribute("xml:space")!=="preserve",F=a(u(C,"styling","style")),W=a(u(C,"layout","region")),V=u(C,"body","[begin]");return[].map.call(V,function(I){var B=s(I,M);if(!B||!I.hasAttribute("begin"))return null;var X=b(I.getAttribute("begin"),y),ee=b(I.getAttribute("dur"),y),oe=b(I.getAttribute("end"),y);if(X===null)throw c(I);if(oe===null){if(ee===null)throw c(I);oe=X+ee}var fe=new O.default(X-v,oe-v,B);fe.id=Object(_.generateCueId)(fe.startTime,fe.endTime,fe.text);var ke=W[I.getAttribute("region")],xe=F[I.getAttribute("style")];fe.position=10,fe.size=80;var Te=h(ke,xe),Ce=Te.textAlign;if(Ce){var ge=w[Ce];ge&&(fe.lineAlign=ge),fe.align=Ce}return A(fe,Te),fe}).filter(function(I){return I!==null})}function u(g,v,d){var o=g.getElementsByTagName(v)[0];return o?[].slice.call(o.querySelectorAll(d)):[]}function a(g){return g.reduce(function(v,d){var o=d.getAttribute("xml:id");return o&&(v[o]=d),v},{})}function s(g,v){return[].slice.call(g.childNodes).reduce(function(d,o,C){var S;return o.nodeName==="br"&&C?d+`
`:(S=o.childNodes)!==null&&S!==void 0&&S.length?s(o,v):v?d+o.textContent.trim().replace(/\s+/g," "):d+o.textContent},"")}function h(g,v){var d="http://www.w3.org/ns/ttml#styling",o=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return o.reduce(function(C,S){var y=k(v,d,S)||k(g,d,S);return y&&(C[S]=y),C},{})}function k(g,v,d){return g.hasAttributeNS(v,d)?g.getAttributeNS(v,d):null}function c(g){return new Error("Could not parse ttml timestamp "+g)}function b(g,v){if(!g)return null;var d=Object(U.parseTimeStamp)(g);return d===null&&(x.test(g)?d=D(g,v):P.test(g)&&(d=T(g,v))),d}function D(g,v){var d=x.exec(g),o=(d[4]|0)+(d[5]|0)/v.subFrameRate;return(d[1]|0)*3600+(d[2]|0)*60+(d[3]|0)+o/v.frameRate}function T(g,v){var d=P.exec(g),o=Number(d[1]),C=d[2];switch(C){case"h":return o*3600;case"m":return o*60;case"ms":return o*1e3;case"f":return o/v.frameRate;case"t":return o/v.tickRate}return o}},"./src/utils/logger.ts":function(ne,$,R){"use strict";R.r($),R.d($,"enableLogs",function(){return _}),R.d($,"logger",function(){return A});var Q=function(){},U={trace:Q,debug:Q,log:Q,warn:Q,info:Q,error:Q},O=U;function j(f){var x=self.console[f];return x?x.bind(self.console,"["+f+"] >"):Q}function N(f){for(var x=arguments.length,P=new Array(x>1?x-1:0),w=1;w<x;w++)P[w-1]=arguments[w];P.forEach(function(E){O[E]=f[E]?f[E].bind(f):j(E)})}function _(f){if(self.console&&f===!0||typeof f=="object"){N(f,"debug","log","info","warn","error");try{O.log()}catch(x){O=U}}else O=U}var A=O},"./src/utils/mediakeys-helper.ts":function(ne,$,R){"use strict";R.r($),R.d($,"KeySystems",function(){return Q}),R.d($,"requestMediaKeySystemAccess",function(){return U});var Q;(function(O){O.WIDEVINE="com.widevine.alpha",O.PLAYREADY="com.microsoft.playready"})(Q||(Q={}));var U=function(){return typeof self!="undefined"&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}()},"./src/utils/mediasource-helper.ts":function(ne,$,R){"use strict";R.r($),R.d($,"getMediaSource",function(){return Q});function Q(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(ne,$,R){"use strict";R.r($),R.d($,"bin2str",function(){return N}),R.d($,"readUint16",function(){return _}),R.d($,"readUint32",function(){return A}),R.d($,"writeUint32",function(){return f}),R.d($,"findBox",function(){return x}),R.d($,"parseSegmentIndex",function(){return P}),R.d($,"parseInitSegment",function(){return w}),R.d($,"getStartDTS",function(){return E}),R.d($,"getDuration",function(){return p}),R.d($,"computeRawDurationFromSamples",function(){return u}),R.d($,"offsetStartDTS",function(){return a}),R.d($,"segmentValidRange",function(){return s}),R.d($,"appendUint8Array",function(){return h});var Q=R("./src/utils/typed-array.ts"),U=R("./src/loader/fragment.ts"),O=Math.pow(2,32)-1,j=[].push;function N(k){return String.fromCharCode.apply(null,k)}function _(k,c){"data"in k&&(c+=k.start,k=k.data);var b=k[c]<<8|k[c+1];return b<0?65536+b:b}function A(k,c){"data"in k&&(c+=k.start,k=k.data);var b=k[c]<<24|k[c+1]<<16|k[c+2]<<8|k[c+3];return b<0?4294967296+b:b}function f(k,c,b){"data"in k&&(c+=k.start,k=k.data),k[c]=b>>24,k[c+1]=b>>16&255,k[c+2]=b>>8&255,k[c+3]=b&255}function x(k,c){var b=[];if(!c.length)return b;var D,T,g;"data"in k?(D=k.data,T=k.start,g=k.end):(D=k,T=0,g=D.byteLength);for(var v=T;v<g;){var d=A(D,v),o=N(D.subarray(v+4,v+8)),C=d>1?v+d:g;if(o===c[0])if(c.length===1)b.push({data:D,start:v+8,end:C});else{var S=x({data:D,start:v+8,end:C},c.slice(1));S.length&&j.apply(b,S)}v=C}return b}function P(k){var c=x(k,["moov"]),b=c[0],D=b?b.end:null,T=x(k,["sidx"]);if(!T||!T[0])return null;var g=[],v=T[0],d=v.data[0],o=d===0?8:16,C=A(v,o);o+=4;var S=0,y=0;d===0?o+=8:o+=16,o+=2;var M=v.end+y,F=_(v,o);o+=2;for(var W=0;W<F;W++){var V=o,I=A(v,V);V+=4;var B=I&2147483647,X=(I&2147483648)>>>31;if(X===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var ee=A(v,V);V+=4,g.push({referenceSize:B,subsegmentDuration:ee,info:{duration:ee/C,start:M,end:M+B-1}}),M+=B,V+=4,o=V}return{earliestPresentationTime:S,timescale:C,version:d,referencesCount:F,references:g,moovEndOffset:D}}function w(k){for(var c=[],b=x(k,["moov","trak"]),D=0;D<b.length;D++){var T=b[D],g=x(T,["tkhd"])[0];if(g){var v=g.data[g.start],d=v===0?12:20,o=A(g,d),C=x(T,["mdia","mdhd"])[0];if(C){v=C.data[C.start],d=v===0?12:20;var S=A(C,d),y=x(T,["mdia","hdlr"])[0];if(y){var M=N(y.data.subarray(y.start+8,y.start+12)),F={soun:U.ElementaryStreamTypes.AUDIO,vide:U.ElementaryStreamTypes.VIDEO}[M];if(F){var W=x(T,["mdia","minf","stbl","stsd"])[0],V=void 0;W&&(V=N(W.data.subarray(W.start+12,W.start+16))),c[o]={timescale:S,type:F},c[F]={timescale:S,id:o,codec:V}}}}}}var I=x(k,["moov","mvex","trex"]);return I.forEach(function(B){var X=A(B,4),ee=c[X];ee&&(ee.default={duration:A(B,12),flags:A(B,20)})}),c}function E(k,c){return x(c,["moof","traf"]).reduce(function(b,D){var T=x(D,["tfdt"])[0],g=T.data[T.start],v=x(D,["tfhd"]).reduce(function(d,o){var C=A(o,4),S=k[C];if(S){var y=A(T,4);g===1&&(y*=Math.pow(2,32),y+=A(T,8));var M=S.timescale||9e4,F=y/M;if(isFinite(F)&&(d===null||F<d))return F}return d},null);return v!==null&&isFinite(v)&&(b===null||v<b)?v:b},null)||0}function p(k,c){for(var b=0,D=0,T=0,g=x(k,["moof","traf"]),v=0;v<g.length;v++){var d=g[v],o=x(d,["tfhd"])[0],C=A(o,4),S=c[C];if(!S)continue;var y=S.default,M=A(o,0)|(y==null?void 0:y.flags),F=y==null?void 0:y.duration;M&8&&(M&2?F=A(o,12):F=A(o,8));for(var W=S.timescale||9e4,V=x(d,["trun"]),I=0;I<V.length;I++){if(F){var B=A(V[I],4);b=F*B}else b=u(V[I]);S.type===U.ElementaryStreamTypes.VIDEO?D+=b/W:S.type===U.ElementaryStreamTypes.AUDIO&&(T+=b/W)}}if(D===0&&T===0){var X=P(k);if(X!=null&&X.references)return X.references.reduce(function(ee,oe){return ee+oe.info.duration||0},0)}return D||T}function u(k){var c=A(k,0),b=8;c&1&&(b+=4),c&4&&(b+=4);for(var D=0,T=A(k,4),g=0;g<T;g++){if(c&256){var v=A(k,b);D+=v,b+=4}c&512&&(b+=4),c&1024&&(b+=4),c&2048&&(b+=4)}return D}function a(k,c,b){x(c,["moof","traf"]).forEach(function(D){x(D,["tfhd"]).forEach(function(T){var g=A(T,4),v=k[g];if(!v)return;var d=v.timescale||9e4;x(D,["tfdt"]).forEach(function(o){var C=o.data[o.start],S=A(o,4);if(C===0)f(o,4,S-b*d);else{S*=Math.pow(2,32),S+=A(o,8),S-=b*d,S=Math.max(S,0);var y=Math.floor(S/(O+1)),M=Math.floor(S%(O+1));f(o,4,y),f(o,8,M)}})})})}function s(k){var c={valid:null,remainder:null},b=x(k,["moof"]);if(b){if(b.length<2)return c.remainder=k,c}else return c;var D=b[b.length-1];return c.valid=Object(Q.sliceUint8)(k,0,D.start-8),c.remainder=Object(Q.sliceUint8)(k,D.start-8),c}function h(k,c){var b=new Uint8Array(k.length+c.length);return b.set(k),b.set(c,k.length),b}},"./src/utils/output-filter.ts":function(ne,$,R){"use strict";R.r($),R.d($,"default",function(){return Q});var Q=function(){function U(j,N){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=j,this.trackName=N}var O=U.prototype;return O.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},O.newCue=function(N,_,A){(this.startTime===null||this.startTime>N)&&(this.startTime=N),this.endTime=_,this.screen=A,this.timelineController.createCaptionsTrack(this.trackName)},O.reset=function(){this.cueRanges=[]},U}()},"./src/utils/texttrack-utils.ts":function(ne,$,R){"use strict";R.r($),R.d($,"sendAddTrackEvent",function(){return U}),R.d($,"addCueToTrack",function(){return O}),R.d($,"clearCurrentCues",function(){return j}),R.d($,"removeCuesInRange",function(){return N}),R.d($,"getCuesInRange",function(){return A});var Q=R("./src/utils/logger.ts");function U(f,x){var P;try{P=new Event("addtrack")}catch(w){P=document.createEvent("Event"),P.initEvent("addtrack",!1,!1)}P.track=f,x.dispatchEvent(P)}function O(f,x){var P=f.mode;if(P==="disabled"&&(f.mode="hidden"),f.cues&&!f.cues.getCueById(x.id))try{if(f.addCue(x),!f.cues.getCueById(x.id))throw new Error("addCue is failed for: "+x)}catch(E){Q.logger.debug("[texttrack-utils]: "+E);var w=new self.TextTrackCue(x.startTime,x.endTime,x.text);w.id=x.id,f.addCue(w)}P==="disabled"&&(f.mode=P)}function j(f){var x=f.mode;if(x==="disabled"&&(f.mode="hidden"),f.cues)for(var P=f.cues.length;P--;)f.removeCue(f.cues[P]);x==="disabled"&&(f.mode=x)}function N(f,x,P){var w=f.mode;if(w==="disabled"&&(f.mode="hidden"),f.cues&&f.cues.length>0)for(var E=A(f.cues,x,P),p=0;p<E.length;p++)f.removeCue(E[p]);w==="disabled"&&(f.mode=w)}function _(f,x){if(x<f[0].startTime)return 0;var P=f.length-1;if(x>f[P].endTime)return-1;for(var w=0,E=P;w<=E;){var p=Math.floor((E+w)/2);if(x<f[p].startTime)E=p-1;else if(x>f[p].startTime&&w<P)w=p+1;else return p}return f[w].startTime-x<x-f[E].startTime?w:E}function A(f,x,P){var w=[],E=_(f,x);if(E>-1)for(var p=E,u=f.length;p<u;p++){var a=f[p];if(a.startTime>=x&&a.endTime<=P)w.push(a);else if(a.startTime>P)return w}return w}},"./src/utils/time-ranges.ts":function(ne,$,R){"use strict";R.r($);var Q={toString:function(O){for(var j="",N=O.length,_=0;_<N;_++)j+="["+O.start(_).toFixed(3)+","+O.end(_).toFixed(3)+"]";return j}};$.default=Q},"./src/utils/timescale-conversion.ts":function(ne,$,R){"use strict";R.r($),R.d($,"toTimescaleFromBase",function(){return U}),R.d($,"toTimescaleFromScale",function(){return O}),R.d($,"toMsFromMpegTsClock",function(){return j}),R.d($,"toMpegTsClockFromTimescale",function(){return N});var Q=9e4;function U(_,A,f,x){f===void 0&&(f=1),x===void 0&&(x=!1);var P=_*A*f;return x?Math.round(P):P}function O(_,A,f,x){return f===void 0&&(f=1),x===void 0&&(x=!1),U(_,A,1/f,x)}function j(_,A){return A===void 0&&(A=!1),U(_,1e3,1/Q,A)}function N(_,A){return A===void 0&&(A=1),U(_,Q,1/A)}},"./src/utils/typed-array.ts":function(ne,$,R){"use strict";R.r($),R.d($,"sliceUint8",function(){return Q});function Q(U,O,j){return Uint8Array.prototype.slice?U.slice(O,j):new Uint8Array(Array.prototype.slice.call(U,O,j))}},"./src/utils/vttcue.ts":function(ne,$,R){"use strict";R.r($),$.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var Q=["","lr","rl"],U=["start","middle","end","left","right"];function O(f,x){if(typeof x!="string")return!1;if(!Array.isArray(f))return!1;var P=x.toLowerCase();return~f.indexOf(P)?P:!1}function j(f){return O(Q,f)}function N(f){return O(U,f)}function _(f){for(var x=arguments.length,P=new Array(x>1?x-1:0),w=1;w<x;w++)P[w-1]=arguments[w];for(var E=1;E<arguments.length;E++){var p=arguments[E];for(var u in p)f[u]=p[u]}return f}function A(f,x,P){var w=this,E={enumerable:!0};w.hasBeenReset=!1;var p="",u=!1,a=f,s=x,h=P,k=null,c="",b=!0,D="auto",T="start",g=50,v="middle",d=50,o="middle";Object.defineProperty(w,"id",_({},E,{get:function(){return p},set:function(S){p=""+S}})),Object.defineProperty(w,"pauseOnExit",_({},E,{get:function(){return u},set:function(S){u=!!S}})),Object.defineProperty(w,"startTime",_({},E,{get:function(){return a},set:function(S){if(typeof S!="number")throw new TypeError("Start time must be set to a number.");a=S,this.hasBeenReset=!0}})),Object.defineProperty(w,"endTime",_({},E,{get:function(){return s},set:function(S){if(typeof S!="number")throw new TypeError("End time must be set to a number.");s=S,this.hasBeenReset=!0}})),Object.defineProperty(w,"text",_({},E,{get:function(){return h},set:function(S){h=""+S,this.hasBeenReset=!0}})),Object.defineProperty(w,"region",_({},E,{get:function(){return k},set:function(S){k=S,this.hasBeenReset=!0}})),Object.defineProperty(w,"vertical",_({},E,{get:function(){return c},set:function(S){var y=j(S);if(y===!1)throw new SyntaxError("An invalid or illegal string was specified.");c=y,this.hasBeenReset=!0}})),Object.defineProperty(w,"snapToLines",_({},E,{get:function(){return b},set:function(S){b=!!S,this.hasBeenReset=!0}})),Object.defineProperty(w,"line",_({},E,{get:function(){return D},set:function(S){if(typeof S!="number"&&S!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");D=S,this.hasBeenReset=!0}})),Object.defineProperty(w,"lineAlign",_({},E,{get:function(){return T},set:function(S){var y=N(S);if(!y)throw new SyntaxError("An invalid or illegal string was specified.");T=y,this.hasBeenReset=!0}})),Object.defineProperty(w,"position",_({},E,{get:function(){return g},set:function(S){if(S<0||S>100)throw new Error("Position must be between 0 and 100.");g=S,this.hasBeenReset=!0}})),Object.defineProperty(w,"positionAlign",_({},E,{get:function(){return v},set:function(S){var y=N(S);if(!y)throw new SyntaxError("An invalid or illegal string was specified.");v=y,this.hasBeenReset=!0}})),Object.defineProperty(w,"size",_({},E,{get:function(){return d},set:function(S){if(S<0||S>100)throw new Error("Size must be between 0 and 100.");d=S,this.hasBeenReset=!0}})),Object.defineProperty(w,"align",_({},E,{get:function(){return o},set:function(S){var y=N(S);if(!y)throw new SyntaxError("An invalid or illegal string was specified.");o=y,this.hasBeenReset=!0}})),w.displayState=void 0}return A.prototype.getCueAsHTML=function(){var f=self.WebVTT;return f.convertCueToDOMTree(self,this.text)},A}()},"./src/utils/vttparser.ts":function(ne,$,R){"use strict";R.r($),R.d($,"parseTimeStamp",function(){return O}),R.d($,"fixLineBreaks",function(){return x}),R.d($,"VTTParser",function(){return P});var Q=R("./src/utils/vttcue.ts"),U=function(){function w(){}var E=w.prototype;return E.decode=function(u,a){if(!u)return"";if(typeof u!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(u))},w}();function O(w){function E(u,a,s,h){return(u|0)*3600+(a|0)*60+(s|0)+parseFloat(h||0)}var p=w.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return p?parseFloat(p[2])>59?E(p[2],p[3],0,p[4]):E(p[1],p[2],p[3],p[4]):null}var j=function(){function w(){this.values=Object.create(null)}var E=w.prototype;return E.set=function(u,a){!this.get(u)&&a!==""&&(this.values[u]=a)},E.get=function(u,a,s){return s?this.has(u)?this.values[u]:a[s]:this.has(u)?this.values[u]:a},E.has=function(u){return u in this.values},E.alt=function(u,a,s){for(var h=0;h<s.length;++h)if(a===s[h]){this.set(u,a);break}},E.integer=function(u,a){/^-?\d+$/.test(a)&&this.set(u,parseInt(a,10))},E.percent=function(u,a){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(a)){var s=parseFloat(a);if(s>=0&&s<=100)return this.set(u,s),!0}return!1},w}();function N(w,E,p,u){var a=u?w.split(u):[w];for(var s in a){if(typeof a[s]!="string")continue;var h=a[s].split(p);if(h.length!==2)continue;var k=h[0],c=h[1];E(k,c)}}var _=new Q.default(0,0,""),A=_.align==="middle"?"middle":"center";function f(w,E,p){var u=w;function a(){var k=O(w);if(k===null)throw new Error("Malformed timestamp: "+u);return w=w.replace(/^[^\sa-zA-Z-]+/,""),k}function s(k,c){var b=new j;N(k,function(g,v){var d;switch(g){case"region":for(var o=p.length-1;o>=0;o--)if(p[o].id===v){b.set(g,p[o].region);break}break;case"vertical":b.alt(g,v,["rl","lr"]);break;case"line":d=v.split(","),b.integer(g,d[0]),b.percent(g,d[0])&&b.set("snapToLines",!1),b.alt(g,d[0],["auto"]),d.length===2&&b.alt("lineAlign",d[1],["start",A,"end"]);break;case"position":d=v.split(","),b.percent(g,d[0]),d.length===2&&b.alt("positionAlign",d[1],["start",A,"end","line-left","line-right","auto"]);break;case"size":b.percent(g,v);break;case"align":b.alt(g,v,["start",A,"end","left","right"]);break}},/:/,/\s/),c.region=b.get("region",null),c.vertical=b.get("vertical","");var D=b.get("line","auto");D==="auto"&&_.line===-1&&(D=-1),c.line=D,c.lineAlign=b.get("lineAlign","start"),c.snapToLines=b.get("snapToLines",!0),c.size=b.get("size",100),c.align=b.get("align",A);var T=b.get("position","auto");T==="auto"&&_.position===50&&(T=c.align==="start"||c.align==="left"?0:c.align==="end"||c.align==="right"?100:50),c.position=T}function h(){w=w.replace(/^\s+/,"")}if(h(),E.startTime=a(),h(),w.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+u);w=w.substr(3),h(),E.endTime=a(),h(),s(w,E)}function x(w){return w.replace(/<br(?: \/)?>/gi,`
`)}var P=function(){function w(){this.state="INITIAL",this.buffer="",this.decoder=new U,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var E=w.prototype;return E.parse=function(u){var a=this;u&&(a.buffer+=a.decoder.decode(u,{stream:!0}));function s(){var T=a.buffer,g=0;for(T=x(T);g<T.length&&T[g]!=="\r"&&T[g]!==`
`;)++g;var v=T.substr(0,g);return T[g]==="\r"&&++g,T[g]===`
`&&++g,a.buffer=T.substr(g),v}function h(T){N(T,function(g,v){},/:/)}try{var k="";if(a.state==="INITIAL"){if(!/\r\n|\n/.test(a.buffer))return this;k=s();var c=k.match(/^()?WEBVTT([ \t].*)?$/);if(!c||!c[0])throw new Error("Malformed WebVTT signature.");a.state="HEADER"}for(var b=!1;a.buffer;){if(!/\r\n|\n/.test(a.buffer))return this;b?b=!1:k=s();switch(a.state){case"HEADER":/:/.test(k)?h(k):k||(a.state="ID");continue;case"NOTE":k||(a.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(k)){a.state="NOTE";break}if(!k)continue;if(a.cue=new Q.default(0,0,""),a.state="CUE",k.indexOf("-->")===-1){a.cue.id=k;continue}case"CUE":if(!a.cue){a.state="BADCUE";continue}try{f(k,a.cue,a.regionList)}catch(T){a.cue=null,a.state="BADCUE";continue}a.state="CUETEXT";continue;case"CUETEXT":{var D=k.indexOf("-->")!==-1;if(!k||D&&(b=!0)){a.oncue&&a.cue&&a.oncue(a.cue),a.cue=null,a.state="ID";continue}if(a.cue===null)continue;a.cue.text&&(a.cue.text+=`
`),a.cue.text+=k}continue;case"BADCUE":k||(a.state="ID")}}}catch(T){a.state==="CUETEXT"&&a.cue&&a.oncue&&a.oncue(a.cue),a.cue=null,a.state=a.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},E.flush=function(){var u=this;try{if((u.cue||u.state==="HEADER")&&(u.buffer+=`
`,u.parse()),u.state==="INITIAL"||u.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(a){u.onparsingerror&&u.onparsingerror(a)}return u.onflush&&u.onflush(),this},w}()},"./src/utils/webvtt-parser.ts":function(ne,$,R){"use strict";R.r($),R.d($,"generateCueId",function(){return P}),R.d($,"parseWebVTT",function(){return E});var Q=R("./src/polyfills/number.ts"),U=R("./src/utils/vttparser.ts"),O=R("./src/demux/id3.ts"),j=R("./src/utils/timescale-conversion.ts"),N=R("./src/remux/mp4-remuxer.ts"),_=/\r\n|\n\r|\n|\r/g,A=function(u,a,s){return s===void 0&&(s=0),u.substr(s,a.length)===a},f=function(u){var a=parseInt(u.substr(-3)),s=parseInt(u.substr(-6,2)),h=parseInt(u.substr(-9,2)),k=u.length>9?parseInt(u.substr(0,u.indexOf(":"))):0;if(!Object(Q.isFiniteNumber)(a)||!Object(Q.isFiniteNumber)(s)||!Object(Q.isFiniteNumber)(h)||!Object(Q.isFiniteNumber)(k))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+u);return a+=1e3*s,a+=60*1e3*h,a+=60*60*1e3*k,a},x=function(u){for(var a=5381,s=u.length;s;)a=a*33^u.charCodeAt(--s);return(a>>>0).toString()};function P(p,u,a){return x(p.toString())+x(u.toString())+x(a)}var w=function(u,a,s){var h=u[a],k=u[h.prevCC];if(!k||!k.new&&h.new){u.ccOffset=u.presentationOffset=h.start,h.new=!1;return}for(;(c=k)!==null&&c!==void 0&&c.new;){var c;u.ccOffset+=h.start-k.start,h.new=!1,h=k,k=u[h.prevCC]}u.presentationOffset=s};function E(p,u,a,s,h,k,c,b){var D=new U.VTTParser,T=Object(O.utf8ArrayToStr)(new Uint8Array(p)).trim().replace(_,`
`).split(`
`),g=[],v=Object(j.toMpegTsClockFromTimescale)(u,a),d="00:00.000",o=0,C=0,S,y=!0,M=!1;D.oncue=function(F){var W=s[h],V=s.ccOffset,I=(o-v)/9e4;if(W!=null&&W.new&&(C!==void 0?V=s.ccOffset=W.start:w(s,h,I)),I&&(V=I-s.presentationOffset),M){var B=F.endTime-F.startTime,X=Object(N.normalizePts)((F.startTime+V-C)*9e4,k*9e4)/9e4;F.startTime=X,F.endTime=X+B}var ee=F.text.trim();F.text=decodeURIComponent(encodeURIComponent(ee)),F.id||(F.id=P(F.startTime,F.endTime,ee)),F.endTime>0&&g.push(F)},D.onparsingerror=function(F){S=F},D.onflush=function(){if(S){b(S);return}c(g)},T.forEach(function(F){if(y)if(A(F,"X-TIMESTAMP-MAP=")){y=!1,M=!0,F.substr(16).split(",").forEach(function(W){A(W,"LOCAL:")?d=W.substr(6):A(W,"MPEGTS:")&&(o=parseInt(W.substr(7)))});try{C=f(d)/1e3}catch(W){M=!1,S=W}return}else F===""&&(y=!1);D.parse(F+`
`)}),D.flush()}},"./src/utils/xhr-loader.ts":function(ne,$,R){"use strict";R.r($);var Q=R("./src/utils/logger.ts"),U=R("./src/loader/load-stats.ts"),O=/^age:\s*[\d.]+\s*$/m,j=function(){function N(A){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=A?A.xhrSetup:null,this.stats=new U.LoadStats,this.retryDelay=0}var _=N.prototype;return _.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},_.abortInternal=function(){var f=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),f&&(f.onreadystatechange=null,f.onprogress=null,f.readyState!==4&&(this.stats.aborted=!0,f.abort()))},_.abort=function(){var f;this.abortInternal(),(f=this.callbacks)!==null&&f!==void 0&&f.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},_.load=function(f,x,P){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=f,this.config=x,this.callbacks=P,this.retryDelay=x.retryDelay,this.loadInternal()},_.loadInternal=function(){var f=this.config,x=this.context;if(!f)return;var P=this.loader=new self.XMLHttpRequest,w=this.stats;w.loading.first=0,w.loaded=0;var E=this.xhrSetup;try{if(E)try{E(P,x.url)}catch(a){P.open("GET",x.url,!0),E(P,x.url)}P.readyState||P.open("GET",x.url,!0);var p=this.context.headers;if(p)for(var u in p)P.setRequestHeader(u,p[u])}catch(a){this.callbacks.onError({code:P.status,text:a.message},x,P);return}x.rangeEnd&&P.setRequestHeader("Range","bytes="+x.rangeStart+"-"+(x.rangeEnd-1)),P.onreadystatechange=this.readystatechange.bind(this),P.onprogress=this.loadprogress.bind(this),P.responseType=x.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),f.timeout),P.send()},_.readystatechange=function(){var f=this.context,x=this.loader,P=this.stats;if(!f||!x)return;var w=x.readyState,E=this.config;if(P.aborted)return;if(w>=2)if(self.clearTimeout(this.requestTimeout),P.loading.first===0&&(P.loading.first=Math.max(self.performance.now(),P.loading.start)),w===4){x.onreadystatechange=null,x.onprogress=null;var p=x.status;if(p>=200&&p<300){P.loading.end=Math.max(self.performance.now(),P.loading.first);var u,a;if(f.responseType==="arraybuffer"?(u=x.response,a=u.byteLength):(u=x.responseText,a=u.length),P.loaded=P.total=a,!this.callbacks)return;var s=this.callbacks.onProgress;if(s&&s(P,f,u,x),!this.callbacks)return;var h={url:x.responseURL,data:u};this.callbacks.onSuccess(h,P,f,x)}else P.retry>=E.maxRetry||p>=400&&p<499?(Q.logger.error(p+" while loading "+f.url),this.callbacks.onError({code:p,text:x.statusText},f,x)):(Q.logger.warn(p+" while loading "+f.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,E.maxRetryDelay),P.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),E.timeout)},_.loadtimeout=function(){Q.logger.warn("timeout while loading "+this.context.url);var f=this.callbacks;f&&(this.abortInternal(),f.onTimeout(this.stats,this.context,this.loader))},_.loadprogress=function(f){var x=this.stats;x.loaded=f.loaded,f.lengthComputable&&(x.total=f.total)},_.getCacheAge=function(){var f=null;if(this.loader&&O.test(this.loader.getAllResponseHeaders())){var x=this.loader.getResponseHeader("age");f=x?parseFloat(x):null}return f},N}();$.default=j}}).default})},vHTk:function(dt,at,se){dt.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}},wU8J:function(dt,at){function se(){this.buffer=new Array,this.length=0}se.prototype={get:function(ne){var $=Math.floor(ne/8);return(this.buffer[$]>>>7-ne%8&1)==1},put:function(ne,$){for(var R=0;R<$;R++)this.putBit((ne>>>$-R-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(ne){var $=Math.floor(this.length/8);this.buffer.length<=$&&this.buffer.push(0),ne&&(this.buffer[$]|=128>>>this.length%8),this.length++}},dt.exports=se}}]);