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.
372 lines
967 KiB
372 lines
967 KiB
(window.webpackJsonp=window.webpackJsonp||[]).push([[233,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,b=E.length-1;b>=0;b--){var u=E[b];if(u.name=="DEFAULT")continue;return u}return{styleIdentifier:function(){return null}}}function F(w,E,b){return function(){this.name=w,this.bracketNo=0,this.style=E,this.styles=b,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=F("importmodule","tag",["string","builtin"]),_.documentclass=F("documentclass","tag",["","atom"]),_.usepackage=F("usepackage","tag",["atom"]),_.begin=F("begin","tag",["atom"]),_.end=F("end","tag",["atom"]),_.label=F("label","tag",["atom"]),_.ref=F("ref","tag",["atom"]),_.eqref=F("eqref","tag",["atom"]),_.cite=F("cite","tag",["atom"]),_.bibitem=F("bibitem","tag",["atom"]),_.Bibitem=F("Bibitem","tag",["atom"]),_.RBibitem=F("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 c(w,E){var b;if(w.match(/^\\[a-zA-Z@]+/)){var u=w.current().slice(1);return b=_.hasOwnProperty(u)?_[u]:_.DEFAULT,b=new b,Q(E,b),A(E,M),b.style}if(w.match(/^\\[$&%#{}_]/))return"tag";if(w.match(/^\\[,;!\/\\]/))return"tag";if(w.match("\\["))return A(E,function(l,h){return x(l,h,"\\]")}),"keyword";if(w.match("\\("))return A(E,function(l,h){return x(l,h,"\\)")}),"keyword";if(w.match("$$"))return A(E,function(l,h){return x(l,h,"$$")}),"keyword";if(w.match("$"))return A(E,function(l,h){return x(l,h,"$")}),"keyword";var a=w.next();if(a=="%")return w.skipToEnd(),"comment";if(a=="}"||a=="]"){if(b=U(E),b)b.closeBracket(a),A(E,M);else return"error";return"bracket"}else return a=="{"||a=="["?(b=_.DEFAULT,b=new b,Q(E,b),"bracket"):/\d/.test(a)?(w.eatWhile(/[\w.%]/),"atom"):(w.eatWhile(/[\w\-_]/),b=j(E),b.name=="begin"&&(b.argument=w.current()),b.styleIdentifier())}function x(w,E,b){if(w.eatSpace())return null;if(b&&w.match(b))return A(E,c),"keyword";if(w.match(/^\\[a-zA-Z@]+/))return"tag";if(w.match(/^[a-zA-Z]+/))return"variable-2";if(w.match(/^\\[$&%#{}_]/))return"tag";if(w.match(/^\\[,;!\/]/))return"tag";if(w.match(/^[\^_&]/))return"tag";if(w.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(w.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var u=w.next();return u=="{"||u=="}"||u=="["||u=="]"||u=="("||u==")"?"bracket":u=="%"?(w.skipToEnd(),"comment"):"error"}function M(w,E){var b=w.peek(),u;return b=="{"||b=="["?(u=U(E),u.openBracket(b),w.eat(b),A(E,c),"bracket"):/[ \t\r]/.test(b)?(w.eat(b),null):(A(E,c),O(E),c(w,E))}return{startState:function(){var w=R.inMathMode?function(E,b){return x(E,b)}:c;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=c,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(F,_,A){var c=A&&A!=ne.Init;if(_&&!c)F.on("blur",U),F.on("change",O),F.on("swapDoc",O),ne.on(F.getInputField(),"compositionupdate",F.state.placeholderCompose=function(){Q(F)}),O(F);else if(!_&&c){F.off("blur",U),F.off("change",O),F.off("swapDoc",O),ne.off(F.getInputField(),"compositionupdate",F.state.placeholderCompose),$(F);var x=F.getWrapperElement();x.className=x.className.replace(" CodeMirror-empty","")}_&&!F.hasFocus()&&U(F)});function $(F){F.state.placeholder&&(F.state.placeholder.parentNode.removeChild(F.state.placeholder),F.state.placeholder=null)}function R(F){$(F);var _=F.state.placeholder=document.createElement("pre");_.style.cssText="height: 0; overflow: visible",_.style.direction=F.getOption("direction"),_.className="CodeMirror-placeholder CodeMirror-line-like";var A=F.getOption("placeholder");typeof A=="string"&&(A=document.createTextNode(A)),_.appendChild(A),F.display.lineSpace.insertBefore(_,F.display.lineSpace.firstChild)}function Q(F){setTimeout(function(){var _=!1,A=F.getInputField();A.nodeName=="TEXTAREA"?_=!A.value:F.lineCount()==1&&(_=!/[^\u200b]/.test(A.querySelector(".CodeMirror-line").textContent)),_?R(F):$(F)},20)}function U(F){j(F)&&R(F)}function O(F){var _=F.getWrapperElement(),A=j(F);_.className=_.className.replace(" CodeMirror-empty","")+(A?" CodeMirror-empty":""),A?R(F):$(F)}function j(F){return F.lineCount()===1&&F.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={},F=U.htmlMode?$:R;for(var _ in F)j[_]=F[_];for(var _ in U)j[_]=U[_];var A,c;function x(o,T){function S(B){return T.tokenize=B,B(o,T)}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(b(1))):null:o.eat("?")?(o.eatWhile(/[\w\._\-]/),T.tokenize=E("meta","?>"),"meta"):(A=o.eat("/")?"closeTag":"openTag",T.tokenize=M,"tag bracket");if(y=="&"){var P;return o.eat("#")?o.eat("x")?P=o.eatWhile(/[a-fA-F\d]/)&&o.eat(";"):P=o.eatWhile(/[\d]/)&&o.eat(";"):P=o.eatWhile(/[\w\.\-:]/)&&o.eat(";"),P?"atom":"error"}else return o.eatWhile(/[^&<]/),null}x.isInText=!0;function M(o,T){var S=o.next();if(S==">"||S=="/"&&o.eat(">"))return T.tokenize=x,A=S==">"?"endTag":"selfcloseTag","tag bracket";if(S=="=")return A="equals",null;if(S=="<"){T.tokenize=x,T.state=h,T.tagName=T.tagStart=null;var y=T.tokenize(o,T);return y?y+" tag error":"tag error"}else return/[\'\"]/.test(S)?(T.tokenize=w(S),T.stringStartCol=o.column(),T.tokenize(o,T)):(o.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function w(o){var T=function(S,y){for(;!S.eol();)if(S.next()==o){y.tokenize=M;break}return"string"};return T.isInAttribute=!0,T}function E(o,T){return function(S,y){for(;!S.eol();){if(S.match(T)){y.tokenize=x;break}S.next()}return o}}function b(o){return function(T,S){for(var y;(y=T.next())!=null;){if(y=="<")return S.tokenize=b(o+1),S.tokenize(T,S);if(y==">")if(o==1){S.tokenize=x;break}else return S.tokenize=b(o-1),S.tokenize(T,S)}return"meta"}}function u(o,T,S){this.prev=o.context,this.tagName=T,this.indent=o.indented,this.startOfLine=S,(j.doNotIndent.hasOwnProperty(T)||o.context&&o.context.noIndent)&&(this.noIndent=!0)}function a(o){o.context&&(o.context=o.context.prev)}function l(o,T){for(var S;;){if(!o.context)return;if(S=o.context.tagName,!j.contextGrabbers.hasOwnProperty(S)||!j.contextGrabbers[S].hasOwnProperty(T))return;a(o)}}function h(o,T,S){return o=="openTag"?(S.tagStart=T.column(),L):o=="closeTag"?f:h}function L(o,T,S){return o=="word"?(S.tagName=T.current(),c="tag",C):j.allowMissingTagName&&o=="endTag"?(c="tag bracket",C(o,T,S)):(c="error",L)}function f(o,T,S){if(o=="word"){var y=T.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?(c="tag",p):(c="tag error",D)}else return j.allowMissingTagName&&o=="endTag"?(c="tag bracket",p(o,T,S)):(c="error",D)}function p(o,T,S){return o!="endTag"?(c="error",p):(a(S),h)}function D(o,T,S){return c="error",p(o,T,S)}function C(o,T,S){if(o=="word")return c="attribute",m;if(o=="endTag"||o=="selfcloseTag"){var y=S.tagName,P=S.tagStart;return S.tagName=S.tagStart=null,o=="selfcloseTag"||j.autoSelfClosers.hasOwnProperty(y)?l(S,y):(l(S,y),S.context=new u(S,y,P==S.indented)),h}return c="error",C}function m(o,T,S){return o=="equals"?v:(j.allowMissing||(c="error"),C(o,T,S))}function v(o,T,S){return o=="string"?d:o=="word"&&j.allowUnquoted?(c="string",C):(c="error",C(o,T,S))}function d(o,T,S){return o=="string"?d:C(o,T,S)}return{startState:function(o){var T={tokenize:x,state:h,indented:o||0,tagName:null,tagStart:null,context:null};return o!=null&&(T.baseIndent=o),T},token:function(o,T){if(!T.tagName&&o.sol()&&(T.indented=o.indentation()),o.eatSpace())return null;A=null;var S=T.tokenize(o,T);return(S||A)&&S!="comment"&&(c=null,T.state=T.state(A||S,o,T),c&&(S=c=="error"?S+" error":c)),S},indent:function(o,T,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!=M&&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(T))return 0;var P=T&&/^<(\/)?([\w_:\.-]*)/.exec(T);if(P&&P[1])for(;y;)if(y.tagName==P[2]){y=y.prev;break}else if(j.implicitlyClosed.hasOwnProperty(y.tagName))y=y.prev;else break;else if(P)for(;y;){var B=j.contextGrabbers[y.tagName];if(B&&B.hasOwnProperty(P[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=C)},xmlCurrentTag:function(o){return o.tagName?{name:o.tagName,close:o.type=="closeTag"}:null},xmlCurrentContext:function(o){for(var T=[],S=o.context;S;S=S.prev)S.tagName&&T.push(S.tagName);return T.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(M){return typeof M=="string"&&Q.test(M)}for(var O=U,j=[],F=0;F<256;++F)j.push((F+256).toString(16).substr(1));function _(M){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,E=(j[M[w+0]]+j[M[w+1]]+j[M[w+2]]+j[M[w+3]]+"-"+j[M[w+4]]+j[M[w+5]]+"-"+j[M[w+6]]+j[M[w+7]]+"-"+j[M[w+8]]+j[M[w+9]]+"-"+j[M[w+10]]+j[M[w+11]]+j[M[w+12]]+j[M[w+13]]+j[M[w+14]]+j[M[w+15]]).toLowerCase();if(!O(E))throw TypeError("Stringified UUID is invalid");return E}var A=_;function c(M,w,E){M=M||{};var b=M.random||(M.rng||R)();if(b[6]=b[6]&15|64,b[8]=b[8]&63|128,w){E=E||0;for(var u=0;u<16;++u)w[E+u]=b[u];return w}return A(b)}var x=at.a=c},"7ahc":function(dt,at,se){"use strict";se.d(at,"a",function(){return L});var ne=se("k1fw"),$=se("0Owb"),R=se("+L6B"),Q=se("2/Rp"),U=se("y8nQ"),O=se("Vl3Y"),j=se("tJVT"),F=se("OaEy"),_=se("2fM7"),A=se("q1tI"),c=se.n(A),x=se("VrN/"),M=se.n(x),w=se("p77/"),E=se.n(w),b=se("c5Ni"),u=se.n(b),a=_.a.Option,l={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(f){var p=f.callback,D=f.onCancel,C=Object(A.useState)("python"),m=Object(j.a)(C,2),v=m[0],d=m[1];function o(S){d(h[S][1])}function T(S){p(S)}return c.a.createElement(O.a,Object($.a)({},l,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:T}),c.a.createElement(O.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},c.a.createElement(_.a,{onChange:o},Object.keys(h).map(function(S){return c.a.createElement(a,{key:S,value:S},h[S][0])}))),c.a.createElement(O.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},c.a.createElement(L,{mode:v})),c.a.createElement("div",{className:"flex-container flex-end"},c.a.createElement(Q.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),c.a.createElement(Q.a,{type:"ghost",onClick:D},"\u53D6\u6D88")))};function L(f){var p=f.value,D=f.onChange,C=f.mode,m=f.options,v=m===void 0?{}:m,d=Object(A.useRef)(),o=Object(A.useState)(),T=Object(j.a)(o,2),S=T[0],y=T[1];return Object(A.useEffect)(function(){if(S){function P(B){var W=B.getValue();D&&D(W)}return S.on("change",P),function(){S.off("change",P)}}},[S,D]),Object(A.useEffect)(function(){S&&S.setOption("mode",C)},[S,C]),Object(A.useEffect)(function(){S&&((p!==S.getValue()||p==="")&&setTimeout(function(){S.setValue(p||" ")},300))},[S,p]),Object(A.useEffect)(function(){if(d.current&&!S){var P=M.a.fromTextArea(d.current,Object(ne.a)({mode:C,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},v));y(P)}},[d.current,S]),c.a.createElement("div",{className:"my-codemirror-container"},c.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("."),F=j>-1&&Q.substring(j+1,Q.length);if(F)return ne.findModeByExtension(F)},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"),F=se("WmNS"),_=se.n(F),A=se("q1tI"),c=se.n(A),x=se("vg9a"),M=se("DlQD"),w=se.n(M),E=se("rUJ1");function b(K,s){var g=K.match(/^(\s+)(?:```)/);if(g===null)return s;var G=g[1];return s.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>"],l=new w.a.Renderer,h=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function L(){u.length=0,a=["<ul>"]}var f={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function p(K,s,g,G){if(s>=K.length||K[s].level<=g)return s;var J=K[s];G.push("<li><a href='#"+J.anchor+"'>"+J.text+"</a>"),s++;var z=[];return s=p(K,s,J.level,z),z.length>0&&(G.push("<ul>"),z.forEach(function(ye){G.push(ye)}),G.push("</ul>")),G.push("</li>"),s=p(K,s,g,G),s}function D(){return p(u,0,0,a),a.push("</ul>"),a.join("")}var C={heading:function(s){var g=h.exec(s);if(g)return{type:"heading",raw:g[0],depth:g[1].length,text:g[2]}},fences:function(s){var g=this.rules.block.fences.exec(s);if(g){var G=g[0],J=b(G,g[3]||""),z=g[2]?g[2].trim():g[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}}}},m=/(?:\${2})([^\n`]+?)(?:\${2})/gi,v=0,d=function(){return"__special_katext_id_".concat(v++,"__")},o={};function T(){return o}function S(){v=0,o={}}function y(K){return K=K.replace(m,function(s,g){var G=d();return o[G]={type:"inline",expression:g},G}),K}var P=l.listitem;l.listitem=function(K){return P(y(K))};var B=l.paragraph;l.paragraph=function(K){return B(y(K))};var W=l.tablecell;l.tablecell=function(K,s){return W(y(K),s)},l.code=function(K,s,g){var G=(s||"").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(s,'">').concat(g?K:Object(E.escape)(K,!0),`</code></pre>
|
|
`):'<pre class="prettyprint linenums"><code>'+(g?K:Object(E.escape)(K,!0))+"</code></pre>"},l.heading=function(K,s,g){var G=this.options.headerPrefix+g.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return u.push({anchor:G,level:s,text:K}),"<h"+s+' id="'+G+'">'+K+"</h"+s+">"},w.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),w.a.use({tokenizer:C,renderer:l});var V=w.a,I=se("SJMd"),N=se("ulZh"),X=se.n(N),ee=se("m3rI"),oe=se("Oy/b"),ce=se("p5ED"),De=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 Ee=function(K,s){return(Ee=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(g,G){g.__proto__=G}||function(g,G){for(var J in G)Object.prototype.hasOwnProperty.call(G,J)&&(g[J]=G[J])})(K,s)};function Ce(K,s){function g(){this.constructor=K}Ee(K,s),K.prototype=s===null?Object.create(s):(g.prototype=s.prototype,new g)}function Te(K,s,g,G){return new(g||(g=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 g?ze:new g(function(wt){wt(ze)})).then(ye,He)}Oe((G=G.apply(K,s||[])).next())})}function me(K,s){var g,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(g)throw new TypeError("Generator is already executing.");for(;ye;)try{if(g=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=s.call(K,ye)}catch(wt){ze=[6,wt],G=0}finally{g=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,s=0,g=arguments.length;s<g;s++)K+=arguments[s].length;var G=Array(K),J=0;for(s=0;s<g;s++)for(var z=arguments[s],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(s,g){for(var G=0,J=g;G<J.length;G++){var z=J[G],ye=z[0],He=z[1];s.setAttribute(ye,He)}},K.createRect=function(s,g,G){var J=document.createElementNS("http://www.w3.org/2000/svg","rect");return J.setAttribute("width",s.toString()),J.setAttribute("height",g.toString()),G&&K.setAttributes(J,G),J},K.createLine=function(s,g,G,J,z){var ye=document.createElementNS("http://www.w3.org/2000/svg","line");return ye.setAttribute("x1",s.toString()),ye.setAttribute("y1",g.toString()),ye.setAttribute("x2",G.toString()),ye.setAttribute("y2",J.toString()),z&&K.setAttributes(ye,z),ye},K.createPolygon=function(s,g){var G=document.createElementNS("http://www.w3.org/2000/svg","polygon");return G.setAttribute("points",s),g&&K.setAttributes(G,g),G},K.createCircle=function(s,g){var G=document.createElementNS("http://www.w3.org/2000/svg","circle");return G.setAttribute("cx",(s/2).toString()),G.setAttribute("cy",(s/2).toString()),G.setAttribute("r",s.toString()),g&&K.setAttributes(G,g),G},K.createEllipse=function(s,g,G){var J=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return J.setAttribute("cx",(s/2).toString()),J.setAttribute("cy",(g/2).toString()),J.setAttribute("rx",(s/2).toString()),J.setAttribute("ry",(g/2).toString()),G&&K.setAttributes(J,G),J},K.createGroup=function(s){var g=document.createElementNS("http://www.w3.org/2000/svg","g");return s&&K.setAttributes(g,s),g},K.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},K.createMarker=function(s,g,G,J,z,ye,He){var Oe=document.createElementNS("http://www.w3.org/2000/svg","marker");return K.setAttributes(Oe,[["id",s],["orient",g],["markerWidth",G.toString()],["markerHeight",J.toString()],["refX",z.toString()],["refY",ye.toString()]]),Oe.appendChild(He),Oe},K.createText=function(s){var g=document.createElementNS("http://www.w3.org/2000/svg","text");return g.setAttribute("x","0"),g.setAttribute("y","0"),s&&K.setAttributes(g,s),g},K.createTSpan=function(s,g){var G=document.createElementNS("http://www.w3.org/2000/svg","tspan");return G.textContent=s,g&&K.setAttributes(G,g),G},K.createImage=function(s){var g=document.createElementNS("http://www.w3.org/2000/svg","image");return s&&K.setAttributes(g,s),g},K.createPoint=function(s,g){var G=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return G.x=s,G.y=g,G},K.createPath=function(s,g){var G=document.createElementNS("http://www.w3.org/2000/svg","path");return G.setAttribute("d",s),g&&K.setAttributes(G,g),G},K}(),te=function(){function K(){}return K.addKey=function(s){K.key=s},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}(),he=function(){function K(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return K.prototype.rasterize=function(s,g,G){var J=this;return new Promise(function(z){var ye=G!==void 0?G:document.createElement("canvas");s===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",g.width.baseVal.valueAsString),He.setAttribute("height",g.height.baseVal.valueAsString),He.setAttribute("viewBox","0 0 "+g.viewBox.baseVal.width.toString()+" "+g.viewBox.baseVal.height.toString()),He.innerHTML=g.innerHTML,J.naturalSize===!0?(He.width.baseVal.value=s.naturalWidth,He.height.baseVal.value=s.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(s,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"}),Ht=ze.createObjectURL(Nt);wt.onload=function(){mt.drawImage(wt,0,0),ze.revokeObjectURL(Ht);var Wr=ye.toDataURL(J.imageType,J.imageQuality);z(Wr)},wt.src=Ht})},K}(),ae=function(){},we=function(){function K(s){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+s+"_"}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(s){return this.styleSheet===void 0&&this.addStyleSheet(),s.name=""+this.classNamePrefix+s.localName,this.classes.push(s),this.styleSheet.sheet.insertRule("."+s.name+" {"+s.style+"}",this.styleSheet.sheet.cssRules.length),s},K.prototype.addRule=function(s){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(s),this.styleSheet.sheet.insertRule(s.selector+" {"+s.style+"}",this.styleSheet.sheet.cssRules.length)},K.prototype.addStyleSheet=function(){var s;this.styleSheet=document.createElement("style"),((s=this.styleSheetRoot)!==null&&s!==void 0?s:document.head).appendChild(this.styleSheet),this.addRule(new Le("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new Le("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
|
|
from {
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
}
|
|
`)),this.addRule(new Le("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
|
|
from {
|
|
opacity: 1;
|
|
}
|
|
to {
|
|
opacity: 0;
|
|
}
|
|
`)),this.addClass(new xe("fade_in",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
|
|
`)),this.addClass(new xe("fade_out",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
|
|
`))},K.prototype.removeStyleSheet=function(){var s;this.styleSheet&&(((s=this.styleSheetRoot)!==null&&s!==void 0?s:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},K}(),Le=function(K,s){this.selector=K,this.style=s},xe=function(K,s){this.localName=K,this.style=s},_e=function(){function K(s,g,G,J,z){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=s,this.displayMode=g,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(s){var g=this;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=s,this.uiContainer.className=this.toolbarStyleClass.name+" "+this.styles.fadeInAnimationClassName+" "+(this.uiStyleSettings.toolbarStyleColorsClassName?this.uiStyleSettings.toolbarStyleColorsClassName:this.toolbarStyleColorsClass.name);var 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=""+g.toolbarButtonStyleClass.name,ye.setAttribute("data-type-name",z.typeName),ye.innerHTML=z.icon,ye.addEventListener("click",function(){g.markerToolbarButtonClicked(ye,z)}),g.buttons.push(ye),g.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(s){this.buttonClickListeners.push(s)},K.prototype.removeButtonClickListener=function(s){this.buttonClickListeners.indexOf(s)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(s),1)},K.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},K.prototype.adjustLayout=function(){if(this.markerButtons&&this.markerButtons.length>0){var s=Math.floor(this.markerButtonBlock.clientWidth/this.uiStyleSettings.toolbarHeight)-1;this.markerButtonBlock.innerHTML="",this.markerButtonOverflowBlock.innerHTML="";for(var g=0;g<this.markerButtons.length;g++)g<s||g===s&&this.markerButtons.length-1===s?this.markerButtonBlock.appendChild(this.markerButtons[g]):(g===s&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[g]))}},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 s=this;this.buttons.forEach(function(g){g.className=g.className.replace(s.uiStyleSettings.toolbarButtonStyleColorsClassName?s.uiStyleSettings.toolbarButtonStyleColorsClassName:s.toolbarButtonStyleColorsClass.name,"").trim(),g.className=g.className.replace(s.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?s.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:s.toolbarActiveButtonStyleColorsClass.name,"").trim(),g.className+=" "+(s.uiStyleSettings.toolbarButtonStyleColorsClassName?s.uiStyleSettings.toolbarButtonStyleColorsClassName:s.toolbarButtonStyleColorsClass.name)})},K.prototype.addActionButton=function(s,g,G){var J=this,z=document.createElement("div");switch(z.className=""+this.toolbarButtonStyleClass.name,z.innerHTML=g,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}s.appendChild(z),this.buttons.push(z)},K.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new xe("toolbar",`
|
|
width: 100%;
|
|
flex-shrink: 0;
|
|
display: flex;
|
|
flex-direction: row;
|
|
justify-content: space-between;
|
|
height: `+this.uiStyleSettings.toolbarHeight+`px;
|
|
box-sizing: content-box;
|
|
`+(this.displayMode==="inline"?"border-top-left-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
|
|
`+(this.displayMode==="inline"?"border-top-right-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
|
|
overflow: hidden;
|
|
`)),this.toolbarStyleColorsClass=this.styles.addClass(new xe("toolbar_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
box-shadow: 0px 3px rgba(33, 33, 33, 0.1);
|
|
`)),this.toolbarBlockStyleClass=this.styles.addClass(new xe("toolbar-block",`
|
|
display: inline-block;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new xe("toolbar-overflow-block",`
|
|
position: absolute;
|
|
top: `+this.uiStyleSettings.toolbarHeight+`px;
|
|
max-width: `+2*this.uiStyleSettings.toolbarHeight+`px;
|
|
z-index: 10;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarOverflowBlockStyleColorsClass=this.styles.addClass(new xe("toolbar-overflow-block_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
`));var s=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new xe("toolbar_button",`
|
|
display: inline-block;
|
|
width: `+(this.uiStyleSettings.toolbarHeight-2*s)+`px;
|
|
height: `+(this.uiStyleSettings.toolbarHeight-2*s)+`px;
|
|
padding: `+s+`px;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new xe("toolbar_button_colors",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new xe("toolbar_active_button",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`)),this.styles.addRule(new Le("."+this.toolbarButtonStyleClass.name+" svg",`
|
|
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
|
|
`)),this.styles.addRule(new Le("."+this.toolbarButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`))},K.prototype.markerToolbarButtonClicked=function(s,g){this.setActiveButton(s),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(G){return G("marker",g)}),this.markerButtonOverflowBlock.style.display="none"},K.prototype.actionToolbarButtonClicked=function(s,g){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(G){return G("action",g)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},K.prototype.setActiveButton=function(s){this.resetButtonStyles(),s.className=s.className.replace(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name,"").trim(),s.className+=" "+(this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?this.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:this.toolbarActiveButtonStyleColorsClass.name)},K.prototype.setActiveMarkerButton=function(s){var g=this.markerButtons.find(function(G){return G.getAttribute("data-type-name")===s});g&&this.setActiveButton(g)},K.prototype.setCurrentMarker=function(s){var g=this;this.currentMarker=s,this.buttons.filter(function(G){return/delete|notes/.test(G.getAttribute("data-action"))}).forEach(function(G){g.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(s,g,G,J){this.panels=[],this.panelButtons=[],this.markerjsContainer=s,this.displayMode=g,this.uiStyleSettings=G,this.styles=J,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return K.prototype.addStyles=function(){var s;this.toolboxStyleClass=this.styles.addClass(new xe("toolbox",`
|
|
width: 100%;
|
|
flex-shrink: 0;
|
|
display: flex;
|
|
flex-direction: column;
|
|
font-family: sans-serif;
|
|
`+(this.displayMode==="popup"?"height:"+2.5*this.uiStyleSettings.toolbarHeight+"px;":"")+`
|
|
box-sizing: content-box;
|
|
`+(this.displayMode==="popup"?"background-color: "+this.uiStyleSettings.canvasBackgroundColor+";":"")+`
|
|
`+(this.displayMode==="inline"?"border-bottom-left-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
|
|
`+(this.displayMode==="inline"?"border-bottom-right-radius: "+Math.round(this.uiStyleSettings.toolbarHeight/10)+"px;":"")+`
|
|
overflow: hidden;
|
|
`)),this.toolboxStyleColorsClass=this.styles.addClass(new xe("toolbox_colors",`
|
|
color: `+this.uiStyleSettings.toolboxColor+`;
|
|
`));var g=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new xe("toolbox-button-row",`
|
|
display: flex;
|
|
cursor: default;
|
|
box-sizing: content-box;
|
|
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new xe("toolbox-button-row_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new xe("toolbox-panel-row",`
|
|
display: flex;
|
|
`+(this.displayMode==="inline"?"position: absolute;":"")+`
|
|
`+(this.displayMode==="inline"?"bottom: "+this.uiStyleSettings.toolbarHeight+"px;":"")+`
|
|
cursor: default;
|
|
height: `+1.5*this.uiStyleSettings.toolbarHeight+`px;
|
|
`+(this.displayMode==="inline"?"width: 100%;":"")+`
|
|
box-sizing: content-box;
|
|
`)),this.toolboxPanelRowStyleColorsClass=this.styles.addClass(new xe("toolbox-panel-row_colors",`
|
|
background-color: `+((s=this.uiStyleSettings.toolboxBackgroundColor)!==null&&s!==void 0?s:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
|
|
`)),this.toolboxButtonStyleClass=this.styles.addClass(new xe("toolbox_button",`
|
|
display: inline-block;
|
|
width: `+(this.uiStyleSettings.toolbarHeight-2*g)+`px;
|
|
height: `+(this.uiStyleSettings.toolbarHeight-2*g)+`px;
|
|
padding: `+g+`px;
|
|
box-sizing: content-box;
|
|
`)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new xe("toolbox-button_colors",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new xe("toolbox-active-button_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.styles.addRule(new Le("."+this.toolboxButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`)),this.styles.addRule(new Le("."+this.toolboxButtonStyleClass.name+" svg",`
|
|
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
|
|
`))},K.prototype.show=function(s){var g;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=s,this.uiContainer.className=this.toolboxStyleClass.name+" "+((g=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&g!==void 0?g:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},K.prototype.setPanelButtons=function(s){var g,G,J=this;this.panels=s,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((g=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&g!==void 0?g: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(s){var g=this,G=-1;if(s!==this.activePanel){G=this.panels.indexOf(s),this.panelRow.innerHTML="";var J=s.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=s}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){g.displayMode==="inline"?g.panelRow.style.display="none":g.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(z,ye){var He,Oe;z.className=g.toolboxButtonStyleClass.name+" "+(ye===G?""+((He=g.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&He!==void 0?He:g.toolboxActiveButtonStyleColorsClass.name):""+((Oe=g.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&Oe!==void 0?Oe:g.toolboxButtonStyleColorsClass.name))})},K}(),We=function(K,s){this.title=K,this.icon=s},Fe=function(K){function s(g,G,J,z){var ye=K.call(this,g,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 Ce(s,K),s.prototype.getUi=function(){var g=this,G=document.createElement("div");return G.style.overflow="hidden",G.style.whiteSpace="nowrap",this.colors.forEach(function(J){var z=g.getColorBox(J);G.appendChild(z),g.colorBoxes.push(z)}),G},s.prototype.getColorBox=function(g){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=g===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",ye.addEventListener("click",function(){G.setCurrentColor(g,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=g,He.style.borderRadius=z/2+"px",g==="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},s.prototype.setCurrentColor=function(g,G){var J=this;this.currentColor=g,this.colorBoxes.forEach(function(z){z.style.borderColor=z===G?J.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(g)},s}(We),Ne=function(){function K(s,g,G){this._state="new",this._isSelected=!1,this._container=s,this._overlayContainer=g,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(s){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(s,g){},K.prototype.dblClick=function(s,g){},K.prototype.manipulate=function(s){},K.prototype.pointerUp=function(s){this.stateChanged()},K.prototype.dispose=function(){},K.prototype.addMarkerVisualToContainer=function(s){this.container.childNodes.length>0?this.container.insertBefore(s,this.container.childNodes[0]):this.container.appendChild(s)},K.prototype.getState=function(){return{typeName:K.typeName,state:this.state,notes:this.notes}},K.prototype.restoreState=function(s){this._state=s.state,this.notes=s.notes},K.prototype.scale=function(s,g){},K.prototype.colorChanged=function(s){this.onColorChanged&&this.onColorChanged(s),this.stateChanged()},K.prototype.fillColorChanged=function(s){this.onFillColorChanged&&this.onFillColorChanged(s),this.stateChanged()},K.prototype.stateChanged=function(){if(this.onStateChanged&&this.state!=="creating"&&this.state!=="new"){var s=this.getState();this.manipulationStartState!==void 0&&(this.manipulationStartState.state="select"),s.state="select",JSON.stringify(this.manipulationStartState)!=JSON.stringify(s)&&this.onStateChanged(this)}},K.typeName="MarkerBase",K}(),Ue=function(){function K(){this.findGripByVisual=this.findGripByVisual.bind(this)}return K.prototype.findGripByVisual=function(s){return this.topLeft.ownsTarget(s)?this.topLeft:this.topCenter.ownsTarget(s)?this.topCenter:this.topRight.ownsTarget(s)?this.topRight:this.centerLeft.ownsTarget(s)?this.centerLeft:this.centerRight.ownsTarget(s)?this.centerRight:this.bottomLeft.ownsTarget(s)?this.bottomLeft:this.bottomCenter.ownsTarget(s)?this.bottomCenter:this.bottomRight.ownsTarget(s)?this.bottomRight:void 0},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(s){return s===this.visual||s===this.visual.childNodes[0]||s===this.visual.childNodes[1]},K}(),ot=function(){function K(){}return K.toITransformMatrix=function(s){return{a:s.a,b:s.b,c:s.c,d:s.d,e:s.e,f:s.f}},K.toSVGMatrix=function(s,g){return s.a=g.a,s.b=g.b,s.c=g.c,s.d=g.d,s.e=g.e,s.f=g.f,s},K}(),nt=function(K){function s(g,G,J){var z=K.call(this,g,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 Ce(s,K),Object.defineProperty(s.prototype,"centerX",{get:function(){return this.left+this.width/2},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"centerY",{get:function(){return this.top+this.height/2},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"visual",{get:function(){return this._visual},set:function(g){this._visual=g;var G=ue.createTransform();this._visual.transform.baseVal.appendItem(G)},enumerable:!1,configurable:!0}),s.prototype.ownsTarget=function(g){return!!K.prototype.ownsTarget.call(this,g)||!!(this.controlGrips.findGripByVisual(g)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(g))},s.prototype.pointerDown=function(g,G){K.prototype.pointerDown.call(this,g,G),this.state==="new"&&(this.left=g.x,this.top=g.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var J=this.unrotatePoint(g);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"},s.prototype.pointerUp=function(g){var G=this.state;K.prototype.pointerUp.call(this,g),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(g),this._state="select",G==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},s.prototype.moveVisual=function(g){this.visual.style.transform="translate("+g.x+"px, "+g.y+"px)"},s.prototype.manipulate=function(g){var G=this.unrotatePoint(g);this.state==="creating"?this.resize(g):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(g)},s.prototype.resize=function(g){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+g.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+g.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:z=this.manipulationStartTop+g.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+g.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()},s.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},s.prototype.rotate=function(g){if(Math.abs(g.x-this.centerX)>.1){var G=Math.sign(g.x-this.centerX);this.rotationAngle=180*Math.atan((g.y-this.centerY)/(g.x-this.centerX))/Math.PI+90*G,this.applyRotation()}},s.prototype.applyRotation=function(){var g=this.container.transform.baseVal.getItem(0);g.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(g,0)},s.prototype.rotatePoint=function(g){if(this.rotationAngle===0)return g;var G=this.container.getCTM(),J=ue.createPoint(g.x,g.y);return{x:(J=J.matrixTransform(G)).x,y:J.y}},s.prototype.unrotatePoint=function(g){if(this.rotationAngle===0)return g;var G=this.container.getCTM();G=G.inverse();var J=ue.createPoint(g.x,g.y);return{x:(J=J.matrixTransform(G)).x,y:J.y}},s.prototype.select=function(){K.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},s.prototype.deselect=function(){K.prototype.deselect.call(this),this.controlBox.style.display="none"},s.prototype.setupControlBox=function(){this.controlBox=ue.createGroup();var g=ue.createTransform();g.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(g),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"},s.prototype.adjustControlBox=function(){var g=this.controlBox.transform.baseVal.getItem(0);g.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(g,0),this.controlRect.setAttribute("width",(this.width+this.CB_DISTANCE).toString()),this.controlRect.setAttribute("height",(this.height+this.CB_DISTANCE).toString()),this.rotatorGripLine!==void 0&&(this.rotatorGripLine.setAttribute("x1",((this.width+this.CB_DISTANCE)/2).toString()),this.rotatorGripLine.setAttribute("y1",(-this.CB_DISTANCE/2).toString()),this.rotatorGripLine.setAttribute("x2",((this.width+this.CB_DISTANCE)/2).toString()),this.rotatorGripLine.setAttribute("y2",(3*-this.CB_DISTANCE).toString())),this.positionGrips()},s.prototype.addControlGrips=function(){this.controlGrips.topLeft=this.createGrip(),this.controlGrips.topCenter=this.createGrip(),this.controlGrips.topRight=this.createGrip(),this.controlGrips.centerLeft=this.createGrip(),this.controlGrips.centerRight=this.createGrip(),this.controlGrips.bottomLeft=this.createGrip(),this.controlGrips.bottomCenter=this.createGrip(),this.controlGrips.bottomRight=this.createGrip(),this.globalSettings.disableRotation!==!0&&(this.rotatorGrip=this.createGrip()),this.positionGrips()},s.prototype.createGrip=function(){var g=new et;return g.visual.transform.baseVal.appendItem(ue.createTransform()),this.controlBox.appendChild(g.visual),g},s.prototype.positionGrips=function(){var g=this.controlGrips.topLeft.GRIP_SIZE,G=-g/2,J=G,z=(this.width+this.CB_DISTANCE)/2-g/2,ye=(this.height+this.CB_DISTANCE)/2-g/2,He=this.height+this.CB_DISTANCE-g/2,Oe=this.width+this.CB_DISTANCE-g/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)},s.prototype.positionGrip=function(g,G,J){var z=g.transform.baseVal.getItem(0);z.setTranslate(G,J),g.transform.baseVal.replaceItem(z,0)},s.prototype.hideControlBox=function(){this.controlBox.style.display="none"},s.prototype.showControlBox=function(){this.controlBox.style.display=""},s.prototype.getState=function(){return Object.assign({left:this.left,top:this.top,width:this.width,height:this.height,rotationAngle:this.rotationAngle,visualTransformMatrix:ot.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:ot.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},K.prototype.getState.call(this))},s.prototype.restoreState=function(g){K.prototype.restoreState.call(this,g);var G=g;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))},s.prototype.scale=function(g,G){K.prototype.scale.call(this,g,G);var J=this.rotatePoint({x:this.left,y:this.top}),z=this.unrotatePoint({x:J.x*g,y:J.y*G});this.left=z.x,this.top=z.y,this.width=this.width*g,this.height=this.height*G,this.adjustControlBox()},s}(Ne),qe=function(K){function s(g,G,J){var z=K.call(this,g,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 Ce(s,K),s.prototype.ownsTarget=function(g){return!(!K.prototype.ownsTarget.call(this,g)&&g!==this.visual)},s.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)},s.prototype.pointerDown=function(g,G){K.prototype.pointerDown.call(this,g,G),this.state==="new"&&(this.createVisual(),this.moveVisual(g),this._state="creating")},s.prototype.manipulate=function(g){K.prototype.manipulate.call(this,g)},s.prototype.resize=function(g){K.prototype.resize.call(this,g),this.setSize()},s.prototype.setSize=function(){K.prototype.setSize.call(this),ue.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},s.prototype.pointerUp=function(g){K.prototype.pointerUp.call(this,g),this.setSize()},s.prototype.setStrokeColor=function(g){this.strokeColor=g,this.visual&&ue.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(g),this.stateChanged()},s.prototype.setFillColor=function(g){this.fillColor=g,this.visual&&ue.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},s.prototype.setStrokeWidth=function(g){this.strokeWidth=g,this.visual&&ue.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},s.prototype.setStrokeDasharray=function(g){this.strokeDasharray=g,this.visual&&ue.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},s.prototype.getState=function(){return Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},K.prototype.getState.call(this))},s.prototype.restoreState=function(g){var G=g;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,g),this.setSize()},s.prototype.scale=function(g,G){K.prototype.scale.call(this,g,G),this.setSize()},s.title="Rectangle marker",s}(nt),st=function(K){function s(g,G,J,z){var ye=K.call(this,g,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 Ce(s,K),s.prototype.getUi=function(){var g=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===g.currentWidth?g.uiStyleSettings.toolboxAccentColor:"transparent",z.addEventListener("click",function(){g.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 "+g.uiStyleSettings.toolboxColor,Oe.style.flexGrow="2",He.appendChild(Oe),z.appendChild(He),g.widthBoxes.push(z)}),G},s.prototype.setCurrentWidth=function(g,G){var J=this;this.currentWidth=g,this.widthBoxes.forEach(function(z){z.style.borderColor=z===G?J.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},s}(We),$e=function(K){function s(g,G,J,z){var ye=K.call(this,g,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 Ce(s,K),s.prototype.getUi=function(){var g=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/g.styles.length-5+"%",z.style.borderColor=J===g.currentStyle?g.uiStyleSettings.toolboxAccentColor:"transparent",z.addEventListener("click",function(){g.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="`+g.uiStyleSettings.toolboxColor+'" stroke-width="3" '+(J!==""?'stroke-dasharray="'+J+'"':"")+` />
|
|
</svg>`;ye.innerHTML=He,z.appendChild(ye),g.styleBoxes.push(z)}),G},s.prototype.setCurrentStyle=function(g,G){var J=this;this.currentStyle=g,this.styleBoxes.forEach(function(z){z.style.borderColor=z===G?J.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},s}(We),Qe=function(K){function s(g,G,J){var z=K.call(this,g,G,J)||this;return z.strokeColor=J.defaultColor,z.strokeWidth=J.defaultStrokeWidth,z.strokeDasharray=J.defaultStrokeDasharray,z.strokePanel=new Fe("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 Ce(s,K),Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var g=K.prototype.getState.call(this);return g.typeName=s.typeName,g},s.typeName="FrameMarker",s.title="Frame marker",s.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',s}(qe),Me=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 s(g,G,J){var z=K.call(this,g,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 Ce(s,K),s.prototype.ownsTarget=function(g){return!!K.prototype.ownsTarget.call(this,g)||!(!this.grip1.ownsTarget(g)&&!this.grip2.ownsTarget(g))},s.prototype.pointerDown=function(g,G){K.prototype.pointerDown.call(this,g,G),this.manipulationStartX=g.x,this.manipulationStartY=g.y,this.state==="new"&&(this.x1=g.x,this.y1=g.y,this.x2=g.x,this.y2=g.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")},s.prototype.pointerUp=function(g){var G=this.state;K.prototype.pointerUp.call(this,g),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(g),this._state="select",G==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},s.prototype.adjustVisual=function(){},s.prototype.manipulate=function(g){this.state==="creating"?this.resize(g):this.state==="move"?(this.x1=this.manipulationStartX1+g.x-this.manipulationStartX,this.y1=this.manipulationStartY1+g.y-this.manipulationStartY,this.x2=this.manipulationStartX2+g.x-this.manipulationStartX,this.y2=this.manipulationStartY2+g.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(g)},s.prototype.resize=function(g){switch(this.activeGrip){case this.grip1:this.x1=g.x,this.y1=g.y;break;case this.grip2:case void 0:this.x2=g.x,this.y2=g.y}this.adjustVisual(),this.adjustControlBox()},s.prototype.select=function(){K.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},s.prototype.deselect=function(){K.prototype.deselect.call(this),this.controlBox.style.display="none"},s.prototype.setupControlBox=function(){this.controlBox=ue.createGroup(),this.container.appendChild(this.controlBox),this.addControlGrips(),this.controlBox.style.display="none"},s.prototype.adjustControlBox=function(){this.positionGrips()},s.prototype.addControlGrips=function(){this.grip1=this.createGrip(),this.grip2=this.createGrip(),this.positionGrips()},s.prototype.createGrip=function(){var g=new et;return g.visual.transform.baseVal.appendItem(ue.createTransform()),this.controlBox.appendChild(g.visual),g},s.prototype.positionGrips=function(){var g=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-g/2,this.y1-g/2),this.positionGrip(this.grip2.visual,this.x2-g/2,this.y2-g/2)},s.prototype.positionGrip=function(g,G,J){var z=g.transform.baseVal.getItem(0);z.setTranslate(G,J),g.transform.baseVal.replaceItem(z,0)},s.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},K.prototype.getState.call(this))},s.prototype.restoreState=function(g){K.prototype.restoreState.call(this,g);var G=g;this.x1=G.x1,this.y1=G.y1,this.x2=G.x2,this.y2=G.y2},s.prototype.scale=function(g,G){K.prototype.scale.call(this,g,G),this.x1=this.x1*g,this.y1=this.y1*G,this.x2=this.x2*g,this.y2=this.y2*G,this.adjustVisual(),this.adjustControlBox()},s}(Ne),lt=function(K){function s(g,G,J){var z=K.call(this,g,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 Fe("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 Ce(s,K),s.prototype.ownsTarget=function(g){return!(!K.prototype.ownsTarget.call(this,g)&&g!==this.visual&&g!==this.selectorLine&&g!==this.visibleLine)},s.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)},s.prototype.pointerDown=function(g,G){K.prototype.pointerDown.call(this,g,G),this.state==="new"&&(this.createVisual(),this.adjustVisual(),this._state="creating")},s.prototype.adjustVisual=function(){this.selectorLine&&this.visibleLine&&(this.selectorLine.setAttribute("x1",this.x1.toString()),this.selectorLine.setAttribute("y1",this.y1.toString()),this.selectorLine.setAttribute("x2",this.x2.toString()),this.selectorLine.setAttribute("y2",this.y2.toString()),this.visibleLine.setAttribute("x1",this.x1.toString()),this.visibleLine.setAttribute("y1",this.y1.toString()),this.visibleLine.setAttribute("x2",this.x2.toString()),this.visibleLine.setAttribute("y2",this.y2.toString()),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()]]))},s.prototype.setStrokeColor=function(g){this.strokeColor=g,this.adjustVisual(),this.colorChanged(g)},s.prototype.setStrokeWidth=function(g){this.strokeWidth=g,this.adjustVisual()},s.prototype.setStrokeDasharray=function(g){this.strokeDasharray=g,this.adjustVisual(),this.stateChanged()},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var g=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},K.prototype.getState.call(this));return g.typeName=s.typeName,g},s.prototype.restoreState=function(g){K.prototype.restoreState.call(this,g);var G=g;this.strokeColor=G.strokeColor,this.strokeWidth=G.strokeWidth,this.strokeDasharray=G.strokeDasharray,this.createVisual(),this.adjustVisual()},s.typeName="LineMarker",s.title="Line marker",s.icon='<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>',s}(ut),Be=function(K){function s(g,G,J,z){var ye=K.call(this,g,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 Ce(s,K),s.prototype.getUi=function(){var g=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/g.fonts.length-5+"%",z.style.borderColor=J===g.currentFont?g.uiStyleSettings.toolboxAccentColor:"transparent",z.addEventListener("click",function(){g.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),g.fontBoxes.push(z)}),G},s.prototype.setCurrentFont=function(g,G){var J=this;this.currentFont=g,this.fontBoxes.forEach(function(z){z.style.borderColor=z===G?J.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},s}(We),Ke=function(K){function s(g,G,J){var z=K.call(this,g,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 Fe("Color",J.defaultColorSet,J.defaultColor),z.colorPanel.onColorChanged=z.setColor,z.fontFamilyPanel=new Be("Font",J.defaultFontFamilies,J.defaultFontFamily),z.fontFamilyPanel.onFontChanged=z.setFont,z}return Ce(s,K),s.prototype.ownsTarget=function(g){if(K.prototype.ownsTarget.call(this,g)||g===this.visual||g===this.textElement||g===this.bgRectangle)return!0;var G=!1;return this.textElement.childNodes.forEach(function(J){J===g&&(G=!0)}),G},s.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()},s.prototype.pointerDown=function(g,G){K.prototype.pointerDown.call(this,g,G),this.isMoved=!1,this.pointerDownPoint=g,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(g),this._state="creating")},s.prototype.renderText=function(){var g=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){g.textElement.appendChild(ue.createTSpan(G.trim()===""?" ":G.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},s.prototype.getTextScale=function(){var g=this.textElement.getBBox(),G=1;if(g.width>0&&g.height>0){var J=(1*this.width-this.width*this.padding*2/100)/g.width,z=(1*this.height-this.height*this.padding*2/100)/g.height;G=Math.min(J,z)}return G},s.prototype.getTextPosition=function(g){var G=this.textElement.getBBox(),J=0,z=0;return G.width>0&&G.height>0&&(J=(this.width-G.width*g)/2,z=this.height/2-G.height*g/2),{x:J,y:z}},s.prototype.sizeText=function(){var g=this.textElement.getBBox(),G=this.getTextScale(),J=this.getTextPosition(G);J.y-=g.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))},s.prototype.manipulate=function(g){K.prototype.manipulate.call(this,g),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(g.x-this.pointerDownPoint.x)>5||Math.abs(g.y-this.pointerDownPoint.y)>5)},s.prototype.resize=function(g){K.prototype.resize.call(this,g),this.isMoved=!0,this.setSize(),this.sizeText()},s.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()]]))},s.prototype.pointerUp=function(g){var G=this.state;G==="creating"&&(this._suppressMarkerCreateEvent=!0),K.prototype.pointerUp.call(this,g),this.setSize(),(G==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},s.prototype.showTextEditor=function(){var g=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(g.textEditor.style.fontSize);g.textEditor.clientWidth>=Number.parseInt(g.textEditor.style.maxWidth)&&G>.9;)G-=.1,g.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(){g.textEditDivClicked(g.textEditor.innerText)}),this.textEditDiv.appendChild(this.textEditor),this.overlayContainer.appendChild(this.textEditDiv),this.hideVisual(),this.textEditor.focus(),document.execCommand("selectAll")},s.prototype.positionTextEditor=function(){if(this.state==="edit")if(this.textEditor===void 0)this.showTextEditor();else{this.textElement.style.display="";var g=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*g,y:J.height*g};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*g,12)+"px",this.textElement.style.display="none"}},s.prototype.textEditDivClicked=function(g){this.text=g.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},s.prototype.select=function(){K.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},s.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),K.prototype.deselect.call(this)},s.prototype.dblClick=function(g,G){K.prototype.dblClick.call(this,g,G),this.showTextEditor()},s.prototype.setColor=function(g){this.textElement&&ue.setAttributes(this.textElement,[["fill",g]]),this.color=g,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(g)},s.prototype.setFont=function(g){this.textElement&&ue.setAttributes(this.textElement,[["font-family",g]]),this.fontFamily=g,this.textEditor&&(this.textEditor.style.fontFamily=this.fontFamily),this.renderText(),this.stateChanged()},s.prototype.hideVisual=function(){this.textElement.style.display="none",this.hideControlBox()},s.prototype.showVisual=function(){this.state==="edit"&&(this._state="select"),this.textElement.style.display="",this.showControlBox()},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var g=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},K.prototype.getState.call(this));return g.typeName=s.typeName,g},s.prototype.restoreState=function(g){var G=g;this.color=G.color,this.fontFamily=G.fontFamily,this.padding=G.padding,this.text=G.text,this.createVisual(),K.prototype.restoreState.call(this,g),this.setSize()},s.prototype.scale=function(g,G){K.prototype.scale.call(this,g,G),this.setSize(),this.sizeText(),this.positionTextEditor()},s.typeName="TextMarker",s.title="Text marker",s.icon='<svg viewBox="0 0 24 24"><path d="M9.6 14L12 7.7l2.4 6.3M11 5L5.5 19h2.2l1.1-3H15l1.1 3h2.2L13 5h-2z"/></svg>',s}(nt),Se=function(K){function s(g,G,J){var z=K.call(this,g,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 Fe("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 Ce(s,K),s.prototype.ownsTarget=function(g){return!(!K.prototype.ownsTarget.call(this,g)&&g!==this.visual&&g!==this.drawingImage)},s.prototype.createVisual=function(){this.visual=ue.createGroup(),this.drawingImage=ue.createImage(),this.visual.appendChild(this.drawingImage);var g=ue.createTransform();this.visual.transform.baseVal.appendItem(g),this.addMarkerVisualToContainer(this.visual)},s.prototype.pointerDown=function(g,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(g.x,g.y),this.drawing=!0):K.prototype.pointerDown.call(this,g,G)},s.prototype.manipulate=function(g){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(g.x,g.y),this.canvasContext.stroke()):K.prototype.manipulate.call(this,g)},s.prototype.resize=function(g){K.prototype.resize.call(this,g),ue.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),ue.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},s.prototype.pointerUp=function(g){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):K.prototype.pointerUp.call(this,g)},s.prototype.addCanvas=function(){this.overlayContainer.innerHTML="",this.canvasElement=document.createElement("canvas"),this.canvasElement.width=this.overlayContainer.clientWidth*this.pixelRatio,this.canvasElement.height=this.overlayContainer.clientHeight*this.pixelRatio,this.canvasContext=this.canvasElement.getContext("2d"),this.canvasContext.scale(this.pixelRatio,this.pixelRatio),this.overlayContainer.appendChild(this.canvasElement)},s.prototype.select=function(){this.state==="creating"&&this.finishCreation(),K.prototype.select.call(this)},s.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),K.prototype.deselect.call(this)},s.prototype.finishCreation=function(){for(var g=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++)g.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=""},s.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})},s.prototype.setColor=function(g){this.color=g,this.colorChanged(g)},s.prototype.setLineWidth=function(g){this.lineWidth=g},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return this.state==="new"||this.state==="creating"?[this.colorPanel,this.lineWidthPanel]:[]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var g=Object.assign({drawingImgUrl:this.drawingImgUrl},K.prototype.getState.call(this));return g.typeName=s.typeName,g},s.prototype.restoreState=function(g){this.createVisual(),K.prototype.restoreState.call(this,g),this.drawingImgUrl=g.drawingImgUrl,this.setDrawingImage()},s.prototype.scale=function(g,G){K.prototype.scale.call(this,g,G),this.setDrawingImage()},s.typeName="FreehandMarker",s.title="Freehand marker",s.icon='<svg viewBox="0 0 24 24"><path d="M9.75 20.85c1.78-.7 1.39-2.63.49-3.85-.89-1.25-2.12-2.11-3.36-2.94A9.817 9.817 0 014.54 12c-.28-.33-.85-.94-.27-1.06.59-.12 1.61.46 2.13.68.91.38 1.81.82 2.65 1.34l1.01-1.7C8.5 10.23 6.5 9.32 4.64 9.05c-1.06-.16-2.18.06-2.54 1.21-.32.99.19 1.99.77 2.77 1.37 1.83 3.5 2.71 5.09 4.29.34.33.75.72.95 1.18.21.44.16.47-.31.47-1.24 0-2.79-.97-3.8-1.61l-1.01 1.7c1.53.94 4.09 2.41 5.96 1.79m11.09-15.6c.22-.22.22-.58 0-.79l-1.3-1.3a.562.562 0 00-.78 0l-1.02 1.02 2.08 2.08M11 10.92V13h2.08l6.15-6.15-2.08-2.08L11 10.92z"/></svg>',s}(nt),ve=function(K){function s(g,G,J){var z=K.call(this,g,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 Ce(s,K),s.prototype.getUi=function(){var g=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(){g.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 Ht=document.createElement("div");Ht.style.display="flex",Ht.style.alignItems="center",Ht.style.minHeight="20px",Ht.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>`,Ht.style.marginRight="5px",mt.appendChild(Ht)}z.typeBoxes.push(mt)},z=this,ye=0;ye<4;ye++)J(ye);return G},s.prototype.setCurrentType=function(g,G){var J=this;this.currentType=g,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)},s}(We),be=function(K){function s(g,G,J){var z=K.call(this,g,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 Ce(s,K),s.prototype.ownsTarget=function(g){return!(!K.prototype.ownsTarget.call(this,g)&&g!==this.arrow1&&g!==this.arrow2)},s.prototype.getArrowPoints=function(g,G){var J=this.arrowBaseWidth+2*this.strokeWidth,z=this.arrowBaseHeight+2*this.strokeWidth;return g-J/2+","+(G+z/2)+" "+g+","+(G-z/2)+" "+(g+J/2)+","+(G+z/2)},s.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)},s.prototype.pointerDown=function(g,G){K.prototype.pointerDown.call(this,g,G),this.state==="creating"&&this.createTips()},s.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 g=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(g,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(G,0);var J=this.arrow2.transform.baseVal.getItem(0);J.setRotate(g+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(J,0)}},s.prototype.setArrowType=function(g){this.arrowType=g,this.adjustVisual(),this.stateChanged()},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel,this.arrowTypePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var g=Object.assign({arrowType:this.arrowType},K.prototype.getState.call(this));return g.typeName=s.typeName,g},s.prototype.restoreState=function(g){K.prototype.restoreState.call(this,g);var G=g;this.arrowType=G.arrowType,this.createTips(),this.adjustVisual()},s.typeName="ArrowMarker",s.title="Arrow marker",s.icon='<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 7 15.59V9H5v10h10v-2H8.41L19 6.41z"/></svg>',s}(lt),re=function(K){function s(g,G,J){var z=K.call(this,g,G,J)||this;return z.fillColor=J.defaultFillColor,z.strokeWidth=0,z.fillPanel=new Fe("Color",J.defaultColorSet,J.defaultFillColor),z.fillPanel.onColorChanged=z.setFillColor,z}return Ce(s,K),Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var g=K.prototype.getState.call(this);return g.typeName=s.typeName,g},s.typeName="CoverMarker",s.title="Cover marker",s.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',s}(qe),ie=function(K){function s(g,G,J,z){var ye=K.call(this,g,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 Ce(s,K),s.prototype.getUi=function(){var g=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===g.currentOpacity?g.uiStyleSettings.toolboxAccentColor:"transparent",z.addEventListener("click",function(){g.setCurrentOpacity(J,z)}),G.appendChild(z);var ye=document.createElement("div");ye.innerText=100*J+"%",z.appendChild(ye),g.opacityBoxes.push(z)}),G},s.prototype.setCurrentOpacity=function(g,G){var J=this;this.currentOpacity=g,this.opacityBoxes.forEach(function(z){z.style.borderColor=z===G?J.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},s}(We),le=function(K){function s(g,G,J){var z=K.call(this,g,G,J)||this;return z.setOpacity=z.setOpacity.bind(z),z.fillColor=J.defaultHighlightColor,z.strokeWidth=0,z.opacity=J.defaultHighlightOpacity,z.fillPanel=new Fe("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 Ce(s,K),s.prototype.setOpacity=function(g){this.opacity=g,this.visual&&ue.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.fillPanel,this.opacityPanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var g=K.prototype.getState.call(this);return g.typeName=s.typeName,g},s.typeName="HighlightMarker",s.title="Highlight marker",s.icon='<svg viewBox="0 0 24 24"><path d="M18.5 1.15c-.53 0-1.04.19-1.43.58l-5.81 5.82 5.65 5.65 5.82-5.81c.77-.78.77-2.04 0-2.83l-2.84-2.83c-.39-.39-.89-.58-1.39-.58M10.3 8.5l-5.96 5.96c-.78.78-.78 2.04.02 2.85C3.14 18.54 1.9 19.77.67 21h5.66l.86-.86c.78.76 2.03.75 2.81-.02l5.95-5.96"/></svg>',s}(re),de='<svg viewBox="0 0 24 24"><path d="M19 11.5s-2 2.17-2 3.5a2 2 0 002 2 2 2 0 002-2c0-1.33-2-3.5-2-3.5M5.21 10L10 5.21 14.79 10m1.77-1.06L7.62 0 6.21 1.41l2.38 2.38-5.15 5.15c-.59.56-.59 1.53 0 2.12l5.5 5.5c.29.29.68.44 1.06.44s.77-.15 1.06-.44l5.5-5.5c.59-.59.59-1.56 0-2.12z"/></svg>',ke=function(K){function s(g,G,J){var z=K.call(this,g,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 Fe("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 Fe("Fill color",J.defaultColorSet,z.bgColor,de),z.bgColorPanel.onColorChanged=z.setBgColor,z.fontFamilyPanel=new Be("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 Ce(s,K),s.prototype.ownsTarget=function(g){return K.prototype.ownsTarget.call(this,g)||this.tipGrip.ownsTarget(g)||this.tip===g},s.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)},s.prototype.pointerDown=function(g,G){this.state==="new"&&K.prototype.pointerDown.call(this,g,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,g,G)},s.prototype.pointerUp=function(g){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,K.prototype.pointerUp.call(this,g);else{var G=this.state==="creating";K.prototype.pointerUp.call(this,g),this.setTipPoints(G),this.positionTip()}},s.prototype.manipulate=function(g){if(this.tipMoving){var G=this.unrotatePoint(g);this.tipPosition={x:G.x-this.manipulationStartLeft,y:G.y-this.manipulationStartTop},this.positionTip()}else K.prototype.manipulate.call(this,g)},s.prototype.setBgColor=function(g){this.bgRectangle&&this.tip&&(ue.setAttributes(this.bgRectangle,[["fill",g]]),ue.setAttributes(this.tip,[["fill",g]])),this.bgColor=g,this.fillColorChanged(g)},s.prototype.getTipPoints=function(){return this.setTipPoints(this.state==="creating"),this.tipBase1Position.x+","+this.tipBase1Position.y+" "+this.tipBase2Position.x+","+this.tipBase2Position.y+" "+this.tipPosition.x+","+this.tipPosition.y},s.prototype.setTipPoints=function(g){g===void 0&&(g=!1);var G=Math.min(this.height/2,15),J=this.height/5;g&&(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})},s.prototype.resize=function(g){K.prototype.resize.call(this,g),this.positionTip()},s.prototype.positionTip=function(){ue.setAttributes(this.tip,[["points",this.getTipPoints()]]);var g=this.tipGrip.visual.transform.baseVal.getItem(0);g.setTranslate(this.tipPosition.x,this.tipPosition.y),this.tipGrip.visual.transform.baseVal.replaceItem(g,0)},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.colorPanel,this.bgColorPanel,this.fontFamilyPanel]},enumerable:!1,configurable:!0}),s.prototype.select=function(){this.positionTip(),K.prototype.select.call(this)},s.prototype.getState=function(){var g=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},K.prototype.getState.call(this));return g.typeName=s.typeName,g},s.prototype.restoreState=function(g){var G=g;this.bgColor=G.bgColor,this.tipPosition=G.tipPosition,K.prototype.restoreState.call(this,g),this.createTip(),this.setTipPoints()},s.prototype.scale=function(g,G){K.prototype.scale.call(this,g,G),this.tipPosition={x:this.tipPosition.x*g,y:this.tipPosition.y*G},this.positionTip()},s.typeName="CalloutMarker",s.title="Callout marker",s.icon='<svg viewBox="0 0 24 24"><path d="M4 2h16a2 2 0 012 2v12a2 2 0 01-2 2h-4l-4 4-4-4H4a2 2 0 01-2-2V4a2 2 0 012-2m0 2v12h4.83L12 19.17 15.17 16H20V4H4m2 3h12v2H6V7m0 4h10v2H6v-2z"/></svg>',s}(Ke),Pe=function(K){function s(g,G,J){var z=K.call(this,g,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 Fe("Line color",pe(J.defaultColorSet,["transparent"]),J.defaultColor),z.strokePanel.onColorChanged=z.setStrokeColor,z.fillPanel=new Fe("Fill color",pe(J.defaultColorSet,["transparent"]),z.fillColor,de),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 Ce(s,K),s.prototype.ownsTarget=function(g){return!(!K.prototype.ownsTarget.call(this,g)&&g!==this.visual)},s.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)},s.prototype.pointerDown=function(g,G){K.prototype.pointerDown.call(this,g,G),this.state==="new"&&(this.createVisual(),this.moveVisual(g),this._state="creating")},s.prototype.manipulate=function(g){K.prototype.manipulate.call(this,g)},s.prototype.resize=function(g){K.prototype.resize.call(this,g),this.setSize()},s.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()]])},s.prototype.pointerUp=function(g){K.prototype.pointerUp.call(this,g),this.setSize()},s.prototype.setStrokeColor=function(g){this.strokeColor=g,this.visual&&ue.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(g),this.stateChanged()},s.prototype.setFillColor=function(g){this.fillColor=g,this.visual&&ue.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(g),this.stateChanged()},s.prototype.setStrokeWidth=function(g){this.strokeWidth=g,this.visual&&ue.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},s.prototype.setStrokeDasharray=function(g){this.strokeDasharray=g,this.visual&&ue.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},s.prototype.setOpacity=function(g){this.opacity=g,this.visual&&ue.setAttributes(this.visual,[["opacity",this.opacity.toString()]]),this.stateChanged()},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.fillPanel,this.strokeWidthPanel,this.strokeStylePanel,this.opacityPanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var g=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},K.prototype.getState.call(this));return g.typeName=s.typeName,g},s.prototype.restoreState=function(g){var G=g;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,g),this.setSize()},s.prototype.scale=function(g,G){K.prototype.scale.call(this,g,G),this.setSize()},s.typeName="EllipseMarker",s.title="Ellipse marker",s.icon='<svg viewBox="0 0 24 24"><path d="M12 4C6.5 4 2 7.58 2 12s4.5 8 10 8 10-3.58 10-8-4.5-8-10-8z"/></svg>',s}(nt),Xe=function(K){function s(g,G,J){return K.call(this,g,G,J)||this}return Ce(s,K),Object.defineProperty(s.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),s.prototype.ownsTarget=function(g){return!(!K.prototype.ownsTarget.call(this,g)&&g!==this.tip1&&g!==this.tip2)},s.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)},s.prototype.pointerDown=function(g,G){K.prototype.pointerDown.call(this,g,G),this.state==="creating"&&this.createTips()},s.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 g=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(g,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(G,0);var J=this.tip2.transform.baseVal.getItem(0);J.setRotate(g+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(J,0)}},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var g=K.prototype.getState.call(this);return g.typeName=s.typeName,g},s.prototype.restoreState=function(g){K.prototype.restoreState.call(this,g),this.createTips(),this.adjustVisual()},s.typeName="MeasurementMarker",s.title="Measurement marker",s.icon='<svg viewBox="0 0 24 24"><path d="M1.39 18.36l1.77-1.76L4.58 18l1.06-1.05-1.42-1.41 1.42-1.42 2.47 2.48 1.06-1.06-2.47-2.48 1.41-1.41 1.42 1.41L10.59 12l-1.42-1.41 1.42-1.42 2.47 2.48 1.06-1.06-2.47-2.48 1.41-1.41 1.41 1.41 1.07-1.06-1.42-1.41 1.42-1.42L18 6.7l1.07-1.06-2.47-2.48 1.76-1.77 4.25 4.25L5.64 22.61l-4.25-4.25z"/></svg>',s}(lt),vt=function(K){function s(g,G,J){var z=K.call(this,g,G,J)||this;return z.strokePanel.colors=J.defaultColorSet,z.fillColor="transparent",z}return Ce(s,K),Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var g=K.prototype.getState.call(this);return g.typeName=s.typeName,g},s.typeName="EllipseFrameMarker",s.title="Ellipse frame marker",s.icon='<svg viewBox="0 0 24 24"><path d="M12 6c4.41 0 8 2.69 8 6s-3.59 6-8 6-8-2.69-8-6 3.59-6 8-6m0-2C6.5 4 2 7.58 2 12s4.5 8 10 8 10-3.58 10-8-4.5-8-10-8z"/></svg>',s}(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(s){this.undoStack.length!==0&&JSON.stringify(this.undoStack[this.undoStack.length-1])===JSON.stringify(s)||(this.undoStack.push(s),JSON.stringify(this.lastRedoStep)!==JSON.stringify(s)&&this.redoStack.splice(0,this.redoStack.length))},K.prototype.replaceLastUndoStep=function(s){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=s)},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 s=this.undoStack.pop();return s!==void 0&&this.redoStack.push(s),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 s(g,G,J){var z=K.call(this,g,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 Fe("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 Ce(s,K),s.prototype.ownsTarget=function(g){return!(!K.prototype.ownsTarget.call(this,g)&&g!==this.visual&&g!==this.selectorCurve&&g!==this.visibleCurve&&!this.curveGrip.ownsTarget(g))},s.prototype.getPathD=function(){return"M "+this.x1+" "+this.y1+" Q "+this.curveX+" "+this.curveY+", "+this.x2+" "+this.y2},s.prototype.createVisual=function(){this.visual=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)},s.prototype.pointerDown=function(g,G){K.prototype.pointerDown.call(this,g,G),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=g.x,this.curveY=g.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(G)&&(this.activeGrip=this.curveGrip,this._state="resize")},s.prototype.adjustVisual=function(){this.selectorCurve&&this.visibleCurve&&(this.selectorCurve.setAttribute("d",this.getPathD()),this.visibleCurve.setAttribute("d",this.getPathD()),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()]]))},s.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)},s.prototype.addControlGrips=function(){this.curveGrip=this.createGrip(),this.curveX=0,this.curveY=0,K.prototype.addControlGrips.call(this)},s.prototype.positionGrips=function(){K.prototype.positionGrips.call(this);var g=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-g/2,this.curveY-g/2),this.curveControlLine1&&this.curveControlLine2&&(this.curveControlLine1.setAttribute("x1",this.x1.toString()),this.curveControlLine1.setAttribute("y1",this.y1.toString()),this.curveControlLine1.setAttribute("x2",this.curveX.toString()),this.curveControlLine1.setAttribute("y2",this.curveY.toString()),this.curveControlLine2.setAttribute("x1",this.x2.toString()),this.curveControlLine2.setAttribute("y1",this.y2.toString()),this.curveControlLine2.setAttribute("x2",this.curveX.toString()),this.curveControlLine2.setAttribute("y2",this.curveY.toString()))},s.prototype.manipulate=function(g){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+g.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+g.y-this.manipulationStartY),K.prototype.manipulate.call(this,g)},s.prototype.resize=function(g){this.activeGrip===this.curveGrip&&(this.curveX=g.x,this.curveY=g.y),K.prototype.resize.call(this,g),this.state==="creating"&&(this.curveX=this.x1+(this.x2-this.x1)/2,this.curveY=this.y1+(this.y2-this.y1)/2)},s.prototype.setStrokeColor=function(g){this.strokeColor=g,this.adjustVisual(),this.colorChanged(g)},s.prototype.setStrokeWidth=function(g){this.strokeWidth=g,this.adjustVisual()},s.prototype.setStrokeDasharray=function(g){this.strokeDasharray=g,this.adjustVisual()},s.prototype.scale=function(g,G){this.curveX=this.curveX*g,this.curveY=this.curveY*G,K.prototype.scale.call(this,g,G)},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var g=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},K.prototype.getState.call(this));return g.typeName=s.typeName,g},s.prototype.restoreState=function(g){K.prototype.restoreState.call(this,g);var G=g;this.strokeColor=G.strokeColor,this.strokeWidth=G.strokeWidth,this.strokeDasharray=G.strokeDasharray,this.curveX=G.curveX,this.curveY=G.curveY,this.createVisual(),this.adjustVisual()},s.typeName="CurveMarker",s.title="Curve marker",s.icon='<svg viewBox="0 0 24 24"><path d="M18.5 2A1.5 1.5 0 0120 3.5 1.5 1.5 0 0118.5 5c-.23 0-.45-.05-.65-.15l-3.69 3.7.34.45c2.19-1.26 4.76-2 7.5-2l1 .03v2.01L22 9c-2.58 0-5 .75-7 2.04A3.96 3.96 0 0111.04 15C9.75 17 9 19.42 9 22l.04 1H7.03L7 22c0-2.74.74-5.31 2-7.5l-.45-.34-3.7 3.69c.1.2.15.42.15.65A1.5 1.5 0 013.5 20 1.5 1.5 0 012 18.5 1.5 1.5 0 013.5 17c.23 0 .45.05.65.15l3.69-3.7C7.31 12.78 7 11.92 7 11a4 4 0 014-4c.92 0 1.78.31 2.45.84l3.7-3.69c-.1-.2-.15-.42-.15-.65A1.5 1.5 0 0118.5 2M11 9a2 2 0 00-2 2 2 2 0 002 2 2 2 0 002-2 2 2 0 00-2-2z"/></svg>',s}(ut),Et=function(){function K(s,g){g===void 0&&(g=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=s,this.cancelable=g}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 s(g,G,J){var z=K.call(this,g,!1)||this;return z.dataUrl=G,z.state=J,z}return Ce(s,K),s}(Et),it=function(K){function s(g,G,J){J===void 0&&(J=!1);var z=K.call(this,g,J)||this;return z.marker=G,z}return Ce(s,K),s}(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(s,g){this[s].push(g)},K.prototype.removeEventListener=function(s,g){var G=this[s].indexOf(g);G>-1&&this[s].splice(G,1)},K}(),pt=function(){function K(s){this.touchPoints=0,this._availableMarkerTypes=this.DEFAULT_MARKER_TYPES,this.mode="select",this.markers=[],this.isDragging=!1,this.renderEventListeners=[],this.closeEventListeners=[],this.settings=new Me,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=s,this.targetRoot=document.body,this.width=s.clientWidth,this.height=s.clientHeight,this.styles.removeStyleSheet(),this.open=this.open.bind(this),this.setTopLeft=this.setTopLeft.bind(this),this.toolbarButtonClicked=this.toolbarButtonClicked.bind(this),this.createNewMarker=this.createNewMarker.bind(this),this.addNewMarker=this.addNewMarker.bind(this),this.markerCreated=this.markerCreated.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onDblClick=this.onDblClick.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.onPointerOut=this.onPointerOut.bind(this),this.onKeyUp=this.onKeyUp.bind(this),this.overrideOverflow=this.overrideOverflow.bind(this),this.restoreOverflow=this.restoreOverflow.bind(this),this.close=this.close.bind(this),this.closeUI=this.closeUI.bind(this),this.addCloseEventListener=this.addCloseEventListener.bind(this),this.removeCloseEventListener=this.removeCloseEventListener.bind(this),this.addRenderEventListener=this.addRenderEventListener.bind(this),this.removeRenderEventListener=this.removeRenderEventListener.bind(this),this.clientToLocalCoordinates=this.clientToLocalCoordinates.bind(this),this.onWindowResize=this.onWindowResize.bind(this),this.deleteSelectedMarker=this.deleteSelectedMarker.bind(this),this.setWindowHeight=this.setWindowHeight.bind(this),this.removeMarker=this.removeMarker.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this),this.onPopupTargetResize=this.onPopupTargetResize.bind(this),this.showNotesEditor=this.showNotesEditor.bind(this),this.hideNotesEditor=this.hideNotesEditor.bind(this),this.stepZoom=this.stepZoom.bind(this),this.focus=this.focus.bind(this),this.blur=this.blur.bind(this),this.markerStateChanged=this.markerStateChanged.bind(this),this.switchToSelectMode=this.switchToSelectMode.bind(this),this.addDefs=this.addDefs.bind(this),this.addDefsToImage=this.addDefsToImage.bind(this)}return Object.defineProperty(K.prototype,"ALL_MARKER_TYPES",{get:function(){return[Qe,Se,be,Ke,vt,Pe,le,ke,Xe,re,lt,Ge]},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[Qe,Se,be,Ke,Pe,le,ke]},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(s){var g=this;this._availableMarkerTypes.splice(0),s.forEach(function(G){if(typeof G=="string"){var J=g.ALL_MARKER_TYPES.find(function(z){return z.typeName===G});J!==void 0&&g._availableMarkerTypes.push(J)}else g._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(s){this._zoomLevel=s,this.editorCanvas&&this.contentDiv&&(this.editorCanvas.style.transform="scale("+this._zoomLevel+")",this.contentDiv.scrollTo({left:(this.editorCanvas.clientWidth*this._zoomLevel-this.contentDiv.clientWidth)/2,top:(this.editorCanvas.clientHeight*this._zoomLevel-this.contentDiv.clientHeight)/2}))},enumerable:!1,configurable:!0}),Object.defineProperty(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 s=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(g){return g(new Et(s))})},K.prototype.render=function(){return Te(this,void 0,void 0,function(){var s;return me(this,function(g){switch(g.label){case 0:return this.setCurrentMarker(),(s=new he).naturalSize=this.renderAtNaturalSize,s.imageType=this.renderImageType,s.imageQuality=this.renderImageQuality,s.markersOnly=this.renderMarkersOnly,s.width=this.renderWidth,s.height=this.renderHeight,[4,s.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 1:return g.sent(),[4,s.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,g.sent()]}})})},K.prototype.close=function(s){var g=this;if(s===void 0&&(s=!1),this.isOpen){var G=!1;s||this.eventListeners.beforeclose.forEach(function(J){var z=new Et(g,!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(g))}),this.detachEvents(),this._isOpen=!1)}},K.prototype.addMarkersToToolbar=function(){for(var s,g=[],G=0;G<arguments.length;G++)g[G]=arguments[G];(s=this._availableMarkerTypes).push.apply(s,g)},K.prototype.addRenderEventListener=function(s){this.addEventListener("render",function(g){s(g.dataUrl,g.state)})},K.prototype.removeRenderEventListener=function(s){},K.prototype.addCloseEventListener=function(s){this.addEventListener("close",function(){s()})},K.prototype.removeCloseEventListener=function(s){},K.prototype.setupResizeObserver=function(){var s=this;this.settings.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){s.resize(s.target.clientWidth,s.target.clientHeight)}),this.targetObserver.observe(this.target)):this.settings.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){return s.onPopupTargetResize()}),this.targetObserver.observe(this.editorCanvas)),window.addEventListener("resize",this.setWindowHeight))},K.prototype.onPopupTargetResize=function(){var s=1*this.target.clientWidth/this.target.clientHeight,g=this.editorCanvas.clientWidth/s>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*s:this.editorCanvas.clientWidth,G=g<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/s;this.resize(g,G)},K.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},K.prototype.resize=function(s,g){this._isResizing=!0;var G=s/this.imageWidth,J=g/this.imageHeight;this.imageWidth=Math.round(s),this.imageHeight=Math.round(g),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(s,g){var G,J=this;this._currentMarker&&this._currentMarker instanceof Ke?this._currentMarker.scale(s,g):(G=this._currentMarker,this.setCurrentMarker()),this.markers.forEach(function(z){z!==J._currentMarker&&z.scale(s,g)}),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 s=this.editingTarget.getBoundingClientRect(),g=this.editorCanvas.getBoundingClientRect();this.left=s.left-g.left,this.top=s.top-g.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 s,g=[],G=0;G<arguments.length;G++)g[G]=arguments[G];this.defs=ue.createDefs(),this.addDefsToImage(),(s=this.defs).append.apply(s,g)},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 s=document.createElement("a");s.href="https://markerjs.com/",s.target="_blank",s.innerHTML='<svg viewBox="0 0 112 96" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414"><path fill="#e5f20d" fill-opacity=".647" d="M0 40.386h111.96V95.62H0z"/><path d="M93.61 61.452c0 .987-.328 1.831-.987 2.53-.657.7-1.52 1.048-2.591 1.048-1.481 0-2.222-.74-2.222-2.22 0-16.617-.533-29.347-1.604-38.192-1.068-8.842-2.92-13.265-5.552-13.265-4.443 0-10.94 15.509-19.497 46.52v.124c0 .987-.328 1.831-.987 2.53-.657.7-1.52 1.048-2.592 1.048-1.48 0-2.22-.74-2.22-2.22 0-3.29.165-8.392.493-15.302.33-7.732.494-13.82.494-18.262 0-6.17-.186-10.55-.556-13.142-.37-2.591-1.172-3.887-2.406-3.887-2.796 0-6.333 5.12-10.612 15.363C38.494 34.367 34.01 46.44 29.32 60.34l-1.11 3.209a5.714 5.714 0 01-1.42 2.097c-.617.578-1.295.864-2.036.864-.987 0-1.644-.081-1.974-.247-.328-.162-.533-.656-.617-1.48-.41-4.03-.74-9.418-.987-16.165-.163-1.728-.329-4.566-.494-8.515-.822-13.901-1.562-23.3-2.221-28.196-.657-4.893-.987-7.628-.987-8.205 0-.657.33-1.44.987-2.345.659-.903 1.276-1.357 1.85-1.357 1.319 0 2.387.947 3.21 2.838.411.906.863 4.526 1.357 10.859.493 6.335.905 14.19 1.233 23.568l.617 18.88c4.527-13.983 9.216-26.673 14.068-38.068C45.65 6.686 50.093.988 54.123.988c2.715 0 4.566 1.974 5.553 5.923.987 3.949 1.481 9.667 1.481 17.152 0 3.949-.081 9.625-.247 17.029l-.123 5.676c3.373-11.762 6.725-21.634 10.057-29.615 3.331-7.979 6.685-11.97 10.056-11.97 8.475 0 12.71 18.757 12.71 56.269z" fill-rule="nonzero"/></svg>',s.title="Powered by marker.js",s.style.display="grid",s.style.alignItems="center",s.style.justifyItems="center",s.style.padding="3px",s.style.width="20px",s.style.height="20px",this.logoUI.appendChild(s),this.editorCanvas.appendChild(this.logoUI),this.logoUI.style.position="absolute",this.logoUI.style.pointerEvents="all",this.positionLogo()},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 s=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=s+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px",this.coverDiv.style.width=this.target.offsetWidth.toString()+"px",this.coverDiv.style.zIndex=this.uiStyleSettings.zIndex!==void 0?this.uiStyleSettings.zIndex:"5";break;case"popup":this.coverDiv.style.position="absolute",this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=window.innerHeight+"px",this.coverDiv.style.backgroundColor="rgba(0, 0, 0, 0.75)",this.coverDiv.style.zIndex=this.uiStyleSettings.zIndex!==void 0?this.uiStyleSettings.zIndex:"1000",this.coverDiv.style.display="flex"}this.targetRoot.appendChild(this.coverDiv),this.uiDiv=document.createElement("div"),this.uiDiv.style.display="flex",this.uiDiv.style.flexDirection="column",this.uiDiv.style.flexGrow="2",this.uiDiv.style.margin=this.settings.displayMode==="popup"?this.settings.popupMargin+"px":"0px",this.uiDiv.style.border="0px",this.coverDiv.appendChild(this.uiDiv),this.toolbar=new _e(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(s){this.markerImage.removeChild(s.container),this.markers.indexOf(s)>-1&&this.markers.splice(this.markers.indexOf(s),1),s.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(s,g){if(s==="marker"&&g!==void 0)this.createNewMarker(g);else if(s==="action")switch(g){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 s=this;if(this._currentMarker!==void 0){var g=!1;if(this.eventListeners.markerbeforedelete.forEach(function(J){var z=new it(s,s._currentMarker,!0);J(z),z.defaultPrevented&&(g=!0)}),!g){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(s,G))})}}},K.prototype.clear=function(){var s=this,g=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(ye){var He=new it(s,void 0,!0);ye(He),He.defaultPrevented&&(g=!0)}),!g)){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(s,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 s;this._currentMarker!==void 0&&(this.overlayContainer.innerHTML="",this.notesArea=document.createElement("textarea"),this.notesArea.className=this.uiStyleSettings.notesAreaStyleClassName,this.notesArea.style.pointerEvents="auto",this.notesArea.style.alignSelf="stretch",this.notesArea.style.width="100%",this.notesArea.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.notesArea.value=(s=this._currentMarker.notes)!==null&&s!==void 0?s:"",this.overlayContainer.appendChild(this.notesArea))},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 s=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var g=this.getState(),G=this.undoRedoManager.getLastUndoStep();if(!G||G.width===g.width&&G.height===g.height){var J=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(g),J<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach(function(z){return z(new Et(s))})}else this.undoRedoManager.replaceLastUndoStep(g),this.eventListeners.statechange.forEach(function(z){return z(new Et(s))})}},K.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},K.prototype.undoStep=function(){var s=this,g=this.undoRedoManager.undo();g!==void 0&&(this.restoreState(g),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(G){return G(new Et(s))}))},K.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},K.prototype.redoStep=function(){var s=this,g=this.undoRedoManager.redo();g!==void 0&&(this.restoreState(g),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(G){return G(new Et(s))}))},K.prototype.stepZoom=function(){var s=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=s<this.zoomSteps.length-1?this.zoomSteps[s+1]:this.zoomSteps[0]},K.prototype.panTo=function(s){this.contentDiv.scrollBy({left:this.prevPanPoint.x-s.x,top:this.prevPanPoint.y-s.y}),this.prevPanPoint=s},K.prototype.startRenderAndClose=function(){return Te(this,void 0,void 0,function(){var s,g,G=this;return me(this,function(J){switch(J.label){case 0:return[4,this.render()];case 1:return s=J.sent(),g=this.getState(),this.eventListeners.render.forEach(function(z){return z(new ft(G,s,g))}),this.close(!0),[2]}})})},K.prototype.getState=function(s){s===!0&&this.setCurrentMarker();var g={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach(function(G){return g.markers.push(G.getState())}),g},K.prototype.restoreState=function(s){var g=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);s.markers.forEach(function(G){var J=g._availableMarkerTypes.find(function(ye){return ye.typeName===G.typeName});if(J!==void 0){var z=g.addNewMarker(J);z.restoreState(G),g.markers.push(z)}}),s.width&&s.height&&(s.width!==this.imageWidth||s.height!==this.imageHeight)&&this.scaleMarkers(this.imageWidth/s.width,this.imageHeight/s.height),this.eventListeners.restorestate.forEach(function(G){return G(new Et(g))})},K.prototype.addNewMarker=function(s){var g=ue.createGroup();return this.markerImage.appendChild(g),new s(g,this.overlayContainer,this.settings)},K.prototype.createNewMarker=function(s){var g,G=this;(g=typeof s=="string"?this._availableMarkerTypes.find(function(J){return J.typeName===s}):s)&&(this.setCurrentMarker(),this.addUndoStep(),this._currentMarker=this.addNewMarker(g),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(g.typeName),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this.eventListeners.markercreating.forEach(function(J){return J(new it(G,G._currentMarker))}))},K.prototype.markerCreated=function(s){var g=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(s),this.setCurrentMarker(s),s instanceof Se&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(Se):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function(G){return G(new it(g,g._currentMarker))})},K.prototype.colorChanged=function(s){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=s,this.settings.defaultStrokeColor=s)},K.prototype.fillColorChanged=function(s){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=s)},K.prototype.markerStateChanged=function(s){var g=this;this.eventListeners.markerchange.forEach(function(G){return G(new it(g,s))})},K.prototype.setCurrentMarker=function(s){var g=this;this._currentMarker!==s&&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(g,g._currentMarker))})),this._currentMarker=s,this._currentMarker===void 0||this._currentMarker.isSelected||(this._currentMarker.state!=="new"&&this._currentMarker.select(),this.toolbar.setCurrentMarker(this._currentMarker),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this._isResizing||this.eventListeners.markerselect.forEach(function(G){return G(new it(g,g._currentMarker))}))},K.prototype.onPointerDown=function(s){if(this._isFocused||this.focus(),this.touchPoints++,this.touchPoints===1||s.pointerType!=="touch")if(this._currentMarker===void 0||this._currentMarker.state!=="new"&&this._currentMarker.state!=="creating"){if(this.mode==="select"){var g=this.markers.find(function(G){return G.ownsTarget(s.target)});g!==void 0?(this.setCurrentMarker(g),this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(s.clientX,s.clientY),s.target)):(this.setCurrentMarker(),this.isDragging=!0,this.prevPanPoint={x:s.clientX,y:s.clientY})}}else this.isDragging=!0,this._currentMarker.pointerDown(this.clientToLocalCoordinates(s.clientX,s.clientY))},K.prototype.onDblClick=function(s){if(this._isFocused||this.focus(),this.mode==="select"){var g=this.markers.find(function(G){return G.ownsTarget(s.target)});g!==void 0&&g!==this._currentMarker&&this.setCurrentMarker(g),this._currentMarker!==void 0?this._currentMarker.dblClick(this.clientToLocalCoordinates(s.clientX,s.clientY),s.target):this.setCurrentMarker()}},K.prototype.onPointerMove=function(s){this.touchPoints!==1&&s.pointerType==="touch"||(this._currentMarker!==void 0||this.isDragging)&&(this._currentMarker!==void 0&&this._currentMarker.state==="edit"||s.preventDefault(),this._currentMarker!==void 0?this._currentMarker.manipulate(this.clientToLocalCoordinates(s.clientX,s.clientY)):this.zoomLevel>1&&this.panTo({x:s.clientX,y:s.clientY}))},K.prototype.onPointerUp=function(s){this.touchPoints>0&&this.touchPoints--,this.touchPoints===0&&this.isDragging&&this._currentMarker!==void 0&&this._currentMarker.pointerUp(this.clientToLocalCoordinates(s.clientX,s.clientY)),this.isDragging=!1,this.addUndoStep()},K.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},K.prototype.onKeyUp=function(s){this._currentMarker===void 0||this.notesArea!==void 0||s.key!=="Delete"&&s.key!=="Backspace"||this.deleteSelectedMarker()},K.prototype.clientToLocalCoordinates=function(s,g){var G=this.markerImage.getBoundingClientRect();return{x:(s-G.left)/this.zoomLevel,y:(g-G.top)/this.zoomLevel}},K.prototype.onWindowResize=function(){this.positionUI()},K.prototype.positionUI=function(){switch(this.setTopLeft(),this.settings.displayMode){case"inline":var s=this.target.getClientRects().item(0).y>this.styles.settings.toolbarHeight?this.target.offsetTop-this.styles.settings.toolbarHeight:0;this.coverDiv.style.top=s+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px";break;case"popup":this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=this.windowHeight+"px",this.contentDiv.style.maxHeight=this.windowHeight-2*this.settings.popupMargin-3.5*this.styles.settings.toolbarHeight+"px"}this.positionMarkerImage(),this.positionLogo()},K.prototype.addLicenseKey=function(s){te.addKey(s)},K.prototype.addEventListener=function(s,g){this.eventListeners.addEventListener(s,g)},K.prototype.removeEventListener=function(s,g){this.eventListeners.removeEventListener(s,g)},K.prototype.renderState=function(s){this._silentRenderMode=!0,this.settings.displayMode="inline",this.isOpen||this.show(),this.restoreState(s),this.startRenderAndClose(),this._silentRenderMode=!1},Object.defineProperty(K.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),K.prototype.focus=function(){var s=this;this._isFocused||(this.attachWindowEvents(),this._isFocused=!0,this._previousCurrentMarker!==void 0&&this.setCurrentMarker(this._previousCurrentMarker),this.eventListeners.focus.forEach(function(g){return g(new Et(s))}))},K.prototype.blur=function(){var s=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(g){return g(new Et(s))}))},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,s){return(At=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(g,G){g.__proto__=G}||function(g,G){for(var J in G)Object.prototype.hasOwnProperty.call(G,J)&&(g[J]=G[J])})(K,s)};function Lt(K,s){if(typeof s!="function"&&s!==null)throw new TypeError("Class extends value "+String(s)+" is not a constructor or null");function g(){this.constructor=K}At(K,s),K.prototype=s===null?Object.create(s):(g.prototype=s.prototype,new g)}function Ze(K,s,g,G){return new(g||(g=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 g?ze:new g(function(wt){wt(ze)})).then(ye,He)}Oe((G=G.apply(K,s||[])).next())})}function or(K,s){var g,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(g)throw new TypeError("Generator is already executing.");for(;ye;)try{if(g=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=s.call(K,ye)}catch(wt){ze=[6,wt],G=0}finally{g=J=0}if(5&ze[0])throw ze[1];return{value:ze[0]?ze[1]:void 0,done:!0}}([Oe,mt])}}}var Qt=function(){function K(){}return K.addKey=function(s){K.key=s},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(s,g){for(var G=0,J=g;G<J.length;G++){var z=J[G],ye=z[0],He=z[1];s.setAttribute(ye,He)}},K.createRect=function(s,g,G){var J=document.createElementNS("http://www.w3.org/2000/svg","rect");return J.setAttribute("width",s.toString()),J.setAttribute("height",g.toString()),G&&K.setAttributes(J,G),J},K.createLine=function(s,g,G,J,z){var ye=document.createElementNS("http://www.w3.org/2000/svg","line");return ye.setAttribute("x1",s.toString()),ye.setAttribute("y1",g.toString()),ye.setAttribute("x2",G.toString()),ye.setAttribute("y2",J.toString()),z&&K.setAttributes(ye,z),ye},K.createPolygon=function(s,g){var G=document.createElementNS("http://www.w3.org/2000/svg","polygon");return G.setAttribute("points",s),g&&K.setAttributes(G,g),G},K.createCircle=function(s,g){var G=document.createElementNS("http://www.w3.org/2000/svg","circle");return G.setAttribute("cx",(s/2).toString()),G.setAttribute("cy",(s/2).toString()),G.setAttribute("r",s.toString()),g&&K.setAttributes(G,g),G},K.createEllipse=function(s,g,G){var J=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return J.setAttribute("cx",(s/2).toString()),J.setAttribute("cy",(g/2).toString()),J.setAttribute("rx",(s/2).toString()),J.setAttribute("ry",(g/2).toString()),G&&K.setAttributes(J,G),J},K.createGroup=function(s){var g=document.createElementNS("http://www.w3.org/2000/svg","g");return s&&K.setAttributes(g,s),g},K.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},K.createMarker=function(s,g,G,J,z,ye,He){var Oe=document.createElementNS("http://www.w3.org/2000/svg","marker");return K.setAttributes(Oe,[["id",s],["orient",g],["markerWidth",G.toString()],["markerHeight",J.toString()],["refX",z.toString()],["refY",ye.toString()]]),Oe.appendChild(He),Oe},K.createText=function(s){var g=document.createElementNS("http://www.w3.org/2000/svg","text");return g.setAttribute("x","0"),g.setAttribute("y","0"),s&&K.setAttributes(g,s),g},K.createTSpan=function(s,g){var G=document.createElementNS("http://www.w3.org/2000/svg","tspan");return G.textContent=s,g&&K.setAttributes(G,g),G},K.createImage=function(s){var g=document.createElementNS("http://www.w3.org/2000/svg","image");return s&&K.setAttributes(g,s),g},K.createPoint=function(s,g){var G=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return G.x=s,G.y=g,G},K.createPath=function(s,g){var G=document.createElementNS("http://www.w3.org/2000/svg","path");return G.setAttribute("d",s),g&&K.setAttributes(G,g),G},K.createElement=function(s,g){var G=document.createElementNS("http://www.w3.org/2000/svg",s);return g&&K.setAttributes(G,g),G},K.getHollowRectanglePath=function(s,g,G,J,z,ye,He,Oe){return"M"+s+","+g+"V"+(g+J)+"H"+(s+G)+"V"+g+"H"+z+"V"+ye+"H"+(z+He)+"V"+(ye+Oe)+"H"+z+"V"+g+"Z"},K}(),Xt=function(){function K(s){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+s+"_"}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(s){return this.styleSheet===void 0&&this.addStyleSheet(),s.name=""+this.classNamePrefix+s.localName,this.classes.push(s),this.styleSheet.sheet.insertRule("."+s.name+" {"+s.style+"}",this.styleSheet.sheet.cssRules.length),s},K.prototype.addRule=function(s){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(s),this.styleSheet.sheet.insertRule(s.selector+" {"+s.style+"}",this.styleSheet.sheet.cssRules.length)},K.prototype.addStyleSheet=function(){var s;this.styleSheet=document.createElement("style"),((s=this.styleSheetRoot)!==null&&s!==void 0?s:document.head).appendChild(this.styleSheet),this.addRule(new hr("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new hr("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
|
|
from {
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
}
|
|
`)),this.addRule(new hr("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
|
|
from {
|
|
opacity: 1;
|
|
}
|
|
to {
|
|
opacity: 0;
|
|
}
|
|
`)),this.addClass(new ir("_fade_in",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
|
|
`)),this.addClass(new ir("_fade_out",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
|
|
`))},K.prototype.removeStyleSheet=function(){var s;this.styleSheet&&(((s=this.styleSheetRoot)!==null&&s!==void 0?s:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},K}(),hr=function(K,s){this.selector=K,this.style=s},ir=function(K,s){this.localName=K,this.style=s},Cr=function(){function K(){this.blocks=[],this.display=""}return K.prototype.addButtonBlock=function(s){s.className=this.blockClassName,s.buttonClassName=this.buttonClassName,s.buttonColorsClassName=this.buttonColorsClassName,s.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(s)},K.prototype.addElementBlock=function(s){s.className===void 0&&(s.className=this.blockClassName),this.blocks.push(s)},K.prototype.getUI=function(){var s=document.createElement("div");return s.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,s.style.display=this.display,this.blocks.forEach(function(g){return s.appendChild(g.getUI())}),s},K}(),Ar=function(){function K(){}return K.prototype.getUI=function(){var s=document.createElement("div");if(s.className=this.className,this.minWidth!==void 0&&(s.style.minWidth=this.minWidth),this.contentAlign!==void 0)switch(this.contentAlign){case"start":s.style.justifyContent="flex-start";break;case"center":s.style.justifyContent="center";break;case"end":s.style.justifyContent="flex-end"}return s.style.whiteSpace="nowrap",s},K}(),Vr=function(K){function s(){var g=K!==null&&K.apply(this,arguments)||this;return g.buttons=[],g}return Lt(s,K),s.prototype.addButton=function(g){g.className=this.buttonClassName,g.colorsClassName=this.buttonColorsClassName,g.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(g)},s.prototype.getUI=function(){var g=K.prototype.getUI.call(this);return this.buttons.forEach(function(G){return g.appendChild(G.getUI())}),g},s}(Ar),Bt=function(){function K(s,g){this._isActive=!1,this._isHidden=!1,this._icon=s,this.title=g,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(K.prototype,"icon",{get:function(){return this._icon},set:function(s){this._icon=s,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"isActive",{get:function(){return this._isActive},set:function(s){this._isActive=s,this.adjustClassName()},enumerable:!1,configurable:!0}),K.prototype.getUI=function(){var s=this;return this.buttonContainer=document.createElement("div"),this.buttonContainer.title=this.title,this.buttonContainer.className=this.className+" "+this.colorsClassName,this.adjustClassName(),this.buttonContainer.innerHTML=this._icon,this.onClick&&this.buttonContainer.addEventListener("click",function(){return s.onClick()}),this.uiContainer.appendChild(this.buttonContainer),this.uiContainer.style.display=this._isHidden?"none":"inline-block",this.uiContainer},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 s(){var g=K!==null&&K.apply(this,arguments)||this;return g.elements=[],g}return Lt(s,K),s.prototype.addElement=function(g){this.elements.push(g)},s.prototype.getUI=function(){var g=K.prototype.getUI.call(this);return this.elements.forEach(function(G){return g.appendChild(G)}),g},s}(Ar),jr=function(){function K(s,g){this.horizontal=s,this.vertical=g}return Object.defineProperty(K.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),K.prototype.getVerticalLength=function(s){return s/this.ratio},K.prototype.getHorizontalLength=function(s){return s*this.ratio},K}(),li=function(){function K(){}return K.getIcon=function(s,g){if(s>0&&g>0){var G=new jr(s,g),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(s+":"+g)),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 s(g,G,J){var z=K.call(this,g,G)||this;return z.isDropdownOpen=!1,z.onClick=z.dropdownButtonClicked,z.dropdownButtons=J,z}return Lt(s,K),s.prototype.setupDropdown=function(){var g=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=g.className,G.colorsClassName=g.colorsClassName,g.dropdownBlock.appendChild(G.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},s.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},s.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},s.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},s.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},s.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},s}(Bt),Pt=function(){function K(s,g){this.GRIP_SIZE=10,this.color=s,this.fillColor=g,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(s){return s===this.visual||s===this.visual.childNodes[0]||s===this.visual.childNodes[1]},K.prototype.setCenter=function(s,g){this.visual.childNodes.forEach(function(G){return yt.setAttributes(G,[["cx",s.toString()],["cy",g.toString()]])})},K}(),Xr=function(){function K(s,g,G,J){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=s,this.canvasHeight=g,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(s){this._aspectRatio=s,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(s){this._isGridVisible=s,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(s){this._zoomFactor=s,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),K.prototype.open=function(){var s=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 g=0;g<this.numberOfGridLines;g++)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 s.gridContainer.appendChild(G)}),this.verticalGridLines.forEach(function(G){return s.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(s){this.cropRect=s;var g=Object.assign({},this.cropRect);this.zoomFactor!==1&&(g.width=this.cropRect.width*this.zoomFactor,g.height=this.cropRect.height*this.zoomFactor,g.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-g.width/2,g.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-g.height/2),yt.setAttributes(this.cropRectElement,[["x",g.x.toString()],["y",g.y.toString()],["width",g.width.toString()],["height",g.height.toString()]]);var G=g.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(z,ye){var He=g.y+G*(ye+1);yt.setAttributes(z,[["x1",""+g.x],["y1",""+He],["x2",""+(g.x+g.width)],["y2",""+He]])});var J=g.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(z,ye){var He=g.x+J*(ye+1);yt.setAttributes(z,[["x1",""+He],["y1",""+g.y],["x2",""+He],["y2",""+(g.y+g.height)]])}),yt.setAttributes(this.cropShadeElement,[["d",yt.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,g.x,g.y,g.width,g.height)]]),this.topLeftGrip.setCenter(g.x,g.y),this.topRightGrip.setCenter(g.x+g.width,g.y),this.bottomLeftGrip.setCenter(g.x,g.y+g.height),this.bottomRightGrip.setCenter(g.x+g.width,g.y+g.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(s,g){var G=this.container.getBoundingClientRect();return{x:s-G.left+this.margin,y:g-G.top+this.margin}},K.prototype.onPointerDown=function(s){this.container.setPointerCapture(s.pointerId),this.previousPoint=this.clientToLocalCoordinates(s.clientX,s.clientY),this.cropRectElement===s.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(s.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(s.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(s.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(s.target)&&(this.activeGrip=this.bottomRightGrip)},K.prototype.onPointerMove=function(s){if(this.isMoving)this.move(this.clientToLocalCoordinates(s.clientX,s.clientY));else if(this.activeGrip){var g=this.clientToLocalCoordinates(s.clientX,s.clientY);this.resize(g)}s.preventDefault()},K.prototype.onPointerUp=function(s){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(s.pointerId)},K.prototype.move=function(s){var g=s.x-this.previousPoint.x,G=s.y-this.previousPoint.y;this.zoomFactor!==1&&(g=-g/this.zoomFactor,G=-G/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+g),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=s},K.prototype.resize=function(s){var g=Object.assign({},this.cropRect),G=s.x-this.previousPoint.x,J=s.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:g.x+G<this.margin&&(G=this.margin-g.x),g.x+=G,g.width=this.cropRect.x+this.cropRect.width-g.x;break;case this.bottomRightGrip:case this.topRightGrip:g.width+G>this.canvasWidth*this.zoomFactor&&(G=this.canvasWidth*this.zoomFactor-g.width),g.width+=G}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(g.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(G),g.height=this.aspectRatio.getVerticalLength(g.width)):(g.y+=J,g.height=this.cropRect.y+this.cropRect.height-g.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?g.height=this.aspectRatio.getVerticalLength(g.width):g.height+=J}g.width<10&&(g.x=this.cropRect.x,g.width=10),g.height<10&&(g.y=this.cropRect.y,g.height=10),this.previousPoint=s,g.x>=this.margin&&g.y>=this.margin&&g.x-this.margin+g.width<=this.canvasWidth&&g.y-this.margin+g.height<=this.canvasHeight&&(this.cropRect=g,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 s=this.cropRect.x+this.cropRect.width/2,g=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=s-this.cropRect.width/2,this.cropRect.y=g-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(s,g,G,J,z,ye){var He=G/s,Oe=J/g;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(s,g){var G=this.getRescaledRect(this.canvasWidth,this.canvasHeight,s,g,this.cropRect,this.margin);this.canvasWidth=s,this.canvasHeight=g,this.onCropChange&&this.onCropChange(G),this.setCropRectangle(G)},K}(),ui=function(){function K(s){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=s,this.uiContainer=document.createElement("div"),this.getUI=this.getUI.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.setAngleLabel=this.setAngleLabel.bind(this),this.positionScaleShape=this.positionScaleShape.bind(this)}return Object.defineProperty(K.prototype,"angle",{get:function(){return this._angle},set:function(s){this._angle=s,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(s){this.controlContainer.setPointerCapture(s.pointerId),this.isDragging=!0,this.previousPoint={x:s.clientX,y:s.clientY}},K.prototype.onPointerMove=function(s){this.isDragging&&(this.onAngleChange&&this.onAngleChange((s.clientX-this.previousPoint.x)/5),this.previousPoint.x=s.clientX)},K.prototype.onPointerUp=function(s){this.isDragging&&this.onAngleChange&&this.onAngleChange((s.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(s.pointerId)},K.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var s=this.angleLabelText.getBBox();yt.setAttributes(this.angleLabelElement,[["x",((this.width-s.width)/2).toString()],["y",(this.height/2).toString()]])}},K.prototype.positionScaleShape=function(){if(this.scaleShape){var s=this.scaleShape.transform.baseVal.getItem(0);s.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(s,0)}},K.prototype.getVisual=function(){var s=document.createElementNS("http://www.w3.org/2000/svg","svg");s.setAttribute("xmlns","http://www.w3.org/2000/svg"),s.setAttribute("width",this.width+"px"),s.setAttribute("height",this.height+"px"),s.setAttribute("viewBox","0 0 "+this.width+" "+this.height),s.style.flexShrink="0",document.body.appendChild(s);for(var g="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;g+="h4v"+-J+"h1v"+J}g+="v1H0Z",this.scaleShape=yt.createPath(g);var z=yt.createTransform();this.scaleShape.transform.baseVal.appendItem(z),s.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="°",this.angleLabelElement.appendChild(ye),s.appendChild(this.angleLabelElement),document.body.removeChild(s),s},K}(),gi=function(){function K(){this.naturalSize=!1,this.imageType="image/png"}return K.prototype.rasterize=function(s,g,G,J,z,ye,He){var Oe=this;return new Promise(function(mt){var ze=document.createElement("canvas");ze.width=s.width.baseVal.value-2*J,ze.height=s.height.baseVal.value-2*J;var wt=1,Nt=1;Oe.naturalSize===!0?(wt=g.naturalWidth/(s.width.baseVal.value-2*J)/ye,Nt=g.naturalHeight/(s.height.baseVal.value-2*J)/He,ze.width=g.naturalWidth/ye,ze.height=g.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 Ht=ze.getContext("2d");Ht.translate(ze.width/2,ze.height/2),Ht.rotate(z*Math.PI/180),Ht.scale(ye,He),Ht.translate(-ze.width/2,-ze.height/2),Ht.drawImage(g,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(Ht.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(s){this._zoomToCropEnabled=!0,this.zoomFactor=1,this.flippedHorizontally=!1,this.flippedVertically=!1,this._isGridVisible=!0,this._gridLines=2,this._rotationAngle=0,this.scaleFactor=1,this.renderEventListeners=[],this.closeEventListeners=[],this._isOpen=!1,this.CANVAS_MARGIN=20,this.renderAtNaturalSize=!1,this.renderImageType="image/png",this.displayMode="inline",this.popupMargin=30,this.toolbarHeight=40,this.aspectRatios=[{horizontal:0,vertical:0},{horizontal:4,vertical:3},{horizontal:3,vertical:2},{horizontal:16,vertical:9},{horizontal:1,vertical:1},{horizontal:3,vertical:4},{horizontal:2,vertical:3},{horizontal:9,vertical:16}],this._instanceNo=K.instanceCounter++,this.styles=new Xt(this.instanceNo),this.target=s,this.targetRoot=document.body,this.open=this.open.bind(this),this.setTopLeft=this.setTopLeft.bind(this),this.overrideOverflow=this.overrideOverflow.bind(this),this.restoreOverflow=this.restoreOverflow.bind(this),this.close=this.close.bind(this),this.closeUI=this.closeUI.bind(this),this.addCloseEventListener=this.addCloseEventListener.bind(this),this.removeCloseEventListener=this.removeCloseEventListener.bind(this),this.addRenderEventListener=this.addRenderEventListener.bind(this),this.removeRenderEventListener=this.removeRenderEventListener.bind(this),this.clientToLocalCoordinates=this.clientToLocalCoordinates.bind(this),this.onWindowResize=this.onWindowResize.bind(this),this.setWindowHeight=this.setWindowHeight.bind(this),this.rotateBy=this.rotateBy.bind(this),this.applyRotation=this.applyRotation.bind(this),this.cropRectChanged=this.cropRectChanged.bind(this),this.zoomToCrop=this.zoomToCrop.bind(this),this.unzoomFromCrop=this.unzoomFromCrop.bind(this),this.rotateLeftButtonClicked=this.rotateLeftButtonClicked.bind(this),this.rotateRightButtonClicked=this.rotateRightButtonClicked.bind(this),this.flipHorizontallyButtonClicked=this.flipHorizontallyButtonClicked.bind(this),this.flipVerticallyButtonClicked=this.flipVerticallyButtonClicked.bind(this),this.applyFlip=this.applyFlip.bind(this),this.startRenderAndClose=this.startRenderAndClose.bind(this),this.render=this.render.bind(this),this.onPopupResize=this.onPopupResize.bind(this),this.applyAspectRatio=this.applyAspectRatio.bind(this)}return Object.defineProperty(K.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(s){this._zoomToCropEnabled=s,s?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(s){this._isGridVisible=s,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"gridLines",{get:function(){return this._gridLines},set:function(s){this._gridLines=s,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(s){this._rotationAngle=s,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(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 s;return(s=this._aspectRatio)!==null&&s!==void 0?s:this.aspectRatios[0]},set:function(s){this._aspectRatio=s},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(s){s===void 0&&(s=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),s||this.closeEventListeners.forEach(function(g){return g()}),this._isOpen=!1)},K.prototype.addRenderEventListener=function(s){this.renderEventListeners.push(s)},K.prototype.removeRenderEventListener=function(s){this.renderEventListeners.indexOf(s)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(s),1)},K.prototype.addCloseEventListener=function(s){this.closeEventListeners.push(s)},K.prototype.removeCloseEventListener=function(s){this.closeEventListeners.indexOf(s)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(s),1)},K.prototype.setupResizeObserver=function(){var s=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){s.resize(s.target.clientWidth,s.target.clientHeight)}),this.targetObserver.observe(this.target)):this.displayMode==="popup"&&(window.ResizeObserver&&(this.targetObserver=new ResizeObserver(this.onPopupResize),this.targetObserver.observe(this.contentDiv)),window.addEventListener("resize",this.setWindowHeight))},K.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var s=1*this.target.clientWidth/this.target.clientHeight,g=this.contentDiv.clientWidth/s>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*s:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,G=g+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/s;this.resize(g,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(s,g){this.imageWidth=Math.round(s),this.imageHeight=Math.round(g),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 s=document.createElement("canvas");s.width=this.target.naturalWidth,s.height=this.target.naturalHeight,s.getContext("2d").drawImage(this.target,0,0,this.target.naturalWidth,this.target.naturalHeight);var g=s.toDataURL();yt.setAttributes(this.editingTarget,[["href",g]]),this.setEditingTargetSize()},K.prototype.setTopLeft=function(){var s=this.target.getBoundingClientRect(),g=this.editorCanvas.getBoundingClientRect();this.left=s.left-g.left-this.CANVAS_MARGIN,this.top=s.top-g.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 s=yt.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(s);var g=yt.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(g),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 s=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,g=this.cropRect.y-this.CANVAS_MARGIN+this.cropRect.height/2;this.zoomFactor=Math.min(this.imageWidth/this.cropRect.width,this.imageHeight/this.cropRect.height),this.editingTargetContainer&&this.cropLayer&&(this.editingTargetContainer.style.transformOrigin=s+"px "+g+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-s+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-g+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(s){this.cropRect=s,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 s=this.styles.settings.hideTopToolbar?0:this.toolbarHeight,g=this.target.offsetTop>s+this.CANVAS_MARGIN?this.target.offsetTop-(s+this.CANVAS_MARGIN):0;this.coverDiv.style.top=g+"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 s=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 g=new Vr;g.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(g);var G=[];this.aspectRatios.forEach(function(Nt){var Ht=new Bt(li.getIcon(Nt.horizontal,Nt.vertical),Nt.horizontal===0&&Nt.vertical===0?"FREE":Nt.horizontal+":"+Nt.vertical);Ht.onClick=function(){return s.ratioButtonClicked(Nt)},G.push(Ht)}),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,g.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(){s.isGridVisible=!s.isGridVisible,J.isActive=s.isGridVisible},g.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(){s.zoomToCropEnabled=!s.zoomToCropEnabled,z.isActive=s.zoomToCropEnabled},g.addButton(z),!Qt.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 s=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 g=new Vr;g.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(g);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,g.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,g.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){s.rotateBy(mt),s.straightener.angle=s.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(s){this.aspectRatio=s,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(s){if(s){var g=this.cropLayer.getRescaledRect(s.width,s.height,this.imageWidth,this.imageHeight,s.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(g),this.cropRectChanged(g),this.flippedHorizontally=s.flippedHorizontally,this.flippedVertically=s.flippedVertically,this.applyFlip(),this.rotationAngle=s.rotationAngle,this.applyRotation()}},K.prototype.clientToLocalCoordinates=function(s,g){var G=this.cropImage.getBoundingClientRect();return{x:s-G.left,y:g-G.top}},K.prototype.onWindowResize=function(){this.positionUI()},K.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var s=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=s+"px",this.coverDiv.style.left=this.target.offsetLeft.toString()+"px";break;case"popup":this.coverDiv.style.top="0px",this.coverDiv.style.left="0px",this.coverDiv.style.width="100vw",this.coverDiv.style.height=this.windowHeight+"px",this.contentDiv.style.maxHeight="calc(100vh - "+(2*this.popupMargin+2*this.toolbarHeight)+"px)"}this.positionCropImage()},K.prototype.rotateLeftButtonClicked=function(){var s=this.rotationAngle-90;this.rotationAngle%90!=0&&(s+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(s)},K.prototype.rotateRightButtonClicked=function(){var s=this.rotationAngle+90;this.rotationAngle%90!=0&&(s-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(s)},K.prototype.rotateTo=function(s){s=(s=s>180?s-360:s)<=-180?s+360:s,this.rotationAngle=s,this.applyRotation()},K.prototype.rotateBy=function(s){this.rotateTo((this.rotationAngle+s)%360)},K.prototype.applyRotation=function(){var s=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var g=this.editingTargetRotationContainer.transform.baseVal.getItem(0);g.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(g,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=s},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 s,g;return or(this,function(G){switch(G.label){case 0:return[4,this.render()];case 1:return s=G.sent(),g=this.getState(),this.renderEventListeners.forEach(function(J){return J(s,g)}),this.close(!0),[2]}})})},K.prototype.render=function(){return Ze(this,void 0,void 0,function(){var s;return or(this,function(g){switch(g.label){case 0:return(s=new gi).naturalSize=this.renderAtNaturalSize,s.imageType=this.renderImageType,s.imageQuality=this.renderImageQuality,s.width=this.renderWidth,s.height=this.renderHeight,this.unzoomFromCrop(),yt.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,s.rasterize(this.cropImage,this.target,{x:this.cropRect.x,y:this.cropRect.y,width:this.cropRect.width,height:this.cropRect.height},this.CANVAS_MARGIN,this.rotationAngle,this.scaleFactor*(this.flippedHorizontally?-1:1),this.scaleFactor*(this.flippedVertically?-1:1))];case 1:return g.sent(),[4,s.rasterize(this.cropImage,this.target,{x:this.cropRect.x,y:this.cropRect.y,width:this.cropRect.width,height:this.cropRect.height},this.CANVAS_MARGIN,this.rotationAngle,this.scaleFactor*(this.flippedHorizontally?-1:1),this.scaleFactor*(this.flippedVertically?-1:1))];case 2:return[2,g.sent()]}})})},K.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new ir("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 ir("toolbar_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarBlockStyleClass=this.styles.addClass(new ir("toolbar-block",`
|
|
display: flex;
|
|
align-items: center;
|
|
box-sizing: content-box;
|
|
`));var s=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new ir("toolbar_button",`
|
|
display: inline-block;
|
|
width: `+(this.toolbarHeight-2*s)+`px;
|
|
height: `+(this.toolbarHeight-2*s)+`px;
|
|
padding: `+s+`px;
|
|
cursor: default;
|
|
user-select: none;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new ir("toolbar_button_colors",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new ir("toolbar_active_button",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
|
|
`)),this.styles.addRule(new hr("."+this.toolbarButtonStyleClass.name+" svg",`
|
|
height: `+this.toolbarHeight/2+`px;
|
|
`)),this.styles.addRule(new hr("."+this.toolbarButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
|
|
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new ir("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 ir("toolbar_dropdown_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new ir("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 ir("toolbar_straightener",`
|
|
display: flex;
|
|
overflow: hidden;
|
|
justify-content: center;
|
|
height: `+(this.toolbarHeight-2*s)+`px;
|
|
padding: `+s+`px;
|
|
cursor: default;
|
|
user-select: none;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new ir("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 s=document.createElement("div");return s.innerHTML=K,s.childNodes.length===0?"":s.childNodes[0].nodeValue}var Ri=at.a=function(K){var s=K.value,g=s===void 0?"":s,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,Ht=K.stylesPrev,Wr=Ht===void 0?{}:Ht,Hr=String(g),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(sr){for(;;)switch(sr.prev=sr.next){case 0:return dr.current.style.display="none",sr.next=3,Object(De.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:yr}});case 3:Yt=sr.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 sr.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(sr){for(;;)switch(sr.prev=sr.next){case 0:if(dr.current.style.display="none",!Yr.current){sr.next=6;break}return sr.next=4,Object(De.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:yr.dataUrl}});case 4:Yt=sr.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 sr.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=T();if(Hr.match(/\[TOC\]/)&&(jt=jt.replace("<p>[TOC]</p>",D()),L()),jt=jt.replace(/(__special_katext_id_\d+__)/g,function(yi,sr){var lr=yr[sr],ni=lr.type,bi=lr.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)();f.WebkitLineClamp=He,He&&(Nt=Object(U.a)(Object(U.a)({},Nt),f));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(),L()}},[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 c.a.createElement("div",{style:{position:"relative"}},c.a.createElement("div",{ref:Nr,style:Object(U.a)({},Nt),className:"".concat(z||""," markdown-body ").concat(ti.a.mdBody),onMouseOver:Mi,dangerouslySetInnerHTML:{__html:Ir}}),c.a.createElement("div",{ref:dr,className:ti.a.button},c.a.createElement($.a,null,c.a.createElement(Q.a,{onClick:function(){return fn()}},"\u88C1\u526A"),c.a.createElement(Q.a,{onClick:function(){return Vi()}},"\u7F16\u8F91"))),c.a.createElement("img",{ref:Yr,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1,top:"-10000px"}}),c.a.createElement(ce.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 F=setInterval(j,U);return function(){return clearInterval(F)}}},[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 F=document.querySelector("head");return F||document.body}function Q(j){var F,_=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Object(ne.a)())return null;var A=document.createElement("style");if((F=_.csp)===null||F===void 0?void 0:F.nonce){var c;A.nonce=(c=_.csp)===null||c===void 0?void 0:c.nonce}A.innerHTML=j;var x=R(_),M=x.firstChild;return _.prepend&&x.prepend?x.prepend(A):_.prepend&&M?x.insertBefore(A,M):x.appendChild(A),A}var U=new Map;function O(j,F){var _=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},A=R(_);if(!U.has(A)){var c=Q("",_),x=c.parentNode;U.set(A,x),x.removeChild(c)}var M=Array.from(U.get(A).children).find(function(a){return a.tagName==="STYLE"&&a[$]===F});if(M){var w,E;if(((w=_.csp)===null||w===void 0?void 0:w.nonce)&&M.nonce!==((E=_.csp)===null||E===void 0?void 0:E.nonce)){var b;M.nonce=(b=_.csp)===null||b===void 0?void 0:b.nonce}return M.innerHTML!==j&&(M.innerHTML=j),M}var u=Q(j,_);return u[$]=F,u}},Bd2K:function(dt,at,se){(function(ne){ne(se("VrN/"),se("osHv"))})(function(ne){ne.defineOption("autoCloseTags",!1,function(_,A,c){if(c!=ne.Init&&c&&_.removeKeyMap("autoCloseTags"),!A)return;var x={name:"autoCloseTags"};(typeof A!="object"||A.whenClosing!==!1)&&(x["'/'"]=function(M){return O(M)}),(typeof A!="object"||A.whenOpening!==!1)&&(x["'>'"]=function(M){return Q(M)}),_.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(),c=[],x=_.getOption("autoCloseTags"),M=0;M<A.length;M++){if(!A[M].empty())return ne.Pass;var w=A[M].head,E=_.getTokenAt(w),b=ne.innerMode(_.getMode(),E.state),u=b.state,a=b.mode.xmlCurrentTag&&b.mode.xmlCurrentTag(u),l=a&&a.name;if(!l)return ne.Pass;var h=b.mode.configuration=="html",L=typeof x=="object"&&x.dontCloseTags||h&&$,f=typeof x=="object"&&x.indentTags||h&&R;E.end>w.ch&&(l=l.slice(0,l.length-E.end+w.ch));var p=l.toLowerCase();if(!l||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||L&&j(L,p)>-1||F(_,b.mode.xmlCurrentContext&&b.mode.xmlCurrentContext(u)||[],l,w,!0))return ne.Pass;var D=typeof x=="object"&&x.emptyTags;if(D&&j(D,l)>-1){c[M]={text:"/>",newPos:ne.Pos(w.line,w.ch+2)};continue}var C=f&&j(f,p)>-1;c[M]={indent:C,text:">"+(C?`
|
|
|
|
`:"")+"</"+l+">",newPos:C?ne.Pos(w.line+1,0):ne.Pos(w.line,w.ch+1)}}for(var m=typeof x=="object"&&x.dontIndentOnAutoClose,M=A.length-1;M>=0;M--){var v=c[M];_.replaceRange(v.text,A[M].head,A[M].anchor,"+insert");var d=_.listSelections().slice(0);d[M]={head:v.newPos,anchor:v.newPos},_.setSelections(d),!m&&v.indent&&(_.indentLine(v.newPos.line,null,!0),_.indentLine(v.newPos.line+1,null,!0))}}function U(_,A){for(var c=_.listSelections(),x=[],M=A?"/":"</",w=_.getOption("autoCloseTags"),E=typeof w=="object"&&w.dontIndentOnSlash,b=0;b<c.length;b++){if(!c[b].empty())return ne.Pass;var u=c[b].head,a=_.getTokenAt(u),l=ne.innerMode(_.getMode(),a.state),h=l.state;if(A&&(a.type=="string"||a.string.charAt(0)!="<"||a.start!=u.ch-1))return ne.Pass;var L,f=l.mode.name!="xml"&&_.getMode().name=="htmlmixed";if(f&&l.mode.name=="javascript")L=M+"script";else if(f&&l.mode.name=="css")L=M+"style";else{var p=l.mode.xmlCurrentContext&&l.mode.xmlCurrentContext(h);if(!p||p.length&&F(_,p,p[p.length-1],u))return ne.Pass;L=M+p[p.length-1]}_.getLine(u.line).charAt(a.end)!=">"&&(L+=">"),x[b]=L}if(_.replaceSelections(x),c=_.listSelections(),!E)for(var b=0;b<c.length;b++)(b==c.length-1||c[b].head.line<c[b+1].head.line)&&_.indentLine(c[b].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 c=0,x=_.length;c<x;++c)if(_[c]==A)return c;return-1}function F(_,A,c,x,M){if(!ne.scanForClosingTag)return!1;var w=Math.min(_.lastLine()+1,x.line+500),E=ne.scanForClosingTag(_,x,null,w);if(!E||E.tag!=c)return!1;for(var b=M?1:0,u=A.length-1;u>=0&&A[u]==c;u--)++b;x=E.to;for(var u=1;u<b;u++){var a=ne.scanForClosingTag(_,x,null,w);if(!a||a.tag!=c)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 $(F){var _=!0;if(F.length>0){for(var A=0;A<F.length;A++)if(F[A].compile_success==0||!F[A].compile_success){_=!1;break}}else _=!1;return _}function R(F){for(var _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",A=[],c=0;c<F.length;c++){var x=F[c],M=_?"".concat(_,"/").concat(x.name):"".concat(x.name);A.push({title:x.name,isLeaf:!(x.type==="tree"),key:M})}return A}function Q(F,_,A){for(var c=0;c<F.length;c++){var x=F[c];if(x.key===_){x.children=A;break}x.children&&Q(x.children,_,A)}return F}function U(F,_,A){var c;return function(){var x=this,M=arguments,w=function(){c=null,A||F.apply(x,M)},E=A&&!c;clearTimeout(c),c=setTimeout(w,_),E&&F.apply(x,M)}}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(B){return typeof B}:ne=function(B){return B&&typeof Symbol=="function"&&B.constructor===Symbol&&B!==Symbol.prototype?"symbol":typeof B},ne(y)}function $(){return $=Object.assign||function(y){for(var P=1;P<arguments.length;P++){var B=arguments[P];for(var W in B)Object.prototype.hasOwnProperty.call(B,W)&&(y[W]=B[W])}return y},$.apply(this,arguments)}function R(y,P){var B=Object.keys(y);if(Object.getOwnPropertySymbols){var W=Object.getOwnPropertySymbols(y);P&&(W=W.filter(function(V){return Object.getOwnPropertyDescriptor(y,V).enumerable})),B.push.apply(B,W)}return B}function Q(y){for(var P=1;P<arguments.length;P++){var B=arguments[P]!=null?arguments[P]:{};P%2?R(B,!0).forEach(function(W){E(y,W,B[W])}):Object.getOwnPropertyDescriptors?Object.defineProperties(y,Object.getOwnPropertyDescriptors(B)):R(B).forEach(function(W){Object.defineProperty(y,W,Object.getOwnPropertyDescriptor(B,W))})}return y}function U(y,P){if(y==null)return{};var B=O(y,P),W,V;if(Object.getOwnPropertySymbols){var I=Object.getOwnPropertySymbols(y);for(V=0;V<I.length;V++){if(W=I[V],P.indexOf(W)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(y,W))continue;B[W]=y[W]}}return B}function O(y,P){if(y==null)return{};var B={},W=Object.keys(y),V,I;for(I=0;I<W.length;I++){if(V=W[I],P.indexOf(V)>=0)continue;B[V]=y[V]}return B}function j(y,P){if(!(y instanceof P))throw new TypeError("Cannot call a class as a function")}function F(y,P){for(var B=0;B<P.length;B++){var W=P[B];W.enumerable=W.enumerable||!1,W.configurable=!0,"value"in W&&(W.writable=!0),Object.defineProperty(y,W.key,W)}}function _(y,P,B){return P&&F(y.prototype,P),B&&F(y,B),y}function A(y,P){return P&&(ne(P)==="object"||typeof P=="function")?P:x(y)}function c(y){return c=Object.setPrototypeOf?Object.getPrototypeOf:function(B){return B.__proto__||Object.getPrototypeOf(B)},c(y)}function x(y){if(y===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return y}function M(y,P){if(typeof P!="function"&&P!==null)throw new TypeError("Super expression must either be null or a function");y.prototype=Object.create(P&&P.prototype,{constructor:{value:y,writable:!0,configurable:!0}}),P&&w(y,P)}function w(y,P){return w=Object.setPrototypeOf||function(W,V){return W.__proto__=V,W},w(y,P)}function E(y,P,B){return P in y?Object.defineProperty(y,P,{value:B,enumerable:!0,configurable:!0,writable:!0}):y[P]=B,y}var b=se("q1tI"),u=se("17x9"),a=se("H38U"),l=se("aRTE");function h(y){for(var P="",B=0;B<y.length;B++){var W=y.charCodeAt(B);W<128?P+=String.fromCharCode(W):W<2048?(P+=String.fromCharCode(192|W>>6),P+=String.fromCharCode(128|W&63)):W<55296||W>=57344?(P+=String.fromCharCode(224|W>>12),P+=String.fromCharCode(128|W>>6&63),P+=String.fromCharCode(128|W&63)):(B++,W=65536+((W&1023)<<10|y.charCodeAt(B)&1023),P+=String.fromCharCode(240|W>>18),P+=String.fromCharCode(128|W>>12&63),P+=String.fromCharCode(128|W>>6&63),P+=String.fromCharCode(128|W&63))}return P}var L={size:128,level:"L",bgColor:"#FFFFFF",fgColor:"#000000",includeMargin:!1},f={},p=4,D=.1;function C(y){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,B=[];return y.forEach(function(W,V){var I=null;W.forEach(function(N,X){if(!N&&I!==null){B.push("M".concat(I+P," ").concat(V+P,"h").concat(X-I,"v1H").concat(I+P,"z")),I=null;return}if(X===W.length-1){if(!N)return;I===null?B.push("M".concat(X+P,",").concat(V+P," h1v1H").concat(X+P,"z")):B.push("M".concat(I+P,",").concat(V+P," h").concat(X+1-I,"v1H").concat(I+P,"z"));return}N&&I===null&&(I=X)})}),B.join("")}function m(y,P){return y.slice().map(function(B,W){return W<P.y||W>=P.y+P.h?B:B.map(function(V,I){return I<P.x||I>=P.x+P.w?V:!1})})}function v(y,P){var B=y.imageSettings,W=y.size,V=y.includeMargin;if(B==null)return null;var I=V?p:0,N=P.length+I*2,X=Math.floor(W*D),ee=N/W,oe=(B.width||X)*ee,ce=(B.height||X)*ee,De=B.x==null?P.length/2-oe/2:B.x*ee,Ee=B.y==null?P.length/2-ce/2:B.y*ee,Ce=null;if(B.excavate){var Te=Math.floor(De),me=Math.floor(Ee),pe=Math.ceil(oe+De-Te),ue=Math.ceil(ce+Ee-me);Ce={x:Te,y:me,w:pe,h:ue}}return{x:De,y:Ee,h:ce,w:oe,excavation:Ce}}var d=function(){try{new Path2D().addPath(new Path2D)}catch(y){return!1}return!0}(),o=function(y){M(P,y);function P(){var B,W;j(this,P);for(var V=arguments.length,I=new Array(V),N=0;N<V;N++)I[N]=arguments[N];return W=A(this,(B=c(P)).call.apply(B,[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 _(P,[{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,N=W.level,X=W.bgColor,ee=W.fgColor,oe=W.includeMargin,ce=W.imageSettings,De=new a(-1,l[N]);if(De.addData(h(V)),De.make(),this._canvas!=null){var Ee=this._canvas,Ce=Ee.getContext("2d");if(!Ce)return;var Te=De.modules;if(Te===null)return;var me=oe?p:0,pe=Te.length+me*2,ue=v(this.props,Te);ce!=null&&ue!=null&&(ue.excavation!=null&&(Te=m(Te,ue.excavation)));var te=window.devicePixelRatio||1;Ee.height=Ee.width=I*te;var he=I/pe*te;Ce.scale(he,he),Ce.fillStyle=X,Ce.fillRect(0,0,pe,pe),Ce.fillStyle=ee,d?Ce.fill(new Path2D(C(Te,me))):Te.forEach(function(ae,we){ae.forEach(function(Le,xe){Le&&Ce.fillRect(xe+me,we+me,1,1)})}),this.state.imgLoaded&&this._image&&ue!=null&&Ce.drawImage(this._image,ue.x+me,ue.y+me,ue.w,ue.h)}}},{key:"render",value:function(){var W=this,V=this.props,I=V.value,N=V.size,X=V.level,ee=V.bgColor,oe=V.fgColor,ce=V.style,De=V.includeMargin,Ee=V.imageSettings,Ce=U(V,["value","size","level","bgColor","fgColor","style","includeMargin","imageSettings"]),Te=Q({height:N,width:N},ce),me=null,pe=Ee&&Ee.src;return Ee!=null&&pe!=null&&(me=b.createElement("img",{src:pe,style:{display:"none"},onLoad:this.handleImageLoad,ref:function(te){return W._image=te}})),b.createElement(b.Fragment,null,b.createElement("canvas",$({style:Te,height:N,width:N,ref:function(te){return W._canvas=te}},Ce)),me)}}]),P}(b.PureComponent);E(o,"defaultProps",L);var T=function(y){M(P,y);function P(){return j(this,P),A(this,c(P).apply(this,arguments))}return _(P,[{key:"render",value:function(){var W=this.props,V=W.value,I=W.size,N=W.level,X=W.bgColor,ee=W.fgColor,oe=W.includeMargin,ce=W.imageSettings,De=U(W,["value","size","level","bgColor","fgColor","includeMargin","imageSettings"]),Ee=new a(-1,l[N]);Ee.addData(h(V)),Ee.make();var Ce=Ee.modules;if(Ce===null)return null;var Te=oe?p:0,me=Ce.length+Te*2,pe=v(this.props,Ce),ue=null;ce!=null&&pe!=null&&(pe.excavation!=null&&(Ce=m(Ce,pe.excavation)),ue=b.createElement("image",{xlinkHref:ce.src,height:pe.h,width:pe.w,x:pe.x+Te,y:pe.y+Te,preserveAspectRatio:"none"}));var te=C(Ce,Te);return b.createElement("svg",$({shapeRendering:"crispEdges",height:I,width:I,viewBox:"0 0 ".concat(me," ").concat(me)},De),b.createElement("path",{fill:X,d:"M0,0 h".concat(me,"v").concat(me,"H0z")}),b.createElement("path",{fill:ee,d:te}),ue)}}]),P}(b.PureComponent);E(T,"defaultProps",L);var S=function(P){var B=P.renderAs,W=U(P,["renderAs"]),V=B==="svg"?T:o;return b.createElement(V,W)};S.defaultProps=Q({renderAs:"canvas"},L),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}}),F=j.defaults,_=j.getDefaults,A=j.changeDefaults,c=/[&<>"']/,x=/[&<>"']/g,M=/[<>"']|&(?!#?\w+;)/,w=/[<>"']|&(?!#?\w+;)/g,E={"&":"&","<":"<",">":">",'"':""","'":"'"},b=function(ve){return E[ve]};function u(Se,ve){if(ve){if(c.test(Se))return Se.replace(x,b)}else if(M.test(Se))return Se.replace(w,b);return Se}var a=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function l(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 L(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 f=/[^\w:]/g,p=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function D(Se,ve,be){if(Se){var re;try{re=decodeURIComponent(l(be)).replace(f,"").toLowerCase()}catch(ie){return null}if(re.indexOf("javascript:")===0||re.indexOf("vbscript:")===0||re.indexOf("data:")===0)return null}ve&&!p.test(be)&&(be=o(ve,be));try{be=encodeURI(be).replace(/%25/g,"%")}catch(ie){return null}return be}var C={},m=/^[^:]+:\/*[^/]*$/,v=/^([^:]+:)[\s\S]*$/,d=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(Se,ve){C[" "+Se]||(m.test(Se)?C[" "+Se]=Se+"/":C[" "+Se]=P(Se,"/",!0)),Se=C[" "+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 T={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,de,ke){for(var Pe=!1,Xe=de;--Xe>=0&&ke[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 P(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 B(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:l,edit:L,cleanUrl:D,resolveUrl:o,noopTest:T,merge:S,splitCells:y,rtrim:P,findClosingBracket:B,checkSanitizeDeprecation:W},I=j.defaults,N=V.rtrim,X=V.splitCells,ee=V.escape,oe=V.findClosingBracket;function ce(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 De(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 de=le[0];return de.length>=re.length?ie.slice(re.length):ie}).join(`
|
|
`)}var Ee=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 de=ie[ie.length-1];if(de&&de.type==="paragraph")return{raw:le[0],text:le[0].trimRight()};var ke=le[0].replace(/^ {4}/gm,"");return{type:"code",raw:le[0],codeBlockStyle:"indented",text:this.options.pedantic?ke:N(ke,`
|
|
`)}}},ve.fences=function(re){var ie=this.rules.block.fences.exec(re);if(ie){var le=ie[0],de=De(le,ie[3]||"");return{type:"code",raw:le,lang:ie[2]?ie[2].trim():ie[2],text:de}}},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 de=le.align.length,ke;for(ke=0;ke<de;ke++)/^ *-+: *$/.test(le.align[ke])?le.align[ke]="right":/^ *:-+: *$/.test(le.align[ke])?le.align[ke]="center":/^ *:-+ *$/.test(le.align[ke])?le.align[ke]="left":le.align[ke]=null;for(de=le.cells.length,ke=0;ke<de;ke++)le.cells[ke]=X(le.cells[ke],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],de=ie[2],ke=de.length>1,Pe=de[de.length-1]===")",Xe={type:"list",raw:le,ordered:ke,start:ke?+de.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],(ke?ft.length===1||!Pe&&ft[ft.length-1]===")":ft.length>1||this.options.smartLists&&ft!==de)&&(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 de=le.align.length,ke;for(ke=0;ke<de;ke++)/^ *-+: *$/.test(le.align[ke])?le.align[ke]="right":/^ *:-+: *$/.test(le.align[ke])?le.align[ke]="center":/^ *:-+ *$/.test(le.align[ke])?le.align[ke]="left":le.align[ke]=null;for(de=le.cells.length,ke=0;ke<de;ke++)le.cells[ke]=X(le.cells[ke].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 de=ie[ie.length-1];return de&&de.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 de=this.rules.inline.tag.exec(re);if(de)return!ie&&/^<a /i.test(de[0])?ie=!0:ie&&/^<\/a>/i.test(de[0])&&(ie=!1),!le&&/^<(pre|code|kbd|script)(\s|>)/i.test(de[0])?le=!0:le&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(de[0])&&(le=!1),{type:this.options.sanitize?"text":"html",raw:de[0],inLink:ie,inRawBlock:le,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(de[0]):ee(de[0]):de[0]}},ve.link=function(re){var ie=this.rules.inline.link.exec(re);if(ie){var le=oe(ie[2],"()");if(le>-1){var de=ie[0].indexOf("!")===0?5:4,ke=de+ie[1].length+le;ie[2]=ie[2].substring(0,le),ie[0]=ie[0].substring(0,ke).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=ce(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 de=(le[2]||le[1]).replace(/\s+/g," ");if(de=ie[de.toLowerCase()],!de||!de.href){var ke=le[0].charAt(0);return{type:"text",raw:ke,text:ke}}var Pe=ce(le,de,le[0]);return Pe}},ve.strong=function(re,ie,le){le===void 0&&(le="");var de=this.rules.inline.strong.start.exec(re);if(de&&(!de[1]||de[1]&&(le===""||this.rules.inline.punctuation.exec(le)))){ie=ie.slice(-1*re.length);var ke=de[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;ke.lastIndex=0;for(var Pe;(de=ke.exec(ie))!=null;)if(Pe=this.rules.inline.strong.middle.exec(ie.slice(0,de.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 de=this.rules.inline.em.start.exec(re);if(de&&(!de[1]||de[1]&&(le===""||this.rules.inline.punctuation.exec(le)))){ie=ie.slice(-1*re.length);var ke=de[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;ke.lastIndex=0;for(var Pe;(de=ke.exec(ie))!=null;)if(Pe=this.rules.inline.em.middle.exec(ie.slice(0,de.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," "),de=/[^ ]/.test(le),ke=le.startsWith(" ")&&le.endsWith(" ");return de&&ke&&(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 de,ke;return le[2]==="@"?(de=ee(this.options.mangle?ie(le[1]):le[1]),ke="mailto:"+de):(de=ee(le[1]),ke=de),{type:"link",raw:le[0],text:de,href:ke,tokens:[{type:"text",raw:de,text:de}]}}},ve.url=function(re,ie){var le;if(le=this.rules.inline.url.exec(re)){var de,ke;if(le[2]==="@")de=ee(this.options.mangle?ie(le[0]):le[0]),ke="mailto:"+de;else{var Pe;do Pe=le[0],le[0]=this.rules.inline._backpedal.exec(le[0])[0];while(Pe!==le[0]);de=ee(le[0]),le[1]==="www."?ke="http://"+de:ke=de}return{type:"link",raw:le[0],text:de,href:ke,tokens:[{type:"text",raw:de,text:de}]}}},ve.inlineText=function(re,ie,le){var de=this.rules.inline.text.exec(re);if(de){var ke;return ie?ke=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(de[0]):ee(de[0]):de[0]:ke=ee(this.options.smartypants?le(de[0]):de[0]),{type:"text",raw:de[0],text:ke}}},Se}(),Ce=V.noopTest,Te=V.edit,me=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:Ce,table:Ce,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=Te(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=Te(pe.item,"gm").replace(/bull/g,pe.bullet).getRegex(),pe.list=Te(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=Te(pe.html,"i").replace("comment",pe._comment).replace("tag",pe._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),pe.paragraph=Te(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=Te(pe.blockquote).replace("paragraph",pe.paragraph).getRegex(),pe.normal=me({},pe),pe.gfm=me({},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=Te(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=Te(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=me({},pe.normal,{html:Te(`^ *(?: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:Ce,paragraph:Te(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:Ce,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:Ce,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};ue._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",ue.punctuation=Te(ue.punctuation).replace(/punctuation/g,ue._punctuation).getRegex(),ue._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",ue._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",ue.em.start=Te(ue.em.start).replace(/punctuation/g,ue._punctuation).getRegex(),ue.em.middle=Te(ue.em.middle).replace(/punctuation/g,ue._punctuation).replace(/overlapSkip/g,ue._overlapSkip).getRegex(),ue.em.endAst=Te(ue.em.endAst,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.em.endUnd=Te(ue.em.endUnd,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.strong.start=Te(ue.strong.start).replace(/punctuation/g,ue._punctuation).getRegex(),ue.strong.middle=Te(ue.strong.middle).replace(/punctuation/g,ue._punctuation).replace(/blockSkip/g,ue._blockSkip).getRegex(),ue.strong.endAst=Te(ue.strong.endAst,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.strong.endUnd=Te(ue.strong.endUnd,"g").replace(/punctuation/g,ue._punctuation).getRegex(),ue.blockSkip=Te(ue._blockSkip,"g").getRegex(),ue.overlapSkip=Te(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=Te(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=Te(ue.tag).replace("comment",pe._comment).replace("attribute",ue._attribute).getRegex(),ue._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,ue._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,ue._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,ue.link=Te(ue.link).replace("label",ue._label).replace("href",ue._href).replace("title",ue._title).getRegex(),ue.reflink=Te(ue.reflink).replace("label",ue._label).getRegex(),ue.reflinkSearch=Te(ue.reflinkSearch,"g").replace("reflink",ue.reflink).replace("nolink",ue.nolink).getRegex(),ue.normal=me({},ue),ue.pedantic=me({},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:Te(/^!?\[(label)\]\((.*?)\)/).replace("label",ue._label).getRegex(),reflink:Te(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ue._label).getRegex()}),ue.gfm=me({},ue.normal,{escape:Te(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=Te(ue.gfm.url,"i").replace("email",ue.gfm._extended_email).getRegex(),ue.breaks=me({},ue.gfm,{br:Te(ue.br).replace("{2,}","*").getRegex(),text:Te(ue.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var te={block:pe,inline:ue},he=j.defaults,ae=te.block,we=te.inline;function Le(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 xe(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 _e=function(){function Se(be){this.tokens=[],this.tokens.links=Object.create(null),this.options=be||he,this.options.tokenizer=this.options.tokenizer||new Ee,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 de,ke,Pe,Xe;re;){if(de=this.tokenizer.space(re)){re=re.substring(de.raw.length),de.type&&ie.push(de);continue}if(de=this.tokenizer.code(re,ie)){re=re.substring(de.raw.length),de.type?ie.push(de):(Xe=ie[ie.length-1],Xe.raw+=`
|
|
`+de.raw,Xe.text+=`
|
|
`+de.text);continue}if(de=this.tokenizer.fences(re)){re=re.substring(de.raw.length),ie.push(de);continue}if(de=this.tokenizer.heading(re)){re=re.substring(de.raw.length),ie.push(de);continue}if(de=this.tokenizer.nptable(re)){re=re.substring(de.raw.length),ie.push(de);continue}if(de=this.tokenizer.hr(re)){re=re.substring(de.raw.length),ie.push(de);continue}if(de=this.tokenizer.blockquote(re)){re=re.substring(de.raw.length),de.tokens=this.blockTokens(de.text,[],le),ie.push(de);continue}if(de=this.tokenizer.list(re)){for(re=re.substring(de.raw.length),Pe=de.items.length,ke=0;ke<Pe;ke++)de.items[ke].tokens=this.blockTokens(de.items[ke].text,[],!1);ie.push(de);continue}if(de=this.tokenizer.html(re)){re=re.substring(de.raw.length),ie.push(de);continue}if(le&&(de=this.tokenizer.def(re))){re=re.substring(de.raw.length),this.tokens.links[de.tag]||(this.tokens.links[de.tag]={href:de.href,title:de.title});continue}if(de=this.tokenizer.table(re)){re=re.substring(de.raw.length),ie.push(de);continue}if(de=this.tokenizer.lheading(re)){re=re.substring(de.raw.length),ie.push(de);continue}if(le&&(de=this.tokenizer.paragraph(re))){re=re.substring(de.raw.length),ie.push(de);continue}if(de=this.tokenizer.text(re,ie)){re=re.substring(de.raw.length),de.type?ie.push(de):(Xe=ie[ie.length-1],Xe.raw+=`
|
|
`+de.raw,Xe.text+=`
|
|
`+de.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,de,ke,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:[]},ke=Xe.header.length,le=0;le<ke;le++)Xe.tokens.header[le]=[],this.inlineTokens(Xe.header[le],Xe.tokens.header[le]);for(ke=Xe.cells.length,le=0;le<ke;le++)for(Pe=Xe.cells[le],Xe.tokens.cells[le]=[],de=0;de<Pe.length;de++)Xe.tokens.cells[le][de]=[],this.inlineTokens(Pe[de],Xe.tokens.cells[le][de]);break}case"blockquote":{this.inline(Xe.tokens);break}case"list":{for(ke=Xe.items.length,le=0;le<ke;le++)this.inline(Xe.items[le].tokens);break}}}return re},ve.inlineTokens=function(re,ie,le,de,ke){ie===void 0&&(ie=[]),le===void 0&&(le=!1),de===void 0&&(de=!1),ke===void 0&&(ke="");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,de)){re=re.substring(Pe.raw.length),le=Pe.inLink,de=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,de)),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,de)),ie.push(Pe);continue}if(Pe=this.tokenizer.strong(re,Xe,ke)){re=re.substring(Pe.raw.length),Pe.tokens=this.inlineTokens(Pe.text,[],le,de),ie.push(Pe);continue}if(Pe=this.tokenizer.em(re,Xe,ke)){re=re.substring(Pe.raw.length),Pe.tokens=this.inlineTokens(Pe.text,[],le,de),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,de),ie.push(Pe);continue}if(Pe=this.tokenizer.autolink(re,xe)){re=re.substring(Pe.raw.length),ie.push(Pe);continue}if(!le&&(Pe=this.tokenizer.url(re,xe))){re=re.substring(Pe.raw.length),ie.push(Pe);continue}if(Pe=this.tokenizer.inlineText(re,de,Le)){re=re.substring(Pe.raw.length),ke=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,Fe=V.escape,Ne=function(){function Se(be){this.options=be||Ie}var ve=Se.prototype;return ve.code=function(re,ie,le){var de=(ie||"").match(/\S*/)[0];if(this.options.highlight){var ke=this.options.highlight(re,de);ke!=null&&ke!==re&&(le=!0,re=ke)}return de?'<pre><code class="'+this.options.langPrefix+Fe(de,!0)+'">'+(le?re:Fe(re,!0))+`</code></pre>
|
|
`:"<pre><code>"+(le?re:Fe(re,!0))+`</code></pre>
|
|
`},ve.blockquote=function(re){return`<blockquote>
|
|
`+re+`</blockquote>
|
|
`},ve.html=function(re){return re},ve.heading=function(re,ie,le,de){return this.options.headerIds?"<h"+ie+' id="'+this.options.headerPrefix+de.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 de=ie?"ol":"ul",ke=ie&&le!==1?' start="'+le+'"':"";return"<"+de+ke+`>
|
|
`+re+"</"+de+`>
|
|
`},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",de=ie.align?"<"+le+' align="'+ie.align+'">':"<"+le+">";return de+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 de='<a href="'+Fe(re)+'"';return ie&&(de+=' title="'+ie+'"'),de+=">"+le+"</a>",de},ve.image=function(re,ie,le){if(re=We(this.options.sanitize,this.options.baseUrl,re),re===null)return le;var de='<img src="'+re+'" alt="'+le+'"';return ie&&(de+=' title="'+ie+'"'),de+=this.options.xhtml?"/>":">",de},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 Ne,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="",de,ke,Pe,Xe,vt,Dt,Ge,Et,ft,it,Rt,pt,At,Lt,Ze,or,Qt,yt,Xt=re.length;for(de=0;de<Xt;de++){it=re[de];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,ke=0;ke<Xe;ke++)Ge+=this.renderer.tablecell(this.parseInline(it.tokens.header[ke]),{header:!0,align:it.align[ke]});for(Et+=this.renderer.tablerow(Ge),ft="",Xe=it.cells.length,ke=0;ke<Xe;ke++){for(Dt=it.tokens.cells[ke],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="",ke=0;ke<Xe;ke++)Ze=it.items[ke],or=Ze.checked,Qt=Ze.task,Lt="",Ze.task&&(yt=this.renderer.checkbox(or),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,Qt,or);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;de+1<Xt&&re[de+1].type==="text";)it=re[++de],ft+=`
|
|
`+(it.tokens?this.parseInline(it.tokens):it.text);le+=ie?this.renderer.paragraph(ft):ft;continue}default:{var hr='Token with "'+it.type+'" type was not found.';if(this.options.silent){console.error(hr);return}else throw new Error(hr)}}}return le},ve.parseInline=function(re,ie){ie=ie||this.renderer;var le="",de,ke,Pe=re.length;for(de=0;de<Pe;de++){ke=re[de];switch(ke.type){case"escape":{le+=ie.text(ke.text);break}case"html":{le+=ie.html(ke.text);break}case"link":{le+=ie.link(ke.href,ke.title,this.parseInline(ke.tokens,ie));break}case"image":{le+=ie.image(ke.href,ke.title,ke.text);break}case"strong":{le+=ie.strong(this.parseInline(ke.tokens,ie));break}case"em":{le+=ie.em(this.parseInline(ke.tokens,ie));break}case"codespan":{le+=ie.codespan(ke.text);break}case"br":{le+=ie.br();break}case"del":{le+=ie.del(this.parseInline(ke.tokens,ie));break}case"text":{le+=ie.text(ke.text);break}default:{var Xe='Token with "'+ke.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,Me=j.getDefaults,ut=j.changeDefaults,lt=j.defaults;function Be(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({},Be.defaults,ve||{}),$e(ve),be){var re=ve.highlight,ie;try{ie=_e.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 de=0;Be.walkTokens(ie,function(Pe){Pe.type==="code"&&(de++,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),de--,de===0&&le()})},0))}),de===0&&le();return}try{var ke=_e.lex(Se,ve);return ve.walkTokens&&Be.walkTokens(ke,ve.walkTokens),qe.parse(ke,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}}Be.options=Be.setOptions=function(Se){return st(Be.defaults,Se),ut(Be.defaults),Be},Be.getDefaults=Me,Be.defaults=lt,Be.use=function(Se){var ve=st({},Se);if(Se.renderer&&function(){var re=Be.defaults.renderer||new Ne,ie=function(ke){var Pe=re[ke];re[ke]=function(){for(var Xe=arguments.length,vt=new Array(Xe),Dt=0;Dt<Xe;Dt++)vt[Dt]=arguments[Dt];var Ge=Se.renderer[ke].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=Be.defaults.tokenizer||new Ee,ie=function(ke){var Pe=re[ke];re[ke]=function(){for(var Xe=arguments.length,vt=new Array(Xe),Dt=0;Dt<Xe;Dt++)vt[Dt]=arguments[Dt];var Ge=Se.tokenizer[ke].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=Be.defaults.walkTokens;ve.walkTokens=function(re){Se.walkTokens(re),be&&be(re)}}Be.setOptions(ve)},Be.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),de;!(de=le()).done;){var ke=de.value;Be.walkTokens(ke,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;Be.walkTokens(Et,ve)}break}case"list":{Be.walkTokens(ie.items,ve);break}default:ie.tokens&&Be.walkTokens(ie.tokens,ve)}}},Be.Parser=qe,Be.parser=qe.parse,Be.Renderer=Ne,Be.TextRenderer=Ue,Be.Lexer=_e,Be.lexer=_e.lex,Be.Tokenizer=Ee,Be.Slugger=et,Be.parse=Be;var Ke=Be;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,b,u){u&&u!=ne.Init&&(E.removeKeyMap(U),E.state.closeBrackets=null),b&&(O(Q(b,"pairs")),E.state.closeBrackets=b,E.addKeyMap(U))});function Q(E,b){return b=="pairs"&&typeof E=="string"?E:typeof E=="object"&&E[b]!=null?E[b]:$[b]}var U={Backspace:_,Enter:A};function O(E){for(var b=0;b<E.length;b++){var u=E.charAt(b),a="'"+u+"'";U[a]||(U[a]=j(u))}}O($.pairs+"`");function j(E){return function(b){return x(b,E)}}function F(E){var b=E.state.closeBrackets;if(!b||b.override)return b;var u=E.getModeAt(E.getCursor());return u.closeBrackets||b}function _(E){var b=F(E);if(!b||E.getOption("disableInput"))return ne.Pass;for(var u=Q(b,"pairs"),a=E.listSelections(),l=0;l<a.length;l++){if(!a[l].empty())return ne.Pass;var h=M(E,a[l].head);if(!h||u.indexOf(h)%2!=0)return ne.Pass}for(var l=a.length-1;l>=0;l--){var L=a[l].head;E.replaceRange("",R(L.line,L.ch-1),R(L.line,L.ch+1),"+delete")}}function A(E){var b=F(E),u=b&&Q(b,"explode");if(!u||E.getOption("disableInput"))return ne.Pass;for(var a=E.listSelections(),l=0;l<a.length;l++){if(!a[l].empty())return ne.Pass;var h=M(E,a[l].head);if(!h||u.indexOf(h)%2!=0)return ne.Pass}E.operation(function(){var L=E.lineSeparator()||`
|
|
`;E.replaceSelection(L+L,null),E.execCommand("goCharLeft"),a=E.listSelections();for(var f=0;f<a.length;f++){var p=a[f].head.line;E.indentLine(p,null,!0),E.indentLine(p+1,null,!0)}})}function c(E){var b=ne.cmpPos(E.anchor,E.head)>0;return{anchor:new R(E.anchor.line,E.anchor.ch+(b?-1:1)),head:new R(E.head.line,E.head.ch+(b?1:-1))}}function x(E,b){var u=F(E);if(!u||E.getOption("disableInput"))return ne.Pass;var a=Q(u,"pairs"),l=a.indexOf(b);if(l==-1)return ne.Pass;for(var h=Q(u,"closeBefore"),L=Q(u,"triples"),f=a.charAt(l+1)==b,p=E.listSelections(),D=l%2==0,C,m=0;m<p.length;m++){var v=p[m],d=v.head,o,T=E.getRange(d,R(d.line,d.ch+1));if(D&&!v.empty())o="surround";else if((f||!D)&&T==b)f&&w(E,d)?o="both":L.indexOf(b)>=0&&E.getRange(d,R(d.line,d.ch+3))==b+b+b?o="skipThree":o="skip";else if(f&&d.ch>1&&L.indexOf(b)>=0&&E.getRange(R(d.line,d.ch-2),d)==b+b){if(d.ch>2&&/\bstring/.test(E.getTokenTypeAt(R(d.line,d.ch-2))))return ne.Pass;o="addFour"}else if(f){var S=d.ch==0?" ":E.getRange(R(d.line,d.ch-1),d);if(!ne.isWordChar(T)&&S!=b&&!ne.isWordChar(S))o="both";else return ne.Pass}else if(D&&(T.length===0||/\s/.test(T)||h.indexOf(T)>-1))o="both";else return ne.Pass;if(!C)C=o;else if(C!=o)return ne.Pass}var y=l%2?a.charAt(l-1):b,P=l%2?b:a.charAt(l+1);E.operation(function(){if(C=="skip")E.execCommand("goCharRight");else if(C=="skipThree")for(var B=0;B<3;B++)E.execCommand("goCharRight");else if(C=="surround"){for(var W=E.getSelections(),B=0;B<W.length;B++)W[B]=y+W[B]+P;E.replaceSelections(W,"around"),W=E.listSelections().slice();for(var B=0;B<W.length;B++)W[B]=c(W[B]);E.setSelections(W)}else C=="both"?(E.replaceSelection(y+P,null),E.triggerElectric(y+P),E.execCommand("goCharLeft")):C=="addFour"&&(E.replaceSelection(y+y+y+y,"before"),E.execCommand("goCharRight"))})}function M(E,b){var u=E.getRange(R(b.line,b.ch-1),R(b.line,b.ch+1));return u.length==2?u:null}function w(E,b){var u=E.getTokenAt(R(b.line,b.ch+1));return/\bstring/.test(u.type)&&u.start==b.ch&&(b.ch==0||!/\bstring/.test(E.getTokenTypeAt(b)))}})},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 N="cannot "+V.method+" "+V.action+" "+I.status+"'",X=new Error(N);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(N){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 N=new FormData;V.data&&Object.keys(V.data).forEach(function(ee){var oe=V.data[ee];if(Array.isArray(oe)){oe.forEach(function(ce){N.append(ee+"[]",ce)});return}N.append(ee,V.data[ee])}),V.file instanceof Blob?N.append(V.filename,V.file,V.file.name):N.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(N),{abort:function(){I.abort()}}}var F=+new Date,_=0;function A(){return"rc-upload-"+F+"-"+ ++_}function c(V,I){return V.indexOf(I,V.length-I.length)!==-1}var x=function(V,I){if(V&&I){var N=Array.isArray(I)?I:I.split(","),X=V.name||"",ee=V.type||"",oe=ee.replace(/\/.*$/,"");return N.some(function(ce){var De=ce.trim();return De.charAt(0)==="."?c(X.toLowerCase(),De.toLowerCase()):/\/\*$/.test(De)?oe===De.replace(/\/.*$/,""):ee===De})}return!0};function M(V,I){var N=V.createReader(),X=[];function ee(){N.readEntries(function(oe){var ce=Array.prototype.slice.apply(oe);X=X.concat(ce);var De=!ce.length;De?I(X):ee()})}ee()}var w=function(I,N,X){var ee=function oe(ce,De){De=De||"",ce.isFile?ce.file(function(Ee){X(Ee)&&(ce.fullPath&&!Ee.webkitRelativePath&&(Object.defineProperties(Ee,{webkitRelativePath:{writable:!0}}),Ee.webkitRelativePath=ce.fullPath.replace(/^\//,""),Object.defineProperties(Ee,{webkitRelativePath:{writable:!1}})),N([Ee]))}):ce.isDirectory&&M(ce,function(Ee){Ee.forEach(function(Ce){oe(Ce,""+De+ce.name+"/")})})};I.forEach(function(oe){ee(oe.webkitGetAsEntry())})},E=w,b=Object.assign||function(V){for(var I=1;I<arguments.length;I++){var N=arguments[I];for(var X in N)Object.prototype.hasOwnProperty.call(N,X)&&(V[X]=N[X])}return V},u=function(){function V(I,N){var X=[],ee=!0,oe=!1,ce=void 0;try{for(var De=I[Symbol.iterator](),Ee;!(ee=(Ee=De.next()).done)&&!(X.push(Ee.value),N&&X.length===N);ee=!0);}catch(Ce){oe=!0,ce=Ce}finally{try{!ee&&De.return&&De.return()}finally{if(oe)throw ce}}return X}return function(I,N){if(Array.isArray(I))return I;if(Symbol.iterator in Object(I))return V(I,N);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),a=function(){function V(I,N){for(var X=0;X<N.length;X++){var ee=N[X];ee.enumerable=ee.enumerable||!1,ee.configurable=!0,"value"in ee&&(ee.writable=!0),Object.defineProperty(I,ee.key,ee)}}return function(I,N,X){return N&&V(I.prototype,N),X&&V(I,X),I}}();function l(V,I,N){return I in V?Object.defineProperty(V,I,{value:N,enumerable:!0,configurable:!0,writable:!0}):V[I]=N,V}function h(V,I){var N={};for(var X in V){if(I.indexOf(X)>=0)continue;if(!Object.prototype.hasOwnProperty.call(V,X))continue;N[X]=V[X]}return N}function L(V,I){if(!(V instanceof I))throw new TypeError("Cannot call a class as a function")}function f(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 p(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(N,X){return(X.substr(0,5)==="data-"||X.substr(0,5)==="aria-"||X==="role")&&(N[X]=I[X]),N},{})},C=function(V){p(I,V);function I(){var N,X,ee,oe;L(this,I);for(var ce=arguments.length,De=Array(ce),Ee=0;Ee<ce;Ee++)De[Ee]=arguments[Ee];return oe=(X=(ee=f(this,(N=I.__proto__||Object.getPrototypeOf(I)).call.apply(N,[this].concat(De))),ee),ee.state={uid:A()},ee.reqs={},ee.onChange=function(Ce){var Te=Ce.target.files;ee.uploadFiles(Te),ee.reset()},ee.onClick=function(Ce){var Te=ee.fileInput;if(!Te)return;var me=ee.props,pe=me.children,ue=me.onClick;pe&&pe.type==="button"&&(Te.parentNode.focus(),Te.parentNode.querySelector("button").blur()),Te.click(),ue&&ue(Ce)},ee.onKeyDown=function(Ce){Ce.key==="Enter"&&ee.onClick()},ee.onFileDrop=function(Ce){var Te=ee.props.multiple;if(Ce.preventDefault(),Ce.type==="dragover")return;if(ee.props.directory)E(Array.prototype.slice.call(Ce.dataTransfer.items),ee.uploadFiles,function(pe){return x(pe,ee.props.accept)});else{var me=Array.prototype.slice.call(Ce.dataTransfer.files).filter(function(pe){return x(pe,ee.props.accept)});Te===!1&&(me=me.slice(0,1)),ee.uploadFiles(me)}},ee.uploadFiles=function(Ce){var Te=Array.prototype.slice.call(Ce);Te.map(function(me){return me.uid=A(),me}).forEach(function(me){ee.upload(me,Te)})},ee.saveFileInput=function(Ce){ee.fileInput=Ce},X),f(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,ce=this.props;if(!ce.beforeUpload)return setTimeout(function(){return oe.post(X)},0);var De=ce.beforeUpload(X,ee);De&&De.then?De.then(function(Ee){var Ce=Object.prototype.toString.call(Ee);return Ce==="[object File]"||Ce==="[object Blob]"?oe.post(Ee):oe.post(X)}).catch(function(Ee){console.log(Ee)}):De!==!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,ce=oe.onStart,De=oe.onProgress,Ee=oe.transformFile,Ce=Ee===void 0?function(Te){return Te}:Ee;new Promise(function(Te){var me=oe.action;return typeof me=="function"&&(me=me(X)),Te(me)}).then(function(Te){var me=X.uid,pe=oe.customRequest||j,ue=Promise.resolve(Ce(X)).then(function(te){var he=oe.data;return typeof he=="function"&&(he=he(te)),Promise.all([te,he])}).catch(function(te){console.error(te)});ue.then(function(te){var he=u(te,2),ae=he[0],we=he[1],Le={action:Te,filename:oe.name,data:we,file:ae,headers:oe.headers,withCredentials:oe.withCredentials,method:oe.method||"post",onProgress:De?function(xe){De(xe,X)}:null,onSuccess:function(_e,Ie){delete ee.reqs[me],oe.onSuccess(_e,X,Ie)},onError:function(_e,Ie){delete ee.reqs[me],oe.onError(_e,Ie,X)}};ce(X),ee.reqs[me]=pe(Le)})})}},{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(ce){ee[ce]&&ee[ce].abort&&ee[ce].abort(),delete ee[ce]})}},{key:"render",value:function(){var X,ee=this.props,oe=ee.component,ce=ee.prefixCls,De=ee.className,Ee=ee.disabled,Ce=ee.id,Te=ee.style,me=ee.multiple,pe=ee.accept,ue=ee.children,te=ee.directory,he=ee.openFileDialogOnClick,ae=ee.onMouseEnter,we=ee.onMouseLeave,Le=h(ee,["component","prefixCls","className","disabled","id","style","multiple","accept","children","directory","openFileDialogOnClick","onMouseEnter","onMouseLeave"]),xe=Q()((X={},l(X,ce,!0),l(X,ce+"-disabled",Ee),l(X,De,De),X)),_e=Ee?{}:{onClick:he?this.onClick:function(){},onKeyDown:he?this.onKeyDown:function(){},onMouseEnter:ae,onMouseLeave:we,onDrop:this.onFileDrop,onDragOver:this.onFileDrop,tabIndex:"0"};return $.a.createElement(oe,b({},_e,{className:xe,role:"button",style:Te}),$.a.createElement("input",b({},D(Le),{id:Ce,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:me,onChange:this.onChange})),ue)}}]),I}(ne.Component),m=C,v=Object.assign||function(V){for(var I=1;I<arguments.length;I++){var N=arguments[I];for(var X in N)Object.prototype.hasOwnProperty.call(N,X)&&(V[X]=N[X])}return V},d=function(){function V(I,N){for(var X=0;X<N.length;X++){var ee=N[X];ee.enumerable=ee.enumerable||!1,ee.configurable=!0,"value"in ee&&(ee.writable=!0),Object.defineProperty(I,ee.key,ee)}}return function(I,N,X){return N&&V(I.prototype,N),X&&V(I,X),I}}();function o(V,I){if(!(V instanceof I))throw new TypeError("Cannot call a class as a function")}function T(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 P=function(V){S(I,V);function I(){var N,X,ee,oe;o(this,I);for(var ce=arguments.length,De=Array(ce),Ee=0;Ee<ce;Ee++)De[Ee]=arguments[Ee];return oe=(X=(ee=T(this,(N=I.__proto__||Object.getPrototypeOf(I)).call.apply(N,[this].concat(De))),ee),ee.saveUploader=function(Ce){ee.uploader=Ce},X),T(ee,oe)}return d(I,[{key:"abort",value:function(X){this.uploader.abort(X)}},{key:"render",value:function(){return $.a.createElement(m,v({},this.props,{ref:this.saveUploader}))}}]),I}(ne.Component);P.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 B=P,W=at.a=B},H38U:function(dt,at,se){var ne=se("f4xo"),$=se("rcnY"),R=se("wU8J"),Q=se("Iq15"),U=se("dWSS");function O(F,_){this.typeNumber=F,this.errorCorrectLevel=_,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}var j=O.prototype;j.addData=function(F){var _=new ne(F);this.dataList.push(_),this.dataCache=null},j.isDark=function(F,_){if(F<0||this.moduleCount<=F||_<0||this.moduleCount<=_)throw new Error(F+","+_);return this.modules[F][_]},j.getModuleCount=function(){return this.moduleCount},j.make=function(){if(this.typeNumber<1){var F=1;for(F=1;F<40;F++){for(var _=$.getRSBlocks(F,this.errorCorrectLevel),A=new R,c=0,x=0;x<_.length;x++)c+=_[x].dataCount;for(var x=0;x<this.dataList.length;x++){var M=this.dataList[x];A.put(M.mode,4),A.put(M.getLength(),Q.getLengthInBits(M.mode,F)),M.write(A)}if(A.getLengthInBits()<=c*8)break}this.typeNumber=F}this.makeImpl(!1,this.getBestMaskPattern())},j.makeImpl=function(F,_){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 c=0;c<this.moduleCount;c++)this.modules[A][c]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(F,_),this.typeNumber>=7&&this.setupTypeNumber(F),this.dataCache==null&&(this.dataCache=O.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,_)},j.setupPositionProbePattern=function(F,_){for(var A=-1;A<=7;A++){if(F+A<=-1||this.moduleCount<=F+A)continue;for(var c=-1;c<=7;c++){if(_+c<=-1||this.moduleCount<=_+c)continue;0<=A&&A<=6&&(c==0||c==6)||0<=c&&c<=6&&(A==0||A==6)||2<=A&&A<=4&&2<=c&&c<=4?this.modules[F+A][_+c]=!0:this.modules[F+A][_+c]=!1}}},j.getBestMaskPattern=function(){for(var F=0,_=0,A=0;A<8;A++){this.makeImpl(!0,A);var c=Q.getLostPoint(this);(A==0||F>c)&&(F=c,_=A)}return _},j.createMovieClip=function(F,_,A){var c=F.createEmptyMovieClip(_,A),x=1;this.make();for(var M=0;M<this.modules.length;M++)for(var w=M*x,E=0;E<this.modules[M].length;E++){var b=E*x,u=this.modules[M][E];u&&(c.beginFill(0,100),c.moveTo(b,w),c.lineTo(b+x,w),c.lineTo(b+x,w+x),c.lineTo(b,w+x),c.endFill())}return c},j.setupTimingPattern=function(){for(var F=8;F<this.moduleCount-8;F++){if(this.modules[F][6]!=null)continue;this.modules[F][6]=F%2==0}for(var _=8;_<this.moduleCount-8;_++){if(this.modules[6][_]!=null)continue;this.modules[6][_]=_%2==0}},j.setupPositionAdjustPattern=function(){for(var F=Q.getPatternPosition(this.typeNumber),_=0;_<F.length;_++)for(var A=0;A<F.length;A++){var c=F[_],x=F[A];if(this.modules[c][x]!=null)continue;for(var M=-2;M<=2;M++)for(var w=-2;w<=2;w++)M==-2||M==2||w==-2||w==2||M==0&&w==0?this.modules[c+M][x+w]=!0:this.modules[c+M][x+w]=!1}},j.setupTypeNumber=function(F){for(var _=Q.getBCHTypeNumber(this.typeNumber),A=0;A<18;A++){var c=!F&&(_>>A&1)==1;this.modules[Math.floor(A/3)][A%3+this.moduleCount-8-3]=c}for(var A=0;A<18;A++){var c=!F&&(_>>A&1)==1;this.modules[A%3+this.moduleCount-8-3][Math.floor(A/3)]=c}},j.setupTypeInfo=function(F,_){for(var A=this.errorCorrectLevel<<3|_,c=Q.getBCHTypeInfo(A),x=0;x<15;x++){var M=!F&&(c>>x&1)==1;x<6?this.modules[x][8]=M:x<8?this.modules[x+1][8]=M:this.modules[this.moduleCount-15+x][8]=M}for(var x=0;x<15;x++){var M=!F&&(c>>x&1)==1;x<8?this.modules[8][this.moduleCount-x-1]=M:x<9?this.modules[8][15-x-1+1]=M:this.modules[8][15-x-1]=M}this.modules[this.moduleCount-8][8]=!F},j.mapData=function(F,_){for(var A=-1,c=this.moduleCount-1,x=7,M=0,w=this.moduleCount-1;w>0;w-=2)for(w==6&&w--;;){for(var E=0;E<2;E++)if(this.modules[c][w-E]==null){var b=!1;M<F.length&&(b=(F[M]>>>x&1)==1);var u=Q.getMask(_,c,w-E);u&&(b=!b),this.modules[c][w-E]=b,x--,x==-1&&(M++,x=7)}if(c+=A,c<0||this.moduleCount<=c){c-=A,A=-A;break}}},O.PAD0=236,O.PAD1=17,O.createData=function(F,_,A){for(var c=$.getRSBlocks(F,_),x=new R,M=0;M<A.length;M++){var w=A[M];x.put(w.mode,4),x.put(w.getLength(),Q.getLengthInBits(w.mode,F)),w.write(x)}for(var E=0,M=0;M<c.length;M++)E+=c[M].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,c)},O.createBytes=function(F,_){for(var A=0,c=0,x=0,M=new Array(_.length),w=new Array(_.length),E=0;E<_.length;E++){var b=_[E].dataCount,u=_[E].totalCount-b;c=Math.max(c,b),x=Math.max(x,u),M[E]=new Array(b);for(var a=0;a<M[E].length;a++)M[E][a]=255&F.buffer[a+A];A+=b;var l=Q.getErrorCorrectPolynomial(u),h=new U(M[E],l.getLength()-1),L=h.mod(l);w[E]=new Array(l.getLength()-1);for(var a=0;a<w[E].length;a++){var f=a+L.getLength()-w[E].length;w[E][a]=f>=0?L.get(f):0}}for(var p=0,a=0;a<_.length;a++)p+=_[a].totalCount;for(var D=new Array(p),C=0,a=0;a<c;a++)for(var E=0;E<_.length;E++)a<M[E].length&&(D[C++]=M[E][a]);for(var a=0;a<x;a++)for(var E=0;E<_.length;E++)a<w[E].length&&(D[C++]=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,F){switch(O){case Q.PATTERN000:return(j+F)%2==0;case Q.PATTERN001:return j%2==0;case Q.PATTERN010:return F%3==0;case Q.PATTERN011:return(j+F)%3==0;case Q.PATTERN100:return(Math.floor(j/2)+Math.floor(F/3))%2==0;case Q.PATTERN101:return j*F%2+j*F%3==0;case Q.PATTERN110:return(j*F%2+j*F%3)%2==0;case Q.PATTERN111:return(j*F%3+(j+F)%2)%2==0;default:throw new Error("bad maskPattern:"+O)}},getErrorCorrectPolynomial:function(O){for(var j=new $([1],0),F=0;F<O;F++)j=j.multiply(new $([1,R.gexp(F)],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(),F=0,_=0;_<j;_++)for(var A=0;A<j;A++){for(var c=0,x=O.isDark(_,A),M=-1;M<=1;M++){if(_+M<0||j<=_+M)continue;for(var w=-1;w<=1;w++){if(A+w<0||j<=A+w)continue;if(M==0&&w==0)continue;x==O.isDark(_+M,A+w)&&c++}}c>5&&(F+=3+c-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)&&(F+=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)&&(F+=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)&&(F+=40);for(var b=0,A=0;A<j;A++)for(var _=0;_<j;_++)O.isDark(_,A)&&b++;var u=Math.abs(100*b/j/j-50)/5;return F+=u*10,F}};dt.exports=U},LdHM:function(dt,at,se){"use strict";se.d(at,"b",function(){return h}),se.d(at,"a",function(){return f});var ne=se("1OyB"),$=se("vuIU"),R=se("Ji7U"),Q=se("LK+K"),U=se("q1tI"),O=se("rePB"),j=se("Ff2n"),F=se("ODXe"),_=se("4IlW"),A=se("bX4T"),c=se("YrtM"),x=se("TSYQ"),M=se.n(x),w=se("+nKL"),E=se("8OUc"),b=function(X,ee){var oe=X.prefixCls,ce=X.id,De=X.flattenOptions,Ee=X.childrenAsData,Ce=X.values,Te=X.searchValue,me=X.multiple,pe=X.defaultActiveFirstOption,ue=X.height,te=X.itemHeight,he=X.notFoundContent,ae=X.open,we=X.menuItemSelectedIcon,Le=X.virtual,xe=X.onSelect,_e=X.onToggleOpen,Ie=X.onActiveValue,We=X.onScroll,Fe=X.onMouseEnter,Ne="".concat(oe,"-item"),Ue=Object(c.a)(function(){return De},[ae,De],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],de=le.group,ke=le.data;if(!de&&!ke.disabled)return ie}return-1},st=U.useState(function(){return qe(0)}),$e=Object(F.a)(st,2),Qe=$e[0],Me=$e[1],ut=function(Se){Me(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,Te]),U.useEffect(function(){var Ke=setTimeout(function(){if(!me&&ae&&Ce.size===1){var Se=Array.from(Ce)[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&&xe(Se,{selected:!Ce.has(Se)}),me||_e(!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:_e(!1)}},onKeyUp:function(){},scrollTo:function(Se){nt(Se)}}}),Ue.length===0)return U.createElement("div",{role:"listbox",id:"".concat(ce,"_list"),className:"".concat(Ne,"-empty"),onMouseDown:ot},he);function Be(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),de=Ee?ie:re;return Se?U.createElement("div",Object.assign({"aria-label":typeof de=="string"?de:null},le,{key:Ke,role:"option",id:"".concat(ce,"_list_").concat(Ke),"aria-selected":Ce.has(be)}),be):null}return U.createElement(U.Fragment,null,U.createElement("div",{role:"listbox",id:"".concat(ce,"_list"),style:{height:0,width:0,overflow:"hidden"}},Be(Qe-1),Be(Qe),Be(Qe+1)),U.createElement(w.a,{itemKey:"key",ref:et,data:Ue,height:ue,itemHeight:te,fullHeight:!1,onMouseDown:ot,onScroll:We,virtual:Le,onMouseEnter:Fe},function(Ke,Se){var ve,be=Ke.group,re=Ke.groupOption,ie=Ke.data,le=ie.label,de=ie.key;if(be)return U.createElement("div",{className:M()(Ne,"".concat(Ne,"-group"))},le!==void 0?le:de);var ke=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=Ce.has(Pe),it="".concat(Ne,"-option"),Rt=M()(Ne,it,Ge,(ve={},Object(O.a)(ve,"".concat(it,"-grouped"),re),Object(O.a)(ve,"".concat(it,"-active"),Qe===Se&&!ke),Object(O.a)(ve,"".concat(it,"-disabled"),ke),Object(O.a)(ve,"".concat(it,"-selected"),ft),ve)),pt=Ee?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||ke)return;ut(Se)},onClick:function(){ke||lt(Pe)},style:Dt}),U.createElement("div",{className:"".concat(it,"-content")},pt||Pe),U.isValidElement(we)||ft,At&&U.createElement(E.a,{className:"".concat(Ne,"-option-state"),customizeIcon:we,customizeIconProps:{isSelected:ft}},ft?"\u2713":null))}))},u=U.forwardRef(b);u.displayName="OptionList";var a=u,l=function(){return null};l.isSelectOption=!0;var h=l,L=function(){return null};L.isSelectOptGroup=!0;var f=L,p=se("VTBJ"),D=se("Zm9Q");function C(N){var X=N.key,ee=N.props,oe=ee.children,ce=ee.value,De=Object(j.a)(ee,["children","value"]);return Object(p.a)({key:X,value:ce!==void 0?ce:X,children:oe},De)}function m(N){var X=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(D.a)(N).map(function(ee,oe){if(!U.isValidElement(ee)||!ee.type)return null;var ce=ee.type.isSelectOptGroup,De=ee.key,Ee=ee.props,Ce=Ee.children,Te=Object(j.a)(Ee,["children"]);return X||!ce?C(ee):Object(p.a)(Object(p.a)({key:"__RC_SELECT_GRP__".concat(De===null?oe:De,"__"),label:De},Te),{},{options:m(Ce)})}).filter(function(ee){return ee})}var v=se("2Qr1"),d=se("qNPg"),o=se("U8pU"),T=se("Kwbf"),S=se("WKfj");function y(N){var X=N.mode,ee=N.options,oe=N.children,ce=N.backfill,De=N.allowClear,Ee=N.placeholder,Ce=N.getInputElement,Te=N.showSearch,me=N.onSearch,pe=N.defaultOpen,ue=N.autoFocus,te=N.labelInValue,he=N.value,ae=N.inputValue,we=N.optionLabelProp,Le=X==="multiple"||X==="tags",xe=Te!==void 0?Te:Le||X==="combobox",_e=ee||m(oe);if(Object(T.a)(X!=="tags"||_e.every(function(Ne){return!Ne.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),X==="tags"||X==="combobox"){var Ie=_e.some(function(Ne){return Ne.options?Ne.options.some(function(Ue){return typeof("value"in Ue?Ue.value:Ue.key)=="number"}):typeof("value"in Ne?Ne.value:Ne.key)=="number"});Object(T.a)(!Ie,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(T.a)(X!=="combobox"||!we,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(T.a)(X==="combobox"||!ce,"`backfill` only works with `combobox` mode."),Object(T.a)(X==="combobox"||!Ce,"`getInputElement` only work with `combobox` mode."),Object(T.b)(X!=="combobox"||!Ce||!De||!Ee,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),me&&!xe&&X!=="combobox"&&X!=="tags"&&Object(T.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(T.b)(!pe||ue,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),he!=null){var We=Object(S.d)(he);Object(T.a)(!te||We.every(function(Ne){return Object(o.a)(Ne)==="object"&&("key"in Ne||"value"in Ne)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(T.a)(!Le||Array.isArray(he),"`value` should be array when `mode` is `multiple` or `tags`")}if(oe){var Fe=null;Object(D.a)(oe).some(function(Ne){if(!U.isValidElement(Ne)||!Ne.type)return!1;var Ue=Ne.type;if(Ue.isSelectOption)return!1;if(Ue.isSelectOptGroup){var et=Object(D.a)(Ne.props.children).every(function(ot){return!U.isValidElement(ot)||!Ne.type||ot.type.isSelectOption?!0:(Fe=ot.type,!1)});return!et}return Fe=Ue,!0}),Fe&&Object(T.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(Fe.displayName||Fe.name||Fe,"`.")),Object(T.a)(ae===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var P=y,B=Object(d.a)({prefixCls:"rc-select",components:{optionList:a},convertChildrenToData:m,flattenOptions:v.d,getLabeledValue:v.e,filterOptions:v.b,isValueDisabled:v.g,findValueOption:v.c,warningProps:P,fillOptionsWithMissingValue:v.a}),W=function(N){Object(R.a)(ee,N);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(B,Object.assign({ref:this.selectRef},this.props))}}]),ee}(U.Component);W.Option=h,W.OptGroup=f;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"),F=se.n(j),_=function(A){Object(R.a)(x,A);var c=Object(Q.a)(x);function x(M){var w;Object(ne.a)(this,x),w=c.call(this,M);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"),F=se("jrin"),_=se("WmNS"),A=se.n(_),c=se("q1tI"),x=se.n(c),M=se("VrN/"),w=se.n(M),E=se("bdgK"),b=se("p77/"),u=se("Bd2K"),a=se("ELLl"),l=se("19Vz"),h=se("lZu9"),L=se("+NIl"),f=se("kSUc"),p=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(c.useMemo)(function(){return""},[ft]);return x.a.createElement(x.a.Fragment,null,x.a.createElement("div",{dangerouslySetInnerHTML:{__html:Ze}}))},C=se("Q9mQ"),m=se("diRs"),v=se("0Owb"),d=se("dejd"),o=se("C+DQ"),T=se("D1Df"),S=se.n(T),y=se("1vsH"),P=se("m3rI"),B=[{title:"\u7C97\u4F53",icon:"icon-bold",actionName:"bold"},{title:"\u659C\u4F53",icon:"icon-italic",actionName:"italic"},"|",{title:"\u65E0\u5E8F\u5217\u8868",icon:"icon-unorder-list",actionName:"list-ul"},{title:"\u6709\u5E8F\u5217\u8868",icon:"icon-order-list",actionName:"list-ol"},"|",{title:"\u884C\u5185\u4EE3\u7801",icon:"icon-code",actionName:"code"},{title:"\u4EE3\u7801\u5757\uFF08\u591A\u8BED\u8A00\u98CE\u683C\uFF09",icon:"icon-file-code",actionName:"code-block"},{title:"\u94FE\u63A5",icon:"icon-link",actionName:"link"},"|",{title:"\u884C\u5185\u516C\u5F0F",icon:"icon-sum",actionName:"inline-latex"},{title:"\u591A\u884C\u516C\u5F0F",icon:"icon-formula",actionName:"latex"},"|",{title:"\u6DFB\u52A0\u56FE\u7247",icon:"icon-picture",actionName:"upload-image"},{title:"\u8868\u683C",icon:"icon-table",actionName:"add-table"},"|",{title:"\u6362\u884C",icon:"icon-minus",actionName:"line-break"},{title:"\u6E05\u7A7A",icon:"icon-eraser",actionName:"eraser"}];function 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;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(y.E)("_educoder_session_login"),"&_educoder_session=").concat(Object(y.E)("_educoder_session"),"&key=").concat(Lt,"&api=").concat(encodeURIComponent(P.a.PROXY_SERVER)));var or=[].concat(B,[{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&&or.map(function(Qt,yt){return x.a.createElement("li",{key:yt},Qt.actionName?x.a.createElement(W,Object(v.a)({},Qt,{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(m.a,{title:"\u6253\u5F00\u624B\u673A\u626B\u4E00\u626B",content:x.a.createElement("div",null,x.a.createElement(S.a,{size:150,fgColor:"#000",value:"https://test2.educoder.net/upload.html?_educoder_session_login=".concat(Object(y.E)("_educoder_session_login"),"&_educoder_session=").concat(Object(y.E)("_educoder_session"),"&key=").concat(Lt,"&api=").concat(encodeURIComponent(P.a.PROXY_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"),N=se("+L6B"),X=se("2/Rp"),ee=se("y8nQ"),oe=se("Vl3Y"),ce=se("5NDa"),De=se("5rEg"),Ee={labelCol:{span:4},wrapperCol:{span:20}},Ce=function(Ge){var Et=Ge.callback,ft=Ge.onCancel;function it(Rt){Et(Rt)}return x.a.createElement(oe.a,Object(v.a)({},Ee,{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(De.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(De.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")))},Te=se("7ahc"),me=se("k1fw"),pe=se("HmJG"),ue=se("BjJ7"),te=oe.a.useForm,he={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(c.useRef)();function Lt(Qt){Et(Object(me.a)(Object(me.a)({},Qt),{},{name:At.current}))}function Ze(Qt,yt){pt.setFieldsValue({src:"/api/attachments/".concat(Qt.id,"?type=").concat(Qt.content_type),type:yt.type})}function or(Qt){var yt=Qt.target.files[0];At.current=yt.name,xe(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(De.a,{style:he})),x.a.createElement(Le,{onFileChange:or}))),x.a.createElement(oe.a.Item,{label:"\u6587\u4EF6\u63CF\u8FF0",name:"alt"},x.a.createElement(De.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 Le(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 xe(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 _e=se("giR+"),Ie=se("fyUT"),We=se("7Kak"),Fe=se("9yH6"),Ne=Fe.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(Ne,null,x.a.createElement(Fe.a,{value:"default"},x.a.createElement("i",{className:"fa fa-align-justify"})),x.a.createElement(Fe.a,{value:"left"},x.a.createElement("i",{className:"fa fa-align-left"})),x.a.createElement(Fe.a,{value:"center"},x.a.createElement("i",{className:"fa fa-align-center"})),x.a.createElement(Fe.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",Me="------------",ut={default:Me,left:":".concat(Me),center:":".concat(Me,":"),right:"".concat(Me,":")},lt=se("9VGf"),Be,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 de=navigator.platform.toUpperCase().indexOf("MAC")>=0,ke=de?"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=(Be={},Object(F.a)(Be,ke+"-B","bold"),Object(F.a)(Be,ke+"-I","italic"),Be),vt=(Ke={},Object(F.a)(Ke,qe,"\u6DFB\u52A0\u94FE\u63A5"),Object(F.a)(Ke,$e,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(F.a)(Ke,st,"\u6DFB\u52A0\u6587\u4EF6"),Object(F.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,or=Ze===void 0?!1:Ze,Qt=Ge.isFocus,yt=Qt===void 0?!1:Qt,Xt=Ge.watch,hr=Ge.insertTemp,ir=Ge.mode,Cr=ir===void 0?"markdown":ir,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,s=K===void 0?!1:K,g=Ge.placeholder,G=g===void 0?"":g,J=Ge.values,z=J===void 0?"":J,ye=Object(c.useState)(null),He=Object(j.a)(ye,2),Oe=He[0],mt=He[1],ze=Object(c.useState)(ft),wt=Object(j.a)(ze,2),Nt=wt[0],Ht=wt[1],Wr=Object(c.useState)(Xt),Hr=Object(j.a)(Wr,2),dr=Hr[0],Yr=Hr[1],Ki=Object(c.useState)(Ye),kr=Object(j.a)(Ki,2),Dr=kr[0],ri=kr[1],vi=Object(c.useState)(""),Qr=Object(j.a)(vi,2),ii=Qr[0],Gr=Qr[1],fn=Object(c.useState)(0),Vi=Object(j.a)(fn,2),Ir=Vi[0],Nr=Vi[1],Oi=Object(c.useState)(Lt),_i=Object(j.a)(Oi,2),Mi=_i[0],tr=_i[1],Ft=Object(c.useState)(!1),vr=Object(j.a)(Ft,2),jt=vr[0],yr=vr[1],Yt=Object(c.useRef)(Object(nt.a)()),yi=Object(c.useRef)(!1),sr=Object(c.useRef)(),lr=Object(c.useRef)(),ni=Object(c.useRef)(),bi=Object(c.useRef)(),xi=Object(c.useRef)(),Fn=function(){var bt=Object(O.a)(A.a.mark(function kt(){var St,_t;return A.a.wrap(function(Gt){for(;;)switch(Gt.prev=Gt.next){case 0:return Gt.next=2,Object(ot.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:Yt.current}});case 2:_t=Gt.sent,_t!=null&&(St=_t.attachments)!==null&&St!==void 0&&St.length&&(console.log("cm:",Oe,lr),_t.attachments.map(function(It){It.content_type.indexOf("image")>-1?Oe.replaceSelection(".concat(It.content_type,")")):It.content_type.indexOf("video")>-1?Oe.replaceSelection('<video width="100%" controls src="'.concat(P.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):It.content_type.indexOf("pdf")>-1?Oe.replaceSelection('<a href="'.concat(P.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(P.a.API_SERVER,"/api/attachments/").concat(It.id,"?type=").concat(It.content_type,")"))}));case 4:case"end":return Gt.stop()}},kt)}));return function(){return bt.apply(this,arguments)}}();Object(c.useEffect)(function(){Ht(z),Oe==null||Oe.setValue(z)},[z]),Object(c.useEffect)(function(){hi==null||hi(Dr)},[Dr]),Object(c.useEffect)(function(){if(lr.current){var bt=w.a.fromTextArea(lr.current,{mode:Cr,lineNumbers:!or,lineWrapping:!0,value:ft,autoCloseTags:!0,autoCloseBrackets:!0});yt&&bt.focus();function kt(St,_t){if(s){_t.preventDefault();return}var Ut=_t.clipboardData;if(Ut){var Gt=Ut.types.toString(),It=Ut.items;if(Gt==="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();xe(Mt,function(zt){if(zt.id){var br,Vt,$r;(Mt==null||((br=Mt.type)===null||br===void 0)?void 0:br.indexOf("image"))>-1?bt.replaceSelection(".concat(zt.content_type,")")):(Mt==null||((Vt=Mt.type)===null||Vt===void 0)?void 0:Vt.indexOf("video"))>-1?bt.replaceSelection('<video width="100%" controls src="'.concat(P.a.API_SERVER,"/api/attachments/").concat(zt.id,'"></video>')):(Mt==null||(($r=Mt.type)===null||$r===void 0)?void 0:$r.indexOf("pdf"))>-1?bt.replaceSelection('<a href="'.concat(P.a.API_SERVER,"/api/attachments/").concat(zt.id,"?type=").concat(Mt.type,'&disposition=inline" target="_blank">').concat(Mt.name,"</a>")):Pe.includes(Pi)?bt.replaceSelection('<a href="'.concat(P.a.API_SERVER,"/api/attachments/").concat(zt.id,'?type=office&disposition=inline" target="_blank">').concat(Mt.name,"</a>")):bt.replaceSelection("[".concat(Mt.name,"](").concat(P.a.API_SERVER,"/api/attachments/").concat(zt.id,"?type=").concat(zt.content_type,")"))}else(zt==null?void 0:zt.status)===401&&(document.location.href="/user/login")})}catch(zt){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 Gt=function(cr){var Mt=Ut[cr],Pi=Mt.name.split(".").pop();xe(Mt,function(zt){if(zt.id){var br,Vt,$r;(Mt==null||((br=Mt.type)===null||br===void 0)?void 0:br.indexOf("image"))>-1?bt.replaceSelection(".concat(zt.content_type,")")):(Mt==null||((Vt=Mt.type)===null||Vt===void 0)?void 0:Vt.indexOf("video"))>-1?bt.replaceSelection('<video width="100%" controls src="'.concat(P.a.API_SERVER,"/api/attachments/").concat(zt.id,'"></video>')):(Mt==null||(($r=Mt.type)===null||$r===void 0)?void 0:$r.indexOf("pdf"))>-1?bt.replaceSelection('<a href="'.concat(P.a.API_SERVER,"/api/attachments/").concat(zt.id,"?type=").concat(Mt.type,'&disposition=inline" target="_blank">').concat(Mt.name,"</a>")):Pe.includes(Pi)?bt.replaceSelection('<a href="'.concat(P.a.API_SERVER,"/api/attachments/").concat(zt.id,'?type=office&disposition=inline" target="_blank">').concat(Mt.name,"</a>")):bt.replaceSelection("[".concat(Mt.name,"](").concat(P.a.API_SERVER,"/api/attachments/").concat(zt.id,"?type=").concat(zt.content_type,")"))}else(zt==null?void 0:zt.status)===401&&(document.location.href="/user/login")})},It=0;It<Ut.length;It++)Gt(It)}}),mt(bt),function(){bt.off("paste",kt)}}},[]);var Zr=Object(c.useCallback)(function(){if(ni.current)try{}catch(bt){console.log(bt,"---- to set md editor body height")}},[Mi,ni,Dr]);Object(c.useEffect)(function(){function bt(){var St=new E.default(function(_t){var Ut=Object(R.a)(_t),Gt;try{for(Ut.s();!(Gt=Ut.n()).done;){var It=Gt.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(lr.current.parentElement),St}if(Oe){var kt=bt();return function(){kt.unobserve(lr.current.parentElement)}}},[Oe,Zr]),Object(c.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(F.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 sr.current=setInterval(function(){yi.current&&Fn()},4e3),function(){clearInterval(sr.current);var Gt=Object(R.a)(bt),It;try{for(Gt.s();!(It=Gt.n()).done;){var Jt=It.value;Oe.removeKeyMap(Jt)}}catch(cr){Gt.e(cr)}finally{Gt.f()}}}},[Oe]),Object(c.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(c.useEffect)(function(){Yr(Xt)},[Oe,Xt]),Object(c.useEffect)(function(){Oe&&(yt&&Oe.focus())},[Oe,yt]),Object(c.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(c.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(c.useEffect)(function(){if(Oe&&Tt){function bt(){Tt(Oe.getValue())}return Oe.on("blur",bt),function(){Oe.off("blur",bt)}}},[Oe,Tt]),Object(c.useEffect)(function(){if(Oe){function bt(kt){var St=kt.getValue();Ht(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(c.useEffect)(function(){Oe&&(ft==null?(Oe.setValue(""),Ht("")):ft!==Oe.getValue()&&(Oe.setValue(ft),Ht(ft),Oe.setCursor(Oe.lineCount(),0)))},[Oe,ft]);var Xi=Object(c.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,Gt){return Ut===""?"":"".concat(Gt+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(c.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 Gt=bt.src,It=bt.alt,Jt=bt.name;return Gt.indexOf("type=image")>-1?Oe.replaceSelection(".concat(Gt,' "').concat(It||"",'" )')):Gt.indexOf("type=application/pdf")>-1?Oe.replaceSelection('<a href="'.concat(Gt,'&disposition=inline" target="_blank">').concat(Jt,"</a>")):Oe.replaceSelection('<a href="'.concat(Gt,'" target="_blank">').concat(Jt,"</a>")),Oe.focus();case Qe:for(var cr=bt.row,Mt=bt.col,Pi=bt.align,zt=`
|
|
`,br=0;br<cr;br++){for(var Vt=[],$r=[],pn=0;pn<Mt;pn++)br===1&&$r.push(ut[Pi]),Vt.push(" ");br===1&&(zt+="| ".concat($r.join(" | "),` |
|
|
`)),zt+="| ".concat(Vt.join(Mt===1?"":" | "),` |
|
|
`)}return Oe.replaceSelection(zt+`
|
|
`),Oe.focus();default:throw new Error}},[Oe,ii]),Yi=Object(c.useMemo)(function(){switch(ii){case qe:return x.a.createElement(Ce,{callback:Br,onCancel:ci});case $e:return x.a.createElement(Te.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(c.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 Gt(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",Gt),document.addEventListener("mouseup",Ut),function(){bt.removeEventListener("mousedown",_t),document.removeEventListener("mousemove",Gt),document.removeEventListener("mouseup",Ut)}}},[Oe,bi]),Object(c.useEffect)(function(){tr(Lt)},[Lt]);var Ei=le(pt),ua=le(Mi),ha={width:Ei,height:ua},Qa=Object(c.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),Ht(St),Oe==null||Oe.setValue(St)}return x.a.createElement(c.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(or?"mini":""," ").concat(Dr?"full-screen":""),style:ha},x.a.createElement(V,{insertTemp:hr,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:lr,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(p.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 F=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"],c=[A,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],x=[c,"alignas,alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,noexcept,noreturn,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],M=[c,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],w=[c,"abstract,add,alias,as,ascending,async,await,base,bool,by,byte,checked,decimal,delegate,descending,dynamic,event,finally,fixed,foreach,from,get,global,group,implicit,in,interface,internal,into,is,join,let,lock,null,object,out,override,orderby,params,partial,readonly,ref,remove,sbyte,sealed,select,set,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,value,var,virtual,where,yield"],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",b=[c,"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"],l=[_,"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"],L=[x,w,M,b,u,a,l,h],f=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,p="str",D="kwd",C="com",m="typ",v="lit",d="pun",o="pln",T="tag",S="dec",y="src",P="atn",B="atv",W="nocode",V="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function I(xe){for(var _e=0,Ie=!1,We=!1,Fe=0,Ne=xe.length;Fe<Ne;++Fe){var Ue=xe[Fe];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 Me=Qe.charCodeAt(0);if(Me!==92)return Me;var ut=Qe.charAt(1);return Me=et[ut],Me||("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 Me=String.fromCharCode(Qe);return Me==="\\"||Me==="-"||Me==="]"||Me==="^"?"\\"+Me:Me}function qe(Qe){var Me=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=Me[0]==="^",Be=["["];lt&&Be.push("^");for(var Ke=lt?1:0,Se=Me.length;Ke<Se;++Ke){var ve=Me[Ke];if(/\\[bdsw]/i.test(ve))Be.push(ve);else{var be=ot(ve),re;Ke+2<Se&&Me[Ke+1]==="-"?(re=ot(Me[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(ke,Pe){return ke[0]-Pe[0]||Pe[1]-ke[1]});for(var ie=[],le=[],Ke=0;Ke<ut.length;++Ke){var de=ut[Ke];de[0]<=le[1]+1?le[1]=Math.max(le[1],de[1]):ie.push(le=de)}for(var Ke=0;Ke<ie.length;++Ke){var de=ie[Ke];Be.push(nt(de[0])),de[1]>de[0]&&(de[1]+1>de[0]&&Be.push("-"),Be.push(nt(de[1])))}return Be.push("]"),Be.join("")}function st(Qe){for(var Me=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=Me.length,lt=[],Be=0,Ke=0;Be<ut;++Be){var Se=Me[Be];if(Se==="(")++Ke;else if(Se.charAt(0)==="\\"){var ve=+Se.substring(1);ve&&(ve<=Ke?lt[ve]=-1:Me[Be]=nt(ve))}}for(var Be=1;Be<lt.length;++Be)lt[Be]===-1&&(lt[Be]=++_e);for(var Be=0,Ke=0;Be<ut;++Be){var Se=Me[Be];if(Se==="(")++Ke,lt[Ke]||(Me[Be]="(?:");else if(Se.charAt(0)==="\\"){var ve=+Se.substring(1);ve&&ve<=Ke&&(Me[Be]="\\"+lt[ve])}}for(var Be=0;Be<ut;++Be)Me[Be]==="^"&&Me[Be+1]!=="^"&&(Me[Be]="");if(Qe.ignoreCase&&Ie)for(var Be=0;Be<ut;++Be){var Se=Me[Be],be=Se.charAt(0);Se.length>=2&&be==="["?Me[Be]=qe(Se):be!=="\\"&&(Me[Be]=Se.replace(/[a-zA-Z]/g,function(le){var de=le.charCodeAt(0);return"["+String.fromCharCode(de&~32,de|32)+"]"}))}return Me.join("")}for(var $e=[],Fe=0,Ne=xe.length;Fe<Ne;++Fe){var Ue=xe[Fe];if(Ue.global||Ue.multiline)throw new Error(""+Ue);$e.push("(?:"+st(Ue)+")")}return new RegExp($e.join("|"),We?"gi":"g")}function N(xe,_e){var Ie=/(?:^|\s)nocode(?:\s|$)/,We=[],Fe=0,Ne=[],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]=`
|
|
`,Ne[Ue<<1]=Fe++,Ne[Ue++<<1|1]=ot)}else if(nt==3||nt==4){var $e=ot.nodeValue;$e.length&&(_e?$e=$e.replace(/\r\n?/g,`
|
|
`):$e=$e.replace(/[ \t\r\n]+/g," "),We[Ue]=$e,Ne[Ue<<1]=Fe,Fe+=$e.length,Ne[Ue++<<1|1]=ot)}}return et(xe),{sourceCode:We.join("").replace(/\n$/,""),spans:Ne}}function X(xe,_e,Ie,We,Fe){if(!Ie)return;var Ne={sourceNode:xe,pre:1,langExtension:null,numberLines:null,sourceCode:Ie,spans:null,basePos:_e,decorations:null};We(Ne),Fe.push.apply(Fe,Ne.decorations)}var ee=/\S/;function oe(xe){for(var _e=void 0,Ie=xe.firstChild;Ie;Ie=Ie.nextSibling){var We=Ie.nodeType;_e=We===1?_e?xe:Ie:We===3&&ee.test(Ie.nodeValue)?xe:_e}return _e===xe?void 0:_e}function ce(xe,_e){var Ie={},We;(function(){for(var Ue=xe.concat(_e),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 Me=st[1],ut=""+Me;ot.hasOwnProperty(ut)||(et.push(Me),ot[ut]=null)}et.push(/[\0-\uffff]/),We=I(et)})();var Fe=_e.length,Ne=function(Ue){for(var et=Ue.sourceCode,ot=Ue.basePos,nt=Ue.sourceNode,qe=[ot,o],st=0,$e=et.match(We)||[],Qe={},Me=0,ut=$e.length;Me<ut;++Me){var lt=$e[Me],Be=Qe[lt],Ke=void 0,Se;if(typeof Be=="string")Se=!1;else{var ve=Ie[lt.charAt(0)];if(ve)Ke=lt.match(ve[1]),Be=ve[0];else{for(var be=0;be<Fe;++be)if(ve=_e[be],Ke=lt.match(ve[1]),Ke){Be=ve[0];break}Ke||(Be=o)}Se=Be.length>=5&&Be.substring(0,5)==="lang-",Se&&!(Ke&&typeof Ke[1]=="string")&&(Se=!1,Be=y),Se||(Qe[lt]=Be)}var re=st;if(st+=lt.length,!Se)qe.push(ot+re,Be);else{var ie=Ke[1],le=lt.indexOf(ie),de=le+ie.length;Ke[2]&&(de=lt.length-Ke[2].length,le=de-ie.length);var ke=Be.substring(5);X(nt,ot+re,lt.substring(0,le),Ne,qe),X(nt,ot+re+le,ie,ue(ke,ie),qe),X(nt,ot+re+de,lt.substring(de),Ne,qe)}}Ue.decorations=qe};return Ne}function De(xe){var _e=[],Ie=[];xe.tripleQuotedStrings?_e.push([p,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):xe.multiLineStrings?_e.push([p,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):_e.push([p,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),xe.verbatimStrings&&Ie.push([p,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var We=xe.hashComments;We&&(xe.cStyleComments?(We>1?_e.push([C,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):_e.push([C,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),Ie.push([p,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):_e.push([C,/^#[^\r\n]*/,null,"#"])),xe.cStyleComments&&(Ie.push([C,/^\/\/[^\r\n]*/,null]),Ie.push([C,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Fe=xe.regexLiterals;if(Fe){var Ne=Fe>1?"":`
|
|
\r`,Ue=Ne?".":"[\\S\\s]",et="/(?=[^/*"+Ne+"])(?:[^/\\x5B\\x5C"+Ne+"]|\\x5C"+Ue+"|\\x5B(?:[^\\x5C\\x5D"+Ne+"]|\\x5C"+Ue+")*(?:\\x5D|$))+/";Ie.push(["lang-regex",RegExp("^"+V+"("+et+")")])}var ot=xe.types;ot&&Ie.push([m,ot]);var nt=(""+xe.keywords).replace(/^ | $/g,"");nt.length&&Ie.push([D,new RegExp("^(?:"+nt.replace(/[\s,]+/g,"|")+")\\b"),null]),_e.push([o,/^\s+/,null,` \r
|
|
\xA0`]);var qe="^.[^\\s\\w.$@'\"`/\\\\]*";return xe.regexLiterals&&(qe+="(?!s*/)"),Ie.push([v,/^@[a-z_$][a-z_$@0-9]*/i,null],[m,/^(?:[@_]?[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]),ce(_e,Ie)}var Ee=De({keywords:L,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function Ce(xe,_e,Ie){for(var We=/(?:^|\s)nocode(?:\s|$)/,Fe=/\r\n?|\n/,Ne=xe.ownerDocument,Ue=Ne.createElement("li");xe.firstChild;)Ue.appendChild(xe.firstChild);var et=[Ue];function ot(Me){var ut=Me.nodeType;if(ut==1&&!We.test(Me.className))if(Me.nodeName==="br")nt(Me),Me.parentNode&&Me.parentNode.removeChild(Me);else for(var lt=Me.firstChild;lt;lt=lt.nextSibling)ot(lt);else if((ut==3||ut==4)&&Ie){var Be=Me.nodeValue,Ke=Be.match(Fe);if(Ke){var Se=Be.substring(0,Ke.index);Me.nodeValue=Se;var ve=Be.substring(Ke.index+Ke[0].length);if(ve){var be=Me.parentNode;be.insertBefore(Ne.createTextNode(ve),Me.nextSibling)}nt(Me),Se||Me.parentNode.removeChild(Me)}}}function nt(Me){for(;!Me.nextSibling;)if(Me=Me.parentNode,!Me)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(Me.nextSibling,0),Be;(Be=lt.parentNode)&&Be.nodeType===1;)lt=Be;et.push(lt)}for(var qe=0;qe<et.length;++qe)ot(et[qe]);_e===(_e|0)&&et[0].setAttribute("value",_e);var st=Ne.createElement("ol");st.className="linenums";for(var $e=Math.max(0,_e-1|0)||0,qe=0,Qe=et.length;qe<Qe;++qe)Ue=et[qe],Ue.className="L"+(qe+$e)%10,Ue.firstChild||Ue.appendChild(Ne.createTextNode("\xA0")),st.appendChild(Ue);xe.appendChild(st)}function Te(xe){var _e=/\bMSIE\s(\d+)/.exec(navigator.userAgent);_e=_e&&+_e[1]<=8;var Ie=/\n/g,We=xe.sourceCode,Fe=We.length,Ne=0,Ue=xe.spans,et=Ue.length,ot=0,nt=xe.decorations,qe=nt.length,st=0;nt[qe]=Fe;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 Me=nt[Qe],ut=nt[Qe+1],lt=Qe+2;lt+2<=qe&&nt[lt+1]===ut;)lt+=2;nt[$e++]=Me,nt[$e++]=ut,Qe=lt}qe=nt.length=$e;var Be=xe.sourceNode,Ke="";Be&&(Ke=Be.style.display,Be.style.display="none");try{for(var Se=null;ot<et;){var ve=Ue[ot],be=Ue[ot+2]||Fe,re=nt[st+2]||Fe,lt=Math.min(be,re),ie=Ue[ot+1],le;if(ie.nodeType!==1&&(le=We.substring(Ne,lt))){_e&&(le=le.replace(Ie,"\r")),ie.nodeValue=le;var de=ie.ownerDocument,ke=de.createElement("span");ke.className=nt[st+1];var Pe=ie.parentNode;Pe.replaceChild(ke,ie),ke.appendChild(ie),Ne<be&&(Ue[ot+1]=ie=de.createTextNode(We.substring(lt,be)),Pe.insertBefore(ie,ke.nextSibling))}Ne=lt,Ne>=be&&(ot+=2),Ne>=re&&(st+=2)}}finally{Be&&(Be.style.display=Ke)}}var me={};function pe(xe,_e){for(var Ie=_e.length;--Ie>=0;){var We=_e[Ie];me.hasOwnProperty(We)?F.console&&console.warn("cannot override language handler %s",We):me[We]=xe}}function ue(xe,_e){return xe&&me.hasOwnProperty(xe)||(xe=/^\s*</.test(_e)?"default-markup":"default-code"),me[xe]}pe(Ee,["default-code"]),pe(ce([],[[o,/^[^<?]+/],[S,/^<!\w[^>]*(?:>|$)/],[C,/^<\!--[\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(ce([[o,/^[\s]+/,null,` \r
|
|
`],[B,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[T,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[P,/^(?!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(ce([],[[B,/^[\s\S]+/]]),["uq.val"]),pe(De({keywords:x,hashComments:!0,cStyleComments:!0,types:f}),["c","cc","cpp","cxx","cyc","m"]),pe(De({keywords:"null,true,false"}),["json"]),pe(De({keywords:w,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:f}),["cs"]),pe(De({keywords:M,cStyleComments:!0}),["java"]),pe(De({keywords:h,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),pe(De({keywords:a,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),pe(De({keywords:u,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),pe(De({keywords:l,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),pe(De({keywords:b,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),pe(De({keywords:E,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),pe(ce([],[[p,/^[\s\S]+/]]),["regex"]);function te(xe){var _e=xe.langExtension;try{var Ie=N(xe.sourceNode,xe.pre),We=Ie.sourceCode;xe.sourceCode=We,xe.spans=Ie.spans,xe.basePos=0,ue(_e,We)(xe),Te(xe)}catch(Fe){F.console&&console.log(Fe&&Fe.stack||Fe)}}function he(xe,_e,Ie){var We=Ie||!1,Fe=_e||null,Ne=document.createElement("div");Ne.innerHTML="<pre>"+xe+"</pre>",Ne=Ne.firstChild,We&&Ce(Ne,We,!0);var Ue={langExtension:Fe,numberLines:We,sourceNode:Ne,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return te(Ue),Ne.innerHTML}function ae(xe,_e){var Ie=_e||document.body,We=Ie.ownerDocument||document;function Fe(ve){return Ie.getElementsByTagName(ve)}for(var Ne=[Fe("pre"),Fe("code"),Fe("xmp")],Ue=[],et=0;et<Ne.length;++et)for(var ot=0,nt=Ne[et].length;ot<nt;++ot)Ue.push(Ne[et][ot]);Ne=null;var qe=Date;qe.now||(qe={now:function(){return+new Date}});var st=0,$e=/\blang(?:uage)?-([\w.]+)(?!\S)/,Qe=/\bprettyprint\b/,Me=/\bprettyprinted\b/,ut=/pre|xmp/i,lt=/^code$/i,Be=/^(?:pre|code|xmp)$/i,Ke={};function Se(){for(var ve=F.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,de=(le===7||le===8)&&ie.nodeValue;if(de?!/^\??prettify\b/.test(de):le!==3||/\S/.test(ie.nodeValue))break;if(de){re={},de.replace(/\b(\w+)=([\w:.%+-]+)/g,function(Lt,Ze,or){re[Ze]=or});break}}var ke=be.className;if((re!==Ke||Qe.test(ke))&&!Me.test(ke)){for(var Pe=!1,Xe=be.parentNode;Xe;Xe=Xe.parentNode){var vt=Xe.tagName;if(Be.test(vt)&&Xe.className&&Qe.test(Xe.className)){Pe=!0;break}}if(!Pe){be.className+=" prettyprinted";var Dt=re.lang;if(!Dt){Dt=ke.match($e);var Ge;!Dt&&(Ge=oe(be))&<.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=ke.match(/\blinenums\b(?::(\d+))?/),pt=pt?pt[1]&&pt[1].length?+pt[1]:!0:!1),pt&&Ce(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?F.setTimeout(Se,250):typeof xe=="function"&&xe()}Se()}var we=F.PR={createSimpleLexer:ce,registerLangHandler:pe,sourceDecorator:De,PR_ATTRIB_NAME:P,PR_ATTRIB_VALUE:B,PR_COMMENT:C,PR_DECLARATION:S,PR_KEYWORD:D,PR_LITERAL:v,PR_NOCODE:W,PR_PLAIN:o,PR_PUNCTUATION:d,PR_SOURCE:y,PR_STRING:p,PR_TAG:T,PR_TYPE:m,prettyPrintOne:R?F.prettyPrintOne=he:O=he,prettyPrint:j=R?F.prettyPrint=ae:j=ae},Le=F.define;typeof Le=="function"&&Le.amd&&Le("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"),F=se("tJVT"),_=se("B9cy"),A=se("Ol7k"),c=se("lUTK"),x=se("BvKs"),M=se("WmNS"),w=se.n(M),E=se("q1tI"),b=se.n(E),u=se("m3rI"),a=se("p0QG"),l=se.n(a),h=se("ErOA"),L=se("9kvl"),f=se("RCxd"),p=se("xGfz"),D=se("xKgJ"),C=se("5NDa"),m=se("5rEg");function v(me){var pe=me.user,ue=me.CategoryId,te=me.IsShow,he=me.setIsShow,ae=me.dispatch,we=me.init,Le=Object(E.useState)(),xe=Object(F.a)(Le,2),_e=xe[0],Ie=xe[1];return b.a.createElement(Q.a,{title:ue?"\u65B0\u5EFA\u4E09\u7EA7\u7C7B\u76EE":"\u65B0\u5EFA\u4E8C\u7EA7\u7C7B\u76EE",width:424,onCancel:function(){he(!1)},onOk:Object(j.a)(w.a.mark(function We(){var Fe;return w.a.wrap(function(Ue){for(;;)switch(Ue.prev=Ue.next){case 0:if(_e){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:_e,parent_id:ue}});case 5:Fe=Ue.sent,Fe.status===0&&(O.b.info("\u521B\u5EFA\u6210\u529F"),he(!1),Ie(""),we());case 7:case"end":return Ue.stop()}},We)})),visible:te},b.a.createElement(m.a,{value:_e,onChange:function(Fe){return Ie(Fe.target.value)},placeholder:"\u8BF7\u8F93\u5165\u4E0D\u8D85\u8FC710\u4E2A\u6C49\u5B57\u7684\u540D\u79F0",maxLength:10}))}var d=Object(L.a)(function(me){var pe=me.user;return{user:pe}})(v);function o(me){var pe=me.user,ue=me.CategoryId,te=me.name,he=me.IsShow,ae=me.setIsShow,we=me.dispatch,Le=me.init,xe=Object(E.useState)(),_e=Object(F.a)(xe,2),Ie=_e[0],We=_e[1];return Object(E.useEffect)(function(){We(te)},[te]),b.a.createElement(Q.a,{title:"\u76EE\u5F55\u91CD\u547D\u540D",width:424,onCancel:function(){ae(!1)},onOk:Object(j.a)(w.a.mark(function Fe(){var Ne;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:Ne=et.sent,Ne.status===0&&(O.b.info("\u4FEE\u6539\u6210\u529F"),ae(!1),We(""),Le());case 7:case"end":return et.stop()}},Fe)})),visible:he},b.a.createElement(m.a,{value:Ie,onChange:function(Ne){return We(Ne.target.value)},placeholder:"\u8BF7\u8F93\u5165\u4E0D\u8D85\u8FC710\u4E2A\u6C49\u5B57\u7684\u540D\u79F0",maxLength:10}))}var T=Object(L.a)(function(me){var pe=me.user;return{user:pe}})(o),S=se("+L6B"),y=se("2/Rp"),P=se("9Bee");function B(me){var pe,ue,te,he,ae=me.user,we=me.ItemData,Le=me.setIssee,xe=me.dispatch,_e=me.init;return b.a.createElement("div",null,b.a.createElement("div",{style:{textAlign:"right"}},Object(D.v)()&&b.a.createElement(y.a,{onClick:function(){return Le(!1)}},"\u7F16\u8F91")),b.a.createElement(P.a,{value:we.content}),(we==null||((pe=we.attachment)===null||pe===void 0)?void 0:pe.id)&&b.a.createElement("div",null,b.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},b.a.createElement("i",{style:{color:"#29BD8B"},className:"font-14 color-green iconfont icon-fujian mr8"}),b.a.createElement("span",{style:{color:"#000000"}},we==null||((he=we.attachment)===null||he===void 0)?void 0:he.title))))}var W=Object(L.a)(function(me){var pe=me.user;return{user:pe}})(B),V=se("DZo9"),I=se("8z0m"),N=se("Ot1p"),X=se("hJwl");function ee(me){var pe=me.user,ue=me.ItemData,te=me.setIssee,he=me.CategoryId,ae=me.dispatch,we=me.init,Le=Object(E.useState)([]),xe=Object(F.a)(Le,2),_e=xe[0],Ie=xe[1],We=Object(E.useState)(ue.content),Fe=Object(F.a)(We,2),Ne=Fe[0],Ue=Fe[1];function et(){var $e,Qe=[];return ue==null||(($e=ue.attachments)===null||$e===void 0)||$e.map(function(Me){var ut={uid:Me==null?void 0:Me.id,name:Me.title,response:{id:Me.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 Me=Qe.file.status;Me!=="uploading",Me==="removed"&&Ie(Qe.fileList),Me==="done"?(Ie(Qe.fileList),O.b.success("".concat(Qe.file.name," \u6587\u4EF6\u4E0A\u4F20\u6210\u529F"))):Me==="error"&&O.b.error("".concat(Qe.file.name," \u6587\u4EF6\u4E0A\u4F20\u5931\u8D25"))},beforeUpload:function(Qe){var Me=Qe.size/1024/1024<150;return Me||O.b.info("\u6587\u4EF6\u5927\u5C0F\u5FC5\u987B\u5C0F\u4E8E150MB"),Me}};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(he,"/update_content.json"),{method:"put",body:{id:he,content:Ne,attachment_id:st(_e)}});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(Me){Qe=Me.response.id}),Qe}return b.a.createElement("div",null,b.a.createElement(N.a,{defaultValue:Ne,onChange:function(Qe){return Ue(Qe)}}),b.a.createElement(I.a,ot,b.a.createElement(y.a,{className:"uploadBtn"},"\u4E0A\u4F20\u9644\u4EF6"),"(\u5355\u4E2A\u6587\u4EF6150M\u4EE5\u5185)"),b.a.createElement("p",{style:{marginTop:"10px"}},b.a.createElement(y.a,{style:{width:"90px"},onClick:function(){return nt()}},"\u63D0\u4EA4"),b.a.createElement(y.a,{style:{marginLeft:"30px",width:"90px"},type:"primary",onClick:function(){return te(!0)}},"\u53D6\u6D88")))}var oe=Object(L.a)(function(me){var pe=me.user;return{user:pe}})(ee),ce=x.a.SubMenu,De=A.a.Content,Ee=A.a.Sider;function Ce(me){var pe,ue=me.user,te=me.dispatch,he=me.globalSetting,ae=Object(E.useState)(),we=Object(F.a)(ae,2),Le=we[0],xe=we[1],_e=Object(E.useState)(!1),Ie=Object(F.a)(_e,2),We=Ie[0],Fe=Ie[1],Ne=Object(E.useState)(),Ue=Object(F.a)(Ne,2),et=Ue[0],ot=Ue[1],nt=Object(E.useState)(),qe=Object(F.a)(nt,2),st=qe[0],$e=qe[1],Qe=Object(E.useState)(!1),Me=Object(F.a)(Qe,2),ut=Me[0],lt=Me[1],Be=Object(E.useState)(""),Ke=Object(F.a)(Be,2),Se=Ke[0],ve=Ke[1],be=Object(E.useState)(""),re=Object(F.a)(be,2),ie=re[0],le=re[1],de=Object(E.useState)(!0),ke=Object(F.a)(de,2),Pe=ke[0],Xe=ke[1];Object(E.useEffect)(function(){vt()},[]),console.log("globalSetting",he);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,or){var Qt;return w.a.wrap(function(Xt){for(;;)switch(Xt.prev=Xt.next){case 0:Xt.t0=Lt,Xt.next=Xt.t0===1?3:Xt.t0===2?6:Xt.t0===3?10:Xt.t0===4?15:17;break;case 3:return $e(Ze==null?void 0:Ze.id),Fe(!0),Xt.abrupt("break",17);case 6:return $e(Ze==null?void 0:Ze.id),lt(!0),ve(Ze==null?void 0:Ze.name),Xt.abrupt("break",17);case 10:return Xt.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 Qt=Xt.sent,Qt.status===0&&vt(),Xt.abrupt("break",17);case 15:return Et(b.a.createElement("p",null,"\u5220\u9664\u4E4B\u540E\u4E0D\u80FD\u6062\u590D,",b.a.createElement("br",null),"\u662F\u5426\u786E\u8BA4\u5220\u9664?"),Object(j.a)(w.a.mark(function hr(){var ir;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:ir=Ar.sent,ir.status===0&&(O.b.info("\u5220\u9664\u6210\u529F"),vt());case 4:case"end":return Ar.stop()}},hr)}))),Xt.abrupt("break",17);case 17:case"end":return Xt.stop()}},At)}));return function(Lt,Ze,or){return pt.apply(this,arguments)}}(),Et=function(At,Lt){Q.a.confirm({centered:!0,title:"\u63D0\u793A",icon:b.a.createElement(f.a,null),content:At,okText:"\u786E\u8BA4",onOk:function(){return Lt()},cancelText:"\u53D6\u6D88"})},ft=function(At,Lt){return b.a.createElement("div",{className:l.a.leftMenuActions},Lt===1&&b.a.createElement("p",{className:"current",onClick:function(){return Ge(1,At,Lt)}},"\u65B0\u5EFA"),b.a.createElement("p",{className:"current",onClick:function(){return Ge(2,At,Lt)}},"\u91CD\u547D\u540D"),b.a.createElement("p",{className:"current",onClick:function(){return Ge(3,At,Lt)}},"\u7F6E\u9876"),b.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 b.a.createElement("div",{style:{marginBottom:"40px"}},b.a.createElement("img",{style:{width:"100%"},src:u.a.IMG_SERVER+"/".concat(he==null||((pe=he.setting)===null||pe===void 0)?void 0:pe.shixun_banner_url)}),b.a.createElement("div",{className:"edu-container minH500",style:{display:"flex",width:"1200px"}},b.a.createElement(Ee,{width:244,className:l.a.leftMenus,style:{background:"none",marginTop:"20px",height:"auto"}},b.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 b.a.createElement(ce,{title:b.a.createElement("span",{className:"font16"},b.a.createElement("span",null,pt.name),!Object(D.v)()&&b.a.createElement("span",null),Object(D.v)()&&b.a.createElement($.a,{placement:"right",content:function(){return ft(pt,1)},trigger:"hover"},b.a.createElement("span",{className:["iconfont icon-sandian",l.a.actions].join(" ")})))},pt==null||((Lt=pt.children)===null||Lt===void 0)?void 0:Lt.map(function(Ze,or){return b.a.createElement(x.a.Item,{className:l.a===null||l.a===void 0?void 0:l.a.SubMentItem,onClick:function(){$e(Ze==null?void 0:Ze.id),st=Ze==null?void 0:Ze.id,it()}},b.a.createElement("span",{style:{flex:"1"}},Ze==null?void 0:Ze.name),Object(D.v)()&&b.a.createElement($.a,{placement:"right",content:function(){return ft(Ze,2)},trigger:"hover"},b.a.createElement("span",{className:["iconfont icon-sandian",l.a.actions].join(" ")})))}))}else return b.a.createElement(x.a.Item,{className:l.a===null||l.a===void 0?void 0:l.a.SubMentItem,onClick:function(){$e(pt==null?void 0:pt.id),st=pt==null?void 0:pt.id,it()}},b.a.createElement("span",{style:{flex:"1"}},pt==null?void 0:pt.name),Object(D.v)()&&b.a.createElement($.a,{placement:"right",content:function(){return ft(pt,1)},trigger:"hover"},b.a.createElement("span",{className:["iconfont icon-sandian",l.a.actions].join(" ")})))}),b.a.createElement(x.a.Item,{onClick:function(){$e(""),st="",Fe(!0)},style:{color:"#0152d9",fontSize:"16px",height:"40px",display:"flex",alignItems:"center"},icon:b.a.createElement(p.a,{style:{color:"#0152d9",fontSize:"16px"}})},"\u65B0\u589E\u4E8C\u7EA7\u7C7B\u76EE"))),b.a.createElement("div",{style:{width:"937px",marginLeft:"17px",background:"#fff",padding:"20px"}},Pe&&b.a.createElement(W,{ItemData:ie,setIssee:Xe}),Pe===!1&&b.a.createElement(oe,{ItemData:ie,setIssee:Xe,CategoryId:st}))),b.a.createElement(d,{CategoryId:st,IsShow:We,setIsShow:Fe,init:vt}),b.a.createElement(T,{CategoryId:st,name:Se,IsShow:ut,setIsShow:lt,init:vt}))}var Te=at.default=Object(L.a)(function(me){var pe=me.user,ue=me.globalSetting;return{user:pe,globalSetting:ue}})(Ce)},"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,F=j&&(Q?document.documentMode||6:+(O||U)[1]),_=!O&&/WebKit\//.test(ne),A=_&&/Qt\/\d+\.\d+/.test(ne),c=!O&&/Chrome\//.test(ne),x=/Opera\//.test(ne),M=/Apple Computer/.test(navigator.vendor),w=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(ne),E=/PhantomJS/.test(ne),b=!O&&/AppleWebKit/.test(ne)&&/Mobile\/\w+/.test(ne),u=/Android/.test(ne),a=b||u||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(ne),l=b||/Mac/.test($),h=/\bCrOS\b/.test(ne),L=/win/i.test($),f=x&&ne.match(/Version\/(\d*\.\d*)/);f&&(f=Number(f[1])),f&&f>=15&&(x=!1,_=!0);var p=l&&(A||x&&(f==null||f<12.11)),D=R||j&&F>=9;function C(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var m=function(e,t){var i=e.className,r=C(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 k=0;k<t.length;++k)n.appendChild(t[k]);return n}function T(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 P(){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 B(e,t){var i=e.className;C(t).test(i)||(e.className+=(i?" ":"")+t)}function W(e,t){for(var i=e.split(" "),r=0;r<i.length;r++)i[r]&&!C(i[r]).test(t)&&(t+=" "+i[r]);return t}var V=function(e){e.select()};b?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 N(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 k=r||0,H=n||0;;){var Y=e.indexOf(" ",k);if(Y<0||Y>=t)return H+(t-k);H+=Y-k,H+=i-H%i,k=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 ce=50,De={toString:function(){return"CodeMirror.Pass"}},Ee={scroll:!1},Ce={origin:"*mouse"},Te={origin:"+move"};function me(e,t,i){for(var r=0,n=0;;){var k=e.indexOf(" ",r);k==-1&&(k=e.length);var H=k-r;if(k==e.length||n+H>=t)return r+Math.min(H,t-n);if(n+=k-r,n+=i-n%i,r=k+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 he(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 Le(e,t){var i;return Object.create?i=Object.create(e):(we.prototype=e,i=new we),t&&N(t,i),i}var xe=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function _e(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||xe.test(e))}function Ie(e,t){return t?t.source.indexOf("\\w")>-1&&_e(e)?!0:t.test(e):_e(e)}function We(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var Fe=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function Ne(e){return e.charCodeAt(0)>=768&&Fe.test(e)}function Ue(e,t,i){for(;(i<0?t>0:t<e.length)&&Ne(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,k=r<0?Math.ceil(n):Math.floor(n);if(k==t)return e(k)?t:i;e(k)?i=k:t=k+r}}function ot(e,t,i,r){if(!e)return r(t,i,"ltr",0);for(var n=!1,k=0;k<e.length;++k){var H=e[k];(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",k),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 k=e[n];if(k.from<t&&k.to>t)return n;k.to==t&&(k.from!=k.to&&i=="before"?r=n:nt=n),k.from==t&&(k.from!=k.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]/,k=/[LRr]/,H=/[Lb1n]/,Y=/[1n]/;function Z(q,fe,ge){this.level=q,this.from=fe,this.to=ge}return function(q,fe){var ge=fe=="ltr"?"L":"R";if(q.length==0||fe=="ltr"&&!r.test(q))return!1;for(var Re=q.length,Ae=[],je=0;je<Re;++je)Ae.push(i(q.charCodeAt(je)));for(var Ve=0,Je=ge;Ve<Re;++Ve){var tt=Ae[Ve];tt=="m"?Ae[Ve]=Je:Je=tt}for(var ht=0,rt=ge;ht<Re;++ht){var ct=Ae[ht];ct=="1"&&rt=="r"?Ae[ht]="n":k.test(ct)&&(rt=ct,ct=="r"&&(Ae[ht]="R"))}for(var Ct=1,xt=Ae[0];Ct<Re-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<Re;++$t){var mr=Ae[$t];if(mr==",")Ae[$t]="N";else if(mr=="%"){var qt=void 0;for(qt=$t+1;qt<Re&&Ae[qt]=="%";++qt);for(var Fr=$t&&Ae[$t-1]=="!"||qt<Re&&Ae[qt]=="1"?"1":"N",_r=$t;_r<qt;++_r)Ae[_r]=Fr;$t=qt-1}}for(var nr=0,Mr=ge;nr<Re;++nr){var xr=Ae[nr];Mr=="L"&&xr=="1"?Ae[nr]="L":k.test(xr)&&(Mr=xr)}for(var ur=0;ur<Re;++ur)if(n.test(Ae[ur])){var ar=void 0;for(ar=ur+1;ar<Re&&n.test(Ae[ar]);++ar);for(var er=(ur?Ae[ur-1]:ge)=="L",Pr=(ar<Re?Ae[ar]:ge)=="L",dn=er==Pr?er?"L":"R":ge,Di=ur;Di<ar;++Di)Ae[Di]=dn;ur=ar-1}for(var Sr=[],si,gr=0;gr<Re;)if(H.test(Ae[gr])){var Ya=gr;for(++gr;gr<Re&&H.test(Ae[gr]);++gr);Sr.push(new Z(0,Ya,gr))}else{var mi=gr,Gi=Sr.length,zi=fe=="rtl"?1:0;for(++gr;gr<Re&&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 fe=="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,Re-si[0].length,Re)))),fe=="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=[],Me=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 k=oe(n,i);k>-1&&(r[t]=n.slice(0,k).concat(n.slice(k+1)))}}}function Be(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}}),Be(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){Me(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 de(e){re(e),ie(e)}function ke(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)),l&&e.ctrlKey&&t==1&&(t=3),t}var Xe=function(){if(j&&F<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&&F<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 k=e.slice(t,e.charAt(n-1)=="\r"?n-1:n),H=k.indexOf("\r");H!=-1?(i.push(k.slice(0,H)),t+=H+1):(i.push(k),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 or(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Lt[e]=t}function Qt(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=Le(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 Xt(e,t){t=yt(t);var i=Lt[t.name];if(!i)return Xt(e,"text/plain");var r=i(e,t);if(hr.hasOwnProperty(t.name)){var n=hr[t.name];for(var k in n){if(!n.hasOwnProperty(k))continue;r.hasOwnProperty(k)&&(r["_"+k]=r[k]),r[k]=n[k]}}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 hr={};function ir(e,t){var i=hr.hasOwnProperty(e)?hr[e]:hr[e]={};N(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 k=this.string.slice(this.pos).match(e);return k&&k.index>0?null:(k&&t!==!1&&(this.pos+=k[0].length),k)}},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],k=n.chunkSize();if(t<k){i=n;break}t-=k}return i.lines[t]}function jr(e,t,i){var r=[],n=t.line;return e.iter(t.line,i.line+1,function(k){var H=k.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],k=n.height;if(t<k){e=n;continue e}t-=k,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 s(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):g(t,gt(e,t.line).text.length)}function g(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]=s(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],k={};Hr(e,t.text,e.doc.mode,i,function(q,fe){return n.push(q,fe)},k,r);for(var H=i.state,Y=function(q){i.baseTokens=n;var fe=e.state.overlays[q],ge=1,Re=0;i.state=!0,Hr(e,t.text,fe.mode,i,function(Ae,je){for(var Ve=ge;Re<Ae;){var Je=n[ge];Je>Ae&&n.splice(ge,1,Ae,n[ge+1],Je),ge+=2,Re=Math.min(Ae,Je)}if(!je)return;if(fe.opaque)n.splice(Ve,ge-Ve,Ae,"overlay "+je),ge=Ve+2;else for(;Ve<ge;Ve+=2){var tt=n[Ve+1];n[Ve+1]=(tt?tt+" ":"")+"overlay "+je}},k),i.state=H,i.baseTokens=null,i.baseTokenPos=1},Z=0;Z<e.state.overlays.length;++Z)Y(Z);return{styles:n,classes:k.bgClass||k.textClass?k: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),k=ye(e,t,r);n&&(r.state=n),t.stateAfter=r.save(!n),t.styles=k.styles,k.classes?t.styleClasses=k.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 k=dr(e,t,i),H=k>r.first&>(r,k-1).stateAfter,Y=H?z.fromSaved(r,H,k):new z(r,Vr(r.mode),k);return r.iter(k,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,k=new Bt(t,e.options.tabSize,i);for(k.start=k.pos=r||0,t==""&&ze(n,i.state);!k.eol();)wt(n,k,i.state),k.start=k.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 k=e.token(t,i);if(t.pos>t.start)return k}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 Ht(e,t,i,r){var n=e.doc,k=n.mode,H;t=s(n,t);var Y=gt(n,t.line),Z=Oe(e,t.line,i),q=new Bt(Y.text,e.options.tabSize,Z),fe;for(r&&(fe=[]);(r||q.pos<t.ch)&&!q.eol();)q.start=q.pos,H=wt(k,q,Z.state),r&&fe.push(new Nt(q,H,Cr(n.mode,Z.state)));return r?fe: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,k,H){var Y=i.flattenSpans;Y==null&&(Y=e.options.flattenSpans);var Z=0,q=null,fe=new Bt(t,e.options.tabSize,r),ge,Re=e.options.addModeClass&&[null];for(t==""&&Wr(ze(i,r.state),k);!fe.eol();){if(fe.pos>e.options.maxHighlightLength?(Y=!1,H&&mt(e,t,r,fe.pos),fe.pos=t.length,ge=null):ge=Wr(wt(i,fe,r.state,Re),k),Re){var Ae=Re[0].name;Ae&&(ge="m-"+(ge?Ae+" "+ge:Ae))}if(!Y||q!=ge){for(;Z<fe.start;)Z=Math.min(fe.start,Z+5e3),n(Z,q);q=ge}fe.start=fe.pos}for(;Z<fe.pos;){var je=Math.min(fe.pos,Z+5e3);n(je,q),Z=je}}function dr(e,t,i){for(var r,n,k=e.doc,H=i?-1:t-(e.doc.mode.innerMode?1e3:100),Y=t;Y>H;--Y){if(Y<=k.first)return k.first;var Z=gt(k,Y-1),q=Z.stateAfter;if(q&&(!i||Y+(q instanceof J?q.lookAhead:0)<=k.modeFrontier))return Y;var fe=X(Z.text,null,e.options.tabSize);(n==null||r>fe)&&(n=Y-1,r=fe)}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 k=e[n],H=k.marker,Y=k.from==null||(H.inclusiveLeft?k.from<=t:k.from<t);if(Y||k.from==t&&H.type=="bookmark"&&(!i||!k.marker.insertLeft)){var Z=k.to==null||(H.inclusiveRight?k.to>=t:k.to>t);(r||(r=[])).push(new vi(H,k.from,Z?null:k.to))}}return r}function Vi(e,t,i){var r;if(e)for(var n=0;n<e.length;++n){var k=e[n],H=k.marker,Y=k.to==null||(H.inclusiveRight?k.to>=t:k.to>t);if(Y||k.from==t&&H.type=="bookmark"&&(!i||k.marker.insertLeft)){var Z=k.from==null||(H.inclusiveLeft?k.from<=t:k.from<t);(r||(r=[])).push(new vi(H,Z?null:k.from-t,k.to==null?null:k.to-t))}}return r}function Ir(e,t){if(t.full)return null;var i=ui(e,t.from.line)&>(e,t.from.line).markedSpans,r=ui(e,t.to.line)&>(e,t.to.line).markedSpans;if(!i&&!r)return null;var n=t.from.ch,k=t.to.ch,H=Tt(t.from,t.to)==0,Y=fn(i,n,H),Z=Vi(r,k,H),q=t.text.length==1,fe=te(t.text).length+(q?n:0);if(Y)for(var ge=0;ge<Y.length;++ge){var Re=Y[ge];if(Re.to==null){var Ae=Qr(Z,Re.marker);Ae?q&&(Re.to=Ae.to==null?null:Ae.to+fe):Re.to=n}}if(Z)for(var je=0;je<Z.length;++je){var Ve=Z[je];if(Ve.to!=null&&(Ve.to+=fe),Ve.from==null){var Je=Qr(Y,Ve.marker);Je||(Ve.from=fe,q&&(Y||(Y=[])).push(Ve))}else Ve.from+=fe,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 je=0;je<Ae.markedSpans.length;++je){var Ve=Ae.markedSpans[je].marker;Ve.readOnly&&(!r||oe(r,Ve)==-1)&&(r||(r=[])).push(Ve)}}),!r)return null;for(var n=[{from:t,to:i}],k=0;k<r.length;++k)for(var H=r[k],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 fe=[Z,1],ge=Tt(q.from,Y.from),Re=Tt(q.to,Y.to);(ge<0||!H.inclusiveLeft&&!ge)&&fe.push({from:q.from,to:Y.from}),(Re>0||!H.inclusiveRight&&!Re)&&fe.push({from:Y.to,to:q.to}),n.splice.apply(n,fe),Z+=fe.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(),k=Tt(r.from,n.from)||tr(e)-tr(t);if(k)return-k;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,k=0;k<i.length;++k)n=i[k],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 k=i[n];k.marker.collapsed&&(k.from==null||k.from<t)&&(k.to==null||k.to>t)&&(!r||vr(r,k.marker)<0)&&(r=k.marker)}return r}function sr(e,t,i,r,n){var k=gt(e,t),H=kr&&k.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),fe=Tt(q.from,i)||tr(Z.marker)-tr(n),ge=Tt(q.to,r)||Ft(Z.marker)-Ft(n);if(fe>=0&&ge<=0||fe<=0&&ge>=0)continue;if(fe<=0&&(Z.marker.inclusiveRight&&n.inclusiveLeft?Tt(q.to,i)>=0:Tt(q.to,i)>0)||fe>=0&&(Z.marker.inclusiveRight&&n.inclusiveLeft?Tt(q.from,r)<=0:Tt(q.from,r)<0))return!0}}function lr(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=lr(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,k=0;k<t.markedSpans.length;++k)if(n=t.markedSpans[k],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=lr(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 k=i.parent;k;i=k,k=i.parent)for(var H=0;H<k.children.length;++H){var Y=k.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 k=i.find(0,!0);t-=r.text.length-k.from.ch,r=k.to.line,t+=r.text.length-k.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=T("span",null,null,_?"padding-right: .1px":null),r={pre:T("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 k=n?t.rest[n-1]:t.line,H=void 0;r.pos=0,r.addToken=kt,Et(e.display.measure)&&(H=$e(k,e.doc.direction))&&(r.addToken=_t(r.addToken,H)),r.map=[];var Y=t!=e.display.externalMeasured&&Pt(k);Gt(k,r,He(e,k,Y)),k.styleClasses&&(k.styleClasses.bgClass&&(r.bgClass=W(k.styleClasses.bgClass,r.bgClass||"")),k.styleClasses.textClass&&(r.textClass=W(k.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 Be(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,k,H){if(!t)return;var Y=e.splitSpaces?St(t,e.trailingSpace):t,Z=e.cm.state.specialChars,q=!1,fe;if(!Z.test(t))e.col+=t.length,fe=document.createTextNode(Y),e.map.push(e.pos,e.pos+t.length,fe),j&&F<9&&(q=!0),e.pos+=t.length;else{fe=document.createDocumentFragment();for(var ge=0;;){Z.lastIndex=ge;var Re=Z.exec(t),Ae=Re?Re.index-ge:t.length-ge;if(Ae){var je=document.createTextNode(Y.slice(ge,ge+Ae));j&&F<9?fe.appendChild(o("span",[je])):fe.appendChild(je),e.map.push(e.pos,e.pos+Ae,je),e.col+=Ae,e.pos+=Ae}if(!Re)break;ge+=Ae+1;var Ve=void 0;if(Re[0]==" "){var Je=e.cm.options.tabSize,tt=Je-e.col%Je;Ve=fe.appendChild(o("span",ue(tt),"cm-tab")),Ve.setAttribute("role","presentation"),Ve.setAttribute("cm-text"," "),e.col+=tt}else Re[0]=="\r"||Re[0]==`
|
|
`?(Ve=fe.appendChild(o("span",Re[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Ve.setAttribute("cm-text",Re[0]),e.col+=1):(Ve=e.cm.options.specialCharPlaceholder(Re[0]),Ve.setAttribute("cm-text",Re[0]),j&&F<9?fe.appendChild(o("span",[Ve])):fe.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||k||H){var ht=i||"";r&&(ht+=r),n&&(ht+=n);var rt=o("span",[fe],ht,k);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(fe)}function St(e,t){if(e.length>1&&!/ /.test(e))return e;for(var i=t,r="",n=0;n<e.length;n++){var k=e.charAt(n);k==" "&&i&&(n==e.length-1||e.charCodeAt(n+1)==32)&&(k="\xA0"),r+=k,i=k==" "}return r}function _t(e,t){return function(i,r,n,k,H,Y,Z){n=n?n+" cm-force-border":"cm-force-border";for(var q=i.pos,fe=q+r.length;;){for(var ge=void 0,Re=0;Re<t.length&&!(ge=t[Re],ge.to>q&&ge.from<=q);Re++);if(ge.to>=fe)return e(i,r,n,k,H,Y,Z);e(i,r.slice(0,ge.to-q),n,k,null,Y,Z),k=null,r=r.slice(ge.to-q),q=ge.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 Gt(e,t,i){var r=e.markedSpans,n=e.text,k=0;if(!r){for(var H=1;H<i.length;H+=2)t.addToken(t,n.slice(k,k=i[H]),da(i[H+1],t.cm.options));return}for(var Y=n.length,Z=0,q=1,fe="",ge,Re,Ae=0,je,Ve,Je,tt,ht;;){if(Ae==Z){je=Ve=Je=Re="",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&&(je+=" "+Ot.className),Ot.css&&(Re=(Re?Re+";":"")+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(fe){var _r=Z+fe.length;if(!tt){var nr=_r>Fr?fe.slice(0,Fr-Z):fe;t.addToken(t,nr,ge?ge+je:je,Je,Z+nr.length==Ae?Ve:"",Re,ht)}if(_r>=Fr){fe=fe.slice(Fr-Z),Z=Fr;break}Z=_r,Je=""}fe=n.slice(k,k=i[q++]),ge=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,k=t;k<i;k=n){var H=new It(e.doc,gt(e.doc,k),k);n=k+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 zt(e,t){var i=e.ownsGroup;if(!i)return;try{Pi(i)}finally{cr=null,t(i)}}var br=null;function Vt(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 k=function(Y){n.push(function(){return i[Y].apply(null,r)})},H=0;H<i.length;++H)k(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 k=t.changes[n];k=="text"?Ps(e,t):k=="gutter"?qa(e,t,i,r):k=="class"?ca(e,t):k=="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&&F<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 k=t.line.gutterMarkers;if(e.options.lineNumbers||k){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&&(!k||!k["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"))),k)for(var Z=0;Z<e.display.gutterSpecs.length;++Z){var q=e.display.gutterSpecs[Z].className,fe=k.hasOwnProperty(q)&&k[q];fe&&Y.appendChild(o("div",[fe],"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=C("CodeMirror-linewidget"),n=t.node.firstChild,k=void 0;n;n=k)k=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 k=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?k.insertBefore(q,i.gutter||i.text):k.appendChild(q),Vt(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=ke(t);i!=e.wrapper;i=i.parentNode)if(!i||i.nodeType==1&&i.getAttribute("cm-ignore-events")=="true"||i.parentNode==e.sizer&&i!=e.mover)return!0}function 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 ce-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 k=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&&k.push((Z.bottom+q.top)/2-i.top)}}k.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=lr(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 k=i+(r||""),H;return t.cache.hasOwnProperty(k)?H=t.cache[k]:(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[k]=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,k,H,Y,Z,q=0;q<e.length;q+=3)if(Y=e[q],Z=e[q+1],t<Y?(n=0,k=1,H="left"):t<Z?(n=t-Y,k=n+1):(q==e.length-3||t==Z&&e[q+3]>t)&&(k=Z-Y,n=k-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:k,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),k=n.node,H=n.start,Y=n.end,Z=n.collapse,q;if(k.nodeType==3){for(var fe=0;fe<4;fe++){for(;H&&Ne(t.line.text.charAt(n.coverStart+H));)--H;for(;n.coverStart+Y<n.coverEnd&&Ne(t.line.text.charAt(n.coverStart+Y));)++Y;if(j&&F<9&&H==0&&Y==n.coverEnd-n.coverStart?q=k.parentNode.getBoundingClientRect():q=js(S(k,H,Y).getClientRects(),r),q.left||q.right||H==0)break;Y=H,H=H-1,Z="right"}j&&F<11&&(q=Hs(e.display.measure,q))}else{H>0&&(Z=r="right");var ge;e.options.lineWrapping&&(ge=k.getClientRects()).length>1?q=ge[r=="right"?ge.length-1:0]:q=k.getBoundingClientRect()}if(j&&F<9&&!H&&(!q||!q.left&&!q.right)){var Re=k.parentNode.getClientRects()[0];Re?q={left:Re.left,right:Re.left+Zi(e.display),top:Re.top,bottom:Re.bottom}:q=ao}for(var Ae=q.top-t.rect.top,je=q.bottom-t.rect.top,Ve=(Ae+je)/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=je),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 c&&u?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function ho(){return c&&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 k=ga(t);i.top+=k,i.bottom+=k}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 k=e.display.sizer.getBoundingClientRect();r+=k.left,n+=k.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,k){r=r||gt(e.doc,t.line),n||(n=$i(e,r));function H(je,Ve){var Je=oi(e,n,je,Ve?"right":"left",k);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 fe(je,Ve,Je){var tt=Y[Ve],ht=tt.level==1;return H(Je?je-1:je,ht!=Je)}var ge=qe(Y,Z,q),Re=nt,Ae=fe(Z,ge,q=="before");return Re!=null&&(Ae.other=fe(Z,Re,q!="before")),Ae}function fo(e,t){var i=0;t=s(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 k=Ye(e,t,i);return k.xRel=n,r&&(k.outside=r),k}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),k=r.first+r.size-1;if(n>k)return ya(r.first+r.size-1,gt(r,k).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,k=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},k,n),{begin:k,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 k=$i(e,t),H=ga(t),Y=0,Z=t.text.length,q=!0,fe=$e(t,e.doc.direction);if(fe){var ge=(e.options.lineWrapping?Ks:zs)(e,t,i,k,fe,r,n);q=ge.level!=1,Y=q?ge.from:ge.to-1,Z=q?ge.to:ge.from-1}var Re=null,Ae=null,je=et(function(Ct){var xt=oi(e,k,Ct);return xt.top+=H,xt.bottom+=H,xa(xt,r,n,!1)?(xt.top<=n&&xt.left<=r&&(Re=Ct,Ae=xt),!0):!1},Y,Z),Ve,Je,tt=!1;if(Ae){var ht=r-Ae.left<Ae.right-r,rt=ht==q;je=Re+(rt?0:1),Je=rt?"after":"before",Ve=ht?Ae.left:Ae.right}else{!q&&(je==Z||je==Y)&&je++,Je=je==0?"after":je==t.text.length?"before":oi(e,k,je-(q?1:0)).bottom+H<=n==q?"after":"before";var ct=Jr(e,Ye(i,je,Je),"line",t,k);Ve=ct.left,tt=n<ct.top?-1:n>=ct.bottom?1:0}return je=Ue(t.text,je,1),ya(i,je,Je,tt,r-Ve)}function zs(e,t,i,r,n,k,H){var Y=et(function(ge){var Re=n[ge],Ae=Re.level!=1;return xa(Jr(e,Ye(i,Ae?Re.to:Re.from,Ae?"before":"after"),"line",t,r),k,H,!0)},0,n.length-1),Z=n[Y];if(Y>0){var q=Z.level!=1,fe=Jr(e,Ye(i,q?Z.from:Z.to,q?"after":"before"),"line",t,r);xa(fe,k,H,!0)&&fe.top>H&&(Z=n[Y-1])}return Z}function Ks(e,t,i,r,n,k,H){var Y=po(e,t,r,H),Z=Y.begin,q=Y.end;/\s/.test(t.text.charAt(q-1))&&q--;for(var fe=null,ge=null,Re=0;Re<n.length;Re++){var Ae=n[Re];if(Ae.from>=q||Ae.to<=Z)continue;var je=Ae.level!=1,Ve=oi(e,r,je?Math.min(q,Ae.to)-1:Math.max(Z,Ae.from)).right,Je=Ve<k?k-Ve+1e9:Ve-k;(!fe||ge>Je)&&(fe=Ae,ge=Je)}return fe||(fe=n[n.length-1]),fe.from<Z&&(fe={from:Z,to:fe.to,level:fe.level}),fe.to>q&&(fe={from:fe.from,to:q,level:fe.level}),fe}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,k=t.gutters.firstChild,H=0;k;k=k.nextSibling,++H){var Y=e.display.gutterSpecs[H].className;i[Y]=k.offsetLeft+k.clientLeft+n,r[Y]=k.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 k=0;if(n.widgets)for(var H=0;H<n.widgets.length;H++)n.widgets[H].height&&(k+=n.widgets[H].height);return i?k+(Math.ceil(n.text.length/r)||1)*t:k+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&&ke(t).getAttribute("cm-not-content")=="true")return null;var k,H,Y=n.lineSpace.getBoundingClientRect();try{k=t.clientX-Y.left,H=t.clientY-Y.top}catch(ge){return null}var Z=ba(e,k,H),q;if(r&&Z.xRel>0&&(q=gt(e.doc,Z.line).text).length==Z.ch){var fe=X(q,q.length,e.options.tabSize)-q.length;Z=Ye(Z.line,Math.max(0,Math.round((k-ro(e.display).left)/Zi(e.display))-fe))}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 k=Gn(e,i,i+r,1);k?(n.view=n.view.slice(k.index),n.viewFrom=k.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 k=r.view[Ui(e,t)];if(k.node==null)return;var H=k.changes||(k.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),k,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;k=Y+H[n].size-t,n++}else k=Y-t;t+=k,i+=k}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(),k=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,k)}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 k=i.appendChild(o("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));k.style.display="",k.style.left=r.other.left+"px",k.style.top=r.other.top+"px",k.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,k=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 fe(rt,ct,Ct,xt){ct<0&&(ct=0),ct=Math.round(ct),xt=Math.round(xt),k.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 ge(rt,ct,Ct){var xt=gt(n,rt),Ot=xt.text.length,$t,mr;function qt(nr,Mr){return va(e,Ye(rt,nr),"div",xt,Mr)}function Fr(nr,Mr,xr){var ur=mo(e,xt,null,nr),ar=Mr=="ltr"==(xr=="after")?"left":"right",er=xr=="after"?ur.begin:ur.end-(/\s/.test(xt.text.charAt(ur.end-1))?2:1);return qt(er,ar)[ar]}var _r=$e(xt,n.direction);return ot(_r,ct||0,Ct==null?Ot:Ct,function(nr,Mr,xr,ur){var ar=xr=="ltr",er=qt(nr,ar?"left":"right"),Pr=qt(Mr-1,ar?"right":"left"),dn=ct==null&&nr==0,Di=Ct==null&&Mr==Ot,Sr=ur==0,si=!_r||ur==_r.length-1;if(Pr.top-er.top<=3){var gr=(q?dn:Di)&&Sr,Ya=(q?Di:dn)&&si,mi=gr?Y:(ar?er:Pr).left,Gi=Ya?Z:(ar?Pr:er).right;fe(mi,er.top,Gi-mi,er.bottom)}else{var zi,wr,cn,$a;ar?(zi=q&&dn&&Sr?Y:er.left,wr=q?Z:Fr(nr,xr,"before"),cn=q?Y:Fr(Mr,xr,"after"),$a=q&&Di&&si?Z:Pr.right):(zi=q?Fr(nr,xr,"before"):Y,wr=!q&&dn&&Sr?Z:er.right,cn=!q&&Di&&si?Y:Pr.left,$a=q?Fr(Mr,xr,"after"):Z),fe(zi,er.top,wr-zi,er.bottom),er.bottom<Pr.top&&fe(Y,er.bottom,null,Pr.top),fe(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 Re=t.from(),Ae=t.to();if(Re.line==Ae.line)ge(Re.line,Re.ch,Ae.ch);else{var je=gt(n,Re.line),Ve=gt(n,Ae.line),Je=lr(je)==lr(Ve),tt=ge(Re.line,Re.ch,Je?je.text.length+1:null).end,ht=ge(Ae.line,Je?0:null,Ae.ch).start;Je&&(tt.top<ht.top-2?(fe(tt.right,tt.top,null,tt.bottom),fe(Y,ht.top,ht.left,ht.bottom)):fe(tt.right,tt.top,ht.left-tt.right,tt.bottom)),tt.bottom<ht.top&&fe(Y,tt.bottom,null,ht.top)}i.appendChild(k)}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||(Be(e,"focus",e,t),e.state.focused=!0,B(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&&(Be(e,"blur",e,t),e.state.focused=!1,m(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function Kn(e){for(var t=e.display,i=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var n=t.view[r],k=e.options.lineWrapping,H=void 0,Y=0;if(n.hidden)continue;if(j&&F<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,!k&&n.text.firstChild&&(Y=n.text.firstChild.getBoundingClientRect().right-q.left-1)}var fe=n.line.height-H;if((fe>.005||fe<-.005)&&(Lr(n.line,H),So(n.line),n.rest))for(var ge=0;ge<n.rest.length;ge++)So(n.rest[ge]);if(Y>e.display.sizerWidth){var Re=Math.ceil(Y/Zi(e.display));Re>e.display.maxLineLength&&(e.display.maxLineLength=Re,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,k=Xr(t,r),H=Xr(t,n);if(i&&i.ensure){var Y=i.ensure.from.line,Z=i.ensure.to.line;Y<k?(k=Y,H=Xr(t,Br(gt(t,Y))+e.wrapper.clientHeight)):Math.min(Z,t.lastLine())>=H&&(k=Xr(t,Br(gt(t,Z))-e.wrapper.clientHeight),H=Z)}return{from:k,to:Math.max(H,k+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 k=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(k),k.scrollIntoView(n),e.display.lineSpace.removeChild(k)}}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 k=0;k<5;k++){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),fe=e.doc.scrollTop,ge=e.doc.scrollLeft;if(q.scrollTop!=null&&(xn(e,q.scrollTop),Math.abs(e.doc.scrollTop-fe)>1&&(H=!0)),q.scrollLeft!=null&&(Fi(e,q.scrollLeft),Math.abs(e.doc.scrollLeft-ge)>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,k=pa(e),H={};t.bottom-t.top>k&&(t.bottom=t.top+k);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+k){var fe=Math.min(t.top,(q?Y:t.bottom)-k);fe!=n&&(H.scrollTop=fe)}var ge=e.options.fixedGutter?0:i.gutters.offsetWidth,Re=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:i.scroller.scrollLeft-ge,Ae=Ii(e)-i.gutters.offsetWidth,je=t.right-t.left>Ae;return je&&(t.right=t.left+Ae),t.left<10?H.scrollLeft=0:t.left<Re?H.scrollLeft=Math.max(0,t.left+ge-(je?0:10)):t.right>Ae+Re-3&&(H.scrollLeft=t.right+(je?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),Me(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),Me(n,"scroll",function(){n.clientWidth&&t(n.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,j&&F<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 k=e.viewWidth-e.barLeft-(i?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+k)+"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=l&&!w?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new ee,this.disableVert=new ee},ji.prototype.enableZeroWidthBar=function(e,t,i){e.style.pointerEvents="auto";function r(){var n=e.getBoundingClientRect(),k=i=="vert"?document.elementFromPoint(n.right-1,(n.top+n.bottom)/2):document.elementFromPoint((n.right+n.left)/2,n.bottom-1);k!=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&&m(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),Me(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&&B(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&&zt(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 k=0;k<t.length;k++)il(t[k]);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==P();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,s(r,e.scrollToPos.from),s(r,e.scrollToPos.to),e.scrollToPos.margin);Ys(t,n)}var k=e.maybeHiddenMarkers,H=e.maybeUnhiddenMarkers;if(k)for(var Y=0;Y<k.length;++Y)k[Y].lines.length||Be(k[Y],"hide");if(H)for(var Z=0;Z<H.length;++Z)H[Z].lines.length&&Be(H[Z],"unhide");i.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Be(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function 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(k){if(r.line>=e.display.viewFrom){var H=k.styles,Y=k.text.length>e.options.maxHighlightLength?Cr(t.mode,r.state):null,Z=ye(e,k,r,!0);Y&&(r.state=Y),k.styles=Z.styles;var q=k.styleClasses,fe=Z.classes;fe?k.styleClasses=fe:q&&(k.styleClasses=null);for(var ge=!H||H.length!=k.styles.length||q!=fe&&(!q||!fe||q.bgClass!=fe.bgClass||q.textClass!=fe.textClass),Re=0;!ge&&Re<H.length;++Re)ge=H[Re]!=k.styles[Re];ge&&n.push(r.line),k.stateAfter=r.save(),r.nextLine()}else k.text.length<=e.options.maxHighlightLength&&mt(e,k.text,r),k.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 k=0;k<n.length;k++)Si(e,n[k],"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++)Be.apply(null,this.events[e])};function ol(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=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=P();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==P())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,k=Math.max(t.visible.from-e.options.viewportMargin,r.first),H=Math.min(n,t.visible.to+e.options.viewportMargin);i.viewFrom<k&&k-i.viewFrom<20&&(k=Math.max(r.first,i.viewFrom)),i.viewTo>H&&i.viewTo-H<20&&(H=Math.min(n,i.viewTo)),kr&&(k=xi(e.doc,k),H=Fn(e.doc,H));var Y=k!=i.viewFrom||H!=i.viewTo||i.lastWrapHeight!=t.wrapperHeight||i.lastWrapWidth!=t.wrapperWidth;Vs(e,k,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,k=r.lineDiv,H=k.firstChild;function Y(je){var Ve=je.nextSibling;return _&&l&&e.display.currentWheelTarget==je?je.style.display="none":je.parentNode.removeChild(je),Ve}for(var Z=r.view,q=r.viewFrom,fe=0;fe<Z.length;fe++){var ge=Z[fe];if(!ge.hidden)if(!ge.node||ge.node.parentNode!=k){var Re=Ns(e,ge,q,i);k.insertBefore(Re,H)}else{for(;H!=ge.node;)H=Y(H);var Ae=n&&t!=null&&t<=q&&ge.lineNumber;ge.changes&&(oe(ge.changes,"gutter")>-1&&(Ae=!1),pn(e,ge,q,i)),Ae&&(v(ge.lineNumber),ge.lineNumber.appendChild(document.createTextNode(gi(e.options,q)))),H=ge.node.nextSibling}q+=ge.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,k=r+"px",H=0;H<i.length;H++)if(!i[H].hidden){e.options.fixedGutter&&(i[H].gutter&&(i[H].gutter.style.left=k),i[H].gutterBackground&&(i[H].gutterBackground.style.left=k));var Y=i[H].alignable;if(Y)for(var Z=0;Z<Y.length;Z++)Y[Z].style.left=k}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")),k=n.firstChild.offsetWidth,H=n.offsetWidth-k;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(k,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 k=e[n],H=null;if(typeof k!="string"&&(H=k.style,k=k.className),k=="CodeMirror-linenumbers")if(t)r=!0;else continue;i.push({className:k,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],k=n.className,H=n.style,Y=t.appendChild(o("div",null,"CodeMirror-gutter "+k));H&&(Y.style.cssText=H),k=="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=T("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=T("div",[n.measure,n.lineMeasure,n.selectionDiv,n.cursorDiv,n.lineDiv],null,"position: relative; outline: none");var k=T("div",[n.lineSpace],"CodeMirror-lines");n.mover=o("div",[k],null,"position: relative"),n.sizer=o("div",[n.mover],"CodeMirror-sizer"),n.sizerWidth=null,n.heightForcer=o("div",null,null,"position: absolute; height: "+ce+"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&&F<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:c?zr=-.7:M&&(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,k=e.display,H=k.scroller,Y=H.scrollWidth>H.clientWidth,Z=H.scrollHeight>H.clientHeight;if(!(r&&Y||n&&Z))return;if(n&&l&&_){e:for(var q=t.target,fe=k.view;q!=H;q=q.parentNode)for(var ge=0;ge<fe.length;ge++)if(fe[ge].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),k.wheelStartX=null;return}if(n&&zr!=null){var Re=n*zr,Ae=e.doc.scrollTop,je=Ae+k.wrapper.clientHeight;Re<0?Ae=Math.max(0,Ae+Re-50):je=Math.min(e.doc.height,je+Re+50),Da(e,{top:Ae,bottom:je})}$n<20&&(k.wheelStartX==null?(k.wheelStartX=H.scrollLeft,k.wheelStartY=H.scrollTop,k.wheelDX=r,k.wheelDY=n,setTimeout(function(){if(k.wheelStartX==null)return;var Ve=H.scrollLeft-k.wheelStartX,Je=H.scrollTop-k.wheelStartY,tt=Je&&k.wheelDY&&Je/k.wheelDY||Ve&&k.wheelDX&&Ve/k.wheelDX;if(k.wheelStartX=k.wheelStartY=null,!tt)return;zr=(zr*$n+tt)/($n+1),++$n},200)):(k.wheelDX+=r,k.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 Wt(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 Wt=function(e,t){this.anchor=e,this.head=t};Wt.prototype.from=function(){return Ri(this.anchor,this.head)},Wt.prototype.to=function(){return di(this.anchor,this.head)},Wt.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(Re,Ae){return Tt(Re.from(),Ae.from())}),i=oe(t,n);for(var k=1;k<t.length;k++){var H=t[k],Y=t[k-1],Z=Tt(Y.to(),H.from());if(r&&!H.empty()?Z>0:Z>=0){var q=Ri(Y.from(),H.from()),fe=di(Y.to(),H.to()),ge=Y.empty()?H.from()==H.head:Y.from()==Y.head;k<=i&&--i,t.splice(--k,2,new Wt(ge?fe:q,ge?q:fe))}}return new Kr(t,i)}function Ti(e,t){return new Kr([new Wt(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 Wt(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),k=n,H=0;H<t.length;H++){var Y=t[H],Z=Io(Y.from,n,k),q=Io(wi(Y),n,k);if(n=Y.to,k=q,i=="around"){var fe=e.sel.ranges[H],ge=Tt(fe.head,fe.anchor)<0;r[H]=new Wt(ge?q:Z,ge?Z:q)}else r[H]=new Wt(Z,Z)}return new Kr(r,e.sel.primIndex)}function Pa(e){e.doc.mode=Xt(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 k(ht,rt,ct){ua(ht,rt,ct,r),Vt(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,fe=gt(e,Y.line),ge=gt(e,Z.line),Re=te(q),Ae=n(q.length-1),je=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);k(ge,ge.text,Ae),je&&e.remove(Y.line,je),Ve.length&&e.insert(Y.line,Ve)}else if(fe==ge)if(q.length==1)k(fe,fe.text.slice(0,Y.ch)+Re+fe.text.slice(Z.ch),Ae);else{var Je=H(1,q.length-1);Je.push(new Ei(Re+fe.text.slice(Z.ch),Ae,r)),k(fe,fe.text.slice(0,Y.ch)+q[0],n(0)),e.insert(Y.line+1,Je)}else if(q.length==1)k(fe,fe.text.slice(0,Y.ch)+q[0]+ge.text.slice(Z.ch),n(0)),e.remove(Y.line+1,je);else{k(fe,fe.text.slice(0,Y.ch)+q[0],n(0)),k(ge,Re+ge.text.slice(Z.ch),Ae);var tt=H(1,q.length-1);je>1&&e.remove(Y.line+1,je-1),e.insert(Y.line+1,tt)}Vt(e,"change",e,t)}function Ai(e,t,i){function r(n,k,H){if(n.linked)for(var Y=0;Y<n.linked.length;++Y){var Z=n.linked[Y];if(Z.doc==k)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"?B:m)(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 k=+new Date,H,Y;if((n.lastOp==r||n.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&n.lastModTime>k-(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=k,n.lastOp=n.lastSelOp=r,n.lastOrigin=n.lastSelOrigin=t.origin,Y||Be(e,"historyAdded")}function ml(e,t,i,r){var n=t.charAt(0);return n=="*"||n=="+"&&i.ranges.length==r.ranges.length&&i.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function gl(e,t,i,r){var n=e.history,k=r&&r.origin;i==n.lastSelOp||k&&n.lastSelOrigin==k&&(n.lastModTime==n.lastSelTime&&n.lastOrigin==k||ml(e,k,te(n.done),t))?n.done[n.done.length-1]=t:Zn(t,n.done),n.lastSelTime=+new Date,n.lastSelOrigin=k,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],k=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]={}))[k]=H.markedSpans),++k})}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 k=i[n],H=r[n];if(k&&H){e:for(var Y=0;Y<H.length;++Y){for(var Z=H[Y],q=0;q<k.length;++q)if(k[q].marker==Z.marker)continue e;k.push(Z)}}else H&&(i[n]=H)}return i}function tn(e,t,i){for(var r=[],n=0;n<e.length;++n){var k=e[n];if(k.ranges){r.push(i?Kr.prototype.deepCopy.call(k):k);continue}var H=k.changes,Y=[];r.push({changes:Y});for(var Z=0;Z<H.length;++Z){var q=H[Z],fe=void 0;if(Y.push({from:q.from,to:q.to,text:q.text}),t)for(var ge in q)(fe=ge.match(/^spans_(\d+)$/))&&(oe(t,Number(fe[1]))>-1&&(te(Y)[ge]=q[ge],delete q[ge]))}}return r}function Ba(e,t,i,r){if(r){var n=e.anchor;if(i){var k=Tt(t,n)<0;k!=Tt(i,n)<0?(n=t,t=i):k!=Tt(t,i)<0&&(t=i)}return new Wt(n,t)}else return new Wt(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),k=0;k<e.sel.ranges.length;k++)r[k]=Ba(e.sel.ranges[k],t[k],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 k=0;k<n.length;k++)this.ranges[k]=new Wt(s(e,n[k].anchor),s(e,n[k].head))},origin:i&&i.origin};return Be(e,"beforeSelectionChange",e,r),e.cm&&Be(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)),Vt(e,"cursorActivity",e)}function Xo(e){Vo(e,Yo(e,e.sel,null,!1))}function Yo(e,t,i,r){for(var n,k=0;k<t.ranges.length;k++){var H=t.ranges[k],Y=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[k],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,k)),n[k]=new Wt(Z,q))}return n?qr(e.cm,n,t.primIndex):t}function rn(e,t,i,r,n){var k=gt(e,t.line);if(k.markedSpans)for(var H=0;H<k.markedSpans.length;++H){var Y=k.markedSpans[H],Z=Y.marker,q="selectLeft"in Z?!Z.selectLeft:Z.inclusiveLeft,fe="selectRight"in Z?!Z.selectRight:Z.inclusiveRight;if((Y.from==null||(q?Y.from<=t.ch:Y.from<t.ch))&&(Y.to==null||(fe?Y.to>=t.ch:Y.to>t.ch))){if(n&&(Be(Z,"beforeCursorEnter"),Z.explicitlyCleared))if(k.markedSpans){--H;continue}else break;if(!Z.atomic)continue;if(i){var ge=Z.find(r<0?1:-1),Re=void 0;if((r<0?fe:q)&&(ge=$o(e,ge,-r,ge&&ge.line==t.line?k:null)),ge&&ge.line==t.line&&(Re=Tt(ge,i))&&(r<0?Re<0:Re>0))return rn(e,ge,t,r,n)}var Ae=Z.find(r<0?-1:1);return(r<0?q:fe)&&(Ae=$o(e,Ae,r,Ae.line==t.line?k:null)),Ae?rn(e,Ae,t,r,n):null}}return t}function ea(e,t,i,r,n){var k=r||1,H=rn(e,t,i,k,n)||!n&&rn(e,t,i,k,!0)||rn(e,t,i,-k,n)||!n&&rn(e,t,i,-k,!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?s(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()),Ee)}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,k,H,Y){n&&(r.from=s(e,n)),k&&(r.to=s(e,k)),H&&(r.text=H),Y!==void 0&&(r.origin=Y)}),Be(e,"beforeChange",e,r),e.cm&&Be(e.cm,"beforeChange",e.cm,r),r.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:r.from,to:r.to,text:r.text,origin:r.origin}}function 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,k){!k&&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,k,H=e.sel,Y=t=="undo"?n.done:n.undone,Z=t=="undo"?n.undone:n.done,q=0;q<Y.length&&!(k=Y[q],i?k.ranges&&!k.equals(e.sel):!k.ranges);q++);if(q==Y.length)return;for(n.lastOrigin=n.lastSelOrigin=null;;)if(k=Y.pop(),k.ranges){if(Zn(k,Z),i&&!k.equals(e.sel)){Er(e,k,{clearRedo:!1});return}H=k}else if(r){Y.push(k);return}else break;var fe=[];Zn(H,Z),Z.push({changes:fe,generation:n.generation}),n.generation=k.generation||++n.maxGeneration;for(var ge=ve(e,"beforeChange")||e.cm&&ve(e.cm,"beforeChange"),Re=function(Ve){var Je=k.changes[Ve];if(Je.origin=t,ge&&!Zo(e,Je,!1))return Y.length=0,{};fe.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=k.changes.length-1;Ae>=0;--Ae){var je=Re(Ae);if(je)return je.v}}function qo(e,t){if(t==0)return;if(e.first+=t,e.sel=new Kr(he(e.sel.ranges,function(n){return new Wt(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 k=e.lastLine();t.to.line>k&&(t={from:t.from,to:Ye(k,gt(e,k).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,Ee),e.cantEdit&&ea(e,Ye(e.firstLine(),0))&&(e.cantEdit=!1)}function xl(e,t,i){var r=e.doc,n=e.display,k=t.from,H=t.to,Y=!1,Z=k.line;e.options.lineWrapping||(Z=Pt(lr(gt(r,k.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,k.line+t.text.length,function(Ae){var je=Yi(Ae);je>n.maxLineLength&&(n.maxLine=Ae,n.maxLineLength=je,n.maxLineChanged=!0,Y=!1)}),Y&&(e.curOp.updateMaxLine=!0)),Yr(r,k.line),Cn(e,400);var q=t.text.length-(H.line-k.line)-1;t.full?Rr(e):k.line==H.line&&t.text.length==1&&!No(e.doc,t)?Si(e,k.line,"text"):Rr(e,k.line,H.line+1,q);var fe=ve(e,"changes"),ge=ve(e,"change");if(ge||fe){var Re={from:k,to:H,text:t.text,removed:t.removed,origin:t.origin};ge&&Vt(e,"change",e,Re),fe&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(Re)}e.display.selForContextMenu=null}function an(e,t,i,r,n){var k;r||(r=i),Tt(r,i)<0&&(k=[r,i],i=k[0],r=k[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 k=e[n],H=!0;if(k.ranges){k.copied||(k=e[n]=k.deepCopy(),k.copied=!0);for(var Y=0;Y<k.ranges.length;Y++)es(k.ranges[Y].anchor,t,i,r),es(k.ranges[Y].head,t,i,r);continue}for(var Z=0;Z<k.changes.length;++Z){var q=k.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,k=t;return typeof t=="number"?k=gt(e,K(e,t)):n=Pt(t),n==null?null:(r(k,n)&&e.cm&&Si(e.cm,n,i),k)}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),Vt(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 k=Math.min(t,n-e),H=r.height;if(r.removeInner(e,k),this.height-=H-r.height,n==k&&(this.children.splice(i--,1),r.parent=null),(t-=k)==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],k=n.chunkSize();if(e<=k){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-=k}},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],k=n.chunkSize();if(e<k){var H=Math.min(t,k-e);if(n.iterN(e,H,i))return!0;if((t-=H)==0)break;e=0}else e-=k}}};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 k=gn(this);Lr(i,Math.max(0,i.height-k)),e&&(Ur(e,function(){is(e,i,-k),Si(e,r,"widget")}),Vt(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),Vt(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),k=e.cm;return k&&n.noHScroll&&(k.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,k&&!Zr(e,H)){var Z=Br(H)<e.scrollTop;Lr(H,H.height+gn(n)),Z&&La(k,n.height),k.curOp.forceUpdate=!0}return!0}),k&&Vt(k,"lineWidgetAdded",k,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&&Vt(this,"clear",i.from,i.to)}for(var r=null,n=null,k=0;k<this.lines.length;++k){var H=this.lines[k],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=lr(this.lines[Z]),fe=Yi(q);fe>e.display.maxLineLength&&(e.display.maxLine=q,e.display.maxLineLength=fe,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&&Vt(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 k=this.lines[n],H=Qr(k.markedSpans,this);if(H.from!=null&&(i=Ye(t?k:Pt(k),H.from),e==-1))return i;if(H.to!=null&&(r=Ye(t?k:Pt(k),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,k=Pt(t.line),H=ma(r,k);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)}Vt(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 k=new Li(e,n),H=Tt(t,i);if(r&&N(r,k,!1),H>0||H==0&&k.clearWhenEmpty!==!1)return k;if(k.replacedWith&&(k.collapsed=!0,k.widgetNode=T("span",[k.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||k.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(k.widgetNode.insertLeft=!0)),k.collapsed){if(sr(e,t.line,t,i,k)||t.line!=i.line&&sr(e,i.line,t,i,k))throw new Error("Inserting collapsed marker partially overlapping an existing one");ri()}k.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(ge){Z&&k.collapsed&&!Z.options.lineWrapping&&lr(ge)==Z.display.maxLine&&(q=!0),k.collapsed&&Y!=t.line&&Lr(ge,0),Gr(ge,new vi(k,Y==t.line?t.ch:null,Y==i.line?i.ch:null)),++Y}),k.collapsed&&e.iter(t.line,i.line+1,function(ge){Zr(e,ge)&&Lr(ge,0)}),k.clearOnEnter&&Me(k,"beforeCursorEnter",function(){return k.clear()}),k.readOnly&&(Dr(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),k.collapsed&&(k.id=++ns,k.atomic=!0),Z){if(q&&(Z.curOp.updateMaxLine=!0),k.collapsed)Rr(Z,t.line,i.line+1);else if(k.className||k.startStyle||k.endStyle||k.css||k.attributes||k.title)for(var fe=t.line;fe<=i.line;fe++)Si(Z,fe,"text");k.atomic&&Xo(Z.doc),Vt(Z,"markerAdded",Z,k)}return k}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();Vt(this,"clear")},On.prototype.find=function(e,t){return this.primary.find(e,t)},be(On);function Sl(e,t,i,r,n){r=N(r),r.shared=!1;var k=[on(e,t,i,r,n)],H=k[0],Y=r.widgetNode;return Ai(e,function(Z){Y&&(r.widgetNode=Y.cloneNode(!0)),k.push(on(Z,s(Z,t),s(Z,i),r,n));for(var q=0;q<Z.linked.length;++q)if(Z.linked[q].isParent)return;H=te(k)}),new On(k,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(),k=e.clipPos(n.from),H=e.clipPos(n.to);if(Tt(k,H)){var Y=on(e,k,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],k=[n.primary.doc];Ai(n.primary.doc,function(Z){return k.push(Z)});for(var H=0;H<n.markers.length;H++){var Y=n.markers[H];oe(k,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 k=Ye(i,0);this.sel=Ti(k),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:k,to:k,text:e}),Er(this,Ti(k),Ee)};Or.prototype=Le(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),Ee)}),replaceRange:function(e,t,i,r){t=s(this,t),i=i?s(this,i):t,an(this,e,t,i,r)},getRange:function(e,t,i){var r=jr(this,s(this,e),s(this,t));return i===!1?r:r.join(i||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(ui(this,e))return gt(this,e)},getLineNumber:function(e){return Pt(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=gt(this,e)),lr(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return s(this,e)},getCursor:function(e){var t=this.sel.primary(),i;return e==null||e=="head"?i=t.head:e=="anchor"?i=t.anchor:e=="end"||e=="to"||e===!1?i=t.to():i=t.from(),i},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:pr(function(e,t,i){zo(this,s(this,typeof e=="number"?Ye(e,t||0):e),null,i)}),setSelection:pr(function(e,t,i){zo(this,s(this,e),s(this,t||e),i)}),extendSelection:pr(function(e,t,i){Jn(this,s(this,e),t&&s(this,t),i)}),extendSelections:pr(function(e,t){Go(this,G(this,e),t)}),extendSelectionsBy:pr(function(e,t){var i=he(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 Wt(s(this,e[n].anchor),s(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 Wt(s(this,e),s(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,k=0;k<n.ranges.length;k++){var H=n.ranges[k];r[k]={from:H.from(),to:H.to(),text:this.splitLines(e[k]),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(C(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",k=r[n];if(k)if(i==null)r[n]=null;else{var H=k.match(C(i));if(!H)return!1;var Y=H.index+H[0].length;r[n]=k.slice(0,H.index)+(!H.index||Y==k.length?"":" ")+k.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,s(this,e),s(this,t),i,i&&i.type||"range")},setBookmark:function(e,t){var i={replacedWith:t&&(t.nodeType==null?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=s(this,e),on(this,e,e,i,"bookmark")},findMarksAt:function(e){e=s(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=s(this,e),t=s(this,t);var r=[],n=e.line;return this.iter(e.line,t.line+1,function(k){var H=k.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 k=n.text.length+r;if(k>e)return t=e,!0;e-=k,++i}),s(this,Ye(i,t))},indexFromPos:function(e){e=s(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var i=this.lineSeparator().length;return this.iter(this.first,e.line,function(r){t+=r.text.length+i}),t},copy:function(e){var t=new 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 Zt&&(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,k=Array(n),H=0,Y=function(){++H==n&&fr(t,function(){i=s(t.doc,i);var Ae={from:i,to:i,text:t.doc.splitLines(k.filter(function(je){return je!=null}).join(t.doc.lineSeparator())),origin:"paste"};nn(t.doc,Ae),Ko(t.doc,Ti(s(t.doc,i),s(t.doc,wi(Ae))))})()},Z=function(Ae,je){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}k[je]=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 fe=e.dataTransfer.getData("Text");if(fe){var ge;if(t.state.draggingText&&!t.state.draggingText.copy&&(ge=t.listSelections()),qn(t.doc,Ti(i,i)),ge)for(var Re=0;Re<ge.length;++Re)an(t.doc,"",ge[Re].anchor,ge[Re].head,"drag");t.replaceSelection(fe,"around","paste"),t.display.input.focus()}}catch(Ae){}}}function Ll(e,t){if(j&&(!e.state.draggingText||+new Date-os<100)){de(t);return}if(Ke(e,t)||fi(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!M){var i=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 k=0;k<i.length;k++)e(i[k])})}var us=!1;function Dl(){if(us)return;Rl(),us=!0}function Rl(){var e;Me(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,ls(Ol)},100))}),Me(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=l?pi.macDefault:pi.pcDefault;function _l(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var i,r,n,k,H=0;H<t.length-1;H++){var Y=t[H];if(/^(cmd|meta|m)$/i.test(Y))k=!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),k&&(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=he(i.split(" "),_l),k=0;k<n.length;k++){var H=void 0,Y=void 0;k==n.length-1?(Y=n.join(" "),H=r):(Y=n.slice(0,k+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 k=0;k<t.fallthrough.length;k++){var H=sn(e,t.fallthrough[k],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),(p?t.metaKey:t.ctrlKey)&&r!="Ctrl"&&(e="Ctrl-"+e),(p?t.ctrlKey:t.metaKey)&&r!="Mod"&&(e="Cmd-"+e),!i&&t.shiftKey&&r!="Shift"&&(e="Shift-"+e),e}function 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 k=t(i[n]);r.length&&Tt(k.from,te(r).to)<=0;){var H=r.pop();if(Tt(H.from,k.from)<0){k.from=H.from;break}}r.push(k)}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 k=$e(i,t.doc.direction);if(k){var H=n<0?te(k):k[0],Y=n<0==(H.level==1),Z=Y?"after":"before",q;if(H.level>0||t.doc.direction=="rtl"){var fe=$i(t,i);q=n<0?i.text.length-1:0;var ge=oi(t,fe,q).top;q=et(function(Re){return oi(t,fe,Re).top==ge},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 k=qe(n,i.ch,i.sticky),H=n[k];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}},fe=q(i.sticky=="before"?Y(i,-1):i.ch);if(e.doc.direction=="rtl"||H.level==1){var ge=H.level==1==r<0,Re=Y(i,ge?1:-1);if(Re!=null&&(ge?Re<=H.to&&Re<=fe.end:Re>=H.from&&Re>=fe.begin)){var Ae=ge?"before":"after";return new Ye(i.line,Re,Ae)}}var je=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=je(k+r,r,fe);if(Ve)return Ve;var Je=r>0?fe.end:Y(fe.begin,-1);return Je!=null&&!(r>0&&Je==t.text.length)&&(Ve=je(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"),Ee)},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:s(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")},Te)},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")},Te)},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},Te)},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 k=i[n].from(),H=X(e.getLine(k.line),k.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,k=gt(e.doc,n.line).text;if(k){if(n.ch==k.length&&(n=new Ye(n.line,n.ch-1)),n.ch>0)n=new Ye(n.line,n.ch+1),e.replaceRange(k.charAt(n.ch-1)+k.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(k.charAt(0)+e.doc.lineSeparator()+H.charAt(H.length-1),Ye(n.line-1,H.length-1),n,"+transpose"))}}i.push(new Wt(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=lr(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 k=Math.max(i.ch,r.text.search(/\S/)),H=t.line==i.line&&t.ch<=k&&t.ch;return Ye(i.line,H?0:k,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)!=De}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"&&Vt(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=P(),Ke(t,e))return;j&&F<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&&(l?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),R&&!l&&!r&&i==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),i==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Fl(t)}function Fl(e){var t=e.display.lineDiv;B(t,"CodeMirror-crosshair");function i(r){(r.keyCode==18||!r.altKey)&&(m(t,"CodeMirror-crosshair"),lt(document,"keyup",i),lt(document,"mouseover",i))}Me(document,"keyup",i),Me(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||l&&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),k=r?Wl(r,n):"single";if(window.focus(),n==1&&t.state.selectingText&&t.state.selectingText(e),r&&Hl(t,n,r,k,e))return;n==1?r?zl(t,r,k,e):ke(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 k="Click";return r=="double"?k="Double"+k:r=="triple"&&(k="Triple"+k),k=(t==1?"Left":t==2?"Middle":"Right")+k,In(e,ds(k,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)!=De}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 k=h?i.shiftKey&&i.metaKey:i.altKey;n.unit=k?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(n.extend==null||e.doc.extend)&&(n.extend=e.doc.extend||i.shiftKey),n.addNew==null&&(n.addNew=l?i.metaKey:i.ctrlKey),n.moveOnDrag==null&&(n.moveOnDrag=!(l?i.altKey:i.ctrlKey)),n}function zl(e,t,i,r){j?setTimeout(I(xo,e),0):e.curOp.focus=P();var n=Gl(e,i,r),k=e.doc.sel,H;e.options.dragDrop&&Xe&&!e.isReadOnly()&&i=="single"&&(H=k.contains(t))>-1&&(Tt((H=k.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,k=!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),k||(re(q),r.addNew||Jn(e.doc,i,null,null,r.extend),_&&!M||j&&F==9?setTimeout(function(){n.wrapper.ownerDocument.body.focus({preventScroll:!0}),n.input.focus()},20):n.input.focus())}),Y=function(q){k=k||Math.abs(t.clientX-q.clientX)+Math.abs(t.clientY-q.clientY)>=10},Z=function(){return k=!0};_&&(n.scroller.draggable=!0),e.state.draggingText=H,H.copy=!r.moveOnDrag,n.scroller.dragDrop&&n.scroller.dragDrop(),Me(n.wrapper.ownerDocument,"mouseup",H),Me(n.wrapper.ownerDocument,"mousemove",Y),Me(n.scroller,"dragstart",Z),Me(n.scroller,"drop",H),Eo(e),setTimeout(function(){return n.input.focus()},20)}function Es(e,t,i){if(i=="char")return new Wt(t,t);if(i=="word")return e.findWordAt(t);if(i=="line")return new Wt(Ye(t.line,0),s(e.doc,Ye(t.line+1,0)));var r=i(e,t);return new Wt(r.from,r.to)}function Vl(e,t,i,r){var n=e.display,k=e.doc;re(t);var H,Y,Z=k.sel,q=Z.ranges;if(r.addNew&&!r.extend?(Y=k.sel.contains(i),Y>-1?H=q[Y]:H=new Wt(i,i)):(H=k.sel.primary(),Y=k.sel.primIndex),r.unit=="rectangle")r.addNew||(H=new Wt(i,i)),i=Bi(e,t,!0,!0),Y=-1;else{var fe=Es(e,i,r.unit);r.extend?H=Ba(H,fe.anchor,fe.head,r.extend):H=fe}r.addNew?Y==-1?(Y=q.length,Er(k,qr(e,q.concat([H]),Y),{scroll:!1,origin:"*mouse"})):q.length>1&&q[Y].empty()&&r.unit=="char"&&!r.extend?(Er(k,qr(e,q.slice(0,Y).concat(q.slice(Y+1)),0),{scroll:!1,origin:"*mouse"}),Z=k.sel):Ua(k,Y,H,Ce):(Y=0,Er(k,new Kr([H],0),Ce),Z=k.sel);var ge=i;function Re(rt){if(Tt(ge,rt)==0)return;if(ge=rt,r.unit=="rectangle"){for(var ct=[],Ct=e.options.tabSize,xt=X(gt(k,i.line).text,i.ch,Ct),Ot=X(gt(k,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(k,qt).text,nr=me(_r,$t,Ct);$t==mr?ct.push(new Wt(Ye(qt,nr),Ye(qt,nr))):_r.length>nr&&ct.push(new Wt(Ye(qt,nr),Ye(qt,me(_r,mr,Ct))))}ct.length||ct.push(new Wt(i,i)),Er(k,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),ur=Mr.anchor,ar;Tt(xr.anchor,ur)>0?(ar=xr.head,ur=Ri(Mr.from(),xr.anchor)):(ar=xr.anchor,ur=di(Mr.to(),xr.head));var er=Z.ranges.slice(0);er[Y]=Xl(e,new Wt(s(k,ur),ar)),Er(k,qr(e,er,Y),Ce)}}var Ae=n.wrapper.getBoundingClientRect(),je=0;function Ve(rt){var ct=++je,Ct=Bi(e,rt,!0,r.unit=="rectangle");if(!Ct)return;if(Tt(Ct,ge)!=0){e.curOp.focus=P(),Re(Ct);var xt=Vn(n,k);(Ct.line>=xt.to||Ct.line<xt.from)&&setTimeout(fr(e,function(){je==ct&&Ve(rt)}),150)}else{var Ot=rt.clientY<Ae.top?-20:rt.clientY>Ae.bottom?20:0;Ot&&setTimeout(fr(e,function(){if(je!=ct)return;n.scroller.scrollTop+=Ot,Ve(rt)}),50)}}function Je(rt){e.state.selectingText=!1,je=Infinity,rt&&(re(rt),n.input.focus()),lt(n.wrapper.ownerDocument,"mousemove",tt),lt(n.wrapper.ownerDocument,"mouseup",ht),k.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,Me(n.wrapper.ownerDocument,"mousemove",tt),Me(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 k=$e(n);if(!k)return t;var H=qe(k,i.ch,i.sticky),Y=k[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==k.length)return t;var q;if(r.line!=i.line)q=(r.line-i.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var fe=qe(k,r.ch,r.sticky),ge=fe-H||(r.ch-i.ch)*(Y.level==1?-1:1);fe==Z-1||fe==Z?q=ge<0:q=ge>0}var Re=k[Z+(q?-1:0)],Ae=q==(Re.level==1),je=Ae?Re.from:Re.to,Ve=Ae?"after":"before";return i.ch==je&&i.sticky==Ve?t:new Wt(new Ye(i.line,je,Ve),r)}function Ss(e,t,i,r){var n,k;if(t.touches)n=t.touches[0].clientX,k=t.touches[0].clientY;else try{n=t.clientX,k=t.clientY}catch(Re){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(k>Y.bottom||!ve(e,i))return le(t);k-=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 fe=Xr(e.doc,k),ge=e.display.gutterSpecs[Z];return Be(e,i,e,fe,ge.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,k,H){e.defaults[r]=n,k&&(t[r]=H?function(Y,Z,q){q!=un&&k(Y,Z,q)}:k)}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 k=[],H=r.doc.first;r.doc.iter(function(Z){for(var q=0;;){var fe=Z.text.indexOf(n,q);if(fe==-1)break;q=fe+n.length,k.push(Ye(H,fe))}H++});for(var Y=k.length-1;Y>=0;Y--)an(r.doc,n,k[Y],Ye(k[Y].line,k[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,k){r.state.specialChars=new RegExp(n.source+(n.test(" ")?"":"| "),"g"),k!=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",!L),i("wholeLineUpdateBefore",!0),i("theme","default",function(r){Ts(r),Tn(r)},!0),i("keyMap","default",function(r,n,k){var H=ia(n),Y=k!=un&&ia(k);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,k=t?Me:lt;k(e.display.scroller,"dragstart",n.start),k(e.display.scroller,"dragenter",n.enter),k(e.display.scroller,"dragover",n.over),k(e.display.scroller,"dragleave",n.leave),k(e.display.scroller,"drop",n.drop)}}function Zl(e){e.options.lineWrapping?(B(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(m(e.display.wrapper,"CodeMirror-wrap"),ci(e)),Ca(e),Rr(e),vn(e),setTimeout(function(){return en(e)},100)}function Zt(e,t){var i=this;if(!(this instanceof Zt))return new Zt(e,t);this.options=t=t?N(t):{},N(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 Zt.inputStyles[t.inputStyle](this),k=this.display=new hl(e,r,n,t);k.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&&k.input.focus(),j&&F<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(k.lineDiv).textRendering=="optimizelegibility"&&(k.lineDiv.style.textRendering="auto")}Zt.defaults=ws,Zt.optionHandlers=aa;function Jl(e){var t=e.display;Me(t.scroller,"mousedown",fr(e,xs)),j&&F<11?Me(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 fe=e.findWordAt(q);Jn(e.doc,fe.anchor,fe.head)})):Me(t.scroller,"dblclick",function(Z){return Ke(e,Z)||re(Z)}),Me(t.scroller,"contextmenu",function(Z){return Cs(e,Z)}),Me(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 k(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 fe=q.left-Z.left,ge=q.top-Z.top;return fe*fe+ge*ge>20*20}Me(t.scroller,"touchstart",function(Z){if(!Ke(e,Z)&&!k(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)}}),Me(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Me(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 fe=e.coordsChar(t.activeTouch,"page"),ge;!q.prev||H(q,q.prev)?ge=new Wt(fe,fe):!q.prev.prev||H(q,q.prev.prev)?ge=e.findWordAt(fe):ge=new Wt(Ye(fe.line,0),s(e.doc,Ye(fe.line+1,0))),e.setSelection(ge.anchor,ge.head),e.focus(),re(Z)}n()}),Me(t.scroller,"touchcancel",n),Me(t.scroller,"scroll",function(){t.scroller.clientHeight&&(xn(e,t.scroller.scrollTop),Fi(e,t.scroller.scrollLeft,!0),Be(e,"scroll",e))}),Me(t.scroller,"mousewheel",function(Z){return Mo(e,Z)}),Me(t.scroller,"DOMMouseScroll",function(Z){return Mo(e,Z)}),Me(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(Z){Ke(e,Z)||de(Z)},over:function(Z){Ke(e,Z)||(kl(e,Z),de(Z))},start:function(Z){return Ll(e,Z)},drop:fr(e,Al),leave:function(Z){Ke(e,Z)||ss(e)}};var Y=t.input.getField();Me(Y,"keyup",function(Z){return ys.call(e,Z)}),Me(Y,"keydown",fr(e,vs)),Me(Y,"keypress",fr(e,bs)),Me(Y,"focus",function(Z){return wa(e,Z)}),Me(Y,"blur",function(Z){return Ji(e,Z)})}var Ka=[];Zt.defineInitHook=function(e){return Ka.push(e)};function Un(e,t,i,r){var n=e.doc,k;i==null&&(i="add"),i=="smart"&&(n.mode.indent?k=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],fe;if(!r&&!/\S/.test(Y.text))fe=0,i="not";else if(i=="smart"&&(fe=n.mode.indent(k,Y.text.slice(q.length),Y.text),fe==De||fe>150)){if(!r)return;i="prev"}i=="prev"?t>n.first?fe=X(gt(n,t-1).text,null,H):fe=0:i=="add"?fe=Z+e.options.indentUnit:i=="subtract"?fe=Z-e.options.indentUnit:typeof i=="number"&&(fe=Z+i),fe=Math.max(0,fe);var ge="",Re=0;if(e.options.indentWithTabs)for(var Ae=Math.floor(fe/H);Ae;--Ae)Re+=H,ge+=" ";if(Re<fe&&(ge+=ue(fe-Re)),ge!=q)return an(n,ge,Ye(t,0),Ye(t,q.length),"+input"),Y.stateAfter=null,!0;for(var je=0;je<n.sel.ranges.length;je++){var Ve=n.sel.ranges[je];if(Ve.head.line==t&&Ve.head.ch<q.length){var Je=Ye(t,q.length);Ua(n,je,new Wt(Je,Je));break}}}var ei=null;function oa(e){ei=e}function Va(e,t,i,r,n){var k=e.doc;e.display.shift=!1,r||(r=k.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 fe=0;fe<ei.text.length;fe++)q.push(k.splitLines(ei.text[fe]))}}else Z.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(q=he(Z,function(tt){return[tt]}));for(var ge=e.curOp.updateInput,Re=r.ranges.length-1;Re>=0;Re--){var Ae=r.ranges[Re],je=Ae.from(),Ve=Ae.to();Ae.empty()&&(i&&i>0?je=Ye(je.line,je.ch-i):e.state.overwrite&&!Y?Ve=Ye(Ve.line,Math.min(gt(k,Ve.line).text.length,Ve.ch+te(Z).length)):Y&&ei&&ei.lineWise&&ei.text.join(`
|
|
`)==Z.join(`
|
|
`)&&(je=Ve=Ye(je.line,0)));var Je={from:je,to:Ve,text:q?q[Re%q.length]:Z,origin:n||(Y?"paste":e.state.cutIncoming>H?"cut":"+input")};nn(e.doc,Je),Vt(e,"inputRead",e,Je)}t&&!Y&&Ls(e,t),qi(e),e.curOp.updateInput<2&&(e.curOp.updateInput=ge),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 k=e.getModeAt(n.head),H=!1;if(k.electricChars){for(var Y=0;Y<k.electricChars.length;Y++)if(t.indexOf(k.electricChars.charAt(Y))>-1){H=Un(e,n.head.line,"smart");break}}else k.electricInput&&(k.electricInput.test(gt(e.doc,n.head.line).text.slice(0,n.head.ch))&&(H=Un(e,n.head.line,"smart")));H&&Vt(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,k={anchor:Ye(n,0),head:Ye(n+1,0)};i.push(k),t.push(e.getRange(k.anchor,k.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"),b&&(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 k=this.options,H=k[r];if(k[r]==n&&r!="mode")return;k[r]=n,t.hasOwnProperty(r)&&fr(this,t[r])(this,n,H),Be(this,"optionChange",this,r)},getOption:function(r){return this.options[r]},getDoc:function(){return this.doc},addKeyMap:function(r,n){this.state.keyMaps[n?"push":"unshift"](ia(r))},removeKeyMap:function(r){for(var n=this.state.keyMaps,k=0;k<n.length;++k)if(n[k]==r||n[k].name==r)return n.splice(k,1),!0},addOverlay:Tr(function(r,n){var k=r.token?r:e.getMode(this.options,r);if(k.startState)throw new Error("Overlays may not be stateful.");ae(this.state.overlays,{mode:k,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,k=0;k<n.length;++k){var H=n[k].modeSpec;if(H==r||typeof r=="string"&&H.name==r){n.splice(k,1),this.state.modeGen++,Rr(this);return}}}),indentLine:Tr(function(r,n,k){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,k)}),indentSelection:Tr(function(r){for(var n=this.doc.sel.ranges,k=-1,H=0;H<n.length;H++){var Y=n[H];if(Y.empty())Y.head.line>k&&(Un(this,Y.head.line,r,!0),k=Y.head.line,H==this.doc.sel.primIndex&&qi(this));else{var Z=Y.from(),q=Y.to(),fe=Math.max(k,Z.line);k=Math.min(this.lastLine(),q.line-(q.ch?0:1))+1;for(var ge=fe;ge<k;++ge)Un(this,ge,r);var Re=this.doc.sel.ranges;Z.ch==0&&n.length==Re.length&&Re[H].from().ch>0&&Ua(this.doc,H,new Wt(Z,Re[H].to()),Ee)}}}),getTokenAt:function(r,n){return Ht(this,r,n)},getLineTokens:function(r,n){return Ht(this,Ye(r),n,!0)},getTokenTypeAt:function(r){r=s(this.doc,r);var n=He(this,gt(this.doc,r.line)),k=0,H=(n.length-1)/2,Y=r.ch,Z;if(Y==0)Z=n[2];else for(;;){var q=k+H>>1;if((q?n[q*2-1]:0)>=Y)H=q;else if(n[q*2+1]<Y)k=q+1;else{Z=n[q*2+2];break}}var fe=Z?Z.indexOf("overlay "):-1;return fe<0?Z:fe==0?null:Z.slice(0,fe-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 k=[];if(!i.hasOwnProperty(n))return k;var H=i[n],Y=this.getModeAt(r);if(typeof Y[n]=="string")H[Y[n]]&&k.push(H[Y[n]]);else if(Y[n])for(var Z=0;Z<Y[n].length;Z++){var q=H[Y[n][Z]];q&&k.push(q)}else Y.helperType&&H[Y.helperType]?k.push(H[Y.helperType]):H[Y.name]&&k.push(H[Y.name]);for(var fe=0;fe<H._global.length;fe++){var ge=H._global[fe];ge.pred(Y,this)&&oe(k,ge.val)==-1&&k.push(ge.val)}return k},getStateAfter:function(r,n){var k=this.doc;return r=K(k,r==null?k.first+k.size-1:r),Oe(this,r+1,n).state},cursorCoords:function(r,n){var k,H=this.doc.sel.primary();return r==null?k=H.head:typeof r=="object"?k=s(this.doc,r):k=r?H.from():H.to(),Jr(this,k,n||"page")},charCoords:function(r,n){return va(this,s(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,k){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",k||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,k,H,Y){var Z=this.display;r=Jr(this,s(this.doc,r));var q=r.bottom,fe=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 ge=Math.max(Z.wrapper.clientHeight,this.doc.height),Re=Math.max(Z.sizer.clientWidth,Z.lineSpace.clientWidth);(H=="above"||r.bottom+n.offsetHeight>ge)&&r.top>n.offsetHeight?q=r.top-n.offsetHeight:r.bottom+n.offsetHeight<=ge&&(q=r.bottom),fe+n.offsetWidth>Re&&(fe=Re-n.offsetWidth)}n.style.top=q+"px",n.style.left=n.style.right="",Y=="right"?(fe=Z.sizer.clientWidth-n.offsetWidth,n.style.right="0px"):(Y=="left"?fe=0:Y=="middle"&&(fe=(Z.sizer.clientWidth-n.offsetWidth)/2),n.style.left=fe+"px"),k&&Qs(this,{left:fe,top:q,right:fe+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,k,H){var Y=1;n<0&&(Y=-1,n=-n);for(var Z=s(this.doc,r),q=0;q<n&&!(Z=Xa(this.doc,Z,Y,k,H),Z.hitSide);++q);return Z},moveH:Tr(function(r,n){var k=this;this.extendSelectionsBy(function(H){return k.display.shift||k.doc.extend||H.empty()?Xa(k.doc,H.head,r,n,k.options.rtlMoveVisually):r<0?H.from():H.to()},Te)}),deleteH:Tr(function(r,n){var k=this.doc.sel,H=this.doc;k.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,k,H){var Y=1,Z=H;n<0&&(Y=-1,n=-n);for(var q=s(this.doc,r),fe=0;fe<n;++fe){var ge=Jr(this,q,"div");if(Z==null?Z=ge.left:ge.left=Z,q=Os(this,ge,Y,k),q.hitSide)break}return q},moveV:Tr(function(r,n){var k=this,H=this.doc,Y=[],Z=!this.display.shift&&!H.extend&&H.sel.somethingSelected();if(H.extendSelectionsBy(function(fe){if(Z)return r<0?fe.from():fe.to();var ge=Jr(k,fe.head,"div");fe.goalColumn!=null&&(ge.left=fe.goalColumn),Y.push(ge.left);var Re=Os(k,ge,r,n);return n=="page"&&fe==H.sel.primary()&&La(k,va(k,Re,"div").top-ge.top),Re},Te),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,k=gt(n,r.line).text,H=r.ch,Y=r.ch;if(k){var Z=this.getHelper(r,"wordChars");(r.sticky=="before"||Y==k.length)&&H?--H:++Y;for(var q=k.charAt(H),fe=Ie(q,Z)?function(ge){return Ie(ge,Z)}:/\s/.test(q)?function(ge){return/\s/.test(ge)}:function(ge){return!/\s/.test(ge)&&!Ie(ge)};H>0&&fe(k.charAt(H-1));)--H;for(;Y<k.length&&fe(k.charAt(Y));)++Y}return new Wt(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)?B(this.display.cursorDiv,"CodeMirror-overwrite"):m(this.display.cursorDiv,"CodeMirror-overwrite"),Be(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==P()},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 k=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(k,Y,"widget");break}}++Y}),this.curOp.forceUpdate=!0,Be(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),Be(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,Vt(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,k){i.hasOwnProperty(r)||(i[r]=e[r]={_global:[]}),i[r][n]=k},e.registerGlobalHelper=function(r,n,k,H){e.registerHelper(r,n,H),i[r]._global.push({pred:k,val:H})}}function Xa(e,t,i,r,n){var k=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 fe(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")fe();else if(r=="column")fe(!0);else if(r=="word"||r=="group")for(var ge=null,Re=r=="group",Ae=e.cm&&e.cm.getHelper(t,"wordChars"),je=!0;!(i<0&&!fe(!je));je=!1){var Ve=Y.text.charAt(t.ch)||`
|
|
`,Je=Ie(Ve,Ae)?"w":Re&&Ve==`
|
|
`?"n":!Re||/\s/.test(Ve)?null:"p";if(Re&&!je&&!Je&&(Je="s"),ge&&ge!=Je){i<0&&(i=1,fe(),t.sticky="after");break}if(Je&&(ge=Je),i>0&&!fe(!je))break}var tt=ea(e,t,k,H,!0);return ti(k,tt)&&(tt.hitSide=!0),tt}function Os(e,t,i,r){var n=e.doc,k=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,k,H),!q.outside);){if(i<0?H<=0:H>=n.height){q.hitSide=!0;break}H+=i*5}return q}var Kt=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new ee,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Kt.prototype.init=function(e){var t=this,i=this,r=i.cm,n=i.div=e.lineDiv;Ds(n,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function k(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}Me(n,"paste",function(Y){if(!k(Y)||Ke(r,Y)||As(Y,r))return;F<=11&&setTimeout(fr(r,function(){return t.updateFromDOM()}),20)}),Me(n,"compositionstart",function(Y){t.composing={data:Y.data,done:!1}}),Me(n,"compositionupdate",function(Y){t.composing||(t.composing={data:Y.data,done:!1})}),Me(n,"compositionend",function(Y){t.composing&&(Y.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Me(n,"touchstart",function(){return i.forceCompositionEnd()}),Me(n,"input",function(){t.composing||t.readFromDOMSoon()});function H(Y){if(!k(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,Ee),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 fe=Rs(),ge=fe.firstChild;r.display.lineSpace.insertBefore(fe,r.display.lineSpace.firstChild),ge.value=ei.text.join(`
|
|
`);var Re=document.activeElement;V(ge),setTimeout(function(){r.display.lineSpace.removeChild(fe),Re.focus(),Re==n&&i.showPrimarySelection()},50)}Me(n,"copy",H),Me(n,"cut",H)},Kt.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Kt.prototype.prepareSelection=function(){var e=yo(this.cm,!1);return e.focus=document.activeElement==this.div,e},Kt.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},Kt.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Kt.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,i=t.doc.sel.primary(),r=i.from(),n=i.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||n.line<t.display.viewFrom){e.removeAllRanges();return}var k=sa(t,e.anchorNode,e.anchorOffset),H=sa(t,e.focusNode,e.focusOffset);if(k&&!k.bad&&H&&!H.bad&&Tt(Ri(k,H),r)==0&&Tt(di(k,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 fe=Y[Y.length-1].measure,ge=fe.maps?fe.maps[fe.maps.length-1]:fe.map;q={node:ge[ge.length-1],offset:ge[ge.length-2]-ge[ge.length-3]}}if(!Z||!q){e.removeAllRanges();return}var Re=e.rangeCount&&e.getRangeAt(0),Ae;try{Ae=S(Z.node,Z.offset,q.offset,q.node)}catch(je){}Ae&&(!R&&t.state.focused?(e.collapse(Z.node,Z.offset),Ae.collapsed||(e.removeAllRanges(),e.addRange(Ae))):(e.removeAllRanges(),e.addRange(Ae)),Re&&e.anchorNode==null?e.addRange(Re):R&&this.startGracePeriod()),this.rememberSelection()},Kt.prototype.startGracePeriod=function(){var e=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation(function(){return e.cm.curOp.selectionChanged=!0})},20)},Kt.prototype.showMultipleSelections=function(e){d(this.cm.display.cursorDiv,e.cursors),d(this.cm.display.selectionDiv,e.selection)},Kt.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},Kt.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return y(this.div,t)},Kt.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},Kt.prototype.blur=function(){this.div.blur()},Kt.prototype.getField=function(){return this.div},Kt.prototype.supportsTouch=function(){return!0},Kt.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():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)},Kt.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},Kt.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(u&&c&&this.cm.display.gutterSpecs.length&&eu(e.anchorNode)){this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();return}if(this.composing)return;this.rememberSelection();var 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),Ee),(i.bad||r.bad)&&(t.curOp.selectionChanged=!0)})},Kt.prototype.pollContent=function(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,i=e.doc.sel.primary(),r=i.from(),n=i.to();if(r.ch==0&&r.line>e.firstLine()&&(r=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 k,H,Y;r.line==t.viewFrom||(k=Ui(e,r.line))==0?(H=Pt(t.view[0].line),Y=t.view[0].node):(H=Pt(t.view[k].line),Y=t.view[k-1].node.nextSibling);var Z=Ui(e,n.line),q,fe;if(Z==t.view.length-1?(q=t.viewTo-1,fe=t.lineDiv.lastChild):(q=Pt(t.view[Z+1].line)-1,fe=t.view[Z+1].node.previousSibling),!Y)return!1;for(var ge=e.doc.splitLines(tu(e,Y,fe,H,q)),Re=jr(e.doc,Ye(H,0),Ye(q,gt(e.doc,q).text.length));ge.length>1&&Re.length>1;)if(te(ge)==te(Re))ge.pop(),Re.pop(),q--;else if(ge[0]==Re[0])ge.shift(),Re.shift(),H++;else break;for(var Ae=0,je=0,Ve=ge[0],Je=Re[0],tt=Math.min(Ve.length,Je.length);Ae<tt&&Ve.charCodeAt(Ae)==Je.charCodeAt(Ae);)++Ae;for(var ht=te(ge),rt=te(Re),ct=Math.min(ht.length-(ge.length==1?Ae:0),rt.length-(Re.length==1?Ae:0));je<ct&&ht.charCodeAt(ht.length-je-1)==rt.charCodeAt(rt.length-je-1);)++je;if(ge.length==1&&Re.length==1&&H==r.line)for(;Ae&&Ae>r.ch&&ht.charCodeAt(ht.length-je-1)==rt.charCodeAt(rt.length-je-1);)Ae--,je++;ge[ge.length-1]=ht.slice(0,ht.length-je).replace(/^\u200b+/,""),ge[0]=ge[0].slice(Ae).replace(/\u200b+$/,"");var Ct=Ye(H,Ae),xt=Ye(q,Re.length?te(Re).length-je:0);if(ge.length>1||ge[0]||Tt(Ct,xt))return an(e.doc,ge,Ct,xt,"+input"),!0},Kt.prototype.ensurePolled=function(){this.forceCompositionEnd()},Kt.prototype.reset=function(){this.forceCompositionEnd()},Kt.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},Kt.prototype.readFromDOMSoon=function(){var e=this;if(this.readDOMTimeout!=null)return;this.readDOMTimeout=setTimeout(function(){if(e.readDOMTimeout=null,e.composing)if(e.composing.done)e.composing=null;else return;e.updateFromDOM()},80)},Kt.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&Ur(this.cm,function(){return Rr(e.cm)})},Kt.prototype.setUneditable=function(e){e.contentEditable="false"},Kt.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||fr(this.cm,Va)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},Kt.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},Kt.prototype.onContextMenu=function(){},Kt.prototype.resetPosition=function(){},Kt.prototype.needsContentAttribute=!0;function _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),k=$e(r,e.doc.direction),H="left";if(k){var Y=qe(k,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 k="",H=!1,Y=e.doc.lineSeparator(),Z=!1;function q(Ae){return function(je){return je.id==Ae}}function fe(){H&&(k+=Y,Z&&(k+=Y),H=Z=!1)}function ge(Ae){Ae&&(fe(),k+=Ae)}function Re(Ae){if(Ae.nodeType==1){var je=Ae.getAttribute("cm-text");if(je){ge(je);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))&&ge(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&&fe();for(var rt=0;rt<Ae.childNodes.length;rt++)Re(Ae.childNodes[rt]);/^(pre|p)$/i.test(Ae.nodeName)&&(Z=!0),ht&&(H=!0)}else Ae.nodeType==3&&ge(Ae.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(Re(t),t==i);)t=t.nextSibling,Z=!1;return k}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 k=e.display.view[n];if(k.node==r)return ru(k,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 k=e.rest?te(e.rest):e.line;return hn(Ye(Pt(k),k.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 fe(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 ge=fe(H,Y,i);if(ge)return hn(ge,n);for(var Re=Y.nextSibling,Ae=H?H.nodeValue.length-i:0;Re;Re=Re.nextSibling){if(ge=fe(Re,Re.firstChild,0),ge)return hn(Ye(ge.line,ge.ch-Ae),n);Ae+=Re.textContent.length}for(var je=Y.previousSibling,Ve=i;je;je=je.previousSibling){if(ge=fe(je,je.firstChild,-1),ge)return hn(Ye(ge.line,ge.ch+Ve),n);Ve+=je.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),b&&(n.style.width="0px"),Me(n,"input",function(){j&&F>=9&&t.hasSelection&&(t.hasSelection=null),i.poll()}),Me(n,"paste",function(H){if(Ke(r,H)||As(H,r))return;r.state.pasteIncoming=+new Date,i.fastPoll()});function k(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,Ee):(i.prevInput="",n.value=Y.text.join(`
|
|
`),V(n))}else return;H.type=="cut"&&(r.state.cutIncoming=+new Date)}Me(n,"cut",k),Me(n,"copy",k),Me(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)}),Me(e.lineSpace,"selectstart",function(H){fi(e,H)||re(H)}),Me(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"})}}),Me(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"),k=t.wrapper.getBoundingClientRect(),H=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,n.top+H.top-k.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,n.left+H.left-k.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&&F>=9&&(this.hasSelection=i)}else e||(this.prevInput=this.textarea.value="",j&&F>=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||P()!=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&&F>=9&&this.hasSelection===n||l&&/[\uf700-\uf7ff]/.test(n))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var k=n.charCodeAt(0);if(k==8203&&!r&&(r="\u200B"),k==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&&F>=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 k=Bi(i,e),H=r.scroller.scrollTop;if(!k||x)return;var Y=i.options.resetSelectionOnContextMenu;Y&&i.doc.sel.contains(k)==-1&&fr(i,Er)(i.doc,Ti(k),Ee);var Z=n.style.cssText,q=t.wrapper.style.cssText,fe=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",n.style.cssText=`position: absolute; width: 30px; height: 30px;
|
|
top: `+(e.clientY-fe.top-5)+"px; left: "+(e.clientX-fe.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 ge;_&&(ge=window.scrollY),r.input.focus(),_&&window.scrollTo(null,ge),r.input.reset(),i.somethingSelected()||(n.value=t.prevInput=" "),t.contextMenuPending=Ae,r.selForContextMenu=i.doc.sel,clearTimeout(r.detectingSelectAll);function Re(){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&&F<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=H),n.selectionStart!=null){(!j||j&&F<9)&&Re();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&&F>=9&&Re(),D){de(e);var je=function(){lt(window,"mouseup",je),setTimeout(Ae,20)};Me(window,"mouseup",je)}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?N(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=P();t.autofocus=i==e||e.getAttribute("autofocus")!=null&&i==document.body}function r(){e.value=Y.getValue()}var n;if(e.form&&(Me(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var k=e.form;n=k.submit;try{var H=k.submit=function(){r(),k.submit=n,k.submit(),k.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=Zt(function(Z){return e.parentNode.insertBefore(Z,e.nextSibling)},t);return Y}function nu(e){e.off=lt,e.on=Me,e.wheelEventPixels=dl,e.Doc=Or,e.splitLines=ft,e.countColumn=X,e.findColumn=me,e.isWordChar=_e,e.Pass=De,e.signal=Be,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=Xt,e.modeExtensions=hr,e.extendMode=ir,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=de,e.addClass=B,e.contains=y,e.rmClass=m,e.keyNames=ki}$l(Zt),ql(Zt);var au="iter insert remove copy getEditor constructor".split(" ");for(var la in Or.prototype)Or.prototype.hasOwnProperty(la)&&oe(au,la)<0&&(Zt.prototype[la]=function(e){return function(){return e.apply(this.doc,arguments)}}(Or.prototype[la]));return be(Or),Zt.inputStyles={textarea:rr,contenteditable:Kt},Zt.defineMode=function(e){!Zt.defaults.mode&&e!="null"&&(Zt.defaults.mode=e),or.apply(this,arguments)},Zt.defineMIME=Qt,Zt.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Zt.defineMIME("text/plain","null"),Zt.defineExtension=function(e,t){Zt.prototype[e]=t},Zt.defineDocExtension=function(e,t){Or.prototype[e]=t},Zt.fromTextArea=iu,nu(Zt),Zt.version="5.58.2",Zt})},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"),F=se("rePB"),_=se("Zm9Q"),A=se("Kwbf"),c=se("c+Xe"),x=se("m+aA"),M=se("bdgK"),w=new Map;function E(Ee){Ee.forEach(function(Ce){var Te,me=Ce.target;(Te=w.get(me))===null||Te===void 0||Te.forEach(function(pe){return pe(me)})})}var b=new M.default(E),u=null,a=null;function l(Ee,Ce){w.has(Ee)||(w.set(Ee,new Set),b.observe(Ee)),w.get(Ee).add(Ce)}function h(Ee,Ce){w.has(Ee)&&(w.get(Ee).delete(Ce),w.get(Ee).size||(b.unobserve(Ee),w.delete(Ee)))}var L=function(Ee){Object(Q.a)(Te,Ee);var Ce=Object(U.a)(Te);function Te(){return Object($.a)(this,Te),Ce.apply(this,arguments)}return Object(R.a)(Te,[{key:"render",value:function(){return this.props.children}}]),Te}(O.Component),f=O.createContext(null);function p(Ee){var Ce=Ee.children,Te=Ee.onBatchResize,me=O.useRef(0),pe=O.useRef([]),ue=O.useContext(f),te=O.useCallback(function(he,ae,we){me.current+=1;var Le=me.current;pe.current.push({size:he,element:ae,data:we}),Promise.resolve().then(function(){Le===me.current&&(Te==null||Te(pe.current),pe.current=[])}),ue==null||ue(he,ae,we)},[Te,ue]);return O.createElement(f.Provider,{value:te},Ce)}function D(Ee){var Ce=Ee.children,Te=Ee.disabled,me=O.useRef(null),pe=O.useRef(null),ue=O.useContext(f),te=O.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),he=O.isValidElement(Ce)&&Object(c.c)(Ce),ae=he?Ce.ref:null,we=O.useMemo(function(){return Object(c.a)(ae,me)},[ae,me]),Le=O.useRef(Ee);Le.current=Ee;var xe=O.useCallback(function(_e){var Ie=Le.current,We=Ie.onResize,Fe=Ie.data,Ne=_e.getBoundingClientRect(),Ue=Ne.width,et=Ne.height,ot=_e.offsetWidth,nt=_e.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,Me=nt===Math.round(et)?et:nt,ut=Object(j.a)(Object(j.a)({},$e),{},{offsetWidth:Qe,offsetHeight:Me});ue==null||ue(ut,_e,Fe),We&&Promise.resolve().then(function(){We(ut,_e)})}},[]);return O.useEffect(function(){var _e=Object(x.a)(me.current)||Object(x.a)(pe.current);return _e&&!Te&&l(_e,xe),function(){return h(_e,xe)}},[me.current,Te]),O.createElement(L,{ref:pe},he?O.cloneElement(Ce,{ref:we}):Ce)}var C="rc-observer-key";function m(Ee){var Ce=Ee.children,Te=Object(_.a)(Ce);return Te.map(function(me,pe){var ue=(me==null?void 0:me.key)||"".concat(C,"-").concat(pe);return O.createElement(D,Object(ne.a)({},Ee,{key:ue}),me)})}m.Collection=p;var v=m,d=se("bT9E"),o=se("TSYQ"),T=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"],P={},B;function W(Ee){var Ce=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Te=Ee.getAttribute("id")||Ee.getAttribute("data-reactid")||Ee.getAttribute("name");if(Ce&&P[Te])return P[Te];var me=window.getComputedStyle(Ee),pe=me.getPropertyValue("box-sizing")||me.getPropertyValue("-moz-box-sizing")||me.getPropertyValue("-webkit-box-sizing"),ue=parseFloat(me.getPropertyValue("padding-bottom"))+parseFloat(me.getPropertyValue("padding-top")),te=parseFloat(me.getPropertyValue("border-bottom-width"))+parseFloat(me.getPropertyValue("border-top-width")),he=y.map(function(we){return"".concat(we,":").concat(me.getPropertyValue(we))}).join(";"),ae={sizingStyle:he,paddingSize:ue,borderSize:te,boxSizing:pe};return Ce&&Te&&(P[Te]=ae),ae}function V(Ee){var Ce=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Te=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,me=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;B||(B=document.createElement("textarea"),B.setAttribute("tab-index","-1"),B.setAttribute("aria-hidden","true"),document.body.appendChild(B)),Ee.getAttribute("wrap")?B.setAttribute("wrap",Ee.getAttribute("wrap")):B.removeAttribute("wrap");var pe=W(Ee,Ce),ue=pe.paddingSize,te=pe.borderSize,he=pe.boxSizing,ae=pe.sizingStyle;B.setAttribute("style","".concat(ae,";").concat(S)),B.value=Ee.value||Ee.placeholder||"";var we=Number.MIN_SAFE_INTEGER,Le=Number.MAX_SAFE_INTEGER,xe=B.scrollHeight,_e;if(he==="border-box"?xe+=te:he==="content-box"&&(xe-=ue),Te!==null||me!==null){B.value=" ";var Ie=B.scrollHeight-ue;Te!==null&&(we=Ie*Te,he==="border-box"&&(we=we+ue+te),xe=Math.max(we,xe)),me!==null&&(Le=Ie*me,he==="border-box"&&(Le=Le+ue+te),_e=xe>Le?"":"hidden",xe=Math.min(Le,xe))}return{height:xe,minHeight:we,maxHeight:Le,overflowY:_e,resize:"none"}}var I=se("Gytx"),N=se.n(I),X;(function(Ee){Ee[Ee.NONE=0]="NONE",Ee[Ee.RESIZING=1]="RESIZING",Ee[Ee.RESIZED=2]="RESIZED"})(X||(X={}));var ee=function(Ee){Object(Q.a)(Te,Ee);var Ce=Object(U.a)(Te);function Te(me){var pe;return Object($.a)(this,Te),pe=Ce.call(this,me),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,he=pe.props,ae=he.autoSize,we=he.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,he=ue.maxRows,ae=V(pe.textArea,!1,te,he);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,he=te===void 0?"rc-textarea":te,ae=ue.autoSize,we=ue.onResize,Le=ue.className,xe=ue.disabled,_e=pe.state,Ie=_e.textareaStyles,We=_e.resizeStatus,Fe=Object(d.a)(pe.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Ne=T()(he,Le,Object(F.a)({},"".concat(he,"-disabled"),xe));"value"in Fe&&(Fe.value=Fe.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)({},Fe,{className:Ne,style:Ue,ref:pe.saveTextArea})))},pe.state={textareaStyles:{},resizeStatus:X.NONE},pe}return Object(R.a)(Te,[{key:"componentDidUpdate",value:function(pe){(pe.value!==this.props.value||!N()(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()}}]),Te}(O.Component),oe=ee,ce=function(Ee){Object(Q.a)(Te,Ee);var Ce=Object(U.a)(Te);function Te(me){var pe;Object($.a)(this,Te),pe=Ce.call(this,me),pe.resizableTextArea=void 0,pe.focus=function(){pe.resizableTextArea.textArea.focus()},pe.saveTextArea=function(te){pe.resizableTextArea=te},pe.handleChange=function(te){var he=pe.props.onChange;pe.setValue(te.target.value,function(){pe.resizableTextArea.resizeTextarea()}),he&&he(te)},pe.handleKeyDown=function(te){var he=pe.props,ae=he.onPressEnter,we=he.onKeyDown;te.keyCode===13&&ae&&ae(te),we&&we(te)};var ue=typeof me.value=="undefined"||me.value===null?me.defaultValue:me.value;return pe.state={value:ue},pe}return Object(R.a)(Te,[{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}}]),Te}(O.Component),De=at.default=ce},ZW9T:function(dt,at,se){"use strict";se.d(at,"a",function(){return L});var ne=se("k1fw"),$=se("miYZ"),R=se("tsqr"),Q=se("rAM+"),U=se("tJVT"),O=se("PpiC"),j=se("q1tI"),F=se.n(j),_=se("bdgK");function A(f,p,D,C,m){var v=p.getWordUntilPosition(D),d={startLineNumber:D.lineNumber,endLineNumber:D.lineNumber,startColumn:v.startColumn,endColumn:v.endColumn},o=C.map(function(T){return{label:T,kind:f.languages.CompletionItemKind.Keyword,insertText:T,insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet,range:d}});return m.map(function(T){o.push(Object(ne.a)(Object(ne.a)({},T),{},{range:d}))}),o}var c=function(f){var p={label:"ifelse",kind:f.languages.CompletionItemKind.Method,insertText:["if (${1:condition}) {"," $0","} else {"," ","}"].join(`
|
|
`),insertTextRules:f.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"];f.languages.registerCompletionItemProvider("cpp",{provideCompletionItems:function(d,o){var T=A(f,d,o,D,[p]);return{suggestions:T}}});var C=["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"];f.languages.registerCompletionItemProvider("python",{provideCompletionItems:function(d,o){var T=[{label:"print",kind:f.languages.CompletionItemKind.Snippet,insertText:["print($0)"].join(`
|
|
`),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet}],S=A(f,d,o,C,T);return{suggestions:S}}});var m=["abstract","assert","boolean","break","byte","case","catch","char","class","const","continue","default","do","double","else","enum","extends","final","finally","float","for","goto","if","implements","import","instance of","int","interface","long","native","new","package","private","protected","public","return","strictfp","short","static","super","switch","synchronized","this","throw","throws","transient","try","void","volatile","while"];f.languages.registerCompletionItemProvider("java",{provideCompletionItems:function(d,o){var T=[p,{label:"main",kind:f.languages.CompletionItemKind.Snippet,insertText:["public static void main(String[] args) {"," $0","}"].join(`
|
|
`),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"System.out.print",kind:f.languages.CompletionItemKind.Snippet,insertText:["System.out.print($0)"].join(`
|
|
`),insertTextRules:f.languages.CompletionItemInsertTextRule.InsertAsSnippet}],S=A(f,d,o,m,T);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",M=se("LvDl");function w(f){return/^\d+$/.test(f)?"".concat(f,"px"):f}function E(){}var b=!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 f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],p=f;if(Array.isArray(f)){for(var D=0;D<f.length;D++){var C=u[f[D]];if(C)return C}return p[0]}return u[p]||p}var l=null,h=at.b=function(f){var p=f.width,D=p===void 0?"100%":p,C=f.height,m=C===void 0?"100%":C,v=f.value,d=f.language,o=d===void 0?"javascript":d,T=f.style,S=T===void 0?{}:T,y=f.options,P=y===void 0?{}:y,B=f.overrideServices,W=B===void 0?{}:B,V=f.theme,I=V===void 0?"vs-dark":V,N=f.onEditBlur,X=f.onSave,ee=f.autoHeight,oe=ee===void 0?!1:ee,ce=f.forbidCopy,De=ce===void 0?!1:ce,Ee=f.onChange,Ce=Ee===void 0?E:Ee,Te=f.editorDidMount,me=Te===void 0?E:Te,pe=f.onFocus,ue=pe===void 0?E:pe,te=f.filename,he=te===void 0?"educoder.txt":te,ae=Object(O.a)(f,["width","height","value","language","style","options","overrideServices","theme","onEditBlur","onSave","autoHeight","forbidCopy","onChange","editorDidMount","onFocus","filename"]),we=Object(j.useRef)(),Le=Object(j.useRef)({}),xe=Object(j.useRef)(),_e=Object(j.useRef)(!1),Ie=Object(j.useRef)(),We=Object(j.useState)(!1),Fe=Object(U.a)(We,2),Ne=Fe[0],Ue=Fe[1];function et(){var le;return we.current&&(le=new _.default(function(de){var ke=Object(Q.a)(de),Pe;try{for(ke.s();!(Pe=ke.n()).done;){var Xe=Pe.value;(Xe.target.offsetHeight>0||Xe.target.offsetWidth>0)&&Le.current.instance.layout()}}catch(vt){ke.e(vt)}finally{ke.f()}}),le.observe(we.current)),le}function ot(){R.b.warn(decodeURIComponent(x))}var nt=function(){var de=Le.current.instance;if(v!=null&&de&&Ne){var ke=de.getModel();ke&&v!==ke.getValue()&&(b=!0,ke.setValue(v),de.layout(),b=!1)}};Object(j.useEffect)(function(){xe.current&&clearTimeout(xe.current),xe.current=setTimeout(function(){nt()},500)},[v,Ne,Le.current]);function qe(){var le=Le.current.instance;if(le){var de=le.getSelection(),ke=Le.current.pastePos||{},Pe=new l.Range(ke.startLineNumber||de.endLineNumber,ke.startColumn||de.endColumn,ke.endLineNumber||de.endLineNumber,ke.endColumn||de.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&&Le.current.instance){var de=Le.current.instance.getContentHeight();re(de<m?m:de)}else re(m)};function Qe(le){var de=document.createEvent("MouseEvents");de.initMouseEvent("click",!0,!1,window,0,0,0,0,0,!1,!1,!1,!1,0,null),le.dispatchEvent(de)}function Me(le,de){var ke=window.URL||window.webkitURL||window,Pe=new Blob([de]),Xe=document.createElementNS("http://www.w3.org/1999/xhtml","a");Xe.href=ke.createObjectURL(Pe),Xe.download=le,Qe(Xe)}Object(j.useEffect)(function(){$e()},[$e]),Object(j.useEffect)(function(){we.current&&!Ne&&se.e(27).then(se.t.bind(null,"M/lh",7)).then(function(le){try{l=le,Le.current.instance=l.editor.create(we.current,{value:v,language:a(o),theme:I,requireConfig:{"vs/nls":{availableLanguages:{"*":"zh-cn"}}},wordWrap:!0},W);var de=Le.current.instance;if(me(de,l),setTimeout(function(){$e(),Le.current.instance.addAction({id:"d123123",label:"Download File",contextMenuGroupId:"9_cutcopypaste",run:function(){Me(he||"educoder.txt",de.getValue())}})},500),Le.current.subscription=de.onDidChangeModelContent(function(Pe){_e.current?clearTimeout(Ie.current):($e(),Ce(de.getValue(),Pe)),Ie.current=setTimeout(function(){_e.current=!1},500)}),window.Monaco||c(l),De&&(de.addCommand(l.KeyMod.CtrlCmd|l.KeyMod.Shift|l.KeyCode.KEY_V,function(){return ot(),null}),de.addCommand(l.KeyMod.CtrlCmd|l.KeyCode.KEY_C,function(){return ot(),null})),window.Monaco=l,N&&de.onDidBlurEditorWidget(function(){N(de.getValue())}),ue&&de.onDidFocusEditorText(function(){ue(de.getValue())}),De){de.addCommand(l.KeyMod.CtrlCmd|l.KeyCode.KEY_V,function(){return ot(),null}),de.onDidPaste(function(Pe){Le.current.pastePos=Pe});try{window.addEventListener("paste",qe)}catch(Pe){}}var ke=et();return Ue(!0),function(){var Pe=Le.current.instance;Pe.dispose();var Xe=Pe.getModel();Xe&&Xe.dispose(),Le.current.subscription&&Le.current.subscription.dispose(),De&&window.removeEventListener("paste",qe),ke.unobserve(we.current)}}catch(Pe){}})},[]),Object(j.useEffect)(function(){var le=Le.current.instance;if(le&&Ne)return document.addEventListener("keydown",st,!1),function(){document.removeEventListener("keydown",st)}},[X,Ne]),Object(j.useEffect)(function(){var le=Le.current.instance;if(le&&Ne){var de=a(o);l.editor.setModelLanguage(le.getModel(),de),console.log("language:",o,le.getModel(),de)}},[o,Ne]),Object(j.useEffect)(function(){var le=Le.current.instance;le&&Ne&&l.editor.setTheme(I)},[I,Ne]),Object(j.useEffect)(function(){var le=Le.current.instance;le&&Ne&&(le.updateOptions(Object(ne.a)({},P)),setTimeout(function(){le.getModel().updateOptions(Object(ne.a)({},P))},200))},[JSON.stringify(P),Ne]),Object(j.useEffect)(function(){var le=Le.current.instance;le&&Ne&&le.layout()},[D,m,Ne]);var ut=Object(j.useState)(w(D)),lt=Object(U.a)(ut,2),Be=lt[0],Ke=lt[1],Se=Object(j.useState)(w(m)),ve=Object(U.a)(Se,2),be=ve[0],re=ve[1],ie=Object(ne.a)(Object(ne.a)({},S),{},{width:Be,height:be});return F.a.createElement("div",{className:"my-monaco-editor",ref:we,style:ie})};function L(f){var p=f.width,D=p===void 0?"100%":p,C=f.height,m=C===void 0?"100%":C,v=f.original,d=f.modified,o=f.language,T=f.options,S=T===void 0?{}:T,y=Object(j.useRef)(),P=Object(j.useState)(null),B=Object(U.a)(P,2),W=B[0],V=B[1];function I(oe){var ce;return y.current&&(ce=new _.default(function(De){var Ee=Object(Q.a)(De),Ce;try{for(Ee.s();!(Ce=Ee.n()).done;){var Te=Ce.value;(Te.target.offsetHeight>0||Te.target.offsetWidth>0)&&oe.layout()}}catch(me){Ee.e(me)}finally{Ee.f()}}),ce.observe(y.current)),ce}Object(j.useEffect)(function(){y.current&&se.e(27).then(se.t.bind(null,"M/lh",7)).then(function(oe){l=oe;var ce=l.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(ce);var De=I(ce);return function(){ce.dispose();var Ee=ce.getModel();Ee&&Ee.dispose(),De.unobserve(y.current)}})},[]),Object(j.useEffect)(function(){W&&W.setModel({original:l.editor.createModel(v,o),modified:l.editor.createModel(d,o)})},[v,d,o,W]);var N=w(D),X=w(m),ee={width:N,height:X};return F.a.createElement("div",{className:"my-diff-editor",ref:y,style:ee})}},ZpRC:function(dt,at,se){"use strict";function ne(c){return typeof c=="object"&&c!=null&&c.nodeType===1}function $(c,x){return(!x||c!=="hidden")&&c!=="visible"&&c!=="clip"}function R(c,x){if(c.clientHeight<c.scrollHeight||c.clientWidth<c.scrollWidth){var M=getComputedStyle(c,null);return $(M.overflowY,x)||$(M.overflowX,x)||function(w){var E=function(b){if(!b.ownerDocument||!b.ownerDocument.defaultView)return null;try{return b.ownerDocument.defaultView.frameElement}catch(u){return null}}(w);return!!E&&(E.clientHeight<w.scrollHeight||E.clientWidth<w.scrollWidth)}(c)}return!1}function Q(c,x,M,w,E,b,u,a){return b<c&&u>x||b>c&&u<x?0:b<=c&&a<=M||u>=x&&a>=M?b-c-w:u>x&&a<M||b<c&&a>M?u-x+E:0}var U=function(c,x){var M=window,w=x.scrollMode,E=x.block,b=x.inline,u=x.boundary,a=x.skipOverflowHiddenElements,l=typeof u=="function"?u:function(Ie){return Ie!==u};if(!ne(c))throw new TypeError("Invalid target");for(var h=document.scrollingElement||document.documentElement,L=[],f=c;ne(f)&&l(f);){if((f=f.parentElement)===h){L.push(f);break}f!=null&&f===document.body&&R(f)&&!R(document.documentElement)||f!=null&&R(f,a)&&L.push(f)}for(var p=M.visualViewport?M.visualViewport.width:innerWidth,D=M.visualViewport?M.visualViewport.height:innerHeight,C=window.scrollX||pageXOffset,m=window.scrollY||pageYOffset,v=c.getBoundingClientRect(),d=v.height,o=v.width,T=v.top,S=v.right,y=v.bottom,P=v.left,B=E==="start"||E==="nearest"?T:E==="end"?y:T+d/2,W=b==="center"?P+o/2:b==="end"?S:P,V=[],I=0;I<L.length;I++){var N=L[I],X=N.getBoundingClientRect(),ee=X.height,oe=X.width,ce=X.top,De=X.right,Ee=X.bottom,Ce=X.left;if(w==="if-needed"&&T>=0&&P>=0&&y<=D&&S<=p&&T>=ce&&y<=Ee&&P>=Ce&&S<=De)return V;var Te=getComputedStyle(N),me=parseInt(Te.borderLeftWidth,10),pe=parseInt(Te.borderTopWidth,10),ue=parseInt(Te.borderRightWidth,10),te=parseInt(Te.borderBottomWidth,10),he=0,ae=0,we="offsetWidth"in N?N.offsetWidth-N.clientWidth-me-ue:0,Le="offsetHeight"in N?N.offsetHeight-N.clientHeight-pe-te:0;if(h===N)he=E==="start"?B:E==="end"?B-D:E==="nearest"?Q(m,m+D,D,pe,te,m+B,m+B+d,d):B-D/2,ae=b==="start"?W:b==="center"?W-p/2:b==="end"?W-p:Q(C,C+p,p,me,ue,C+W,C+W+o,o),he=Math.max(0,he+m),ae=Math.max(0,ae+C);else{he=E==="start"?B-ce-pe:E==="end"?B-Ee+te+Le:E==="nearest"?Q(ce,Ee,ee,pe,te+Le,B,B+d,d):B-(ce+ee/2)+Le/2,ae=b==="start"?W-Ce-me:b==="center"?W-(Ce+oe/2)+we/2:b==="end"?W-De+ue+we:Q(Ce,De,oe,me,ue+we,W,W+o,o);var xe=N.scrollLeft,_e=N.scrollTop;B+=_e-(he=Math.max(0,Math.min(_e+he,N.scrollHeight-ee+Le))),W+=xe-(ae=Math.max(0,Math.min(xe+ae,N.scrollWidth-oe+we)))}V.push({el:N,top:he,left:ae})}return V};function O(c){return c===Object(c)&&Object.keys(c).length!==0}function j(c,x){x===void 0&&(x="auto");var M="scrollBehavior"in document.body.style;c.forEach(function(w){var E=w.el,b=w.top,u=w.left;E.scroll&&M?E.scroll({top:b,left:u,behavior:x}):(E.scrollTop=b,E.scrollLeft=u)})}function F(c){return c===!1?{block:"end",inline:"nearest"}:O(c)?c:{block:"start",inline:"nearest"}}function _(c,x){var M=!c.ownerDocument.documentElement.contains(c);if(O(x)&&typeof x.behavior=="function")return x.behavior(M?[]:U(c,x));if(M)return;var w=F(x);return j(U(c,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,F=$.max,_=$.random;function A(te,he){if(te=te||"",he=he||{},te instanceof A)return te;if(!(this instanceof A))return new A(te,he);var ae=c(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=he.format||ae.format,this._gradientType=he.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(),he,ae,we,Le,xe,_e;return he=te.r/255,ae=te.g/255,we=te.b/255,he<=.03928?Le=he/12.92:Le=$.pow((he+.055)/1.055,2.4),ae<=.03928?xe=ae/12.92:xe=$.pow((ae+.055)/1.055,2.4),we<=.03928?_e=we/12.92:_e=$.pow((we+.055)/1.055,2.4),.2126*Le+.7152*xe+.0722*_e},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),he=O(te.h*360),ae=O(te.s*100),we=O(te.v*100);return this._a==1?"hsv("+he+", "+ae+"%, "+we+"%)":"hsva("+he+", "+ae+"%, "+we+"%, "+this._roundA+")"},toHsl:function(){var te=M(this._r,this._g,this._b);return{h:te.h*360,s:te.s,l:te.l,a:this._a}},toHslString:function(){var te=M(this._r,this._g,this._b),he=O(te.h*360),ae=O(te.s*100),we=O(te.l*100);return this._a==1?"hsl("+he+", "+ae+"%, "+we+"%)":"hsla("+he+", "+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:B[u(this._r,this._g,this._b,!0)]||!1},toFilter:function(te){var he="#"+l(this._r,this._g,this._b,this._a),ae=he,we=this._gradientType?"GradientType = 1, ":"";if(te){var Le=A(te);ae="#"+l(Le._r,Le._g,Le._b,Le._a)}return"progid:DXImageTransform.Microsoft.gradient("+we+"startColorstr="+he+",endColorstr="+ae+")"},toString:function(te){var he=!!te;te=te||this._format;var ae=!1,we=this._a<1&&this._a>=0,Le=!he&&we&&(te==="hex"||te==="hex6"||te==="hex3"||te==="hex4"||te==="hex8"||te==="name");return Le?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,he){var ae=te.apply(null,[this].concat([].slice.call(he)));return this._r=ae._r,this._g=ae._g,this._b=ae._b,this.setAlpha(ae._a),this},lighten:function(){return this._applyModification(p,arguments)},brighten:function(){return this._applyModification(D,arguments)},darken:function(){return this._applyModification(C,arguments)},desaturate:function(){return this._applyModification(h,arguments)},saturate:function(){return this._applyModification(L,arguments)},greyscale:function(){return this._applyModification(f,arguments)},spin:function(){return this._applyModification(m,arguments)},_applyCombination:function(te,he){return te.apply(null,[this].concat([].slice.call(he)))},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(T,arguments)},triad:function(){return this._applyCombination(d,arguments)},tetrad:function(){return this._applyCombination(o,arguments)}},A.fromRatio=function(te,he){if(typeof te=="object"){var ae={};for(var we in te)te.hasOwnProperty(we)&&(we==="a"?ae[we]=te[we]:ae[we]=De(te[we]));te=ae}return A(te,he)};function c(te){var he={r:0,g:0,b:0},ae=1,we=null,Le=null,xe=null,_e=!1,Ie=!1;return typeof te=="string"&&(te=pe(te)),typeof te=="object"&&(me(te.r)&&me(te.g)&&me(te.b)?(he=x(te.r,te.g,te.b),_e=!0,Ie=String(te.r).substr(-1)==="%"?"prgb":"rgb"):me(te.h)&&me(te.s)&&me(te.v)?(we=De(te.s),Le=De(te.v),he=b(te.h,we,Le),_e=!0,Ie="hsv"):me(te.h)&&me(te.s)&&me(te.l)&&(we=De(te.s),xe=De(te.l),he=w(te.h,we,xe),_e=!0,Ie="hsl"),te.hasOwnProperty("a")&&(ae=te.a)),ae=V(ae),{ok:_e,format:te.format||Ie,r:j(255,F(he.r,0)),g:j(255,F(he.g,0)),b:j(255,F(he.b,0)),a:ae}}function x(te,he,ae){return{r:I(te,255)*255,g:I(he,255)*255,b:I(ae,255)*255}}function M(te,he,ae){te=I(te,255),he=I(he,255),ae=I(ae,255);var we=F(te,he,ae),Le=j(te,he,ae),xe,_e,Ie=(we+Le)/2;if(we==Le)xe=_e=0;else{var We=we-Le;_e=Ie>.5?We/(2-we-Le):We/(we+Le);switch(we){case te:xe=(he-ae)/We+(he<ae?6:0);break;case he:xe=(ae-te)/We+2;break;case ae:xe=(te-he)/We+4;break}xe/=6}return{h:xe,s:_e,l:Ie}}function w(te,he,ae){var we,Le,xe;te=I(te,360),he=I(he,100),ae=I(ae,100);function _e(Fe,Ne,Ue){return Ue<0&&(Ue+=1),Ue>1&&(Ue-=1),Ue<1/6?Fe+(Ne-Fe)*6*Ue:Ue<1/2?Ne:Ue<2/3?Fe+(Ne-Fe)*(2/3-Ue)*6:Fe}if(he===0)we=Le=xe=ae;else{var Ie=ae<.5?ae*(1+he):ae+he-ae*he,We=2*ae-Ie;we=_e(We,Ie,te+1/3),Le=_e(We,Ie,te),xe=_e(We,Ie,te-1/3)}return{r:we*255,g:Le*255,b:xe*255}}function E(te,he,ae){te=I(te,255),he=I(he,255),ae=I(ae,255);var we=F(te,he,ae),Le=j(te,he,ae),xe,_e,Ie=we,We=we-Le;if(_e=we===0?0:We/we,we==Le)xe=0;else{switch(we){case te:xe=(he-ae)/We+(he<ae?6:0);break;case he:xe=(ae-te)/We+2;break;case ae:xe=(te-he)/We+4;break}xe/=6}return{h:xe,s:_e,v:Ie}}function b(te,he,ae){te=I(te,360)*6,he=I(he,100),ae=I(ae,100);var we=$.floor(te),Le=te-we,xe=ae*(1-he),_e=ae*(1-Le*he),Ie=ae*(1-(1-Le)*he),We=we%6,Fe=[ae,_e,xe,xe,Ie,ae][We],Ne=[Ie,ae,ae,_e,xe,xe][We],Ue=[xe,xe,Ie,ae,ae,_e][We];return{r:Fe*255,g:Ne*255,b:Ue*255}}function u(te,he,ae,we){var Le=[ce(O(te).toString(16)),ce(O(he).toString(16)),ce(O(ae).toString(16))];return we&&Le[0].charAt(0)==Le[0].charAt(1)&&Le[1].charAt(0)==Le[1].charAt(1)&&Le[2].charAt(0)==Le[2].charAt(1)?Le[0].charAt(0)+Le[1].charAt(0)+Le[2].charAt(0):Le.join("")}function a(te,he,ae,we,Le){var xe=[ce(O(te).toString(16)),ce(O(he).toString(16)),ce(O(ae).toString(16)),ce(Ee(we))];return Le&&xe[0].charAt(0)==xe[0].charAt(1)&&xe[1].charAt(0)==xe[1].charAt(1)&&xe[2].charAt(0)==xe[2].charAt(1)&&xe[3].charAt(0)==xe[3].charAt(1)?xe[0].charAt(0)+xe[1].charAt(0)+xe[2].charAt(0)+xe[3].charAt(0):xe.join("")}function l(te,he,ae,we){var Le=[ce(Ee(we)),ce(O(te).toString(16)),ce(O(he).toString(16)),ce(O(ae).toString(16))];return Le.join("")}A.equals=function(te,he){return!te||!he?!1:A(te).toRgbString()==A(he).toRgbString()},A.random=function(){return A.fromRatio({r:_(),g:_(),b:_()})};function h(te,he){he=he===0?0:he||10;var ae=A(te).toHsl();return ae.s-=he/100,ae.s=N(ae.s),A(ae)}function L(te,he){he=he===0?0:he||10;var ae=A(te).toHsl();return ae.s+=he/100,ae.s=N(ae.s),A(ae)}function f(te){return A(te).desaturate(100)}function p(te,he){he=he===0?0:he||10;var ae=A(te).toHsl();return ae.l+=he/100,ae.l=N(ae.l),A(ae)}function D(te,he){he=he===0?0:he||10;var ae=A(te).toRgb();return ae.r=F(0,j(255,ae.r-O(255*-(he/100)))),ae.g=F(0,j(255,ae.g-O(255*-(he/100)))),ae.b=F(0,j(255,ae.b-O(255*-(he/100)))),A(ae)}function C(te,he){he=he===0?0:he||10;var ae=A(te).toHsl();return ae.l-=he/100,ae.l=N(ae.l),A(ae)}function m(te,he){var ae=A(te).toHsl(),we=(ae.h+he)%360;return ae.h=we<0?360+we:we,A(ae)}function v(te){var he=A(te).toHsl();return he.h=(he.h+180)%360,A(he)}function d(te){var he=A(te).toHsl(),ae=he.h;return[A(te),A({h:(ae+120)%360,s:he.s,l:he.l}),A({h:(ae+240)%360,s:he.s,l:he.l})]}function o(te){var he=A(te).toHsl(),ae=he.h;return[A(te),A({h:(ae+90)%360,s:he.s,l:he.l}),A({h:(ae+180)%360,s:he.s,l:he.l}),A({h:(ae+270)%360,s:he.s,l:he.l})]}function T(te){var he=A(te).toHsl(),ae=he.h;return[A(te),A({h:(ae+72)%360,s:he.s,l:he.l}),A({h:(ae+216)%360,s:he.s,l:he.l})]}function S(te,he,ae){he=he||6,ae=ae||30;var we=A(te).toHsl(),Le=360/ae,xe=[A(te)];for(we.h=(we.h-(Le*he>>1)+720)%360;--he;)we.h=(we.h+Le)%360,xe.push(A(we));return xe}function y(te,he){he=he||6;for(var ae=A(te).toHsv(),we=ae.h,Le=ae.s,xe=ae.v,_e=[],Ie=1/he;he--;)_e.push(A({h:we,s:Le,v:xe})),xe=(xe+Ie)%1;return _e}A.mix=function(te,he,ae){ae=ae===0?0:ae||50;var we=A(te).toRgb(),Le=A(he).toRgb(),xe=ae/100,_e={r:(Le.r-we.r)*xe+we.r,g:(Le.g-we.g)*xe+we.g,b:(Le.b-we.b)*xe+we.b,a:(Le.a-we.a)*xe+we.a};return A(_e)},A.readability=function(te,he){var ae=A(te),we=A(he);return($.max(ae.getLuminance(),we.getLuminance())+.05)/($.min(ae.getLuminance(),we.getLuminance())+.05)},A.isReadable=function(te,he,ae){var we=A.readability(te,he),Le,xe;xe=!1,Le=ue(ae);switch(Le.level+Le.size){case"AAsmall":case"AAAlarge":xe=we>=4.5;break;case"AAlarge":xe=we>=3;break;case"AAAsmall":xe=we>=7;break}return xe},A.mostReadable=function(te,he,ae){var we=null,Le=0,xe,_e,Ie,We;ae=ae||{},_e=ae.includeFallbackColors,Ie=ae.level,We=ae.size;for(var Fe=0;Fe<he.length;Fe++)xe=A.readability(te,he[Fe]),xe>Le&&(Le=xe,we=A(he[Fe]));return A.isReadable(te,we,{level:Ie,size:We})||!_e?we:(ae.includeFallbackColors=!1,A.mostReadable(te,["#fff","#000"],ae))};var P=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"},B=A.hexNames=W(P);function W(te){var he={};for(var ae in te)te.hasOwnProperty(ae)&&(he[te[ae]]=ae);return he}function V(te){return te=parseFloat(te),(isNaN(te)||te<0||te>1)&&(te=1),te}function I(te,he){ee(te)&&(te="100%");var ae=oe(te);return te=j(he,F(0,parseFloat(te))),ae&&(te=parseInt(te*he,10)/100),$.abs(te-he)<1e-6?1:te%he/parseFloat(he)}function N(te){return j(1,F(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 ce(te){return te.length==1?"0"+te:""+te}function De(te){return te<=1&&(te=te*100+"%"),te}function Ee(te){return $.round(parseFloat(te)*255).toString(16)}function Ce(te){return X(te)/255}var Te=function(){var te="[-\\+]?\\d+%?",he="[-\\+]?\\d*\\.\\d+%?",ae="(?:"+he+")|(?:"+te+")",we="[\\s|\\(]+("+ae+")[,|\\s]+("+ae+")[,|\\s]+("+ae+")\\s*\\)?",Le="[\\s|\\(]+("+ae+")[,|\\s]+("+ae+")[,|\\s]+("+ae+")[,|\\s]+("+ae+")\\s*\\)?";return{CSS_UNIT:new RegExp(ae),rgb:new RegExp("rgb"+we),rgba:new RegExp("rgba"+Le),hsl:new RegExp("hsl"+we),hsla:new RegExp("hsla"+Le),hsv:new RegExp("hsv"+we),hsva:new RegExp("hsva"+Le),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 me(te){return!!Te.CSS_UNIT.exec(te)}function pe(te){te=te.replace(R,"").replace(Q,"").toLowerCase();var he=!1;if(P[te])te=P[te],he=!0;else if(te=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var ae;return(ae=Te.rgb.exec(te))?{r:ae[1],g:ae[2],b:ae[3]}:(ae=Te.rgba.exec(te))?{r:ae[1],g:ae[2],b:ae[3],a:ae[4]}:(ae=Te.hsl.exec(te))?{h:ae[1],s:ae[2],l:ae[3]}:(ae=Te.hsla.exec(te))?{h:ae[1],s:ae[2],l:ae[3],a:ae[4]}:(ae=Te.hsv.exec(te))?{h:ae[1],s:ae[2],v:ae[3]}:(ae=Te.hsva.exec(te))?{h:ae[1],s:ae[2],v:ae[3],a:ae[4]}:(ae=Te.hex8.exec(te))?{r:X(ae[1]),g:X(ae[2]),b:X(ae[3]),a:Ce(ae[4]),format:he?"name":"hex8"}:(ae=Te.hex6.exec(te))?{r:X(ae[1]),g:X(ae[2]),b:X(ae[3]),format:he?"name":"hex"}:(ae=Te.hex4.exec(te))?{r:X(ae[1]+""+ae[1]),g:X(ae[2]+""+ae[2]),b:X(ae[3]+""+ae[3]),a:Ce(ae[4]+""+ae[4]),format:he?"name":"hex8"}:(ae=Te.hex3.exec(te))?{r:X(ae[1]+""+ae[1]),g:X(ae[2]+""+ae[2]),b:X(ae[3]+""+ae[3]),format:he?"name":"hex"}:!1}function ue(te){var he,ae;return te=te||{level:"AA",size:"small"},he=(te.level||"AA").toUpperCase(),ae=(te.size||"small").toLowerCase(),he!=="AA"&&he!=="AAA"&&(he="AA"),ae!=="small"&&ae!=="large"&&(ae="small"),{level:he,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"),F=se("q1tI"),_=se.n(F),A=se("TSYQ"),c=se.n(A),x=se("4IlW");function M(d,o){var T=Object.keys(d);if(Object.getOwnPropertySymbols){var S=Object.getOwnPropertySymbols(d);o&&(S=S.filter(function(y){return Object.getOwnPropertyDescriptor(d,y).enumerable})),T.push.apply(T,S)}return T}function w(d){for(var o=1;o<arguments.length;o++){var T=arguments[o]!=null?arguments[o]:{};o%2?M(Object(T),!0).forEach(function(S){Object($.a)(d,S,T[S])}):Object.getOwnPropertyDescriptors?Object.defineProperties(d,Object.getOwnPropertyDescriptors(T)):M(Object(T)).forEach(function(S){Object.defineProperty(d,S,Object.getOwnPropertyDescriptor(T,S))})}return d}function E(d){var o=b();return function(){var S=Object(j.a)(d),y;if(o){var P=Object(j.a)(this).constructor;y=Reflect.construct(S,arguments,P)}else y=S.apply(this,arguments);return Object(O.a)(this,y)}}function b(){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 l=function(o){return o.replace(/[^\w.-]+/g,"")},h=200,L=600,f=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,p=function(o){return o!=null},D=function(o,T){return T===o||typeof T=="number"&&typeof o=="number"&&isNaN(T)&&isNaN(o)},C=function(d){Object(U.a)(T,d);var o=E(T);function T(S){var y;Object(R.a)(this,T),y=o.call(this,S),y.onKeyDown=function(W){var V=y.props,I=V.onKeyDown,N=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&&N&&N(W);if(y.recordCursorPosition(),y.lastKeyCode=W.keyCode,I){for(var oe=arguments.length,ce=new Array(oe>1?oe-1:0),De=1;De<oe;De++)ce[De-1]=arguments[De];I.apply(void 0,[W].concat(ce))}},y.onKeyUp=function(W){var V=y.props.onKeyUp;if(y.stop(),y.recordCursorPosition(),V){for(var I=arguments.length,N=new Array(I>1?I-1:0),X=1;X<I;X++)N[X-1]=arguments[X];V.apply(void 0,[W].concat(N))}},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 N=y.input.value,X=y.getInputDisplayValue({focus:!1,value:I});y.input.value=X&&Number(X),W.apply(void 0,arguments),y.input.value=N}},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(p(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,N=V.inputValue,X=V.value,ee;I?ee=N:ee=y.toPrecisionAsStep(X),ee==null&&(ee="");var oe=y.formatWrapper(ee);return p(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 N=y.cursorBefore.length;return y.lastKeyCode===x.a.DELETE&&y.cursorBefore.charAt(N-1)===W[0]?(y.fixCaret(N,N),!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 N=W.substring(I);return y.restoreByAfter(N)})},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 P=S.value;P===void 0&&(P=S.defaultValue),y.state={focused:S.autoFocus};var B=y.getValidValue(y.toNumber(P));return y.state=w(w({},y.state),{},{inputValue:y.toPrecisionAsStep(B),value:B}),y}return Object(Q.a)(T,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(y){var P=this.props,B=P.value,W=P.onChange,V=P.max,I=P.min,N=this.state.focused;if(y){if(!D(y.value,B)||!D(y.max,V)||!D(y.min,I)){var X=N?B:this.getValidValue(B),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?B: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 ce=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===x.a.BACKSPACE?ce=this.cursorStart-1:this.lastKeyCode===x.a.DELETE&&(ce=this.cursorStart):ce=this.input.value.length,this.fixCaret(ce,ce)}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(De){}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 P=y;return P===""?P="":this.isNotCompleteNumber(parseFloat(P))?P=this.state.value:P=this.getValidValue(P),this.toNumber(P)}},{key:"getValueFromEvent",value:function(y){var P=y.target.value.trim().replace(/。/g,".");return p(this.props.decimalSeparator)&&(P=P.replace(this.props.decimalSeparator,".")),P}},{key:"getValidValue",value:function(y){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,B=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,W=parseFloat(y);return isNaN(W)?y:(W<P&&(W=P),W>B&&(W=B),W)}},{key:"setValue",value:function(y,P){var B=this.props.precision,W=this.isNotCompleteNumber(parseFloat(y))?null:parseFloat(y),V=this.state.value,I=V===void 0?null:V,N=this.state.inputValue,X=N===void 0?null:N,ee=typeof W=="number"?W.toFixed(B):"".concat(W),oe=W!==I||ee!=="".concat(X);return"value"in this.props?(X=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:X},P)):this.setState({value:W,inputValue:this.toPrecisionAsStep(y)},P),oe&&this.props.onChange(W),W}},{key:"getMaxPrecision",value:function(y){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,B=this.props,W=B.precision,V=B.step;if(p(W))return W;var I=this.getPrecision(P),N=this.getPrecision(V),X=this.getPrecision(y);return y?Math.max(X,I+N):I+N}},{key:"getPrecisionFactor",value:function(y){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,B=this.getMaxPrecision(y,P);return Math.pow(10,B)}},{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 P=Math.abs(this.getMaxPrecision(y));return isNaN(P)?y.toString():Number(y).toFixed(P)}},{key:"toNumber",value:function(y){var P=this.props.precision,B=this.state.focused,W=y&&y.length>16&&B;return this.isNotCompleteNumber(y)||W?y:p(P)?Math.round(y*Math.pow(10,P))/Math.pow(10,P):Number(y)}},{key:"upStep",value:function(y,P){var B=this.props.step,W=this.getPrecisionFactor(y,P),V=Math.abs(this.getMaxPrecision(y,P)),I=((W*y+W*B*P)/W).toFixed(V);return this.toNumber(I)}},{key:"downStep",value:function(y,P){var B=this.props.step,W=this.getPrecisionFactor(y,P),V=Math.abs(this.getMaxPrecision(y,P)),I=((W*y-W*B*P)/W).toFixed(V);return this.toNumber(I)}},{key:"step",value:function(y,P){var B=this,W=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,V=arguments.length>3?arguments[3]:void 0;this.stop(),P&&(P.persist(),P.preventDefault());var I=this.props;if(I.disabled)return;var N=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(N))return;var X=this["".concat(y,"Step")](N,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(){B.pressingUpOrDown=!1}),ee)return;this.autoStepTimer=setTimeout(function(){B[y](P,W,!0)},V?h:L)}},{key:"fixCaret",value:function(y,P){if(y===void 0||P===void 0||!this.input||!this.input.value)return;try{var B=this.input.selectionStart,W=this.input.selectionEnd;(y!==B||P!==W)&&this.input.setSelectionRange(y,P)}catch(V){}}},{key:"render",value:function(){var y,P=this.props,B=P.prefixCls,W=P.disabled,V=P.readOnly,I=P.useTouch,N=P.autoComplete,X=P.upHandler,ee=P.downHandler,oe=P.className,ce=P.max,De=P.min,Ee=P.style,Ce=P.title,Te=P.onMouseEnter,me=P.onMouseLeave,pe=P.onMouseOver,ue=P.onMouseOut,te=P.required,he=P.onClick,ae=P.tabIndex,we=P.type,Le=P.placeholder,xe=P.id,_e=P.inputMode,Ie=P.pattern,We=P.step,Fe=P.maxLength,Ne=P.autoFocus,Ue=P.name,et=P.onPaste,ot=P.onInput,nt=Object(ne.a)(P,["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=c()(B,(y={},Object($.a)(y,oe,!!oe),Object($.a)(y,"".concat(B,"-disabled"),W),Object($.a)(y,"".concat(B,"-focused"),$e),y)),Me={};Object.keys(nt).forEach(function(de){(de.substr(0,5)==="data-"||de.substr(0,5)==="aria-"||de==="role")&&(Me[de]=nt[de])});var ut=!V&&!W,lt=this.getInputDisplayValue(null),Be=(st||st===0)&&(isNaN(st)||Number(st)>=ce),Ke=(st||st===0)&&(isNaN(st)||Number(st)<=De),Se=Be||W||V,ve=Ke||W||V,be=c()("".concat(B,"-handler"),"".concat(B,"-handler-up"),Object($.a)({},"".concat(B,"-handler-up-disabled"),Se)),re=c()("".concat(B,"-handler"),"".concat(B,"-handler-down"),Object($.a)({},"".concat(B,"-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:Ee,title:Ce,onMouseEnter:Te,onMouseLeave:me,onMouseOver:pe,onMouseOut:ue,onFocus:function(){return null},onBlur:function(){return null}},_.a.createElement("div",{className:"".concat(B,"-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(B,"-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(B,"-handler-down-inner"),onClick:a}))),_.a.createElement("div",{className:"".concat(B,"-input-wrap")},_.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":De,"aria-valuemax":ce,"aria-valuenow":st,required:te,type:we,placeholder:Le,onPaste:et,onClick:he,onMouseUp:this.onMouseUp,className:"".concat(B,"-input"),tabIndex:ae,autoComplete:N,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:ut?this.onKeyDown:u,onKeyUp:ut?this.onKeyUp:u,autoFocus:Ne,maxLength:Fe,readOnly:V,disabled:W,max:ce,min:De,step:We,name:Ue,title:Ce,id:xe,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(lt),pattern:Ie,inputMode:_e,onInput:ot},Me))))}}]),T}(_.a.Component);C.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:f,min:-f,step:1,style:{},onChange:u,onKeyDown:u,onPressEnter:u,onFocus:u,onBlur:u,parser:l,required:!1,autoComplete:"off"};var m=C,v=at.a=m},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 N=Date.now(),X=!1;Object.keys(V).forEach(function(ee){var oe=V[ee].current;if(!oe)return;X=!0;var ce=oe.style;ce.transitionDuration=".3s, .3s, .3s, .06s",I.current&&N-I.current<100&&(ce.transitionDuration="0s, 0s")}),X&&(I.current=Date.now())}),[V]};function j(){return j=Object.assign||function(B){for(var W=1;W<arguments.length;W++){var V=arguments[W];for(var I in V)Object.prototype.hasOwnProperty.call(V,I)&&(B[I]=V[I])}return B},j.apply(this,arguments)}function F(B,W){return M(B)||x(B,W)||A(B,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(B,W){if(!B)return;if(typeof B=="string")return c(B,W);var V=Object.prototype.toString.call(B).slice(8,-1);if(V==="Object"&&B.constructor&&(V=B.constructor.name),V==="Map"||V==="Set")return Array.from(B);if(V==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(V))return c(B,W)}function c(B,W){(W==null||W>B.length)&&(W=B.length);for(var V=0,I=new Array(W);V<W;V++)I[V]=B[V];return I}function x(B,W){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(B)))return;var V=[],I=!0,N=!1,X=void 0;try{for(var ee=B[Symbol.iterator](),oe;!(I=(oe=ee.next()).done)&&!(V.push(oe.value),W&&V.length===W);I=!0);}catch(ce){N=!0,X=ce}finally{try{!I&&ee.return!=null&&ee.return()}finally{if(N)throw X}}return V}function M(B){if(Array.isArray(B))return B}function w(B,W){if(B==null)return{};var V=E(B,W),I,N;if(Object.getOwnPropertySymbols){var X=Object.getOwnPropertySymbols(B);for(N=0;N<X.length;N++){if(I=X[N],W.indexOf(I)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(B,I))continue;V[I]=B[I]}}return V}function E(B,W){if(B==null)return{};var V={},I=Object.keys(B),N,X;for(X=0;X<I.length;X++){if(N=I[X],W.indexOf(N)>=0)continue;V[N]=B[N]}return V}var b=function(W){var V=W.className,I=W.percent,N=W.prefixCls,X=W.strokeColor,ee=W.strokeLinecap,oe=W.strokeWidth,ce=W.style,De=W.trailColor,Ee=W.trailWidth,Ce=W.transition,Te=w(W,["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"]);delete Te.gapPosition;var me=Array.isArray(I)?I:[I],pe=Array.isArray(X)?X:[X],ue=O(me),te=F(ue,1),he=te[0],ae=oe/2,we=100-oe/2,Le="M ".concat(ee==="round"?ae:0,",").concat(ae,`
|
|
L `).concat(ee==="round"?we:100,",").concat(ae),xe="0 0 100 ".concat(oe),_e=0;return $.a.createElement("svg",j({className:Q()("".concat(N,"-line"),V),viewBox:xe,preserveAspectRatio:"none",style:ce},Te),$.a.createElement("path",{className:"".concat(N,"-line-trail"),d:Le,strokeLinecap:ee,stroke:De,strokeWidth:Ee||oe,fillOpacity:"0"}),me.map(function(Ie,We){var Fe={strokeDasharray:"".concat(Ie,"px, 100px"),strokeDashoffset:"-".concat(_e,"px"),transition:Ce||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},Ne=pe[We]||pe[pe.length-1];return _e+=Ie,$.a.createElement("path",{key:We,className:"".concat(N,"-line-path"),d:Le,strokeLinecap:ee,stroke:Ne,strokeWidth:oe,fillOpacity:"0",ref:he[We],style:Fe})}))};b.defaultProps=U;var u=b;function a(){return a=Object.assign||function(B){for(var W=1;W<arguments.length;W++){var V=arguments[W];for(var I in V)Object.prototype.hasOwnProperty.call(V,I)&&(B[I]=V[I])}return B},a.apply(this,arguments)}function l(B,W){return D(B)||p(B,W)||L(B,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 L(B,W){if(!B)return;if(typeof B=="string")return f(B,W);var V=Object.prototype.toString.call(B).slice(8,-1);if(V==="Object"&&B.constructor&&(V=B.constructor.name),V==="Map"||V==="Set")return Array.from(B);if(V==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(V))return f(B,W)}function f(B,W){(W==null||W>B.length)&&(W=B.length);for(var V=0,I=new Array(W);V<W;V++)I[V]=B[V];return I}function p(B,W){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(B)))return;var V=[],I=!0,N=!1,X=void 0;try{for(var ee=B[Symbol.iterator](),oe;!(I=(oe=ee.next()).done)&&!(V.push(oe.value),W&&V.length===W);I=!0);}catch(ce){N=!0,X=ce}finally{try{!I&&ee.return!=null&&ee.return()}finally{if(N)throw X}}return V}function D(B){if(Array.isArray(B))return B}function C(B,W){if(B==null)return{};var V=m(B,W),I,N;if(Object.getOwnPropertySymbols){var X=Object.getOwnPropertySymbols(B);for(N=0;N<X.length;N++){if(I=X[N],W.indexOf(I)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(B,I))continue;V[I]=B[I]}}return V}function m(B,W){if(B==null)return{};var V={},I=Object.keys(B),N,X;for(X=0;X<I.length;X++){if(N=I[X],W.indexOf(N)>=0)continue;V[N]=B[N]}return V}var v=0;function d(B){return+B.replace("%","")}function o(B){return Array.isArray(B)?B:[B]}function T(B,W,V,I){var N=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,X=arguments.length>5?arguments[5]:void 0,ee=50-I/2,oe=0,ce=-ee,De=0,Ee=-2*ee;switch(X){case"left":oe=-ee,ce=0,De=2*ee,Ee=0;break;case"right":oe=ee,ce=0,De=-2*ee,Ee=0;break;case"bottom":ce=ee,Ee=2*ee;break;default:}var Ce="M 50,50 m ".concat(oe,",").concat(ce,`
|
|
a `).concat(ee,",").concat(ee," 0 1 1 ").concat(De,",").concat(-Ee,`
|
|
a `).concat(ee,",").concat(ee," 0 1 1 ").concat(-De,",").concat(Ee),Te=Math.PI*2*ee,me={stroke:V,strokeDasharray:"".concat(W/100*(Te-N),"px ").concat(Te,"px"),strokeDashoffset:"-".concat(N/2+B/100*(Te-N),"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"};return{pathString:Ce,pathStyle:me}}var S=function(W){var V=W.prefixCls,I=W.strokeWidth,N=W.trailWidth,X=W.gapDegree,ee=W.gapPosition,oe=W.trailColor,ce=W.strokeLinecap,De=W.style,Ee=W.className,Ce=W.strokeColor,Te=W.percent,me=C(W,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"]),pe=Object(ne.useMemo)(function(){return v+=1,v},[]),ue=T(0,100,oe,I,X,ee),te=ue.pathString,he=ue.pathStyle,ae=o(Te),we=o(Ce),Le=we.find(function(Fe){return Object.prototype.toString.call(Fe)==="[object Object]"}),xe=O(ae),_e=l(xe,1),Ie=_e[0],We=function(){var Ne=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=T(Ne,Ue,ot,I,X,ee);return Ne+=Ue,$.a.createElement("path",{key:et,className:"".concat(V,"-circle-path"),d:qe.pathString,stroke:nt,strokeLinecap:ce,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"),Ee),viewBox:"0 0 100 100",style:De},me),Le&&$.a.createElement("defs",null,$.a.createElement("linearGradient",{id:"".concat(V,"-gradient-").concat(pe),x1:"100%",y1:"0%",x2:"0%",y2:"0%"},Object.keys(Le).sort(function(Fe,Ne){return d(Fe)-d(Ne)}).map(function(Fe,Ne){return $.a.createElement("stop",{key:Ne,offset:Fe,stopColor:Le[Fe]})}))),$.a.createElement("path",{className:"".concat(V,"-circle-trail"),d:te,stroke:oe,strokeLinecap:ce,strokeWidth:N||I,fillOpacity:"0",style:he}),We().reverse())};S.defaultProps=U;var y=S,P={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 N=ne.findModeByName(I);N&&(I=N.mime||N.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 F in j)j.hasOwnProperty(F)&&R.tokenTypeOverrides[F]&&(j[F]=R.tokenTypeOverrides[F]);var _=/^([*\-_])(?:\s*\1){2,}\s*$/,A=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,c=/^\[(x| )\](?=\s)/i,x=R.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,M=/^ {0,3}(?:\={1,}|-{2,})\s*$/,w=/^[^#!\[\]*_\\<>` "'(~:]+/,E=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,b=/^\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 l(I,N,X){return N.f=N.inline=X,X(I,N)}function h(I,N,X){return N.f=N.block=X,X(I,N)}function L(I){return!I||!/\S/.test(I.string)}function f(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 N=U;if(!N){var X=ne.innerMode(Q,I.htmlState);N=X.mode.name=="xml"&&X.state.tagStart===null&&!X.state.context&&X.state.tokenize.isInText}N&&(I.f=d,I.block=p,I.htmlState=null)}return I.trailingSpace=0,I.trailingSpaceNewLine=!1,I.prevLine=I.thisLine,I.thisLine={stream:null},null}function p(I,N){var X=I.column()===N.indentation,ee=L(N.prevLine.stream),oe=N.indentedCode,ce=N.prevLine.hr,De=N.list!==!1,Ee=(N.listStack[N.listStack.length-1]||0)+3;N.indentedCode=!1;var Ce=N.indentation;if(N.indentationDiff===null&&(N.indentationDiff=N.indentation,De)){for(N.list=null;Ce<N.listStack[N.listStack.length-1];)N.listStack.pop(),N.listStack.length?N.indentation=N.listStack[N.listStack.length-1]:N.list=!1;N.list!==!1&&(N.indentationDiff=Ce-N.listStack[N.listStack.length-1])}var Te=!ee&&!ce&&!N.prevLine.header&&(!De||!oe)&&!N.prevLine.fencedCodeEnd,me=(N.list===!1||ce||ee)&&N.indentation<=Ee&&I.match(_),pe=null;if(N.indentationDiff>=4&&(oe||N.prevLine.fencedCodeEnd||N.prevLine.header||ee))return I.skipToEnd(),N.indentedCode=!0,j.code;if(I.eatSpace())return null;if(X&&N.indentation<=Ee&&(pe=I.match(x))&&pe[1].length<=6)return N.quote=0,N.header=pe[1].length,N.thisLine.header=!0,R.highlightFormatting&&(N.formatting="header"),N.f=N.inline,m(N);if(N.indentation<=Ee&&I.eat(">"))return N.quote=X?1:N.quote+1,R.highlightFormatting&&(N.formatting="quote"),I.eatSpace(),m(N);if(!me&&!N.setext&&X&&N.indentation<=Ee&&(pe=I.match(A))){var ue=pe[1]?"ol":"ul";return N.indentation=Ce+I.current().length,N.list=!0,N.quote=0,N.listStack.push(N.indentation),N.em=!1,N.strong=!1,N.code=!1,N.strikethrough=!1,R.taskLists&&I.match(c,!1)&&(N.taskList=!0),N.f=N.inline,R.highlightFormatting&&(N.formatting=["list","list-"+ue]),m(N)}else{if(X&&N.indentation<=Ee&&(pe=I.match(E,!0)))return N.quote=0,N.fencedEndRE=new RegExp(pe[1]+"+ *$"),N.localMode=R.fencedCodeBlockHighlighting&&O(pe[2]||R.fencedCodeBlockDefaultMode),N.localMode&&(N.localState=ne.startState(N.localMode)),N.f=N.block=C,R.highlightFormatting&&(N.formatting="code-block"),N.code=-1,m(N);if(N.setext||(!Te||!De)&&!N.quote&&N.list===!1&&!N.code&&!me&&!b.test(I.string)&&(pe=I.lookAhead(1))&&(pe=pe.match(M)))return N.setext?(N.header=N.setext,N.setext=0,I.skipToEnd(),R.highlightFormatting&&(N.formatting="header")):(N.header=pe[0].charAt(0)=="="?1:2,N.setext=N.header),N.thisLine.header=!0,N.f=N.inline,m(N);if(me)return I.skipToEnd(),N.hr=!0,N.thisLine.hr=!0,j.hr;if(I.peek()==="[")return l(I,N,P)}return l(I,N,N.inline)}function D(I,N){var X=Q.token(I,N.htmlState);if(!U){var ee=ne.innerMode(Q,N.htmlState);(ee.mode.name=="xml"&&ee.state.tagStart===null&&!ee.state.context&&ee.state.tokenize.isInText||N.md_inside&&I.current().indexOf(">")>-1)&&(N.f=d,N.block=p,N.htmlState=null)}return X}function C(I,N){var X=N.listStack[N.listStack.length-1]||0,ee=N.indentation<X,oe=X+3;if(N.fencedEndRE&&N.indentation<=oe&&(ee||I.match(N.fencedEndRE))){R.highlightFormatting&&(N.formatting="code-block");var ce;return ee||(ce=m(N)),N.localMode=N.localState=null,N.block=p,N.f=d,N.fencedEndRE=null,N.code=0,N.thisLine.fencedCodeEnd=!0,ee?h(I,N,N.block):ce}else return N.localMode?N.localMode.token(I,N.localState):(I.skipToEnd(),j.code)}function m(I){var N=[];if(I.formatting){N.push(j.formatting),typeof I.formatting=="string"&&(I.formatting=[I.formatting]);for(var X=0;X<I.formatting.length;X++)N.push(j.formatting+"-"+I.formatting[X]),I.formatting[X]==="header"&&N.push(j.formatting+"-"+I.formatting[X]+"-"+I.header),I.formatting[X]==="quote"&&(!R.maxBlockquoteDepth||R.maxBlockquoteDepth>=I.quote?N.push(j.formatting+"-"+I.formatting[X]+"-"+I.quote):N.push("error"))}if(I.taskOpen)return N.push("meta"),N.length?N.join(" "):null;if(I.taskClosed)return N.push("property"),N.length?N.join(" "):null;if(I.linkHref?N.push(j.linkHref,"url"):(I.strong&&N.push(j.strong),I.em&&N.push(j.em),I.strikethrough&&N.push(j.strikethrough),I.emoji&&N.push(j.emoji),I.linkText&&N.push(j.linkText),I.code&&N.push(j.code),I.image&&N.push(j.image),I.imageAltText&&N.push(j.imageAltText,"link"),I.imageMarker&&N.push(j.imageMarker)),I.header&&N.push(j.header,j.header+"-"+I.header),I.quote&&(N.push(j.quote),!R.maxBlockquoteDepth||R.maxBlockquoteDepth>=I.quote?N.push(j.quote+"-"+I.quote):N.push(j.quote+"-"+R.maxBlockquoteDepth)),I.list!==!1){var ee=(I.listStack.length-1)%3;ee?ee===1?N.push(j.list2):N.push(j.list3):N.push(j.list1)}return I.trailingSpaceNewLine?N.push("trailing-space-new-line"):I.trailingSpace&&N.push("trailing-space-"+(I.trailingSpace%2?"a":"b")),N.length?N.join(" "):null}function v(I,N){return I.match(w,!0)?m(N):void 0}function d(I,N){var X=N.text(I,N);if(typeof X!="undefined")return X;if(N.list)return N.list=null,m(N);if(N.taskList){var ee=I.match(c,!0)[1]===" ";return ee?N.taskOpen=!0:N.taskClosed=!0,R.highlightFormatting&&(N.formatting="task"),N.taskList=!1,m(N)}if(N.taskOpen=!1,N.taskClosed=!1,N.header&&I.match(/^#+$/,!0))return R.highlightFormatting&&(N.formatting="header"),m(N);var oe=I.next();if(N.linkTitle){N.linkTitle=!1;var ce=oe;oe==="("&&(ce=")"),ce=(ce+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var De="^\\s*(?:[^"+ce+"\\\\]+|\\\\\\\\|\\\\.)"+ce;if(I.match(new RegExp(De),!0))return j.linkHref}if(oe==="`"){var Ee=N.formatting;R.highlightFormatting&&(N.formatting="code"),I.eatWhile("`");var Ce=I.current().length;if(N.code==0&&(!N.quote||Ce==1))return N.code=Ce,m(N);if(Ce==N.code){var Te=m(N);return N.code=0,Te}else return N.formatting=Ee,m(N)}else if(N.code)return m(N);if(oe==="\\"&&(I.next(),R.highlightFormatting)){var me=m(N),pe=j.formatting+"-escape";return me?me+" "+pe:pe}if(oe==="!"&&I.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return N.imageMarker=!0,N.image=!0,R.highlightFormatting&&(N.formatting="image"),m(N);if(oe==="["&&N.imageMarker&&I.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return N.imageMarker=!1,N.imageAltText=!0,R.highlightFormatting&&(N.formatting="image"),m(N);if(oe==="]"&&N.imageAltText){R.highlightFormatting&&(N.formatting="image");var me=m(N);return N.imageAltText=!1,N.image=!1,N.inline=N.f=T,me}if(oe==="["&&!N.image)return N.linkText&&I.match(/^.*?\]/)||(N.linkText=!0,R.highlightFormatting&&(N.formatting="link")),m(N);if(oe==="]"&&N.linkText){R.highlightFormatting&&(N.formatting="link");var me=m(N);return N.linkText=!1,N.inline=N.f=I.match(/\(.*?\)| ?\[.*?\]/,!1)?T:d,me}if(oe==="<"&&I.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){N.f=N.inline=o,R.highlightFormatting&&(N.formatting="link");var me=m(N);return me?me+=" ":me="",me+j.linkInline}if(oe==="<"&&I.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){N.f=N.inline=o,R.highlightFormatting&&(N.formatting="link");var me=m(N);return me?me+=" ":me="",me+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)&&(N.md_inside=!0)}return I.backUp(1),N.htmlState=ne.startState(Q),h(I,N,D)}if(R.xml&&oe==="<"&&I.match(/^\/\w*?>/))return N.md_inside=!1,"tag";if(oe==="*"||oe==="_"){for(var he=1,ae=I.pos==1?" ":I.string.charAt(I.pos-2);he<3&&I.eat(oe);)he++;var we=I.peek()||" ",Le=!/\s/.test(we)&&(!u.test(we)||/\s/.test(ae)||u.test(ae)),xe=!/\s/.test(ae)&&(!u.test(ae)||/\s/.test(we)||u.test(we)),_e=null,Ie=null;if(he%2&&(!N.em&&Le&&(oe==="*"||!xe||u.test(ae))?_e=!0:N.em==oe&&xe&&(oe==="*"||!Le||u.test(we))&&(_e=!1)),he>1&&(!N.strong&&Le&&(oe==="*"||!xe||u.test(ae))?Ie=!0:N.strong==oe&&xe&&(oe==="*"||!Le||u.test(we))&&(Ie=!1)),Ie!=null||_e!=null){R.highlightFormatting&&(N.formatting=_e==null?"strong":Ie==null?"em":"strong em"),_e===!0&&(N.em=oe),Ie===!0&&(N.strong=oe);var Te=m(N);return _e===!1&&(N.em=!1),Ie===!1&&(N.strong=!1),Te}}else if(oe===" "&&(I.eat("*")||I.eat("_"))){if(I.peek()===" ")return m(N);I.backUp(1)}if(R.strikethrough){if(oe==="~"&&I.eatWhile(oe)){if(N.strikethrough){R.highlightFormatting&&(N.formatting="strikethrough");var Te=m(N);return N.strikethrough=!1,Te}else if(I.match(/^[^\s]/,!1))return N.strikethrough=!0,R.highlightFormatting&&(N.formatting="strikethrough"),m(N)}else if(oe===" "&&I.match(/^~~/,!0)){if(I.peek()===" ")return m(N);I.backUp(2)}}if(R.emoji&&oe===":"&&I.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){N.emoji=!0,R.highlightFormatting&&(N.formatting="emoji");var We=m(N);return N.emoji=!1,We}return oe===" "&&(I.match(/^ +$/,!1)?N.trailingSpace++:N.trailingSpace&&(N.trailingSpaceNewLine=!0)),m(N)}function o(I,N){var X=I.next();if(X===">"){N.f=N.inline=d,R.highlightFormatting&&(N.formatting="link");var ee=m(N);return ee?ee+=" ":ee="",ee+j.linkInline}return I.match(/^[^>]+/,!0),j.linkInline}function T(I,N){if(I.eatSpace())return null;var X=I.next();return X==="("||X==="["?(N.f=N.inline=y(X==="("?")":"]"),R.highlightFormatting&&(N.formatting="link-string"),N.linkHref=!0,m(N)):"error"}var S={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function y(I){return function(N,X){var ee=N.next();if(ee===I){X.f=X.inline=d,R.highlightFormatting&&(X.formatting="link-string");var oe=m(X);return X.linkHref=!1,oe}return N.match(S[I]),X.linkHref=!0,m(X)}}function P(I,N){return I.match(/^([^\]\\]|\\.)*\]:/,!1)?(N.f=B,I.next(),R.highlightFormatting&&(N.formatting="link"),N.linkText=!0,m(N)):l(I,N,d)}function B(I,N){if(I.match(/^\]:/,!0)){N.f=N.inline=W,R.highlightFormatting&&(N.formatting="link");var X=m(N);return N.linkText=!1,X}return I.match(/^([^\]\\]|\\.)+/,!0),j.linkText}function W(I,N){return I.eatSpace()?null:(I.match(/^[^\s]+/,!0),I.peek()===void 0?N.linkTitle=!0:I.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),N.f=N.inline=d,j.linkHref+" url")}var V={startState:function(){return{f:p,prevLine:{stream:null},thisLine:{stream:null},block:p,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,N){if(N.formatting=!1,I!=N.thisLine.stream){if(N.header=0,N.hr=!1,I.match(/^\s*$/,!0))return f(N),null;if(N.prevLine=N.thisLine,N.thisLine={stream:I},N.taskList=!1,N.trailingSpace=0,N.trailingSpaceNewLine=!1,!N.localState&&(N.f=N.block,N.f!=D)){var X=I.match(/^\s*/,!0)[0].replace(/\t/g,a).length;if(N.indentation=X,N.indentationDiff=null,X>0)return null}}return N.f(I,N)},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,N,X){return I.block==D&&Q.indent?Q.indent(I.htmlState,N,X):I.localState&&I.localMode.indent?I.localMode.indent(I.localState,N,X):ne.Pass},blankLine:f,getType:m,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,l,h){this.line=a,this.ch=l,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 F(u,a){var l=u.cm.getTokenTypeAt($(u.line,a));return l&&/\btag\b/.test(l)}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 c(u){for(;;){var a=u.text.indexOf(">",u.ch);if(a==-1){if(_(u))continue;return}if(!F(u,a+1)){u.ch=a+1;continue}var l=u.text.lastIndexOf("/",a),h=l>-1&&!/\S/.test(u.text.slice(l+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(!F(u,a+1)){u.ch=a;continue}O.lastIndex=a,u.ch=a;var l=O.exec(u.text);if(l&&l.index==a)return l}}function M(u){for(;;){O.lastIndex=u.ch;var a=O.exec(u.text);if(!a){if(_(u))continue;return}if(!F(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(!F(u,a+1)){u.ch=a;continue}var l=u.text.lastIndexOf("/",a),h=l>-1&&!/\S/.test(u.text.slice(l+1,a));return u.ch=a+1,h?"selfClose":"regular"}}function E(u,a){for(var l=[];;){var h=M(u),L,f=u.line,p=u.ch-(h?h[0].length:0);if(!h||!(L=c(u)))return;if(L=="selfClose")continue;if(h[1]){for(var D=l.length-1;D>=0;--D)if(l[D]==h[2]){l.length=D;break}if(D<0&&(!a||a==h[2]))return{tag:h[2],from:$(f,p),to:$(u.line,u.ch)}}else l.push(h[2])}}function b(u,a){for(var l=[];;){var h=w(u);if(!h)return;if(h=="selfClose"){x(u);continue}var L=u.line,f=u.ch,p=x(u);if(!p)return;if(p[1])l.push(p[2]);else{for(var D=l.length-1;D>=0;--D)if(l[D]==p[2]){l.length=D;break}if(D<0&&(!a||a==p[2]))return{tag:p[2],from:$(u.line,u.ch),to:$(L,f)}}}}ne.registerHelper("fold","xml",function(u,a){for(var l=new j(u,a.line,0);;){var h=M(l);if(!h||l.line!=a.line)return;var L=c(l);if(!L)return;if(!h[1]&&L!="selfClose"){var f=$(l.line,l.ch),p=E(l,h[2]);return p&&R(p.from,f)>0?{from:f,to:p.from}:null}}}),ne.findMatchingTag=function(u,a,l){var h=new j(u,a.line,a.ch,l);if(h.text.indexOf(">")==-1&&h.text.indexOf("<")==-1)return;var L=c(h),f=L&&$(h.line,h.ch),p=L&&x(h);if(!L||!p||R(h,a)>0)return;var D={from:$(h.line,h.ch),to:f,tag:p[2]};return L=="selfClose"?{open:D,close:null,at:"open"}:p[1]?{open:b(h,p[2]),close:D,at:"close"}:(h=new j(u,f.line,f.ch,l),{open:D,close:E(h,p[2]),at:"open"})},ne.findEnclosingTag=function(u,a,l,h){for(var L=new j(u,a.line,a.ch,l);;){var f=b(L,h);if(!f)break;var p=new j(u,a.line,a.ch,l),D=E(p,f.tag);if(D)return{open:f,close:D}}},ne.scanForClosingTag=function(u,a,l,h){var L=new j(u,a.line,a.ch,h?{from:0,to:h}:null);return E(L,l)}})},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("9og8"),j=se("tJVT"),F=se("WmNS"),_=se.n(F),A=se("q1tI"),c=se.n(A),x=se("vHTk"),M=se.n(x),w=se("yEEn"),E=se("ZW9T"),b=se("1vsH"),u=se("V0Rq"),a=se("m3rI"),l=function(L){var f=L.name,p=L.data,D=L.theme,C=L.type,m=L.filename,v=L.monacoEditor,d=L.className,o=L.style,T=L.close,S=L.onClose,y=L.hasMask,P=L.otherData,B=P===void 0?{}:P,W=Object(A.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),V=Object(j.a)(W,2),I=V[0],N=V[1],X=Object(A.useState)(""),ee=Object(j.a)(X,2),oe=ee[0],ce=ee[1],De=Object(A.useState)(),Ee=Object(j.a)(De,2),Ce=Ee[0],Te=Ee[1],me,pe=1024*1024,ue=10*pe,te=Object(A.useRef)();C==="office"&&(me=Object(b.R)(p).filesize,me>ue&&(C="other")),m&&(v.filename=m),Object(A.useEffect)(function(){var Le,xe,_e=(Le=document.cookie)===null||Le===void 0||((xe=Le.replace(/\s/g,""))===null||xe===void 0)?void 0:xe.split(";");_e==null||_e.map(function(Ie){var We=Ie.split("=");We[0]==="_educoder_session"&&ce(We[1])})},[]),Object(A.useEffect)(function(){C==="office"&&he()},[C]);var he=function(){var Le=Object(O.a)(_.a.mark(function xe(){var _e,Ie,We;return _.a.wrap(function(Ne){for(;;)switch(Ne.prev=Ne.next){case 0:return console.log("data:",p),_e=p,p.startsWith("http")||(_e=location.origin+_e),Ie=new URL(_e).pathname.split("/").pop(),Ne.next=6,Object(u.U)({attachment_id:Ie});case 6:We=Ne.sent,Te(We);case 8:case"end":return Ne.stop()}},xe)}));return function(){return Le.apply(this,arguments)}}(),ae=function(){if(p.startsWith("http")||p.startsWith("blob:")){we();return}Object(b.x)(m||"educoder",p,m)},we=function(){Object(b.v)(m||"educoder",decodeURIComponent(p))};return c.a.createElement("div",{style:Object(U.a)({},o||{}),className:"".concat(y&&M.a.bgBlack," ").concat(C?M.a.wrp:"hide")},T&&c.a.createElement("div",{className:M.a.close,ref:te},c.a.createElement(Q.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return te.current}},c.a.createElement("span",{onClick:we},c.a.createElement("i",{className:"icon-quxiaozhiding"}))),c.a.createElement(Q.a,{title:"\u5173\u95ED",getPopupContainer:function(){return te.current}},c.a.createElement("span",{className:"",onClick:function(){S(),Te(null)}},c.a.createElement("i",{className:"icon-guanbi1"})))),c.a.createElement("div",{className:"".concat(M.a[d]," ").concat(d," ").concat(M.a.monaco," ").concat(C==="txt"?"show":"hide")},C==="txt"&&c.a.createElement(E.b,v)),C==="audio"&&c.a.createElement("audio",{src:"".concat((p==null?void 0:p.indexOf("http://"))>-1||(p==null?void 0:p.indexOf("https://"))>-1?"":"data:audio/mp3;base64,").concat(p),autoPlay:!0}),C==="video"&&c.a.createElement(c.a.Fragment,null,(p==null?void 0:p.indexOf("http"))>-1?c.a.createElement("video",{controls:!0,src:"".concat(p),autoPlay:!0}):c.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(p),autoPlay:!0})),C==="office"&&Ce&&c.a.createElement("iframe",{src:"/react/build/office.html?key=".concat(Ce.key,"&url=").concat(a.a.API_SERVER+Ce.url,"&callbackUrl=").concat(a.a.API_SERVER+Ce.callbackUrl,"&fileType=").concat(Ce.fileType,"&title=").concat(Ce.title,"&model=view")}),(C==="xlsx"||C==="doc"||C==="pptx"||C==="docx")&&c.a.createElement("iframe",{src:"/react/build/office.html?key=".concat(B.key,"&url=").concat(a.a.API_SERVER+B.url,"&callbackUrl=").concat(a.a.API_SERVER+B.callbackUrl,"&fileType=").concat(B.fileType,"&title=").concat(B.title,"&model=").concat(B.model)}),C==="html"&&c.a.createElement("iframe",{src:p+"&disposition=inline"}),C==="pdf"&&c.a.createElement("embed",{className:M.a.embed,src:p,type:"application/pdf"}),C==="image"&&c.a.createElement("img",{src:"".concat((p==null?void 0:p.indexOf("http://"))>-1||(p==null?void 0:p.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(p)}),C==="other"&&c.a.createElement("div",null,c.a.createElement($.a,{type:"primary",size:"large",onClick:ae},c.a.createElement(w.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),C==="download"&&c.a.createElement($.a,{type:"primary",size:"large",onClick:ae},c.a.createElement(w.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))};at.a=l},"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 F=!0,_=!1,A;return{s:function(){U=R[Symbol.iterator]()},n:function(){var x=U.next();return F=x.done,x},e:function(x){_=!0,A=x},f:function(){try{!F&&U.return!=null&&U.return()}finally{if(_)throw A}}}}},rUJ1:function(dt,at){const se=/[&<>"']/,ne=/[&<>"']/g,$=/[<>"']|&(?!#?\w+;)/,R=/[<>"']|&(?!#?\w+;)/g,Q={"&":"&","<":"<",">":">",'"':""","'":"'"},U=C=>Q[C];function O(C,m){if(m){if(se.test(C))return C.replace(ne,U)}else if($.test(C))return C.replace(R,U);return C}const j=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function F(C){return C.replace(j,(m,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(C,m){C=C.source||C,m=m||"";const v={replace:(d,o)=>(o=o.source||o,o=o.replace(_,"$1"),C=C.replace(d,o),v),getRegex:()=>new RegExp(C,m)};return v}const c=/[^\w:]/g,x=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function M(C,m,v){if(C){let d;try{d=decodeURIComponent(F(v)).replace(c,"").toLowerCase()}catch(o){return null}if(d.indexOf("javascript:")===0||d.indexOf("vbscript:")===0||d.indexOf("data:")===0)return null}m&&!x.test(v)&&(v=a(m,v));try{v=encodeURI(v).replace(/%25/g,"%")}catch(d){return null}return v}const w={},E=/^[^:]+:\/*[^/]*$/,b=/^([^:]+:)[\s\S]*$/,u=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(C,m){w[" "+C]||(E.test(C)?w[" "+C]=C+"/":w[" "+C]=f(C,"/",!0)),C=w[" "+C];const v=C.indexOf(":")===-1;return m.substring(0,2)==="//"?v?m:C.replace(b,"$1")+m:m.charAt(0)==="/"?v?m:C.replace(u,"$1")+m:C+m}const l={exec:function(){}};function h(C){let m=1,v,d;for(;m<arguments.length;m++){v=arguments[m];for(d in v)Object.prototype.hasOwnProperty.call(v,d)&&(C[d]=v[d])}return C}function L(C,m){const v=C.replace(/\|/g,(T,S,y)=>{let P=!1,B=S;for(;--B>=0&&y[B]==="\\";)P=!P;return P?"|":" |"}),d=v.split(/ \|/);let o=0;if(d.length>m)d.splice(m);else for(;d.length<m;)d.push("");for(;o<d.length;o++)d[o]=d[o].trim().replace(/\\\|/g,"|");return d}function f(C,m,v){const d=C.length;if(d===0)return"";let o=0;for(;o<d;){const T=C.charAt(d-o-1);if(T===m&&!v)o++;else if(T!==m&&v)o++;else break}return C.substr(0,d-o)}function p(C,m){if(C.indexOf(m[1])===-1)return-1;const v=C.length;let d=0,o=0;for(;o<v;o++)if(C[o]==="\\")o++;else if(C[o]===m[0])d++;else if(C[o]===m[1]&&(d--,d<0))return o;return-1}function D(C){C&&C.sanitize&&!C.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:F,edit:A,cleanUrl:M,resolveUrl:a,noopTest:l,merge:h,splitCells:L,rtrim:f,findClosingBracket:p,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,F=0;F<O;F++)for(var _=U[F*3+0],A=U[F*3+1],c=U[F*3+2],x=0;x<_;x++)j.push(new $(A,c));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(F){return Q[F]}.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(c,x,M){this.fn=c,this.context=x,this.once=M||!1}function F(c,x,M,w,E){if(typeof M!="function")throw new TypeError("The listener must be a function");var b=new j(M,w||c,E),u=U?U+x:x;return c._events[u]?c._events[u].fn?c._events[u]=[c._events[u],b]:c._events[u].push(b):(c._events[u]=b,c._eventsCount++),c}function _(c,x){--c._eventsCount===0?c._events=new O:delete c._events[x]}function A(){this._events=new O,this._eventsCount=0}A.prototype.eventNames=function(){var x=[],M,w;if(this._eventsCount===0)return x;for(w in M=this._events)Q.call(M,w)&&x.push(U?w.slice(1):w);return Object.getOwnPropertySymbols?x.concat(Object.getOwnPropertySymbols(M)):x},A.prototype.listeners=function(x){var M=U?U+x:x,w=this._events[M];if(!w)return[];if(w.fn)return[w.fn];for(var E=0,b=w.length,u=new Array(b);E<b;E++)u[E]=w[E].fn;return u},A.prototype.listenerCount=function(x){var M=U?U+x:x,w=this._events[M];return w?w.fn?1:w.length:0},A.prototype.emit=function(x,M,w,E,b,u){var a=U?U+x:x;if(!this._events[a])return!1;var l=this._events[a],h=arguments.length,L,f;if(l.fn){l.once&&this.removeListener(x,l.fn,void 0,!0);switch(h){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,M),!0;case 3:return l.fn.call(l.context,M,w),!0;case 4:return l.fn.call(l.context,M,w,E),!0;case 5:return l.fn.call(l.context,M,w,E,b),!0;case 6:return l.fn.call(l.context,M,w,E,b,u),!0}for(f=1,L=new Array(h-1);f<h;f++)L[f-1]=arguments[f];l.fn.apply(l.context,L)}else{var p=l.length,D;for(f=0;f<p;f++){l[f].once&&this.removeListener(x,l[f].fn,void 0,!0);switch(h){case 1:l[f].fn.call(l[f].context);break;case 2:l[f].fn.call(l[f].context,M);break;case 3:l[f].fn.call(l[f].context,M,w);break;case 4:l[f].fn.call(l[f].context,M,w,E);break;default:if(!L)for(D=1,L=new Array(h-1);D<h;D++)L[D-1]=arguments[D];l[f].fn.apply(l[f].context,L)}}}return!0},A.prototype.on=function(x,M,w){return F(this,x,M,w,!1)},A.prototype.once=function(x,M,w){return F(this,x,M,w,!0)},A.prototype.removeListener=function(x,M,w,E){var b=U?U+x:x;if(!this._events[b])return this;if(!M)return _(this,b),this;var u=this._events[b];if(u.fn)u.fn===M&&(!E||u.once)&&(!w||u.context===w)&&_(this,b);else{for(var a=0,l=[],h=u.length;a<h;a++)(u[a].fn!==M||E&&!u[a].once||w&&u[a].context!==w)&&l.push(u[a]);l.length?this._events[b]=l.length===1?l[0]:l:_(this,b)}return this},A.prototype.removeAllListeners=function(x){var M;return x?(M=U?U+x:x,this._events[M]&&_(this,M)):(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,F=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,_={buildAbsoluteURL:function(A,c,x){if(x=x||{},A=A.trim(),c=c.trim(),!c){if(!x.alwaysNormalize)return A;var M=_.parseURL(A);if(!M)throw new Error("Error trying to parse base URL.");return M.path=_.normalizePath(M.path),_.buildURLFromParts(M)}var w=_.parseURL(c);if(!w)throw new Error("Error trying to parse relative URL.");if(w.scheme)return x.alwaysNormalize?(w.path=_.normalizePath(w.path),_.buildURLFromParts(w)):c;var E=_.parseURL(A);if(!E)throw new Error("Error trying to parse base URL.");if(!E.netLoc&&E.path&&E.path[0]!=="/"){var b=O.exec(E.path);E.netLoc=b[1],E.path=b[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,l=a.substring(0,a.lastIndexOf("/")+1)+w.path;u.path=_.normalizePath(l)}return u.path===null&&(u.path=x.alwaysNormalize?_.normalizePath(w.path):w.path),_.buildURLFromParts(u)},parseURL:function(A){var c=U.exec(A);return c?{scheme:c[1]||"",netLoc:c[2]||"",path:c[3]||"",params:c[4]||"",query:c[5]||"",fragment:c[6]||""}:null},normalizePath:function(A){for(A=A.split("").reverse().join("").replace(j,"");A.length!==(A=A.replace(F,"")).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 M={};function w(b){if(M[b])return M[b].exports;var u=M[b]={i:b,l:!1,exports:{}};return x[b].call(u.exports,u,u.exports,w),u.l=!0,u.exports}w.m=x,w.c=M,w.i=function(b){return b},w.d=function(b,u,a){w.o(b,u)||Object.defineProperty(b,u,{configurable:!1,enumerable:!0,get:a})},w.r=function(b){Object.defineProperty(b,"__esModule",{value:!0})},w.n=function(b){var u=b&&b.__esModule?function(){return b.default}:function(){return b};return w.d(u,"a",u),u},w.o=function(b,u){return Object.prototype.hasOwnProperty.call(b,u)},w.p="/",w.oe=function(b){throw console.error(b),b};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 F(x){return!isNaN(1*x)}function _(x,M,w){var E={};E[w]=[];var b=M.toString(),u=b.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!u)return E;for(var a=u[1],l=new RegExp("(\\\\n|\\W)"+j(a)+O,"g"),h;h=l.exec(b);){if(h[3]==="dll-reference")continue;E[w].push(h[3])}for(l=new RegExp("\\("+j(a)+'\\("(dll-reference\\s('+U+'))"\\)\\)'+O,"g");h=l.exec(b);)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 L=Object.keys(E),f=0;f<L.length;f++)for(var p=0;p<E[L[f]].length;p++)F(E[L[f]][p])&&(E[L[f]][p]=1*E[L[f]][p]);return E}function A(x){var M=Object.keys(x);return M.reduce(function(w,E){return w||x[E].length>0},!1)}function c(x,M){for(var w={main:[M]},E={main:[]},b={main:{}};A(w);)for(var u=Object.keys(w),a=0;a<u.length;a++){var l=u[a],h=w[l],L=h.pop();if(b[l]=b[l]||{},b[l][L]||!x[l][L])continue;b[l][L]=!0,E[l]=E[l]||[],E[l].push(L);for(var f=_(x,x[l][L],l),p=Object.keys(f),D=0;D<p.length;D++)w[p[D]]=w[p[D]]||[],w[p[D]]=w[p[D]].concat(f[p[D]])}return E}ne.exports=function(x,M){M=M||{};var w={main:R.m},E=M.all?{main:Object.keys(w.main)}:c(w,x),b="";Object.keys(E).filter(function(L){return L!=="main"}).forEach(function(L){for(var f=0;E[L][f];)f++;E[L].push(f),w[L][f]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",b=b+"var "+L+" = ("+Q.toString().replace("ENTRY_MODULE",JSON.stringify(f))+")({"+E[L].map(function(p){return""+JSON.stringify(p)+": "+w[L][p].toString()}).join(",")+`});
|
|
`}),b=b+"new (("+Q.toString().replace("ENTRY_MODULE",JSON.stringify(x))+")({"+E.main.map(function(L){return""+JSON.stringify(L)+": "+w.main[L].toString()}).join(",")+"}))(self);";var u=new window.Blob([b],{type:"text/javascript"});if(M.bare)return u;var a=window.URL||window.webkitURL||window.mozURL||window.msURL,l=a.createObjectURL(u),h=new window.Worker(l);return h.objectURL=l,h}},"./src/config.ts":function(ne,$,R){"use strict";R.r($),R.d($,"hlsDefaultConfig",function(){return D}),R.d($,"mergeConfig",function(){return m}),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"),F=R("./src/controller/subtitle-track-controller.ts"),_=R("./src/controller/buffer-controller.ts"),A=R("./src/controller/timeline-controller.ts"),c=R("./src/controller/cap-level-controller.ts"),x=R("./src/controller/fps-controller.ts"),M=R("./src/controller/eme-controller.ts"),w=R("./src/controller/cmcd-controller.ts"),E=R("./src/utils/xhr-loader.ts"),b=R("./src/utils/fetch-loader.ts"),u=R("./src/utils/cues.ts"),a=R("./src/utils/mediakeys-helper.ts"),l=R("./src/utils/logger.ts");function h(){return h=Object.assign||function(d){for(var o=1;o<arguments.length;o++){var T=arguments[o];for(var S in T)Object.prototype.hasOwnProperty.call(T,S)&&(d[S]=T[S])}return d},h.apply(this,arguments)}function L(d,o){var T=Object.keys(d);if(Object.getOwnPropertySymbols){var S=Object.getOwnPropertySymbols(d);o&&(S=S.filter(function(y){return Object.getOwnPropertyDescriptor(d,y).enumerable})),T.push.apply(T,S)}return T}function f(d){for(var o=1;o<arguments.length;o++){var T=arguments[o]!=null?arguments[o]:{};o%2?L(Object(T),!0).forEach(function(S){p(d,S,T[S])}):Object.getOwnPropertyDescriptors?Object.defineProperties(d,Object.getOwnPropertyDescriptors(T)):L(Object(T)).forEach(function(S){Object.defineProperty(d,S,Object.getOwnPropertyDescriptor(T,S))})}return d}function p(d,o,T){return o in d?Object.defineProperty(d,o,{value:T,enumerable:!0,configurable:!0,writable:!0}):d[o]=T,d}var D=f(f({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:c.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},C()),{},{subtitleStreamController:j.SubtitleStreamController,subtitleTrackController:F.default,timelineController:A.TimelineController,audioStreamController:U.default,audioTrackController:O.default,emeController:M.default,cmcdController:w.default});function C(){return{cueHandler:u.default,enableCEA708Captions:!0,enableWebVTT:!0,enableIMSC1:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function m(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!==b.default&&o!==E.default)l.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),d.progressive=!1;else{var T=Object(b.fetchSupported)();T&&(d.loader=b.default,d.progressive=!0,d.enableSoftwareAES=!0,l.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"),F=R("./src/errors.ts"),_=R("./src/types/loader.ts"),A=R("./src/utils/logger.ts");function c(w,E){for(var b=0;b<E.length;b++){var u=E[b];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(w,u.key,u)}}function x(w,E,b){return E&&c(w.prototype,E),b&&c(w,b),w}var M=function(){function w(b){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=b;var u=b.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 l=a.frag;if(l.type===_.PlaylistLevelType.MAIN&&!this.timer){var h;this.fragCurrent=l,this.partCurrent=(h=a.part)!=null?h:null,this.timer=self.setInterval(this.onCheck,100)}},E.onLevelLoaded=function(u,a){var l=this.hls.config;a.details.live?this.bwEstimator.update(l.abrEwmaSlowLive,l.abrEwmaFastLive):this.bwEstimator.update(l.abrEwmaSlowVoD,l.abrEwmaFastVoD)},E._abandonRulesCheck=function(){var u=this.fragCurrent,a=this.partCurrent,l=this.hls,h=l.autoLevelEnabled,L=l.config,f=l.media;if(!u||!f)return;var p=a?a.stats:u.stats,D=a?a.duration:u.duration;if(p.aborted){A.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!h||f.paused||!f.playbackRate||!f.readyState)return;var C=performance.now()-p.loading.start,m=Math.abs(f.playbackRate);if(C<=500*D/m)return;var v=l.levels,d=l.minAutoLevel,o=v[u.level],T=p.total||Math.max(p.loaded,Math.round(D*o.maxBitrate/8)),S=Math.max(1,p.bwEstimate?p.bwEstimate/8:p.loaded*1e3/C),y=(T-p.loaded)/S,P=f.currentTime,B=(j.BufferHelper.bufferInfo(f,P,L.maxBufferHole).end-P)/m;if(B>=2*D/m||y<=B)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<B)break}if(W>=y)return;var N=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)(N)?(N/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: `+B.toFixed(3)+" s"),l.nextLoadLevel=V,this.bwEstimator.sample(C,p.loaded),this.clearTimer(),u.loader&&(this.fragCurrent=this.partCurrent=null,u.loader.abort()),l.trigger(O.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:u,part:a,stats:p})},E.onFragLoaded=function(u,a){var l=a.frag,h=a.part;if(l.type===_.PlaylistLevelType.MAIN&&Object(Q.isFiniteNumber)(l.sn)){var L=h?h.stats:l.stats,f=h?h.duration:l.duration;if(this.clearTimer(),this.lastLoadedFragLevel=l.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var p=this.hls.levels[l.level],D=(p.loaded?p.loaded.bytes:0)+L.loaded,C=(p.loaded?p.loaded.duration:0)+f;p.loaded={bytes:D,duration:C},p.realBitrate=Math.round(8*D/C)}if(l.bitrateTest){var m={stats:L,frag:l,part:h,id:l.type};this.onFragBuffered(O.Events.FRAG_BUFFERED,m),l.bitrateTest=!1}}},E.onFragBuffered=function(u,a){var l=a.frag,h=a.part,L=h?h.stats:l.stats;if(L.aborted)return;if(l.type!==_.PlaylistLevelType.MAIN||l.sn==="initSegment")return;var f=L.parsing.end-L.loading.start;this.bwEstimator.sample(f,L.loaded),L.bwEstimate=this.bwEstimator.getEstimate(),l.bitrateTest?this.bitrateTestDelay=f/1e3:this.bitrateTestDelay=0},E.onError=function(u,a){switch(a.details){case F.ErrorDetails.FRAG_LOAD_ERROR:case F.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,l=this.hls,h=l.maxAutoLevel,L=l.config,f=l.minAutoLevel,p=l.media,D=a?a.duration:u?u.duration:0,C=p?p.currentTime:0,m=p&&p.playbackRate!==0?Math.abs(p.playbackRate):1,v=this.bwEstimator?this.bwEstimator.getEstimate():L.abrEwmaDefaultEstimate,d=(j.BufferHelper.bufferInfo(p,C,L.maxBufferHole).end-C)/m,o=this.findBestLevel(v,f,h,d,L.abrBandWidthFactor,L.abrBandWidthUpFactor);if(o>=0)return o;A.logger.trace((d?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var T=D?Math.min(D,L.maxStarvationDelay):L.maxStarvationDelay,S=L.abrBandWidthFactor,y=L.abrBandWidthUpFactor;if(!d){var P=this.bitrateTestDelay;if(P){var B=D?Math.min(D,L.maxLoadingDelay):L.maxLoadingDelay;T=B-P,A.logger.trace("bitrate test took "+Math.round(1e3*P)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*T)+" ms"),S=y=1}}return o=this.findBestLevel(v,f,h,d+T,S,y),Math.max(o,0)},E.findBestLevel=function(u,a,l,h,L,f){for(var p,D=this.fragCurrent,C=this.partCurrent,m=this.lastLoadedFragLevel,v=this.hls.levels,d=v[m],o=!!(d!=null&&(p=d.details)!==null&&p!==void 0&&p.live),T=d==null?void 0:d.codecSet,S=C?C.duration:D?D.duration:0,y=l;y>=a;y--){var P=v[y];if(!P||T&&P.codecSet!==T)continue;var B=P.details,W=(C?B==null?void 0:B.partTarget:B==null?void 0:B.averagetargetduration)||S,V=void 0;y<=m?V=L*u:V=f*u;var I=v[y].maxBitrate,N=I*W/V;if(A.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+y+"/"+Math.round(V)+"/"+I+"/"+W+"/"+h+"/"+N),V>I&&(!N||o&&!this.bitrateTestDelay||N<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 l=this.getNextABRAutoLevel();return u!==-1&&(l=Math.min(u,l)),l},set:function(u){this._nextAutoLevel=u}}]),w}();$.default=M},"./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"),F=R("./src/controller/fragment-tracker.ts"),_=R("./src/types/level.ts"),A=R("./src/types/loader.ts"),c=R("./src/loader/fragment.ts"),x=R("./src/demux/chunk-cache.ts"),M=R("./src/demux/transmuxer-interface.ts"),w=R("./src/types/transmuxer.ts"),E=R("./src/controller/fragment-finders.ts"),b=R("./src/utils/discontinuities.ts"),u=R("./src/errors.ts"),a=R("./src/utils/logger.ts");function l(){return l=Object.assign||function(D){for(var C=1;C<arguments.length;C++){var m=arguments[C];for(var v in m)Object.prototype.hasOwnProperty.call(m,v)&&(D[v]=m[v])}return D},l.apply(this,arguments)}function h(D,C){D.prototype=Object.create(C.prototype),D.prototype.constructor=D,L(D,C)}function L(D,C){return L=Object.setPrototypeOf||function(v,d){return v.__proto__=d,v},L(D,C)}var f=100,p=function(D){h(C,D);function C(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 m=C.prototype;return m.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},m._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)},m._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)},m.onInitPtsFound=function(d,o){var T=o.frag,S=o.id,y=o.initPTS;if(S==="main"){var P=T.cc;this.initPTS[T.cc]=y,this.log("InitPTS for cc: "+P+" found from main: "+y),this.videoTrackCC=P,this.state===U.State.WAITING_INIT_PTS&&this.tick()}},m.startLoad=function(d){if(!this.levels){this.startPosition=d,this.state=U.State.STOPPED;return}var o=this.lastCurrentTime;this.stopLoad(),this.setInterval(f),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()},m.doTick=function(){switch(this.state){case U.State.IDLE:this.doTickIdle();break;case U.State.WAITING_TRACK:{var d,o=this.levels,T=this.trackId,S=o==null||((d=o[T])===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,P=performance.now(),B=this.retryDate;(!B||P>=B||(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,N=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=N.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 ce=this.getLoadPosition(),De=j.BufferHelper.bufferInfo(this.mediaBuffer,ce,this.config.maxBufferHole),Ee=Object(E.fragmentWithinToleranceTest)(De.end,this.config.maxFragLookUpTolerance,V);Ee<0&&(a.logger.log("Waiting fragment cc ("+V.cc+") @ "+V.start+" cancelled because another fragment at "+De.end+" is needed"),this.clearWaitingFragment())}}else this.state=U.State.IDLE}}this.onTickEnd()},m.clearWaitingFragment=function(){var d=this.waitingData;d&&(this.fragmentTracker.removeFragment(d.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=U.State.IDLE)},m.onTickEnd=function(){var d=this.media;if(!d||!d.readyState)return;var o=this.mediaBuffer?this.mediaBuffer:d,T=o.buffered;!this.loadedmetadata&&T.length&&(this.loadedmetadata=!0),this.lastCurrentTime=d.currentTime},m.doTickIdle=function(){var d,o,T=this.hls,S=this.levels,y=this.media,P=this.trackId,B=T.config;if(!S||!S[P])return;if(!y&&(this.startFragRequested||!B.startFragPrefetch))return;var W=S[P],V=W.details;if(!V||V.live&&this.levelLastLoaded!==P||this.waitForCdnTuneIn(V)){this.state=U.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,c.ElementaryStreamTypes.AUDIO,A.PlaylistLevelType.AUDIO));var I=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,A.PlaylistLevelType.AUDIO);if(I===null)return;var N=I.len,X=this.getMaxBufferLength(),ee=this.audioSwitch;if(N>=X&&!ee)return;if(!ee&&this._streamEnded(I,V)){T.trigger(O.Events.BUFFER_EOS,{type:"audio"}),this.state=U.State.ENDED;return}var oe=V.fragments,ce=oe[0].start,De=I.end;if(ee){var Ee=this.getLoadPosition();De=Ee,V.PTSKnown&&Ee<ce&&((I.end>ce||I.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),y.currentTime=ce+.05))}var Ce=this.getNextFragment(De,V);if(!Ce){this.bufferFlushed=!0;return}((d=Ce.decryptdata)===null||d===void 0?void 0:d.keyFormat)==="identity"&&!((o=Ce.decryptdata)!==null&&o!==void 0&&o.key)?this.loadKey(Ce,V):this.loadFragment(Ce,V,De)},m.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)},m.onMediaDetaching=function(){this.videoBuffer=null,D.prototype.onMediaDetaching.call(this)},m.onAudioTracksUpdated=function(d,o){var T=o.audioTracks;this.resetTransmuxer(),this.levels=T.map(function(S){return new _.Level(S)})},m.onAudioTrackSwitching=function(d,o){var T=!!o.url;this.trackId=o.id;var S=this.fragCurrent;S!=null&&S.loader&&S.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),T?this.setInterval(f):this.resetTransmuxer(),T?(this.audioSwitch=!0,this.state=U.State.IDLE):this.state=U.State.STOPPED,this.tick()},m.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},m.onLevelLoaded=function(d,o){this.mainDetails=o.details},m.onAudioTrackLoaded=function(d,o){var T,S=this.levels,y=o.details,P=o.id;if(!S){this.warn("Audio tracks were reset while loading level "+P);return}this.log("Track "+P+" loaded ["+y.startSN+","+y.endSN+"],duration:"+y.totalduration);var B=S[P],W=0;if(y.live||(T=B.details)!==null&&T!==void 0&&T.live){var V=this.mainDetails;if(y.fragments[0]||(y.deltaUpdateFailed=!0),y.deltaUpdateFailed||!V)return;!B.details&&y.hasProgramDateTime&&V.hasProgramDateTime?(Object(b.alignMediaPlaylistByPDT)(y,V),W=y.fragments[0].start):W=this.alignPlaylists(y,B.details)}B.details=y,this.levelLastLoaded=P,!this.startFragRequested&&(this.mainDetails||!y.live)&&this.setStartPosition(B.details,W),this.state===U.State.WAITING_TRACK&&!this.waitForCdnTuneIn(y)&&(this.state=U.State.IDLE),this.tick()},m._handleFragmentLoadProgress=function(d){var o,T=d.frag,S=d.part,y=d.payload,P=this.config,B=this.trackId,W=this.levels;if(!W){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+T.sn+" of level "+T.level+" will not be buffered");return}var V=W[B];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 N=P.defaultAudioCodec||V.audioCodec||"mp4a.40.2",X=this.transmuxer;X||(X=this.transmuxer=new M.default(this.hls,A.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var ee=this.initPTS[T.cc],oe=(o=T.initSegment)===null||o===void 0?void 0:o.data;if(ee!==void 0){var ce=!1,De=S?S.index:-1,Ee=De!==-1,Ce=new w.ChunkMetadata(T.level,T.sn,T.stats.chunkCount,y.byteLength,De,Ee);X.push(y,oe,N,"",T,S,I.totalduration,ce,Ce,ee)}else{a.logger.log("Unknown video PTS for cc "+T.cc+", waiting for video PTS before demuxing audio frag "+T.sn+" of ["+I.startSN+" ,"+I.endSN+"],track "+B);var Te=this.waitingData=this.waitingData||{frag:T,part:S,cache:new x.default,complete:!1},me=Te.cache;me.push(new Uint8Array(y)),this.waitingVideoCC=this.videoTrackCC,this.state=U.State.WAITING_INIT_PTS}},m._handleFragmentLoadComplete=function(d){if(this.waitingData){this.waitingData.complete=!0;return}D.prototype._handleFragmentLoadComplete.call(this,d)},m.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},m.onBufferCreated=function(d,o){var T=o.tracks.audio;T&&(this.mediaBuffer=T.buffer),o.tracks.video&&(this.videoBuffer=o.tracks.video.buffer)},m.onFragBuffered=function(d,o){var T=o.frag,S=o.part;if(T.type!==A.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(T)){this.warn("Fragment "+T.sn+(S?" p: "+S.index:"")+" of level "+T.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}T.sn!=="initSegment"&&(this.fragPrevious=T,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(O.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(T,S)},m.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 T=!0,S=this.getFwdBufferInfo(this.mediaBuffer,A.PlaylistLevelType.AUDIO);S&&S.len>.5&&(T=!this.reduceMaxBufferLength(S.len)),T&&(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}},m.onBufferFlushed=function(d,o){var T=o.type;T===c.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},m._handleTransmuxComplete=function(d){var o,T="audio",S=this.hls,y=d.remuxResult,P=d.chunkMeta,B=this.getCurrentContext(P);if(!B){this.warn("The loading context changed while buffering fragment "+P.sn+" of level "+P.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(P.level);return}var W=B.frag,V=B.part,I=y.audio,N=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,P),S.trigger(O.Events.FRAG_PARSING_INIT_SEGMENT,{frag:W,id:T,tracks:ee.tracks})),I){var oe=I.startPTS,ce=I.endPTS,De=I.startDTS,Ee=I.endDTS;V&&(V.elementaryStreams[c.ElementaryStreamTypes.AUDIO]={startPTS:oe,endPTS:ce,startDTS:De,endDTS:Ee}),W.setElementaryStreamInfo(c.ElementaryStreamTypes.AUDIO,oe,ce,De,Ee),this.bufferFragmentData(I,W,V,P)}if(X!=null&&(o=X.samples)!==null&&o!==void 0&&o.length){var Ce=l({frag:W,id:T},X);S.trigger(O.Events.FRAG_PARSING_METADATA,Ce)}if(N){var Te=l({frag:W,id:T},N);S.trigger(O.Events.FRAG_PARSING_USERDATA,Te)}},m._bufferInitSegment=function(d,o,T){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 P={type:"audio",frag:o,part:null,chunkMeta:T,parent:o.type,data:y};this.hls.trigger(O.Events.BUFFER_APPENDING,P)}this.tick()},m.loadFragment=function(d,o,T){var S=this.fragmentTracker.getState(d);this.fragCurrent=d,(this.audioSwitch||S===F.FragmentState.NOT_LOADED||S===F.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,T)))},m.completeAudioSwitch=function(){var d=this.hls,o=this.media,T=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:T})},C}(U.default);$.default=p},"./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 F(M,w){for(var E=0;E<w.length;E++){var b=w[E];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(M,b.key,b)}}function _(M,w,E){return w&&F(M.prototype,w),E&&F(M,E),M}function A(M,w){M.prototype=Object.create(w.prototype),M.prototype.constructor=M,c(M,w)}function c(M,w){return c=Object.setPrototypeOf||function(b,u){return b.__proto__=u,b},c(M,w)}var x=function(M){A(w,M);function w(b){var u;return u=M.call(this,b,"[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,M.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 l=a.id,h=a.details,L=this.tracksInGroup[l];if(!L){this.warn("Invalid audio track id "+l);return}var f=L.details;L.details=a.details,this.log("audioTrack "+l+" loaded ["+h.startSN+"-"+h.endSN+"]"),l===this.trackId&&(this.retryCount=0,this.playlistLoaded(l,a,f))},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 l=a.audioGroupIds[a.urlId];if(this.groupId!==l){this.groupId=l;var h=this.tracks.filter(function(f){return!l||f.groupId===l});this.selectDefaultTrack&&!h.some(function(f){return f.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=h;var L={audioTracks:h};this.log("Updating audio tracks, "+h.length+' track(s) found in "'+l+'" group-id'),this.hls.trigger(Q.Events.AUDIO_TRACKS_UPDATED,L),this.selectInitialTrack()}},E.onError=function(u,a){if(M.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 l=a[this.trackId];this.log("Now switching to audio-track index "+u);var h=a[u],L=h.id,f=h.groupId,p=f===void 0?"":f,D=h.name,C=h.type,m=h.url;if(this.trackId=u,this.trackName=D,this.selectDefaultTrack=!1,this.hls.trigger(Q.Events.AUDIO_TRACK_SWITCHING,{id:L,groupId:p,name:D,type:C,url:m}),h.details&&!h.details.live)return;var v=this.switchParams(h.url,l==null?void 0:l.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,l=this.findTrackId(a)||this.findTrackId();l!==-1?this.setAudioTrack(l):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(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,l=0;l<a.length;l++){var h=a[l];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 l=a.id,h=a.groupId,L=a.url;if(u)try{L=u.addDirectives(L)}catch(f){this.warn("Could not construct new URL with HLS Delivery Directives: "+f)}this.log("loading audio-track playlist for id: "+l),this.clearTimer(),this.hls.trigger(Q.Events.AUDIO_TRACK_LOADING,{url:L,id:l,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"),F=R("./src/errors.ts"),_=function(){function A(x,M){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,M+":"),this.warn=j.logger.warn.bind(j.logger,M+":"),this.hls=x}var c=A.prototype;return c.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},c.onError=function(M,w){w.fatal&&w.type===F.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},c.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},c.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},c.stopLoad=function(){this.canLoad=!1,this.clearTimer()},c.switchParams=function(M,w){var E=w==null?void 0:w.renditionReports;if(E)for(var b=0;b<E.length;b++){var u=E[b],a=""+u.URI;if(a===M.substr(-a.length)){var l=parseInt(u["LAST-MSN"]),h=parseInt(u["LAST-PART"]);if(w&&this.hls.config.lowLatencyMode){var L=Math.min(w.age-w.partTarget,w.targetduration);h!==void 0&&L>w.partTarget&&(h+=1)}if(Object(Q.isFiniteNumber)(l))return new U.HlsUrlParameters(l,Object(Q.isFiniteNumber)(h)?h:void 0,U.HlsSkip.No)}}},c.loadPlaylist=function(M){},c.shouldLoadTrack=function(M){return this.canLoad&&M&&!!M.url&&(!M.details||M.details.live)},c.playlistLoaded=function(M,w,E){var b=this,u=w.details,a=w.stats,l=a.loading.end?Math.max(0,self.performance.now()-a.loading.end):0;if(u.advancedDateTime=Date.now()-l,u.live||E!=null&&E.live){if(u.reloaded(E),E&&this.log("live playlist "+M+" "+(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,L=void 0,f=void 0;if(u.canBlockReload&&u.endSN&&u.advanced){var p=this.hls.config.lowLatencyMode,D=u.lastPartSn,C=u.endSN,m=u.lastPartIndex,v=m!==-1,d=D===C,o=p?0:m;v?(L=d?C+1:D,f=d?o:m+1):L=C+1;var T=u.age,S=T+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 P=Math.floor(y/u.targetduration);if(L+=P,f!==void 0){var B=Math.round(y%u.targetduration/u.partTarget);f+=B}this.log("CDN Tune-in age: "+u.ageHeader+"s last advanced "+T.toFixed(2)+"s goal: "+y+" skip sn "+P+" to part "+f)}u.tuneInGoal=y}if(h=this.getDeliveryDirectives(u,w.deliveryDirectives,L,f),p||!d){this.loadPlaylist(h);return}}else h=this.getDeliveryDirectives(u,w.deliveryDirectives,L,f);var W=Object(O.computeReloadInterval)(u,a);L!==void 0&&u.canBlockReload&&(W-=u.partTarget||1),this.log("reload live playlist "+M+" in "+Math.round(W)+" ms"),this.timer=self.setTimeout(function(){return b.loadPlaylist(h)},W)}else this.clearTimer()},c.getDeliveryDirectives=function(M,w,E,b){var u=Object(U.getSkipValue)(M,E);return w!=null&&w.skip&&M.deltaUpdateFailed&&(E=w.msn,b=w.part,u=U.HlsSkip.No),new U.HlsUrlParameters(E,b,u)},c.retryLoadingOrFail=function(M){var w=this,E=this.hls.config,b=this.retryCount<E.levelLoadingMaxRetry;if(b){var u;if(this.retryCount++,M.details.indexOf("LoadTimeOut")>-1&&(u=M.context)!==null&&u!==void 0&&u.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+M.details+'"'),this.loadPlaylist();else{var 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 "'+M.details+'"')}}else this.warn('cannot recover from error "'+M.details+'"'),this.clearTimer(),M.fatal=!0;return b},A}()},"./src/controller/base-stream-controller.ts":function(ne,$,R){"use strict";R.r($),R.d($,"State",function(){return C}),R.d($,"default",function(){return m});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"),F=R("./src/utils/logger.ts"),_=R("./src/events.ts"),A=R("./src/errors.ts"),c=R("./src/types/transmuxer.ts"),x=R("./src/utils/mp4-tools.ts"),M=R("./src/utils/discontinuities.ts"),w=R("./src/controller/fragment-finders.ts"),E=R("./src/controller/level-helper.ts"),b=R("./src/loader/fragment-loader.ts"),u=R("./src/crypt/decrypter.ts"),a=R("./src/utils/time-ranges.ts"),l=R("./src/types/loader.ts");function h(v,d){for(var o=0;o<d.length;o++){var T=d[o];T.enumerable=T.enumerable||!1,T.configurable=!0,"value"in T&&(T.writable=!0),Object.defineProperty(v,T.key,T)}}function L(v,d,o){return d&&h(v.prototype,d),o&&h(v,o),v}function f(v){if(v===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return v}function p(v,d){v.prototype=Object.create(d.prototype),v.prototype.constructor=v,D(v,d)}function D(v,d){return D=Object.setPrototypeOf||function(T,S){return T.__proto__=S,T},D(v,d)}var C={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",BACKTRACKING:"BACKTRACKING",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"},m=function(v){p(d,v);function d(T,S,y){var P;return P=v.call(this)||this,P.hls=void 0,P.fragPrevious=null,P.fragCurrent=null,P.fragmentTracker=void 0,P.transmuxer=null,P._state=C.STOPPED,P.media=void 0,P.mediaBuffer=void 0,P.config=void 0,P.bitrateTest=!1,P.lastCurrentTime=0,P.nextLoadPosition=0,P.startPosition=0,P.loadedmetadata=!1,P.fragLoadError=0,P.retryDate=0,P.levels=null,P.fragmentLoader=void 0,P.levelLastLoaded=null,P.startFragRequested=!1,P.decrypter=void 0,P.initPTS=[],P.onvseeking=null,P.onvended=null,P.logPrefix="",P.log=void 0,P.warn=void 0,P.logPrefix=y,P.log=F.logger.log.bind(F.logger,y+":"),P.warn=F.logger.warn.bind(F.logger,y+":"),P.hls=T,P.fragmentLoader=new b.default(T.config),P.fragmentTracker=S,P.config=T.config,P.decrypter=new u.default(T,T.config),T.on(_.Events.KEY_LOADED,P.onKeyLoaded,f(P)),P}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=C.STOPPED},o._streamEnded=function(S,y){var P=this.fragCurrent,B=this.fragmentTracker;if(!y.live&&P&&P.sn===y.endSN&&!S.nextStart){var W=B.getState(P);return W===O.FragmentState.PARTIAL||W===O.FragmentState.OK}return!1},o.onMediaAttached=function(S,y){var P=this.media=this.mediaBuffer=y.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),P.addEventListener("seeking",this.onvseeking),P.addEventListener("ended",this.onvended);var B=this.config;this.levels&&B.autoStartLoad&&this.state===C.STOPPED&&this.startLoad(B.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,P=this.media,B=this.mediaBuffer,W=this.state,V=P?P.currentTime:0,I=j.BufferHelper.bufferInfo(B||P,V,S.maxBufferHole);if(this.log("media seeking to "+(Object(Q.isFiniteNumber)(V)?V.toFixed(3):V)+", state: "+W),W===C.ENDED)this.resetLoadingState();else if(y&&!I.len){var N=S.maxFragLookUpTolerance,X=y.start-N,ee=y.start+y.duration+N,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())}P&&(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!==C.KEY_LOADING||y.frag!==this.fragCurrent||!this.levels)return;this.state=C.IDLE;var P=this.levels[y.frag.level].details;P&&this.loadFragment(y.frag,P,y.frag.start)},o.onHandlerDestroying=function(){this.stopLoad(),v.prototype.onHandlerDestroying.call(this)},o.onHandlerDestroyed=function(){this.state=C.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=C.KEY_LOADING,this.fragCurrent=S,this.hls.trigger(_.Events.KEY_LOADING,{frag:S})},o.loadFragment=function(S,y,P){this._loadFragForPlayback(S,y,P)},o._loadFragForPlayback=function(S,y,P){var B=this,W=function(I){if(B.fragContextChanged(S)){B.warn("Fragment "+S.sn+(I.part?" p: "+I.part.index:"")+" of level "+S.level+" was dropped during download."),B.fragmentTracker.removeFragment(S);return}S.stats.chunkCount++,B._handleFragmentLoadProgress(I)};this._doFragLoad(S,y,P,W).then(function(V){if(!V)return;B.fragLoadError=0;var I=B.state;if(B.fragContextChanged(S)){(I===C.FRAG_LOADING||I===C.BACKTRACKING||!B.fragCurrent&&I===C.PARSING)&&(B.fragmentTracker.removeFragment(S),B.state=C.IDLE);return}if("payload"in V&&(B.log("Loaded fragment "+S.sn+" of level "+S.level),B.hls.trigger(_.Events.FRAG_LOADED,V),B.state===C.BACKTRACKING)){B.fragmentTracker.backtrack(S,V),B.resetFragmentLoading(S);return}B._handleFragmentLoadComplete(V)}).catch(function(V){B.warn(V),B.resetFragmentLoading(S)})},o.flushMainBuffer=function(S,y,P){if(P===void 0&&(P=null),!(S-y))return;var B={startOffset:S,endOffset:y,type:P};this.fragLoadError=0,this.hls.trigger(_.Events.BUFFER_FLUSHING,B)},o._loadInitSegment=function(S){var y=this;this._doFragLoad(S).then(function(P){if(!P||y.fragContextChanged(S)||!y.levels)throw new Error("init load aborted");return P}).then(function(P){var B=y.hls,W=P.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(N){var X=self.performance.now();return B.trigger(_.Events.FRAG_DECRYPTED,{frag:S,payload:N,stats:{tstart:I,tdecrypt:X}}),P.payload=N,P})}return P}).then(function(P){var B=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 N=S.stats;y.state=C.IDLE,y.fragLoadError=0,S.data=new Uint8Array(P.payload),N.parsing.start=N.buffering.start=self.performance.now(),N.parsing.end=N.buffering.end=self.performance.now(),P.frag===B&&W.trigger(_.Events.FRAG_BUFFERED,{stats:N,frag:B,part:null,id:S.type}),y.tick()}).catch(function(P){y.warn(P),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 P=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(P))),this.state=C.IDLE,this.tick()},o._handleFragmentLoadComplete=function(S){var y=this.transmuxer;if(!y)return;var P=S.frag,B=S.part,W=S.partsLoaded,V=!W||W.length===0||W.some(function(N){return!N}),I=new c.ChunkMetadata(P.level,P.sn,P.stats.chunkCount+1,0,B?B.index:-1,!V);y.flush(I)},o._handleFragmentLoadProgress=function(S){},o._doFragLoad=function(S,y,P,B){var W=this;if(P===void 0&&(P=null),!this.levels)throw new Error("frag load aborted, missing levels");if(P=Math.max(S.start,P||0),this.config.lowLatencyMode&&y){var V=y.partList;if(V&&B){P>S.end&&y.fragmentHint&&(S=y.fragmentHint);var I=this.getNextPart(V,S,P);if(I>-1){var N=V[I];return this.log("Loading part sn: "+S.sn+" p: "+N.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(P.toFixed(3))),this.nextLoadPosition=N.start+N.duration,this.state=C.FRAG_LOADING,this.hls.trigger(_.Events.FRAG_LOADING,{frag:S,part:V[I],targetBufferTime:P}),this.doFragPartsLoad(S,V,I,B).catch(function(X){return W.handleFragLoadError(X)})}else if(!S.url||this.loadedEndOfParts(V,P))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(P.toFixed(3))),Object(Q.isFiniteNumber)(S.sn)&&!this.bitrateTest&&(this.nextLoadPosition=S.start+S.duration),this.state=C.FRAG_LOADING,this.hls.trigger(_.Events.FRAG_LOADING,{frag:S,targetBufferTime:P}),this.fragmentLoader.load(S,B).catch(function(X){return W.handleFragLoadError(X)})},o.doFragPartsLoad=function(S,y,P,B){var W=this;return new Promise(function(V,I){var N=[],X=function ee(oe){var ce=y[oe];W.fragmentLoader.loadPart(S,ce,B).then(function(De){N[ce.index]=De;var Ee=De.part;W.hls.trigger(_.Events.FRAG_LOADED,De);var Ce=y[oe+1];if(Ce&&Ce.fragment===S)ee(oe+1);else return V({frag:S,part:Ee,partsLoaded:N})}).catch(I)};X(P)})},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!==C.PARSING){this.fragCurrent||(this.state=C.IDLE);return}var P=y.frag,B=y.part,W=y.level,V=self.performance.now();P.stats.parsing.end=V,B&&(B.stats.parsing.end=V),this.updateLevelTiming(P,B,W,S.partial)},o.getCurrentContext=function(S){var y=this.levels,P=S.level,B=S.sn,W=S.part;if(!y||!y[P])return this.warn("Levels object was unset while buffering fragment "+B+" of level "+P+". The current chunk will not be buffered."),null;var V=y[P],I=W>-1?Object(E.getPartWith)(V,B,W):null,N=I?I.fragment:Object(E.getFragmentWithSN)(V,B,this.fragCurrent);return N?{frag:N,part:I,level:V}:null},o.bufferFragmentData=function(S,y,P,B){if(!S||this.state!==C.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 N={type:S.type,frag:y,part:P,chunkMeta:B,parent:y.type,data:I};this.hls.trigger(_.Events.BUFFER_APPENDING,N),S.dropped&&S.independent&&!P&&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 P=y.currentTime,B=j.BufferHelper.bufferInfo(y,P,0),W=S.duration,V=Math.min(this.config.maxFragLookUpTolerance*2,W*.25),I=Math.max(Math.min(S.start-V,B.end-V),P+V);S.start-I>V&&this.flushMainBuffer(I,S.start)},o.getFwdBufferInfo=function(S,y){var P=this.config,B=this.getLoadPosition();if(!Object(Q.isFiniteNumber)(B))return null;var W=j.BufferHelper.bufferInfo(S,B,P.maxBufferHole);if(W.len===0&&W.nextStart!==void 0){var V=this.fragmentTracker.getBufferedFrag(B,y);if(V&&W.nextStart<V.end)return j.BufferHelper.bufferInfo(S,B,Math.max(W.nextStart,P.maxBufferHole))}return W},o.getMaxBufferLength=function(S){var y=this.config,P;return S?P=Math.max(8*y.maxBufferSize/S,y.maxBufferLength):P=y.maxBufferLength,Math.min(P,y.maxMaxBufferLength)},o.reduceMaxBufferLength=function(S){var y=this.config,P=S||y.maxBufferLength;return y.maxMaxBufferLength>=P?(y.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+y.maxMaxBufferLength+"s"),!0):!1},o.getNextFragment=function(S,y){var P,B,W=y.fragments,V=W.length;if(!V)return null;var I=this.config,N=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<=N&&(X=W[0]);if(!X){var oe=I.lowLatencyMode?y.partEnd:y.fragmentEnd;X=this.getFragmentAtPosition(S,oe,y)}return(P=X)!==null&&P!==void 0&&P.initSegment&&!((B=X)!==null&&B!==void 0&&B.initSegment.data)&&!this.bitrateTest&&(X=X.initSegment),X},o.getNextPart=function(S,y,P){for(var B=-1,W=!1,V=!0,I=0,N=S.length;I<N;I++){var X=S[I];if(V=V&&!X.independent,B>-1&&P<X.start)break;var ee=X.loaded;!ee&&(W||X.independent||V)&&X.fragment===y&&(B=I),W=ee}return B},o.loadedEndOfParts=function(S,y){var P=S[S.length-1];return P&&y>P.start&&P.loaded},o.getInitialLiveFragment=function(S,y){var P=this.fragPrevious,B=null;if(P){if(S.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+P.programDateTime),B=Object(w.findFragmentByPDT)(y,P.endProgramDateTime,this.config.maxFragLookUpTolerance)),!B){var W=P.sn+1;if(W>=S.startSN&&W<=S.endSN){var V=y[W-S.startSN];P.cc===V.cc&&(B=V,this.log("Live playlist, switching playlist, load frag with next SN: "+B.sn))}B||(B=Object(w.findFragWithCC)(y,P.cc),B&&this.log("Live playlist, switching playlist, load frag with same CC: "+B.sn))}}else{var I=this.hls.liveSyncPosition;I!==null&&(B=this.getFragmentAtPosition(I,this.bitrateTest?S.fragmentEnd:S.edge,S))}return B},o.getFragmentAtPosition=function(S,y,P){var B=this.config,W=this.fragPrevious,V=P.fragments,I=P.endSN,N=P.fragmentHint,X=B.maxFragLookUpTolerance,ee=!!(B.lowLatencyMode&&P.partList&&N);ee&&N&&!this.bitrateTest&&(V=V.concat(N),I=N.sn);var oe;if(S<y){var ce=S>y-X?0:X;oe=Object(w.findFragmentByPTS)(W,V,S,ce)}else oe=V[V.length-1];if(oe){var De=oe.sn-P.startSN,Ee=W&&oe.level===W.level,Ce=V[De+1],Te=this.fragmentTracker.getState(oe);if(Te===O.FragmentState.BACKTRACKED){oe=null;for(var me=De;V[me]&&this.fragmentTracker.getState(V[me])===O.FragmentState.BACKTRACKED;)W?oe=V[me--]:oe=V[--me];oe||(oe=Ce)}else W&&oe.sn===W.sn&&!ee&&(Ee&&(oe.sn<I&&this.fragmentTracker.getState(Ce)!==O.FragmentState.OK?(this.log("SN "+oe.sn+" just loaded, load next one: "+Ce.sn),oe=Ce):oe=null))}return oe},o.synchronizeToLiveEdge=function(S){var y=this.config,P=this.media;if(!P)return;var B=this.hls.liveSyncPosition,W=P.currentTime,V=S.fragments[0].start,I=S.edge,N=W>=V-y.maxFragLookUpTolerance&&W<=I;if(B!==null&&P.duration>B&&(W<B||!N)){var X=y.liveMaxLatencyDuration!==void 0?y.liveMaxLatencyDuration:y.liveMaxLatencyDurationCount*S.targetduration;(!N&&P.readyState<4||W<I-X)&&(this.loadedmetadata||(this.nextLoadPosition=B),P.readyState&&(this.warn("Playback: "+W.toFixed(3)+" is located too far from the end of live sliding playlist: "+I+", reset currentTime to : "+B.toFixed(3)),P.currentTime=B))}},o.alignPlaylists=function(S,y){var P=this.levels,B=this.levelLastLoaded,W=this.fragPrevious,V=B!==null?P[B]:null,I=S.fragments.length;if(!I)return this.warn("No fragments in live playlist"),0;var N=S.fragments[0].start,X=!y,ee=S.alignedSliding&&Object(Q.isFiniteNumber)(N);if(X||!ee&&!N){Object(M.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 N},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 P=this.startPosition;if(P<y&&(P=-1),P===-1||this.lastCurrentTime===-1){var B=S.startTimeOffset;Object(Q.isFiniteNumber)(B)?(P=y+B,B<0&&(P+=S.totalduration),P=Math.min(Math.max(y,P),y+S.totalduration),this.log("Start time offset "+B+" found in playlist, adjust startPosition to "+P),this.startPosition=P):S.live?P=this.hls.liveSyncPosition||y:this.startPosition=P=0,this.lastCurrentTime=P}this.nextLoadPosition=P},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=C.IDLE)},o.onFragmentOrKeyLoadError=function(S,y){if(y.fatal)return;var P=y.frag;if(!P||P.type!==S)return;var B=this.fragCurrent;console.assert(B&&P.sn===B.sn&&P.level===B.level&&P.urlId===B.urlId,"Frag load error must match current frag to retry");var W=this.config;if(this.fragLoadError+1<=W.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(P.level))return;var V=Math.min(Math.pow(2,this.fragLoadError)*W.fragLoadingRetryDelay,W.fragLoadingMaxRetryTimeout);this.warn("Fragment "+P.sn+" of "+S+" "+P.level+" failed to load, retrying in "+V+"ms"),this.retryDate=self.performance.now()+V,this.fragLoadError++,this.state=C.FRAG_LOADING_WAITING_RETRY}else y.levelRetry?(S===l.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=C.IDLE):(F.logger.error(y.details+" reaches max retry, redispatch as fatal ..."),y.fatal=!0,this.hls.stopLoad(),this.state=C.ERROR)},o.afterBufferFlushed=function(S,y,P){if(!S)return;var B=j.BufferHelper.getBuffered(S);this.fragmentTracker.detectEvictedFragments(y,B,P),this.state===C.ENDED&&this.resetLoadingState()},o.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=C.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,P,B){var W=this,V=P.details;console.assert(!!V,"level.details must be defined");var I=Object.keys(S.elementaryStreams).reduce(function(N,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(),N||!1;var ce=B?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:P,drift:ce,type:X,frag:S,start:ee.startPTS,end:ee.endPTS}),!0}return N},!1);I?(this.state=C.PARSED,this.hls.trigger(_.Events.FRAG_PARSED,{frag:S,part:y})):this.resetLoadingState()},o.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},L(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"),F=R("./src/utils/buffer-helper.ts"),_=R("./src/utils/mediasource-helper.ts"),A=R("./src/loader/fragment.ts"),c=R("./src/controller/buffer-operation-queue.ts"),x=Object(_.getMediaSource)(),M=/([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 l=a.hls,h=a.media,L=a.mediaSource;O.logger.log("[buffer-controller]: Media source opened"),h&&(a.updateMediaElementDuration(),l.trigger(U.Events.MEDIA_ATTACHED,{media:h})),L&&L.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 b=E.prototype;return b.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},b.destroy=function(){this.unregisterListeners(),this.details=null},b.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)},b.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)},b._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new c.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},b.onManifestParsed=function(a,l){var h=2;(l.audio&&!l.video||!l.altAudio)&&(h=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=h,this.details=null,O.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},b.onMediaAttaching=function(a,l){var h=this.media=l.media;if(h&&x){var L=this.mediaSource=new x;L.addEventListener("sourceopen",this._onMediaSourceOpen),L.addEventListener("sourceended",this._onMediaSourceEnded),L.addEventListener("sourceclose",this._onMediaSourceClose),h.src=self.URL.createObjectURL(L),this._objectUrl=h.src}},b.onMediaDetaching=function(){var a=this.media,l=this.mediaSource,h=this._objectUrl;if(l){if(O.logger.log("[buffer-controller]: media source detaching"),l.readyState==="open")try{l.endOfStream()}catch(L){O.logger.warn("[buffer-controller]: onMediaDetaching: "+L.message+" while calling endOfStream")}this.onBufferReset(),l.removeEventListener("sourceopen",this._onMediaSourceOpen),l.removeEventListener("sourceended",this._onMediaSourceEnded),l.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)},b.onBufferReset=function(){var a=this;this.getSourceBufferTypes().forEach(function(l){var h=a.sourceBuffer[l];try{h&&(a.removeBufferListeners(l),a.mediaSource&&a.mediaSource.removeSourceBuffer(h),a.sourceBuffer[l]=void 0)}catch(L){O.logger.warn("[buffer-controller]: Failed to reset the "+l+" buffer",L)}}),this._initSourceBuffer()},b.onBufferCodecs=function(a,l){var h=this,L=this.getSourceBufferTypes().length;if(Object.keys(l).forEach(function(f){if(L){var p=h.tracks[f];if(p&&typeof p.buffer.changeType=="function"){var D=l[f],C=D.codec,m=D.levelCodec,v=D.container,d=(p.levelCodec||p.codec).replace(M,"$1"),o=(m||C).replace(M,"$1");if(d!==o){var T=v+";codecs="+(m||C);h.appendChangeType(f,T)}}}else h.pendingTracks[f]=l[f]}),L)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},b.appendChangeType=function(a,l){var h=this,L=this.operationQueue,f={execute:function(){var D=h.sourceBuffer[a];D&&(O.logger.log("[buffer-controller]: changing "+a+" sourceBuffer type to "+l),D.changeType(l)),L.shiftAndExecuteNext(a)},onStart:function(){},onComplete:function(){},onError:function(D){O.logger.warn("[buffer-controller]: Failed to change "+a+" SourceBuffer type",D)}};L.append(f,a)},b.onBufferAppending=function(a,l){var h=this,L=this.hls,f=this.operationQueue,p=this.tracks,D=l.data,C=l.type,m=l.frag,v=l.part,d=l.chunkMeta,o=d.buffering[C],T=self.performance.now();o.start=T;var S=m.stats.buffering,y=v?v.stats.buffering:null;S.start===0&&(S.start=T),y&&y.start===0&&(y.start=T);var P=p.audio,B=C==="audio"&&d.id===1&&(P==null?void 0:P.container)==="audio/mpeg",W={execute:function(){if(o.executeStart=self.performance.now(),B){var I=h.sourceBuffer[C];if(I){var N=m.start-I.timestampOffset;Math.abs(N)>=.1&&(O.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+m.start+" (delta: "+N+") sn: "+m.sn+")"),I.timestampOffset=m.start)}}h.appendExecutor(D,C)},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 N=h.sourceBuffer,X={};for(var ee in N)X[ee]=F.BufferHelper.getBuffered(N[ee]);h.appendError=0,h.hls.trigger(U.Events.BUFFER_APPENDED,{type:C,frag:m,part:v,chunkMeta:d,parent:m.type,timeRanges:X})},onError:function(I){O.logger.error("[buffer-controller]: Error encountered while trying to append to the "+C+" SourceBuffer",I);var N={type:j.ErrorTypes.MEDIA_ERROR,parent:m.type,details:j.ErrorDetails.BUFFER_APPEND_ERROR,err:I,fatal:!1};I.code===DOMException.QUOTA_EXCEEDED_ERR?N.details=j.ErrorDetails.BUFFER_FULL_ERROR:(h.appendError++,N.details=j.ErrorDetails.BUFFER_APPEND_ERROR,h.appendError>L.config.appendErrorMaxRetry&&(O.logger.error("[buffer-controller]: Failed "+L.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),N.fatal=!0)),L.trigger(U.Events.ERROR,N)}};f.append(W,C)},b.onBufferFlushing=function(a,l){var h=this,L=this.operationQueue,f=function(D){return{execute:h.removeExecutor.bind(h,D,l.startOffset,l.endOffset),onStart:function(){},onComplete:function(){h.hls.trigger(U.Events.BUFFER_FLUSHED,{type:D})},onError:function(m){O.logger.warn("[buffer-controller]: Failed to remove from "+D+" SourceBuffer",m)}}};l.type?L.append(f(l.type),l.type):this.getSourceBufferTypes().forEach(function(p){L.append(f(p),p)})},b.onFragParsed=function(a,l){var h=this,L=l.frag,f=l.part,p=[],D=f?f.elementaryStreams:L.elementaryStreams;D[A.ElementaryStreamTypes.AUDIOVIDEO]?p.push("audiovideo"):(D[A.ElementaryStreamTypes.AUDIO]&&p.push("audio"),D[A.ElementaryStreamTypes.VIDEO]&&p.push("video"));var C=function(){var v=self.performance.now();L.stats.buffering.end=v,f&&(f.stats.buffering.end=v);var d=f?f.stats:L.stats;h.hls.trigger(U.Events.FRAG_BUFFERED,{frag:L,part:f,stats:d,id:L.type})};p.length===0&&O.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+L.type+" level: "+L.level+" sn: "+L.sn),this.blockBuffers(C,p)},b.onFragChanged=function(a,l){this.flushBackBuffer()},b.onBufferEos=function(a,l){var h=this,L=this.getSourceBufferTypes().reduce(function(f,p){var D=h.sourceBuffer[p];return(!l.type||l.type===p)&&(D&&!D.ended&&(D.ended=!0,O.logger.log("[buffer-controller]: "+p+" sourceBuffer now EOS"))),f&&!!(!D||D.ended)},!0);L&&this.blockBuffers(function(){var f=h.mediaSource;if(!f||f.readyState!=="open")return;f.endOfStream()})},b.onLevelUpdated=function(a,l){var h=l.details;if(!h.fragments.length)return;this.details=h,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},b.flushBackBuffer=function(){var a=this.hls,l=this.details,h=this.media,L=this.sourceBuffer;if(!h||l===null)return;var f=this.getSourceBufferTypes();if(!f.length)return;var p=l.live&&a.config.liveBackBufferLength!==null?a.config.liveBackBufferLength:a.config.backBufferLength;if(!Object(Q.isFiniteNumber)(p)||p<0)return;var D=h.currentTime,C=l.levelTargetDuration,m=Math.max(p,C),v=Math.floor(D/C)*C-m;f.forEach(function(d){var o=L[d];if(o){var T=F.BufferHelper.getBuffered(o);T.length>0&&v>T.start(0)&&(a.trigger(U.Events.BACK_BUFFER_REACHED,{bufferEnd:v}),l.live&&a.trigger(U.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:v}),a.trigger(U.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:v,type:d}))}})},b.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var a=this.details,l=this.hls,h=this.media,L=this.mediaSource,f=a.fragments[0].start+a.totalduration,p=h.duration,D=Object(Q.isFiniteNumber)(L.duration)?L.duration:0;a.live&&l.config.liveDurationInfinity?(O.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),L.duration=Infinity,this.updateSeekableRange(a)):(f>D&&f>p||!Object(Q.isFiniteNumber)(p))&&(O.logger.log("[buffer-controller]: Updating Media Source duration to "+f.toFixed(3)),L.duration=f)},b.updateSeekableRange=function(a){var l=this.mediaSource,h=a.fragments,L=h.length;if(L&&a.live&&l!==null&&l!==void 0&&l.setLiveSeekableRange){var f=Math.max(0,h[0].start),p=Math.max(f,f+a.totalduration);l.setLiveSeekableRange(f,p)}},b.checkPendingTracks=function(){var a=this.bufferCodecEventsExpected,l=this.operationQueue,h=this.pendingTracks,L=Object.keys(h).length;if(L&&!a||L===2){this.createSourceBuffers(h),this.pendingTracks={};var f=this.getSourceBufferTypes();if(f.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}f.forEach(function(p){l.executeNext(p)})}},b.createSourceBuffers=function(a){var l=this.sourceBuffer,h=this.mediaSource;if(!h)throw Error("createSourceBuffers called when mediaSource was null");var L=0;for(var f in a)if(!l[f]){var p=a[f];if(!p)throw Error("source buffer exists for track "+f+", however track does not");var D=p.levelCodec||p.codec,C=p.container+";codecs="+D;O.logger.log("[buffer-controller]: creating sourceBuffer("+C+")");try{var m=l[f]=h.addSourceBuffer(C),v=f;this.addBufferListener(v,"updatestart",this._onSBUpdateStart),this.addBufferListener(v,"updateend",this._onSBUpdateEnd),this.addBufferListener(v,"error",this._onSBUpdateError),this.tracks[f]={buffer:m,codec:D,container:p.container,levelCodec:p.levelCodec,id:p.id},L++}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:C})}}L&&this.hls.trigger(U.Events.BUFFER_CREATED,{tracks:this.tracks})},b._onSBUpdateStart=function(a){var l=this.operationQueue,h=l.current(a);h.onStart()},b._onSBUpdateEnd=function(a){var l=this.operationQueue,h=l.current(a);h.onComplete(),l.shiftAndExecuteNext(a)},b._onSBUpdateError=function(a,l){O.logger.error("[buffer-controller]: "+a+" SourceBuffer error",l),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(l)},b.removeExecutor=function(a,l,h){var L=this.media,f=this.mediaSource,p=this.operationQueue,D=this.sourceBuffer,C=D[a];if(!L||!f||!C){O.logger.warn("[buffer-controller]: Attempting to remove from the "+a+" SourceBuffer, but it does not exist"),p.shiftAndExecuteNext(a);return}var m=Object(Q.isFiniteNumber)(L.duration)?L.duration:Infinity,v=Object(Q.isFiniteNumber)(f.duration)?f.duration:Infinity,d=Math.max(0,l),o=Math.min(h,m,v);o>d?(O.logger.log("[buffer-controller]: Removing ["+d+","+o+"] from the "+a+" SourceBuffer"),console.assert(!C.updating,a+" sourceBuffer must not be updating"),C.remove(d,o)):p.shiftAndExecuteNext(a)},b.appendExecutor=function(a,l){var h=this.operationQueue,L=this.sourceBuffer,f=L[l];if(!f){O.logger.warn("[buffer-controller]: Attempting to append to the "+l+" SourceBuffer, but it does not exist"),h.shiftAndExecuteNext(l);return}f.ended=!1,console.assert(!f.updating,l+" sourceBuffer must not be updating"),f.appendBuffer(a)},b.blockBuffers=function(a,l){var h=this;if(l===void 0&&(l=this.getSourceBufferTypes()),!l.length){O.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(a);return}var L=this.operationQueue,f=l.map(function(p){return L.appendBlocker(p)});Promise.all(f).then(function(){a(),l.forEach(function(p){var D=h.sourceBuffer[p];(!D||!D.updating)&&L.shiftAndExecuteNext(p)})})},b.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},b.addBufferListener=function(a,l,h){var L=this.sourceBuffer[a];if(!L)return;var f=h.bind(this,a);this.listeners[a].push({event:l,listener:f}),L.addEventListener(l,f)},b.removeBufferListeners=function(a){var l=this.sourceBuffer[a];if(!l)return;this.listeners[a].forEach(function(h){l.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(F){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=F}var j=O.prototype;return j.append=function(_,A){var c=this.queues[A];c.push(_),c.length===1&&this.buffers[A]&&this.executeNext(A)},j.insertAbort=function(_,A){var c=this.queues[A];c.unshift(_),this.executeNext(A)},j.appendBlocker=function(_){var A,c=new Promise(function(M){A=M}),x={execute:A,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(x,_),c},j.executeNext=function(_){var A=this.buffers,c=this.queues,x=A[_],M=c[_];if(M.length){var w=M[0];try{w.execute()}catch(E){Q.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),w.onError(E),(!x||!x.updating)&&(M.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(F,_){for(var A=0;A<_.length;A++){var c=_[A];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(F,c.key,c)}}function O(F,_,A){return _&&U(F.prototype,_),A&&U(F,A),F}var j=function(){function F(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 _=F.prototype;return _.setStreamController=function(c){this.streamController=c},_.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},_.registerListeners=function(){var c=this.hls;c.on(Q.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),c.on(Q.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),c.on(Q.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.on(Q.Events.BUFFER_CODECS,this.onBufferCodecs,this),c.on(Q.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},_.unregisterListener=function(){var c=this.hls;c.off(Q.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),c.off(Q.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),c.off(Q.Events.MANIFEST_PARSED,this.onManifestParsed,this),c.off(Q.Events.BUFFER_CODECS,this.onBufferCodecs,this),c.off(Q.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},_.onFpsDropLevelCapping=function(c,x){F.isLevelAllowed(x.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(x.droppedLevel)},_.onMediaAttaching=function(c,x){this.media=x.media instanceof HTMLVideoElement?x.media:null},_.onManifestParsed=function(c,x){var M=this.hls;this.restrictedLevels=[],this.firstLevel=x.firstLevel,M.config.capLevelToPlayerSize&&x.video&&this.startCapping()},_.onBufferCodecs=function(c,x){var M=this.hls;M.config.capLevelToPlayerSize&&x.video&&this.startCapping()},_.onMediaDetaching=function(){this.stopCapping()},_.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var c=this.hls.levels;if(c.length){var x=this.hls;x.autoLevelCapping=this.getMaxLevel(c.length-1),x.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=x.autoLevelCapping}}},_.getMaxLevel=function(c){var x=this,M=this.hls.levels;if(!M.length)return-1;var w=M.filter(function(E,b){return F.isLevelAllowed(b,x.restrictedLevels)&&b<=c});return this.clientRect=null,F.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 c=this.media,x={width:0,height:0};if(c){var M=c.getBoundingClientRect();x.width=M.width,x.height=M.height,!x.width&&!x.height&&(x.width=M.right-M.left||c.width||0,x.height=M.bottom-M.top||c.height||0)}return this.clientRect=x,x},F.isLevelAllowed=function(c,x){return x===void 0&&(x=[]),x.indexOf(c)===-1},F.getMaxLevelByMediaSize=function(c,x,M){if(!c||!c.length)return-1;for(var w=function(l,h){return h?l.width!==h.width||l.height!==h.height:!0},E=c.length-1,b=0;b<c.length;b+=1){var u=c[b];if((u.width>=x||u.height>=M)&&w(u,c[b+1])){E=b;break}}return E},O(F,[{key:"mediaWidth",get:function(){return this.getDimensions().width*F.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*F.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var c=1;try{c=self.devicePixelRatio}catch(x){}return c}}]),F}();$.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 F(E,b){for(var u=0;u<b.length;u++){var a=b[u];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(E,a.key,a)}}function _(E,b,u){return b&&F(E.prototype,b),u&&F(E,u),E}function A(E,b){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=c(E))||b&&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 c(E,b){if(!E)return;if(typeof E=="string")return x(E,b);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,b)}function x(E,b){(b==null||b>E.length)&&(b=E.length);for(var u=0,a=new Array(b);u<b;u++)a[u]=E[u];return a}function M(){return M=Object.assign||function(E){for(var b=1;b<arguments.length;b++){var u=arguments[b];for(var a in u)Object.prototype.hasOwnProperty.call(u,a)&&(E[a]=u[a])}return E},M.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(L){try{a.apply(L,{ot:U.CMCDObjectType.MANIFEST,su:!a.initialized})}catch(f){j.logger.warn("Could not generate manifest CMCD data.",f)}},this.applyFragmentData=function(L){try{var f=L.frag,p=a.hls.levels[f.level],D=a.getObjectType(f),C={d:f.duration*1e3,ot:D};(D===U.CMCDObjectType.VIDEO||D===U.CMCDObjectType.AUDIO||D==U.CMCDObjectType.MUXED)&&(C.br=p.bitrate/1e3,C.tb=a.getTopBandwidth(D),C.bl=a.getBufferLength(D)),a.apply(L,C)}catch(m){j.logger.warn("Could not generate segment CMCD data.",m)}},this.hls=u;var l=this.config=u.config,h=l.cmcd;h!=null&&(l.pLoader=this.createPlaylistLoader(),l.fLoader=this.createFragmentLoader(),this.sid=h.sessionId||E.uuid(),this.cid=h.contentId,this.useHeaders=h.useHeaders===!0,this.registerListeners())}var b=E.prototype;return b.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)},b.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()},b.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},b.onMediaAttached=function(a,l){this.media=l.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},b.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},b.onBufferCreated=function(a,l){var h,L;this.audioBuffer=(h=l.tracks.audio)===null||h===void 0?void 0:h.buffer,this.videoBuffer=(L=l.tracks.video)===null||L===void 0?void 0:L.buffer},b.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}},b.apply=function(a,l){l===void 0&&(l={}),M(l,this.createData());var h=l.ot===U.CMCDObjectType.INIT||l.ot===U.CMCDObjectType.VIDEO||l.ot===U.CMCDObjectType.MUXED;if(this.starved&&h&&(l.bs=!0,l.su=!0,this.starved=!1),l.su==null&&(l.su=this.buffering),this.useHeaders){var L=E.toHeaders(l);if(!Object.keys(L).length)return;a.headers||(a.headers={}),M(a.headers,L)}else{var f=E.toQuery(l);if(!f)return;a.url=E.appendQueryToUri(a.url,f)}},b.getObjectType=function(a){var l=a.type;return l==="subtitle"?U.CMCDObjectType.TIMED_TEXT:a.sn==="initSegment"?U.CMCDObjectType.INIT:l==="audio"?U.CMCDObjectType.AUDIO:l==="main"?this.hls.audioTracks.length?U.CMCDObjectType.VIDEO:U.CMCDObjectType.MUXED:void 0},b.getTopBandwidth=function(a){for(var l=0,h=a===U.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,L=A(h),f;!(f=L()).done;){var p=f.value;p.bitrate>l&&(l=p.bitrate)}return l>0?l:NaN},b.getBufferLength=function(a){var l=this.hls.media,h=a===U.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!h||!l)return NaN;var L=O.BufferHelper.bufferInfo(h,l.currentTime,this.config.maxBufferHole);return L.len*1e3},b.createPlaylistLoader=function(){var a=this.config.pLoader,l=this.applyPlaylistData,h=a||this.config.loader;return function(){function L(p){this.loader=void 0,this.loader=new h(p)}var f=L.prototype;return f.destroy=function(){this.loader.destroy()},f.abort=function(){this.loader.abort()},f.load=function(D,C,m){l(D),this.loader.load(D,C,m)},_(L,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),L}()},b.createFragmentLoader=function(){var a=this.config.fLoader,l=this.applyFragmentData,h=a||this.config.loader;return function(){function L(p){this.loader=void 0,this.loader=new h(p)}var f=L.prototype;return f.destroy=function(){this.loader.destroy()},f.abort=function(){this.loader.abort()},f.load=function(D,C,m){l(D),this.loader.load(D,C,m)},_(L,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),L}()},E.uuid=function(){var a=URL.createObjectURL(new Blob),l=a.toString();return URL.revokeObjectURL(a),l.substr(l.lastIndexOf("/")+1)},E.serialize=function(a){for(var l=[],h=function(B){return!Number.isNaN(B)&&B!=null&&B!==""&&B!==!1},L=function(B){return Math.round(B)},f=function(B){return L(B/100)*100},p=function(B){return encodeURIComponent(B)},D={br:L,d:L,bl:f,dl:f,mtp:f,nor:p,rtp:f,tb:L},C=Object.keys(a||{}).sort(),m=A(C),v;!(v=m()).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 T=D[d];T&&(o=T(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),l.push(y)}return l.join(",")},E.toHeaders=function(a){for(var l=Object.keys(a),h={},L=["Object","Request","Session","Status"],f=[{},{},{},{}],p={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,bs:3,rtp:3},D=0,C=l;D<C.length;D++){var m=C[D],v=p[m]!=null?p[m]:1;f[v][m]=a[m]}for(var d=0;d<f.length;d++){var o=E.serialize(f[d]);o&&(h["CMCD-"+L[d]]=o)}return h},E.toQuery=function(a){return"CMCD="+encodeURIComponent(E.serialize(a))},E.appendQueryToUri=function(a,l){if(!l)return a;var h=a.includes("?")?"&":"?";return""+a+h+l},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 F(w,E){for(var b=0;b<E.length;b++){var u=E[b];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(w,u.key,u)}}function _(w,E,b){return E&&F(w.prototype,E),b&&F(w,b),w}var A=3,c=function(E,b,u){var a={audioCapabilities:[],videoCapabilities:[]};return E.forEach(function(l){a.audioCapabilities.push({contentType:'audio/mp4; codecs="'+l+'"',robustness:u.audioRobustness||""})}),b.forEach(function(l){a.videoCapabilities.push({contentType:'video/mp4; codecs="'+l+'"',robustness:u.videoRobustness||""})}),[a]},x=function(E,b,u,a){switch(E){case j.KeySystems.WIDEVINE:return c(b,u,a);default:throw new Error("Unknown key-system: "+E)}},M=function(){function w(b){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=b,this._config=b.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,l){var h=this,L=x(u,a,l,this._drmSystemOptions);O.logger.log("Requesting encrypted media key-system access");var f=this.requestMediaKeySystemAccess(u,L);this.mediaKeysPromise=f.then(function(p){return h._onMediaKeySystemAccessObtained(u,p)}),f.catch(function(p){O.logger.error('Failed to obtain key-system "'+u+'" access:',p)})},E._onMediaKeySystemAccessObtained=function(u,a){var l=this;O.logger.log('Access for key-system "'+u+'" obtained');var h={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:a,mediaKeySystemDomain:u};this._mediaKeysList.push(h);var L=Promise.resolve().then(function(){return a.createMediaKeys()}).then(function(f){return h.mediaKeys=f,O.logger.log('Media-keys created for key-system "'+u+'"'),l._onMediaKeysCreated(),f});return L.catch(function(f){O.logger.error("Failed to create media-keys:",f)}),L},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(l){a._onKeySessionMessage(u,l.message)},!1)},E._onKeySessionMessage=function(u,a){O.logger.log("Got EME message event, creating license request"),this._requestLicense(a,function(l){O.logger.log("Received license data (length: "+(l&&l.byteLength)+"), updating key-session"),u.update(l)})},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 l=function(L){if(!a._media)return;a._attemptSetMediaKeys(L),a._generateRequestWithPreferredKeySession(u.initDataType,u.initData)};this.mediaKeysPromise.then(l).catch(l)},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 l=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 L=h.mediaKeysSession;if(!L){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,L.generateRequest(u,a).then(function(){O.logger.debug("Key-session generation succeeded")}).catch(function(f){O.logger.error("Error generating key-session request:",f),l.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,l){var h=new XMLHttpRequest;h.responseType="arraybuffer",h.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,h,u,a,l);var L=this._licenseXhrSetup;if(L)try{L.call(this.hls,h,u),L=void 0}catch(f){O.logger.error(f)}try{h.readyState||h.open("POST",u,!0),L&&L.call(this.hls,h,u)}catch(f){throw new Error("issue setting up KeySystem license XHR "+f)}return h},E._onLicenseRequestReadyStageChange=function(u,a,l,h){switch(u.readyState){case 4:if(u.status===200){this._requestLicenseFailureCount=0,O.logger.log("License request succeeded");var L=u.response,f=this._licenseResponseCallback;if(f)try{L=f.call(this.hls,u,a)}catch(D){O.logger.error(D)}h(L)}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 p=A-this._requestLicenseFailureCount+1;O.logger.warn("Retrying license request, "+p+" attempts left"),this._requestLicense(l,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 l=this._mediaKeysList[0];if(!l){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(l.mediaKeySystemDomain),L=this._createLicenseXhr(h,u,a);O.logger.log("Sending license request to URL: "+h);var f=this._generateLicenseRequestChallenge(l,u);L.send(f)}catch(p){O.logger.error("Failure requesting DRM license: "+p),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 l=a.media;this._media=l,l.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(l){if(l.mediaKeysSession)return l.mediaKeysSession.close().catch(function(){})})).then(function(){return u.setMediaKeys(null)}).catch(function(){})},E.onManifestParsed=function(u,a){if(!this._emeEnabled)return;var l=a.levels.map(function(L){return L.audioCodec}).filter(function(L){return!!L}),h=a.levels.map(function(L){return L.videoCodec}).filter(function(L){return!!L});this._attemptKeySystemAccess(j.KeySystems.WIDEVINE,l,h)},_(w,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),w}();$.default=M},"./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 F=j.prototype;return F.setStreamController=function(A){this.streamController=A},F.registerListeners=function(){this.hls.on(Q.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},F.unregisterListeners=function(){this.hls.off(Q.Events.MEDIA_ATTACHING,this.onMediaAttaching)},F.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},F.onMediaAttaching=function(A,c){var x=this.hls.config;if(x.capLevelOnFPSDrop){var M=c.media instanceof self.HTMLVideoElement?c.media:null;this.media=M,M&&typeof M.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),x.fpsDroppedMonitoringPeriod)}},F.checkFPS=function(A,c,x){var M=performance.now();if(c){if(this.lastTime){var w=M-this.lastTime,E=x-this.lastDroppedFrames,b=c-this.lastDecodedFrames,u=1e3*E/w,a=this.hls;if(a.trigger(Q.Events.FPS_DROP,{currentDropped:E,currentDecoded:b,totalDroppedFrames:x}),u>0&&E>a.config.fpsDroppedMonitoringThreshold*b){var l=a.currentLevel;U.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+l),l>0&&(a.autoLevelCapping===-1||a.autoLevelCapping>=l)&&(l=l-1,a.trigger(Q.Events.FPS_DROP_LEVEL_CAPPING,{level:l,droppedLevel:a.currentLevel}),a.autoLevelCapping=l,this.streamController.nextLevelSwitch())}}this.lastTime=M,this.lastDroppedFrames=x,this.lastDecodedFrames=c}},F.checkFPSInterval=function(){var A=this.media;if(A)if(this.isVideoPlaybackQualityAvailable){var c=A.getVideoPlaybackQuality();this.checkFPS(A,c.totalVideoFrames,c.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 F}),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(c,x,M){if(x===null||!Array.isArray(c)||!c.length||!Object(Q.isFiniteNumber)(x))return null;var w=c[0].programDateTime;if(x<(w||0))return null;var E=c[c.length-1].endProgramDateTime;if(x>=(E||0))return null;M=M||0;for(var b=0;b<c.length;++b){var u=c[b];if(_(x,M,u))return u}return null}function j(c,x,M,w){M===void 0&&(M=0),w===void 0&&(w=0);var E=null;if(c?E=x[c.sn-x[0].sn+1]||null:M===0&&x[0].start===0&&(E=x[0]),E&&F(M,w,E)===0)return E;var b=U.default.search(x,F.bind(null,M,w));return b||E}function F(c,x,M){c===void 0&&(c=0),x===void 0&&(x=0);var w=Math.min(x,M.duration+(M.deltaPTS?M.deltaPTS:0));return M.start+M.duration-w<=c?1:M.start-w>c&&M.start?-1:0}function _(c,x,M){var w=Math.min(x,M.duration+(M.deltaPTS?M.deltaPTS:0))*1e3,E=M.endProgramDateTime||0;return E-w>c}function A(c,x){return U.default.search(c,function(M){return M.cc<x?1:M.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 c=A.prototype;return c._registerListeners=function(){var M=this.hls;M.on(Q.Events.BUFFER_APPENDED,this.onBufferAppended,this),M.on(Q.Events.FRAG_BUFFERED,this.onFragBuffered,this),M.on(Q.Events.FRAG_LOADED,this.onFragLoaded,this)},c._unregisterListeners=function(){var M=this.hls;M.off(Q.Events.BUFFER_APPENDED,this.onBufferAppended,this),M.off(Q.Events.FRAG_BUFFERED,this.onFragBuffered,this),M.off(Q.Events.FRAG_LOADED,this.onFragLoaded,this)},c.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},c.getAppendedFrag=function(M,w){if(w===U.PlaylistLevelType.MAIN){var E=this.activeFragment,b=this.activeParts;if(!E)return null;if(b)for(var u=b.length;u--;){var a=b[u],l=a?a.end:E.appendedPTS;if(a.start<=M&&l!==void 0&&M<=l)return u>9&&(this.activeParts=b.slice(u-9)),a}else if(E.start<=M&&E.appendedPTS!==void 0&&M<=E.appendedPTS)return E}return this.getBufferedFrag(M,w)},c.getBufferedFrag=function(M,w){for(var E=this.fragments,b=Object.keys(E),u=b.length;u--;){var a=E[b[u]];if((a==null?void 0:a.body.type)===w&&a.buffered){var l=a.body;if(l.start<=M&&M<=l.end)return l}}return null},c.detectEvictedFragments=function(M,w,E){var b=this;Object.keys(this.fragments).forEach(function(u){var a=b.fragments[u];if(!a)return;if(!a.buffered){a.body.type===E&&b.removeFragment(a.body);return}var l=a.range[M];if(!l)return;l.time.some(function(h){var L=!b.isTimeBuffered(h.startPTS,h.endPTS,w);return L&&b.removeFragment(a.body),L})})},c.detectPartialFragments=function(M){var w=this,E=this.timeRanges,b=M.frag,u=M.part;if(!E||b.sn==="initSegment")return;var a=_(b),l=this.fragments[a];if(!l)return;Object.keys(E).forEach(function(h){var L=b.elementaryStreams[h];if(!L)return;var f=E[h],p=u!==null||L.partial===!0;l.range[h]=w.getBufferedTimes(b,u,p,f)}),l.backtrack=l.loaded=null,Object.keys(l.range).length?l.buffered=!0:this.removeFragment(l.body)},c.fragBuffered=function(M){var w=_(M),E=this.fragments[w];E&&(E.backtrack=E.loaded=null,E.buffered=!0)},c.getBufferedTimes=function(M,w,E,b){for(var u={time:[],partial:E},a=w?w.start:M.start,l=w?w.end:M.end,h=M.minEndPTS||l,L=M.maxStartPTS||a,f=0;f<b.length;f++){var p=b.start(f)-this.bufferPadding,D=b.end(f)+this.bufferPadding;if(L>=p&&h<=D){u.time.push({startPTS:Math.max(a,b.start(f)),endPTS:Math.min(l,b.end(f))});break}else if(a<D&&l>p)u.partial=!0,u.time.push({startPTS:Math.max(a,b.start(f)),endPTS:Math.min(l,b.end(f))});else if(l<=p)break}return u},c.getPartialFragment=function(M){var w=null,E,b,u,a=0,l=this.bufferPadding,h=this.fragments;return Object.keys(h).forEach(function(L){var f=h[L];if(!f)return;F(f)&&(b=f.body.start-l,u=f.body.end+l,M>=b&&M<=u&&(E=Math.min(M-b,u-M),a<=E&&(w=f.body,a=E)))}),w},c.getState=function(M){var w=_(M),E=this.fragments[w];return E?E.buffered?F(E)?O.PARTIAL:O.OK:E.backtrack?O.BACKTRACKED:O.APPENDING:O.NOT_LOADED},c.backtrack=function(M,w){var E=_(M),b=this.fragments[E];if(!b||b.backtrack)return null;var u=b.backtrack=w||b.loaded;return b.loaded=null,u},c.getBacktrackData=function(M){var w=_(M),E=this.fragments[w];if(E){var b,u=E.backtrack;if(u!=null&&(b=u.payload)!==null&&b!==void 0&&b.byteLength)return u;this.removeFragment(M)}return null},c.isTimeBuffered=function(M,w,E){for(var b,u,a=0;a<E.length;a++){if(b=E.start(a)-this.bufferPadding,u=E.end(a)+this.bufferPadding,M>=b&&w<=u)return!0;if(w<=b)return!1}return!1},c.onFragLoaded=function(M,w){var E=w.frag,b=w.part;if(E.sn==="initSegment"||E.bitrateTest||b)return;var u=_(E);this.fragments[u]={body:E,loaded:w,backtrack:null,buffered:!1,range:Object.create(null)}},c.onBufferAppended=function(M,w){var E=this,b=w.frag,u=w.part,a=w.timeRanges;if(b.type===U.PlaylistLevelType.MAIN)if(this.activeFragment=b,u){var l=this.activeParts;l||(this.activeParts=l=[]),l.push(u)}else this.activeParts=null;this.timeRanges=a,Object.keys(a).forEach(function(h){var L=a[h];if(E.detectEvictedFragments(h,L),!u)for(var f=0;f<L.length;f++)b.appendedPTS=Math.max(L.end(f),b.appendedPTS||0)})},c.onFragBuffered=function(M,w){this.detectPartialFragments(w)},c.hasFragment=function(M){var w=_(M);return!!this.fragments[w]},c.removeFragmentsInRange=function(M,w,E){var b=this;Object.keys(this.fragments).forEach(function(u){var a=b.fragments[u];if(!a)return;if(a.buffered){var l=a.body;l.type===E&&l.start<w&&l.end>M&&b.removeFragment(l)}})},c.removeFragment=function(M){var w=_(M);M.stats.loaded=0,M.clearElementaryStreamInfo(),delete this.fragments[w]},c.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},A}();function F(A){var c,x;return A.buffered&&(((c=A.range.video)===null||c===void 0?void 0:c.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 F}),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 c}),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"),F=250,_=2,A=.1,c=.05,x=function(){function M(E,b,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=b,this.fragmentTracker=u,this.hls=a}var w=M.prototype;return w.destroy=function(){this.hls=this.fragmentTracker=this.media=null},w.poll=function(b){var u=this.config,a=this.media,l=this.stalled,h=a.currentTime,L=a.seeking,f=this.seeking&&!L,p=!this.seeking&&L;if(this.seeking=L,h!==b){if(this.moved=!0,l!==null){if(this.stallReported){var D=self.performance.now()-l;j.logger.warn("playback not stuck anymore @"+h+", after "+Math.round(D)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((p||f)&&(this.stalled=null),a.paused||a.ended||a.playbackRate===0||!Q.BufferHelper.getBuffered(a).length)return;var C=Q.BufferHelper.bufferInfo(a,h,0),m=C.len>0,v=C.nextStart||0;if(!m&&!v)return;if(L){var d=C.len>_,o=!v||v-h>_&&!this.fragmentTracker.getPartialFragment(h);if(d||o)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var T,S=Math.max(v,C.start||0)-h,y=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,P=y==null||((T=y.details)===null||T===void 0)?void 0:T.live,B=P?y.details.targetduration*2:_;if(S>0&&S<=B){this._trySkipBufferHole(null);return}}var W=self.performance.now();if(l===null){this.stalled=W;return}var V=W-l;!L&&V>=F&&this._reportStall(C.len);var I=Q.BufferHelper.bufferInfo(a,h,u.maxBufferHole);this._tryFixBufferStall(I,V)},w._tryFixBufferStall=function(b,u){var a=this.config,l=this.fragmentTracker,h=this.media,L=h.currentTime,f=l.getPartialFragment(L);if(f){var p=this._trySkipBufferHole(f);if(p)return}b.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(b){var u=this.hls,a=this.media,l=this.stallReported;l||(this.stallReported=!0,j.logger.warn("Playback stalling at @"+a.currentTime+" due to low buffer (buffer="+b+")"),u.trigger(O.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:b}))},w._trySkipBufferHole=function(b){for(var u=this.config,a=this.hls,l=this.media,h=l.currentTime,L=0,f=Q.BufferHelper.getBuffered(l),p=0;p<f.length;p++){var D=f.start(p);if(h+u.maxBufferHole>=L&&h<D){var C=Math.max(D+c,l.currentTime+A);return j.logger.warn("skipping hole, adjusting currentTime from "+h+" to "+C),this.moved=!0,this.stalled=null,l.currentTime=C,b&&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 "+C,frag:b}),C}L=f.end(p)}return 0},w._tryNudgeBuffer=function(){var b=this.config,u=this.hls,a=this.media,l=a.currentTime,h=(this.nudgeRetry||0)+1;if(this.nudgeRetry=h,h<b.nudgeMaxRetry){var L=l+h*b.nudgeOffset;j.logger.warn("Nudging 'currentTime' from "+l+" to "+L),a.currentTime=L,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 @"+l+" after "+b.nudgeMaxRetry+" nudges"),u.trigger(O.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},M}()},"./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,F=function(){function _(c){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=c,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,M){this.media=M.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 M=0;M<x.length;M++){var w=x[M];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,M){if(!this.media)return;var w=M.frag,E=M.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var b=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,u=0;u<E.length;u++){var a=O.getID3Frames(E[u].data);if(a){var l=E[u].pts,h=u<E.length-1?E[u+1].pts:w.end,L=h-l;L<=0&&(h=l+j);for(var f=0;f<a.length;f++){var p=a[f];if(!O.isTimeStampFrame(p)){var D=new b(l,h,"");D.value=p,this.id3Track.addCue(D)}}}}},A.onBufferFlushing=function(x,M){var w=M.startOffset,E=M.endOffset,b=M.type;if(!b||b==="audio"){var u=this.id3Track;u&&Object(U.removeCuesInRange)(u,w,E)}},_}();$.default=F},"./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,c){for(var x=0;x<c.length;x++){var M=c[x];M.enumerable=M.enumerable||!1,M.configurable=!0,"value"in M&&(M.writable=!0),Object.defineProperty(A,M.key,M)}}function F(A,c,x){return c&&j(A.prototype,c),x&&j(A,x),A}var _=function(){function A(x){var M=this;this.hls=void 0,this.config=void 0,this.media=null,this.levelDetails=null,this.currentTime=0,this.stallCount=0,this._latency=null,this.timeupdateHandler=function(){return M.timeupdate()},this.hls=x,this.config=x.config,this.registerListeners()}var c=A.prototype;return c.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},c.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)},c.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)},c.onMediaAttached=function(M,w){this.media=w.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},c.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},c.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},c.onLevelUpdated=function(M,w){var E=w.details;this.levelDetails=E,E.advanced&&this.timeupdate(),!E.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},c.onError=function(M,w){if(w.details!==Q.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,O.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},c.timeupdate=function(){var M=this.media,w=this.levelDetails;if(!M||!w)return;this.currentTime=M.currentTime;var E=this.computeLatency();if(E===null)return;this._latency=E;var b=this.config,u=b.lowLatencyMode,a=b.maxLiveSyncPlaybackRate;if(!u||a===1)return;var l=this.targetLatency;if(l===null)return;var h=E-l,L=Math.min(this.maxLatency,l+w.targetduration),f=h<L;if(w.live&&f&&h>.05&&this.forwardBufferLength>1){var p=Math.min(2,Math.max(1,a)),D=Math.round(2/(1+Math.exp(-.75*h-this.edgeStalled))*20)/20;M.playbackRate=Math.min(p,Math.max(1,D))}else M.playbackRate!==1&&M.playbackRate!==0&&(M.playbackRate=1)},c.estimateLiveEdge=function(){var M=this.levelDetails;return M===null?null:M.edge+M.age},c.computeLatency=function(){var M=this.estimateLiveEdge();return M===null?null:M-this.currentTime},F(A,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var M=this.config,w=this.levelDetails;return M.liveMaxLatencyDuration!==void 0?M.liveMaxLatencyDuration:w?M.liveMaxLatencyDurationCount*w.targetduration:0}},{key:"targetLatency",get:function(){var M=this.levelDetails;if(M===null)return null;var w=M.holdBack,E=M.partHoldBack,b=M.targetduration,u=this.config,a=u.liveSyncDuration,l=u.liveSyncDurationCount,h=u.lowLatencyMode,L=this.hls.userConfig,f=h&&E||w;(L.liveSyncDuration||L.liveSyncDurationCount||f===0)&&(f=a!==void 0?a:l*b);var p=b,D=1;return f+Math.min(this.stallCount*D,p)}},{key:"liveSyncPosition",get:function(){var M=this.estimateLiveEdge(),w=this.targetLatency,E=this.levelDetails;if(M===null||w===null||E===null)return null;var b=E.edge,u=M-w-this.edgeStalled,a=b-E.totalduration,l=b-(this.config.lowLatencyMode&&E.partTarget||E.targetduration);return Math.min(Math.max(a,u),l)}},{key:"drift",get:function(){var M=this.levelDetails;return M===null?1:M.drift}},{key:"edgeStalled",get:function(){var M=this.levelDetails;if(M===null)return 0;var w=(this.config.lowLatencyMode&&M.partTarget||M.targetduration)*3;return Math.max(M.age-w,0)}},{key:"forwardBufferLength",get:function(){var M=this.media,w=this.levelDetails;if(!M||!w)return 0;var E=M.buffered.length;return E?M.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"),F=R("./src/controller/level-helper.ts"),_=R("./src/controller/base-playlist-controller.ts"),A=R("./src/types/loader.ts");function c(){return c=Object.assign||function(a){for(var l=1;l<arguments.length;l++){var h=arguments[l];for(var L in h)Object.prototype.hasOwnProperty.call(h,L)&&(a[L]=h[L])}return a},c.apply(this,arguments)}function x(a,l){for(var h=0;h<l.length;h++){var L=l[h];L.enumerable=L.enumerable||!1,L.configurable=!0,"value"in L&&(L.writable=!0),Object.defineProperty(a,L.key,L)}}function M(a,l,h){return l&&x(a.prototype,l),h&&x(a,h),a}function w(a,l){a.prototype=Object.create(l.prototype),a.prototype.constructor=a,E(a,l)}function E(a,l){return E=Object.setPrototypeOf||function(L,f){return L.__proto__=f,L},E(a,l)}var b=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),u=function(a){w(l,a);function l(L){var f;return f=a.call(this,L,"[level-controller]")||this,f._levels=[],f._firstLevel=-1,f._startLevel=void 0,f.currentLevelIndex=-1,f.manualLevelIndex=-1,f.onParsedComplete=void 0,f._registerListeners(),f}var h=l.prototype;return h._registerListeners=function(){var f=this.hls;f.on(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),f.on(U.Events.LEVEL_LOADED,this.onLevelLoaded,this),f.on(U.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),f.on(U.Events.FRAG_LOADED,this.onFragLoaded,this),f.on(U.Events.ERROR,this.onError,this)},h._unregisterListeners=function(){var f=this.hls;f.off(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),f.off(U.Events.LEVEL_LOADED,this.onLevelLoaded,this),f.off(U.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),f.off(U.Events.FRAG_LOADED,this.onFragLoaded,this),f.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 f=this._levels;f.forEach(function(p){p.loadError=0}),a.prototype.startLoad.call(this)},h.onManifestLoaded=function(f,p){var D=[],C=[],m=[],v,d={},o,T=!1,S=!1,y=!1;if(p.levels.forEach(function(V){var I=V.attrs;T=T||!!(V.width&&V.height),S=S||!!V.videoCodec,y=y||!!V.audioCodec,b&&V.audioCodec&&V.audioCodec.indexOf("mp4a.40.34")!==-1&&(V.audioCodec=void 0);var N=V.bitrate+"-"+V.attrs.RESOLUTION+"-"+V.attrs.CODECS;o=d[N],o?o.url.push(V.url):(o=new Q.Level(V),d[N]=o,D.push(o)),I&&(I.AUDIO&&Object(F.addGroupId)(o,"audio",I.AUDIO),I.SUBTITLES&&Object(F.addGroupId)(o,"text",I.SUBTITLES))}),(T||S)&&y&&(D=D.filter(function(V){var I=V.videoCodec,N=V.width,X=V.height;return!!I||!!(N&&X)})),D=D.filter(function(V){var I=V.audioCodec,N=V.videoCodec;return(!I||Object(j.isCodecSupportedInMp4)(I,"audio"))&&(!N||Object(j.isCodecSupportedInMp4)(N,"video"))}),p.audioTracks&&(C=p.audioTracks.filter(function(V){return!V.audioCodec||Object(j.isCodecSupportedInMp4)(V.audioCodec,"audio")}),Object(F.assignTrackIdsByGroup)(C)),p.subtitles&&(m=p.subtitles,Object(F.assignTrackIdsByGroup)(m)),D.length>0){v=D[0].bitrate,D.sort(function(V,I){return V.bitrate-I.bitrate}),this._levels=D;for(var P=0;P<D.length;P++)if(D[P].bitrate===v){this._firstLevel=P,this.log("manifest loaded, "+D.length+" level(s) found, first bitrate: "+v);break}var B=y&&!S,W={levels:D,audioTracks:C,subtitleTracks:m,firstLevel:this._firstLevel,stats:p.stats,audio:y,video:S,altAudio:!B&&C.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:p.url,reason:"no level with compatible codecs found in manifest"})},h.onError=function(f,p){if(a.prototype.onError.call(this,f,p),p.fatal)return;var D=p.context,C=this._levels[this.currentLevelIndex];if(D&&(D.type===A.PlaylistContextType.AUDIO_TRACK&&C.audioGroupIds&&D.groupId===C.audioGroupIds[C.urlId]||D.type===A.PlaylistContextType.SUBTITLE_TRACK&&C.textGroupIds&&D.groupId===C.textGroupIds[C.urlId])){this.redundantFailover(this.currentLevelIndex);return}var m=!1,v=!0,d;switch(p.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(p.frag){var o=this._levels[p.frag.level];o?(o.fragmentError++,o.fragmentError>this.hls.config.fragLoadingMaxRetry&&(d=p.frag.level)):d=p.frag.level}break;case O.ErrorDetails.LEVEL_LOAD_ERROR:case O.ErrorDetails.LEVEL_LOAD_TIMEOUT:D&&(D.deliveryDirectives&&(v=!1),d=D.level),m=!0;break;case O.ErrorDetails.REMUX_ALLOC_ERROR:d=p.level,m=!0;break}d!==void 0&&this.recoverLevel(p,d,m,v)},h.recoverLevel=function(f,p,D,C){var m=f.details,v=this._levels[p];if(v.loadError++,D){var d=this.retryLoadingOrFail(f);if(d)f.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(C){var o=v.url.length;if(o>1&&v.loadError<o)f.levelRetry=!0,this.redundantFailover(p);else if(this.manualLevelIndex===-1){var T=p===0?this._levels.length-1:p-1;this.currentLevelIndex!==T&&this._levels[T].loadError===0&&(this.warn(m+": switch to "+T),f.levelRetry=!0,this.hls.nextAutoLevel=T)}}},h.redundantFailover=function(f){var p=this._levels[f],D=p.url.length;if(D>1){var C=(p.urlId+1)%D;this.warn("Switching to redundant URL-id "+C),this._levels.forEach(function(m){m.urlId=C}),this.level=f}},h.onFragLoaded=function(f,p){var D=p.frag;if(D!==void 0&&D.type===A.PlaylistLevelType.MAIN){var C=this._levels[D.level];C!==void 0&&(C.fragmentError=0,C.loadError=0)}},h.onLevelLoaded=function(f,p){var D,C=p.level,m=p.details,v=this._levels[C];if(!v){var d;this.warn("Invalid level index "+C),(d=p.deliveryDirectives)!==null&&d!==void 0&&d.skip&&(m.deltaUpdateFailed=!0);return}C===this.currentLevelIndex?(v.fragmentError===0&&(v.loadError=0,this.retryCount=0),this.playlistLoaded(C,p,v.details)):(D=p.deliveryDirectives)!==null&&D!==void 0&&D.skip&&(m.deltaUpdateFailed=!0)},h.onAudioTrackSwitched=function(f,p){var D=this.hls.levels[this.currentLevelIndex];if(!D)return;if(D.audioGroupIds){for(var C=-1,m=this.hls.audioTracks[p.id].groupId,v=0;v<D.audioGroupIds.length;v++)if(D.audioGroupIds[v]===m){C=v;break}C!==D.urlId&&(D.urlId=C,this.startLoad())}},h.loadPlaylist=function(f){var p=this.currentLevelIndex,D=this._levels[p];if(this.canLoad&&D&&D.url.length>0){var C=D.urlId,m=D.url[C];if(f)try{m=f.addDirectives(m)}catch(v){this.warn("Could not construct new URL with HLS Delivery Directives: "+v)}this.log("Attempt loading level index "+p+(f?" at sn "+f.msn+" part "+f.part:"")+" with URL-id "+C+" "+m),this.clearTimer(),this.hls.trigger(U.Events.LEVEL_LOADING,{url:m,level:p,id:C,deliveryDirectives:f||null})}},h.removeLevel=function(f,p){var D=function(v,d){return d!==p},C=this._levels.filter(function(m,v){return v!==f?!0:m.url.length>1&&p!==void 0?(m.url=m.url.filter(D),m.audioGroupIds&&(m.audioGroupIds=m.audioGroupIds.filter(D)),m.textGroupIds&&(m.textGroupIds=m.textGroupIds.filter(D)),m.urlId=0,!0):!1}).map(function(m,v){var d=m.details;return d!=null&&d.fragments&&d.fragments.forEach(function(o){o.level=v}),m});this._levels=C,this.hls.trigger(U.Events.LEVELS_UPDATED,{levels:C})},M(l,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(f){var p,D=this._levels;if(D.length===0)return;if(this.currentLevelIndex===f&&(p=D[f])!==null&&p!==void 0&&p.details)return;if(f<0||f>=D.length){var C=f<0;if(this.hls.trigger(U.Events.ERROR,{type:O.ErrorTypes.OTHER_ERROR,details:O.ErrorDetails.LEVEL_SWITCH_ERROR,level:f,fatal:C,reason:"invalid level idx"}),C)return;f=Math.min(f,D.length-1)}this.clearTimer();var m=this.currentLevelIndex,v=D[m],d=D[f];this.log("switching to level "+f+" from "+m),this.currentLevelIndex=f;var o=c({},d,{level:f,maxBitrate:d.maxBitrate,uri:d.uri,urlId:d.urlId});delete o._urlId,this.hls.trigger(U.Events.LEVEL_SWITCHING,o);var T=d.details;if(!T||T.live){var S=this.switchParams(d.uri,v==null?void 0:v.details);this.loadPlaylist(S)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(f){this.manualLevelIndex=f,this._startLevel===void 0&&(this._startLevel=f),f!==-1&&(this.level=f)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(f){this._firstLevel=f}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var f=this.hls.config.startLevel;return f!==void 0?f:this._firstLevel}else return this._startLevel},set:function(f){this._startLevel=f}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(f){this.level=f,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=f)}}]),l}(_.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 F}),R.d($,"updateFragPTSDTS",function(){return A}),R.d($,"mergeDetails",function(){return c}),R.d($,"mapPartIntersection",function(){return x}),R.d($,"mapFragmentIntersection",function(){return M}),R.d($,"adjustSliding",function(){return w}),R.d($,"addSliding",function(){return E}),R.d($,"computeReloadInterval",function(){return b}),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(l,h,L){switch(h){case"audio":l.audioGroupIds||(l.audioGroupIds=[]),l.audioGroupIds.push(L);break;case"text":l.textGroupIds||(l.textGroupIds=[]),l.textGroupIds.push(L);break}}function j(l){var h={};l.forEach(function(L){var f=L.groupId||"";L.id=h[f]=h[f]||0,h[f]++})}function F(l,h,L){var f=l[h],p=l[L];_(f,p)}function _(l,h){var L=h.startPTS;if(Object(Q.isFiniteNumber)(L)){var f=0,p;h.sn>l.sn?(f=L-l.start,p=l):(f=l.start-L,p=h),p.duration!==f&&(p.duration=f)}else if(h.sn>l.sn){var D=l.cc===h.cc;D&&l.minEndPTS?h.start=l.start+(l.minEndPTS-l.start):h.start=l.start+l.duration}else h.start=Math.max(l.start-h.duration,0)}function A(l,h,L,f,p,D){var C=f-L;C<=0&&(U.logger.warn("Fragment should have a positive duration",h),f=L+h.duration,D=p+h.duration);var m=L,v=f,d=h.startPTS,o=h.endPTS;if(Object(Q.isFiniteNumber)(d)){var T=Math.abs(d-L);Object(Q.isFiniteNumber)(h.deltaPTS)?h.deltaPTS=Math.max(T,h.deltaPTS):h.deltaPTS=T,m=Math.max(L,d),L=Math.min(L,d),p=Math.min(p,h.startDTS),v=Math.min(f,o),f=Math.max(f,o),D=Math.max(D,h.endDTS)}h.duration=f-L;var S=L-h.start;h.appendedPTS=f,h.start=h.startPTS=L,h.maxStartPTS=m,h.startDTS=p,h.endPTS=f,h.minEndPTS=v,h.endDTS=D;var y=h.sn;if(!l||y<l.startSN||y>l.endSN)return 0;var P,B=y-l.startSN,W=l.fragments;for(W[B]=h,P=B;P>0;P--)_(W[P],W[P-1]);for(P=B;P<W.length-1;P++)_(W[P],W[P+1]);return l.fragmentHint&&_(W[W.length-1],l.fragmentHint),l.PTSKnown=l.alignedSliding=!0,S}function c(l,h){for(var L=null,f=l.fragments,p=f.length-1;p>=0;p--){var D=f[p].initSegment;if(D){L=D;break}}l.fragmentHint&&delete l.fragmentHint.endPTS;var C=0,m;if(M(l,h,function(P,B){P.relurl&&(C=P.cc-B.cc),Object(Q.isFiniteNumber)(P.startPTS)&&Object(Q.isFiniteNumber)(P.endPTS)&&(B.start=B.startPTS=P.startPTS,B.startDTS=P.startDTS,B.appendedPTS=P.appendedPTS,B.maxStartPTS=P.maxStartPTS,B.endPTS=P.endPTS,B.endDTS=P.endDTS,B.minEndPTS=P.minEndPTS,B.duration=P.endPTS-P.startPTS,B.duration&&(m=B),h.PTSKnown=h.alignedSliding=!0),B.elementaryStreams=P.elementaryStreams,B.loader=P.loader,B.stats=P.stats,B.urlId=P.urlId,P.initSegment&&(B.initSegment=P.initSegment,L=P.initSegment)}),L){var v=h.fragmentHint?h.fragments.concat(h.fragmentHint):h.fragments;v.forEach(function(P){var B;(!P.initSegment||P.initSegment.relurl===((B=L)===null||B===void 0?void 0:B.relurl))&&(P.initSegment=L)})}if(h.skippedSegments&&(h.deltaUpdateFailed=h.fragments.some(function(P){return!P}),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(C){U.logger.warn("discontinuity sliding from playlist, take drift into account");for(var T=0;T<o.length;T++)o[T].cc+=C}h.skippedSegments&&(h.startCC=h.fragments[0].cc),x(l.partList,h.partList,function(P,B){B.elementaryStreams=P.elementaryStreams,B.stats=P.stats}),m?A(h,m,m.startPTS,m.endPTS,m.startDTS,m.endDTS):w(l,h),o.length&&(h.totalduration=h.edge-o[0].start),h.driftStartTime=l.driftStartTime,h.driftStart=l.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=l.driftEndTime,h.driftEnd=l.driftEnd,h.advancedDateTime=l.advancedDateTime}function x(l,h,L){if(l&&h)for(var f=0,p=0,D=l.length;p<=D;p++){var C=l[p],m=h[p+f];C&&m&&C.index===m.index&&C.fragment.sn===m.fragment.sn?L(C,m):f--}}function M(l,h,L){for(var f=h.skippedSegments,p=Math.max(l.startSN,h.startSN)-h.startSN,D=(l.fragmentHint?1:0)+(f?h.endSN:Math.min(l.endSN,h.endSN))-h.startSN,C=h.startSN-l.startSN,m=h.fragmentHint?h.fragments.concat(h.fragmentHint):h.fragments,v=l.fragmentHint?l.fragments.concat(l.fragmentHint):l.fragments,d=p;d<=D;d++){var o=v[C+d],T=m[d];f&&!T&&d<f&&(T=h.fragments[d]=o),o&&T&&L(o,T)}}function w(l,h){var L=h.startSN+h.skippedSegments-l.startSN,f=l.fragments;if(L<0||L>=f.length)return;E(h,f[L].start)}function E(l,h){if(h){for(var L=l.fragments,f=l.skippedSegments;f<L.length;f++)L[f].start+=h;l.fragmentHint&&(l.fragmentHint.start+=h)}}function b(l,h){var L=1e3*l.levelTargetDuration,f=L/2,p=l.age,D=p>0&&p<L*3,C=h.loading.end-h.loading.start,m,v=l.availabilityDelay;if(l.updated===!1)if(D){var d=333*l.misses;m=Math.max(Math.min(f,C*2),d),l.availabilityDelay=(l.availabilityDelay||0)+m}else m=f;else D?(v=Math.min(v||L/2,p),l.availabilityDelay=v,m=v+L-p):m=L-C;return Math.round(m)}function u(l,h,L){if(!l||!l.details)return null;var f=l.details,p=f.fragments[h-f.startSN];return p||(p=f.fragmentHint,p&&p.sn===h?p:h<f.startSN&&L&&L.sn===h?L:null)}function a(l,h,L){if(!l||!l.details)return null;var f=l.details.partList;if(f)for(var p=f.length;p--;){var D=f[p];if(D.index===L&&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 f});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"),F=R("./src/utils/buffer-helper.ts"),_=R("./src/controller/fragment-tracker.ts"),A=R("./src/types/loader.ts"),c=R("./src/loader/fragment.ts"),x=R("./src/demux/transmuxer-interface.ts"),M=R("./src/types/transmuxer.ts"),w=R("./src/controller/gap-controller.ts"),E=R("./src/errors.ts"),b=R("./src/utils/logger.ts");function u(p,D){for(var C=0;C<D.length;C++){var m=D[C];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(p,m.key,m)}}function a(p,D,C){return D&&u(p.prototype,D),C&&u(p,C),p}function l(p,D){p.prototype=Object.create(D.prototype),p.prototype.constructor=p,h(p,D)}function h(p,D){return h=Object.setPrototypeOf||function(m,v){return m.__proto__=v,m},h(p,D)}var L=100,f=function(p){l(D,p);function D(m,v){var d;return d=p.call(this,m,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 C=D.prototype;return C._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)},C._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)},C.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},C.startLoad=function(v){if(this.levels){var d=this.lastCurrentTime,o=this.hls;if(this.stopLoad(),this.setInterval(L),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var T=o.startLevel;T===-1&&(o.config.testBandwidth?(T=0,this.bitrateTest=!0):T=o.nextAutoLevel),this.level=o.nextLoadLevel=T,this.loadedmetadata=!1}d>0&&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},C.stopLoad=function(){this._forceStartLoad=!1,p.prototype.stopLoad.call(this)},C.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,T=d==null||((v=d[o])===null||v===void 0)?void 0:v.details;if(T&&(!T.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(T))break;this.state=U.State.IDLE;break}break}case U.State.FRAG_LOADING_WAITING_RETRY:{var S,y=self.performance.now(),P=this.retryDate;(!P||y>=P||(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()},C.onTickEnd=function(){p.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},C.doTickIdle=function(){var v,d,o=this.hls,T=this.levelLastLoaded,S=this.levels,y=this.media,P=o.config,B=o.nextLoadLevel;if(T===null||!y&&(this.startFragRequested||!P.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!S||!S[B])return;var W=S[B];this.level=o.nextLoadLevel=B;var V=W.details;if(!V||this.state===U.State.WAITING_LEVEL||V.live&&this.levelLastLoaded!==B){this.state=U.State.WAITING_LEVEL;return}var I=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:y,A.PlaylistLevelType.MAIN);if(I===null)return;var N=I.len,X=this.getMaxBufferLength(W.maxBitrate);if(N>=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,ce=this.getNextFragment(oe,V);if(this.couldBacktrack&&!this.fragPrevious&&ce&&ce.sn!=="initSegment"){var De=ce.sn-V.startSN;De>1&&(ce=V.fragments[De-1],this.fragmentTracker.removeFragment(ce))}if(ce&&this.fragmentTracker.getState(ce)===_.FragmentState.OK&&this.nextLoadPosition>oe){var Ee=this.audioOnly&&!this.altAudio?c.ElementaryStreamTypes.AUDIO:c.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(y,Ee,A.PlaylistLevelType.MAIN),ce=this.getNextFragment(this.nextLoadPosition,V)}if(!ce)return;ce.initSegment&&!ce.initSegment.data&&!this.bitrateTest&&(ce=ce.initSegment),((v=ce.decryptdata)===null||v===void 0?void 0:v.keyFormat)==="identity"&&!((d=ce.decryptdata)!==null&&d!==void 0&&d.key)?this.loadKey(ce,V):this.loadFragment(ce,V,oe)},C.loadFragment=function(v,d,o){var T,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,p.prototype.loadFragment.call(this,v,d,o)):S===_.FragmentState.APPENDING?this.reduceMaxBufferLength(v.duration)&&this.fragmentTracker.removeFragment(v):((T=this.media)===null||T===void 0?void 0:T.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},C.getAppendedFrag=function(v){var d=this.fragmentTracker.getAppendedFrag(v,A.PlaylistLevelType.MAIN);return d&&"fragment"in d?d.fragment:d},C.getBufferedFrag=function(v){return this.fragmentTracker.getBufferedFrag(v,A.PlaylistLevelType.MAIN)},C.followingBufferedFrag=function(v){return v?this.getBufferedFrag(v.end+.5):null},C.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},C.nextLevelSwitch=function(){var v=this.levels,d=this.media;if(d!=null&&d.readyState){var o,T=this.getAppendedFrag(d.currentTime);if(T&&T.start>1&&this.flushMainBuffer(0,T.start-1),!d.paused&&v){var S=this.hls.nextLoadLevel,y=v[S],P=this.fragLastKbps;P&&this.fragCurrent?o=this.fragCurrent.duration*y.maxBitrate/(1e3*P)+1:o=0}else o=0;var B=this.getBufferedFrag(d.currentTime+o);if(B){var W=this.followingBufferedFrag(B);if(W){this.abortCurrentFrag();var V=W.maxStartPTS?W.maxStartPTS:W.start,I=W.duration,N=Math.max(B.end,V+Math.min(Math.max(I-this.config.maxFragLookUpTolerance,I*.5),I*.75));this.flushMainBuffer(N,Number.POSITIVE_INFINITY)}}}},C.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()},C.flushMainBuffer=function(v,d){p.prototype.flushMainBuffer.call(this,v,d,this.altAudio?"video":null)},C.onMediaAttached=function(v,d){p.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)},C.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),p.prototype.onMediaDetaching.call(this)},C.onMediaPlaying=function(){this.tick()},C.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()},C.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},C.onManifestParsed=function(v,d){var o=!1,T=!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&&(T=!0))}),this.audioCodecSwitch=o&&T&&!Object(O.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=d.levels,this.startFragRequested=!1},C.onLevelLoading=function(v,d){var o=this.levels;if(!o||this.state!==U.State.IDLE)return;var T=o[d.level];(!T.details||T.details.live&&this.levelLastLoaded!==d.level||this.waitForCdnTuneIn(T.details))&&(this.state=U.State.WAITING_LEVEL)},C.onLevelLoaded=function(v,d){var o,T=this.levels,S=d.level,y=d.details,P=y.totalduration;if(!T){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:"+P);var B=this.fragCurrent;B&&(this.state===U.State.FRAG_LOADING||this.state===U.State.FRAG_LOADING_WAITING_RETRY)&&(B.level!==d.level&&B.loader&&(this.state=U.State.IDLE,B.loader.abort()));var W=T[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()},C._handleFragmentLoadProgress=function(v){var d,o=v.frag,T=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 P=y[o.level],B=P.details;if(!B){this.warn("Dropping fragment "+o.sn+" of level "+o.level+" after level details were reset");return}var W=P.videoCodec,V=B.PTSKnown||!B.live,I=(d=o.initSegment)===null||d===void 0?void 0:d.data,N=this._getAudioCodec(P),X=this.transmuxer=this.transmuxer||new x.default(this.hls,A.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),ee=T?T.index:-1,oe=ee!==-1,ce=new M.ChunkMetadata(o.level,o.sn,o.stats.chunkCount,S.byteLength,ee,oe),De=this.initPTS[o.cc];X.push(S,I,N,W,o,T,B.totalduration,V,ce,De)},C.onAudioTrackSwitching=function(v,d){var o=this.altAudio,T=!!d.url,S=d.id;if(!T){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var 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 P=this.hls;o&&P.trigger(j.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),P.trigger(j.Events.AUDIO_TRACK_SWITCHED,{id:S})}},C.onAudioTrackSwitched=function(v,d){var o=d.id,T=!!this.hls.audioTracks[o].url;if(T){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=T,this.tick()},C.onBufferCreated=function(v,d){var o=d.tracks,T,S,y=!1;for(var P in o){var B=o[P];if(B.id==="main"){if(S=P,T=B,P==="video"){var W=o[P];W&&(this.videoBuffer=W.buffer)}}else y=!0}y&&T?(this.log("Alternate track found, use "+S+".buffered to schedule main fragment loading"),this.mediaBuffer=T.buffer):this.mediaBuffer=this.media},C.onFragBuffered=function(v,d){var o=d.frag,T=d.part;if(o&&o.type!==A.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(o)){this.warn("Fragment "+o.sn+(T?" p: "+T.index:"")+" of level "+o.level+" finished buffering, but was aborted. state: "+this.state),this.state===U.State.PARSED&&(this.state=U.State.IDLE);return}var S=T?T.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,T)},C.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,T=this.getFwdBufferInfo(this.media,A.PlaylistLevelType.MAIN);T&&T.len>.5&&(o=!this.reduceMaxBufferLength(T.len)),o&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},C.checkBuffer=function(){var v=this.media,d=this.gapController;if(!v||!d||!v.readyState)return;var o=F.BufferHelper.getBuffered(v);!this.loadedmetadata&&o.length?(this.loadedmetadata=!0,this.seekToStartPos()):d.poll(this.lastCurrentTime),this.lastCurrentTime=v.currentTime},C.onFragLoadEmergencyAborted=function(){this.state=U.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},C.onBufferFlushed=function(v,d){var o=d.type;if(o!==c.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var T=(o===c.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(T,o,A.PlaylistLevelType.MAIN)}},C.onLevelsUpdated=function(v,d){this.levels=d.levels},C.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},C.seekToStartPos=function(){var v=this.media,d=v.currentTime,o=this.startPosition;if(o>=0&&d<o){if(v.seeking){b.logger.log("could not seek to "+o+", already seeking at "+d);return}var T=F.BufferHelper.getBuffered(v),S=T.length?T.start(0):0,y=S-o;y>0&&(y<this.config.maxBufferHole||y<this.config.maxFragLookUpTolerance)&&(b.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}},C._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},C._loadBitrateTestFrag=function(v){var d=this;this._doFragLoad(v).then(function(o){var T=d.hls;if(!o||T.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(),T.trigger(j.Events.FRAG_LOADED,o)})},C._handleTransmuxComplete=function(v){var d,o="main",T=this.hls,S=v.remuxResult,y=v.chunkMeta,P=this.getCurrentContext(y);if(!P){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 B=P.frag,W=P.part,V=P.level,I=S.video,N=S.text,X=S.id3,ee=S.initSegment,oe=this.altAudio?void 0:S.audio;if(this.fragContextChanged(B))return;if(this.state=U.State.PARSING,ee){ee.tracks&&(this._bufferInitSegment(V,ee.tracks,B,y),T.trigger(j.Events.FRAG_PARSING_INIT_SEGMENT,{frag:B,id:o,tracks:ee.tracks}));var ce=ee.initPTS,De=ee.timescale;Object(Q.isFiniteNumber)(ce)&&(this.initPTS[B.cc]=ce,T.trigger(j.Events.INIT_PTS_FOUND,{frag:B,id:o,initPTS:ce,timescale:De}))}if(I&&S.independent!==!1){if(V.details){var Ee=I.startPTS,Ce=I.endPTS,Te=I.startDTS,me=I.endDTS;if(W)W.elementaryStreams[I.type]={startPTS:Ee,endPTS:Ce,startDTS:Te,endDTS:me};else if(I.firstKeyFrame&&I.independent&&(this.couldBacktrack=!0),I.dropped&&I.independent){var pe=this.getLoadPosition()+this.config.maxBufferHole;if(pe<Ee){this.backtrack(B);return}B.setElementaryStreamInfo(I.type,B.start,Ce,B.start,me,!0)}B.setElementaryStreamInfo(I.type,Ee,Ce,Te,me),this.bufferFragmentData(I,B,W,y)}}else if(S.independent===!1){this.backtrack(B);return}if(oe){var ue=oe.startPTS,te=oe.endPTS,he=oe.startDTS,ae=oe.endDTS;W&&(W.elementaryStreams[c.ElementaryStreamTypes.AUDIO]={startPTS:ue,endPTS:te,startDTS:he,endDTS:ae}),B.setElementaryStreamInfo(c.ElementaryStreamTypes.AUDIO,ue,te,he,ae),this.bufferFragmentData(oe,B,W,y)}if(X!=null&&(d=X.samples)!==null&&d!==void 0&&d.length){var we={frag:B,id:o,samples:X.samples};T.trigger(j.Events.FRAG_PARSING_METADATA,we)}if(N){var Le={frag:B,id:o,samples:N.samples};T.trigger(j.Events.FRAG_PARSING_USERDATA,Le)}},C._bufferInitSegment=function(v,d,o,T){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,P=d.video,B=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+"]")}P&&(P.levelCodec=v.videoCodec,P.id="main",this.log("Init video buffer, container:"+P.container+", codecs[level/parsed]=["+(v.videoCodec||"")+"/"+P.codec+"]")),B&&this.log("Init audiovideo buffer, container:"+B.container+", codecs[level/parsed]=["+(v.attrs.CODECS||"")+"/"+B.codec+"]"),this.hls.trigger(j.Events.BUFFER_CODECS,d),Object.keys(d).forEach(function(I){var N=d[I],X=N.initSegment;X!=null&&X.byteLength&&S.hls.trigger(j.Events.BUFFER_APPENDING,{type:I,data:X,frag:o,part:null,chunkMeta:T,parent:o.type})}),this.tick()},C.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},C.checkFragmentChanged=function(){var v=this.media,d=null;if(v&&v.readyState>1&&v.seeking===!1){var o=v.currentTime;if(F.BufferHelper.isBuffered(v,o)?d=this.getAppendedFrag(o):F.BufferHelper.isBuffered(v,o+.1)&&(d=this.getAppendedFrag(o+.1)),d){var T=this.fragPlaying,S=d.level;(!T||d.sn!==T.sn||T.level!==S||d.urlId!==T.urlId)&&(this.hls.trigger(j.Events.FRAG_CHANGED,{frag:d}),(!T||T.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 l});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"),F=R("./src/utils/discontinuities.ts"),_=R("./src/controller/level-helper.ts"),A=R("./src/controller/fragment-tracker.ts"),c=R("./src/controller/base-stream-controller.ts"),x=R("./src/types/loader.ts"),M=R("./src/types/level.ts");function w(h,L){for(var f=0;f<L.length;f++){var p=L[f];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(h,p.key,p)}}function E(h,L,f){return L&&w(h.prototype,L),f&&w(h,f),h}function b(h,L){h.prototype=Object.create(L.prototype),h.prototype.constructor=h,u(h,L)}function u(h,L){return u=Object.setPrototypeOf||function(p,D){return p.__proto__=D,p},u(h,L)}var a=500,l=function(h){b(L,h);function L(p,D){var C;return C=h.call(this,p,D,"[subtitle-stream-controller]")||this,C.levels=[],C.currentTrackId=-1,C.tracksBuffered=[],C.mainDetails=null,C._registerListeners(),C}var f=L.prototype;return f.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},f._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)},f._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)},f.startLoad=function(){this.stopLoad(),this.state=c.State.IDLE,this.setInterval(a),this.tick()},f.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},f.onLevelLoaded=function(D,C){this.mainDetails=C.details},f.onSubtitleFragProcessed=function(D,C){var m=C.frag,v=C.success;if(this.fragPrevious=m,this.state=c.State.IDLE,!v)return;var d=this.tracksBuffered[this.currentTrackId];if(!d)return;for(var o,T=m.start,S=0;S<d.length;S++)if(T>=d[S].start&&T<=d[S].end){o=d[S];break}var y=m.start+m.duration;o?o.end=y:(o={start:T,end:y},d.push(o)),this.fragmentTracker.fragBuffered(m)},f.onBufferFlushing=function(D,C){var m=C.startOffset,v=C.endOffset;if(m===0&&v!==Number.POSITIVE_INFINITY){var d=this.currentTrackId,o=this.levels;if(!o.length||!o[d]||!o[d].details)return;var T=o[d].details,S=T.targetduration,y=v-S;if(y<=0)return;C.endOffsetSubtitles=Math.max(0,y),this.tracksBuffered.forEach(function(P){for(var B=0;B<P.length;){if(P[B].end<=y){P.shift();continue}else if(P[B].start<y)P[B].start=y;else break;B++}}),this.fragmentTracker.removeFragmentsInRange(m,y,x.PlaylistLevelType.SUBTITLE)}},f.onError=function(D,C){var m,v=C.frag;if(!v||v.type!==x.PlaylistLevelType.SUBTITLE)return;(m=this.fragCurrent)!==null&&m!==void 0&&m.loader&&this.fragCurrent.loader.abort(),this.state=c.State.IDLE},f.onSubtitleTracksUpdated=function(D,C){var m=this,v=C.subtitleTracks;this.tracksBuffered=[],this.levels=v.map(function(d){return new M.Level(d)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(d){m.tracksBuffered[d.id]=[]}),this.mediaBuffer=null},f.onSubtitleTrackSwitch=function(D,C){if(this.currentTrackId=C.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var m=this.levels[this.currentTrackId];m!=null&&m.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,m&&this.setInterval(a)},f.onSubtitleTrackLoaded=function(D,C){var m,v=C.details,d=C.id,o=this.currentTrackId,T=this.levels;if(!T.length)return;var S=T[o];if(d>=T.length||d!==o||!S)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,v.live||(m=S.details)!==null&&m!==void 0&&m.live){var y=this.mainDetails;if(v.deltaUpdateFailed||!y)return;var P=y.fragments[0];if(!S.details)v.hasProgramDateTime&&y.hasProgramDateTime?Object(F.alignMediaPlaylistByPDT)(v,y):P&&Object(_.addSliding)(v,P.start);else{var B=this.alignPlaylists(v,S.details);B===0&&P&&Object(_.addSliding)(v,P.start)}}if(S.details=v,this.levelLastLoaded=d,this.tick(),v.live&&!this.fragCurrent&&this.media&&this.state===c.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)}},f._handleFragmentLoadComplete=function(D){var C=D.frag,m=D.payload,v=C.decryptdata,d=this.hls;if(this.fragContextChanged(C))return;if(m&&m.byteLength>0&&v&&v.key&&v.iv&&v.method==="AES-128"){var o=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(m),v.key.buffer,v.iv.buffer).then(function(T){var S=performance.now();d.trigger(Q.Events.FRAG_DECRYPTED,{frag:C,payload:T,stats:{tstart:o,tdecrypt:S}})})}},f.doTick=function(){if(!this.media){this.state=c.State.IDLE;return}if(this.state===c.State.IDLE){var D,C=this.currentTrackId,m=this.levels;if(!m.length||!m[C]||!m[C].details)return;var v=m[C].details,d=v.targetduration,o=this.config,T=this.media,S=O.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,T.currentTime-d,o.maxBufferHole),y=S.end,P=S.len,B=this.getMaxBufferLength()+d;if(P>B)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,N,X=this.fragPrevious;if(y<I){var ee=o.maxFragLookUpTolerance;X&&v.hasProgramDateTime&&(N=Object(j.findFragmentByPDT)(W,X.endProgramDateTime,ee)),N||(N=Object(j.findFragmentByPTS)(X,W,y,ee),!N&&X&&X.start<W[0].start&&(N=W[0]))}else N=W[V-1];(D=N)!==null&&D!==void 0&&D.encrypted?(U.logger.log("Loading key for "+N.sn),this.state=c.State.KEY_LOADING,this.hls.trigger(Q.Events.KEY_LOADING,{frag:N})):N&&this.fragmentTracker.getState(N)===A.FragmentState.NOT_LOADED&&this.loadFragment(N,v,y)}},f.loadFragment=function(D,C,m){this.fragCurrent=D,h.prototype.loadFragment.call(this,D,C,m)},E(L,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),L}(c.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 F(w,E){for(var b=0;b<E.length;b++){var u=E[b];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(w,u.key,u)}}function _(w,E,b){return E&&F(w.prototype,E),b&&F(w,b),w}function A(w,E){w.prototype=Object.create(E.prototype),w.prototype.constructor=w,c(w,E)}function c(w,E){return c=Object.setPrototypeOf||function(u,a){return u.__proto__=a,u},c(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 b=E.prototype;return b.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,w.prototype.destroy.call(this)},b.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)},b.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)},b.onMediaAttached=function(a,l){if(this.media=l.media,!this.media)return;this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange)},b.pollTrackChange=function(a){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,a)},b.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=M(this.media.textTracks);a.forEach(function(l){Object(U.clearCurrentCues)(l)}),this.subtitleTrack=-1,this.media=null},b.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},b.onManifestParsed=function(a,l){this.tracks=l.subtitleTracks},b.onSubtitleTrackLoaded=function(a,l){var h=l.id,L=l.details,f=this.trackId,p=this.tracksInGroup[f];if(!p){this.warn("Invalid subtitle track id "+h);return}var D=p.details;p.details=l.details,this.log("subtitle track "+h+" loaded ["+L.startSN+"-"+L.endSN+"]"),h===this.trackId&&(this.retryCount=0,this.playlistLoaded(h,l,D))},b.onLevelLoading=function(a,l){this.switchLevel(l.level)},b.onLevelSwitching=function(a,l){this.switchLevel(l.level)},b.switchLevel=function(a){var l=this.hls.levels[a];if(!(l!=null&&l.textGroupIds))return;var h=l.textGroupIds[l.urlId];if(this.groupId!==h){var L=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,f=this.tracks.filter(function(C){return!h||C.groupId===h});this.tracksInGroup=f;var p=this.findTrackId(L==null?void 0:L.name)||this.findTrackId();this.groupId=h;var D={subtitleTracks:f};this.log("Updating subtitle tracks, "+f.length+' track(s) found in "'+h+'" group-id'),this.hls.trigger(Q.Events.SUBTITLE_TRACKS_UPDATED,D),p!==-1&&this.setSubtitleTrack(p,L)}},b.findTrackId=function(a){for(var l=this.tracksInGroup,h=0;h<l.length;h++){var L=l[h];if((!this.selectDefaultTrack||L.default)&&(!a||a===L.name))return L.id}return-1},b.onError=function(a,l){if(w.prototype.onError.call(this,a,l),l.fatal||!l.context)return;l.context.type===j.PlaylistContextType.SUBTITLE_TRACK&&l.context.id===this.trackId&&l.context.groupId===this.groupId&&this.retryLoadingOrFail(l)},b.loadPlaylist=function(a){var l=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(l)){var h=l.id,L=l.groupId,f=l.url;if(a)try{f=a.addDirectives(f)}catch(p){this.warn("Could not construct new URL with HLS Delivery Directives: "+p)}this.log("Loading subtitle playlist for id "+h),this.hls.trigger(Q.Events.SUBTITLE_TRACK_LOADING,{url:f,id:h,groupId:L,deliveryDirectives:a||null})}},b.toggleTrackModes=function(a){var l=this,h=this.media,L=this.subtitleDisplay,f=this.trackId;if(!h)return;var p=M(h.textTracks),D=p.filter(function(v){return v.groupId===l.groupId});if(a===-1)[].slice.call(p).forEach(function(v){v.mode="disabled"});else{var C=D[f];C&&(C.mode="disabled")}var m=D[a];m&&(m.mode=L?"showing":"hidden")},b.setSubtitleTrack=function(a,l){var h,L=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=a;return}if(this.trackId!==a&&this.toggleTrackModes(a),this.trackId===a&&(a===-1||(h=L[a])!==null&&h!==void 0&&h.details)||a<-1||a>=L.length)return;this.clearTimer();var f=L[a];if(this.log("Switching to subtitle track "+a),this.trackId=a,f){var p=f.id,D=f.groupId,C=D===void 0?"":D,m=f.name,v=f.type,d=f.url;this.hls.trigger(Q.Events.SUBTITLE_TRACK_SWITCH,{id:p,groupId:C,name:m,type:v,url:d});var o=this.switchParams(f.url,l==null?void 0:l.details);this.loadPlaylist(o)}else this.hls.trigger(Q.Events.SUBTITLE_TRACK_SWITCH,{id:a})},b.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var a=-1,l=M(this.media.textTracks),h=0;h<l.length;h++)if(l[h].mode==="hidden")a=h;else if(l[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 l=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(a,l)}}]),E}(O.default);function M(w){for(var E=[],b=0;b<w.length;b++){var u=w[b];u.kind==="subtitles"&&u.label&&E.push(w[b])}return E}$.default=x},"./src/controller/timeline-controller.ts":function(ne,$,R){"use strict";R.r($),R.d($,"TimelineController",function(){return M});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"),F=R("./src/utils/webvtt-parser.ts"),_=R("./src/utils/texttrack-utils.ts"),A=R("./src/utils/imsc1-ttml-parser.ts"),c=R("./src/types/loader.ts"),x=R("./src/utils/logger.ts"),M=function(){function u(l){if(this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.timescale=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=b(),this.captionsProperties=void 0,this.hls=l,this.config=l.config,this.Cues=l.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},this.config.enableCEA708Captions){var h=new j.default(this,"textTrack1"),L=new j.default(this,"textTrack2"),f=new j.default(this,"textTrack3"),p=new j.default(this,"textTrack4");this.cea608Parser1=new O.default(1,h,L),this.cea608Parser2=new O.default(3,f,p)}l.on(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),l.on(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),l.on(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),l.on(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),l.on(U.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),l.on(U.Events.FRAG_LOADING,this.onFragLoading,this),l.on(U.Events.FRAG_LOADED,this.onFragLoaded,this),l.on(U.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),l.on(U.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),l.on(U.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),l.on(U.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),l.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,L,f,p,D){for(var C=!1,m=D.length;m--;){var v=D[m],d=E(v[0],v[1],L,f);if(d>=0&&(v[0]=Math.min(v[0],L),v[1]=Math.max(v[1],f),C=!0,d/(f-L)>.5))return}if(C||D.push([L,f]),this.config.renderTextTracksNatively){var o=this.captionsTracks[h];this.Cues.newCue(o,L,f,p)}else{var T=this.Cues.newCue(null,L,f,p);this.hls.trigger(U.Events.CUES_PARSED,{type:"captions",cues:T,track:h})}},a.onInitPtsFound=function(h,L){var f=this,p=L.frag,D=L.id,C=L.initPTS,m=L.timescale,v=this.unparsedVttFrags;D==="main"&&(this.initPTS[p.cc]=C,this.timescale[p.cc]=m),v.length&&(this.unparsedVttFrags=[],v.forEach(function(d){f.onFragLoaded(U.Events.FRAG_LOADED,d)}))},a.getExistingTrack=function(h){var L=this.media;if(L)for(var f=0;f<L.textTracks.length;f++){var p=L.textTracks[f];if(p[h])return p}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 L=this.captionsProperties,f=this.captionsTracks,p=this.media,D=L[h],C=D.label,m=D.languageCode,v=this.getExistingTrack(h);if(v)f[h]=v,Object(_.clearCurrentCues)(f[h]),Object(_.sendAddTrackEvent)(f[h],p);else{var d=this.createTextTrack("captions",C,m);d&&(d[h]=!0,f[h]=d)}},a.createNonNativeTrack=function(h){if(this.nonNativeCaptionsTracks[h])return;var L=this.captionsProperties[h];if(!L)return;var f=L.label,p={_id:h,label:f,kind:"captions",default:L.media?!!L.media.default:!1,closedCaptions:L.media};this.nonNativeCaptionsTracks[h]=p,this.hls.trigger(U.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[p]})},a.createTextTrack=function(h,L,f){var p=this.media;return p?p.addTextTrack(h,L,f):void 0},a.onMediaAttaching=function(h,L){this.media=L.media,this._cleanTracks()},a.onMediaDetaching=function(){var h=this.captionsTracks;Object.keys(h).forEach(function(L){Object(_.clearCurrentCues)(h[L]),delete h[L]}),this.nonNativeCaptionsTracks={}},a.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=b(),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 L=h.textTracks;if(L)for(var f=0;f<L.length;f++)Object(_.clearCurrentCues)(L[f])},a.onSubtitleTracksUpdated=function(h,L){var f=this;this.textTracks=[];var p=L.subtitleTracks||[],D=p.some(function(d){return d.textCodec===A.IMSC1_CODEC});if(this.config.enableWebVTT||D&&this.config.enableIMSC1){var C=this.tracks&&p&&this.tracks.length===p.length;if(this.tracks=p||[],this.config.renderTextTracksNatively){var m=this.media?this.media.textTracks:[];this.tracks.forEach(function(d,o){var T;if(o<m.length){for(var S=null,y=0;y<m.length;y++)if(w(m[y],d)){S=m[y];break}S&&(T=S)}T?Object(_.clearCurrentCues)(T):(T=f.createTextTrack("subtitles",d.name,d.lang),T&&(T.mode="disabled")),T&&(T.groupId=d.groupId,f.textTracks.push(T))})}else if(!C&&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,L){var f=this;this.config.enableCEA708Captions&&L.captions&&L.captions.forEach(function(p){var D=/(?:CC|SERVICE)([1-4])/.exec(p.instreamId);if(!D)return;var C="textTrack"+D[1],m=f.captionsProperties[C];if(!m)return;m.label=p.name,p.lang&&(m.languageCode=p.lang),m.media=p})},a.onFragLoading=function(h,L){var f=this.cea608Parser1,p=this.cea608Parser2,D=this.lastSn,C=this.lastPartIndex;if(!this.enabled||!(f&&p))return;if(L.frag.type===c.PlaylistLevelType.MAIN){var m,v,d=L.frag.sn,o=(m=L==null||((v=L.part)===null||v===void 0)?void 0:v.index)!=null?m:-1;d===D+1||d===D&&o===C+1||(f.reset(),p.reset()),this.lastSn=d,this.lastPartIndex=o}},a.onFragLoaded=function(h,L){var f=L.frag,p=L.payload,D=this.initPTS,C=this.unparsedVttFrags;if(f.type===c.PlaylistLevelType.SUBTITLE)if(p.byteLength){if(!Object(Q.isFiniteNumber)(D[f.cc])){C.push(L),D.length&&this.hls.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:f,error:new Error("Missing initial subtitle PTS")});return}var m=f.decryptdata;if(m==null||m.key==null||m.method!=="AES-128"){var v=this.tracks[f.level],d=this.vttCCs;d[f.cc]||(d[f.cc]={start:f.start,prevCC:this.prevCC,new:!0},this.prevCC=f.cc),v&&v.textCodec===A.IMSC1_CODEC?this._parseIMSC1(f,p):this._parseVTTs(f,p,d)}}else this.hls.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:f,error:new Error("Empty subtitle payload")})},a._parseIMSC1=function(h,L){var f=this,p=this.hls;Object(A.parseIMSC1)(L,this.initPTS[h.cc],this.timescale[h.cc],function(D){f._appendCues(D,h.level),p.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:h})},function(D){x.logger.log("Failed to parse IMSC1: "+D),p.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:h,error:D})})},a._parseVTTs=function(h,L,f){var p=this,D=this.hls;Object(F.parseWebVTT)(L,this.initPTS[h.cc],this.timescale[h.cc],f,h.cc,h.start,function(C){p._appendCues(C,h.level),D.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:h})},function(C){p._fallbackToIMSC1(h,L),x.logger.log("Failed to parse VTT cue: "+C),D.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:h,error:C})})},a._fallbackToIMSC1=function(h,L){var f=this,p=this.tracks[h.level];p.textCodec||Object(A.parseIMSC1)(L,this.initPTS[h.cc],this.timescale[h.cc],function(){p.textCodec=A.IMSC1_CODEC,f._parseIMSC1(h,L)},function(){p.textCodec="wvtt"})},a._appendCues=function(h,L){var f=this.hls;if(this.config.renderTextTracksNatively){var p=this.textTracks[L];if(p.mode==="disabled")return;h.forEach(function(m){return Object(_.addCueToTrack)(p,m)})}else{var D=this.tracks[L],C=D.default?"default":"subtitles"+L;f.trigger(U.Events.CUES_PARSED,{type:"subtitles",cues:h,track:C})}},a.onFragDecrypted=function(h,L){var f=L.frag;if(f.type===c.PlaylistLevelType.SUBTITLE){if(!Object(Q.isFiniteNumber)(this.initPTS[f.cc])){this.unparsedVttFrags.push(L);return}this.onFragLoaded(U.Events.FRAG_LOADED,L)}},a.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},a.onFragParsingUserdata=function(h,L){var f=this.cea608Parser1,p=this.cea608Parser2;if(!this.enabled||!(f&&p))return;for(var D=0;D<L.samples.length;D++){var C=L.samples[D].bytes;if(C){var m=this.extractCea608Data(C);f.addData(L.samples[D].pts,m[0]),p.addData(L.samples[D].pts,m[1])}}},a.onBufferFlushing=function(h,L){var f=L.startOffset,p=L.endOffset,D=L.endOffsetSubtitles,C=L.type,m=this.media;if(!m||m.currentTime<p)return;if(!C||C==="video"){var v=this.captionsTracks;Object.keys(v).forEach(function(o){return Object(_.removeCuesInRange)(v[o],f,p)})}if(this.config.renderTextTracksNatively&&(f===0&&D!==void 0)){var d=this.textTracks;Object.keys(d).forEach(function(o){return Object(_.removeCuesInRange)(d[o],f,D)})}},a.extractCea608Data=function(h){for(var L=h[0]&31,f=2,p=[[],[]],D=0;D<L;D++){var C=h[f++],m=127&h[f++],v=127&h[f++],d=(4&C)!==0,o=3&C;if(m===0&&v===0)continue;d&&((o===0||o===1)&&(p[o].push(m),p[o].push(v)))}return p},u}();function w(u,a){return u&&u.label===a.name&&!(u.textTrack1||u.textTrack2)}function E(u,a,l,h){return Math.min(a,h)-Math.max(u,l)}function b(){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,F){this.subtle=void 0,this.aesIV=void 0,this.subtle=j,this.aesIV=F}var O=U.prototype;return O.decrypt=function(F,_){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},_,F)},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 F=j.byteLength,_=F&&new DataView(j.buffer).getUint8(F-1);return _?Object(Q.sliceUint8)(j,0,F-_):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 F=j.prototype;return F.uint8ArrayToUint32Array_=function(A){for(var c=new DataView(A),x=new Uint32Array(4),M=0;M<4;M++)x[M]=c.getUint32(M*4);return x},F.initTable=function(){var A=this.sBox,c=this.invSBox,x=this.subMix,M=x[0],w=x[1],E=x[2],b=x[3],u=this.invSubMix,a=u[0],l=u[1],h=u[2],L=u[3],f=new Uint32Array(256),p=0,D=0,C=0;for(C=0;C<256;C++)C<128?f[C]=C<<1:f[C]=C<<1^283;for(C=0;C<256;C++){var m=D^D<<1^D<<2^D<<3^D<<4;m=m>>>8^m&255^99,A[p]=m,c[m]=p;var v=f[p],d=f[v],o=f[d],T=f[m]*257^m*16843008;M[p]=T<<24|T>>>8,w[p]=T<<16|T>>>16,E[p]=T<<8|T>>>24,b[p]=T,T=o*16843009^d*65537^v*257^p*16843008,a[m]=T<<24|T>>>8,l[m]=T<<16|T>>>16,h[m]=T<<8|T>>>24,L[m]=T,p?(p=v^f[f[f[o^v]]],D^=f[f[D]]):p=D=1}},F.expandKey=function(A){for(var c=this.uint8ArrayToUint32Array_(A),x=!0,M=0;M<c.length&&x;)x=c[M]===this.key[M],M++;if(x)return;this.key=c;var w=this.keySize=c.length;if(w!==4&&w!==6&&w!==8)throw new Error("Invalid aes key size="+w);var E=this.ksRows=(w+6+1)*4,b,u,a=this.keySchedule=new Uint32Array(E),l=this.invKeySchedule=new Uint32Array(E),h=this.sBox,L=this.rcon,f=this.invSubMix,p=f[0],D=f[1],C=f[2],m=f[3],v,d;for(b=0;b<E;b++){if(b<w){v=a[b]=c[b];continue}d=v,b%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^=L[b/w|0]<<24):w>6&&b%w===4&&(d=h[d>>>24]<<24|h[d>>>16&255]<<16|h[d>>>8&255]<<8|h[d&255]),a[b]=v=(a[b-w]^d)>>>0}for(u=0;u<E;u++)b=E-u,u&3?d=a[b]:d=a[b-4],u<4||b<=4?l[u]=d:l[u]=p[h[d>>>24]]^D[h[d>>>16&255]]^C[h[d>>>8&255]]^m[h[d&255]],l[u]=l[u]>>>0},F.networkToHostOrderSwap=function(A){return A<<24|(A&65280)<<8|(A&16711680)>>8|A>>>24},F.decrypt=function(A,c,x){for(var M=this.keySize+6,w=this.invKeySchedule,E=this.invSBox,b=this.invSubMix,u=b[0],a=b[1],l=b[2],h=b[3],L=this.uint8ArrayToUint32Array_(x),f=L[0],p=L[1],D=L[2],C=L[3],m=new Int32Array(A),v=new Int32Array(m.length),d,o,T,S,y,P,B,W,V,I,N,X,ee,oe,ce=this.networkToHostOrderSwap;c<m.length;){for(V=ce(m[c]),I=ce(m[c+1]),N=ce(m[c+2]),X=ce(m[c+3]),y=V^w[0],P=X^w[1],B=N^w[2],W=I^w[3],ee=4,oe=1;oe<M;oe++)d=u[y>>>24]^a[P>>16&255]^l[B>>8&255]^h[W&255]^w[ee],o=u[P>>>24]^a[B>>16&255]^l[W>>8&255]^h[y&255]^w[ee+1],T=u[B>>>24]^a[W>>16&255]^l[y>>8&255]^h[P&255]^w[ee+2],S=u[W>>>24]^a[y>>16&255]^l[P>>8&255]^h[B&255]^w[ee+3],y=d,P=o,B=T,W=S,ee=ee+4;d=E[y>>>24]<<24^E[P>>16&255]<<16^E[B>>8&255]<<8^E[W&255]^w[ee],o=E[P>>>24]<<24^E[B>>16&255]<<16^E[W>>8&255]<<8^E[y&255]^w[ee+1],T=E[B>>>24]<<24^E[W>>16&255]<<16^E[y>>8&255]<<8^E[P&255]^w[ee+2],S=E[W>>>24]<<24^E[y>>16&255]<<16^E[P>>8&255]<<8^E[B&255]^w[ee+3],v[c]=ce(d^f),v[c+1]=ce(S^p),v[c+2]=ce(T^D),v[c+3]=ce(o^C),f=V,p=I,D=N,C=X,c=c+4}return v.buffer},j}()},"./src/crypt/decrypter.ts":function(ne,$,R){"use strict";R.r($),R.d($,"default",function(){return c});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"),F=R("./src/utils/mp4-tools.ts"),_=R("./src/utils/typed-array.ts"),A=16,c=function(){function x(w,E,b){var u=b===void 0?{}:b,a=u.removePKCS7Padding,l=a===void 0?!0:a;if(this.logEnabled=!0,this.observer=void 0,this.config=void 0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.observer=w,this.config=E,this.removePKCS7Padding=l,l)try{var h=self.crypto;h&&(this.subtle=h.subtle||h.webkitSubtle)}catch(L){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var M=x.prototype;return M.destroy=function(){this.observer=null},M.isSync=function(){return this.config.enableSoftwareAES},M.flush=function(){var E=this.currentResult;if(!E){this.reset();return}var b=new Uint8Array(E);return this.reset(),this.removePKCS7Padding?Object(O.removePadding)(b):b},M.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},M.decrypt=function(E,b,u,a){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(E),b,u);var l=this.flush();l&&a(l.buffer)}else this.webCryptoDecrypt(new Uint8Array(E),b,u).then(a)},M.softwareDecrypt=function(E,b,u){var a=this.currentIV,l=this.currentResult,h=this.remainderData;this.logOnce("JS AES decrypt"),h&&(E=Object(F.appendUint8Array)(h,E),this.remainderData=null);var L=this.getValidChunk(E);if(!L.length)return null;a&&(u=a);var f=this.softwareDecrypter;f||(f=this.softwareDecrypter=new O.default),f.expandKey(b);var p=l;return this.currentResult=f.decrypt(L.buffer,0,u),this.currentIV=Object(_.sliceUint8)(L,-16).buffer,p||null},M.webCryptoDecrypt=function(E,b,u){var a=this,l=this.subtle;return(this.key!==b||!this.fastAesKey)&&(this.key=b,this.fastAesKey=new U.default(l,b)),this.fastAesKey.expandKey().then(function(h){if(!l)return Promise.reject(new Error("web crypto not initialized"));var L=new Q.default(l,u);return L.decrypt(E.buffer,h)}).catch(function(h){return a.onWebCryptoError(h,E,b,u)})},M.onWebCryptoError=function(E,b,u,a){return j.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",E),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(b,u,a)},M.getValidChunk=function(E){var b=E,u=E.length-E.length%A;return u!==E.length&&(b=Object(_.sliceUint8)(E,0,u),this.remainderData=Object(_.sliceUint8)(E,u)),b},M.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,F){this.subtle=void 0,this.key=void 0,this.subtle=j,this.key=F}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 F(c,x){c.prototype=Object.create(x.prototype),c.prototype.constructor=c,_(c,x)}function _(c,x){return _=Object.setPrototypeOf||function(w,E){return w.__proto__=E,w},_(c,x)}var A=function(c){F(x,c);function x(w,E){var b;return b=c.call(this)||this,b.observer=void 0,b.config=void 0,b.observer=w,b.config=E,b}var M=x.prototype;return M.resetInitSegment=function(E,b,u){c.prototype.resetInitSegment.call(this,E,b,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 b=j.getID3Data(E,0)||[],u=b.length,a=E.length;u<a;u++)if(U.probe(E,u))return O.logger.log("ADTS sync word found !"),!0;return!1},M.canParse=function(E,b){return U.canParse(E,b)},M.appendFrame=function(E,b,u){U.initTrackConfig(E,this.observer,b,u,E.manifestCodec);var a=U.appendFrame(E,b,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 F}),R.d($,"getHeaderLength",function(){return _}),R.d($,"getFullFrameLength",function(){return A}),R.d($,"canGetFrameLength",function(){return c}),R.d($,"isHeader",function(){return x}),R.d($,"canParse",function(){return M}),R.d($,"probe",function(){return w}),R.d($,"initTrackConfig",function(){return E}),R.d($,"getFrameDuration",function(){return b}),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(l,h,L,f){var p,D,C,m,v=navigator.userAgent.toLowerCase(),d=f,o=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];p=((h[L+2]&192)>>>6)+1;var T=(h[L+2]&60)>>>2;if(T>o.length-1){l.trigger(O.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+T});return}return C=(h[L+2]&1)<<2,C|=(h[L+3]&192)>>>6,Q.logger.log("manifest codec:"+f+", ADTS type:"+p+", samplingIndex:"+T),/firefox/i.test(v)?T>=6?(p=5,m=new Array(4),D=T-3):(p=2,m=new Array(2),D=T):v.indexOf("android")!==-1?(p=2,m=new Array(2),D=T):(p=5,m=new Array(4),f&&(f.indexOf("mp4a.40.29")!==-1||f.indexOf("mp4a.40.5")!==-1)||!f&&T>=6?D=T-3:((f&&f.indexOf("mp4a.40.2")!==-1&&(T>=6&&C===1||/vivaldi/i.test(v))||!f&&C===1)&&(p=2,m=new Array(2)),D=T)),m[0]=p<<3,m[0]|=(T&14)>>1,m[1]|=(T&1)<<7,m[1]|=C<<3,p===5&&(m[1]|=(D&14)>>1,m[2]=(D&1)<<7,m[2]|=2<<2,m[3]=0),{config:m,samplerate:o[T],channelCount:C,codec:"mp4a.40."+p,manifestCodec:d}}function F(l,h){return l[h]===255&&(l[h+1]&246)===240}function _(l,h){return l[h+1]&1?7:9}function A(l,h){return(l[h+3]&3)<<11|l[h+4]<<3|(l[h+5]&224)>>>5}function c(l,h){return h+5<l.length}function x(l,h){return h+1<l.length&&F(l,h)}function M(l,h){return c(l,h)&&F(l,h)&&A(l,h)<=l.length-h}function w(l,h){if(x(l,h)){var L=_(l,h);if(h+L>=l.length)return!1;var f=A(l,h);if(f<=L)return!1;var p=h+f;return p===l.length||x(l,p)}return!1}function E(l,h,L,f,p){if(!l.samplerate){var D=j(h,L,f,p);if(!D)return;l.config=D.config,l.samplerate=D.samplerate,l.channelCount=D.channelCount,l.codec=D.codec,l.manifestCodec=D.manifestCodec,Q.logger.log("parsed codec:"+l.codec+", rate:"+D.samplerate+", channels:"+D.channelCount)}}function b(l){return 1024*9e4/l}function u(l,h,L,f,p){var D=_(l,h),C=A(l,h);if(C-=D,C>0){var m=L+f*p;return{headerLength:D,frameLength:C,stamp:m}}}function a(l,h,L,f,p){var D=b(l.samplerate),C=u(h,L,f,p,D);if(C){var m=C.frameLength,v=C.headerLength,d=C.stamp,o=v+m,T=Math.max(0,L+o-h.length),S;T?(S=new Uint8Array(o-v),S.set(h.subarray(L+v,h.length),0)):S=h.subarray(L+v,L+o);var y={unit:S,pts:d};return T||l.samples.push(y),{sample:y,length:o,missing:T}}}},"./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"),F=R("./src/utils/typed-array.ts"),_=function(){function c(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var x=c.prototype;return x.resetInitSegment=function(w,E,b){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,b){},x.demux=function(w,E){this.cachedData&&(w=Object(j.appendUint8Array)(this.cachedData,w),this.cachedData=null);var b=U.getID3Data(w,0),u=b?b.length:0,a,l,h=this._audioTrack,L=this._id3Track,f=b?U.getTimeStamp(b):void 0,p=w.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=A(f,E)),b&&b.length>0&&L.samples.push({pts:this.initPTS,dts:this.initPTS,data:b}),l=this.initPTS;u<p;){if(this.canParse(w,u)){var D=this.appendFrame(h,w,u);D?(this.frameIndex++,l=D.sample.pts,u+=D.length,a=u):u=p}else U.canParse(w,u)?(b=U.getID3Data(w,u),L.samples.push({pts:l,dts:l,data:b}),u+=b.length,a=u):u++;if(u===p&&a!==p){var C=Object(F.sliceUint8)(w,a);this.cachedData?this.cachedData=Object(j.appendUint8Array)(this.cachedData,C):this.cachedData=C}}return{audioTrack:h,avcTrack:Object(O.dummyTrack)(),id3Track:L,textTrack:Object(O.dummyTrack)()}},x.demuxSampleAes=function(w,E,b){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(){},c}(),A=function(x,M){return Object(Q.isFiniteNumber)(x)?x*90:M*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,c;if(_.length)_.length===1?c=_[0]:c=U(_,A);else return new Uint8Array(0);return this.reset(),c},j.reset=function(){this.chunks.length=0,this.dataLength=0},O}();function U(O,j){for(var F=new Uint8Array(j),_=0,A=0;A<O.length;A++){var c=O[A];F.set(c,_),_+=c.length}return F}},"./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(F){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=F,this.bytesAvailable=F.byteLength,this.word=0,this.bitsAvailable=0}var j=O.prototype;return j.loadWord=function(){var _=this.data,A=this.bytesAvailable,c=_.byteLength-A,x=new Uint8Array(4),M=Math.min(4,A);if(M===0)throw new Error("no bytes available");x.set(_.subarray(c,c+M)),this.word=new DataView(x.buffer).getUint32(0),this.bitsAvailable=M*8,this.bytesAvailable-=M},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,_),c=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?c<<A|this.readBits(A):c},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,c=8,x,M=0;M<_;M++)c!==0&&(x=this.readEG(),c=(A+x+256)%256),A=c===0?A:c},j.readSPS=function(){var _=0,A=0,c=0,x=0,M,w,E,b=this.readUByte.bind(this),u=this.readBits.bind(this),a=this.readUEG.bind(this),l=this.readBoolean.bind(this),h=this.skipBits.bind(this),L=this.skipEG.bind(this),f=this.skipUEG.bind(this),p=this.skipScalingList.bind(this);b();var D=b();if(u(5),h(3),b(),f(),D===100||D===110||D===122||D===244||D===44||D===83||D===86||D===118||D===128){var C=a();if(C===3&&h(1),f(),f(),h(1),l())for(w=C!==3?8:12,E=0;E<w;E++)l()&&(E<6?p(16):p(64))}f();var m=a();if(m===0)a();else if(m===1)for(h(1),L(),L(),M=a(),E=0;E<M;E++)L();f(),h(1);var v=a(),d=a(),o=u(1);o===0&&h(1),h(1),l()&&(_=a(),A=a(),c=a(),x=a());var T=[1,1];if(l()&&l()){var S=b();switch(S){case 1:T=[1,1];break;case 2:T=[12,11];break;case 3:T=[10,11];break;case 4:T=[16,11];break;case 5:T=[40,33];break;case 6:T=[24,11];break;case 7:T=[20,11];break;case 8:T=[32,11];break;case 9:T=[80,33];break;case 10:T=[18,11];break;case 11:T=[15,11];break;case 12:T=[64,33];break;case 13:T=[160,99];break;case 14:T=[4,3];break;case 15:T=[3,2];break;case 16:T=[2,1];break;case 255:{T=[b()<<8|b(),b()<<8|b()];break}}}return{width:Math.ceil((v+1)*16-_*2-A*2),height:(2-o)*(d+1)*16-(o?2:4)*(c+x),pixelRatio:T}},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 F}),R.d($,"getTimeStamp",function(){return _}),R.d($,"isTimeStampFrame",function(){return A}),R.d($,"getID3Frames",function(){return x}),R.d($,"decodeFrame",function(){return M}),R.d($,"utf8ArrayToStr",function(){return a}),R.d($,"testables",function(){return l});var Q=function(p,D){return D+10<=p.length&&(p[D]===73&&p[D+1]===68&&p[D+2]===51&&(p[D+3]<255&&p[D+4]<255&&(p[D+6]<128&&p[D+7]<128&&p[D+8]<128&&p[D+9]<128)))},U=function(p,D){return D+10<=p.length&&(p[D]===51&&p[D+1]===68&&p[D+2]===73&&(p[D+3]<255&&p[D+4]<255&&(p[D+6]<128&&p[D+7]<128&&p[D+8]<128&&p[D+9]<128)))},O=function(p,D){for(var C=D,m=0;Q(p,D);){m+=10;var v=j(p,D+6);m+=v,U(p,D+10)&&(m+=10),D+=m}return m>0?p.subarray(C,C+m):void 0},j=function(p,D){var C=0;return C=(p[D]&127)<<21,C|=(p[D+1]&127)<<14,C|=(p[D+2]&127)<<7,C|=p[D+3]&127,C},F=function(p,D){return Q(p,D)&&j(p,D+6)+10<=p.length-D},_=function(p){for(var D=x(p),C=0;C<D.length;C++){var m=D[C];if(A(m))return u(m)}return},A=function(p){return p&&p.key==="PRIV"&&p.info==="com.apple.streaming.transportStreamTimestamp"},c=function(p){var D=String.fromCharCode(p[0],p[1],p[2],p[3]),C=j(p,4),m=10;return{type:D,size:C,data:p.subarray(m,m+C)}},x=function(p){for(var D=0,C=[];Q(p,D);){var m=j(p,D+6);D+=10;for(var v=D+m;D+8<v;){var d=c(p.subarray(D)),o=M(d);o&&C.push(o),D+=d.size+10}U(p,D)&&(D+=10)}return C},M=function(p){return p.type==="PRIV"?w(p):p.type[0]==="W"?b(p):E(p)},w=function(p){if(p.size<2)return;var D=a(p.data,!0),C=new Uint8Array(p.data.subarray(D.length+1));return{key:p.type,info:D,data:C.buffer}},E=function(p){if(p.size<2)return;if(p.type==="TXXX"){var D=1,C=a(p.data.subarray(D),!0);D+=C.length+1;var m=a(p.data.subarray(D));return{key:p.type,info:C,data:m}}var v=a(p.data.subarray(1));return{key:p.type,data:v}},b=function(p){if(p.type==="WXXX"){if(p.size<2)return;var D=1,C=a(p.data.subarray(D),!0);D+=C.length+1;var m=a(p.data.subarray(D));return{key:p.type,info:C,data:m}}var v=a(p.data);return{key:p.type,data:v}},u=function(p){if(p.data.byteLength===8){var D=new Uint8Array(p.data),C=D[3]&1,m=(D[4]<<23)+(D[5]<<15)+(D[6]<<7)+D[7];return m/=45,C&&(m+=4772185884e-2),Math.round(m)}return},a=function(p,D){D===void 0&&(D=!1);var C=L();if(C){var m=C.decode(p);if(D){var v=m.indexOf("\0");return v!==-1?m.substring(0,v):m}return m.replace(/\0/g,"")}for(var d=p.length,o,T,S,y="",P=0;P<d;){if(o=p[P++],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:T=p[P++],y+=String.fromCharCode((o&31)<<6|T&63);break;case 14:T=p[P++],S=p[P++],y+=String.fromCharCode((o&15)<<12|(T&63)<<6|(S&63)<<0);break;default:}}return y},l={decodeTextFrame:E},h;function L(){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 F(c,x){c.prototype=Object.create(x.prototype),c.prototype.constructor=c,_(c,x)}function _(c,x){return _=Object.setPrototypeOf||function(w,E){return w.__proto__=E,w},_(c,x)}var A=function(c){F(x,c);function x(){return c.apply(this,arguments)||this}var M=x.prototype;return M.resetInitSegment=function(E,b,u){c.prototype.resetInitSegment.call(this,E,b,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 b=U.getID3Data(E,0)||[],u=b.length,a=E.length;u<a;u++)if(j.probe(E,u))return O.logger.log("MPEG Audio sync word found !"),!0;return!1},M.canParse=function(E,b){return j.canParse(E,b)},M.appendFrame=function(E,b,u){return this.initPTS===null?void 0:j.appendFrame(E,b,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 F=j.prototype;return F.resetTimeStamp=function(){},F.resetInitSegment=function(){},F.resetContiguity=function(){},j.probe=function(A){return Object(Q.findBox)({data:A,start:0,end:Math.min(A.length,16384)},["moof"]).length>0},F.demux=function(A){var c=A,x=Object(U.dummyTrack)();if(this.config.progressive){this.remainderData&&(c=Object(Q.appendUint8Array)(this.remainderData,A));var M=Object(Q.segmentValidRange)(c);this.remainderData=M.remainder,x.samples=M.valid||new Uint8Array}else x.samples=c;return{audioTrack:Object(U.dummyTrack)(),avcTrack:x,id3Track:Object(U.dummyTrack)(),textTrack:Object(U.dummyTrack)()}},F.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)()}},F.demuxSampleAes=function(A,c,x){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},F.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 c}),R.d($,"isHeader",function(){return x}),R.d($,"canParse",function(){return M}),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]],F=[0,1,1,4];function _(E,b,u,a,l){if(u+24>b.length)return;var h=A(b,u);if(h&&u+h.frameLength<=b.length){var L=h.samplesPerFrame*9e4/h.sampleRate,f=a+l*L,p={unit:b.subarray(u,u+h.frameLength),pts:f,dts:f};return E.config=[],E.channelCount=h.channelCount,E.samplerate=h.sampleRate,E.samples.push(p),{sample:p,length:h.frameLength,missing:0}}}function A(E,b){var u=E[b+1]>>3&3,a=E[b+1]>>1&3,l=E[b+2]>>4&15,h=E[b+2]>>2&3;if(u!==1&&l!==0&&l!==15&&h!==3){var L=E[b+2]>>1&1,f=E[b+3]>>6,p=u===3?3-a:a===3?3:4,D=U[p*14+l-1]*1e3,C=u===3?0:u===2?1:2,m=O[C*3+h],v=f===3?1:2,d=j[u][a],o=F[a],T=d*8*o,S=Math.floor(d*D/m+L)*o;if(Q===null){var y=navigator.userAgent||"",P=y.match(/Chrome\/(\d+)/i);Q=P?parseInt(P[1]):0}var B=!!Q&&Q<=87;return B&&a===2&&D>=224e3&&f===0&&(E[b+3]=E[b+3]|128),{sampleRate:m,channelCount:v,frameLength:S,samplesPerFrame:T}}}function c(E,b){return E[b]===255&&(E[b+1]&224)===224&&(E[b+1]&6)!==0}function x(E,b){return b+1<E.length&&c(E,b)}function M(E,b){var u=4;return c(E,b)&&u<=E.length-b}function w(E,b){if(b+1<E.length&&c(E,b)){var u=4,a=A(E,b),l=u;a!=null&&a.frameLength&&(l=a.frameLength);var h=b+l;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,c){this.keyData=void 0,this.decrypter=void 0,this.keyData=c,this.decrypter=new Q.default(_,A,{removePKCS7Padding:!1})}var F=j.prototype;return F.decryptBuffer=function(A,c){this.decrypter.decrypt(A,this.keyData.key.buffer,this.keyData.iv.buffer,c)},F.decryptAacSample=function(A,c,x,M){var w=A[c].unit,E=w.subarray(16,w.length-w.length%16),b=E.buffer.slice(E.byteOffset,E.byteOffset+E.length),u=this;this.decryptBuffer(b,function(a){var l=new Uint8Array(a);w.set(l,16),M||u.decryptAacSamples(A,c+1,x)})},F.decryptAacSamples=function(A,c,x){for(;;c++){if(c>=A.length){x();return}if(A[c].unit.length<32)continue;var M=this.decrypter.isSync();if(this.decryptAacSample(A,c,x,M),!M)return}},F.getAvcEncryptedData=function(A){for(var c=Math.floor((A.length-48)/160)*16+16,x=new Int8Array(c),M=0,w=32;w<=A.length-16;w+=160,M+=16)x.set(A.subarray(w,w+16),M);return x},F.getAvcDecryptedUnit=function(A,c){for(var x=new Uint8Array(c),M=0,w=32;w<=A.length-16;w+=160,M+=16)A.set(x.subarray(M,M+16),w);return A},F.decryptAvcSample=function(A,c,x,M,w,E){var b=Object(U.discardEPB)(w.data),u=this.getAvcEncryptedData(b),a=this;this.decryptBuffer(u.buffer,function(l){w.data=a.getAvcDecryptedUnit(b,l),E||a.decryptAvcSamples(A,c,x+1,M)})},F.decryptAvcSamples=function(A,c,x,M){if(A instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;c++,x=0){if(c>=A.length){M();return}for(var w=A[c].units;!(x>=w.length);x++){var E=w[x];if(E.data.length<=48||E.type!==1&&E.type!==5)continue;var b=this.decrypter.isSync();if(this.decryptAvcSample(A,c,x,M,E,b),!b)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"),F=R("./src/utils/logger.ts"),_=R("./src/errors.ts"),A=R("./src/utils/mediasource-helper.ts"),c=R("./node_modules/eventemitter3/index.js"),x=R.n(c),M=Object(A.getMediaSource)()||{isTypeSupported:function(){return!1}},w=function(){function E(u,a,l,h){var L=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=l,this.onFlush=h;var f=u.config,p=function(d,o){o=o||{},o.frag=L.frag,o.id=L.id,u.trigger(d,o)};this.observer=new c.EventEmitter,this.observer.on(O.Events.FRAG_DECRYPTED,p),this.observer.on(O.Events.ERROR,p);var D={mp4:M.isTypeSupported("video/mp4"),mpeg:M.isTypeSupported("audio/mpeg"),mp3:M.isTypeSupported('audio/mp4; codecs="mp3"')},C=navigator.vendor;if(f.enableWorker&&typeof Worker!="undefined"){F.logger.log("demuxing in webworker");var m;try{m=this.worker=Q("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),m.addEventListener("message",this.onwmsg),m.onerror=function(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+")")})},m.postMessage({cmd:"init",typeSupported:D,vendor:C,id:a,config:JSON.stringify(f)})}catch(v){F.logger.warn("Error in worker:",v),F.logger.error("Error while initializing DemuxerWorker, fallback to inline"),m&&self.URL.revokeObjectURL(m.objectURL),this.transmuxer=new j.default(this.observer,D,f,C,a),this.worker=null}}else this.transmuxer=new j.default(this.observer,D,f,C,a)}var b=E.prototype;return b.destroy=function(){var a=this.worker;if(a)a.removeEventListener("message",this.onwmsg),a.terminate(),this.worker=null;else{var l=this.transmuxer;l&&(l.destroy(),this.transmuxer=null)}var h=this.observer;h&&h.removeAllListeners(),this.observer=null},b.push=function(a,l,h,L,f,p,D,C,m,v){var d=this;m.transmuxing.start=self.performance.now();var o=this.transmuxer,T=this.worker,S=p?p.start:f.start,y=f.decryptdata,P=this.frag,B=!(P&&f.cc===P.cc),W=!(P&&m.level===P.level),V=P?m.sn-P.sn:-1,I=this.part?m.part-this.part.index:1,N=!W&&(V===1||V===0&&I===1),X=self.performance.now();(W||V||f.stats.parsing.start===0)&&(f.stats.parsing.start=X),p&&(I||!N)&&(p.stats.parsing.start=X);var ee=new j.TransmuxState(B,N,C,W,S);if(!N||B){F.logger.log("[transmuxer-interface, "+f.type+"]: Starting new transmux session for sn: "+m.sn+" p: "+m.part+" level: "+m.level+" id: "+m.id+`
|
|
discontinuity: `+B+`
|
|
trackSwitch: `+W+`
|
|
contiguous: `+N+`
|
|
accurateTimeOffset: `+C+`
|
|
timeOffset: `+S);var oe=new j.TransmuxConfig(h,L,l,D,v);this.configureTransmuxer(oe)}if(this.frag=f,this.part=p,T)T.postMessage({cmd:"demux",data:a,decryptdata:y,chunkMeta:m,state:ee},a instanceof ArrayBuffer?[a]:[]);else if(o){var ce=o.push(a,y,m,ee);Object(j.isPromise)(ce)?ce.then(function(De){d.handleTransmuxComplete(De)}):this.handleTransmuxComplete(ce)}},b.flush=function(a){var l=this;a.transmuxing.start=self.performance.now();var h=this.transmuxer,L=this.worker;if(L)L.postMessage({cmd:"flush",chunkMeta:a});else if(h){var f=h.flush(a);Object(j.isPromise)(f)?f.then(function(p){l.handleFlushResult(p,a)}):this.handleFlushResult(f,a)}},b.handleFlushResult=function(a,l){var h=this;a.forEach(function(L){h.handleTransmuxComplete(L)}),this.onFlush(l)},b.onWorkerMessage=function(a){var l=a.data,h=this.hls;switch(l.event){case"init":{self.URL.revokeObjectURL(this.worker.objectURL);break}case"transmuxComplete":{this.handleTransmuxComplete(l.data);break}case"flush":{this.onFlush(l.data);break}default:{l.data=l.data||{},l.data.frag=this.frag,l.data.id=this.id,h.trigger(l.event,l.data);break}}},b.configureTransmuxer=function(a){var l=this.worker,h=this.transmuxer;l?l.postMessage({cmd:"configure",config:a}):h&&h.configure(a)},b.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"),F=R.n(j);function _(w){var E=new j.EventEmitter,b=function(a,l){w.postMessage({event:a,data:l})};E.on(U.Events.FRAG_DECRYPTED,b),E.on(U.Events.ERROR,b),w.addEventListener("message",function(u){var a=u.data;switch(a.cmd){case"init":{var l=JSON.parse(a.config);w.transmuxer=new Q.default(E,a.typeSupported,l,a.vendor,a.id),Object(O.enableLogs)(l.debug),b("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(p){A(w,p)}):A(w,h);break}case"flush":{var L=a.chunkMeta,f=w.transmuxer.flush(L);Object(Q.isPromise)(f)?f.then(function(p){x(w,p,L)}):x(w,f,L);break}default:break}})}function A(w,E){if(M(E.remuxResult))return;var b=[],u=E.remuxResult,a=u.audio,l=u.video;a&&c(b,a),l&&c(b,l),w.postMessage({event:"transmuxComplete",data:E},b)}function c(w,E){E.data1&&w.push(E.data1.buffer),E.data2&&w.push(E.data2.buffer)}function x(w,E,b){E.forEach(function(u){A(w,u)}),w.postMessage({event:"flush",data:b})}function M(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 l}),R.d($,"isPromise",function(){return f}),R.d($,"TransmuxConfig",function(){return p}),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"),F=R("./src/demux/mp4demuxer.ts"),_=R("./src/demux/tsdemuxer.ts"),A=R("./src/demux/mp3demuxer.ts"),c=R("./src/remux/mp4-remuxer.ts"),x=R("./src/remux/passthrough-remuxer.ts"),M=R("./src/demux/chunk-cache.ts"),w=R("./src/utils/mp4-tools.ts"),E=R("./src/utils/logger.ts"),b;try{b=self.performance.now.bind(self.performance)}catch(C){E.logger.debug("Unable to use Performance API on this environment"),b=self.Date.now}var u=[{demux:_.default,remux:c.default},{demux:F.default,remux:x.default},{demux:j.default,remux:c.default},{demux:A.default,remux:c.default}],a=1024;u.forEach(function(C){var m=C.demux;a=Math.max(a,m.minProbeByteLength)});var l=function(){function C(v,d,o,T,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 M.default,this.observer=v,this.typeSupported=d,this.config=o,this.vendor=T,this.id=S}var m=C.prototype;return m.configure=function(d){this.transmuxConfig=d,this.decrypter&&this.decrypter.reset()},m.push=function(d,o,T,S){var y=this,P=T.transmuxing;P.executeStart=b();var B=new Uint8Array(d),W=this.cache,V=this.config,I=this.currentTransmuxState,N=this.transmuxConfig;S&&(this.currentTransmuxState=S);var X=h(B,o);if(X&&X.method==="AES-128"){var ee=this.getDecrypter();if(V.enableSoftwareAES){var oe=ee.softwareDecrypt(B,X.key.buffer,X.iv.buffer);if(!oe)return P.executeEnd=b(),L(T);B=new Uint8Array(oe)}else return this.decryptionPromise=ee.webCryptoDecrypt(B,X.key.buffer,X.iv.buffer).then(function(_e){var Ie=y.push(_e,null,T);return y.decryptionPromise=null,Ie}),this.decryptionPromise}var ce=S||I,De=ce.contiguous,Ee=ce.discontinuity,Ce=ce.trackSwitch,Te=ce.accurateTimeOffset,me=ce.timeOffset,pe=N.audioCodec,ue=N.videoCodec,te=N.defaultInitPts,he=N.duration,ae=N.initSegmentData;if((Ee||Ce)&&this.resetInitSegment(ae,pe,ue,he),Ee&&this.resetInitialTimestamp(te),De||this.resetContiguity(),this.needsProbing(B,Ee,Ce)){if(W.dataLength){var we=W.flush();B=Object(w.appendUint8Array)(we,B)}this.configureTransmuxer(B,N)}var Le=this.transmux(B,X,me,Te,T),xe=this.currentTransmuxState;return xe.contiguous=!0,xe.discontinuity=!1,xe.trackSwitch=!1,P.executeEnd=b(),Le},m.flush=function(d){var o=this,T=d.transmuxing;T.executeStart=b();var S=this.decrypter,y=this.cache,P=this.currentTransmuxState,B=this.decryptionPromise;if(B)return B.then(function(){return o.flush(d)});var W=[],V=P.timeOffset;if(S){var I=S.flush();I&&W.push(this.push(I,null,d))}var N=y.dataLength;y.reset();var X=this.demuxer,ee=this.remuxer;if(!X||!ee)return N>=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"}),T.executeEnd=b(),[L(d)];var oe=X.flush(V);return f(oe)?oe.then(function(ce){return o.flushRemux(W,ce,d),W}):(this.flushRemux(W,oe,d),W)},m.flushRemux=function(d,o,T){var S=o.audioTrack,y=o.avcTrack,P=o.id3Track,B=o.textTrack,W=this.currentTransmuxState,V=W.accurateTimeOffset,I=W.timeOffset;E.logger.log("[transmuxer.ts]: Flushed fragment "+T.sn+(T.part>-1?" p: "+T.part:"")+" of level "+T.level);var N=this.remuxer.remux(S,y,P,B,I,V,!0,this.id);d.push({remuxResult:N,chunkMeta:T}),T.transmuxing.executeEnd=b()},m.resetInitialTimestamp=function(d){var o=this.demuxer,T=this.remuxer;if(!o||!T)return;o.resetTimeStamp(d),T.resetTimeStamp(d)},m.resetContiguity=function(){var d=this.demuxer,o=this.remuxer;if(!d||!o)return;d.resetContiguity(),o.resetNextTimestamp()},m.resetInitSegment=function(d,o,T,S){var y=this.demuxer,P=this.remuxer;if(!y||!P)return;y.resetInitSegment(o,T,S),P.resetInitSegment(d,o,T)},m.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},m.transmux=function(d,o,T,S,y){var P;return o&&o.method==="SAMPLE-AES"?P=this.transmuxSampleAes(d,o,T,S,y):P=this.transmuxUnencrypted(d,T,S,y),P},m.transmuxUnencrypted=function(d,o,T,S){var y=this.demuxer.demux(d,o,!1,!this.config.progressive),P=y.audioTrack,B=y.avcTrack,W=y.id3Track,V=y.textTrack,I=this.remuxer.remux(P,B,W,V,o,T,!1,this.id);return{remuxResult:I,chunkMeta:S}},m.transmuxSampleAes=function(d,o,T,S,y){var P=this;return this.demuxer.demuxSampleAes(d,o,T).then(function(B){var W=P.remuxer.remux(B.audioTrack,B.avcTrack,B.id3Track,B.textTrack,T,S,!1,P.id);return{remuxResult:W,chunkMeta:y}})},m.configureTransmuxer=function(d,o){for(var T=this.config,S=this.observer,y=this.typeSupported,P=this.vendor,B=o.audioCodec,W=o.defaultInitPts,V=o.duration,I=o.initSegmentData,N=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:F.default,remux:x.default});var ce=this.demuxer,De=this.remuxer,Ee=X.remux,Ce=X.demux;(!De||!(De instanceof Ee))&&(this.remuxer=new Ee(S,T,y,P)),(!ce||!(ce instanceof Ce))&&(this.demuxer=new Ce(S,T,y),this.probe=Ce.probe),this.resetInitSegment(I,B,N,V),this.resetInitialTimestamp(W)},m.needsProbing=function(d,o,T){return!this.demuxer||!this.remuxer||o||T},m.getDecrypter=function(){var d=this.decrypter;return d||(d=this.decrypter=new O.default(this.observer,this.config)),d},C}();function h(C,m){var v=null;return C.byteLength>0&&m!=null&&m.key!=null&&m.iv!==null&&m.method!=null&&(v=m),v}var L=function(m){return{remuxResult:{},chunkMeta:m}};function f(C){return"then"in C&&C.then instanceof Function}var p=function(m,v,d,o,T){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=m,this.videoCodec=v,this.initSegmentData=d,this.duration=o,this.defaultInitPts=T},D=function(m,v,d,o,T){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=m,this.contiguous=v,this.accurateTimeOffset=d,this.trackSwitch=o,this.timeOffset=T}},"./src/demux/tsdemuxer.ts":function(ne,$,R){"use strict";R.r($),R.d($,"discardEPB",function(){return L});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"),F=R("./src/demux/sample-aes.ts"),_=R("./src/events.ts"),A=R("./src/utils/mp4-tools.ts"),c=R("./src/utils/logger.ts"),x=R("./src/errors.ts"),M={video:1,audio:2,id3:3,text:4},w=function(){function f(D,C,m){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this.aacLastPTS=null,this._initPTS=null,this._initDTS=null,this._pmtId=-1,this._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=D,this.config=C,this.typeSupported=m}f.probe=function(C){var m=f.syncOffset(C);return m<0?!1:(m&&c.logger.warn("MPEG2-TS detected but first sync word found @ offset "+m+", junk ahead ?"),!0)},f.syncOffset=function(C){for(var m=Math.min(1e3,C.length-3*188),v=0;v<m;){if(C[v]===71&&C[v+188]===71&&C[v+2*188]===71)return v;v++}return-1},f.createTrack=function(C,m){return{container:C==="video"||C==="audio"?"video/mp2t":void 0,type:C,id:M[C],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:C==="audio"?m:void 0}};var p=f.prototype;return p.resetInitSegment=function(C,m,v){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=f.createTrack("video",v),this._audioTrack=f.createTrack("audio",v),this._id3Track=f.createTrack("id3",v),this._txtTrack=f.createTrack("text",v),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=C,this.videoCodec=m,this._duration=v},p.resetTimeStamp=function(){},p.resetContiguity=function(){var C=this._audioTrack,m=this._avcTrack,v=this._id3Track;C&&(C.pesData=null),m&&(m.pesData=null),v&&(v.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},p.demux=function(C,m,v,d){v===void 0&&(v=!1),d===void 0&&(d=!1),v||(this.sampleAes=null);var o,T=this._avcTrack,S=this._audioTrack,y=this._id3Track,P=T.pid,B=T.pesData,W=S.pid,V=y.pid,I=S.pesData,N=y.pesData,X=!1,ee=this.pmtParsed,oe=this._pmtId,ce=C.length;if(this.remainderData&&(C=Object(A.appendUint8Array)(this.remainderData,C),ce=C.length,this.remainderData=null),ce<188&&!d)return this.remainderData=C,{audioTrack:S,avcTrack:T,id3Track:y,textTrack:this._txtTrack};var De=Math.max(0,f.syncOffset(C));ce-=(ce+De)%188,ce<C.byteLength&&!d&&(this.remainderData=new Uint8Array(C.buffer,ce,C.buffer.byteLength-ce));for(var Ee=De;Ee<ce;Ee+=188)if(C[Ee]===71){var Ce=!!(C[Ee+1]&64),Te=((C[Ee+1]&31)<<8)+C[Ee+2],me=(C[Ee+3]&48)>>4,pe=void 0;if(me>1){if(pe=Ee+5+C[Ee+4],pe===Ee+188)continue}else pe=Ee+4;switch(Te){case P:Ce&&(B&&(o=a(B))&&this.parseAVCPES(o,!1),B={data:[],size:0}),B&&(B.data.push(C.subarray(pe,Ee+188)),B.size+=Ee+188-pe);break;case W:Ce&&(I&&(o=a(I))&&(S.isAAC?this.parseAACPES(o):this.parseMPEGPES(o)),I={data:[],size:0}),I&&(I.data.push(C.subarray(pe,Ee+188)),I.size+=Ee+188-pe);break;case V:Ce&&(N&&(o=a(N))&&this.parseID3PES(o),N={data:[],size:0}),N&&(N.data.push(C.subarray(pe,Ee+188)),N.size+=Ee+188-pe);break;case 0:Ce&&(pe+=C[pe]+1),oe=this._pmtId=b(C,pe);break;case oe:{Ce&&(pe+=C[pe]+1);var ue=u(C,pe,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,v);P=ue.avc,P>0&&(T.pid=P),W=ue.audio,W>0&&(S.pid=W,S.isAAC=ue.isAAC),V=ue.id3,V>0&&(y.pid=V),X&&!ee&&(c.logger.log("reparse from beginning"),X=!1,Ee=De-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"});T.pesData=B,S.pesData=I,y.pesData=N;var te={audioTrack:S,avcTrack:T,id3Track:y,textTrack:this._txtTrack};return d&&this.extractRemainingSamples(te),te},p.flush=function(){var C=this.remainderData;this.remainderData=null;var m;return C?m=this.demux(C,-1,!1,!0):m={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(m),this.sampleAes?this.decrypt(m,this.sampleAes):m},p.extractRemainingSamples=function(C){var m=C.audioTrack,v=C.avcTrack,d=C.id3Track,o=v.pesData,T=m.pesData,S=d.pesData,y;o&&(y=a(o))?(this.parseAVCPES(y,!0),v.pesData=null):v.pesData=o,T&&(y=a(T))?(m.isAAC?this.parseAACPES(y):this.parseMPEGPES(y),m.pesData=null):(T!=null&&T.size&&c.logger.log("last AAC PES packet truncated,might overlap between fragments"),m.pesData=T),S&&(y=a(S))?(this.parseID3PES(y),d.pesData=null):d.pesData=S},p.demuxSampleAes=function(C,m,v){var d=this.demux(C,v,!0,!this.config.progressive),o=this.sampleAes=new F.default(this.observer,this.config,m);return this.decrypt(d,o)},p.decrypt=function(C,m){return new Promise(function(v){var d=C.audioTrack,o=C.avcTrack;d.samples&&d.isAAC?m.decryptAacSamples(d.samples,0,function(){o.samples?m.decryptAvcSamples(o.samples,0,0,function(){v(C)}):v(C)}):o.samples&&m.decryptAvcSamples(o.samples,0,0,function(){v(C)})})},p.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},p.parseAVCPES=function(C,m){var v=this,d=this._avcTrack,o=this.parseAVCNALu(C.data),T=!1,S=this.avcSample,y,P=!1;C.data=null,S&&o.length&&!d.audFound&&(l(S,d),S=this.avcSample=E(!1,C.pts,C.dts,"")),o.forEach(function(B){switch(B.type){case 1:{y=!0,S||(S=v.avcSample=E(!0,C.pts,C.dts,"")),T&&(S.debug+="NDR "),S.frame=!0;var W=B.data;if(P&&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,C.pts,C.dts,"")),T&&(S.debug+="IDR "),S.key=!0,S.frame=!0;break;case 6:{y=!0,T&&S&&(S.debug+="SEI ");var I=new O.default(L(B.data));I.readUByte();for(var N=0,X=0,ee=!1,oe=0;!ee&&I.bytesAvailable>1;){N=0;do oe=I.readUByte(),N+=oe;while(oe===255);X=0;do oe=I.readUByte(),X+=oe;while(oe===255);if(N===4&&I.bytesAvailable!==0){ee=!0;var ce=I.readUByte();if(ce===181){var De=I.readUShort();if(De===49){var Ee=I.readUInt();if(Ee===1195456820){var Ce=I.readUByte();if(Ce===3){for(var Te=I.readUByte(),me=I.readUByte(),pe=31&Te,ue=[Te,me],te=0;te<pe;te++)ue.push(I.readUByte()),ue.push(I.readUByte()),ue.push(I.readUByte());h(v._txtTrack.samples,{type:3,pts:C.pts,bytes:ue})}}}}}else if(N===5&&I.bytesAvailable!==0){if(ee=!0,X>16){for(var he=[],ae=0;ae<16;ae++)he.push(I.readUByte().toString(16)),(ae===3||ae===5||ae===7||ae===9)&&he.push("-");for(var we=X-16,Le=new Uint8Array(we),xe=0;xe<we;xe++)Le[xe]=I.readUByte();h(v._txtTrack.samples,{pts:C.pts,payloadType:N,uuid:he.join(""),userData:Object(j.utf8ArrayToStr)(Le),userDataBytes:Le})}}else if(X<I.bytesAvailable)for(var _e=0;_e<X;_e++)I.readUByte()}break}case 7:if(y=!0,P=!0,T&&S&&(S.debug+="SPS "),!d.sps){var Ie=new O.default(B.data),We=Ie.readSPS();d.width=We.width,d.height=We.height,d.pixelRatio=We.pixelRatio,d.sps=[B.data],d.duration=v._duration;for(var Fe=B.data.subarray(1,4),Ne="avc1.",Ue=0;Ue<3;Ue++){var et=Fe[Ue].toString(16);et.length<2&&(et="0"+et),Ne+=et}d.codec=Ne}break;case 8:y=!0,T&&S&&(S.debug+="PPS "),d.pps||(d.pps=[B.data]);break;case 9:y=!1,d.audFound=!0,S&&l(S,d),S=v.avcSample=E(!1,C.pts,C.dts,T?"AUD ":"");break;case 12:y=!1;break;default:y=!1,S&&(S.debug+="unknown NAL "+B.type+" ");break}if(S&&y){var ot=S.units;ot.push(B)}}),m&&S&&(l(S,d),this.avcSample=null)},p.getLastNalUnit=function(){var C,m=this.avcSample,v;if(!m||m.units.length===0){var d=this._avcTrack.samples;m=d[d.length-1]}if((C=m)!==null&&C!==void 0&&C.units){var o=m.units;v=o[o.length-1]}return v},p.parseAVCNALu=function(C){var m=C.byteLength,v=this._avcTrack,d=v.naluState||0,o=d,T=[],S=0,y,P,B,W=-1,V=0;for(d===-1&&(W=0,V=C[0]&31,d=0,S=1);S<m;){if(y=C[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:C.subarray(W,S-d-1),type:V};T.push(I)}else{var N=this.getLastNalUnit();if(N&&(o&&S<=4-o&&(N.state&&(N.data=N.data.subarray(0,N.data.byteLength-o))),P=S-d-1,P>0)){var X=new Uint8Array(N.data.byteLength+P);X.set(N.data,0),X.set(C.subarray(0,P),N.data.byteLength),N.data=X,N.state=0}}S<m?(B=C[S]&31,W=S,V=B,d=0):d=-1}else d=0}if(W>=0&&d>=0){var ee={data:C.subarray(W,m),type:V,state:d};T.push(ee)}if(T.length===0){var oe=this.getLastNalUnit();if(oe){var ce=new Uint8Array(oe.data.byteLength+C.byteLength);ce.set(oe.data,0),ce.set(C,oe.data.byteLength),oe.data=ce}}return v.naluState=d,T},p.parseAACPES=function(C){var m=0,v=this._audioTrack,d=this.aacOverFlow,o=C.data;if(d){this.aacOverFlow=null;var T=d.sample.unit.byteLength,S=Math.min(d.missing,T),y=T-S;d.sample.unit.set(o.subarray(0,S),y),v.samples.push(d.sample),m=d.missing}var P,B;for(P=m,B=o.length;P<B-1&&!Q.isHeader(o,P);P++);if(P!==m){var W,V;if(P<B-1?(W="AAC PES did not start with ADTS header,offset:"+P,V=!1):(W="no ADTS header found in AAC PES",V=!0),c.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,P,this.audioCodec);var I;if(C.pts!==void 0)I=C.pts;else if(d){var N=Q.getFrameDuration(v.samplerate);I=d.sample.pts+N}else{c.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var X=0;P<B;)if(Q.isHeader(o,P)){if(P+5<B){var ee=Q.appendFrame(v,o,P,I,X);if(ee)if(ee.missing)this.aacOverFlow=ee;else{P+=ee.length,X++;continue}}break}else P++},p.parseMPEGPES=function(C){var m=C.data,v=m.length,d=0,o=0,T=C.pts;if(T===void 0){c.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;o<v;)if(U.isHeader(m,o)){var S=U.appendFrame(this._audioTrack,m,o,T,d);if(S)o+=S.length,d++;else break}else o++},p.parseID3PES=function(C){if(C.pts===void 0){c.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(C)},f}();w.minProbeByteLength=188;function E(f,p,D,C){return{key:f,frame:!1,pts:p,dts:D,units:[],debug:C,length:0}}function b(f,p){return(f[p+10]&31)<<8|f[p+11]}function u(f,p,D,C){var m={audio:-1,avc:-1,id3:-1,isAAC:!0},v=(f[p+1]&15)<<8|f[p+2],d=p+3+v-4,o=(f[p+10]&15)<<8|f[p+11];for(p+=12+o;p<d;){var T=(f[p+1]&31)<<8|f[p+2];switch(f[p]){case 207:if(!C){c.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:m.audio===-1&&(m.audio=T);break;case 21:m.id3===-1&&(m.id3=T);break;case 219:if(!C){c.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:m.avc===-1&&(m.avc=T);break;case 3:case 4:D?m.audio===-1&&(m.audio=T,m.isAAC=!1):c.logger.log("MPEG audio found, not supported in this browser");break;case 36:c.logger.warn("Unsupported HEVC stream type found");break;default:break}p+=((f[p+3]&15)<<8|f[p+4])+5}return m}function a(f){var p=0,D,C,m,v,d,o=f.data;if(!f||f.size===0)return null;for(;o[0].length<19&&o.length>1;){var T=new Uint8Array(o[0].length+o[1].length);T.set(o[0]),T.set(o[1],o[0].length),o[0]=T,o.splice(1,1)}D=o[0];var S=(D[0]<<16)+(D[1]<<8)+D[2];if(S===1){if(C=(D[4]<<8)+D[5],C&&C>f.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&&(c.logger.warn(Math.round((v-d)/9e4)+"s delta between PTS and DTS, align them"),v=d)):d=v),m=D[8];var P=m+9;if(f.size<=P)return null;f.size-=P;for(var B=new Uint8Array(f.size),W=0,V=o.length;W<V;W++){D=o[W];var I=D.byteLength;if(P)if(P>I){P-=I;continue}else D=D.subarray(P),I-=P,P=0;B.set(D,p),p+=I}return C&&(C-=m+3),{data:B,pts:v,dts:d,len:C}}return null}function l(f,p){if(f.units.length&&f.frame){if(f.pts===void 0){var D=p.samples,C=D.length;if(C){var m=D[C-1];f.pts=m.pts,f.dts=m.dts}else{p.dropped++;return}}p.samples.push(f)}f.debug.length&&c.logger.log(f.pts+"/"+f.dts+":"+f.debug)}function h(f,p){var D=f.length;if(D>0){if(p.pts>=f[D-1].pts)f.push(p);else for(var C=D-1;C>=0;C--)if(p.pts<f[C].pts){f.splice(C,0,p);break}}else f.push(p)}function L(f){for(var p=f.byteLength,D=[],C=1;C<p-2;)f[C]===0&&f[C+1]===0&&f[C+2]===3?(D.push(C+2),C+=2):C++;if(D.length===0)return f;var m=p-D.length,v=new Uint8Array(m),d=0;for(C=0;C<m;d++,C++)d===D[0]&&(d++,D.shift()),v[C]=f[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 f});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"),F=R("./src/controller/id3-track-controller.ts"),_=R("./src/controller/latency-controller.ts"),A=R("./src/controller/level-controller.ts"),c=R("./src/controller/fragment-tracker.ts"),x=R("./src/controller/stream-controller.ts"),M=R("./src/is-supported.ts"),w=R("./src/utils/logger.ts"),E=R("./src/config.ts"),b=R("./node_modules/eventemitter3/index.js"),u=R.n(b),a=R("./src/events.ts"),l=R("./src/errors.ts");function h(p,D){for(var C=0;C<D.length;C++){var m=D[C];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(p,m.key,m)}}function L(p,D,C){return D&&h(p.prototype,D),C&&h(p,C),p}var f=function(){p.isSupported=function(){return Object(M.isSupported)()};function p(C){C===void 0&&(C={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new b.EventEmitter,this._autoLevelCapping=void 0,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null;var m=this.config=Object(E.mergeConfig)(p.DefaultConfig,C);this.userConfig=C,Object(w.enableLogs)(m.debug),this._autoLevelCapping=-1,m.progressive&&Object(E.enableStreamingMode)(m);var v=m.abrController,d=m.bufferController,o=m.capLevelController,T=m.fpsController,S=this.abrController=new v(this),y=this.bufferController=new d(this),P=this.capLevelController=new o(this),B=new T(this),W=new O.default(this),V=new j.default(this),I=new F.default(this),N=this.levelController=new A.default(this),X=new c.FragmentTracker(this),ee=this.streamController=new x.default(this,X);P.setStreamController(ee),B.setStreamController(ee);var oe=[N,ee];this.networkControllers=oe;var ce=[W,V,S,y,P,B,I,X];this.audioTrackController=this.createController(m.audioTrackController,null,oe),this.createController(m.audioStreamController,X,oe),this.subtitleTrackController=this.createController(m.subtitleTrackController,null,oe),this.createController(m.subtitleStreamController,X,oe),this.createController(m.timelineController,null,ce),this.emeController=this.createController(m.emeController,null,ce),this.cmcdController=this.createController(m.cmcdController,null,ce),this.latencyController=this.createController(_.default,null,ce),this.coreComponents=ce}var D=p.prototype;return D.createController=function(m,v,d){if(m){var o=v?new m(this,v):new m(this);return d&&d.push(o),o}return null},D.on=function(m,v,d){d===void 0&&(d=this),this._emitter.on(m,v,d)},D.once=function(m,v,d){d===void 0&&(d=this),this._emitter.once(m,v,d)},D.removeAllListeners=function(m){this._emitter.removeAllListeners(m)},D.off=function(m,v,d,o){d===void 0&&(d=this),this._emitter.off(m,v,d,o)},D.listeners=function(m){return this._emitter.listeners(m)},D.emit=function(m,v,d){return this._emitter.emit(m,v,d)},D.trigger=function(m,v){if(this.config.debug)return this.emit(m,m,v);try{return this.emit(m,m,v)}catch(d){w.logger.error("An internal error happened while handling event "+m+'. Error message: "'+d.message+'". Here is a stacktrace:',d),this.trigger(a.Events.ERROR,{type:l.ErrorTypes.OTHER_ERROR,details:l.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:m,error:d})}return!1},D.listenerCount=function(m){return this._emitter.listenerCount(m)},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(m){return m.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(m){return m.destroy()}),this.coreComponents.length=0},D.attachMedia=function(m){w.logger.log("attachMedia"),this._media=m,this.trigger(a.Events.MEDIA_ATTACHING,{media:m})},D.detachMedia=function(){w.logger.log("detachMedia"),this.trigger(a.Events.MEDIA_DETACHING,void 0),this._media=null},D.loadSource=function(m){this.stopLoad();var v=this.media,d=this.url,o=this.url=Q.buildAbsoluteURL(self.location.href,m,{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:m})},D.startLoad=function(m){m===void 0&&(m=-1),w.logger.log("startLoad("+m+")"),this.networkControllers.forEach(function(v){v.startLoad(m)})},D.stopLoad=function(){w.logger.log("stopLoad"),this.networkControllers.forEach(function(m){m.stopLoad()})},D.swapAudioCodec=function(){w.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},D.recoverMediaError=function(){w.logger.log("recoverMediaError");var m=this._media;this.detachMedia(),m&&this.attachMedia(m)},D.removeLevel=function(m,v){v===void 0&&(v=0),this.levelController.removeLevel(m,v)},L(p,[{key:"levels",get:function(){var m=this.levelController.levels;return m||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(m){w.logger.log("set currentLevel:"+m),this.loadLevel=m,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(m){w.logger.log("set nextLevel:"+m),this.levelController.manualLevel=m,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(m){w.logger.log("set loadLevel:"+m),this.levelController.manualLevel=m}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(m){this.levelController.nextLoadLevel=m}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(m){w.logger.log("set firstLevel:"+m),this.levelController.firstLevel=m}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(m){w.logger.log("set startLevel:"+m),m!==-1&&(m=Math.max(m,this.minAutoLevel)),this.levelController.startLevel=m}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(m){var v=!!m;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(m){this._autoLevelCapping!==m&&(w.logger.log("set autoLevelCapping:"+m),this._autoLevelCapping=m)}},{key:"bandwidthEstimate",get:function(){var m=this.abrController.bwEstimator;return m?m.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var m=this.levels,v=this.config.minAutoBitrate;if(!m)return 0;for(var d=m.length,o=0;o<d;o++)if(m[o].maxBitrate>v)return o;return 0}},{key:"maxAutoLevel",get:function(){var m=this.levels,v=this.autoLevelCapping,d;return v===-1&&m&&m.length?d=m.length-1:d=v,d}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(m){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,m)}},{key:"audioTracks",get:function(){var m=this.audioTrackController;return m?m.audioTracks:[]}},{key:"audioTrack",get:function(){var m=this.audioTrackController;return m?m.audioTrack:-1},set:function(m){var v=this.audioTrackController;v&&(v.audioTrack=m)}},{key:"subtitleTracks",get:function(){var m=this.subtitleTrackController;return m?m.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var m=this.subtitleTrackController;return m?m.subtitleTrack:-1},set:function(m){var v=this.subtitleTrackController;v&&(v.subtitleTrack=m)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var m=this.subtitleTrackController;return m?m.subtitleDisplay:!1},set:function(m){var v=this.subtitleTrackController;v&&(v.subtitleDisplay=m)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(m){this.config.lowLatencyMode=m}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}],[{key:"version",get:function(){return"1.1.2"}},{key:"Events",get:function(){return a.Events}},{key:"ErrorTypes",get:function(){return l.ErrorTypes}},{key:"ErrorDetails",get:function(){return l.ErrorDetails}},{key:"DefaultConfig",get:function(){return p.defaultConfig?p.defaultConfig:E.hlsDefaultConfig},set:function(m){p.defaultConfig=m}}]),p}();f.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 F=Object(Q.getMediaSource)();if(!F)return!1;var _=U(),A=F&&typeof F.isTypeSupported=="function"&&F.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),c=!_||_.prototype&&typeof _.prototype.appendBuffer=="function"&&typeof _.prototype.remove=="function";return!!A&&!!c}function j(){var F,_=U();return typeof(_==null||((F=_.prototype)===null||F===void 0)?void 0:F.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 b});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,c(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,L)}function L(){return F(h,arguments,x(this).constructor)}return L.prototype=Object.create(h.prototype,{constructor:{value:L,enumerable:!1,writable:!0,configurable:!0}}),c(L,h)},j(u)}function F(u,a,l){return _()?F=Reflect.construct:F=function(L,f,p){var D=[null];D.push.apply(D,f);var C=Function.bind.apply(L,D),m=new C;return p&&c(m,p.prototype),m},F.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 c(u,a){return c=Object.setPrototypeOf||function(h,L){return h.__proto__=L,h},c(u,a)}function x(u){return x=Object.setPrototypeOf?Object.getPrototypeOf:function(l){return l.__proto__||Object.getPrototypeOf(l)},x(u)}var M=Math.pow(2,17),w=function(){function u(l){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=l}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,L){var f=this,p=h.url;if(!p)return Promise.reject(new b({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:h,networkDetails:null},"Fragment does not have a "+(p?"part list":"url")));this.abort();var D=this.config,C=D.fLoader,m=D.loader;return new Promise(function(v,d){f.loader&&f.loader.destroy();var o=f.loader=h.loader=C?new C(D):new m(D),T=E(h),S={timeout:D.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:D.fragLoadingMaxRetryTimeout,highWaterMark:M};h.stats=o.stats,o.load(T,S,{onSuccess:function(P,B,W,V){f.resetLoader(h,o),v({frag:h,part:null,payload:P.data,networkDetails:V})},onError:function(P,B,W){f.resetLoader(h,o),d(new b({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:h,response:P,networkDetails:W}))},onAbort:function(P,B,W){f.resetLoader(h,o),d(new b({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:h,networkDetails:W}))},onTimeout:function(P,B,W){f.resetLoader(h,o),d(new b({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:h,networkDetails:W}))},onProgress:function(P,B,W,V){L&&L({frag:h,part:null,payload:W,networkDetails:V})}})})},a.loadPart=function(h,L,f){var p=this;this.abort();var D=this.config,C=D.fLoader,m=D.loader;return new Promise(function(v,d){p.loader&&p.loader.destroy();var o=p.loader=h.loader=C?new C(D):new m(D),T=E(h,L),S={timeout:D.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:D.fragLoadingMaxRetryTimeout,highWaterMark:M};L.stats=o.stats,o.load(T,S,{onSuccess:function(P,B,W,V){p.resetLoader(h,o),p.updateStatsFromPart(h,L);var I={frag:h,part:L,payload:P.data,networkDetails:V};f(I),v(I)},onError:function(P,B,W){p.resetLoader(h,o),d(new b({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:h,part:L,response:P,networkDetails:W}))},onAbort:function(P,B,W){h.stats.aborted=L.stats.aborted,p.resetLoader(h,o),d(new b({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:h,part:L,networkDetails:W}))},onTimeout:function(P,B,W){p.resetLoader(h,o),d(new b({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:h,part:L,networkDetails:W}))}})})},a.updateStatsFromPart=function(h,L){var f=h.stats,p=L.stats,D=p.total;if(f.loaded+=p.loaded,D){var C=Math.round(h.duration/L.duration),m=Math.min(Math.round(f.loaded/D),C),v=C-m,d=v*Math.round(f.loaded/m);f.total=f.loaded+d}else f.total=Math.max(f.loaded,f.total);var o=f.loading,T=p.loading;o.start?o.first+=T.first-T.start:(o.start=T.start,o.first=T.first),o.end=T.end},a.resetLoader=function(h,L){h.loader=null,this.loader===L&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),L.destroy()},u}();function E(u,a){a===void 0&&(a=null);var l=a||u,h={frag:u,part:a,responseType:"arraybuffer",url:l.url,headers:{},rangeStart:0,rangeEnd:0},L=l.byteRangeStartOffset,f=l.byteRangeEndOffset;return Object(Q.isFiniteNumber)(L)&&Object(Q.isFiniteNumber)(f)&&(h.rangeStart=L,h.rangeEnd=f),h}var b=function(u){O(a,u);function a(l){for(var h,L=arguments.length,f=new Array(L>1?L-1:0),p=1;p<L;p++)f[p-1]=arguments[p];return h=u.call.apply(u,[this].concat(f))||this,h.data=void 0,h.data=l,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 b}),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"),F=R("./src/loader/level-key.ts"),_=R("./src/loader/load-stats.ts");function A(a,l){a.prototype=Object.create(l.prototype),a.prototype.constructor=a,c(a,l)}function c(a,l){return c=Object.setPrototypeOf||function(L,f){return L.__proto__=f,L},c(a,l)}function x(a,l){for(var h=0;h<l.length;h++){var L=l[h];L.enumerable=L.enumerable||!1,L.configurable=!0,"value"in L&&(L.writable=!0),Object.defineProperty(a,L.key,L)}}function M(a,l,h){return l&&x(a.prototype,l),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 L;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(L={},L[w.AUDIO]=null,L[w.VIDEO]=null,L[w.AUDIOVIDEO]=null,L),this.baseurl=h}var l=a.prototype;return l.setByteRange=function(L,f){var p=L.split("@",2),D=[];p.length===1?D[0]=f?f.byteRangeEndOffset:0:D[0]=parseInt(p[1]),D[1]=parseInt(p[0])+D[0],this._byteRange=D},M(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(L){this._url=L}}]),a}(),b=function(a){A(l,a);function l(L,f){var p;return p=a.call(this,f)||this,p._decryptdata=null,p.rawProgramDateTime=null,p.programDateTime=null,p.tagList=[],p.duration=0,p.sn=0,p.levelkey=void 0,p.type=void 0,p.loader=null,p.level=-1,p.cc=0,p.startPTS=void 0,p.endPTS=void 0,p.appendedPTS=void 0,p.startDTS=void 0,p.endDTS=void 0,p.start=0,p.deltaPTS=void 0,p.maxStartPTS=void 0,p.minEndPTS=void 0,p.stats=new _.LoadStats,p.urlId=0,p.data=void 0,p.bitrateTest=!1,p.title=null,p.initSegment=null,p.type=L,p}var h=l.prototype;return h.createInitializationVector=function(f){for(var p=new Uint8Array(16),D=12;D<16;D++)p[D]=f>>8*(15-D)&255;return p},h.setDecryptDataFromLevelKey=function(f,p){var D=f;return(f==null?void 0:f.method)==="AES-128"&&f.uri&&!f.iv&&(D=F.LevelKey.fromURI(f.uri),D.method=f.method,D.iv=this.createInitializationVector(p),D.keyFormat="identity"),D},h.setElementaryStreamInfo=function(f,p,D,C,m,v){v===void 0&&(v=!1);var d=this.elementaryStreams,o=d[f];if(!o){d[f]={startPTS:p,endPTS:D,startDTS:C,endDTS:m,partial:v};return}o.startPTS=Math.min(o.startPTS,p),o.endPTS=Math.max(o.endPTS,D),o.startDTS=Math.min(o.startDTS,C),o.endDTS=Math.max(o.endDTS,m)},h.clearElementaryStreamInfo=function(){var f=this.elementaryStreams;f[w.AUDIO]=null,f[w.VIDEO]=null,f[w.AUDIOVIDEO]=null},M(l,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var f=this.sn;typeof f!="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'),f=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,f)}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 f=Object(Q.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+f*1e3}},{key:"encrypted",get:function(){var f;return!!((f=this.decryptdata)!==null&&f!==void 0&&f.keyFormat&&this.decryptdata.uri)}}]),l}(E),u=function(a){A(l,a);function l(h,L,f,p,D){var C;C=a.call(this,f)||this,C.fragOffset=0,C.duration=0,C.gap=!1,C.independent=!1,C.relurl=void 0,C.fragment=void 0,C.index=void 0,C.stats=new _.LoadStats,C.duration=h.decimalFloatingPoint("DURATION"),C.gap=h.bool("GAP"),C.independent=h.bool("INDEPENDENT"),C.relurl=h.enumeratedString("URI"),C.fragment=L,C.index=p;var m=h.enumeratedString("BYTERANGE");return m&&C.setByteRange(m,D),D&&(C.fragOffset=D.fragOffset+D.duration),C}return M(l,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var L=this.elementaryStreams;return!!(L.audio||L.video||L.audiovideo)}}]),l}(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 F(A){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=A,this._registerListeners()}var _=F.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 c in this.loaders){var x=this.loaders[c];x&&x.destroy()}this.loaders={}},_.onKeyLoading=function(c,x){var M=x.frag,w=M.type,E=this.loaders[w];if(!M.decryptdata){O.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var b=M.decryptdata.uri;if(b!==this.decrypturl||this.decryptkey===null){var u=this.hls.config;if(E&&(O.logger.warn("abort previous key loader for type:"+w),E.abort()),!b){O.logger.warn("key uri is falsy");return}var a=u.loader,l=M.loader=this.loaders[w]=new a(u);this.decrypturl=b,this.decryptkey=null;var h={url:b,frag:M,responseType:"arraybuffer"},L={timeout:u.fragLoadingTimeOut,maxRetry:0,retryDelay:u.fragLoadingRetryDelay,maxRetryDelay:u.fragLoadingMaxRetryTimeout,highWaterMark:0},f={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};l.load(h,L,f)}else this.decryptkey&&(M.decryptdata.key=this.decryptkey,this.hls.trigger(Q.Events.KEY_LOADED,{frag:M}))},_.loadsuccess=function(c,x,M){var w=M.frag;if(!w.decryptdata){O.logger.error("after key load, decryptdata unset");return}this.decryptkey=w.decryptdata.key=new Uint8Array(c.data),w.loader=null,delete this.loaders[w.type],this.hls.trigger(Q.Events.KEY_LOADED,{frag:w})},_.loaderror=function(c,x){var M=x.frag,w=M.loader;w&&w.abort(),delete this.loaders[M.type],this.hls.trigger(Q.Events.ERROR,{type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:M,response:c})},_.loadtimeout=function(c,x){var M=x.frag,w=M.loader;w&&w.abort(),delete this.loaders[M.type],this.hls.trigger(Q.Events.ERROR,{type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:M})},F}()},"./src/loader/level-details.ts":function(ne,$,R){"use strict";R.r($),R.d($,"LevelDetails",function(){return F});var Q=R("./src/polyfills/number.ts");function U(_,A){for(var c=0;c<A.length;c++){var x=A[c];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(_,x.key,x)}}function O(_,A,c){return A&&U(_.prototype,A),c&&U(_,c),_}var j=10,F=function(){function _(c){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.needSidxRanges=!1,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.fragments=[],this.url=c}var A=_.prototype;return A.reloaded=function(x){if(!x){this.advanced=!0,this.updated=!0;return}var M=this.lastPartSn-x.lastPartSn,w=this.lastPartIndex-x.lastPartIndex;this.updated=this.endSN!==x.endSN||!!w||!!M,this.advanced=this.endSN>x.endSN||M>0||M===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 M=this.driftEnd-this.driftStart;return M*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 F});var Q=R("./node_modules/url-toolkit/src/url-toolkit.js"),U=R.n(Q);function O(_,A){for(var c=0;c<A.length;c++){var x=A[c];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(_,x.key,x)}}function j(_,A,c){return A&&O(_.prototype,A),c&&O(_,c),_}var F=function(){_.fromURL=function(c,x){return new _(c,x)},_.fromURI=function(c){return new _(c)};function _(A,c){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,c?this._uri=Object(Q.buildAbsoluteURL)(A,c,{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 l});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"),F=R("./src/loader/level-details.ts"),_=R("./src/loader/level-key.ts"),A=R("./src/utils/attr-list.ts"),c=R("./src/utils/logger.ts"),x=R("./src/utils/codecs.ts"),M=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,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"),b=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 C,m;return u.test((C=(m=U.parseURL(D))===null||m===void 0?void 0:m.path)!=null?C:"")}var l=function(){function D(){}return D.findGroup=function(m,v){for(var d=0;d<m.length;d++){var o=m[d];if(o.id===v)return o}},D.convertAVC1ToAVCOTI=function(m){var v=m.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 m},D.resolve=function(m,v){return U.buildAbsoluteURL(v,m,{alwaysNormalize:!0})},D.parseMasterPlaylist=function(m,v){var d=[],o={},T=!1;M.lastIndex=0;for(var S;(S=M.exec(m))!=null;)if(S[1]){var y=new A.AttrList(S[1]),P={attrs:y,bitrate:y.decimalInteger("AVERAGE-BANDWIDTH")||y.decimalInteger("BANDWIDTH"),name:y.NAME,url:D.resolve(S[2],v)},B=y.decimalResolution("RESOLUTION");B&&(P.width=B.width,P.height=B.height),h((y.CODECS||"").split(/[ ,]+/).filter(function(V){return V}),P),P.videoCodec&&P.videoCodec.indexOf("avc1")!==-1&&(P.videoCodec=D.convertAVC1ToAVCOTI(P.videoCodec)),d.push(P)}else if(S[3]){var W=new A.AttrList(S[3]);W["DATA-ID"]&&(T=!0,o[W["DATA-ID"]]=W)}return{levels:d,sessionData:T?o:null}},D.parseMasterPlaylistMedia=function(m,v,d,o){o===void 0&&(o=[]);var T,S=[],y=0;for(w.lastIndex=0;(T=w.exec(m))!==null;){var P=new A.AttrList(T[1]);if(P.TYPE===d){var B={attrs:P,bitrate:0,id:y++,groupId:P["GROUP-ID"],instreamId:P["INSTREAM-ID"],name:P.NAME||P.LANGUAGE||"",type:d,default:P.bool("DEFAULT"),autoselect:P.bool("AUTOSELECT"),forced:P.bool("FORCED"),lang:P.LANGUAGE,url:P.URI?D.resolve(P.URI,v):""};if(o.length){var W=D.findGroup(o,B.groupId)||o[0];L(B,W,"audioCodec"),L(B,W,"textCodec")}S.push(B)}}return S},D.parseLevelPlaylist=function(m,v,d,o,T){var S=new F.LevelDetails(v),y=S.fragments,P=null,B=0,W=0,V=0,I=0,N=null,X=new j.Fragment(o,v),ee,oe,ce,De=-1,Ee=!1;for(E.lastIndex=0,S.m3u8=m;(ee=E.exec(m))!==null;){Ee&&(Ee=!1,X=new j.Fragment(o,v),X.start=V,X.sn=B,X.cc=I,X.level=d,P&&(X.initSegment=P,X.rawProgramDateTime=P.rawProgramDateTime));var Ce=ee[1];if(Ce){X.duration=parseFloat(Ce);var Te=(" "+ee[2]).slice(1);X.title=Te||null,X.tagList.push(Te?["INF",Ce,Te]:["INF",Ce])}else if(ee[3])Object(Q.isFiniteNumber)(X.duration)&&(X.start=V,ce&&(X.levelkey=ce),X.sn=B,X.level=d,X.cc=I,X.urlId=T,y.push(X),X.relurl=(" "+ee[3]).slice(1),p(X,N),N=X,V+=X.duration,B++,W=0,Ee=!0);else if(ee[4]){var me=(" "+ee[4]).slice(1);N?X.setByteRange(me,N):X.setByteRange(me)}else if(ee[5])X.rawProgramDateTime=(" "+ee[5]).slice(1),X.tagList.push(["PROGRAM-DATE-TIME",X.rawProgramDateTime]),De===-1&&(De=y.length);else{if(ee=ee[0].match(b),!ee){c.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":B=S.startSN=parseInt(ue);break;case"SKIP":{var he=new A.AttrList(ue),ae=he.decimalInteger("SKIPPED-SEGMENTS");if(Object(Q.isFiniteNumber)(ae)){S.skippedSegments=ae;for(var we=ae;we--;)y.unshift(null);B+=ae}var Le=he.enumeratedString("RECENTLY-REMOVED-DATERANGES");Le&&(S.recentlyRemovedDateranges=Le.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 xe,_e=new A.AttrList(ue),Ie=_e.enumeratedString("METHOD"),We=_e.URI,Fe=_e.hexadecimalInteger("IV"),Ne=_e.enumeratedString("KEYFORMATVERSIONS"),Ue=_e.enumeratedString("KEYID"),et=(xe=_e.enumeratedString("KEYFORMAT"))!=null?xe:"identity",ot=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(ot.indexOf(et)>-1){c.logger.warn("Keyformat "+et+" is not supported from the manifest");continue}else if(et!=="identity")continue;Ie&&(ce=_.LevelKey.fromURL(v,We),We&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(Ie)>=0&&(ce.method=Ie,ce.keyFormat=et,Ue&&(ce.keyID=Ue),Ne&&(ce.keyFormatVersions=Ne),ce.iv=Fe));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",ce&&(X.levelkey=ce),X.initSegment=null,P=X,Ee=!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 Me=S.partList;Me||(Me=S.partList=[]);var ut=W>0?Me[Me.length-1]:void 0,lt=W++,Be=new j.Part(new A.AttrList(ue),X,v,lt,ut);Me.push(Be),X.duration+=Be.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:c.logger.warn("line parsed but not handled: "+ee);break}}}N&&!N.relurl?(y.pop(),V-=N.duration,S.partList&&(S.fragmentHint=N)):S.partList&&(p(X,N),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)})&&(c.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,De>0&&f(y,De),S},D}();function h(D,C){["video","audio","text"].forEach(function(m){var v=D.filter(function(o){return Object(x.isCodecType)(o,m)});if(v.length){var d=v.filter(function(o){return o.lastIndexOf("avc1",0)===0||o.lastIndexOf("mp4a",0)===0});C[m+"Codec"]=d.length>0?d[0]:v[0],D=D.filter(function(o){return v.indexOf(o)===-1})}}),C.unknownCodecs=D}function L(D,C,m){var v=C[m];v&&(D[m]=v)}function f(D,C){for(var m=D[C],v=C;v--;){var d=D[v];if(!d)return;d.programDateTime=m.programDateTime-d.duration*1e3,m=d}}function p(D,C){D.rawProgramDateTime?D.programDateTime=Date.parse(D.rawProgramDateTime):C!=null&&C.programDateTime&&(D.programDateTime=C.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"),F=R("./src/utils/mp4-tools.ts"),_=R("./src/loader/m3u8-parser.ts"),A=R("./src/types/loader.ts"),c=R("./src/utils/attr-list.ts");function x(E){var b=E.type;switch(b){case A.PlaylistContextType.AUDIO_TRACK:return A.PlaylistLevelType.AUDIO;case A.PlaylistContextType.SUBTITLE_TRACK:return A.PlaylistLevelType.SUBTITLE;default:return A.PlaylistLevelType.MAIN}}function M(E,b){var u=E.url;return(u===void 0||u.indexOf("data:")===0)&&(u=b.url),u}var w=function(){function E(u){this.hls=void 0,this.loaders=Object.create(null),this.hls=u,this.registerListeners()}var b=E.prototype;return b.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)},b.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)},b.createInternalLoader=function(a){var l=this.hls.config,h=l.pLoader,L=l.loader,f=h||L,p=new f(l);return a.loader=p,this.loaders[a.type]=p,p},b.getInternalLoader=function(a){return this.loaders[a.type]},b.resetInternalLoader=function(a){this.loaders[a]&&delete this.loaders[a]},b.destroyInternalLoaders=function(){for(var a in this.loaders){var l=this.loaders[a];l&&l.destroy(),this.resetInternalLoader(a)}},b.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},b.onManifestLoading=function(a,l){var h=l.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:A.PlaylistContextType.MANIFEST,url:h,deliveryDirectives:null})},b.onLevelLoading=function(a,l){var h=l.id,L=l.level,f=l.url,p=l.deliveryDirectives;this.load({id:h,groupId:null,level:L,responseType:"text",type:A.PlaylistContextType.LEVEL,url:f,deliveryDirectives:p})},b.onAudioTrackLoading=function(a,l){var h=l.id,L=l.groupId,f=l.url,p=l.deliveryDirectives;this.load({id:h,groupId:L,level:null,responseType:"text",type:A.PlaylistContextType.AUDIO_TRACK,url:f,deliveryDirectives:p})},b.onSubtitleTrackLoading=function(a,l){var h=l.id,L=l.groupId,f=l.url,p=l.deliveryDirectives;this.load({id:h,groupId:L,level:null,responseType:"text",type:A.PlaylistContextType.SUBTITLE_TRACK,url:f,deliveryDirectives:p})},b.load=function(a){var l,h=this.hls.config,L=this.getInternalLoader(a);if(L){var f=L.context;if(f&&f.url===a.url){j.logger.trace("[playlist-loader]: playlist request ongoing");return}j.logger.log("[playlist-loader]: aborting previous loader for type: "+a.type),L.abort()}var p,D,C,m;switch(a.type){case A.PlaylistContextType.MANIFEST:p=h.manifestLoadingMaxRetry,D=h.manifestLoadingTimeOut,C=h.manifestLoadingRetryDelay,m=h.manifestLoadingMaxRetryTimeout;break;case A.PlaylistContextType.LEVEL:case A.PlaylistContextType.AUDIO_TRACK:case A.PlaylistContextType.SUBTITLE_TRACK:p=0,D=h.levelLoadingTimeOut;break;default:p=h.levelLoadingMaxRetry,D=h.levelLoadingTimeOut,C=h.levelLoadingRetryDelay,m=h.levelLoadingMaxRetryTimeout;break}if(L=this.createInternalLoader(a),(l=a.deliveryDirectives)!==null&&l!==void 0&&l.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 T={timeout:D,maxRetry:p,retryDelay:C,maxRetryDelay:m,highWaterMark:0},S={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};L.load(a,T,S)},b.loadsuccess=function(a,l,h,L){if(L===void 0&&(L=null),h.isSidxRequest){this.handleSidxRequest(a,h),this.handlePlaylistLoaded(a,l,h,L);return}this.resetInternalLoader(h.type);var f=a.data;if(f.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(a,h,"no EXTM3U delimiter",L);return}l.parsing.start=performance.now(),f.indexOf("#EXTINF:")>0||f.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(a,l,h,L):this.handleMasterPlaylist(a,l,h,L)},b.loaderror=function(a,l,h){h===void 0&&(h=null),this.handleNetworkError(l,h,!1,a)},b.loadtimeout=function(a,l,h){h===void 0&&(h=null),this.handleNetworkError(l,h,!0)},b.handleMasterPlaylist=function(a,l,h,L){var f=this.hls,p=a.data,D=M(a,h),C=_.default.parseMasterPlaylist(p,D),m=C.levels,v=C.sessionData;if(!m.length){this.handleManifestParsingError(a,h,"no level found in manifest",L);return}var d=m.map(function(B){return{id:B.attrs.AUDIO,audioCodec:B.audioCodec}}),o=m.map(function(B){return{id:B.attrs.SUBTITLES,textCodec:B.textCodec}}),T=_.default.parseMasterPlaylistMedia(p,D,"AUDIO",d),S=_.default.parseMasterPlaylistMedia(p,D,"SUBTITLES",o),y=_.default.parseMasterPlaylistMedia(p,D,"CLOSED-CAPTIONS");if(T.length){var P=T.some(function(B){return!B.url});!P&&m[0].audioCodec&&!m[0].attrs.AUDIO&&(j.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),T.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new c.AttrList({}),bitrate:0,url:""}))}f.trigger(U.Events.MANIFEST_LOADED,{levels:m,audioTracks:T,subtitles:S,captions:y,url:D,stats:l,networkDetails:L,sessionData:v})},b.handleTrackOrLevelPlaylist=function(a,l,h,L){var f=this.hls,p=h.id,D=h.level,C=h.type,m=M(a,h),v=Object(Q.isFiniteNumber)(p)?p:0,d=Object(Q.isFiniteNumber)(D)?D:v,o=x(h),T=_.default.parseLevelPlaylist(a.data,m,d,o,v);if(!T.fragments.length){f.trigger(U.Events.ERROR,{type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:m,reason:"no fragments found in level",level:typeof h.level=="number"?h.level:void 0});return}if(C===A.PlaylistContextType.MANIFEST){var S={attrs:new c.AttrList({}),bitrate:0,details:T,name:"",url:m};f.trigger(U.Events.MANIFEST_LOADED,{levels:[S],audioTracks:[],url:m,stats:l,networkDetails:L,sessionData:null})}if(l.parsing.end=performance.now(),T.needSidxRanges){var y,P=(y=T.fragments[0].initSegment)===null||y===void 0?void 0:y.url;this.load({url:P,isSidxRequest:!0,type:C,level:D,levelDetails:T,id:p,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}h.levelDetails=T,this.handlePlaylistLoaded(a,l,h,L)},b.handleSidxRequest=function(a,l){var h=Object(F.parseSegmentIndex)(new Uint8Array(a.data));if(!h)return;var L=h.references,f=l.levelDetails;L.forEach(function(p,D){var C=p.info,m=f.fragments[D];m.byteRange.length===0&&m.setByteRange(String(1+C.end-C.start)+"@"+String(C.start)),m.initSegment&&m.initSegment.setByteRange(String(h.moovEndOffset)+"@0")})},b.handleManifestParsingError=function(a,l,h,L){this.hls.trigger(U.Events.ERROR,{type:O.ErrorTypes.NETWORK_ERROR,details:O.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:l.type===A.PlaylistContextType.MANIFEST,url:a.url,reason:h,response:a,context:l,networkDetails:L})},b.handleNetworkError=function(a,l,h,L){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 f=O.ErrorDetails.UNKNOWN,p=!1,D=this.getInternalLoader(a);switch(a.type){case A.PlaylistContextType.MANIFEST:f=h?O.ErrorDetails.MANIFEST_LOAD_TIMEOUT:O.ErrorDetails.MANIFEST_LOAD_ERROR,p=!0;break;case A.PlaylistContextType.LEVEL:f=h?O.ErrorDetails.LEVEL_LOAD_TIMEOUT:O.ErrorDetails.LEVEL_LOAD_ERROR,p=!1;break;case A.PlaylistContextType.AUDIO_TRACK:f=h?O.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:O.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,p=!1;break;case A.PlaylistContextType.SUBTITLE_TRACK:f=h?O.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:O.ErrorDetails.SUBTITLE_LOAD_ERROR,p=!1;break}D&&this.resetInternalLoader(a.type);var C={type:O.ErrorTypes.NETWORK_ERROR,details:f,fatal:p,url:a.url,loader:D,context:a,networkDetails:l};L&&(C.response=L),this.hls.trigger(U.Events.ERROR,C)},b.handlePlaylistLoaded=function(a,l,h,L){var f=h.type,p=h.level,D=h.id,C=h.groupId,m=h.loader,v=h.levelDetails,d=h.deliveryDirectives;if(!(v!=null&&v.targetduration)){this.handleManifestParsingError(a,h,"invalid target duration",L);return}if(!m)return;v.live&&(m.getCacheAge&&(v.ageHeader=m.getCacheAge()||0),(!m.getCacheAge||isNaN(v.ageHeader))&&(v.ageHeader=0));switch(f){case A.PlaylistContextType.MANIFEST:case A.PlaylistContextType.LEVEL:this.hls.trigger(U.Events.LEVEL_LOADED,{details:v,level:p||0,id:D||0,stats:l,networkDetails:L,deliveryDirectives:d});break;case A.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(U.Events.AUDIO_TRACK_LOADED,{details:v,id:D||0,groupId:C||"",stats:l,networkDetails:L,deliveryDirectives:d});break;case A.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(U.Events.SUBTITLE_TRACK_LOADED,{details:v,id:D||0,groupId:C||"",stats:l,networkDetails:L,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,F){switch(j){case"mp4a.40.2":if(F===1)return new Uint8Array([0,200,0,128,35,128]);if(F===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(F===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(F===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(F===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(F===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(F===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(F===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(F===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 F;for(F in O.types)O.types.hasOwnProperty(F)&&(O.types[F]=[F.charCodeAt(0),F.charCodeAt(1),F.charCodeAt(2),F.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 c=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 M=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,M,E,M,w),O.DINF=O.box(O.types.dinf,O.box(O.types.dref,c))},O.box=function(F){for(var _=8,A=arguments.length,c=new Array(A>1?A-1:0),x=1;x<A;x++)c[x-1]=arguments[x];for(var M=c.length,w=M;M--;)_+=c[M].byteLength;var E=new Uint8Array(_);for(E[0]=_>>24&255,E[1]=_>>16&255,E[2]=_>>8&255,E[3]=_&255,E.set(F,4),M=0,_=8;M<w;M++)E.set(c[M],_),_+=c[M].byteLength;return E},O.hdlr=function(F){return O.box(O.types.hdlr,O.HDLR_TYPES[F])},O.mdat=function(F){return O.box(O.types.mdat,F)},O.mdhd=function(F,_){_*=F;var A=Math.floor(_/(Q+1)),c=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,F>>24&255,F>>16&255,F>>8&255,F&255,A>>24,A>>16&255,A>>8&255,A&255,c>>24,c>>16&255,c>>8&255,c&255,85,196,0,0]))},O.mdia=function(F){return O.box(O.types.mdia,O.mdhd(F.timescale,F.duration),O.hdlr(F.type),O.minf(F))},O.mfhd=function(F){return O.box(O.types.mfhd,new Uint8Array([0,0,0,0,F>>24,F>>16&255,F>>8&255,F&255]))},O.minf=function(F){return F.type==="audio"?O.box(O.types.minf,O.box(O.types.smhd,O.SMHD),O.DINF,O.stbl(F)):O.box(O.types.minf,O.box(O.types.vmhd,O.VMHD),O.DINF,O.stbl(F))},O.moof=function(F,_,A){return O.box(O.types.moof,O.mfhd(F),O.traf(A,_))},O.moov=function(F){for(var _=F.length,A=[];_--;)A[_]=O.trak(F[_]);return O.box.apply(null,[O.types.moov,O.mvhd(F[0].timescale,F[0].duration)].concat(A).concat(O.mvex(F)))},O.mvex=function(F){for(var _=F.length,A=[];_--;)A[_]=O.trex(F[_]);return O.box.apply(null,[O.types.mvex].concat(A))},O.mvhd=function(F,_){_*=F;var A=Math.floor(_/(Q+1)),c=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,F>>24&255,F>>16&255,F>>8&255,F&255,A>>24,A>>16&255,A>>8&255,A&255,c>>24,c>>16&255,c>>8&255,c&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return O.box(O.types.mvhd,x)},O.sdtp=function(F){var _=F.samples||[],A=new Uint8Array(4+_.length),c,x;for(c=0;c<_.length;c++)x=_[c].flags,A[c+4]=x.dependsOn<<4|x.isDependedOn<<2|x.hasRedundancy;return O.box(O.types.sdtp,A)},O.stbl=function(F){return O.box(O.types.stbl,O.stsd(F),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(F){var _=[],A=[],c,x,M;for(c=0;c<F.sps.length;c++)x=F.sps[c],M=x.byteLength,_.push(M>>>8&255),_.push(M&255),_=_.concat(Array.prototype.slice.call(x));for(c=0;c<F.pps.length;c++)x=F.pps[c],M=x.byteLength,A.push(M>>>8&255),A.push(M&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|F.sps.length].concat(_).concat([F.pps.length]).concat(A))),E=F.width,b=F.height,u=F.pixelRatio[0],a=F.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,b>>8&255,b&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(F){var _=F.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(F.config).concat([6,1,2]))},O.mp4a=function(F){var _=F.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,F.channelCount,0,16,0,0,0,0,_>>8&255,_&255,0,0]),O.box(O.types.esds,O.esds(F)))},O.mp3=function(F){var _=F.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,F.channelCount,0,16,0,0,0,0,_>>8&255,_&255,0,0]))},O.stsd=function(F){return F.type==="audio"?!F.isAAC&&F.codec==="mp3"?O.box(O.types.stsd,O.STSD,O.mp3(F)):O.box(O.types.stsd,O.STSD,O.mp4a(F)):O.box(O.types.stsd,O.STSD,O.avc1(F))},O.tkhd=function(F){var _=F.id,A=F.duration*F.timescale,c=F.width,x=F.height,M=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,M>>24,M>>16&255,M>>8&255,M&255,w>>24,w>>16&255,w>>8&255,w&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,c>>8&255,c&255,0,0,x>>8&255,x&255,0,0]))},O.traf=function(F,_){var A=O.sdtp(F),c=F.id,x=Math.floor(_/(Q+1)),M=Math.floor(_%(Q+1));return O.box(O.types.traf,O.box(O.types.tfhd,new Uint8Array([0,0,0,0,c>>24,c>>16&255,c>>8&255,c&255])),O.box(O.types.tfdt,new Uint8Array([1,0,0,0,x>>24,x>>16&255,x>>8&255,x&255,M>>24,M>>16&255,M>>8&255,M&255])),O.trun(F,A.length+16+20+8+16+8+8),A)},O.trak=function(F){return F.duration=F.duration||4294967295,O.box(O.types.trak,O.tkhd(F),O.mdia(F))},O.trex=function(F){var _=F.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(F,_){var A=F.samples||[],c=A.length,x=12+16*c,M=new Uint8Array(x),w,E,b,u,a,l;for(_+=8+x,M.set([0,0,15,1,c>>>24&255,c>>>16&255,c>>>8&255,c&255,_>>>24&255,_>>>16&255,_>>>8&255,_&255],0),w=0;w<c;w++)E=A[w],b=E.duration,u=E.size,a=E.flags,l=E.cts,M.set([b>>>24&255,b>>>16&255,b>>>8&255,b&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,l>>>24&255,l>>>16&255,l>>>8&255,l&255],12+16*w);return O.box(O.types.trun,M)},O.initSegment=function(F){O.types||O.init();var _=O.moov(F),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 l}),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"),F=R("./src/errors.ts"),_=R("./src/utils/logger.ts"),A=R("./src/types/loader.ts"),c=R("./src/utils/timescale-conversion.ts");function x(){return x=Object.assign||function(D){for(var C=1;C<arguments.length;C++){var m=arguments[C];for(var v in m)Object.prototype.hasOwnProperty.call(m,v)&&(D[v]=m[v])}return D},x.apply(this,arguments)}var M=10*1e3,w=1024,E=1152,b=null,u=null,a=!1,l=function(){function D(m,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=m,this.config=v,this.typeSupported=d,this.ISGenerated=!1,b===null){var T=navigator.userAgent||"",S=T.match(/Chrome\/(\d+)/i);b=S?parseInt(S[1]):0}if(u===null){var y=navigator.userAgent.match(/Safari\/(\d+)/i);u=y?parseInt(y[1]):0}a=!!b&&b<75||!!u&&u<600}var C=D.prototype;return C.destroy=function(){},C.resetTimeStamp=function(v){_.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=v},C.resetNextTimestamp=function(){_.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},C.resetInitSegment=function(){_.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},C.getVideoStartPts=function(v){var d=!1,o=v.reduce(function(T,S){var y=S.pts-T;return y<-4294967296?(d=!0,h(T,S.pts)):y>0?T:S.pts},v[0].pts);return d&&_.logger.debug("PTS rollover detected"),o},C.remux=function(v,d,o,T,S,y,P,B){var W,V,I,N,X,ee,oe=S,ce=S,De=v.pid>-1,Ee=d.pid>-1,Ce=d.samples.length,Te=v.samples.length>0,me=Ce>1,pe=(!De||Te)&&(!Ee||me)||this.ISGenerated||P;if(pe){this.ISGenerated||(I=this.generateIS(v,d,S));var ue=this.isVideoContiguous,te=-1;if(me&&(te=L(d.samples),!ue&&this.config.forceKeyFrameOnDiscontinuity))if(ee=!0,te>0){_.logger.warn("[mp4-remuxer]: Dropped "+te+" out of "+Ce+" video samples due to a missing keyframe");var he=this.getVideoStartPts(d.samples);d.samples=d.samples.slice(te),d.dropped+=te,ce+=(d.samples[0].pts-he)/(d.timescale||9e4)}else te===-1&&(_.logger.warn("[mp4-remuxer]: No keyframe found out of "+Ce+" video samples"),ee=!1);if(this.ISGenerated){if(Te&&me){var ae=this.getVideoStartPts(d.samples),we=h(v.samples[0].pts,ae)-ae,Le=we/d.inputTimeScale;oe+=Math.max(0,Le),ce+=Math.max(0,-Le)}if(Te){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,Ee||me||B===A.PlaylistLevelType.AUDIO?ce:void 0),me){var xe=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,ce,ue,xe)}}else me&&(W=this.remuxVideo(d,ce,ue,0));W&&(W.firstKeyFrame=te,W.independent=te!==-1)}}return this.ISGenerated&&(o.samples.length&&(X=this.remuxID3(o,S)),T.samples.length&&(N=this.remuxText(T,S))),{audio:V,video:W,initSegment:I,independent:ee,text:N,id3:X}},C.generateIS=function(v,d,o){var T=v.samples,S=d.samples,y=this.typeSupported,P={},B=!Object(Q.isFiniteNumber)(this._initPTS),W="audio/mp4",V,I,N;if(B&&(V=I=Infinity),v.config&&T.length&&(v.timescale=v.samplerate,v.isAAC||(y.mpeg?(W="audio/mpeg",v.codec=""):y.mp3&&(v.codec="mp3")),P.audio={id:"audio",container:W,codec:v.codec,initSegment:!v.isAAC&&y.mpeg?new Uint8Array(0):O.default.initSegment([v]),metadata:{channelCount:v.channelCount}},B&&(N=v.inputTimeScale,V=I=T[0].pts-Math.round(N*o))),d.sps&&d.pps&&S.length&&(d.timescale=d.inputTimeScale,P.video={id:"main",container:"video/mp4",codec:d.codec,initSegment:O.default.initSegment([d]),metadata:{width:d.width,height:d.height}},B)){N=d.inputTimeScale;var X=this.getVideoStartPts(S),ee=Math.round(N*o);I=Math.min(I,h(S[0].dts,X)-ee),V=Math.min(V,X-ee)}if(Object.keys(P).length)return this.ISGenerated=!0,B&&(this._initPTS=V,this._initDTS=I),{tracks:P,initPTS:V,timescale:N}},C.remuxVideo=function(v,d,o,T){var S=v.inputTimeScale,y=v.samples,P=[],B=y.length,W=this._initPTS,V=this.nextAvcDts,I=8,N,X,ee,oe=Number.POSITIVE_INFINITY,ce=Number.NEGATIVE_INFINITY,De=0,Ee=!1;if(!o||V===null){var Ce=d*S,Te=y[0].pts-h(y[0].dts,y[0].pts);V=Ce-Te}for(var me=0;me<B;me++){var pe=y[me];if(pe.pts=h(pe.pts-W,V),pe.dts=h(pe.dts-W,V),pe.dts>pe.pts){var ue=9e4*.2;De=Math.max(Math.min(De,pe.pts-pe.dts),-1*ue)}pe.dts<y[me>0?me-1:me].dts&&(Ee=!0)}Ee&&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)/(B-1));if(De<0){if(De<te*-2){_.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(c.toMsFromMpegTsClock)(-te,!0)+" ms");for(var he=De,ae=0;ae<B;ae++)y[ae].dts=he=Math.max(he,y[ae].pts-te),y[ae].pts=Math.max(he,y[ae].pts)}else{_.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(c.toMsFromMpegTsClock)(De,!0)+" ms to overcome this issue");for(var we=0;we<B;we++)y[we].dts=y[we].dts+De}X=y[0].dts}if(o){var Le=X-V,xe=Le>te,_e=Le<-1;if(xe||_e){xe?_.logger.warn("AVC: "+Object(c.toMsFromMpegTsClock)(Le,!0)+" ms ("+Le+"dts) hole between fragments detected, filling it"):_.logger.warn("AVC: "+Object(c.toMsFromMpegTsClock)(-Le,!0)+" ms ("+Le+"dts) overlapping between fragments detected"),X=V;var Ie=y[0].pts-Le;y[0].dts=X,y[0].pts=Ie,_.logger.log("Video: First PTS/DTS adjusted: "+Object(c.toMsFromMpegTsClock)(Ie,!0)+"/"+Object(c.toMsFromMpegTsClock)(X,!0)+", delta: "+Object(c.toMsFromMpegTsClock)(Le,!0)+" ms")}}a&&(X=Math.max(0,X));for(var We=0,Fe=0,Ne=0;Ne<B;Ne++){for(var Ue=y[Ne],et=Ue.units,ot=et.length,nt=0,qe=0;qe<ot;qe++)nt+=et[qe].data.length;Fe+=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),ce=Math.max(Ue.pts,ce)}ee=y[B-1].dts;var st=Fe+4*We+8,$e;try{$e=new Uint8Array(st)}catch(Et){this.observer.emit(j.Events.ERROR,j.Events.ERROR,{type:F.ErrorTypes.MUX_ERROR,details:F.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 Me=0;Me<B;Me++){for(var ut=y[Me],lt=ut.units,Be=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,Be+=4+re}if(Me<B-1)N=y[Me+1].dts-ut.dts;else{var ie=this.config,le=ut.dts-y[Me>0?Me-1:Me].dts;if(ie.stretchShortVideoTrack&&this.nextAudioPts!==null){var de=Math.floor(ie.maxBufferHole*S),ke=(T?oe+T*S:this.nextAudioPts)-ut.pts;ke>de?(N=ke-le,N<0&&(N=le),_.logger.log("[mp4-remuxer]: It is approximately "+ke/90+" ms to the next segment; using duration "+N/90+" ms for the last video frame.")):N=le}else N=le}var Pe=Math.round(ut.pts-ut.dts);P.push(new f(ut.key,N,Be,Pe))}if(P.length&&b&&b<70){var Xe=P[0].flags;Xe.dependsOn=2,Xe.isNonSync=0}console.assert(N!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=V=ee+N,this.isVideoContiguous=!0;var vt=O.default.moof(v.sequenceNumber++,X,x({},v,{samples:P})),Dt="video",Ge={data1:vt,data2:$e,startPTS:oe/S,endPTS:(ce+N)/S,startDTS:X/S,endDTS:V/S,type:Dt,hasAudio:!1,hasVideo:!0,nb:P.length,dropped:v.dropped};return v.samples=[],v.dropped=0,console.assert($e.length,"MDAT length must not be zero"),Ge},C.remuxAudio=function(v,d,o,T,S){var y=v.inputTimeScale,P=v.samplerate?v.samplerate:y,B=y/P,W=v.isAAC?w:E,V=W*B,I=this._initPTS,N=!v.isAAC&&this.typeSupported.mpeg,X=[],ee=v.samples,oe=N?0:8,ce=this.nextAudioPts||-1,De=d*y;if(this.isAudioContiguous=o=o||ee.length&&ce>0&&(T&&Math.abs(De-ce)<9e3||Math.abs(h(ee[0].pts-I,De)-ce)<20*V),ee.forEach(function(be){be.pts=h(be.pts-I,De)}),!o||ce<0){if(ee=ee.filter(function(be){return be.pts>=0}),!ee.length)return;S===0?ce=0:T?ce=Math.max(0,De):ce=ee[0].pts}if(v.isAAC)for(var Ee=S!==void 0,Ce=this.config.maxAudioFramesDrift,Te=0,me=ce;Te<ee.length;Te++){var pe=ee[Te],ue=pe.pts,te=ue-me,he=Math.abs(1e3*te/y);if(te<=-Ce*V&&Ee)Te===0&&(_.logger.warn("Audio frame @ "+(ue/y).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*te/y)+" ms."),this.nextAudioPts=ce=me=ue);else if(te>=Ce*V&&he<M&&Ee){var ae=Math.round(te/V);me=ue-ae*V,me<0&&(ae--,me+=V),Te===0&&(this.nextAudioPts=ce=me),_.logger.warn("[mp4-remuxer]: Injecting "+ae+" audio frame @ "+(me/y).toFixed(3)+"s due to "+Math.round(1e3*te/y)+" ms gap.");for(var we=0;we<ae;we++){var Le=Math.max(me,0),xe=U.default.getSilentFrame(v.manifestCodec||v.codec,v.channelCount);xe||(_.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),xe=pe.unit.subarray()),ee.splice(Te,0,{unit:xe,pts:Le}),me+=V,Te++}}pe.pts=me,me+=V}for(var _e=null,Ie=null,We,Fe=0,Ne=ee.length;Ne--;)Fe+=ee[Ne].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)/B)}else if(o&&v.isAAC&&(qe=ce),_e=qe,Fe>0){Fe+=oe;try{We=new Uint8Array(Fe)}catch(be){this.observer.emit(j.Events.ERROR,j.Events.ERROR,{type:F.ErrorTypes.MUX_ERROR,details:F.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Fe,reason:"fail allocating audio mdat "+Fe});return}if(!N){var $e=new DataView(We.buffer);$e.setUint32(0,Fe),We.set(O.default.types.mdat,4)}}else return;We.set(nt,oe);var Qe=nt.byteLength;oe+=Qe,X.push(new f(!0,W,Qe,0)),Ie=qe}var Me=X.length;if(!Me)return;var ut=X[X.length-1];this.nextAudioPts=ce=Ie+B*ut.duration;var lt=N?new Uint8Array(0):O.default.moof(v.sequenceNumber++,_e/B,x({},v,{samples:X}));v.samples=[];var Be=_e/y,Ke=ce/y,Se="audio",ve={data1:lt,data2:We,startPTS:Be,endPTS:Ke,startDTS:Be,endDTS:Ke,type:Se,hasAudio:!0,hasVideo:!1,nb:Me};return this.isAudioContiguous=!0,console.assert(We.length,"MDAT length must not be zero"),ve},C.remuxEmptyAudio=function(v,d,o,T){var S=v.inputTimeScale,y=v.samplerate?v.samplerate:S,P=S/y,B=this.nextAudioPts,W=(B!==null?B:T.startDTS*S)+this._initDTS,V=T.endDTS*S+this._initDTS,I=P*w,N=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<N;oe++){var ce=W+oe*I;ee.push({unit:X,pts:ce,dts:ce})}return v.samples=ee,this.remuxAudio(v,d,o,!1)},C.remuxID3=function(v,d){var o=v.samples.length;if(!o)return;for(var T=v.inputTimeScale,S=this._initPTS,y=this._initDTS,P=0;P<o;P++){var B=v.samples[P];B.pts=h(B.pts-S,d*T)/T,B.dts=h(B.dts-y,d*T)/T}var W=v.samples;return v.samples=[],{samples:W}},C.remuxText=function(v,d){var o=v.samples.length;if(!o)return;for(var T=v.inputTimeScale,S=this._initPTS,y=0;y<o;y++){var P=v.samples[y];P.pts=h(P.pts-S,d*T)/T}v.samples.sort(function(W,V){return W.pts-V.pts});var B=v.samples;return v.samples=[],{samples:B}},D}();function h(D,C){var m;if(C===null)return D;for(C<D?m=-8589934592:m=8589934592;Math.abs(D-C)>4294967296;)D+=m;return D}function L(D){for(var C=0;C<D.length;C++)if(D[C].key)return C;return-1}var f=function(C,m,v,d){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=m,this.size=v,this.cts=d,this.flags=new p(C)},p=function(C){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=C?2:1,this.isNonSync=C?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"),F=function(){function c(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=void 0,this.initTracks=void 0,this.lastEndDTS=null}var x=c.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,b){this.audioCodec=E,this.videoCodec=b,this.generateInitSegment(w),this.emitInitSegment=!0},x.generateInitSegment=function(w){var E=this.audioCodec,b=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)),b||(b=A(u.video,O.ElementaryStreamTypes.VIDEO));var a={};u.audio&&u.video?a.audiovideo={container:"video/mp4",codec:E+","+b,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:b,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,b,u,a){var l=this.initPTS,h=this.lastEndDTS,L={audio:void 0,video:void 0,text:u,id3:b,initSegment:void 0};Object(Q.isFiniteNumber)(h)||(h=this.lastEndDTS=a||0);var f=E.samples;if(!f||!f.length)return L;var p={initPTS:void 0,timescale:1},D=this.initData;if((!D||!D.length)&&(this.generateInitSegment(f),D=this.initData),!D||!D.length)return j.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),L;this.emitInitSegment&&(p.tracks=this.initTracks,this.emitInitSegment=!1),Object(Q.isFiniteNumber)(l)||(this.initPTS=p.initPTS=l=_(D,f,h));var C=Object(U.getDuration)(f,D),m=h,v=C+m;Object(U.offsetStartDTS)(D,f,l),C>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,T="";d&&(T+="audio"),o&&(T+="video");var S={data1:f,startPTS:m,startDTS:m,endPTS:v,endDTS:v,type:T,hasAudio:d,hasVideo:o,nb:1,dropped:0};return L.audio=S.type==="audio"?S:void 0,L.video=S.type!=="audio"?S:void 0,L.text=u,L.id3=b,L.initSegment=p,L},c}(),_=function(x,M,w){return Object(U.getStartDTS)(x,M)-w};function A(c,x){var M=c==null?void 0:c.codec;return M&&M.length>4?M:M==="hvc1"?"hvc1.1.c.L120.90":M==="av01"?"av01.0.04M.08":M==="avc1"||x===O.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}$.default=F},"./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(F){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,F),!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(F){F.MANIFEST="m",F.AUDIO="a",F.VIDEO="v",F.MUXED="av",F.INIT="i",F.CAPTION="c",F.TIMED_TEXT="tt",F.KEY="k",F.OTHER="o"})(U||(U={}));var O;(function(F){F.DASH="d",F.HLS="h",F.SMOOTH="s",F.OTHER="o"})(O||(O={}));var j;(function(F){F.VOD="v",F.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 F}),R.d($,"Level",function(){return _});function Q(A,c){for(var x=0;x<c.length;x++){var M=c[x];M.enumerable=M.enumerable||!1,M.configurable=!0,"value"in M&&(M.writable=!0),Object.defineProperty(A,M.key,M)}}function U(A,c,x){return c&&Q(A.prototype,c),x&&Q(A,x),A}var O;(function(A){A.No="",A.Yes="YES",A.v2="v2"})(O||(O={}));function j(A,c){var x=A.canSkipUntil,M=A.canSkipDateRanges,w=A.endSN,E=c!==void 0?c-w:0;return x&&E<x?M?O.v2:O.Yes:O.No}var F=function(){function A(x,M,w){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=x,this.part=M,this.skip=w}var c=A.prototype;return c.addDirectives=function(M){var w=new self.URL(M);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(c){this.attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.unknownCodecs=void 0,this.audioGroupIds=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.textGroupIds=void 0,this.url=void 0,this._urlId=0,this.url=[c.url],this.attrs=c.attrs,this.bitrate=c.bitrate,c.details&&(this.details=c.details),this.id=c.id||0,this.name=c.name,this.width=c.width||0,this.height=c.height||0,this.audioCodec=c.audioCodec,this.videoCodec=c.videoCodec,this.unknownCodecs=c.unknownCodecs,this.codecSet=[c.videoCodec,c.audioCodec].filter(function(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 M=x%this.url.length;this._urlId!==M&&(this.details=void 0,this._urlId=M)}}]),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,F,_,A,c,x){A===void 0&&(A=0),c===void 0&&(c=-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=F,this.id=_,this.size=A,this.part=c,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 F=j.prototype;return F.decimalInteger=function(A){var c=parseInt(this[A],10);return c>Number.MAX_SAFE_INTEGER?Infinity:c},F.hexadecimalInteger=function(A){if(this[A]){var c=(this[A]||"0x").slice(2);c=(c.length&1?"0":"")+c;for(var x=new Uint8Array(c.length/2),M=0;M<c.length/2;M++)x[M]=parseInt(c.slice(M*2,M*2+2),16);return x}else return null},F.hexadecimalIntegerAsNumber=function(A){var c=parseInt(this[A],16);return c>Number.MAX_SAFE_INTEGER?Infinity:c},F.decimalFloatingPoint=function(A){return parseFloat(this[A])},F.optionalFloat=function(A,c){var x=this[A];return x?parseFloat(x):c},F.enumeratedString=function(A){return this[A]},F.bool=function(A){return this[A]==="YES"},F.decimalResolution=function(A){var c=Q.exec(this[A]);return c===null?void 0:{width:parseInt(c[1],10),height:parseInt(c[2],10)}},j.parseAttrList=function(A){var c,x={},M='"';for(U.lastIndex=0;(c=U.exec(A))!==null;){var w=c[2];w.indexOf(M)===0&&w.lastIndexOf(M)===w.length-1&&(w=w.slice(1,-1)),x[c[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 F=0,_=O.length-1,A=null,c=null;F<=_;){A=(F+_)/2|0,c=O[A];var x=j(c);if(x>0)F=A+1;else if(x<0)_=A-1;else return c}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 c=j.getBuffered(_),x=0;x<c.length;x++)if(A>=c.start(x)&&A<=c.end(x))return!0}}catch(M){}return!1},j.bufferInfo=function(_,A,c){try{if(_){var x=j.getBuffered(_),M=[],w;for(w=0;w<x.length;w++)M.push({start:x.start(w),end:x.end(w)});return this.bufferedInfo(M,A,c)}}catch(E){}return{len:0,start:A,end:A,nextStart:void 0}},j.bufferedInfo=function(_,A,c){A=Math.max(0,A),_.sort(function(p,D){var C=p.start-D.start;return C||D.end-p.end});var x=[];if(c)for(var M=0;M<_.length;M++){var w=x.length;if(w){var E=x[w-1].end;_[M].start-E<c?_[M].end>E&&(x[w-1].end=_[M].end):x.push(_[M])}else x.push(_[M])}else x=_;for(var b=0,u,a=A,l=A,h=0;h<x.length;h++){var L=x[h].start,f=x[h].end;if(A+c>=L&&A<f)a=L,l=f,b=l-A;else if(A+c<L){u=L;break}}return{len:b,start:a||0,end:l||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 l}),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,F=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},c={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},M=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],w;(function(m){m[m.ERROR=0]="ERROR",m[m.TEXT=1]="TEXT",m[m.WARNING=2]="WARNING",m[m.INFO=2]="INFO",m[m.DEBUG=3]="DEBUG",m[m.DATA=3]="DATA"})(w||(w={}));var E=function(){function m(){this.time=null,this.verboseLevel=w.ERROR}var v=m.prototype;return v.log=function(o,T){this.verboseLevel>=o&&Q.logger.log(this.time+" ["+o+"] "+T)},m}(),b=function(v){for(var d=[],o=0;o<v.length;o++)d.push(v[o].toString(16));return d},u=function(){function m(d,o,T,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=T||!1,this.background=S||"black",this.flash=y||!1}var v=m.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 T=["foreground","underline","italics","background","flash"],S=0;S<T.length;S++){var y=T[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},m}(),a=function(){function m(d,o,T,S,y,P){this.uchar=void 0,this.penState=void 0,this.uchar=d||" ",this.penState=new u(o,T,S,y,P)}var v=m.prototype;return v.reset=function(){this.uchar=" ",this.penState.reset()},v.setChar=function(o,T){this.uchar=o,this.penState.copy(T)},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()},m}(),l=function(){function m(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<F;o++)this.chars.push(new a);this.logger=d,this.pos=0,this.currPenState=new u}var v=m.prototype;return v.equals=function(o){for(var T=!0,S=0;S<F;S++)if(!this.chars[S].equals(o.chars[S])){T=!1;break}return T},v.copy=function(o){for(var T=0;T<F;T++)this.chars[T].copy(o.chars[T])},v.isEmpty=function(){for(var o=!0,T=0;T<F;T++)if(!this.chars[T].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>F&&(this.logger.log(w.DEBUG,"Too large cursor position "+this.pos),this.pos=F)},v.moveCursor=function(o){var T=this.pos+o;if(o>1)for(var S=this.pos+1;S<T+1;S++)this.chars[S].setPenState(this.currPenState);this.setCursor(T)},v.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},v.insertChar=function(o){o>=144&&this.backSpace();var T=O(o);if(this.pos>=F){this.logger.log(w.ERROR,"Cannot insert "+o.toString(16)+" ("+T+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(T,this.currPenState),this.moveCursor(1)},v.clearFromPos=function(o){var T;for(T=o;T<F;T++)this.chars[T].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=[],T=!0,S=0;S<F;S++){var y=this.chars[S].uchar;y!==" "&&(T=!1),o.push(y)}return T?"":o.join("")},v.setPenStyles=function(o){this.currPenState.setStyles(o);var T=this.chars[this.pos];T.setPenState(this.currPenState)},m}(),h=function(){function m(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 l(d));this.logger=d,this.currRow=j-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var v=m.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 T=!0,S=0;S<j;S++)if(!this.rows[S].equals(o.rows[S])){T=!1;break}return T},v.copy=function(o){for(var T=0;T<j;T++)this.rows[T].copy(o.rows[T])},v.isEmpty=function(){for(var o=!0,T=0;T<j;T++)if(!this.rows[T].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 T=this.rows[this.currRow];T.insertChar(o)},v.setPen=function(o){var T=this.rows[this.currRow];T.setPenStyles(o)},v.moveCursor=function(o){var T=this.rows[this.currRow];T.moveCursor(o)},v.setCursor=function(o){this.logger.log(w.INFO,"setCursor: "+o);var T=this.rows[this.currRow];T.setCursor(o)},v.setPAC=function(o){this.logger.log(w.INFO,"pacData = "+JSON.stringify(o));var T=o.row-1;if(this.nrRollUpRows&&T<this.nrRollUpRows-1&&(T=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==T){for(var S=0;S<j;S++)this.rows[S].clear();var y=this.currRow+1-this.nrRollUpRows,P=this.lastOutputScreen;if(P){var B=P.rows[y].cueStartTime,W=this.logger.time;if(B&&W!==null&&B<W)for(var V=0;V<this.nrRollUpRows;V++)this.rows[T-this.nrRollUpRows+V+1].copy(P.rows[y+V])}}this.currRow=T;var I=this.rows[this.currRow];if(o.indent!==null){var N=o.indent,X=Math.max(N-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,T=this.rows.splice(o,1)[0];T.clear(),this.rows.splice(this.currRow,0,T),this.logger.log(w.INFO,"Rolling up")},v.getDisplayText=function(o){o=o||!1;for(var T=[],S="",y=-1,P=0;P<j;P++){var B=this.rows[P].getTextString();B&&(y=P+1,o?T.push("Row "+y+": '"+B+"'"):T.push(B.trim()))}return T.length>0&&(o?S="["+T.join(" | ")+"]":S=T.join(`
|
|
`)),S},v.getTextAndFormat=function(){return this.rows},m}(),L=function(){function m(d,o,T){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=d,this.outputFilter=o,this.mode=null,this.verbose=0,this.displayedMemory=new h(T),this.nonDisplayedMemory=new h(T),this.lastOutputScreen=new h(T),this.currRollUpRow=this.displayedMemory.rows[j-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=T}var v=m.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 T=0;T<o.length;T++)this.writeScreen.insertChar(o[T]);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 T={flash:!1};if(T.underline=o%2===1,T.italics=o>=46,T.italics)T.foreground="white";else{var S=Math.floor(o/2)-16,y=["white","green","blue","cyan","red","yellow","magenta"];T.foreground=y[S]}this.logger.log(w.INFO,"MIDROW: "+JSON.stringify(T)),this.writeScreen.setPen(T)},v.outputDataUpdate=function(o){o===void 0&&(o=!1);var T=this.logger.time;if(T===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=T:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,T,this.lastOutputScreen),o&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:T),this.lastOutputScreen.copy(this.displayedMemory))},v.cueSplitAtTime=function(o){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,o,this.displayedMemory),this.cueStartTime=o))},m}(),f=function(){function m(d,o,T){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var S=new E;this.channels=[null,new L(d,o,S),new L(d+1,T,S)],this.cmdHistory=C(),this.logger=S}var v=m.prototype;return v.getHandler=function(o){return this.channels[o].getHandler()},v.setHandler=function(o,T){this.channels[o].setHandler(T)},v.addData=function(o,T){var S,y,P,B=!1;this.logger.time=o;for(var W=0;W<T.length;W+=2){if(y=T[W]&127,P=T[W+1]&127,y===0&&P===0)continue;if(this.logger.log(w.DATA,"["+b([T[W],T[W+1]])+"] -> ("+b([y,P])+")"),S=this.parseCmd(y,P),S||(S=this.parseMidrow(y,P)),S||(S=this.parsePAC(y,P)),S||(S=this.parseBackgroundAttributes(y,P)),!S&&(B=this.parseChars(y,P),B)){var V=this.currentChannel;if(V&&V>0){var I=this.channels[V];I.insertChars(B)}else this.logger.log(w.WARNING,"No channel found yet. TEXT-MODE?")}!S&&!B&&this.logger.log(w.WARNING,"Couldn't parse cleaned data "+b([y,P])+" orig: "+b([T[W],T[W+1]]))}},v.parseCmd=function(o,T){var S=this.cmdHistory,y=(o===20||o===28||o===21||o===29)&&T>=32&&T<=47,P=(o===23||o===31)&&T>=33&&T<=35;if(!(y||P))return!1;if(D(o,T,S))return p(null,null,S),this.logger.log(w.DEBUG,"Repeated command ("+b([o,T])+") is dropped"),!0;var B=o===20||o===21||o===23?1:2,W=this.channels[B];return o===20||o===21||o===28||o===29?T===32?W.ccRCL():T===33?W.ccBS():T===34?W.ccAOF():T===35?W.ccAON():T===36?W.ccDER():T===37?W.ccRU(2):T===38?W.ccRU(3):T===39?W.ccRU(4):T===40?W.ccFON():T===41?W.ccRDC():T===42?W.ccTR():T===43?W.ccRTD():T===44?W.ccEDM():T===45?W.ccCR():T===46?W.ccENM():T===47&&W.ccEOC():W.ccTO(T-32),p(o,T,S),this.currentChannel=B,!0},v.parseMidrow=function(o,T){var S=0;if((o===17||o===25)&&T>=32&&T<=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(T),this.logger.log(w.DEBUG,"MIDROW ("+b([o,T])+")"),!0):!1}return!1},v.parsePAC=function(o,T){var S,y=this.cmdHistory,P=(o>=17&&o<=23||o>=25&&o<=31)&&T>=64&&T<=127,B=(o===16||o===24)&&T>=64&&T<=95;if(!(P||B))return!1;if(D(o,T,y))return p(null,null,y),!0;var W=o<=23?1:2;T>=64&&T<=95?S=W===1?_[o]:c[o]:S=W===1?A[o]:x[o];var V=this.channels[W];return V?(V.setPAC(this.interpretPAC(S,T)),p(o,T,y),this.currentChannel=W,!0):!1},v.interpretPAC=function(o,T){var S,y={color:null,italics:!1,indent:null,underline:!1,row:o};return T>95?S=T-96:S=T-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,T){var S,y=null,P=null;if(o>=25?(S=2,P=o-8):(S=1,P=o),P>=17&&P<=19){var B;P===17?B=T+80:P===18?B=T+112:B=T+144,this.logger.log(w.INFO,"Special char '"+O(B)+"' in channel "+S),y=[B]}else o>=32&&o<=127&&(y=T===0?[o]:[o,T]);if(y){var W=b(y);this.logger.log(w.DEBUG,"Char codes = "+W.join(",")),p(o,T,this.cmdHistory)}return y},v.parseBackgroundAttributes=function(o,T){var S=(o===16||o===24)&&T>=32&&T<=47,y=(o===23||o===31)&&T>=45&&T<=47;if(!(S||y))return!1;var P,B={};o===16||o===24?(P=Math.floor((T-32)/2),B.background=M[P],T%2===1&&(B.background=B.background+"_semi")):T===45?B.background="transparent":(B.foreground="black",T===47&&(B.underline=!0));var W=o<=23?1:2,V=this.channels[W];return V.setBkgData(B),p(o,T,this.cmdHistory),!0},v.reset=function(){for(var o=0;o<Object.keys(this.channels).length;o++){var T=this.channels[o];T&&T.reset()}this.cmdHistory=C()},v.cueSplitAtTime=function(o){for(var T=0;T<this.channels.length;T++){var S=this.channels[T];S&&S.cueSplitAtTime(o)}},m}();function p(m,v,d){d.a=m,d.b=v}function D(m,v,d){return d.a===m&&d.b===v}function C(){return{a:null,b:null}}$.default=f},"./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,F){var _=Q[F];return!!_&&_[j.slice(0,4)]===!0}function O(j,F){return MediaSource.isTypeSupported((F||"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/,F={newCue:function(A,c,x,M){for(var w=[],E,b,u,a,l,h=self.VTTCue||self.TextTrackCue,L=0;L<M.rows.length;L++)if(E=M.rows[L],u=!0,a=0,l="",!E.isEmpty()){for(var f=0;f<E.chars.length;f++)j.test(E.chars[f].uchar)&&u?a++:(l+=E.chars[f].uchar,u=!1);E.cueStartTime=c,c===x&&(x+=1e-4),a>=16?a--:a++;var p=Object(Q.fixLineBreaks)(l.trim()),D=Object(U.generateCueId)(c,x,p);(!A||!A.cues||!A.cues.getCueById(D))&&(b=new h(c,x,p),b.id=D,b.line=L+1,b.align="left",b.position=10+Math.min(80,Math.floor(a*8/32)*10),w.push(b))}return A&&w.length&&(w.sort(function(C,m){return C.line==="auto"||m.line==="auto"?0:C.line>8&&m.line>8?m.line-C.line:C.line-m.line}),w.forEach(function(C){return Object(O.addCueToTrack)(A,C)})),w}};$.default=F},"./src/utils/discontinuities.ts":function(ne,$,R){"use strict";R.r($),R.d($,"findFirstFragWithCC",function(){return j}),R.d($,"shouldAlignOnDiscontinuities",function(){return F}),R.d($,"findDiscontinuousReferenceFrag",function(){return _}),R.d($,"adjustSlidingStart",function(){return c}),R.d($,"alignStream",function(){return x}),R.d($,"alignPDT",function(){return w}),R.d($,"alignFragmentByPDTDelta",function(){return E}),R.d($,"alignMediaPlaylistByPDT",function(){return b});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 l=null,h=0,L=u.length;h<L;h++){var f=u[h];if(f&&f.cc===a){l=f;break}}return l}function F(u,a,l){return!!(a.details&&(l.endCC>l.startCC||u&&u.cc<l.startCC))}function _(u,a){var l=u.fragments,h=a.fragments;if(!h.length||!l.length){U.logger.log("No fragments to align");return}var L=j(l,h[0].cc);if(!L||L&&!L.startPTS){U.logger.log("No frag in previous level to align on");return}return L}function A(u,a){if(u){var l=u.start+a;u.start=u.startPTS=l,u.endPTS=l+u.duration}}function c(u,a){for(var l=a.fragments,h=0,L=l.length;h<L;h++)A(l[h],u);a.fragmentHint&&A(a.fragmentHint,u),a.alignedSliding=!0}function x(u,a,l){if(!a)return;M(u,l,a),!l.alignedSliding&&a.details&&w(l,a.details),!l.alignedSliding&&a.details&&!l.skippedSegments&&Object(O.adjustSliding)(a.details,l)}function M(u,a,l){if(F(u,l,a)){var h=_(l.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),c(h.start,a))}}function w(u,a){if(!a.fragments.length||!u.hasProgramDateTime||!a.hasProgramDateTime)return;var l=a.fragments[0].programDateTime,h=u.fragments[0].programDateTime,L=(h-l)/1e3+a.fragments[0].start;L&&Object(Q.isFiniteNumber)(L)&&(U.logger.log("Adjusting PTS using programDateTime delta "+(h-l)+"ms, sliding:"+L.toFixed(3)+" "+u.url+" "),c(L,u))}function E(u,a){var l=u.programDateTime;if(!l)return;var h=(l-a)/1e3;u.start=u.startPTS=h,u.endPTS=h+u.duration}function b(u,a){if(!a.fragments.length||!u.hasProgramDateTime||!a.hasProgramDateTime)return;var l=a.fragments[0].programDateTime,h=a.fragments[0].start,L=l-h*1e3;u.fragments.forEach(function(f){E(f,L)}),u.fragmentHint&&E(u.fragmentHint,L),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(F,_,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(F),this.fast_=new Q.default(_)}var j=O.prototype;return j.update=function(_,A){var c=this.slow_,x=this.fast_;this.slow_.halfLife!==_&&(this.slow_=new Q.default(_,c.getEstimate(),c.getTotalWeight())),this.fast_.halfLife!==A&&(this.fast_=new Q.default(A,x.getEstimate(),x.getTotalWeight()))},j.sample=function(_,A){_=Math.max(_,this.minDelayMs_);var c=8*A,x=_/1e3,M=c/x;this.fast_.sample(x,M),this.slow_.sample(x,M)},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,F,_){F===void 0&&(F=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_=F,this.totalWeight_=_}var O=U.prototype;return O.sample=function(F,_){var A=Math.pow(this.alpha_,F);this.estimate_=_*(1-A)+A*this.estimate_,this.totalWeight_+=F},O.getTotalWeight=function(){return this.totalWeight_},O.getEstimate=function(){if(this.alpha_){var F=1-Math.pow(this.alpha_,this.totalWeight_);if(F)return this.estimate_/F}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,L){h.prototype=Object.create(L.prototype),h.prototype.constructor=h,x(h,L)}function F(h){var L=typeof Map=="function"?new Map:void 0;return F=function(p){if(p===null||!c(p))return p;if(typeof p!="function")throw new TypeError("Super expression must either be null or a function");if(typeof L!="undefined"){if(L.has(p))return L.get(p);L.set(p,D)}function D(){return _(p,arguments,M(this).constructor)}return D.prototype=Object.create(p.prototype,{constructor:{value:D,enumerable:!1,writable:!0,configurable:!0}}),x(D,p)},F(h)}function _(h,L,f){return A()?_=Reflect.construct:_=function(D,C,m){var v=[null];v.push.apply(v,C);var d=Function.bind.apply(D,v),o=new d;return m&&x(o,m.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 c(h){return Function.toString.call(h).indexOf("[native code]")!==-1}function x(h,L){return x=Object.setPrototypeOf||function(p,D){return p.__proto__=D,p},x(h,L)}function M(h){return M=Object.setPrototypeOf?Object.getPrototypeOf:function(f){return f.__proto__||Object.getPrototypeOf(f)},M(h)}function w(){return w=Object.assign||function(h){for(var L=1;L<arguments.length;L++){var f=arguments[L];for(var p in f)Object.prototype.hasOwnProperty.call(f,p)&&(h[p]=f[p])}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 b=function(){function h(f){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=f.fetchSetup||a,this.controller=new self.AbortController,this.stats=new U.LoadStats}var L=h.prototype;return L.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},L.abortInternal=function(){var p=this.response;(!p||!p.ok)&&(this.stats.aborted=!0,this.controller.abort())},L.abort=function(){var p;this.abortInternal(),(p=this.callbacks)!==null&&p!==void 0&&p.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},L.load=function(p,D,C){var m=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(p,this.controller.signal),o=C.onProgress,T=p.responseType==="arraybuffer",S=T?"byteLength":"length";this.context=p,this.config=D,this.callbacks=C,this.request=this.fetchSetup(p,d),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){m.abortInternal(),C.onTimeout(v,p,m.response)},D.timeout),self.fetch(this.request).then(function(y){if(m.response=m.loader=y,!y.ok){var P=y.status,B=y.statusText;throw new l(B||"fetch, bad network response",P,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)?m.loadProgressively(y,v,p,D.highWaterMark,o):T?y.arrayBuffer():y.text()}).then(function(y){var P=m.response;self.clearTimeout(m.requestTimeout),v.loading.end=Math.max(self.performance.now(),v.loading.first),v.loaded=v.total=y[S];var B={url:P.url,data:y};o&&!Object(Q.isFiniteNumber)(D.highWaterMark)&&o(v,p,y,P),C.onSuccess(B,v,p,P)}).catch(function(y){if(self.clearTimeout(m.requestTimeout),v.aborted)return;var P=y.code||0;C.onError({code:P,text:y.message},p,y.details)})},L.getCacheAge=function(){var p=null;if(this.response){var D=this.response.headers.get("age");p=D?parseFloat(D):null}return p},L.loadProgressively=function(p,D,C,m,v){m===void 0&&(m=0);var d=new O.default,o=p.body.getReader(),T=function S(){return o.read().then(function(y){if(y.done)return d.dataLength&&v(D,C,d.flush(),p),Promise.resolve(new ArrayBuffer(0));var P=y.value,B=P.length;return D.loaded+=B,B<m||d.dataLength?(d.push(P),d.dataLength>=m&&v(D,C,d.flush(),p)):v(D,C,P,p),S()}).catch(function(){return Promise.reject()})};return T()},h}();function u(h,L){var f={method:"GET",mode:"cors",credentials:"same-origin",signal:L,headers:new self.Headers(w({},h.headers))};return h.rangeEnd&&f.headers.set("Range","bytes="+h.rangeStart+"-"+String(h.rangeEnd-1)),f}function a(h,L){return new self.Request(h.url,L)}var l=function(h){j(L,h);function L(f,p,D){var C;return C=h.call(this,f)||this,C.code=void 0,C.details=void 0,C.code=p,C.details=D,C}return L}(F(Error));$.default=b},"./src/utils/imsc1-ttml-parser.ts":function(ne,$,R){"use strict";R.r($),R.d($,"IMSC1_CODEC",function(){return c}),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"),F=R("./src/utils/timescale-conversion.ts"),_=R("./src/utils/webvtt-parser.ts");function A(){return A=Object.assign||function(m){for(var v=1;v<arguments.length;v++){var d=arguments[v];for(var o in d)Object.prototype.hasOwnProperty.call(d,o)&&(m[o]=d[o])}return m},A.apply(this,arguments)}var c="stpp.ttml.im1t",x=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,M=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,w={left:"start",center:"center",right:"end",start:"start",end:"end"};function E(m,v,d,o,T){var S=Object(Q.findBox)(new Uint8Array(m),["mdat"]);if(S.length===0){T(new Error("Could not parse IMSC1 mdat"));return}var y=S[0],P=Object(j.utf8ArrayToStr)(new Uint8Array(m,y.start,y.end-y.start)),B=Object(F.toTimescaleFromScale)(v,1,d);try{o(b(P,B))}catch(W){T(W)}}function b(m,v){var d=new DOMParser,o=d.parseFromString(m,"text/xml"),T=o.getElementsByTagName("tt")[0];if(!T)throw new Error("Invalid ttml");var S={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},y=Object.keys(S).reduce(function(I,N){return I[N]=T.getAttribute("ttp:"+N)||S[N],I},{}),P=T.getAttribute("xml:space")!=="preserve",B=a(u(T,"styling","style")),W=a(u(T,"layout","region")),V=u(T,"body","[begin]");return[].map.call(V,function(I){var N=l(I,P);if(!N||!I.hasAttribute("begin"))return null;var X=p(I.getAttribute("begin"),y),ee=p(I.getAttribute("dur"),y),oe=p(I.getAttribute("end"),y);if(X===null)throw f(I);if(oe===null){if(ee===null)throw f(I);oe=X+ee}var ce=new O.default(X-v,oe-v,N);ce.id=Object(_.generateCueId)(ce.startTime,ce.endTime,ce.text);var De=W[I.getAttribute("region")],Ee=B[I.getAttribute("style")];ce.position=10,ce.size=80;var Ce=h(De,Ee),Te=Ce.textAlign;if(Te){var me=w[Te];me&&(ce.lineAlign=me),ce.align=Te}return A(ce,Ce),ce}).filter(function(I){return I!==null})}function u(m,v,d){var o=m.getElementsByTagName(v)[0];return o?[].slice.call(o.querySelectorAll(d)):[]}function a(m){return m.reduce(function(v,d){var o=d.getAttribute("xml:id");return o&&(v[o]=d),v},{})}function l(m,v){return[].slice.call(m.childNodes).reduce(function(d,o,T){var S;return o.nodeName==="br"&&T?d+`
|
|
`:(S=o.childNodes)!==null&&S!==void 0&&S.length?l(o,v):v?d+o.textContent.trim().replace(/\s+/g," "):d+o.textContent},"")}function h(m,v){var d="http://www.w3.org/ns/ttml#styling",o=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return o.reduce(function(T,S){var y=L(v,d,S)||L(m,d,S);return y&&(T[S]=y),T},{})}function L(m,v,d){return m.hasAttributeNS(v,d)?m.getAttributeNS(v,d):null}function f(m){return new Error("Could not parse ttml timestamp "+m)}function p(m,v){if(!m)return null;var d=Object(U.parseTimeStamp)(m);return d===null&&(x.test(m)?d=D(m,v):M.test(m)&&(d=C(m,v))),d}function D(m,v){var d=x.exec(m),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 C(m,v){var d=M.exec(m),o=Number(d[1]),T=d[2];switch(T){case"h":return o*3600;case"m":return o*60;case"ms":return o*1e3;case"f":return o/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(c){var x=self.console[c];return x?x.bind(self.console,"["+c+"] >"):Q}function F(c){for(var x=arguments.length,M=new Array(x>1?x-1:0),w=1;w<x;w++)M[w-1]=arguments[w];M.forEach(function(E){O[E]=c[E]?c[E].bind(c):j(E)})}function _(c){if(self.console&&c===!0||typeof c=="object"){F(c,"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 F}),R.d($,"readUint16",function(){return _}),R.d($,"readUint32",function(){return A}),R.d($,"writeUint32",function(){return c}),R.d($,"findBox",function(){return x}),R.d($,"parseSegmentIndex",function(){return M}),R.d($,"parseInitSegment",function(){return w}),R.d($,"getStartDTS",function(){return E}),R.d($,"getDuration",function(){return b}),R.d($,"computeRawDurationFromSamples",function(){return u}),R.d($,"offsetStartDTS",function(){return a}),R.d($,"segmentValidRange",function(){return l}),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 F(L){return String.fromCharCode.apply(null,L)}function _(L,f){"data"in L&&(f+=L.start,L=L.data);var p=L[f]<<8|L[f+1];return p<0?65536+p:p}function A(L,f){"data"in L&&(f+=L.start,L=L.data);var p=L[f]<<24|L[f+1]<<16|L[f+2]<<8|L[f+3];return p<0?4294967296+p:p}function c(L,f,p){"data"in L&&(f+=L.start,L=L.data),L[f]=p>>24,L[f+1]=p>>16&255,L[f+2]=p>>8&255,L[f+3]=p&255}function x(L,f){var p=[];if(!f.length)return p;var D,C,m;"data"in L?(D=L.data,C=L.start,m=L.end):(D=L,C=0,m=D.byteLength);for(var v=C;v<m;){var d=A(D,v),o=F(D.subarray(v+4,v+8)),T=d>1?v+d:m;if(o===f[0])if(f.length===1)p.push({data:D,start:v+8,end:T});else{var S=x({data:D,start:v+8,end:T},f.slice(1));S.length&&j.apply(p,S)}v=T}return p}function M(L){var f=x(L,["moov"]),p=f[0],D=p?p.end:null,C=x(L,["sidx"]);if(!C||!C[0])return null;var m=[],v=C[0],d=v.data[0],o=d===0?8:16,T=A(v,o);o+=4;var S=0,y=0;d===0?o+=8:o+=16,o+=2;var P=v.end+y,B=_(v,o);o+=2;for(var W=0;W<B;W++){var V=o,I=A(v,V);V+=4;var N=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,m.push({referenceSize:N,subsegmentDuration:ee,info:{duration:ee/T,start:P,end:P+N-1}}),P+=N,V+=4,o=V}return{earliestPresentationTime:S,timescale:T,version:d,referencesCount:B,references:m,moovEndOffset:D}}function w(L){for(var f=[],p=x(L,["moov","trak"]),D=0;D<p.length;D++){var C=p[D],m=x(C,["tkhd"])[0];if(m){var v=m.data[m.start],d=v===0?12:20,o=A(m,d),T=x(C,["mdia","mdhd"])[0];if(T){v=T.data[T.start],d=v===0?12:20;var S=A(T,d),y=x(C,["mdia","hdlr"])[0];if(y){var P=F(y.data.subarray(y.start+8,y.start+12)),B={soun:U.ElementaryStreamTypes.AUDIO,vide:U.ElementaryStreamTypes.VIDEO}[P];if(B){var W=x(C,["mdia","minf","stbl","stsd"])[0],V=void 0;W&&(V=F(W.data.subarray(W.start+12,W.start+16))),f[o]={timescale:S,type:B},f[B]={timescale:S,id:o,codec:V}}}}}}var I=x(L,["moov","mvex","trex"]);return I.forEach(function(N){var X=A(N,4),ee=f[X];ee&&(ee.default={duration:A(N,12),flags:A(N,20)})}),f}function E(L,f){return x(f,["moof","traf"]).reduce(function(p,D){var C=x(D,["tfdt"])[0],m=C.data[C.start],v=x(D,["tfhd"]).reduce(function(d,o){var T=A(o,4),S=L[T];if(S){var y=A(C,4);m===1&&(y*=Math.pow(2,32),y+=A(C,8));var P=S.timescale||9e4,B=y/P;if(isFinite(B)&&(d===null||B<d))return B}return d},null);return v!==null&&isFinite(v)&&(p===null||v<p)?v:p},null)||0}function b(L,f){for(var p=0,D=0,C=0,m=x(L,["moof","traf"]),v=0;v<m.length;v++){var d=m[v],o=x(d,["tfhd"])[0],T=A(o,4),S=f[T];if(!S)continue;var y=S.default,P=A(o,0)|(y==null?void 0:y.flags),B=y==null?void 0:y.duration;P&8&&(P&2?B=A(o,12):B=A(o,8));for(var W=S.timescale||9e4,V=x(d,["trun"]),I=0;I<V.length;I++){if(B){var N=A(V[I],4);p=B*N}else p=u(V[I]);S.type===U.ElementaryStreamTypes.VIDEO?D+=p/W:S.type===U.ElementaryStreamTypes.AUDIO&&(C+=p/W)}}if(D===0&&C===0){var X=M(L);if(X!=null&&X.references)return X.references.reduce(function(ee,oe){return ee+oe.info.duration||0},0)}return D||C}function u(L){var f=A(L,0),p=8;f&1&&(p+=4),f&4&&(p+=4);for(var D=0,C=A(L,4),m=0;m<C;m++){if(f&256){var v=A(L,p);D+=v,p+=4}f&512&&(p+=4),f&1024&&(p+=4),f&2048&&(p+=4)}return D}function a(L,f,p){x(f,["moof","traf"]).forEach(function(D){x(D,["tfhd"]).forEach(function(C){var m=A(C,4),v=L[m];if(!v)return;var d=v.timescale||9e4;x(D,["tfdt"]).forEach(function(o){var T=o.data[o.start],S=A(o,4);if(T===0)c(o,4,S-p*d);else{S*=Math.pow(2,32),S+=A(o,8),S-=p*d,S=Math.max(S,0);var y=Math.floor(S/(O+1)),P=Math.floor(S%(O+1));c(o,4,y),c(o,8,P)}})})})}function l(L){var f={valid:null,remainder:null},p=x(L,["moof"]);if(p){if(p.length<2)return f.remainder=L,f}else return f;var D=p[p.length-1];return f.valid=Object(Q.sliceUint8)(L,0,D.start-8),f.remainder=Object(Q.sliceUint8)(L,D.start-8),f}function h(L,f){var p=new Uint8Array(L.length+f.length);return p.set(L),p.set(f,L.length),p}},"./src/utils/output-filter.ts":function(ne,$,R){"use strict";R.r($),R.d($,"default",function(){return Q});var Q=function(){function U(j,F){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=j,this.trackName=F}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(F,_,A){(this.startTime===null||this.startTime>F)&&(this.startTime=F),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 F}),R.d($,"getCuesInRange",function(){return A});var Q=R("./src/utils/logger.ts");function U(c,x){var M;try{M=new Event("addtrack")}catch(w){M=document.createEvent("Event"),M.initEvent("addtrack",!1,!1)}M.track=c,x.dispatchEvent(M)}function O(c,x){var M=c.mode;if(M==="disabled"&&(c.mode="hidden"),c.cues&&!c.cues.getCueById(x.id))try{if(c.addCue(x),!c.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,c.addCue(w)}M==="disabled"&&(c.mode=M)}function j(c){var x=c.mode;if(x==="disabled"&&(c.mode="hidden"),c.cues)for(var M=c.cues.length;M--;)c.removeCue(c.cues[M]);x==="disabled"&&(c.mode=x)}function F(c,x,M){var w=c.mode;if(w==="disabled"&&(c.mode="hidden"),c.cues&&c.cues.length>0)for(var E=A(c.cues,x,M),b=0;b<E.length;b++)c.removeCue(E[b]);w==="disabled"&&(c.mode=w)}function _(c,x){if(x<c[0].startTime)return 0;var M=c.length-1;if(x>c[M].endTime)return-1;for(var w=0,E=M;w<=E;){var b=Math.floor((E+w)/2);if(x<c[b].startTime)E=b-1;else if(x>c[b].startTime&&w<M)w=b+1;else return b}return c[w].startTime-x<x-c[E].startTime?w:E}function A(c,x,M){var w=[],E=_(c,x);if(E>-1)for(var b=E,u=c.length;b<u;b++){var a=c[b];if(a.startTime>=x&&a.endTime<=M)w.push(a);else if(a.startTime>M)return w}return w}},"./src/utils/time-ranges.ts":function(ne,$,R){"use strict";R.r($);var Q={toString:function(O){for(var j="",F=O.length,_=0;_<F;_++)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 F});var Q=9e4;function U(_,A,c,x){c===void 0&&(c=1),x===void 0&&(x=!1);var M=_*A*c;return x?Math.round(M):M}function O(_,A,c,x){return c===void 0&&(c=1),x===void 0&&(x=!1),U(_,A,1/c,x)}function j(_,A){return A===void 0&&(A=!1),U(_,1e3,1/Q,A)}function F(_,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(c,x){if(typeof x!="string")return!1;if(!Array.isArray(c))return!1;var M=x.toLowerCase();return~c.indexOf(M)?M:!1}function j(c){return O(Q,c)}function F(c){return O(U,c)}function _(c){for(var x=arguments.length,M=new Array(x>1?x-1:0),w=1;w<x;w++)M[w-1]=arguments[w];for(var E=1;E<arguments.length;E++){var b=arguments[E];for(var u in b)c[u]=b[u]}return c}function A(c,x,M){var w=this,E={enumerable:!0};w.hasBeenReset=!1;var b="",u=!1,a=c,l=x,h=M,L=null,f="",p=!0,D="auto",C="start",m=50,v="middle",d=50,o="middle";Object.defineProperty(w,"id",_({},E,{get:function(){return b},set:function(S){b=""+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 l},set:function(S){if(typeof S!="number")throw new TypeError("End time must be set to a number.");l=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 L},set:function(S){L=S,this.hasBeenReset=!0}})),Object.defineProperty(w,"vertical",_({},E,{get:function(){return f},set:function(S){var y=j(S);if(y===!1)throw new SyntaxError("An invalid or illegal string was specified.");f=y,this.hasBeenReset=!0}})),Object.defineProperty(w,"snapToLines",_({},E,{get:function(){return p},set:function(S){p=!!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 C},set:function(S){var y=F(S);if(!y)throw new SyntaxError("An invalid or illegal string was specified.");C=y,this.hasBeenReset=!0}})),Object.defineProperty(w,"position",_({},E,{get:function(){return m},set:function(S){if(S<0||S>100)throw new Error("Position must be between 0 and 100.");m=S,this.hasBeenReset=!0}})),Object.defineProperty(w,"positionAlign",_({},E,{get:function(){return v},set:function(S){var y=F(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=F(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 c=self.WebVTT;return c.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 M});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,l,h){return(u|0)*3600+(a|0)*60+(l|0)+parseFloat(h||0)}var b=w.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return b?parseFloat(b[2])>59?E(b[2],b[3],0,b[4]):E(b[1],b[2],b[3],b[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,l){return l?this.has(u)?this.values[u]:a[l]:this.has(u)?this.values[u]:a},E.has=function(u){return u in this.values},E.alt=function(u,a,l){for(var h=0;h<l.length;++h)if(a===l[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 l=parseFloat(a);if(l>=0&&l<=100)return this.set(u,l),!0}return!1},w}();function F(w,E,b,u){var a=u?w.split(u):[w];for(var l in a){if(typeof a[l]!="string")continue;var h=a[l].split(b);if(h.length!==2)continue;var L=h[0],f=h[1];E(L,f)}}var _=new Q.default(0,0,""),A=_.align==="middle"?"middle":"center";function c(w,E,b){var u=w;function a(){var L=O(w);if(L===null)throw new Error("Malformed timestamp: "+u);return w=w.replace(/^[^\sa-zA-Z-]+/,""),L}function l(L,f){var p=new j;F(L,function(m,v){var d;switch(m){case"region":for(var o=b.length-1;o>=0;o--)if(b[o].id===v){p.set(m,b[o].region);break}break;case"vertical":p.alt(m,v,["rl","lr"]);break;case"line":d=v.split(","),p.integer(m,d[0]),p.percent(m,d[0])&&p.set("snapToLines",!1),p.alt(m,d[0],["auto"]),d.length===2&&p.alt("lineAlign",d[1],["start",A,"end"]);break;case"position":d=v.split(","),p.percent(m,d[0]),d.length===2&&p.alt("positionAlign",d[1],["start",A,"end","line-left","line-right","auto"]);break;case"size":p.percent(m,v);break;case"align":p.alt(m,v,["start",A,"end","left","right"]);break}},/:/,/\s/),f.region=p.get("region",null),f.vertical=p.get("vertical","");var D=p.get("line","auto");D==="auto"&&_.line===-1&&(D=-1),f.line=D,f.lineAlign=p.get("lineAlign","start"),f.snapToLines=p.get("snapToLines",!0),f.size=p.get("size",100),f.align=p.get("align",A);var C=p.get("position","auto");C==="auto"&&_.position===50&&(C=f.align==="start"||f.align==="left"?0:f.align==="end"||f.align==="right"?100:50),f.position=C}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(),l(w,E)}function x(w){return w.replace(/<br(?: \/)?>/gi,`
|
|
`)}var M=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 l(){var C=a.buffer,m=0;for(C=x(C);m<C.length&&C[m]!=="\r"&&C[m]!==`
|
|
`;)++m;var v=C.substr(0,m);return C[m]==="\r"&&++m,C[m]===`
|
|
`&&++m,a.buffer=C.substr(m),v}function h(C){F(C,function(m,v){},/:/)}try{var L="";if(a.state==="INITIAL"){if(!/\r\n|\n/.test(a.buffer))return this;L=l();var f=L.match(/^()?WEBVTT([ \t].*)?$/);if(!f||!f[0])throw new Error("Malformed WebVTT signature.");a.state="HEADER"}for(var p=!1;a.buffer;){if(!/\r\n|\n/.test(a.buffer))return this;p?p=!1:L=l();switch(a.state){case"HEADER":/:/.test(L)?h(L):L||(a.state="ID");continue;case"NOTE":L||(a.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(L)){a.state="NOTE";break}if(!L)continue;if(a.cue=new Q.default(0,0,""),a.state="CUE",L.indexOf("-->")===-1){a.cue.id=L;continue}case"CUE":if(!a.cue){a.state="BADCUE";continue}try{c(L,a.cue,a.regionList)}catch(C){a.cue=null,a.state="BADCUE";continue}a.state="CUETEXT";continue;case"CUETEXT":{var D=L.indexOf("-->")!==-1;if(!L||D&&(p=!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+=L}continue;case"BADCUE":L||(a.state="ID")}}}catch(C){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 M}),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"),F=R("./src/remux/mp4-remuxer.ts"),_=/\r\n|\n\r|\n|\r/g,A=function(u,a,l){return l===void 0&&(l=0),u.substr(l,a.length)===a},c=function(u){var a=parseInt(u.substr(-3)),l=parseInt(u.substr(-6,2)),h=parseInt(u.substr(-9,2)),L=u.length>9?parseInt(u.substr(0,u.indexOf(":"))):0;if(!Object(Q.isFiniteNumber)(a)||!Object(Q.isFiniteNumber)(l)||!Object(Q.isFiniteNumber)(h)||!Object(Q.isFiniteNumber)(L))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+u);return a+=1e3*l,a+=60*1e3*h,a+=60*60*1e3*L,a},x=function(u){for(var a=5381,l=u.length;l;)a=a*33^u.charCodeAt(--l);return(a>>>0).toString()};function M(b,u,a){return x(b.toString())+x(u.toString())+x(a)}var w=function(u,a,l){var h=u[a],L=u[h.prevCC];if(!L||!L.new&&h.new){u.ccOffset=u.presentationOffset=h.start,h.new=!1;return}for(;(f=L)!==null&&f!==void 0&&f.new;){var f;u.ccOffset+=h.start-L.start,h.new=!1,h=L,L=u[h.prevCC]}u.presentationOffset=l};function E(b,u,a,l,h,L,f,p){var D=new U.VTTParser,C=Object(O.utf8ArrayToStr)(new Uint8Array(b)).trim().replace(_,`
|
|
`).split(`
|
|
`),m=[],v=Object(j.toMpegTsClockFromTimescale)(u,a),d="00:00.000",o=0,T=0,S,y=!0,P=!1;D.oncue=function(B){var W=l[h],V=l.ccOffset,I=(o-v)/9e4;if(W!=null&&W.new&&(T!==void 0?V=l.ccOffset=W.start:w(l,h,I)),I&&(V=I-l.presentationOffset),P){var N=B.endTime-B.startTime,X=Object(F.normalizePts)((B.startTime+V-T)*9e4,L*9e4)/9e4;B.startTime=X,B.endTime=X+N}var ee=B.text.trim();B.text=decodeURIComponent(encodeURIComponent(ee)),B.id||(B.id=M(B.startTime,B.endTime,ee)),B.endTime>0&&m.push(B)},D.onparsingerror=function(B){S=B},D.onflush=function(){if(S){p(S);return}f(m)},C.forEach(function(B){if(y)if(A(B,"X-TIMESTAMP-MAP=")){y=!1,P=!0,B.substr(16).split(",").forEach(function(W){A(W,"LOCAL:")?d=W.substr(6):A(W,"MPEGTS:")&&(o=parseInt(W.substr(7)))});try{T=c(d)/1e3}catch(W){P=!1,S=W}return}else B===""&&(y=!1);D.parse(B+`
|
|
`)}),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 F(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 _=F.prototype;return _.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},_.abortInternal=function(){var c=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),c&&(c.onreadystatechange=null,c.onprogress=null,c.readyState!==4&&(this.stats.aborted=!0,c.abort()))},_.abort=function(){var c;this.abortInternal(),(c=this.callbacks)!==null&&c!==void 0&&c.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},_.load=function(c,x,M){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=c,this.config=x,this.callbacks=M,this.retryDelay=x.retryDelay,this.loadInternal()},_.loadInternal=function(){var c=this.config,x=this.context;if(!c)return;var M=this.loader=new self.XMLHttpRequest,w=this.stats;w.loading.first=0,w.loaded=0;var E=this.xhrSetup;try{if(E)try{E(M,x.url)}catch(a){M.open("GET",x.url,!0),E(M,x.url)}M.readyState||M.open("GET",x.url,!0);var b=this.context.headers;if(b)for(var u in b)M.setRequestHeader(u,b[u])}catch(a){this.callbacks.onError({code:M.status,text:a.message},x,M);return}x.rangeEnd&&M.setRequestHeader("Range","bytes="+x.rangeStart+"-"+(x.rangeEnd-1)),M.onreadystatechange=this.readystatechange.bind(this),M.onprogress=this.loadprogress.bind(this),M.responseType=x.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),c.timeout),M.send()},_.readystatechange=function(){var c=this.context,x=this.loader,M=this.stats;if(!c||!x)return;var w=x.readyState,E=this.config;if(M.aborted)return;if(w>=2)if(self.clearTimeout(this.requestTimeout),M.loading.first===0&&(M.loading.first=Math.max(self.performance.now(),M.loading.start)),w===4){x.onreadystatechange=null,x.onprogress=null;var b=x.status;if(b>=200&&b<300){M.loading.end=Math.max(self.performance.now(),M.loading.first);var u,a;if(c.responseType==="arraybuffer"?(u=x.response,a=u.byteLength):(u=x.responseText,a=u.length),M.loaded=M.total=a,!this.callbacks)return;var l=this.callbacks.onProgress;if(l&&l(M,c,u,x),!this.callbacks)return;var h={url:x.responseURL,data:u};this.callbacks.onSuccess(h,M,c,x)}else M.retry>=E.maxRetry||b>=400&&b<499?(Q.logger.error(b+" while loading "+c.url),this.callbacks.onError({code:b,text:x.statusText},c,x)):(Q.logger.warn(b+" while loading "+c.url+", retrying in "+this.retryDelay+"..."),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,E.maxRetryDelay),M.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 c=this.callbacks;c&&(this.abortInternal(),c.onTimeout(this.stats,this.context,this.loader))},_.loadprogress=function(c){var x=this.stats;x.loaded=c.loaded,c.lengthComputable&&(x.total=c.total)},_.getCacheAge=function(){var c=null;if(this.loader&&O.test(this.loader.getAllResponseHeaders())){var x=this.loader.getResponseHeader("age");c=x?parseFloat(x):null}return c},F}();$.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}}]);
|