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.
366 lines
930 KiB
366 lines
930 KiB
(window.webpackJsonp=window.webpackJsonp||[]).push([[284,6,7,8,11],{"+NIl":function(pt,at,pe){(function(fe){fe(pe("VrN/"))})(function(fe){"use strict";fe.defineMode("stex",function(Z,_){"use strict";function J(L,w){L.cmdState.push(w)}function U(L){return L.cmdState.length>0?L.cmdState[L.cmdState.length-1]:null}function D(L){var w=L.cmdState.pop();w&&w.closeBracket()}function z(L){for(var w=L.cmdState,y=w.length-1;y>=0;y--){var h=w[y];if(h.name=="DEFAULT")continue;return h}return{styleIdentifier:function(){return null}}}function H(L,w,y){return function(){this.name=L,this.bracketNo=0,this.style=w,this.styles=y,this.argument=null,this.styleIdentifier=function(){return this.styles[this.bracketNo-1]||null},this.openBracket=function(){return this.bracketNo++,"bracket"},this.closeBracket=function(){}}}var B={};B.importmodule=H("importmodule","tag",["string","builtin"]),B.documentclass=H("documentclass","tag",["","atom"]),B.usepackage=H("usepackage","tag",["atom"]),B.begin=H("begin","tag",["atom"]),B.end=H("end","tag",["atom"]),B.label=H("label","tag",["atom"]),B.ref=H("ref","tag",["atom"]),B.eqref=H("eqref","tag",["atom"]),B.cite=H("cite","tag",["atom"]),B.bibitem=H("bibitem","tag",["atom"]),B.Bibitem=H("Bibitem","tag",["atom"]),B.RBibitem=H("RBibitem","tag",["atom"]),B.DEFAULT=function(){this.name="DEFAULT",this.style="tag",this.styleIdentifier=this.openBracket=this.closeBracket=function(){}};function O(L,w){L.f=w}function b(L,w){var y;if(L.match(/^\\[a-zA-Z@]+/)){var h=L.current().slice(1);return y=B.hasOwnProperty(h)?B[h]:B.DEFAULT,y=new y,J(w,y),O(w,P),y.style}if(L.match(/^\\[$&%#{}_]/))return"tag";if(L.match(/^\\[,;!\/\\]/))return"tag";if(L.match("\\["))return O(w,function(l,u){return A(l,u,"\\]")}),"keyword";if(L.match("\\("))return O(w,function(l,u){return A(l,u,"\\)")}),"keyword";if(L.match("$$"))return O(w,function(l,u){return A(l,u,"$$")}),"keyword";if(L.match("$"))return O(w,function(l,u){return A(l,u,"$")}),"keyword";var o=L.next();if(o=="%")return L.skipToEnd(),"comment";if(o=="}"||o=="]"){if(y=U(w),y)y.closeBracket(o),O(w,P);else return"error";return"bracket"}else return o=="{"||o=="["?(y=B.DEFAULT,y=new y,J(w,y),"bracket"):/\d/.test(o)?(L.eatWhile(/[\w.%]/),"atom"):(L.eatWhile(/[\w\-_]/),y=z(w),y.name=="begin"&&(y.argument=L.current()),y.styleIdentifier())}function A(L,w,y){if(L.eatSpace())return null;if(y&&L.match(y))return O(w,b),"keyword";if(L.match(/^\\[a-zA-Z@]+/))return"tag";if(L.match(/^[a-zA-Z]+/))return"variable-2";if(L.match(/^\\[$&%#{}_]/))return"tag";if(L.match(/^\\[,;!\/]/))return"tag";if(L.match(/^[\^_&]/))return"tag";if(L.match(/^[+\-<>|=,\/@!*:;'"`~#?]/))return null;if(L.match(/^(\d+\.\d*|\d*\.\d+|\d+)/))return"number";var h=L.next();return h=="{"||h=="}"||h=="["||h=="]"||h=="("||h==")"?"bracket":h=="%"?(L.skipToEnd(),"comment"):"error"}function P(L,w){var y=L.peek(),h;return y=="{"||y=="["?(h=U(w),h.openBracket(y),L.eat(y),O(w,b),"bracket"):/[ \t\r]/.test(y)?(L.eat(y),null):(O(w,b),D(w),b(L,w))}return{startState:function(){var L=_.inMathMode?function(w,y){return A(w,y)}:b;return{cmdState:[],f:L}},copyState:function(L){return{cmdState:L.cmdState.slice(),f:L.f}},token:function(L,w){return w.f(L,w)},blankLine:function(L){L.f=b,L.cmdState.length=0},lineComment:"%"}}),fe.defineMIME("text/x-stex","stex"),fe.defineMIME("text/x-latex","stex")})},"19Vz":function(pt,at,pe){(function(fe){fe(pe("VrN/"))})(function(fe){fe.defineOption("placeholder","",function(H,B,O){var b=O&&O!=fe.Init;if(B&&!b)H.on("blur",U),H.on("change",D),H.on("swapDoc",D),fe.on(H.getInputField(),"compositionupdate",H.state.placeholderCompose=function(){J(H)}),D(H);else if(!B&&b){H.off("blur",U),H.off("change",D),H.off("swapDoc",D),fe.off(H.getInputField(),"compositionupdate",H.state.placeholderCompose),Z(H);var A=H.getWrapperElement();A.className=A.className.replace(" CodeMirror-empty","")}B&&!H.hasFocus()&&U(H)});function Z(H){H.state.placeholder&&(H.state.placeholder.parentNode.removeChild(H.state.placeholder),H.state.placeholder=null)}function _(H){Z(H);var B=H.state.placeholder=document.createElement("pre");B.style.cssText="height: 0; overflow: visible",B.style.direction=H.getOption("direction"),B.className="CodeMirror-placeholder CodeMirror-line-like";var O=H.getOption("placeholder");typeof O=="string"&&(O=document.createTextNode(O)),B.appendChild(O),H.display.lineSpace.insertBefore(B,H.display.lineSpace.firstChild)}function J(H){setTimeout(function(){var B=!1,O=H.getInputField();O.nodeName=="TEXTAREA"?B=!O.value:H.lineCount()==1&&(B=!/[^\u200b]/.test(O.querySelector(".CodeMirror-line").textContent)),B?_(H):Z(H)},20)}function U(H){z(H)&&_(H)}function D(H){var B=H.getWrapperElement(),O=z(H);B.className=B.className.replace(" CodeMirror-empty","")+(O?" CodeMirror-empty":""),O?_(H):Z(H)}function z(H){return H.lineCount()===1&&H.getLine(0)===""}})},"1eCo":function(pt,at,pe){(function(fe){fe(pe("VrN/"))})(function(fe){"use strict";var Z={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},_={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};fe.defineMode("xml",function(J,U){var D=J.indentUnit,z={},H=U.htmlMode?Z:_;for(var B in H)z[B]=H[B];for(var B in U)z[B]=U[B];var O,b;function A(a,E){function g(W){return E.tokenize=W,W(a,E)}var S=a.next();if(S=="<")return a.eat("!")?a.eat("[")?a.match("CDATA[")?g(w("atom","]]>")):null:a.match("--")?g(w("comment","-->")):a.match("DOCTYPE",!0,!0)?(a.eatWhile(/[\w\._\-]/),g(y(1))):null:a.eat("?")?(a.eatWhile(/[\w\._\-]/),E.tokenize=w("meta","?>"),"meta"):(O=a.eat("/")?"closeTag":"openTag",E.tokenize=P,"tag bracket");if(S=="&"){var F;return a.eat("#")?a.eat("x")?F=a.eatWhile(/[a-fA-F\d]/)&&a.eat(";"):F=a.eatWhile(/[\d]/)&&a.eat(";"):F=a.eatWhile(/[\w\.\-:]/)&&a.eat(";"),F?"atom":"error"}else return a.eatWhile(/[^&<]/),null}A.isInText=!0;function P(a,E){var g=a.next();if(g==">"||g=="/"&&a.eat(">"))return E.tokenize=A,O=g==">"?"endTag":"selfcloseTag","tag bracket";if(g=="=")return O="equals",null;if(g=="<"){E.tokenize=A,E.state=u,E.tagName=E.tagStart=null;var S=E.tokenize(a,E);return S?S+" tag error":"tag error"}else return/[\'\"]/.test(g)?(E.tokenize=L(g),E.stringStartCol=a.column(),E.tokenize(a,E)):(a.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function L(a){var E=function(g,S){for(;!g.eol();)if(g.next()==a){S.tokenize=P;break}return"string"};return E.isInAttribute=!0,E}function w(a,E){return function(g,S){for(;!g.eol();){if(g.match(E)){S.tokenize=A;break}g.next()}return a}}function y(a){return function(E,g){for(var S;(S=E.next())!=null;){if(S=="<")return g.tokenize=y(a+1),g.tokenize(E,g);if(S==">")if(a==1){g.tokenize=A;break}else return g.tokenize=y(a-1),g.tokenize(E,g)}return"meta"}}function h(a,E,g){this.prev=a.context,this.tagName=E,this.indent=a.indented,this.startOfLine=g,(z.doNotIndent.hasOwnProperty(E)||a.context&&a.context.noIndent)&&(this.noIndent=!0)}function o(a){a.context&&(a.context=a.context.prev)}function l(a,E){for(var g;;){if(!a.context)return;if(g=a.context.tagName,!z.contextGrabbers.hasOwnProperty(g)||!z.contextGrabbers[g].hasOwnProperty(E))return;o(a)}}function u(a,E,g){return a=="openTag"?(g.tagStart=E.column(),C):a=="closeTag"?v:u}function C(a,E,g){return a=="word"?(g.tagName=E.current(),b="tag",x):z.allowMissingTagName&&a=="endTag"?(b="tag bracket",x(a,E,g)):(b="error",C)}function v(a,E,g){if(a=="word"){var S=E.current();return g.context&&g.context.tagName!=S&&z.implicitlyClosed.hasOwnProperty(g.context.tagName)&&o(g),g.context&&g.context.tagName==S||z.matchClosing===!1?(b="tag",m):(b="tag error",k)}else return z.allowMissingTagName&&a=="endTag"?(b="tag bracket",m(a,E,g)):(b="error",k)}function m(a,E,g){return a!="endTag"?(b="error",m):(o(g),u)}function k(a,E,g){return b="error",m(a,E,g)}function x(a,E,g){if(a=="word")return b="attribute",f;if(a=="endTag"||a=="selfcloseTag"){var S=g.tagName,F=g.tagStart;return g.tagName=g.tagStart=null,a=="selfcloseTag"||z.autoSelfClosers.hasOwnProperty(S)?l(g,S):(l(g,S),g.context=new h(g,S,F==g.indented)),u}return b="error",x}function f(a,E,g){return a=="equals"?p:(z.allowMissing||(b="error"),x(a,E,g))}function p(a,E,g){return a=="string"?d:a=="word"&&z.allowUnquoted?(b="string",x):(b="error",x(a,E,g))}function d(a,E,g){return a=="string"?d:x(a,E,g)}return{startState:function(a){var E={tokenize:A,state:u,indented:a||0,tagName:null,tagStart:null,context:null};return a!=null&&(E.baseIndent=a),E},token:function(a,E){if(!E.tagName&&a.sol()&&(E.indented=a.indentation()),a.eatSpace())return null;O=null;var g=E.tokenize(a,E);return(g||O)&&g!="comment"&&(b=null,E.state=E.state(O||g,a,E),b&&(g=b=="error"?g+" error":b)),g},indent:function(a,E,g){var S=a.context;if(a.tokenize.isInAttribute)return a.tagStart==a.indented?a.stringStartCol+1:a.indented+D;if(S&&S.noIndent)return fe.Pass;if(a.tokenize!=P&&a.tokenize!=A)return g?g.match(/^(\s*)/)[0].length:0;if(a.tagName)return z.multilineTagIndentPastTag!==!1?a.tagStart+a.tagName.length+2:a.tagStart+D*(z.multilineTagIndentFactor||1);if(z.alignCDATA&&/<!\[CDATA\[/.test(E))return 0;var F=E&&/^<(\/)?([\w_:\.-]*)/.exec(E);if(F&&F[1])for(;S;)if(S.tagName==F[2]){S=S.prev;break}else if(z.implicitlyClosed.hasOwnProperty(S.tagName))S=S.prev;else break;else if(F)for(;S;){var W=z.contextGrabbers[S.tagName];if(W&&W.hasOwnProperty(F[2]))S=S.prev;else break}for(;S&&S.prev&&!S.startOfLine;)S=S.prev;return S?S.indent+D:a.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:z.htmlMode?"html":"xml",helperType:z.htmlMode?"html":"xml",skipAttribute:function(a){a.state==p&&(a.state=x)},xmlCurrentTag:function(a){return a.tagName?{name:a.tagName,close:a.type=="closeTag"}:null},xmlCurrentContext:function(a){for(var E=[],g=a.context;g;g=g.prev)g.tagName&&E.push(g.tagName);return E.reverse()}}}),fe.defineMIME("text/xml","xml"),fe.defineMIME("application/xml","xml"),fe.mimeModes.hasOwnProperty("text/html")||fe.defineMIME("text/html",{name:"xml",htmlMode:!0})})},"7Cbv":function(pt,at,pe){"use strict";var fe=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),Z=new Uint8Array(16);function _(){if(!fe)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return fe(Z)}var J=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function U(P){return typeof P=="string"&&J.test(P)}for(var D=U,z=[],H=0;H<256;++H)z.push((H+256).toString(16).substr(1));function B(P){var L=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,w=(z[P[L+0]]+z[P[L+1]]+z[P[L+2]]+z[P[L+3]]+"-"+z[P[L+4]]+z[P[L+5]]+"-"+z[P[L+6]]+z[P[L+7]]+"-"+z[P[L+8]]+z[P[L+9]]+"-"+z[P[L+10]]+z[P[L+11]]+z[P[L+12]]+z[P[L+13]]+z[P[L+14]]+z[P[L+15]]).toLowerCase();if(!D(w))throw TypeError("Stringified UUID is invalid");return w}var O=B;function b(P,L,w){P=P||{};var y=P.random||(P.rng||_)();if(y[6]=y[6]&15|64,y[8]=y[8]&63|128,L){w=w||0;for(var h=0;h<16;++h)L[w+h]=y[h];return L}return O(y)}var A=at.a=b},"7ahc":function(pt,at,pe){"use strict";pe.d(at,"a",function(){return C});var fe=pe("k1fw"),Z=pe("0Owb"),_=pe("+L6B"),J=pe("2/Rp"),U=pe("y8nQ"),D=pe("Vl3Y"),z=pe("tJVT"),H=pe("OaEy"),B=pe("2fM7"),O=pe("q1tI"),b=pe.n(O),A=pe("VrN/"),P=pe.n(A),L=pe("p77/"),w=pe.n(L),y=pe("c5Ni"),h=pe.n(y),o=B.a.Option,l={labelCol:{span:4},wrapperCol:{span:20}},u={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(v){var m=v.callback,k=v.onCancel,x=Object(O.useState)("python"),f=Object(z.a)(x,2),p=f[0],d=f[1];function a(g){d(u[g][1])}function E(g){m(g)}return b.a.createElement(D.a,Object(Z.a)({},l,{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:E}),b.a.createElement(D.a.Item,{label:"\u4EE3\u7801\u8BED\u8A00",name:"language"},b.a.createElement(B.a,{onChange:a},Object.keys(u).map(function(g){return b.a.createElement(o,{key:g,value:g},u[g][0])}))),b.a.createElement(D.a.Item,{label:"\u4EE3\u7801\u5185\u5BB9",name:"content",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EE3\u7801\u5185\u5BB9"}]},b.a.createElement(C,{mode:p})),b.a.createElement("div",{className:"flex-container flex-end"},b.a.createElement(J.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),b.a.createElement(J.a,{type:"ghost",onClick:k},"\u53D6\u6D88")))};function C(v){var m=v.value,k=v.onChange,x=v.mode,f=v.options,p=f===void 0?{}:f,d=Object(O.useRef)(),a=Object(O.useState)(),E=Object(z.a)(a,2),g=E[0],S=E[1];return Object(O.useEffect)(function(){if(g){function F(W){var K=W.getValue();k&&k(K)}return g.on("change",F),function(){g.off("change",F)}}},[g,k]),Object(O.useEffect)(function(){g&&g.setOption("mode",x)},[g,x]),Object(O.useEffect)(function(){g&&((m!==g.getValue()||m==="")&&setTimeout(function(){g.setValue(m||" ")},300))},[g,m]),Object(O.useEffect)(function(){if(d.current&&!g){var F=P.a.fromTextArea(d.current,Object(fe.a)({mode:x,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},p));S(F)}},[d.current,g]),b.a.createElement("div",{className:"my-codemirror-container"},b.a.createElement("textarea",{ref:d}))}},"8EBN":function(pt,at,pe){(function(fe){fe(pe("VrN/"))})(function(fe){"use strict";fe.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 Z=0;Z<fe.modeInfo.length;Z++){var _=fe.modeInfo[Z];_.mimes&&(_.mime=_.mimes[0])}fe.findModeByMIME=function(J){J=J.toLowerCase();for(var U=0;U<fe.modeInfo.length;U++){var D=fe.modeInfo[U];if(D.mime==J)return D;if(D.mimes){for(var z=0;z<D.mimes.length;z++)if(D.mimes[z]==J)return D}}if(/\+xml$/.test(J))return fe.findModeByMIME("application/xml");if(/\+json$/.test(J))return fe.findModeByMIME("application/json")},fe.findModeByExtension=function(J){J=J.toLowerCase();for(var U=0;U<fe.modeInfo.length;U++){var D=fe.modeInfo[U];if(D.ext){for(var z=0;z<D.ext.length;z++)if(D.ext[z]==J)return D}}},fe.findModeByFileName=function(J){for(var U=0;U<fe.modeInfo.length;U++){var D=fe.modeInfo[U];if(D.file&&D.file.test(J))return D}var z=J.lastIndexOf("."),H=z>-1&&J.substring(z+1,J.length);if(H)return fe.findModeByExtension(H)},fe.findModeByName=function(J){J=J.toLowerCase();for(var U=0;U<fe.modeInfo.length;U++){var D=fe.modeInfo[U];if(D.name.toLowerCase()==J)return D;if(D.alias){for(var z=0;z<D.alias.length;z++)if(D.alias[z].toLowerCase()==J)return D}}}})},"8hTe":function(pt,at,pe){pt.exports={button:"button___1wy9m"}},"9Bee":function(pt,at,pe){"use strict";var fe=pe("DYRE"),Z=pe("zeV3"),_=pe("+L6B"),J=pe("2/Rp"),U=pe("k1fw"),D=pe("9og8"),z=pe("tJVT"),H=pe("WmNS"),B=pe.n(H),O=pe("q1tI"),b=pe.n(O),A=pe("vg9a"),P=pe("DlQD"),L=pe.n(P),w=pe("rUJ1");function y(se,q){var ee=se.match(/^(\s+)(?:```)/);if(ee===null)return q;var ne=ee[1];return q.split(`
|
|
`).map(function(le){var te=le.match(/^\s+/);if(te===null)return le;var ie=Object(z.a)(te,1),ue=ie[0];return ue.length>=ne.length?le.slice(ne.length):le}).join(`
|
|
`)}var h=[],o=["<ul>"],l=new L.a.Renderer,u=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function C(){h.length=0,o=["<ul>"]}var v={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function m(se,q,ee,ne){if(q>=se.length||se[q].level<=ee)return q;var le=se[q];ne.push("<li><a href='#"+le.anchor+"'>"+le.text+"</a>"),q++;var te=[];return q=m(se,q,le.level,te),te.length>0&&(ne.push("<ul>"),te.forEach(function(ie){ne.push(ie)}),ne.push("</ul>")),ne.push("</li>"),q=m(se,q,ee,ne),q}function k(){return m(h,0,0,o),o.push("</ul>"),o.join("")}var x={heading:function(q){var ee=u.exec(q);if(ee)return{type:"heading",raw:ee[0],depth:ee[1].length,text:ee[2]}},fences:function(q){var ee=this.rules.block.fences.exec(q);if(ee){var ne=ee[0],le=y(ne,ee[3]||""),te=ee[2]?ee[2].trim():ee[2];if(["latex","katex","math"].indexOf(te)>=0){var ie=d(),ue=le;le=ie,a[ie]={type:"block",expression:ue}}return{type:"code",raw:ne,lang:te,text:le}}}},f=/(?:\${2})([^\n`]+?)(?:\${2})/gi,p=0,d=function(){return"__special_katext_id_".concat(p++,"__")},a={};function E(){return a}function g(){p=0,a={}}function S(se){return se=se.replace(f,function(q,ee){var ne=d();return a[ne]={type:"inline",expression:ee},ne}),se}var F=l.listitem;l.listitem=function(se){return F(S(se))};var W=l.paragraph;l.paragraph=function(se){return W(S(se))};var K=l.tablecell;l.tablecell=function(se,q){return K(S(se),q)},l.code=function(se,q,ee){var ne=(q||"").match(/\S*/)[0];return ne?["latex","katex","math"].indexOf(ne)>=0?"<p class='editormd-tex'>".concat(se,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(q,'">').concat(ee?se:Object(w.escape)(se,!0),`</code></pre>
|
|
`):'<pre class="prettyprint linenums"><code>'+(ee?se:Object(w.escape)(se,!0))+"</code></pre>"},l.heading=function(se,q,ee){var ne=this.options.headerPrefix+ee.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return h.push({anchor:ne,level:q,text:se}),"<h"+q+' id="'+ne+'">'+se+"</h"+q+">"},L.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),L.a.use({tokenizer:x,renderer:l});var V=L.a,M=pe("SJMd"),I=pe("ulZh"),$=pe.n(I),ae=pe("m3rI"),he=pe("Oy/b"),ge=pe("p5ED"),De=pe("ErOA"),Se=pe("STEk");/* **********************************
|
|
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 Re=function(se,q){return(Re=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(ee,ne){ee.__proto__=ne}||function(ee,ne){for(var le in ne)Object.prototype.hasOwnProperty.call(ne,le)&&(ee[le]=ne[le])})(se,q)};function Ce(se,q){if(typeof q!="function"&&q!==null)throw new TypeError("Class extends value "+String(q)+" is not a constructor or null");function ee(){this.constructor=se}Re(se,q),se.prototype=q===null?Object.create(q):(ee.prototype=q.prototype,new ee)}function xe(se,q,ee,ne){return new(ee||(ee=Promise))(function(le,te){function ie(ye){try{de(ne.next(ye))}catch(Ee){te(Ee)}}function ue(ye){try{de(ne.throw(ye))}catch(Ee){te(Ee)}}function de(ye){var Ee;ye.done?le(ye.value):(Ee=ye.value,Ee instanceof ee?Ee:new ee(function(Pe){Pe(Ee)})).then(ie,ue)}de((ne=ne.apply(se,q||[])).next())})}function me(se,q){var ee,ne,le,te,ie={label:0,sent:function(){if(1&le[0])throw le[1];return le[1]},trys:[],ops:[]};return te={next:ue(0),throw:ue(1),return:ue(2)},typeof Symbol=="function"&&(te[Symbol.iterator]=function(){return this}),te;function ue(de){return function(ye){return function(Ee){if(ee)throw new TypeError("Generator is already executing.");for(;ie;)try{if(ee=1,ne&&(le=2&Ee[0]?ne.return:Ee[0]?ne.throw||((le=ne.return)&&le.call(ne),0):ne.next)&&!(le=le.call(ne,Ee[1])).done)return le;switch(ne=0,le&&(Ee=[2&Ee[0],le.value]),Ee[0]){case 0:case 1:le=Ee;break;case 4:return ie.label++,{value:Ee[1],done:!1};case 5:ie.label++,ne=Ee[1],Ee=[0];continue;case 7:Ee=ie.ops.pop(),ie.trys.pop();continue;default:if(!(le=ie.trys,(le=le.length>0&&le[le.length-1])||Ee[0]!==6&&Ee[0]!==2)){ie=0;continue}if(Ee[0]===3&&(!le||Ee[1]>le[0]&&Ee[1]<le[3])){ie.label=Ee[1];break}if(Ee[0]===6&&ie.label<le[1]){ie.label=le[1],le=Ee;break}if(le&&ie.label<le[2]){ie.label=le[2],ie.ops.push(Ee);break}le[2]&&ie.ops.pop(),ie.trys.pop();continue}Ee=q.call(se,ie)}catch(Pe){Ee=[6,Pe],ne=0}finally{ee=le=0}if(5&Ee[0])throw Ee[1];return{value:Ee[0]?Ee[1]:void 0,done:!0}}([de,ye])}}}var G=function(){function se(){}return se.addKey=function(q){se.key=q},Object.defineProperty(se,"isLicensed",{get:function(){return!!se.key&&new RegExp(/^CRPR-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(se.key)},enumerable:!1,configurable:!0}),se}(),s=function(){function se(){}return se.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},se.setAttributes=function(q,ee){for(var ne=0,le=ee;ne<le.length;ne++){var te=le[ne],ie=te[0],ue=te[1];q.setAttribute(ie,ue)}},se.createRect=function(q,ee,ne){var le=document.createElementNS("http://www.w3.org/2000/svg","rect");return le.setAttribute("width",q.toString()),le.setAttribute("height",ee.toString()),ne&&se.setAttributes(le,ne),le},se.createLine=function(q,ee,ne,le,te){var ie=document.createElementNS("http://www.w3.org/2000/svg","line");return ie.setAttribute("x1",q.toString()),ie.setAttribute("y1",ee.toString()),ie.setAttribute("x2",ne.toString()),ie.setAttribute("y2",le.toString()),te&&se.setAttributes(ie,te),ie},se.createPolygon=function(q,ee){var ne=document.createElementNS("http://www.w3.org/2000/svg","polygon");return ne.setAttribute("points",q),ee&&se.setAttributes(ne,ee),ne},se.createCircle=function(q,ee){var ne=document.createElementNS("http://www.w3.org/2000/svg","circle");return ne.setAttribute("cx",(q/2).toString()),ne.setAttribute("cy",(q/2).toString()),ne.setAttribute("r",q.toString()),ee&&se.setAttributes(ne,ee),ne},se.createEllipse=function(q,ee,ne){var le=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return le.setAttribute("cx",(q/2).toString()),le.setAttribute("cy",(ee/2).toString()),le.setAttribute("rx",(q/2).toString()),le.setAttribute("ry",(ee/2).toString()),ne&&se.setAttributes(le,ne),le},se.createGroup=function(q){var ee=document.createElementNS("http://www.w3.org/2000/svg","g");return q&&se.setAttributes(ee,q),ee},se.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},se.createMarker=function(q,ee,ne,le,te,ie,ue){var de=document.createElementNS("http://www.w3.org/2000/svg","marker");return se.setAttributes(de,[["id",q],["orient",ee],["markerWidth",ne.toString()],["markerHeight",le.toString()],["refX",te.toString()],["refY",ie.toString()]]),de.appendChild(ue),de},se.createText=function(q){var ee=document.createElementNS("http://www.w3.org/2000/svg","text");return ee.setAttribute("x","0"),ee.setAttribute("y","0"),q&&se.setAttributes(ee,q),ee},se.createTSpan=function(q,ee){var ne=document.createElementNS("http://www.w3.org/2000/svg","tspan");return ne.textContent=q,ee&&se.setAttributes(ne,ee),ne},se.createImage=function(q){var ee=document.createElementNS("http://www.w3.org/2000/svg","image");return q&&se.setAttributes(ee,q),ee},se.createPoint=function(q,ee){var ne=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return ne.x=q,ne.y=ee,ne},se.createPath=function(q,ee){var ne=document.createElementNS("http://www.w3.org/2000/svg","path");return ne.setAttribute("d",q),ee&&se.setAttributes(ne,ee),ne},se.createElement=function(q,ee){var ne=document.createElementNS("http://www.w3.org/2000/svg",q);return ee&&se.setAttributes(ne,ee),ne},se.getHollowRectanglePath=function(q,ee,ne,le,te,ie,ue,de){return"M"+q+","+ee+"V"+(ee+le)+"H"+(q+ne)+"V"+ee+"H"+te+"V"+ie+"H"+(te+ue)+"V"+(ie+de)+"H"+te+"V"+ee+"Z"},se}(),c=function(){function se(q){this._classNamePrefixBase="__cropro_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+q+"_"}return Object.defineProperty(se.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(se.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(se.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"_fade_out"},enumerable:!1,configurable:!0}),se.prototype.addClass=function(q){return this.styleSheet===void 0&&this.addStyleSheet(),q.name=""+this.classNamePrefix+q.localName,this.classes.push(q),this.styleSheet.sheet.insertRule("."+q.name+" {"+q.style+"}",this.styleSheet.sheet.cssRules.length),q},se.prototype.addRule=function(q){this.styleSheet===void 0&&this.addStyleSheet(),this.rules.push(q),this.styleSheet.sheet.insertRule(q.selector+" {"+q.style+"}",this.styleSheet.sheet.cssRules.length)},se.prototype.addStyleSheet=function(){var q;this.styleSheet=document.createElement("style"),((q=this.styleSheetRoot)!==null&&q!==void 0?q:document.head).appendChild(this.styleSheet),this.addRule(new R("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new R("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
|
|
from {
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
}
|
|
`)),this.addRule(new R("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
|
|
from {
|
|
opacity: 1;
|
|
}
|
|
to {
|
|
opacity: 0;
|
|
}
|
|
`)),this.addClass(new X("_fade_in",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
|
|
`)),this.addClass(new X("_fade_out",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
|
|
`))},se.prototype.removeStyleSheet=function(){var q;this.styleSheet&&(((q=this.styleSheetRoot)!==null&&q!==void 0?q:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},se}(),R=function(se,q){this.selector=se,this.style=q},X=function(se,q){this.localName=se,this.style=q},N=function(){function se(){this.blocks=[],this.display=""}return se.prototype.addButtonBlock=function(q){q.className=this.blockClassName,q.buttonClassName=this.buttonClassName,q.buttonColorsClassName=this.buttonColorsClassName,q.buttonActiveColorsClassName=this.buttonActiveColorsClassName,this.blocks.push(q)},se.prototype.addElementBlock=function(q){q.className===void 0&&(q.className=this.blockClassName),this.blocks.push(q)},se.prototype.getUI=function(){var q=document.createElement("div");return q.className=this.className+" "+this.colorsClassName+" "+this.fadeInClassName,q.style.display=this.display,this.blocks.forEach(function(ee){return q.appendChild(ee.getUI())}),q},se}(),oe=function(){function se(){}return se.prototype.getUI=function(){var q=document.createElement("div");if(q.className=this.className,this.minWidth!==void 0&&(q.style.minWidth=this.minWidth),this.contentAlign!==void 0)switch(this.contentAlign){case"start":q.style.justifyContent="flex-start";break;case"center":q.style.justifyContent="center";break;case"end":q.style.justifyContent="flex-end"}return q.style.whiteSpace="nowrap",q},se}(),be=function(se){function q(){var ee=se!==null&&se.apply(this,arguments)||this;return ee.buttons=[],ee}return Ce(q,se),q.prototype.addButton=function(ee){ee.className=this.buttonClassName,ee.colorsClassName=this.buttonColorsClassName,ee.activeColorsClassName=this.buttonActiveColorsClassName,this.buttons.push(ee)},q.prototype.getUI=function(){var ee=se.prototype.getUI.call(this);return this.buttons.forEach(function(ne){return ee.appendChild(ne.getUI())}),ee},q}(oe),we=function(){function se(q,ee){this._isActive=!1,this._isHidden=!1,this._icon=q,this.title=ee,this.uiContainer=document.createElement("div"),this.adjustClassName=this.adjustClassName.bind(this)}return Object.defineProperty(se.prototype,"icon",{get:function(){return this._icon},set:function(q){this._icon=q,this.buttonContainer.innerHTML=this._icon},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"isActive",{get:function(){return this._isActive},set:function(q){this._isActive=q,this.adjustClassName()},enumerable:!1,configurable:!0}),se.prototype.getUI=function(){var q=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 q.onClick()}),this.uiContainer.appendChild(this.buttonContainer),this.uiContainer.style.display=this._isHidden?"none":"inline-block",this.uiContainer},se.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,"")))},se.prototype.hide=function(){this._isHidden=!0},se}(),_e=function(se){function q(){var ee=se!==null&&se.apply(this,arguments)||this;return ee.elements=[],ee}return Ce(q,se),q.prototype.addElement=function(ee){this.elements.push(ee)},q.prototype.getUI=function(){var ee=se.prototype.getUI.call(this);return this.elements.forEach(function(ne){return ee.appendChild(ne)}),ee},q}(oe),Le=function(){function se(q,ee){this.horizontal=q,this.vertical=ee}return Object.defineProperty(se.prototype,"ratio",{get:function(){return 1*this.horizontal/this.vertical},enumerable:!1,configurable:!0}),se.prototype.getVerticalLength=function(q){return q/this.ratio},se.prototype.getHorizontalLength=function(q){return q*this.ratio},se}(),Oe=function(){function se(){}return se.getIcon=function(q,ee){if(q>0&&ee>0){var ne=new Le(q,ee),le=ne.ratio>=1?20:ne.getHorizontalLength(20),te=ne.ratio<1?20:ne.getVerticalLength(20),ie=document.createElementNS("http://www.w3.org/2000/svg","svg");ie.setAttribute("xmlns","http://www.w3.org/2000/svg"),ie.setAttribute("viewBox","0 0 24 24"),document.body.appendChild(ie);var ue=s.createDefs();ie.appendChild(ue);var de=s.createElement("clipPath",[["id","text-bg-clip"]]);ue.appendChild(de);var ye=s.createPath(s.getHollowRectanglePath((24-le)/2,(24-te)/2,le,te,(24-le)/2+2,(24-te)/2+2,le-4,te-4));ie.appendChild(ye);var Ee=s.createText([["x","0"],["y","0"],["font-size","7px"],["font-family","monospace"]]);Ee.appendChild(s.createTSpan(q+":"+ee)),ie.appendChild(Ee);var Pe=Ee.getBBox();s.setAttributes(Ee,[["x",((24-Pe.width)/2).toString()],["y",((24-Pe.height)/2-Pe.y).toString()]]);var Ue=s.createPath(s.getHollowRectanglePath(0,0,24,24,(24-Math.ceil(Pe.width))/2,(24-Math.ceil(Pe.height))/2,Math.ceil(Pe.width),Math.ceil(Pe.height)));return de.appendChild(Ue),s.setAttributes(ye,[["clip-path","url(#text-bg-clip)"]]),document.body.removeChild(ie),ie.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>'},se}(),Me=function(se){function q(ee,ne,le){var te=se.call(this,ee,ne)||this;return te.isDropdownOpen=!1,te.onClick=te.dropdownButtonClicked,te.dropdownButtons=le,te}return Ce(q,se),q.prototype.setupDropdown=function(){var ee=this;this.dropdownBlock=document.createElement("div"),this.dropdownBlock.className=this.dropdownClassName+" "+this.dropdownColorsClassName,this.dropdownBlock.style.display="none",this.dropdownButtons.forEach(function(ne){ne.className=ee.className,ne.colorsClassName=ee.colorsClassName,ee.dropdownBlock.appendChild(ne.getUI())}),this.uiContainer.appendChild(this.dropdownBlock)},q.prototype.positionDropdown=function(){this.dropdownBlock.style.left=this.uiContainer.clientLeft+"px",this.dropdownBlock.style.top=this.uiContainer.clientTop+this.uiContainer.clientHeight+"px"},q.prototype.dropdownButtonClicked=function(){this.dropdownBlock===void 0&&this.setupDropdown(),this.isDropdownOpen=!this.isDropdownOpen,this.toggleDropdown()},q.prototype.toggleDropdown=function(){this.positionDropdown(),this.dropdownBlock.style.display=this.isDropdownOpen?"inline-block":"none"},q.prototype.showDropdown=function(){this.isDropdownOpen=!0,this.toggleDropdown()},q.prototype.hideDropdown=function(){this.isDropdownOpen=!1,this.toggleDropdown()},q}(we),Be=function(){function se(q,ee){this.GRIP_SIZE=10,this.color=q,this.fillColor=ee,this.visual=s.createGroup(),this.visual.appendChild(s.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(s.createCircle(this.GRIP_SIZE,[["fill",this.fillColor],["fill-opacity","0.9"],["stroke",this.color],["stroke-width","2"],["stroke-opacity","0.7"]]))}return se.prototype.ownsTarget=function(q){return q===this.visual||q===this.visual.childNodes[0]||q===this.visual.childNodes[1]},se.prototype.setCenter=function(q,ee){this.visual.childNodes.forEach(function(ne){return s.setAttributes(ne,[["cx",q.toString()],["cy",ee.toString()]])})},se}(),Ve=function(){function se(q,ee,ne,le){this.isMoving=!1,this._isGridVisible=!0,this.numberOfGridLines=2,this.horizontalGridLines=[],this.verticalGridLines=[],this._zoomFactor=1,this.cropRectChanged=!1,this.canvasWidth=q,this.canvasHeight=ee,this.margin=ne,this.container=le,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(se.prototype,"aspectRatio",{get:function(){return this._aspectRatio},set:function(q){this._aspectRatio=q,this.adjustCropRect(),this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(q){this._isGridVisible=q,this.gridContainer&&s.setAttributes(this.gridContainer,[["display",this._isGridVisible?"":"none"]])},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"zoomFactor",{get:function(){return this._zoomFactor},set:function(q){this._zoomFactor=q,this.setCropRectangle(this.cropRect)},enumerable:!1,configurable:!0}),se.prototype.open=function(){var q=this;this.cropShadeElement=s.createPath("M0,0Z",[["fill",this.cropShadeColor],["fill-opacity","0.8"]]),this.container.appendChild(this.cropShadeElement),this.gridContainer=s.createGroup([["display",this.isGridVisible?"":"none"]]),this.container.appendChild(this.gridContainer);for(var ee=0;ee<this.numberOfGridLines;ee++)this.horizontalGridLines.push(s.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]])),this.verticalGridLines.push(s.createLine(0,0,0,0,[["stroke",this.cropFrameColor],["stroke-width","1"],["stroke-dasharray","3 1"],["opacity","0.7"]]));this.horizontalGridLines.forEach(function(ne){return q.gridContainer.appendChild(ne)}),this.verticalGridLines.forEach(function(ne){return q.gridContainer.appendChild(ne)}),this.cropRectElement=s.createRect(0,0,[["stroke",this.cropFrameColor],["stroke-width","3"],["fill","transparent"]]),this.container.appendChild(this.cropRectElement),this.topLeftGrip=new Be(this.gripColor,this.gripFillColor),this.container.appendChild(this.topLeftGrip.visual),this.topRightGrip=new Be(this.gripColor,this.gripFillColor),this.container.appendChild(this.topRightGrip.visual),this.bottomLeftGrip=new Be(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomLeftGrip.visual),this.bottomRightGrip=new Be(this.gripColor,this.gripFillColor),this.container.appendChild(this.bottomRightGrip.visual),this.attachEvents()},se.prototype.setCropRectangle=function(q){this.cropRect=q;var ee=Object.assign({},this.cropRect);this.zoomFactor!==1&&(ee.width=this.cropRect.width*this.zoomFactor,ee.height=this.cropRect.height*this.zoomFactor,ee.x=this.cropRect.height/this.cropRect.width<this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasWidth/2-ee.width/2,ee.y=this.cropRect.height/this.cropRect.width>this.canvasHeight/this.canvasWidth?this.margin:this.margin+this.canvasHeight/2-ee.height/2),s.setAttributes(this.cropRectElement,[["x",ee.x.toString()],["y",ee.y.toString()],["width",ee.width.toString()],["height",ee.height.toString()]]);var ne=ee.height/(this.numberOfGridLines+1);this.horizontalGridLines.forEach(function(te,ie){var ue=ee.y+ne*(ie+1);s.setAttributes(te,[["x1",""+ee.x],["y1",""+ue],["x2",""+(ee.x+ee.width)],["y2",""+ue]])});var le=ee.width/(this.numberOfGridLines+1);this.verticalGridLines.forEach(function(te,ie){var ue=ee.x+le*(ie+1);s.setAttributes(te,[["x1",""+ue],["y1",""+ee.y],["x2",""+ue],["y2",""+(ee.y+ee.height)]])}),s.setAttributes(this.cropShadeElement,[["d",s.getHollowRectanglePath(0,0,this.canvasWidth+2*this.margin,this.canvasHeight+2*this.margin,ee.x,ee.y,ee.width,ee.height)]]),this.topLeftGrip.setCenter(ee.x,ee.y),this.topRightGrip.setCenter(ee.x+ee.width,ee.y),this.bottomLeftGrip.setCenter(ee.x,ee.y+ee.height),this.bottomRightGrip.setCenter(ee.x+ee.width,ee.y+ee.height),this.cropRectChanged&&this.onCropChange&&(this.cropRectChanged=!1,this.onCropChange(this.cropRect)),this.cropRectChanged=!1},se.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)},se.prototype.clientToLocalCoordinates=function(q,ee){var ne=this.container.getBoundingClientRect();return{x:q-ne.left+this.margin,y:ee-ne.top+this.margin}},se.prototype.onPointerDown=function(q){this.container.setPointerCapture(q.pointerId),this.previousPoint=this.clientToLocalCoordinates(q.clientX,q.clientY),this.cropRectElement===q.target?this.isMoving=!0:this.topLeftGrip.ownsTarget(q.target)?this.activeGrip=this.topLeftGrip:this.bottomLeftGrip.ownsTarget(q.target)?this.activeGrip=this.bottomLeftGrip:this.topRightGrip.ownsTarget(q.target)?this.activeGrip=this.topRightGrip:this.bottomRightGrip.ownsTarget(q.target)&&(this.activeGrip=this.bottomRightGrip)},se.prototype.onPointerMove=function(q){if(this.isMoving)this.move(this.clientToLocalCoordinates(q.clientX,q.clientY));else if(this.activeGrip){var ee=this.clientToLocalCoordinates(q.clientX,q.clientY);this.resize(ee)}q.preventDefault()},se.prototype.onPointerUp=function(q){this.activeGrip=void 0,this.isMoving=!1,this.container.releasePointerCapture(q.pointerId)},se.prototype.move=function(q){var ee=q.x-this.previousPoint.x,ne=q.y-this.previousPoint.y;this.zoomFactor!==1&&(ee=-ee/this.zoomFactor,ne=-ne/this.zoomFactor),this.cropRect.x=Math.min(Math.max(this.margin,this.cropRect.x+ee),this.canvasWidth-this.cropRect.width+this.margin),this.cropRect.y=Math.min(Math.max(this.margin,this.cropRect.y+ne),this.canvasHeight-this.cropRect.height+this.margin),this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect),this.previousPoint=q},se.prototype.resize=function(q){var ee=Object.assign({},this.cropRect),ne=q.x-this.previousPoint.x,le=q.y-this.previousPoint.y;switch(this.activeGrip){case this.bottomLeftGrip:case this.topLeftGrip:ee.x+ne<this.margin&&(ne=this.margin-ee.x),ee.x+=ne,ee.width=this.cropRect.x+this.cropRect.width-ee.x;break;case this.bottomRightGrip:case this.topRightGrip:ee.width+ne>this.canvasWidth*this.zoomFactor&&(ne=this.canvasWidth*this.zoomFactor-ee.width),ee.width+=ne}switch(this.activeGrip){case this.topLeftGrip:case this.topRightGrip:this.aspectRatio?(ee.y=this.cropRect.y-(this.activeGrip===this.topLeftGrip?-1:1)*this.aspectRatio.getVerticalLength(ne),ee.height=this.aspectRatio.getVerticalLength(ee.width)):(ee.y+=le,ee.height=this.cropRect.y+this.cropRect.height-ee.y);break;case this.bottomLeftGrip:case this.bottomRightGrip:this.aspectRatio?ee.height=this.aspectRatio.getVerticalLength(ee.width):ee.height+=le}ee.width<10&&(ee.x=this.cropRect.x,ee.width=10),ee.height<10&&(ee.y=this.cropRect.y,ee.height=10),this.previousPoint=q,ee.x>=this.margin&&ee.y>=this.margin&&ee.x-this.margin+ee.width<=this.canvasWidth&&ee.y-this.margin+ee.height<=this.canvasHeight&&(this.cropRect=ee,this.onCropChange?(this.cropRectChanged=!0,this.onCropChange(this.cropRect)):this.setCropRectangle(this.cropRect))},se.prototype.adjustCropRect=function(){if(this.aspectRatio&&Math.round(this.cropRect.height)!==Math.round(this.aspectRatio.getVerticalLength(this.cropRect.width))){var q=this.cropRect.x+this.cropRect.width/2,ee=this.cropRect.y+this.cropRect.height/2,ne=this.aspectRatio.getHorizontalLength(this.cropRect.height),le=this.aspectRatio.getVerticalLength(this.cropRect.width);ne/this.canvasWidth<le/this.canvasHeight?this.cropRect.width=ne:this.cropRect.height=le,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=q-this.cropRect.width/2,this.cropRect.y=ee-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)}},se.prototype.getRescaledRect=function(q,ee,ne,le,te,ie){var ue=ne/q,de=le/ee;return{x:(te.x-ie)*ue+ie,y:(te.y-ie)*de+ie,width:te.width*ue,height:te.height*de}},se.prototype.scaleCanvas=function(q,ee){var ne=this.getRescaledRect(this.canvasWidth,this.canvasHeight,q,ee,this.cropRect,this.margin);this.canvasWidth=q,this.canvasHeight=ee,this.onCropChange&&this.onCropChange(ne),this.setCropRectangle(ne)},se}(),Xe=function(){function se(q){this._angle=0,this.isDragging=!1,this.width=401,this.height=24,this.title=q,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(se.prototype,"angle",{get:function(){return this._angle},set:function(q){this._angle=q,this.setAngleLabel(),this.positionScaleShape()},enumerable:!1,configurable:!0}),se.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},se.prototype.onPointerDown=function(q){this.controlContainer.setPointerCapture(q.pointerId),this.isDragging=!0,this.previousPoint={x:q.clientX,y:q.clientY}},se.prototype.onPointerMove=function(q){this.isDragging&&(this.onAngleChange&&this.onAngleChange((q.clientX-this.previousPoint.x)/5),this.previousPoint.x=q.clientX)},se.prototype.onPointerUp=function(q){this.isDragging&&this.onAngleChange&&this.onAngleChange((q.clientX-this.previousPoint.x)/5),this.isDragging=!1,this.controlContainer.releasePointerCapture(q.pointerId)},se.prototype.setAngleLabel=function(){if(this.angleLabelText){this.angleLabelText.innerHTML=""+Math.round(this._angle);var q=this.angleLabelText.getBBox();s.setAttributes(this.angleLabelElement,[["x",((this.width-q.width)/2).toString()],["y",(this.height/2).toString()]])}},se.prototype.positionScaleShape=function(){if(this.scaleShape){var q=this.scaleShape.transform.baseVal.getItem(0);q.setTranslate(this._angle%5*5-25,0),this.scaleShape.transform.baseVal.replaceItem(q,0)}},se.prototype.getVisual=function(){var q=document.createElementNS("http://www.w3.org/2000/svg","svg");q.setAttribute("xmlns","http://www.w3.org/2000/svg"),q.setAttribute("width",this.width+"px"),q.setAttribute("height",this.height+"px"),q.setAttribute("viewBox","0 0 "+this.width+" "+this.height),q.style.flexShrink="0",document.body.appendChild(q);for(var ee="M0,"+(this.height-1)+" v"+-this.height/3+"h1v"+this.height/3,ne=1;ne<=this.width/5+10;ne++){var le=ne%5==0?this.height/3:this.height/6;ee+="h4v"+-le+"h1v"+le}ee+="v1H0Z",this.scaleShape=s.createPath(ee);var te=s.createTransform();this.scaleShape.transform.baseVal.appendItem(te),q.appendChild(this.scaleShape),this.angleLabelElement=s.createText([["x","0"],["y","0"],["font-size","10px"],["font-family","monospace"]]),this.angleLabelText=s.createTSpan(""),this.angleLabelElement.appendChild(this.angleLabelText);var ie=s.createTSpan("");return ie.innerHTML="°",this.angleLabelElement.appendChild(ie),q.appendChild(this.angleLabelElement),document.body.removeChild(q),q},se}(),ze=function(){function se(){this.naturalSize=!1,this.imageType="image/png"}return se.prototype.rasterize=function(q,ee,ne,le,te,ie,ue){var de=this;return new Promise(function(ye){var Ee=document.createElement("canvas");Ee.width=q.width.baseVal.value-2*le,Ee.height=q.height.baseVal.value-2*le;var Pe=1,Ue=1;de.naturalSize===!0?(Pe=ee.naturalWidth/(q.width.baseVal.value-2*le)/ie,Ue=ee.naturalHeight/(q.height.baseVal.value-2*le)/ue,Ee.width=ee.naturalWidth/ie,Ee.height=ee.naturalHeight/ue):de.width!==void 0&&de.height!==void 0&&(Pe=de.width/ne.width,Ue=de.height/ne.height,Ee.width*=Pe,Ee.height*=Ue);var Qe=Ee.getContext("2d");Qe.translate(Ee.width/2,Ee.height/2),Qe.rotate(te*Math.PI/180),Qe.scale(ie,ue),Qe.translate(-Ee.width/2,-Ee.height/2),Qe.drawImage(ee,0,0,Ee.width,Ee.height);var tt=document.createElement("canvas");tt.width=ne.width*Pe,tt.height=ne.height*Ue,tt.getContext("2d").putImageData(Qe.getImageData((ne.x-le)*Pe,(ne.y-le)*Ue,ne.width*Pe,ne.height*Ue),0,0),ye(tt.toDataURL(de.imageType,de.imageQuality))})},se}(),rt=function(){function se(q){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=se.instanceCounter++,this.styles=new c(this.instanceNo),this.target=q,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(se.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"zoomToCropEnabled",{get:function(){return this._zoomToCropEnabled},set:function(q){this._zoomToCropEnabled=q,q?this.zoomToCrop():this.unzoomFromCrop()},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"isGridVisible",{get:function(){return this._isGridVisible},set:function(q){this._isGridVisible=q,this.cropLayer&&(this.cropLayer.isGridVisible=this._isGridVisible)},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"gridLines",{get:function(){return this._gridLines},set:function(q){this._gridLines=q,this.cropLayer&&(this.cropLayer.numberOfGridLines=this._gridLines)},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"rotationAngle",{get:function(){return this._rotationAngle},set:function(q){this._rotationAngle=q,this.straightener&&(this.straightener.angle=this._rotationAngle)},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"paddedImageWidth",{get:function(){return this.imageWidth+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"paddedImageHeight",{get:function(){return this.imageHeight+2*this.CANVAS_MARGIN},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(se.prototype,"aspectRatio",{get:function(){var q;return(q=this._aspectRatio)!==null&&q!==void 0?q:this.aspectRatios[0]},set:function(q){this._aspectRatio=q},enumerable:!1,configurable:!0}),se.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},se.prototype.show=function(){this.showUI(),this.open()},se.prototype.close=function(q){q===void 0&&(q=!1),this.isOpen&&(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),q||this.closeEventListeners.forEach(function(ee){return ee()}),this._isOpen=!1)},se.prototype.addRenderEventListener=function(q){this.renderEventListeners.push(q)},se.prototype.removeRenderEventListener=function(q){this.renderEventListeners.indexOf(q)>-1&&this.renderEventListeners.splice(this.renderEventListeners.indexOf(q),1)},se.prototype.addCloseEventListener=function(q){this.closeEventListeners.push(q)},se.prototype.removeCloseEventListener=function(q){this.closeEventListeners.indexOf(q)>-1&&this.closeEventListeners.splice(this.closeEventListeners.indexOf(q),1)},se.prototype.setupResizeObserver=function(){var q=this;this.displayMode==="inline"?window.ResizeObserver&&(this.targetObserver=new ResizeObserver(function(){q.resize(q.target.clientWidth,q.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))},se.prototype.onPopupResize=function(){if(this.contentDiv.clientWidth>0&&this.contentDiv.clientHeight>0){var q=1*this.target.clientWidth/this.target.clientHeight,ee=this.contentDiv.clientWidth/q>this.contentDiv.clientHeight?(this.contentDiv.clientHeight-2*this.CANVAS_MARGIN)*q:this.contentDiv.clientWidth-2*this.CANVAS_MARGIN,ne=ee+2*this.CANVAS_MARGIN<this.contentDiv.clientWidth?this.contentDiv.clientHeight-2*this.CANVAS_MARGIN:(this.contentDiv.clientWidth-2*this.CANVAS_MARGIN)/q;this.resize(ee,ne)}},se.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},se.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",s.setAttributes(this.editingTarget,[["width",""+this.imageWidth],["height",""+this.imageHeight]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px"},se.prototype.resize=function(q,ee){this.imageWidth=Math.round(q),this.imageHeight=Math.round(ee),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()},se.prototype.setEditingTarget=function(){var q=document.createElement("canvas");q.width=this.target.naturalWidth,q.height=this.target.naturalHeight,q.getContext("2d").drawImage(this.target,0,0,this.target.naturalWidth,this.target.naturalHeight);var ee=q.toDataURL();s.setAttributes(this.editingTarget,[["href",ee]]),this.setEditingTargetSize()},se.prototype.setTopLeft=function(){var q=this.target.getBoundingClientRect(),ee=this.editorCanvas.getBoundingClientRect();this.left=q.left-ee.left-this.CANVAS_MARGIN,this.top=q.top-ee.top-this.CANVAS_MARGIN},se.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=s.createDefs(),this.cropImage.appendChild(this.defs),this.editingTarget=s.createImage([["href",""]]),this.editingTarget.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationContainer=s.createGroup(),this.editingTargetRotationScaleContainer=s.createGroup(),this.editingTargetRotationScaleContainer.appendChild(this.editingTarget),this.editingTargetRotationContainer.appendChild(this.editingTargetRotationScaleContainer);var q=s.createTransform();this.editingTargetRotationContainer.transform.baseVal.appendItem(q);var ee=s.createTransform();this.editingTargetRotationScaleContainer.transform.baseVal.appendItem(ee),this.editingTargetContainer=s.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)},se.prototype.positionCropImage=function(){this.cropImageHolder.style.top=this.top+"px",this.cropImageHolder.style.left=this.left+"px"},se.prototype.initCropLayer=function(){this.cropRect={x:this.CANVAS_MARGIN,y:this.CANVAS_MARGIN,width:this.imageWidth,height:this.imageHeight},this.cropLayerContainer=s.createGroup(),this.cropImage.appendChild(this.cropLayerContainer),this.cropLayer=new Ve(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()},se.prototype.zoomToCrop=function(){if(this.cropRect){var q=this.cropRect.x-this.CANVAS_MARGIN+this.cropRect.width/2,ee=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=q+"px "+ee+"px",this.editingTargetContainer.style.transform="translate("+(this.imageWidth/2-q+this.CANVAS_MARGIN)+"px,"+(this.imageHeight/2-ee+this.CANVAS_MARGIN)+"px) scale("+this.zoomFactor+")",this.cropLayer.zoomFactor=this.zoomFactor)}},se.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)},se.prototype.cropRectChanged=function(q){this.cropRect=q,this.zoomToCropEnabled?this.zoomToCrop():this.cropLayer.zoomFactor=1},se.prototype.attachEvents=function(){window.addEventListener("resize",this.onWindowResize)},se.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"},se.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},se.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 q=this.styles.settings.hideTopToolbar?0:this.toolbarHeight,ee=this.target.offsetTop>q+this.CANVAS_MARGIN?this.target.offsetTop-(q+this.CANVAS_MARGIN):0;this.coverDiv.style.top=ee+"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},se.prototype.addToolbars=function(){this.addTopToolbar(),this.addBottomToolbar()},se.prototype.addTopToolbar=function(){var q=this;this.topToolbar=new N,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 ee=new be;ee.minWidth=3*this.toolbarHeight+"px",this.topToolbar.addButtonBlock(ee);var ne=[];this.aspectRatios.forEach(function(Ue){var Qe=new we(Oe.getIcon(Ue.horizontal,Ue.vertical),Ue.horizontal===0&&Ue.vertical===0?"FREE":Ue.horizontal+":"+Ue.vertical);Qe.onClick=function(){return q.ratioButtonClicked(Ue)},ne.push(Qe)}),this.aspectRatioButton=new Me(Oe.getIcon(0,0),"Aspect ratio",ne),this.aspectRatioButton.dropdownClassName=this.toolbarDropdownStyleClass.name,this.aspectRatioButton.dropdownColorsClassName=this.styles.settings.toolbarDropdownStyleColorsClassName?this.styles.settings.toolbarDropdownStyleColorsClassName:this.toolbarDropdownStyleColorsClass.name,ee.addButton(this.aspectRatioButton),this.aspectRatios.length<2&&this.aspectRatioButton.hide();var le=new we('<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");le.isActive=this.isGridVisible,le.onClick=function(){q.isGridVisible=!q.isGridVisible,le.isActive=q.isGridVisible},ee.addButton(le);var te=new we('<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(te.isActive=this.zoomToCropEnabled,te.onClick=function(){q.zoomToCropEnabled=!q.zoomToCropEnabled,te.isActive=q.zoomToCropEnabled},ee.addButton(te),!G.isLicensed){var ie=new _e;this.topToolbar.addElementBlock(ie);var ue=document.createElement("div");ue.className=this.topToolbar.buttonClassName+" "+this.topToolbar.buttonColorsClassName;var de=document.createElement("a");de.style.color="currentColor",de.href="https://markerjs.com/products/cropro",de.target="_blank",de.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>',ue.appendChild(de),ie.addElement(ue)}var ye=new be;ye.minWidth=3*this.toolbarHeight+"px",ye.contentAlign="end",this.topToolbar.addButtonBlock(ye);var Ee=new we('<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");Ee.onClick=this.startRenderAndClose,ye.addButton(Ee),this.styles.settings.toolbarOkButtonStyleColorsClassName&&(Ee.colorsClassName=this.styles.settings.toolbarOkButtonStyleColorsClassName);var Pe=new we('<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");Pe.onClick=this.close,ye.addButton(Pe),this.styles.settings.toolbarCloseButtonStyleColorsClassName&&(Pe.colorsClassName=this.styles.settings.toolbarCloseButtonStyleColorsClassName)},se.prototype.addBottomToolbar=function(){var q=this;this.bottomToolbar=new N,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 ee=new be;ee.minWidth=2*this.toolbarHeight+"px",this.bottomToolbar.addButtonBlock(ee);var ne=new we('<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");ne.onClick=this.rotateLeftButtonClicked,ee.addButton(ne);var le=new we('<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");le.onClick=this.rotateRightButtonClicked,ee.addButton(le);var te=new _e;te.className=this.toolbarStraightenerBlockStyleClass.name,this.bottomToolbar.addElementBlock(te),this.straightener=new Xe("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(ye){q.rotateBy(ye),q.straightener.angle=q.rotationAngle},te.addElement(this.straightener.getUI());var ie=new be;ie.minWidth=2*this.toolbarHeight+"px",ie.contentAlign="end",this.bottomToolbar.addButtonBlock(ie);var ue=new we('<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");ue.onClick=this.flipHorizontallyButtonClicked,ie.addButton(ue);var de=new we('<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");de.onClick=this.flipVerticallyButtonClicked,ie.addButton(de)},se.prototype.ratioButtonClicked=function(q){this.aspectRatio=q,this.applyAspectRatio(),this.aspectRatioButton.hideDropdown()},se.prototype.applyAspectRatio=function(){this.setCropLayerAspectRatio(),this.aspectRatioButton.icon=Oe.getIcon(this.aspectRatio.horizontal,this.aspectRatio.vertical)},se.prototype.setCropLayerAspectRatio=function(){this.cropLayer&&(this.aspectRatio&&this.aspectRatio.horizontal!==0&&this.aspectRatio.vertical!==0?this.cropLayer.aspectRatio=new Le(this.aspectRatio.horizontal,this.aspectRatio.vertical):this.cropLayer.aspectRatio=void 0)},se.prototype.closeUI=function(){this.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},se.prototype.getState=function(){return{width:this.imageWidth,height:this.imageHeight,rotationAngle:this.rotationAngle,flippedHorizontally:this.flippedHorizontally,flippedVertically:this.flippedVertically,cropRect:Object.assign({},this.cropRect)}},se.prototype.restoreState=function(q){if(q){var ee=this.cropLayer.getRescaledRect(q.width,q.height,this.imageWidth,this.imageHeight,q.cropRect,this.CANVAS_MARGIN);this.cropLayer.setCropRectangle(ee),this.cropRectChanged(ee),this.flippedHorizontally=q.flippedHorizontally,this.flippedVertically=q.flippedVertically,this.applyFlip(),this.rotationAngle=q.rotationAngle,this.applyRotation()}},se.prototype.clientToLocalCoordinates=function(q,ee){var ne=this.cropImage.getBoundingClientRect();return{x:q-ne.left,y:ee-ne.top}},se.prototype.onWindowResize=function(){this.positionUI()},se.prototype.positionUI=function(){switch(this.setTopLeft(),this.displayMode){case"inline":var q=this.target.offsetTop>this.toolbarHeight?this.target.offsetTop-this.toolbarHeight:0;this.coverDiv.style.top=q+"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()},se.prototype.rotateLeftButtonClicked=function(){var q=this.rotationAngle-90;this.rotationAngle%90!=0&&(q+=this.rotationAngle>=0?90-this.rotationAngle%90:-this.rotationAngle%90),this.rotateTo(q)},se.prototype.rotateRightButtonClicked=function(){var q=this.rotationAngle+90;this.rotationAngle%90!=0&&(q-=this.rotationAngle>=0?this.rotationAngle%90:90+this.rotationAngle%90),this.rotateTo(q)},se.prototype.rotateTo=function(q){q=(q=q>180?q-360:q)<=-180?q+360:q,this.rotationAngle=q,this.applyRotation()},se.prototype.rotateBy=function(q){this.rotateTo((this.rotationAngle+q)%360)},se.prototype.applyRotation=function(){var q=this.zoomToCropEnabled;this.zoomToCropEnabled=!1,this.editingTargetRotationScaleContainer.style.transformOrigin=this.imageWidth/2+"px "+this.imageHeight/2+"px",this.editingTargetRotationScaleContainer.style.transform="scale(1)";var ee=this.editingTargetRotationContainer.transform.baseVal.getItem(0);ee.setRotate(this.rotationAngle,this.imageWidth/2,this.imageHeight/2),this.editingTargetRotationContainer.transform.baseVal.replaceItem(ee,0);var ne=this.editingTarget.getBoundingClientRect();this.scaleFactor=Math.min(this.imageWidth/ne.width,this.imageHeight/ne.height),this.editingTargetRotationScaleContainer.style.transform="scale("+this.scaleFactor+")",this.zoomToCropEnabled=q},se.prototype.flipHorizontallyButtonClicked=function(){this.flippedHorizontally=!this.flippedHorizontally,this.applyFlip()},se.prototype.flipVerticallyButtonClicked=function(){this.flippedVertically=!this.flippedVertically,this.applyFlip()},se.prototype.applyFlip=function(){this.editingTarget.style.transform="scale("+(this.flippedHorizontally?-1:1)+","+(this.flippedVertically?-1:1)+")"},se.prototype.startRenderAndClose=function(){return xe(this,void 0,void 0,function(){var q,ee;return me(this,function(ne){switch(ne.label){case 0:return[4,this.render()];case 1:return q=ne.sent(),ee=this.getState(),this.renderEventListeners.forEach(function(le){return le(q,ee)}),this.close(!0),[2]}})})},se.prototype.render=function(){return xe(this,void 0,void 0,function(){var q;return me(this,function(ee){switch(ee.label){case 0:return(q=new ze).naturalSize=this.renderAtNaturalSize,q.imageType=this.renderImageType,q.imageQuality=this.renderImageQuality,q.width=this.renderWidth,q.height=this.renderHeight,this.unzoomFromCrop(),s.setAttributes(this.cropLayerContainer,[["display","none"]]),[4,q.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 ee.sent(),[4,q.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,ee.sent()]}})})},se.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new X("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 X("toolbar_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarBlockStyleClass=this.styles.addClass(new X("toolbar-block",`
|
|
display: flex;
|
|
align-items: center;
|
|
box-sizing: content-box;
|
|
`));var q=this.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new X("toolbar_button",`
|
|
display: inline-block;
|
|
width: `+(this.toolbarHeight-2*q)+`px;
|
|
height: `+(this.toolbarHeight-2*q)+`px;
|
|
padding: `+q+`px;
|
|
cursor: default;
|
|
user-select: none;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarButtonStyleColorsClass=this.styles.addClass(new X("toolbar_button_colors",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new X("toolbar_active_button",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
background-color: `+this.styles.settings.toolbarBackgroundActiveColor+`
|
|
`)),this.styles.addRule(new R("."+this.toolbarButtonStyleClass.name+" svg",`
|
|
height: `+this.toolbarHeight/2+`px;
|
|
`)),this.styles.addRule(new R("."+this.toolbarButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundHoverColor+`
|
|
`)),this.toolbarDropdownStyleClass=this.styles.addClass(new X("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 X("toolbar_dropdown_colors",`
|
|
background-color: `+this.styles.settings.toolbarBackgroundColor+`;
|
|
`)),this.toolbarStraightenerBlockStyleClass=this.styles.addClass(new X("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 X("toolbar_straightener",`
|
|
display: flex;
|
|
overflow: hidden;
|
|
justify-content: center;
|
|
height: `+(this.toolbarHeight-2*q)+`px;
|
|
padding: `+q+`px;
|
|
cursor: default;
|
|
user-select: none;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarStraightenerStyleColorsClass=this.styles.addClass(new X("toolbar_straightener_colors",`
|
|
color: `+this.styles.settings.toolbarColor+`;
|
|
fill: currentColor;
|
|
`))},se.instanceCounter=0,se}(),je=pe("8hTe"),We=pe.n(je),ke=/<pre[^>]*>/g;function Je(se){var q=document.createElement("div");return q.innerHTML=se,q.childNodes.length===0?"":q.childNodes[0].nodeValue}var qe=at.a=function(se){var q=se.value,ee=q===void 0?"":q,ne=se.edit,le=ne===void 0?!1:ne,te=se.className,ie=se.showTextOnly,ue=se.showLines,de=se.replaces,ye=se.zoomImg,Ee=se.hasMask,Pe=se.style,Ue=Pe===void 0?{}:Pe,Qe=se.stylesPrev,tt=Qe===void 0?{}:Qe,xt=String(ee),st=Object(O.useRef)(),nt=Object(O.useRef)(),wt=Object(O.useState)(""),ot=Object(z.a)(wt,2),vt=ot[0],bt=ot[1],Ke=Object(O.useState)("office"),ir=Object(z.a)(Ke,2),nr=ir[0],Kt=ir[1],Ot=function(){var At=new rt(nt.current);At.displayMode="popup",At.addRenderEventListener(function(){var Qt=Object(D.a)(B.a.mark(function yt(gt){var kt;return B.a.wrap(function(jt){for(;;)switch(jt.prev=jt.next){case 0:return st.current.style.display="none",jt.next=3,Object(De.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:gt}});case 3:kt=jt.sent,kt!=null&&kt.id&&de(nt.current.getAttribute("src").replace(ae.a.API_SERVER,""),"/api/attachments/".concat(kt==null?void 0:kt.id,"?type=").concat(kt.content_type));case 5:case"end":return jt.stop()}},yt)}));return function(yt){return Qt.apply(this,arguments)}}()),At.show()},ar=function(){var At=new Se.a(nt.current);At.settings.displayMode="popup",At.addEventListener("render",function(){var Qt=Object(D.a)(B.a.mark(function yt(gt){var kt;return B.a.wrap(function(jt){for(;;)switch(jt.prev=jt.next){case 0:if(st.current.style.display="none",!nt.current){jt.next=6;break}return jt.next=4,Object(De.a)("/api/attachments.json",{method:"post",body:{file_type:"base64",original_filename:"educoder.png",file:gt.dataUrl}});case 4:kt=jt.sent,kt!=null&&kt.id&&de(nt.current.getAttribute("src").replace(ae.a.API_SERVER,""),"/api/attachments/".concat(kt==null?void 0:kt.id,"?type=").concat(kt.content_type));case 6:case"end":return jt.stop()}},yt)}));return function(yt){return Qt.apply(this,arguments)}}()),At.show(),window.markerArea=At},wr=Object(O.useMemo)(function(){st.current&&(st.current.style.zIndex=-1);try{var Ze=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,At=/\"\/api\/attachments\/|\"\/attachments\/download\//g,Qt=/\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;xt=xt.replace(Ze,"("+ae.a.API_SERVER+"/api/attachments/").replace(At,'"'+ae.a.API_SERVER+"/api/attachments/").replace(Qt,'"'+ae.a.API_SERVER+"/files/uploads/").replaceAll("http://video.educoder","https://video.educoder").replaceAll("http://www.educoder.net/api","https://data.educoder.net/api").replaceAll("https://www.educoder.net/api","https://data.educoder.net/api").replace(/\r\n/g,`
|
|
`)}catch(br){}var yt=V(xt),gt=E();if(xt.match(/\[TOC\]/)&&(yt=yt.replace("<p>[TOC]</p>",k()),C()),yt=yt.replace(/(__special_katext_id_\d+__)/g,function(br,jt){var Fe=gt[jt],ct=Fe.type,ri=Fe.expression;return Object(he.renderToString)(Je(ri)||"",{displayMode:ct==="block",throwOnError:!1,output:"html"})}),yt=yt.replace(/▁/g,"\u2581\u2581\u2581"),g(),ie){var kt=document.createElement("div");return kt.innerHTML=yt,kt.innerText}return setTimeout(function(){return ti()},500),yt},[xt]),Vt=Object(O.useRef)();v.WebkitLineClamp=ue,ue&&(Ue=Object(U.a)(Object(U.a)({},Ue),v));function ur(Ze){var At=Ze.target;if(At.tagName.toUpperCase()==="IMG"){if(ye){var Qt=At.getAttribute("src");bt(Qt),Kt("image")}}else if(At.tagName.toUpperCase()==="A"){var yt=At.getAttribute("href");if(yt.indexOf("office")>-1)Ze.preventDefault(),bt(yt),Kt("office");else if(yt.indexOf("application/pdf")>-1)Ze.preventDefault(),bt(yt),Kt("pdf");else if(yt.indexOf("text/html")>-1)Ze.preventDefault(),bt(yt),Kt("html");else if(yt.startsWith("#")){Ze.preventDefault();var gt=document.getElementById(yt.replace("#",""));gt&>.scrollIntoView(!0)}}}var ti=function(){var At,Qt=(At=Vt.current)===null||At===void 0?void 0:At.querySelectorAll("video");Qt==null||Qt.forEach(function(yt){if(yt.oncontextmenu=function(){return!1},yt.src.indexOf(".m3u8")>-1&&!yt.canPlayType("application/vnd.apple.mpegurl")){if($.a.isSupported()){var gt=new $.a;gt.loadSource(yt.src),gt.attachMedia(yt)}}})};Object(O.useEffect)(function(){if(Vt.current&&wr&&(wr.match(ke)&&window.PR.prettyPrint()),Vt.current)return Vt.current.addEventListener("click",ur),function(){Vt.current.removeEventListener("click",ur),g(),C()}},[wr,Vt.current,ur]);var It=function(At){if(!le)return;At.target.nodeName==="IMG"?(st.current.style.zIndex=1,st.current.style.display="flex",st.current.style.width=At.target.clientWidth+"px",st.current.style.height=At.target.clientHeight+"px",st.current.style.top=At.target.offsetTop+"px",st.current.style.left=At.target.offsetLeft+"px",nt.current.src=At.target.getAttribute("src")):st.current.style.display="none"};return b.a.createElement("div",{style:{position:"relative"}},b.a.createElement("div",{ref:Vt,style:Object(U.a)({},Ue),className:"".concat(te||""," markdown-body ").concat(We.a.mdBody),onMouseOver:It,dangerouslySetInnerHTML:{__html:wr}}),b.a.createElement("div",{ref:st,className:We.a.button},b.a.createElement(Z.a,null,b.a.createElement(J.a,{onClick:function(){return Ot()}},"\u88C1\u526A"),b.a.createElement(J.a,{onClick:function(){return ar()}},"\u7F16\u8F91"))),b.a.createElement("img",{ref:nt,src:"",alt:"sample",crossOrigin:"anonymous",style:{maxWidth:"90%",opacity:0,position:"absolute",zIndex:-1}}),b.a.createElement(ge.a,{close:!0,data:vt,type:vt!=null&&vt.length?nr:"",style:Object(U.a)({},tt),onClose:function(){return bt("")}}))}},"9VGf":function(pt,at,pe){"use strict";pe.d(at,"a",function(){return _});var fe=pe("q1tI"),Z=pe.n(fe);function _(J,U){var D=Object(fe.useRef)();Object(fe.useEffect)(function(){D.current=J}),Object(fe.useEffect)(function(){function z(){D.current()}if(U!==null){var H=setInterval(z,U);return function(){return clearInterval(H)}}},[U])}},Bd2K:function(pt,at,pe){(function(fe){fe(pe("VrN/"),pe("osHv"))})(function(fe){fe.defineOption("autoCloseTags",!1,function(B,O,b){if(b!=fe.Init&&b&&B.removeKeyMap("autoCloseTags"),!O)return;var A={name:"autoCloseTags"};(typeof O!="object"||O.whenClosing!==!1)&&(A["'/'"]=function(P){return D(P)}),(typeof O!="object"||O.whenOpening!==!1)&&(A["'>'"]=function(P){return J(P)}),B.addKeyMap(A)});var Z=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],_=["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 J(B){if(B.getOption("disableInput"))return fe.Pass;for(var O=B.listSelections(),b=[],A=B.getOption("autoCloseTags"),P=0;P<O.length;P++){if(!O[P].empty())return fe.Pass;var L=O[P].head,w=B.getTokenAt(L),y=fe.innerMode(B.getMode(),w.state),h=y.state,o=y.mode.xmlCurrentTag&&y.mode.xmlCurrentTag(h),l=o&&o.name;if(!l)return fe.Pass;var u=y.mode.configuration=="html",C=typeof A=="object"&&A.dontCloseTags||u&&Z,v=typeof A=="object"&&A.indentTags||u&&_;w.end>L.ch&&(l=l.slice(0,l.length-w.end+L.ch));var m=l.toLowerCase();if(!l||w.type=="string"&&(w.end!=L.ch||!/[\"\']/.test(w.string.charAt(w.string.length-1))||w.string.length==1)||w.type=="tag"&&o.close||w.string.indexOf("/")==L.ch-w.start-1||C&&z(C,m)>-1||H(B,y.mode.xmlCurrentContext&&y.mode.xmlCurrentContext(h)||[],l,L,!0))return fe.Pass;var k=typeof A=="object"&&A.emptyTags;if(k&&z(k,l)>-1){b[P]={text:"/>",newPos:fe.Pos(L.line,L.ch+2)};continue}var x=v&&z(v,m)>-1;b[P]={indent:x,text:">"+(x?`
|
|
|
|
`:"")+"</"+l+">",newPos:x?fe.Pos(L.line+1,0):fe.Pos(L.line,L.ch+1)}}for(var f=typeof A=="object"&&A.dontIndentOnAutoClose,P=O.length-1;P>=0;P--){var p=b[P];B.replaceRange(p.text,O[P].head,O[P].anchor,"+insert");var d=B.listSelections().slice(0);d[P]={head:p.newPos,anchor:p.newPos},B.setSelections(d),!f&&p.indent&&(B.indentLine(p.newPos.line,null,!0),B.indentLine(p.newPos.line+1,null,!0))}}function U(B,O){for(var b=B.listSelections(),A=[],P=O?"/":"</",L=B.getOption("autoCloseTags"),w=typeof L=="object"&&L.dontIndentOnSlash,y=0;y<b.length;y++){if(!b[y].empty())return fe.Pass;var h=b[y].head,o=B.getTokenAt(h),l=fe.innerMode(B.getMode(),o.state),u=l.state;if(O&&(o.type=="string"||o.string.charAt(0)!="<"||o.start!=h.ch-1))return fe.Pass;var C,v=l.mode.name!="xml"&&B.getMode().name=="htmlmixed";if(v&&l.mode.name=="javascript")C=P+"script";else if(v&&l.mode.name=="css")C=P+"style";else{var m=l.mode.xmlCurrentContext&&l.mode.xmlCurrentContext(u);if(!m||m.length&&H(B,m,m[m.length-1],h))return fe.Pass;C=P+m[m.length-1]}B.getLine(h.line).charAt(o.end)!=">"&&(C+=">"),A[y]=C}if(B.replaceSelections(A),b=B.listSelections(),!w)for(var y=0;y<b.length;y++)(y==b.length-1||b[y].head.line<b[y+1].head.line)&&B.indentLine(b[y].head.line)}function D(B){return B.getOption("disableInput")?fe.Pass:U(B,!0)}fe.commands.closeTag=function(B){return U(B)};function z(B,O){if(B.indexOf)return B.indexOf(O);for(var b=0,A=B.length;b<A;++b)if(B[b]==O)return b;return-1}function H(B,O,b,A,P){if(!fe.scanForClosingTag)return!1;var L=Math.min(B.lastLine()+1,A.line+500),w=fe.scanForClosingTag(B,A,null,L);if(!w||w.tag!=b)return!1;for(var y=P?1:0,h=O.length-1;h>=0&&O[h]==b;h--)++y;A=w.to;for(var h=1;h<y;h++){var o=fe.scanForClosingTag(B,A,null,L);if(!o||o.tag!=b)return!1;A=o.to}return!0}})},BjJ7:function(pt,at,pe){"use strict";pe.d(at,"d",function(){return Z}),pe.d(at,"c",function(){return _}),pe.d(at,"e",function(){return J}),pe.d(at,"b",function(){return U}),pe.d(at,"a",function(){return z});var fe=pe("m3rI");function Z(H){var B=!0;if(H.length>0){for(var O=0;O<H.length;O++)if(H[O].compile_success==0||!H[O].compile_success){B=!1;break}}else B=!1;return B}function _(H){for(var B=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",O=[],b=0;b<H.length;b++){var A=H[b],P=B?"".concat(B,"/").concat(A.name):"".concat(A.name);O.push({title:A.name,isLeaf:!(A.type==="tree"),key:P})}return O}function J(H,B,O){for(var b=0;b<H.length;b++){var A=H[b];if(A.key===B){A.children=O;break}A.children&&J(A.children,B,O)}return H}function U(H,B,O){var b;return function(){var A=this,P=arguments,L=function(){b=null,O||H.apply(A,P)},w=O&&!b;clearTimeout(b),b=setTimeout(L,B),w&&H.apply(A,P)}}var D=!0,z=fe.a.API_SERVER},"C+DQ":function(pt,at,pe){},DlQD:function(pt,at,pe){(function(fe,Z){pt.exports=Z()})(this,function(){"use strict";function fe(ee,ne){for(var le=0;le<ne.length;le++){var te=ne[le];te.enumerable=te.enumerable||!1,te.configurable=!0,"value"in te&&(te.writable=!0),Object.defineProperty(ee,te.key,te)}}function Z(ee,ne,le){return ne&&fe(ee.prototype,ne),le&&fe(ee,le),ee}function _(ee,ne){if(!ee)return;if(typeof ee=="string")return J(ee,ne);var le=Object.prototype.toString.call(ee).slice(8,-1);if(le==="Object"&&ee.constructor&&(le=ee.constructor.name),le==="Map"||le==="Set")return Array.from(ee);if(le==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(le))return J(ee,ne)}function J(ee,ne){(ne==null||ne>ee.length)&&(ne=ee.length);for(var le=0,te=new Array(ne);le<ne;le++)te[le]=ee[le];return te}function U(ee,ne){var le;if(typeof Symbol=="undefined"||ee[Symbol.iterator]==null){if(Array.isArray(ee)||(le=_(ee))||ne&&ee&&typeof ee.length=="number"){le&&(ee=le);var te=0;return function(){return te>=ee.length?{done:!0}:{done:!1,value:ee[te++]}}}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 le=ee[Symbol.iterator](),le.next.bind(le)}function D(ee,ne){return ne={exports:{}},ee(ne,ne.exports),ne.exports}var z=D(function(ee){function ne(){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 le(te){ee.exports.defaults=te}ee.exports={defaults:ne(),getDefaults:ne,changeDefaults:le}}),H=z.defaults,B=z.getDefaults,O=z.changeDefaults,b=/[&<>"']/,A=/[&<>"']/g,P=/[<>"']|&(?!#?\w+;)/,L=/[<>"']|&(?!#?\w+;)/g,w={"&":"&","<":"<",">":">",'"':""","'":"'"},y=function(ne){return w[ne]};function h(ee,ne){if(ne){if(b.test(ee))return ee.replace(A,y)}else if(P.test(ee))return ee.replace(L,y);return ee}var o=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function l(ee){return ee.replace(o,function(ne,le){return le=le.toLowerCase(),le==="colon"?":":le.charAt(0)==="#"?le.charAt(1)==="x"?String.fromCharCode(parseInt(le.substring(2),16)):String.fromCharCode(+le.substring(1)):""})}var u=/(^|[^\[])\^/g;function C(ee,ne){ee=ee.source||ee,ne=ne||"";var le={replace:function(ie,ue){return ue=ue.source||ue,ue=ue.replace(u,"$1"),ee=ee.replace(ie,ue),le},getRegex:function(){return new RegExp(ee,ne)}};return le}var v=/[^\w:]/g,m=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function k(ee,ne,le){if(ee){var te;try{te=decodeURIComponent(l(le)).replace(v,"").toLowerCase()}catch(ie){return null}if(te.indexOf("javascript:")===0||te.indexOf("vbscript:")===0||te.indexOf("data:")===0)return null}ne&&!m.test(le)&&(le=a(ne,le));try{le=encodeURI(le).replace(/%25/g,"%")}catch(ie){return null}return le}var x={},f=/^[^:]+:\/*[^/]*$/,p=/^([^:]+:)[\s\S]*$/,d=/^([^:]+:\/*[^/]*)[\s\S]*$/;function a(ee,ne){x[" "+ee]||(f.test(ee)?x[" "+ee]=ee+"/":x[" "+ee]=F(ee,"/",!0)),ee=x[" "+ee];var le=ee.indexOf(":")===-1;return ne.substring(0,2)==="//"?le?ne:ee.replace(p,"$1")+ne:ne.charAt(0)==="/"?le?ne:ee.replace(d,"$1")+ne:ee+ne}var E={exec:function(){}};function g(ee){for(var ne=1,le,te;ne<arguments.length;ne++){le=arguments[ne];for(te in le)Object.prototype.hasOwnProperty.call(le,te)&&(ee[te]=le[te])}return ee}function S(ee,ne){var le=ee.replace(/\|/g,function(ue,de,ye){for(var Ee=!1,Pe=de;--Pe>=0&&ye[Pe]==="\\";)Ee=!Ee;return Ee?"|":" |"}),te=le.split(/ \|/),ie=0;if(te.length>ne)te.splice(ne);else for(;te.length<ne;)te.push("");for(;ie<te.length;ie++)te[ie]=te[ie].trim().replace(/\\\|/g,"|");return te}function F(ee,ne,le){var te=ee.length;if(te===0)return"";for(var ie=0;ie<te;){var ue=ee.charAt(te-ie-1);if(ue===ne&&!le)ie++;else if(ue!==ne&&le)ie++;else break}return ee.substr(0,te-ie)}function W(ee,ne){if(ee.indexOf(ne[1])===-1)return-1;for(var le=ee.length,te=0,ie=0;ie<le;ie++)if(ee[ie]==="\\")ie++;else if(ee[ie]===ne[0])te++;else if(ee[ie]===ne[1]&&(te--,te<0))return ie;return-1}function K(ee){ee&&ee.sanitize&&!ee.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}var V={escape:h,unescape:l,edit:C,cleanUrl:k,resolveUrl:a,noopTest:E,merge:g,splitCells:S,rtrim:F,findClosingBracket:W,checkSanitizeDeprecation:K},M=z.defaults,I=V.rtrim,$=V.splitCells,ae=V.escape,he=V.findClosingBracket;function ge(ee,ne,le){var te=ne.href,ie=ne.title?ae(ne.title):null,ue=ee[1].replace(/\\([\[\]])/g,"$1");return ee[0].charAt(0)!=="!"?{type:"link",raw:le,href:te,title:ie,text:ue}:{type:"image",raw:le,href:te,title:ie,text:ae(ue)}}function De(ee,ne){var le=ee.match(/^(\s+)(?:```)/);if(le===null)return ne;var te=le[1];return ne.split(`
|
|
`).map(function(ie){var ue=ie.match(/^\s+/);if(ue===null)return ie;var de=ue[0];return de.length>=te.length?ie.slice(te.length):ie}).join(`
|
|
`)}var Se=function(){function ee(le){this.options=le||M}var ne=ee.prototype;return ne.space=function(te){var ie=this.rules.block.newline.exec(te);if(ie)return ie[0].length>1?{type:"space",raw:ie[0]}:{raw:`
|
|
`}},ne.code=function(te,ie){var ue=this.rules.block.code.exec(te);if(ue){var de=ie[ie.length-1];if(de&&de.type==="paragraph")return{raw:ue[0],text:ue[0].trimRight()};var ye=ue[0].replace(/^ {4}/gm,"");return{type:"code",raw:ue[0],codeBlockStyle:"indented",text:this.options.pedantic?ye:I(ye,`
|
|
`)}}},ne.fences=function(te){var ie=this.rules.block.fences.exec(te);if(ie){var ue=ie[0],de=De(ue,ie[3]||"");return{type:"code",raw:ue,lang:ie[2]?ie[2].trim():ie[2],text:de}}},ne.heading=function(te){var ie=this.rules.block.heading.exec(te);if(ie)return{type:"heading",raw:ie[0],depth:ie[1].length,text:ie[2]}},ne.nptable=function(te){var ie=this.rules.block.nptable.exec(te);if(ie){var ue={type:"table",header:$(ie[1].replace(/^ *| *\| *$/g,"")),align:ie[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ie[3]?ie[3].replace(/\n$/,"").split(`
|
|
`):[],raw:ie[0]};if(ue.header.length===ue.align.length){var de=ue.align.length,ye;for(ye=0;ye<de;ye++)/^ *-+: *$/.test(ue.align[ye])?ue.align[ye]="right":/^ *:-+: *$/.test(ue.align[ye])?ue.align[ye]="center":/^ *:-+ *$/.test(ue.align[ye])?ue.align[ye]="left":ue.align[ye]=null;for(de=ue.cells.length,ye=0;ye<de;ye++)ue.cells[ye]=$(ue.cells[ye],ue.header.length);return ue}}},ne.hr=function(te){var ie=this.rules.block.hr.exec(te);if(ie)return{type:"hr",raw:ie[0]}},ne.blockquote=function(te){var ie=this.rules.block.blockquote.exec(te);if(ie){var ue=ie[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:ie[0],text:ue}}},ne.list=function(te){var ie=this.rules.block.list.exec(te);if(ie){for(var ue=ie[0],de=ie[2],ye=de.length>1,Ee=de[de.length-1]===")",Pe={type:"list",raw:ue,ordered:ye,start:ye?+de.slice(0,-1):"",loose:!1,items:[]},Ue=ie[0].match(this.rules.block.item),Qe=!1,tt,xt,st,nt,wt,ot,vt,bt=Ue.length,Ke=0;Ke<bt;Ke++)tt=Ue[Ke],ue=tt,xt=tt.length,tt=tt.replace(/^ *([*+-]|\d+[.)]) */,""),~tt.indexOf(`
|
|
`)&&(xt-=tt.length,tt=this.options.pedantic?tt.replace(/^ {1,4}/gm,""):tt.replace(new RegExp("^ {1,"+xt+"}","gm"),"")),Ke!==bt-1&&(st=this.rules.block.bullet.exec(Ue[Ke+1])[0],(ye?st.length===1||!Ee&&st[st.length-1]===")":st.length>1||this.options.smartLists&&st!==de)&&(nt=Ue.slice(Ke+1).join(`
|
|
`),Pe.raw=Pe.raw.substring(0,Pe.raw.length-nt.length),Ke=bt-1)),wt=Qe||/\n\n(?!\s*$)/.test(tt),Ke!==bt-1&&(Qe=tt.charAt(tt.length-1)===`
|
|
`,wt||(wt=Qe)),wt&&(Pe.loose=!0),ot=/^\[[ xX]\] /.test(tt),vt=void 0,ot&&(vt=tt[1]!==" ",tt=tt.replace(/^\[[ xX]\] +/,"")),Pe.items.push({type:"list_item",raw:ue,task:ot,checked:vt,loose:wt,text:tt});return Pe}},ne.html=function(te){var ie=this.rules.block.html.exec(te);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]):ae(ie[0]):ie[0]}},ne.def=function(te){var ie=this.rules.block.def.exec(te);if(ie){ie[3]&&(ie[3]=ie[3].substring(1,ie[3].length-1));var ue=ie[1].toLowerCase().replace(/\s+/g," ");return{tag:ue,raw:ie[0],href:ie[2],title:ie[3]}}},ne.table=function(te){var ie=this.rules.block.table.exec(te);if(ie){var ue={type:"table",header:$(ie[1].replace(/^ *| *\| *$/g,"")),align:ie[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:ie[3]?ie[3].replace(/\n$/,"").split(`
|
|
`):[]};if(ue.header.length===ue.align.length){ue.raw=ie[0];var de=ue.align.length,ye;for(ye=0;ye<de;ye++)/^ *-+: *$/.test(ue.align[ye])?ue.align[ye]="right":/^ *:-+: *$/.test(ue.align[ye])?ue.align[ye]="center":/^ *:-+ *$/.test(ue.align[ye])?ue.align[ye]="left":ue.align[ye]=null;for(de=ue.cells.length,ye=0;ye<de;ye++)ue.cells[ye]=$(ue.cells[ye].replace(/^ *\| *| *\| *$/g,""),ue.header.length);return ue}}},ne.lheading=function(te){var ie=this.rules.block.lheading.exec(te);if(ie)return{type:"heading",raw:ie[0],depth:ie[2].charAt(0)==="="?1:2,text:ie[1]}},ne.paragraph=function(te){var ie=this.rules.block.paragraph.exec(te);if(ie)return{type:"paragraph",raw:ie[0],text:ie[1].charAt(ie[1].length-1)===`
|
|
`?ie[1].slice(0,-1):ie[1]}},ne.text=function(te,ie){var ue=this.rules.block.text.exec(te);if(ue){var de=ie[ie.length-1];return de&&de.type==="text"?{raw:ue[0],text:ue[0]}:{type:"text",raw:ue[0],text:ue[0]}}},ne.escape=function(te){var ie=this.rules.inline.escape.exec(te);if(ie)return{type:"escape",raw:ie[0],text:ae(ie[1])}},ne.tag=function(te,ie,ue){var de=this.rules.inline.tag.exec(te);if(de)return!ie&&/^<a /i.test(de[0])?ie=!0:ie&&/^<\/a>/i.test(de[0])&&(ie=!1),!ue&&/^<(pre|code|kbd|script)(\s|>)/i.test(de[0])?ue=!0:ue&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(de[0])&&(ue=!1),{type:this.options.sanitize?"text":"html",raw:de[0],inLink:ie,inRawBlock:ue,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(de[0]):ae(de[0]):de[0]}},ne.link=function(te){var ie=this.rules.inline.link.exec(te);if(ie){var ue=he(ie[2],"()");if(ue>-1){var de=ie[0].indexOf("!")===0?5:4,ye=de+ie[1].length+ue;ie[2]=ie[2].substring(0,ue),ie[0]=ie[0].substring(0,ye).trim(),ie[3]=""}var Ee=ie[2],Pe="";if(this.options.pedantic){var Ue=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(Ee);Ue?(Ee=Ue[1],Pe=Ue[3]):Pe=""}else Pe=ie[3]?ie[3].slice(1,-1):"";Ee=Ee.trim().replace(/^<([\s\S]*)>$/,"$1");var Qe=ge(ie,{href:Ee&&Ee.replace(this.rules.inline._escapes,"$1"),title:Pe&&Pe.replace(this.rules.inline._escapes,"$1")},ie[0]);return Qe}},ne.reflink=function(te,ie){var ue;if((ue=this.rules.inline.reflink.exec(te))||(ue=this.rules.inline.nolink.exec(te))){var de=(ue[2]||ue[1]).replace(/\s+/g," ");if(de=ie[de.toLowerCase()],!de||!de.href){var ye=ue[0].charAt(0);return{type:"text",raw:ye,text:ye}}var Ee=ge(ue,de,ue[0]);return Ee}},ne.strong=function(te,ie,ue){ue===void 0&&(ue="");var de=this.rules.inline.strong.start.exec(te);if(de&&(!de[1]||de[1]&&(ue===""||this.rules.inline.punctuation.exec(ue)))){ie=ie.slice(-1*te.length);var ye=de[0]==="**"?this.rules.inline.strong.endAst:this.rules.inline.strong.endUnd;ye.lastIndex=0;for(var Ee;(de=ye.exec(ie))!=null;)if(Ee=this.rules.inline.strong.middle.exec(ie.slice(0,de.index+3)),Ee)return{type:"strong",raw:te.slice(0,Ee[0].length),text:te.slice(2,Ee[0].length-2)}}},ne.em=function(te,ie,ue){ue===void 0&&(ue="");var de=this.rules.inline.em.start.exec(te);if(de&&(!de[1]||de[1]&&(ue===""||this.rules.inline.punctuation.exec(ue)))){ie=ie.slice(-1*te.length);var ye=de[0]==="*"?this.rules.inline.em.endAst:this.rules.inline.em.endUnd;ye.lastIndex=0;for(var Ee;(de=ye.exec(ie))!=null;)if(Ee=this.rules.inline.em.middle.exec(ie.slice(0,de.index+2)),Ee)return{type:"em",raw:te.slice(0,Ee[0].length),text:te.slice(1,Ee[0].length-1)}}},ne.codespan=function(te){var ie=this.rules.inline.code.exec(te);if(ie){var ue=ie[2].replace(/\n/g," "),de=/[^ ]/.test(ue),ye=ue.startsWith(" ")&&ue.endsWith(" ");return de&&ye&&(ue=ue.substring(1,ue.length-1)),ue=ae(ue,!0),{type:"codespan",raw:ie[0],text:ue}}},ne.br=function(te){var ie=this.rules.inline.br.exec(te);if(ie)return{type:"br",raw:ie[0]}},ne.del=function(te){var ie=this.rules.inline.del.exec(te);if(ie)return{type:"del",raw:ie[0],text:ie[1]}},ne.autolink=function(te,ie){var ue=this.rules.inline.autolink.exec(te);if(ue){var de,ye;return ue[2]==="@"?(de=ae(this.options.mangle?ie(ue[1]):ue[1]),ye="mailto:"+de):(de=ae(ue[1]),ye=de),{type:"link",raw:ue[0],text:de,href:ye,tokens:[{type:"text",raw:de,text:de}]}}},ne.url=function(te,ie){var ue;if(ue=this.rules.inline.url.exec(te)){var de,ye;if(ue[2]==="@")de=ae(this.options.mangle?ie(ue[0]):ue[0]),ye="mailto:"+de;else{var Ee;do Ee=ue[0],ue[0]=this.rules.inline._backpedal.exec(ue[0])[0];while(Ee!==ue[0]);de=ae(ue[0]),ue[1]==="www."?ye="http://"+de:ye=de}return{type:"link",raw:ue[0],text:de,href:ye,tokens:[{type:"text",raw:de,text:de}]}}},ne.inlineText=function(te,ie,ue){var de=this.rules.inline.text.exec(te);if(de){var ye;return ie?ye=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(de[0]):ae(de[0]):de[0]:ye=ae(this.options.smartypants?ue(de[0]):de[0]),{type:"text",raw:de[0],text:ye}}},ee}(),Re=V.noopTest,Ce=V.edit,xe=V.merge,me={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:Re,table:Re,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/};me._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,me._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,me.def=Ce(me.def).replace("label",me._label).replace("title",me._title).getRegex(),me.bullet=/(?:[*+-]|\d{1,9}[.)])/,me.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,me.item=Ce(me.item,"gm").replace(/bull/g,me.bullet).getRegex(),me.list=Ce(me.list).replace(/bull/g,me.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+me.def.source+")").getRegex(),me._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",me._comment=/<!--(?!-?>)[\s\S]*?-->/,me.html=Ce(me.html,"i").replace("comment",me._comment).replace("tag",me._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),me.paragraph=Ce(me._paragraph).replace("hr",me.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",me._tag).getRegex(),me.blockquote=Ce(me.blockquote).replace("paragraph",me.paragraph).getRegex(),me.normal=xe({},me),me.gfm=xe({},me.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*|$)"}),me.gfm.nptable=Ce(me.gfm.nptable).replace("hr",me.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",me._tag).getRegex(),me.gfm.table=Ce(me.gfm.table).replace("hr",me.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",me._tag).getRegex(),me.pedantic=xe({},me.normal,{html:Ce(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",me._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:Re,paragraph:Ce(me.normal._paragraph).replace("hr",me.hr).replace("heading",` *#{1,6} *[^
|
|
]`).replace("lheading",me.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var G={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Re,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:Re,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))|(?= {2,}\n))/,punctuation:/^([\s*punctuation])/};G._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",G.punctuation=Ce(G.punctuation).replace(/punctuation/g,G._punctuation).getRegex(),G._blockSkip="\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>",G._overlapSkip="__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*",G.em.start=Ce(G.em.start).replace(/punctuation/g,G._punctuation).getRegex(),G.em.middle=Ce(G.em.middle).replace(/punctuation/g,G._punctuation).replace(/overlapSkip/g,G._overlapSkip).getRegex(),G.em.endAst=Ce(G.em.endAst,"g").replace(/punctuation/g,G._punctuation).getRegex(),G.em.endUnd=Ce(G.em.endUnd,"g").replace(/punctuation/g,G._punctuation).getRegex(),G.strong.start=Ce(G.strong.start).replace(/punctuation/g,G._punctuation).getRegex(),G.strong.middle=Ce(G.strong.middle).replace(/punctuation/g,G._punctuation).replace(/blockSkip/g,G._blockSkip).getRegex(),G.strong.endAst=Ce(G.strong.endAst,"g").replace(/punctuation/g,G._punctuation).getRegex(),G.strong.endUnd=Ce(G.strong.endUnd,"g").replace(/punctuation/g,G._punctuation).getRegex(),G.blockSkip=Ce(G._blockSkip,"g").getRegex(),G.overlapSkip=Ce(G._overlapSkip,"g").getRegex(),G._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,G._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,G._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])?)+(?![-_])/,G.autolink=Ce(G.autolink).replace("scheme",G._scheme).replace("email",G._email).getRegex(),G._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,G.tag=Ce(G.tag).replace("comment",me._comment).replace("attribute",G._attribute).getRegex(),G._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,G._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,G._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,G.link=Ce(G.link).replace("label",G._label).replace("href",G._href).replace("title",G._title).getRegex(),G.reflink=Ce(G.reflink).replace("label",G._label).getRegex(),G.reflinkSearch=Ce(G.reflinkSearch,"g").replace("reflink",G.reflink).replace("nolink",G.nolink).getRegex(),G.normal=xe({},G),G.pedantic=xe({},G.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:Ce(/^!?\[(label)\]\((.*?)\)/).replace("label",G._label).getRegex(),reflink:Ce(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",G._label).getRegex()}),G.gfm=xe({},G.normal,{escape:Ce(G.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.!#$%&'*+\/=?_`{\|}~-]+@))/}),G.gfm.url=Ce(G.gfm.url,"i").replace("email",G.gfm._extended_email).getRegex(),G.breaks=xe({},G.gfm,{br:Ce(G.br).replace("{2,}","*").getRegex(),text:Ce(G.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});var s={block:me,inline:G},c=z.defaults,R=s.block,X=s.inline;function N(ee){return ee.replace(/---/g,"\u2014").replace(/--/g,"\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1\u201C").replace(/"/g,"\u201D").replace(/\.{3}/g,"\u2026")}function oe(ee){var ne="",le,te,ie=ee.length;for(le=0;le<ie;le++)te=ee.charCodeAt(le),Math.random()>.5&&(te="x"+te.toString(16)),ne+="&#"+te+";";return ne}var be=function(){function ee(le){this.tokens=[],this.tokens.links=Object.create(null),this.options=le||c,this.options.tokenizer=this.options.tokenizer||new Se,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var te={block:R.normal,inline:X.normal};this.options.pedantic?(te.block=R.pedantic,te.inline=X.pedantic):this.options.gfm&&(te.block=R.gfm,this.options.breaks?te.inline=X.breaks:te.inline=X.gfm),this.tokenizer.rules=te}ee.lex=function(te,ie){var ue=new ee(ie);return ue.lex(te)};var ne=ee.prototype;return ne.lex=function(te){return te=te.replace(/\r\n|\r/g,`
|
|
`).replace(/\t/g," "),this.blockTokens(te,this.tokens,!0),this.inline(this.tokens),this.tokens},ne.blockTokens=function(te,ie,ue){ie===void 0&&(ie=[]),ue===void 0&&(ue=!0),te=te.replace(/^ +$/gm,"");for(var de,ye,Ee,Pe;te;){if(de=this.tokenizer.space(te)){te=te.substring(de.raw.length),de.type&&ie.push(de);continue}if(de=this.tokenizer.code(te,ie)){te=te.substring(de.raw.length),de.type?ie.push(de):(Pe=ie[ie.length-1],Pe.raw+=`
|
|
`+de.raw,Pe.text+=`
|
|
`+de.text);continue}if(de=this.tokenizer.fences(te)){te=te.substring(de.raw.length),ie.push(de);continue}if(de=this.tokenizer.heading(te)){te=te.substring(de.raw.length),ie.push(de);continue}if(de=this.tokenizer.nptable(te)){te=te.substring(de.raw.length),ie.push(de);continue}if(de=this.tokenizer.hr(te)){te=te.substring(de.raw.length),ie.push(de);continue}if(de=this.tokenizer.blockquote(te)){te=te.substring(de.raw.length),de.tokens=this.blockTokens(de.text,[],ue),ie.push(de);continue}if(de=this.tokenizer.list(te)){for(te=te.substring(de.raw.length),Ee=de.items.length,ye=0;ye<Ee;ye++)de.items[ye].tokens=this.blockTokens(de.items[ye].text,[],!1);ie.push(de);continue}if(de=this.tokenizer.html(te)){te=te.substring(de.raw.length),ie.push(de);continue}if(ue&&(de=this.tokenizer.def(te))){te=te.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(te)){te=te.substring(de.raw.length),ie.push(de);continue}if(de=this.tokenizer.lheading(te)){te=te.substring(de.raw.length),ie.push(de);continue}if(ue&&(de=this.tokenizer.paragraph(te))){te=te.substring(de.raw.length),ie.push(de);continue}if(de=this.tokenizer.text(te,ie)){te=te.substring(de.raw.length),de.type?ie.push(de):(Pe=ie[ie.length-1],Pe.raw+=`
|
|
`+de.raw,Pe.text+=`
|
|
`+de.text);continue}if(te){var Ue="Infinite loop on byte: "+te.charCodeAt(0);if(this.options.silent){console.error(Ue);break}else throw new Error(Ue)}}return ie},ne.inline=function(te){var ie,ue,de,ye,Ee,Pe,Ue=te.length;for(ie=0;ie<Ue;ie++){Pe=te[ie];switch(Pe.type){case"paragraph":case"text":case"heading":{Pe.tokens=[],this.inlineTokens(Pe.text,Pe.tokens);break}case"table":{for(Pe.tokens={header:[],cells:[]},ye=Pe.header.length,ue=0;ue<ye;ue++)Pe.tokens.header[ue]=[],this.inlineTokens(Pe.header[ue],Pe.tokens.header[ue]);for(ye=Pe.cells.length,ue=0;ue<ye;ue++)for(Ee=Pe.cells[ue],Pe.tokens.cells[ue]=[],de=0;de<Ee.length;de++)Pe.tokens.cells[ue][de]=[],this.inlineTokens(Ee[de],Pe.tokens.cells[ue][de]);break}case"blockquote":{this.inline(Pe.tokens);break}case"list":{for(ye=Pe.items.length,ue=0;ue<ye;ue++)this.inline(Pe.items[ue].tokens);break}}}return te},ne.inlineTokens=function(te,ie,ue,de,ye){ie===void 0&&(ie=[]),ue===void 0&&(ue=!1),de===void 0&&(de=!1),ye===void 0&&(ye="");var Ee,Pe=te,Ue;if(this.tokens.links){var Qe=Object.keys(this.tokens.links);if(Qe.length>0)for(;(Ue=this.tokenizer.rules.inline.reflinkSearch.exec(Pe))!=null;)Qe.includes(Ue[0].slice(Ue[0].lastIndexOf("[")+1,-1))&&(Pe=Pe.slice(0,Ue.index)+"["+"a".repeat(Ue[0].length-2)+"]"+Pe.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(Ue=this.tokenizer.rules.inline.blockSkip.exec(Pe))!=null;)Pe=Pe.slice(0,Ue.index)+"["+"a".repeat(Ue[0].length-2)+"]"+Pe.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;te;){if(Ee=this.tokenizer.escape(te)){te=te.substring(Ee.raw.length),ie.push(Ee);continue}if(Ee=this.tokenizer.tag(te,ue,de)){te=te.substring(Ee.raw.length),ue=Ee.inLink,de=Ee.inRawBlock,ie.push(Ee);continue}if(Ee=this.tokenizer.link(te)){te=te.substring(Ee.raw.length),Ee.type==="link"&&(Ee.tokens=this.inlineTokens(Ee.text,[],!0,de)),ie.push(Ee);continue}if(Ee=this.tokenizer.reflink(te,this.tokens.links)){te=te.substring(Ee.raw.length),Ee.type==="link"&&(Ee.tokens=this.inlineTokens(Ee.text,[],!0,de)),ie.push(Ee);continue}if(Ee=this.tokenizer.strong(te,Pe,ye)){te=te.substring(Ee.raw.length),Ee.tokens=this.inlineTokens(Ee.text,[],ue,de),ie.push(Ee);continue}if(Ee=this.tokenizer.em(te,Pe,ye)){te=te.substring(Ee.raw.length),Ee.tokens=this.inlineTokens(Ee.text,[],ue,de),ie.push(Ee);continue}if(Ee=this.tokenizer.codespan(te)){te=te.substring(Ee.raw.length),ie.push(Ee);continue}if(Ee=this.tokenizer.br(te)){te=te.substring(Ee.raw.length),ie.push(Ee);continue}if(Ee=this.tokenizer.del(te)){te=te.substring(Ee.raw.length),Ee.tokens=this.inlineTokens(Ee.text,[],ue,de),ie.push(Ee);continue}if(Ee=this.tokenizer.autolink(te,oe)){te=te.substring(Ee.raw.length),ie.push(Ee);continue}if(!ue&&(Ee=this.tokenizer.url(te,oe))){te=te.substring(Ee.raw.length),ie.push(Ee);continue}if(Ee=this.tokenizer.inlineText(te,de,N)){te=te.substring(Ee.raw.length),ye=Ee.raw.slice(-1),ie.push(Ee);continue}if(te){var tt="Infinite loop on byte: "+te.charCodeAt(0);if(this.options.silent){console.error(tt);break}else throw new Error(tt)}}return ie},Z(ee,null,[{key:"rules",get:function(){return{block:R,inline:X}}}]),ee}(),we=z.defaults,_e=V.cleanUrl,Le=V.escape,Oe=function(){function ee(le){this.options=le||we}var ne=ee.prototype;return ne.code=function(te,ie,ue){var de=(ie||"").match(/\S*/)[0];if(this.options.highlight){var ye=this.options.highlight(te,de);ye!=null&&ye!==te&&(ue=!0,te=ye)}return de?'<pre><code class="'+this.options.langPrefix+Le(de,!0)+'">'+(ue?te:Le(te,!0))+`</code></pre>
|
|
`:"<pre><code>"+(ue?te:Le(te,!0))+`</code></pre>
|
|
`},ne.blockquote=function(te){return`<blockquote>
|
|
`+te+`</blockquote>
|
|
`},ne.html=function(te){return te},ne.heading=function(te,ie,ue,de){return this.options.headerIds?"<h"+ie+' id="'+this.options.headerPrefix+de.slug(ue)+'">'+te+"</h"+ie+`>
|
|
`:"<h"+ie+">"+te+"</h"+ie+`>
|
|
`},ne.hr=function(){return this.options.xhtml?`<hr/>
|
|
`:`<hr>
|
|
`},ne.list=function(te,ie,ue){var de=ie?"ol":"ul",ye=ie&&ue!==1?' start="'+ue+'"':"";return"<"+de+ye+`>
|
|
`+te+"</"+de+`>
|
|
`},ne.listitem=function(te){return"<li>"+te+`</li>
|
|
`},ne.checkbox=function(te){return"<input "+(te?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},ne.paragraph=function(te){return"<p>"+te+`</p>
|
|
`},ne.table=function(te,ie){return ie&&(ie="<tbody>"+ie+"</tbody>"),`<table>
|
|
<thead>
|
|
`+te+`</thead>
|
|
`+ie+`</table>
|
|
`},ne.tablerow=function(te){return`<tr>
|
|
`+te+`</tr>
|
|
`},ne.tablecell=function(te,ie){var ue=ie.header?"th":"td",de=ie.align?"<"+ue+' align="'+ie.align+'">':"<"+ue+">";return de+te+"</"+ue+`>
|
|
`},ne.strong=function(te){return"<strong>"+te+"</strong>"},ne.em=function(te){return"<em>"+te+"</em>"},ne.codespan=function(te){return"<code>"+te+"</code>"},ne.br=function(){return this.options.xhtml?"<br/>":"<br>"},ne.del=function(te){return"<del>"+te+"</del>"},ne.link=function(te,ie,ue){if(te=_e(this.options.sanitize,this.options.baseUrl,te),te===null)return ue;var de='<a href="'+Le(te)+'"';return ie&&(de+=' title="'+ie+'"'),de+=">"+ue+"</a>",de},ne.image=function(te,ie,ue){if(te=_e(this.options.sanitize,this.options.baseUrl,te),te===null)return ue;var de='<img src="'+te+'" alt="'+ue+'"';return ie&&(de+=' title="'+ie+'"'),de+=this.options.xhtml?"/>":">",de},ne.text=function(te){return te},ee}(),Me=function(){function ee(){}var ne=ee.prototype;return ne.strong=function(te){return te},ne.em=function(te){return te},ne.codespan=function(te){return te},ne.del=function(te){return te},ne.html=function(te){return te},ne.text=function(te){return te},ne.link=function(te,ie,ue){return""+ue},ne.image=function(te,ie,ue){return""+ue},ne.br=function(){return""},ee}(),Be=function(){function ee(){this.seen={}}var ne=ee.prototype;return ne.slug=function(te){var ie=te.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(ie)){var ue=ie;do this.seen[ue]++,ie=ue+"-"+this.seen[ue];while(this.seen.hasOwnProperty(ie))}return this.seen[ie]=0,ie},ee}(),Ve=z.defaults,Xe=V.unescape,ze=function(){function ee(le){this.options=le||Ve,this.options.renderer=this.options.renderer||new Oe,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Me,this.slugger=new Be}ee.parse=function(te,ie){var ue=new ee(ie);return ue.parse(te)};var ne=ee.prototype;return ne.parse=function(te,ie){ie===void 0&&(ie=!0);var ue="",de,ye,Ee,Pe,Ue,Qe,tt,xt,st,nt,wt,ot,vt,bt,Ke,ir,nr,Kt,Ot=te.length;for(de=0;de<Ot;de++){nt=te[de];switch(nt.type){case"space":continue;case"hr":{ue+=this.renderer.hr();continue}case"heading":{ue+=this.renderer.heading(this.parseInline(nt.tokens),nt.depth,Xe(this.parseInline(nt.tokens,this.textRenderer)),this.slugger);continue}case"code":{ue+=this.renderer.code(nt.text,nt.lang,nt.escaped);continue}case"table":{for(xt="",tt="",Pe=nt.header.length,ye=0;ye<Pe;ye++)tt+=this.renderer.tablecell(this.parseInline(nt.tokens.header[ye]),{header:!0,align:nt.align[ye]});for(xt+=this.renderer.tablerow(tt),st="",Pe=nt.cells.length,ye=0;ye<Pe;ye++){for(Qe=nt.tokens.cells[ye],tt="",Ue=Qe.length,Ee=0;Ee<Ue;Ee++)tt+=this.renderer.tablecell(this.parseInline(Qe[Ee]),{header:!1,align:nt.align[Ee]});st+=this.renderer.tablerow(tt)}ue+=this.renderer.table(xt,st);continue}case"blockquote":{st=this.parse(nt.tokens),ue+=this.renderer.blockquote(st);continue}case"list":{for(wt=nt.ordered,ot=nt.start,vt=nt.loose,Pe=nt.items.length,st="",ye=0;ye<Pe;ye++)Ke=nt.items[ye],ir=Ke.checked,nr=Ke.task,bt="",Ke.task&&(Kt=this.renderer.checkbox(ir),vt?Ke.tokens.length>0&&Ke.tokens[0].type==="text"?(Ke.tokens[0].text=Kt+" "+Ke.tokens[0].text,Ke.tokens[0].tokens&&Ke.tokens[0].tokens.length>0&&Ke.tokens[0].tokens[0].type==="text"&&(Ke.tokens[0].tokens[0].text=Kt+" "+Ke.tokens[0].tokens[0].text)):Ke.tokens.unshift({type:"text",text:Kt}):bt+=Kt),bt+=this.parse(Ke.tokens,vt),st+=this.renderer.listitem(bt,nr,ir);ue+=this.renderer.list(st,wt,ot);continue}case"html":{ue+=this.renderer.html(nt.text);continue}case"paragraph":{ue+=this.renderer.paragraph(this.parseInline(nt.tokens));continue}case"text":{for(st=nt.tokens?this.parseInline(nt.tokens):nt.text;de+1<Ot&&te[de+1].type==="text";)nt=te[++de],st+=`
|
|
`+(nt.tokens?this.parseInline(nt.tokens):nt.text);ue+=ie?this.renderer.paragraph(st):st;continue}default:{var ar='Token with "'+nt.type+'" type was not found.';if(this.options.silent){console.error(ar);return}else throw new Error(ar)}}}return ue},ne.parseInline=function(te,ie){ie=ie||this.renderer;var ue="",de,ye,Ee=te.length;for(de=0;de<Ee;de++){ye=te[de];switch(ye.type){case"escape":{ue+=ie.text(ye.text);break}case"html":{ue+=ie.html(ye.text);break}case"link":{ue+=ie.link(ye.href,ye.title,this.parseInline(ye.tokens,ie));break}case"image":{ue+=ie.image(ye.href,ye.title,ye.text);break}case"strong":{ue+=ie.strong(this.parseInline(ye.tokens,ie));break}case"em":{ue+=ie.em(this.parseInline(ye.tokens,ie));break}case"codespan":{ue+=ie.codespan(ye.text);break}case"br":{ue+=ie.br();break}case"del":{ue+=ie.del(this.parseInline(ye.tokens,ie));break}case"text":{ue+=ie.text(ye.text);break}default:{var Pe='Token with "'+ye.type+'" type was not found.';if(this.options.silent){console.error(Pe);return}else throw new Error(Pe)}}}return ue},ee}(),rt=V.merge,je=V.checkSanitizeDeprecation,We=V.escape,ke=z.getDefaults,Je=z.changeDefaults,qe=z.defaults;function se(ee,ne,le){if(typeof ee=="undefined"||ee===null)throw new Error("marked(): input parameter is undefined or null");if(typeof ee!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(ee)+", string expected");if(typeof ne=="function"&&(le=ne,ne=null),ne=rt({},se.defaults,ne||{}),je(ne),le){var te=ne.highlight,ie;try{ie=be.lex(ee,ne)}catch(Ee){return le(Ee)}var ue=function(Pe){var Ue;if(!Pe)try{Ue=ze.parse(ie,ne)}catch(Qe){Pe=Qe}return ne.highlight=te,Pe?le(Pe):le(null,Ue)};if(!te||te.length<3)return ue();if(delete ne.highlight,!ie.length)return ue();var de=0;se.walkTokens(ie,function(Ee){Ee.type==="code"&&(de++,setTimeout(function(){te(Ee.text,Ee.lang,function(Pe,Ue){if(Pe)return ue(Pe);Ue!=null&&Ue!==Ee.text&&(Ee.text=Ue,Ee.escaped=!0),de--,de===0&&ue()})},0))}),de===0&&ue();return}try{var ye=be.lex(ee,ne);return ne.walkTokens&&se.walkTokens(ye,ne.walkTokens),ze.parse(ye,ne)}catch(Ee){if(Ee.message+=`
|
|
Please report this to https://github.com/markedjs/marked.`,ne.silent)return"<p>An error occurred:</p><pre>"+We(Ee.message+"",!0)+"</pre>";throw Ee}}se.options=se.setOptions=function(ee){return rt(se.defaults,ee),Je(se.defaults),se},se.getDefaults=ke,se.defaults=qe,se.use=function(ee){var ne=rt({},ee);if(ee.renderer&&function(){var te=se.defaults.renderer||new Oe,ie=function(ye){var Ee=te[ye];te[ye]=function(){for(var Pe=arguments.length,Ue=new Array(Pe),Qe=0;Qe<Pe;Qe++)Ue[Qe]=arguments[Qe];var tt=ee.renderer[ye].apply(te,Ue);return tt===!1&&(tt=Ee.apply(te,Ue)),tt}};for(var ue in ee.renderer)ie(ue);ne.renderer=te}(),ee.tokenizer&&function(){var te=se.defaults.tokenizer||new Se,ie=function(ye){var Ee=te[ye];te[ye]=function(){for(var Pe=arguments.length,Ue=new Array(Pe),Qe=0;Qe<Pe;Qe++)Ue[Qe]=arguments[Qe];var tt=ee.tokenizer[ye].apply(te,Ue);return tt===!1&&(tt=Ee.apply(te,Ue)),tt}};for(var ue in ee.tokenizer)ie(ue);ne.tokenizer=te}(),ee.walkTokens){var le=se.defaults.walkTokens;ne.walkTokens=function(te){ee.walkTokens(te),le&&le(te)}}se.setOptions(ne)},se.walkTokens=function(ee,ne){for(var le=U(ee),te;!(te=le()).done;){var ie=te.value;ne(ie);switch(ie.type){case"table":{for(var ue=U(ie.tokens.header),de;!(de=ue()).done;){var ye=de.value;se.walkTokens(ye,ne)}for(var Ee=U(ie.tokens.cells),Pe;!(Pe=Ee()).done;)for(var Ue=Pe.value,Qe=U(Ue),tt;!(tt=Qe()).done;){var xt=tt.value;se.walkTokens(xt,ne)}break}case"list":{se.walkTokens(ie.items,ne);break}default:ie.tokens&&se.walkTokens(ie.tokens,ne)}}},se.Parser=ze,se.parser=ze.parse,se.Renderer=Oe,se.TextRenderer=Me,se.Lexer=be,se.lexer=be.lex,se.Tokenizer=Se,se.Slugger=Be,se.parse=se;var q=se;return q})},ELLl:function(pt,at,pe){(function(fe){fe(pe("VrN/"))})(function(fe){var Z={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},_=fe.Pos;fe.defineOption("autoCloseBrackets",!1,function(w,y,h){h&&h!=fe.Init&&(w.removeKeyMap(U),w.state.closeBrackets=null),y&&(D(J(y,"pairs")),w.state.closeBrackets=y,w.addKeyMap(U))});function J(w,y){return y=="pairs"&&typeof w=="string"?w:typeof w=="object"&&w[y]!=null?w[y]:Z[y]}var U={Backspace:B,Enter:O};function D(w){for(var y=0;y<w.length;y++){var h=w.charAt(y),o="'"+h+"'";U[o]||(U[o]=z(h))}}D(Z.pairs+"`");function z(w){return function(y){return A(y,w)}}function H(w){var y=w.state.closeBrackets;if(!y||y.override)return y;var h=w.getModeAt(w.getCursor());return h.closeBrackets||y}function B(w){var y=H(w);if(!y||w.getOption("disableInput"))return fe.Pass;for(var h=J(y,"pairs"),o=w.listSelections(),l=0;l<o.length;l++){if(!o[l].empty())return fe.Pass;var u=P(w,o[l].head);if(!u||h.indexOf(u)%2!=0)return fe.Pass}for(var l=o.length-1;l>=0;l--){var C=o[l].head;w.replaceRange("",_(C.line,C.ch-1),_(C.line,C.ch+1),"+delete")}}function O(w){var y=H(w),h=y&&J(y,"explode");if(!h||w.getOption("disableInput"))return fe.Pass;for(var o=w.listSelections(),l=0;l<o.length;l++){if(!o[l].empty())return fe.Pass;var u=P(w,o[l].head);if(!u||h.indexOf(u)%2!=0)return fe.Pass}w.operation(function(){var C=w.lineSeparator()||`
|
|
`;w.replaceSelection(C+C,null),w.execCommand("goCharLeft"),o=w.listSelections();for(var v=0;v<o.length;v++){var m=o[v].head.line;w.indentLine(m,null,!0),w.indentLine(m+1,null,!0)}})}function b(w){var y=fe.cmpPos(w.anchor,w.head)>0;return{anchor:new _(w.anchor.line,w.anchor.ch+(y?-1:1)),head:new _(w.head.line,w.head.ch+(y?1:-1))}}function A(w,y){var h=H(w);if(!h||w.getOption("disableInput"))return fe.Pass;var o=J(h,"pairs"),l=o.indexOf(y);if(l==-1)return fe.Pass;for(var u=J(h,"closeBefore"),C=J(h,"triples"),v=o.charAt(l+1)==y,m=w.listSelections(),k=l%2==0,x,f=0;f<m.length;f++){var p=m[f],d=p.head,a,E=w.getRange(d,_(d.line,d.ch+1));if(k&&!p.empty())a="surround";else if((v||!k)&&E==y)v&&L(w,d)?a="both":C.indexOf(y)>=0&&w.getRange(d,_(d.line,d.ch+3))==y+y+y?a="skipThree":a="skip";else if(v&&d.ch>1&&C.indexOf(y)>=0&&w.getRange(_(d.line,d.ch-2),d)==y+y){if(d.ch>2&&/\bstring/.test(w.getTokenTypeAt(_(d.line,d.ch-2))))return fe.Pass;a="addFour"}else if(v){var g=d.ch==0?" ":w.getRange(_(d.line,d.ch-1),d);if(!fe.isWordChar(E)&&g!=y&&!fe.isWordChar(g))a="both";else return fe.Pass}else if(k&&(E.length===0||/\s/.test(E)||u.indexOf(E)>-1))a="both";else return fe.Pass;if(!x)x=a;else if(x!=a)return fe.Pass}var S=l%2?o.charAt(l-1):y,F=l%2?y:o.charAt(l+1);w.operation(function(){if(x=="skip")w.execCommand("goCharRight");else if(x=="skipThree")for(var W=0;W<3;W++)w.execCommand("goCharRight");else if(x=="surround"){for(var K=w.getSelections(),W=0;W<K.length;W++)K[W]=S+K[W]+F;w.replaceSelections(K,"around"),K=w.listSelections().slice();for(var W=0;W<K.length;W++)K[W]=b(K[W]);w.setSelections(K)}else x=="both"?(w.replaceSelection(S+F,null),w.triggerElectric(S+F),w.execCommand("goCharLeft")):x=="addFour"&&(w.replaceSelection(S+S+S+S,"before"),w.execCommand("goCharRight"))})}function P(w,y){var h=w.getRange(_(y.line,y.ch-1),_(y.line,y.ch+1));return h.length==2?h:null}function L(w,y){var h=w.getTokenAt(_(y.line,y.ch+1));return/\bstring/.test(h.type)&&h.start==y.ch&&(y.ch==0||!/\bstring/.test(w.getTokenTypeAt(y)))}})},GfqC:function(pt,at,pe){"use strict";var fe=pe("q1tI"),Z=pe.n(fe),_=pe("TSYQ"),J=pe.n(_);function U(V,M){var I="cannot "+V.method+" "+V.action+" "+M.status+"'",$=new Error(I);return $.status=M.status,$.method=V.method,$.url=V.action,$}function D(V){var M=V.responseText||V.response;if(!M)return M;try{return JSON.parse(M)}catch(I){return M}}function z(V){var M=new XMLHttpRequest;V.onProgress&&M.upload&&(M.upload.onprogress=function(he){he.total>0&&(he.percent=he.loaded/he.total*100),V.onProgress(he)});var I=new FormData;V.data&&Object.keys(V.data).forEach(function(ae){var he=V.data[ae];if(Array.isArray(he)){he.forEach(function(ge){I.append(ae+"[]",ge)});return}I.append(ae,V.data[ae])}),V.file instanceof Blob?I.append(V.filename,V.file,V.file.name):I.append(V.filename,V.file),M.onerror=function(he){V.onError(he)},M.onload=function(){return M.status<200||M.status>=300?V.onError(U(V,M),D(M)):V.onSuccess(D(M),M)},M.open(V.method,V.action,!0),V.withCredentials&&"withCredentials"in M&&(M.withCredentials=!0);var $=V.headers||{};return $["X-Requested-With"]!==null&&M.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys($).forEach(function(ae){$[ae]!==null&&M.setRequestHeader(ae,$[ae])}),M.send(I),{abort:function(){M.abort()}}}var H=+new Date,B=0;function O(){return"rc-upload-"+H+"-"+ ++B}function b(V,M){return V.indexOf(M,V.length-M.length)!==-1}var A=function(V,M){if(V&&M){var I=Array.isArray(M)?M:M.split(","),$=V.name||"",ae=V.type||"",he=ae.replace(/\/.*$/,"");return I.some(function(ge){var De=ge.trim();return De.charAt(0)==="."?b($.toLowerCase(),De.toLowerCase()):/\/\*$/.test(De)?he===De.replace(/\/.*$/,""):ae===De})}return!0};function P(V,M){var I=V.createReader(),$=[];function ae(){I.readEntries(function(he){var ge=Array.prototype.slice.apply(he);$=$.concat(ge);var De=!ge.length;De?M($):ae()})}ae()}var L=function(M,I,$){var ae=function he(ge,De){De=De||"",ge.isFile?ge.file(function(Se){$(Se)&&(ge.fullPath&&!Se.webkitRelativePath&&(Object.defineProperties(Se,{webkitRelativePath:{writable:!0}}),Se.webkitRelativePath=ge.fullPath.replace(/^\//,""),Object.defineProperties(Se,{webkitRelativePath:{writable:!1}})),I([Se]))}):ge.isDirectory&&P(ge,function(Se){Se.forEach(function(Re){he(Re,""+De+ge.name+"/")})})};M.forEach(function(he){ae(he.webkitGetAsEntry())})},w=L,y=Object.assign||function(V){for(var M=1;M<arguments.length;M++){var I=arguments[M];for(var $ in I)Object.prototype.hasOwnProperty.call(I,$)&&(V[$]=I[$])}return V},h=function(){function V(M,I){var $=[],ae=!0,he=!1,ge=void 0;try{for(var De=M[Symbol.iterator](),Se;!(ae=(Se=De.next()).done)&&!($.push(Se.value),I&&$.length===I);ae=!0);}catch(Re){he=!0,ge=Re}finally{try{!ae&&De.return&&De.return()}finally{if(he)throw ge}}return $}return function(M,I){if(Array.isArray(M))return M;if(Symbol.iterator in Object(M))return V(M,I);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),o=function(){function V(M,I){for(var $=0;$<I.length;$++){var ae=I[$];ae.enumerable=ae.enumerable||!1,ae.configurable=!0,"value"in ae&&(ae.writable=!0),Object.defineProperty(M,ae.key,ae)}}return function(M,I,$){return I&&V(M.prototype,I),$&&V(M,$),M}}();function l(V,M,I){return M in V?Object.defineProperty(V,M,{value:I,enumerable:!0,configurable:!0,writable:!0}):V[M]=I,V}function u(V,M){var I={};for(var $ in V){if(M.indexOf($)>=0)continue;if(!Object.prototype.hasOwnProperty.call(V,$))continue;I[$]=V[$]}return I}function C(V,M){if(!(V instanceof M))throw new TypeError("Cannot call a class as a function")}function v(V,M){if(!V)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return M&&(typeof M=="object"||typeof M=="function")?M:V}function m(V,M){if(typeof M!="function"&&M!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof M);V.prototype=Object.create(M&&M.prototype,{constructor:{value:V,enumerable:!1,writable:!0,configurable:!0}}),M&&(Object.setPrototypeOf?Object.setPrototypeOf(V,M):V.__proto__=M)}var k=function(M){return Object.keys(M).reduce(function(I,$){return($.substr(0,5)==="data-"||$.substr(0,5)==="aria-"||$==="role")&&(I[$]=M[$]),I},{})},x=function(V){m(M,V);function M(){var I,$,ae,he;C(this,M);for(var ge=arguments.length,De=Array(ge),Se=0;Se<ge;Se++)De[Se]=arguments[Se];return he=($=(ae=v(this,(I=M.__proto__||Object.getPrototypeOf(M)).call.apply(I,[this].concat(De))),ae),ae.state={uid:O()},ae.reqs={},ae.onChange=function(Re){var Ce=Re.target.files;ae.uploadFiles(Ce),ae.reset()},ae.onClick=function(Re){var Ce=ae.fileInput;if(!Ce)return;var xe=ae.props,me=xe.children,G=xe.onClick;me&&me.type==="button"&&(Ce.parentNode.focus(),Ce.parentNode.querySelector("button").blur()),Ce.click(),G&&G(Re)},ae.onKeyDown=function(Re){Re.key==="Enter"&&ae.onClick()},ae.onFileDrop=function(Re){var Ce=ae.props.multiple;if(Re.preventDefault(),Re.type==="dragover")return;if(ae.props.directory)w(Array.prototype.slice.call(Re.dataTransfer.items),ae.uploadFiles,function(me){return A(me,ae.props.accept)});else{var xe=Array.prototype.slice.call(Re.dataTransfer.files).filter(function(me){return A(me,ae.props.accept)});Ce===!1&&(xe=xe.slice(0,1)),ae.uploadFiles(xe)}},ae.uploadFiles=function(Re){var Ce=Array.prototype.slice.call(Re);Ce.map(function(xe){return xe.uid=O(),xe}).forEach(function(xe){ae.upload(xe,Ce)})},ae.saveFileInput=function(Re){ae.fileInput=Re},$),v(ae,he)}return o(M,[{key:"componentDidMount",value:function(){this._isMounted=!0}},{key:"componentWillUnmount",value:function(){this._isMounted=!1,this.abort()}},{key:"upload",value:function($,ae){var he=this,ge=this.props;if(!ge.beforeUpload)return setTimeout(function(){return he.post($)},0);var De=ge.beforeUpload($,ae);De&&De.then?De.then(function(Se){var Re=Object.prototype.toString.call(Se);return Re==="[object File]"||Re==="[object Blob]"?he.post(Se):he.post($)}).catch(function(Se){console.log(Se)}):De!==!1&&setTimeout(function(){return he.post($)},0);return}},{key:"post",value:function($){var ae=this;if(!this._isMounted)return;var he=this.props,ge=he.onStart,De=he.onProgress,Se=he.transformFile,Re=Se===void 0?function(Ce){return Ce}:Se;new Promise(function(Ce){var xe=he.action;return typeof xe=="function"&&(xe=xe($)),Ce(xe)}).then(function(Ce){var xe=$.uid,me=he.customRequest||z,G=Promise.resolve(Re($)).then(function(s){var c=he.data;return typeof c=="function"&&(c=c(s)),Promise.all([s,c])}).catch(function(s){console.error(s)});G.then(function(s){var c=h(s,2),R=c[0],X=c[1],N={action:Ce,filename:he.name,data:X,file:R,headers:he.headers,withCredentials:he.withCredentials,method:he.method||"post",onProgress:De?function(oe){De(oe,$)}:null,onSuccess:function(be,we){delete ae.reqs[xe],he.onSuccess(be,$,we)},onError:function(be,we){delete ae.reqs[xe],he.onError(be,we,$)}};ge($),ae.reqs[xe]=me(N)})})}},{key:"reset",value:function(){this.setState({uid:O()})}},{key:"abort",value:function($){var ae=this.reqs;if($){var he=$;$&&$.uid&&(he=$.uid),ae[he]&&ae[he].abort&&ae[he].abort(),delete ae[he]}else Object.keys(ae).forEach(function(ge){ae[ge]&&ae[ge].abort&&ae[ge].abort(),delete ae[ge]})}},{key:"render",value:function(){var $,ae=this.props,he=ae.component,ge=ae.prefixCls,De=ae.className,Se=ae.disabled,Re=ae.id,Ce=ae.style,xe=ae.multiple,me=ae.accept,G=ae.children,s=ae.directory,c=ae.openFileDialogOnClick,R=ae.onMouseEnter,X=ae.onMouseLeave,N=u(ae,["component","prefixCls","className","disabled","id","style","multiple","accept","children","directory","openFileDialogOnClick","onMouseEnter","onMouseLeave"]),oe=J()(($={},l($,ge,!0),l($,ge+"-disabled",Se),l($,De,De),$)),be=Se?{}:{onClick:c?this.onClick:function(){},onKeyDown:c?this.onKeyDown:function(){},onMouseEnter:R,onMouseLeave:X,onDrop:this.onFileDrop,onDragOver:this.onFileDrop,tabIndex:"0"};return Z.a.createElement(he,y({},be,{className:oe,role:"button",style:Ce}),Z.a.createElement("input",y({},k(N),{id:Re,type:"file",ref:this.saveFileInput,onClick:function(_e){return _e.stopPropagation()},key:this.state.uid,style:{display:"none"},accept:me,directory:s?"directory":null,webkitdirectory:s?"webkitdirectory":null,multiple:xe,onChange:this.onChange})),G)}}]),M}(fe.Component),f=x,p=Object.assign||function(V){for(var M=1;M<arguments.length;M++){var I=arguments[M];for(var $ in I)Object.prototype.hasOwnProperty.call(I,$)&&(V[$]=I[$])}return V},d=function(){function V(M,I){for(var $=0;$<I.length;$++){var ae=I[$];ae.enumerable=ae.enumerable||!1,ae.configurable=!0,"value"in ae&&(ae.writable=!0),Object.defineProperty(M,ae.key,ae)}}return function(M,I,$){return I&&V(M.prototype,I),$&&V(M,$),M}}();function a(V,M){if(!(V instanceof M))throw new TypeError("Cannot call a class as a function")}function E(V,M){if(!V)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return M&&(typeof M=="object"||typeof M=="function")?M:V}function g(V,M){if(typeof M!="function"&&M!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof M);V.prototype=Object.create(M&&M.prototype,{constructor:{value:V,enumerable:!1,writable:!0,configurable:!0}}),M&&(Object.setPrototypeOf?Object.setPrototypeOf(V,M):V.__proto__=M)}function S(){}var F=function(V){g(M,V);function M(){var I,$,ae,he;a(this,M);for(var ge=arguments.length,De=Array(ge),Se=0;Se<ge;Se++)De[Se]=arguments[Se];return he=($=(ae=E(this,(I=M.__proto__||Object.getPrototypeOf(M)).call.apply(I,[this].concat(De))),ae),ae.saveUploader=function(Re){ae.uploader=Re},$),E(ae,he)}return d(M,[{key:"abort",value:function($){this.uploader.abort($)}},{key:"render",value:function(){return Z.a.createElement(f,p({},this.props,{ref:this.saveUploader}))}}]),M}(fe.Component);F.defaultProps={component:"span",prefixCls:"rc-upload",data:{},headers:{},name:"file",multipart:!1,onStart:S,onError:S,onSuccess:S,multiple:!1,beforeUpload:null,customRequest:null,withCredentials:!1,openFileDialogOnClick:!0};var W=F,K=at.a=W},HmJG:function(pt,at,pe){},LdHM:function(pt,at,pe){"use strict";pe.d(at,"b",function(){return u}),pe.d(at,"a",function(){return v});var fe=pe("1OyB"),Z=pe("vuIU"),_=pe("Ji7U"),J=pe("LK+K"),U=pe("q1tI"),D=pe("rePB"),z=pe("Ff2n"),H=pe("ODXe"),B=pe("4IlW"),O=pe("bX4T"),b=pe("YrtM"),A=pe("TSYQ"),P=pe.n(A),L=pe("+nKL"),w=pe("8OUc"),y=function($,ae){var he=$.prefixCls,ge=$.id,De=$.flattenOptions,Se=$.childrenAsData,Re=$.values,Ce=$.searchValue,xe=$.multiple,me=$.defaultActiveFirstOption,G=$.height,s=$.itemHeight,c=$.notFoundContent,R=$.open,X=$.menuItemSelectedIcon,N=$.virtual,oe=$.onSelect,be=$.onToggleOpen,we=$.onActiveValue,_e=$.onScroll,Le=$.onMouseEnter,Oe="".concat(he,"-item"),Me=Object(b.a)(function(){return De},[R,De],function(q,ee){return ee[0]&&q[1]!==ee[1]}),Be=U.useRef(null),Ve=function(ee){ee.preventDefault()},Xe=function(ee){Be.current&&Be.current.scrollTo({index:ee})},ze=function(ee){for(var ne=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,le=Me.length,te=0;te<le;te+=1){var ie=(ee+te*ne+le)%le,ue=Me[ie],de=ue.group,ye=ue.data;if(!de&&!ye.disabled)return ie}return-1},rt=U.useState(function(){return ze(0)}),je=Object(H.a)(rt,2),We=je[0],ke=je[1],Je=function(ee){ke(ee);var ne=Me[ee];if(!ne){we(null,-1);return}we(ne.data.value,ee)};U.useEffect(function(){Je(me!==!1?ze(0):-1)},[Me.length,Ce]),U.useEffect(function(){var q=setTimeout(function(){if(!xe&&R&&Re.size===1){var ee=Array.from(Re)[0],ne=Me.findIndex(function(le){var te=le.data;return te.value===ee});Je(ne),Xe(ne)}});return function(){return clearTimeout(q)}},[R]);var qe=function(ee){ee!==void 0&&oe(ee,{selected:!Re.has(ee)}),xe||be(!1)};if(U.useImperativeHandle(ae,function(){return{onKeyDown:function(ee){var ne=ee.which;switch(ne){case B.a.UP:case B.a.DOWN:{var le=0;if(ne===B.a.UP?le=-1:ne===B.a.DOWN&&(le=1),le!==0){var te=ze(We+le,le);Xe(te),Je(te)}break}case B.a.ENTER:{var ie=Me[We];ie&&!ie.data.disabled?qe(ie.data.value):qe(void 0),R&&ee.preventDefault();break}case B.a.ESC:be(!1)}},onKeyUp:function(){},scrollTo:function(ee){Xe(ee)}}}),Me.length===0)return U.createElement("div",{role:"listbox",id:"".concat(ge,"_list"),className:"".concat(Oe,"-empty"),onMouseDown:Ve},c);function se(q){var ee=Me[q];if(!ee)return null;var ne=ee.data||{},le=ne.value,te=ne.label,ie=ne.children,ue=Object(O.a)(ne,!0),de=Se?ie:te;return ee?U.createElement("div",Object.assign({"aria-label":typeof de=="string"?de:null},ue,{key:q,role:"option",id:"".concat(ge,"_list_").concat(q),"aria-selected":Re.has(le)}),le):null}return U.createElement(U.Fragment,null,U.createElement("div",{role:"listbox",id:"".concat(ge,"_list"),style:{height:0,width:0,overflow:"hidden"}},se(We-1),se(We),se(We+1)),U.createElement(L.a,{itemKey:"key",ref:Be,data:Me,height:G,itemHeight:s,fullHeight:!1,onMouseDown:Ve,onScroll:_e,virtual:N,onMouseEnter:Le},function(q,ee){var ne,le=q.group,te=q.groupOption,ie=q.data,ue=ie.label,de=ie.key;if(le)return U.createElement("div",{className:P()(Oe,"".concat(Oe,"-group"))},ue!==void 0?ue:de);var ye=ie.disabled,Ee=ie.value,Pe=ie.title,Ue=ie.children,Qe=ie.style,tt=ie.className,xt=Object(z.a)(ie,["disabled","value","title","children","style","className"]),st=Re.has(Ee),nt="".concat(Oe,"-option"),wt=P()(Oe,nt,tt,(ne={},Object(D.a)(ne,"".concat(nt,"-grouped"),te),Object(D.a)(ne,"".concat(nt,"-active"),We===ee&&!ye),Object(D.a)(ne,"".concat(nt,"-disabled"),ye),Object(D.a)(ne,"".concat(nt,"-selected"),st),ne)),ot=Se?Ue:ue,vt=!X||typeof X=="function"||st;return U.createElement("div",Object.assign({},xt,{"aria-selected":st,className:wt,title:Pe,onMouseMove:function(){if(We===ee||ye)return;Je(ee)},onClick:function(){ye||qe(Ee)},style:Qe}),U.createElement("div",{className:"".concat(nt,"-content")},ot||Ee),U.isValidElement(X)||st,vt&&U.createElement(w.a,{className:"".concat(Oe,"-option-state"),customizeIcon:X,customizeIconProps:{isSelected:st}},st?"\u2713":null))}))},h=U.forwardRef(y);h.displayName="OptionList";var o=h,l=function(){return null};l.isSelectOption=!0;var u=l,C=function(){return null};C.isSelectOptGroup=!0;var v=C,m=pe("VTBJ"),k=pe("Zm9Q");function x(I){var $=I.key,ae=I.props,he=ae.children,ge=ae.value,De=Object(z.a)(ae,["children","value"]);return Object(m.a)({key:$,value:ge!==void 0?ge:$,children:he},De)}function f(I){var $=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Object(k.a)(I).map(function(ae,he){if(!U.isValidElement(ae)||!ae.type)return null;var ge=ae.type.isSelectOptGroup,De=ae.key,Se=ae.props,Re=Se.children,Ce=Object(z.a)(Se,["children"]);return $||!ge?x(ae):Object(m.a)(Object(m.a)({key:"__RC_SELECT_GRP__".concat(De===null?he:De,"__"),label:De},Ce),{},{options:f(Re)})}).filter(function(ae){return ae})}var p=pe("2Qr1"),d=pe("qNPg"),a=pe("U8pU"),E=pe("Kwbf"),g=pe("WKfj");function S(I){var $=I.mode,ae=I.options,he=I.children,ge=I.backfill,De=I.allowClear,Se=I.placeholder,Re=I.getInputElement,Ce=I.showSearch,xe=I.onSearch,me=I.defaultOpen,G=I.autoFocus,s=I.labelInValue,c=I.value,R=I.inputValue,X=I.optionLabelProp,N=$==="multiple"||$==="tags",oe=Ce!==void 0?Ce:N||$==="combobox",be=ae||f(he);if(Object(E.a)($!=="tags"||be.every(function(Oe){return!Oe.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),$==="tags"||$==="combobox"){var we=be.some(function(Oe){return Oe.options?Oe.options.some(function(Me){return typeof("value"in Me?Me.value:Me.key)=="number"}):typeof("value"in Oe?Oe.value:Oe.key)=="number"});Object(E.a)(!we,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(E.a)($!=="combobox"||!X,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(E.a)($==="combobox"||!ge,"`backfill` only works with `combobox` mode."),Object(E.a)($==="combobox"||!Re,"`getInputElement` only work with `combobox` mode."),Object(E.b)($!=="combobox"||!Re||!De||!Se,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),xe&&!oe&&$!=="combobox"&&$!=="tags"&&Object(E.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(E.b)(!me||G,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),c!=null){var _e=Object(g.d)(c);Object(E.a)(!s||_e.every(function(Oe){return Object(a.a)(Oe)==="object"&&("key"in Oe||"value"in Oe)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(E.a)(!N||Array.isArray(c),"`value` should be array when `mode` is `multiple` or `tags`")}if(he){var Le=null;Object(k.a)(he).some(function(Oe){if(!U.isValidElement(Oe)||!Oe.type)return!1;var Me=Oe.type;if(Me.isSelectOption)return!1;if(Me.isSelectOptGroup){var Be=Object(k.a)(Oe.props.children).every(function(Ve){return!U.isValidElement(Ve)||!Oe.type||Ve.type.isSelectOption?!0:(Le=Ve.type,!1)});return!Be}return Le=Me,!0}),Le&&Object(E.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(Le.displayName||Le.name||Le,"`.")),Object(E.a)(R===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var F=S,W=Object(d.a)({prefixCls:"rc-select",components:{optionList:o},convertChildrenToData:f,flattenOptions:p.d,getLabeledValue:p.e,filterOptions:p.b,isValueDisabled:p.g,findValueOption:p.c,warningProps:F,fillOptionsWithMissingValue:p.a}),K=function(I){Object(_.a)(ae,I);var $=Object(J.a)(ae);function ae(){var he;return Object(fe.a)(this,ae),he=$.apply(this,arguments),he.selectRef=U.createRef(),he.focus=function(){he.selectRef.current.focus()},he.blur=function(){he.selectRef.current.blur()},he}return Object(Z.a)(ae,[{key:"render",value:function(){return U.createElement(W,Object.assign({ref:this.selectRef},this.props))}}]),ae}(U.Component);K.Option=u,K.OptGroup=v;var V=K,M=at.c=V},M8RZ:function(pt,at,pe){"use strict";pe.d(at,"a",function(){return B});var fe=pe("fWQN"),Z=pe("mtLc"),_=pe("yKVA"),J=pe("879j"),U=pe("q1tI"),D=pe.n(U),z=pe("i8i4"),H=pe.n(z),B=function(O){Object(_.a)(A,O);var b=Object(J.a)(A);function A(P){var L;Object(fe.a)(this,A),L=b.call(this,P);var w=window.document;return L.node=w.createElement("div"),w.body.appendChild(L.node),L}return Object(Z.a)(A,[{key:"render",value:function(){var L=this.props.children;return Object(z.createPortal)(L,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),A}(D.a.Component)},Ot1p:function(pt,at,pe){"use strict";var fe=pe("2qtc"),Z=pe("kLXV"),_=pe("rAM+"),J=pe("miYZ"),U=pe("tsqr"),D=pe("9og8"),z=pe("tJVT"),H=pe("jrin"),B=pe("WmNS"),O=pe.n(B),b=pe("q1tI"),A=pe.n(b),P=pe("VrN/"),L=pe.n(P),w=pe("bdgK"),y=pe("p77/"),h=pe("Bd2K"),o=pe("ELLl"),l=pe("19Vz"),u=pe("lZu9"),C=pe("+NIl"),v=pe("kSUc"),m=pe("9Bee"),k=function(ye){var Ee=ye.value,Pe=Ee===void 0?"":Ee,Ue=ye.className,Qe=ye.showTextOnly,tt=ye.showLines,xt=ye.style,st=xt===void 0?{}:xt,nt=Object(b.useMemo)(function(){return""},[Pe]);return A.a.createElement(A.a.Fragment,null,A.a.createElement("div",{dangerouslySetInnerHTML:{__html:nt}}))},x=pe("0Owb"),f=pe("dejd"),p=pe("C+DQ"),d=pe("1vsH"),a=pe("m3rI"),E=[{title:"\u7C97\u4F53",icon:"icon-bold",actionName:"bold"},{title:"\u659C\u4F53",icon:"icon-italic",actionName:"italic"},"|",{title:"\u65E0\u5E8F\u5217\u8868",icon:"icon-unorder-list",actionName:"list-ul"},{title:"\u6709\u5E8F\u5217\u8868",icon:"icon-order-list",actionName:"list-ol"},"|",{title:"\u884C\u5185\u4EE3\u7801",icon:"icon-code",actionName:"code"},{title:"\u4EE3\u7801\u5757\uFF08\u591A\u8BED\u8A00\u98CE\u683C\uFF09",icon:"icon-file-code",actionName:"code-block"},{title:"\u94FE\u63A5",icon:"icon-link",actionName:"link"},"|",{title:"\u884C\u5185\u516C\u5F0F",icon:"icon-sum",actionName:"inline-latex"},{title:"\u591A\u884C\u516C\u5F0F",icon:"icon-formula",actionName:"latex"},"|",{title:"\u6DFB\u52A0\u56FE\u7247",icon:"icon-picture",actionName:"upload-image"},{title:"\u8868\u683C",icon:"icon-table",actionName:"add-table"},"|",{title:"\u6362\u884C",icon:"icon-minus",actionName:"line-break"},{title:"\u6E05\u7A7A",icon:"icon-eraser",actionName:"eraser"}];function g(ye){var Ee=ye.onActionCallback,Pe=ye.title,Ue=ye.icon,Qe=ye.actionName,tt=ye.className,xt=tt===void 0?"":tt,st=ye.children;function nt(){Ee(Qe)}return A.a.createElement("a",{title:Pe,className:xt,onClick:nt},A.a.createElement("i",{className:"md-iconfont ".concat(Ue)}),st)}var S=function(ye){var Ee=ye.watch,Pe=ye.showNullButton,Ue=ye.onActionCallback,Qe=ye.fullScreen,tt=ye.insertTemp,xt=ye.hidetoolBar,st=ye.uuid,nt=ye.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(d.F)("_educoder_session_login"),"&_educoder_session=").concat(Object(d.F)("_educoder_session"),"&key=").concat(st,"&api=").concat(encodeURIComponent(a.a.PROXY_SERVER)));var wt=[].concat(E,[{title:"".concat(Ee?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(Ee?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return A.a.createElement("ul",{className:"markdown-toolbar-container"},!xt&&wt.map(function(ot,vt){return A.a.createElement("li",{key:vt},ot.actionName?A.a.createElement(g,Object(x.a)({},ot,{onActionCallback:Ue})):A.a.createElement("span",{className:"v-line"}))}),Pe?A.a.createElement("li",null,A.a.createElement(g,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:Ue},A.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,tt&&A.a.createElement("li",null,A.a.createElement(g,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(tt),onActionCallback:Ue},A.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),A.a.createElement("li",{className:"btn-full-screen"},A.a.createElement(g,{icon:"".concat(Qe?"icon-shrink":"icon-enlarge"),title:Qe?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:Ue})))},F=pe("M8RZ"),W=pe("+L6B"),K=pe("2/Rp"),V=pe("y8nQ"),M=pe("Vl3Y"),I=pe("5NDa"),$=pe("5rEg"),ae={labelCol:{span:4},wrapperCol:{span:20}},he=function(ye){var Ee=ye.callback,Pe=ye.onCancel;function Ue(Qe){Ee(Qe)}return A.a.createElement(M.a,Object(x.a)({},ae,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:Ue}),A.a.createElement(M.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},A.a.createElement($.a,null)),A.a.createElement(M.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},A.a.createElement($.a,null)),A.a.createElement("div",{className:"flex-container flex-end"},A.a.createElement(K.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),A.a.createElement(K.a,{type:"ghost",onClick:Pe},"\u53D6\u6D88")))},ge=pe("7ahc"),De=pe("HmJG"),Se=pe("BjJ7"),Re=M.a.useForm,Ce={width:280,marginRight:10},xe={labelCol:{span:5},wrapperCol:{span:19}},me=function(ye){var Ee=ye.callback,Pe=ye.onCancel,Ue=Re(),Qe=Object(z.a)(Ue,1),tt=Qe[0];function xt(wt){Ee(wt)}function st(wt,ot){if(wt.status===-1){U.b.error(wt.message);return}tt.setFieldsValue({src:"/api/attachments/".concat(wt.id),type:ot.type})}function nt(wt){var ot=wt.target.files[0];s(ot,st)}return A.a.createElement(M.a,Object(x.a)({form:tt},xe,{className:"upload-image-panel",onFinish:xt}),A.a.createElement(M.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},A.a.createElement("div",{className:"flex-container"},A.a.createElement(M.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},A.a.createElement($.a,{style:Ce})),A.a.createElement(G,{onFileChange:nt}))),A.a.createElement(M.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},A.a.createElement($.a,{style:{width:264}})),A.a.createElement(M.a.Item,{style:{textAlign:"right"}},A.a.createElement(K.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),A.a.createElement(K.a,{type:"ghost",onClick:Pe},"\u53D6\u6D88")))};function G(ye){var Ee=ye.onFileChange;return A.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",A.a.createElement("input",{type:"file",onChange:Ee}))}function s(ye,Ee){if(!ye)throw new String("\u6CA1\u6709\u6587\u4EF6");var Pe=new FormData;Pe.append("editormd-image-file",ye),Pe.append("file_param_name","editormd-image-file"),Pe.append("byxhr","true");var Ue=new window.XMLHttpRequest;Ue.withCredentials=!0,Ue.addEventListener("load",function(Qe){Ee(JSON.parse(Qe.target.responseText),ye)},!1),Ue.addEventListener("error",function(Qe){console.error(Qe)},!1),Ue.open("POST","".concat(Se.a,"/api/attachments.json")),Ue.send(Pe)}var c=pe("giR+"),R=pe("fyUT"),X=pe("7Kak"),N=pe("9yH6"),oe=N.a.Group,be={margin:"0 8px"},we=function(ye){var Ee=ye.callback,Pe=ye.onCancel;function Ue(Qe){Ee(Qe)}return A.a.createElement(M.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:Ue},A.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},A.a.createElement("span",{style:be},"\u5355\u5143\u683C\u6570\uFF1A"),A.a.createElement("span",{style:be},"\u884C\u6570"),A.a.createElement(M.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},A.a.createElement(R.a,null)),A.a.createElement("span",{style:be},"\u5217\u6570"),A.a.createElement(M.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},A.a.createElement(R.a,null))),A.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},A.a.createElement("span",{style:be},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),A.a.createElement(M.a.Item,{name:"align"},A.a.createElement(oe,null,A.a.createElement(N.a,{value:"default"},A.a.createElement("i",{className:"fa fa-align-justify"})),A.a.createElement(N.a,{value:"left"},A.a.createElement("i",{className:"fa fa-align-left"})),A.a.createElement(N.a,{value:"center"},A.a.createElement("i",{className:"fa fa-align-center"})),A.a.createElement(N.a,{value:"right"},A.a.createElement("i",{className:"fa fa-align-right"}))))),A.a.createElement("div",{className:"flex-container flex-end"},A.a.createElement(K.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),A.a.createElement(K.a,{type:"ghost",onClick:Pe},"\u53D6\u6D88")))},_e=pe("ErOA"),Le=pe("7Cbv"),Oe="link",Me="upload-image",Be="code-block",Ve="add-table",Xe="------------",ze={default:Xe,left:":".concat(Xe),center:":".concat(Xe,":"),right:"".concat(Xe,":")},rt=pe("9VGf"),je,We;function ke(){}var Je=0,qe=1e4,se="\u2581",q=`
|
|
**\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 ee(ye){return/^\d+$/.test(ye)?"".concat(ye,"px"):ye}var ne=navigator.platform.toUpperCase().indexOf("MAC")>=0,le=ne?"Cmd":"Ctrl",te=["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"],ie=(je={},Object(H.a)(je,le+"-B","bold"),Object(H.a)(je,le+"-I","italic"),je),ue=(We={},Object(H.a)(We,Oe,"\u6DFB\u52A0\u94FE\u63A5"),Object(H.a)(We,Be,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(H.a)(We,Me,"\u6DFB\u52A0\u6587\u4EF6"),Object(H.a)(We,Ve,"\u6DFB\u52A0\u8868\u683C"),We),de=at.a=function(ye){var Ee=ye.defaultValue,Pe=Ee===void 0?"":Ee,Ue=ye.onChange,Qe=ye.width,tt=Qe===void 0?"100%":Qe,xt=ye.height,st=xt===void 0?400:xt,nt=ye.miniToolbar,wt=nt===void 0?!1:nt,ot=ye.isFocus,vt=ot===void 0?!1:ot,bt=ye.watch,Ke=ye.insertTemp,ir=ye.mode,nr=ir===void 0?"markdown":ir,Kt=ye.id,Ot=Kt===void 0?"markdown-editor-id":Kt,ar=ye.showResizeBar,wr=ar===void 0?!1:ar,Vt=ye.noStorage,ur=Vt===void 0?!1:Vt,ti=ye.showNullButton,It=ti===void 0?!1:ti,Ze=ye.hidetoolBar,At=Ze===void 0?!1:Ze,Qt=ye.fullScreen,yt=Qt===void 0?!1:Qt,gt=ye.onBlur,kt=ye.onCMBeforeChange,br=ye.onFullScreen,jt=ye.className,Fe=jt===void 0?"":jt,ct=ye.disablePaste,ri=ct===void 0?!1:ct,bi=ye.placeholder,xi=bi===void 0?"":bi,ii=ye.values,Ei=ii===void 0?"":ii,mt=Object(b.useState)(null),Ln=Object(z.a)(mt,2),He=Ln[0],Si=Ln[1],Tr=Object(b.useState)(Pe),Ki=Object(z.a)(Tr,2),ni=Ki[0],Ar=Ki[1],Vi=Object(b.useState)(bt),Xi=Object(z.a)(Vi,2),Lr=Xi[0],Yi=Xi[1],kn=Object(b.useState)(yt),$i=Object(z.a)(kn,2),kr=$i[0],Dn=$i[1],aa=Object(b.useState)(""),Zi=Object(z.a)(aa,2),or=Zi[0],Kr=Zi[1],oa=Object(b.useState)(0),ai=Object(z.a)(oa,2),Dr=ai[0],Qi=ai[1],sa=Object(b.useState)(st),Rn=Object(z.a)(sa,2),_n=Rn[0],Ti=Rn[1],On=Object(b.useState)(!1),Mn=Object(z.a)(On,2),la=Mn[0],Ci=Mn[1],oi=Object(b.useRef)(Object(Le.a)()),si=Object(b.useRef)(!1),wi=Object(b.useRef)(),Fr=Object(b.useRef)(),Ur=Object(b.useRef)(),jr=Object(b.useRef)(),Ai=Object(b.useRef)(),Pn=function(){var lt=Object(D.a)(O.a.mark(function ft(){var ht,St;return O.a.wrap(function(Mt){for(;;)switch(Mt.prev=Mt.next){case 0:return Mt.next=2,Object(_e.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:oi.current}});case 2:St=Mt.sent,St!=null&&(ht=St.attachments)!==null&&ht!==void 0&&ht.length&&(console.log("cm:",He,Fr),St.attachments.map(function(Ct){Ct.content_type.indexOf("image")>-1?He.replaceSelection(".concat(Ct.content_type,")")):Ct.content_type.indexOf("video")>-1?He.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):Ct.content_type.indexOf("pdf")>-1?He.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Ct.id,"?type=").concat(Ct.content_type,'&disposition=inline" target="_blank">').concat(Ct.name,"</a>")):He.replaceSelection("[".concat(Ct.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(Ct.id,"?type=").concat(Ct.content_type,")"))}));case 4:case"end":return Mt.stop()}},ft)}));return function(){return lt.apply(this,arguments)}}();Object(b.useEffect)(function(){Ar(Ei),He==null||He.setValue(Ei)},[Ei]),Object(b.useEffect)(function(){br==null||br(kr)},[kr]),Object(b.useEffect)(function(){if(Fr.current){var lt=L.a.fromTextArea(Fr.current,{mode:nr,lineNumbers:!wt,lineWrapping:!0,value:Pe,autoCloseTags:!0,autoCloseBrackets:!0});vt&<.focus();function ft(ht,St){if(ri){St.preventDefault();return}var Lt=St.clipboardData;if(Lt){var Mt=Lt.types.toString(),Ct=Lt.items;if(Mt==="Files"||Lt.types.indexOf("Files")>-1){if(St.preventDefault(),nr=="stex")return;try{var Gt,hr=Ct[1];((Gt=Ct[0])===null||Gt===void 0?void 0:Gt.kind)==="file"&&(hr=Ct[0]);var Tt=hr.getAsFile(),Wr=Tt.name.split(".").pop();s(Tt,function(Dt){if(Dt.id){var dr,er,Cr;(Tt==null||((dr=Tt.type)===null||dr===void 0)?void 0:dr.indexOf("image"))>-1?lt.replaceSelection(".concat(Dt.content_type,")")):(Tt==null||((er=Tt.type)===null||er===void 0)?void 0:er.indexOf("video"))>-1?lt.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Dt.id,'"></video>')):(Tt==null||((Cr=Tt.type)===null||Cr===void 0)?void 0:Cr.indexOf("pdf"))>-1?lt.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Dt.id,"?type=").concat(Tt.type,'&disposition=inline" target="_blank">').concat(Tt.name,"</a>")):te.includes(Wr)?lt.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Dt.id,'?type=office&disposition=inline" target="_blank">').concat(Tt.name,"</a>")):lt.replaceSelection("[".concat(Tt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(Dt.id,"?type=").concat(Dt.content_type,")"))}else(Dt==null?void 0:Dt.status)===401&&(document.location.href="/user/login")})}catch(Dt){U.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return lt.on("paste",ft),lt.on("dragleave",function(ht,St){Ur.current.classList.remove("mouse-hover-md")}),lt.on("dragover",function(ht,St){Ur.current.classList.add("mouse-hover-md")}),lt.on("drop",function(ht,St){Ur.current.classList.add("mouse-hover-md");var Lt;if(Lt=St.dataTransfer.files,Lt.length>0){St.preventDefault(),St.stopPropagation();for(var Mt=function(hr){var Tt=Lt[hr],Wr=Tt.name.split(".").pop();s(Tt,function(Dt){if(Dt.id){var dr,er,Cr;(Tt==null||((dr=Tt.type)===null||dr===void 0)?void 0:dr.indexOf("image"))>-1?lt.replaceSelection(".concat(Dt.content_type,")")):(Tt==null||((er=Tt.type)===null||er===void 0)?void 0:er.indexOf("video"))>-1?lt.replaceSelection('<video width="100%" controls src="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Dt.id,'"></video>')):(Tt==null||((Cr=Tt.type)===null||Cr===void 0)?void 0:Cr.indexOf("pdf"))>-1?lt.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Dt.id,"?type=").concat(Tt.type,'&disposition=inline" target="_blank">').concat(Tt.name,"</a>")):te.includes(Wr)?lt.replaceSelection('<a href="'.concat(a.a.API_SERVER,"/api/attachments/").concat(Dt.id,'?type=office&disposition=inline" target="_blank">').concat(Tt.name,"</a>")):lt.replaceSelection("[".concat(Tt.name,"](").concat(a.a.API_SERVER,"/api/attachments/").concat(Dt.id,"?type=").concat(Dt.content_type,")"))}else(Dt==null?void 0:Dt.status)===401&&(document.location.href="/user/login")})},Ct=0;Ct<Lt.length;Ct++)Mt(Ct)}}),Si(lt),function(){lt.off("paste",ft)}}},[]);var xr=Object(b.useCallback)(function(){if(Ur.current)try{}catch(lt){console.log(lt,"---- to set md editor body height")}},[_n,Ur,kr]);Object(b.useEffect)(function(){function lt(){var ht=new w.default(function(St){var Lt=Object(_.a)(St),Mt;try{for(Lt.s();!(Mt=Lt.n()).done;){var Ct=Mt.value;(Ct.target.offsetHeight>0||Ct.target.offsetWidth>0)&&(xr(),He.setSize("100%","100%"),He.refresh())}}catch(Gt){Lt.e(Gt)}finally{Lt.f()}});return ht.observe(Fr.current.parentElement),ht}if(He){var ft=lt();return function(){ft.unobserve(Fr.current.parentElement)}}},[He,xr]),Object(b.useEffect)(function(){if(He){for(var lt=[],ft=function(){var Ct=St[ht];Lt=Object(z.a)(Ct,2);var Gt=Lt[0],hr=Lt[1],Tt=Object(H.a)({},Gt,function(){In(hr)});lt.push(Tt),He.addKeyMap(Tt)},ht=0,St=Object.entries(ie);ht<St.length;ht++){var Lt;ft()}return wi.current=setInterval(function(){si.current&&Pn()},4e3),function(){clearInterval(wi.current);var Mt=Object(_.a)(lt),Ct;try{for(Mt.s();!(Ct=Mt.n()).done;){var Gt=Ct.value;He.removeKeyMap(Gt)}}catch(hr){Mt.e(hr)}finally{Mt.f()}}}},[He]),Object(b.useEffect)(function(){yt!==kr&&Dn(yt)},[yt]),Object(rt.a)(function(){if(!ur&&Dr>0){var lt=new Date().getTime(),ft=window.sessionStorage.getItem(Ot);lt>=Dr+qe&&(!ft||ft!==ni)&&(window.sessionStorage.setItem(Ot,ni),Ci(!0))}},qe),Object(b.useEffect)(function(){Yi(bt)},[He,bt]),Object(b.useEffect)(function(){He&&(vt&&He.focus())},[He,vt]),Object(b.useEffect)(function(){if(Lr&&He){var lt=He.getScrollerElement();function ft(ht){var St=ht.target;if(Ai.current){var Lt=St.scrollTop/St.scrollHeight;Ai.current.scrollTop=Ai.current.scrollHeight*Lt}}return lt.addEventListener("scroll",ft),function(){lt.removeEventListener("scroll",ft)}}},[He,Lr]),Object(b.useEffect)(function(){if(He&&kt){function lt(ft,ht){kt(ft,ht)}return He.on("beforeChange",lt),function(){He.off("beforeChange",lt)}}},[He,kt]),Object(b.useEffect)(function(){if(He&>){function lt(){gt(He.getValue())}return He.on("blur",lt),function(){He.off("blur",lt)}}},[He,gt]),Object(b.useEffect)(function(){if(He){function lt(ft){var ht=ft.getValue();Ar(ht),Qi(new Date().getTime()),ft.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),Ue&&Ue(ht)}return He.on("change",lt),function(){He.off("change",lt)}}},[He,Ue]),Object(b.useEffect)(function(){He&&(Pe==null?(He.setValue(""),Ar("")):Pe!==He.getValue()&&(He.setValue(Pe),Ar(Pe),He.setCursor(He.lineCount(),0)))},[He,Pe]);var In=Object(b.useCallback)(function(lt){var ft=He.getCursor(),ht=He.getSelection(),St=ht.split(`
|
|
`);switch(lt){case"bold":return He.replaceSelection("**"+ht+"**"),ht===""&&He.setCursor(ft.line,ft.ch+2),He.focus();case"italic":return He.replaceSelection("*"+ht+"*"),ht===""&&He.setCursor(ft.line,ft.ch+1),He.focus();case"code":return He.replaceSelection("`"+ht+"`"),ht===""&&He.setCursor(ft.line,ft.ch+1),He.focus();case"inline-latex":return He.replaceSelection("`$$"+ht+"$$`"),ht===""&&He.setCursor(ft.line,ft.ch+3),He.focus();case"latex":return He.replaceSelection("```latex\n"+ht+"\n```"),He.setCursor(ft.line+1,ht.length+1),He.focus();case"line-break":return He.replaceSelection(`<br/>
|
|
`),He.focus();case"list-ul":return ht===""?He.replaceSelection("- "+ht):He.replaceSelection(St.map(function(Lt){return Lt===""?"":"- ".concat(Lt)}).join(`
|
|
`)),He.focus();case"list-ol":return ht===""?He.replaceSelection("1. "+ht):He.replaceSelection(St.map(function(Lt,Mt){return Lt===""?"":"".concat(Mt+1,". ").concat(Lt)}).join(`
|
|
`)),He.focus();case"add-null-ch":return ht===""&&He.setCursor(ft.line,ft.ch+1),He.replaceSelection(se),He.focus();case"inster-template-1":return ht===""&&He.setCursor(ft.line,ft.ch),He.replaceSelection(q),He.focus();case"eraser":return He.setValue(""),He.focus();case"trigger-watch":return Yi(!Lr),He.focus();case"trigger-full-screen":return Dn(!kr),He.focus();case Oe:Kr(Oe);return;case Be:Kr(Be);return;case Me:Kr(Me);return;case Ve:Kr(Ve);return;default:throw new Error}},[He,Lr,kr]),Li=Object(b.useCallback)(function(lt){Kr("");switch(or){case Oe:var ft=lt.title,ht=lt.link;return He.replaceSelection("[".concat(ft,"](").concat(ht,")")),He.focus();case Be:var St=lt.language,Lt=lt.content;return He.replaceSelection(["```"+St,Lt,"```"].join(`
|
|
`)),He.focus();case Me:var Mt=lt.src,Ct=lt.alt;return Ct?He.replaceSelection(".concat(Mt,' "').concat(Ct,'" )')):He.replaceSelection("")),He.focus();case Ve:for(var Gt=lt.row,hr=lt.col,Tt=lt.align,Wr=`
|
|
`,Dt=0;Dt<Gt;Dt++){for(var dr=[],er=[],Cr=0;Cr<hr;Cr++)Dt===1&&er.push(ze[Tt]),dr.push(" ");Dt===1&&(Wr+="| ".concat(er.join(" | "),` |
|
|
`)),Wr+="| ".concat(dr.join(hr===1?"":" | "),` |
|
|
`)}return He.replaceSelection(Wr+`
|
|
`),He.focus();default:throw new Error}},[He,or]),Ji=Object(b.useMemo)(function(){switch(or){case Oe:return A.a.createElement(he,{callback:Li,onCancel:Vr});case Be:return A.a.createElement(ge.b,{callback:Li,onCancel:Vr});case Me:return A.a.createElement(me,{callback:Li,onCancel:Vr});case Ve:return A.a.createElement(we,{callback:Li,onCancel:Vr});default:return null}},[or]);function Vr(){Kr("")}Object(b.useEffect)(function(){if(jr.current){var lt=jr.current,ft=!1,ht=0;function St(Ct){ft=!0,ht=Ct.pageY}function Lt(){ft=!1}function Mt(Ct){if(ft){var Gt=Ct.pageY-ht;Gt<0&&(Gt=0),Gt>300&&(Gt=300);var hr=st+Gt+"px";Ti(hr)}}return lt.addEventListener("mousedown",St),document.addEventListener("mousemove",Mt),document.addEventListener("mouseup",Lt),function(){lt.removeEventListener("mousedown",St),document.removeEventListener("mousemove",Mt),document.removeEventListener("mouseup",Lt)}}},[He,jr]),Object(b.useEffect)(function(){Ti(st)},[st]);var Pr=ee(tt),qi=ee(_n),Rr={width:Pr,height:qi},en=Object(b.useMemo)(function(){if(Dr){var lt=new Date(Dr),ft=lt.getHours(),ht=lt.getMinutes(),St=lt.getSeconds();return ft=ft<10?"0"+ft:ft,ht=ht<10?"0"+ht:ht,St=St<10?"0"+St:St,"".concat(ft,":").concat(ht,":").concat(St)}return 0},[Dr]);function Nn(){window.sessionStorage.removeItem(Ot),Ci(!1),Qi(0)}function li(){Ci(!1),Qi(0),He.setValue(window.sessionStorage.getItem(Ot))}function ua(lt,ft){var ht=He.getValue();ht=ht.replace(lt,ft),Ar(ht),He==null||He.setValue(ht)}return A.a.createElement(b.Fragment,null,A.a.createElement("div",{className:"markdown-editor-wrapper",ref:Ur},A.a.createElement("div",{className:"markdown-editor-container ".concat(Fe," ").concat(Lr?"on-preview":""," ").concat(wt?"mini":""," ").concat(kr?"full-screen":""),style:Rr},A.a.createElement(S,{insertTemp:Ke,watch:Lr,fullScreen:kr,showNullButton:It,onActionCallback:In,hidetoolBar:At,uuid:oi.current,setOpenPhones:function(){si.current=!0}}),A.a.createElement("div",{className:"markdown-editor-body"},A.a.createElement("div",{className:"codemirror-container"},A.a.createElement("textarea",{ref:Fr,placeholder:xi})),Lr?A.a.createElement("div",{ref:Ai,className:"preview-container"},nr==="stex"&&A.a.createElement(k,{value:ni}),nr!=="stex"&&A.a.createElement(m.a,{edit:!0,value:ni,replaces:ua})):null))),wr?A.a.createElement("a",{ref:jr,className:"editor-resize"}):null,A.a.createElement(F.a,null,ue[or]?A.a.createElement(Z.a,{centered:!0,title:ue[or],visible:!0,onCancel:Vr,footer:null,className:"markdown-popup-form"},Ji):null))}},SJMd:function(pt,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 pe,fe,Z,_=!1,J,U;window.PR_SHOULD_USE_CONTINUATION=!0;var D,z;(function(){var H=window,B=["break,continue,do,else,for,if,return,while"],O=[B,"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"],b=[O,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],A=[b,"alignas,alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,noexcept,noreturn,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],P=[b,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],L=[b,"abstract,add,alias,as,ascending,async,await,base,bool,by,byte,checked,decimal,delegate,descending,dynamic,event,finally,fixed,foreach,from,get,global,group,implicit,in,interface,internal,into,is,join,let,lock,null,object,out,override,orderby,params,partial,readonly,ref,remove,sbyte,sealed,select,set,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,value,var,virtual,where,yield"],w="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes",y=[b,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],h="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",o=[B,"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=[B,"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"],u=[B,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],C=[A,L,P,y,h,o,l,u],v=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,m="str",k="kwd",x="com",f="typ",p="lit",d="pun",a="pln",E="tag",g="dec",S="src",F="atn",W="atv",K="nocode",V="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function M(oe){for(var be=0,we=!1,_e=!1,Le=0,Oe=oe.length;Le<Oe;++Le){var Me=oe[Le];if(Me.ignoreCase)_e=!0;else if(/[a-z]/i.test(Me.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){we=!0,_e=!1;break}}var Be={b:8,t:9,n:10,v:11,f:12,r:13};function Ve(We){var ke=We.charCodeAt(0);if(ke!==92)return ke;var Je=We.charAt(1);return ke=Be[Je],ke||("0"<=Je&&Je<="7"?parseInt(We.substring(1),8):Je==="u"||Je==="x"?parseInt(We.substring(2),16):We.charCodeAt(1))}function Xe(We){if(We<32)return(We<16?"\\x0":"\\x")+We.toString(16);var ke=String.fromCharCode(We);return ke==="\\"||ke==="-"||ke==="]"||ke==="^"?"\\"+ke:ke}function ze(We){var ke=We.substring(1,We.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")),Je=[],qe=ke[0]==="^",se=["["];qe&&se.push("^");for(var q=qe?1:0,ee=ke.length;q<ee;++q){var ne=ke[q];if(/\\[bdsw]/i.test(ne))se.push(ne);else{var le=Ve(ne),te;q+2<ee&&ke[q+1]==="-"?(te=Ve(ke[q+2]),q+=2):te=le,Je.push([le,te]),te<65||le>122||(te<65||le>90||Je.push([Math.max(65,le)|32,Math.min(te,90)|32]),te<97||le>122||Je.push([Math.max(97,le)&~32,Math.min(te,122)&~32]))}}Je.sort(function(ye,Ee){return ye[0]-Ee[0]||Ee[1]-ye[1]});for(var ie=[],ue=[],q=0;q<Je.length;++q){var de=Je[q];de[0]<=ue[1]+1?ue[1]=Math.max(ue[1],de[1]):ie.push(ue=de)}for(var q=0;q<ie.length;++q){var de=ie[q];se.push(Xe(de[0])),de[1]>de[0]&&(de[1]+1>de[0]&&se.push("-"),se.push(Xe(de[1])))}return se.push("]"),se.join("")}function rt(We){for(var ke=We.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")),Je=ke.length,qe=[],se=0,q=0;se<Je;++se){var ee=ke[se];if(ee==="(")++q;else if(ee.charAt(0)==="\\"){var ne=+ee.substring(1);ne&&(ne<=q?qe[ne]=-1:ke[se]=Xe(ne))}}for(var se=1;se<qe.length;++se)qe[se]===-1&&(qe[se]=++be);for(var se=0,q=0;se<Je;++se){var ee=ke[se];if(ee==="(")++q,qe[q]||(ke[se]="(?:");else if(ee.charAt(0)==="\\"){var ne=+ee.substring(1);ne&&ne<=q&&(ke[se]="\\"+qe[ne])}}for(var se=0;se<Je;++se)ke[se]==="^"&&ke[se+1]!=="^"&&(ke[se]="");if(We.ignoreCase&&we)for(var se=0;se<Je;++se){var ee=ke[se],le=ee.charAt(0);ee.length>=2&&le==="["?ke[se]=ze(ee):le!=="\\"&&(ke[se]=ee.replace(/[a-zA-Z]/g,function(ue){var de=ue.charCodeAt(0);return"["+String.fromCharCode(de&~32,de|32)+"]"}))}return ke.join("")}for(var je=[],Le=0,Oe=oe.length;Le<Oe;++Le){var Me=oe[Le];if(Me.global||Me.multiline)throw new Error(""+Me);je.push("(?:"+rt(Me)+")")}return new RegExp(je.join("|"),_e?"gi":"g")}function I(oe,be){var we=/(?:^|\s)nocode(?:\s|$)/,_e=[],Le=0,Oe=[],Me=0;function Be(Ve){var Xe=Ve.nodeType;if(Xe==1){if(we.test(Ve.className))return;for(var ze=Ve.firstChild;ze;ze=ze.nextSibling)Be(ze);var rt=Ve.nodeName.toLowerCase();(rt==="br"||rt==="li")&&(_e[Me]=`
|
|
`,Oe[Me<<1]=Le++,Oe[Me++<<1|1]=Ve)}else if(Xe==3||Xe==4){var je=Ve.nodeValue;je.length&&(be?je=je.replace(/\r\n?/g,`
|
|
`):je=je.replace(/[ \t\r\n]+/g," "),_e[Me]=je,Oe[Me<<1]=Le,Le+=je.length,Oe[Me++<<1|1]=Ve)}}return Be(oe),{sourceCode:_e.join("").replace(/\n$/,""),spans:Oe}}function $(oe,be,we,_e,Le){if(!we)return;var Oe={sourceNode:oe,pre:1,langExtension:null,numberLines:null,sourceCode:we,spans:null,basePos:be,decorations:null};_e(Oe),Le.push.apply(Le,Oe.decorations)}var ae=/\S/;function he(oe){for(var be=void 0,we=oe.firstChild;we;we=we.nextSibling){var _e=we.nodeType;be=_e===1?be?oe:we:_e===3&&ae.test(we.nodeValue)?oe:be}return be===oe?void 0:be}function ge(oe,be){var we={},_e;(function(){for(var Me=oe.concat(be),Be=[],Ve={},Xe=0,ze=Me.length;Xe<ze;++Xe){var rt=Me[Xe],je=rt[3];if(je)for(var We=je.length;--We>=0;)we[je.charAt(We)]=rt;var ke=rt[1],Je=""+ke;Ve.hasOwnProperty(Je)||(Be.push(ke),Ve[Je]=null)}Be.push(/[\0-\uffff]/),_e=M(Be)})();var Le=be.length,Oe=function(Me){for(var Be=Me.sourceCode,Ve=Me.basePos,Xe=Me.sourceNode,ze=[Ve,a],rt=0,je=Be.match(_e)||[],We={},ke=0,Je=je.length;ke<Je;++ke){var qe=je[ke],se=We[qe],q=void 0,ee;if(typeof se=="string")ee=!1;else{var ne=we[qe.charAt(0)];if(ne)q=qe.match(ne[1]),se=ne[0];else{for(var le=0;le<Le;++le)if(ne=be[le],q=qe.match(ne[1]),q){se=ne[0];break}q||(se=a)}ee=se.length>=5&&se.substring(0,5)==="lang-",ee&&!(q&&typeof q[1]=="string")&&(ee=!1,se=S),ee||(We[qe]=se)}var te=rt;if(rt+=qe.length,!ee)ze.push(Ve+te,se);else{var ie=q[1],ue=qe.indexOf(ie),de=ue+ie.length;q[2]&&(de=qe.length-q[2].length,ue=de-ie.length);var ye=se.substring(5);$(Xe,Ve+te,qe.substring(0,ue),Oe,ze),$(Xe,Ve+te+ue,ie,G(ye,ie),ze),$(Xe,Ve+te+de,qe.substring(de),Oe,ze)}}Me.decorations=ze};return Oe}function De(oe){var be=[],we=[];oe.tripleQuotedStrings?be.push([m,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,`'"`]):oe.multiLineStrings?be.push([m,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):be.push([m,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,`"'`]),oe.verbatimStrings&&we.push([m,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var _e=oe.hashComments;_e&&(oe.cStyleComments?(_e>1?be.push([x,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):be.push([x,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),we.push([m,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):be.push([x,/^#[^\r\n]*/,null,"#"])),oe.cStyleComments&&(we.push([x,/^\/\/[^\r\n]*/,null]),we.push([x,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var Le=oe.regexLiterals;if(Le){var Oe=Le>1?"":`
|
|
\r`,Me=Oe?".":"[\\S\\s]",Be="/(?=[^/*"+Oe+"])(?:[^/\\x5B\\x5C"+Oe+"]|\\x5C"+Me+"|\\x5B(?:[^\\x5C\\x5D"+Oe+"]|\\x5C"+Me+")*(?:\\x5D|$))+/";we.push(["lang-regex",RegExp("^"+V+"("+Be+")")])}var Ve=oe.types;Ve&&we.push([f,Ve]);var Xe=(""+oe.keywords).replace(/^ | $/g,"");Xe.length&&we.push([k,new RegExp("^(?:"+Xe.replace(/[\s,]+/g,"|")+")\\b"),null]),be.push([a,/^\s+/,null,` \r
|
|
\xA0`]);var ze="^.[^\\s\\w.$@'\"`/\\\\]*";return oe.regexLiterals&&(ze+="(?!s*/)"),we.push([p,/^@[a-z_$][a-z_$@0-9]*/i,null],[f,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[a,/^[a-z_$][a-z_$@0-9]*/i,null],[p,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[a,/^\\[\s\S]?/,null],[d,new RegExp(ze),null]),ge(be,we)}var Se=De({keywords:C,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0});function Re(oe,be,we){for(var _e=/(?:^|\s)nocode(?:\s|$)/,Le=/\r\n?|\n/,Oe=oe.ownerDocument,Me=Oe.createElement("li");oe.firstChild;)Me.appendChild(oe.firstChild);var Be=[Me];function Ve(ke){var Je=ke.nodeType;if(Je==1&&!_e.test(ke.className))if(ke.nodeName==="br")Xe(ke),ke.parentNode&&ke.parentNode.removeChild(ke);else for(var qe=ke.firstChild;qe;qe=qe.nextSibling)Ve(qe);else if((Je==3||Je==4)&&we){var se=ke.nodeValue,q=se.match(Le);if(q){var ee=se.substring(0,q.index);ke.nodeValue=ee;var ne=se.substring(q.index+q[0].length);if(ne){var le=ke.parentNode;le.insertBefore(Oe.createTextNode(ne),ke.nextSibling)}Xe(ke),ee||ke.parentNode.removeChild(ke)}}}function Xe(ke){for(;!ke.nextSibling;)if(ke=ke.parentNode,!ke)return;function Je(q,ee){var ne=ee?q.cloneNode(!1):q,le=q.parentNode;if(le){var te=Je(le,1),ie=q.nextSibling;te.appendChild(ne);for(var ue=ie;ue;ue=ie)ie=ue.nextSibling,te.appendChild(ue)}return ne}for(var qe=Je(ke.nextSibling,0),se;(se=qe.parentNode)&&se.nodeType===1;)qe=se;Be.push(qe)}for(var ze=0;ze<Be.length;++ze)Ve(Be[ze]);be===(be|0)&&Be[0].setAttribute("value",be);var rt=Oe.createElement("ol");rt.className="linenums";for(var je=Math.max(0,be-1|0)||0,ze=0,We=Be.length;ze<We;++ze)Me=Be[ze],Me.className="L"+(ze+je)%10,Me.firstChild||Me.appendChild(Oe.createTextNode("\xA0")),rt.appendChild(Me);oe.appendChild(rt)}function Ce(oe){var be=/\bMSIE\s(\d+)/.exec(navigator.userAgent);be=be&&+be[1]<=8;var we=/\n/g,_e=oe.sourceCode,Le=_e.length,Oe=0,Me=oe.spans,Be=Me.length,Ve=0,Xe=oe.decorations,ze=Xe.length,rt=0;Xe[ze]=Le;var je,We;for(We=je=0;We<ze;)Xe[We]!==Xe[We+2]?(Xe[je++]=Xe[We++],Xe[je++]=Xe[We++]):We+=2;for(ze=je,We=je=0;We<ze;){for(var ke=Xe[We],Je=Xe[We+1],qe=We+2;qe+2<=ze&&Xe[qe+1]===Je;)qe+=2;Xe[je++]=ke,Xe[je++]=Je,We=qe}ze=Xe.length=je;var se=oe.sourceNode,q="";se&&(q=se.style.display,se.style.display="none");try{for(var ee=null;Ve<Be;){var ne=Me[Ve],le=Me[Ve+2]||Le,te=Xe[rt+2]||Le,qe=Math.min(le,te),ie=Me[Ve+1],ue;if(ie.nodeType!==1&&(ue=_e.substring(Oe,qe))){be&&(ue=ue.replace(we,"\r")),ie.nodeValue=ue;var de=ie.ownerDocument,ye=de.createElement("span");ye.className=Xe[rt+1];var Ee=ie.parentNode;Ee.replaceChild(ye,ie),ye.appendChild(ie),Oe<le&&(Me[Ve+1]=ie=de.createTextNode(_e.substring(qe,le)),Ee.insertBefore(ie,ye.nextSibling))}Oe=qe,Oe>=le&&(Ve+=2),Oe>=te&&(rt+=2)}}finally{se&&(se.style.display=q)}}var xe={};function me(oe,be){for(var we=be.length;--we>=0;){var _e=be[we];xe.hasOwnProperty(_e)?H.console&&console.warn("cannot override language handler %s",_e):xe[_e]=oe}}function G(oe,be){return oe&&xe.hasOwnProperty(oe)||(oe=/^\s*</.test(be)?"default-markup":"default-code"),xe[oe]}me(Se,["default-code"]),me(ge([],[[a,/^[^<?]+/],[g,/^<!\w[^>]*(?:>|$)/],[x,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[d,/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),me(ge([[a,/^[\s]+/,null,` \r
|
|
`],[W,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,`"'`]],[[E,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[F,/^(?!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"]),me(ge([],[[W,/^[\s\S]+/]]),["uq.val"]),me(De({keywords:A,hashComments:!0,cStyleComments:!0,types:v}),["c","cc","cpp","cxx","cyc","m"]),me(De({keywords:"null,true,false"}),["json"]),me(De({keywords:L,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:v}),["cs"]),me(De({keywords:P,cStyleComments:!0}),["java"]),me(De({keywords:u,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),me(De({keywords:o,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),me(De({keywords:h,hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]),me(De({keywords:l,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]),me(De({keywords:y,cStyleComments:!0,regexLiterals:!0}),["javascript","js","ts","typescript"]),me(De({keywords:w,hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]),me(ge([],[[m,/^[\s\S]+/]]),["regex"]);function s(oe){var be=oe.langExtension;try{var we=I(oe.sourceNode,oe.pre),_e=we.sourceCode;oe.sourceCode=_e,oe.spans=we.spans,oe.basePos=0,G(be,_e)(oe),Ce(oe)}catch(Le){H.console&&console.log(Le&&Le.stack||Le)}}function c(oe,be,we){var _e=we||!1,Le=be||null,Oe=document.createElement("div");Oe.innerHTML="<pre>"+oe+"</pre>",Oe=Oe.firstChild,_e&&Re(Oe,_e,!0);var Me={langExtension:Le,numberLines:_e,sourceNode:Oe,pre:1,sourceCode:null,basePos:null,spans:null,decorations:null};return s(Me),Oe.innerHTML}function R(oe,be){var we=be||document.body,_e=we.ownerDocument||document;function Le(ne){return we.getElementsByTagName(ne)}for(var Oe=[Le("pre"),Le("code"),Le("xmp")],Me=[],Be=0;Be<Oe.length;++Be)for(var Ve=0,Xe=Oe[Be].length;Ve<Xe;++Ve)Me.push(Oe[Be][Ve]);Oe=null;var ze=Date;ze.now||(ze={now:function(){return+new Date}});var rt=0,je=/\blang(?:uage)?-([\w.]+)(?!\S)/,We=/\bprettyprint\b/,ke=/\bprettyprinted\b/,Je=/pre|xmp/i,qe=/^code$/i,se=/^(?:pre|code|xmp)$/i,q={};function ee(){for(var ne=H.PR_SHOULD_USE_CONTINUATION?ze.now()+250:Infinity;rt<Me.length&&ze.now()<ne;rt++){for(var le=Me[rt],te=q,ie=le;ie=ie.previousSibling;){var ue=ie.nodeType,de=(ue===7||ue===8)&&ie.nodeValue;if(de?!/^\??prettify\b/.test(de):ue!==3||/\S/.test(ie.nodeValue))break;if(de){te={},de.replace(/\b(\w+)=([\w:.%+-]+)/g,function(bt,Ke,ir){te[Ke]=ir});break}}var ye=le.className;if((te!==q||We.test(ye))&&!ke.test(ye)){for(var Ee=!1,Pe=le.parentNode;Pe;Pe=Pe.parentNode){var Ue=Pe.tagName;if(se.test(Ue)&&Pe.className&&We.test(Pe.className)){Ee=!0;break}}if(!Ee){le.className+=" prettyprinted";var Qe=te.lang;if(!Qe){Qe=ye.match(je);var tt;!Qe&&(tt=he(le))&&qe.test(tt.tagName)&&(Qe=tt.className.match(je)),Qe&&(Qe=Qe[1])}var xt;if(Je.test(le.tagName))xt=1;else{var st=le.currentStyle,nt=_e.defaultView,wt=st?st.whiteSpace:nt&&nt.getComputedStyle?nt.getComputedStyle(le,null).getPropertyValue("white-space"):0;xt=wt&&wt.substring(0,3)==="pre"}var ot=te.linenums;(ot=ot==="true"||+ot)||(ot=ye.match(/\blinenums\b(?::(\d+))?/),ot=ot?ot[1]&&ot[1].length?+ot[1]:!0:!1),ot&&Re(le,ot,xt);var vt={langExtension:Qe,sourceNode:le,numberLines:ot,pre:xt,sourceCode:null,basePos:null,spans:null,decorations:null};s(vt)}}}rt<Me.length?H.setTimeout(ee,250):typeof oe=="function"&&oe()}ee()}var X=H.PR={createSimpleLexer:ge,registerLangHandler:me,sourceDecorator:De,PR_ATTRIB_NAME:F,PR_ATTRIB_VALUE:W,PR_COMMENT:x,PR_DECLARATION:g,PR_KEYWORD:k,PR_LITERAL:p,PR_NOCODE:K,PR_PLAIN:a,PR_PUNCTUATION:d,PR_SOURCE:S,PR_STRING:m,PR_TAG:E,PR_TYPE:f,prettyPrintOne:_?H.prettyPrintOne=c:D=c,prettyPrint:z=_?H.prettyPrint=R:z=R},N=H.define;typeof N=="function"&&N.amd&&N("google-code-prettify",[],function(){return X})})()},STEk:function(pt,at,pe){"use strict";pe.d(at,"a",function(){return me});/*! *****************************************************************************
|
|
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 fe=function(G,s){return(fe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,R){c.__proto__=R}||function(c,R){for(var X in R)Object.prototype.hasOwnProperty.call(R,X)&&(c[X]=R[X])})(G,s)};function Z(G,s){function c(){this.constructor=G}fe(G,s),G.prototype=s===null?Object.create(s):(c.prototype=s.prototype,new c)}function _(G,s,c,R){return new(c||(c=Promise))(function(X,N){function oe(_e){try{we(R.next(_e))}catch(Le){N(Le)}}function be(_e){try{we(R.throw(_e))}catch(Le){N(Le)}}function we(_e){var Le;_e.done?X(_e.value):(Le=_e.value,Le instanceof c?Le:new c(function(Oe){Oe(Le)})).then(oe,be)}we((R=R.apply(G,s||[])).next())})}function J(G,s){var c,R,X,N,oe={label:0,sent:function(){if(1&X[0])throw X[1];return X[1]},trys:[],ops:[]};return N={next:be(0),throw:be(1),return:be(2)},typeof Symbol=="function"&&(N[Symbol.iterator]=function(){return this}),N;function be(we){return function(_e){return function(Le){if(c)throw new TypeError("Generator is already executing.");for(;oe;)try{if(c=1,R&&(X=2&Le[0]?R.return:Le[0]?R.throw||((X=R.return)&&X.call(R),0):R.next)&&!(X=X.call(R,Le[1])).done)return X;switch(R=0,X&&(Le=[2&Le[0],X.value]),Le[0]){case 0:case 1:X=Le;break;case 4:return oe.label++,{value:Le[1],done:!1};case 5:oe.label++,R=Le[1],Le=[0];continue;case 7:Le=oe.ops.pop(),oe.trys.pop();continue;default:if(!(X=oe.trys,(X=X.length>0&&X[X.length-1])||Le[0]!==6&&Le[0]!==2)){oe=0;continue}if(Le[0]===3&&(!X||Le[1]>X[0]&&Le[1]<X[3])){oe.label=Le[1];break}if(Le[0]===6&&oe.label<X[1]){oe.label=X[1],X=Le;break}if(X&&oe.label<X[2]){oe.label=X[2],oe.ops.push(Le);break}X[2]&&oe.ops.pop(),oe.trys.pop();continue}Le=s.call(G,oe)}catch(Oe){Le=[6,Oe],R=0}finally{c=X=0}if(5&Le[0])throw Le[1];return{value:Le[0]?Le[1]:void 0,done:!0}}([we,_e])}}}function U(){for(var G=0,s=0,c=arguments.length;s<c;s++)G+=arguments[s].length;var R=Array(G),X=0;for(s=0;s<c;s++)for(var N=arguments[s],oe=0,be=N.length;oe<be;oe++,X++)R[X]=N[oe];return R}var D=function(){function G(){}return G.createDefs=function(){return document.createElementNS("http://www.w3.org/2000/svg","defs")},G.setAttributes=function(s,c){for(var R=0,X=c;R<X.length;R++){var N=X[R],oe=N[0],be=N[1];s.setAttribute(oe,be)}},G.createRect=function(s,c,R){var X=document.createElementNS("http://www.w3.org/2000/svg","rect");return X.setAttribute("width",s.toString()),X.setAttribute("height",c.toString()),R&&G.setAttributes(X,R),X},G.createLine=function(s,c,R,X,N){var oe=document.createElementNS("http://www.w3.org/2000/svg","line");return oe.setAttribute("x1",s.toString()),oe.setAttribute("y1",c.toString()),oe.setAttribute("x2",R.toString()),oe.setAttribute("y2",X.toString()),N&&G.setAttributes(oe,N),oe},G.createPolygon=function(s,c){var R=document.createElementNS("http://www.w3.org/2000/svg","polygon");return R.setAttribute("points",s),c&&G.setAttributes(R,c),R},G.createCircle=function(s,c){var R=document.createElementNS("http://www.w3.org/2000/svg","circle");return R.setAttribute("cx",(s/2).toString()),R.setAttribute("cy",(s/2).toString()),R.setAttribute("r",s.toString()),c&&G.setAttributes(R,c),R},G.createEllipse=function(s,c,R){var X=document.createElementNS("http://www.w3.org/2000/svg","ellipse");return X.setAttribute("cx",(s/2).toString()),X.setAttribute("cy",(c/2).toString()),X.setAttribute("rx",(s/2).toString()),X.setAttribute("ry",(c/2).toString()),R&&G.setAttributes(X,R),X},G.createGroup=function(s){var c=document.createElementNS("http://www.w3.org/2000/svg","g");return s&&G.setAttributes(c,s),c},G.createTransform=function(){return document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGTransform()},G.createMarker=function(s,c,R,X,N,oe,be){var we=document.createElementNS("http://www.w3.org/2000/svg","marker");return G.setAttributes(we,[["id",s],["orient",c],["markerWidth",R.toString()],["markerHeight",X.toString()],["refX",N.toString()],["refY",oe.toString()]]),we.appendChild(be),we},G.createText=function(s){var c=document.createElementNS("http://www.w3.org/2000/svg","text");return c.setAttribute("x","0"),c.setAttribute("y","0"),s&&G.setAttributes(c,s),c},G.createTSpan=function(s,c){var R=document.createElementNS("http://www.w3.org/2000/svg","tspan");return R.textContent=s,c&&G.setAttributes(R,c),R},G.createImage=function(s){var c=document.createElementNS("http://www.w3.org/2000/svg","image");return s&&G.setAttributes(c,s),c},G.createPoint=function(s,c){var R=document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGPoint();return R.x=s,R.y=c,R},G.createPath=function(s,c){var R=document.createElementNS("http://www.w3.org/2000/svg","path");return R.setAttribute("d",s),c&&G.setAttributes(R,c),R},G}(),z=function(){function G(){}return G.addKey=function(s){G.key=s},Object.defineProperty(G,"isLicensed",{get:function(){return!!G.key&&new RegExp(/^MJS2-[A-Z][0-9]{3}-[A-Z][0-9]{3}-[0-9]{4}$/,"i").test(G.key)},enumerable:!1,configurable:!0}),G}(),H=function(){function G(){this.naturalSize=!1,this.imageType="image/png",this.markersOnly=!1}return G.prototype.rasterize=function(s,c,R){var X=this;return new Promise(function(N){var oe=R!==void 0?R:document.createElement("canvas");s===null&&(X.markersOnly=!0,X.naturalSize=!1);var be=document.createElementNS("http://www.w3.org/2000/svg","svg");be.setAttribute("xmlns","http://www.w3.org/2000/svg"),be.setAttribute("width",c.width.baseVal.valueAsString),be.setAttribute("height",c.height.baseVal.valueAsString),be.setAttribute("viewBox","0 0 "+c.viewBox.baseVal.width.toString()+" "+c.viewBox.baseVal.height.toString()),be.innerHTML=c.innerHTML,X.naturalSize===!0?(be.width.baseVal.value=s.naturalWidth,be.height.baseVal.value=s.naturalHeight):X.width!==void 0&&X.height!==void 0&&(be.width.baseVal.value=X.width,be.height.baseVal.value=X.height),oe.width=be.width.baseVal.value,oe.height=be.height.baseVal.value;var we=be.outerHTML,_e=oe.getContext("2d");X.markersOnly!==!0&&_e.drawImage(s,0,0,oe.width,oe.height);var Le=window.URL,Oe=new Image(oe.width,oe.height);Oe.setAttribute("crossOrigin","anonymous");var Me=new Blob([we],{type:"image/svg+xml"}),Be=Le.createObjectURL(Me);Oe.onload=function(){_e.drawImage(Oe,0,0),Le.revokeObjectURL(Be);var Ve=oe.toDataURL(X.imageType,X.imageQuality);N(Ve)},Oe.src=Be})},G}(),B=function(){},O=function(){function G(s){this._classNamePrefixBase="__markerjs2_",this.classes=[],this.rules=[],this.settings=this.defaultSettings,this._classNamePrefix=this._classNamePrefixBase+"_"+s+"_"}return Object.defineProperty(G.prototype,"classNamePrefixBase",{get:function(){return this._classNamePrefixBase},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"classNamePrefix",{get:function(){return this._classNamePrefix},enumerable:!1,configurable:!0}),Object.defineProperty(G.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(G.prototype,"fadeInAnimationClassName",{get:function(){return this.classNamePrefix+"fade_in"},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"fadeOutAnimationClassName",{get:function(){return this.classNamePrefix+"fade_out"},enumerable:!1,configurable:!0}),G.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},G.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)},G.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 b("."+this.classNamePrefix+" h3","font-family: sans-serif")),this.addRule(new b("@keyframes "+this.classNamePrefix+"_fade_in_animation_frames",`
|
|
from {
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
}
|
|
`)),this.addRule(new b("@keyframes "+this.classNamePrefix+"_fade_out_animation_frames",`
|
|
from {
|
|
opacity: 1;
|
|
}
|
|
to {
|
|
opacity: 0;
|
|
}
|
|
`)),this.addClass(new A("fade_in",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_in_animation_frames;
|
|
`)),this.addClass(new A("fade_out",`
|
|
animation-duration: 0.3s;
|
|
animation-name: `+this.classNamePrefix+`_fade_out_animation_frames;
|
|
`))},G.prototype.removeStyleSheet=function(){var s;this.styleSheet&&(((s=this.styleSheetRoot)!==null&&s!==void 0?s:document.head).removeChild(this.styleSheet),this.styleSheet=void 0)},G}(),b=function(G,s){this.selector=G,this.style=s},A=function(G,s){this.localName=G,this.style=s},P=function(){function G(s,c,R,X,N){this.buttons=[],this.markerButtons=[],this.buttonClickListeners=[],this.markerjsContainer=s,this.displayMode=c,this.markerItems=R,this.uiStyleSettings=X,this.styles=N,this.addStyles(),this.adjustLayout=this.adjustLayout.bind(this),this.overflowButtonClicked=this.overflowButtonClicked.bind(this),this.setCurrentMarker=this.setCurrentMarker.bind(this)}return G.prototype.show=function(s){var c=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 R=document.createElement("div");R.className=this.toolbarBlockStyleClass.name,R.style.whiteSpace="nowrap",this.uiContainer.appendChild(R),this.addActionButton(R,'<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(R,'<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(R,'<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(R,'<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(R,'<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(R,'<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(R,'<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(R,'<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(N){var oe=document.createElement("div");oe.className=""+c.toolbarButtonStyleClass.name,oe.setAttribute("data-type-name",N.typeName),oe.innerHTML=N.icon,oe.addEventListener("click",function(){c.markerToolbarButtonClicked(oe,N)}),c.buttons.push(oe),c.markerButtons.push(oe)}),this.overflowButton=document.createElement("div"),this.overflowButton.className=this.toolbarButtonStyleClass.name+" "+(this.uiStyleSettings.toolbarButtonStyleColorsClassName?this.uiStyleSettings.toolbarButtonStyleColorsClassName:this.toolbarButtonStyleColorsClass.name),this.overflowButton.innerHTML='<svg viewBox="0 0 24 24"><path d="M12 16a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2m0-6a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2z"/></svg>',this.overflowButton.addEventListener("click",this.overflowButtonClicked),this.markerButtonBlock.appendChild(this.overflowButton));var X=document.createElement("div");X.className=this.toolbarBlockStyleClass.name,X.style.whiteSpace="nowrap",X.style.display=this.uiStyleSettings.resultButtonBlockVisible!==!1?"":"none",this.uiContainer.appendChild(X),this.addActionButton(X,'<svg viewBox="0 0 24 24"><path d="M9 20.42l-6.21-6.21 2.83-2.83L9 14.77l9.88-9.89 2.83 2.83L9 20.42z"/></svg>',"render"),this.addActionButton(X,'<svg viewBox="0 0 24 24"><path d="M20 6.91L17.09 4 12 9.09 6.91 4 4 6.91 9.09 12 4 17.09 6.91 20 12 14.91 17.09 20 20 17.09 14.91 12 20 6.91z"/></svg>',"close"),this.markerjsContainer.appendChild(this.uiContainer),this.setSelectMode(),this.setCurrentMarker(),this.adjustLayout()},G.prototype.addButtonClickListener=function(s){this.buttonClickListeners.push(s)},G.prototype.removeButtonClickListener=function(s){this.buttonClickListeners.indexOf(s)>-1&&this.buttonClickListeners.splice(this.buttonClickListeners.indexOf(s),1)},G.prototype.setSelectMode=function(){this.resetButtonStyles(),this.setActiveButton(this.buttons[0])},G.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 c=0;c<this.markerButtons.length;c++)c<s||c===s&&this.markerButtons.length-1===s?this.markerButtonBlock.appendChild(this.markerButtons[c]):(c===s&&this.markerButtonBlock.appendChild(this.overflowButton),this.markerButtonOverflowBlock.appendChild(this.markerButtons[c]))}},G.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")},G.prototype.resetButtonStyles=function(){var s=this;this.buttons.forEach(function(c){c.className=c.className.replace(s.uiStyleSettings.toolbarButtonStyleColorsClassName?s.uiStyleSettings.toolbarButtonStyleColorsClassName:s.toolbarButtonStyleColorsClass.name,"").trim(),c.className=c.className.replace(s.uiStyleSettings.toolbarActiveButtonStyleColorsClassName?s.uiStyleSettings.toolbarActiveButtonStyleColorsClassName:s.toolbarActiveButtonStyleColorsClass.name,"").trim(),c.className+=" "+(s.uiStyleSettings.toolbarButtonStyleColorsClassName?s.uiStyleSettings.toolbarButtonStyleColorsClassName:s.toolbarButtonStyleColorsClass.name)})},G.prototype.addActionButton=function(s,c,R){var X=this,N=document.createElement("div");switch(N.className=""+this.toolbarButtonStyleClass.name,N.innerHTML=c,N.setAttribute("data-action",R),N.addEventListener("click",function(){X.actionToolbarButtonClicked(N,R)}),R){case"select":N.style.fill=this.uiStyleSettings.selectButtonColor;break;case"delete":case"clear":N.style.fill=this.uiStyleSettings.deleteButtonColor;break;case"undo":case"redo":N.style.fill=this.uiStyleSettings.selectButtonColor;break;case"render":N.style.fill=this.uiStyleSettings.okButtonColor;break;case"close":N.style.fill=this.uiStyleSettings.closeButtonColor}s.appendChild(N),this.buttons.push(N)},G.prototype.addStyles=function(){this.toolbarStyleClass=this.styles.addClass(new A("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 A("toolbar_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
box-shadow: 0px 3px rgba(33, 33, 33, 0.1);
|
|
`)),this.toolbarBlockStyleClass=this.styles.addClass(new A("toolbar-block",`
|
|
display: inline-block;
|
|
box-sizing: content-box;
|
|
`)),this.toolbarOverflowBlockStyleClass=this.styles.addClass(new A("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 A("toolbar-overflow-block_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
`));var s=this.uiStyleSettings.toolbarHeight/4;this.toolbarButtonStyleClass=this.styles.addClass(new A("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 A("toolbar_button_colors",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.toolbarActiveButtonStyleColorsClass=this.styles.addClass(new A("toolbar_active_button",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`)),this.styles.addRule(new b("."+this.toolbarButtonStyleClass.name+" svg",`
|
|
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
|
|
`)),this.styles.addRule(new b("."+this.toolbarButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`))},G.prototype.markerToolbarButtonClicked=function(s,c){this.setActiveButton(s),this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(R){return R("marker",c)}),this.markerButtonOverflowBlock.style.display="none"},G.prototype.actionToolbarButtonClicked=function(s,c){this.buttonClickListeners&&this.buttonClickListeners.length>0&&this.buttonClickListeners.forEach(function(R){return R("action",c)}),this.markerButtonOverflowBlock.style.display="none",this.setActiveButton(this.buttons[0])},G.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)},G.prototype.setActiveMarkerButton=function(s){var c=this.markerButtons.find(function(R){return R.getAttribute("data-type-name")===s});c&&this.setActiveButton(c)},G.prototype.setCurrentMarker=function(s){var c=this;this.currentMarker=s,this.buttons.filter(function(R){return/delete|notes/.test(R.getAttribute("data-action"))}).forEach(function(R){c.currentMarker===void 0?(R.style.fillOpacity="0.4",R.style.pointerEvents="none"):(R.style.fillOpacity="1",R.style.pointerEvents="all")})},G}(),L=function(){function G(s,c,R,X){this.panels=[],this.panelButtons=[],this.markerjsContainer=s,this.displayMode=c,this.uiStyleSettings=R,this.styles=X,this.panelButtonClick=this.panelButtonClick.bind(this),this.addStyles()}return G.prototype.addStyles=function(){var s;this.toolboxStyleClass=this.styles.addClass(new A("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 A("toolbox_colors",`
|
|
color: `+this.uiStyleSettings.toolboxColor+`;
|
|
`));var c=this.uiStyleSettings.toolbarHeight/4;this.toolboxButtonRowStyleClass=this.styles.addClass(new A("toolbox-button-row",`
|
|
display: flex;
|
|
cursor: default;
|
|
box-sizing: content-box;
|
|
`)),this.toolboxButtonRowStyleColorsClass=this.styles.addClass(new A("toolbox-button-row_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundColor+`;
|
|
`)),this.toolboxPanelRowStyleClass=this.styles.addClass(new A("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 A("toolbox-panel-row_colors",`
|
|
background-color: `+((s=this.uiStyleSettings.toolboxBackgroundColor)!==null&&s!==void 0?s:this.uiStyleSettings.toolbarBackgroundHoverColor)+`;
|
|
`)),this.toolboxButtonStyleClass=this.styles.addClass(new A("toolbox_button",`
|
|
display: inline-block;
|
|
width: `+(this.uiStyleSettings.toolbarHeight-2*c)+`px;
|
|
height: `+(this.uiStyleSettings.toolbarHeight-2*c)+`px;
|
|
padding: `+c+`px;
|
|
box-sizing: content-box;
|
|
`)),this.toolboxButtonStyleColorsClass=this.styles.addClass(new A("toolbox-button_colors",`
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.toolboxActiveButtonStyleColorsClass=this.styles.addClass(new A("toolbox-active-button_colors",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`;
|
|
fill: `+this.uiStyleSettings.toolbarColor+`;
|
|
`)),this.styles.addRule(new b("."+this.toolboxButtonStyleColorsClass.name+":hover",`
|
|
background-color: `+this.uiStyleSettings.toolbarBackgroundHoverColor+`
|
|
`)),this.styles.addRule(new b("."+this.toolboxButtonStyleClass.name+" svg",`
|
|
height: `+this.uiStyleSettings.toolbarHeight/2+`px;
|
|
`))},G.prototype.show=function(s){var c;this.uiContainer=document.createElement("div"),this.uiContainer.style.visibility=s,this.uiContainer.className=this.toolboxStyleClass.name+" "+((c=this.uiStyleSettings.toolboxStyleColorsClassName)!==null&&c!==void 0?c:this.toolboxStyleColorsClass.name),this.markerjsContainer.appendChild(this.uiContainer)},G.prototype.setPanelButtons=function(s){var c,R,X=this;this.panels=s,this.uiContainer!==void 0&&(this.uiContainer.innerHTML="",this.panelRow=document.createElement("div"),this.panelRow.className=this.toolboxPanelRowStyleClass.name+" "+((c=this.uiStyleSettings.toolboxPanelRowStyleColorsClassName)!==null&&c!==void 0?c:this.toolboxPanelRowStyleColorsClass.name),this.uiContainer.appendChild(this.panelRow),this.buttonRow=document.createElement("div"),this.buttonRow.className=this.toolboxButtonRowStyleClass.name+" "+((R=this.uiStyleSettings.toolboxButtonRowStyleColorsClassName)!==null&&R!==void 0?R:this.toolboxButtonRowStyleColorsClass.name)+" ",this.uiContainer.appendChild(this.buttonRow),this.panelButtons.splice(0),this.panels.forEach(function(N){var oe;N.uiStyleSettings=X.uiStyleSettings;var be=document.createElement("div");be.className=X.toolboxButtonStyleClass.name+" "+((oe=X.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&oe!==void 0?oe:X.toolboxButtonStyleColorsClass.name),be.innerHTML=N.icon,be.title=N.title,be.addEventListener("click",function(){X.panelButtonClick(N)}),X.panelButtons.push(be),X.buttonRow.appendChild(be)}),this.displayMode==="inline"?this.panelRow.style.display="none":this.panelRow.style.visibility="hidden")},G.prototype.panelButtonClick=function(s){var c=this,R=-1;if(s!==this.activePanel){R=this.panels.indexOf(s),this.panelRow.innerHTML="";var X=s.getUi();X.style.margin=this.uiStyleSettings.toolbarHeight/4+"px",this.panelRow.appendChild(X),this.panelRow.style.display="flex",this.panelRow.style.visibility="visible",this.panelRow.className=this.panelRow.className.replace(this.styles.fadeOutAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeInAnimationClassName,this.activePanel=s}else this.activePanel=void 0,this.panelRow.className=this.panelRow.className.replace(this.styles.fadeInAnimationClassName,""),this.panelRow.className+=" "+this.styles.fadeOutAnimationClassName,setTimeout(function(){c.displayMode==="inline"?c.panelRow.style.display="none":c.panelRow.style.visibility="hidden"},200);this.panelButtons.forEach(function(N,oe){var be,we;N.className=c.toolboxButtonStyleClass.name+" "+(oe===R?""+((be=c.uiStyleSettings.toolboxActiveButtonStyleColorsClassName)!==null&&be!==void 0?be:c.toolboxActiveButtonStyleColorsClass.name):""+((we=c.uiStyleSettings.toolboxButtonStyleColorsClassName)!==null&&we!==void 0?we:c.toolboxButtonStyleColorsClass.name))})},G}(),w=function(G,s){this.title=G,this.icon=s},y=function(G){function s(c,R,X,N){var oe=G.call(this,c,N||'<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 oe.colors=[],oe.addTransparent=!1,oe.colorBoxes=[],oe.colors=R,oe.currentColor=X,oe.setCurrentColor=oe.setCurrentColor.bind(oe),oe.getColorBox=oe.getColorBox.bind(oe),oe}return Z(s,G),s.prototype.getUi=function(){var c=this,R=document.createElement("div");return R.style.overflow="hidden",R.style.whiteSpace="nowrap",this.colors.forEach(function(X){var N=c.getColorBox(X);R.appendChild(N),c.colorBoxes.push(N)}),R},s.prototype.getColorBox=function(c){var R=this,X=this.uiStyleSettings.toolbarHeight/4,N=this.uiStyleSettings.toolbarHeight-X,oe=document.createElement("div");oe.style.display="inline-block",oe.style.boxSizing="content-box",oe.style.width=N-2+"px",oe.style.height=N-2+"px",oe.style.padding="1px",oe.style.marginRight="2px",oe.style.marginBottom="2px",oe.style.borderWidth="2px",oe.style.borderStyle="solid",oe.style.borderRadius=(N+2)/2+"px",oe.style.borderColor=c===this.currentColor?this.uiStyleSettings.toolboxAccentColor:"transparent",oe.addEventListener("click",function(){R.setCurrentColor(c,oe)});var be=document.createElement("div");return be.style.display="inline-block",be.style.width=N-2+"px",be.style.height=N-2+"px",be.style.backgroundColor=c,be.style.borderRadius=N/2+"px",c==="transparent"&&(be.style.fill=this.uiStyleSettings.toolboxAccentColor,be.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>`),oe.appendChild(be),oe},s.prototype.setCurrentColor=function(c,R){var X=this;this.currentColor=c,this.colorBoxes.forEach(function(N){N.style.borderColor=N===R?X.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onColorChanged&&this.onColorChanged(c)},s}(w),h=function(){function G(s,c,R){this._state="new",this._isSelected=!1,this._container=s,this._overlayContainer=c,this.globalSettings=R,this.stateChanged=this.stateChanged.bind(this),this.colorChanged=this.colorChanged.bind(this),this.fillColorChanged=this.fillColorChanged.bind(this)}return Object.defineProperty(G.prototype,"typeName",{get:function(){return Object.getPrototypeOf(this).constructor.typeName},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"overlayContainer",{get:function(){return this._overlayContainer},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"toolboxPanels",{get:function(){return[]},enumerable:!1,configurable:!0}),G.prototype.ownsTarget=function(s){return!1},Object.defineProperty(G.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),G.prototype.select=function(){this.container.style.cursor="move",this._isSelected=!0,this.manipulationStartState=this.getState()},G.prototype.deselect=function(){this.container.style.cursor="default",this._isSelected=!1,this.stateChanged()},G.prototype.pointerDown=function(s,c){},G.prototype.dblClick=function(s,c){},G.prototype.manipulate=function(s){},G.prototype.pointerUp=function(s){this.stateChanged()},G.prototype.dispose=function(){},G.prototype.addMarkerVisualToContainer=function(s){this.container.childNodes.length>0?this.container.insertBefore(s,this.container.childNodes[0]):this.container.appendChild(s)},G.prototype.getState=function(){return{typeName:G.typeName,state:this.state,notes:this.notes}},G.prototype.restoreState=function(s){this._state=s.state,this.notes=s.notes},G.prototype.scale=function(s,c){},G.prototype.colorChanged=function(s){this.onColorChanged&&this.onColorChanged(s),this.stateChanged()},G.prototype.fillColorChanged=function(s){this.onFillColorChanged&&this.onFillColorChanged(s),this.stateChanged()},G.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)}},G.typeName="MarkerBase",G}(),o=function(){function G(){this.findGripByVisual=this.findGripByVisual.bind(this)}return G.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},G}(),l=function(){function G(){this.GRIP_SIZE=10,this.visual=D.createGroup(),this.visual.appendChild(D.createCircle(1.5*this.GRIP_SIZE,[["fill","transparent"]])),this.visual.appendChild(D.createCircle(this.GRIP_SIZE,[["fill","#cccccc"],["fill-opacity","0.7"],["stroke","#333333"],["stroke-width","2"],["stroke-opacity","0.7"]]))}return G.prototype.ownsTarget=function(s){return s===this.visual||s===this.visual.childNodes[0]||s===this.visual.childNodes[1]},G}(),u=function(){function G(){}return G.toITransformMatrix=function(s){return{a:s.a,b:s.b,c:s.c,d:s.d,e:s.e,f:s.f}},G.toSVGMatrix=function(s,c){return s.a=c.a,s.b=c.b,s.c=c.c,s.d=c.d,s.e=c.e,s.f=c.f,s},G}(),C=function(G){function s(c,R,X){var N=G.call(this,c,R,X)||this;return N.left=0,N.top=0,N.width=0,N.height=0,N.defaultSize={x:50,y:20},N.offsetX=0,N.offsetY=0,N.rotationAngle=0,N.CB_DISTANCE=10,N._suppressMarkerCreateEvent=!1,N.container.transform.baseVal.appendItem(D.createTransform()),N.setupControlBox(),N}return Z(s,G),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(c){this._visual=c;var R=D.createTransform();this._visual.transform.baseVal.appendItem(R)},enumerable:!1,configurable:!0}),s.prototype.ownsTarget=function(c){return!!G.prototype.ownsTarget.call(this,c)||!!(this.controlGrips.findGripByVisual(c)!==void 0||this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(c))},s.prototype.pointerDown=function(c,R){G.prototype.pointerDown.call(this,c,R),this.state==="new"&&(this.left=c.x,this.top=c.y),this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.manipulationStartWidth=this.width,this.manipulationStartHeight=this.height;var X=this.unrotatePoint(c);if(this.manipulationStartX=X.x,this.manipulationStartY=X.y,this.offsetX=X.x-this.left,this.offsetY=X.y-this.top,this.state!=="new")if(this.select(),this.activeGrip=this.controlGrips.findGripByVisual(R),this.activeGrip!==void 0)this._state="resize";else if(this.rotatorGrip!==void 0&&this.rotatorGrip.ownsTarget(R)){this.activeGrip=this.rotatorGrip;var N=this.rotatePoint({x:this.centerX,y:this.centerY});this.left=N.x-this.width/2,this.top=N.y-this.height/2,this.moveVisual({x:this.left,y:this.top});var oe=this.container.transform.baseVal.getItem(0);oe.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(oe,0),this.adjustControlBox(),this._state="rotate"}else this._state="move"},s.prototype.pointerUp=function(c){var R=this.state;G.prototype.pointerUp.call(this,c),this.state==="creating"&&this.width<10&&this.height<10?(this.width=this.defaultSize.x,this.height=this.defaultSize.y):this.manipulate(c),this._state="select",R==="creating"&&this.onMarkerCreated&&this._suppressMarkerCreateEvent===!1&&this.onMarkerCreated(this)},s.prototype.moveVisual=function(c){this.visual.style.transform="translate("+c.x+"px, "+c.y+"px)"},s.prototype.manipulate=function(c){var R=this.unrotatePoint(c);this.state==="creating"?this.resize(c):this.state==="move"?(this.left=this.manipulationStartLeft+(R.x-this.manipulationStartLeft)-this.offsetX,this.top=this.manipulationStartTop+(R.y-this.manipulationStartTop)-this.offsetY,this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()):this.state==="resize"?this.resize(R):this.state==="rotate"&&this.rotate(c)},s.prototype.resize=function(c){var R=this.manipulationStartLeft,X=this.manipulationStartWidth,N=this.manipulationStartTop,oe=this.manipulationStartHeight;switch(this.activeGrip){case this.controlGrips.bottomLeft:case this.controlGrips.centerLeft:case this.controlGrips.topLeft:R=this.manipulationStartLeft+c.x-this.manipulationStartX,X=this.manipulationStartWidth+this.manipulationStartLeft-R;break;case this.controlGrips.bottomRight:case this.controlGrips.centerRight:case this.controlGrips.topRight:case void 0:X=this.manipulationStartWidth+c.x-this.manipulationStartX}switch(this.activeGrip){case this.controlGrips.topCenter:case this.controlGrips.topLeft:case this.controlGrips.topRight:N=this.manipulationStartTop+c.y-this.manipulationStartY,oe=this.manipulationStartHeight+this.manipulationStartTop-N;break;case this.controlGrips.bottomCenter:case this.controlGrips.bottomLeft:case this.controlGrips.bottomRight:case void 0:oe=this.manipulationStartHeight+c.y-this.manipulationStartY}X>=0?(this.left=R,this.width=X):(this.left=R+X,this.width=-X),oe>=0?(this.top=N,this.height=oe):(this.top=N+oe,this.height=-oe),this.setSize()},s.prototype.setSize=function(){this.moveVisual({x:this.left,y:this.top}),this.adjustControlBox()},s.prototype.rotate=function(c){if(Math.abs(c.x-this.centerX)>.1){var R=Math.sign(c.x-this.centerX);this.rotationAngle=180*Math.atan((c.y-this.centerY)/(c.x-this.centerX))/Math.PI+90*R,this.applyRotation()}},s.prototype.applyRotation=function(){var c=this.container.transform.baseVal.getItem(0);c.setRotate(this.rotationAngle,this.centerX,this.centerY),this.container.transform.baseVal.replaceItem(c,0)},s.prototype.rotatePoint=function(c){if(this.rotationAngle===0)return c;var R=this.container.getCTM(),X=D.createPoint(c.x,c.y);return{x:(X=X.matrixTransform(R)).x,y:X.y}},s.prototype.unrotatePoint=function(c){if(this.rotationAngle===0)return c;var R=this.container.getCTM();R=R.inverse();var X=D.createPoint(c.x,c.y);return{x:(X=X.matrixTransform(R)).x,y:X.y}},s.prototype.select=function(){G.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},s.prototype.deselect=function(){G.prototype.deselect.call(this),this.controlBox.style.display="none"},s.prototype.setupControlBox=function(){this.controlBox=D.createGroup();var c=D.createTransform();c.setTranslate(-this.CB_DISTANCE/2,-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.appendItem(c),this.container.appendChild(this.controlBox),this.controlRect=D.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=D.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 o,this.addControlGrips(),this.controlBox.style.display="none"},s.prototype.adjustControlBox=function(){var c=this.controlBox.transform.baseVal.getItem(0);c.setTranslate(this.left-this.CB_DISTANCE/2,this.top-this.CB_DISTANCE/2),this.controlBox.transform.baseVal.replaceItem(c,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 c=new l;return c.visual.transform.baseVal.appendItem(D.createTransform()),this.controlBox.appendChild(c.visual),c},s.prototype.positionGrips=function(){var c=this.controlGrips.topLeft.GRIP_SIZE,R=-c/2,X=R,N=(this.width+this.CB_DISTANCE)/2-c/2,oe=(this.height+this.CB_DISTANCE)/2-c/2,be=this.height+this.CB_DISTANCE-c/2,we=this.width+this.CB_DISTANCE-c/2;this.positionGrip(this.controlGrips.topLeft.visual,R,X),this.positionGrip(this.controlGrips.topCenter.visual,N,X),this.positionGrip(this.controlGrips.topRight.visual,we,X),this.positionGrip(this.controlGrips.centerLeft.visual,R,oe),this.positionGrip(this.controlGrips.centerRight.visual,we,oe),this.positionGrip(this.controlGrips.bottomLeft.visual,R,be),this.positionGrip(this.controlGrips.bottomCenter.visual,N,be),this.positionGrip(this.controlGrips.bottomRight.visual,we,be),this.rotatorGrip!==void 0&&this.positionGrip(this.rotatorGrip.visual,N,X-3*this.CB_DISTANCE)},s.prototype.positionGrip=function(c,R,X){var N=c.transform.baseVal.getItem(0);N.setTranslate(R,X),c.transform.baseVal.replaceItem(N,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:u.toITransformMatrix(this.visual.transform.baseVal.getItem(0).matrix),containerTransformMatrix:u.toITransformMatrix(this.container.transform.baseVal.getItem(0).matrix)},G.prototype.getState.call(this))},s.prototype.restoreState=function(c){G.prototype.restoreState.call(this,c);var R=c;this.left=R.left,this.top=R.top,this.width=R.width,this.height=R.height,this.rotationAngle=R.rotationAngle,this.visual.transform.baseVal.getItem(0).setMatrix(u.toSVGMatrix(this.visual.transform.baseVal.getItem(0).matrix,R.visualTransformMatrix)),this.container.transform.baseVal.getItem(0).setMatrix(u.toSVGMatrix(this.container.transform.baseVal.getItem(0).matrix,R.containerTransformMatrix))},s.prototype.scale=function(c,R){G.prototype.scale.call(this,c,R);var X=this.rotatePoint({x:this.left,y:this.top}),N=this.unrotatePoint({x:X.x*c,y:X.y*R});this.left=N.x,this.top=N.y,this.width=this.width*c,this.height=this.height*R,this.adjustControlBox()},s}(h),v=function(G){function s(c,R,X){var N=G.call(this,c,R,X)||this;return N.fillColor="transparent",N.strokeColor="transparent",N.strokeWidth=0,N.strokeDasharray="",N.opacity=1,N.setStrokeColor=N.setStrokeColor.bind(N),N.setFillColor=N.setFillColor.bind(N),N.setStrokeWidth=N.setStrokeWidth.bind(N),N.setStrokeDasharray=N.setStrokeDasharray.bind(N),N.createVisual=N.createVisual.bind(N),N}return Z(s,G),s.prototype.ownsTarget=function(c){return!(!G.prototype.ownsTarget.call(this,c)&&c!==this.visual)},s.prototype.createVisual=function(){this.visual=D.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(c,R){G.prototype.pointerDown.call(this,c,R),this.state==="new"&&(this.createVisual(),this.moveVisual(c),this._state="creating")},s.prototype.manipulate=function(c){G.prototype.manipulate.call(this,c)},s.prototype.resize=function(c){G.prototype.resize.call(this,c),this.setSize()},s.prototype.setSize=function(){G.prototype.setSize.call(this),D.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]])},s.prototype.pointerUp=function(c){G.prototype.pointerUp.call(this,c),this.setSize()},s.prototype.setStrokeColor=function(c){this.strokeColor=c,this.visual&&D.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(c),this.stateChanged()},s.prototype.setFillColor=function(c){this.fillColor=c,this.visual&&D.setAttributes(this.visual,[["fill",this.fillColor]]),this.stateChanged()},s.prototype.setStrokeWidth=function(c){this.strokeWidth=c,this.visual&&D.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},s.prototype.setStrokeDasharray=function(c){this.strokeDasharray=c,this.visual&&D.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},G.prototype.getState.call(this))},s.prototype.restoreState=function(c){var R=c;this.fillColor=R.fillColor,this.strokeColor=R.strokeColor,this.strokeWidth=R.strokeWidth,this.strokeDasharray=R.strokeDasharray,this.opacity=R.opacity,this.createVisual(),G.prototype.restoreState.call(this,c),this.setSize()},s.prototype.scale=function(c,R){G.prototype.scale.call(this,c,R),this.setSize()},s.title="Rectangle marker",s}(C),m=function(G){function s(c,R,X,N){var oe=G.call(this,c,N||'<svg viewBox="0 0 24 24"><path d="M3 17h18v-2H3v2m0 3h18v-1H3v1m0-7h18v-3H3v3m0-9v4h18V4H3z"/></svg>')||this;return oe.widths=[],oe.widthBoxes=[],oe.widths=R,oe.currentWidth=X,oe.setCurrentWidth=oe.setCurrentWidth.bind(oe),oe}return Z(s,G),s.prototype.getUi=function(){var c=this,R=document.createElement("div");return R.style.display="flex",R.style.overflow="hidden",R.style.flexGrow="2",this.widths.forEach(function(X){var N=document.createElement("div");N.style.display="flex",N.style.flexGrow="2",N.style.alignItems="center",N.style.justifyContent="space-between",N.style.padding="5px",N.style.borderWidth="2px",N.style.borderStyle="solid",N.style.borderColor=X===c.currentWidth?c.uiStyleSettings.toolboxAccentColor:"transparent",N.addEventListener("click",function(){c.setCurrentWidth(X,N)}),R.appendChild(N);var oe=document.createElement("div");oe.innerText=X.toString(),oe.style.marginRight="5px",N.appendChild(oe);var be=document.createElement("div");be.style.minHeight="20px",be.style.flexGrow="2",be.style.display="flex",be.style.alignItems="center";var we=document.createElement("hr");we.style.minWidth="20px",we.style.border="0px",we.style.borderTop=X+"px solid "+c.uiStyleSettings.toolboxColor,we.style.flexGrow="2",be.appendChild(we),N.appendChild(be),c.widthBoxes.push(N)}),R},s.prototype.setCurrentWidth=function(c,R){var X=this;this.currentWidth=c,this.widthBoxes.forEach(function(N){N.style.borderColor=N===R?X.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onWidthChanged&&this.onWidthChanged(this.currentWidth)},s}(w),k=function(G){function s(c,R,X,N){var oe=G.call(this,c,N||'<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 oe.styles=[],oe.styleBoxes=[],oe.styles=R,oe.currentStyle=X,oe.setCurrentStyle=oe.setCurrentStyle.bind(oe),oe}return Z(s,G),s.prototype.getUi=function(){var c=this,R=document.createElement("div");return R.style.display="flex",R.style.overflow="hidden",R.style.flexGrow="2",this.styles.forEach(function(X){var N=document.createElement("div");N.style.display="flex",N.style.alignItems="center",N.style.justifyContent="space-between",N.style.padding="5px",N.style.borderWidth="2px",N.style.borderStyle="solid",N.style.overflow="hidden",N.style.maxWidth=100/c.styles.length-5+"%",N.style.borderColor=X===c.currentStyle?c.uiStyleSettings.toolboxAccentColor:"transparent",N.addEventListener("click",function(){c.setCurrentStyle(X,N)}),R.appendChild(N);var oe=document.createElement("div");oe.style.minHeight="20px",oe.style.flexGrow="2",oe.style.overflow="hidden";var be=`<svg width="100" height="20">
|
|
<line x1="0" y1="10" x2="100" y2="10" stroke="`+c.uiStyleSettings.toolboxColor+'" stroke-width="3" '+(X!==""?'stroke-dasharray="'+X+'"':"")+` />
|
|
</svg>`;oe.innerHTML=be,N.appendChild(oe),c.styleBoxes.push(N)}),R},s.prototype.setCurrentStyle=function(c,R){var X=this;this.currentStyle=c,this.styleBoxes.forEach(function(N){N.style.borderColor=N===R?X.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onStyleChanged&&this.onStyleChanged(this.currentStyle)},s}(w),x=function(G){function s(c,R,X){var N=G.call(this,c,R,X)||this;return N.strokeColor=X.defaultColor,N.strokeWidth=X.defaultStrokeWidth,N.strokeDasharray=X.defaultStrokeDasharray,N.strokePanel=new y("Line color",X.defaultColorSet,X.defaultColor),N.strokePanel.onColorChanged=N.setStrokeColor,N.strokeWidthPanel=new m("Line width",X.defaultStrokeWidths,X.defaultStrokeWidth),N.strokeWidthPanel.onWidthChanged=N.setStrokeWidth,N.strokeStylePanel=new k("Line style",X.defaultStrokeDasharrays,X.defaultStrokeDasharray),N.strokeStylePanel.onStyleChanged=N.setStrokeDasharray,N}return Z(s,G),Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var c=G.prototype.getState.call(this);return c.typeName=s.typeName,c},s.typeName="FrameMarker",s.title="Frame marker",s.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4m14 11H6V8h12v9z"/></svg>',s}(v),f=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},p=function(G){function s(c,R,X){var N=G.call(this,c,R,X)||this;return N.x1=0,N.y1=0,N.x2=0,N.y2=0,N.defaultLength=50,N.manipulationStartX=0,N.manipulationStartY=0,N.manipulationStartX1=0,N.manipulationStartY1=0,N.manipulationStartX2=0,N.manipulationStartY2=0,N.setupControlBox(),N}return Z(s,G),s.prototype.ownsTarget=function(c){return!!G.prototype.ownsTarget.call(this,c)||!(!this.grip1.ownsTarget(c)&&!this.grip2.ownsTarget(c))},s.prototype.pointerDown=function(c,R){G.prototype.pointerDown.call(this,c,R),this.manipulationStartX=c.x,this.manipulationStartY=c.y,this.state==="new"&&(this.x1=c.x,this.y1=c.y,this.x2=c.x,this.y2=c.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(R)?this.activeGrip=this.grip1:this.grip2.ownsTarget(R)?this.activeGrip=this.grip2:this.activeGrip=void 0,this.activeGrip?this._state="resize":this._state="move")},s.prototype.pointerUp=function(c){var R=this.state;G.prototype.pointerUp.call(this,c),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(c),this._state="select",R==="creating"&&this.onMarkerCreated&&this.onMarkerCreated(this)},s.prototype.adjustVisual=function(){},s.prototype.manipulate=function(c){this.state==="creating"?this.resize(c):this.state==="move"?(this.x1=this.manipulationStartX1+c.x-this.manipulationStartX,this.y1=this.manipulationStartY1+c.y-this.manipulationStartY,this.x2=this.manipulationStartX2+c.x-this.manipulationStartX,this.y2=this.manipulationStartY2+c.y-this.manipulationStartY,this.adjustVisual(),this.adjustControlBox()):this.state==="resize"&&this.resize(c)},s.prototype.resize=function(c){switch(this.activeGrip){case this.grip1:this.x1=c.x,this.y1=c.y;break;case this.grip2:case void 0:this.x2=c.x,this.y2=c.y}this.adjustVisual(),this.adjustControlBox()},s.prototype.select=function(){G.prototype.select.call(this),this.adjustControlBox(),this.controlBox.style.display=""},s.prototype.deselect=function(){G.prototype.deselect.call(this),this.controlBox.style.display="none"},s.prototype.setupControlBox=function(){this.controlBox=D.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 c=new l;return c.visual.transform.baseVal.appendItem(D.createTransform()),this.controlBox.appendChild(c.visual),c},s.prototype.positionGrips=function(){var c=this.grip1.GRIP_SIZE;this.positionGrip(this.grip1.visual,this.x1-c/2,this.y1-c/2),this.positionGrip(this.grip2.visual,this.x2-c/2,this.y2-c/2)},s.prototype.positionGrip=function(c,R,X){var N=c.transform.baseVal.getItem(0);N.setTranslate(R,X),c.transform.baseVal.replaceItem(N,0)},s.prototype.getState=function(){return Object.assign({x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2},G.prototype.getState.call(this))},s.prototype.restoreState=function(c){G.prototype.restoreState.call(this,c);var R=c;this.x1=R.x1,this.y1=R.y1,this.x2=R.x2,this.y2=R.y2},s.prototype.scale=function(c,R){G.prototype.scale.call(this,c,R),this.x1=this.x1*c,this.y1=this.y1*R,this.x2=this.x2*c,this.y2=this.y2*R,this.adjustVisual(),this.adjustControlBox()},s}(h),d=function(G){function s(c,R,X){var N=G.call(this,c,R,X)||this;return N.strokeColor="transparent",N.strokeWidth=0,N.strokeDasharray="",N.setStrokeColor=N.setStrokeColor.bind(N),N.setStrokeWidth=N.setStrokeWidth.bind(N),N.setStrokeDasharray=N.setStrokeDasharray.bind(N),N.strokeColor=X.defaultColor,N.strokeWidth=X.defaultStrokeWidth,N.strokeDasharray=X.defaultStrokeDasharray,N.strokePanel=new y("Line color",X.defaultColorSet,X.defaultColor),N.strokePanel.onColorChanged=N.setStrokeColor,N.strokeWidthPanel=new m("Line width",X.defaultStrokeWidths,X.defaultStrokeWidth),N.strokeWidthPanel.onWidthChanged=N.setStrokeWidth,N.strokeStylePanel=new k("Line style",X.defaultStrokeDasharrays,X.defaultStrokeDasharray),N.strokeStylePanel.onStyleChanged=N.setStrokeDasharray,N}return Z(s,G),s.prototype.ownsTarget=function(c){return!(!G.prototype.ownsTarget.call(this,c)&&c!==this.visual&&c!==this.selectorLine&&c!==this.visibleLine)},s.prototype.createVisual=function(){this.visual=D.createGroup(),this.selectorLine=D.createLine(this.x1,this.y1,this.x2,this.y2,[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()]]),this.visibleLine=D.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(c,R){G.prototype.pointerDown.call(this,c,R),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()),D.setAttributes(this.visibleLine,[["stroke",this.strokeColor]]),D.setAttributes(this.visibleLine,[["stroke-width",this.strokeWidth.toString()]]),D.setAttributes(this.visibleLine,[["stroke-dasharray",this.strokeDasharray.toString()]]))},s.prototype.setStrokeColor=function(c){this.strokeColor=c,this.adjustVisual(),this.colorChanged(c)},s.prototype.setStrokeWidth=function(c){this.strokeWidth=c,this.adjustVisual()},s.prototype.setStrokeDasharray=function(c){this.strokeDasharray=c,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 c=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray},G.prototype.getState.call(this));return c.typeName=s.typeName,c},s.prototype.restoreState=function(c){G.prototype.restoreState.call(this,c);var R=c;this.strokeColor=R.strokeColor,this.strokeWidth=R.strokeWidth,this.strokeDasharray=R.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}(p),a=function(G){function s(c,R,X,N){var oe=G.call(this,c,N||'<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 oe.fonts=[],oe.fontBoxes=[],oe.fonts=R,oe.currentFont=X,oe.setCurrentFont=oe.setCurrentFont.bind(oe),oe}return Z(s,G),s.prototype.getUi=function(){var c=this,R=document.createElement("div");return R.style.overflow="hidden",R.style.flexGrow="2",this.fonts.forEach(function(X){var N=document.createElement("div");N.style.display="inline-block",N.style.alignItems="center",N.style.justifyContent="space-between",N.style.padding="5px",N.style.borderWidth="2px",N.style.borderStyle="solid",N.style.overflow="hidden",N.style.maxWidth=100/c.fonts.length-5+"%",N.style.borderColor=X===c.currentFont?c.uiStyleSettings.toolboxAccentColor:"transparent",N.addEventListener("click",function(){c.setCurrentFont(X,N)}),R.appendChild(N);var oe=document.createElement("div");oe.style.display="flex",oe.style.minHeight="20px",oe.style.flexGrow="2",oe.style.fontFamily=X,oe.style.overflow="hidden";var be=document.createElement("div");be.style.whiteSpace="nowrap",be.style.overflow="hidden",be.style.textOverflow="ellipsis",be.innerHTML="The quick brown fox jumps over the lazy dog",oe.appendChild(be),N.appendChild(oe),c.fontBoxes.push(N)}),R},s.prototype.setCurrentFont=function(c,R){var X=this;this.currentFont=c,this.fontBoxes.forEach(function(N){N.style.borderColor=N===R?X.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onFontChanged&&this.onFontChanged(this.currentFont)},s}(w),E=function(G){function s(c,R,X){var N=G.call(this,c,R,X)||this;return N.color="transparent",N.padding=5,N.DEFAULT_TEXT="your text here",N.text=N.DEFAULT_TEXT,N.isMoved=!1,N.color=X.defaultColor,N.fontFamily=X.defaultFontFamily,N.defaultSize={x:100,y:30},N.setColor=N.setColor.bind(N),N.setFont=N.setFont.bind(N),N.renderText=N.renderText.bind(N),N.sizeText=N.sizeText.bind(N),N.textEditDivClicked=N.textEditDivClicked.bind(N),N.showTextEditor=N.showTextEditor.bind(N),N.setSize=N.setSize.bind(N),N.positionTextEditor=N.positionTextEditor.bind(N),N.colorPanel=new y("Color",X.defaultColorSet,X.defaultColor),N.colorPanel.onColorChanged=N.setColor,N.fontFamilyPanel=new a("Font",X.defaultFontFamilies,X.defaultFontFamily),N.fontFamilyPanel.onFontChanged=N.setFont,N}return Z(s,G),s.prototype.ownsTarget=function(c){if(G.prototype.ownsTarget.call(this,c)||c===this.visual||c===this.textElement||c===this.bgRectangle)return!0;var R=!1;return this.textElement.childNodes.forEach(function(X){X===c&&(R=!0)}),R},s.prototype.createVisual=function(){this.visual=D.createGroup(),this.bgRectangle=D.createRect(1,1,[["fill","transparent"]]),this.visual.appendChild(this.bgRectangle),this.textElement=D.createText([["fill",this.color],["font-family",this.fontFamily],["font-size","16px"],["x","0"],["y","0"]]),this.textElement.transform.baseVal.appendItem(D.createTransform()),this.textElement.transform.baseVal.appendItem(D.createTransform()),this.visual.appendChild(this.textElement),this.addMarkerVisualToContainer(this.visual),this.renderText()},s.prototype.pointerDown=function(c,R){G.prototype.pointerDown.call(this,c,R),this.isMoved=!1,this.pointerDownPoint=c,this.pointerDownTimestamp=Date.now(),this.state==="new"&&(this.createVisual(),this.moveVisual(c),this._state="creating")},s.prototype.renderText=function(){var c=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(R){c.textElement.appendChild(D.createTSpan(R.trim()===""?" ":R.trim(),[["x","0"],["dy","1.2em"]]))}),setTimeout(this.sizeText,10)}},s.prototype.getTextScale=function(){var c=this.textElement.getBBox(),R=1;if(c.width>0&&c.height>0){var X=(1*this.width-this.width*this.padding*2/100)/c.width,N=(1*this.height-this.height*this.padding*2/100)/c.height;R=Math.min(X,N)}return R},s.prototype.getTextPosition=function(c){var R=this.textElement.getBBox(),X=0,N=0;return R.width>0&&R.height>0&&(X=(this.width-R.width*c)/2,N=this.height/2-R.height*c/2),{x:X,y:N}},s.prototype.sizeText=function(){var c=this.textElement.getBBox(),R=this.getTextScale(),X=this.getTextPosition(R);X.y-=c.y*R,navigator.userAgent.indexOf("Edge/")>-1?this.textElement.style.transform="translate("+X.x+"px, "+X.y+"px) scale("+R+", "+R+")":(this.textElement.transform.baseVal.getItem(0).setTranslate(X.x,X.y),this.textElement.transform.baseVal.getItem(1).setScale(R,R))},s.prototype.manipulate=function(c){G.prototype.manipulate.call(this,c),this.pointerDownPoint!==void 0&&(this.isMoved=Math.abs(c.x-this.pointerDownPoint.x)>5||Math.abs(c.y-this.pointerDownPoint.y)>5)},s.prototype.resize=function(c){G.prototype.resize.call(this,c),this.isMoved=!0,this.setSize(),this.sizeText()},s.prototype.setSize=function(){G.prototype.setSize.call(this),this.visual&&this.bgRectangle&&(D.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),D.setAttributes(this.bgRectangle,[["width",this.width.toString()],["height",this.height.toString()]]))},s.prototype.pointerUp=function(c){var R=this.state;R==="creating"&&(this._suppressMarkerCreateEvent=!0),G.prototype.pointerUp.call(this,c),this.setSize(),(R==="creating"||!this.isMoved&&Date.now()-this.pointerDownTimestamp>500)&&this.showTextEditor(),this.pointerDownPoint=void 0},s.prototype.showTextEditor=function(){var c=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(R){R.stopPropagation()}),this.textEditor.addEventListener("input",function(){for(var R=Number.parseFloat(c.textEditor.style.fontSize);c.textEditor.clientWidth>=Number.parseInt(c.textEditor.style.maxWidth)&&R>.9;)R-=.1,c.textEditor.style.fontSize=Math.max(R,.9)+"em"}),this.textEditor.addEventListener("keyup",function(R){R.cancelBubble=!0}),this.textEditor.addEventListener("paste",function(R){if(R.clipboardData){var X=R.clipboardData.getData("text"),N=window.getSelection();if(!N.rangeCount)return!1;N.deleteFromDocument(),N.getRangeAt(0).insertNode(document.createTextNode(X)),R.preventDefault()}}),this.textEditDiv.addEventListener("pointerup",function(){c.textEditDivClicked(c.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 c=this.getTextScale(),R=this.rotatePoint({x:this.left+this.width/2,y:this.top+this.height/2}),X=this.textElement.getBBox(),N={x:X.width*c,y:X.height*c};R.x-=N.x/2,R.y-=N.y/2,this.textEditor.style.top=R.y+"px",this.textEditor.style.left=R.x+"px",this.textEditor.style.maxWidth=this.overlayContainer.offsetWidth-R.x+"px",this.textEditor.style.fontSize=Math.max(16*c,12)+"px",this.textElement.style.display="none"}},s.prototype.textEditDivClicked=function(c){this.text=c.trim(),this.overlayContainer.innerHTML="",this.renderText(),this.showVisual(),this._suppressMarkerCreateEvent&&(this._suppressMarkerCreateEvent=!1,this.onMarkerCreated&&this.onMarkerCreated(this)),this.stateChanged()},s.prototype.select=function(){G.prototype.select.call(this),this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText)},s.prototype.deselect=function(){this.state==="edit"&&this.textEditDivClicked(this.textEditor.innerText),G.prototype.deselect.call(this)},s.prototype.dblClick=function(c,R){G.prototype.dblClick.call(this,c,R),this.showTextEditor()},s.prototype.setColor=function(c){this.textElement&&D.setAttributes(this.textElement,[["fill",c]]),this.color=c,this.textEditor&&(this.textEditor.style.color=this.color),this.colorChanged(c)},s.prototype.setFont=function(c){this.textElement&&D.setAttributes(this.textElement,[["font-family",c]]),this.fontFamily=c,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 c=Object.assign({color:this.color,fontFamily:this.fontFamily,padding:this.padding,text:this.text},G.prototype.getState.call(this));return c.typeName=s.typeName,c},s.prototype.restoreState=function(c){var R=c;this.color=R.color,this.fontFamily=R.fontFamily,this.padding=R.padding,this.text=R.text,this.createVisual(),G.prototype.restoreState.call(this,c),this.setSize()},s.prototype.scale=function(c,R){G.prototype.scale.call(this,c,R),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}(C),g=function(G){function s(c,R,X){var N=G.call(this,c,R,X)||this;return N.color="transparent",N.lineWidth=3,N.drawing=!1,N.pixelRatio=1,N.color=X.defaultColor,N.lineWidth=X.defaultStrokeWidth,N.pixelRatio=X.freehandPixelRatio,N.setColor=N.setColor.bind(N),N.addCanvas=N.addCanvas.bind(N),N.finishCreation=N.finishCreation.bind(N),N.setLineWidth=N.setLineWidth.bind(N),N.colorPanel=new y("Color",X.defaultColorSet,X.defaultColor),N.colorPanel.onColorChanged=N.setColor,N.lineWidthPanel=new m("Line width",X.defaultStrokeWidths,X.defaultStrokeWidth),N.lineWidthPanel.onWidthChanged=N.setLineWidth,N}return Z(s,G),s.prototype.ownsTarget=function(c){return!(!G.prototype.ownsTarget.call(this,c)&&c!==this.visual&&c!==this.drawingImage)},s.prototype.createVisual=function(){this.visual=D.createGroup(),this.drawingImage=D.createImage(),this.visual.appendChild(this.drawingImage);var c=D.createTransform();this.visual.transform.baseVal.appendItem(c),this.addMarkerVisualToContainer(this.visual)},s.prototype.pointerDown=function(c,R){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(c.x,c.y),this.drawing=!0):G.prototype.pointerDown.call(this,c,R)},s.prototype.manipulate=function(c){this.state==="creating"?this.drawing&&(this.canvasContext.lineTo(c.x,c.y),this.canvasContext.stroke()):G.prototype.manipulate.call(this,c)},s.prototype.resize=function(c){G.prototype.resize.call(this,c),D.setAttributes(this.visual,[["width",this.width.toString()],["height",this.height.toString()]]),D.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]])},s.prototype.pointerUp=function(c){this._state==="creating"?this.drawing&&(this.canvasContext.closePath(),this.drawing=!1,this.globalSettings.newFreehandMarkerOnPointerUp&&this.finishCreation()):G.prototype.pointerUp.call(this,c)},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(),G.prototype.select.call(this)},s.prototype.deselect=function(){this.state==="creating"&&this.finishCreation(),G.prototype.deselect.call(this)},s.prototype.finishCreation=function(){for(var c=this.canvasContext.getImageData(0,0,this.canvasElement.width,this.canvasElement.height),R=[this.canvasElement.width+1,this.canvasElement.height+1,-1,-1],X=R[0],N=R[1],oe=R[2],be=R[3],we=!1,_e=0;_e<this.canvasElement.height;_e++)for(var Le=0;Le<this.canvasElement.width;Le++)c.data[_e*this.canvasElement.width*4+4*Le+3]>0&&(we=!0,_e<N&&(N=_e),Le<X&&(X=Le),_e>be&&(be=_e),Le>oe&&(oe=Le));if(we){this.left=X/this.pixelRatio,this.top=N/this.pixelRatio,this.width=(oe-X)/this.pixelRatio,this.height=(be-N)/this.pixelRatio;var Oe=document.createElement("canvas");Oe.width=oe-X,Oe.height=be-N,Oe.getContext("2d").putImageData(this.canvasContext.getImageData(X,N,oe-X,be-N),0,0),this.drawingImgUrl=Oe.toDataURL("image/png"),this.setDrawingImage(),this._state="select",this.onMarkerCreated&&this.onMarkerCreated(this)}this.overlayContainer.innerHTML=""},s.prototype.setDrawingImage=function(){D.setAttributes(this.drawingImage,[["width",this.width.toString()],["height",this.height.toString()]]),D.setAttributes(this.drawingImage,[["href",this.drawingImgUrl]]),this.moveVisual({x:this.left,y:this.top})},s.prototype.setColor=function(c){this.color=c,this.colorChanged(c)},s.prototype.setLineWidth=function(c){this.lineWidth=c},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 c=Object.assign({drawingImgUrl:this.drawingImgUrl},G.prototype.getState.call(this));return c.typeName=s.typeName,c},s.prototype.restoreState=function(c){this.createVisual(),G.prototype.restoreState.call(this,c),this.drawingImgUrl=c.drawingImgUrl,this.setDrawingImage()},s.prototype.scale=function(c,R){G.prototype.scale.call(this,c,R),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}(C),S=function(G){function s(c,R,X){var N=G.call(this,c,X||'<svg viewBox="0 0 24 24"><path d="M8 14v4l-6-6 6-6v4h8V6l6 6-6 6v-4H8z"/></svg>')||this;return N.typeBoxes=[],N.currentType=R,N.setCurrentType=N.setCurrentType.bind(N),N}return Z(s,G),s.prototype.getUi=function(){var c=this,R=document.createElement("div");R.style.display="flex",R.style.overflow="hidden",R.style.flexGrow="2";for(var X=function(be){var we="both";switch(be){case 0:we="both";break;case 1:we="start";break;case 2:we="end";break;case 3:we="none"}var _e=document.createElement("div");if(_e.style.display="flex",_e.style.flexGrow="2",_e.style.alignItems="center",_e.style.justifyContent="space-between",_e.style.padding="5px",_e.style.borderWidth="2px",_e.style.borderStyle="solid",_e.style.borderColor=we===N.currentType?N.uiStyleSettings.toolboxAccentColor:"transparent",_e.addEventListener("click",function(){c.setCurrentType(we,_e)}),R.appendChild(_e),we==="both"||we==="start"){var Le=document.createElement("div");Le.style.display="flex",Le.style.alignItems="center",Le.style.minHeight="20px",Le.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="`+(N.uiStyleSettings!==void 0?N.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
|
|
</svg>`,Le.style.marginLeft="5px",_e.appendChild(Le)}var Oe=document.createElement("div");Oe.style.display="flex",Oe.style.alignItems="center",Oe.style.minHeight="20px",Oe.style.flexGrow="2";var Me=document.createElement("hr");if(Me.style.minWidth="20px",Me.style.border="0px",Me.style.borderTop="3px solid "+(N.uiStyleSettings!==void 0?N.uiStyleSettings.toolboxColor:"#eeeeee"),Me.style.flexGrow="2",Oe.appendChild(Me),_e.appendChild(Oe),we==="both"||we==="end"){var Be=document.createElement("div");Be.style.display="flex",Be.style.alignItems="center",Be.style.minHeight="20px",Be.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="`+(N.uiStyleSettings!==void 0?N.uiStyleSettings.toolboxColor:"#eeeeee")+`" />
|
|
</svg>`,Be.style.marginRight="5px",_e.appendChild(Be)}N.typeBoxes.push(_e)},N=this,oe=0;oe<4;oe++)X(oe);return R},s.prototype.setCurrentType=function(c,R){var X=this;this.currentType=c,this.typeBoxes.forEach(function(N){N.style.borderColor=N===R?X.uiStyleSettings!==void 0?X.uiStyleSettings.toolboxAccentColor:"#3080c3":"transparent"}),this.onArrowTypeChanged&&this.onArrowTypeChanged(this.currentType)},s}(w),F=function(G){function s(c,R,X){var N=G.call(this,c,R,X)||this;return N.arrowType="end",N.arrowBaseHeight=10,N.arrowBaseWidth=10,N.getArrowPoints=N.getArrowPoints.bind(N),N.setArrowType=N.setArrowType.bind(N),N.arrowTypePanel=new S("Arrow type","end"),N.arrowTypePanel.onArrowTypeChanged=N.setArrowType,N}return Z(s,G),s.prototype.ownsTarget=function(c){return!(!G.prototype.ownsTarget.call(this,c)&&c!==this.arrow1&&c!==this.arrow2)},s.prototype.getArrowPoints=function(c,R){var X=this.arrowBaseWidth+2*this.strokeWidth,N=this.arrowBaseHeight+2*this.strokeWidth;return c-X/2+","+(R+N/2)+" "+c+","+(R-N/2)+" "+(c+X/2)+","+(R+N/2)},s.prototype.createTips=function(){this.arrow1=D.createPolygon(this.getArrowPoints(this.x1,this.y1),[["fill",this.strokeColor]]),this.arrow1.transform.baseVal.appendItem(D.createTransform()),this.visual.appendChild(this.arrow1),this.arrow2=D.createPolygon(this.getArrowPoints(this.x2,this.y2),[["fill",this.strokeColor]]),this.arrow2.transform.baseVal.appendItem(D.createTransform()),this.visual.appendChild(this.arrow2)},s.prototype.pointerDown=function(c,R){G.prototype.pointerDown.call(this,c,R),this.state==="creating"&&this.createTips()},s.prototype.adjustVisual=function(){if(G.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",D.setAttributes(this.arrow1,[["points",this.getArrowPoints(this.x1,this.y1)],["fill",this.strokeColor]]),D.setAttributes(this.arrow2,[["points",this.getArrowPoints(this.x2,this.y2)],["fill",this.strokeColor]]),Math.abs(this.x1-this.x2)>.1)){var c=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),R=this.arrow1.transform.baseVal.getItem(0);R.setRotate(c,this.x1,this.y1),this.arrow1.transform.baseVal.replaceItem(R,0);var X=this.arrow2.transform.baseVal.getItem(0);X.setRotate(c+180,this.x2,this.y2),this.arrow2.transform.baseVal.replaceItem(X,0)}},s.prototype.setArrowType=function(c){this.arrowType=c,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 c=Object.assign({arrowType:this.arrowType},G.prototype.getState.call(this));return c.typeName=s.typeName,c},s.prototype.restoreState=function(c){G.prototype.restoreState.call(this,c);var R=c;this.arrowType=R.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}(d),W=function(G){function s(c,R,X){var N=G.call(this,c,R,X)||this;return N.fillColor=X.defaultFillColor,N.strokeWidth=0,N.fillPanel=new y("Color",X.defaultColorSet,X.defaultFillColor),N.fillPanel.onColorChanged=N.setFillColor,N}return Z(s,G),Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.fillPanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var c=G.prototype.getState.call(this);return c.typeName=s.typeName,c},s.typeName="CoverMarker",s.title="Cover marker",s.icon='<svg viewBox="0 0 24 24"><path d="M4 6v13h16V6H4z"/></svg>',s}(v),K=function(G){function s(c,R,X,N){var oe=G.call(this,c,N||'<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 oe.opacities=[],oe.opacityBoxes=[],oe.opacities=R,oe.currentOpacity=X,oe.setCurrentOpacity=oe.setCurrentOpacity.bind(oe),oe}return Z(s,G),s.prototype.getUi=function(){var c=this,R=document.createElement("div");return R.style.display="flex",R.style.overflow="hidden",R.style.flexGrow="2",R.style.justifyContent="space-between",this.opacities.forEach(function(X){var N=document.createElement("div");N.style.display="flex",N.style.alignItems="center",N.style.justifyContent="center",N.style.padding="5px",N.style.borderWidth="2px",N.style.borderStyle="solid",N.style.borderColor=X===c.currentOpacity?c.uiStyleSettings.toolboxAccentColor:"transparent",N.addEventListener("click",function(){c.setCurrentOpacity(X,N)}),R.appendChild(N);var oe=document.createElement("div");oe.innerText=100*X+"%",N.appendChild(oe),c.opacityBoxes.push(N)}),R},s.prototype.setCurrentOpacity=function(c,R){var X=this;this.currentOpacity=c,this.opacityBoxes.forEach(function(N){N.style.borderColor=N===R?X.uiStyleSettings.toolboxAccentColor:"transparent"}),this.onOpacityChanged&&this.onOpacityChanged(this.currentOpacity)},s}(w),V=function(G){function s(c,R,X){var N=G.call(this,c,R,X)||this;return N.setOpacity=N.setOpacity.bind(N),N.fillColor=X.defaultHighlightColor,N.strokeWidth=0,N.opacity=X.defaultHighlightOpacity,N.fillPanel=new y("Color",X.defaultColorSet,N.fillColor),N.fillPanel.onColorChanged=N.setFillColor,N.opacityPanel=new K("Opacity",X.defaultOpacitySteps,N.opacity),N.opacityPanel.onOpacityChanged=N.setOpacity,N}return Z(s,G),s.prototype.setOpacity=function(c){this.opacity=c,this.visual&&D.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 c=G.prototype.getState.call(this);return c.typeName=s.typeName,c},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}(W),M='<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>',I=function(G){function s(c,R,X){var N=G.call(this,c,R,X)||this;return N.bgColor="transparent",N.tipPosition={x:0,y:0},N.tipBase1Position={x:0,y:0},N.tipBase2Position={x:0,y:0},N.tipMoving=!1,N.color=X.defaultStrokeColor,N.bgColor=X.defaultFillColor,N.fontFamily=X.defaultFontFamily,N.defaultSize={x:100,y:30},N.setBgColor=N.setBgColor.bind(N),N.getTipPoints=N.getTipPoints.bind(N),N.positionTip=N.positionTip.bind(N),N.setTipPoints=N.setTipPoints.bind(N),N.colorPanel=new y("Text color",X.defaultColorSet,N.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>'),N.colorPanel.onColorChanged=N.setColor,N.bgColorPanel=new y("Fill color",X.defaultColorSet,N.bgColor,M),N.bgColorPanel.onColorChanged=N.setBgColor,N.fontFamilyPanel=new a("Font",X.defaultFontFamilies,X.defaultFontFamily),N.fontFamilyPanel.onFontChanged=N.setFont,N.tipGrip=new l,N.tipGrip.visual.transform.baseVal.appendItem(D.createTransform()),N.controlBox.appendChild(N.tipGrip.visual),N}return Z(s,G),s.prototype.ownsTarget=function(c){return G.prototype.ownsTarget.call(this,c)||this.tipGrip.ownsTarget(c)||this.tip===c},s.prototype.createTip=function(){D.setAttributes(this.bgRectangle,[["fill",this.bgColor],["rx","10px"]]),this.tip=D.createPolygon(this.getTipPoints(),[["fill",this.bgColor]]),this.visual.appendChild(this.tip)},s.prototype.pointerDown=function(c,R){this.state==="new"&&G.prototype.pointerDown.call(this,c,R),this.state==="creating"?this.createTip():this.tipGrip.ownsTarget(R)?(this.manipulationStartLeft=this.left,this.manipulationStartTop=this.top,this.tipMoving=!0):G.prototype.pointerDown.call(this,c,R)},s.prototype.pointerUp=function(c){if(this.tipMoving)this.tipMoving=!1,this.isMoved=!0,G.prototype.pointerUp.call(this,c);else{var R=this.state==="creating";G.prototype.pointerUp.call(this,c),this.setTipPoints(R),this.positionTip()}},s.prototype.manipulate=function(c){if(this.tipMoving){var R=this.unrotatePoint(c);this.tipPosition={x:R.x-this.manipulationStartLeft,y:R.y-this.manipulationStartTop},this.positionTip()}else G.prototype.manipulate.call(this,c)},s.prototype.setBgColor=function(c){this.bgRectangle&&this.tip&&(D.setAttributes(this.bgRectangle,[["fill",c]]),D.setAttributes(this.tip,[["fill",c]])),this.bgColor=c,this.fillColorChanged(c)},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(c){c===void 0&&(c=!1);var R=Math.min(this.height/2,15),X=this.height/5;c&&(this.tipPosition={x:R+X/2,y:this.height+20});var N=Math.atan(this.height/2/(this.width/2));this.tipPosition.x<this.width/2&&this.tipPosition.y<this.height/2?N<Math.atan((this.height/2-this.tipPosition.y)/(this.width/2-this.tipPosition.x))?(X=this.width/5,R=Math.min(this.width/2,15),this.tipBase1Position={x:R,y:0},this.tipBase2Position={x:R+X,y:0}):(this.tipBase1Position={x:0,y:R},this.tipBase2Position={x:0,y:R+X}):this.tipPosition.x>=this.width/2&&this.tipPosition.y<this.height/2?N<Math.atan((this.height/2-this.tipPosition.y)/(this.tipPosition.x-this.width/2))?(X=this.width/5,R=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-R-X,y:0},this.tipBase2Position={x:this.width-R,y:0}):(this.tipBase1Position={x:this.width,y:R},this.tipBase2Position={x:this.width,y:R+X}):this.tipPosition.x>=this.width/2&&this.tipPosition.y>=this.height/2?N<Math.atan((this.tipPosition.y-this.height/2)/(this.tipPosition.x-this.width/2))?(X=this.width/5,R=Math.min(this.width/2,15),this.tipBase1Position={x:this.width-R-X,y:this.height},this.tipBase2Position={x:this.width-R,y:this.height}):(this.tipBase1Position={x:this.width,y:this.height-R-X},this.tipBase2Position={x:this.width,y:this.height-R}):N<Math.atan((this.tipPosition.y-this.height/2)/(this.width/2-this.tipPosition.x))?(X=this.width/5,R=Math.min(this.width/2,15),this.tipBase1Position={x:R,y:this.height},this.tipBase2Position={x:R+X,y:this.height}):(this.tipBase1Position={x:0,y:this.height-R},this.tipBase2Position={x:0,y:this.height-R-X})},s.prototype.resize=function(c){G.prototype.resize.call(this,c),this.positionTip()},s.prototype.positionTip=function(){D.setAttributes(this.tip,[["points",this.getTipPoints()]]);var c=this.tipGrip.visual.transform.baseVal.getItem(0);c.setTranslate(this.tipPosition.x,this.tipPosition.y),this.tipGrip.visual.transform.baseVal.replaceItem(c,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(),G.prototype.select.call(this)},s.prototype.getState=function(){var c=Object.assign({bgColor:this.bgColor,tipPosition:this.tipPosition},G.prototype.getState.call(this));return c.typeName=s.typeName,c},s.prototype.restoreState=function(c){var R=c;this.bgColor=R.bgColor,this.tipPosition=R.tipPosition,G.prototype.restoreState.call(this,c),this.createTip(),this.setTipPoints()},s.prototype.scale=function(c,R){G.prototype.scale.call(this,c,R),this.tipPosition={x:this.tipPosition.x*c,y:this.tipPosition.y*R},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}(E),$=function(G){function s(c,R,X){var N=G.call(this,c,R,X)||this;return N.fillColor="transparent",N.strokeColor="transparent",N.strokeWidth=0,N.strokeDasharray="",N.opacity=1,N.strokeColor=X.defaultColor,N.strokeWidth=X.defaultStrokeWidth,N.strokeDasharray=X.defaultStrokeDasharray,N.fillColor=X.defaultFillColor,N.setStrokeColor=N.setStrokeColor.bind(N),N.setFillColor=N.setFillColor.bind(N),N.setStrokeWidth=N.setStrokeWidth.bind(N),N.setStrokeDasharray=N.setStrokeDasharray.bind(N),N.setOpacity=N.setOpacity.bind(N),N.createVisual=N.createVisual.bind(N),N.strokePanel=new y("Line color",U(X.defaultColorSet,["transparent"]),X.defaultColor),N.strokePanel.onColorChanged=N.setStrokeColor,N.fillPanel=new y("Fill color",U(X.defaultColorSet,["transparent"]),N.fillColor,M),N.fillPanel.onColorChanged=N.setFillColor,N.strokeWidthPanel=new m("Line width",X.defaultStrokeWidths,X.defaultStrokeWidth),N.strokeWidthPanel.onWidthChanged=N.setStrokeWidth,N.strokeStylePanel=new k("Line style",X.defaultStrokeDasharrays,X.defaultStrokeDasharray),N.strokeStylePanel.onStyleChanged=N.setStrokeDasharray,N.opacityPanel=new K("Opacity",X.defaultOpacitySteps,N.opacity),N.opacityPanel.onOpacityChanged=N.setOpacity,N}return Z(s,G),s.prototype.ownsTarget=function(c){return!(!G.prototype.ownsTarget.call(this,c)&&c!==this.visual)},s.prototype.createVisual=function(){this.visual=D.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(c,R){G.prototype.pointerDown.call(this,c,R),this.state==="new"&&(this.createVisual(),this.moveVisual(c),this._state="creating")},s.prototype.manipulate=function(c){G.prototype.manipulate.call(this,c)},s.prototype.resize=function(c){G.prototype.resize.call(this,c),this.setSize()},s.prototype.setSize=function(){G.prototype.setSize.call(this),D.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(c){G.prototype.pointerUp.call(this,c),this.setSize()},s.prototype.setStrokeColor=function(c){this.strokeColor=c,this.visual&&D.setAttributes(this.visual,[["stroke",this.strokeColor]]),this.colorChanged(c),this.stateChanged()},s.prototype.setFillColor=function(c){this.fillColor=c,this.visual&&D.setAttributes(this.visual,[["fill",this.fillColor]]),this.fillColorChanged(c),this.stateChanged()},s.prototype.setStrokeWidth=function(c){this.strokeWidth=c,this.visual&&D.setAttributes(this.visual,[["stroke-width",this.strokeWidth.toString()]]),this.stateChanged()},s.prototype.setStrokeDasharray=function(c){this.strokeDasharray=c,this.visual&&D.setAttributes(this.visual,[["stroke-dasharray",this.strokeDasharray]]),this.stateChanged()},s.prototype.setOpacity=function(c){this.opacity=c,this.visual&&D.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 c=Object.assign({fillColor:this.fillColor,strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,opacity:this.opacity},G.prototype.getState.call(this));return c.typeName=s.typeName,c},s.prototype.restoreState=function(c){var R=c;this.fillColor=R.fillColor,this.strokeColor=R.strokeColor,this.strokeWidth=R.strokeWidth,this.strokeDasharray=R.strokeDasharray,this.opacity=R.opacity,this.createVisual(),G.prototype.restoreState.call(this,c),this.setSize()},s.prototype.scale=function(c,R){G.prototype.scale.call(this,c,R),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}(C),ae=function(G){function s(c,R,X){return G.call(this,c,R,X)||this}return Z(s,G),Object.defineProperty(s.prototype,"tipLength",{get:function(){return 10+3*this.strokeWidth},enumerable:!1,configurable:!0}),s.prototype.ownsTarget=function(c){return!(!G.prototype.ownsTarget.call(this,c)&&c!==this.tip1&&c!==this.tip2)},s.prototype.createTips=function(){this.tip1=D.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(D.createTransform()),this.visual.appendChild(this.tip1),this.tip2=D.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(D.createTransform()),this.visual.appendChild(this.tip2)},s.prototype.pointerDown=function(c,R){G.prototype.pointerDown.call(this,c,R),this.state==="creating"&&this.createTips()},s.prototype.adjustVisual=function(){if(G.prototype.adjustVisual.call(this),this.tip1&&this.tip2&&(D.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()]]),D.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 c=180*Math.atan((this.y2-this.y1)/(this.x2-this.x1))/Math.PI+90*Math.sign(this.x1-this.x2),R=this.tip1.transform.baseVal.getItem(0);R.setRotate(c,this.x1,this.y1),this.tip1.transform.baseVal.replaceItem(R,0);var X=this.tip2.transform.baseVal.getItem(0);X.setRotate(c+180,this.x2,this.y2),this.tip2.transform.baseVal.replaceItem(X,0)}},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var c=G.prototype.getState.call(this);return c.typeName=s.typeName,c},s.prototype.restoreState=function(c){G.prototype.restoreState.call(this,c),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}(d),he=function(G){function s(c,R,X){var N=G.call(this,c,R,X)||this;return N.strokePanel.colors=X.defaultColorSet,N.fillColor="transparent",N}return Z(s,G),Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var c=G.prototype.getState.call(this);return c.typeName=s.typeName,c},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}($),ge=function(){function G(){this.undoStack=[],this.redoStack=[]}return Object.defineProperty(G.prototype,"isUndoPossible",{get:function(){return this.undoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"isRedoPossible",{get:function(){return this.redoStack.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"undoStepCount",{get:function(){return this.undoStack.length},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"redoStepCount",{get:function(){return this.redoStack.length},enumerable:!1,configurable:!0}),G.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))},G.prototype.replaceLastUndoStep=function(s){this.undoStack.length>0&&(this.undoStack[this.undoStack.length-1]=s)},G.prototype.getLastUndoStep=function(){return this.undoStack.length>0?this.undoStack[this.undoStack.length-1]:void 0},G.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}},G.prototype.redo=function(){return this.lastRedoStep=this.redoStack.pop(),this.lastRedoStep},G}(),De=function(G){function s(c,R,X){var N=G.call(this,c,R,X)||this;return N.strokeColor="transparent",N.strokeWidth=0,N.strokeDasharray="",N.curveX=0,N.curveY=0,N.manipulationStartCurveX=0,N.manipulationStartCurveY=0,N.setStrokeColor=N.setStrokeColor.bind(N),N.setStrokeWidth=N.setStrokeWidth.bind(N),N.setStrokeDasharray=N.setStrokeDasharray.bind(N),N.positionGrips=N.positionGrips.bind(N),N.addControlGrips=N.addControlGrips.bind(N),N.adjustVisual=N.adjustVisual.bind(N),N.setupControlBox=N.setupControlBox.bind(N),N.resize=N.resize.bind(N),N.strokeColor=X.defaultColor,N.strokeWidth=X.defaultStrokeWidth,N.strokeDasharray=X.defaultStrokeDasharray,N.strokePanel=new y("Line color",X.defaultColorSet,X.defaultColor),N.strokePanel.onColorChanged=N.setStrokeColor,N.strokeWidthPanel=new m("Line width",X.defaultStrokeWidths,X.defaultStrokeWidth),N.strokeWidthPanel.onWidthChanged=N.setStrokeWidth,N.strokeStylePanel=new k("Line style",X.defaultStrokeDasharrays,X.defaultStrokeDasharray),N.strokeStylePanel.onStyleChanged=N.setStrokeDasharray,N}return Z(s,G),s.prototype.ownsTarget=function(c){return!(!G.prototype.ownsTarget.call(this,c)&&c!==this.visual&&c!==this.selectorCurve&&c!==this.visibleCurve&&!this.curveGrip.ownsTarget(c))},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=D.createGroup(),this.selectorCurve=D.createPath(this.getPathD(),[["stroke","transparent"],["stroke-width",(this.strokeWidth+10).toString()],["fill","transparent"]]),this.visibleCurve=D.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(c,R){G.prototype.pointerDown.call(this,c,R),this.manipulationStartCurveX=this.curveX,this.manipulationStartCurveY=this.curveY,this.state==="new"&&(this.curveX=c.x,this.curveY=c.y),this.state==="new"?(this.createVisual(),this.adjustVisual(),this._state="creating"):this.curveGrip.ownsTarget(R)&&(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()),D.setAttributes(this.visibleCurve,[["stroke",this.strokeColor]]),D.setAttributes(this.visibleCurve,[["stroke-width",this.strokeWidth.toString()]]),D.setAttributes(this.visibleCurve,[["stroke-dasharray",this.strokeDasharray.toString()]]))},s.prototype.setupControlBox=function(){G.prototype.setupControlBox.call(this),this.curveControlLine1=D.createLine(this.x1,this.y1,this.curveX,this.curveY,[["stroke","black"],["stroke-width","1"],["stroke-opacity","0.5"],["stroke-dasharray","3, 2"]]),this.curveControlLine2=D.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,G.prototype.addControlGrips.call(this)},s.prototype.positionGrips=function(){G.prototype.positionGrips.call(this);var c=this.curveGrip.GRIP_SIZE;this.positionGrip(this.curveGrip.visual,this.curveX-c/2,this.curveY-c/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(c){this.state==="move"&&(this.curveX=this.manipulationStartCurveX+c.x-this.manipulationStartX,this.curveY=this.manipulationStartCurveY+c.y-this.manipulationStartY),G.prototype.manipulate.call(this,c)},s.prototype.resize=function(c){this.activeGrip===this.curveGrip&&(this.curveX=c.x,this.curveY=c.y),G.prototype.resize.call(this,c),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(c){this.strokeColor=c,this.adjustVisual(),this.colorChanged(c)},s.prototype.setStrokeWidth=function(c){this.strokeWidth=c,this.adjustVisual()},s.prototype.setStrokeDasharray=function(c){this.strokeDasharray=c,this.adjustVisual()},s.prototype.scale=function(c,R){this.curveX=this.curveX*c,this.curveY=this.curveY*R,G.prototype.scale.call(this,c,R)},Object.defineProperty(s.prototype,"toolboxPanels",{get:function(){return[this.strokePanel,this.strokeWidthPanel,this.strokeStylePanel]},enumerable:!1,configurable:!0}),s.prototype.getState=function(){var c=Object.assign({strokeColor:this.strokeColor,strokeWidth:this.strokeWidth,strokeDasharray:this.strokeDasharray,curveX:this.curveX,curveY:this.curveY},G.prototype.getState.call(this));return c.typeName=s.typeName,c},s.prototype.restoreState=function(c){G.prototype.restoreState.call(this,c);var R=c;this.strokeColor=R.strokeColor,this.strokeWidth=R.strokeWidth,this.strokeDasharray=R.strokeDasharray,this.curveX=R.curveX,this.curveY=R.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}(p),Se=function(){function G(s,c){c===void 0&&(c=!1),this.cancelable=!1,this._defaultPrevented=!1,this.markerArea=s,this.cancelable=c}return Object.defineProperty(G.prototype,"defaultPrevented",{get:function(){return this._defaultPrevented},enumerable:!1,configurable:!0}),G.prototype.preventDefault=function(){this._defaultPrevented=!0},G}(),Re=function(G){function s(c,R,X){var N=G.call(this,c,!1)||this;return N.dataUrl=R,N.state=X,N}return Z(s,G),s}(Se),Ce=function(G){function s(c,R,X){X===void 0&&(X=!1);var N=G.call(this,c,X)||this;return N.marker=R,N}return Z(s,G),s}(Se),xe=function(){function G(){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 G.prototype.addEventListener=function(s,c){this[s].push(c)},G.prototype.removeEventListener=function(s,c){var R=this[s].indexOf(c);R>-1&&this[s].splice(R,1)},G}(),me=function(){function G(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 f,this._isOpen=!1,this.undoRedoManager=new ge,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 xe,this._silentRenderMode=!1,this._isFocused=!1,this._instanceNo=G.instanceCounter++,this.styles=new O(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(G.prototype,"ALL_MARKER_TYPES",{get:function(){return[x,g,F,E,he,$,V,I,ae,W,d,De]},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"DEFAULT_MARKER_TYPES",{get:function(){return[x,g,F,E,$,V,I]},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"BASIC_MARKER_TYPES",{get:function(){return[x,g,F,E,V]},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"availableMarkerTypes",{get:function(){return this._availableMarkerTypes},set:function(s){var c=this;this._availableMarkerTypes.splice(0),s.forEach(function(R){if(typeof R=="string"){var X=c.ALL_MARKER_TYPES.find(function(N){return N.typeName===R});X!==void 0&&c._availableMarkerTypes.push(X)}else c._availableMarkerTypes.push(R)})},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"currentMarker",{get:function(){return this._currentMarker},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"isUndoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isUndoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"isRedoPossible",{get:function(){return!(!this.undoRedoManager||!this.undoRedoManager.isRedoPossible)},enumerable:!1,configurable:!0}),Object.defineProperty(G.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(G.prototype,"instanceNo",{get:function(){return this._instanceNo},enumerable:!1,configurable:!0}),G.prototype.open=function(){this.setupResizeObserver(),this.setEditingTarget(),this.setTopLeft(),this.initMarkerCanvas(),this.initOverlay(),this.attachEvents(),this.settings.displayMode==="popup"&&this.onPopupTargetResize(),z.isLicensed||this.addLogo(),this._isOpen=!0,this._isFocused=!0},G.prototype.show=function(){var s=this;this.styles.styleSheetRoot===void 0&&B.styleSheetRoot!==void 0&&(this.styles.styleSheetRoot=B.styleSheetRoot),this.setWindowHeight(),this.showUI(),this.open(),this.eventListeners.show.forEach(function(c){return c(new Se(s))})},G.prototype.render=function(){return _(this,void 0,void 0,function(){var s;return J(this,function(c){switch(c.label){case 0:return this.setCurrentMarker(),(s=new H).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 c.sent(),[4,s.rasterize(this.target instanceof HTMLImageElement?this.target:null,this.markerImage,this.renderTarget)];case 2:return[2,c.sent()]}})})},G.prototype.close=function(s){var c=this;if(s===void 0&&(s=!1),this.isOpen){var R=!1;s||this.eventListeners.beforeclose.forEach(function(X){var N=new Se(c,!0);X(N),N.defaultPrevented&&(R=!0)}),R||(this.coverDiv&&this.closeUI(),this.targetObserver&&this.targetObserver.unobserve(this.target),this.settings.displayMode==="popup"&&window.removeEventListener("resize",this.setWindowHeight),this.eventListeners.close.forEach(function(X){return X(new Se(c))}),this.detachEvents(),this._isOpen=!1)}},G.prototype.addMarkersToToolbar=function(){for(var s,c=[],R=0;R<arguments.length;R++)c[R]=arguments[R];(s=this._availableMarkerTypes).push.apply(s,c)},G.prototype.addRenderEventListener=function(s){this.addEventListener("render",function(c){s(c.dataUrl,c.state)})},G.prototype.removeRenderEventListener=function(s){},G.prototype.addCloseEventListener=function(s){this.addEventListener("close",function(){s()})},G.prototype.removeCloseEventListener=function(s){},G.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))},G.prototype.onPopupTargetResize=function(){var s=1*this.target.clientWidth/this.target.clientHeight,c=this.editorCanvas.clientWidth/s>this.editorCanvas.clientHeight?this.editorCanvas.clientHeight*s:this.editorCanvas.clientWidth,R=c<this.editorCanvas.clientWidth?this.editorCanvas.clientHeight:this.editorCanvas.clientWidth/s;this.resize(c,R)},G.prototype.setWindowHeight=function(){this.windowHeight=window.innerHeight},G.prototype.resize=function(s,c){this._isResizing=!0;var R=s/this.imageWidth,X=c/this.imageHeight;this.imageWidth=Math.round(s),this.imageHeight=Math.round(c),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(R,X),this._isResizing=!1},G.prototype.scaleMarkers=function(s,c){var R,X=this;this._currentMarker&&this._currentMarker instanceof E?this._currentMarker.scale(s,c):(R=this._currentMarker,this.setCurrentMarker()),this.markers.forEach(function(N){N!==X._currentMarker&&N.scale(s,c)}),R!==void 0&&this.setCurrentMarker(R)},G.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"},G.prototype.setTopLeft=function(){var s=this.editingTarget.getBoundingClientRect(),c=this.editorCanvas.getBoundingClientRect();this.left=s.left-c.left,this.top=s.top-c.top},G.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)},G.prototype.addDefs=function(){for(var s,c=[],R=0;R<arguments.length;R++)c[R]=arguments[R];this.defs=D.createDefs(),this.addDefsToImage(),(s=this.defs).append.apply(s,c)},G.prototype.addDefsToImage=function(){this.defs&&this.markerImage.insertBefore(this.defs,this.markerImage.firstChild)},G.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)},G.prototype.positionMarkerImage=function(){this.markerImageHolder.style.top=this.top/this.zoomLevel+"px",this.markerImageHolder.style.left=this.left/this.zoomLevel+"px"},G.prototype.attachEvents=function(){this.markerImage.addEventListener("pointerdown",this.onPointerDown),this.markerImage.addEventListener("dblclick",this.onDblClick),this.attachWindowEvents()},G.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)},G.prototype.detachEvents=function(){this.markerImage.removeEventListener("pointerdown",this.onPointerDown),this.markerImage.removeEventListener("dblclick",this.onDblClick),this.detachWindowEvents()},G.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)},G.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()},G.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")},G.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"},G.prototype.restoreOverflow=function(){document.body.style.overflow=this.bodyOverflowState,window.scroll({top:this.scrollYState,left:this.scrollXState})},G.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 P(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 L(this.uiDiv,this.settings.displayMode,this.uiStyleSettings,this.styles),this.toolbox.show(this._silentRenderMode||this.uiStyleSettings.hideToolbox?"hidden":"visible")},G.prototype.closeUI=function(){this.settings.displayMode==="popup"&&this.restoreOverflow(),this.targetRoot.removeChild(this.coverDiv)},G.prototype.removeMarker=function(s){this.markerImage.removeChild(s.container),this.markers.indexOf(s)>-1&&this.markers.splice(this.markers.indexOf(s),1),s.dispose()},G.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())},G.prototype.toolbarButtonClicked=function(s,c){if(s==="marker"&&c!==void 0)this.createNewMarker(c);else if(s==="action")switch(c){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()}},G.prototype.deleteSelectedMarker=function(){var s=this;if(this._currentMarker!==void 0){var c=!1;if(this.eventListeners.markerbeforedelete.forEach(function(X){var N=new Ce(s,s._currentMarker,!0);X(N),N.defaultPrevented&&(c=!0)}),!c){var R=this._currentMarker;this._currentMarker.dispose(),this.markerImage.removeChild(this._currentMarker.container),this.markers.splice(this.markers.indexOf(this._currentMarker),1),this.setCurrentMarker(),this.addUndoStep(),this.eventListeners.markerdelete.forEach(function(X){return X(new Ce(s,R))})}}},G.prototype.clear=function(){var s=this,c=!1;if(this.markers.length>0&&(this.eventListeners.markerbeforedelete.forEach(function(oe){var be=new Ce(s,void 0,!0);oe(be),be.defaultPrevented&&(c=!0)}),!c)){this.setCurrentMarker();for(var R=function(oe){var be=X.markers[oe];X.setCurrentMarker(X.markers[oe]),X._currentMarker.dispose(),X.markerImage.removeChild(X._currentMarker.container),X.markers.splice(X.markers.indexOf(X._currentMarker),1),X.eventListeners.markerdelete.forEach(function(we){return we(new Ce(s,be))})},X=this,N=this.markers.length-1;N>=0;N--)R(N);this.addUndoStep()}},Object.defineProperty(G.prototype,"isNotesAreaOpen",{get:function(){return this.notesArea!==void 0},enumerable:!1,configurable:!0}),G.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))},G.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)},G.prototype.selectLastMarker=function(){this.markers.length>0?this.setCurrentMarker(this.markers[this.markers.length-1]):this.setCurrentMarker()},G.prototype.addUndoStep=function(){var s=this;if(this._currentMarker===void 0||this._currentMarker.state!=="edit"){var c=this.getState(),R=this.undoRedoManager.getLastUndoStep();if(!R||R.width===c.width&&R.height===c.height){var X=this.undoRedoManager.undoStepCount;this.undoRedoManager.addUndoStep(c),X<this.undoRedoManager.undoStepCount&&this.eventListeners.statechange.forEach(function(N){return N(new Se(s))})}else this.undoRedoManager.replaceLastUndoStep(c),this.eventListeners.statechange.forEach(function(N){return N(new Se(s))})}},G.prototype.undo=function(){this.switchToSelectMode(),this.addUndoStep(),this.undoStep()},G.prototype.undoStep=function(){var s=this,c=this.undoRedoManager.undo();c!==void 0&&(this.restoreState(c),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(R){return R(new Se(s))}))},G.prototype.redo=function(){this.switchToSelectMode(),this.redoStep()},G.prototype.redoStep=function(){var s=this,c=this.undoRedoManager.redo();c!==void 0&&(this.restoreState(c),this.addDefsToImage(),this.selectLastMarker(),this.eventListeners.statechange.forEach(function(R){return R(new Se(s))}))},G.prototype.stepZoom=function(){var s=this.zoomSteps.indexOf(this.zoomLevel);this.zoomLevel=s<this.zoomSteps.length-1?this.zoomSteps[s+1]:this.zoomSteps[0]},G.prototype.panTo=function(s){this.contentDiv.scrollBy({left:this.prevPanPoint.x-s.x,top:this.prevPanPoint.y-s.y}),this.prevPanPoint=s},G.prototype.startRenderAndClose=function(){return _(this,void 0,void 0,function(){var s,c,R=this;return J(this,function(X){switch(X.label){case 0:return[4,this.render()];case 1:return s=X.sent(),c=this.getState(),this.eventListeners.render.forEach(function(N){return N(new Re(R,s,c))}),this.close(!0),[2]}})})},G.prototype.getState=function(s){s===!0&&this.setCurrentMarker();var c={width:this.imageWidth,height:this.imageHeight,markers:[]};return this.markers.forEach(function(R){return c.markers.push(R.getState())}),c},G.prototype.restoreState=function(s){var c=this;for(this.markers.splice(0);this.markerImage.lastChild;)this.markerImage.removeChild(this.markerImage.lastChild);s.markers.forEach(function(R){var X=c._availableMarkerTypes.find(function(oe){return oe.typeName===R.typeName});if(X!==void 0){var N=c.addNewMarker(X);N.restoreState(R),c.markers.push(N)}}),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(R){return R(new Se(c))})},G.prototype.addNewMarker=function(s){var c=D.createGroup();return this.markerImage.appendChild(c),new s(c,this.overlayContainer,this.settings)},G.prototype.createNewMarker=function(s){var c,R=this;(c=typeof s=="string"?this._availableMarkerTypes.find(function(X){return X.typeName===s}):s)&&(this.setCurrentMarker(),this.addUndoStep(),this._currentMarker=this.addNewMarker(c),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(c.typeName),this.toolbox.setPanelButtons(this._currentMarker.toolboxPanels),this.eventListeners.markercreating.forEach(function(X){return X(new Ce(R,R._currentMarker))}))},G.prototype.markerCreated=function(s){var c=this;this.mode="select",this.markerImage.style.cursor="default",this.markers.push(s),this.setCurrentMarker(s),s instanceof g&&this.settings.newFreehandMarkerOnPointerUp?this.createNewMarker(g):this.toolbar.setSelectMode(),this.addUndoStep(),this.eventListeners.markercreate.forEach(function(R){return R(new Ce(c,c._currentMarker))})},G.prototype.colorChanged=function(s){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultColor=s,this.settings.defaultStrokeColor=s)},G.prototype.fillColorChanged=function(s){this.settings.defaultColorsFollowCurrentColors&&(this.settings.defaultFillColor=s)},G.prototype.markerStateChanged=function(s){var c=this;this.eventListeners.markerchange.forEach(function(R){return R(new Ce(c,s))})},G.prototype.setCurrentMarker=function(s){var c=this;this._currentMarker!==s&&this._currentMarker!==void 0&&(this._currentMarker.deselect(),this.toolbar.setCurrentMarker(),this.toolbox.setPanelButtons([]),this._isResizing||this.eventListeners.markerdeselect.forEach(function(R){return R(new Ce(c,c._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(R){return R(new Ce(c,c._currentMarker))}))},G.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 c=this.markers.find(function(R){return R.ownsTarget(s.target)});c!==void 0?(this.setCurrentMarker(c),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))},G.prototype.onDblClick=function(s){if(this._isFocused||this.focus(),this.mode==="select"){var c=this.markers.find(function(R){return R.ownsTarget(s.target)});c!==void 0&&c!==this._currentMarker&&this.setCurrentMarker(c),this._currentMarker!==void 0?this._currentMarker.dblClick(this.clientToLocalCoordinates(s.clientX,s.clientY),s.target):this.setCurrentMarker()}},G.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}))},G.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()},G.prototype.onPointerOut=function(){this.touchPoints>0&&this.touchPoints--},G.prototype.onKeyUp=function(s){this._currentMarker===void 0||this.notesArea!==void 0||s.key!=="Delete"&&s.key!=="Backspace"||this.deleteSelectedMarker()},G.prototype.clientToLocalCoordinates=function(s,c){var R=this.markerImage.getBoundingClientRect();return{x:(s-R.left)/this.zoomLevel,y:(c-R.top)/this.zoomLevel}},G.prototype.onWindowResize=function(){this.positionUI()},G.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()},G.prototype.addLicenseKey=function(s){z.addKey(s)},G.prototype.addEventListener=function(s,c){this.eventListeners.addEventListener(s,c)},G.prototype.removeEventListener=function(s,c){this.eventListeners.removeEventListener(s,c)},G.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(G.prototype,"isFocused",{get:function(){return this._isFocused},enumerable:!1,configurable:!0}),G.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(c){return c(new Se(s))}))},G.prototype.blur=function(){var s=this;this._isFocused&&(this.detachWindowEvents(),this._isFocused=!1,this._previousCurrentMarker=this._currentMarker,this.setCurrentMarker(),this.eventListeners.blur.forEach(function(c){return c(new Se(s))}))},G.instanceCounter=0,G}()},"T+//":function(pt,at,pe){"use strict";pe.r(at);var fe=pe("Q9mQ"),Z=pe("diRs"),_=pe("2qtc"),J=pe("kLXV"),U=pe("miYZ"),D=pe("tsqr"),z=pe("9og8"),H=pe("tJVT"),B=pe("B9cy"),O=pe("Ol7k"),b=pe("lUTK"),A=pe("BvKs"),P=pe("WmNS"),L=pe.n(P),w=pe("q1tI"),y=pe.n(w),h=pe("m3rI"),o=pe("p0QG"),l=pe.n(o),u=pe("ErOA"),C=pe("9kvl"),v=pe("RCxd"),m=pe("xGfz"),k=pe("xKgJ"),x=pe("5NDa"),f=pe("5rEg");function p(xe){var me=xe.user,G=xe.CategoryId,s=xe.IsShow,c=xe.setIsShow,R=xe.dispatch,X=xe.init,N=Object(w.useState)(),oe=Object(H.a)(N,2),be=oe[0],we=oe[1];return y.a.createElement(J.a,{title:G?"\u65B0\u5EFA\u4E09\u7EA7\u7C7B\u76EE":"\u65B0\u5EFA\u4E8C\u7EA7\u7C7B\u76EE",width:424,onCancel:function(){c(!1)},onOk:Object(z.a)(L.a.mark(function _e(){var Le;return L.a.wrap(function(Me){for(;;)switch(Me.prev=Me.next){case 0:if(be){Me.next=3;break}return D.b.error("\u680F\u76EE\u540D\u4E0D\u80FD\u4E3A\u7A7A"),Me.abrupt("return");case 3:return Me.next=5,Object(u.a)("/api/programas.json",{method:"post",body:{name:be,parent_id:G}});case 5:Le=Me.sent,Le.status===0&&(D.b.info("\u521B\u5EFA\u6210\u529F"),c(!1),we(""),X());case 7:case"end":return Me.stop()}},_e)})),visible:s},y.a.createElement(f.a,{value:be,onChange:function(Le){return we(Le.target.value)},placeholder:"\u8BF7\u8F93\u5165\u4E0D\u8D85\u8FC710\u4E2A\u6C49\u5B57\u7684\u540D\u79F0",maxLength:10}))}var d=Object(C.a)(function(xe){var me=xe.user;return{user:me}})(p);function a(xe){var me=xe.user,G=xe.CategoryId,s=xe.name,c=xe.IsShow,R=xe.setIsShow,X=xe.dispatch,N=xe.init,oe=Object(w.useState)(),be=Object(H.a)(oe,2),we=be[0],_e=be[1];return Object(w.useEffect)(function(){_e(s)},[s]),y.a.createElement(J.a,{title:"\u76EE\u5F55\u91CD\u547D\u540D",width:424,onCancel:function(){R(!1)},onOk:Object(z.a)(L.a.mark(function Le(){var Oe;return L.a.wrap(function(Be){for(;;)switch(Be.prev=Be.next){case 0:if(we){Be.next=3;break}return D.b.error("\u680F\u76EE\u540D\u4E0D\u80FD\u4E3A\u7A7A"),Be.abrupt("return");case 3:return Be.next=5,Object(u.a)("/api/programas/".concat(G,"/rename.json"),{method:"put",body:{name:we,id:G}});case 5:Oe=Be.sent,Oe.status===0&&(D.b.info("\u4FEE\u6539\u6210\u529F"),R(!1),_e(""),N());case 7:case"end":return Be.stop()}},Le)})),visible:c},y.a.createElement(f.a,{value:we,onChange:function(Oe){return _e(Oe.target.value)},placeholder:"\u8BF7\u8F93\u5165\u4E0D\u8D85\u8FC710\u4E2A\u6C49\u5B57\u7684\u540D\u79F0",maxLength:10}))}var E=Object(C.a)(function(xe){var me=xe.user;return{user:me}})(a),g=pe("+L6B"),S=pe("2/Rp"),F=pe("9Bee");function W(xe){var me,G,s,c,R=xe.user,X=xe.ItemData,N=xe.setIssee,oe=xe.dispatch,be=xe.init;return y.a.createElement("div",null,y.a.createElement("div",{style:{textAlign:"right"}},Object(k.w)()&&y.a.createElement(S.a,{onClick:function(){return N(!1)}},"\u7F16\u8F91")),y.a.createElement(F.a,{value:X.content}),(X==null||((me=X.attachment)===null||me===void 0)?void 0:me.id)&&y.a.createElement("div",null,y.a.createElement("a",{href:X==null||((G=X.attachment)===null||G===void 0)?void 0:G.url,target:"_self",download:X==null||((s=X.attachment)===null||s===void 0)?void 0:s.title},y.a.createElement("i",{style:{color:"#29BD8B"},className:"font-14 color-green iconfont icon-fujian mr8"}),y.a.createElement("span",{style:{color:"#000000"}},X==null||((c=X.attachment)===null||c===void 0)?void 0:c.title))))}var K=Object(C.a)(function(xe){var me=xe.user;return{user:me}})(W),V=pe("DZo9"),M=pe("8z0m"),I=pe("Ot1p"),$=pe("hJwl");function ae(xe){var me=xe.user,G=xe.ItemData,s=xe.setIssee,c=xe.CategoryId,R=xe.dispatch,X=xe.init,N=Object(w.useState)([]),oe=Object(H.a)(N,2),be=oe[0],we=oe[1],_e=Object(w.useState)(G.content),Le=Object(H.a)(_e,2),Oe=Le[0],Me=Le[1];function Be(){var je,We=[];return G==null||((je=G.attachments)===null||je===void 0)||je.map(function(ke){var Je={uid:ke==null?void 0:ke.id,name:ke.title,response:{id:ke.id}};We.push(Je)}),We}var Ve={name:"file",multiple:!0,action:h.a.API_SERVER+"/api/attachments.json",defaultFileList:Be(),onRemove:function(We){Object($.t)({id:We.uid})},onChange:function(We){console.log("info",We);var ke=We.file.status;ke!=="uploading",ke==="removed"&&we(We.fileList),ke==="done"?(we(We.fileList),D.b.success("".concat(We.file.name," \u6587\u4EF6\u4E0A\u4F20\u6210\u529F"))):ke==="error"&&D.b.error("".concat(We.file.name," \u6587\u4EF6\u4E0A\u4F20\u5931\u8D25"))},beforeUpload:function(We){var ke=We.size/1024/1024<150;return ke||D.b.info("\u6587\u4EF6\u5927\u5C0F\u5FC5\u987B\u5C0F\u4E8E150MB"),ke}};function Xe(){return ze.apply(this,arguments)}function ze(){return ze=Object(z.a)(L.a.mark(function je(){var We;return L.a.wrap(function(Je){for(;;)switch(Je.prev=Je.next){case 0:return Je.next=2,Object(u.a)("/api/programas/".concat(c,"/update_content.json"),{method:"put",body:{id:c,content:Oe,attachment_id:rt(be)}});case 2:We=Je.sent,We&&(D.b.info("\u63D0\u4EA4\u6210\u529F"),s(!0));case 4:case"end":return Je.stop()}},je)})),ze.apply(this,arguments)}function rt(je){var We;return je&&je.map(function(ke){We=ke.response.id}),We}return y.a.createElement("div",null,y.a.createElement(I.a,{defaultValue:Oe,onChange:function(We){return Me(We)}}),y.a.createElement(M.a,Ve,y.a.createElement(S.a,{className:"uploadBtn"},"\u4E0A\u4F20\u9644\u4EF6"),"(\u5355\u4E2A\u6587\u4EF6150M\u4EE5\u5185)"),y.a.createElement("p",{style:{marginTop:"10px"}},y.a.createElement(S.a,{style:{width:"90px"},onClick:function(){return Xe()}},"\u63D0\u4EA4"),y.a.createElement(S.a,{style:{marginLeft:"30px",width:"90px"},type:"primary",onClick:function(){return s(!0)}},"\u53D6\u6D88")))}var he=Object(C.a)(function(xe){var me=xe.user;return{user:me}})(ae),ge=A.a.SubMenu,De=O.a.Content,Se=O.a.Sider;function Re(xe){var me,G=xe.user,s=xe.dispatch,c=xe.globalSetting,R=Object(w.useState)(),X=Object(H.a)(R,2),N=X[0],oe=X[1],be=Object(w.useState)(!1),we=Object(H.a)(be,2),_e=we[0],Le=we[1],Oe=Object(w.useState)(),Me=Object(H.a)(Oe,2),Be=Me[0],Ve=Me[1],Xe=Object(w.useState)(),ze=Object(H.a)(Xe,2),rt=ze[0],je=ze[1],We=Object(w.useState)(!1),ke=Object(H.a)(We,2),Je=ke[0],qe=ke[1],se=Object(w.useState)(""),q=Object(H.a)(se,2),ee=q[0],ne=q[1],le=Object(w.useState)(""),te=Object(H.a)(le,2),ie=te[0],ue=te[1],de=Object(w.useState)(!0),ye=Object(H.a)(de,2),Ee=ye[0],Pe=ye[1];Object(w.useEffect)(function(){Ue()},[]),console.log("globalSetting",c);function Ue(){return Qe.apply(this,arguments)}function Qe(){return Qe=Object(z.a)(L.a.mark(function ot(){var vt;return L.a.wrap(function(Ke){for(;;)switch(Ke.prev=Ke.next){case 0:return Ke.next=2,Object(u.a)("/api/programas.json",{method:"get"});case 2:vt=Ke.sent,vt&&Ve(vt==null?void 0:vt.programas);case 4:case"end":return Ke.stop()}},ot)})),Qe.apply(this,arguments)}var tt=function(){var ot=Object(z.a)(L.a.mark(function vt(bt,Ke,ir){var nr;return L.a.wrap(function(Ot){for(;;)switch(Ot.prev=Ot.next){case 0:Ot.t0=bt,Ot.next=Ot.t0===1?3:Ot.t0===2?6:Ot.t0===3?10:Ot.t0===4?15:17;break;case 3:return je(Ke==null?void 0:Ke.id),Le(!0),Ot.abrupt("break",17);case 6:return je(Ke==null?void 0:Ke.id),qe(!0),ne(Ke==null?void 0:Ke.name),Ot.abrupt("break",17);case 10:return Ot.next=12,Object(u.a)("/api/programas/".concat(Ke==null?void 0:Ke.id,"/top.json"),{method:"post",body:{id:Ke==null?void 0:Ke.id}});case 12:return nr=Ot.sent,nr.status===0&&Ue(),Ot.abrupt("break",17);case 15:return xt(y.a.createElement("p",null,"\u5220\u9664\u4E4B\u540E\u4E0D\u80FD\u6062\u590D,",y.a.createElement("br",null),"\u662F\u5426\u786E\u8BA4\u5220\u9664?"),Object(z.a)(L.a.mark(function ar(){var wr;return L.a.wrap(function(ur){for(;;)switch(ur.prev=ur.next){case 0:return ur.next=2,Object(u.a)("/api/programas/".concat(Ke==null?void 0:Ke.id,".json"),{method:"delete",body:{id:Ke==null?void 0:Ke.id}});case 2:wr=ur.sent,wr.status===0&&(D.b.info("\u5220\u9664\u6210\u529F"),Ue());case 4:case"end":return ur.stop()}},ar)}))),Ot.abrupt("break",17);case 17:case"end":return Ot.stop()}},vt)}));return function(bt,Ke,ir){return ot.apply(this,arguments)}}(),xt=function(vt,bt){J.a.confirm({centered:!0,title:"\u63D0\u793A",icon:y.a.createElement(v.a,null),content:vt,okText:"\u786E\u8BA4",onOk:function(){return bt()},cancelText:"\u53D6\u6D88"})},st=function(vt,bt){return y.a.createElement("div",{className:l.a.leftMenuActions},bt===1&&y.a.createElement("p",{className:"current",onClick:function(){return tt(1,vt,bt)}},"\u65B0\u5EFA"),y.a.createElement("p",{className:"current",onClick:function(){return tt(2,vt,bt)}},"\u91CD\u547D\u540D"),y.a.createElement("p",{className:"current",onClick:function(){return tt(3,vt,bt)}},"\u7F6E\u9876"),y.a.createElement("p",{className:"current",onClick:function(){return tt(4,vt,bt)}},"\u5220\u9664"))};function nt(){return wt.apply(this,arguments)}function wt(){return wt=Object(z.a)(L.a.mark(function ot(){var vt;return L.a.wrap(function(Ke){for(;;)switch(Ke.prev=Ke.next){case 0:return Ke.next=2,Object(u.a)("/api/programas/".concat(rt,"/content.json"),{method:"get",params:{id:rt}});case 2:vt=Ke.sent,vt&&ue(vt);case 4:case"end":return Ke.stop()}},ot)})),wt.apply(this,arguments)}return y.a.createElement("div",{style:{marginBottom:"40px"}},y.a.createElement("img",{style:{width:"100%"},src:h.a.IMG_SERVER+"/".concat(c==null||((me=c.setting)===null||me===void 0)?void 0:me.shixun_banner_url)}),y.a.createElement("div",{className:"edu-container minH500",style:{display:"flex",width:"1200px"}},y.a.createElement(Se,{width:244,className:l.a.leftMenus,style:{background:"none",marginTop:"20px",height:"auto"}},y.a.createElement(A.a,{mode:"inline"},Be==null?void 0:Be.map(function(ot,vt){if((ot==null?void 0:ot.children.length)>0){var bt;return y.a.createElement(ge,{title:y.a.createElement("span",{className:"font16"},y.a.createElement("span",null,ot.name),!Object(k.w)()&&y.a.createElement("span",null),Object(k.w)()&&y.a.createElement(Z.a,{placement:"right",content:function(){return st(ot,1)},trigger:"hover"},y.a.createElement("span",{className:["iconfont icon-sandian",l.a.actions].join(" ")})))},ot==null||((bt=ot.children)===null||bt===void 0)?void 0:bt.map(function(Ke,ir){return y.a.createElement(A.a.Item,{className:l.a===null||l.a===void 0?void 0:l.a.SubMentItem,onClick:function(){je(Ke==null?void 0:Ke.id),rt=Ke==null?void 0:Ke.id,nt()}},y.a.createElement("span",{style:{flex:"1"}},Ke==null?void 0:Ke.name),Object(k.w)()&&y.a.createElement(Z.a,{placement:"right",content:function(){return st(Ke,2)},trigger:"hover"},y.a.createElement("span",{className:["iconfont icon-sandian",l.a.actions].join(" ")})))}))}else return y.a.createElement(A.a.Item,{className:l.a===null||l.a===void 0?void 0:l.a.SubMentItem,onClick:function(){je(ot==null?void 0:ot.id),rt=ot==null?void 0:ot.id,nt()}},y.a.createElement("span",{style:{flex:"1"}},ot==null?void 0:ot.name),Object(k.w)()&&y.a.createElement(Z.a,{placement:"right",content:function(){return st(ot,1)},trigger:"hover"},y.a.createElement("span",{className:["iconfont icon-sandian",l.a.actions].join(" ")})))}),y.a.createElement(A.a.Item,{onClick:function(){je(""),rt="",Le(!0)},style:{color:"#0152d9",fontSize:"16px",height:"40px",display:"flex",alignItems:"center"},icon:y.a.createElement(m.a,{style:{color:"#0152d9",fontSize:"16px"}})},"\u65B0\u589E\u4E8C\u7EA7\u7C7B\u76EE"))),y.a.createElement("div",{style:{width:"937px",marginLeft:"17px",background:"#fff",padding:"20px"}},Ee&&y.a.createElement(K,{ItemData:ie,setIssee:Pe}),Ee===!1&&y.a.createElement(he,{ItemData:ie,setIssee:Pe,CategoryId:rt}))),y.a.createElement(d,{CategoryId:rt,IsShow:_e,setIsShow:Le,init:Ue}),y.a.createElement(E,{CategoryId:rt,name:ee,IsShow:Je,setIsShow:qe,init:Ue}))}var Ce=at.default=Object(C.a)(function(xe){var me=xe.user,G=xe.globalSetting;return{user:me,globalSetting:G}})(Re)},"VrN/":function(pt,at,pe){(function(fe,Z){pt.exports=Z()})(this,function(){"use strict";var fe=navigator.userAgent,Z=navigator.platform,_=/gecko\/\d/i.test(fe),J=/MSIE \d/.test(fe),U=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(fe),D=/Edge\/(\d+)/.exec(fe),z=J||U||D,H=z&&(J?document.documentMode||6:+(D||U)[1]),B=!D&&/WebKit\//.test(fe),O=B&&/Qt\/\d+\.\d+/.test(fe),b=!D&&/Chrome\//.test(fe),A=/Opera\//.test(fe),P=/Apple Computer/.test(navigator.vendor),L=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(fe),w=/PhantomJS/.test(fe),y=!D&&/AppleWebKit/.test(fe)&&/Mobile\/\w+/.test(fe),h=/Android/.test(fe),o=y||h||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(fe),l=y||/Mac/.test(Z),u=/\bCrOS\b/.test(fe),C=/win/i.test(Z),v=A&&fe.match(/Version\/(\d*\.\d*)/);v&&(v=Number(v[1])),v&&v>=15&&(A=!1,B=!0);var m=l&&(O||A&&(v==null||v<12.11)),k=_||z&&H>=9;function x(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var f=function(e,t){var i=e.className,r=x(t).exec(i);if(r){var n=i.slice(r.index+r[0].length);e.className=i.slice(0,r.index)+(n?r[1]+n:"")}};function p(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function d(e,t){return p(e).appendChild(t)}function a(e,t,i,r){var n=document.createElement(e);if(i&&(n.className=i),r&&(n.style.cssText=r),typeof t=="string")n.appendChild(document.createTextNode(t));else if(t)for(var T=0;T<t.length;++T)n.appendChild(t[T]);return n}function E(e,t,i,r){var n=a(e,t,i,r);return n.setAttribute("role","presentation"),n}var g;document.createRange?g=function(e,t,i,r){var n=document.createRange();return n.setEnd(r||e,i),n.setStart(e,t),n}:g=function(e,t,i){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch(n){return r}return r.collapse(!0),r.moveEnd("character",i),r.moveStart("character",t),r};function S(e,t){if(t.nodeType==3&&(t=t.parentNode),e.contains)return e.contains(t);do if(t.nodeType==11&&(t=t.host),t==e)return!0;while(t=t.parentNode)}function F(){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 W(e,t){var i=e.className;x(t).test(i)||(e.className+=(i?" ":"")+t)}function K(e,t){for(var i=e.split(" "),r=0;r<i.length;r++)i[r]&&!x(i[r]).test(t)&&(t+=" "+i[r]);return t}var V=function(e){e.select()};y?V=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:z&&(V=function(e){try{e.select()}catch(t){}});function M(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function I(e,t,i){t||(t={});for(var r in e)e.hasOwnProperty(r)&&(i!==!1||!t.hasOwnProperty(r))&&(t[r]=e[r]);return t}function $(e,t,i,r,n){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var T=r||0,j=n||0;;){var Y=e.indexOf(" ",T);if(Y<0||Y>=t)return j+(t-T);j+=Y-T,j+=i-j%i,T=Y+1}}var ae=function(){this.id=null,this.f=null,this.time=0,this.handler=M(this.onTimeout,this)};ae.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},ae.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 he(e,t){for(var i=0;i<e.length;++i)if(e[i]==t)return i;return-1}var ge=50,De={toString:function(){return"CodeMirror.Pass"}},Se={scroll:!1},Re={origin:"*mouse"},Ce={origin:"+move"};function xe(e,t,i){for(var r=0,n=0;;){var T=e.indexOf(" ",r);T==-1&&(T=e.length);var j=T-r;if(T==e.length||n+j>=t)return r+Math.min(j,t-n);if(n+=T-r,n+=i-n%i,r=T+1,n>=t)return r}}var me=[""];function G(e){for(;me.length<=e;)me.push(s(me)+" ");return me[e]}function s(e){return e[e.length-1]}function c(e,t){for(var i=[],r=0;r<e.length;r++)i[r]=t(e[r],r);return i}function R(e,t,i){for(var r=0,n=i(t);r<e.length&&i(e[r])<=n;)r++;e.splice(r,0,t)}function X(){}function N(e,t){var i;return Object.create?i=Object.create(e):(X.prototype=e,i=new X),t&&I(t,i),i}var oe=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function be(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||oe.test(e))}function we(e,t){return t?t.source.indexOf("\\w")>-1&&be(e)?!0:t.test(e):be(e)}function _e(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var Le=/[\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 Oe(e){return e.charCodeAt(0)>=768&&Le.test(e)}function Me(e,t,i){for(;(i<0?t>0:t<e.length)&&Oe(e.charAt(t));)t+=i;return t}function Be(e,t,i){for(var r=t>i?-1:1;;){if(t==i)return t;var n=(t+i)/2,T=r<0?Math.ceil(n):Math.floor(n);if(T==t)return e(T)?t:i;e(T)?i=T:t=T+r}}function Ve(e,t,i,r){if(!e)return r(t,i,"ltr",0);for(var n=!1,T=0;T<e.length;++T){var j=e[T];(j.from<i&&j.to>t||t==i&&j.to==t)&&(r(Math.max(j.from,t),Math.min(j.to,i),j.level==1?"rtl":"ltr",T),n=!0)}n||r(t,i,"ltr")}var Xe=null;function ze(e,t,i){var r;Xe=null;for(var n=0;n<e.length;++n){var T=e[n];if(T.from<t&&T.to>t)return n;T.to==t&&(T.from!=T.to&&i=="before"?r=n:Xe=n),T.from==t&&(T.from!=T.to&&i!="before"?r=n:Xe=n)}return r!=null?r:Xe}var rt=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function i(re){return re<=247?e.charAt(re):1424<=re&&re<=1524?"R":1536<=re&&re<=1785?t.charAt(re-1536):1774<=re&&re<=2220?"r":8192<=re&&re<=8203?"w":re==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,n=/[stwN]/,T=/[LRr]/,j=/[Lb1n]/,Y=/[1n]/;function Q(re,ce,ve){this.level=re,this.from=ce,this.to=ve}return function(re,ce){var ve=ce=="ltr"?"L":"R";if(re.length==0||ce=="ltr"&&!r.test(re))return!1;for(var Ae=re.length,Te=[],Ie=0;Ie<Ae;++Ie)Te.push(i(re.charCodeAt(Ie)));for(var Ne=0,Ge=ve;Ne<Ae;++Ne){var Ye=Te[Ne];Ye=="m"?Te[Ne]=Ge:Ge=Ye}for(var et=0,$e=ve;et<Ae;++et){var it=Te[et];it=="1"&&$e=="r"?Te[et]="n":T.test(it)&&($e=it,it=="r"&&(Te[et]="R"))}for(var dt=1,ut=Te[0];dt<Ae-1;++dt){var Et=Te[dt];Et=="+"&&ut=="1"&&Te[dt+1]=="1"?Te[dt]="1":Et==","&&ut==Te[dt+1]&&(ut=="1"||ut=="n")&&(Te[dt]=ut),ut=Et}for(var Pt=0;Pt<Ae;++Pt){var $t=Te[Pt];if($t==",")Te[Pt]="N";else if($t=="%"){var Bt=void 0;for(Bt=Pt+1;Bt<Ae&&Te[Bt]=="%";++Bt);for(var yr=Pt&&Te[Pt-1]=="!"||Bt<Ae&&Te[Bt]=="1"?"1":"N",pr=Pt;pr<Bt;++pr)Te[pr]=yr;Pt=Bt-1}}for(var Wt=0,mr=ve;Wt<Ae;++Wt){var qt=Te[Wt];mr=="L"&&qt=="1"?Te[Wt]="L":T.test(qt)&&(mr=qt)}for(var zt=0;zt<Ae;++zt)if(n.test(Te[zt])){var Ht=void 0;for(Ht=zt+1;Ht<Ae&&n.test(Te[Ht]);++Ht);for(var Ft=(zt?Te[zt-1]:ve)=="L",gr=(Ht<Ae?Te[Ht]:ve)=="L",Gi=Ft==gr?Ft?"L":"R":ve,ei=zt;ei<Ht;++ei)Te[ei]=Gi;zt=Ht-1}for(var rr=[],Br,Zt=0;Zt<Ae;)if(j.test(Te[Zt])){var Va=Zt;for(++Zt;Zt<Ae&&j.test(Te[Zt]);++Zt);rr.push(new Q(0,Va,Zt))}else{var zr=Zt,vi=rr.length,yi=ce=="rtl"?1:0;for(++Zt;Zt<Ae&&Te[Zt]!="L";++Zt);for(var lr=zr;lr<Zt;)if(Y.test(Te[lr])){zr<lr&&(rr.splice(vi,0,new Q(1,zr,lr)),vi+=yi);var zi=lr;for(++lr;lr<Zt&&Y.test(Te[lr]);++lr);rr.splice(vi,0,new Q(2,zi,lr)),vi+=yi,zr=lr}else++lr;zr<Zt&&rr.splice(vi,0,new Q(1,zr,Zt))}return ce=="ltr"&&(rr[0].level==1&&(Br=re.match(/^\s+/))&&(rr[0].from=Br[0].length,rr.unshift(new Q(0,0,Br[0].length))),s(rr).level==1&&(Br=re.match(/\s+$/))&&(s(rr).to-=Br[0].length,rr.push(new Q(0,Ae-Br[0].length,Ae)))),ce=="rtl"?rr.reverse():rr}}();function je(e,t){var i=e.order;return i==null&&(i=e.order=rt(e.text,t)),i}var We=[],ke=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]||We).concat(i)}};function Je(e,t){return e._handlers&&e._handlers[t]||We}function qe(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 T=he(n,i);T>-1&&(r[t]=n.slice(0,T).concat(n.slice(T+1)))}}}function se(e,t){var i=Je(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 q(e,t,i){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),se(e,i||t.type,e,t),ue(t)||t.codemirrorIgnore}function ee(e){var t=e._handlers&&e._handlers.cursorActivity;if(!t)return;for(var i=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),r=0;r<t.length;++r)he(i,t[r])==-1&&i.push(t[r])}function ne(e,t){return Je(e,t).length>0}function le(e){e.prototype.on=function(t,i){ke(this,t,i)},e.prototype.off=function(t,i){qe(this,t,i)}}function te(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function ie(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function ue(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function de(e){te(e),ie(e)}function ye(e){return e.target||e.srcElement}function Ee(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 Pe=function(){if(z&&H<9)return!1;var e=a("div");return"draggable"in e||"dragDrop"in e}(),Ue;function Qe(e){if(Ue==null){var t=a("span","\u200B");d(e,a("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(Ue=t.offsetWidth<=1&&t.offsetHeight>2&&!(z&&H<8))}var i=Ue?a("span","\u200B"):a("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return i.setAttribute("cm-text",""),i}var tt;function xt(e){if(tt!=null)return tt;var t=d(e,document.createTextNode("A\u062EA")),i=g(t,0,1).getBoundingClientRect(),r=g(t,1,2).getBoundingClientRect();return p(e),!i||i.left==i.right?!1:tt=r.right-i.right<3}var st=`
|
|
|
|
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 T=e.slice(t,e.charAt(n-1)=="\r"?n-1:n),j=T.indexOf("\r");j!=-1?(i.push(T.slice(0,j)),t+=j+1):(i.push(T),t=n+1)}return i}:function(e){return e.split(/\r\n?|\n/)},nt=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},wt=function(){var e=a("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),ot=null;function vt(e){if(ot!=null)return ot;var t=d(e,a("span","x")),i=t.getBoundingClientRect(),r=g(t,0,1).getBoundingClientRect();return ot=Math.abs(i.left-r.left)>1}var bt={},Ke={};function ir(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),bt[e]=t}function nr(e,t){Ke[e]=t}function Kt(e){if(typeof e=="string"&&Ke.hasOwnProperty(e))e=Ke[e];else if(e&&typeof e.name=="string"&&Ke.hasOwnProperty(e.name)){var t=Ke[e.name];typeof t=="string"&&(t={name:t}),e=N(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Kt("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Kt("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function Ot(e,t){t=Kt(t);var i=bt[t.name];if(!i)return Ot(e,"text/plain");var r=i(e,t);if(ar.hasOwnProperty(t.name)){var n=ar[t.name];for(var T in n){if(!n.hasOwnProperty(T))continue;r.hasOwnProperty(T)&&(r["_"+T]=r[T]),r[T]=n[T]}}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var j in t.modeProps)r[j]=t.modeProps[j];return r}var ar={};function wr(e,t){var i=ar.hasOwnProperty(e)?ar[e]:ar[e]={};I(t,i)}function Vt(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 ur(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 ti(e,t,i){return e.startState?e.startState(t,i):!0}var It=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};It.prototype.eol=function(){return this.pos>=this.string.length},It.prototype.sol=function(){return this.pos==this.lineStart},It.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},It.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},It.prototype.eat=function(e){var t=this.string.charAt(this.pos),i;if(typeof e=="string"?i=t==e:i=t&&(e.test?e.test(t):e(t)),i)return++this.pos,t},It.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},It.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},It.prototype.skipToEnd=function(){this.pos=this.string.length},It.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},It.prototype.backUp=function(e){this.pos-=e},It.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=$(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?$(this.string,this.lineStart,this.tabSize):0)},It.prototype.indentation=function(){return $(this.string,null,this.tabSize)-(this.lineStart?$(this.string,this.lineStart,this.tabSize):0)},It.prototype.match=function(e,t,i){if(typeof e=="string"){var r=function(j){return i?j.toLowerCase():j},n=this.string.substr(this.pos,e.length);if(r(n)==r(e))return t!==!1&&(this.pos+=e.length),!0}else{var T=this.string.slice(this.pos).match(e);return T&&T.index>0?null:(T&&t!==!1&&(this.pos+=T[0].length),T)}},It.prototype.current=function(){return this.string.slice(this.start,this.pos)},It.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},It.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},It.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function Ze(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],T=n.chunkSize();if(t<T){i=n;break}t-=T}return i.lines[t]}function At(e,t,i){var r=[],n=t.line;return e.iter(t.line,i.line+1,function(T){var j=T.text;n==i.line&&(j=j.slice(0,i.ch)),n==t.line&&(j=j.slice(t.ch)),r.push(j),++n}),r}function Qt(e,t,i){var r=[];return e.iter(t,i,function(n){r.push(n.text)}),r}function yt(e,t){var i=t-e.height;if(i)for(var r=e;r;r=r.parent)r.height+=i}function gt(e){if(e.parent==null)return null;for(var t=e.parent,i=he(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 kt(e,t){var i=e.first;e:do{for(var r=0;r<e.children.length;++r){var n=e.children[r],T=n.height;if(t<T){e=n;continue e}t-=T,i+=n.chunkSize()}return i}while(!e.lines);for(var j=0;j<e.lines.length;++j){var Y=e.lines[j],Q=Y.height;if(t<Q)break;t-=Q}return i+j}function br(e,t){return t>=e.first&&t<e.first+e.size}function jt(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function Fe(e,t,i){if(i===void 0&&(i=null),!(this instanceof Fe))return new Fe(e,t,i);this.line=e,this.ch=t,this.sticky=i}function ct(e,t){return e.line-t.line||e.ch-t.ch}function ri(e,t){return e.sticky==t.sticky&&ct(e,t)==0}function bi(e){return Fe(e.line,e.ch)}function xi(e,t){return ct(e,t)<0?t:e}function ii(e,t){return ct(e,t)<0?e:t}function Ei(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function mt(e,t){if(t.line<e.first)return Fe(e.first,0);var i=e.first+e.size-1;return t.line>i?Fe(i,Ze(e,i).text.length):Ln(t,Ze(e,t.line).text.length)}function Ln(e,t){var i=e.ch;return i==null||i>t?Fe(e.line,t):i<0?Fe(e.line,0):e}function He(e,t){for(var i=[],r=0;r<t.length;r++)i[r]=mt(e,t[r]);return i}var Si=function(e,t){this.state=e,this.lookAhead=t},Tr=function(e,t,i,r){this.state=t,this.doc=e,this.line=i,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};Tr.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},Tr.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}},Tr.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},Tr.fromSaved=function(e,t,i){return t instanceof Si?new Tr(e,Vt(e.mode,t.state),i,t.lookAhead):new Tr(e,Vt(e.mode,t),i)},Tr.prototype.save=function(e){var t=e!==!1?Vt(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Si(t,this.maxLookAhead):t};function Ki(e,t,i,r){var n=[e.state.modeGen],T={};kr(e,t.text,e.doc.mode,i,function(re,ce){return n.push(re,ce)},T,r);for(var j=i.state,Y=function(re){i.baseTokens=n;var ce=e.state.overlays[re],ve=1,Ae=0;i.state=!0,kr(e,t.text,ce.mode,i,function(Te,Ie){for(var Ne=ve;Ae<Te;){var Ge=n[ve];Ge>Te&&n.splice(ve,1,Te,n[ve+1],Ge),ve+=2,Ae=Math.min(Te,Ge)}if(!Ie)return;if(ce.opaque)n.splice(Ne,ve-Ne,Te,"overlay "+Ie),ve=Ne+2;else for(;Ne<ve;Ne+=2){var Ye=n[Ne+1];n[Ne+1]=(Ye?Ye+" ":"")+"overlay "+Ie}},T),i.state=j,i.baseTokens=null,i.baseTokenPos=1},Q=0;Q<e.state.overlays.length;++Q)Y(Q);return{styles:n,classes:T.bgClass||T.textClass?T:null}}function ni(e,t,i){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=Ar(e,gt(t)),n=t.text.length>e.options.maxHighlightLength&&Vt(e.doc.mode,r.state),T=Ki(e,t,r);n&&(r.state=n),t.stateAfter=r.save(!n),t.styles=T.styles,T.classes?t.styleClasses=T.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 Ar(e,t,i){var r=e.doc,n=e.display;if(!r.mode.startState)return new Tr(r,!0,t);var T=Dn(e,t,i),j=T>r.first&&Ze(r,T-1).stateAfter,Y=j?Tr.fromSaved(r,j,T):new Tr(r,ti(r.mode),T);return r.iter(T,t,function(Q){Vi(e,Q.text,Y);var re=Y.line;Q.stateAfter=re==t-1||re%5==0||re>=n.viewFrom&&re<n.viewTo?Y.save():null,Y.nextLine()}),i&&(r.modeFrontier=Y.line),Y}function Vi(e,t,i,r){var n=e.doc.mode,T=new It(t,e.options.tabSize,i);for(T.start=T.pos=r||0,t==""&&Xi(n,i.state);!T.eol();)Lr(n,T,i.state),T.start=T.pos}function Xi(e,t){if(e.blankLine)return e.blankLine(t);if(!e.innerMode)return;var i=ur(e,t);if(i.mode.blankLine)return i.mode.blankLine(i.state)}function Lr(e,t,i,r){for(var n=0;n<10;n++){r&&(r[0]=ur(e,i).mode);var T=e.token(t,i);if(t.pos>t.start)return T}throw new Error("Mode "+e.name+" failed to advance stream.")}var Yi=function(e,t,i){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=i};function kn(e,t,i,r){var n=e.doc,T=n.mode,j;t=mt(n,t);var Y=Ze(n,t.line),Q=Ar(e,t.line,i),re=new It(Y.text,e.options.tabSize,Q),ce;for(r&&(ce=[]);(r||re.pos<t.ch)&&!re.eol();)re.start=re.pos,j=Lr(T,re,Q.state),r&&ce.push(new Yi(re,j,Vt(n.mode,Q.state)));return r?ce:new Yi(re,j,Q.state)}function $i(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 kr(e,t,i,r,n,T,j){var Y=i.flattenSpans;Y==null&&(Y=e.options.flattenSpans);var Q=0,re=null,ce=new It(t,e.options.tabSize,r),ve,Ae=e.options.addModeClass&&[null];for(t==""&&$i(Xi(i,r.state),T);!ce.eol();){if(ce.pos>e.options.maxHighlightLength?(Y=!1,j&&Vi(e,t,r,ce.pos),ce.pos=t.length,ve=null):ve=$i(Lr(i,ce,r.state,Ae),T),Ae){var Te=Ae[0].name;Te&&(ve="m-"+(ve?Te+" "+ve:Te))}if(!Y||re!=ve){for(;Q<ce.start;)Q=Math.min(ce.start,Q+5e3),n(Q,re);re=ve}ce.start=ce.pos}for(;Q<ce.pos;){var Ie=Math.min(ce.pos,Q+5e3);n(Ie,re),Q=Ie}}function Dn(e,t,i){for(var r,n,T=e.doc,j=i?-1:t-(e.doc.mode.innerMode?1e3:100),Y=t;Y>j;--Y){if(Y<=T.first)return T.first;var Q=Ze(T,Y-1),re=Q.stateAfter;if(re&&(!i||Y+(re instanceof Si?re.lookAhead:0)<=T.modeFrontier))return Y;var ce=$(Q.text,null,e.options.tabSize);(n==null||r>ce)&&(n=Y-1,r=ce)}return n}function aa(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=Ze(e,r).stateAfter;if(n&&(!(n instanceof Si)||r+n.lookAhead<t)){i=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,i)}var Zi=!1,or=!1;function Kr(){Zi=!0}function oa(){or=!0}function ai(e,t,i){this.marker=e,this.from=t,this.to=i}function Dr(e,t){if(e)for(var i=0;i<e.length;++i){var r=e[i];if(r.marker==t)return r}}function Qi(e,t){for(var i,r=0;r<e.length;++r)e[r]!=t&&(i||(i=[])).push(e[r]);return i}function sa(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function Rn(e,t,i){var r;if(e)for(var n=0;n<e.length;++n){var T=e[n],j=T.marker,Y=T.from==null||(j.inclusiveLeft?T.from<=t:T.from<t);if(Y||T.from==t&&j.type=="bookmark"&&(!i||!T.marker.insertLeft)){var Q=T.to==null||(j.inclusiveRight?T.to>=t:T.to>t);(r||(r=[])).push(new ai(j,T.from,Q?null:T.to))}}return r}function _n(e,t,i){var r;if(e)for(var n=0;n<e.length;++n){var T=e[n],j=T.marker,Y=T.to==null||(j.inclusiveRight?T.to>=t:T.to>t);if(Y||T.from==t&&j.type=="bookmark"&&(!i||T.marker.insertLeft)){var Q=T.from==null||(j.inclusiveLeft?T.from<=t:T.from<t);(r||(r=[])).push(new ai(j,Q?null:T.from-t,T.to==null?null:T.to-t))}}return r}function Ti(e,t){if(t.full)return null;var i=br(e,t.from.line)&&Ze(e,t.from.line).markedSpans,r=br(e,t.to.line)&&Ze(e,t.to.line).markedSpans;if(!i&&!r)return null;var n=t.from.ch,T=t.to.ch,j=ct(t.from,t.to)==0,Y=Rn(i,n,j),Q=_n(r,T,j),re=t.text.length==1,ce=s(t.text).length+(re?n:0);if(Y)for(var ve=0;ve<Y.length;++ve){var Ae=Y[ve];if(Ae.to==null){var Te=Dr(Q,Ae.marker);Te?re&&(Ae.to=Te.to==null?null:Te.to+ce):Ae.to=n}}if(Q)for(var Ie=0;Ie<Q.length;++Ie){var Ne=Q[Ie];if(Ne.to!=null&&(Ne.to+=ce),Ne.from==null){var Ge=Dr(Y,Ne.marker);Ge||(Ne.from=ce,re&&(Y||(Y=[])).push(Ne))}else Ne.from+=ce,re&&(Y||(Y=[])).push(Ne)}Y&&(Y=On(Y)),Q&&Q!=Y&&(Q=On(Q));var Ye=[Y];if(!re){var et=t.text.length-2,$e;if(et>0&&Y)for(var it=0;it<Y.length;++it)Y[it].to==null&&($e||($e=[])).push(new ai(Y[it].marker,null,null));for(var dt=0;dt<et;++dt)Ye.push($e);Ye.push(Q)}return Ye}function On(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 Mn(e,t,i){var r=null;if(e.iter(t.line,i.line+1,function(Te){if(Te.markedSpans)for(var Ie=0;Ie<Te.markedSpans.length;++Ie){var Ne=Te.markedSpans[Ie].marker;Ne.readOnly&&(!r||he(r,Ne)==-1)&&(r||(r=[])).push(Ne)}}),!r)return null;for(var n=[{from:t,to:i}],T=0;T<r.length;++T)for(var j=r[T],Y=j.find(0),Q=0;Q<n.length;++Q){var re=n[Q];if(ct(re.to,Y.from)<0||ct(re.from,Y.to)>0)continue;var ce=[Q,1],ve=ct(re.from,Y.from),Ae=ct(re.to,Y.to);(ve<0||!j.inclusiveLeft&&!ve)&&ce.push({from:re.from,to:Y.from}),(Ae>0||!j.inclusiveRight&&!Ae)&&ce.push({from:Y.to,to:re.to}),n.splice.apply(n,ce),Q+=ce.length-3}return n}function la(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 Ci(e,t){if(!t)return;for(var i=0;i<t.length;++i)t[i].marker.attachLine(e);e.markedSpans=t}function oi(e){return e.inclusiveLeft?-1:0}function si(e){return e.inclusiveRight?1:0}function wi(e,t){var i=e.lines.length-t.lines.length;if(i!=0)return i;var r=e.find(),n=t.find(),T=ct(r.from,n.from)||oi(e)-oi(t);if(T)return-T;var j=ct(r.to,n.to)||si(e)-si(t);return j||t.id-e.id}function Fr(e,t){var i=or&&e.markedSpans,r;if(i)for(var n=void 0,T=0;T<i.length;++T)n=i[T],n.marker.collapsed&&(t?n.from:n.to)==null&&(!r||wi(r,n.marker)<0)&&(r=n.marker);return r}function Ur(e){return Fr(e,!0)}function jr(e){return Fr(e,!1)}function Ai(e,t){var i=or&&e.markedSpans,r;if(i)for(var n=0;n<i.length;++n){var T=i[n];T.marker.collapsed&&(T.from==null||T.from<t)&&(T.to==null||T.to>t)&&(!r||wi(r,T.marker)<0)&&(r=T.marker)}return r}function Pn(e,t,i,r,n){var T=Ze(e,t),j=or&&T.markedSpans;if(j)for(var Y=0;Y<j.length;++Y){var Q=j[Y];if(!Q.marker.collapsed)continue;var re=Q.marker.find(0),ce=ct(re.from,i)||oi(Q.marker)-oi(n),ve=ct(re.to,r)||si(Q.marker)-si(n);if(ce>=0&&ve<=0||ce<=0&&ve>=0)continue;if(ce<=0&&(Q.marker.inclusiveRight&&n.inclusiveLeft?ct(re.to,i)>=0:ct(re.to,i)>0)||ce>=0&&(Q.marker.inclusiveRight&&n.inclusiveLeft?ct(re.from,r)<=0:ct(re.from,r)<0))return!0}}function xr(e){for(var t;t=Ur(e);)e=t.find(-1,!0).line;return e}function In(e){for(var t;t=jr(e);)e=t.find(1,!0).line;return e}function Li(e){for(var t,i;t=jr(e);)e=t.find(1,!0).line,(i||(i=[])).push(e);return i}function Ji(e,t){var i=Ze(e,t),r=xr(i);return i==r?t:gt(r)}function Vr(e,t){if(t>e.lastLine())return t;var i=Ze(e,t),r;if(!Pr(e,i))return t;for(;r=jr(i);)i=r.find(1,!0).line;return gt(i)+1}function Pr(e,t){var i=or&&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&&qi(e,t,r))return!0}}function qi(e,t,i){if(i.to==null){var r=i.marker.find(1,!0);return qi(e,r.line,Dr(r.line.markedSpans,i.marker))}if(i.marker.inclusiveRight&&i.to==t.text.length)return!0;for(var n=void 0,T=0;T<t.markedSpans.length;++T)if(n=t.markedSpans[T],n.marker.collapsed&&!n.marker.widgetNode&&n.from==i.to&&(n.to==null||n.to!=i.from)&&(n.marker.inclusiveLeft||i.marker.inclusiveRight)&&qi(e,t,n))return!0}function Rr(e){e=xr(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 T=i.parent;T;i=T,T=i.parent)for(var j=0;j<T.children.length;++j){var Y=T.children[j];if(Y==i)break;t+=Y.height}return t}function en(e){if(e.height==0)return 0;for(var t=e.text.length,i,r=e;i=Ur(r);){var n=i.find(0,!0);r=n.from.line,t+=n.from.ch-n.to.ch}for(r=e;i=jr(r);){var T=i.find(0,!0);t-=r.text.length-T.from.ch,r=T.to.line,t+=r.text.length-T.to.ch}return t}function Nn(e){var t=e.display,i=e.doc;t.maxLine=Ze(i,i.first),t.maxLineLength=en(t.maxLine),t.maxLineChanged=!0,i.iter(function(r){var n=en(r);n>t.maxLineLength&&(t.maxLineLength=n,t.maxLine=r)})}var li=function(e,t,i){this.text=e,Ci(this,t),this.height=i?i(this):1};li.prototype.lineNo=function(){return gt(this)},le(li);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),la(e),Ci(e,i);var n=r?r(e):1;n!=e.height&&yt(e,n)}function lt(e){e.parent=null,la(e)}var ft={},ht={};function St(e,t){if(!e||/^\s*$/.test(e))return null;var i=t.addModeClass?ht:ft;return i[e]||(i[e]=e.replace(/\S+/g,"cm-$&"))}function Lt(e,t){var i=E("span",null,null,B?"padding-right: .1px":null),r={pre:E("pre",[i],"CodeMirror-line"),content:i,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var n=0;n<=(t.rest?t.rest.length:0);n++){var T=n?t.rest[n-1]:t.line,j=void 0;r.pos=0,r.addToken=Ct,xt(e.display.measure)&&(j=je(T,e.doc.direction))&&(r.addToken=hr(r.addToken,j)),r.map=[];var Y=t!=e.display.externalMeasured&>(T);Wr(T,r,ni(e,T,Y)),T.styleClasses&&(T.styleClasses.bgClass&&(r.bgClass=K(T.styleClasses.bgClass,r.bgClass||"")),T.styleClasses.textClass&&(r.textClass=K(T.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(Qe(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(B){var Q=r.content.lastChild;(/\bcm-tab\b/.test(Q.className)||Q.querySelector&&Q.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return se(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=K(r.pre.className,r.textClass||"")),r}function Mt(e){var t=a("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Ct(e,t,i,r,n,T,j){if(!t)return;var Y=e.splitSpaces?Gt(t,e.trailingSpace):t,Q=e.cm.state.specialChars,re=!1,ce;if(!Q.test(t))e.col+=t.length,ce=document.createTextNode(Y),e.map.push(e.pos,e.pos+t.length,ce),z&&H<9&&(re=!0),e.pos+=t.length;else{ce=document.createDocumentFragment();for(var ve=0;;){Q.lastIndex=ve;var Ae=Q.exec(t),Te=Ae?Ae.index-ve:t.length-ve;if(Te){var Ie=document.createTextNode(Y.slice(ve,ve+Te));z&&H<9?ce.appendChild(a("span",[Ie])):ce.appendChild(Ie),e.map.push(e.pos,e.pos+Te,Ie),e.col+=Te,e.pos+=Te}if(!Ae)break;ve+=Te+1;var Ne=void 0;if(Ae[0]==" "){var Ge=e.cm.options.tabSize,Ye=Ge-e.col%Ge;Ne=ce.appendChild(a("span",G(Ye),"cm-tab")),Ne.setAttribute("role","presentation"),Ne.setAttribute("cm-text"," "),e.col+=Ye}else Ae[0]=="\r"||Ae[0]==`
|
|
`?(Ne=ce.appendChild(a("span",Ae[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),Ne.setAttribute("cm-text",Ae[0]),e.col+=1):(Ne=e.cm.options.specialCharPlaceholder(Ae[0]),Ne.setAttribute("cm-text",Ae[0]),z&&H<9?ce.appendChild(a("span",[Ne])):ce.appendChild(Ne),e.col+=1);e.map.push(e.pos,e.pos+1,Ne),e.pos++}}if(e.trailingSpace=Y.charCodeAt(t.length-1)==32,i||r||n||re||T||j){var et=i||"";r&&(et+=r),n&&(et+=n);var $e=a("span",[ce],et,T);if(j)for(var it in j)j.hasOwnProperty(it)&&it!="style"&&it!="class"&&$e.setAttribute(it,j[it]);return e.content.appendChild($e)}e.content.appendChild(ce)}function Gt(e,t){if(e.length>1&&!/ /.test(e))return e;for(var i=t,r="",n=0;n<e.length;n++){var T=e.charAt(n);T==" "&&i&&(n==e.length-1||e.charCodeAt(n+1)==32)&&(T="\xA0"),r+=T,i=T==" "}return r}function hr(e,t){return function(i,r,n,T,j,Y,Q){n=n?n+" cm-force-border":"cm-force-border";for(var re=i.pos,ce=re+r.length;;){for(var ve=void 0,Ae=0;Ae<t.length&&!(ve=t[Ae],ve.to>re&&ve.from<=re);Ae++);if(ve.to>=ce)return e(i,r,n,T,j,Y,Q);e(i,r.slice(0,ve.to-re),n,T,null,Y,Q),T=null,r=r.slice(ve.to-re),re=ve.to}}}function Tt(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 Wr(e,t,i){var r=e.markedSpans,n=e.text,T=0;if(!r){for(var j=1;j<i.length;j+=2)t.addToken(t,n.slice(T,T=i[j]),St(i[j+1],t.cm.options));return}for(var Y=n.length,Q=0,re=1,ce="",ve,Ae,Te=0,Ie,Ne,Ge,Ye,et;;){if(Te==Q){Ie=Ne=Ge=Ae="",et=null,Ye=null,Te=Infinity;for(var $e=[],it=void 0,dt=0;dt<r.length;++dt){var ut=r[dt],Et=ut.marker;if(Et.type=="bookmark"&&ut.from==Q&&Et.widgetNode)$e.push(Et);else if(ut.from<=Q&&(ut.to==null||ut.to>Q||Et.collapsed&&ut.to==Q&&ut.from==Q)){if(ut.to!=null&&ut.to!=Q&&Te>ut.to&&(Te=ut.to,Ne=""),Et.className&&(Ie+=" "+Et.className),Et.css&&(Ae=(Ae?Ae+";":"")+Et.css),Et.startStyle&&ut.from==Q&&(Ge+=" "+Et.startStyle),Et.endStyle&&ut.to==Te&&(it||(it=[])).push(Et.endStyle,ut.to),Et.title&&((et||(et={})).title=Et.title),Et.attributes)for(var Pt in Et.attributes)(et||(et={}))[Pt]=Et.attributes[Pt];Et.collapsed&&(!Ye||wi(Ye.marker,Et)<0)&&(Ye=ut)}else ut.from>Q&&Te>ut.from&&(Te=ut.from)}if(it)for(var $t=0;$t<it.length;$t+=2)it[$t+1]==Te&&(Ne+=" "+it[$t]);if(!Ye||Ye.from==Q)for(var Bt=0;Bt<$e.length;++Bt)Tt(t,0,$e[Bt]);if(Ye&&(Ye.from||0)==Q){if(Tt(t,(Ye.to==null?Y+1:Ye.to)-Q,Ye.marker,Ye.from==null),Ye.to==null)return;Ye.to==Q&&(Ye=!1)}}if(Q>=Y)break;for(var yr=Math.min(Y,Te);;){if(ce){var pr=Q+ce.length;if(!Ye){var Wt=pr>yr?ce.slice(0,yr-Q):ce;t.addToken(t,Wt,ve?ve+Ie:Ie,Ge,Q+Wt.length==Te?Ne:"",Ae,et)}if(pr>=yr){ce=ce.slice(yr-Q),Q=yr;break}Q=pr,Ge=""}ce=n.slice(T,T=i[re++]),ve=St(i[re++],t.cm.options)}}}function Dt(e,t,i){this.line=t,this.rest=Li(t),this.size=this.rest?gt(s(this.rest))-i+1:1,this.node=this.text=null,this.hidden=Pr(e,t)}function dr(e,t,i){for(var r=[],n,T=t;T<i;T=n){var j=new Dt(e.doc,Ze(e.doc,T),T);n=T+j.size,r.push(j)}return r}var er=null;function Cr(e){er?er.ops.push(e):e.ownsGroup=er={ops:[e],delayedCallbacks:[]}}function Rs(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 _s(e,t){var i=e.ownsGroup;if(!i)return;try{Rs(i)}finally{er=null,t(i)}}var tn=null;function Jt(e,t){var i=Je(e,t);if(!i.length)return;var r=Array.prototype.slice.call(arguments,2),n;er?n=er.delayedCallbacks:tn?n=tn:(n=tn=[],setTimeout(Os,0));for(var T=function(Y){n.push(function(){return i[Y].apply(null,r)})},j=0;j<i.length;++j)T(j)}function Os(){var e=tn;tn=null;for(var t=0;t<e.length;++t)e[t]()}function Ya(e,t,i,r){for(var n=0;n<t.changes.length;n++){var T=t.changes[n];T=="text"?Ps(e,t):T=="gutter"?Za(e,t,i,r):T=="class"?ha(e,t):T=="widget"&&Is(e,t,r)}t.changes=null}function rn(e){return e.node==e.text&&(e.node=a("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),z&&H<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=rn(t);t.background=r.insertBefore(a("div",null,i),r.firstChild),e.display.input.setUneditable(t.background)}}function $a(e,t){var i=e.display.externalMeasured;return i&&i.line==t.line?(e.display.externalMeasured=null,t.measure=i.measure,i.built):Lt(e,t)}function Ps(e,t){var i=t.text.className,r=$a(e,t);t.text==t.node&&(t.node=r.pre),t.text.parentNode.replaceChild(r.pre,t.text),t.text=r.pre,r.bgClass!=t.bgClass||r.textClass!=t.textClass?(t.bgClass=r.bgClass,t.textClass=r.textClass,ha(e,t)):i&&(t.text.className=i)}function ha(e,t){Ms(e,t),t.line.wrapClass?rn(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 Za(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=rn(t);t.gutterBackground=a("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),n.insertBefore(t.gutterBackground,t.text)}var T=t.line.gutterMarkers;if(e.options.lineNumbers||T){var j=rn(t),Y=t.gutter=a("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(Y),j.insertBefore(Y,t.text),t.line.gutterClass&&(Y.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!T||!T["CodeMirror-linenumbers"])&&(t.lineNumber=Y.appendChild(a("div",jt(e.options,i),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),T)for(var Q=0;Q<e.display.gutterSpecs.length;++Q){var re=e.display.gutterSpecs[Q].className,ce=T.hasOwnProperty(re)&&T[re];ce&&Y.appendChild(a("div",[ce],"CodeMirror-gutter-elt","left: "+r.gutterLeft[re]+"px; width: "+r.gutterWidth[re]+"px"))}}}function Is(e,t,i){t.alignable&&(t.alignable=null);for(var r=x("CodeMirror-linewidget"),n=t.node.firstChild,T=void 0;n;n=T)T=n.nextSibling,r.test(n.className)&&t.node.removeChild(n);Qa(e,t,i)}function Ns(e,t,i,r){var n=$a(e,t);return t.text=t.node=n.pre,n.bgClass&&(t.bgClass=n.bgClass),n.textClass&&(t.textClass=n.textClass),ha(e,t),Za(e,t,i,r),Qa(e,t,r),t.node}function Qa(e,t,i){if(Ja(e,t.line,t,i,!0),t.rest)for(var r=0;r<t.rest.length;r++)Ja(e,t.rest[r],t,i,!1)}function Ja(e,t,i,r,n){if(!t.widgets)return;for(var T=rn(i),j=0,Y=t.widgets;j<Y.length;++j){var Q=Y[j],re=a("div",[Q.node],"CodeMirror-linewidget"+(Q.className?" "+Q.className:""));Q.handleMouseEvents||re.setAttribute("cm-ignore-events","true"),Bs(Q,re,i,r),e.display.input.setUneditable(re),n&&Q.above?T.insertBefore(re,i.gutter||i.text):T.appendChild(re),Jt(Q,"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 nn(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!S(document.body,e.node)){var i="position: relative;";e.coverGutter&&(i+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(i+="width: "+t.display.wrapper.clientWidth+"px;"),d(t.display.measure,a("div",[e.node],null,i))}return e.height=e.node.parentNode.offsetHeight}function Hr(e,t){for(var i=ye(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 Bn(e){return e.lineSpace.offsetTop}function da(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function qa(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=d(e.measure,a("pre","x","CodeMirror-line-like")),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 Ir(e){return ge-e.display.nativeBarWidth}function ui(e){return e.display.scroller.clientWidth-Ir(e)-e.display.barWidth}function ca(e){return e.display.scroller.clientHeight-Ir(e)-e.display.barHeight}function Fs(e,t,i){var r=e.options.lineWrapping,n=r&&ui(e);if(!t.measure.heights||r&&t.measure.width!=n){var T=t.measure.heights=[];if(r){t.measure.width=n;for(var j=t.text.firstChild.getClientRects(),Y=0;Y<j.length-1;Y++){var Q=j[Y],re=j[Y+1];Math.abs(Q.bottom-re.bottom)>2&&T.push((Q.bottom+re.top)/2-i.top)}}T.push(i.bottom-i.top)}}function eo(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(gt(e.rest[n])>i)return{map:e.measure.maps[n],cache:e.measure.caches[n],before:!0}}function Us(e,t){t=xr(t);var i=gt(t),r=e.display.externalMeasured=new Dt(e.doc,t,i);r.lineN=i;var n=r.built=Lt(e,r);return r.text=n.pre,d(e.display.lineMeasure,n.pre),r}function to(e,t,i,r){return Nr(e,ki(e,t),i,r)}function fa(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[ci(e,t)];var i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size)return i}function ki(e,t){var i=gt(t),r=fa(e,i);r&&!r.text?r=null:r&&r.changes&&(Ya(e,r,i,ba(e)),e.curOp.forceUpdate=!0),r||(r=Us(e,t));var n=eo(r,t,i);return{line:t,view:r,rect:null,map:n.map,cache:n.cache,before:n.before,hasHeights:!1}}function Nr(e,t,i,r,n){t.before&&(i=-1);var T=i+(r||""),j;return t.cache.hasOwnProperty(T)?j=t.cache[T]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Fs(e,t.view,t.rect),t.hasHeights=!0),j=Ws(e,t,i,r),j.bogus||(t.cache[T]=j)),{left:j.left,right:j.right,top:n?j.rtop:j.top,bottom:n?j.rbottom:j.bottom}}var ro={left:0,right:0,top:0,bottom:0};function io(e,t,i){for(var r,n,T,j,Y,Q,re=0;re<e.length;re+=3)if(Y=e[re],Q=e[re+1],t<Y?(n=0,T=1,j="left"):t<Q?(n=t-Y,T=n+1):(re==e.length-3||t==Q&&e[re+3]>t)&&(T=Q-Y,n=T-1,t>=Q&&(j="right")),n!=null){if(r=e[re+2],Y==Q&&i==(r.insertLeft?"left":"right")&&(j=i),i=="left"&&n==0)for(;re&&e[re-2]==e[re-3]&&e[re-1].insertLeft;)r=e[(re-=3)+2],j="left";if(i=="right"&&n==Q-Y)for(;re<e.length-3&&e[re+3]==e[re+4]&&!e[re+5].insertLeft;)r=e[(re+=3)+2],j="right";break}return{node:r,start:n,end:T,collapse:j,coverStart:Y,coverEnd:Q}}function js(e,t){var i=ro;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=io(t.map,i,r),T=n.node,j=n.start,Y=n.end,Q=n.collapse,re;if(T.nodeType==3){for(var ce=0;ce<4;ce++){for(;j&&Oe(t.line.text.charAt(n.coverStart+j));)--j;for(;n.coverStart+Y<n.coverEnd&&Oe(t.line.text.charAt(n.coverStart+Y));)++Y;if(z&&H<9&&j==0&&Y==n.coverEnd-n.coverStart?re=T.parentNode.getBoundingClientRect():re=js(g(T,j,Y).getClientRects(),r),re.left||re.right||j==0)break;Y=j,j=j-1,Q="right"}z&&H<11&&(re=Hs(e.display.measure,re))}else{j>0&&(Q=r="right");var ve;e.options.lineWrapping&&(ve=T.getClientRects()).length>1?re=ve[r=="right"?ve.length-1:0]:re=T.getBoundingClientRect()}if(z&&H<9&&!j&&(!re||!re.left&&!re.right)){var Ae=T.parentNode.getClientRects()[0];Ae?re={left:Ae.left,right:Ae.left+Ri(e.display),top:Ae.top,bottom:Ae.bottom}:re=ro}for(var Te=re.top-t.rect.top,Ie=re.bottom-t.rect.top,Ne=(Te+Ie)/2,Ge=t.view.measure.heights,Ye=0;Ye<Ge.length-1&&!(Ne<Ge[Ye]);Ye++);var et=Ye?Ge[Ye-1]:0,$e=Ge[Ye],it={left:(Q=="right"?re.right:re.left)-t.rect.left,right:(Q=="left"?re.left:re.right)-t.rect.left,top:et,bottom:$e};return!re.left&&!re.right&&(it.bogus=!0),e.options.singleCursorHeightPerLine||(it.rtop=Te,it.rbottom=Ie),it}function Hs(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!vt(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 no(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function ao(e){e.display.externalMeasure=null,p(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)no(e.display.view[t])}function an(e){ao(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function oo(){return b&&h?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function so(){return b&&h?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function pa(e){var t=0;if(e.widgets)for(var i=0;i<e.widgets.length;++i)e.widgets[i].above&&(t+=nn(e.widgets[i]));return t}function Fn(e,t,i,r,n){if(!n){var T=pa(t);i.top+=T,i.bottom+=T}if(r=="line")return i;r||(r="local");var j=Rr(t);if(r=="local"?j+=Bn(e.display):j-=e.display.viewOffset,r=="page"||r=="window"){var Y=e.display.lineSpace.getBoundingClientRect();j+=Y.top+(r=="window"?0:so());var Q=Y.left+(r=="window"?0:oo());i.left+=Q,i.right+=Q}return i.top+=j,i.bottom+=j,i}function lo(e,t,i){if(i=="div")return t;var r=t.left,n=t.top;if(i=="page")r-=oo(),n-=so();else if(i=="local"||!i){var T=e.display.sizer.getBoundingClientRect();r+=T.left,n+=T.top}var j=e.display.lineSpace.getBoundingClientRect();return{left:r-j.left,top:n-j.top}}function ma(e,t,i,r,n){return r||(r=Ze(e.doc,t.line)),Fn(e,r,to(e,r,t.ch,n),i)}function _r(e,t,i,r,n,T){r=r||Ze(e.doc,t.line),n||(n=ki(e,r));function j(Ie,Ne){var Ge=Nr(e,n,Ie,Ne?"right":"left",T);return Ne?Ge.left=Ge.right:Ge.right=Ge.left,Fn(e,r,Ge,i)}var Y=je(r,e.doc.direction),Q=t.ch,re=t.sticky;if(Q>=r.text.length?(Q=r.text.length,re="before"):Q<=0&&(Q=0,re="after"),!Y)return j(re=="before"?Q-1:Q,re=="before");function ce(Ie,Ne,Ge){var Ye=Y[Ne],et=Ye.level==1;return j(Ge?Ie-1:Ie,et!=Ge)}var ve=ze(Y,Q,re),Ae=Xe,Te=ce(Q,ve,re=="before");return Ae!=null&&(Te.other=ce(Q,Ae,re!="before")),Te}function uo(e,t){var i=0;t=mt(e.doc,t),e.options.lineWrapping||(i=Ri(e.display)*t.ch);var r=Ze(e.doc,t.line),n=Rr(r)+Bn(e.display);return{left:i,right:i,top:n,bottom:n+r.height}}function ga(e,t,i,r,n){var T=Fe(e,t,i);return T.xRel=n,r&&(T.outside=r),T}function va(e,t,i){var r=e.doc;if(i+=e.display.viewOffset,i<0)return ga(r.first,0,null,-1,-1);var n=kt(r,i),T=r.first+r.size-1;if(n>T)return ga(r.first+r.size-1,Ze(r,T).text.length,null,1,1);t<0&&(t=0);for(var j=Ze(r,n);;){var Y=Gs(e,j,n,t,i),Q=Ai(j,Y.ch+(Y.xRel>0||Y.outside>0?1:0));if(!Q)return Y;var re=Q.find(1);if(re.line==n)return re;j=Ze(r,n=re.line)}}function ho(e,t,i,r){r-=pa(t);var n=t.text.length,T=Be(function(j){return Nr(e,i,j-1).bottom<=r},n,0);return n=Be(function(j){return Nr(e,i,j).top>r},T,n),{begin:T,end:n}}function co(e,t,i,r){i||(i=ki(e,t));var n=Fn(e,t,Nr(e,i,r),"line").top;return ho(e,t,i,n)}function ya(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-=Rr(t);var T=ki(e,t),j=pa(t),Y=0,Q=t.text.length,re=!0,ce=je(t,e.doc.direction);if(ce){var ve=(e.options.lineWrapping?Ks:zs)(e,t,i,T,ce,r,n);re=ve.level!=1,Y=re?ve.from:ve.to-1,Q=re?ve.to:ve.from-1}var Ae=null,Te=null,Ie=Be(function(dt){var ut=Nr(e,T,dt);return ut.top+=j,ut.bottom+=j,ya(ut,r,n,!1)?(ut.top<=n&&ut.left<=r&&(Ae=dt,Te=ut),!0):!1},Y,Q),Ne,Ge,Ye=!1;if(Te){var et=r-Te.left<Te.right-r,$e=et==re;Ie=Ae+($e?0:1),Ge=$e?"after":"before",Ne=et?Te.left:Te.right}else{!re&&(Ie==Q||Ie==Y)&&Ie++,Ge=Ie==0?"after":Ie==t.text.length?"before":Nr(e,T,Ie-(re?1:0)).bottom+j<=n==re?"after":"before";var it=_r(e,Fe(i,Ie,Ge),"line",t,T);Ne=it.left,Ye=n<it.top?-1:n>=it.bottom?1:0}return Ie=Me(t.text,Ie,1),ga(i,Ie,Ge,Ye,r-Ne)}function zs(e,t,i,r,n,T,j){var Y=Be(function(ve){var Ae=n[ve],Te=Ae.level!=1;return ya(_r(e,Fe(i,Te?Ae.to:Ae.from,Te?"before":"after"),"line",t,r),T,j,!0)},0,n.length-1),Q=n[Y];if(Y>0){var re=Q.level!=1,ce=_r(e,Fe(i,re?Q.from:Q.to,re?"after":"before"),"line",t,r);ya(ce,T,j,!0)&&ce.top>j&&(Q=n[Y-1])}return Q}function Ks(e,t,i,r,n,T,j){var Y=ho(e,t,r,j),Q=Y.begin,re=Y.end;/\s/.test(t.text.charAt(re-1))&&re--;for(var ce=null,ve=null,Ae=0;Ae<n.length;Ae++){var Te=n[Ae];if(Te.from>=re||Te.to<=Q)continue;var Ie=Te.level!=1,Ne=Nr(e,r,Ie?Math.min(re,Te.to)-1:Math.max(Q,Te.from)).right,Ge=Ne<T?T-Ne+1e9:Ne-T;(!ce||ve>Ge)&&(ce=Te,ve=Ge)}return ce||(ce=n[n.length-1]),ce.from<Q&&(ce={from:Q,to:ce.to,level:ce.level}),ce.to>re&&(ce={from:ce.from,to:re,level:ce.level}),ce}var hi;function Di(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(hi==null){hi=a("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)hi.appendChild(document.createTextNode("x")),hi.appendChild(a("br"));hi.appendChild(document.createTextNode("x"))}d(e.measure,hi);var i=hi.offsetHeight/50;return i>3&&(e.cachedTextHeight=i),p(e.measure),i||1}function Ri(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=a("span","xxxxxxxxxx"),i=a("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 ba(e){for(var t=e.display,i={},r={},n=t.gutters.clientLeft,T=t.gutters.firstChild,j=0;T;T=T.nextSibling,++j){var Y=e.display.gutterSpecs[j].className;i[Y]=T.offsetLeft+T.clientLeft+n,r[Y]=T.clientWidth}return{fixedPos:xa(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:i,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function xa(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function fo(e){var t=Di(e.display),i=e.options.lineWrapping,r=i&&Math.max(5,e.display.scroller.clientWidth/Ri(e.display)-3);return function(n){if(Pr(e.doc,n))return 0;var T=0;if(n.widgets)for(var j=0;j<n.widgets.length;j++)n.widgets[j].height&&(T+=n.widgets[j].height);return i?T+(Math.ceil(n.text.length/r)||1)*t:T+t}}function Ea(e){var t=e.doc,i=fo(e);t.iter(function(r){var n=i(r);n!=r.height&&yt(r,n)})}function di(e,t,i,r){var n=e.display;if(!i&&ye(t).getAttribute("cm-not-content")=="true")return null;var T,j,Y=n.lineSpace.getBoundingClientRect();try{T=t.clientX-Y.left,j=t.clientY-Y.top}catch(ve){return null}var Q=va(e,T,j),re;if(r&&Q.xRel>0&&(re=Ze(e.doc,Q.line).text).length==Q.ch){var ce=$(re,re.length,e.options.tabSize)-re.length;Q=Fe(Q.line,Math.max(0,Math.round((T-qa(e.display).left)/Ri(e.display))-ce))}return Q}function ci(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 cr(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)or&&Ji(e.doc,t)<n.viewTo&&Yr(e);else if(i<=n.viewFrom)or&&Vr(e.doc,i+r)>n.viewFrom?Yr(e):(n.viewFrom+=r,n.viewTo+=r);else if(t<=n.viewFrom&&i>=n.viewTo)Yr(e);else if(t<=n.viewFrom){var T=Un(e,i,i+r,1);T?(n.view=n.view.slice(T.index),n.viewFrom=T.lineN,n.viewTo+=r):Yr(e)}else if(i>=n.viewTo){var j=Un(e,t,t,-1);j?(n.view=n.view.slice(0,j.index),n.viewTo=j.lineN):Yr(e)}else{var Y=Un(e,t,t,-1),Q=Un(e,i,i+r,1);Y&&Q?(n.view=n.view.slice(0,Y.index).concat(dr(e,Y.lineN,Q.lineN)).concat(n.view.slice(Q.index)),n.viewTo+=r):Yr(e)}var re=n.externalMeasured;re&&(i<re.lineN?re.lineN+=r:t<re.lineN+re.size&&(n.externalMeasured=null))}function Xr(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 T=r.view[ci(e,t)];if(T.node==null)return;var j=T.changes||(T.changes=[]);he(j,i)==-1&&j.push(i)}function Yr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Un(e,t,i,r){var n=ci(e,t),T,j=e.display.view;if(!or||i==e.doc.first+e.doc.size)return{index:n,lineN:i};for(var Y=e.display.viewFrom,Q=0;Q<n;Q++)Y+=j[Q].size;if(Y!=t){if(r>0){if(n==j.length-1)return null;T=Y+j[n].size-t,n++}else T=Y-t;t+=T,i+=T}for(;Ji(e.doc,i)!=i;){if(n==(r<0?0:j.length-1))return null;i+=r*j[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=dr(e,t,i),r.viewFrom=t):(r.viewFrom>t?r.view=dr(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(ci(e,t))),r.viewFrom=t,r.viewTo<i?r.view=r.view.concat(dr(e,r.viewTo,i)):r.viewTo>i&&(r.view=r.view.slice(0,ci(e,i)))),r.viewTo=i}function po(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 on(e){e.display.input.showSelection(e.display.input.prepareSelection())}function mo(e,t){t===void 0&&(t=!0);for(var i=e.doc,r={},n=r.cursors=document.createDocumentFragment(),T=r.selection=document.createDocumentFragment(),j=0;j<i.sel.ranges.length;j++){if(!t&&j==i.sel.primIndex)continue;var Y=i.sel.ranges[j];if(Y.from().line>=e.display.viewTo||Y.to().line<e.display.viewFrom)continue;var Q=Y.empty();(Q||e.options.showCursorWhenSelecting)&&go(e,Y.head,n),Q||Xs(e,Y,T)}return r}function go(e,t,i){var r=_r(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),n=i.appendChild(a("div","\xA0","CodeMirror-cursor"));if(n.style.left=r.left+"px",n.style.top=r.top+"px",n.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px",r.other){var T=i.appendChild(a("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));T.style.display="",T.style.left=r.other.left+"px",T.style.top=r.other.top+"px",T.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function jn(e,t){return e.top-t.top||e.left-t.left}function Xs(e,t,i){var r=e.display,n=e.doc,T=document.createDocumentFragment(),j=qa(e.display),Y=j.left,Q=Math.max(r.sizerWidth,ui(e)-r.sizer.offsetLeft)-j.right,re=n.direction=="ltr";function ce($e,it,dt,ut){it<0&&(it=0),it=Math.round(it),ut=Math.round(ut),T.appendChild(a("div",null,"CodeMirror-selected","position: absolute; left: "+$e+`px;
|
|
top: `+it+"px; width: "+(dt==null?Q-$e:dt)+`px;
|
|
height: `+(ut-it)+"px"))}function ve($e,it,dt){var ut=Ze(n,$e),Et=ut.text.length,Pt,$t;function Bt(Wt,mr){return ma(e,Fe($e,Wt),"div",ut,mr)}function yr(Wt,mr,qt){var zt=co(e,ut,null,Wt),Ht=mr=="ltr"==(qt=="after")?"left":"right",Ft=qt=="after"?zt.begin:zt.end-(/\s/.test(ut.text.charAt(zt.end-1))?2:1);return Bt(Ft,Ht)[Ht]}var pr=je(ut,n.direction);return Ve(pr,it||0,dt==null?Et:dt,function(Wt,mr,qt,zt){var Ht=qt=="ltr",Ft=Bt(Wt,Ht?"left":"right"),gr=Bt(mr-1,Ht?"right":"left"),Gi=it==null&&Wt==0,ei=dt==null&&mr==Et,rr=zt==0,Br=!pr||zt==pr.length-1;if(gr.top-Ft.top<=3){var Zt=(re?Gi:ei)&&rr,Va=(re?ei:Gi)&&Br,zr=Zt?Y:(Ht?Ft:gr).left,vi=Va?Q:(Ht?gr:Ft).right;ce(zr,Ft.top,vi-zr,Ft.bottom)}else{var yi,lr,zi,Xa;Ht?(yi=re&&Gi&&rr?Y:Ft.left,lr=re?Q:yr(Wt,qt,"before"),zi=re?Y:yr(mr,qt,"after"),Xa=re&&ei&&Br?Q:gr.right):(yi=re?yr(Wt,qt,"before"):Y,lr=!re&&Gi&&rr?Q:Ft.right,zi=!re&&ei&&Br?Y:gr.left,Xa=re?yr(mr,qt,"after"):Q),ce(yi,Ft.top,lr-yi,Ft.bottom),Ft.bottom<gr.top&&ce(Y,Ft.bottom,null,gr.top),ce(zi,gr.top,Xa-zi,gr.bottom)}(!Pt||jn(Ft,Pt)<0)&&(Pt=Ft),jn(gr,Pt)<0&&(Pt=gr),(!$t||jn(Ft,$t)<0)&&($t=Ft),jn(gr,$t)<0&&($t=gr)}),{start:Pt,end:$t}}var Ae=t.from(),Te=t.to();if(Ae.line==Te.line)ve(Ae.line,Ae.ch,Te.ch);else{var Ie=Ze(n,Ae.line),Ne=Ze(n,Te.line),Ge=xr(Ie)==xr(Ne),Ye=ve(Ae.line,Ae.ch,Ge?Ie.text.length+1:null).end,et=ve(Te.line,Ge?0:null,Te.ch).start;Ge&&(Ye.top<et.top-2?(ce(Ye.right,Ye.top,null,Ye.bottom),ce(Y,et.top,et.left,et.bottom)):ce(Ye.right,Ye.top,et.left-Ye.right,Ye.bottom)),Ye.bottom<et.top&&ce(Y,Ye.bottom,null,et.top)}i.appendChild(T)}function Sa(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()||_i(e),t.cursorDiv.style.visibility=(i=!i)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}function vo(e){e.state.focused||(e.display.input.focus(),Ta(e))}function yo(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,_i(e))},100)}function Ta(e,t){if(e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),e.options.readOnly=="nocursor")return;e.state.focused||(se(e,"focus",e,t),e.state.focused=!0,W(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),B&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Sa(e)}function _i(e,t){if(e.state.delayingBlurEvent)return;e.state.focused&&(se(e,"blur",e,t),e.state.focused=!1,f(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function Wn(e){for(var t=e.display,i=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var n=t.view[r],T=e.options.lineWrapping,j=void 0,Y=0;if(n.hidden)continue;if(z&&H<8){var Q=n.node.offsetTop+n.node.offsetHeight;j=Q-i,i=Q}else{var re=n.node.getBoundingClientRect();j=re.bottom-re.top,!T&&n.text.firstChild&&(Y=n.text.firstChild.getBoundingClientRect().right-re.left-1)}var ce=n.line.height-j;if((ce>.005||ce<-.005)&&(yt(n.line,j),bo(n.line),n.rest))for(var ve=0;ve<n.rest.length;ve++)bo(n.rest[ve]);if(Y>e.display.sizerWidth){var Ae=Math.ceil(Y/Ri(e.display));Ae>e.display.maxLineLength&&(e.display.maxLineLength=Ae,e.display.maxLine=n.line,e.display.maxLineChanged=!0)}}}function bo(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 Hn(e,t,i){var r=i&&i.top!=null?Math.max(0,i.top):e.scroller.scrollTop;r=Math.floor(r-Bn(e));var n=i&&i.bottom!=null?i.bottom:r+e.wrapper.clientHeight,T=kt(t,r),j=kt(t,n);if(i&&i.ensure){var Y=i.ensure.from.line,Q=i.ensure.to.line;Y<T?(T=Y,j=kt(t,Rr(Ze(t,Y))+e.wrapper.clientHeight)):Math.min(Q,t.lastLine())>=j&&(T=kt(t,Rr(Ze(t,Q))-e.wrapper.clientHeight),j=Q)}return{from:T,to:Math.max(j,T+1)}}function Ys(e,t){if(q(e,"scrollCursorIntoView"))return;var i=e.display,r=i.sizer.getBoundingClientRect(),n=null;if(t.top+r.top<0?n=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(n=!1),n!=null&&!w){var T=a("div","\u200B",null,`position: absolute;
|
|
top: `+(t.top-i.viewOffset-Bn(e.display))+`px;
|
|
height: `+(t.bottom-t.top+Ir(e)+i.barHeight)+`px;
|
|
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(T),T.scrollIntoView(n),e.display.lineSpace.removeChild(T)}}function $s(e,t,i,r){r==null&&(r=0);var n;!e.options.lineWrapping&&t==i&&(t=t.ch?Fe(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t,i=t.sticky=="before"?Fe(t.line,t.ch+1,"before"):t);for(var T=0;T<5;T++){var j=!1,Y=_r(e,t),Q=!i||i==t?Y:_r(e,i);n={left:Math.min(Y.left,Q.left),top:Math.min(Y.top,Q.top)-r,right:Math.max(Y.left,Q.left),bottom:Math.max(Y.bottom,Q.bottom)+r};var re=Ca(e,n),ce=e.doc.scrollTop,ve=e.doc.scrollLeft;if(re.scrollTop!=null&&(ln(e,re.scrollTop),Math.abs(e.doc.scrollTop-ce)>1&&(j=!0)),re.scrollLeft!=null&&(fi(e,re.scrollLeft),Math.abs(e.doc.scrollLeft-ve)>1&&(j=!0)),!j)break}return n}function Zs(e,t){var i=Ca(e,t);i.scrollTop!=null&&ln(e,i.scrollTop),i.scrollLeft!=null&&fi(e,i.scrollLeft)}function Ca(e,t){var i=e.display,r=Di(e.display);t.top<0&&(t.top=0);var n=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:i.scroller.scrollTop,T=ca(e),j={};t.bottom-t.top>T&&(t.bottom=t.top+T);var Y=e.doc.height+da(i),Q=t.top<r,re=t.bottom>Y-r;if(t.top<n)j.scrollTop=Q?0:t.top;else if(t.bottom>n+T){var ce=Math.min(t.top,(re?Y:t.bottom)-T);ce!=n&&(j.scrollTop=ce)}var ve=e.options.fixedGutter?0:i.gutters.offsetWidth,Ae=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:i.scroller.scrollLeft-ve,Te=ui(e)-i.gutters.offsetWidth,Ie=t.right-t.left>Te;return Ie&&(t.right=t.left+Te),t.left<10?j.scrollLeft=0:t.left<Ae?j.scrollLeft=Math.max(0,t.left+ve-(Ie?0:10)):t.right>Te+Ae-3&&(j.scrollLeft=t.right+(Ie?0:10)-Te),j}function wa(e,t){if(t==null)return;Gn(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t}function Oi(e){Gn(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function sn(e,t,i){(t!=null||i!=null)&&Gn(e),t!=null&&(e.curOp.scrollLeft=t),i!=null&&(e.curOp.scrollTop=i)}function Qs(e,t){Gn(e),e.curOp.scrollToPos=t}function Gn(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var i=uo(e,t.from),r=uo(e,t.to);xo(e,i,r,t.margin)}}function xo(e,t,i,r){var n=Ca(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});sn(e,n.scrollLeft,n.scrollTop)}function ln(e,t){if(Math.abs(e.doc.scrollTop-t)<2)return;_||La(e,{top:t}),Eo(e,t,!0),_&&La(e),dn(e,100)}function Eo(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,Ao(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t)}function un(e){var t=e.display,i=t.gutters.offsetWidth,r=Math.round(e.doc.height+da(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+Ir(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:i}}var pi=function(e,t,i){this.cm=i;var r=this.vert=a("div",[a("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),n=this.horiz=a("div",[a("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=n.tabIndex=-1,e(r),e(n),ke(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),ke(n,"scroll",function(){n.clientWidth&&t(n.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,z&&H<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};pi.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 T=e.viewWidth-e.barLeft-(i?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+T)+"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}},pi.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},pi.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},pi.prototype.zeroWidthHack=function(){var e=l&&!L?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new ae,this.disableVert=new ae},pi.prototype.enableZeroWidthBar=function(e,t,i){e.style.pointerEvents="auto";function r(){var n=e.getBoundingClientRect(),T=i=="vert"?document.elementFromPoint(n.right-1,(n.top+n.bottom)/2):document.elementFromPoint((n.right+n.left)/2,n.bottom-1);T!=e?e.style.pointerEvents="none":t.set(1e3,r)}t.set(1e3,r)},pi.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var hn=function(){};hn.prototype.update=function(){return{bottom:0,right:0}},hn.prototype.setScrollLeft=function(){},hn.prototype.setScrollTop=function(){},hn.prototype.clear=function(){};function Mi(e,t){t||(t=un(e));var i=e.display.barWidth,r=e.display.barHeight;So(e,t);for(var n=0;n<4&&i!=e.display.barWidth||r!=e.display.barHeight;n++)i!=e.display.barWidth&&e.options.lineWrapping&&Wn(e),So(e,un(e)),i=e.display.barWidth,r=e.display.barHeight}function So(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 To={native:pi,null:hn};function Co(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&f(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new To[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),ke(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):ln(e,t)},e),e.display.scrollbars.addClass&&W(e.display.wrapper,e.display.scrollbars.addClass)}var Js=0;function mi(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},Cr(e.curOp)}function gi(e){var t=e.curOp;t&&_s(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 T=0;T<t.length;T++)il(t[T]);for(var j=0;j<t.length;j++)nl(t[j])}function el(e){var t=e.cm,i=t.display;ol(t),e.updateMaxLine&&Nn(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 zn(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function tl(e){e.updatedDisplay=e.mustUpdate&&Aa(e.cm,e.update)}function rl(e){var t=e.cm,i=t.display;e.updatedDisplay&&Wn(t),e.barMeasure=un(t),i.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=to(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+Ir(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,i.sizer.offsetLeft+e.adjustWidthTo-ui(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==F();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,i),(e.updatedDisplay||e.startHeight!=t.doc.height)&&Mi(t,e.barMeasure),e.updatedDisplay&&Da(t,e.barMeasure),e.selectionChanged&&Sa(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),i&&vo(e.cm)}function nl(e){var t=e.cm,i=t.display,r=t.doc;if(e.updatedDisplay&&wo(t,e.update),i.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(i.wheelStartX=i.wheelStartY=null),e.scrollTop!=null&&Eo(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&fi(t,e.scrollLeft,!0,!0),e.scrollToPos){var n=$s(t,mt(r,e.scrollToPos.from),mt(r,e.scrollToPos.to),e.scrollToPos.margin);Ys(t,n)}var T=e.maybeHiddenMarkers,j=e.maybeUnhiddenMarkers;if(T)for(var Y=0;Y<T.length;++Y)T[Y].lines.length||se(T[Y],"hide");if(j)for(var Q=0;Q<j.length;++Q)j[Q].lines.length&&se(j[Q],"unhide");i.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&se(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function vr(e,t){if(e.curOp)return t();mi(e);try{return t()}finally{gi(e)}}function Xt(e,t){return function(){if(e.curOp)return t.apply(e,arguments);mi(e);try{return t.apply(e,arguments)}finally{gi(e)}}}function sr(e){return function(){if(this.curOp)return e.apply(this,arguments);mi(this);try{return e.apply(this,arguments)}finally{gi(this)}}}function Yt(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);mi(t);try{return e.apply(this,arguments)}finally{gi(t)}}}function dn(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,M(al,e))}function al(e){var t=e.doc;if(t.highlightFrontier>=e.display.viewTo)return;var i=+new Date+e.options.workTime,r=Ar(e,t.highlightFrontier),n=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(T){if(r.line>=e.display.viewFrom){var j=T.styles,Y=T.text.length>e.options.maxHighlightLength?Vt(t.mode,r.state):null,Q=Ki(e,T,r,!0);Y&&(r.state=Y),T.styles=Q.styles;var re=T.styleClasses,ce=Q.classes;ce?T.styleClasses=ce:re&&(T.styleClasses=null);for(var ve=!j||j.length!=T.styles.length||re!=ce&&(!re||!ce||re.bgClass!=ce.bgClass||re.textClass!=ce.textClass),Ae=0;!ve&&Ae<j.length;++Ae)ve=j[Ae]!=T.styles[Ae];ve&&n.push(r.line),T.stateAfter=r.save(),r.nextLine()}else T.text.length<=e.options.maxHighlightLength&&Vi(e,T.text,r),T.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>i)return dn(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),n.length&&vr(e,function(){for(var T=0;T<n.length;T++)Xr(e,n[T],"text")})}var zn=function(e,t,i){var r=e.display;this.viewport=t,this.visible=Hn(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=ui(e),this.force=i,this.dims=ba(e),this.events=[]};zn.prototype.signal=function(e,t){ne(e,t)&&this.events.push(arguments)},zn.prototype.finish=function(){for(var e=0;e<this.events.length;e++)se.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=Ir(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Ir(e)+"px",t.scrollbarsClipped=!0)}function sl(e){if(e.hasFocus())return null;var t=F();if(!t||!S(e.display.lineDiv,t))return null;var i={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&S(e.display.lineDiv,r.anchorNode)&&(i.anchorNode=r.anchorNode,i.anchorOffset=r.anchorOffset,i.focusNode=r.focusNode,i.focusOffset=r.focusOffset)}return i}function ll(e){if(!e||!e.activeElt||e.activeElt==F())return;if(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&S(document.body,e.anchorNode)&&S(document.body,e.focusNode)){var t=window.getSelection(),i=document.createRange();i.setEnd(e.anchorNode,e.anchorOffset),i.collapse(!1),t.removeAllRanges(),t.addRange(i),t.extend(e.focusNode,e.focusOffset)}}function Aa(e,t){var i=e.display,r=e.doc;if(t.editorIsHidden)return Yr(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&&po(e)==0)return!1;Lo(e)&&(Yr(e),t.dims=ba(e));var n=r.first+r.size,T=Math.max(t.visible.from-e.options.viewportMargin,r.first),j=Math.min(n,t.visible.to+e.options.viewportMargin);i.viewFrom<T&&T-i.viewFrom<20&&(T=Math.max(r.first,i.viewFrom)),i.viewTo>j&&i.viewTo-j<20&&(j=Math.min(n,i.viewTo)),or&&(T=Ji(e.doc,T),j=Vr(e.doc,j));var Y=T!=i.viewFrom||j!=i.viewTo||i.lastWrapHeight!=t.wrapperHeight||i.lastWrapWidth!=t.wrapperWidth;Vs(e,T,j),i.viewOffset=Rr(Ze(e.doc,i.viewFrom)),e.display.mover.style.top=i.viewOffset+"px";var Q=po(e);if(!Y&&Q==0&&!t.force&&i.renderedView==i.view&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo))return!1;var re=sl(e);return Q>4&&(i.lineDiv.style.display="none"),ul(e,i.updateLineNumbers,t.dims),Q>4&&(i.lineDiv.style.display=""),i.renderedView=i.view,ll(re),p(i.cursorDiv),p(i.selectionDiv),i.gutters.style.height=i.sizer.style.minHeight=0,Y&&(i.lastWrapHeight=t.wrapperHeight,i.lastWrapWidth=t.wrapperWidth,dn(e,400)),i.updateLineNumbers=null,!0}function wo(e,t){for(var i=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==ui(e)){if(i&&i.top!=null&&(i={top:Math.min(e.doc.height+da(e.display)-ca(e),i.top)}),t.visible=Hn(e.display,e.doc,i),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=Hn(e.display,e.doc,i));if(!Aa(e,t))break;Wn(e);var n=un(e);on(e),Mi(e,n),Da(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 La(e,t){var i=new zn(e,t);if(Aa(e,i)){Wn(e),wo(e,i);var r=un(e);on(e),Mi(e,r),Da(e,r),i.finish()}}function ul(e,t,i){var r=e.display,n=e.options.lineNumbers,T=r.lineDiv,j=T.firstChild;function Y(Ie){var Ne=Ie.nextSibling;return B&&l&&e.display.currentWheelTarget==Ie?Ie.style.display="none":Ie.parentNode.removeChild(Ie),Ne}for(var Q=r.view,re=r.viewFrom,ce=0;ce<Q.length;ce++){var ve=Q[ce];if(!ve.hidden)if(!ve.node||ve.node.parentNode!=T){var Ae=Ns(e,ve,re,i);T.insertBefore(Ae,j)}else{for(;j!=ve.node;)j=Y(j);var Te=n&&t!=null&&t<=re&&ve.lineNumber;ve.changes&&(he(ve.changes,"gutter")>-1&&(Te=!1),Ya(e,ve,re,i)),Te&&(p(ve.lineNumber),ve.lineNumber.appendChild(document.createTextNode(jt(e.options,re)))),j=ve.node.nextSibling}re+=ve.size}for(;j;)j=Y(j)}function ka(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Da(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+Ir(e)+"px"}function Ao(e){var t=e.display,i=t.view;if(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))return;for(var r=xa(t)-t.scroller.scrollLeft+e.doc.scrollLeft,n=t.gutters.offsetWidth,T=r+"px",j=0;j<i.length;j++)if(!i[j].hidden){e.options.fixedGutter&&(i[j].gutter&&(i[j].gutter.style.left=T),i[j].gutterBackground&&(i[j].gutterBackground.style.left=T));var Y=i[j].alignable;if(Y)for(var Q=0;Q<Y.length;Q++)Y[Q].style.left=T}e.options.fixedGutter&&(t.gutters.style.left=r+n+"px")}function Lo(e){if(!e.options.lineNumbers)return!1;var t=e.doc,i=jt(e.options,t.first+t.size-1),r=e.display;if(i.length!=r.lineNumChars){var n=r.measure.appendChild(a("div",[a("div",i)],"CodeMirror-linenumber CodeMirror-gutter-elt")),T=n.firstChild.offsetWidth,j=n.offsetWidth-T;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(T,r.lineGutter.offsetWidth-j)+1,r.lineNumWidth=r.lineNumInnerWidth+j,r.lineNumChars=r.lineNumInnerWidth?i.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",ka(e.display),!0}return!1}function Ra(e,t){for(var i=[],r=!1,n=0;n<e.length;n++){var T=e[n],j=null;if(typeof T!="string"&&(j=T.style,T=T.className),T=="CodeMirror-linenumbers")if(t)r=!0;else continue;i.push({className:T,style:j})}return t&&!r&&i.push({className:"CodeMirror-linenumbers",style:null}),i}function ko(e){var t=e.gutters,i=e.gutterSpecs;p(t),e.lineGutter=null;for(var r=0;r<i.length;++r){var n=i[r],T=n.className,j=n.style,Y=t.appendChild(a("div",null,"CodeMirror-gutter "+T));j&&(Y.style.cssText=j),T=="CodeMirror-linenumbers"&&(e.lineGutter=Y,Y.style.width=(e.lineNumWidth||1)+"px")}t.style.display=i.length?"":"none",ka(e)}function cn(e){ko(e.display),cr(e),Ao(e)}function hl(e,t,i,r){var n=this;this.input=i,n.scrollbarFiller=a("div",null,"CodeMirror-scrollbar-filler"),n.scrollbarFiller.setAttribute("cm-not-content","true"),n.gutterFiller=a("div",null,"CodeMirror-gutter-filler"),n.gutterFiller.setAttribute("cm-not-content","true"),n.lineDiv=E("div",null,"CodeMirror-code"),n.selectionDiv=a("div",null,null,"position: relative; z-index: 1"),n.cursorDiv=a("div",null,"CodeMirror-cursors"),n.measure=a("div",null,"CodeMirror-measure"),n.lineMeasure=a("div",null,"CodeMirror-measure"),n.lineSpace=E("div",[n.measure,n.lineMeasure,n.selectionDiv,n.cursorDiv,n.lineDiv],null,"position: relative; outline: none");var T=E("div",[n.lineSpace],"CodeMirror-lines");n.mover=a("div",[T],null,"position: relative"),n.sizer=a("div",[n.mover],"CodeMirror-sizer"),n.sizerWidth=null,n.heightForcer=a("div",null,null,"position: absolute; height: "+ge+"px; width: 1px;"),n.gutters=a("div",null,"CodeMirror-gutters"),n.lineGutter=null,n.scroller=a("div",[n.sizer,n.heightForcer,n.gutters],"CodeMirror-scroll"),n.scroller.setAttribute("tabIndex","-1"),n.wrapper=a("div",[n.scrollbarFiller,n.gutterFiller,n.scroller],"CodeMirror"),z&&H<8&&(n.gutters.style.zIndex=-1,n.scroller.style.paddingRight=0),!B&&!(_&&o)&&(n.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(n.wrapper):e(n.wrapper)),n.viewFrom=n.viewTo=t.first,n.reportedViewFrom=n.reportedViewTo=t.first,n.view=[],n.renderedView=null,n.externalMeasured=null,n.viewOffset=0,n.lastWrapHeight=n.lastWrapWidth=0,n.updateLineNumbers=null,n.nativeBarWidth=n.barHeight=n.barWidth=0,n.scrollbarsClipped=!1,n.lineNumWidth=n.lineNumInnerWidth=n.lineNumChars=null,n.alignWidgets=!1,n.cachedCharWidth=n.cachedTextHeight=n.cachedPaddingH=null,n.maxLine=null,n.maxLineLength=0,n.maxLineChanged=!1,n.wheelDX=n.wheelDY=n.wheelStartX=n.wheelStartY=null,n.shift=!1,n.selForContextMenu=null,n.activeTouch=null,n.gutterSpecs=Ra(r.gutters,r.lineNumbers),ko(n),i.init(n)}var Kn=0,Er=null;z?Er=-.53:_?Er=15:b?Er=-.7:P&&(Er=-1/3);function Do(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=Do(e);return t.x*=Er,t.y*=Er,t}function Ro(e,t){var i=Do(t),r=i.x,n=i.y,T=e.display,j=T.scroller,Y=j.scrollWidth>j.clientWidth,Q=j.scrollHeight>j.clientHeight;if(!(r&&Y||n&&Q))return;if(n&&l&&B){e:for(var re=t.target,ce=T.view;re!=j;re=re.parentNode)for(var ve=0;ve<ce.length;ve++)if(ce[ve].node==re){e.display.currentWheelTarget=re;break e}}if(r&&!_&&!A&&Er!=null){n&&Q&&ln(e,Math.max(0,j.scrollTop+n*Er)),fi(e,Math.max(0,j.scrollLeft+r*Er)),(!n||n&&Q)&&te(t),T.wheelStartX=null;return}if(n&&Er!=null){var Ae=n*Er,Te=e.doc.scrollTop,Ie=Te+T.wrapper.clientHeight;Ae<0?Te=Math.max(0,Te+Ae-50):Ie=Math.min(e.doc.height,Ie+Ae+50),La(e,{top:Te,bottom:Ie})}Kn<20&&(T.wheelStartX==null?(T.wheelStartX=j.scrollLeft,T.wheelStartY=j.scrollTop,T.wheelDX=r,T.wheelDY=n,setTimeout(function(){if(T.wheelStartX==null)return;var Ne=j.scrollLeft-T.wheelStartX,Ge=j.scrollTop-T.wheelStartY,Ye=Ge&&T.wheelDY&&Ge/T.wheelDY||Ne&&T.wheelDX&&Ne/T.wheelDX;if(T.wheelStartX=T.wheelStartY=null,!Ye)return;Er=(Er*Kn+Ye)/(Kn+1),++Kn},200)):(T.wheelDX+=r,T.wheelDY+=n))}var Sr=function(e,t){this.ranges=e,this.primIndex=t};Sr.prototype.primary=function(){return this.ranges[this.primIndex]},Sr.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(!ri(i.anchor,r.anchor)||!ri(i.head,r.head))return!1}return!0},Sr.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new Rt(bi(this.ranges[t].anchor),bi(this.ranges[t].head));return new Sr(e,this.primIndex)},Sr.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},Sr.prototype.contains=function(e,t){t||(t=e);for(var i=0;i<this.ranges.length;i++){var r=this.ranges[i];if(ct(t,r.from())>=0&&ct(e,r.to())<=0)return i}return-1};var Rt=function(e,t){this.anchor=e,this.head=t};Rt.prototype.from=function(){return ii(this.anchor,this.head)},Rt.prototype.to=function(){return xi(this.anchor,this.head)},Rt.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Or(e,t,i){var r=e&&e.options.selectionsMayTouch,n=t[i];t.sort(function(Ae,Te){return ct(Ae.from(),Te.from())}),i=he(t,n);for(var T=1;T<t.length;T++){var j=t[T],Y=t[T-1],Q=ct(Y.to(),j.from());if(r&&!j.empty()?Q>0:Q>=0){var re=ii(Y.from(),j.from()),ce=xi(Y.to(),j.to()),ve=Y.empty()?j.from()==j.head:Y.from()==Y.head;T<=i&&--i,t.splice(--T,2,new Rt(ve?ce:re,ve?re:ce))}}return new Sr(t,i)}function $r(e,t){return new Sr([new Rt(e,t||e)],0)}function Zr(e){return e.text?Fe(e.from.line+e.text.length-1,s(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function _o(e,t){if(ct(e,t.from)<0)return e;if(ct(e,t.to)<=0)return Zr(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+=Zr(t).ch-t.to.ch),Fe(i,r)}function _a(e,t){for(var i=[],r=0;r<e.sel.ranges.length;r++){var n=e.sel.ranges[r];i.push(new Rt(_o(n.anchor,t),_o(n.head,t)))}return Or(e.cm,i,e.sel.primIndex)}function Oo(e,t,i){return e.line==t.line?Fe(i.line,e.ch-t.ch+i.ch):Fe(i.line+(e.line-t.line),e.ch)}function cl(e,t,i){for(var r=[],n=Fe(e.first,0),T=n,j=0;j<t.length;j++){var Y=t[j],Q=Oo(Y.from,n,T),re=Oo(Zr(Y),n,T);if(n=Y.to,T=re,i=="around"){var ce=e.sel.ranges[j],ve=ct(ce.head,ce.anchor)<0;r[j]=new Rt(ve?re:Q,ve?Q:re)}else r[j]=new Rt(Q,Q)}return new Sr(r,e.sel.primIndex)}function Oa(e){e.doc.mode=Ot(e.options,e.doc.modeOption),fn(e)}function fn(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,dn(e,100),e.state.modeGen++,e.curOp&&cr(e)}function Mo(e,t){return t.from.ch==0&&t.to.ch==0&&s(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Ma(e,t,i,r){function n(et){return i?i[et]:null}function T(et,$e,it){ua(et,$e,it,r),Jt(et,"change",et,t)}function j(et,$e){for(var it=[],dt=et;dt<$e;++dt)it.push(new li(re[dt],n(dt),r));return it}var Y=t.from,Q=t.to,re=t.text,ce=Ze(e,Y.line),ve=Ze(e,Q.line),Ae=s(re),Te=n(re.length-1),Ie=Q.line-Y.line;if(t.full)e.insert(0,j(0,re.length)),e.remove(re.length,e.size-re.length);else if(Mo(e,t)){var Ne=j(0,re.length-1);T(ve,ve.text,Te),Ie&&e.remove(Y.line,Ie),Ne.length&&e.insert(Y.line,Ne)}else if(ce==ve)if(re.length==1)T(ce,ce.text.slice(0,Y.ch)+Ae+ce.text.slice(Q.ch),Te);else{var Ge=j(1,re.length-1);Ge.push(new li(Ae+ce.text.slice(Q.ch),Te,r)),T(ce,ce.text.slice(0,Y.ch)+re[0],n(0)),e.insert(Y.line+1,Ge)}else if(re.length==1)T(ce,ce.text.slice(0,Y.ch)+re[0]+ve.text.slice(Q.ch),n(0)),e.remove(Y.line+1,Ie);else{T(ce,ce.text.slice(0,Y.ch)+re[0],n(0)),T(ve,Ae+ve.text.slice(Q.ch),Te);var Ye=j(1,re.length-1);Ie>1&&e.remove(Y.line+1,Ie-1),e.insert(Y.line+1,Ye)}Jt(e,"change",e,t)}function Qr(e,t,i){function r(n,T,j){if(n.linked)for(var Y=0;Y<n.linked.length;++Y){var Q=n.linked[Y];if(Q.doc==T)continue;var re=j&&Q.sharedHist;if(i&&!re)continue;t(Q.doc,re),r(Q.doc,n,re)}}r(e,null,!0)}function Po(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,Ea(e),Oa(e),Io(e),e.options.lineWrapping||Nn(e),e.options.mode=t.modeOption,cr(e)}function Io(e){(e.doc.direction=="rtl"?W:f)(e.display.lineDiv,"CodeMirror-rtl")}function fl(e){vr(e,function(){Io(e),cr(e)})}function Vn(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 Pa(e,t){var i={from:bi(t.from),to:Zr(t),text:At(e,t.from,t.to)};return Fo(e,i,t.from.line,t.to.line+1),Qr(e,function(r){return Fo(r,i,t.from.line,t.to.line+1)},!0),i}function No(e){for(;e.length;){var t=s(e);if(t.ranges)e.pop();else break}}function pl(e,t){if(t)return No(e.done),s(e.done);if(e.done.length&&!s(e.done).ranges)return s(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),s(e.done)}function Bo(e,t,i,r){var n=e.history;n.undone.length=0;var T=+new Date,j,Y;if((n.lastOp==r||n.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&n.lastModTime>T-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(j=pl(n,n.lastOp==r)))Y=s(j.changes),ct(t.from,t.to)==0&&ct(t.from,Y.to)==0?Y.to=Zr(t):j.changes.push(Pa(e,t));else{var Q=s(n.done);for((!Q||!Q.ranges)&&Xn(e.sel,n.done),j={changes:[Pa(e,t)],generation:n.generation},n.done.push(j);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=T,n.lastOp=n.lastSelOp=r,n.lastOrigin=n.lastSelOrigin=t.origin,Y||se(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,T=r&&r.origin;i==n.lastSelOp||T&&n.lastSelOrigin==T&&(n.lastModTime==n.lastSelTime&&n.lastOrigin==T||ml(e,T,s(n.done),t))?n.done[n.done.length-1]=t:Xn(t,n.done),n.lastSelTime=+new Date,n.lastSelOrigin=T,n.lastSelOp=i,r&&r.clearRedo!==!1&&No(n.undone)}function Xn(e,t){var i=s(t);i&&i.ranges&&i.equals(e)||t.push(e)}function Fo(e,t,i,r){var n=t["spans_"+e.id],T=0;e.iter(Math.max(e.first,i),Math.min(e.first+e.size,r),function(j){j.markedSpans&&((n||(n=t["spans_"+e.id]={}))[T]=j.markedSpans),++T})}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 Uo(e,t){var i=yl(e,t),r=Ti(e,t);if(!i)return r;if(!r)return i;for(var n=0;n<i.length;++n){var T=i[n],j=r[n];if(T&&j){e:for(var Y=0;Y<j.length;++Y){for(var Q=j[Y],re=0;re<T.length;++re)if(T[re].marker==Q.marker)continue e;T.push(Q)}}else j&&(i[n]=j)}return i}function Pi(e,t,i){for(var r=[],n=0;n<e.length;++n){var T=e[n];if(T.ranges){r.push(i?Sr.prototype.deepCopy.call(T):T);continue}var j=T.changes,Y=[];r.push({changes:Y});for(var Q=0;Q<j.length;++Q){var re=j[Q],ce=void 0;if(Y.push({from:re.from,to:re.to,text:re.text}),t)for(var ve in re)(ce=ve.match(/^spans_(\d+)$/))&&(he(t,Number(ce[1]))>-1&&(s(Y)[ve]=re[ve],delete re[ve]))}}return r}function Ia(e,t,i,r){if(r){var n=e.anchor;if(i){var T=ct(t,n)<0;T!=ct(i,n)<0?(n=t,t=i):T!=ct(t,i)<0&&(t=i)}return new Rt(n,t)}else return new Rt(i||t,t)}function Yn(e,t,i,r,n){n==null&&(n=e.cm&&(e.cm.display.shift||e.extend)),tr(e,new Sr([Ia(e.sel.primary(),t,i,n)],0),r)}function jo(e,t,i){for(var r=[],n=e.cm&&(e.cm.display.shift||e.extend),T=0;T<e.sel.ranges.length;T++)r[T]=Ia(e.sel.ranges[T],t[T],null,n);var j=Or(e.cm,r,e.sel.primIndex);tr(e,j,i)}function Na(e,t,i,r){var n=e.sel.ranges.slice(0);n[t]=i,tr(e,Or(e.cm,n,e.sel.primIndex),r)}function Wo(e,t,i,r){tr(e,$r(t,i),r)}function bl(e,t,i){var r={ranges:t.ranges,update:function(n){this.ranges=[];for(var T=0;T<n.length;T++)this.ranges[T]=new Rt(mt(e,n[T].anchor),mt(e,n[T].head))},origin:i&&i.origin};return se(e,"beforeSelectionChange",e,r),e.cm&&se(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?Or(e.cm,r.ranges,r.ranges.length-1):t}function Ho(e,t,i){var r=e.history.done,n=s(r);n&&n.ranges?(r[r.length-1]=t,$n(e,t,i)):tr(e,t,i)}function tr(e,t,i){$n(e,t,i),gl(e,e.sel,e.cm?e.cm.curOp.id:NaN,i)}function $n(e,t,i){(ne(e,"beforeSelectionChange")||e.cm&&ne(e.cm,"beforeSelectionChange"))&&(t=bl(e,t,i));var r=i&&i.bias||(ct(t.primary().head,e.sel.primary().head)<0?-1:1);Go(e,Ko(e,t,r,!0)),!(i&&i.scroll===!1)&&e.cm&&Oi(e.cm)}function Go(e,t){if(t.equals(e.sel))return;e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,ee(e.cm)),Jt(e,"cursorActivity",e)}function zo(e){Go(e,Ko(e,e.sel,null,!1))}function Ko(e,t,i,r){for(var n,T=0;T<t.ranges.length;T++){var j=t.ranges[T],Y=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[T],Q=Zn(e,j.anchor,Y&&Y.anchor,i,r),re=Zn(e,j.head,Y&&Y.head,i,r);(n||Q!=j.anchor||re!=j.head)&&(n||(n=t.ranges.slice(0,T)),n[T]=new Rt(Q,re))}return n?Or(e.cm,n,t.primIndex):t}function Ii(e,t,i,r,n){var T=Ze(e,t.line);if(T.markedSpans)for(var j=0;j<T.markedSpans.length;++j){var Y=T.markedSpans[j],Q=Y.marker,re="selectLeft"in Q?!Q.selectLeft:Q.inclusiveLeft,ce="selectRight"in Q?!Q.selectRight:Q.inclusiveRight;if((Y.from==null||(re?Y.from<=t.ch:Y.from<t.ch))&&(Y.to==null||(ce?Y.to>=t.ch:Y.to>t.ch))){if(n&&(se(Q,"beforeCursorEnter"),Q.explicitlyCleared))if(T.markedSpans){--j;continue}else break;if(!Q.atomic)continue;if(i){var ve=Q.find(r<0?1:-1),Ae=void 0;if((r<0?ce:re)&&(ve=Vo(e,ve,-r,ve&&ve.line==t.line?T:null)),ve&&ve.line==t.line&&(Ae=ct(ve,i))&&(r<0?Ae<0:Ae>0))return Ii(e,ve,t,r,n)}var Te=Q.find(r<0?-1:1);return(r<0?re:ce)&&(Te=Vo(e,Te,r,Te.line==t.line?T:null)),Te?Ii(e,Te,t,r,n):null}}return t}function Zn(e,t,i,r,n){var T=r||1,j=Ii(e,t,i,T,n)||!n&&Ii(e,t,i,T,!0)||Ii(e,t,i,-T,n)||!n&&Ii(e,t,i,-T,!0);return j||(e.cantEdit=!0,Fe(e.first,0))}function Vo(e,t,i,r){return i<0&&t.ch==0?t.line>e.first?mt(e,Fe(t.line-1)):null:i>0&&t.ch==(r||Ze(e,t.line)).text.length?t.line<e.first+e.size-1?Fe(t.line+1,0):null:new Fe(t.line,t.ch+i)}function Xo(e){e.setSelection(Fe(e.firstLine(),0),Fe(e.lastLine()),Se)}function Yo(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,T,j,Y){n&&(r.from=mt(e,n)),T&&(r.to=mt(e,T)),j&&(r.text=j),Y!==void 0&&(r.origin=Y)}),se(e,"beforeChange",e,r),e.cm&&se(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 Ni(e,t,i){if(e.cm){if(!e.cm.curOp)return Xt(e.cm,Ni)(e,t,i);if(e.cm.state.suppressEdits)return}if((ne(e,"beforeChange")||e.cm&&ne(e.cm,"beforeChange"))&&(t=Yo(e,t,!0),!t))return;var r=Zi&&!i&&Mn(e,t.from,t.to);if(r)for(var n=r.length-1;n>=0;--n)$o(e,{from:r[n].from,to:r[n].to,text:n?[""]:t.text,origin:t.origin});else $o(e,t)}function $o(e,t){if(t.text.length==1&&t.text[0]==""&&ct(t.from,t.to)==0)return;var i=_a(e,t);Bo(e,t,i,e.cm?e.cm.curOp.id:NaN),pn(e,t,i,Ti(e,t));var r=[];Qr(e,function(n,T){!T&&he(r,n.history)==-1&&(qo(n.history,t),r.push(n.history)),pn(n,t,null,Ti(n,t))})}function Qn(e,t,i){var r=e.cm&&e.cm.state.suppressEdits;if(r&&!i)return;for(var n=e.history,T,j=e.sel,Y=t=="undo"?n.done:n.undone,Q=t=="undo"?n.undone:n.done,re=0;re<Y.length&&!(T=Y[re],i?T.ranges&&!T.equals(e.sel):!T.ranges);re++);if(re==Y.length)return;for(n.lastOrigin=n.lastSelOrigin=null;;)if(T=Y.pop(),T.ranges){if(Xn(T,Q),i&&!T.equals(e.sel)){tr(e,T,{clearRedo:!1});return}j=T}else if(r){Y.push(T);return}else break;var ce=[];Xn(j,Q),Q.push({changes:ce,generation:n.generation}),n.generation=T.generation||++n.maxGeneration;for(var ve=ne(e,"beforeChange")||e.cm&&ne(e.cm,"beforeChange"),Ae=function(Ne){var Ge=T.changes[Ne];if(Ge.origin=t,ve&&!Yo(e,Ge,!1))return Y.length=0,{};ce.push(Pa(e,Ge));var Ye=Ne?_a(e,Ge):s(Y);pn(e,Ge,Ye,Uo(e,Ge)),!Ne&&e.cm&&e.cm.scrollIntoView({from:Ge.from,to:Zr(Ge)});var et=[];Qr(e,function($e,it){!it&&he(et,$e.history)==-1&&(qo($e.history,Ge),et.push($e.history)),pn($e,Ge,null,Uo($e,Ge))})},Te=T.changes.length-1;Te>=0;--Te){var Ie=Ae(Te);if(Ie)return Ie.v}}function Zo(e,t){if(t==0)return;if(e.first+=t,e.sel=new Sr(c(e.sel.ranges,function(n){return new Rt(Fe(n.anchor.line+t,n.anchor.ch),Fe(n.head.line+t,n.head.ch))}),e.sel.primIndex),e.cm){cr(e.cm,e.first,e.first-t,t);for(var i=e.cm.display,r=i.viewFrom;r<i.viewTo;r++)Xr(e.cm,r,"gutter")}}function pn(e,t,i,r){if(e.cm&&!e.cm.curOp)return Xt(e.cm,pn)(e,t,i,r);if(t.to.line<e.first){Zo(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);Zo(e,n),t={from:Fe(e.first,0),to:Fe(t.to.line+n,t.to.ch),text:[s(t.text)],origin:t.origin}}var T=e.lastLine();t.to.line>T&&(t={from:t.from,to:Fe(T,Ze(e,T).text.length),text:[t.text[0]],origin:t.origin}),t.removed=At(e,t.from,t.to),i||(i=_a(e,t)),e.cm?xl(e.cm,t,r):Ma(e,t,r),$n(e,i,Se),e.cantEdit&&Zn(e,Fe(e.firstLine(),0))&&(e.cantEdit=!1)}function xl(e,t,i){var r=e.doc,n=e.display,T=t.from,j=t.to,Y=!1,Q=T.line;e.options.lineWrapping||(Q=gt(xr(Ze(r,T.line))),r.iter(Q,j.line+1,function(Te){if(Te==n.maxLine)return Y=!0,!0})),r.sel.contains(t.from,t.to)>-1&&ee(e),Ma(r,t,i,fo(e)),e.options.lineWrapping||(r.iter(Q,T.line+t.text.length,function(Te){var Ie=en(Te);Ie>n.maxLineLength&&(n.maxLine=Te,n.maxLineLength=Ie,n.maxLineChanged=!0,Y=!1)}),Y&&(e.curOp.updateMaxLine=!0)),aa(r,T.line),dn(e,400);var re=t.text.length-(j.line-T.line)-1;t.full?cr(e):T.line==j.line&&t.text.length==1&&!Mo(e.doc,t)?Xr(e,T.line,"text"):cr(e,T.line,j.line+1,re);var ce=ne(e,"changes"),ve=ne(e,"change");if(ve||ce){var Ae={from:T,to:j,text:t.text,removed:t.removed,origin:t.origin};ve&&Jt(e,"change",e,Ae),ce&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(Ae)}e.display.selForContextMenu=null}function Bi(e,t,i,r,n){var T;r||(r=i),ct(r,i)<0&&(T=[r,i],i=T[0],r=T[1]),typeof t=="string"&&(t=e.splitLines(t)),Ni(e,{from:i,to:r,text:t,origin:n})}function Qo(e,t,i,r){i<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function Jo(e,t,i,r){for(var n=0;n<e.length;++n){var T=e[n],j=!0;if(T.ranges){T.copied||(T=e[n]=T.deepCopy(),T.copied=!0);for(var Y=0;Y<T.ranges.length;Y++)Qo(T.ranges[Y].anchor,t,i,r),Qo(T.ranges[Y].head,t,i,r);continue}for(var Q=0;Q<T.changes.length;++Q){var re=T.changes[Q];if(i<re.from.line)re.from=Fe(re.from.line+r,re.from.ch),re.to=Fe(re.to.line+r,re.to.ch);else if(t<=re.to.line){j=!1;break}}j||(e.splice(0,n+1),n=0)}}function qo(e,t){var i=t.from.line,r=t.to.line,n=t.text.length-(r-i)-1;Jo(e.done,i,r,n),Jo(e.undone,i,r,n)}function mn(e,t,i,r){var n=t,T=t;return typeof t=="number"?T=Ze(e,Ei(e,t)):n=gt(t),n==null?null:(r(T,n)&&e.cm&&Xr(e.cm,n,i),T)}function gn(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}gn.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,lt(n),Jt(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 vn(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}vn.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 T=Math.min(t,n-e),j=r.height;if(r.removeInner(e,T),this.height-=j-r.height,n==T&&(this.children.splice(i--,1),r.parent=null),(t-=T)==0)break;e=0}else e-=n}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof gn))){var Y=[];this.collapse(Y),this.children=[new gn(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],T=n.chunkSize();if(e<=T){if(n.insertInner(e,t,i),n.lines&&n.lines.length>50){for(var j=n.lines.length%25+25,Y=j;Y<n.lines.length;){var Q=new gn(n.lines.slice(Y,Y+=25));n.height-=Q.height,this.children.splice(++r,0,Q),Q.parent=this}n.lines=n.lines.slice(0,j),this.maybeSpill()}break}e-=T}},maybeSpill:function(){if(this.children.length<=10)return;var e=this;do{var t=e.children.splice(e.children.length-5,5),i=new vn(t);if(e.parent){e.size-=i.size,e.height-=i.height;var n=he(e.parent.children,e);e.parent.children.splice(n+1,0,i)}else{var r=new vn(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],T=n.chunkSize();if(e<T){var j=Math.min(t,T-e);if(n.iterN(e,j,i))return!0;if((t-=j)==0)break;e=0}else e-=T}}};var yn=function(e,t,i){if(i)for(var r in i)i.hasOwnProperty(r)&&(this[r]=i[r]);this.doc=e,this.node=t};yn.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,i=this.line,r=gt(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 T=nn(this);yt(i,Math.max(0,i.height-T)),e&&(vr(e,function(){es(e,i,-T),Xr(e,r,"widget")}),Jt(e,"lineWidgetCleared",e,this,r))},yn.prototype.changed=function(){var e=this,t=this.height,i=this.doc.cm,r=this.line;this.height=null;var n=nn(this)-t;if(!n)return;Pr(this.doc,r)||yt(r,r.height+n),i&&vr(i,function(){i.curOp.forceUpdate=!0,es(i,r,n),Jt(i,"lineWidgetChanged",i,e,gt(r))})},le(yn);function es(e,t,i){Rr(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&wa(e,i)}function El(e,t,i,r){var n=new yn(e,i,r),T=e.cm;return T&&n.noHScroll&&(T.display.alignWidgets=!0),mn(e,t,"widget",function(j){var Y=j.widgets||(j.widgets=[]);if(n.insertAt==null?Y.push(n):Y.splice(Math.min(Y.length-1,Math.max(0,n.insertAt)),0,n),n.line=j,T&&!Pr(e,j)){var Q=Rr(j)<e.scrollTop;yt(j,j.height+nn(n)),Q&&wa(T,n.height),T.curOp.forceUpdate=!0}return!0}),T&&Jt(T,"lineWidgetAdded",T,n,typeof t=="number"?t:gt(t)),n}var ts=0,Jr=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++ts};Jr.prototype.clear=function(){if(this.explicitlyCleared)return;var e=this.doc.cm,t=e&&!e.curOp;if(t&&mi(e),ne(this,"clear")){var i=this.find();i&&Jt(this,"clear",i.from,i.to)}for(var r=null,n=null,T=0;T<this.lines.length;++T){var j=this.lines[T],Y=Dr(j.markedSpans,this);e&&!this.collapsed?Xr(e,gt(j),"text"):e&&(Y.to!=null&&(n=gt(j)),Y.from!=null&&(r=gt(j))),j.markedSpans=Qi(j.markedSpans,Y),Y.from==null&&this.collapsed&&!Pr(this.doc,j)&&e&&yt(j,Di(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var Q=0;Q<this.lines.length;++Q){var re=xr(this.lines[Q]),ce=en(re);ce>e.display.maxLineLength&&(e.display.maxLine=re,e.display.maxLineLength=ce,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&cr(e,r,n+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&zo(e.doc)),e&&Jt(e,"markerCleared",e,this,r,n),t&&gi(e),this.parent&&this.parent.clear()},Jr.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var i,r,n=0;n<this.lines.length;++n){var T=this.lines[n],j=Dr(T.markedSpans,this);if(j.from!=null&&(i=Fe(t?T:gt(T),j.from),e==-1))return i;if(j.to!=null&&(r=Fe(t?T:gt(T),j.to),e==1))return r}return i&&{from:i,to:r}},Jr.prototype.changed=function(){var e=this,t=this.find(-1,!0),i=this,r=this.doc.cm;if(!t||!r)return;vr(r,function(){var n=t.line,T=gt(t.line),j=fa(r,T);if(j&&(no(j),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!Pr(i.doc,n)&&i.height!=null){var Y=i.height;i.height=null;var Q=nn(i)-Y;Q&&yt(n,n.height+Q)}Jt(r,"markerChanged",r,e)})},Jr.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||he(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Jr.prototype.detachLine=function(e){if(this.lines.splice(he(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},le(Jr);function Fi(e,t,i,r,n){if(r&&r.shared)return Sl(e,t,i,r,n);if(e.cm&&!e.cm.curOp)return Xt(e.cm,Fi)(e,t,i,r,n);var T=new Jr(e,n),j=ct(t,i);if(r&&I(r,T,!1),j>0||j==0&&T.clearWhenEmpty!==!1)return T;if(T.replacedWith&&(T.collapsed=!0,T.widgetNode=E("span",[T.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||T.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(T.widgetNode.insertLeft=!0)),T.collapsed){if(Pn(e,t.line,t,i,T)||t.line!=i.line&&Pn(e,i.line,t,i,T))throw new Error("Inserting collapsed marker partially overlapping an existing one");oa()}T.addToHistory&&Bo(e,{from:t,to:i,origin:"markText"},e.sel,NaN);var Y=t.line,Q=e.cm,re;if(e.iter(Y,i.line+1,function(ve){Q&&T.collapsed&&!Q.options.lineWrapping&&xr(ve)==Q.display.maxLine&&(re=!0),T.collapsed&&Y!=t.line&&yt(ve,0),sa(ve,new ai(T,Y==t.line?t.ch:null,Y==i.line?i.ch:null)),++Y}),T.collapsed&&e.iter(t.line,i.line+1,function(ve){Pr(e,ve)&&yt(ve,0)}),T.clearOnEnter&&ke(T,"beforeCursorEnter",function(){return T.clear()}),T.readOnly&&(Kr(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),T.collapsed&&(T.id=++ts,T.atomic=!0),Q){if(re&&(Q.curOp.updateMaxLine=!0),T.collapsed)cr(Q,t.line,i.line+1);else if(T.className||T.startStyle||T.endStyle||T.css||T.attributes||T.title)for(var ce=t.line;ce<=i.line;ce++)Xr(Q,ce,"text");T.atomic&&zo(Q.doc),Jt(Q,"markerAdded",Q,T)}return T}var bn=function(e,t){this.markers=e,this.primary=t;for(var i=0;i<e.length;++i)e[i].parent=this};bn.prototype.clear=function(){if(this.explicitlyCleared)return;this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();Jt(this,"clear")},bn.prototype.find=function(e,t){return this.primary.find(e,t)},le(bn);function Sl(e,t,i,r,n){r=I(r),r.shared=!1;var T=[Fi(e,t,i,r,n)],j=T[0],Y=r.widgetNode;return Qr(e,function(Q){Y&&(r.widgetNode=Y.cloneNode(!0)),T.push(Fi(Q,mt(Q,t),mt(Q,i),r,n));for(var re=0;re<Q.linked.length;++re)if(Q.linked[re].isParent)return;j=s(T)}),new bn(T,j)}function rs(e){return e.findMarks(Fe(e.first,0),e.clipPos(Fe(e.lastLine())),function(t){return t.parent})}function Tl(e,t){for(var i=0;i<t.length;i++){var r=t[i],n=r.find(),T=e.clipPos(n.from),j=e.clipPos(n.to);if(ct(T,j)){var Y=Fi(e,T,j,r.primary,r.primary.type);r.markers.push(Y),Y.parent=r}}}function Cl(e){for(var t=function(r){var n=e[r],T=[n.primary.doc];Qr(n.primary.doc,function(Q){return T.push(Q)});for(var j=0;j<n.markers.length;j++){var Y=n.markers[j];he(T,Y.doc)==-1&&(Y.parent=null,n.markers.splice(j--,1))}},i=0;i<e.length;i++)t(i)}var wl=0,fr=function(e,t,i,r,n){if(!(this instanceof fr))return new fr(e,t,i,r,n);i==null&&(i=0),vn.call(this,[new gn([new li("",null)])]),this.first=i,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=i;var T=Fe(i,0);this.sel=$r(T),this.history=new Vn(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)),Ma(this,{from:T,to:T,text:e}),tr(this,$r(T),Se)};fr.prototype=N(vn.prototype,{constructor:fr,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=Qt(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:Yt(function(e){var t=Fe(this.first,0),i=this.first+this.size-1;Ni(this,{from:t,to:Fe(i,Ze(this,i).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&sn(this.cm,0,0),tr(this,$r(t),Se)}),replaceRange:function(e,t,i,r){t=mt(this,t),i=i?mt(this,i):t,Bi(this,e,t,i,r)},getRange:function(e,t,i){var r=At(this,mt(this,e),mt(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(br(this,e))return Ze(this,e)},getLineNumber:function(e){return gt(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=Ze(this,e)),xr(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return mt(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:Yt(function(e,t,i){Wo(this,mt(this,typeof e=="number"?Fe(e,t||0):e),null,i)}),setSelection:Yt(function(e,t,i){Wo(this,mt(this,e),mt(this,t||e),i)}),extendSelection:Yt(function(e,t,i){Yn(this,mt(this,e),t&&mt(this,t),i)}),extendSelections:Yt(function(e,t){jo(this,He(this,e),t)}),extendSelectionsBy:Yt(function(e,t){var i=c(this.sel.ranges,e);jo(this,He(this,i),t)}),setSelections:Yt(function(e,t,i){if(!e.length)return;for(var r=[],n=0;n<e.length;n++)r[n]=new Rt(mt(this,e[n].anchor),mt(this,e[n].head));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),tr(this,Or(this.cm,r,t),i)}),addSelection:Yt(function(e,t,i){var r=this.sel.ranges.slice(0);r.push(new Rt(mt(this,e),mt(this,t||e))),tr(this,Or(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=At(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=At(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:Yt(function(e,t,i){for(var r=[],n=this.sel,T=0;T<n.ranges.length;T++){var j=n.ranges[T];r[T]={from:j.from(),to:j.to(),text:this.splitLines(e[T]),origin:i}}for(var Y=t&&t!="end"&&cl(this,r,t),Q=r.length-1;Q>=0;Q--)Ni(this,r[Q]);Y?Ho(this,Y):this.cm&&Oi(this.cm)}),undo:Yt(function(){Qn(this,"undo")}),redo:Yt(function(){Qn(this,"redo")}),undoSelection:Yt(function(){Qn(this,"undo",!0)}),redoSelection:Yt(function(){Qn(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 Vn(this.history.maxGeneration),Qr(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:Pi(this.history.done),undone:Pi(this.history.undone)}},setHistory:function(e){var t=this.history=new Vn(this.history.maxGeneration);t.done=Pi(e.done.slice(0),null,!0),t.undone=Pi(e.undone.slice(0),null,!0)},setGutterMarker:Yt(function(e,t,i){return mn(this,e,"gutter",function(r){var n=r.gutterMarkers||(r.gutterMarkers={});return n[t]=i,!i&&_e(n)&&(r.gutterMarkers=null),!0})}),clearGutter:Yt(function(e){var t=this;this.iter(function(i){i.gutterMarkers&&i.gutterMarkers[e]&&mn(t,i,"gutter",function(){return i.gutterMarkers[e]=null,_e(i.gutterMarkers)&&(i.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!br(this,e))return null;if(t=e,e=Ze(this,e),!e)return null}else if(t=gt(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:Yt(function(e,t,i){return mn(this,e,t=="gutter"?"gutter":"class",function(r){var n=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!r[n])r[n]=i;else{if(x(i).test(r[n]))return!1;r[n]+=" "+i}return!0})}),removeLineClass:Yt(function(e,t,i){return mn(this,e,t=="gutter"?"gutter":"class",function(r){var n=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",T=r[n];if(T)if(i==null)r[n]=null;else{var j=T.match(x(i));if(!j)return!1;var Y=j.index+j[0].length;r[n]=T.slice(0,j.index)+(!j.index||Y==T.length?"":" ")+T.slice(Y)||null}else return!1;return!0})}),addLineWidget:Yt(function(e,t,i){return El(this,e,t,i)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,i){return Fi(this,mt(this,e),mt(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=mt(this,e),Fi(this,e,e,i,"bookmark")},findMarksAt:function(e){e=mt(this,e);var t=[],i=Ze(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=mt(this,e),t=mt(this,t);var r=[],n=e.line;return this.iter(e.line,t.line+1,function(T){var j=T.markedSpans;if(j)for(var Y=0;Y<j.length;Y++){var Q=j[Y];!(Q.to!=null&&n==e.line&&e.ch>=Q.to||Q.from==null&&n!=e.line||Q.from!=null&&n==t.line&&Q.from>=t.ch)&&(!i||i(Q.marker))&&r.push(Q.marker.parent||Q.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 T=n.text.length+r;if(T>e)return t=e,!0;e-=T,++i}),mt(this,Fe(i,t))},indexFromPos:function(e){e=mt(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 fr(Qt(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 fr(Qt(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}],Tl(r,rs(this)),r},unlinkDoc:function(e){if(e instanceof Nt&&(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),Cl(rs(this));break}if(e.history==this.history){var r=[e.id];Qr(e,function(n){return r.push(n.id)},!0),e.history=new Vn(null),e.history.done=Pi(this.history.done,r),e.history.undone=Pi(this.history.undone,r)}},iterLinkedDocs:function(e){Qr(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):st(e)},lineSeparator:function(){return this.lineSep||`
|
|
`},setDirection:Yt(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)})}),fr.prototype.eachLine=fr.prototype.iter;var is=0;function Al(e){var t=this;if(ns(t),q(t,e)||Hr(t.display,e))return;te(e),z&&(is=+new Date);var i=di(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,T=Array(n),j=0,Y=function(){++j==n&&Xt(t,function(){i=mt(t.doc,i);var Te={from:i,to:i,text:t.doc.splitLines(T.filter(function(Ie){return Ie!=null}).join(t.doc.lineSeparator())),origin:"paste"};Ni(t.doc,Te),Ho(t.doc,$r(mt(t.doc,i),mt(t.doc,Zr(Te))))})()},Q=function(Te,Ie){if(t.options.allowDropFileTypes&&he(t.options.allowDropFileTypes,Te.type)==-1){Y();return}var Ne=new FileReader;Ne.onerror=function(){return Y()},Ne.onload=function(){var Ge=Ne.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(Ge)){Y();return}T[Ie]=Ge,Y()},Ne.readAsText(Te)},re=0;re<r.length;re++)Q(r[re],re);else{if(t.state.draggingText&&t.doc.sel.contains(i)>-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var ce=e.dataTransfer.getData("Text");if(ce){var ve;if(t.state.draggingText&&!t.state.draggingText.copy&&(ve=t.listSelections()),$n(t.doc,$r(i,i)),ve)for(var Ae=0;Ae<ve.length;++Ae)Bi(t.doc,"",ve[Ae].anchor,ve[Ae].head,"drag");t.replaceSelection(ce,"around","paste"),t.display.input.focus()}}catch(Te){}}}function Ll(e,t){if(z&&(!e.state.draggingText||+new Date-is<100)){de(t);return}if(q(e,t)||Hr(e.display,t))return;if(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!P){var i=a("img",null,null,"position: fixed; left: 0; top: 0;");i.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",A&&(i.width=i.height=1,e.display.wrapper.appendChild(i),i._top=i.offsetTop),t.dataTransfer.setDragImage(i,0,0),A&&i.parentNode.removeChild(i)}}function kl(e,t){var i=di(e,t);if(!i)return;var r=document.createDocumentFragment();go(e,i,r),e.display.dragCursor||(e.display.dragCursor=a("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),d(e.display.dragCursor,r)}function ns(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function as(e){if(!document.getElementsByClassName)return;for(var t=document.getElementsByClassName("CodeMirror"),i=[],r=0;r<t.length;r++){var n=t[r].CodeMirror;n&&i.push(n)}i.length&&i[0].operation(function(){for(var T=0;T<i.length;T++)e(i[T])})}var os=!1;function Dl(){if(os)return;Rl(),os=!0}function Rl(){var e;ke(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,as(_l)},100))}),ke(window,"blur",function(){return as(_i)})}function _l(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var qr={3:"Pause",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",224:"Mod",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},xn=0;xn<10;xn++)qr[xn+48]=qr[xn+96]=String(xn);for(var Jn=65;Jn<=90;Jn++)qr[Jn]=String.fromCharCode(Jn);for(var En=1;En<=12;En++)qr[En+111]=qr[En+63235]="F"+En;var Gr={};Gr.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"},Gr.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"},Gr.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"},Gr.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"]},Gr.default=l?Gr.macDefault:Gr.pcDefault;function Ol(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var i,r,n,T,j=0;j<t.length-1;j++){var Y=t[j];if(/^(cmd|meta|m)$/i.test(Y))T=!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),T&&(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=c(i.split(" "),Ol),T=0;T<n.length;T++){var j=void 0,Y=void 0;T==n.length-1?(Y=n.join(" "),j=r):(Y=n.slice(0,T+1).join(" "),j="...");var Q=t[Y];if(!Q)t[Y]=j;else if(Q!=j)throw new Error("Inconsistent bindings for "+Y)}delete e[i]}for(var re in t)e[re]=t[re];return e}function Ui(e,t,i,r){t=qn(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 Ui(e,t.fallthrough,i,r);for(var T=0;T<t.fallthrough.length;T++){var j=Ui(e,t.fallthrough[T],i,r);if(j)return j}}}function ss(e){var t=typeof e=="string"?e:qr[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function ls(e,t,i){var r=e;return t.altKey&&r!="Alt"&&(e="Alt-"+e),(m?t.metaKey:t.ctrlKey)&&r!="Ctrl"&&(e="Ctrl-"+e),(m?t.ctrlKey:t.metaKey)&&r!="Mod"&&(e="Cmd-"+e),!i&&t.shiftKey&&r!="Shift"&&(e="Shift-"+e),e}function us(e,t){if(A&&e.keyCode==34&&e.char)return!1;var i=qr[e.keyCode];return i==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(i=e.code),ls(i,e,t))}function qn(e){return typeof e=="string"?Gr[e]:e}function ji(e,t){for(var i=e.doc.sel.ranges,r=[],n=0;n<i.length;n++){for(var T=t(i[n]);r.length&&ct(T.from,s(r).to)<=0;){var j=r.pop();if(ct(j.from,T.from)<0){T.from=j.from;break}}r.push(T)}vr(e,function(){for(var Y=r.length-1;Y>=0;Y--)Bi(e.doc,"",r[Y].from,r[Y].to,"+delete");Oi(e)})}function Ba(e,t,i){var r=Me(e.text,t+i,i);return r<0||r>e.text.length?null:r}function Fa(e,t,i){var r=Ba(e,t.ch,i);return r==null?null:new Fe(t.line,r,i<0?"after":"before")}function Ua(e,t,i,r,n){if(e){t.doc.direction=="rtl"&&(n=-n);var T=je(i,t.doc.direction);if(T){var j=n<0?s(T):T[0],Y=n<0==(j.level==1),Q=Y?"after":"before",re;if(j.level>0||t.doc.direction=="rtl"){var ce=ki(t,i);re=n<0?i.text.length-1:0;var ve=Nr(t,ce,re).top;re=Be(function(Ae){return Nr(t,ce,Ae).top==ve},n<0==(j.level==1)?j.from:j.to-1,re),Q=="before"&&(re=Ba(i,re,1))}else re=n<0?j.to:j.from;return new Fe(r,re,Q)}}return new Fe(r,n<0?i.text.length:0,n<0?"before":"after")}function Pl(e,t,i,r){var n=je(t,e.doc.direction);if(!n)return Fa(t,i,r);i.ch>=t.text.length?(i.ch=t.text.length,i.sticky="before"):i.ch<=0&&(i.ch=0,i.sticky="after");var T=ze(n,i.ch,i.sticky),j=n[T];if(e.doc.direction=="ltr"&&j.level%2==0&&(r>0?j.to>i.ch:j.from<i.ch))return Fa(t,i,r);var Y=function(Ye,et){return Ba(t,Ye instanceof Fe?Ye.ch:Ye,et)},Q,re=function(Ye){return e.options.lineWrapping?(Q=Q||ki(e,t),co(e,t,Q,Ye)):{begin:0,end:t.text.length}},ce=re(i.sticky=="before"?Y(i,-1):i.ch);if(e.doc.direction=="rtl"||j.level==1){var ve=j.level==1==r<0,Ae=Y(i,ve?1:-1);if(Ae!=null&&(ve?Ae<=j.to&&Ae<=ce.end:Ae>=j.from&&Ae>=ce.begin)){var Te=ve?"before":"after";return new Fe(i.line,Ae,Te)}}var Ie=function(Ye,et,$e){for(var it=function(Pt,$t){return $t?new Fe(i.line,Y(Pt,1),"before"):new Fe(i.line,Pt,"after")};Ye>=0&&Ye<n.length;Ye+=et){var dt=n[Ye],ut=et>0==(dt.level!=1),Et=ut?$e.begin:Y($e.end,-1);if(dt.from<=Et&&Et<dt.to)return it(Et,ut);if(Et=ut?dt.from:Y(dt.to,-1),$e.begin<=Et&&Et<$e.end)return it(Et,ut)}},Ne=Ie(T+r,r,ce);if(Ne)return Ne;var Ge=r>0?ce.end:Y(ce.begin,-1);return Ge!=null&&!(r>0&&Ge==t.text.length)&&(Ne=Ie(r>0?0:n.length-1,r,re(Ge)),Ne)?Ne:null}var Sn={selectAll:Xo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),Se)},killLine:function(e){return ji(e,function(t){if(t.empty()){var i=Ze(e.doc,t.head.line).text.length;return t.head.ch==i&&t.head.line<e.lastLine()?{from:t.head,to:Fe(t.head.line+1,0)}:{from:t.head,to:Fe(t.head.line,i)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return ji(e,function(t){return{from:Fe(t.from().line,0),to:mt(e.doc,Fe(t.to().line+1,0))}})},delLineLeft:function(e){return ji(e,function(t){return{from:Fe(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return ji(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 ji(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(Fe(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(Fe(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return hs(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return ds(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return Il(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var i=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:i},"div")},Ce)},goLineLeft:function(e){return e.extendSelectionsBy(function(t){var i=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:i},"div")},Ce)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var i=e.cursorCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:i},"div");return r.ch<e.getLine(r.line).search(/\S/)?ds(e,t.head):r},Ce)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"codepoint")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection(" ")},insertSoftTab:function(e){for(var t=[],i=e.listSelections(),r=e.options.tabSize,n=0;n<i.length;n++){var T=i[n].from(),j=$(e.getLine(T.line),T.ch,r);t.push(G(r-j%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return vr(e,function(){for(var t=e.listSelections(),i=[],r=0;r<t.length;r++){if(!t[r].empty())continue;var n=t[r].head,T=Ze(e.doc,n.line).text;if(T){if(n.ch==T.length&&(n=new Fe(n.line,n.ch-1)),n.ch>0)n=new Fe(n.line,n.ch+1),e.replaceRange(T.charAt(n.ch-1)+T.charAt(n.ch-2),Fe(n.line,n.ch-2),n,"+transpose");else if(n.line>e.doc.first){var j=Ze(e.doc,n.line-1).text;j&&(n=new Fe(n.line,1),e.replaceRange(T.charAt(0)+e.doc.lineSeparator()+j.charAt(j.length-1),Fe(n.line-1,j.length-1),n,"+transpose"))}}i.push(new Rt(n,n))}e.setSelections(i)})},newlineAndIndent:function(e){return vr(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);Oi(e)})},openLine:function(e){return e.replaceSelection(`
|
|
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function hs(e,t){var i=Ze(e.doc,t),r=xr(i);return r!=i&&(t=gt(r)),Ua(!0,e,r,t,1)}function Il(e,t){var i=Ze(e.doc,t),r=In(i);return r!=i&&(t=gt(r)),Ua(!0,e,i,t,-1)}function ds(e,t){var i=hs(e,t.line),r=Ze(e.doc,i.line),n=je(r,e.doc.direction);if(!n||n[0].level==0){var T=Math.max(i.ch,r.text.search(/\S/)),j=t.line==i.line&&t.ch<=T&&t.ch;return Fe(i.line,j?0:T,i.sticky)}return i}function ea(e,t,i){if(typeof t=="string"&&(t=Sn[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=Ui(t,e.state.keyMaps[r],i,e);if(n)return n}return e.options.extraKeys&&Ui(t,e.options.extraKeys,i,e)||Ui(t,e.options.keyMap,i,e)}var Bl=new ae;function Tn(e,t,i,r){var n=e.state.keySeq;if(n){if(ss(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())}),cs(e,n+" "+t,i,r))return!0}return cs(e,t,i,r)}function cs(e,t,i,r){var n=Nl(e,t,r);return n=="multi"&&(e.state.keySeq=t),n=="handled"&&Jt(e,"keyHandled",e,t,i),(n=="handled"||n=="multi")&&(te(i),Sa(e)),!!n}function fs(e,t){var i=us(t,!0);return i?t.shiftKey&&!e.state.keySeq?Tn(e,"Shift-"+i,t,function(r){return ea(e,r,!0)})||Tn(e,i,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return ea(e,r)}):Tn(e,i,t,function(r){return ea(e,r)}):!1}function Fl(e,t,i){return Tn(e,"'"+i+"'",t,function(r){return ea(e,r,!0)})}var ja=null;function ps(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(t.curOp.focus=F(),q(t,e))return;z&&H<11&&e.keyCode==27&&(e.returnValue=!1);var i=e.keyCode;t.display.shift=i==16||e.shiftKey;var r=fs(t,e);A&&(ja=r?i:null,!r&&i==88&&!wt&&(l?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),_&&!l&&!r&&i==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),i==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Ul(t)}function Ul(e){var t=e.display.lineDiv;W(t,"CodeMirror-crosshair");function i(r){(r.keyCode==18||!r.altKey)&&(f(t,"CodeMirror-crosshair"),qe(document,"keyup",i),qe(document,"mouseover",i))}ke(document,"keyup",i),ke(document,"mouseover",i)}function ms(e){e.keyCode==16&&(this.doc.sel.shift=!1),q(this,e)}function gs(e){var t=this;if(e.target&&e.target!=t.display.input.getField())return;if(Hr(t.display,e)||q(t,e)||e.ctrlKey&&!e.altKey||l&&e.metaKey)return;var i=e.keyCode,r=e.charCode;if(A&&i==ja){ja=null,te(e);return}if(A&&(!e.which||e.which<10)&&fs(t,e))return;var n=String.fromCharCode(r==null?i:r);if(n=="\b")return;if(Fl(t,e,n))return;t.display.input.onKeyPress(e)}var jl=400,Wa=function(e,t,i){this.time=e,this.pos=t,this.button=i};Wa.prototype.compare=function(e,t,i){return this.time+jl>e&&ct(t,this.pos)==0&&i==this.button};var Cn,wn;function Wl(e,t){var i=+new Date;return wn&&wn.compare(i,e,t)?(Cn=wn=null,"triple"):Cn&&Cn.compare(i,e,t)?(wn=new Wa(i,e,t),Cn=null,"double"):(Cn=new Wa(i,e,t),wn=null,"single")}function vs(e){var t=this,i=t.display;if(q(t,e)||i.activeTouch&&i.input.supportsTouch())return;if(i.input.ensurePolled(),i.shift=e.shiftKey,Hr(i,e)){B||(i.scroller.draggable=!1,setTimeout(function(){return i.scroller.draggable=!0},100));return}if(Ha(t,e))return;var r=di(t,e),n=Ee(e),T=r?Wl(r,n):"single";if(window.focus(),n==1&&t.state.selectingText&&t.state.selectingText(e),r&&Hl(t,n,r,T,e))return;n==1?r?zl(t,r,T,e):ye(e)==i.scroller&&te(e):n==2?(r&&Yn(t.doc,r),setTimeout(function(){return i.input.focus()},20)):n==3&&(k?t.display.input.onContextMenu(e):yo(t))}function Hl(e,t,i,r,n){var T="Click";return r=="double"?T="Double"+T:r=="triple"&&(T="Triple"+T),T=(t==1?"Left":t==2?"Middle":"Right")+T,Tn(e,ls(T,n),n,function(j){if(typeof j=="string"&&(j=Sn[j]),!j)return!1;var Y=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),Y=j(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 T=u?i.shiftKey&&i.metaKey:i.altKey;n.unit=T?"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){z?setTimeout(M(vo,e),0):e.curOp.focus=F();var n=Gl(e,i,r),T=e.doc.sel,j;e.options.dragDrop&&Pe&&!e.isReadOnly()&&i=="single"&&(j=T.contains(t))>-1&&(ct((j=T.ranges[j]).from(),t)<0||t.xRel>0)&&(ct(j.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,T=!1,j=Xt(e,function(re){B&&(n.scroller.draggable=!1),e.state.draggingText=!1,qe(n.wrapper.ownerDocument,"mouseup",j),qe(n.wrapper.ownerDocument,"mousemove",Y),qe(n.scroller,"dragstart",Q),qe(n.scroller,"drop",j),T||(te(re),r.addNew||Yn(e.doc,i,null,null,r.extend),B&&!P||z&&H==9?setTimeout(function(){n.wrapper.ownerDocument.body.focus({preventScroll:!0}),n.input.focus()},20):n.input.focus())}),Y=function(re){T=T||Math.abs(t.clientX-re.clientX)+Math.abs(t.clientY-re.clientY)>=10},Q=function(){return T=!0};B&&(n.scroller.draggable=!0),e.state.draggingText=j,j.copy=!r.moveOnDrag,n.scroller.dragDrop&&n.scroller.dragDrop(),ke(n.wrapper.ownerDocument,"mouseup",j),ke(n.wrapper.ownerDocument,"mousemove",Y),ke(n.scroller,"dragstart",Q),ke(n.scroller,"drop",j),yo(e),setTimeout(function(){return n.input.focus()},20)}function ys(e,t,i){if(i=="char")return new Rt(t,t);if(i=="word")return e.findWordAt(t);if(i=="line")return new Rt(Fe(t.line,0),mt(e.doc,Fe(t.line+1,0)));var r=i(e,t);return new Rt(r.from,r.to)}function Vl(e,t,i,r){var n=e.display,T=e.doc;te(t);var j,Y,Q=T.sel,re=Q.ranges;if(r.addNew&&!r.extend?(Y=T.sel.contains(i),Y>-1?j=re[Y]:j=new Rt(i,i)):(j=T.sel.primary(),Y=T.sel.primIndex),r.unit=="rectangle")r.addNew||(j=new Rt(i,i)),i=di(e,t,!0,!0),Y=-1;else{var ce=ys(e,i,r.unit);r.extend?j=Ia(j,ce.anchor,ce.head,r.extend):j=ce}r.addNew?Y==-1?(Y=re.length,tr(T,Or(e,re.concat([j]),Y),{scroll:!1,origin:"*mouse"})):re.length>1&&re[Y].empty()&&r.unit=="char"&&!r.extend?(tr(T,Or(e,re.slice(0,Y).concat(re.slice(Y+1)),0),{scroll:!1,origin:"*mouse"}),Q=T.sel):Na(T,Y,j,Re):(Y=0,tr(T,new Sr([j],0),Re),Q=T.sel);var ve=i;function Ae($e){if(ct(ve,$e)==0)return;if(ve=$e,r.unit=="rectangle"){for(var it=[],dt=e.options.tabSize,ut=$(Ze(T,i.line).text,i.ch,dt),Et=$(Ze(T,$e.line).text,$e.ch,dt),Pt=Math.min(ut,Et),$t=Math.max(ut,Et),Bt=Math.min(i.line,$e.line),yr=Math.min(e.lastLine(),Math.max(i.line,$e.line));Bt<=yr;Bt++){var pr=Ze(T,Bt).text,Wt=xe(pr,Pt,dt);Pt==$t?it.push(new Rt(Fe(Bt,Wt),Fe(Bt,Wt))):pr.length>Wt&&it.push(new Rt(Fe(Bt,Wt),Fe(Bt,xe(pr,$t,dt))))}it.length||it.push(new Rt(i,i)),tr(T,Or(e,Q.ranges.slice(0,Y).concat(it),Y),{origin:"*mouse",scroll:!1}),e.scrollIntoView($e)}else{var mr=j,qt=ys(e,$e,r.unit),zt=mr.anchor,Ht;ct(qt.anchor,zt)>0?(Ht=qt.head,zt=ii(mr.from(),qt.anchor)):(Ht=qt.anchor,zt=xi(mr.to(),qt.head));var Ft=Q.ranges.slice(0);Ft[Y]=Xl(e,new Rt(mt(T,zt),Ht)),tr(T,Or(e,Ft,Y),Re)}}var Te=n.wrapper.getBoundingClientRect(),Ie=0;function Ne($e){var it=++Ie,dt=di(e,$e,!0,r.unit=="rectangle");if(!dt)return;if(ct(dt,ve)!=0){e.curOp.focus=F(),Ae(dt);var ut=Hn(n,T);(dt.line>=ut.to||dt.line<ut.from)&&setTimeout(Xt(e,function(){Ie==it&&Ne($e)}),150)}else{var Et=$e.clientY<Te.top?-20:$e.clientY>Te.bottom?20:0;Et&&setTimeout(Xt(e,function(){if(Ie!=it)return;n.scroller.scrollTop+=Et,Ne($e)}),50)}}function Ge($e){e.state.selectingText=!1,Ie=Infinity,$e&&(te($e),n.input.focus()),qe(n.wrapper.ownerDocument,"mousemove",Ye),qe(n.wrapper.ownerDocument,"mouseup",et),T.history.lastSelOrigin=null}var Ye=Xt(e,function($e){$e.buttons===0||!Ee($e)?Ge($e):Ne($e)}),et=Xt(e,Ge);e.state.selectingText=et,ke(n.wrapper.ownerDocument,"mousemove",Ye),ke(n.wrapper.ownerDocument,"mouseup",et)}function Xl(e,t){var i=t.anchor,r=t.head,n=Ze(e.doc,i.line);if(ct(i,r)==0&&i.sticky==r.sticky)return t;var T=je(n);if(!T)return t;var j=ze(T,i.ch,i.sticky),Y=T[j];if(Y.from!=i.ch&&Y.to!=i.ch)return t;var Q=j+(Y.from==i.ch==(Y.level!=1)?0:1);if(Q==0||Q==T.length)return t;var re;if(r.line!=i.line)re=(r.line-i.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var ce=ze(T,r.ch,r.sticky),ve=ce-j||(r.ch-i.ch)*(Y.level==1?-1:1);ce==Q-1||ce==Q?re=ve<0:re=ve>0}var Ae=T[Q+(re?-1:0)],Te=re==(Ae.level==1),Ie=Te?Ae.from:Ae.to,Ne=Te?"after":"before";return i.ch==Ie&&i.sticky==Ne?t:new Rt(new Fe(i.line,Ie,Ne),r)}function bs(e,t,i,r){var n,T;if(t.touches)n=t.touches[0].clientX,T=t.touches[0].clientY;else try{n=t.clientX,T=t.clientY}catch(Ae){return!1}if(n>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&te(t);var j=e.display,Y=j.lineDiv.getBoundingClientRect();if(T>Y.bottom||!ne(e,i))return ue(t);T-=Y.top-j.viewOffset;for(var Q=0;Q<e.display.gutterSpecs.length;++Q){var re=j.gutters.childNodes[Q];if(re&&re.getBoundingClientRect().right>=n){var ce=kt(e.doc,T),ve=e.display.gutterSpecs[Q];return se(e,i,e,ce,ve.className,t),ue(t)}}}function Ha(e,t){return bs(e,t,"gutterClick",!0)}function xs(e,t){if(Hr(e.display,t)||Yl(e,t))return;if(q(e,t,"contextmenu"))return;k||e.display.input.onContextMenu(t)}function Yl(e,t){return ne(e,"gutterContextMenu")?bs(e,t,"gutterContextMenu",!1):!1}function Es(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),an(e)}var Wi={toString:function(){return"CodeMirror.Init"}},Ss={},ta={};function $l(e){var t=e.optionHandlers;function i(r,n,T,j){e.defaults[r]=n,T&&(t[r]=j?function(Y,Q,re){re!=Wi&&T(Y,Q,re)}:T)}e.defineOption=i,e.Init=Wi,i("value","",function(r,n){return r.setValue(n)},!0),i("mode",null,function(r,n){r.doc.modeOption=n,Oa(r)},!0),i("indentUnit",2,Oa,!0),i("indentWithTabs",!1),i("smartIndent",!0),i("tabSize",4,function(r){fn(r),an(r),cr(r)},!0),i("lineSeparator",null,function(r,n){if(r.doc.lineSep=n,!n)return;var T=[],j=r.doc.first;r.doc.iter(function(Q){for(var re=0;;){var ce=Q.text.indexOf(n,re);if(ce==-1)break;re=ce+n.length,T.push(Fe(j,ce))}j++});for(var Y=T.length-1;Y>=0;Y--)Bi(r.doc,n,T[Y],Fe(T[Y].line,T[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,T){r.state.specialChars=new RegExp(n.source+(n.test(" ")?"":"| "),"g"),T!=Wi&&r.refresh()}),i("specialCharPlaceholder",Mt,function(r){return r.refresh()},!0),i("electricChars",!0),i("inputStyle",o?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),i("spellcheck",!1,function(r,n){return r.getInputField().spellcheck=n},!0),i("autocorrect",!1,function(r,n){return r.getInputField().autocorrect=n},!0),i("autocapitalize",!1,function(r,n){return r.getInputField().autocapitalize=n},!0),i("rtlMoveVisually",!C),i("wholeLineUpdateBefore",!0),i("theme","default",function(r){Es(r),cn(r)},!0),i("keyMap","default",function(r,n,T){var j=qn(n),Y=T!=Wi&&qn(T);Y&&Y.detach&&Y.detach(r,j),j.attach&&j.attach(r,Y||null)}),i("extraKeys",null),i("configureMouse",null),i("lineWrapping",!1,Ql,!0),i("gutters",[],function(r,n){r.display.gutterSpecs=Ra(n,r.options.lineNumbers),cn(r)},!0),i("fixedGutter",!0,function(r,n){r.display.gutters.style.left=n?xa(r.display)+"px":"0",r.refresh()},!0),i("coverGutterNextToScrollbar",!1,function(r){return Mi(r)},!0),i("scrollbarStyle","native",function(r){Co(r),Mi(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=Ra(r.options.gutters,n),cn(r)},!0),i("firstLineNumber",1,cn,!0),i("lineNumberFormatter",function(r){return r},cn,!0),i("showCursorWhenSelecting",!1,on,!0),i("resetSelectionOnContextMenu",!0),i("lineWiseCopyCut",!0),i("pasteLinesPerSelection",!0),i("selectionsMayTouch",!1),i("readOnly",!1,function(r,n){n=="nocursor"&&(_i(r),r.display.input.blur()),r.display.input.readOnlyChanged(n)}),i("screenReaderLabel",null,function(r,n){n=n===""?null:n,r.display.input.screenReaderLabelChanged(n)}),i("disableInput",!1,function(r,n){n||r.display.input.reset()},!0),i("dragDrop",!0,Zl),i("allowDropFileTypes",null),i("cursorBlinkRate",530),i("cursorScrollMargin",0),i("cursorHeight",1,on,!0),i("singleCursorHeightPerLine",!0,on,!0),i("workTime",100),i("workDelay",100),i("flattenSpans",!0,fn,!0),i("addModeClass",!1,fn,!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,fn,!0),i("moveInputWithCursor",!0,function(r,n){n||r.display.input.resetPosition()}),i("tabindex",null,function(r,n){return r.display.input.getField().tabIndex=n||""}),i("autofocus",null),i("direction","ltr",function(r,n){return r.doc.setDirection(n)},!0),i("phrases",null)}function Zl(e,t,i){var r=i&&i!=Wi;if(!t!=!r){var n=e.display.dragFunctions,T=t?ke:qe;T(e.display.scroller,"dragstart",n.start),T(e.display.scroller,"dragenter",n.enter),T(e.display.scroller,"dragover",n.over),T(e.display.scroller,"dragleave",n.leave),T(e.display.scroller,"drop",n.drop)}}function Ql(e){e.options.lineWrapping?(W(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(f(e.display.wrapper,"CodeMirror-wrap"),Nn(e)),Ea(e),cr(e),an(e),setTimeout(function(){return Mi(e)},100)}function Nt(e,t){var i=this;if(!(this instanceof Nt))return new Nt(e,t);this.options=t=t?I(t):{},I(Ss,t,!1);var r=t.value;typeof r=="string"?r=new fr(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var n=new Nt.inputStyles[t.inputStyle](this),T=this.display=new hl(e,r,n,t);T.wrapper.CodeMirror=this,Es(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Co(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 ae,keySeq:null,specialChars:null},t.autofocus&&!o&&T.input.focus(),z&&H<11&&setTimeout(function(){return i.display.input.reset(!0)},20),Jl(this),Dl(),mi(this),this.curOp.forceUpdate=!0,Po(this,r),t.autofocus&&!o||this.hasFocus()?setTimeout(function(){i.hasFocus()&&!i.state.focused&&Ta(i)},20):_i(this);for(var j in ta)ta.hasOwnProperty(j)&&ta[j](this,t[j],Wi);Lo(this),t.finishInit&&t.finishInit(this);for(var Y=0;Y<Ga.length;++Y)Ga[Y](this);gi(this),B&&t.lineWrapping&&getComputedStyle(T.lineDiv).textRendering=="optimizelegibility"&&(T.lineDiv.style.textRendering="auto")}Nt.defaults=Ss,Nt.optionHandlers=ta;function Jl(e){var t=e.display;ke(t.scroller,"mousedown",Xt(e,vs)),z&&H<11?ke(t.scroller,"dblclick",Xt(e,function(Q){if(q(e,Q))return;var re=di(e,Q);if(!re||Ha(e,Q)||Hr(e.display,Q))return;te(Q);var ce=e.findWordAt(re);Yn(e.doc,ce.anchor,ce.head)})):ke(t.scroller,"dblclick",function(Q){return q(e,Q)||te(Q)}),ke(t.scroller,"contextmenu",function(Q){return xs(e,Q)}),ke(t.input.getField(),"contextmenu",function(Q){t.scroller.contains(Q.target)||xs(e,Q)});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 T(Q){if(Q.touches.length!=1)return!1;var re=Q.touches[0];return re.radiusX<=1&&re.radiusY<=1}function j(Q,re){if(re.left==null)return!0;var ce=re.left-Q.left,ve=re.top-Q.top;return ce*ce+ve*ve>20*20}ke(t.scroller,"touchstart",function(Q){if(!q(e,Q)&&!T(Q)&&!Ha(e,Q)){t.input.ensurePolled(),clearTimeout(i);var re=+new Date;t.activeTouch={start:re,moved:!1,prev:re-r.end<=300?r:null},Q.touches.length==1&&(t.activeTouch.left=Q.touches[0].pageX,t.activeTouch.top=Q.touches[0].pageY)}}),ke(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),ke(t.scroller,"touchend",function(Q){var re=t.activeTouch;if(re&&!Hr(t,Q)&&re.left!=null&&!re.moved&&new Date-re.start<300){var ce=e.coordsChar(t.activeTouch,"page"),ve;!re.prev||j(re,re.prev)?ve=new Rt(ce,ce):!re.prev.prev||j(re,re.prev.prev)?ve=e.findWordAt(ce):ve=new Rt(Fe(ce.line,0),mt(e.doc,Fe(ce.line+1,0))),e.setSelection(ve.anchor,ve.head),e.focus(),te(Q)}n()}),ke(t.scroller,"touchcancel",n),ke(t.scroller,"scroll",function(){t.scroller.clientHeight&&(ln(e,t.scroller.scrollTop),fi(e,t.scroller.scrollLeft,!0),se(e,"scroll",e))}),ke(t.scroller,"mousewheel",function(Q){return Ro(e,Q)}),ke(t.scroller,"DOMMouseScroll",function(Q){return Ro(e,Q)}),ke(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(Q){q(e,Q)||de(Q)},over:function(Q){q(e,Q)||(kl(e,Q),de(Q))},start:function(Q){return Ll(e,Q)},drop:Xt(e,Al),leave:function(Q){q(e,Q)||ns(e)}};var Y=t.input.getField();ke(Y,"keyup",function(Q){return ms.call(e,Q)}),ke(Y,"keydown",Xt(e,ps)),ke(Y,"keypress",Xt(e,gs)),ke(Y,"focus",function(Q){return Ta(e,Q)}),ke(Y,"blur",function(Q){return _i(e,Q)})}var Ga=[];Nt.defineInitHook=function(e){return Ga.push(e)};function An(e,t,i,r){var n=e.doc,T;i==null&&(i="add"),i=="smart"&&(n.mode.indent?T=Ar(e,t).state:i="prev");var j=e.options.tabSize,Y=Ze(n,t),Q=$(Y.text,null,j);Y.stateAfter&&(Y.stateAfter=null);var re=Y.text.match(/^\s*/)[0],ce;if(!r&&!/\S/.test(Y.text))ce=0,i="not";else if(i=="smart"&&(ce=n.mode.indent(T,Y.text.slice(re.length),Y.text),ce==De||ce>150)){if(!r)return;i="prev"}i=="prev"?t>n.first?ce=$(Ze(n,t-1).text,null,j):ce=0:i=="add"?ce=Q+e.options.indentUnit:i=="subtract"?ce=Q-e.options.indentUnit:typeof i=="number"&&(ce=Q+i),ce=Math.max(0,ce);var ve="",Ae=0;if(e.options.indentWithTabs)for(var Te=Math.floor(ce/j);Te;--Te)Ae+=j,ve+=" ";if(Ae<ce&&(ve+=G(ce-Ae)),ve!=re)return Bi(n,ve,Fe(t,0),Fe(t,re.length),"+input"),Y.stateAfter=null,!0;for(var Ie=0;Ie<n.sel.ranges.length;Ie++){var Ne=n.sel.ranges[Ie];if(Ne.head.line==t&&Ne.head.ch<re.length){var Ge=Fe(t,re.length);Na(n,Ie,new Rt(Ge,Ge));break}}}var Mr=null;function ra(e){Mr=e}function za(e,t,i,r,n){var T=e.doc;e.display.shift=!1,r||(r=T.sel);var j=+new Date-200,Y=n=="paste"||e.state.pasteIncoming>j,Q=st(t),re=null;if(Y&&r.ranges.length>1)if(Mr&&Mr.text.join(`
|
|
`)==t){if(r.ranges.length%Mr.text.length==0){re=[];for(var ce=0;ce<Mr.text.length;ce++)re.push(T.splitLines(Mr.text[ce]))}}else Q.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(re=c(Q,function(Ye){return[Ye]}));for(var ve=e.curOp.updateInput,Ae=r.ranges.length-1;Ae>=0;Ae--){var Te=r.ranges[Ae],Ie=Te.from(),Ne=Te.to();Te.empty()&&(i&&i>0?Ie=Fe(Ie.line,Ie.ch-i):e.state.overwrite&&!Y?Ne=Fe(Ne.line,Math.min(Ze(T,Ne.line).text.length,Ne.ch+s(Q).length)):Y&&Mr&&Mr.lineWise&&Mr.text.join(`
|
|
`)==Q.join(`
|
|
`)&&(Ie=Ne=Fe(Ie.line,0)));var Ge={from:Ie,to:Ne,text:re?re[Ae%re.length]:Q,origin:n||(Y?"paste":e.state.cutIncoming>j?"cut":"+input")};Ni(e.doc,Ge),Jt(e,"inputRead",e,Ge)}t&&!Y&&Cs(e,t),Oi(e),e.curOp.updateInput<2&&(e.curOp.updateInput=ve),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Ts(e,t){var i=e.clipboardData&&e.clipboardData.getData("Text");if(i)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&vr(t,function(){return za(t,i,0,null,"paste")}),!0}function Cs(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 T=e.getModeAt(n.head),j=!1;if(T.electricChars){for(var Y=0;Y<T.electricChars.length;Y++)if(t.indexOf(T.electricChars.charAt(Y))>-1){j=An(e,n.head.line,"smart");break}}else T.electricInput&&(T.electricInput.test(Ze(e.doc,n.head.line).text.slice(0,n.head.ch))&&(j=An(e,n.head.line,"smart")));j&&Jt(e,"electricInput",e,n.head.line)}}function ws(e){for(var t=[],i=[],r=0;r<e.doc.sel.ranges.length;r++){var n=e.doc.sel.ranges[r].head.line,T={anchor:Fe(n,0),head:Fe(n+1,0)};i.push(T),t.push(e.getRange(T.anchor,T.head))}return{text:t,ranges:i}}function As(e,t,i,r){e.setAttribute("autocorrect",i?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function Ls(){var e=a("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=a("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return B?e.style.width="1000px":e.setAttribute("wrap","off"),y&&(e.style.border="1px solid black"),As(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 T=this.options,j=T[r];if(T[r]==n&&r!="mode")return;T[r]=n,t.hasOwnProperty(r)&&Xt(this,t[r])(this,n,j),se(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"](qn(r))},removeKeyMap:function(r){for(var n=this.state.keyMaps,T=0;T<n.length;++T)if(n[T]==r||n[T].name==r)return n.splice(T,1),!0},addOverlay:sr(function(r,n){var T=r.token?r:e.getMode(this.options,r);if(T.startState)throw new Error("Overlays may not be stateful.");R(this.state.overlays,{mode:T,modeSpec:r,opaque:n&&n.opaque,priority:n&&n.priority||0},function(j){return j.priority}),this.state.modeGen++,cr(this)}),removeOverlay:sr(function(r){for(var n=this.state.overlays,T=0;T<n.length;++T){var j=n[T].modeSpec;if(j==r||typeof r=="string"&&j.name==r){n.splice(T,1),this.state.modeGen++,cr(this);return}}}),indentLine:sr(function(r,n,T){typeof n!="string"&&typeof n!="number"&&(n==null?n=this.options.smartIndent?"smart":"prev":n=n?"add":"subtract"),br(this.doc,r)&&An(this,r,n,T)}),indentSelection:sr(function(r){for(var n=this.doc.sel.ranges,T=-1,j=0;j<n.length;j++){var Y=n[j];if(Y.empty())Y.head.line>T&&(An(this,Y.head.line,r,!0),T=Y.head.line,j==this.doc.sel.primIndex&&Oi(this));else{var Q=Y.from(),re=Y.to(),ce=Math.max(T,Q.line);T=Math.min(this.lastLine(),re.line-(re.ch?0:1))+1;for(var ve=ce;ve<T;++ve)An(this,ve,r);var Ae=this.doc.sel.ranges;Q.ch==0&&n.length==Ae.length&&Ae[j].from().ch>0&&Na(this.doc,j,new Rt(Q,Ae[j].to()),Se)}}}),getTokenAt:function(r,n){return kn(this,r,n)},getLineTokens:function(r,n){return kn(this,Fe(r),n,!0)},getTokenTypeAt:function(r){r=mt(this.doc,r);var n=ni(this,Ze(this.doc,r.line)),T=0,j=(n.length-1)/2,Y=r.ch,Q;if(Y==0)Q=n[2];else for(;;){var re=T+j>>1;if((re?n[re*2-1]:0)>=Y)j=re;else if(n[re*2+1]<Y)T=re+1;else{Q=n[re*2+2];break}}var ce=Q?Q.indexOf("overlay "):-1;return ce<0?Q:ce==0?null:Q.slice(0,ce-1)},getModeAt:function(r){var n=this.doc.mode;return n.innerMode?e.innerMode(n,this.getTokenAt(r).state).mode:n},getHelper:function(r,n){return this.getHelpers(r,n)[0]},getHelpers:function(r,n){var T=[];if(!i.hasOwnProperty(n))return T;var j=i[n],Y=this.getModeAt(r);if(typeof Y[n]=="string")j[Y[n]]&&T.push(j[Y[n]]);else if(Y[n])for(var Q=0;Q<Y[n].length;Q++){var re=j[Y[n][Q]];re&&T.push(re)}else Y.helperType&&j[Y.helperType]?T.push(j[Y.helperType]):j[Y.name]&&T.push(j[Y.name]);for(var ce=0;ce<j._global.length;ce++){var ve=j._global[ce];ve.pred(Y,this)&&he(T,ve.val)==-1&&T.push(ve.val)}return T},getStateAfter:function(r,n){var T=this.doc;return r=Ei(T,r==null?T.first+T.size-1:r),Ar(this,r+1,n).state},cursorCoords:function(r,n){var T,j=this.doc.sel.primary();return r==null?T=j.head:typeof r=="object"?T=mt(this.doc,r):T=r?j.from():j.to(),_r(this,T,n||"page")},charCoords:function(r,n){return ma(this,mt(this.doc,r),n||"page")},coordsChar:function(r,n){return r=lo(this,r,n||"page"),va(this,r.left,r.top)},lineAtHeight:function(r,n){return r=lo(this,{top:r,left:0},n||"page").top,kt(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,n,T){var j=!1,Y;if(typeof r=="number"){var Q=this.doc.first+this.doc.size-1;r<this.doc.first?r=this.doc.first:r>Q&&(r=Q,j=!0),Y=Ze(this.doc,r)}else Y=r;return Fn(this,Y,{top:0,left:0},n||"page",T||j).top+(j?this.doc.height-Rr(Y):0)},defaultTextHeight:function(){return Di(this.display)},defaultCharWidth:function(){return Ri(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,n,T,j,Y){var Q=this.display;r=_r(this,mt(this.doc,r));var re=r.bottom,ce=r.left;if(n.style.position="absolute",n.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(n),Q.sizer.appendChild(n),j=="over")re=r.top;else if(j=="above"||j=="near"){var ve=Math.max(Q.wrapper.clientHeight,this.doc.height),Ae=Math.max(Q.sizer.clientWidth,Q.lineSpace.clientWidth);(j=="above"||r.bottom+n.offsetHeight>ve)&&r.top>n.offsetHeight?re=r.top-n.offsetHeight:r.bottom+n.offsetHeight<=ve&&(re=r.bottom),ce+n.offsetWidth>Ae&&(ce=Ae-n.offsetWidth)}n.style.top=re+"px",n.style.left=n.style.right="",Y=="right"?(ce=Q.sizer.clientWidth-n.offsetWidth,n.style.right="0px"):(Y=="left"?ce=0:Y=="middle"&&(ce=(Q.sizer.clientWidth-n.offsetWidth)/2),n.style.left=ce+"px"),T&&Zs(this,{left:ce,top:re,right:ce+n.offsetWidth,bottom:re+n.offsetHeight})},triggerOnKeyDown:sr(ps),triggerOnKeyPress:sr(gs),triggerOnKeyUp:ms,triggerOnMouseDown:sr(vs),execCommand:function(r){if(Sn.hasOwnProperty(r))return Sn[r].call(null,this)},triggerElectric:sr(function(r){Cs(this,r)}),findPosH:function(r,n,T,j){var Y=1;n<0&&(Y=-1,n=-n);for(var Q=mt(this.doc,r),re=0;re<n&&!(Q=Ka(this.doc,Q,Y,T,j),Q.hitSide);++re);return Q},moveH:sr(function(r,n){var T=this;this.extendSelectionsBy(function(j){return T.display.shift||T.doc.extend||j.empty()?Ka(T.doc,j.head,r,n,T.options.rtlMoveVisually):r<0?j.from():j.to()},Ce)}),deleteH:sr(function(r,n){var T=this.doc.sel,j=this.doc;T.somethingSelected()?j.replaceSelection("",null,"+delete"):ji(this,function(Y){var Q=Ka(j,Y.head,r,n,!1);return r<0?{from:Q,to:Y.head}:{from:Y.head,to:Q}})}),findPosV:function(r,n,T,j){var Y=1,Q=j;n<0&&(Y=-1,n=-n);for(var re=mt(this.doc,r),ce=0;ce<n;++ce){var ve=_r(this,re,"div");if(Q==null?Q=ve.left:ve.left=Q,re=ks(this,ve,Y,T),re.hitSide)break}return re},moveV:sr(function(r,n){var T=this,j=this.doc,Y=[],Q=!this.display.shift&&!j.extend&&j.sel.somethingSelected();if(j.extendSelectionsBy(function(ce){if(Q)return r<0?ce.from():ce.to();var ve=_r(T,ce.head,"div");ce.goalColumn!=null&&(ve.left=ce.goalColumn),Y.push(ve.left);var Ae=ks(T,ve,r,n);return n=="page"&&ce==j.sel.primary()&&wa(T,ma(T,Ae,"div").top-ve.top),Ae},Ce),Y.length)for(var re=0;re<j.sel.ranges.length;re++)j.sel.ranges[re].goalColumn=Y[re]}),findWordAt:function(r){var n=this.doc,T=Ze(n,r.line).text,j=r.ch,Y=r.ch;if(T){var Q=this.getHelper(r,"wordChars");(r.sticky=="before"||Y==T.length)&&j?--j:++Y;for(var re=T.charAt(j),ce=we(re,Q)?function(ve){return we(ve,Q)}:/\s/.test(re)?function(ve){return/\s/.test(ve)}:function(ve){return!/\s/.test(ve)&&!we(ve)};j>0&&ce(T.charAt(j-1));)--j;for(;Y<T.length&&ce(T.charAt(Y));)++Y}return new Rt(Fe(r.line,j),Fe(r.line,Y))},toggleOverwrite:function(r){if(r!=null&&r==this.state.overwrite)return;(this.state.overwrite=!this.state.overwrite)?W(this.display.cursorDiv,"CodeMirror-overwrite"):f(this.display.cursorDiv,"CodeMirror-overwrite"),se(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==F()},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:sr(function(r,n){sn(this,r,n)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-Ir(this)-this.display.barHeight,width:r.scrollWidth-Ir(this)-this.display.barWidth,clientHeight:ca(this),clientWidth:ui(this)}},scrollIntoView:sr(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:Fe(r,0),to:null}:r.from==null&&(r={from:r,to:null}),r.to||(r.to=r.from),r.margin=n||0,r.from.line!=null?Qs(this,r):xo(this,r.from,r.to,r.margin)}),setSize:sr(function(r,n){var T=this,j=function(Q){return typeof Q=="number"||/^\d+$/.test(String(Q))?Q+"px":Q};r!=null&&(this.display.wrapper.style.width=j(r)),n!=null&&(this.display.wrapper.style.height=j(n)),this.options.lineWrapping&&ao(this);var Y=this.display.viewFrom;this.doc.iter(Y,this.display.viewTo,function(Q){if(Q.widgets){for(var re=0;re<Q.widgets.length;re++)if(Q.widgets[re].noHScroll){Xr(T,Y,"widget");break}}++Y}),this.curOp.forceUpdate=!0,se(this,"refresh",this)}),operation:function(r){return vr(this,r)},startOperation:function(){return mi(this)},endOperation:function(){return gi(this)},refresh:sr(function(){var r=this.display.cachedTextHeight;cr(this),this.curOp.forceUpdate=!0,an(this),sn(this,this.doc.scrollLeft,this.doc.scrollTop),ka(this.display),(r==null||Math.abs(r-Di(this.display))>.5||this.options.lineWrapping)&&Ea(this),se(this,"refresh",this)}),swapDoc:sr(function(r){var n=this.doc;return n.cm=null,this.state.selectingText&&this.state.selectingText(),Po(this,r),an(this),this.display.input.reset(),sn(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,Jt(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}},le(e),e.registerHelper=function(r,n,T){i.hasOwnProperty(r)||(i[r]=e[r]={_global:[]}),i[r][n]=T},e.registerGlobalHelper=function(r,n,T,j){e.registerHelper(r,n,j),i[r]._global.push({pred:T,val:j})}}function Ka(e,t,i,r,n){var T=t,j=i,Y=Ze(e,t.line),Q=n&&e.direction=="rtl"?-i:i;function re(){var et=t.line+Q;return et<e.first||et>=e.first+e.size?!1:(t=new Fe(et,t.ch,t.sticky),Y=Ze(e,et))}function ce(et){var $e;if(r=="codepoint"){var it=Y.text.charCodeAt(t.ch+(r>0?0:-1));isNaN(it)?$e=null:$e=new Fe(t.line,Math.max(0,Math.min(Y.text.length,t.ch+i*(it>=55296&&it<56320?2:1))),-i)}else n?$e=Pl(e.cm,Y,t,i):$e=Fa(Y,t,i);if($e==null)if(!et&&re())t=Ua(n,e.cm,Y,t.line,Q);else return!1;else t=$e;return!0}if(r=="char"||r=="codepoint")ce();else if(r=="column")ce(!0);else if(r=="word"||r=="group")for(var ve=null,Ae=r=="group",Te=e.cm&&e.cm.getHelper(t,"wordChars"),Ie=!0;!(i<0&&!ce(!Ie));Ie=!1){var Ne=Y.text.charAt(t.ch)||`
|
|
`,Ge=we(Ne,Te)?"w":Ae&&Ne==`
|
|
`?"n":!Ae||/\s/.test(Ne)?null:"p";if(Ae&&!Ie&&!Ge&&(Ge="s"),ve&&ve!=Ge){i<0&&(i=1,ce(),t.sticky="after");break}if(Ge&&(ve=Ge),i>0&&!ce(!Ie))break}var Ye=Zn(e,t,T,j,!0);return ri(T,Ye)&&(Ye.hitSide=!0),Ye}function ks(e,t,i,r){var n=e.doc,T=t.left,j;if(r=="page"){var Y=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),Q=Math.max(Y-.5*Di(e.display),3);j=(i>0?t.bottom:t.top)+i*Q}else r=="line"&&(j=i>0?t.bottom+3:t.top-3);for(var re;!(re=va(e,T,j),!re.outside);){if(i<0?j<=0:j>=n.height){re.hitSide=!0;break}j+=i*5}return re}var _t=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new ae,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};_t.prototype.init=function(e){var t=this,i=this,r=i.cm,n=i.div=e.lineDiv;As(n,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function T(Y){for(var Q=Y.target;Q;Q=Q.parentNode){if(Q==n)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(Q.className))break}return!1}ke(n,"paste",function(Y){if(!T(Y)||q(r,Y)||Ts(Y,r))return;H<=11&&setTimeout(Xt(r,function(){return t.updateFromDOM()}),20)}),ke(n,"compositionstart",function(Y){t.composing={data:Y.data,done:!1}}),ke(n,"compositionupdate",function(Y){t.composing||(t.composing={data:Y.data,done:!1})}),ke(n,"compositionend",function(Y){t.composing&&(Y.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),ke(n,"touchstart",function(){return i.forceCompositionEnd()}),ke(n,"input",function(){t.composing||t.readFromDOMSoon()});function j(Y){if(!T(Y)||q(r,Y))return;if(r.somethingSelected())ra({lineWise:!1,text:r.getSelections()}),Y.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var Q=ws(r);ra({lineWise:!0,text:Q.text}),Y.type=="cut"&&r.operation(function(){r.setSelections(Q.ranges,0,Se),r.replaceSelection("",null,"cut")})}else return;if(Y.clipboardData){Y.clipboardData.clearData();var re=Mr.text.join(`
|
|
`);if(Y.clipboardData.setData("Text",re),Y.clipboardData.getData("Text")==re){Y.preventDefault();return}}var ce=Ls(),ve=ce.firstChild;r.display.lineSpace.insertBefore(ce,r.display.lineSpace.firstChild),ve.value=Mr.text.join(`
|
|
`);var Ae=document.activeElement;V(ve),setTimeout(function(){r.display.lineSpace.removeChild(ce),Ae.focus(),Ae==n&&i.showPrimarySelection()},50)}ke(n,"copy",j),ke(n,"cut",j)},_t.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},_t.prototype.prepareSelection=function(){var e=mo(this.cm,!1);return e.focus=document.activeElement==this.div,e},_t.prototype.showSelection=function(e,t){if(!e||!this.cm.display.view.length)return;(e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e)},_t.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},_t.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 T=ia(t,e.anchorNode,e.anchorOffset),j=ia(t,e.focusNode,e.focusOffset);if(T&&!T.bad&&j&&!j.bad&&ct(ii(T,j),r)==0&&ct(xi(T,j),n)==0)return;var Y=t.display.view,Q=r.line>=t.display.viewFrom&&Ds(t,r)||{node:Y[0].measure.map[2],offset:0},re=n.line<t.display.viewTo&&Ds(t,n);if(!re){var ce=Y[Y.length-1].measure,ve=ce.maps?ce.maps[ce.maps.length-1]:ce.map;re={node:ve[ve.length-1],offset:ve[ve.length-2]-ve[ve.length-3]}}if(!Q||!re){e.removeAllRanges();return}var Ae=e.rangeCount&&e.getRangeAt(0),Te;try{Te=g(Q.node,Q.offset,re.offset,re.node)}catch(Ie){}Te&&(!_&&t.state.focused?(e.collapse(Q.node,Q.offset),Te.collapsed||(e.removeAllRanges(),e.addRange(Te))):(e.removeAllRanges(),e.addRange(Te)),Ae&&e.anchorNode==null?e.addRange(Ae):_&&this.startGracePeriod()),this.rememberSelection()},_t.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)},_t.prototype.showMultipleSelections=function(e){d(this.cm.display.cursorDiv,e.cursors),d(this.cm.display.selectionDiv,e.selection)},_t.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},_t.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return S(this.div,t)},_t.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||document.activeElement!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},_t.prototype.blur=function(){this.div.blur()},_t.prototype.getField=function(){return this.div},_t.prototype.supportsTouch=function(){return!0},_t.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():vr(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)},_t.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},_t.prototype.pollSelection=function(){if(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())return;var e=this.getSelection(),t=this.cm;if(h&&b&&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=ia(t,e.anchorNode,e.anchorOffset),r=ia(t,e.focusNode,e.focusOffset);i&&r&&vr(t,function(){tr(t.doc,$r(i,r),Se),(i.bad||r.bad)&&(t.curOp.selectionChanged=!0)})},_t.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=Fe(r.line-1,Ze(e.doc,r.line-1).length)),n.ch==Ze(e.doc,n.line).text.length&&n.line<e.lastLine()&&(n=Fe(n.line+1,0)),r.line<t.viewFrom||n.line>t.viewTo-1)return!1;var T,j,Y;r.line==t.viewFrom||(T=ci(e,r.line))==0?(j=gt(t.view[0].line),Y=t.view[0].node):(j=gt(t.view[T].line),Y=t.view[T-1].node.nextSibling);var Q=ci(e,n.line),re,ce;if(Q==t.view.length-1?(re=t.viewTo-1,ce=t.lineDiv.lastChild):(re=gt(t.view[Q+1].line)-1,ce=t.view[Q+1].node.previousSibling),!Y)return!1;for(var ve=e.doc.splitLines(tu(e,Y,ce,j,re)),Ae=At(e.doc,Fe(j,0),Fe(re,Ze(e.doc,re).text.length));ve.length>1&&Ae.length>1;)if(s(ve)==s(Ae))ve.pop(),Ae.pop(),re--;else if(ve[0]==Ae[0])ve.shift(),Ae.shift(),j++;else break;for(var Te=0,Ie=0,Ne=ve[0],Ge=Ae[0],Ye=Math.min(Ne.length,Ge.length);Te<Ye&&Ne.charCodeAt(Te)==Ge.charCodeAt(Te);)++Te;for(var et=s(ve),$e=s(Ae),it=Math.min(et.length-(ve.length==1?Te:0),$e.length-(Ae.length==1?Te:0));Ie<it&&et.charCodeAt(et.length-Ie-1)==$e.charCodeAt($e.length-Ie-1);)++Ie;if(ve.length==1&&Ae.length==1&&j==r.line)for(;Te&&Te>r.ch&&et.charCodeAt(et.length-Ie-1)==$e.charCodeAt($e.length-Ie-1);)Te--,Ie++;ve[ve.length-1]=et.slice(0,et.length-Ie).replace(/^\u200b+/,""),ve[0]=ve[0].slice(Te).replace(/\u200b+$/,"");var dt=Fe(j,Te),ut=Fe(re,Ae.length?s(Ae).length-Ie:0);if(ve.length>1||ve[0]||ct(dt,ut))return Bi(e.doc,ve,dt,ut,"+input"),!0},_t.prototype.ensurePolled=function(){this.forceCompositionEnd()},_t.prototype.reset=function(){this.forceCompositionEnd()},_t.prototype.forceCompositionEnd=function(){if(!this.composing)return;clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus()},_t.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)},_t.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&vr(this.cm,function(){return cr(e.cm)})},_t.prototype.setUneditable=function(e){e.contentEditable="false"},_t.prototype.onKeyPress=function(e){if(e.charCode==0||this.composing)return;e.preventDefault(),this.cm.isReadOnly()||Xt(this.cm,za)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0)},_t.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},_t.prototype.onContextMenu=function(){},_t.prototype.resetPosition=function(){},_t.prototype.needsContentAttribute=!0;function Ds(e,t){var i=fa(e,t.line);if(!i||i.hidden)return null;var r=Ze(e.doc,t.line),n=eo(i,r,t.line),T=je(r,e.doc.direction),j="left";if(T){var Y=ze(T,t.ch);j=Y%2?"right":"left"}var Q=io(n.map,t.ch,j);return Q.offset=Q.collapse=="right"?Q.end:Q.start,Q}function eu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function Hi(e,t){return t&&(e.bad=!0),e}function tu(e,t,i,r,n){var T="",j=!1,Y=e.doc.lineSeparator(),Q=!1;function re(Te){return function(Ie){return Ie.id==Te}}function ce(){j&&(T+=Y,Q&&(T+=Y),j=Q=!1)}function ve(Te){Te&&(ce(),T+=Te)}function Ae(Te){if(Te.nodeType==1){var Ie=Te.getAttribute("cm-text");if(Ie){ve(Ie);return}var Ne=Te.getAttribute("cm-marker"),Ge;if(Ne){var Ye=e.findMarks(Fe(r,0),Fe(n+1,0),re(+Ne));Ye.length&&(Ge=Ye[0].find(0))&&ve(At(e.doc,Ge.from,Ge.to).join(Y));return}if(Te.getAttribute("contenteditable")=="false")return;var et=/^(pre|div|p|li|table|br)$/i.test(Te.nodeName);if(!/^br$/i.test(Te.nodeName)&&Te.textContent.length==0)return;et&&ce();for(var $e=0;$e<Te.childNodes.length;$e++)Ae(Te.childNodes[$e]);/^(pre|p)$/i.test(Te.nodeName)&&(Q=!0),et&&(j=!0)}else Te.nodeType==3&&ve(Te.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;!(Ae(t),t==i);)t=t.nextSibling,Q=!1;return T}function ia(e,t,i){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[i],!r)return Hi(e.clipPos(Fe(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 T=e.display.view[n];if(T.node==r)return ru(T,t,i)}}function ru(e,t,i){var r=e.text.firstChild,n=!1;if(!t||!S(r,t))return Hi(Fe(gt(e.line),0),!0);if(t==r&&(n=!0,t=r.childNodes[i],i=0,!t)){var T=e.rest?s(e.rest):e.line;return Hi(Fe(gt(T),T.text.length),n)}var j=t.nodeType==3?t:null,Y=t;for(!j&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(j=t.firstChild,i&&(i=j.nodeValue.length));Y.parentNode!=r;)Y=Y.parentNode;var Q=e.measure,re=Q.maps;function ce(Ge,Ye,et){for(var $e=-1;$e<(re?re.length:0);$e++)for(var it=$e<0?Q.map:re[$e],dt=0;dt<it.length;dt+=3){var ut=it[dt+2];if(ut==Ge||ut==Ye){var Et=gt($e<0?e.line:e.rest[$e]),Pt=it[dt]+et;return(et<0||ut!=Ge)&&(Pt=it[dt+(et?1:0)]),Fe(Et,Pt)}}}var ve=ce(j,Y,i);if(ve)return Hi(ve,n);for(var Ae=Y.nextSibling,Te=j?j.nodeValue.length-i:0;Ae;Ae=Ae.nextSibling){if(ve=ce(Ae,Ae.firstChild,0),ve)return Hi(Fe(ve.line,ve.ch-Te),n);Te+=Ae.textContent.length}for(var Ie=Y.previousSibling,Ne=i;Ie;Ie=Ie.previousSibling){if(ve=ce(Ie,Ie.firstChild,-1),ve)return Hi(Fe(ve.line,ve.ch+Ne),n);Ne+=Ie.textContent.length}}var Ut=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new ae,this.hasSelection=!1,this.composing=null};Ut.prototype.init=function(e){var t=this,i=this,r=this.cm;this.createField(e);var n=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),y&&(n.style.width="0px"),ke(n,"input",function(){z&&H>=9&&t.hasSelection&&(t.hasSelection=null),i.poll()}),ke(n,"paste",function(j){if(q(r,j)||Ts(j,r))return;r.state.pasteIncoming=+new Date,i.fastPoll()});function T(j){if(q(r,j))return;if(r.somethingSelected())ra({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var Y=ws(r);ra({lineWise:!0,text:Y.text}),j.type=="cut"?r.setSelections(Y.ranges,null,Se):(i.prevInput="",n.value=Y.text.join(`
|
|
`),V(n))}else return;j.type=="cut"&&(r.state.cutIncoming=+new Date)}ke(n,"cut",T),ke(n,"copy",T),ke(e.scroller,"paste",function(j){if(Hr(e,j)||q(r,j))return;if(!n.dispatchEvent){r.state.pasteIncoming=+new Date,i.focus();return}var Y=new Event("paste");Y.clipboardData=j.clipboardData,n.dispatchEvent(Y)}),ke(e.lineSpace,"selectstart",function(j){Hr(e,j)||te(j)}),ke(n,"compositionstart",function(){var j=r.getCursor("from");i.composing&&i.composing.range.clear(),i.composing={start:j,range:r.markText(j,r.getCursor("to"),{className:"CodeMirror-composing"})}}),ke(n,"compositionend",function(){i.composing&&(i.poll(),i.composing.range.clear(),i.composing=null)})},Ut.prototype.createField=function(e){this.wrapper=Ls(),this.textarea=this.wrapper.firstChild},Ut.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},Ut.prototype.prepareSelection=function(){var e=this.cm,t=e.display,i=e.doc,r=mo(e);if(e.options.moveInputWithCursor){var n=_r(e,i.sel.primary().head,"div"),T=t.wrapper.getBoundingClientRect(),j=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,n.top+j.top-T.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,n.left+j.left-T.left))}return r},Ut.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")},Ut.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),z&&H>=9&&(this.hasSelection=i)}else e||(this.prevInput=this.textarea.value="",z&&H>=9&&(this.hasSelection=null))},Ut.prototype.getField=function(){return this.textarea},Ut.prototype.supportsTouch=function(){return!1},Ut.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!o||F()!=this.textarea))try{this.textarea.focus()}catch(e){}},Ut.prototype.blur=function(){this.textarea.blur()},Ut.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Ut.prototype.receivedFocus=function(){this.slowPoll()},Ut.prototype.slowPoll=function(){var e=this;if(this.pollingFast)return;this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},Ut.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function i(){var r=t.poll();!r&&!e?(e=!0,t.polling.set(60,i)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,i)},Ut.prototype.poll=function(){var e=this,t=this.cm,i=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||nt(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(z&&H>=9&&this.hasSelection===n||l&&/[\uf700-\uf7ff]/.test(n))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var T=n.charCodeAt(0);if(T==8203&&!r&&(r="\u200B"),T==8666)return this.reset(),this.cm.execCommand("undo")}for(var j=0,Y=Math.min(r.length,n.length);j<Y&&r.charCodeAt(j)==n.charCodeAt(j);)++j;return vr(t,function(){za(t,n.slice(j),r.length-j,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},Ut.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Ut.prototype.onKeyPress=function(){z&&H>=9&&(this.hasSelection=null),this.fastPoll()},Ut.prototype.onContextMenu=function(e){var t=this,i=t.cm,r=i.display,n=t.textarea;t.contextMenuPending&&t.contextMenuPending();var T=di(i,e),j=r.scroller.scrollTop;if(!T||A)return;var Y=i.options.resetSelectionOnContextMenu;Y&&i.doc.sel.contains(T)==-1&&Xt(i,tr)(i.doc,$r(T),Se);var Q=n.style.cssText,re=t.wrapper.style.cssText,ce=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",n.style.cssText=`position: absolute; width: 30px; height: 30px;
|
|
top: `+(e.clientY-ce.top-5)+"px; left: "+(e.clientX-ce.left-5)+`px;
|
|
z-index: 1000; background: `+(z?"rgba(255, 255, 255, .05)":"transparent")+`;
|
|
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var ve;B&&(ve=window.scrollY),r.input.focus(),B&&window.scrollTo(null,ve),r.input.reset(),i.somethingSelected()||(n.value=t.prevInput=" "),t.contextMenuPending=Te,r.selForContextMenu=i.doc.sel,clearTimeout(r.detectingSelectAll);function Ae(){if(n.selectionStart!=null){var Ne=i.somethingSelected(),Ge="\u200B"+(Ne?n.value:"");n.value="\u21DA",n.value=Ge,t.prevInput=Ne?"":"\u200B",n.selectionStart=1,n.selectionEnd=Ge.length,r.selForContextMenu=i.doc.sel}}function Te(){if(t.contextMenuPending!=Te)return;if(t.contextMenuPending=!1,t.wrapper.style.cssText=re,n.style.cssText=Q,z&&H<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=j),n.selectionStart!=null){(!z||z&&H<9)&&Ae();var Ne=0,Ge=function(){r.selForContextMenu==i.doc.sel&&n.selectionStart==0&&n.selectionEnd>0&&t.prevInput=="\u200B"?Xt(i,Xo)(i):Ne++<10?r.detectingSelectAll=setTimeout(Ge,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(Ge,200)}}if(z&&H>=9&&Ae(),k){de(e);var Ie=function(){qe(window,"mouseup",Ie),setTimeout(Te,20)};ke(window,"mouseup",Ie)}else setTimeout(Te,50)},Ut.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},Ut.prototype.setUneditable=function(){},Ut.prototype.needsContentAttribute=!1;function iu(e,t){if(t=t?I(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),t.autofocus==null){var i=F();t.autofocus=i==e||e.getAttribute("autofocus")!=null&&i==document.body}function r(){e.value=Y.getValue()}var n;if(e.form&&(ke(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var T=e.form;n=T.submit;try{var j=T.submit=function(){r(),T.submit=n,T.submit(),T.submit=j}}catch(Q){}}t.finishInit=function(Q){Q.save=r,Q.getTextArea=function(){return e},Q.toTextArea=function(){Q.toTextArea=isNaN,r(),e.parentNode.removeChild(Q.getWrapperElement()),e.style.display="",e.form&&(qe(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=n))}},e.style.display="none";var Y=Nt(function(Q){return e.parentNode.insertBefore(Q,e.nextSibling)},t);return Y}function nu(e){e.off=qe,e.on=ke,e.wheelEventPixels=dl,e.Doc=fr,e.splitLines=st,e.countColumn=$,e.findColumn=xe,e.isWordChar=be,e.Pass=De,e.signal=se,e.Line=li,e.changeEnd=Zr,e.scrollbarModel=To,e.Pos=Fe,e.cmpPos=ct,e.modes=bt,e.mimeModes=Ke,e.resolveMode=Kt,e.getMode=Ot,e.modeExtensions=ar,e.extendMode=wr,e.copyState=Vt,e.startState=ti,e.innerMode=ur,e.commands=Sn,e.keyMap=Gr,e.keyName=us,e.isModifierKey=ss,e.lookupKey=Ui,e.normalizeKeyMap=Ml,e.StringStream=It,e.SharedTextMarker=bn,e.TextMarker=Jr,e.LineWidget=yn,e.e_preventDefault=te,e.e_stopPropagation=ie,e.e_stop=de,e.addClass=W,e.contains=S,e.rmClass=f,e.keyNames=qr}$l(Nt),ql(Nt);var au="iter insert remove copy getEditor constructor".split(" ");for(var na in fr.prototype)fr.prototype.hasOwnProperty(na)&&he(au,na)<0&&(Nt.prototype[na]=function(e){return function(){return e.apply(this.doc,arguments)}}(fr.prototype[na]));return le(fr),Nt.inputStyles={textarea:Ut,contenteditable:_t},Nt.defineMode=function(e){!Nt.defaults.mode&&e!="null"&&(Nt.defaults.mode=e),ir.apply(this,arguments)},Nt.defineMIME=nr,Nt.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Nt.defineMIME("text/plain","null"),Nt.defineExtension=function(e,t){Nt.prototype[e]=t},Nt.defineDocExtension=function(e,t){fr.prototype[e]=t},Nt.fromTextArea=iu,nu(Nt),Nt.version="5.58.2",Nt})},Y1PL:function(pt,at,pe){"use strict";pe.r(at),pe.d(at,"ResizableTextArea",function(){return he});var fe=pe("wx14"),Z=pe("1OyB"),_=pe("vuIU"),J=pe("Ji7U"),U=pe("LK+K"),D=pe("q1tI"),z=pe("VTBJ"),H=pe("rePB"),B=pe("Zm9Q"),O=pe("Kwbf"),b=pe("c+Xe"),A=pe("m+aA"),P=pe("bdgK"),L=new Map;function w(Se){Se.forEach(function(Re){var Ce,xe=Re.target;(Ce=L.get(xe))===null||Ce===void 0||Ce.forEach(function(me){return me(xe)})})}var y=new P.default(w),h=null,o=null;function l(Se,Re){L.has(Se)||(L.set(Se,new Set),y.observe(Se)),L.get(Se).add(Re)}function u(Se,Re){L.has(Se)&&(L.get(Se).delete(Re),L.get(Se).size||(y.unobserve(Se),L.delete(Se)))}var C=function(Se){Object(J.a)(Ce,Se);var Re=Object(U.a)(Ce);function Ce(){return Object(Z.a)(this,Ce),Re.apply(this,arguments)}return Object(_.a)(Ce,[{key:"render",value:function(){return this.props.children}}]),Ce}(D.Component),v=D.createContext(null);function m(Se){var Re=Se.children,Ce=Se.onBatchResize,xe=D.useRef(0),me=D.useRef([]),G=D.useContext(v),s=D.useCallback(function(c,R,X){xe.current+=1;var N=xe.current;me.current.push({size:c,element:R,data:X}),Promise.resolve().then(function(){N===xe.current&&(Ce==null||Ce(me.current),me.current=[])}),G==null||G(c,R,X)},[Ce,G]);return D.createElement(v.Provider,{value:s},Re)}function k(Se){var Re=Se.children,Ce=Se.disabled,xe=D.useRef(null),me=D.useRef(null),G=D.useContext(v),s=D.useRef({width:-1,height:-1,offsetWidth:-1,offsetHeight:-1}),c=D.isValidElement(Re)&&Object(b.c)(Re),R=c?Re.ref:null,X=D.useMemo(function(){return Object(b.a)(R,xe)},[R,xe]),N=D.useRef(Se);N.current=Se;var oe=D.useCallback(function(be){var we=N.current,_e=we.onResize,Le=we.data,Oe=be.getBoundingClientRect(),Me=Oe.width,Be=Oe.height,Ve=be.offsetWidth,Xe=be.offsetHeight,ze=Math.floor(Me),rt=Math.floor(Be);if(s.current.width!==ze||s.current.height!==rt||s.current.offsetWidth!==Ve||s.current.offsetHeight!==Xe){var je={width:ze,height:rt,offsetWidth:Ve,offsetHeight:Xe};s.current=je;var We=Ve===Math.round(Me)?Me:Ve,ke=Xe===Math.round(Be)?Be:Xe,Je=Object(z.a)(Object(z.a)({},je),{},{offsetWidth:We,offsetHeight:ke});G==null||G(Je,be,Le),_e&&Promise.resolve().then(function(){_e(Je,be)})}},[]);return D.useEffect(function(){var be=Object(A.a)(xe.current)||Object(A.a)(me.current);return be&&!Ce&&l(be,oe),function(){return u(be,oe)}},[xe.current,Ce]),D.createElement(C,{ref:me},c?D.cloneElement(Re,{ref:X}):Re)}var x="rc-observer-key";function f(Se){var Re=Se.children,Ce=Object(B.a)(Re);return Ce.map(function(xe,me){var G=(xe==null?void 0:xe.key)||"".concat(x,"-").concat(me);return D.createElement(k,Object(fe.a)({},Se,{key:G}),xe)})}f.Collection=m;var p=f,d=pe("bT9E"),a=pe("TSYQ"),E=pe.n(a),g=`
|
|
min-height:0 !important;
|
|
max-height:none !important;
|
|
height:0 !important;
|
|
visibility:hidden !important;
|
|
overflow:hidden !important;
|
|
position:absolute !important;
|
|
z-index:-1000 !important;
|
|
top:0 !important;
|
|
right:0 !important
|
|
`,S=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break"],F={},W;function K(Se){var Re=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Ce=Se.getAttribute("id")||Se.getAttribute("data-reactid")||Se.getAttribute("name");if(Re&&F[Ce])return F[Ce];var xe=window.getComputedStyle(Se),me=xe.getPropertyValue("box-sizing")||xe.getPropertyValue("-moz-box-sizing")||xe.getPropertyValue("-webkit-box-sizing"),G=parseFloat(xe.getPropertyValue("padding-bottom"))+parseFloat(xe.getPropertyValue("padding-top")),s=parseFloat(xe.getPropertyValue("border-bottom-width"))+parseFloat(xe.getPropertyValue("border-top-width")),c=S.map(function(X){return"".concat(X,":").concat(xe.getPropertyValue(X))}).join(";"),R={sizingStyle:c,paddingSize:G,borderSize:s,boxSizing:me};return Re&&Ce&&(F[Ce]=R),R}function V(Se){var Re=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Ce=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,xe=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;W||(W=document.createElement("textarea"),W.setAttribute("tab-index","-1"),W.setAttribute("aria-hidden","true"),document.body.appendChild(W)),Se.getAttribute("wrap")?W.setAttribute("wrap",Se.getAttribute("wrap")):W.removeAttribute("wrap");var me=K(Se,Re),G=me.paddingSize,s=me.borderSize,c=me.boxSizing,R=me.sizingStyle;W.setAttribute("style","".concat(R,";").concat(g)),W.value=Se.value||Se.placeholder||"";var X=Number.MIN_SAFE_INTEGER,N=Number.MAX_SAFE_INTEGER,oe=W.scrollHeight,be;if(c==="border-box"?oe+=s:c==="content-box"&&(oe-=G),Ce!==null||xe!==null){W.value=" ";var we=W.scrollHeight-G;Ce!==null&&(X=we*Ce,c==="border-box"&&(X=X+G+s),oe=Math.max(X,oe)),xe!==null&&(N=we*xe,c==="border-box"&&(N=N+G+s),be=oe>N?"":"hidden",oe=Math.min(N,oe))}return{height:oe,minHeight:X,maxHeight:N,overflowY:be,resize:"none"}}var M=pe("Gytx"),I=pe.n(M),$;(function(Se){Se[Se.NONE=0]="NONE",Se[Se.RESIZING=1]="RESIZING",Se[Se.RESIZED=2]="RESIZED"})($||($={}));var ae=function(Se){Object(J.a)(Ce,Se);var Re=Object(U.a)(Ce);function Ce(xe){var me;return Object(Z.a)(this,Ce),me=Re.call(this,xe),me.nextFrameActionId=void 0,me.resizeFrameId=void 0,me.textArea=void 0,me.saveTextArea=function(G){me.textArea=G},me.handleResize=function(G){var s=me.state.resizeStatus,c=me.props,R=c.autoSize,X=c.onResize;if(s!==$.NONE)return;typeof X=="function"&&X(G),R&&me.resizeOnNextFrame()},me.resizeOnNextFrame=function(){cancelAnimationFrame(me.nextFrameActionId),me.nextFrameActionId=requestAnimationFrame(me.resizeTextarea)},me.resizeTextarea=function(){var G=me.props.autoSize;if(!G||!me.textArea)return;var s=G.minRows,c=G.maxRows,R=V(me.textArea,!1,s,c);me.setState({textareaStyles:R,resizeStatus:$.RESIZING},function(){cancelAnimationFrame(me.resizeFrameId),me.resizeFrameId=requestAnimationFrame(function(){me.setState({resizeStatus:$.RESIZED},function(){me.resizeFrameId=requestAnimationFrame(function(){me.setState({resizeStatus:$.NONE}),me.fixFirefoxAutoScroll()})})})})},me.renderTextArea=function(){var G=me.props,s=G.prefixCls,c=s===void 0?"rc-textarea":s,R=G.autoSize,X=G.onResize,N=G.className,oe=G.disabled,be=me.state,we=be.textareaStyles,_e=be.resizeStatus,Le=Object(d.a)(me.props,["prefixCls","onPressEnter","autoSize","defaultValue","onResize"]),Oe=E()(c,N,Object(H.a)({},"".concat(c,"-disabled"),oe));"value"in Le&&(Le.value=Le.value||"");var Me=Object(z.a)(Object(z.a)(Object(z.a)({},me.props.style),we),_e===$.RESIZING?{overflowX:"hidden",overflowY:"hidden"}:null);return D.createElement(p,{onResize:me.handleResize,disabled:!(R||X)},D.createElement("textarea",Object(fe.a)({},Le,{className:Oe,style:Me,ref:me.saveTextArea})))},me.state={textareaStyles:{},resizeStatus:$.NONE},me}return Object(_.a)(Ce,[{key:"componentDidUpdate",value:function(me){(me.value!==this.props.value||!I()(me.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 me=this.textArea.selectionStart,G=this.textArea.selectionEnd;this.textArea.setSelectionRange(me,G)}}catch(s){}}},{key:"render",value:function(){return this.renderTextArea()}}]),Ce}(D.Component),he=ae,ge=function(Se){Object(J.a)(Ce,Se);var Re=Object(U.a)(Ce);function Ce(xe){var me;Object(Z.a)(this,Ce),me=Re.call(this,xe),me.resizableTextArea=void 0,me.focus=function(){me.resizableTextArea.textArea.focus()},me.saveTextArea=function(s){me.resizableTextArea=s},me.handleChange=function(s){var c=me.props.onChange;me.setValue(s.target.value,function(){me.resizableTextArea.resizeTextarea()}),c&&c(s)},me.handleKeyDown=function(s){var c=me.props,R=c.onPressEnter,X=c.onKeyDown;s.keyCode===13&&R&&R(s),X&&X(s)};var G=typeof xe.value=="undefined"||xe.value===null?xe.defaultValue:xe.value;return me.state={value:G},me}return Object(_.a)(Ce,[{key:"setValue",value:function(me,G){"value"in this.props||this.setState({value:me},G)}},{key:"blur",value:function(){this.resizableTextArea.textArea.blur()}},{key:"render",value:function(){return D.createElement(he,Object(fe.a)({},this.props,{value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,ref:this.saveTextArea}))}}],[{key:"getDerivedStateFromProps",value:function(me){return"value"in me?{value:me.value}:null}}]),Ce}(D.Component),De=at.default=ge},Zss7:function(pt,at,pe){var fe;(function(Z){var _=/^\s+/,J=/\s+$/,U=0,D=Z.round,z=Z.min,H=Z.max,B=Z.random;function O(s,c){if(s=s||"",c=c||{},s instanceof O)return s;if(!(this instanceof O))return new O(s,c);var R=b(s);this._originalInput=s,this._r=R.r,this._g=R.g,this._b=R.b,this._a=R.a,this._roundA=D(100*this._a)/100,this._format=c.format||R.format,this._gradientType=c.gradientType,this._r<1&&(this._r=D(this._r)),this._g<1&&(this._g=D(this._g)),this._b<1&&(this._b=D(this._b)),this._ok=R.ok,this._tc_id=U++}O.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 s=this.toRgb();return(s.r*299+s.g*587+s.b*114)/1e3},getLuminance:function(){var s=this.toRgb(),c,R,X,N,oe,be;return c=s.r/255,R=s.g/255,X=s.b/255,c<=.03928?N=c/12.92:N=Z.pow((c+.055)/1.055,2.4),R<=.03928?oe=R/12.92:oe=Z.pow((R+.055)/1.055,2.4),X<=.03928?be=X/12.92:be=Z.pow((X+.055)/1.055,2.4),.2126*N+.7152*oe+.0722*be},setAlpha:function(s){return this._a=V(s),this._roundA=D(100*this._a)/100,this},toHsv:function(){var s=w(this._r,this._g,this._b);return{h:s.h*360,s:s.s,v:s.v,a:this._a}},toHsvString:function(){var s=w(this._r,this._g,this._b),c=D(s.h*360),R=D(s.s*100),X=D(s.v*100);return this._a==1?"hsv("+c+", "+R+"%, "+X+"%)":"hsva("+c+", "+R+"%, "+X+"%, "+this._roundA+")"},toHsl:function(){var s=P(this._r,this._g,this._b);return{h:s.h*360,s:s.s,l:s.l,a:this._a}},toHslString:function(){var s=P(this._r,this._g,this._b),c=D(s.h*360),R=D(s.s*100),X=D(s.l*100);return this._a==1?"hsl("+c+", "+R+"%, "+X+"%)":"hsla("+c+", "+R+"%, "+X+"%, "+this._roundA+")"},toHex:function(s){return h(this._r,this._g,this._b,s)},toHexString:function(s){return"#"+this.toHex(s)},toHex8:function(s){return o(this._r,this._g,this._b,this._a,s)},toHex8String:function(s){return"#"+this.toHex8(s)},toRgb:function(){return{r:D(this._r),g:D(this._g),b:D(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+D(this._r)+", "+D(this._g)+", "+D(this._b)+")":"rgba("+D(this._r)+", "+D(this._g)+", "+D(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:D(M(this._r,255)*100)+"%",g:D(M(this._g,255)*100)+"%",b:D(M(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+D(M(this._r,255)*100)+"%, "+D(M(this._g,255)*100)+"%, "+D(M(this._b,255)*100)+"%)":"rgba("+D(M(this._r,255)*100)+"%, "+D(M(this._g,255)*100)+"%, "+D(M(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:W[h(this._r,this._g,this._b,!0)]||!1},toFilter:function(s){var c="#"+l(this._r,this._g,this._b,this._a),R=c,X=this._gradientType?"GradientType = 1, ":"";if(s){var N=O(s);R="#"+l(N._r,N._g,N._b,N._a)}return"progid:DXImageTransform.Microsoft.gradient("+X+"startColorstr="+c+",endColorstr="+R+")"},toString:function(s){var c=!!s;s=s||this._format;var R=!1,X=this._a<1&&this._a>=0,N=!c&&X&&(s==="hex"||s==="hex6"||s==="hex3"||s==="hex4"||s==="hex8"||s==="name");return N?s==="name"&&this._a===0?this.toName():this.toRgbString():(s==="rgb"&&(R=this.toRgbString()),s==="prgb"&&(R=this.toPercentageRgbString()),(s==="hex"||s==="hex6")&&(R=this.toHexString()),s==="hex3"&&(R=this.toHexString(!0)),s==="hex4"&&(R=this.toHex8String(!0)),s==="hex8"&&(R=this.toHex8String()),s==="name"&&(R=this.toName()),s==="hsl"&&(R=this.toHslString()),s==="hsv"&&(R=this.toHsvString()),R||this.toHexString())},clone:function(){return O(this.toString())},_applyModification:function(s,c){var R=s.apply(null,[this].concat([].slice.call(c)));return this._r=R._r,this._g=R._g,this._b=R._b,this.setAlpha(R._a),this},lighten:function(){return this._applyModification(m,arguments)},brighten:function(){return this._applyModification(k,arguments)},darken:function(){return this._applyModification(x,arguments)},desaturate:function(){return this._applyModification(u,arguments)},saturate:function(){return this._applyModification(C,arguments)},greyscale:function(){return this._applyModification(v,arguments)},spin:function(){return this._applyModification(f,arguments)},_applyCombination:function(s,c){return s.apply(null,[this].concat([].slice.call(c)))},analogous:function(){return this._applyCombination(g,arguments)},complement:function(){return this._applyCombination(p,arguments)},monochromatic:function(){return this._applyCombination(S,arguments)},splitcomplement:function(){return this._applyCombination(E,arguments)},triad:function(){return this._applyCombination(d,arguments)},tetrad:function(){return this._applyCombination(a,arguments)}},O.fromRatio=function(s,c){if(typeof s=="object"){var R={};for(var X in s)s.hasOwnProperty(X)&&(X==="a"?R[X]=s[X]:R[X]=De(s[X]));s=R}return O(s,c)};function b(s){var c={r:0,g:0,b:0},R=1,X=null,N=null,oe=null,be=!1,we=!1;return typeof s=="string"&&(s=me(s)),typeof s=="object"&&(xe(s.r)&&xe(s.g)&&xe(s.b)?(c=A(s.r,s.g,s.b),be=!0,we=String(s.r).substr(-1)==="%"?"prgb":"rgb"):xe(s.h)&&xe(s.s)&&xe(s.v)?(X=De(s.s),N=De(s.v),c=y(s.h,X,N),be=!0,we="hsv"):xe(s.h)&&xe(s.s)&&xe(s.l)&&(X=De(s.s),oe=De(s.l),c=L(s.h,X,oe),be=!0,we="hsl"),s.hasOwnProperty("a")&&(R=s.a)),R=V(R),{ok:be,format:s.format||we,r:z(255,H(c.r,0)),g:z(255,H(c.g,0)),b:z(255,H(c.b,0)),a:R}}function A(s,c,R){return{r:M(s,255)*255,g:M(c,255)*255,b:M(R,255)*255}}function P(s,c,R){s=M(s,255),c=M(c,255),R=M(R,255);var X=H(s,c,R),N=z(s,c,R),oe,be,we=(X+N)/2;if(X==N)oe=be=0;else{var _e=X-N;be=we>.5?_e/(2-X-N):_e/(X+N);switch(X){case s:oe=(c-R)/_e+(c<R?6:0);break;case c:oe=(R-s)/_e+2;break;case R:oe=(s-c)/_e+4;break}oe/=6}return{h:oe,s:be,l:we}}function L(s,c,R){var X,N,oe;s=M(s,360),c=M(c,100),R=M(R,100);function be(Le,Oe,Me){return Me<0&&(Me+=1),Me>1&&(Me-=1),Me<1/6?Le+(Oe-Le)*6*Me:Me<1/2?Oe:Me<2/3?Le+(Oe-Le)*(2/3-Me)*6:Le}if(c===0)X=N=oe=R;else{var we=R<.5?R*(1+c):R+c-R*c,_e=2*R-we;X=be(_e,we,s+1/3),N=be(_e,we,s),oe=be(_e,we,s-1/3)}return{r:X*255,g:N*255,b:oe*255}}function w(s,c,R){s=M(s,255),c=M(c,255),R=M(R,255);var X=H(s,c,R),N=z(s,c,R),oe,be,we=X,_e=X-N;if(be=X===0?0:_e/X,X==N)oe=0;else{switch(X){case s:oe=(c-R)/_e+(c<R?6:0);break;case c:oe=(R-s)/_e+2;break;case R:oe=(s-c)/_e+4;break}oe/=6}return{h:oe,s:be,v:we}}function y(s,c,R){s=M(s,360)*6,c=M(c,100),R=M(R,100);var X=Z.floor(s),N=s-X,oe=R*(1-c),be=R*(1-N*c),we=R*(1-(1-N)*c),_e=X%6,Le=[R,be,oe,oe,we,R][_e],Oe=[we,R,R,be,oe,oe][_e],Me=[oe,oe,we,R,R,be][_e];return{r:Le*255,g:Oe*255,b:Me*255}}function h(s,c,R,X){var N=[ge(D(s).toString(16)),ge(D(c).toString(16)),ge(D(R).toString(16))];return X&&N[0].charAt(0)==N[0].charAt(1)&&N[1].charAt(0)==N[1].charAt(1)&&N[2].charAt(0)==N[2].charAt(1)?N[0].charAt(0)+N[1].charAt(0)+N[2].charAt(0):N.join("")}function o(s,c,R,X,N){var oe=[ge(D(s).toString(16)),ge(D(c).toString(16)),ge(D(R).toString(16)),ge(Se(X))];return N&&oe[0].charAt(0)==oe[0].charAt(1)&&oe[1].charAt(0)==oe[1].charAt(1)&&oe[2].charAt(0)==oe[2].charAt(1)&&oe[3].charAt(0)==oe[3].charAt(1)?oe[0].charAt(0)+oe[1].charAt(0)+oe[2].charAt(0)+oe[3].charAt(0):oe.join("")}function l(s,c,R,X){var N=[ge(Se(X)),ge(D(s).toString(16)),ge(D(c).toString(16)),ge(D(R).toString(16))];return N.join("")}O.equals=function(s,c){return!s||!c?!1:O(s).toRgbString()==O(c).toRgbString()},O.random=function(){return O.fromRatio({r:B(),g:B(),b:B()})};function u(s,c){c=c===0?0:c||10;var R=O(s).toHsl();return R.s-=c/100,R.s=I(R.s),O(R)}function C(s,c){c=c===0?0:c||10;var R=O(s).toHsl();return R.s+=c/100,R.s=I(R.s),O(R)}function v(s){return O(s).desaturate(100)}function m(s,c){c=c===0?0:c||10;var R=O(s).toHsl();return R.l+=c/100,R.l=I(R.l),O(R)}function k(s,c){c=c===0?0:c||10;var R=O(s).toRgb();return R.r=H(0,z(255,R.r-D(255*-(c/100)))),R.g=H(0,z(255,R.g-D(255*-(c/100)))),R.b=H(0,z(255,R.b-D(255*-(c/100)))),O(R)}function x(s,c){c=c===0?0:c||10;var R=O(s).toHsl();return R.l-=c/100,R.l=I(R.l),O(R)}function f(s,c){var R=O(s).toHsl(),X=(R.h+c)%360;return R.h=X<0?360+X:X,O(R)}function p(s){var c=O(s).toHsl();return c.h=(c.h+180)%360,O(c)}function d(s){var c=O(s).toHsl(),R=c.h;return[O(s),O({h:(R+120)%360,s:c.s,l:c.l}),O({h:(R+240)%360,s:c.s,l:c.l})]}function a(s){var c=O(s).toHsl(),R=c.h;return[O(s),O({h:(R+90)%360,s:c.s,l:c.l}),O({h:(R+180)%360,s:c.s,l:c.l}),O({h:(R+270)%360,s:c.s,l:c.l})]}function E(s){var c=O(s).toHsl(),R=c.h;return[O(s),O({h:(R+72)%360,s:c.s,l:c.l}),O({h:(R+216)%360,s:c.s,l:c.l})]}function g(s,c,R){c=c||6,R=R||30;var X=O(s).toHsl(),N=360/R,oe=[O(s)];for(X.h=(X.h-(N*c>>1)+720)%360;--c;)X.h=(X.h+N)%360,oe.push(O(X));return oe}function S(s,c){c=c||6;for(var R=O(s).toHsv(),X=R.h,N=R.s,oe=R.v,be=[],we=1/c;c--;)be.push(O({h:X,s:N,v:oe})),oe=(oe+we)%1;return be}O.mix=function(s,c,R){R=R===0?0:R||50;var X=O(s).toRgb(),N=O(c).toRgb(),oe=R/100,be={r:(N.r-X.r)*oe+X.r,g:(N.g-X.g)*oe+X.g,b:(N.b-X.b)*oe+X.b,a:(N.a-X.a)*oe+X.a};return O(be)},O.readability=function(s,c){var R=O(s),X=O(c);return(Z.max(R.getLuminance(),X.getLuminance())+.05)/(Z.min(R.getLuminance(),X.getLuminance())+.05)},O.isReadable=function(s,c,R){var X=O.readability(s,c),N,oe;oe=!1,N=G(R);switch(N.level+N.size){case"AAsmall":case"AAAlarge":oe=X>=4.5;break;case"AAlarge":oe=X>=3;break;case"AAAsmall":oe=X>=7;break}return oe},O.mostReadable=function(s,c,R){var X=null,N=0,oe,be,we,_e;R=R||{},be=R.includeFallbackColors,we=R.level,_e=R.size;for(var Le=0;Le<c.length;Le++)oe=O.readability(s,c[Le]),oe>N&&(N=oe,X=O(c[Le]));return O.isReadable(s,X,{level:we,size:_e})||!be?X:(R.includeFallbackColors=!1,O.mostReadable(s,["#fff","#000"],R))};var F=O.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"},W=O.hexNames=K(F);function K(s){var c={};for(var R in s)s.hasOwnProperty(R)&&(c[s[R]]=R);return c}function V(s){return s=parseFloat(s),(isNaN(s)||s<0||s>1)&&(s=1),s}function M(s,c){ae(s)&&(s="100%");var R=he(s);return s=z(c,H(0,parseFloat(s))),R&&(s=parseInt(s*c,10)/100),Z.abs(s-c)<1e-6?1:s%c/parseFloat(c)}function I(s){return z(1,H(0,s))}function $(s){return parseInt(s,16)}function ae(s){return typeof s=="string"&&s.indexOf(".")!=-1&&parseFloat(s)===1}function he(s){return typeof s=="string"&&s.indexOf("%")!=-1}function ge(s){return s.length==1?"0"+s:""+s}function De(s){return s<=1&&(s=s*100+"%"),s}function Se(s){return Z.round(parseFloat(s)*255).toString(16)}function Re(s){return $(s)/255}var Ce=function(){var s="[-\\+]?\\d+%?",c="[-\\+]?\\d*\\.\\d+%?",R="(?:"+c+")|(?:"+s+")",X="[\\s|\\(]+("+R+")[,|\\s]+("+R+")[,|\\s]+("+R+")\\s*\\)?",N="[\\s|\\(]+("+R+")[,|\\s]+("+R+")[,|\\s]+("+R+")[,|\\s]+("+R+")\\s*\\)?";return{CSS_UNIT:new RegExp(R),rgb:new RegExp("rgb"+X),rgba:new RegExp("rgba"+N),hsl:new RegExp("hsl"+X),hsla:new RegExp("hsla"+N),hsv:new RegExp("hsv"+X),hsva:new RegExp("hsva"+N),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 xe(s){return!!Ce.CSS_UNIT.exec(s)}function me(s){s=s.replace(_,"").replace(J,"").toLowerCase();var c=!1;if(F[s])s=F[s],c=!0;else if(s=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var R;return(R=Ce.rgb.exec(s))?{r:R[1],g:R[2],b:R[3]}:(R=Ce.rgba.exec(s))?{r:R[1],g:R[2],b:R[3],a:R[4]}:(R=Ce.hsl.exec(s))?{h:R[1],s:R[2],l:R[3]}:(R=Ce.hsla.exec(s))?{h:R[1],s:R[2],l:R[3],a:R[4]}:(R=Ce.hsv.exec(s))?{h:R[1],s:R[2],v:R[3]}:(R=Ce.hsva.exec(s))?{h:R[1],s:R[2],v:R[3],a:R[4]}:(R=Ce.hex8.exec(s))?{r:$(R[1]),g:$(R[2]),b:$(R[3]),a:Re(R[4]),format:c?"name":"hex8"}:(R=Ce.hex6.exec(s))?{r:$(R[1]),g:$(R[2]),b:$(R[3]),format:c?"name":"hex"}:(R=Ce.hex4.exec(s))?{r:$(R[1]+""+R[1]),g:$(R[2]+""+R[2]),b:$(R[3]+""+R[3]),a:Re(R[4]+""+R[4]),format:c?"name":"hex8"}:(R=Ce.hex3.exec(s))?{r:$(R[1]+""+R[1]),g:$(R[2]+""+R[2]),b:$(R[3]+""+R[3]),format:c?"name":"hex"}:!1}function G(s){var c,R;return s=s||{level:"AA",size:"small"},c=(s.level||"AA").toUpperCase(),R=(s.size||"small").toLowerCase(),c!=="AA"&&c!=="AAA"&&(c="AA"),R!=="small"&&R!=="large"&&(R="small"),{level:c,size:R}}pt.exports?pt.exports=O:!(fe=function(){return O}.call(at,pe,at,pt),fe!==void 0&&(pt.exports=fe))})(Math)},bT9E:function(pt,at,pe){"use strict";pe.d(at,"a",function(){return Z});var fe=pe("VTBJ");function Z(_,J){var U=Object(fe.a)({},_);return Array.isArray(J)&&J.forEach(function(D){delete U[D]}),U}},c5Ni:function(pt,at,pe){},dejd:function(pt,at,pe){},dmUQ:function(pt,at,pe){"use strict";var fe=pe("Ff2n"),Z=pe("rePB"),_=pe("1OyB"),J=pe("vuIU"),U=pe("Ji7U"),D=pe("md7G"),z=pe("foSv"),H=pe("q1tI"),B=pe.n(H),O=pe("TSYQ"),b=pe.n(O),A=pe("4IlW");function P(d,a){var E=Object.keys(d);if(Object.getOwnPropertySymbols){var g=Object.getOwnPropertySymbols(d);a&&(g=g.filter(function(S){return Object.getOwnPropertyDescriptor(d,S).enumerable})),E.push.apply(E,g)}return E}function L(d){for(var a=1;a<arguments.length;a++){var E=arguments[a]!=null?arguments[a]:{};a%2?P(Object(E),!0).forEach(function(g){Object(Z.a)(d,g,E[g])}):Object.getOwnPropertyDescriptors?Object.defineProperties(d,Object.getOwnPropertyDescriptors(E)):P(Object(E)).forEach(function(g){Object.defineProperty(d,g,Object.getOwnPropertyDescriptor(E,g))})}return d}function w(d){var a=y();return function(){var g=Object(z.a)(d),S;if(a){var F=Object(z.a)(this).constructor;S=Reflect.construct(g,arguments,F)}else S=g.apply(this,arguments);return Object(D.a)(this,S)}}function y(){if(typeof Reflect=="undefined"||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(d){return!1}}function h(){}function o(d){d.preventDefault()}var l=function(a){return a.replace(/[^\w.-]+/g,"")},u=200,C=600,v=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,m=function(a){return a!=null},k=function(a,E){return E===a||typeof E=="number"&&typeof a=="number"&&isNaN(E)&&isNaN(a)},x=function(d){Object(U.a)(E,d);var a=w(E);function E(g){var S;Object(_.a)(this,E),S=a.call(this,g),S.onKeyDown=function(K){var V=S.props,M=V.onKeyDown,I=V.onPressEnter;if(K.keyCode===A.a.UP){var $=S.getRatio(K);S.up(K,$,null),S.stop()}else if(K.keyCode===A.a.DOWN){var ae=S.getRatio(K);S.down(K,ae,null),S.stop()}else K.keyCode===A.a.ENTER&&I&&I(K);if(S.recordCursorPosition(),S.lastKeyCode=K.keyCode,M){for(var he=arguments.length,ge=new Array(he>1?he-1:0),De=1;De<he;De++)ge[De-1]=arguments[De];M.apply(void 0,[K].concat(ge))}},S.onKeyUp=function(K){var V=S.props.onKeyUp;if(S.stop(),S.recordCursorPosition(),V){for(var M=arguments.length,I=new Array(M>1?M-1:0),$=1;$<M;$++)I[$-1]=arguments[$];V.apply(void 0,[K].concat(I))}},S.onChange=function(K){var V=S.props.onChange;S.state.focused&&(S.inputting=!0),S.rawInput=S.props.parser(S.getValueFromEvent(K)),S.setState({inputValue:S.rawInput}),V(S.toNumber(S.rawInput))},S.onMouseUp=function(){var K=S.props.onMouseUp;S.recordCursorPosition(),K&&K.apply(void 0,arguments)},S.onFocus=function(){var K;S.setState({focused:!0}),(K=S.props).onFocus.apply(K,arguments)},S.onBlur=function(){var K=S.props.onBlur;S.inputting=!1,S.setState({focused:!1});var V=S.getCurrentValidValue(S.state.inputValue),M=S.setValue(V,h);if(K){var I=S.input.value,$=S.getInputDisplayValue({focus:!1,value:M});S.input.value=$&&Number($),K.apply(void 0,arguments),S.input.value=I}},S.getRatio=function(K){var V=1;return K.metaKey||K.ctrlKey?V=.1:K.shiftKey&&(V=10),V},S.getFullNum=function(K){return isNaN(K)?K:/e/i.test(String(K))?Number(K).toFixed(18).replace(/\.?0+$/,""):K},S.getPrecision=function(K){if(m(S.props.precision))return S.props.precision;var V=String(K);if(V.indexOf("e-")>=0)return parseInt(V.slice(V.indexOf("e-")+2),10);var M=0;return V.indexOf(".")>=0&&(M=V.length-V.indexOf(".")-1),M},S.getInputDisplayValue=function(K){var V=K||S.state,M=V.focused,I=V.inputValue,$=V.value,ae;M?ae=I:ae=S.toPrecisionAsStep($),ae==null&&(ae="");var he=S.formatWrapper(ae);return m(S.props.decimalSeparator)&&(he=he.toString().replace(".",S.props.decimalSeparator)),he},S.recordCursorPosition=function(){try{S.cursorStart=S.input.selectionStart,S.cursorEnd=S.input.selectionEnd,S.currentValue=S.input.value,S.cursorBefore=S.input.value.substring(0,S.cursorStart),S.cursorAfter=S.input.value.substring(S.cursorEnd)}catch(K){}},S.restoreByAfter=function(K){if(K===void 0)return!1;var V=S.input.value,M=V.lastIndexOf(K);if(M===-1)return!1;var I=S.cursorBefore.length;return S.lastKeyCode===A.a.DELETE&&S.cursorBefore.charAt(I-1)===K[0]?(S.fixCaret(I,I),!0):M+K.length===V.length?(S.fixCaret(M,M),!0):!1},S.partRestoreByAfter=function(K){return K===void 0?!1:Array.prototype.some.call(K,function(V,M){var I=K.substring(M);return S.restoreByAfter(I)})},S.isNotCompleteNumber=function(K){return isNaN(K)||K===""||K===null||K&&K.toString().indexOf(".")===K.toString().length-1},S.stop=function(){S.autoStepTimer&&clearTimeout(S.autoStepTimer)},S.down=function(K,V,M){S.pressingUpOrDown=!0,S.step("down",K,V,M)},S.up=function(K,V,M){S.pressingUpOrDown=!0,S.step("up",K,V,M)},S.saveInput=function(K){S.input=K};var F=g.value;F===void 0&&(F=g.defaultValue),S.state={focused:g.autoFocus};var W=S.getValidValue(S.toNumber(F));return S.state=L(L({},S.state),{},{inputValue:S.toPrecisionAsStep(W),value:W}),S}return Object(J.a)(E,[{key:"componentDidMount",value:function(){this.componentDidUpdate(null)}},{key:"componentDidUpdate",value:function(S){var F=this.props,W=F.value,K=F.onChange,V=F.max,M=F.min,I=this.state.focused;if(S){if(!k(S.value,W)||!k(S.max,V)||!k(S.min,M)){var $=I?W:this.getValidValue(W),ae;this.pressingUpOrDown?ae=$:this.inputting?ae=this.rawInput:ae=this.toPrecisionAsStep($),this.setState({value:$,inputValue:ae})}var he="value"in this.props?W:this.state.value;"max"in this.props&&S.max!==V&&typeof he=="number"&&he>V&&K&&K(V),"min"in this.props&&S.min!==M&&typeof he=="number"&&he<M&&K&&K(M)}try{if(this.cursorStart!==void 0&&this.state.focused){if(!this.partRestoreByAfter(this.cursorAfter)&&this.state.value!==this.props.value){var ge=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===A.a.BACKSPACE?ge=this.cursorStart-1:this.lastKeyCode===A.a.DELETE&&(ge=this.cursorStart):ge=this.input.value.length,this.fixCaret(ge,ge)}else if(this.currentValue===this.input.value)switch(this.lastKeyCode){case A.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case A.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1);break;default:}}}catch(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(S){var F=S;return F===""?F="":this.isNotCompleteNumber(parseFloat(F))?F=this.state.value:F=this.getValidValue(F),this.toNumber(F)}},{key:"getValueFromEvent",value:function(S){var F=S.target.value.trim().replace(/。/g,".");return m(this.props.decimalSeparator)&&(F=F.replace(this.props.decimalSeparator,".")),F}},{key:"getValidValue",value:function(S){var F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.props.min,W=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.props.max,K=parseFloat(S);return isNaN(K)?S:(K<F&&(K=F),K>W&&(K=W),K)}},{key:"setValue",value:function(S,F){var W=this.props.precision,K=this.isNotCompleteNumber(parseFloat(S))?null:parseFloat(S),V=this.state.value,M=V===void 0?null:V,I=this.state.inputValue,$=I===void 0?null:I,ae=typeof K=="number"?K.toFixed(W):"".concat(K),he=K!==M||ae!=="".concat($);return"value"in this.props?($=this.toPrecisionAsStep(this.state.value),this.setState({inputValue:$},F)):this.setState({value:K,inputValue:this.toPrecisionAsStep(S)},F),he&&this.props.onChange(K),K}},{key:"getMaxPrecision",value:function(S){var F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,W=this.props,K=W.precision,V=W.step;if(m(K))return K;var M=this.getPrecision(F),I=this.getPrecision(V),$=this.getPrecision(S);return S?Math.max($,M+I):M+I}},{key:"getPrecisionFactor",value:function(S){var F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,W=this.getMaxPrecision(S,F);return Math.pow(10,W)}},{key:"focus",value:function(){this.input.focus(),this.recordCursorPosition()}},{key:"blur",value:function(){this.input.blur()}},{key:"select",value:function(){this.input.select()}},{key:"formatWrapper",value:function(S){return this.props.formatter?this.props.formatter(S):S}},{key:"toPrecisionAsStep",value:function(S){if(this.isNotCompleteNumber(S)||S==="")return S;var F=Math.abs(this.getMaxPrecision(S));return isNaN(F)?S.toString():Number(S).toFixed(F)}},{key:"toNumber",value:function(S){var F=this.props.precision,W=this.state.focused,K=S&&S.length>16&&W;return this.isNotCompleteNumber(S)||K?S:m(F)?Math.round(S*Math.pow(10,F))/Math.pow(10,F):Number(S)}},{key:"upStep",value:function(S,F){var W=this.props.step,K=this.getPrecisionFactor(S,F),V=Math.abs(this.getMaxPrecision(S,F)),M=((K*S+K*W*F)/K).toFixed(V);return this.toNumber(M)}},{key:"downStep",value:function(S,F){var W=this.props.step,K=this.getPrecisionFactor(S,F),V=Math.abs(this.getMaxPrecision(S,F)),M=((K*S-K*W*F)/K).toFixed(V);return this.toNumber(M)}},{key:"step",value:function(S,F){var W=this,K=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,V=arguments.length>3?arguments[3]:void 0;this.stop(),F&&(F.persist(),F.preventDefault());var M=this.props;if(M.disabled)return;var I=this.getCurrentValidValue(this.state.inputValue)||0;if(this.isNotCompleteNumber(I))return;var $=this["".concat(S,"Step")](I,K),ae=$>M.max||$<M.min;if($>M.max?$=M.max:$<M.min&&($=M.min),this.setValue($,null),this.setState({focused:!0},function(){W.pressingUpOrDown=!1}),ae)return;this.autoStepTimer=setTimeout(function(){W[S](F,K,!0)},V?u:C)}},{key:"fixCaret",value:function(S,F){if(S===void 0||F===void 0||!this.input||!this.input.value)return;try{var W=this.input.selectionStart,K=this.input.selectionEnd;(S!==W||F!==K)&&this.input.setSelectionRange(S,F)}catch(V){}}},{key:"render",value:function(){var S,F=this.props,W=F.prefixCls,K=F.disabled,V=F.readOnly,M=F.useTouch,I=F.autoComplete,$=F.upHandler,ae=F.downHandler,he=F.className,ge=F.max,De=F.min,Se=F.style,Re=F.title,Ce=F.onMouseEnter,xe=F.onMouseLeave,me=F.onMouseOver,G=F.onMouseOut,s=F.required,c=F.onClick,R=F.tabIndex,X=F.type,N=F.placeholder,oe=F.id,be=F.inputMode,we=F.pattern,_e=F.step,Le=F.maxLength,Oe=F.autoFocus,Me=F.name,Be=F.onPaste,Ve=F.onInput,Xe=Object(fe.a)(F,["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"]),ze=this.state,rt=ze.value,je=ze.focused,We=b()(W,(S={},Object(Z.a)(S,he,!!he),Object(Z.a)(S,"".concat(W,"-disabled"),K),Object(Z.a)(S,"".concat(W,"-focused"),je),S)),ke={};Object.keys(Xe).forEach(function(de){(de.substr(0,5)==="data-"||de.substr(0,5)==="aria-"||de==="role")&&(ke[de]=Xe[de])});var Je=!V&&!K,qe=this.getInputDisplayValue(null),se=(rt||rt===0)&&(isNaN(rt)||Number(rt)>=ge),q=(rt||rt===0)&&(isNaN(rt)||Number(rt)<=De),ee=se||K||V,ne=q||K||V,le=b()("".concat(W,"-handler"),"".concat(W,"-handler-up"),Object(Z.a)({},"".concat(W,"-handler-up-disabled"),ee)),te=b()("".concat(W,"-handler"),"".concat(W,"-handler-down"),Object(Z.a)({},"".concat(W,"-handler-down-disabled"),ne)),ie=M?{onTouchStart:ee?h:this.up,onTouchEnd:this.stop}:{onMouseDown:ee?h:this.up,onMouseUp:this.stop,onMouseLeave:this.stop},ue=M?{onTouchStart:ne?h:this.down,onTouchEnd:this.stop}:{onMouseDown:ne?h:this.down,onMouseUp:this.stop,onMouseLeave:this.stop};return B.a.createElement("div",{className:We,style:Se,title:Re,onMouseEnter:Ce,onMouseLeave:xe,onMouseOver:me,onMouseOut:G,onFocus:function(){return null},onBlur:function(){return null}},B.a.createElement("div",{className:"".concat(W,"-handler-wrap")},B.a.createElement("span",Object.assign({unselectable:"on"},ie,{role:"button","aria-label":"Increase Value","aria-disabled":ee,className:le}),$||B.a.createElement("span",{unselectable:"on",className:"".concat(W,"-handler-up-inner"),onClick:o})),B.a.createElement("span",Object.assign({unselectable:"on"},ue,{role:"button","aria-label":"Decrease Value","aria-disabled":ne,className:te}),ae||B.a.createElement("span",{unselectable:"on",className:"".concat(W,"-handler-down-inner"),onClick:o}))),B.a.createElement("div",{className:"".concat(W,"-input-wrap")},B.a.createElement("input",Object.assign({role:"spinbutton","aria-valuemin":De,"aria-valuemax":ge,"aria-valuenow":rt,required:s,type:X,placeholder:N,onPaste:Be,onClick:c,onMouseUp:this.onMouseUp,className:"".concat(W,"-input"),tabIndex:R,autoComplete:I,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:Je?this.onKeyDown:h,onKeyUp:Je?this.onKeyUp:h,autoFocus:Oe,maxLength:Le,readOnly:V,disabled:K,max:ge,min:De,step:_e,name:Me,title:Re,id:oe,onChange:this.onChange,ref:this.saveInput,value:this.getFullNum(qe),pattern:we,inputMode:be,onInput:Ve},ke))))}}]),E}(B.a.Component);x.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",max:v,min:-v,step:1,style:{},onChange:h,onKeyDown:h,onPressEnter:h,onFocus:h,onBlur:h,parser:l,required:!1,autoComplete:"off"};var f=x,p=at.a=f},h78n:function(pt,at,pe){"use strict";pe.d(at,"a",function(){return S});var fe=pe("q1tI"),Z=pe.n(fe),_=pe("TSYQ"),J=pe.n(_),U={className:"",percent:0,prefixCls:"rc-progress",strokeColor:"#2db7f5",strokeLinecap:"round",strokeWidth:1,style:{},trailColor:"#D9D9D9",trailWidth:1},D=function(K){var V=K.map(function(){return Object(fe.useRef)()}),M=Object(fe.useRef)();return Object(fe.useEffect)(function(){var I=Date.now(),$=!1;Object.keys(V).forEach(function(ae){var he=V[ae].current;if(!he)return;$=!0;var ge=he.style;ge.transitionDuration=".3s, .3s, .3s, .06s",M.current&&I-M.current<100&&(ge.transitionDuration="0s, 0s")}),$&&(M.current=Date.now())}),[V]};function z(){return z=Object.assign||function(W){for(var K=1;K<arguments.length;K++){var V=arguments[K];for(var M in V)Object.prototype.hasOwnProperty.call(V,M)&&(W[M]=V[M])}return W},z.apply(this,arguments)}function H(W,K){return P(W)||A(W,K)||O(W,K)||B()}function B(){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 O(W,K){if(!W)return;if(typeof W=="string")return b(W,K);var V=Object.prototype.toString.call(W).slice(8,-1);if(V==="Object"&&W.constructor&&(V=W.constructor.name),V==="Map"||V==="Set")return Array.from(W);if(V==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(V))return b(W,K)}function b(W,K){(K==null||K>W.length)&&(K=W.length);for(var V=0,M=new Array(K);V<K;V++)M[V]=W[V];return M}function A(W,K){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(W)))return;var V=[],M=!0,I=!1,$=void 0;try{for(var ae=W[Symbol.iterator](),he;!(M=(he=ae.next()).done)&&!(V.push(he.value),K&&V.length===K);M=!0);}catch(ge){I=!0,$=ge}finally{try{!M&&ae.return!=null&&ae.return()}finally{if(I)throw $}}return V}function P(W){if(Array.isArray(W))return W}function L(W,K){if(W==null)return{};var V=w(W,K),M,I;if(Object.getOwnPropertySymbols){var $=Object.getOwnPropertySymbols(W);for(I=0;I<$.length;I++){if(M=$[I],K.indexOf(M)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(W,M))continue;V[M]=W[M]}}return V}function w(W,K){if(W==null)return{};var V={},M=Object.keys(W),I,$;for($=0;$<M.length;$++){if(I=M[$],K.indexOf(I)>=0)continue;V[I]=W[I]}return V}var y=function(K){var V=K.className,M=K.percent,I=K.prefixCls,$=K.strokeColor,ae=K.strokeLinecap,he=K.strokeWidth,ge=K.style,De=K.trailColor,Se=K.trailWidth,Re=K.transition,Ce=L(K,["className","percent","prefixCls","strokeColor","strokeLinecap","strokeWidth","style","trailColor","trailWidth","transition"]);delete Ce.gapPosition;var xe=Array.isArray(M)?M:[M],me=Array.isArray($)?$:[$],G=D(xe),s=H(G,1),c=s[0],R=he/2,X=100-he/2,N="M ".concat(ae==="round"?R:0,",").concat(R,`
|
|
L `).concat(ae==="round"?X:100,",").concat(R),oe="0 0 100 ".concat(he),be=0;return Z.a.createElement("svg",z({className:J()("".concat(I,"-line"),V),viewBox:oe,preserveAspectRatio:"none",style:ge},Ce),Z.a.createElement("path",{className:"".concat(I,"-line-trail"),d:N,strokeLinecap:ae,stroke:De,strokeWidth:Se||he,fillOpacity:"0"}),xe.map(function(we,_e){var Le={strokeDasharray:"".concat(we,"px, 100px"),strokeDashoffset:"-".concat(be,"px"),transition:Re||"stroke-dashoffset 0.3s ease 0s, stroke-dasharray .3s ease 0s, stroke 0.3s linear"},Oe=me[_e]||me[me.length-1];return be+=we,Z.a.createElement("path",{key:_e,className:"".concat(I,"-line-path"),d:N,strokeLinecap:ae,stroke:Oe,strokeWidth:he,fillOpacity:"0",ref:c[_e],style:Le})}))};y.defaultProps=U;var h=y;function o(){return o=Object.assign||function(W){for(var K=1;K<arguments.length;K++){var V=arguments[K];for(var M in V)Object.prototype.hasOwnProperty.call(V,M)&&(W[M]=V[M])}return W},o.apply(this,arguments)}function l(W,K){return k(W)||m(W,K)||C(W,K)||u()}function u(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function C(W,K){if(!W)return;if(typeof W=="string")return v(W,K);var V=Object.prototype.toString.call(W).slice(8,-1);if(V==="Object"&&W.constructor&&(V=W.constructor.name),V==="Map"||V==="Set")return Array.from(W);if(V==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(V))return v(W,K)}function v(W,K){(K==null||K>W.length)&&(K=W.length);for(var V=0,M=new Array(K);V<K;V++)M[V]=W[V];return M}function m(W,K){if(typeof Symbol=="undefined"||!(Symbol.iterator in Object(W)))return;var V=[],M=!0,I=!1,$=void 0;try{for(var ae=W[Symbol.iterator](),he;!(M=(he=ae.next()).done)&&!(V.push(he.value),K&&V.length===K);M=!0);}catch(ge){I=!0,$=ge}finally{try{!M&&ae.return!=null&&ae.return()}finally{if(I)throw $}}return V}function k(W){if(Array.isArray(W))return W}function x(W,K){if(W==null)return{};var V=f(W,K),M,I;if(Object.getOwnPropertySymbols){var $=Object.getOwnPropertySymbols(W);for(I=0;I<$.length;I++){if(M=$[I],K.indexOf(M)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(W,M))continue;V[M]=W[M]}}return V}function f(W,K){if(W==null)return{};var V={},M=Object.keys(W),I,$;for($=0;$<M.length;$++){if(I=M[$],K.indexOf(I)>=0)continue;V[I]=W[I]}return V}var p=0;function d(W){return+W.replace("%","")}function a(W){return Array.isArray(W)?W:[W]}function E(W,K,V,M){var I=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,$=arguments.length>5?arguments[5]:void 0,ae=50-M/2,he=0,ge=-ae,De=0,Se=-2*ae;switch($){case"left":he=-ae,ge=0,De=2*ae,Se=0;break;case"right":he=ae,ge=0,De=-2*ae,Se=0;break;case"bottom":ge=ae,Se=2*ae;break;default:}var Re="M 50,50 m ".concat(he,",").concat(ge,`
|
|
a `).concat(ae,",").concat(ae," 0 1 1 ").concat(De,",").concat(-Se,`
|
|
a `).concat(ae,",").concat(ae," 0 1 1 ").concat(-De,",").concat(Se),Ce=Math.PI*2*ae,xe={stroke:V,strokeDasharray:"".concat(K/100*(Ce-I),"px ").concat(Ce,"px"),strokeDashoffset:"-".concat(I/2+W/100*(Ce-I),"px"),transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s"};return{pathString:Re,pathStyle:xe}}var g=function(K){var V=K.prefixCls,M=K.strokeWidth,I=K.trailWidth,$=K.gapDegree,ae=K.gapPosition,he=K.trailColor,ge=K.strokeLinecap,De=K.style,Se=K.className,Re=K.strokeColor,Ce=K.percent,xe=x(K,["prefixCls","strokeWidth","trailWidth","gapDegree","gapPosition","trailColor","strokeLinecap","style","className","strokeColor","percent"]),me=Object(fe.useMemo)(function(){return p+=1,p},[]),G=E(0,100,he,M,$,ae),s=G.pathString,c=G.pathStyle,R=a(Ce),X=a(Re),N=X.find(function(Le){return Object.prototype.toString.call(Le)==="[object Object]"}),oe=D(R),be=l(oe,1),we=be[0],_e=function(){var Oe=0;return R.map(function(Me,Be){var Ve=X[Be]||X[X.length-1],Xe=Object.prototype.toString.call(Ve)==="[object Object]"?"url(#".concat(V,"-gradient-").concat(me,")"):"",ze=E(Oe,Me,Ve,M,$,ae);return Oe+=Me,Z.a.createElement("path",{key:Be,className:"".concat(V,"-circle-path"),d:ze.pathString,stroke:Xe,strokeLinecap:ge,strokeWidth:M,opacity:Me===0?0:1,fillOpacity:"0",style:ze.pathStyle,ref:we[Be]})})};return Z.a.createElement("svg",o({className:J()("".concat(V,"-circle"),Se),viewBox:"0 0 100 100",style:De},xe),N&&Z.a.createElement("defs",null,Z.a.createElement("linearGradient",{id:"".concat(V,"-gradient-").concat(me),x1:"100%",y1:"0%",x2:"0%",y2:"0%"},Object.keys(N).sort(function(Le,Oe){return d(Le)-d(Oe)}).map(function(Le,Oe){return Z.a.createElement("stop",{key:Oe,offset:Le,stopColor:N[Le]})}))),Z.a.createElement("path",{className:"".concat(V,"-circle-trail"),d:s,stroke:he,strokeLinecap:ge,strokeWidth:I||M,fillOpacity:"0",style:c}),_e().reverse())};g.defaultProps=U;var S=g,F={Line:h,Circle:S}},kSUc:function(pt,at,pe){},lZu9:function(pt,at,pe){(function(fe){fe(pe("VrN/"),pe("1eCo"),pe("8EBN"))})(function(fe){"use strict";fe.defineMode("markdown",function(Z,_){var J=fe.getMode(Z,"text/html"),U=J.name=="null";function D(M){if(fe.findModeByName){var I=fe.findModeByName(M);I&&(M=I.mime||I.mimes[0])}var $=fe.getMode(Z,M);return $.name=="null"?null:$}_.highlightFormatting===void 0&&(_.highlightFormatting=!1),_.maxBlockquoteDepth===void 0&&(_.maxBlockquoteDepth=0),_.taskLists===void 0&&(_.taskLists=!1),_.strikethrough===void 0&&(_.strikethrough=!1),_.emoji===void 0&&(_.emoji=!1),_.fencedCodeBlockHighlighting===void 0&&(_.fencedCodeBlockHighlighting=!0),_.fencedCodeBlockDefaultMode===void 0&&(_.fencedCodeBlockDefaultMode="text/plain"),_.xml===void 0&&(_.xml=!0),_.tokenTypeOverrides===void 0&&(_.tokenTypeOverrides={});var z={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 H in z)z.hasOwnProperty(H)&&_.tokenTypeOverrides[H]&&(z[H]=_.tokenTypeOverrides[H]);var B=/^([*\-_])(?:\s*\1){2,}\s*$/,O=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,b=/^\[(x| )\](?=\s)/i,A=_.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,P=/^ {0,3}(?:\={1,}|-{2,})\s*$/,L=/^[^#!\[\]*_\\<>` "'(~:]+/,w=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,y=/^\s*\[[^\]]+?\]:.*$/,h=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,o=" ";function l(M,I,$){return I.f=I.inline=$,$(M,I)}function u(M,I,$){return I.f=I.block=$,$(M,I)}function C(M){return!M||!/\S/.test(M.string)}function v(M){if(M.linkTitle=!1,M.linkHref=!1,M.linkText=!1,M.em=!1,M.strong=!1,M.strikethrough=!1,M.quote=0,M.indentedCode=!1,M.f==k){var I=U;if(!I){var $=fe.innerMode(J,M.htmlState);I=$.mode.name=="xml"&&$.state.tagStart===null&&!$.state.context&&$.state.tokenize.isInText}I&&(M.f=d,M.block=m,M.htmlState=null)}return M.trailingSpace=0,M.trailingSpaceNewLine=!1,M.prevLine=M.thisLine,M.thisLine={stream:null},null}function m(M,I){var $=M.column()===I.indentation,ae=C(I.prevLine.stream),he=I.indentedCode,ge=I.prevLine.hr,De=I.list!==!1,Se=(I.listStack[I.listStack.length-1]||0)+3;I.indentedCode=!1;var Re=I.indentation;if(I.indentationDiff===null&&(I.indentationDiff=I.indentation,De)){for(I.list=null;Re<I.listStack[I.listStack.length-1];)I.listStack.pop(),I.listStack.length?I.indentation=I.listStack[I.listStack.length-1]:I.list=!1;I.list!==!1&&(I.indentationDiff=Re-I.listStack[I.listStack.length-1])}var Ce=!ae&&!ge&&!I.prevLine.header&&(!De||!he)&&!I.prevLine.fencedCodeEnd,xe=(I.list===!1||ge||ae)&&I.indentation<=Se&&M.match(B),me=null;if(I.indentationDiff>=4&&(he||I.prevLine.fencedCodeEnd||I.prevLine.header||ae))return M.skipToEnd(),I.indentedCode=!0,z.code;if(M.eatSpace())return null;if($&&I.indentation<=Se&&(me=M.match(A))&&me[1].length<=6)return I.quote=0,I.header=me[1].length,I.thisLine.header=!0,_.highlightFormatting&&(I.formatting="header"),I.f=I.inline,f(I);if(I.indentation<=Se&&M.eat(">"))return I.quote=$?1:I.quote+1,_.highlightFormatting&&(I.formatting="quote"),M.eatSpace(),f(I);if(!xe&&!I.setext&&$&&I.indentation<=Se&&(me=M.match(O))){var G=me[1]?"ol":"ul";return I.indentation=Re+M.current().length,I.list=!0,I.quote=0,I.listStack.push(I.indentation),I.em=!1,I.strong=!1,I.code=!1,I.strikethrough=!1,_.taskLists&&M.match(b,!1)&&(I.taskList=!0),I.f=I.inline,_.highlightFormatting&&(I.formatting=["list","list-"+G]),f(I)}else{if($&&I.indentation<=Se&&(me=M.match(w,!0)))return I.quote=0,I.fencedEndRE=new RegExp(me[1]+"+ *$"),I.localMode=_.fencedCodeBlockHighlighting&&D(me[2]||_.fencedCodeBlockDefaultMode),I.localMode&&(I.localState=fe.startState(I.localMode)),I.f=I.block=x,_.highlightFormatting&&(I.formatting="code-block"),I.code=-1,f(I);if(I.setext||(!Ce||!De)&&!I.quote&&I.list===!1&&!I.code&&!xe&&!y.test(M.string)&&(me=M.lookAhead(1))&&(me=me.match(P)))return I.setext?(I.header=I.setext,I.setext=0,M.skipToEnd(),_.highlightFormatting&&(I.formatting="header")):(I.header=me[0].charAt(0)=="="?1:2,I.setext=I.header),I.thisLine.header=!0,I.f=I.inline,f(I);if(xe)return M.skipToEnd(),I.hr=!0,I.thisLine.hr=!0,z.hr;if(M.peek()==="[")return l(M,I,F)}return l(M,I,I.inline)}function k(M,I){var $=J.token(M,I.htmlState);if(!U){var ae=fe.innerMode(J,I.htmlState);(ae.mode.name=="xml"&&ae.state.tagStart===null&&!ae.state.context&&ae.state.tokenize.isInText||I.md_inside&&M.current().indexOf(">")>-1)&&(I.f=d,I.block=m,I.htmlState=null)}return $}function x(M,I){var $=I.listStack[I.listStack.length-1]||0,ae=I.indentation<$,he=$+3;if(I.fencedEndRE&&I.indentation<=he&&(ae||M.match(I.fencedEndRE))){_.highlightFormatting&&(I.formatting="code-block");var ge;return ae||(ge=f(I)),I.localMode=I.localState=null,I.block=m,I.f=d,I.fencedEndRE=null,I.code=0,I.thisLine.fencedCodeEnd=!0,ae?u(M,I,I.block):ge}else return I.localMode?I.localMode.token(M,I.localState):(M.skipToEnd(),z.code)}function f(M){var I=[];if(M.formatting){I.push(z.formatting),typeof M.formatting=="string"&&(M.formatting=[M.formatting]);for(var $=0;$<M.formatting.length;$++)I.push(z.formatting+"-"+M.formatting[$]),M.formatting[$]==="header"&&I.push(z.formatting+"-"+M.formatting[$]+"-"+M.header),M.formatting[$]==="quote"&&(!_.maxBlockquoteDepth||_.maxBlockquoteDepth>=M.quote?I.push(z.formatting+"-"+M.formatting[$]+"-"+M.quote):I.push("error"))}if(M.taskOpen)return I.push("meta"),I.length?I.join(" "):null;if(M.taskClosed)return I.push("property"),I.length?I.join(" "):null;if(M.linkHref?I.push(z.linkHref,"url"):(M.strong&&I.push(z.strong),M.em&&I.push(z.em),M.strikethrough&&I.push(z.strikethrough),M.emoji&&I.push(z.emoji),M.linkText&&I.push(z.linkText),M.code&&I.push(z.code),M.image&&I.push(z.image),M.imageAltText&&I.push(z.imageAltText,"link"),M.imageMarker&&I.push(z.imageMarker)),M.header&&I.push(z.header,z.header+"-"+M.header),M.quote&&(I.push(z.quote),!_.maxBlockquoteDepth||_.maxBlockquoteDepth>=M.quote?I.push(z.quote+"-"+M.quote):I.push(z.quote+"-"+_.maxBlockquoteDepth)),M.list!==!1){var ae=(M.listStack.length-1)%3;ae?ae===1?I.push(z.list2):I.push(z.list3):I.push(z.list1)}return M.trailingSpaceNewLine?I.push("trailing-space-new-line"):M.trailingSpace&&I.push("trailing-space-"+(M.trailingSpace%2?"a":"b")),I.length?I.join(" "):null}function p(M,I){return M.match(L,!0)?f(I):void 0}function d(M,I){var $=I.text(M,I);if(typeof $!="undefined")return $;if(I.list)return I.list=null,f(I);if(I.taskList){var ae=M.match(b,!0)[1]===" ";return ae?I.taskOpen=!0:I.taskClosed=!0,_.highlightFormatting&&(I.formatting="task"),I.taskList=!1,f(I)}if(I.taskOpen=!1,I.taskClosed=!1,I.header&&M.match(/^#+$/,!0))return _.highlightFormatting&&(I.formatting="header"),f(I);var he=M.next();if(I.linkTitle){I.linkTitle=!1;var ge=he;he==="("&&(ge=")"),ge=(ge+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var De="^\\s*(?:[^"+ge+"\\\\]+|\\\\\\\\|\\\\.)"+ge;if(M.match(new RegExp(De),!0))return z.linkHref}if(he==="`"){var Se=I.formatting;_.highlightFormatting&&(I.formatting="code"),M.eatWhile("`");var Re=M.current().length;if(I.code==0&&(!I.quote||Re==1))return I.code=Re,f(I);if(Re==I.code){var Ce=f(I);return I.code=0,Ce}else return I.formatting=Se,f(I)}else if(I.code)return f(I);if(he==="\\"&&(M.next(),_.highlightFormatting)){var xe=f(I),me=z.formatting+"-escape";return xe?xe+" "+me:me}if(he==="!"&&M.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return I.imageMarker=!0,I.image=!0,_.highlightFormatting&&(I.formatting="image"),f(I);if(he==="["&&I.imageMarker&&M.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return I.imageMarker=!1,I.imageAltText=!0,_.highlightFormatting&&(I.formatting="image"),f(I);if(he==="]"&&I.imageAltText){_.highlightFormatting&&(I.formatting="image");var xe=f(I);return I.imageAltText=!1,I.image=!1,I.inline=I.f=E,xe}if(he==="["&&!I.image)return I.linkText&&M.match(/^.*?\]/)||(I.linkText=!0,_.highlightFormatting&&(I.formatting="link")),f(I);if(he==="]"&&I.linkText){_.highlightFormatting&&(I.formatting="link");var xe=f(I);return I.linkText=!1,I.inline=I.f=M.match(/\(.*?\)| ?\[.*?\]/,!1)?E:d,xe}if(he==="<"&&M.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){I.f=I.inline=a,_.highlightFormatting&&(I.formatting="link");var xe=f(I);return xe?xe+=" ":xe="",xe+z.linkInline}if(he==="<"&&M.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){I.f=I.inline=a,_.highlightFormatting&&(I.formatting="link");var xe=f(I);return xe?xe+=" ":xe="",xe+z.linkEmail}if(_.xml&&he==="<"&&M.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var G=M.string.indexOf(">",M.pos);if(G!=-1){var s=M.string.substring(M.start,G);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(s)&&(I.md_inside=!0)}return M.backUp(1),I.htmlState=fe.startState(J),u(M,I,k)}if(_.xml&&he==="<"&&M.match(/^\/\w*?>/))return I.md_inside=!1,"tag";if(he==="*"||he==="_"){for(var c=1,R=M.pos==1?" ":M.string.charAt(M.pos-2);c<3&&M.eat(he);)c++;var X=M.peek()||" ",N=!/\s/.test(X)&&(!h.test(X)||/\s/.test(R)||h.test(R)),oe=!/\s/.test(R)&&(!h.test(R)||/\s/.test(X)||h.test(X)),be=null,we=null;if(c%2&&(!I.em&&N&&(he==="*"||!oe||h.test(R))?be=!0:I.em==he&&oe&&(he==="*"||!N||h.test(X))&&(be=!1)),c>1&&(!I.strong&&N&&(he==="*"||!oe||h.test(R))?we=!0:I.strong==he&&oe&&(he==="*"||!N||h.test(X))&&(we=!1)),we!=null||be!=null){_.highlightFormatting&&(I.formatting=be==null?"strong":we==null?"em":"strong em"),be===!0&&(I.em=he),we===!0&&(I.strong=he);var Ce=f(I);return be===!1&&(I.em=!1),we===!1&&(I.strong=!1),Ce}}else if(he===" "&&(M.eat("*")||M.eat("_"))){if(M.peek()===" ")return f(I);M.backUp(1)}if(_.strikethrough){if(he==="~"&&M.eatWhile(he)){if(I.strikethrough){_.highlightFormatting&&(I.formatting="strikethrough");var Ce=f(I);return I.strikethrough=!1,Ce}else if(M.match(/^[^\s]/,!1))return I.strikethrough=!0,_.highlightFormatting&&(I.formatting="strikethrough"),f(I)}else if(he===" "&&M.match(/^~~/,!0)){if(M.peek()===" ")return f(I);M.backUp(2)}}if(_.emoji&&he===":"&&M.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){I.emoji=!0,_.highlightFormatting&&(I.formatting="emoji");var _e=f(I);return I.emoji=!1,_e}return he===" "&&(M.match(/^ +$/,!1)?I.trailingSpace++:I.trailingSpace&&(I.trailingSpaceNewLine=!0)),f(I)}function a(M,I){var $=M.next();if($===">"){I.f=I.inline=d,_.highlightFormatting&&(I.formatting="link");var ae=f(I);return ae?ae+=" ":ae="",ae+z.linkInline}return M.match(/^[^>]+/,!0),z.linkInline}function E(M,I){if(M.eatSpace())return null;var $=M.next();return $==="("||$==="["?(I.f=I.inline=S($==="("?")":"]"),_.highlightFormatting&&(I.formatting="link-string"),I.linkHref=!0,f(I)):"error"}var g={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function S(M){return function(I,$){var ae=I.next();if(ae===M){$.f=$.inline=d,_.highlightFormatting&&($.formatting="link-string");var he=f($);return $.linkHref=!1,he}return I.match(g[M]),$.linkHref=!0,f($)}}function F(M,I){return M.match(/^([^\]\\]|\\.)*\]:/,!1)?(I.f=W,M.next(),_.highlightFormatting&&(I.formatting="link"),I.linkText=!0,f(I)):l(M,I,d)}function W(M,I){if(M.match(/^\]:/,!0)){I.f=I.inline=K,_.highlightFormatting&&(I.formatting="link");var $=f(I);return I.linkText=!1,$}return M.match(/^([^\]\\]|\\.)+/,!0),z.linkText}function K(M,I){return M.eatSpace()?null:(M.match(/^[^\s]+/,!0),M.peek()===void 0?I.linkTitle=!0:M.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),I.f=I.inline=d,z.linkHref+" url")}var V={startState:function(){return{f:m,prevLine:{stream:null},thisLine:{stream:null},block:m,htmlState:null,indentation:0,inline:d,text:p,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(M){return{f:M.f,prevLine:M.prevLine,thisLine:M.thisLine,block:M.block,htmlState:M.htmlState&&fe.copyState(J,M.htmlState),indentation:M.indentation,localMode:M.localMode,localState:M.localMode?fe.copyState(M.localMode,M.localState):null,inline:M.inline,text:M.text,formatting:!1,linkText:M.linkText,linkTitle:M.linkTitle,linkHref:M.linkHref,code:M.code,em:M.em,strong:M.strong,strikethrough:M.strikethrough,emoji:M.emoji,header:M.header,setext:M.setext,hr:M.hr,taskList:M.taskList,list:M.list,listStack:M.listStack.slice(0),quote:M.quote,indentedCode:M.indentedCode,trailingSpace:M.trailingSpace,trailingSpaceNewLine:M.trailingSpaceNewLine,md_inside:M.md_inside,fencedEndRE:M.fencedEndRE}},token:function(M,I){if(I.formatting=!1,M!=I.thisLine.stream){if(I.header=0,I.hr=!1,M.match(/^\s*$/,!0))return v(I),null;if(I.prevLine=I.thisLine,I.thisLine={stream:M},I.taskList=!1,I.trailingSpace=0,I.trailingSpaceNewLine=!1,!I.localState&&(I.f=I.block,I.f!=k)){var $=M.match(/^\s*/,!0)[0].replace(/\t/g,o).length;if(I.indentation=$,I.indentationDiff=null,$>0)return null}}return I.f(M,I)},innerMode:function(M){return M.block==k?{state:M.htmlState,mode:J}:M.localState?{state:M.localState,mode:M.localMode}:{state:M,mode:V}},indent:function(M,I,$){return M.block==k&&J.indent?J.indent(M.htmlState,I,$):M.localState&&M.localMode.indent?M.localMode.indent(M.localState,I,$):fe.Pass},blankLine:v,getType:f,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return V},"xml"),fe.defineMIME("text/markdown","markdown"),fe.defineMIME("text/x-markdown","markdown")})},osHv:function(pt,at,pe){(function(fe){fe(pe("VrN/"))})(function(fe){"use strict";var Z=fe.Pos;function _(h,o){return h.line-o.line||h.ch-o.ch}var J="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=J+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",D=new RegExp("<(/?)(["+J+"]["+U+"]*)","g");function z(h,o,l,u){this.line=o,this.ch=l,this.cm=h,this.text=h.getLine(o),this.min=u?Math.max(u.from,h.firstLine()):h.firstLine(),this.max=u?Math.min(u.to-1,h.lastLine()):h.lastLine()}function H(h,o){var l=h.cm.getTokenTypeAt(Z(h.line,o));return l&&/\btag\b/.test(l)}function B(h){return h.line>=h.max?void 0:(h.ch=0,h.text=h.cm.getLine(++h.line),!0)}function O(h){return h.line<=h.min?void 0:(h.text=h.cm.getLine(--h.line),h.ch=h.text.length,!0)}function b(h){for(;;){var o=h.text.indexOf(">",h.ch);if(o==-1){if(B(h))continue;return}if(!H(h,o+1)){h.ch=o+1;continue}var l=h.text.lastIndexOf("/",o),u=l>-1&&!/\S/.test(h.text.slice(l+1,o));return h.ch=o+1,u?"selfClose":"regular"}}function A(h){for(;;){var o=h.ch?h.text.lastIndexOf("<",h.ch-1):-1;if(o==-1){if(O(h))continue;return}if(!H(h,o+1)){h.ch=o;continue}D.lastIndex=o,h.ch=o;var l=D.exec(h.text);if(l&&l.index==o)return l}}function P(h){for(;;){D.lastIndex=h.ch;var o=D.exec(h.text);if(!o){if(B(h))continue;return}if(!H(h,o.index+1)){h.ch=o.index+1;continue}return h.ch=o.index+o[0].length,o}}function L(h){for(;;){var o=h.ch?h.text.lastIndexOf(">",h.ch-1):-1;if(o==-1){if(O(h))continue;return}if(!H(h,o+1)){h.ch=o;continue}var l=h.text.lastIndexOf("/",o),u=l>-1&&!/\S/.test(h.text.slice(l+1,o));return h.ch=o+1,u?"selfClose":"regular"}}function w(h,o){for(var l=[];;){var u=P(h),C,v=h.line,m=h.ch-(u?u[0].length:0);if(!u||!(C=b(h)))return;if(C=="selfClose")continue;if(u[1]){for(var k=l.length-1;k>=0;--k)if(l[k]==u[2]){l.length=k;break}if(k<0&&(!o||o==u[2]))return{tag:u[2],from:Z(v,m),to:Z(h.line,h.ch)}}else l.push(u[2])}}function y(h,o){for(var l=[];;){var u=L(h);if(!u)return;if(u=="selfClose"){A(h);continue}var C=h.line,v=h.ch,m=A(h);if(!m)return;if(m[1])l.push(m[2]);else{for(var k=l.length-1;k>=0;--k)if(l[k]==m[2]){l.length=k;break}if(k<0&&(!o||o==m[2]))return{tag:m[2],from:Z(h.line,h.ch),to:Z(C,v)}}}}fe.registerHelper("fold","xml",function(h,o){for(var l=new z(h,o.line,0);;){var u=P(l);if(!u||l.line!=o.line)return;var C=b(l);if(!C)return;if(!u[1]&&C!="selfClose"){var v=Z(l.line,l.ch),m=w(l,u[2]);return m&&_(m.from,v)>0?{from:v,to:m.from}:null}}}),fe.findMatchingTag=function(h,o,l){var u=new z(h,o.line,o.ch,l);if(u.text.indexOf(">")==-1&&u.text.indexOf("<")==-1)return;var C=b(u),v=C&&Z(u.line,u.ch),m=C&&A(u);if(!C||!m||_(u,o)>0)return;var k={from:Z(u.line,u.ch),to:v,tag:m[2]};return C=="selfClose"?{open:k,close:null,at:"open"}:m[1]?{open:y(u,m[2]),close:k,at:"close"}:(u=new z(h,v.line,v.ch,l),{open:k,close:w(u,m[2]),at:"open"})},fe.findEnclosingTag=function(h,o,l,u){for(var C=new z(h,o.line,o.ch,l);;){var v=y(C,u);if(!v)break;var m=new z(h,o.line,o.ch,l),k=w(m,v.tag);if(k)return{open:v,close:k}}},fe.scanForClosingTag=function(h,o,l,u){var C=new z(h,o.line,o.ch,u?{from:0,to:u}:null);return w(C,l)}})},p0QG:function(pt,at,pe){pt.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(pt,at,pe){"use strict";var fe=pe("+L6B"),Z=pe("2/Rp"),_=pe("5Dmo"),J=pe("3S7+"),U=pe("k1fw"),D=pe("9og8"),z=pe("tJVT"),H=pe("WmNS"),B=pe.n(H),O=pe("q1tI"),b=pe.n(O),A=pe("vHTk"),P=pe.n(A),L=pe("yEEn"),w=pe("ZW9T"),y=pe("1vsH"),h=pe("V0Rq"),o=pe("m3rI");at.a=function(l){var u,C,v,m,k,x,f,p=l.editOffice,d=p===void 0?"view":p,a=l.data,E=l.theme,g=l.type,S=l.filename,F=l.monacoEditor,W=l.className,K=l.style,V=l.close,M=l.onClose,I=l.hasMask,$=l.disabledDownload,ae=Object(O.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),he=Object(z.a)(ae,2),ge=he[0],De=he[1],Se=Object(O.useState)(""),Re=Object(z.a)(Se,2),Ce=Re[0],xe=Re[1],me=Object(O.useState)(),G=Object(z.a)(me,2),s=G[0],c=G[1],R=window.ENV==="build"?"/react/build":"",X=o.a.PROXY_SERVER||location.origin,N,oe=1024*1024,be=10*oe,we=Object(O.useRef)();(u=a)!==null&&u!==void 0&&u.startsWith("/api")&&g!=="txt"&&(a=(o.a.API_SERVER||location.origin)+a),g==="office"&&(N=Object(y.T)(a).filesize,N>be&&(g="other")),S&&F&&(F.filename=S),Object(O.useEffect)(function(){var Me,Be,Ve=(Me=document.cookie)===null||Me===void 0||((Be=Me.replace(/\s/g,""))===null||Be===void 0)?void 0:Be.split(";");Ve==null||Ve.map(function(Xe){var ze=Xe.split("=");ze[0]==="_educoder_session"&&xe(ze[1])})},[]),Object(O.useEffect)(function(){g==="office"&&_e()},[g,a]);var _e=function(){var Me=Object(D.a)(B.a.mark(function Be(){var Ve,Xe,ze;return B.a.wrap(function(je){for(;;)switch(je.prev=je.next){case 0:return console.log("data:",a),Ve=a,a.startsWith("http")||(Ve=location.origin+Ve),Xe=new URL(Ve).pathname.split("/").pop(),je.next=6,Object(h.V)({attachment_id:Xe});case 6:ze=je.sent,c(ze);case 8:case"end":return je.stop()}},Be)}));return function(){return Me.apply(this,arguments)}}(),Le=function(){if(a.startsWith("http")||a.startsWith("blob:")){Oe();return}Object(y.z)(S||"educoder",a,S)},Oe=function(){Object(y.x)(S||"educoder",decodeURIComponent(a))};return b.a.createElement("div",{style:Object(U.a)({},K||{}),className:"".concat(I&&P.a.bgBlack," ").concat(g?P.a.wrp:"hide")},V&&b.a.createElement("div",{className:P.a.close,ref:we},!$&&b.a.createElement(J.a,{title:"\u70B9\u51FB\u4E0B\u8F7D\u6B64\u6587\u4EF6",getPopupContainer:function(){return we.current}},b.a.createElement("span",{onClick:Oe},b.a.createElement("i",{className:"icon-quxiaozhiding"}))),b.a.createElement(J.a,{title:"\u5173\u95ED",getPopupContainer:function(){return we.current}},b.a.createElement("span",{className:"",onClick:M},b.a.createElement("i",{className:"icon-guanbi1"})))),b.a.createElement("div",{className:"".concat(P.a[W]," ").concat(W," ").concat(P.a.monaco," ").concat(g==="txt"?"show":"hide")},g==="txt"&&b.a.createElement(w.b,F)),g==="audio"&&b.a.createElement("audio",{src:"".concat(((C=a)===null||C===void 0?void 0:C.indexOf("http://"))>-1||((v=a)===null||v===void 0?void 0:v.indexOf("https://"))>-1?"":"data:audio/mp3;base64,").concat(a),autoPlay:!0}),g==="video"&&b.a.createElement(b.a.Fragment,null,((m=a)===null||m===void 0?void 0:m.indexOf("http"))>-1?b.a.createElement("video",{controls:!0,src:"".concat(a),autoPlay:!0}):b.a.createElement("video",{controls:!0,src:"data:video/mp4;base64,".concat(a),autoPlay:!0})),g==="office"&&s&&b.a.createElement("iframe",{src:"".concat(R,"/office.html?key=").concat(s.key,"&url=").concat(X+s.url,"&callbackUrl=").concat(X+s.callbackUrl,"&fileType=").concat(s.fileType,"&title=").concat(s.title,"&model=").concat(d,"&officeServer=").concat(o.a.OFFICE_SERVER,"&disabledDownload=").concat(!!$)}),g==="html"&&b.a.createElement("iframe",{src:a+"&disposition=inline"}),g==="pdf"&&b.a.createElement("iframe",{src:"".concat(R,"/js/pdfview/index.html?url=").concat(a,"&disabledDownload=").concat(!!$)}),g==="image"&&b.a.createElement("img",{src:"".concat(((k=a)===null||k===void 0?void 0:k.indexOf("http://"))>-1||((x=a)===null||x===void 0?void 0:x.indexOf("https://"))>-1||(f=a)!==null&&f!==void 0&&f.startsWith("/api")?"":"data:image/png;base64,").concat(a)}),g==="other"&&b.a.createElement("div",null,b.a.createElement(Z.a,{type:"primary",size:"large",onClick:Le},b.a.createElement(L.a,null),"\u70B9\u51FB\u4E0B\u8F7D")),g==="download"&&b.a.createElement(Z.a,{type:"primary",size:"large",onClick:Le},b.a.createElement(L.a,null),"\u70B9\u51FB\u4E0B\u8F7D"))}},"p77/":function(pt,at,pe){},rUJ1:function(pt,at){const pe=/[&<>"']/,fe=/[&<>"']/g,Z=/[<>"']|&(?!#?\w+;)/,_=/[<>"']|&(?!#?\w+;)/g,J={"&":"&","<":"<",">":">",'"':""","'":"'"},U=x=>J[x];function D(x,f){if(f){if(pe.test(x))return x.replace(fe,U)}else if(Z.test(x))return x.replace(_,U);return x}const z=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function H(x){return x.replace(z,(f,p)=>(p=p.toLowerCase(),p==="colon"?":":p.charAt(0)==="#"?p.charAt(1)==="x"?String.fromCharCode(parseInt(p.substring(2),16)):String.fromCharCode(+p.substring(1)):""))}const B=/(^|[^\[])\^/g;function O(x,f){x=x.source||x,f=f||"";const p={replace:(d,a)=>(a=a.source||a,a=a.replace(B,"$1"),x=x.replace(d,a),p),getRegex:()=>new RegExp(x,f)};return p}const b=/[^\w:]/g,A=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function P(x,f,p){if(x){let d;try{d=decodeURIComponent(H(p)).replace(b,"").toLowerCase()}catch(a){return null}if(d.indexOf("javascript:")===0||d.indexOf("vbscript:")===0||d.indexOf("data:")===0)return null}f&&!A.test(p)&&(p=o(f,p));try{p=encodeURI(p).replace(/%25/g,"%")}catch(d){return null}return p}const L={},w=/^[^:]+:\/*[^/]*$/,y=/^([^:]+:)[\s\S]*$/,h=/^([^:]+:\/*[^/]*)[\s\S]*$/;function o(x,f){L[" "+x]||(w.test(x)?L[" "+x]=x+"/":L[" "+x]=v(x,"/",!0)),x=L[" "+x];const p=x.indexOf(":")===-1;return f.substring(0,2)==="//"?p?f:x.replace(y,"$1")+f:f.charAt(0)==="/"?p?f:x.replace(h,"$1")+f:x+f}const l={exec:function(){}};function u(x){let f=1,p,d;for(;f<arguments.length;f++){p=arguments[f];for(d in p)Object.prototype.hasOwnProperty.call(p,d)&&(x[d]=p[d])}return x}function C(x,f){const p=x.replace(/\|/g,(E,g,S)=>{let F=!1,W=g;for(;--W>=0&&S[W]==="\\";)F=!F;return F?"|":" |"}),d=p.split(/ \|/);let a=0;if(d.length>f)d.splice(f);else for(;d.length<f;)d.push("");for(;a<d.length;a++)d[a]=d[a].trim().replace(/\\\|/g,"|");return d}function v(x,f,p){const d=x.length;if(d===0)return"";let a=0;for(;a<d;){const E=x.charAt(d-a-1);if(E===f&&!p)a++;else if(E!==f&&p)a++;else break}return x.substr(0,d-a)}function m(x,f){if(x.indexOf(f[1])===-1)return-1;const p=x.length;let d=0,a=0;for(;a<p;a++)if(x[a]==="\\")a++;else if(x[a]===f[0])d++;else if(x[a]===f[1]&&(d--,d<0))return a;return-1}function k(x){x&&x.sanitize&&!x.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}pt.exports={escape:D,unescape:H,edit:O,cleanUrl:P,resolveUrl:o,noopTest:l,merge:u,splitCells:C,rtrim:v,findClosingBracket:m,checkSanitizeDeprecation:k}},ulZh:function(pt,at,pe){typeof window!="undefined"&&function(Z,_){pt.exports=_()}(this,function(){return function(fe){var Z={};function _(J){if(Z[J])return Z[J].exports;var U=Z[J]={i:J,l:!1,exports:{}};return fe[J].call(U.exports,U,U.exports,_),U.l=!0,U.exports}return _.m=fe,_.c=Z,_.d=function(J,U,D){_.o(J,U)||Object.defineProperty(J,U,{enumerable:!0,get:D})},_.r=function(J){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(J,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(J,"__esModule",{value:!0})},_.t=function(J,U){if(U&1&&(J=_(J)),U&8)return J;if(U&4&&typeof J=="object"&&J&&J.__esModule)return J;var D=Object.create(null);if(_.r(D),Object.defineProperty(D,"default",{enumerable:!0,value:J}),U&2&&typeof J!="string")for(var z in J)_.d(D,z,function(H){return J[H]}.bind(null,z));return D},_.n=function(J){var U=J&&J.__esModule?function(){return J.default}:function(){return J};return _.d(U,"a",U),U},_.o=function(J,U){return Object.prototype.hasOwnProperty.call(J,U)},_.p="/dist/",_(_.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(fe,Z,_){"use strict";var J=Object.prototype.hasOwnProperty,U="~";function D(){}Object.create&&(D.prototype=Object.create(null),new D().__proto__||(U=!1));function z(b,A,P){this.fn=b,this.context=A,this.once=P||!1}function H(b,A,P,L,w){if(typeof P!="function")throw new TypeError("The listener must be a function");var y=new z(P,L||b,w),h=U?U+A:A;return b._events[h]?b._events[h].fn?b._events[h]=[b._events[h],y]:b._events[h].push(y):(b._events[h]=y,b._eventsCount++),b}function B(b,A){--b._eventsCount===0?b._events=new D:delete b._events[A]}function O(){this._events=new D,this._eventsCount=0}O.prototype.eventNames=function(){var A=[],P,L;if(this._eventsCount===0)return A;for(L in P=this._events)J.call(P,L)&&A.push(U?L.slice(1):L);return Object.getOwnPropertySymbols?A.concat(Object.getOwnPropertySymbols(P)):A},O.prototype.listeners=function(A){var P=U?U+A:A,L=this._events[P];if(!L)return[];if(L.fn)return[L.fn];for(var w=0,y=L.length,h=new Array(y);w<y;w++)h[w]=L[w].fn;return h},O.prototype.listenerCount=function(A){var P=U?U+A:A,L=this._events[P];return L?L.fn?1:L.length:0},O.prototype.emit=function(A,P,L,w,y,h){var o=U?U+A:A;if(!this._events[o])return!1;var l=this._events[o],u=arguments.length,C,v;if(l.fn){l.once&&this.removeListener(A,l.fn,void 0,!0);switch(u){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,P),!0;case 3:return l.fn.call(l.context,P,L),!0;case 4:return l.fn.call(l.context,P,L,w),!0;case 5:return l.fn.call(l.context,P,L,w,y),!0;case 6:return l.fn.call(l.context,P,L,w,y,h),!0}for(v=1,C=new Array(u-1);v<u;v++)C[v-1]=arguments[v];l.fn.apply(l.context,C)}else{var m=l.length,k;for(v=0;v<m;v++){l[v].once&&this.removeListener(A,l[v].fn,void 0,!0);switch(u){case 1:l[v].fn.call(l[v].context);break;case 2:l[v].fn.call(l[v].context,P);break;case 3:l[v].fn.call(l[v].context,P,L);break;case 4:l[v].fn.call(l[v].context,P,L,w);break;default:if(!C)for(k=1,C=new Array(u-1);k<u;k++)C[k-1]=arguments[k];l[v].fn.apply(l[v].context,C)}}}return!0},O.prototype.on=function(A,P,L){return H(this,A,P,L,!1)},O.prototype.once=function(A,P,L){return H(this,A,P,L,!0)},O.prototype.removeListener=function(A,P,L,w){var y=U?U+A:A;if(!this._events[y])return this;if(!P)return B(this,y),this;var h=this._events[y];if(h.fn)h.fn===P&&(!w||h.once)&&(!L||h.context===L)&&B(this,y);else{for(var o=0,l=[],u=h.length;o<u;o++)(h[o].fn!==P||w&&!h[o].once||L&&h[o].context!==L)&&l.push(h[o]);l.length?this._events[y]=l.length===1?l[0]:l:B(this,y)}return this},O.prototype.removeAllListeners=function(A){var P;return A?(P=U?U+A:A,this._events[P]&&B(this,P)):(this._events=new D,this._eventsCount=0),this},O.prototype.off=O.prototype.removeListener,O.prototype.addListener=O.prototype.on,O.prefixed=U,O.EventEmitter=O,fe.exports=O},"./node_modules/url-toolkit/src/url-toolkit.js":function(fe,Z,_){(function(J){var U=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,D=/^([^\/?#]*)([^]*)$/,z=/(?:\/|^)\.(?=\/)/g,H=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,B={buildAbsoluteURL:function(O,b,A){if(A=A||{},O=O.trim(),b=b.trim(),!b){if(!A.alwaysNormalize)return O;var P=B.parseURL(O);if(!P)throw new Error("Error trying to parse base URL.");return P.path=B.normalizePath(P.path),B.buildURLFromParts(P)}var L=B.parseURL(b);if(!L)throw new Error("Error trying to parse relative URL.");if(L.scheme)return A.alwaysNormalize?(L.path=B.normalizePath(L.path),B.buildURLFromParts(L)):b;var w=B.parseURL(O);if(!w)throw new Error("Error trying to parse base URL.");if(!w.netLoc&&w.path&&w.path[0]!=="/"){var y=D.exec(w.path);w.netLoc=y[1],w.path=y[2]}w.netLoc&&!w.path&&(w.path="/");var h={scheme:w.scheme,netLoc:L.netLoc,path:null,params:L.params,query:L.query,fragment:L.fragment};if(!L.netLoc&&(h.netLoc=w.netLoc,L.path[0]!=="/"))if(!L.path)h.path=w.path,L.params||(h.params=w.params,L.query||(h.query=w.query));else{var o=w.path,l=o.substring(0,o.lastIndexOf("/")+1)+L.path;h.path=B.normalizePath(l)}return h.path===null&&(h.path=A.alwaysNormalize?B.normalizePath(L.path):L.path),B.buildURLFromParts(h)},parseURL:function(O){var b=U.exec(O);return b?{scheme:b[1]||"",netLoc:b[2]||"",path:b[3]||"",params:b[4]||"",query:b[5]||"",fragment:b[6]||""}:null},normalizePath:function(O){for(O=O.split("").reverse().join("").replace(z,"");O.length!==(O=O.replace(H,"")).length;);return O.split("").reverse().join("")},buildURLFromParts:function(O){return O.scheme+O.netLoc+O.path+O.params+O.query+O.fragment}};fe.exports=B})(this)},"./node_modules/webworkify-webpack/index.js":function(fe,Z,_){function J(A){var P={};function L(y){if(P[y])return P[y].exports;var h=P[y]={i:y,l:!1,exports:{}};return A[y].call(h.exports,h,h.exports,L),h.l=!0,h.exports}L.m=A,L.c=P,L.i=function(y){return y},L.d=function(y,h,o){L.o(y,h)||Object.defineProperty(y,h,{configurable:!1,enumerable:!0,get:o})},L.r=function(y){Object.defineProperty(y,"__esModule",{value:!0})},L.n=function(y){var h=y&&y.__esModule?function(){return y.default}:function(){return y};return L.d(h,"a",h),h},L.o=function(y,h){return Object.prototype.hasOwnProperty.call(y,h)},L.p="/",L.oe=function(y){throw console.error(y),y};var w=L(L.s=ENTRY_MODULE);return w.default||w}var U="[\\.|\\-|\\+|\\w|/|@]+",D="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+U+").*?\\)";function z(A){return(A+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function H(A){return!isNaN(1*A)}function B(A,P,L){var w={};w[L]=[];var y=P.toString(),h=y.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!h)return w;for(var o=h[1],l=new RegExp("(\\\\n|\\W)"+z(o)+D,"g"),u;u=l.exec(y);){if(u[3]==="dll-reference")continue;w[L].push(u[3])}for(l=new RegExp("\\("+z(o)+'\\("(dll-reference\\s('+U+'))"\\)\\)'+D,"g");u=l.exec(y);)A[u[2]]||(w[L].push(u[1]),A[u[2]]=_(u[1]).m),w[u[2]]=w[u[2]]||[],w[u[2]].push(u[4]);for(var C=Object.keys(w),v=0;v<C.length;v++)for(var m=0;m<w[C[v]].length;m++)H(w[C[v]][m])&&(w[C[v]][m]=1*w[C[v]][m]);return w}function O(A){var P=Object.keys(A);return P.reduce(function(L,w){return L||A[w].length>0},!1)}function b(A,P){for(var L={main:[P]},w={main:[]},y={main:{}};O(L);)for(var h=Object.keys(L),o=0;o<h.length;o++){var l=h[o],u=L[l],C=u.pop();if(y[l]=y[l]||{},y[l][C]||!A[l][C])continue;y[l][C]=!0,w[l]=w[l]||[],w[l].push(C);for(var v=B(A,A[l][C],l),m=Object.keys(v),k=0;k<m.length;k++)L[m[k]]=L[m[k]]||[],L[m[k]]=L[m[k]].concat(v[m[k]])}return w}fe.exports=function(A,P){P=P||{};var L={main:_.m},w=P.all?{main:Object.keys(L.main)}:b(L,A),y="";Object.keys(w).filter(function(C){return C!=="main"}).forEach(function(C){for(var v=0;w[C][v];)v++;w[C].push(v),L[C][v]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",y=y+"var "+C+" = ("+J.toString().replace("ENTRY_MODULE",JSON.stringify(v))+")({"+w[C].map(function(m){return""+JSON.stringify(m)+": "+L[C][m].toString()}).join(",")+`});
|
|
`}),y=y+"new (("+J.toString().replace("ENTRY_MODULE",JSON.stringify(A))+")({"+w.main.map(function(C){return""+JSON.stringify(C)+": "+L.main[C].toString()}).join(",")+"}))(self);";var h=new window.Blob([y],{type:"text/javascript"});if(P.bare)return h;var o=window.URL||window.webkitURL||window.mozURL||window.msURL,l=o.createObjectURL(h),u=new window.Worker(l);return u.objectURL=l,u}},"./src/config.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"hlsDefaultConfig",function(){return k}),_.d(Z,"mergeConfig",function(){return f}),_.d(Z,"enableStreamingMode",function(){return p});var J=_("./src/controller/abr-controller.ts"),U=_("./src/controller/audio-stream-controller.ts"),D=_("./src/controller/audio-track-controller.ts"),z=_("./src/controller/subtitle-stream-controller.ts"),H=_("./src/controller/subtitle-track-controller.ts"),B=_("./src/controller/buffer-controller.ts"),O=_("./src/controller/timeline-controller.ts"),b=_("./src/controller/cap-level-controller.ts"),A=_("./src/controller/fps-controller.ts"),P=_("./src/controller/eme-controller.ts"),L=_("./src/controller/cmcd-controller.ts"),w=_("./src/utils/xhr-loader.ts"),y=_("./src/utils/fetch-loader.ts"),h=_("./src/utils/cues.ts"),o=_("./src/utils/mediakeys-helper.ts"),l=_("./src/utils/logger.ts");function u(){return u=Object.assign||function(d){for(var a=1;a<arguments.length;a++){var E=arguments[a];for(var g in E)Object.prototype.hasOwnProperty.call(E,g)&&(d[g]=E[g])}return d},u.apply(this,arguments)}function C(d,a){var E=Object.keys(d);if(Object.getOwnPropertySymbols){var g=Object.getOwnPropertySymbols(d);a&&(g=g.filter(function(S){return Object.getOwnPropertyDescriptor(d,S).enumerable})),E.push.apply(E,g)}return E}function v(d){for(var a=1;a<arguments.length;a++){var E=arguments[a]!=null?arguments[a]:{};a%2?C(Object(E),!0).forEach(function(g){m(d,g,E[g])}):Object.getOwnPropertyDescriptors?Object.defineProperties(d,Object.getOwnPropertyDescriptors(E)):C(Object(E)).forEach(function(g){Object.defineProperty(d,g,Object.getOwnPropertyDescriptor(E,g))})}return d}function m(d,a,E){return a in d?Object.defineProperty(d,a,{value:E,enumerable:!0,configurable:!0,writable:!0}):d[a]=E,d}var k=v(v({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:Infinity,maxBufferSize:60*1e3*1e3,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:Infinity,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:w.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:J.default,bufferController:B.default,capLevelController:b.default,fpsController:A.default,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:o.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},x()),{},{subtitleStreamController:z.SubtitleStreamController,subtitleTrackController:H.default,timelineController:O.TimelineController,audioStreamController:U.default,audioTrackController:D.default,emeController:P.default,cmcdController:L.default});function x(){return{cueHandler:h.default,enableCEA708Captions:!0,enableWebVTT:!0,enableIMSC1:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function f(d,a){if((a.liveSyncDurationCount||a.liveMaxLatencyDurationCount)&&(a.liveSyncDuration||a.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(a.liveMaxLatencyDurationCount!==void 0&&(a.liveSyncDurationCount===void 0||a.liveMaxLatencyDurationCount<=a.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(a.liveMaxLatencyDuration!==void 0&&(a.liveSyncDuration===void 0||a.liveMaxLatencyDuration<=a.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return u({},d,a)}function p(d){var a=d.loader;if(a!==y.default&&a!==w.default)l.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),d.progressive=!1;else{var E=Object(y.fetchSupported)();E&&(d.loader=y.default,d.progressive=!0,d.enableSoftwareAES=!0,l.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}}},"./src/controller/abr-controller.ts":function(fe,Z,_){"use strict";_.r(Z);var J=_("./src/polyfills/number.ts"),U=_("./src/utils/ewma-bandwidth-estimator.ts"),D=_("./src/events.ts"),z=_("./src/utils/buffer-helper.ts"),H=_("./src/errors.ts"),B=_("./src/types/loader.ts"),O=_("./src/utils/logger.ts");function b(L,w){for(var y=0;y<w.length;y++){var h=w[y];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(L,h.key,h)}}function A(L,w,y){return w&&b(L.prototype,w),y&&b(L,y),L}var P=function(){function L(y){this.hls=void 0,this.lastLoadedFragLevel=0,this._nextAutoLevel=-1,this.timer=void 0,this.onCheck=this._abandonRulesCheck.bind(this),this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this.hls=y;var h=y.config;this.bwEstimator=new U.default(h.abrEwmaSlowVoD,h.abrEwmaFastVoD,h.abrEwmaDefaultEstimate),this.registerListeners()}var w=L.prototype;return w.registerListeners=function(){var h=this.hls;h.on(D.Events.FRAG_LOADING,this.onFragLoading,this),h.on(D.Events.FRAG_LOADED,this.onFragLoaded,this),h.on(D.Events.FRAG_BUFFERED,this.onFragBuffered,this),h.on(D.Events.LEVEL_LOADED,this.onLevelLoaded,this),h.on(D.Events.ERROR,this.onError,this)},w.unregisterListeners=function(){var h=this.hls;h.off(D.Events.FRAG_LOADING,this.onFragLoading,this),h.off(D.Events.FRAG_LOADED,this.onFragLoaded,this),h.off(D.Events.FRAG_BUFFERED,this.onFragBuffered,this),h.off(D.Events.LEVEL_LOADED,this.onLevelLoaded,this),h.off(D.Events.ERROR,this.onError,this)},w.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},w.onFragLoading=function(h,o){var l=o.frag;if(l.type===B.PlaylistLevelType.MAIN&&!this.timer){var u;this.fragCurrent=l,this.partCurrent=(u=o.part)!=null?u:null,this.timer=self.setInterval(this.onCheck,100)}},w.onLevelLoaded=function(h,o){var l=this.hls.config;o.details.live?this.bwEstimator.update(l.abrEwmaSlowLive,l.abrEwmaFastLive):this.bwEstimator.update(l.abrEwmaSlowVoD,l.abrEwmaFastVoD)},w._abandonRulesCheck=function(){var h=this.fragCurrent,o=this.partCurrent,l=this.hls,u=l.autoLevelEnabled,C=l.config,v=l.media;if(!h||!v)return;var m=o?o.stats:h.stats,k=o?o.duration:h.duration;if(m.aborted){O.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),this._nextAutoLevel=-1;return}if(!u||v.paused||!v.playbackRate||!v.readyState)return;var x=performance.now()-m.loading.start,f=Math.abs(v.playbackRate);if(x<=500*k/f)return;var p=l.levels,d=l.minAutoLevel,a=p[h.level],E=m.total||Math.max(m.loaded,Math.round(k*a.maxBitrate/8)),g=Math.max(1,m.bwEstimate?m.bwEstimate/8:m.loaded*1e3/x),S=(E-m.loaded)/g,F=v.currentTime,W=(z.BufferHelper.bufferInfo(v,F,C.maxBufferHole).end-F)/f;if(W>=2*k/f||S<=W)return;var K=Number.POSITIVE_INFINITY,V;for(V=h.level-1;V>d;V--){var M=p[V].maxBitrate;if(K=k*M/(8*.8*g),K<W)break}if(K>=S)return;var I=this.bwEstimator.getEstimate();O.logger.warn("Fragment "+h.sn+(o?" part "+o.index:"")+" of level "+h.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+V+`
|
|
Current BW estimate: `+(Object(J.isFiniteNumber)(I)?(I/1024).toFixed(3):"Unknown")+` Kb/s
|
|
Estimated load time for current fragment: `+S.toFixed(3)+` s
|
|
Estimated load time for the next fragment: `+K.toFixed(3)+` s
|
|
Time to underbuffer: `+W.toFixed(3)+" s"),l.nextLoadLevel=V,this.bwEstimator.sample(x,m.loaded),this.clearTimer(),h.loader&&(this.fragCurrent=this.partCurrent=null,h.loader.abort()),l.trigger(D.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:h,part:o,stats:m})},w.onFragLoaded=function(h,o){var l=o.frag,u=o.part;if(l.type===B.PlaylistLevelType.MAIN&&Object(J.isFiniteNumber)(l.sn)){var C=u?u.stats:l.stats,v=u?u.duration:l.duration;if(this.clearTimer(),this.lastLoadedFragLevel=l.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var m=this.hls.levels[l.level],k=(m.loaded?m.loaded.bytes:0)+C.loaded,x=(m.loaded?m.loaded.duration:0)+v;m.loaded={bytes:k,duration:x},m.realBitrate=Math.round(8*k/x)}if(l.bitrateTest){var f={stats:C,frag:l,part:u,id:l.type};this.onFragBuffered(D.Events.FRAG_BUFFERED,f),l.bitrateTest=!1}}},w.onFragBuffered=function(h,o){var l=o.frag,u=o.part,C=u?u.stats:l.stats;if(C.aborted)return;if(l.type!==B.PlaylistLevelType.MAIN||l.sn==="initSegment")return;var v=C.parsing.end-C.loading.start;this.bwEstimator.sample(v,C.loaded),C.bwEstimate=this.bwEstimator.getEstimate(),l.bitrateTest?this.bitrateTestDelay=v/1e3:this.bitrateTestDelay=0},w.onError=function(h,o){switch(o.details){case H.ErrorDetails.FRAG_LOAD_ERROR:case H.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer();break;default:break}},w.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},w.getNextABRAutoLevel=function(){var h=this.fragCurrent,o=this.partCurrent,l=this.hls,u=l.maxAutoLevel,C=l.config,v=l.minAutoLevel,m=l.media,k=o?o.duration:h?h.duration:0,x=m?m.currentTime:0,f=m&&m.playbackRate!==0?Math.abs(m.playbackRate):1,p=this.bwEstimator?this.bwEstimator.getEstimate():C.abrEwmaDefaultEstimate,d=(z.BufferHelper.bufferInfo(m,x,C.maxBufferHole).end-x)/f,a=this.findBestLevel(p,v,u,d,C.abrBandWidthFactor,C.abrBandWidthUpFactor);if(a>=0)return a;O.logger.trace((d?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var E=k?Math.min(k,C.maxStarvationDelay):C.maxStarvationDelay,g=C.abrBandWidthFactor,S=C.abrBandWidthUpFactor;if(!d){var F=this.bitrateTestDelay;if(F){var W=k?Math.min(k,C.maxLoadingDelay):C.maxLoadingDelay;E=W-F,O.logger.trace("bitrate test took "+Math.round(1e3*F)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*E)+" ms"),g=S=1}}return a=this.findBestLevel(p,v,u,d+E,g,S),Math.max(a,0)},w.findBestLevel=function(h,o,l,u,C,v){for(var m,k=this.fragCurrent,x=this.partCurrent,f=this.lastLoadedFragLevel,p=this.hls.levels,d=p[f],a=!!(d!=null&&(m=d.details)!==null&&m!==void 0&&m.live),E=d==null?void 0:d.codecSet,g=x?x.duration:k?k.duration:0,S=l;S>=o;S--){var F=p[S];if(!F||E&&F.codecSet!==E)continue;var W=F.details,K=(x?W==null?void 0:W.partTarget:W==null?void 0:W.averagetargetduration)||g,V=void 0;S<=f?V=C*h:V=v*h;var M=p[S].maxBitrate,I=M*K/V;if(O.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+S+"/"+Math.round(V)+"/"+M+"/"+K+"/"+u+"/"+I),V>M&&(!I||a&&!this.bitrateTestDelay||I<u))return S}return-1},A(L,[{key:"nextAutoLevel",get:function(){var h=this._nextAutoLevel,o=this.bwEstimator;if(h!==-1&&(!o||!o.canEstimate()))return h;var l=this.getNextABRAutoLevel();return h!==-1&&(l=Math.min(h,l)),l},set:function(h){this._nextAutoLevel=h}}]),L}();Z.default=P},"./src/controller/audio-stream-controller.ts":function(fe,Z,_){"use strict";_.r(Z);var J=_("./src/polyfills/number.ts"),U=_("./src/controller/base-stream-controller.ts"),D=_("./src/events.ts"),z=_("./src/utils/buffer-helper.ts"),H=_("./src/controller/fragment-tracker.ts"),B=_("./src/types/level.ts"),O=_("./src/types/loader.ts"),b=_("./src/loader/fragment.ts"),A=_("./src/demux/chunk-cache.ts"),P=_("./src/demux/transmuxer-interface.ts"),L=_("./src/types/transmuxer.ts"),w=_("./src/controller/fragment-finders.ts"),y=_("./src/utils/discontinuities.ts"),h=_("./src/errors.ts"),o=_("./src/utils/logger.ts");function l(){return l=Object.assign||function(k){for(var x=1;x<arguments.length;x++){var f=arguments[x];for(var p in f)Object.prototype.hasOwnProperty.call(f,p)&&(k[p]=f[p])}return k},l.apply(this,arguments)}function u(k,x){k.prototype=Object.create(x.prototype),k.prototype.constructor=k,C(k,x)}function C(k,x){return C=Object.setPrototypeOf||function(p,d){return p.__proto__=d,p},C(k,x)}var v=100,m=function(k){u(x,k);function x(p,d){var a;return a=k.call(this,p,d,"[audio-stream-controller]")||this,a.videoBuffer=null,a.videoTrackCC=-1,a.waitingVideoCC=-1,a.audioSwitch=!1,a.trackId=-1,a.waitingData=null,a.mainDetails=null,a.bufferFlushed=!1,a._registerListeners(),a}var f=x.prototype;return f.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},f._registerListeners=function(){var d=this.hls;d.on(D.Events.MEDIA_ATTACHED,this.onMediaAttached,this),d.on(D.Events.MEDIA_DETACHING,this.onMediaDetaching,this),d.on(D.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.on(D.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.on(D.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),d.on(D.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),d.on(D.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.on(D.Events.ERROR,this.onError,this),d.on(D.Events.BUFFER_RESET,this.onBufferReset,this),d.on(D.Events.BUFFER_CREATED,this.onBufferCreated,this),d.on(D.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),d.on(D.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),d.on(D.Events.FRAG_BUFFERED,this.onFragBuffered,this)},f._unregisterListeners=function(){var d=this.hls;d.off(D.Events.MEDIA_ATTACHED,this.onMediaAttached,this),d.off(D.Events.MEDIA_DETACHING,this.onMediaDetaching,this),d.off(D.Events.MANIFEST_LOADING,this.onManifestLoading,this),d.off(D.Events.LEVEL_LOADED,this.onLevelLoaded,this),d.off(D.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),d.off(D.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),d.off(D.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),d.off(D.Events.ERROR,this.onError,this),d.off(D.Events.BUFFER_RESET,this.onBufferReset,this),d.off(D.Events.BUFFER_CREATED,this.onBufferCreated,this),d.off(D.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),d.off(D.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),d.off(D.Events.FRAG_BUFFERED,this.onFragBuffered,this)},f.onInitPtsFound=function(d,a){var E=a.frag,g=a.id,S=a.initPTS;if(g==="main"){var F=E.cc;this.initPTS[E.cc]=S,this.log("InitPTS for cc: "+F+" found from main: "+S),this.videoTrackCC=F,this.state===U.State.WAITING_INIT_PTS&&this.tick()}},f.startLoad=function(d){if(!this.levels){this.startPosition=d,this.state=U.State.STOPPED;return}var a=this.lastCurrentTime;this.stopLoad(),this.setInterval(v),this.fragLoadError=0,a>0&&d===-1?(this.log("Override startPosition with lastCurrentTime @"+a.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()},f.doTick=function(){switch(this.state){case U.State.IDLE:this.doTickIdle();break;case U.State.WAITING_TRACK:{var d,a=this.levels,E=this.trackId,g=a==null||((d=a[E])===null||d===void 0)?void 0:d.details;if(g){if(this.waitForCdnTuneIn(g))break;this.state=U.State.WAITING_INIT_PTS}break}case U.State.FRAG_LOADING_WAITING_RETRY:{var S,F=performance.now(),W=this.retryDate;(!W||F>=W||(S=this.media)!==null&&S!==void 0&&S.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=U.State.IDLE);break}case U.State.WAITING_INIT_PTS:{var K=this.waitingData;if(K){var V=K.frag,M=K.part,I=K.cache,$=K.complete;if(this.initPTS[V.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=U.State.FRAG_LOADING;var ae=I.flush(),he={frag:V,part:M,payload:ae,networkDetails:null};this._handleFragmentLoadProgress(he),$&&k.prototype._handleFragmentLoadComplete.call(this,he)}else if(this.videoTrackCC!==this.waitingVideoCC)o.logger.log("Waiting fragment cc ("+V.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var ge=this.getLoadPosition(),De=z.BufferHelper.bufferInfo(this.mediaBuffer,ge,this.config.maxBufferHole),Se=Object(w.fragmentWithinToleranceTest)(De.end,this.config.maxFragLookUpTolerance,V);Se<0&&(o.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()},f.clearWaitingFragment=function(){var d=this.waitingData;d&&(this.fragmentTracker.removeFragment(d.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=U.State.IDLE)},f.onTickEnd=function(){var d=this.media;if(!d||!d.readyState)return;var a=this.mediaBuffer?this.mediaBuffer:d,E=a.buffered;!this.loadedmetadata&&E.length&&(this.loadedmetadata=!0),this.lastCurrentTime=d.currentTime},f.doTickIdle=function(){var d,a,E=this.hls,g=this.levels,S=this.media,F=this.trackId,W=E.config;if(!g||!g[F])return;if(!S&&(this.startFragRequested||!W.startFragPrefetch))return;var K=g[F],V=K.details;if(!V||V.live&&this.levelLastLoaded!==F||this.waitForCdnTuneIn(V)){this.state=U.State.WAITING_TRACK;return}this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,b.ElementaryStreamTypes.AUDIO,O.PlaylistLevelType.AUDIO));var M=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,O.PlaylistLevelType.AUDIO);if(M===null)return;var I=M.len,$=this.getMaxBufferLength(),ae=this.audioSwitch;if(I>=$&&!ae)return;if(!ae&&this._streamEnded(M,V)){E.trigger(D.Events.BUFFER_EOS,{type:"audio"}),this.state=U.State.ENDED;return}var he=V.fragments,ge=he[0].start,De=M.end;if(ae){var Se=this.getLoadPosition();De=Se,V.PTSKnown&&Se<ge&&((M.end>ge||M.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),S.currentTime=ge+.05))}var Re=this.getNextFragment(De,V);if(!Re){this.bufferFlushed=!0;return}((d=Re.decryptdata)===null||d===void 0?void 0:d.keyFormat)==="identity"&&!((a=Re.decryptdata)!==null&&a!==void 0&&a.key)?this.loadKey(Re,V):this.loadFragment(Re,V,De)},f.getMaxBufferLength=function(){var d=k.prototype.getMaxBufferLength.call(this),a=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,O.PlaylistLevelType.MAIN);return a===null?d:Math.max(d,a.len)},f.onMediaDetaching=function(){this.videoBuffer=null,k.prototype.onMediaDetaching.call(this)},f.onAudioTracksUpdated=function(d,a){var E=a.audioTracks;this.resetTransmuxer(),this.levels=E.map(function(g){return new B.Level(g)})},f.onAudioTrackSwitching=function(d,a){var E=!!a.url;this.trackId=a.id;var g=this.fragCurrent;g!=null&&g.loader&&g.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),E?this.setInterval(v):this.resetTransmuxer(),E?(this.audioSwitch=!0,this.state=U.State.IDLE):this.state=U.State.STOPPED,this.tick()},f.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},f.onLevelLoaded=function(d,a){this.mainDetails=a.details},f.onAudioTrackLoaded=function(d,a){var E,g=this.levels,S=a.details,F=a.id;if(!g){this.warn("Audio tracks were reset while loading level "+F);return}this.log("Track "+F+" loaded ["+S.startSN+","+S.endSN+"],duration:"+S.totalduration);var W=g[F],K=0;if(S.live||(E=W.details)!==null&&E!==void 0&&E.live){var V=this.mainDetails;if(S.fragments[0]||(S.deltaUpdateFailed=!0),S.deltaUpdateFailed||!V)return;!W.details&&S.hasProgramDateTime&&V.hasProgramDateTime?(Object(y.alignMediaPlaylistByPDT)(S,V),K=S.fragments[0].start):K=this.alignPlaylists(S,W.details)}W.details=S,this.levelLastLoaded=F,!this.startFragRequested&&(this.mainDetails||!S.live)&&this.setStartPosition(W.details,K),this.state===U.State.WAITING_TRACK&&!this.waitForCdnTuneIn(S)&&(this.state=U.State.IDLE),this.tick()},f._handleFragmentLoadProgress=function(d){var a,E=d.frag,g=d.part,S=d.payload,F=this.config,W=this.trackId,K=this.levels;if(!K){this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+E.sn+" of level "+E.level+" will not be buffered");return}var V=K[W];console.assert(V,"Audio track is defined on fragment load progress");var M=V.details;console.assert(M,"Audio track details are defined on fragment load progress");var I=F.defaultAudioCodec||V.audioCodec||"mp4a.40.2",$=this.transmuxer;$||($=this.transmuxer=new P.default(this.hls,O.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var ae=this.initPTS[E.cc],he=(a=E.initSegment)===null||a===void 0?void 0:a.data;if(ae!==void 0){var ge=!1,De=g?g.index:-1,Se=De!==-1,Re=new L.ChunkMetadata(E.level,E.sn,E.stats.chunkCount,S.byteLength,De,Se);$.push(S,he,I,"",E,g,M.totalduration,ge,Re,ae)}else{o.logger.log("Unknown video PTS for cc "+E.cc+", waiting for video PTS before demuxing audio frag "+E.sn+" of ["+M.startSN+" ,"+M.endSN+"],track "+W);var Ce=this.waitingData=this.waitingData||{frag:E,part:g,cache:new A.default,complete:!1},xe=Ce.cache;xe.push(new Uint8Array(S)),this.waitingVideoCC=this.videoTrackCC,this.state=U.State.WAITING_INIT_PTS}},f._handleFragmentLoadComplete=function(d){if(this.waitingData){this.waitingData.complete=!0;return}k.prototype._handleFragmentLoadComplete.call(this,d)},f.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},f.onBufferCreated=function(d,a){var E=a.tracks.audio;E&&(this.mediaBuffer=E.buffer),a.tracks.video&&(this.videoBuffer=a.tracks.video.buffer)},f.onFragBuffered=function(d,a){var E=a.frag,g=a.part;if(E.type!==O.PlaylistLevelType.AUDIO)return;if(this.fragContextChanged(E)){this.warn("Fragment "+E.sn+(g?" p: "+g.index:"")+" of level "+E.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch);return}E.sn!=="initSegment"&&(this.fragPrevious=E,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(D.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(E,g)},f.onError=function(d,a){switch(a.details){case h.ErrorDetails.FRAG_LOAD_ERROR:case h.ErrorDetails.FRAG_LOAD_TIMEOUT:case h.ErrorDetails.KEY_LOAD_ERROR:case h.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(O.PlaylistLevelType.AUDIO,a);break;case h.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case h.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==U.State.ERROR&&this.state!==U.State.STOPPED&&(this.state=a.fatal?U.State.ERROR:U.State.IDLE,this.warn(a.details+" while loading frag, switching to "+this.state+" state"));break;case h.ErrorDetails.BUFFER_FULL_ERROR:if(a.parent==="audio"&&(this.state===U.State.PARSING||this.state===U.State.PARSED)){var E=!0,g=this.getFwdBufferInfo(this.mediaBuffer,O.PlaylistLevelType.AUDIO);g&&g.len>.5&&(E=!this.reduceMaxBufferLength(g.len)),E&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,k.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}break;default:break}},f.onBufferFlushed=function(d,a){var E=a.type;E===b.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},f._handleTransmuxComplete=function(d){var a,E="audio",g=this.hls,S=d.remuxResult,F=d.chunkMeta,W=this.getCurrentContext(F);if(!W){this.warn("The loading context changed while buffering fragment "+F.sn+" of level "+F.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(F.level);return}var K=W.frag,V=W.part,M=S.audio,I=S.text,$=S.id3,ae=S.initSegment;if(this.fragContextChanged(K))return;if(this.state=U.State.PARSING,this.audioSwitch&&M&&this.completeAudioSwitch(),ae!=null&&ae.tracks&&(this._bufferInitSegment(ae.tracks,K,F),g.trigger(D.Events.FRAG_PARSING_INIT_SEGMENT,{frag:K,id:E,tracks:ae.tracks})),M){var he=M.startPTS,ge=M.endPTS,De=M.startDTS,Se=M.endDTS;V&&(V.elementaryStreams[b.ElementaryStreamTypes.AUDIO]={startPTS:he,endPTS:ge,startDTS:De,endDTS:Se}),K.setElementaryStreamInfo(b.ElementaryStreamTypes.AUDIO,he,ge,De,Se),this.bufferFragmentData(M,K,V,F)}if($!=null&&(a=$.samples)!==null&&a!==void 0&&a.length){var Re=l({frag:K,id:E},$);g.trigger(D.Events.FRAG_PARSING_METADATA,Re)}if(I){var Ce=l({frag:K,id:E},I);g.trigger(D.Events.FRAG_PARSING_USERDATA,Ce)}},f._bufferInitSegment=function(d,a,E){if(this.state!==U.State.PARSING)return;d.video&&delete d.video;var g=d.audio;if(!g)return;g.levelCodec=g.codec,g.id="audio",this.log("Init audio buffer, container:"+g.container+", codecs[parsed]=["+g.codec+"]"),this.hls.trigger(D.Events.BUFFER_CODECS,d);var S=g.initSegment;if(S!=null&&S.byteLength){var F={type:"audio",frag:a,part:null,chunkMeta:E,parent:a.type,data:S};this.hls.trigger(D.Events.BUFFER_APPENDING,F)}this.tick()},f.loadFragment=function(d,a,E){var g=this.fragmentTracker.getState(d);this.fragCurrent=d,(this.audioSwitch||g===H.FragmentState.NOT_LOADED||g===H.FragmentState.PARTIAL)&&(d.sn==="initSegment"?this._loadInitSegment(d):a.live&&!Object(J.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,k.prototype.loadFragment.call(this,d,a,E)))},f.completeAudioSwitch=function(){var d=this.hls,a=this.media,E=this.trackId;a&&(this.log("Switching audio track : flushing all audio"),k.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,d.trigger(D.Events.AUDIO_TRACK_SWITCHED,{id:E})},x}(U.default);Z.default=m},"./src/controller/audio-track-controller.ts":function(fe,Z,_){"use strict";_.r(Z);var J=_("./src/events.ts"),U=_("./src/errors.ts"),D=_("./src/controller/base-playlist-controller.ts"),z=_("./src/types/loader.ts");function H(P,L){for(var w=0;w<L.length;w++){var y=L[w];y.enumerable=y.enumerable||!1,y.configurable=!0,"value"in y&&(y.writable=!0),Object.defineProperty(P,y.key,y)}}function B(P,L,w){return L&&H(P.prototype,L),w&&H(P,w),P}function O(P,L){P.prototype=Object.create(L.prototype),P.prototype.constructor=P,b(P,L)}function b(P,L){return b=Object.setPrototypeOf||function(y,h){return y.__proto__=h,y},b(P,L)}var A=function(P){O(L,P);function L(y){var h;return h=P.call(this,y,"[audio-track-controller]")||this,h.tracks=[],h.groupId=null,h.tracksInGroup=[],h.trackId=-1,h.trackName="",h.selectDefaultTrack=!0,h.registerListeners(),h}var w=L.prototype;return w.registerListeners=function(){var h=this.hls;h.on(J.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.on(J.Events.MANIFEST_PARSED,this.onManifestParsed,this),h.on(J.Events.LEVEL_LOADING,this.onLevelLoading,this),h.on(J.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),h.on(J.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),h.on(J.Events.ERROR,this.onError,this)},w.unregisterListeners=function(){var h=this.hls;h.off(J.Events.MANIFEST_LOADING,this.onManifestLoading,this),h.off(J.Events.MANIFEST_PARSED,this.onManifestParsed,this),h.off(J.Events.LEVEL_LOADING,this.onLevelLoading,this),h.off(J.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),h.off(J.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),h.off(J.Events.ERROR,this.onError,this)},w.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,P.prototype.destroy.call(this)},w.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},w.onManifestParsed=function(h,o){this.tracks=o.audioTracks||[]},w.onAudioTrackLoaded=function(h,o){var l=o.id,u=o.details,C=this.tracksInGroup[l];if(!C){this.warn("Invalid audio track id "+l);return}var v=C.details;C.details=o.details,this.log("audioTrack "+l+" loaded ["+u.startSN+"-"+u.endSN+"]"),l===this.trackId&&(this.retryCount=0,this.playlistLoaded(l,o,v))},w.onLevelLoading=function(h,o){this.switchLevel(o.level)},w.onLevelSwitching=function(h,o){this.switchLevel(o.level)},w.switchLevel=function(h){var o=this.hls.levels[h];if(!(o!=null&&o.audioGroupIds))return;var l=o.audioGroupIds[o.urlId];if(this.groupId!==l){this.groupId=l;var u=this.tracks.filter(function(v){return!l||v.groupId===l});this.selectDefaultTrack&&!u.some(function(v){return v.default})&&(this.selectDefaultTrack=!1),this.tracksInGroup=u;var C={audioTracks:u};this.log("Updating audio tracks, "+u.length+' track(s) found in "'+l+'" group-id'),this.hls.trigger(J.Events.AUDIO_TRACKS_UPDATED,C),this.selectInitialTrack()}},w.onError=function(h,o){if(P.prototype.onError.call(this,h,o),o.fatal||!o.context)return;o.context.type===z.PlaylistContextType.AUDIO_TRACK&&o.context.id===this.trackId&&o.context.groupId===this.groupId&&this.retryLoadingOrFail(o)},w.setAudioTrack=function(h){var o=this.tracksInGroup;if(h<0||h>=o.length){this.warn("Invalid id passed to audio-track controller");return}this.clearTimer();var l=o[this.trackId];this.log("Now switching to audio-track index "+h);var u=o[h],C=u.id,v=u.groupId,m=v===void 0?"":v,k=u.name,x=u.type,f=u.url;if(this.trackId=h,this.trackName=k,this.selectDefaultTrack=!1,this.hls.trigger(J.Events.AUDIO_TRACK_SWITCHING,{id:C,groupId:m,name:k,type:x,url:f}),u.details&&!u.details.live)return;var p=this.switchParams(u.url,l==null?void 0:l.details);this.loadPlaylist(p)},w.selectInitialTrack=function(){var h=this.tracksInGroup;console.assert(h.length,"Initial audio track should be selected when tracks are known");var o=this.trackName,l=this.findTrackId(o)||this.findTrackId();l!==-1?this.setAudioTrack(l):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(J.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},w.findTrackId=function(h){for(var o=this.tracksInGroup,l=0;l<o.length;l++){var u=o[l];if((!this.selectDefaultTrack||u.default)&&(!h||h===u.name))return u.id}return-1},w.loadPlaylist=function(h){var o=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(o)){var l=o.id,u=o.groupId,C=o.url;if(h)try{C=h.addDirectives(C)}catch(v){this.warn("Could not construct new URL with HLS Delivery Directives: "+v)}this.log("loading audio-track playlist for id: "+l),this.clearTimer(),this.hls.trigger(J.Events.AUDIO_TRACK_LOADING,{url:C,id:l,groupId:u,deliveryDirectives:h||null})}},B(L,[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(h){this.selectDefaultTrack=!1,this.setAudioTrack(h)}}]),L}(D.default);Z.default=A},"./src/controller/base-playlist-controller.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"default",function(){return B});var J=_("./src/polyfills/number.ts"),U=_("./src/types/level.ts"),D=_("./src/controller/level-helper.ts"),z=_("./src/utils/logger.ts"),H=_("./src/errors.ts"),B=function(){function O(A,P){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=z.logger.log.bind(z.logger,P+":"),this.warn=z.logger.warn.bind(z.logger,P+":"),this.hls=A}var b=O.prototype;return b.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},b.onError=function(P,L){L.fatal&&L.type===H.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},b.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},b.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},b.stopLoad=function(){this.canLoad=!1,this.clearTimer()},b.switchParams=function(P,L){var w=L==null?void 0:L.renditionReports;if(w)for(var y=0;y<w.length;y++){var h=w[y],o=""+h.URI;if(o===P.substr(-o.length)){var l=parseInt(h["LAST-MSN"]),u=parseInt(h["LAST-PART"]);if(L&&this.hls.config.lowLatencyMode){var C=Math.min(L.age-L.partTarget,L.targetduration);u!==void 0&&C>L.partTarget&&(u+=1)}if(Object(J.isFiniteNumber)(l))return new U.HlsUrlParameters(l,Object(J.isFiniteNumber)(u)?u:void 0,U.HlsSkip.No)}}},b.loadPlaylist=function(P){},b.shouldLoadTrack=function(P){return this.canLoad&&P&&!!P.url&&(!P.details||P.details.live)},b.playlistLoaded=function(P,L,w){var y=this,h=L.details,o=L.stats,l=o.loading.end?Math.max(0,self.performance.now()-o.loading.end):0;if(h.advancedDateTime=Date.now()-l,h.live||w!=null&&w.live){if(h.reloaded(w),w&&this.log("live playlist "+P+" "+(h.advanced?"REFRESHED "+h.lastPartSn+"-"+h.lastPartIndex:"MISSED")),w&&h.fragments.length>0&&Object(D.mergeDetails)(w,h),!this.canLoad||!h.live)return;var u,C=void 0,v=void 0;if(h.canBlockReload&&h.endSN&&h.advanced){var m=this.hls.config.lowLatencyMode,k=h.lastPartSn,x=h.endSN,f=h.lastPartIndex,p=f!==-1,d=k===x,a=m?0:f;p?(C=d?x+1:k,v=d?a:f+1):C=x+1;var E=h.age,g=E+h.ageHeader,S=Math.min(g-h.partTarget,h.targetduration*1.5);if(S>0){if(w&&S>w.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+w.tuneInGoal+" to: "+S+" with playlist age: "+h.age),S=0;else{var F=Math.floor(S/h.targetduration);if(C+=F,v!==void 0){var W=Math.round(S%h.targetduration/h.partTarget);v+=W}this.log("CDN Tune-in age: "+h.ageHeader+"s last advanced "+E.toFixed(2)+"s goal: "+S+" skip sn "+F+" to part "+v)}h.tuneInGoal=S}if(u=this.getDeliveryDirectives(h,L.deliveryDirectives,C,v),m||!d){this.loadPlaylist(u);return}}else u=this.getDeliveryDirectives(h,L.deliveryDirectives,C,v);var K=Object(D.computeReloadInterval)(h,o);C!==void 0&&h.canBlockReload&&(K-=h.partTarget||1),this.log("reload live playlist "+P+" in "+Math.round(K)+" ms"),this.timer=self.setTimeout(function(){return y.loadPlaylist(u)},K)}else this.clearTimer()},b.getDeliveryDirectives=function(P,L,w,y){var h=Object(U.getSkipValue)(P,w);return L!=null&&L.skip&&P.deltaUpdateFailed&&(w=L.msn,y=L.part,h=U.HlsSkip.No),new U.HlsUrlParameters(w,y,h)},b.retryLoadingOrFail=function(P){var L=this,w=this.hls.config,y=this.retryCount<w.levelLoadingMaxRetry;if(y){var h;if(this.retryCount++,P.details.indexOf("LoadTimeOut")>-1&&(h=P.context)!==null&&h!==void 0&&h.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+P.details+'"'),this.loadPlaylist();else{var o=Math.min(Math.pow(2,this.retryCount)*w.levelLoadingRetryDelay,w.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout(function(){return L.loadPlaylist()},o),this.warn("retry playlist loading #"+this.retryCount+" in "+o+' ms after "'+P.details+'"')}}else this.warn('cannot recover from error "'+P.details+'"'),this.clearTimer(),P.fatal=!0;return y},O}()},"./src/controller/base-stream-controller.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"State",function(){return x}),_.d(Z,"default",function(){return f});var J=_("./src/polyfills/number.ts"),U=_("./src/task-loop.ts"),D=_("./src/controller/fragment-tracker.ts"),z=_("./src/utils/buffer-helper.ts"),H=_("./src/utils/logger.ts"),B=_("./src/events.ts"),O=_("./src/errors.ts"),b=_("./src/types/transmuxer.ts"),A=_("./src/utils/mp4-tools.ts"),P=_("./src/utils/discontinuities.ts"),L=_("./src/controller/fragment-finders.ts"),w=_("./src/controller/level-helper.ts"),y=_("./src/loader/fragment-loader.ts"),h=_("./src/crypt/decrypter.ts"),o=_("./src/utils/time-ranges.ts"),l=_("./src/types/loader.ts");function u(p,d){for(var a=0;a<d.length;a++){var E=d[a];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(p,E.key,E)}}function C(p,d,a){return d&&u(p.prototype,d),a&&u(p,a),p}function v(p){if(p===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return p}function m(p,d){p.prototype=Object.create(d.prototype),p.prototype.constructor=p,k(p,d)}function k(p,d){return k=Object.setPrototypeOf||function(E,g){return E.__proto__=g,E},k(p,d)}var x={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",BACKTRACKING:"BACKTRACKING",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"},f=function(p){m(d,p);function d(E,g,S){var F;return F=p.call(this)||this,F.hls=void 0,F.fragPrevious=null,F.fragCurrent=null,F.fragmentTracker=void 0,F.transmuxer=null,F._state=x.STOPPED,F.media=void 0,F.mediaBuffer=void 0,F.config=void 0,F.bitrateTest=!1,F.lastCurrentTime=0,F.nextLoadPosition=0,F.startPosition=0,F.loadedmetadata=!1,F.fragLoadError=0,F.retryDate=0,F.levels=null,F.fragmentLoader=void 0,F.levelLastLoaded=null,F.startFragRequested=!1,F.decrypter=void 0,F.initPTS=[],F.onvseeking=null,F.onvended=null,F.logPrefix="",F.log=void 0,F.warn=void 0,F.logPrefix=S,F.log=H.logger.log.bind(H.logger,S+":"),F.warn=H.logger.warn.bind(H.logger,S+":"),F.hls=E,F.fragmentLoader=new y.default(E.config),F.fragmentTracker=g,F.config=E.config,F.decrypter=new h.default(E,E.config),E.on(B.Events.KEY_LOADED,F.onKeyLoaded,v(F)),F}var a=d.prototype;return a.doTick=function(){this.onTickEnd()},a.onTickEnd=function(){},a.startLoad=function(g){},a.stopLoad=function(){this.fragmentLoader.abort();var g=this.fragCurrent;g&&this.fragmentTracker.removeFragment(g),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=x.STOPPED},a._streamEnded=function(g,S){var F=this.fragCurrent,W=this.fragmentTracker;if(!S.live&&F&&F.sn===S.endSN&&!g.nextStart){var K=W.getState(F);return K===D.FragmentState.PARTIAL||K===D.FragmentState.OK}return!1},a.onMediaAttached=function(g,S){var F=this.media=this.mediaBuffer=S.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),F.addEventListener("seeking",this.onvseeking),F.addEventListener("ended",this.onvended);var W=this.config;this.levels&&W.autoStartLoad&&this.state===x.STOPPED&&this.startLoad(W.startPosition)},a.onMediaDetaching=function(){var g=this.media;g!=null&&g.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),g&&(g.removeEventListener("seeking",this.onvseeking),g.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},a.onMediaSeeking=function(){var g=this.config,S=this.fragCurrent,F=this.media,W=this.mediaBuffer,K=this.state,V=F?F.currentTime:0,M=z.BufferHelper.bufferInfo(W||F,V,g.maxBufferHole);if(this.log("media seeking to "+(Object(J.isFiniteNumber)(V)?V.toFixed(3):V)+", state: "+K),K===x.ENDED)this.resetLoadingState();else if(S&&!M.len){var I=g.maxFragLookUpTolerance,$=S.start-I,ae=S.start+S.duration+I,he=V>ae;(V<$||he)&&(he&&S.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),S.loader.abort()),this.resetLoadingState())}F&&(this.lastCurrentTime=V),!this.loadedmetadata&&!M.len&&(this.nextLoadPosition=this.startPosition=V),this.tickImmediate()},a.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},a.onKeyLoaded=function(g,S){if(this.state!==x.KEY_LOADING||S.frag!==this.fragCurrent||!this.levels)return;this.state=x.IDLE;var F=this.levels[S.frag.level].details;F&&this.loadFragment(S.frag,F,S.frag.start)},a.onHandlerDestroying=function(){this.stopLoad(),p.prototype.onHandlerDestroying.call(this)},a.onHandlerDestroyed=function(){this.state=x.STOPPED,this.hls.off(B.Events.KEY_LOADED,this.onKeyLoaded,this),this.fragmentLoader&&this.fragmentLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.fragmentLoader=this.fragmentTracker=null,p.prototype.onHandlerDestroyed.call(this)},a.loadKey=function(g,S){this.log("Loading key for "+g.sn+" of ["+S.startSN+"-"+S.endSN+"], "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+g.level),this.state=x.KEY_LOADING,this.fragCurrent=g,this.hls.trigger(B.Events.KEY_LOADING,{frag:g})},a.loadFragment=function(g,S,F){this._loadFragForPlayback(g,S,F)},a._loadFragForPlayback=function(g,S,F){var W=this,K=function(M){if(W.fragContextChanged(g)){W.warn("Fragment "+g.sn+(M.part?" p: "+M.part.index:"")+" of level "+g.level+" was dropped during download."),W.fragmentTracker.removeFragment(g);return}g.stats.chunkCount++,W._handleFragmentLoadProgress(M)};this._doFragLoad(g,S,F,K).then(function(V){if(!V)return;W.fragLoadError=0;var M=W.state;if(W.fragContextChanged(g)){(M===x.FRAG_LOADING||M===x.BACKTRACKING||!W.fragCurrent&&M===x.PARSING)&&(W.fragmentTracker.removeFragment(g),W.state=x.IDLE);return}if("payload"in V&&(W.log("Loaded fragment "+g.sn+" of level "+g.level),W.hls.trigger(B.Events.FRAG_LOADED,V),W.state===x.BACKTRACKING)){W.fragmentTracker.backtrack(g,V),W.resetFragmentLoading(g);return}W._handleFragmentLoadComplete(V)}).catch(function(V){W.warn(V),W.resetFragmentLoading(g)})},a.flushMainBuffer=function(g,S,F){if(F===void 0&&(F=null),!(g-S))return;var W={startOffset:g,endOffset:S,type:F};this.fragLoadError=0,this.hls.trigger(B.Events.BUFFER_FLUSHING,W)},a._loadInitSegment=function(g){var S=this;this._doFragLoad(g).then(function(F){if(!F||S.fragContextChanged(g)||!S.levels)throw new Error("init load aborted");return F}).then(function(F){var W=S.hls,K=F.payload,V=g.decryptdata;if(K&&K.byteLength>0&&V&&V.key&&V.iv&&V.method==="AES-128"){var M=self.performance.now();return S.decrypter.webCryptoDecrypt(new Uint8Array(K),V.key.buffer,V.iv.buffer).then(function(I){var $=self.performance.now();return W.trigger(B.Events.FRAG_DECRYPTED,{frag:g,payload:I,stats:{tstart:M,tdecrypt:$}}),F.payload=I,F})}return F}).then(function(F){var W=S.fragCurrent,K=S.hls,V=S.levels;if(!V)throw new Error("init load aborted, missing levels");var M=V[g.level].details;console.assert(M,"Level details are defined when init segment is loaded");var I=g.stats;S.state=x.IDLE,S.fragLoadError=0,g.data=new Uint8Array(F.payload),I.parsing.start=I.buffering.start=self.performance.now(),I.parsing.end=I.buffering.end=self.performance.now(),F.frag===W&&K.trigger(B.Events.FRAG_BUFFERED,{stats:I,frag:W,part:null,id:g.type}),S.tick()}).catch(function(F){S.warn(F),S.resetFragmentLoading(g)})},a.fragContextChanged=function(g){var S=this.fragCurrent;return!g||!S||g.level!==S.level||g.sn!==S.sn||g.urlId!==S.urlId},a.fragBufferedComplete=function(g,S){var F=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+g.type+" sn: "+g.sn+(S?" part: "+S.index:"")+" of "+(this.logPrefix==="[stream-controller]"?"level":"track")+" "+g.level+" "+o.default.toString(z.BufferHelper.getBuffered(F))),this.state=x.IDLE,this.tick()},a._handleFragmentLoadComplete=function(g){var S=this.transmuxer;if(!S)return;var F=g.frag,W=g.part,K=g.partsLoaded,V=!K||K.length===0||K.some(function(I){return!I}),M=new b.ChunkMetadata(F.level,F.sn,F.stats.chunkCount+1,0,W?W.index:-1,!V);S.flush(M)},a._handleFragmentLoadProgress=function(g){},a._doFragLoad=function(g,S,F,W){var K=this;if(F===void 0&&(F=null),!this.levels)throw new Error("frag load aborted, missing levels");if(F=Math.max(g.start,F||0),this.config.lowLatencyMode&&S){var V=S.partList;if(V&&W){F>g.end&&S.fragmentHint&&(g=S.fragmentHint);var M=this.getNextPart(V,g,F);if(M>-1){var I=V[M];return this.log("Loading part sn: "+g.sn+" p: "+I.index+" cc: "+g.cc+" of playlist ["+S.startSN+"-"+S.endSN+"] parts [0-"+M+"-"+(V.length-1)+"] "+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+g.level+", target: "+parseFloat(F.toFixed(3))),this.nextLoadPosition=I.start+I.duration,this.state=x.FRAG_LOADING,this.hls.trigger(B.Events.FRAG_LOADING,{frag:g,part:V[M],targetBufferTime:F}),this.doFragPartsLoad(g,V,M,W).catch(function($){return K.handleFragLoadError($)})}else if(!g.url||this.loadedEndOfParts(V,F))return Promise.resolve(null)}}return this.log("Loading fragment "+g.sn+" cc: "+g.cc+" "+(S?"of ["+S.startSN+"-"+S.endSN+"] ":"")+(this.logPrefix==="[stream-controller]"?"level":"track")+": "+g.level+", target: "+parseFloat(F.toFixed(3))),Object(J.isFiniteNumber)(g.sn)&&!this.bitrateTest&&(this.nextLoadPosition=g.start+g.duration),this.state=x.FRAG_LOADING,this.hls.trigger(B.Events.FRAG_LOADING,{frag:g,targetBufferTime:F}),this.fragmentLoader.load(g,W).catch(function($){return K.handleFragLoadError($)})},a.doFragPartsLoad=function(g,S,F,W){var K=this;return new Promise(function(V,M){var I=[],$=function ae(he){var ge=S[he];K.fragmentLoader.loadPart(g,ge,W).then(function(De){I[ge.index]=De;var Se=De.part;K.hls.trigger(B.Events.FRAG_LOADED,De);var Re=S[he+1];if(Re&&Re.fragment===g)ae(he+1);else return V({frag:g,part:Se,partsLoaded:I})}).catch(M)};$(F)})},a.handleFragLoadError=function(g){var S=g.data;return S&&S.details===O.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(S.frag,S.part):this.hls.trigger(B.Events.ERROR,S),null},a._handleTransmuxerFlush=function(g){var S=this.getCurrentContext(g);if(!S||this.state!==x.PARSING){this.fragCurrent||(this.state=x.IDLE);return}var F=S.frag,W=S.part,K=S.level,V=self.performance.now();F.stats.parsing.end=V,W&&(W.stats.parsing.end=V),this.updateLevelTiming(F,W,K,g.partial)},a.getCurrentContext=function(g){var S=this.levels,F=g.level,W=g.sn,K=g.part;if(!S||!S[F])return this.warn("Levels object was unset while buffering fragment "+W+" of level "+F+". The current chunk will not be buffered."),null;var V=S[F],M=K>-1?Object(w.getPartWith)(V,W,K):null,I=M?M.fragment:Object(w.getFragmentWithSN)(V,W,this.fragCurrent);return I?{frag:I,part:M,level:V}:null},a.bufferFragmentData=function(g,S,F,W){if(!g||this.state!==x.PARSING)return;var K=g.data1,V=g.data2,M=K;if(K&&V&&(M=Object(A.appendUint8Array)(K,V)),!M||!M.length)return;var I={type:g.type,frag:S,part:F,chunkMeta:W,parent:S.type,data:M};this.hls.trigger(B.Events.BUFFER_APPENDING,I),g.dropped&&g.independent&&!F&&this.flushBufferGap(S)},a.flushBufferGap=function(g){var S=this.media;if(!S)return;if(!z.BufferHelper.isBuffered(S,S.currentTime)){this.flushMainBuffer(0,g.start);return}var F=S.currentTime,W=z.BufferHelper.bufferInfo(S,F,0),K=g.duration,V=Math.min(this.config.maxFragLookUpTolerance*2,K*.25),M=Math.max(Math.min(g.start-V,W.end-V),F+V);g.start-M>V&&this.flushMainBuffer(M,g.start)},a.getFwdBufferInfo=function(g,S){var F=this.config,W=this.getLoadPosition();if(!Object(J.isFiniteNumber)(W))return null;var K=z.BufferHelper.bufferInfo(g,W,F.maxBufferHole);if(K.len===0&&K.nextStart!==void 0){var V=this.fragmentTracker.getBufferedFrag(W,S);if(V&&K.nextStart<V.end)return z.BufferHelper.bufferInfo(g,W,Math.max(K.nextStart,F.maxBufferHole))}return K},a.getMaxBufferLength=function(g){var S=this.config,F;return g?F=Math.max(8*S.maxBufferSize/g,S.maxBufferLength):F=S.maxBufferLength,Math.min(F,S.maxMaxBufferLength)},a.reduceMaxBufferLength=function(g){var S=this.config,F=g||S.maxBufferLength;return S.maxMaxBufferLength>=F?(S.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+S.maxMaxBufferLength+"s"),!0):!1},a.getNextFragment=function(g,S){var F,W,K=S.fragments,V=K.length;if(!V)return null;var M=this.config,I=K[0].start,$;if(S.live){var ae=M.initialLiveManifestSize;if(V<ae)return this.warn("Not enough fragments to start playback (have: "+V+", need: "+ae+")"),null;!S.PTSKnown&&!this.startFragRequested&&this.startPosition===-1&&($=this.getInitialLiveFragment(S,K),this.startPosition=$?this.hls.liveSyncPosition||$.start:g)}else g<=I&&($=K[0]);if(!$){var he=M.lowLatencyMode?S.partEnd:S.fragmentEnd;$=this.getFragmentAtPosition(g,he,S)}return(F=$)!==null&&F!==void 0&&F.initSegment&&!((W=$)!==null&&W!==void 0&&W.initSegment.data)&&!this.bitrateTest&&($=$.initSegment),$},a.getNextPart=function(g,S,F){for(var W=-1,K=!1,V=!0,M=0,I=g.length;M<I;M++){var $=g[M];if(V=V&&!$.independent,W>-1&&F<$.start)break;var ae=$.loaded;!ae&&(K||$.independent||V)&&$.fragment===S&&(W=M),K=ae}return W},a.loadedEndOfParts=function(g,S){var F=g[g.length-1];return F&&S>F.start&&F.loaded},a.getInitialLiveFragment=function(g,S){var F=this.fragPrevious,W=null;if(F){if(g.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+F.programDateTime),W=Object(L.findFragmentByPDT)(S,F.endProgramDateTime,this.config.maxFragLookUpTolerance)),!W){var K=F.sn+1;if(K>=g.startSN&&K<=g.endSN){var V=S[K-g.startSN];F.cc===V.cc&&(W=V,this.log("Live playlist, switching playlist, load frag with next SN: "+W.sn))}W||(W=Object(L.findFragWithCC)(S,F.cc),W&&this.log("Live playlist, switching playlist, load frag with same CC: "+W.sn))}}else{var M=this.hls.liveSyncPosition;M!==null&&(W=this.getFragmentAtPosition(M,this.bitrateTest?g.fragmentEnd:g.edge,g))}return W},a.getFragmentAtPosition=function(g,S,F){var W=this.config,K=this.fragPrevious,V=F.fragments,M=F.endSN,I=F.fragmentHint,$=W.maxFragLookUpTolerance,ae=!!(W.lowLatencyMode&&F.partList&&I);ae&&I&&!this.bitrateTest&&(V=V.concat(I),M=I.sn);var he;if(g<S){var ge=g>S-$?0:$;he=Object(L.findFragmentByPTS)(K,V,g,ge)}else he=V[V.length-1];if(he){var De=he.sn-F.startSN,Se=K&&he.level===K.level,Re=V[De+1],Ce=this.fragmentTracker.getState(he);if(Ce===D.FragmentState.BACKTRACKED){he=null;for(var xe=De;V[xe]&&this.fragmentTracker.getState(V[xe])===D.FragmentState.BACKTRACKED;)K?he=V[xe--]:he=V[--xe];he||(he=Re)}else K&&he.sn===K.sn&&!ae&&(Se&&(he.sn<M&&this.fragmentTracker.getState(Re)!==D.FragmentState.OK?(this.log("SN "+he.sn+" just loaded, load next one: "+Re.sn),he=Re):he=null))}return he},a.synchronizeToLiveEdge=function(g){var S=this.config,F=this.media;if(!F)return;var W=this.hls.liveSyncPosition,K=F.currentTime,V=g.fragments[0].start,M=g.edge,I=K>=V-S.maxFragLookUpTolerance&&K<=M;if(W!==null&&F.duration>W&&(K<W||!I)){var $=S.liveMaxLatencyDuration!==void 0?S.liveMaxLatencyDuration:S.liveMaxLatencyDurationCount*g.targetduration;(!I&&F.readyState<4||K<M-$)&&(this.loadedmetadata||(this.nextLoadPosition=W),F.readyState&&(this.warn("Playback: "+K.toFixed(3)+" is located too far from the end of live sliding playlist: "+M+", reset currentTime to : "+W.toFixed(3)),F.currentTime=W))}},a.alignPlaylists=function(g,S){var F=this.levels,W=this.levelLastLoaded,K=this.fragPrevious,V=W!==null?F[W]:null,M=g.fragments.length;if(!M)return this.warn("No fragments in live playlist"),0;var I=g.fragments[0].start,$=!S,ae=g.alignedSliding&&Object(J.isFiniteNumber)(I);if($||!ae&&!I){Object(P.alignStream)(K,V,g);var he=g.fragments[0].start;return this.log("Live playlist sliding: "+he.toFixed(2)+" start-sn: "+(S?S.startSN:"na")+"->"+g.startSN+" prev-sn: "+(K?K.sn:"na")+" fragments: "+M),he}return I},a.waitForCdnTuneIn=function(g){var S=3;return g.live&&g.canBlockReload&&g.tuneInGoal>Math.max(g.partHoldBack,g.partTarget*S)},a.setStartPosition=function(g,S){var F=this.startPosition;if(F<S&&(F=-1),F===-1||this.lastCurrentTime===-1){var W=g.startTimeOffset;Object(J.isFiniteNumber)(W)?(F=S+W,W<0&&(F+=g.totalduration),F=Math.min(Math.max(S,F),S+g.totalduration),this.log("Start time offset "+W+" found in playlist, adjust startPosition to "+F),this.startPosition=F):g.live?F=this.hls.liveSyncPosition||S:this.startPosition=F=0,this.lastCurrentTime=F}this.nextLoadPosition=F},a.getLoadPosition=function(){var g=this.media,S=0;return this.loadedmetadata&&g?S=g.currentTime:this.nextLoadPosition&&(S=this.nextLoadPosition),S},a.handleFragLoadAborted=function(g,S){this.transmuxer&&g.sn!=="initSegment"&&g.stats.aborted&&(this.warn("Fragment "+g.sn+(S?" part"+S.index:"")+" of level "+g.level+" was aborted"),this.resetFragmentLoading(g))},a.resetFragmentLoading=function(g){(!this.fragCurrent||!this.fragContextChanged(g))&&(this.state=x.IDLE)},a.onFragmentOrKeyLoadError=function(g,S){if(S.fatal)return;var F=S.frag;if(!F||F.type!==g)return;var W=this.fragCurrent;console.assert(W&&F.sn===W.sn&&F.level===W.level&&F.urlId===W.urlId,"Frag load error must match current frag to retry");var K=this.config;if(this.fragLoadError+1<=K.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(F.level))return;var V=Math.min(Math.pow(2,this.fragLoadError)*K.fragLoadingRetryDelay,K.fragLoadingMaxRetryTimeout);this.warn("Fragment "+F.sn+" of "+g+" "+F.level+" failed to load, retrying in "+V+"ms"),this.retryDate=self.performance.now()+V,this.fragLoadError++,this.state=x.FRAG_LOADING_WAITING_RETRY}else S.levelRetry?(g===l.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=x.IDLE):(H.logger.error(S.details+" reaches max retry, redispatch as fatal ..."),S.fatal=!0,this.hls.stopLoad(),this.state=x.ERROR)},a.afterBufferFlushed=function(g,S,F){if(!g)return;var W=z.BufferHelper.getBuffered(g);this.fragmentTracker.detectEvictedFragments(S,W,F),this.state===x.ENDED&&this.resetLoadingState()},a.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=x.IDLE},a.resetLiveStartWhenNotLoaded=function(g){if(!this.loadedmetadata){this.startFragRequested=!1;var S=this.levels?this.levels[g].details:null;if(S!=null&&S.live)return this.startPosition=-1,this.setStartPosition(S,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},a.updateLevelTiming=function(g,S,F,W){var K=this,V=F.details;console.assert(!!V,"level.details must be defined");var M=Object.keys(g.elementaryStreams).reduce(function(I,$){var ae=g.elementaryStreams[$];if(ae){var he=ae.endPTS-ae.startPTS;if(he<=0)return K.warn("Could not parse fragment "+g.sn+" "+$+" duration reliably ("+he+") resetting transmuxer to fallback to playlist timing"),K.resetTransmuxer(),I||!1;var ge=W?0:Object(w.updateFragPTSDTS)(V,g,ae.startPTS,ae.endPTS,ae.startDTS,ae.endDTS);return K.hls.trigger(B.Events.LEVEL_PTS_UPDATED,{details:V,level:F,drift:ge,type:$,frag:g,start:ae.startPTS,end:ae.endPTS}),!0}return I},!1);M?(this.state=x.PARSED,this.hls.trigger(B.Events.FRAG_PARSED,{frag:g,part:S})):this.resetLoadingState()},a.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},C(d,[{key:"state",get:function(){return this._state},set:function(g){var S=this._state;S!==g&&(this._state=g,this.log(S+"->"+g))}}]),d}(U.default)},"./src/controller/buffer-controller.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"default",function(){return L});var J=_("./src/polyfills/number.ts"),U=_("./src/events.ts"),D=_("./src/utils/logger.ts"),z=_("./src/errors.ts"),H=_("./src/utils/buffer-helper.ts"),B=_("./src/utils/mediasource-helper.ts"),O=_("./src/loader/fragment.ts"),b=_("./src/controller/buffer-operation-queue.ts"),A=Object(B.getMediaSource)(),P=/([ha]vc.)(?:\.[^.,]+)+/,L=function(){function w(h){var o=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var l=o.hls,u=o.media,C=o.mediaSource;D.logger.log("[buffer-controller]: Media source opened"),u&&(o.updateMediaElementDuration(),l.trigger(U.Events.MEDIA_ATTACHED,{media:u})),C&&C.removeEventListener("sourceopen",o._onMediaSourceOpen),o.checkPendingTracks()},this._onMediaSourceClose=function(){D.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){D.logger.log("[buffer-controller]: Media source ended")},this.hls=h,this._initSourceBuffer(),this.registerListeners()}var y=w.prototype;return y.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},y.destroy=function(){this.unregisterListeners(),this.details=null},y.registerListeners=function(){var o=this.hls;o.on(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.on(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(U.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(U.Events.BUFFER_RESET,this.onBufferReset,this),o.on(U.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.on(U.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.on(U.Events.BUFFER_EOS,this.onBufferEos,this),o.on(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.on(U.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.on(U.Events.FRAG_PARSED,this.onFragParsed,this),o.on(U.Events.FRAG_CHANGED,this.onFragChanged,this)},y.unregisterListeners=function(){var o=this.hls;o.off(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),o.off(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(U.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(U.Events.BUFFER_RESET,this.onBufferReset,this),o.off(U.Events.BUFFER_APPENDING,this.onBufferAppending,this),o.off(U.Events.BUFFER_CODECS,this.onBufferCodecs,this),o.off(U.Events.BUFFER_EOS,this.onBufferEos,this),o.off(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),o.off(U.Events.LEVEL_UPDATED,this.onLevelUpdated,this),o.off(U.Events.FRAG_PARSED,this.onFragParsed,this),o.off(U.Events.FRAG_CHANGED,this.onFragChanged,this)},y._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new b.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},y.onManifestParsed=function(o,l){var u=2;(l.audio&&!l.video||!l.altAudio)&&(u=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=u,this.details=null,D.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},y.onMediaAttaching=function(o,l){var u=this.media=l.media;if(u&&A){var C=this.mediaSource=new A;C.addEventListener("sourceopen",this._onMediaSourceOpen),C.addEventListener("sourceended",this._onMediaSourceEnded),C.addEventListener("sourceclose",this._onMediaSourceClose),u.src=self.URL.createObjectURL(C),this._objectUrl=u.src}},y.onMediaDetaching=function(){var o=this.media,l=this.mediaSource,u=this._objectUrl;if(l){if(D.logger.log("[buffer-controller]: media source detaching"),l.readyState==="open")try{l.endOfStream()}catch(C){D.logger.warn("[buffer-controller]: onMediaDetaching: "+C.message+" while calling endOfStream")}this.onBufferReset(),l.removeEventListener("sourceopen",this._onMediaSourceOpen),l.removeEventListener("sourceended",this._onMediaSourceEnded),l.removeEventListener("sourceclose",this._onMediaSourceClose),o&&(u&&self.URL.revokeObjectURL(u),o.src===u?(o.removeAttribute("src"),o.load()):D.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)},y.onBufferReset=function(){var o=this;this.getSourceBufferTypes().forEach(function(l){var u=o.sourceBuffer[l];try{u&&(o.removeBufferListeners(l),o.mediaSource&&o.mediaSource.removeSourceBuffer(u),o.sourceBuffer[l]=void 0)}catch(C){D.logger.warn("[buffer-controller]: Failed to reset the "+l+" buffer",C)}}),this._initSourceBuffer()},y.onBufferCodecs=function(o,l){var u=this,C=this.getSourceBufferTypes().length;if(Object.keys(l).forEach(function(v){if(C){var m=u.tracks[v];if(m&&typeof m.buffer.changeType=="function"){var k=l[v],x=k.codec,f=k.levelCodec,p=k.container,d=(m.levelCodec||m.codec).replace(P,"$1"),a=(f||x).replace(P,"$1");if(d!==a){var E=p+";codecs="+(f||x);u.appendChangeType(v,E)}}}else u.pendingTracks[v]=l[v]}),C)return;this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()},y.appendChangeType=function(o,l){var u=this,C=this.operationQueue,v={execute:function(){var k=u.sourceBuffer[o];k&&(D.logger.log("[buffer-controller]: changing "+o+" sourceBuffer type to "+l),k.changeType(l)),C.shiftAndExecuteNext(o)},onStart:function(){},onComplete:function(){},onError:function(k){D.logger.warn("[buffer-controller]: Failed to change "+o+" SourceBuffer type",k)}};C.append(v,o)},y.onBufferAppending=function(o,l){var u=this,C=this.hls,v=this.operationQueue,m=this.tracks,k=l.data,x=l.type,f=l.frag,p=l.part,d=l.chunkMeta,a=d.buffering[x],E=self.performance.now();a.start=E;var g=f.stats.buffering,S=p?p.stats.buffering:null;g.start===0&&(g.start=E),S&&S.start===0&&(S.start=E);var F=m.audio,W=x==="audio"&&d.id===1&&(F==null?void 0:F.container)==="audio/mpeg",K={execute:function(){if(a.executeStart=self.performance.now(),W){var M=u.sourceBuffer[x];if(M){var I=f.start-M.timestampOffset;Math.abs(I)>=.1&&(D.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+f.start+" (delta: "+I+") sn: "+f.sn+")"),M.timestampOffset=f.start)}}u.appendExecutor(k,x)},onStart:function(){},onComplete:function(){var M=self.performance.now();a.executeEnd=a.end=M,g.first===0&&(g.first=M),S&&S.first===0&&(S.first=M);var I=u.sourceBuffer,$={};for(var ae in I)$[ae]=H.BufferHelper.getBuffered(I[ae]);u.appendError=0,u.hls.trigger(U.Events.BUFFER_APPENDED,{type:x,frag:f,part:p,chunkMeta:d,parent:f.type,timeRanges:$})},onError:function(M){D.logger.error("[buffer-controller]: Error encountered while trying to append to the "+x+" SourceBuffer",M);var I={type:z.ErrorTypes.MEDIA_ERROR,parent:f.type,details:z.ErrorDetails.BUFFER_APPEND_ERROR,err:M,fatal:!1};M.code===DOMException.QUOTA_EXCEEDED_ERR?I.details=z.ErrorDetails.BUFFER_FULL_ERROR:(u.appendError++,I.details=z.ErrorDetails.BUFFER_APPEND_ERROR,u.appendError>C.config.appendErrorMaxRetry&&(D.logger.error("[buffer-controller]: Failed "+C.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),I.fatal=!0)),C.trigger(U.Events.ERROR,I)}};v.append(K,x)},y.onBufferFlushing=function(o,l){var u=this,C=this.operationQueue,v=function(k){return{execute:u.removeExecutor.bind(u,k,l.startOffset,l.endOffset),onStart:function(){},onComplete:function(){u.hls.trigger(U.Events.BUFFER_FLUSHED,{type:k})},onError:function(f){D.logger.warn("[buffer-controller]: Failed to remove from "+k+" SourceBuffer",f)}}};l.type?C.append(v(l.type),l.type):this.getSourceBufferTypes().forEach(function(m){C.append(v(m),m)})},y.onFragParsed=function(o,l){var u=this,C=l.frag,v=l.part,m=[],k=v?v.elementaryStreams:C.elementaryStreams;k[O.ElementaryStreamTypes.AUDIOVIDEO]?m.push("audiovideo"):(k[O.ElementaryStreamTypes.AUDIO]&&m.push("audio"),k[O.ElementaryStreamTypes.VIDEO]&&m.push("video"));var x=function(){var p=self.performance.now();C.stats.buffering.end=p,v&&(v.stats.buffering.end=p);var d=v?v.stats:C.stats;u.hls.trigger(U.Events.FRAG_BUFFERED,{frag:C,part:v,stats:d,id:C.type})};m.length===0&&D.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+C.type+" level: "+C.level+" sn: "+C.sn),this.blockBuffers(x,m)},y.onFragChanged=function(o,l){this.flushBackBuffer()},y.onBufferEos=function(o,l){var u=this,C=this.getSourceBufferTypes().reduce(function(v,m){var k=u.sourceBuffer[m];return(!l.type||l.type===m)&&(k&&!k.ended&&(k.ended=!0,D.logger.log("[buffer-controller]: "+m+" sourceBuffer now EOS"))),v&&!!(!k||k.ended)},!0);C&&this.blockBuffers(function(){var v=u.mediaSource;if(!v||v.readyState!=="open")return;v.endOfStream()})},y.onLevelUpdated=function(o,l){var u=l.details;if(!u.fragments.length)return;this.details=u,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration()},y.flushBackBuffer=function(){var o=this.hls,l=this.details,u=this.media,C=this.sourceBuffer;if(!u||l===null)return;var v=this.getSourceBufferTypes();if(!v.length)return;var m=l.live&&o.config.liveBackBufferLength!==null?o.config.liveBackBufferLength:o.config.backBufferLength;if(!Object(J.isFiniteNumber)(m)||m<0)return;var k=u.currentTime,x=l.levelTargetDuration,f=Math.max(m,x),p=Math.floor(k/x)*x-f;v.forEach(function(d){var a=C[d];if(a){var E=H.BufferHelper.getBuffered(a);E.length>0&&p>E.start(0)&&(o.trigger(U.Events.BACK_BUFFER_REACHED,{bufferEnd:p}),l.live&&o.trigger(U.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:p}),o.trigger(U.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:p,type:d}))}})},y.updateMediaElementDuration=function(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;var o=this.details,l=this.hls,u=this.media,C=this.mediaSource,v=o.fragments[0].start+o.totalduration,m=u.duration,k=Object(J.isFiniteNumber)(C.duration)?C.duration:0;o.live&&l.config.liveDurationInfinity?(D.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),C.duration=Infinity,this.updateSeekableRange(o)):(v>k&&v>m||!Object(J.isFiniteNumber)(m))&&(D.logger.log("[buffer-controller]: Updating Media Source duration to "+v.toFixed(3)),C.duration=v)},y.updateSeekableRange=function(o){var l=this.mediaSource,u=o.fragments,C=u.length;if(C&&o.live&&l!==null&&l!==void 0&&l.setLiveSeekableRange){var v=Math.max(0,u[0].start),m=Math.max(v,v+o.totalduration);l.setLiveSeekableRange(v,m)}},y.checkPendingTracks=function(){var o=this.bufferCodecEventsExpected,l=this.operationQueue,u=this.pendingTracks,C=Object.keys(u).length;if(C&&!o||C===2){this.createSourceBuffers(u),this.pendingTracks={};var v=this.getSourceBufferTypes();if(v.length===0){this.hls.trigger(U.Events.ERROR,{type:z.ErrorTypes.MEDIA_ERROR,details:z.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});return}v.forEach(function(m){l.executeNext(m)})}},y.createSourceBuffers=function(o){var l=this.sourceBuffer,u=this.mediaSource;if(!u)throw Error("createSourceBuffers called when mediaSource was null");var C=0;for(var v in o)if(!l[v]){var m=o[v];if(!m)throw Error("source buffer exists for track "+v+", however track does not");var k=m.levelCodec||m.codec,x=m.container+";codecs="+k;D.logger.log("[buffer-controller]: creating sourceBuffer("+x+")");try{var f=l[v]=u.addSourceBuffer(x),p=v;this.addBufferListener(p,"updatestart",this._onSBUpdateStart),this.addBufferListener(p,"updateend",this._onSBUpdateEnd),this.addBufferListener(p,"error",this._onSBUpdateError),this.tracks[v]={buffer:f,codec:k,container:m.container,levelCodec:m.levelCodec,id:m.id},C++}catch(d){D.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+d.message),this.hls.trigger(U.Events.ERROR,{type:z.ErrorTypes.MEDIA_ERROR,details:z.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:d,mimeType:x})}}C&&this.hls.trigger(U.Events.BUFFER_CREATED,{tracks:this.tracks})},y._onSBUpdateStart=function(o){var l=this.operationQueue,u=l.current(o);u.onStart()},y._onSBUpdateEnd=function(o){var l=this.operationQueue,u=l.current(o);u.onComplete(),l.shiftAndExecuteNext(o)},y._onSBUpdateError=function(o,l){D.logger.error("[buffer-controller]: "+o+" SourceBuffer error",l),this.hls.trigger(U.Events.ERROR,{type:z.ErrorTypes.MEDIA_ERROR,details:z.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var u=this.operationQueue.current(o);u&&u.onError(l)},y.removeExecutor=function(o,l,u){var C=this.media,v=this.mediaSource,m=this.operationQueue,k=this.sourceBuffer,x=k[o];if(!C||!v||!x){D.logger.warn("[buffer-controller]: Attempting to remove from the "+o+" SourceBuffer, but it does not exist"),m.shiftAndExecuteNext(o);return}var f=Object(J.isFiniteNumber)(C.duration)?C.duration:Infinity,p=Object(J.isFiniteNumber)(v.duration)?v.duration:Infinity,d=Math.max(0,l),a=Math.min(u,f,p);a>d?(D.logger.log("[buffer-controller]: Removing ["+d+","+a+"] from the "+o+" SourceBuffer"),console.assert(!x.updating,o+" sourceBuffer must not be updating"),x.remove(d,a)):m.shiftAndExecuteNext(o)},y.appendExecutor=function(o,l){var u=this.operationQueue,C=this.sourceBuffer,v=C[l];if(!v){D.logger.warn("[buffer-controller]: Attempting to append to the "+l+" SourceBuffer, but it does not exist"),u.shiftAndExecuteNext(l);return}v.ended=!1,console.assert(!v.updating,l+" sourceBuffer must not be updating"),v.appendBuffer(o)},y.blockBuffers=function(o,l){var u=this;if(l===void 0&&(l=this.getSourceBufferTypes()),!l.length){D.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),Promise.resolve(o);return}var C=this.operationQueue,v=l.map(function(m){return C.appendBlocker(m)});Promise.all(v).then(function(){o(),l.forEach(function(m){var k=u.sourceBuffer[m];(!k||!k.updating)&&C.shiftAndExecuteNext(m)})})},y.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},y.addBufferListener=function(o,l,u){var C=this.sourceBuffer[o];if(!C)return;var v=u.bind(this,o);this.listeners[o].push({event:l,listener:v}),C.addEventListener(l,v)},y.removeBufferListeners=function(o){var l=this.sourceBuffer[o];if(!l)return;this.listeners[o].forEach(function(u){l.removeEventListener(u.event,u.listener)})},w}()},"./src/controller/buffer-operation-queue.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"default",function(){return U});var J=_("./src/utils/logger.ts"),U=function(){function D(H){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=H}var z=D.prototype;return z.append=function(B,O){var b=this.queues[O];b.push(B),b.length===1&&this.buffers[O]&&this.executeNext(O)},z.insertAbort=function(B,O){var b=this.queues[O];b.unshift(B),this.executeNext(O)},z.appendBlocker=function(B){var O,b=new Promise(function(P){O=P}),A={execute:O,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(A,B),b},z.executeNext=function(B){var O=this.buffers,b=this.queues,A=O[B],P=b[B];if(P.length){var L=P[0];try{L.execute()}catch(w){J.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),L.onError(w),(!A||!A.updating)&&(P.shift(),this.executeNext(B))}}},z.shiftAndExecuteNext=function(B){this.queues[B].shift(),this.executeNext(B)},z.current=function(B){return this.queues[B][0]},D}()},"./src/controller/cap-level-controller.ts":function(fe,Z,_){"use strict";_.r(Z);var J=_("./src/events.ts");function U(H,B){for(var O=0;O<B.length;O++){var b=B[O];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(H,b.key,b)}}function D(H,B,O){return B&&U(H.prototype,B),O&&U(H,O),H}var z=function(){function H(O){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=O,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var B=H.prototype;return B.setStreamController=function(b){this.streamController=b},B.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},B.registerListeners=function(){var b=this.hls;b.on(J.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),b.on(J.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),b.on(J.Events.MANIFEST_PARSED,this.onManifestParsed,this),b.on(J.Events.BUFFER_CODECS,this.onBufferCodecs,this),b.on(J.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},B.unregisterListener=function(){var b=this.hls;b.off(J.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),b.off(J.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),b.off(J.Events.MANIFEST_PARSED,this.onManifestParsed,this),b.off(J.Events.BUFFER_CODECS,this.onBufferCodecs,this),b.off(J.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},B.onFpsDropLevelCapping=function(b,A){H.isLevelAllowed(A.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(A.droppedLevel)},B.onMediaAttaching=function(b,A){this.media=A.media instanceof HTMLVideoElement?A.media:null},B.onManifestParsed=function(b,A){var P=this.hls;this.restrictedLevels=[],this.firstLevel=A.firstLevel,P.config.capLevelToPlayerSize&&A.video&&this.startCapping()},B.onBufferCodecs=function(b,A){var P=this.hls;P.config.capLevelToPlayerSize&&A.video&&this.startCapping()},B.onMediaDetaching=function(){this.stopCapping()},B.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var b=this.hls.levels;if(b.length){var A=this.hls;A.autoLevelCapping=this.getMaxLevel(b.length-1),A.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=A.autoLevelCapping}}},B.getMaxLevel=function(b){var A=this,P=this.hls.levels;if(!P.length)return-1;var L=P.filter(function(w,y){return H.isLevelAllowed(y,A.restrictedLevels)&&y<=b});return this.clientRect=null,H.getMaxLevelByMediaSize(L,this.mediaWidth,this.mediaHeight)},B.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()},B.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},B.getDimensions=function(){if(this.clientRect)return this.clientRect;var b=this.media,A={width:0,height:0};if(b){var P=b.getBoundingClientRect();A.width=P.width,A.height=P.height,!A.width&&!A.height&&(A.width=P.right-P.left||b.width||0,A.height=P.bottom-P.top||b.height||0)}return this.clientRect=A,A},H.isLevelAllowed=function(b,A){return A===void 0&&(A=[]),A.indexOf(b)===-1},H.getMaxLevelByMediaSize=function(b,A,P){if(!b||!b.length)return-1;for(var L=function(l,u){return u?l.width!==u.width||l.height!==u.height:!0},w=b.length-1,y=0;y<b.length;y+=1){var h=b[y];if((h.width>=A||h.height>=P)&&L(h,b[y+1])){w=y;break}}return w},D(H,[{key:"mediaWidth",get:function(){return this.getDimensions().width*H.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*H.contentScaleFactor}}],[{key:"contentScaleFactor",get:function(){var b=1;try{b=self.devicePixelRatio}catch(A){}return b}}]),H}();Z.default=z},"./src/controller/cmcd-controller.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"default",function(){return L});var J=_("./src/events.ts"),U=_("./src/types/cmcd.ts"),D=_("./src/utils/buffer-helper.ts"),z=_("./src/utils/logger.ts");function H(w,y){for(var h=0;h<y.length;h++){var o=y[h];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(w,o.key,o)}}function B(w,y,h){return y&&H(w.prototype,y),h&&H(w,h),w}function O(w,y){var h=typeof Symbol!="undefined"&&w[Symbol.iterator]||w["@@iterator"];if(h)return(h=h.call(w)).next.bind(h);if(Array.isArray(w)||(h=b(w))||y&&w&&typeof w.length=="number"){h&&(w=h);var o=0;return function(){return o>=w.length?{done:!0}:{done:!1,value:w[o++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function b(w,y){if(!w)return;if(typeof w=="string")return A(w,y);var h=Object.prototype.toString.call(w).slice(8,-1);if(h==="Object"&&w.constructor&&(h=w.constructor.name),h==="Map"||h==="Set")return Array.from(w);if(h==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(h))return A(w,y)}function A(w,y){(y==null||y>w.length)&&(y=w.length);for(var h=0,o=new Array(y);h<y;h++)o[h]=w[h];return o}function P(){return P=Object.assign||function(w){for(var y=1;y<arguments.length;y++){var h=arguments[y];for(var o in h)Object.prototype.hasOwnProperty.call(h,o)&&(w[o]=h[o])}return w},P.apply(this,arguments)}var L=function(){function w(h){var o=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){o.initialized&&(o.starved=!0),o.buffering=!0},this.onPlaying=function(){o.initialized||(o.initialized=!0),o.buffering=!1},this.applyPlaylistData=function(C){try{o.apply(C,{ot:U.CMCDObjectType.MANIFEST,su:!o.initialized})}catch(v){z.logger.warn("Could not generate manifest CMCD data.",v)}},this.applyFragmentData=function(C){try{var v=C.frag,m=o.hls.levels[v.level],k=o.getObjectType(v),x={d:v.duration*1e3,ot:k};(k===U.CMCDObjectType.VIDEO||k===U.CMCDObjectType.AUDIO||k==U.CMCDObjectType.MUXED)&&(x.br=m.bitrate/1e3,x.tb=o.getTopBandwidth(k),x.bl=o.getBufferLength(k)),o.apply(C,x)}catch(f){z.logger.warn("Could not generate segment CMCD data.",f)}},this.hls=h;var l=this.config=h.config,u=l.cmcd;u!=null&&(l.pLoader=this.createPlaylistLoader(),l.fLoader=this.createFragmentLoader(),this.sid=u.sessionId||w.uuid(),this.cid=u.contentId,this.useHeaders=u.useHeaders===!0,this.registerListeners())}var y=w.prototype;return y.registerListeners=function(){var o=this.hls;o.on(J.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(J.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.on(J.Events.BUFFER_CREATED,this.onBufferCreated,this)},y.unregisterListeners=function(){var o=this.hls;o.off(J.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(J.Events.MEDIA_DETACHED,this.onMediaDetached,this),o.off(J.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},y.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},y.onMediaAttached=function(o,l){this.media=l.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},y.onMediaDetached=function(){if(!this.media)return;this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null},y.onBufferCreated=function(o,l){var u,C;this.audioBuffer=(u=l.tracks.audio)===null||u===void 0?void 0:u.buffer,this.videoBuffer=(C=l.tracks.video)===null||C===void 0?void 0:C.buffer},y.createData=function(){var o;return{v:U.CMCDVersion,sf:U.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:(o=this.media)===null||o===void 0?void 0:o.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},y.apply=function(o,l){l===void 0&&(l={}),P(l,this.createData());var u=l.ot===U.CMCDObjectType.INIT||l.ot===U.CMCDObjectType.VIDEO||l.ot===U.CMCDObjectType.MUXED;if(this.starved&&u&&(l.bs=!0,l.su=!0,this.starved=!1),l.su==null&&(l.su=this.buffering),this.useHeaders){var C=w.toHeaders(l);if(!Object.keys(C).length)return;o.headers||(o.headers={}),P(o.headers,C)}else{var v=w.toQuery(l);if(!v)return;o.url=w.appendQueryToUri(o.url,v)}},y.getObjectType=function(o){var l=o.type;return l==="subtitle"?U.CMCDObjectType.TIMED_TEXT:o.sn==="initSegment"?U.CMCDObjectType.INIT:l==="audio"?U.CMCDObjectType.AUDIO:l==="main"?this.hls.audioTracks.length?U.CMCDObjectType.VIDEO:U.CMCDObjectType.MUXED:void 0},y.getTopBandwidth=function(o){for(var l=0,u=o===U.CMCDObjectType.AUDIO?this.hls.audioTracks:this.hls.levels,C=O(u),v;!(v=C()).done;){var m=v.value;m.bitrate>l&&(l=m.bitrate)}return l>0?l:NaN},y.getBufferLength=function(o){var l=this.hls.media,u=o===U.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;if(!u||!l)return NaN;var C=D.BufferHelper.bufferInfo(u,l.currentTime,this.config.maxBufferHole);return C.len*1e3},y.createPlaylistLoader=function(){var o=this.config.pLoader,l=this.applyPlaylistData,u=o||this.config.loader;return function(){function C(m){this.loader=void 0,this.loader=new u(m)}var v=C.prototype;return v.destroy=function(){this.loader.destroy()},v.abort=function(){this.loader.abort()},v.load=function(k,x,f){l(k),this.loader.load(k,x,f)},B(C,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),C}()},y.createFragmentLoader=function(){var o=this.config.fLoader,l=this.applyFragmentData,u=o||this.config.loader;return function(){function C(m){this.loader=void 0,this.loader=new u(m)}var v=C.prototype;return v.destroy=function(){this.loader.destroy()},v.abort=function(){this.loader.abort()},v.load=function(k,x,f){l(k),this.loader.load(k,x,f)},B(C,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),C}()},w.uuid=function(){var o=URL.createObjectURL(new Blob),l=o.toString();return URL.revokeObjectURL(o),l.substr(l.lastIndexOf("/")+1)},w.serialize=function(o){for(var l=[],u=function(W){return!Number.isNaN(W)&&W!=null&&W!==""&&W!==!1},C=function(W){return Math.round(W)},v=function(W){return C(W/100)*100},m=function(W){return encodeURIComponent(W)},k={br:C,d:C,bl:v,dl:v,mtp:v,nor:m,rtp:v,tb:C},x=Object.keys(o||{}).sort(),f=O(x),p;!(p=f()).done;){var d=p.value,a=o[d];if(!u(a))continue;if(d==="v"&&a===1)continue;if(d=="pr"&&a===1)continue;var E=k[d];E&&(a=E(a));var g=typeof a,S=void 0;d==="ot"||d==="sf"||d==="st"?S=d+"="+a:g==="boolean"?S=d:g==="number"?S=d+"="+a:S=d+"="+JSON.stringify(a),l.push(S)}return l.join(",")},w.toHeaders=function(o){for(var l=Object.keys(o),u={},C=["Object","Request","Session","Status"],v=[{},{},{},{}],m={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,bs:3,rtp:3},k=0,x=l;k<x.length;k++){var f=x[k],p=m[f]!=null?m[f]:1;v[p][f]=o[f]}for(var d=0;d<v.length;d++){var a=w.serialize(v[d]);a&&(u["CMCD-"+C[d]]=a)}return u},w.toQuery=function(o){return"CMCD="+encodeURIComponent(w.serialize(o))},w.appendQueryToUri=function(o,l){if(!l)return o;var u=o.includes("?")?"&":"?";return""+o+u+l},w}()},"./src/controller/eme-controller.ts":function(fe,Z,_){"use strict";_.r(Z);var J=_("./src/events.ts"),U=_("./src/errors.ts"),D=_("./src/utils/logger.ts"),z=_("./src/utils/mediakeys-helper.ts");function H(L,w){for(var y=0;y<w.length;y++){var h=w[y];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(L,h.key,h)}}function B(L,w,y){return w&&H(L.prototype,w),y&&H(L,y),L}var O=3,b=function(w,y,h){var o={audioCapabilities:[],videoCapabilities:[]};return w.forEach(function(l){o.audioCapabilities.push({contentType:'audio/mp4; codecs="'+l+'"',robustness:h.audioRobustness||""})}),y.forEach(function(l){o.videoCapabilities.push({contentType:'video/mp4; codecs="'+l+'"',robustness:h.videoRobustness||""})}),[o]},A=function(w,y,h,o){switch(w){case z.KeySystems.WIDEVINE:return b(y,h,o);default:throw new Error("Unknown key-system: "+w)}},P=function(){function L(y){this.hls=void 0,this._widevineLicenseUrl=void 0,this._licenseXhrSetup=void 0,this._licenseResponseCallback=void 0,this._emeEnabled=void 0,this._requestMediaKeySystemAccess=void 0,this._drmSystemOptions=void 0,this._config=void 0,this._mediaKeysList=[],this._media=null,this._hasSetMediaKeys=!1,this._requestLicenseFailureCount=0,this.mediaKeysPromise=null,this._onMediaEncrypted=this.onMediaEncrypted.bind(this),this.hls=y,this._config=y.config,this._widevineLicenseUrl=this._config.widevineLicenseUrl,this._licenseXhrSetup=this._config.licenseXhrSetup,this._licenseResponseCallback=this._config.licenseResponseCallback,this._emeEnabled=this._config.emeEnabled,this._requestMediaKeySystemAccess=this._config.requestMediaKeySystemAccessFunc,this._drmSystemOptions=this._config.drmSystemOptions,this._registerListeners()}var w=L.prototype;return w.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},w._registerListeners=function(){this.hls.on(J.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(J.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(J.Events.MANIFEST_PARSED,this.onManifestParsed,this)},w._unregisterListeners=function(){this.hls.off(J.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(J.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(J.Events.MANIFEST_PARSED,this.onManifestParsed,this)},w.getLicenseServerUrl=function(h){switch(h){case z.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+h+'"')},w._attemptKeySystemAccess=function(h,o,l){var u=this,C=A(h,o,l,this._drmSystemOptions);D.logger.log("Requesting encrypted media key-system access");var v=this.requestMediaKeySystemAccess(h,C);this.mediaKeysPromise=v.then(function(m){return u._onMediaKeySystemAccessObtained(h,m)}),v.catch(function(m){D.logger.error('Failed to obtain key-system "'+h+'" access:',m)})},w._onMediaKeySystemAccessObtained=function(h,o){var l=this;D.logger.log('Access for key-system "'+h+'" obtained');var u={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:o,mediaKeySystemDomain:h};this._mediaKeysList.push(u);var C=Promise.resolve().then(function(){return o.createMediaKeys()}).then(function(v){return u.mediaKeys=v,D.logger.log('Media-keys created for key-system "'+h+'"'),l._onMediaKeysCreated(),v});return C.catch(function(v){D.logger.error("Failed to create media-keys:",v)}),C},w._onMediaKeysCreated=function(){var h=this;this._mediaKeysList.forEach(function(o){o.mediaKeysSession||(o.mediaKeysSession=o.mediaKeys.createSession(),h._onNewMediaKeySession(o.mediaKeysSession))})},w._onNewMediaKeySession=function(h){var o=this;D.logger.log("New key-system session "+h.sessionId),h.addEventListener("message",function(l){o._onKeySessionMessage(h,l.message)},!1)},w._onKeySessionMessage=function(h,o){D.logger.log("Got EME message event, creating license request"),this._requestLicense(o,function(l){D.logger.log("Received license data (length: "+(l&&l.byteLength)+"), updating key-session"),h.update(l)})},w.onMediaEncrypted=function(h){var o=this;if(D.logger.log('Media is encrypted using "'+h.initDataType+'" init data type'),!this.mediaKeysPromise){D.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),this.hls.trigger(J.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}var l=function(C){if(!o._media)return;o._attemptSetMediaKeys(C),o._generateRequestWithPreferredKeySession(h.initDataType,h.initData)};this.mediaKeysPromise.then(l).catch(l)},w._attemptSetMediaKeys=function(h){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var o=this._mediaKeysList[0];if(!o||!o.mediaKeys){D.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),this.hls.trigger(J.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});return}D.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(o.mediaKeys),this._hasSetMediaKeys=!0}},w._generateRequestWithPreferredKeySession=function(h,o){var l=this,u=this._mediaKeysList[0];if(!u){D.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),this.hls.trigger(J.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}if(u.mediaKeysSessionInitialized){D.logger.warn("Key-Session already initialized but requested again");return}var C=u.mediaKeysSession;if(!C){D.logger.error("Fatal: Media is encrypted but no key-session existing"),this.hls.trigger(J.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});return}if(!o){D.logger.warn("Fatal: initData required for generating a key session is null"),this.hls.trigger(J.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});return}D.logger.log('Generating key-session request for "'+h+'" init data type'),u.mediaKeysSessionInitialized=!0,C.generateRequest(h,o).then(function(){D.logger.debug("Key-session generation succeeded")}).catch(function(v){D.logger.error("Error generating key-session request:",v),l.hls.trigger(J.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})})},w._createLicenseXhr=function(h,o,l){var u=new XMLHttpRequest;u.responseType="arraybuffer",u.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,u,h,o,l);var C=this._licenseXhrSetup;if(C)try{C.call(this.hls,u,h),C=void 0}catch(v){D.logger.error(v)}try{u.readyState||u.open("POST",h,!0),C&&C.call(this.hls,u,h)}catch(v){throw new Error("issue setting up KeySystem license XHR "+v)}return u},w._onLicenseRequestReadyStageChange=function(h,o,l,u){switch(h.readyState){case 4:if(h.status===200){this._requestLicenseFailureCount=0,D.logger.log("License request succeeded");var C=h.response,v=this._licenseResponseCallback;if(v)try{C=v.call(this.hls,h,o)}catch(k){D.logger.error(k)}u(C)}else{if(D.logger.error("License Request XHR failed ("+o+"). Status: "+h.status+" ("+h.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>O){this.hls.trigger(J.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});return}var m=O-this._requestLicenseFailureCount+1;D.logger.warn("Retrying license request, "+m+" attempts left"),this._requestLicense(l,u)}break}},w._generateLicenseRequestChallenge=function(h,o){switch(h.mediaKeySystemDomain){case z.KeySystems.WIDEVINE:return o}throw new Error("unsupported key-system: "+h.mediaKeySystemDomain)},w._requestLicense=function(h,o){D.logger.log("Requesting content license for key-system");var l=this._mediaKeysList[0];if(!l){D.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),this.hls.trigger(J.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});return}try{var u=this.getLicenseServerUrl(l.mediaKeySystemDomain),C=this._createLicenseXhr(u,h,o);D.logger.log("Sending license request to URL: "+u);var v=this._generateLicenseRequestChallenge(l,h);C.send(v)}catch(m){D.logger.error("Failure requesting DRM license: "+m),this.hls.trigger(J.Events.ERROR,{type:U.ErrorTypes.KEY_SYSTEM_ERROR,details:U.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},w.onMediaAttached=function(h,o){if(!this._emeEnabled)return;var l=o.media;this._media=l,l.addEventListener("encrypted",this._onMediaEncrypted)},w.onMediaDetached=function(){var h=this._media,o=this._mediaKeysList;if(!h)return;h.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(o.map(function(l){if(l.mediaKeysSession)return l.mediaKeysSession.close().catch(function(){})})).then(function(){return h.setMediaKeys(null)}).catch(function(){})},w.onManifestParsed=function(h,o){if(!this._emeEnabled)return;var l=o.levels.map(function(C){return C.audioCodec}).filter(function(C){return!!C}),u=o.levels.map(function(C){return C.videoCodec}).filter(function(C){return!!C});this._attemptKeySystemAccess(z.KeySystems.WIDEVINE,l,u)},B(L,[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}]),L}();Z.default=P},"./src/controller/fps-controller.ts":function(fe,Z,_){"use strict";_.r(Z);var J=_("./src/events.ts"),U=_("./src/utils/logger.ts"),D=function(){function z(B){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=B,this.registerListeners()}var H=z.prototype;return H.setStreamController=function(O){this.streamController=O},H.registerListeners=function(){this.hls.on(J.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},H.unregisterListeners=function(){this.hls.off(J.Events.MEDIA_ATTACHING,this.onMediaAttaching)},H.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},H.onMediaAttaching=function(O,b){var A=this.hls.config;if(A.capLevelOnFPSDrop){var P=b.media instanceof self.HTMLVideoElement?b.media:null;this.media=P,P&&typeof P.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),A.fpsDroppedMonitoringPeriod)}},H.checkFPS=function(O,b,A){var P=performance.now();if(b){if(this.lastTime){var L=P-this.lastTime,w=A-this.lastDroppedFrames,y=b-this.lastDecodedFrames,h=1e3*w/L,o=this.hls;if(o.trigger(J.Events.FPS_DROP,{currentDropped:w,currentDecoded:y,totalDroppedFrames:A}),h>0&&w>o.config.fpsDroppedMonitoringThreshold*y){var l=o.currentLevel;U.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+l),l>0&&(o.autoLevelCapping===-1||o.autoLevelCapping>=l)&&(l=l-1,o.trigger(J.Events.FPS_DROP_LEVEL_CAPPING,{level:l,droppedLevel:o.currentLevel}),o.autoLevelCapping=l,this.streamController.nextLevelSwitch())}}this.lastTime=P,this.lastDroppedFrames=A,this.lastDecodedFrames=b}},H.checkFPSInterval=function(){var O=this.media;if(O)if(this.isVideoPlaybackQualityAvailable){var b=O.getVideoPlaybackQuality();this.checkFPS(O,b.totalVideoFrames,b.droppedVideoFrames)}else this.checkFPS(O,O.webkitDecodedFrameCount,O.webkitDroppedFrameCount)},z}();Z.default=D},"./src/controller/fragment-finders.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"findFragmentByPDT",function(){return D}),_.d(Z,"findFragmentByPTS",function(){return z}),_.d(Z,"fragmentWithinToleranceTest",function(){return H}),_.d(Z,"pdtWithinToleranceTest",function(){return B}),_.d(Z,"findFragWithCC",function(){return O});var J=_("./src/polyfills/number.ts"),U=_("./src/utils/binary-search.ts");function D(b,A,P){if(A===null||!Array.isArray(b)||!b.length||!Object(J.isFiniteNumber)(A))return null;var L=b[0].programDateTime;if(A<(L||0))return null;var w=b[b.length-1].endProgramDateTime;if(A>=(w||0))return null;P=P||0;for(var y=0;y<b.length;++y){var h=b[y];if(B(A,P,h))return h}return null}function z(b,A,P,L){P===void 0&&(P=0),L===void 0&&(L=0);var w=null;if(b?w=A[b.sn-A[0].sn+1]||null:P===0&&A[0].start===0&&(w=A[0]),w&&H(P,L,w)===0)return w;var y=U.default.search(A,H.bind(null,P,L));return y||w}function H(b,A,P){b===void 0&&(b=0),A===void 0&&(A=0);var L=Math.min(A,P.duration+(P.deltaPTS?P.deltaPTS:0));return P.start+P.duration-L<=b?1:P.start-L>b&&P.start?-1:0}function B(b,A,P){var L=Math.min(A,P.duration+(P.deltaPTS?P.deltaPTS:0))*1e3,w=P.endProgramDateTime||0;return w-L>b}function O(b,A){return U.default.search(b,function(P){return P.cc<A?1:P.cc>A?-1:0})}},"./src/controller/fragment-tracker.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"FragmentState",function(){return D}),_.d(Z,"FragmentTracker",function(){return z});var J=_("./src/events.ts"),U=_("./src/types/loader.ts"),D;(function(O){O.NOT_LOADED="NOT_LOADED",O.BACKTRACKED="BACKTRACKED",O.APPENDING="APPENDING",O.PARTIAL="PARTIAL",O.OK="OK"})(D||(D={}));var z=function(){function O(A){this.activeFragment=null,this.activeParts=null,this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hls=A,this._registerListeners()}var b=O.prototype;return b._registerListeners=function(){var P=this.hls;P.on(J.Events.BUFFER_APPENDED,this.onBufferAppended,this),P.on(J.Events.FRAG_BUFFERED,this.onFragBuffered,this),P.on(J.Events.FRAG_LOADED,this.onFragLoaded,this)},b._unregisterListeners=function(){var P=this.hls;P.off(J.Events.BUFFER_APPENDED,this.onBufferAppended,this),P.off(J.Events.FRAG_BUFFERED,this.onFragBuffered,this),P.off(J.Events.FRAG_LOADED,this.onFragLoaded,this)},b.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},b.getAppendedFrag=function(P,L){if(L===U.PlaylistLevelType.MAIN){var w=this.activeFragment,y=this.activeParts;if(!w)return null;if(y)for(var h=y.length;h--;){var o=y[h],l=o?o.end:w.appendedPTS;if(o.start<=P&&l!==void 0&&P<=l)return h>9&&(this.activeParts=y.slice(h-9)),o}else if(w.start<=P&&w.appendedPTS!==void 0&&P<=w.appendedPTS)return w}return this.getBufferedFrag(P,L)},b.getBufferedFrag=function(P,L){for(var w=this.fragments,y=Object.keys(w),h=y.length;h--;){var o=w[y[h]];if((o==null?void 0:o.body.type)===L&&o.buffered){var l=o.body;if(l.start<=P&&P<=l.end)return l}}return null},b.detectEvictedFragments=function(P,L,w){var y=this;Object.keys(this.fragments).forEach(function(h){var o=y.fragments[h];if(!o)return;if(!o.buffered){o.body.type===w&&y.removeFragment(o.body);return}var l=o.range[P];if(!l)return;l.time.some(function(u){var C=!y.isTimeBuffered(u.startPTS,u.endPTS,L);return C&&y.removeFragment(o.body),C})})},b.detectPartialFragments=function(P){var L=this,w=this.timeRanges,y=P.frag,h=P.part;if(!w||y.sn==="initSegment")return;var o=B(y),l=this.fragments[o];if(!l)return;Object.keys(w).forEach(function(u){var C=y.elementaryStreams[u];if(!C)return;var v=w[u],m=h!==null||C.partial===!0;l.range[u]=L.getBufferedTimes(y,h,m,v)}),l.backtrack=l.loaded=null,Object.keys(l.range).length?l.buffered=!0:this.removeFragment(l.body)},b.fragBuffered=function(P){var L=B(P),w=this.fragments[L];w&&(w.backtrack=w.loaded=null,w.buffered=!0)},b.getBufferedTimes=function(P,L,w,y){for(var h={time:[],partial:w},o=L?L.start:P.start,l=L?L.end:P.end,u=P.minEndPTS||l,C=P.maxStartPTS||o,v=0;v<y.length;v++){var m=y.start(v)-this.bufferPadding,k=y.end(v)+this.bufferPadding;if(C>=m&&u<=k){h.time.push({startPTS:Math.max(o,y.start(v)),endPTS:Math.min(l,y.end(v))});break}else if(o<k&&l>m)h.partial=!0,h.time.push({startPTS:Math.max(o,y.start(v)),endPTS:Math.min(l,y.end(v))});else if(l<=m)break}return h},b.getPartialFragment=function(P){var L=null,w,y,h,o=0,l=this.bufferPadding,u=this.fragments;return Object.keys(u).forEach(function(C){var v=u[C];if(!v)return;H(v)&&(y=v.body.start-l,h=v.body.end+l,P>=y&&P<=h&&(w=Math.min(P-y,h-P),o<=w&&(L=v.body,o=w)))}),L},b.getState=function(P){var L=B(P),w=this.fragments[L];return w?w.buffered?H(w)?D.PARTIAL:D.OK:w.backtrack?D.BACKTRACKED:D.APPENDING:D.NOT_LOADED},b.backtrack=function(P,L){var w=B(P),y=this.fragments[w];if(!y||y.backtrack)return null;var h=y.backtrack=L||y.loaded;return y.loaded=null,h},b.getBacktrackData=function(P){var L=B(P),w=this.fragments[L];if(w){var y,h=w.backtrack;if(h!=null&&(y=h.payload)!==null&&y!==void 0&&y.byteLength)return h;this.removeFragment(P)}return null},b.isTimeBuffered=function(P,L,w){for(var y,h,o=0;o<w.length;o++){if(y=w.start(o)-this.bufferPadding,h=w.end(o)+this.bufferPadding,P>=y&&L<=h)return!0;if(L<=y)return!1}return!1},b.onFragLoaded=function(P,L){var w=L.frag,y=L.part;if(w.sn==="initSegment"||w.bitrateTest||y)return;var h=B(w);this.fragments[h]={body:w,loaded:L,backtrack:null,buffered:!1,range:Object.create(null)}},b.onBufferAppended=function(P,L){var w=this,y=L.frag,h=L.part,o=L.timeRanges;if(y.type===U.PlaylistLevelType.MAIN)if(this.activeFragment=y,h){var l=this.activeParts;l||(this.activeParts=l=[]),l.push(h)}else this.activeParts=null;this.timeRanges=o,Object.keys(o).forEach(function(u){var C=o[u];if(w.detectEvictedFragments(u,C),!h)for(var v=0;v<C.length;v++)y.appendedPTS=Math.max(C.end(v),y.appendedPTS||0)})},b.onFragBuffered=function(P,L){this.detectPartialFragments(L)},b.hasFragment=function(P){var L=B(P);return!!this.fragments[L]},b.removeFragmentsInRange=function(P,L,w){var y=this;Object.keys(this.fragments).forEach(function(h){var o=y.fragments[h];if(!o)return;if(o.buffered){var l=o.body;l.type===w&&l.start<L&&l.end>P&&y.removeFragment(l)}})},b.removeFragment=function(P){var L=B(P);P.stats.loaded=0,P.clearElementaryStreamInfo(),delete this.fragments[L]},b.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},O}();function H(O){var b,A;return O.buffered&&(((b=O.range.video)===null||b===void 0?void 0:b.partial)||((A=O.range.audio)===null||A===void 0?void 0:A.partial))}function B(O){return O.type+"_"+O.level+"_"+O.urlId+"_"+O.sn}},"./src/controller/gap-controller.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"STALL_MINIMUM_DURATION_MS",function(){return H}),_.d(Z,"MAX_START_GAP_JUMP",function(){return B}),_.d(Z,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return O}),_.d(Z,"SKIP_BUFFER_RANGE_START",function(){return b}),_.d(Z,"default",function(){return A});var J=_("./src/utils/buffer-helper.ts"),U=_("./src/errors.ts"),D=_("./src/events.ts"),z=_("./src/utils/logger.ts"),H=250,B=2,O=.1,b=.05,A=function(){function P(w,y,h,o){this.config=void 0,this.media=void 0,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=w,this.media=y,this.fragmentTracker=h,this.hls=o}var L=P.prototype;return L.destroy=function(){this.hls=this.fragmentTracker=this.media=null},L.poll=function(y){var h=this.config,o=this.media,l=this.stalled,u=o.currentTime,C=o.seeking,v=this.seeking&&!C,m=!this.seeking&&C;if(this.seeking=C,u!==y){if(this.moved=!0,l!==null){if(this.stallReported){var k=self.performance.now()-l;z.logger.warn("playback not stuck anymore @"+u+", after "+Math.round(k)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}return}if((m||v)&&(this.stalled=null),o.paused||o.ended||o.playbackRate===0||!J.BufferHelper.getBuffered(o).length)return;var x=J.BufferHelper.bufferInfo(o,u,0),f=x.len>0,p=x.nextStart||0;if(!f&&!p)return;if(C){var d=x.len>B,a=!p||p-u>B&&!this.fragmentTracker.getPartialFragment(u);if(d||a)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var E,g=Math.max(p,x.start||0)-u,S=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,F=S==null||((E=S.details)===null||E===void 0)?void 0:E.live,W=F?S.details.targetduration*2:B;if(g>0&&g<=W){this._trySkipBufferHole(null);return}}var K=self.performance.now();if(l===null){this.stalled=K;return}var V=K-l;!C&&V>=H&&this._reportStall(x.len);var M=J.BufferHelper.bufferInfo(o,u,h.maxBufferHole);this._tryFixBufferStall(M,V)},L._tryFixBufferStall=function(y,h){var o=this.config,l=this.fragmentTracker,u=this.media,C=u.currentTime,v=l.getPartialFragment(C);if(v){var m=this._trySkipBufferHole(v);if(m)return}y.len>o.maxBufferHole&&h>o.highBufferWatchdogPeriod*1e3&&(z.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},L._reportStall=function(y){var h=this.hls,o=this.media,l=this.stallReported;l||(this.stallReported=!0,z.logger.warn("Playback stalling at @"+o.currentTime+" due to low buffer (buffer="+y+")"),h.trigger(D.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:y}))},L._trySkipBufferHole=function(y){for(var h=this.config,o=this.hls,l=this.media,u=l.currentTime,C=0,v=J.BufferHelper.getBuffered(l),m=0;m<v.length;m++){var k=v.start(m);if(u+h.maxBufferHole>=C&&u<k){var x=Math.max(k+b,l.currentTime+O);return z.logger.warn("skipping hole, adjusting currentTime from "+u+" to "+x),this.moved=!0,this.stalled=null,l.currentTime=x,y&&o.trigger(D.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+u+" to "+x,frag:y}),x}C=v.end(m)}return 0},L._tryNudgeBuffer=function(){var y=this.config,h=this.hls,o=this.media,l=o.currentTime,u=(this.nudgeRetry||0)+1;if(this.nudgeRetry=u,u<y.nudgeMaxRetry){var C=l+u*y.nudgeOffset;z.logger.warn("Nudging 'currentTime' from "+l+" to "+C),o.currentTime=C,h.trigger(D.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else z.logger.error("Playhead still not moving while enough data buffered @"+l+" after "+y.nudgeMaxRetry+" nudges"),h.trigger(D.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},P}()},"./src/controller/id3-track-controller.ts":function(fe,Z,_){"use strict";_.r(Z);var J=_("./src/events.ts"),U=_("./src/utils/texttrack-utils.ts"),D=_("./src/demux/id3.ts"),z=.25,H=function(){function B(b){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=b,this._registerListeners()}var O=B.prototype;return O.destroy=function(){this._unregisterListeners()},O._registerListeners=function(){var A=this.hls;A.on(J.Events.MEDIA_ATTACHED,this.onMediaAttached,this),A.on(J.Events.MEDIA_DETACHING,this.onMediaDetaching,this),A.on(J.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),A.on(J.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},O._unregisterListeners=function(){var A=this.hls;A.off(J.Events.MEDIA_ATTACHED,this.onMediaAttached,this),A.off(J.Events.MEDIA_DETACHING,this.onMediaDetaching,this),A.off(J.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),A.off(J.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},O.onMediaAttached=function(A,P){this.media=P.media},O.onMediaDetaching=function(){if(!this.id3Track)return;Object(U.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null},O.getID3Track=function(A){if(!this.media)return;for(var P=0;P<A.length;P++){var L=A[P];if(L.kind==="metadata"&&L.label==="id3")return Object(U.sendAddTrackEvent)(L,this.media),L}return this.media.addTextTrack("metadata","id3")},O.onFragParsingMetadata=function(A,P){if(!this.media)return;var L=P.frag,w=P.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var y=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,h=0;h<w.length;h++){var o=D.getID3Frames(w[h].data);if(o){var l=w[h].pts,u=h<w.length-1?w[h+1].pts:L.end,C=u-l;C<=0&&(u=l+z);for(var v=0;v<o.length;v++){var m=o[v];if(!D.isTimeStampFrame(m)){var k=new y(l,u,"");k.value=m,this.id3Track.addCue(k)}}}}},O.onBufferFlushing=function(A,P){var L=P.startOffset,w=P.endOffset,y=P.type;if(!y||y==="audio"){var h=this.id3Track;h&&Object(U.removeCuesInRange)(h,L,w)}},B}();Z.default=H},"./src/controller/latency-controller.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"default",function(){return B});var J=_("./src/errors.ts"),U=_("./src/events.ts"),D=_("./src/utils/logger.ts");function z(O,b){for(var A=0;A<b.length;A++){var P=b[A];P.enumerable=P.enumerable||!1,P.configurable=!0,"value"in P&&(P.writable=!0),Object.defineProperty(O,P.key,P)}}function H(O,b,A){return b&&z(O.prototype,b),A&&z(O,A),O}var B=function(){function O(A){var P=this;this.hls=void 0,this.config=void 0,this.media=null,this.levelDetails=null,this.currentTime=0,this.stallCount=0,this._latency=null,this.timeupdateHandler=function(){return P.timeupdate()},this.hls=A,this.config=A.config,this.registerListeners()}var b=O.prototype;return b.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},b.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)},b.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)},b.onMediaAttached=function(P,L){this.media=L.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},b.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},b.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},b.onLevelUpdated=function(P,L){var w=L.details;this.levelDetails=w,w.advanced&&this.timeupdate(),!w.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},b.onError=function(P,L){if(L.details!==J.ErrorDetails.BUFFER_STALLED_ERROR)return;this.stallCount++,D.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency")},b.timeupdate=function(){var P=this.media,L=this.levelDetails;if(!P||!L)return;this.currentTime=P.currentTime;var w=this.computeLatency();if(w===null)return;this._latency=w;var y=this.config,h=y.lowLatencyMode,o=y.maxLiveSyncPlaybackRate;if(!h||o===1)return;var l=this.targetLatency;if(l===null)return;var u=w-l,C=Math.min(this.maxLatency,l+L.targetduration),v=u<C;if(L.live&&v&&u>.05&&this.forwardBufferLength>1){var m=Math.min(2,Math.max(1,o)),k=Math.round(2/(1+Math.exp(-.75*u-this.edgeStalled))*20)/20;P.playbackRate=Math.min(m,Math.max(1,k))}else P.playbackRate!==1&&P.playbackRate!==0&&(P.playbackRate=1)},b.estimateLiveEdge=function(){var P=this.levelDetails;return P===null?null:P.edge+P.age},b.computeLatency=function(){var P=this.estimateLiveEdge();return P===null?null:P-this.currentTime},H(O,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var P=this.config,L=this.levelDetails;return P.liveMaxLatencyDuration!==void 0?P.liveMaxLatencyDuration:L?P.liveMaxLatencyDurationCount*L.targetduration:0}},{key:"targetLatency",get:function(){var P=this.levelDetails;if(P===null)return null;var L=P.holdBack,w=P.partHoldBack,y=P.targetduration,h=this.config,o=h.liveSyncDuration,l=h.liveSyncDurationCount,u=h.lowLatencyMode,C=this.hls.userConfig,v=u&&w||L;(C.liveSyncDuration||C.liveSyncDurationCount||v===0)&&(v=o!==void 0?o:l*y);var m=y,k=1;return v+Math.min(this.stallCount*k,m)}},{key:"liveSyncPosition",get:function(){var P=this.estimateLiveEdge(),L=this.targetLatency,w=this.levelDetails;if(P===null||L===null||w===null)return null;var y=w.edge,h=P-L-this.edgeStalled,o=y-w.totalduration,l=y-(this.config.lowLatencyMode&&w.partTarget||w.targetduration);return Math.min(Math.max(o,h),l)}},{key:"drift",get:function(){var P=this.levelDetails;return P===null?1:P.drift}},{key:"edgeStalled",get:function(){var P=this.levelDetails;if(P===null)return 0;var L=(this.config.lowLatencyMode&&P.partTarget||P.targetduration)*3;return Math.max(P.age-L,0)}},{key:"forwardBufferLength",get:function(){var P=this.media,L=this.levelDetails;if(!P||!L)return 0;var w=P.buffered.length;return w?P.buffered.end(w-1):L.edge-this.currentTime}}]),O}()},"./src/controller/level-controller.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"default",function(){return h});var J=_("./src/types/level.ts"),U=_("./src/events.ts"),D=_("./src/errors.ts"),z=_("./src/utils/codecs.ts"),H=_("./src/controller/level-helper.ts"),B=_("./src/controller/base-playlist-controller.ts"),O=_("./src/types/loader.ts");function b(){return b=Object.assign||function(o){for(var l=1;l<arguments.length;l++){var u=arguments[l];for(var C in u)Object.prototype.hasOwnProperty.call(u,C)&&(o[C]=u[C])}return o},b.apply(this,arguments)}function A(o,l){for(var u=0;u<l.length;u++){var C=l[u];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(o,C.key,C)}}function P(o,l,u){return l&&A(o.prototype,l),u&&A(o,u),o}function L(o,l){o.prototype=Object.create(l.prototype),o.prototype.constructor=o,w(o,l)}function w(o,l){return w=Object.setPrototypeOf||function(C,v){return C.__proto__=v,C},w(o,l)}var y=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),h=function(o){L(l,o);function l(C){var v;return v=o.call(this,C,"[level-controller]")||this,v._levels=[],v._firstLevel=-1,v._startLevel=void 0,v.currentLevelIndex=-1,v.manualLevelIndex=-1,v.onParsedComplete=void 0,v._registerListeners(),v}var u=l.prototype;return u._registerListeners=function(){var v=this.hls;v.on(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),v.on(U.Events.LEVEL_LOADED,this.onLevelLoaded,this),v.on(U.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),v.on(U.Events.FRAG_LOADED,this.onFragLoaded,this),v.on(U.Events.ERROR,this.onError,this)},u._unregisterListeners=function(){var v=this.hls;v.off(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),v.off(U.Events.LEVEL_LOADED,this.onLevelLoaded,this),v.off(U.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),v.off(U.Events.FRAG_LOADED,this.onFragLoaded,this),v.off(U.Events.ERROR,this.onError,this)},u.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,o.prototype.destroy.call(this)},u.startLoad=function(){var v=this._levels;v.forEach(function(m){m.loadError=0}),o.prototype.startLoad.call(this)},u.onManifestLoaded=function(v,m){var k=[],x=[],f=[],p,d={},a,E=!1,g=!1,S=!1;if(m.levels.forEach(function(V){var M=V.attrs;E=E||!!(V.width&&V.height),g=g||!!V.videoCodec,S=S||!!V.audioCodec,y&&V.audioCodec&&V.audioCodec.indexOf("mp4a.40.34")!==-1&&(V.audioCodec=void 0);var I=V.bitrate+"-"+V.attrs.RESOLUTION+"-"+V.attrs.CODECS;a=d[I],a?a.url.push(V.url):(a=new J.Level(V),d[I]=a,k.push(a)),M&&(M.AUDIO&&Object(H.addGroupId)(a,"audio",M.AUDIO),M.SUBTITLES&&Object(H.addGroupId)(a,"text",M.SUBTITLES))}),(E||g)&&S&&(k=k.filter(function(V){var M=V.videoCodec,I=V.width,$=V.height;return!!M||!!(I&&$)})),k=k.filter(function(V){var M=V.audioCodec,I=V.videoCodec;return(!M||Object(z.isCodecSupportedInMp4)(M,"audio"))&&(!I||Object(z.isCodecSupportedInMp4)(I,"video"))}),m.audioTracks&&(x=m.audioTracks.filter(function(V){return!V.audioCodec||Object(z.isCodecSupportedInMp4)(V.audioCodec,"audio")}),Object(H.assignTrackIdsByGroup)(x)),m.subtitles&&(f=m.subtitles,Object(H.assignTrackIdsByGroup)(f)),k.length>0){p=k[0].bitrate,k.sort(function(V,M){return V.bitrate-M.bitrate}),this._levels=k;for(var F=0;F<k.length;F++)if(k[F].bitrate===p){this._firstLevel=F,this.log("manifest loaded, "+k.length+" level(s) found, first bitrate: "+p);break}var W=S&&!g,K={levels:k,audioTracks:x,subtitleTracks:f,firstLevel:this._firstLevel,stats:m.stats,audio:S,video:g,altAudio:!W&&x.some(function(V){return!!V.url})};this.hls.trigger(U.Events.MANIFEST_PARSED,K),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(U.Events.ERROR,{type:D.ErrorTypes.MEDIA_ERROR,details:D.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:m.url,reason:"no level with compatible codecs found in manifest"})},u.onError=function(v,m){if(o.prototype.onError.call(this,v,m),m.fatal)return;var k=m.context,x=this._levels[this.currentLevelIndex];if(k&&(k.type===O.PlaylistContextType.AUDIO_TRACK&&x.audioGroupIds&&k.groupId===x.audioGroupIds[x.urlId]||k.type===O.PlaylistContextType.SUBTITLE_TRACK&&x.textGroupIds&&k.groupId===x.textGroupIds[x.urlId])){this.redundantFailover(this.currentLevelIndex);return}var f=!1,p=!0,d;switch(m.details){case D.ErrorDetails.FRAG_LOAD_ERROR:case D.ErrorDetails.FRAG_LOAD_TIMEOUT:case D.ErrorDetails.KEY_LOAD_ERROR:case D.ErrorDetails.KEY_LOAD_TIMEOUT:if(m.frag){var a=this._levels[m.frag.level];a?(a.fragmentError++,a.fragmentError>this.hls.config.fragLoadingMaxRetry&&(d=m.frag.level)):d=m.frag.level}break;case D.ErrorDetails.LEVEL_LOAD_ERROR:case D.ErrorDetails.LEVEL_LOAD_TIMEOUT:k&&(k.deliveryDirectives&&(p=!1),d=k.level),f=!0;break;case D.ErrorDetails.REMUX_ALLOC_ERROR:d=m.level,f=!0;break}d!==void 0&&this.recoverLevel(m,d,f,p)},u.recoverLevel=function(v,m,k,x){var f=v.details,p=this._levels[m];if(p.loadError++,k){var d=this.retryLoadingOrFail(v);if(d)v.levelRetry=!0;else{this.currentLevelIndex=-1;return}}if(x){var a=p.url.length;if(a>1&&p.loadError<a)v.levelRetry=!0,this.redundantFailover(m);else if(this.manualLevelIndex===-1){var E=m===0?this._levels.length-1:m-1;this.currentLevelIndex!==E&&this._levels[E].loadError===0&&(this.warn(f+": switch to "+E),v.levelRetry=!0,this.hls.nextAutoLevel=E)}}},u.redundantFailover=function(v){var m=this._levels[v],k=m.url.length;if(k>1){var x=(m.urlId+1)%k;this.warn("Switching to redundant URL-id "+x),this._levels.forEach(function(f){f.urlId=x}),this.level=v}},u.onFragLoaded=function(v,m){var k=m.frag;if(k!==void 0&&k.type===O.PlaylistLevelType.MAIN){var x=this._levels[k.level];x!==void 0&&(x.fragmentError=0,x.loadError=0)}},u.onLevelLoaded=function(v,m){var k,x=m.level,f=m.details,p=this._levels[x];if(!p){var d;this.warn("Invalid level index "+x),(d=m.deliveryDirectives)!==null&&d!==void 0&&d.skip&&(f.deltaUpdateFailed=!0);return}x===this.currentLevelIndex?(p.fragmentError===0&&(p.loadError=0,this.retryCount=0),this.playlistLoaded(x,m,p.details)):(k=m.deliveryDirectives)!==null&&k!==void 0&&k.skip&&(f.deltaUpdateFailed=!0)},u.onAudioTrackSwitched=function(v,m){var k=this.hls.levels[this.currentLevelIndex];if(!k)return;if(k.audioGroupIds){for(var x=-1,f=this.hls.audioTracks[m.id].groupId,p=0;p<k.audioGroupIds.length;p++)if(k.audioGroupIds[p]===f){x=p;break}x!==k.urlId&&(k.urlId=x,this.startLoad())}},u.loadPlaylist=function(v){var m=this.currentLevelIndex,k=this._levels[m];if(this.canLoad&&k&&k.url.length>0){var x=k.urlId,f=k.url[x];if(v)try{f=v.addDirectives(f)}catch(p){this.warn("Could not construct new URL with HLS Delivery Directives: "+p)}this.log("Attempt loading level index "+m+(v?" at sn "+v.msn+" part "+v.part:"")+" with URL-id "+x+" "+f),this.clearTimer(),this.hls.trigger(U.Events.LEVEL_LOADING,{url:f,level:m,id:x,deliveryDirectives:v||null})}},u.removeLevel=function(v,m){var k=function(p,d){return d!==m},x=this._levels.filter(function(f,p){return p!==v?!0:f.url.length>1&&m!==void 0?(f.url=f.url.filter(k),f.audioGroupIds&&(f.audioGroupIds=f.audioGroupIds.filter(k)),f.textGroupIds&&(f.textGroupIds=f.textGroupIds.filter(k)),f.urlId=0,!0):!1}).map(function(f,p){var d=f.details;return d!=null&&d.fragments&&d.fragments.forEach(function(a){a.level=p}),f});this._levels=x,this.hls.trigger(U.Events.LEVELS_UPDATED,{levels:x})},P(l,[{key:"levels",get:function(){return this._levels.length===0?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(v){var m,k=this._levels;if(k.length===0)return;if(this.currentLevelIndex===v&&(m=k[v])!==null&&m!==void 0&&m.details)return;if(v<0||v>=k.length){var x=v<0;if(this.hls.trigger(U.Events.ERROR,{type:D.ErrorTypes.OTHER_ERROR,details:D.ErrorDetails.LEVEL_SWITCH_ERROR,level:v,fatal:x,reason:"invalid level idx"}),x)return;v=Math.min(v,k.length-1)}this.clearTimer();var f=this.currentLevelIndex,p=k[f],d=k[v];this.log("switching to level "+v+" from "+f),this.currentLevelIndex=v;var a=b({},d,{level:v,maxBitrate:d.maxBitrate,uri:d.uri,urlId:d.urlId});delete a._urlId,this.hls.trigger(U.Events.LEVEL_SWITCHING,a);var E=d.details;if(!E||E.live){var g=this.switchParams(d.uri,p==null?void 0:p.details);this.loadPlaylist(g)}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(v){this.manualLevelIndex=v,this._startLevel===void 0&&(this._startLevel=v),v!==-1&&(this.level=v)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(v){this._firstLevel=v}},{key:"startLevel",get:function(){if(this._startLevel===void 0){var v=this.hls.config.startLevel;return v!==void 0?v:this._firstLevel}else return this._startLevel},set:function(v){this._startLevel=v}},{key:"nextLoadLevel",get:function(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(v){this.level=v,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=v)}}]),l}(B.default)},"./src/controller/level-helper.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"addGroupId",function(){return D}),_.d(Z,"assignTrackIdsByGroup",function(){return z}),_.d(Z,"updatePTS",function(){return H}),_.d(Z,"updateFragPTSDTS",function(){return O}),_.d(Z,"mergeDetails",function(){return b}),_.d(Z,"mapPartIntersection",function(){return A}),_.d(Z,"mapFragmentIntersection",function(){return P}),_.d(Z,"adjustSliding",function(){return L}),_.d(Z,"addSliding",function(){return w}),_.d(Z,"computeReloadInterval",function(){return y}),_.d(Z,"getFragmentWithSN",function(){return h}),_.d(Z,"getPartWith",function(){return o});var J=_("./src/polyfills/number.ts"),U=_("./src/utils/logger.ts");function D(l,u,C){switch(u){case"audio":l.audioGroupIds||(l.audioGroupIds=[]),l.audioGroupIds.push(C);break;case"text":l.textGroupIds||(l.textGroupIds=[]),l.textGroupIds.push(C);break}}function z(l){var u={};l.forEach(function(C){var v=C.groupId||"";C.id=u[v]=u[v]||0,u[v]++})}function H(l,u,C){var v=l[u],m=l[C];B(v,m)}function B(l,u){var C=u.startPTS;if(Object(J.isFiniteNumber)(C)){var v=0,m;u.sn>l.sn?(v=C-l.start,m=l):(v=l.start-C,m=u),m.duration!==v&&(m.duration=v)}else if(u.sn>l.sn){var k=l.cc===u.cc;k&&l.minEndPTS?u.start=l.start+(l.minEndPTS-l.start):u.start=l.start+l.duration}else u.start=Math.max(l.start-u.duration,0)}function O(l,u,C,v,m,k){var x=v-C;x<=0&&(U.logger.warn("Fragment should have a positive duration",u),v=C+u.duration,k=m+u.duration);var f=C,p=v,d=u.startPTS,a=u.endPTS;if(Object(J.isFiniteNumber)(d)){var E=Math.abs(d-C);Object(J.isFiniteNumber)(u.deltaPTS)?u.deltaPTS=Math.max(E,u.deltaPTS):u.deltaPTS=E,f=Math.max(C,d),C=Math.min(C,d),m=Math.min(m,u.startDTS),p=Math.min(v,a),v=Math.max(v,a),k=Math.max(k,u.endDTS)}u.duration=v-C;var g=C-u.start;u.appendedPTS=v,u.start=u.startPTS=C,u.maxStartPTS=f,u.startDTS=m,u.endPTS=v,u.minEndPTS=p,u.endDTS=k;var S=u.sn;if(!l||S<l.startSN||S>l.endSN)return 0;var F,W=S-l.startSN,K=l.fragments;for(K[W]=u,F=W;F>0;F--)B(K[F],K[F-1]);for(F=W;F<K.length-1;F++)B(K[F],K[F+1]);return l.fragmentHint&&B(K[K.length-1],l.fragmentHint),l.PTSKnown=l.alignedSliding=!0,g}function b(l,u){for(var C=null,v=l.fragments,m=v.length-1;m>=0;m--){var k=v[m].initSegment;if(k){C=k;break}}l.fragmentHint&&delete l.fragmentHint.endPTS;var x=0,f;if(P(l,u,function(F,W){F.relurl&&(x=F.cc-W.cc),Object(J.isFiniteNumber)(F.startPTS)&&Object(J.isFiniteNumber)(F.endPTS)&&(W.start=W.startPTS=F.startPTS,W.startDTS=F.startDTS,W.appendedPTS=F.appendedPTS,W.maxStartPTS=F.maxStartPTS,W.endPTS=F.endPTS,W.endDTS=F.endDTS,W.minEndPTS=F.minEndPTS,W.duration=F.endPTS-F.startPTS,W.duration&&(f=W),u.PTSKnown=u.alignedSliding=!0),W.elementaryStreams=F.elementaryStreams,W.loader=F.loader,W.stats=F.stats,W.urlId=F.urlId,F.initSegment&&(W.initSegment=F.initSegment,C=F.initSegment)}),C){var p=u.fragmentHint?u.fragments.concat(u.fragmentHint):u.fragments;p.forEach(function(F){var W;(!F.initSegment||F.initSegment.relurl===((W=C)===null||W===void 0?void 0:W.relurl))&&(F.initSegment=C)})}if(u.skippedSegments&&(u.deltaUpdateFailed=u.fragments.some(function(F){return!F}),u.deltaUpdateFailed)){U.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var d=u.skippedSegments;d--;)u.fragments.shift();u.startSN=u.fragments[0].sn,u.startCC=u.fragments[0].cc}var a=u.fragments;if(x){U.logger.warn("discontinuity sliding from playlist, take drift into account");for(var E=0;E<a.length;E++)a[E].cc+=x}u.skippedSegments&&(u.startCC=u.fragments[0].cc),A(l.partList,u.partList,function(F,W){W.elementaryStreams=F.elementaryStreams,W.stats=F.stats}),f?O(u,f,f.startPTS,f.endPTS,f.startDTS,f.endDTS):L(l,u),a.length&&(u.totalduration=u.edge-a[0].start),u.driftStartTime=l.driftStartTime,u.driftStart=l.driftStart;var g=u.advancedDateTime;if(u.advanced&&g){var S=u.edge;u.driftStart||(u.driftStartTime=g,u.driftStart=S),u.driftEndTime=g,u.driftEnd=S}else u.driftEndTime=l.driftEndTime,u.driftEnd=l.driftEnd,u.advancedDateTime=l.advancedDateTime}function A(l,u,C){if(l&&u)for(var v=0,m=0,k=l.length;m<=k;m++){var x=l[m],f=u[m+v];x&&f&&x.index===f.index&&x.fragment.sn===f.fragment.sn?C(x,f):v--}}function P(l,u,C){for(var v=u.skippedSegments,m=Math.max(l.startSN,u.startSN)-u.startSN,k=(l.fragmentHint?1:0)+(v?u.endSN:Math.min(l.endSN,u.endSN))-u.startSN,x=u.startSN-l.startSN,f=u.fragmentHint?u.fragments.concat(u.fragmentHint):u.fragments,p=l.fragmentHint?l.fragments.concat(l.fragmentHint):l.fragments,d=m;d<=k;d++){var a=p[x+d],E=f[d];v&&!E&&d<v&&(E=u.fragments[d]=a),a&&E&&C(a,E)}}function L(l,u){var C=u.startSN+u.skippedSegments-l.startSN,v=l.fragments;if(C<0||C>=v.length)return;w(u,v[C].start)}function w(l,u){if(u){for(var C=l.fragments,v=l.skippedSegments;v<C.length;v++)C[v].start+=u;l.fragmentHint&&(l.fragmentHint.start+=u)}}function y(l,u){var C=1e3*l.levelTargetDuration,v=C/2,m=l.age,k=m>0&&m<C*3,x=u.loading.end-u.loading.start,f,p=l.availabilityDelay;if(l.updated===!1)if(k){var d=333*l.misses;f=Math.max(Math.min(v,x*2),d),l.availabilityDelay=(l.availabilityDelay||0)+f}else f=v;else k?(p=Math.min(p||C/2,m),l.availabilityDelay=p,f=p+C-m):f=C-x;return Math.round(f)}function h(l,u,C){if(!l||!l.details)return null;var v=l.details,m=v.fragments[u-v.startSN];return m||(m=v.fragmentHint,m&&m.sn===u?m:u<v.startSN&&C&&C.sn===u?C:null)}function o(l,u,C){if(!l||!l.details)return null;var v=l.details.partList;if(v)for(var m=v.length;m--;){var k=v[m];if(k.index===C&&k.fragment.sn===u)return k}return null}},"./src/controller/stream-controller.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"default",function(){return v});var J=_("./src/polyfills/number.ts"),U=_("./src/controller/base-stream-controller.ts"),D=_("./src/is-supported.ts"),z=_("./src/events.ts"),H=_("./src/utils/buffer-helper.ts"),B=_("./src/controller/fragment-tracker.ts"),O=_("./src/types/loader.ts"),b=_("./src/loader/fragment.ts"),A=_("./src/demux/transmuxer-interface.ts"),P=_("./src/types/transmuxer.ts"),L=_("./src/controller/gap-controller.ts"),w=_("./src/errors.ts"),y=_("./src/utils/logger.ts");function h(m,k){for(var x=0;x<k.length;x++){var f=k[x];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(m,f.key,f)}}function o(m,k,x){return k&&h(m.prototype,k),x&&h(m,x),m}function l(m,k){m.prototype=Object.create(k.prototype),m.prototype.constructor=m,u(m,k)}function u(m,k){return u=Object.setPrototypeOf||function(f,p){return f.__proto__=p,f},u(m,k)}var C=100,v=function(m){l(k,m);function k(f,p){var d;return d=m.call(this,f,p,"[stream-controller]")||this,d.audioCodecSwap=!1,d.gapController=null,d.level=-1,d._forceStartLoad=!1,d.altAudio=!1,d.audioOnly=!1,d.fragPlaying=null,d.onvplaying=null,d.onvseeked=null,d.fragLastKbps=0,d.stalled=!1,d.couldBacktrack=!1,d.audioCodecSwitch=!1,d.videoBuffer=null,d._registerListeners(),d}var x=k.prototype;return x._registerListeners=function(){var p=this.hls;p.on(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),p.on(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),p.on(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),p.on(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),p.on(z.Events.LEVEL_LOADING,this.onLevelLoading,this),p.on(z.Events.LEVEL_LOADED,this.onLevelLoaded,this),p.on(z.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),p.on(z.Events.ERROR,this.onError,this),p.on(z.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),p.on(z.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),p.on(z.Events.BUFFER_CREATED,this.onBufferCreated,this),p.on(z.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),p.on(z.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),p.on(z.Events.FRAG_BUFFERED,this.onFragBuffered,this)},x._unregisterListeners=function(){var p=this.hls;p.off(z.Events.MEDIA_ATTACHED,this.onMediaAttached,this),p.off(z.Events.MEDIA_DETACHING,this.onMediaDetaching,this),p.off(z.Events.MANIFEST_LOADING,this.onManifestLoading,this),p.off(z.Events.MANIFEST_PARSED,this.onManifestParsed,this),p.off(z.Events.LEVEL_LOADED,this.onLevelLoaded,this),p.off(z.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),p.off(z.Events.ERROR,this.onError,this),p.off(z.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),p.off(z.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),p.off(z.Events.BUFFER_CREATED,this.onBufferCreated,this),p.off(z.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),p.off(z.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),p.off(z.Events.FRAG_BUFFERED,this.onFragBuffered,this)},x.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},x.startLoad=function(p){if(this.levels){var d=this.lastCurrentTime,a=this.hls;if(this.stopLoad(),this.setInterval(C),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var E=a.startLevel;E===-1&&(a.config.testBandwidth?(E=0,this.bitrateTest=!0):E=a.nextAutoLevel),this.level=a.nextLoadLevel=E,this.loadedmetadata=!1}d>0&&p===-1&&(this.log("Override startPosition with lastCurrentTime @"+d.toFixed(3)),p=d),this.state=U.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=p,this.tick()}else this._forceStartLoad=!0,this.state=U.State.STOPPED},x.stopLoad=function(){this._forceStartLoad=!1,m.prototype.stopLoad.call(this)},x.doTick=function(){switch(this.state){case U.State.IDLE:this.doTickIdle();break;case U.State.WAITING_LEVEL:{var p,d=this.levels,a=this.level,E=d==null||((p=d[a])===null||p===void 0)?void 0:p.details;if(E&&(!E.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(E))break;this.state=U.State.IDLE;break}break}case U.State.FRAG_LOADING_WAITING_RETRY:{var g,S=self.performance.now(),F=this.retryDate;(!F||S>=F||(g=this.media)!==null&&g!==void 0&&g.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=U.State.IDLE)}break;default:break}this.onTickEnd()},x.onTickEnd=function(){m.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},x.doTickIdle=function(){var p,d,a=this.hls,E=this.levelLastLoaded,g=this.levels,S=this.media,F=a.config,W=a.nextLoadLevel;if(E===null||!S&&(this.startFragRequested||!F.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;if(!g||!g[W])return;var K=g[W];this.level=a.nextLoadLevel=W;var V=K.details;if(!V||this.state===U.State.WAITING_LEVEL||V.live&&this.levelLastLoaded!==W){this.state=U.State.WAITING_LEVEL;return}var M=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:S,O.PlaylistLevelType.MAIN);if(M===null)return;var I=M.len,$=this.getMaxBufferLength(K.maxBitrate);if(I>=$)return;if(this._streamEnded(M,V)){var ae={};this.altAudio&&(ae.type="video"),this.hls.trigger(z.Events.BUFFER_EOS,ae),this.state=U.State.ENDED;return}var he=M.end,ge=this.getNextFragment(he,V);if(this.couldBacktrack&&!this.fragPrevious&&ge&&ge.sn!=="initSegment"){var De=ge.sn-V.startSN;De>1&&(ge=V.fragments[De-1],this.fragmentTracker.removeFragment(ge))}if(ge&&this.fragmentTracker.getState(ge)===B.FragmentState.OK&&this.nextLoadPosition>he){var Se=this.audioOnly&&!this.altAudio?b.ElementaryStreamTypes.AUDIO:b.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(S,Se,O.PlaylistLevelType.MAIN),ge=this.getNextFragment(this.nextLoadPosition,V)}if(!ge)return;ge.initSegment&&!ge.initSegment.data&&!this.bitrateTest&&(ge=ge.initSegment),((p=ge.decryptdata)===null||p===void 0?void 0:p.keyFormat)==="identity"&&!((d=ge.decryptdata)!==null&&d!==void 0&&d.key)?this.loadKey(ge,V):this.loadFragment(ge,V,he)},x.loadFragment=function(p,d,a){var E,g=this.fragmentTracker.getState(p);if(this.fragCurrent=p,g===B.FragmentState.BACKTRACKED){var S=this.fragmentTracker.getBacktrackData(p);if(S){this._handleFragmentLoadProgress(S),this._handleFragmentLoadComplete(S);return}else g=B.FragmentState.NOT_LOADED}g===B.FragmentState.NOT_LOADED||g===B.FragmentState.PARTIAL?p.sn==="initSegment"?this._loadInitSegment(p):this.bitrateTest?(p.bitrateTest=!0,this.log("Fragment "+p.sn+" of level "+p.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(p)):(this.startFragRequested=!0,m.prototype.loadFragment.call(this,p,d,a)):g===B.FragmentState.APPENDING?this.reduceMaxBufferLength(p.duration)&&this.fragmentTracker.removeFragment(p):((E=this.media)===null||E===void 0?void 0:E.buffered.length)===0&&this.fragmentTracker.removeAllFragments()},x.getAppendedFrag=function(p){var d=this.fragmentTracker.getAppendedFrag(p,O.PlaylistLevelType.MAIN);return d&&"fragment"in d?d.fragment:d},x.getBufferedFrag=function(p){return this.fragmentTracker.getBufferedFrag(p,O.PlaylistLevelType.MAIN)},x.followingBufferedFrag=function(p){return p?this.getBufferedFrag(p.end+.5):null},x.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},x.nextLevelSwitch=function(){var p=this.levels,d=this.media;if(d!=null&&d.readyState){var a,E=this.getAppendedFrag(d.currentTime);if(E&&E.start>1&&this.flushMainBuffer(0,E.start-1),!d.paused&&p){var g=this.hls.nextLoadLevel,S=p[g],F=this.fragLastKbps;F&&this.fragCurrent?a=this.fragCurrent.duration*S.maxBitrate/(1e3*F)+1:a=0}else a=0;var W=this.getBufferedFrag(d.currentTime+a);if(W){var K=this.followingBufferedFrag(W);if(K){this.abortCurrentFrag();var V=K.maxStartPTS?K.maxStartPTS:K.start,M=K.duration,I=Math.max(W.end,V+Math.min(Math.max(M-this.config.maxFragLookUpTolerance,M*.5),M*.75));this.flushMainBuffer(I,Number.POSITIVE_INFINITY)}}}},x.abortCurrentFrag=function(){var p=this.fragCurrent;this.fragCurrent=null,p!=null&&p.loader&&p.loader.abort(),this.state===U.State.KEY_LOADING&&(this.state=U.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},x.flushMainBuffer=function(p,d){m.prototype.flushMainBuffer.call(this,p,d,this.altAudio?"video":null)},x.onMediaAttached=function(p,d){m.prototype.onMediaAttached.call(this,p,d);var a=d.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),a.addEventListener("playing",this.onvplaying),a.addEventListener("seeked",this.onvseeked),this.gapController=new L.default(this.config,a,this.fragmentTracker,this.hls)},x.onMediaDetaching=function(){var p=this.media;p&&(p.removeEventListener("playing",this.onvplaying),p.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),m.prototype.onMediaDetaching.call(this)},x.onMediaPlaying=function(){this.tick()},x.onMediaSeeked=function(){var p=this.media,d=p?p.currentTime:null;Object(J.isFiniteNumber)(d)&&this.log("Media seeked to "+d.toFixed(3)),this.tick()},x.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(z.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},x.onManifestParsed=function(p,d){var a=!1,E=!1,g;d.levels.forEach(function(S){g=S.audioCodec,g&&(g.indexOf("mp4a.40.2")!==-1&&(a=!0),g.indexOf("mp4a.40.5")!==-1&&(E=!0))}),this.audioCodecSwitch=a&&E&&!Object(D.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=d.levels,this.startFragRequested=!1},x.onLevelLoading=function(p,d){var a=this.levels;if(!a||this.state!==U.State.IDLE)return;var E=a[d.level];(!E.details||E.details.live&&this.levelLastLoaded!==d.level||this.waitForCdnTuneIn(E.details))&&(this.state=U.State.WAITING_LEVEL)},x.onLevelLoaded=function(p,d){var a,E=this.levels,g=d.level,S=d.details,F=S.totalduration;if(!E){this.warn("Levels were reset while loading level "+g);return}this.log("Level "+g+" loaded ["+S.startSN+","+S.endSN+"], cc ["+S.startCC+", "+S.endCC+"] duration:"+F);var W=this.fragCurrent;W&&(this.state===U.State.FRAG_LOADING||this.state===U.State.FRAG_LOADING_WAITING_RETRY)&&(W.level!==d.level&&W.loader&&(this.state=U.State.IDLE,W.loader.abort()));var K=E[g],V=0;if(S.live||(a=K.details)!==null&&a!==void 0&&a.live){if(S.fragments[0]||(S.deltaUpdateFailed=!0),S.deltaUpdateFailed)return;V=this.alignPlaylists(S,K.details)}if(K.details=S,this.levelLastLoaded=g,this.hls.trigger(z.Events.LEVEL_UPDATED,{details:S,level:g}),this.state===U.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(S))return;this.state=U.State.IDLE}this.startFragRequested?S.live&&this.synchronizeToLiveEdge(S):this.setStartPosition(S,V),this.tick()},x._handleFragmentLoadProgress=function(p){var d,a=p.frag,E=p.part,g=p.payload,S=this.levels;if(!S){this.warn("Levels were reset while fragment load was in progress. Fragment "+a.sn+" of level "+a.level+" will not be buffered");return}var F=S[a.level],W=F.details;if(!W){this.warn("Dropping fragment "+a.sn+" of level "+a.level+" after level details were reset");return}var K=F.videoCodec,V=W.PTSKnown||!W.live,M=(d=a.initSegment)===null||d===void 0?void 0:d.data,I=this._getAudioCodec(F),$=this.transmuxer=this.transmuxer||new A.default(this.hls,O.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),ae=E?E.index:-1,he=ae!==-1,ge=new P.ChunkMetadata(a.level,a.sn,a.stats.chunkCount,g.byteLength,ae,he),De=this.initPTS[a.cc];$.push(g,M,I,K,a,E,W.totalduration,V,ge,De)},x.onAudioTrackSwitching=function(p,d){var a=this.altAudio,E=!!d.url,g=d.id;if(!E){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var S=this.fragCurrent;S!=null&&S.loader&&(this.log("Switching to main audio track, cancel main fragment load"),S.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var F=this.hls;a&&F.trigger(z.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),F.trigger(z.Events.AUDIO_TRACK_SWITCHED,{id:g})}},x.onAudioTrackSwitched=function(p,d){var a=d.id,E=!!this.hls.audioTracks[a].url;if(E){var g=this.videoBuffer;g&&this.mediaBuffer!==g&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=g)}this.altAudio=E,this.tick()},x.onBufferCreated=function(p,d){var a=d.tracks,E,g,S=!1;for(var F in a){var W=a[F];if(W.id==="main"){if(g=F,E=W,F==="video"){var K=a[F];K&&(this.videoBuffer=K.buffer)}}else S=!0}S&&E?(this.log("Alternate track found, use "+g+".buffered to schedule main fragment loading"),this.mediaBuffer=E.buffer):this.mediaBuffer=this.media},x.onFragBuffered=function(p,d){var a=d.frag,E=d.part;if(a&&a.type!==O.PlaylistLevelType.MAIN)return;if(this.fragContextChanged(a)){this.warn("Fragment "+a.sn+(E?" p: "+E.index:"")+" of level "+a.level+" finished buffering, but was aborted. state: "+this.state),this.state===U.State.PARSED&&(this.state=U.State.IDLE);return}var g=E?E.stats:a.stats;this.fragLastKbps=Math.round(8*g.total/(g.buffering.end-g.loading.first)),a.sn!=="initSegment"&&(this.fragPrevious=a),this.fragBufferedComplete(a,E)},x.onError=function(p,d){switch(d.details){case w.ErrorDetails.FRAG_LOAD_ERROR:case w.ErrorDetails.FRAG_LOAD_TIMEOUT:case w.ErrorDetails.KEY_LOAD_ERROR:case w.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(O.PlaylistLevelType.MAIN,d);break;case w.ErrorDetails.LEVEL_LOAD_ERROR:case w.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 w.ErrorDetails.BUFFER_FULL_ERROR:if(d.parent==="main"&&(this.state===U.State.PARSING||this.state===U.State.PARSED)){var a=!0,E=this.getFwdBufferInfo(this.media,O.PlaylistLevelType.MAIN);E&&E.len>.5&&(a=!this.reduceMaxBufferLength(E.len)),a&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}break;default:break}},x.checkBuffer=function(){var p=this.media,d=this.gapController;if(!p||!d||!p.readyState)return;var a=H.BufferHelper.getBuffered(p);!this.loadedmetadata&&a.length?(this.loadedmetadata=!0,this.seekToStartPos()):d.poll(this.lastCurrentTime),this.lastCurrentTime=p.currentTime},x.onFragLoadEmergencyAborted=function(){this.state=U.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},x.onBufferFlushed=function(p,d){var a=d.type;if(a!==b.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var E=(a===b.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(E,a,O.PlaylistLevelType.MAIN)}},x.onLevelsUpdated=function(p,d){this.levels=d.levels},x.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},x.seekToStartPos=function(){var p=this.media,d=p.currentTime,a=this.startPosition;if(a>=0&&d<a){if(p.seeking){y.logger.log("could not seek to "+a+", already seeking at "+d);return}var E=H.BufferHelper.getBuffered(p),g=E.length?E.start(0):0,S=g-a;S>0&&(S<this.config.maxBufferHole||S<this.config.maxFragLookUpTolerance)&&(y.logger.log("adjusting start position by "+S+" to match buffer start"),a+=S,this.startPosition=a),this.log("seek to target start position "+a+" from current time "+d),p.currentTime=a}},x._getAudioCodec=function(p){var d=this.config.defaultAudioCodec||p.audioCodec;return this.audioCodecSwap&&d&&(this.log("Swapping audio codec"),d.indexOf("mp4a.40.5")!==-1?d="mp4a.40.2":d="mp4a.40.5"),d},x._loadBitrateTestFrag=function(p){var d=this;this._doFragLoad(p).then(function(a){var E=d.hls;if(!a||E.nextLoadLevel||d.fragContextChanged(p))return;d.fragLoadError=0,d.state=U.State.IDLE,d.startFragRequested=!1,d.bitrateTest=!1;var g=p.stats;g.parsing.start=g.parsing.end=g.buffering.start=g.buffering.end=self.performance.now(),E.trigger(z.Events.FRAG_LOADED,a)})},x._handleTransmuxComplete=function(p){var d,a="main",E=this.hls,g=p.remuxResult,S=p.chunkMeta,F=this.getCurrentContext(S);if(!F){this.warn("The loading context changed while buffering fragment "+S.sn+" of level "+S.level+". This chunk will not be buffered."),this.resetLiveStartWhenNotLoaded(S.level);return}var W=F.frag,K=F.part,V=F.level,M=g.video,I=g.text,$=g.id3,ae=g.initSegment,he=this.altAudio?void 0:g.audio;if(this.fragContextChanged(W))return;if(this.state=U.State.PARSING,ae){ae.tracks&&(this._bufferInitSegment(V,ae.tracks,W,S),E.trigger(z.Events.FRAG_PARSING_INIT_SEGMENT,{frag:W,id:a,tracks:ae.tracks}));var ge=ae.initPTS,De=ae.timescale;Object(J.isFiniteNumber)(ge)&&(this.initPTS[W.cc]=ge,E.trigger(z.Events.INIT_PTS_FOUND,{frag:W,id:a,initPTS:ge,timescale:De}))}if(M&&g.independent!==!1){if(V.details){var Se=M.startPTS,Re=M.endPTS,Ce=M.startDTS,xe=M.endDTS;if(K)K.elementaryStreams[M.type]={startPTS:Se,endPTS:Re,startDTS:Ce,endDTS:xe};else if(M.firstKeyFrame&&M.independent&&(this.couldBacktrack=!0),M.dropped&&M.independent){var me=this.getLoadPosition()+this.config.maxBufferHole;if(me<Se){this.backtrack(W);return}W.setElementaryStreamInfo(M.type,W.start,Re,W.start,xe,!0)}W.setElementaryStreamInfo(M.type,Se,Re,Ce,xe),this.bufferFragmentData(M,W,K,S)}}else if(g.independent===!1){this.backtrack(W);return}if(he){var G=he.startPTS,s=he.endPTS,c=he.startDTS,R=he.endDTS;K&&(K.elementaryStreams[b.ElementaryStreamTypes.AUDIO]={startPTS:G,endPTS:s,startDTS:c,endDTS:R}),W.setElementaryStreamInfo(b.ElementaryStreamTypes.AUDIO,G,s,c,R),this.bufferFragmentData(he,W,K,S)}if($!=null&&(d=$.samples)!==null&&d!==void 0&&d.length){var X={frag:W,id:a,samples:$.samples};E.trigger(z.Events.FRAG_PARSING_METADATA,X)}if(I){var N={frag:W,id:a,samples:I.samples};E.trigger(z.Events.FRAG_PARSING_USERDATA,N)}},x._bufferInitSegment=function(p,d,a,E){var g=this;if(this.state!==U.State.PARSING)return;this.audioOnly=!!d.audio&&!d.video,this.altAudio&&!this.audioOnly&&delete d.audio;var S=d.audio,F=d.video,W=d.audiovideo;if(S){var K=p.audioCodec,V=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(K&&(K.indexOf("mp4a.40.5")!==-1?K="mp4a.40.2":K="mp4a.40.5"),S.metadata.channelCount!==1&&V.indexOf("firefox")===-1&&(K="mp4a.40.5")),V.indexOf("android")!==-1&&S.container!=="audio/mpeg"&&(K="mp4a.40.2",this.log("Android: force audio codec to "+K)),p.audioCodec&&p.audioCodec!==K&&this.log('Swapping manifest audio codec "'+p.audioCodec+'" for "'+K+'"'),S.levelCodec=K,S.id="main",this.log("Init audio buffer, container:"+S.container+", codecs[selected/level/parsed]=["+(K||"")+"/"+(p.audioCodec||"")+"/"+S.codec+"]")}F&&(F.levelCodec=p.videoCodec,F.id="main",this.log("Init video buffer, container:"+F.container+", codecs[level/parsed]=["+(p.videoCodec||"")+"/"+F.codec+"]")),W&&this.log("Init audiovideo buffer, container:"+W.container+", codecs[level/parsed]=["+(p.attrs.CODECS||"")+"/"+W.codec+"]"),this.hls.trigger(z.Events.BUFFER_CODECS,d),Object.keys(d).forEach(function(M){var I=d[M],$=I.initSegment;$!=null&&$.byteLength&&g.hls.trigger(z.Events.BUFFER_APPENDING,{type:M,data:$,frag:a,part:null,chunkMeta:E,parent:a.type})}),this.tick()},x.backtrack=function(p){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(p);var d=this.fragmentTracker.backtrack(p);this.fragPrevious=null,this.nextLoadPosition=p.start,d?this.resetFragmentLoading(p):this.state=U.State.BACKTRACKING},x.checkFragmentChanged=function(){var p=this.media,d=null;if(p&&p.readyState>1&&p.seeking===!1){var a=p.currentTime;if(H.BufferHelper.isBuffered(p,a)?d=this.getAppendedFrag(a):H.BufferHelper.isBuffered(p,a+.1)&&(d=this.getAppendedFrag(a+.1)),d){var E=this.fragPlaying,g=d.level;(!E||d.sn!==E.sn||E.level!==g||d.urlId!==E.urlId)&&(this.hls.trigger(z.Events.FRAG_CHANGED,{frag:d}),(!E||E.level!==g)&&this.hls.trigger(z.Events.LEVEL_SWITCHED,{level:g}),this.fragPlaying=d)}}},o(k,[{key:"nextLevel",get:function(){var p=this.nextBufferedFrag;return p?p.level:-1}},{key:"currentLevel",get:function(){var p=this.media;if(p){var d=this.getAppendedFrag(p.currentTime);if(d)return d.level}return-1}},{key:"nextBufferedFrag",get:function(){var p=this.media;if(p){var d=this.getAppendedFrag(p.currentTime);return this.followingBufferedFrag(d)}else return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),k}(U.default)},"./src/controller/subtitle-stream-controller.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"SubtitleStreamController",function(){return l});var J=_("./src/events.ts"),U=_("./src/utils/logger.ts"),D=_("./src/utils/buffer-helper.ts"),z=_("./src/controller/fragment-finders.ts"),H=_("./src/utils/discontinuities.ts"),B=_("./src/controller/level-helper.ts"),O=_("./src/controller/fragment-tracker.ts"),b=_("./src/controller/base-stream-controller.ts"),A=_("./src/types/loader.ts"),P=_("./src/types/level.ts");function L(u,C){for(var v=0;v<C.length;v++){var m=C[v];m.enumerable=m.enumerable||!1,m.configurable=!0,"value"in m&&(m.writable=!0),Object.defineProperty(u,m.key,m)}}function w(u,C,v){return C&&L(u.prototype,C),v&&L(u,v),u}function y(u,C){u.prototype=Object.create(C.prototype),u.prototype.constructor=u,h(u,C)}function h(u,C){return h=Object.setPrototypeOf||function(m,k){return m.__proto__=k,m},h(u,C)}var o=500,l=function(u){y(C,u);function C(m,k){var x;return x=u.call(this,m,k,"[subtitle-stream-controller]")||this,x.levels=[],x.currentTrackId=-1,x.tracksBuffered=[],x.mainDetails=null,x._registerListeners(),x}var v=C.prototype;return v.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},v._registerListeners=function(){var k=this.hls;k.on(J.Events.MEDIA_ATTACHED,this.onMediaAttached,this),k.on(J.Events.MEDIA_DETACHING,this.onMediaDetaching,this),k.on(J.Events.MANIFEST_LOADING,this.onManifestLoading,this),k.on(J.Events.LEVEL_LOADED,this.onLevelLoaded,this),k.on(J.Events.ERROR,this.onError,this),k.on(J.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),k.on(J.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),k.on(J.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),k.on(J.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),k.on(J.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},v._unregisterListeners=function(){var k=this.hls;k.off(J.Events.MEDIA_ATTACHED,this.onMediaAttached,this),k.off(J.Events.MEDIA_DETACHING,this.onMediaDetaching,this),k.off(J.Events.MANIFEST_LOADING,this.onManifestLoading,this),k.off(J.Events.LEVEL_LOADED,this.onLevelLoaded,this),k.off(J.Events.ERROR,this.onError,this),k.off(J.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),k.off(J.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),k.off(J.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),k.off(J.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),k.off(J.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},v.startLoad=function(){this.stopLoad(),this.state=b.State.IDLE,this.setInterval(o),this.tick()},v.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},v.onLevelLoaded=function(k,x){this.mainDetails=x.details},v.onSubtitleFragProcessed=function(k,x){var f=x.frag,p=x.success;if(this.fragPrevious=f,this.state=b.State.IDLE,!p)return;var d=this.tracksBuffered[this.currentTrackId];if(!d)return;for(var a,E=f.start,g=0;g<d.length;g++)if(E>=d[g].start&&E<=d[g].end){a=d[g];break}var S=f.start+f.duration;a?a.end=S:(a={start:E,end:S},d.push(a)),this.fragmentTracker.fragBuffered(f)},v.onBufferFlushing=function(k,x){var f=x.startOffset,p=x.endOffset;if(f===0&&p!==Number.POSITIVE_INFINITY){var d=this.currentTrackId,a=this.levels;if(!a.length||!a[d]||!a[d].details)return;var E=a[d].details,g=E.targetduration,S=p-g;if(S<=0)return;x.endOffsetSubtitles=Math.max(0,S),this.tracksBuffered.forEach(function(F){for(var W=0;W<F.length;){if(F[W].end<=S){F.shift();continue}else if(F[W].start<S)F[W].start=S;else break;W++}}),this.fragmentTracker.removeFragmentsInRange(f,S,A.PlaylistLevelType.SUBTITLE)}},v.onError=function(k,x){var f,p=x.frag;if(!p||p.type!==A.PlaylistLevelType.SUBTITLE)return;(f=this.fragCurrent)!==null&&f!==void 0&&f.loader&&this.fragCurrent.loader.abort(),this.state=b.State.IDLE},v.onSubtitleTracksUpdated=function(k,x){var f=this,p=x.subtitleTracks;this.tracksBuffered=[],this.levels=p.map(function(d){return new P.Level(d)}),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach(function(d){f.tracksBuffered[d.id]=[]}),this.mediaBuffer=null},v.onSubtitleTrackSwitch=function(k,x){if(this.currentTrackId=x.id,!this.levels.length||this.currentTrackId===-1){this.clearInterval();return}var f=this.levels[this.currentTrackId];f!=null&&f.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,f&&this.setInterval(o)},v.onSubtitleTrackLoaded=function(k,x){var f,p=x.details,d=x.id,a=this.currentTrackId,E=this.levels;if(!E.length)return;var g=E[a];if(d>=E.length||d!==a||!g)return;if(this.mediaBuffer=this.mediaBufferTimeRanges,p.live||(f=g.details)!==null&&f!==void 0&&f.live){var S=this.mainDetails;if(p.deltaUpdateFailed||!S)return;var F=S.fragments[0];if(!g.details)p.hasProgramDateTime&&S.hasProgramDateTime?Object(H.alignMediaPlaylistByPDT)(p,S):F&&Object(B.addSliding)(p,F.start);else{var W=this.alignPlaylists(p,g.details);W===0&&F&&Object(B.addSliding)(p,F.start)}}if(g.details=p,this.levelLastLoaded=d,this.tick(),p.live&&!this.fragCurrent&&this.media&&this.state===b.State.IDLE){var K=Object(z.findFragmentByPTS)(null,p.fragments,this.media.currentTime,0);K||(this.warn("Subtitle playlist not aligned with playback"),g.details=void 0)}},v._handleFragmentLoadComplete=function(k){var x=k.frag,f=k.payload,p=x.decryptdata,d=this.hls;if(this.fragContextChanged(x))return;if(f&&f.byteLength>0&&p&&p.key&&p.iv&&p.method==="AES-128"){var a=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(f),p.key.buffer,p.iv.buffer).then(function(E){var g=performance.now();d.trigger(J.Events.FRAG_DECRYPTED,{frag:x,payload:E,stats:{tstart:a,tdecrypt:g}})})}},v.doTick=function(){if(!this.media){this.state=b.State.IDLE;return}if(this.state===b.State.IDLE){var k,x=this.currentTrackId,f=this.levels;if(!f.length||!f[x]||!f[x].details)return;var p=f[x].details,d=p.targetduration,a=this.config,E=this.media,g=D.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,E.currentTime-d,a.maxBufferHole),S=g.end,F=g.len,W=this.getMaxBufferLength()+d;if(F>W)return;console.assert(p,"Subtitle track details are defined on idle subtitle stream controller tick");var K=p.fragments,V=K.length,M=p.edge,I,$=this.fragPrevious;if(S<M){var ae=a.maxFragLookUpTolerance;$&&p.hasProgramDateTime&&(I=Object(z.findFragmentByPDT)(K,$.endProgramDateTime,ae)),I||(I=Object(z.findFragmentByPTS)($,K,S,ae),!I&&$&&$.start<K[0].start&&(I=K[0]))}else I=K[V-1];(k=I)!==null&&k!==void 0&&k.encrypted?(U.logger.log("Loading key for "+I.sn),this.state=b.State.KEY_LOADING,this.hls.trigger(J.Events.KEY_LOADING,{frag:I})):I&&this.fragmentTracker.getState(I)===O.FragmentState.NOT_LOADED&&this.loadFragment(I,p,S)}},v.loadFragment=function(k,x,f){this.fragCurrent=k,u.prototype.loadFragment.call(this,k,x,f)},w(C,[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}]),C}(b.default)},"./src/controller/subtitle-track-controller.ts":function(fe,Z,_){"use strict";_.r(Z);var J=_("./src/events.ts"),U=_("./src/utils/texttrack-utils.ts"),D=_("./src/controller/base-playlist-controller.ts"),z=_("./src/types/loader.ts");function H(L,w){for(var y=0;y<w.length;y++){var h=w[y];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(L,h.key,h)}}function B(L,w,y){return w&&H(L.prototype,w),y&&H(L,y),L}function O(L,w){L.prototype=Object.create(w.prototype),L.prototype.constructor=L,b(L,w)}function b(L,w){return b=Object.setPrototypeOf||function(h,o){return h.__proto__=o,h},b(L,w)}var A=function(L){O(w,L);function w(h){var o;return o=L.call(this,h,"[subtitle-track-controller]")||this,o.media=null,o.tracks=[],o.groupId=null,o.tracksInGroup=[],o.trackId=-1,o.selectDefaultTrack=!0,o.queuedDefaultTrack=-1,o.trackChangeListener=function(){return o.onTextTracksChanged()},o.asyncPollTrackChange=function(){return o.pollTrackChange(0)},o.useTextTrackPolling=!1,o.subtitlePollingInterval=-1,o.subtitleDisplay=!0,o.registerListeners(),o}var y=w.prototype;return y.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,L.prototype.destroy.call(this)},y.registerListeners=function(){var o=this.hls;o.on(J.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.on(J.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.on(J.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(J.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.on(J.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(J.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.on(J.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.on(J.Events.ERROR,this.onError,this)},y.unregisterListeners=function(){var o=this.hls;o.off(J.Events.MEDIA_ATTACHED,this.onMediaAttached,this),o.off(J.Events.MEDIA_DETACHING,this.onMediaDetaching,this),o.off(J.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(J.Events.MANIFEST_PARSED,this.onManifestParsed,this),o.off(J.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(J.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),o.off(J.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),o.off(J.Events.ERROR,this.onError,this)},y.onMediaAttached=function(o,l){if(this.media=l.media,!this.media)return;this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange)},y.pollTrackChange=function(o){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,o)},y.onMediaDetaching=function(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId);var o=P(this.media.textTracks);o.forEach(function(l){Object(U.clearCurrentCues)(l)}),this.subtitleTrack=-1,this.media=null},y.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},y.onManifestParsed=function(o,l){this.tracks=l.subtitleTracks},y.onSubtitleTrackLoaded=function(o,l){var u=l.id,C=l.details,v=this.trackId,m=this.tracksInGroup[v];if(!m){this.warn("Invalid subtitle track id "+u);return}var k=m.details;m.details=l.details,this.log("subtitle track "+u+" loaded ["+C.startSN+"-"+C.endSN+"]"),u===this.trackId&&(this.retryCount=0,this.playlistLoaded(u,l,k))},y.onLevelLoading=function(o,l){this.switchLevel(l.level)},y.onLevelSwitching=function(o,l){this.switchLevel(l.level)},y.switchLevel=function(o){var l=this.hls.levels[o];if(!(l!=null&&l.textGroupIds))return;var u=l.textGroupIds[l.urlId];if(this.groupId!==u){var C=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,v=this.tracks.filter(function(x){return!u||x.groupId===u});this.tracksInGroup=v;var m=this.findTrackId(C==null?void 0:C.name)||this.findTrackId();this.groupId=u;var k={subtitleTracks:v};this.log("Updating subtitle tracks, "+v.length+' track(s) found in "'+u+'" group-id'),this.hls.trigger(J.Events.SUBTITLE_TRACKS_UPDATED,k),m!==-1&&this.setSubtitleTrack(m,C)}},y.findTrackId=function(o){for(var l=this.tracksInGroup,u=0;u<l.length;u++){var C=l[u];if((!this.selectDefaultTrack||C.default)&&(!o||o===C.name))return C.id}return-1},y.onError=function(o,l){if(L.prototype.onError.call(this,o,l),l.fatal||!l.context)return;l.context.type===z.PlaylistContextType.SUBTITLE_TRACK&&l.context.id===this.trackId&&l.context.groupId===this.groupId&&this.retryLoadingOrFail(l)},y.loadPlaylist=function(o){var l=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(l)){var u=l.id,C=l.groupId,v=l.url;if(o)try{v=o.addDirectives(v)}catch(m){this.warn("Could not construct new URL with HLS Delivery Directives: "+m)}this.log("Loading subtitle playlist for id "+u),this.hls.trigger(J.Events.SUBTITLE_TRACK_LOADING,{url:v,id:u,groupId:C,deliveryDirectives:o||null})}},y.toggleTrackModes=function(o){var l=this,u=this.media,C=this.subtitleDisplay,v=this.trackId;if(!u)return;var m=P(u.textTracks),k=m.filter(function(p){return p.groupId===l.groupId});if(o===-1)[].slice.call(m).forEach(function(p){p.mode="disabled"});else{var x=k[v];x&&(x.mode="disabled")}var f=k[o];f&&(f.mode=C?"showing":"hidden")},y.setSubtitleTrack=function(o,l){var u,C=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=o;return}if(this.trackId!==o&&this.toggleTrackModes(o),this.trackId===o&&(o===-1||(u=C[o])!==null&&u!==void 0&&u.details)||o<-1||o>=C.length)return;this.clearTimer();var v=C[o];if(this.log("Switching to subtitle track "+o),this.trackId=o,v){var m=v.id,k=v.groupId,x=k===void 0?"":k,f=v.name,p=v.type,d=v.url;this.hls.trigger(J.Events.SUBTITLE_TRACK_SWITCH,{id:m,groupId:x,name:f,type:p,url:d});var a=this.switchParams(v.url,l==null?void 0:l.details);this.loadPlaylist(a)}else this.hls.trigger(J.Events.SUBTITLE_TRACK_SWITCH,{id:o})},y.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;for(var o=-1,l=P(this.media.textTracks),u=0;u<l.length;u++)if(l[u].mode==="hidden")o=u;else if(l[u].mode==="showing"){o=u;break}this.subtitleTrack!==o&&(this.subtitleTrack=o)},B(w,[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(o){this.selectDefaultTrack=!1;var l=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(o,l)}}]),w}(D.default);function P(L){for(var w=[],y=0;y<L.length;y++){var h=L[y];h.kind==="subtitles"&&h.label&&w.push(L[y])}return w}Z.default=A},"./src/controller/timeline-controller.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"TimelineController",function(){return P});var J=_("./src/polyfills/number.ts"),U=_("./src/events.ts"),D=_("./src/utils/cea-608-parser.ts"),z=_("./src/utils/output-filter.ts"),H=_("./src/utils/webvtt-parser.ts"),B=_("./src/utils/texttrack-utils.ts"),O=_("./src/utils/imsc1-ttml-parser.ts"),b=_("./src/types/loader.ts"),A=_("./src/utils/logger.ts"),P=function(){function h(l){if(this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.timescale=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=y(),this.captionsProperties=void 0,this.hls=l,this.config=l.config,this.Cues=l.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},this.config.enableCEA708Captions){var u=new z.default(this,"textTrack1"),C=new z.default(this,"textTrack2"),v=new z.default(this,"textTrack3"),m=new z.default(this,"textTrack4");this.cea608Parser1=new D.default(1,u,C),this.cea608Parser2=new D.default(3,v,m)}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 o=h.prototype;return o.destroy=function(){var u=this.hls;u.off(U.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),u.off(U.Events.MEDIA_DETACHING,this.onMediaDetaching,this),u.off(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),u.off(U.Events.MANIFEST_LOADED,this.onManifestLoaded,this),u.off(U.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),u.off(U.Events.FRAG_LOADING,this.onFragLoading,this),u.off(U.Events.FRAG_LOADED,this.onFragLoaded,this),u.off(U.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),u.off(U.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),u.off(U.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),u.off(U.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),u.off(U.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},o.addCues=function(u,C,v,m,k){for(var x=!1,f=k.length;f--;){var p=k[f],d=w(p[0],p[1],C,v);if(d>=0&&(p[0]=Math.min(p[0],C),p[1]=Math.max(p[1],v),x=!0,d/(v-C)>.5))return}if(x||k.push([C,v]),this.config.renderTextTracksNatively){var a=this.captionsTracks[u];this.Cues.newCue(a,C,v,m)}else{var E=this.Cues.newCue(null,C,v,m);this.hls.trigger(U.Events.CUES_PARSED,{type:"captions",cues:E,track:u})}},o.onInitPtsFound=function(u,C){var v=this,m=C.frag,k=C.id,x=C.initPTS,f=C.timescale,p=this.unparsedVttFrags;k==="main"&&(this.initPTS[m.cc]=x,this.timescale[m.cc]=f),p.length&&(this.unparsedVttFrags=[],p.forEach(function(d){v.onFragLoaded(U.Events.FRAG_LOADED,d)}))},o.getExistingTrack=function(u){var C=this.media;if(C)for(var v=0;v<C.textTracks.length;v++){var m=C.textTracks[v];if(m[u])return m}return null},o.createCaptionsTrack=function(u){this.config.renderTextTracksNatively?this.createNativeTrack(u):this.createNonNativeTrack(u)},o.createNativeTrack=function(u){if(this.captionsTracks[u])return;var C=this.captionsProperties,v=this.captionsTracks,m=this.media,k=C[u],x=k.label,f=k.languageCode,p=this.getExistingTrack(u);if(p)v[u]=p,Object(B.clearCurrentCues)(v[u]),Object(B.sendAddTrackEvent)(v[u],m);else{var d=this.createTextTrack("captions",x,f);d&&(d[u]=!0,v[u]=d)}},o.createNonNativeTrack=function(u){if(this.nonNativeCaptionsTracks[u])return;var C=this.captionsProperties[u];if(!C)return;var v=C.label,m={_id:u,label:v,kind:"captions",default:C.media?!!C.media.default:!1,closedCaptions:C.media};this.nonNativeCaptionsTracks[u]=m,this.hls.trigger(U.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[m]})},o.createTextTrack=function(u,C,v){var m=this.media;return m?m.addTextTrack(u,C,v):void 0},o.onMediaAttaching=function(u,C){this.media=C.media,this._cleanTracks()},o.onMediaDetaching=function(){var u=this.captionsTracks;Object.keys(u).forEach(function(C){Object(B.clearCurrentCues)(u[C]),delete u[C]}),this.nonNativeCaptionsTracks={}},o.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=y(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.timescale=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},o._cleanTracks=function(){var u=this.media;if(!u)return;var C=u.textTracks;if(C)for(var v=0;v<C.length;v++)Object(B.clearCurrentCues)(C[v])},o.onSubtitleTracksUpdated=function(u,C){var v=this;this.textTracks=[];var m=C.subtitleTracks||[],k=m.some(function(d){return d.textCodec===O.IMSC1_CODEC});if(this.config.enableWebVTT||k&&this.config.enableIMSC1){var x=this.tracks&&m&&this.tracks.length===m.length;if(this.tracks=m||[],this.config.renderTextTracksNatively){var f=this.media?this.media.textTracks:[];this.tracks.forEach(function(d,a){var E;if(a<f.length){for(var g=null,S=0;S<f.length;S++)if(L(f[S],d)){g=f[S];break}g&&(E=g)}E?Object(B.clearCurrentCues)(E):(E=v.createTextTrack("subtitles",d.name,d.lang),E&&(E.mode="disabled")),E&&(E.groupId=d.groupId,v.textTracks.push(E))})}else if(!x&&this.tracks&&this.tracks.length){var p=this.tracks.map(function(d){return{label:d.name,kind:d.type.toLowerCase(),default:d.default,subtitleTrack:d}});this.hls.trigger(U.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:p})}}},o.onManifestLoaded=function(u,C){var v=this;this.config.enableCEA708Captions&&C.captions&&C.captions.forEach(function(m){var k=/(?:CC|SERVICE)([1-4])/.exec(m.instreamId);if(!k)return;var x="textTrack"+k[1],f=v.captionsProperties[x];if(!f)return;f.label=m.name,m.lang&&(f.languageCode=m.lang),f.media=m})},o.onFragLoading=function(u,C){var v=this.cea608Parser1,m=this.cea608Parser2,k=this.lastSn,x=this.lastPartIndex;if(!this.enabled||!(v&&m))return;if(C.frag.type===b.PlaylistLevelType.MAIN){var f,p,d=C.frag.sn,a=(f=C==null||((p=C.part)===null||p===void 0)?void 0:p.index)!=null?f:-1;d===k+1||d===k&&a===x+1||(v.reset(),m.reset()),this.lastSn=d,this.lastPartIndex=a}},o.onFragLoaded=function(u,C){var v=C.frag,m=C.payload,k=this.initPTS,x=this.unparsedVttFrags;if(v.type===b.PlaylistLevelType.SUBTITLE)if(m.byteLength){if(!Object(J.isFiniteNumber)(k[v.cc])){x.push(C),k.length&&this.hls.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:v,error:new Error("Missing initial subtitle PTS")});return}var f=v.decryptdata;if(f==null||f.key==null||f.method!=="AES-128"){var p=this.tracks[v.level],d=this.vttCCs;d[v.cc]||(d[v.cc]={start:v.start,prevCC:this.prevCC,new:!0},this.prevCC=v.cc),p&&p.textCodec===O.IMSC1_CODEC?this._parseIMSC1(v,m):this._parseVTTs(v,m,d)}}else this.hls.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:v,error:new Error("Empty subtitle payload")})},o._parseIMSC1=function(u,C){var v=this,m=this.hls;Object(O.parseIMSC1)(C,this.initPTS[u.cc],this.timescale[u.cc],function(k){v._appendCues(k,u.level),m.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:u})},function(k){A.logger.log("Failed to parse IMSC1: "+k),m.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:u,error:k})})},o._parseVTTs=function(u,C,v){var m=this,k=this.hls;Object(H.parseWebVTT)(C,this.initPTS[u.cc],this.timescale[u.cc],v,u.cc,u.start,function(x){m._appendCues(x,u.level),k.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:u})},function(x){m._fallbackToIMSC1(u,C),A.logger.log("Failed to parse VTT cue: "+x),k.trigger(U.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:u,error:x})})},o._fallbackToIMSC1=function(u,C){var v=this,m=this.tracks[u.level];m.textCodec||Object(O.parseIMSC1)(C,this.initPTS[u.cc],this.timescale[u.cc],function(){m.textCodec=O.IMSC1_CODEC,v._parseIMSC1(u,C)},function(){m.textCodec="wvtt"})},o._appendCues=function(u,C){var v=this.hls;if(this.config.renderTextTracksNatively){var m=this.textTracks[C];if(m.mode==="disabled")return;u.forEach(function(f){return Object(B.addCueToTrack)(m,f)})}else{var k=this.tracks[C],x=k.default?"default":"subtitles"+C;v.trigger(U.Events.CUES_PARSED,{type:"subtitles",cues:u,track:x})}},o.onFragDecrypted=function(u,C){var v=C.frag;if(v.type===b.PlaylistLevelType.SUBTITLE){if(!Object(J.isFiniteNumber)(this.initPTS[v.cc])){this.unparsedVttFrags.push(C);return}this.onFragLoaded(U.Events.FRAG_LOADED,C)}},o.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},o.onFragParsingUserdata=function(u,C){var v=this.cea608Parser1,m=this.cea608Parser2;if(!this.enabled||!(v&&m))return;for(var k=0;k<C.samples.length;k++){var x=C.samples[k].bytes;if(x){var f=this.extractCea608Data(x);v.addData(C.samples[k].pts,f[0]),m.addData(C.samples[k].pts,f[1])}}},o.onBufferFlushing=function(u,C){var v=C.startOffset,m=C.endOffset,k=C.endOffsetSubtitles,x=C.type,f=this.media;if(!f||f.currentTime<m)return;if(!x||x==="video"){var p=this.captionsTracks;Object.keys(p).forEach(function(a){return Object(B.removeCuesInRange)(p[a],v,m)})}if(this.config.renderTextTracksNatively&&(v===0&&k!==void 0)){var d=this.textTracks;Object.keys(d).forEach(function(a){return Object(B.removeCuesInRange)(d[a],v,k)})}},o.extractCea608Data=function(u){for(var C=u[0]&31,v=2,m=[[],[]],k=0;k<C;k++){var x=u[v++],f=127&u[v++],p=127&u[v++],d=(4&x)!==0,a=3&x;if(f===0&&p===0)continue;d&&((a===0||a===1)&&(m[a].push(f),m[a].push(p)))}return m},h}();function L(h,o){return h&&h.label===o.name&&!(h.textTrack1||h.textTrack2)}function w(h,o,l,u){return Math.min(o,u)-Math.max(h,l)}function y(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}}}},"./src/crypt/aes-crypto.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"default",function(){return J});var J=function(){function U(z,H){this.subtle=void 0,this.aesIV=void 0,this.subtle=z,this.aesIV=H}var D=U.prototype;return D.decrypt=function(H,B){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},B,H)},U}()},"./src/crypt/aes-decryptor.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"removePadding",function(){return U}),_.d(Z,"default",function(){return D});var J=_("./src/utils/typed-array.ts");function U(z){var H=z.byteLength,B=H&&new DataView(z.buffer).getUint8(H-1);return B?Object(J.sliceUint8)(z,0,H-B):z}var D=function(){function z(){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 H=z.prototype;return H.uint8ArrayToUint32Array_=function(O){for(var b=new DataView(O),A=new Uint32Array(4),P=0;P<4;P++)A[P]=b.getUint32(P*4);return A},H.initTable=function(){var O=this.sBox,b=this.invSBox,A=this.subMix,P=A[0],L=A[1],w=A[2],y=A[3],h=this.invSubMix,o=h[0],l=h[1],u=h[2],C=h[3],v=new Uint32Array(256),m=0,k=0,x=0;for(x=0;x<256;x++)x<128?v[x]=x<<1:v[x]=x<<1^283;for(x=0;x<256;x++){var f=k^k<<1^k<<2^k<<3^k<<4;f=f>>>8^f&255^99,O[m]=f,b[f]=m;var p=v[m],d=v[p],a=v[d],E=v[f]*257^f*16843008;P[m]=E<<24|E>>>8,L[m]=E<<16|E>>>16,w[m]=E<<8|E>>>24,y[m]=E,E=a*16843009^d*65537^p*257^m*16843008,o[f]=E<<24|E>>>8,l[f]=E<<16|E>>>16,u[f]=E<<8|E>>>24,C[f]=E,m?(m=p^v[v[v[a^p]]],k^=v[v[k]]):m=k=1}},H.expandKey=function(O){for(var b=this.uint8ArrayToUint32Array_(O),A=!0,P=0;P<b.length&&A;)A=b[P]===this.key[P],P++;if(A)return;this.key=b;var L=this.keySize=b.length;if(L!==4&&L!==6&&L!==8)throw new Error("Invalid aes key size="+L);var w=this.ksRows=(L+6+1)*4,y,h,o=this.keySchedule=new Uint32Array(w),l=this.invKeySchedule=new Uint32Array(w),u=this.sBox,C=this.rcon,v=this.invSubMix,m=v[0],k=v[1],x=v[2],f=v[3],p,d;for(y=0;y<w;y++){if(y<L){p=o[y]=b[y];continue}d=p,y%L===0?(d=d<<8|d>>>24,d=u[d>>>24]<<24|u[d>>>16&255]<<16|u[d>>>8&255]<<8|u[d&255],d^=C[y/L|0]<<24):L>6&&y%L===4&&(d=u[d>>>24]<<24|u[d>>>16&255]<<16|u[d>>>8&255]<<8|u[d&255]),o[y]=p=(o[y-L]^d)>>>0}for(h=0;h<w;h++)y=w-h,h&3?d=o[y]:d=o[y-4],h<4||y<=4?l[h]=d:l[h]=m[u[d>>>24]]^k[u[d>>>16&255]]^x[u[d>>>8&255]]^f[u[d&255]],l[h]=l[h]>>>0},H.networkToHostOrderSwap=function(O){return O<<24|(O&65280)<<8|(O&16711680)>>8|O>>>24},H.decrypt=function(O,b,A){for(var P=this.keySize+6,L=this.invKeySchedule,w=this.invSBox,y=this.invSubMix,h=y[0],o=y[1],l=y[2],u=y[3],C=this.uint8ArrayToUint32Array_(A),v=C[0],m=C[1],k=C[2],x=C[3],f=new Int32Array(O),p=new Int32Array(f.length),d,a,E,g,S,F,W,K,V,M,I,$,ae,he,ge=this.networkToHostOrderSwap;b<f.length;){for(V=ge(f[b]),M=ge(f[b+1]),I=ge(f[b+2]),$=ge(f[b+3]),S=V^L[0],F=$^L[1],W=I^L[2],K=M^L[3],ae=4,he=1;he<P;he++)d=h[S>>>24]^o[F>>16&255]^l[W>>8&255]^u[K&255]^L[ae],a=h[F>>>24]^o[W>>16&255]^l[K>>8&255]^u[S&255]^L[ae+1],E=h[W>>>24]^o[K>>16&255]^l[S>>8&255]^u[F&255]^L[ae+2],g=h[K>>>24]^o[S>>16&255]^l[F>>8&255]^u[W&255]^L[ae+3],S=d,F=a,W=E,K=g,ae=ae+4;d=w[S>>>24]<<24^w[F>>16&255]<<16^w[W>>8&255]<<8^w[K&255]^L[ae],a=w[F>>>24]<<24^w[W>>16&255]<<16^w[K>>8&255]<<8^w[S&255]^L[ae+1],E=w[W>>>24]<<24^w[K>>16&255]<<16^w[S>>8&255]<<8^w[F&255]^L[ae+2],g=w[K>>>24]<<24^w[S>>16&255]<<16^w[F>>8&255]<<8^w[W&255]^L[ae+3],p[b]=ge(d^v),p[b+1]=ge(g^m),p[b+2]=ge(E^k),p[b+3]=ge(a^x),v=V,m=M,k=I,x=$,b=b+4}return p.buffer},z}()},"./src/crypt/decrypter.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"default",function(){return b});var J=_("./src/crypt/aes-crypto.ts"),U=_("./src/crypt/fast-aes-key.ts"),D=_("./src/crypt/aes-decryptor.ts"),z=_("./src/utils/logger.ts"),H=_("./src/utils/mp4-tools.ts"),B=_("./src/utils/typed-array.ts"),O=16,b=function(){function A(L,w,y){var h=y===void 0?{}:y,o=h.removePKCS7Padding,l=o===void 0?!0:o;if(this.logEnabled=!0,this.observer=void 0,this.config=void 0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.observer=L,this.config=w,this.removePKCS7Padding=l,l)try{var u=self.crypto;u&&(this.subtle=u.subtle||u.webkitSubtle)}catch(C){}this.subtle===null&&(this.config.enableSoftwareAES=!0)}var P=A.prototype;return P.destroy=function(){this.observer=null},P.isSync=function(){return this.config.enableSoftwareAES},P.flush=function(){var w=this.currentResult;if(!w){this.reset();return}var y=new Uint8Array(w);return this.reset(),this.removePKCS7Padding?Object(D.removePadding)(y):y},P.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},P.decrypt=function(w,y,h,o){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(w),y,h);var l=this.flush();l&&o(l.buffer)}else this.webCryptoDecrypt(new Uint8Array(w),y,h).then(o)},P.softwareDecrypt=function(w,y,h){var o=this.currentIV,l=this.currentResult,u=this.remainderData;this.logOnce("JS AES decrypt"),u&&(w=Object(H.appendUint8Array)(u,w),this.remainderData=null);var C=this.getValidChunk(w);if(!C.length)return null;o&&(h=o);var v=this.softwareDecrypter;v||(v=this.softwareDecrypter=new D.default),v.expandKey(y);var m=l;return this.currentResult=v.decrypt(C.buffer,0,h),this.currentIV=Object(B.sliceUint8)(C,-16).buffer,m||null},P.webCryptoDecrypt=function(w,y,h){var o=this,l=this.subtle;return(this.key!==y||!this.fastAesKey)&&(this.key=y,this.fastAesKey=new U.default(l,y)),this.fastAesKey.expandKey().then(function(u){if(!l)return Promise.reject(new Error("web crypto not initialized"));var C=new J.default(l,h);return C.decrypt(w.buffer,u)}).catch(function(u){return o.onWebCryptoError(u,w,y,h)})},P.onWebCryptoError=function(w,y,h,o){return z.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",w),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(y,h,o)},P.getValidChunk=function(w){var y=w,h=w.length-w.length%O;return h!==w.length&&(y=Object(B.sliceUint8)(w,0,h),this.remainderData=Object(B.sliceUint8)(w,h)),y},P.logOnce=function(w){if(!this.logEnabled)return;z.logger.log("[decrypter.ts]: "+w),this.logEnabled=!1},A}()},"./src/crypt/fast-aes-key.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"default",function(){return J});var J=function(){function U(z,H){this.subtle=void 0,this.key=void 0,this.subtle=z,this.key=H}var D=U.prototype;return D.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},U}()},"./src/demux/aacdemuxer.ts":function(fe,Z,_){"use strict";_.r(Z);var J=_("./src/demux/base-audio-demuxer.ts"),U=_("./src/demux/adts.ts"),D=_("./src/utils/logger.ts"),z=_("./src/demux/id3.ts");function H(b,A){b.prototype=Object.create(A.prototype),b.prototype.constructor=b,B(b,A)}function B(b,A){return B=Object.setPrototypeOf||function(L,w){return L.__proto__=w,L},B(b,A)}var O=function(b){H(A,b);function A(L,w){var y;return y=b.call(this)||this,y.observer=void 0,y.config=void 0,y.observer=L,y.config=w,y}var P=A.prototype;return P.resetInitSegment=function(w,y,h){b.prototype.resetInitSegment.call(this,w,y,h),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:w,duration:h,inputTimeScale:9e4,dropped:0}},A.probe=function(w){if(!w)return!1;for(var y=z.getID3Data(w,0)||[],h=y.length,o=w.length;h<o;h++)if(U.probe(w,h))return D.logger.log("ADTS sync word found !"),!0;return!1},P.canParse=function(w,y){return U.canParse(w,y)},P.appendFrame=function(w,y,h){U.initTrackConfig(w,this.observer,y,h,w.manifestCodec);var o=U.appendFrame(w,y,h,this.initPTS,this.frameIndex);if(o&&o.missing===0)return o},A}(J.default);O.minProbeByteLength=9,Z.default=O},"./src/demux/adts.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"getAudioConfig",function(){return z}),_.d(Z,"isHeaderPattern",function(){return H}),_.d(Z,"getHeaderLength",function(){return B}),_.d(Z,"getFullFrameLength",function(){return O}),_.d(Z,"canGetFrameLength",function(){return b}),_.d(Z,"isHeader",function(){return A}),_.d(Z,"canParse",function(){return P}),_.d(Z,"probe",function(){return L}),_.d(Z,"initTrackConfig",function(){return w}),_.d(Z,"getFrameDuration",function(){return y}),_.d(Z,"parseFrameHeader",function(){return h}),_.d(Z,"appendFrame",function(){return o});var J=_("./src/utils/logger.ts"),U=_("./src/errors.ts"),D=_("./src/events.ts");function z(l,u,C,v){var m,k,x,f,p=navigator.userAgent.toLowerCase(),d=v,a=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];m=((u[C+2]&192)>>>6)+1;var E=(u[C+2]&60)>>>2;if(E>a.length-1){l.trigger(D.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+E});return}return x=(u[C+2]&1)<<2,x|=(u[C+3]&192)>>>6,J.logger.log("manifest codec:"+v+", ADTS type:"+m+", samplingIndex:"+E),/firefox/i.test(p)?E>=6?(m=5,f=new Array(4),k=E-3):(m=2,f=new Array(2),k=E):p.indexOf("android")!==-1?(m=2,f=new Array(2),k=E):(m=5,f=new Array(4),v&&(v.indexOf("mp4a.40.29")!==-1||v.indexOf("mp4a.40.5")!==-1)||!v&&E>=6?k=E-3:((v&&v.indexOf("mp4a.40.2")!==-1&&(E>=6&&x===1||/vivaldi/i.test(p))||!v&&x===1)&&(m=2,f=new Array(2)),k=E)),f[0]=m<<3,f[0]|=(E&14)>>1,f[1]|=(E&1)<<7,f[1]|=x<<3,m===5&&(f[1]|=(k&14)>>1,f[2]=(k&1)<<7,f[2]|=2<<2,f[3]=0),{config:f,samplerate:a[E],channelCount:x,codec:"mp4a.40."+m,manifestCodec:d}}function H(l,u){return l[u]===255&&(l[u+1]&246)===240}function B(l,u){return l[u+1]&1?7:9}function O(l,u){return(l[u+3]&3)<<11|l[u+4]<<3|(l[u+5]&224)>>>5}function b(l,u){return u+5<l.length}function A(l,u){return u+1<l.length&&H(l,u)}function P(l,u){return b(l,u)&&H(l,u)&&O(l,u)<=l.length-u}function L(l,u){if(A(l,u)){var C=B(l,u);if(u+C>=l.length)return!1;var v=O(l,u);if(v<=C)return!1;var m=u+v;return m===l.length||A(l,m)}return!1}function w(l,u,C,v,m){if(!l.samplerate){var k=z(u,C,v,m);if(!k)return;l.config=k.config,l.samplerate=k.samplerate,l.channelCount=k.channelCount,l.codec=k.codec,l.manifestCodec=k.manifestCodec,J.logger.log("parsed codec:"+l.codec+", rate:"+k.samplerate+", channels:"+k.channelCount)}}function y(l){return 1024*9e4/l}function h(l,u,C,v,m){var k=B(l,u),x=O(l,u);if(x-=k,x>0){var f=C+v*m;return{headerLength:k,frameLength:x,stamp:f}}}function o(l,u,C,v,m){var k=y(l.samplerate),x=h(u,C,v,m,k);if(x){var f=x.frameLength,p=x.headerLength,d=x.stamp,a=p+f,E=Math.max(0,C+a-u.length),g;E?(g=new Uint8Array(a-p),g.set(u.subarray(C+p,u.length),0)):g=u.subarray(C+p,C+a);var S={unit:g,pts:d};return E||l.samples.push(S),{sample:S,length:a,missing:E}}}},"./src/demux/base-audio-demuxer.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"initPTSFn",function(){return O});var J=_("./src/polyfills/number.ts"),U=_("./src/demux/id3.ts"),D=_("./src/demux/dummy-demuxed-track.ts"),z=_("./src/utils/mp4-tools.ts"),H=_("./src/utils/typed-array.ts"),B=function(){function b(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var A=b.prototype;return A.resetInitSegment=function(L,w,y){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},A.resetTimeStamp=function(){},A.resetContiguity=function(){},A.canParse=function(L,w){return!1},A.appendFrame=function(L,w,y){},A.demux=function(L,w){this.cachedData&&(L=Object(z.appendUint8Array)(this.cachedData,L),this.cachedData=null);var y=U.getID3Data(L,0),h=y?y.length:0,o,l,u=this._audioTrack,C=this._id3Track,v=y?U.getTimeStamp(y):void 0,m=L.length;for((this.frameIndex===0||this.initPTS===null)&&(this.initPTS=O(v,w)),y&&y.length>0&&C.samples.push({pts:this.initPTS,dts:this.initPTS,data:y}),l=this.initPTS;h<m;){if(this.canParse(L,h)){var k=this.appendFrame(u,L,h);k?(this.frameIndex++,l=k.sample.pts,h+=k.length,o=h):h=m}else U.canParse(L,h)?(y=U.getID3Data(L,h),C.samples.push({pts:l,dts:l,data:y}),h+=y.length,o=h):h++;if(h===m&&o!==m){var x=Object(H.sliceUint8)(L,o);this.cachedData?this.cachedData=Object(z.appendUint8Array)(this.cachedData,x):this.cachedData=x}}return{audioTrack:u,avcTrack:Object(D.dummyTrack)(),id3Track:C,textTrack:Object(D.dummyTrack)()}},A.demuxSampleAes=function(L,w,y){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},A.flush=function(L){var w=this.cachedData;return w&&(this.cachedData=null,this.demux(w,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(D.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(D.dummyTrack)()}},A.destroy=function(){},b}(),O=function(A,P){return Object(J.isFiniteNumber)(A)?A*90:P*9e4};Z.default=B},"./src/demux/chunk-cache.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"default",function(){return J});var J=function(){function D(){this.chunks=[],this.dataLength=0}var z=D.prototype;return z.push=function(B){this.chunks.push(B),this.dataLength+=B.length},z.flush=function(){var B=this.chunks,O=this.dataLength,b;if(B.length)B.length===1?b=B[0]:b=U(B,O);else return new Uint8Array(0);return this.reset(),b},z.reset=function(){this.chunks.length=0,this.dataLength=0},D}();function U(D,z){for(var H=new Uint8Array(z),B=0,O=0;O<D.length;O++){var b=D[O];H.set(b,B),B+=b.length}return H}},"./src/demux/dummy-demuxed-track.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"dummyTrack",function(){return J});function J(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}},"./src/demux/exp-golomb.ts":function(fe,Z,_){"use strict";_.r(Z);var J=_("./src/utils/logger.ts"),U=function(){function D(H){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=H,this.bytesAvailable=H.byteLength,this.word=0,this.bitsAvailable=0}var z=D.prototype;return z.loadWord=function(){var B=this.data,O=this.bytesAvailable,b=B.byteLength-O,A=new Uint8Array(4),P=Math.min(4,O);if(P===0)throw new Error("no bytes available");A.set(B.subarray(b,b+P)),this.word=new DataView(A.buffer).getUint32(0),this.bitsAvailable=P*8,this.bytesAvailable-=P},z.skipBits=function(B){var O;this.bitsAvailable>B?(this.word<<=B,this.bitsAvailable-=B):(B-=this.bitsAvailable,O=B>>3,B-=O>>3,this.bytesAvailable-=O,this.loadWord(),this.word<<=B,this.bitsAvailable-=B)},z.readBits=function(B){var O=Math.min(this.bitsAvailable,B),b=this.word>>>32-O;return B>32&&J.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=O,this.bitsAvailable>0?this.word<<=O:this.bytesAvailable>0&&this.loadWord(),O=B-O,O>0&&this.bitsAvailable?b<<O|this.readBits(O):b},z.skipLZ=function(){var B;for(B=0;B<this.bitsAvailable;++B)if((this.word&2147483648>>>B)!==0)return this.word<<=B,this.bitsAvailable-=B,B;return this.loadWord(),B+this.skipLZ()},z.skipUEG=function(){this.skipBits(1+this.skipLZ())},z.skipEG=function(){this.skipBits(1+this.skipLZ())},z.readUEG=function(){var B=this.skipLZ();return this.readBits(B+1)-1},z.readEG=function(){var B=this.readUEG();return 1&B?1+B>>>1:-1*(B>>>1)},z.readBoolean=function(){return this.readBits(1)===1},z.readUByte=function(){return this.readBits(8)},z.readUShort=function(){return this.readBits(16)},z.readUInt=function(){return this.readBits(32)},z.skipScalingList=function(B){for(var O=8,b=8,A,P=0;P<B;P++)b!==0&&(A=this.readEG(),b=(O+A+256)%256),O=b===0?O:b},z.readSPS=function(){var B=0,O=0,b=0,A=0,P,L,w,y=this.readUByte.bind(this),h=this.readBits.bind(this),o=this.readUEG.bind(this),l=this.readBoolean.bind(this),u=this.skipBits.bind(this),C=this.skipEG.bind(this),v=this.skipUEG.bind(this),m=this.skipScalingList.bind(this);y();var k=y();if(h(5),u(3),y(),v(),k===100||k===110||k===122||k===244||k===44||k===83||k===86||k===118||k===128){var x=o();if(x===3&&u(1),v(),v(),u(1),l())for(L=x!==3?8:12,w=0;w<L;w++)l()&&(w<6?m(16):m(64))}v();var f=o();if(f===0)o();else if(f===1)for(u(1),C(),C(),P=o(),w=0;w<P;w++)C();v(),u(1);var p=o(),d=o(),a=h(1);a===0&&u(1),u(1),l()&&(B=o(),O=o(),b=o(),A=o());var E=[1,1];if(l()&&l()){var g=y();switch(g){case 1:E=[1,1];break;case 2:E=[12,11];break;case 3:E=[10,11];break;case 4:E=[16,11];break;case 5:E=[40,33];break;case 6:E=[24,11];break;case 7:E=[20,11];break;case 8:E=[32,11];break;case 9:E=[80,33];break;case 10:E=[18,11];break;case 11:E=[15,11];break;case 12:E=[64,33];break;case 13:E=[160,99];break;case 14:E=[4,3];break;case 15:E=[3,2];break;case 16:E=[2,1];break;case 255:{E=[y()<<8|y(),y()<<8|y()];break}}}return{width:Math.ceil((p+1)*16-B*2-O*2),height:(2-a)*(d+1)*16-(a?2:4)*(b+A),pixelRatio:E}},z.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},D}();Z.default=U},"./src/demux/id3.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"isHeader",function(){return J}),_.d(Z,"isFooter",function(){return U}),_.d(Z,"getID3Data",function(){return D}),_.d(Z,"canParse",function(){return H}),_.d(Z,"getTimeStamp",function(){return B}),_.d(Z,"isTimeStampFrame",function(){return O}),_.d(Z,"getID3Frames",function(){return A}),_.d(Z,"decodeFrame",function(){return P}),_.d(Z,"utf8ArrayToStr",function(){return o}),_.d(Z,"testables",function(){return l});var J=function(m,k){return k+10<=m.length&&(m[k]===73&&m[k+1]===68&&m[k+2]===51&&(m[k+3]<255&&m[k+4]<255&&(m[k+6]<128&&m[k+7]<128&&m[k+8]<128&&m[k+9]<128)))},U=function(m,k){return k+10<=m.length&&(m[k]===51&&m[k+1]===68&&m[k+2]===73&&(m[k+3]<255&&m[k+4]<255&&(m[k+6]<128&&m[k+7]<128&&m[k+8]<128&&m[k+9]<128)))},D=function(m,k){for(var x=k,f=0;J(m,k);){f+=10;var p=z(m,k+6);f+=p,U(m,k+10)&&(f+=10),k+=f}return f>0?m.subarray(x,x+f):void 0},z=function(m,k){var x=0;return x=(m[k]&127)<<21,x|=(m[k+1]&127)<<14,x|=(m[k+2]&127)<<7,x|=m[k+3]&127,x},H=function(m,k){return J(m,k)&&z(m,k+6)+10<=m.length-k},B=function(m){for(var k=A(m),x=0;x<k.length;x++){var f=k[x];if(O(f))return h(f)}return},O=function(m){return m&&m.key==="PRIV"&&m.info==="com.apple.streaming.transportStreamTimestamp"},b=function(m){var k=String.fromCharCode(m[0],m[1],m[2],m[3]),x=z(m,4),f=10;return{type:k,size:x,data:m.subarray(f,f+x)}},A=function(m){for(var k=0,x=[];J(m,k);){var f=z(m,k+6);k+=10;for(var p=k+f;k+8<p;){var d=b(m.subarray(k)),a=P(d);a&&x.push(a),k+=d.size+10}U(m,k)&&(k+=10)}return x},P=function(m){return m.type==="PRIV"?L(m):m.type[0]==="W"?y(m):w(m)},L=function(m){if(m.size<2)return;var k=o(m.data,!0),x=new Uint8Array(m.data.subarray(k.length+1));return{key:m.type,info:k,data:x.buffer}},w=function(m){if(m.size<2)return;if(m.type==="TXXX"){var k=1,x=o(m.data.subarray(k),!0);k+=x.length+1;var f=o(m.data.subarray(k));return{key:m.type,info:x,data:f}}var p=o(m.data.subarray(1));return{key:m.type,data:p}},y=function(m){if(m.type==="WXXX"){if(m.size<2)return;var k=1,x=o(m.data.subarray(k),!0);k+=x.length+1;var f=o(m.data.subarray(k));return{key:m.type,info:x,data:f}}var p=o(m.data);return{key:m.type,data:p}},h=function(m){if(m.data.byteLength===8){var k=new Uint8Array(m.data),x=k[3]&1,f=(k[4]<<23)+(k[5]<<15)+(k[6]<<7)+k[7];return f/=45,x&&(f+=4772185884e-2),Math.round(f)}return},o=function(m,k){k===void 0&&(k=!1);var x=C();if(x){var f=x.decode(m);if(k){var p=f.indexOf("\0");return p!==-1?f.substring(0,p):f}return f.replace(/\0/g,"")}for(var d=m.length,a,E,g,S="",F=0;F<d;){if(a=m[F++],a===0&&k)return S;if(a===0||a===3)continue;switch(a>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:S+=String.fromCharCode(a);break;case 12:case 13:E=m[F++],S+=String.fromCharCode((a&31)<<6|E&63);break;case 14:E=m[F++],g=m[F++],S+=String.fromCharCode((a&15)<<12|(E&63)<<6|(g&63)<<0);break;default:}}return S},l={decodeTextFrame:w},u;function C(){return!u&&typeof self.TextDecoder!="undefined"&&(u=new self.TextDecoder("utf-8")),u}},"./src/demux/mp3demuxer.ts":function(fe,Z,_){"use strict";_.r(Z);var J=_("./src/demux/base-audio-demuxer.ts"),U=_("./src/demux/id3.ts"),D=_("./src/utils/logger.ts"),z=_("./src/demux/mpegaudio.ts");function H(b,A){b.prototype=Object.create(A.prototype),b.prototype.constructor=b,B(b,A)}function B(b,A){return B=Object.setPrototypeOf||function(L,w){return L.__proto__=w,L},B(b,A)}var O=function(b){H(A,b);function A(){return b.apply(this,arguments)||this}var P=A.prototype;return P.resetInitSegment=function(w,y,h){b.prototype.resetInitSegment.call(this,w,y,h),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:w,duration:h,inputTimeScale:9e4,dropped:0}},A.probe=function(w){if(!w)return!1;for(var y=U.getID3Data(w,0)||[],h=y.length,o=w.length;h<o;h++)if(z.probe(w,h))return D.logger.log("MPEG Audio sync word found !"),!0;return!1},P.canParse=function(w,y){return z.canParse(w,y)},P.appendFrame=function(w,y,h){return this.initPTS===null?void 0:z.appendFrame(w,y,h,this.initPTS,this.frameIndex)},A}(J.default);O.minProbeByteLength=4,Z.default=O},"./src/demux/mp4demuxer.ts":function(fe,Z,_){"use strict";_.r(Z);var J=_("./src/utils/mp4-tools.ts"),U=_("./src/demux/dummy-demuxed-track.ts"),D=function(){function z(B,O){this.remainderData=null,this.config=void 0,this.config=O}var H=z.prototype;return H.resetTimeStamp=function(){},H.resetInitSegment=function(){},H.resetContiguity=function(){},z.probe=function(O){return Object(J.findBox)({data:O,start:0,end:Math.min(O.length,16384)},["moof"]).length>0},H.demux=function(O){var b=O,A=Object(U.dummyTrack)();if(this.config.progressive){this.remainderData&&(b=Object(J.appendUint8Array)(this.remainderData,O));var P=Object(J.segmentValidRange)(b);this.remainderData=P.remainder,A.samples=P.valid||new Uint8Array}else A.samples=b;return{audioTrack:Object(U.dummyTrack)(),avcTrack:A,id3Track:Object(U.dummyTrack)(),textTrack:Object(U.dummyTrack)()}},H.flush=function(){var O=Object(U.dummyTrack)();return O.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(U.dummyTrack)(),avcTrack:O,id3Track:Object(U.dummyTrack)(),textTrack:Object(U.dummyTrack)()}},H.demuxSampleAes=function(O,b,A){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},H.destroy=function(){},z}();D.minProbeByteLength=1024,Z.default=D},"./src/demux/mpegaudio.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"appendFrame",function(){return B}),_.d(Z,"parseHeader",function(){return O}),_.d(Z,"isHeaderPattern",function(){return b}),_.d(Z,"isHeader",function(){return A}),_.d(Z,"canParse",function(){return P}),_.d(Z,"probe",function(){return L});var J=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],D=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],z=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],H=[0,1,1,4];function B(w,y,h,o,l){if(h+24>y.length)return;var u=O(y,h);if(u&&h+u.frameLength<=y.length){var C=u.samplesPerFrame*9e4/u.sampleRate,v=o+l*C,m={unit:y.subarray(h,h+u.frameLength),pts:v,dts:v};return w.config=[],w.channelCount=u.channelCount,w.samplerate=u.sampleRate,w.samples.push(m),{sample:m,length:u.frameLength,missing:0}}}function O(w,y){var h=w[y+1]>>3&3,o=w[y+1]>>1&3,l=w[y+2]>>4&15,u=w[y+2]>>2&3;if(h!==1&&l!==0&&l!==15&&u!==3){var C=w[y+2]>>1&1,v=w[y+3]>>6,m=h===3?3-o:o===3?3:4,k=U[m*14+l-1]*1e3,x=h===3?0:h===2?1:2,f=D[x*3+u],p=v===3?1:2,d=z[h][o],a=H[o],E=d*8*a,g=Math.floor(d*k/f+C)*a;if(J===null){var S=navigator.userAgent||"",F=S.match(/Chrome\/(\d+)/i);J=F?parseInt(F[1]):0}var W=!!J&&J<=87;return W&&o===2&&k>=224e3&&v===0&&(w[y+3]=w[y+3]|128),{sampleRate:f,channelCount:p,frameLength:g,samplesPerFrame:E}}}function b(w,y){return w[y]===255&&(w[y+1]&224)===224&&(w[y+1]&6)!==0}function A(w,y){return y+1<w.length&&b(w,y)}function P(w,y){var h=4;return b(w,y)&&h<=w.length-y}function L(w,y){if(y+1<w.length&&b(w,y)){var h=4,o=O(w,y),l=h;o!=null&&o.frameLength&&(l=o.frameLength);var u=y+l;return u===w.length||A(w,u)}return!1}},"./src/demux/sample-aes.ts":function(fe,Z,_){"use strict";_.r(Z);var J=_("./src/crypt/decrypter.ts"),U=_("./src/demux/tsdemuxer.ts"),D=function(){function z(B,O,b){this.keyData=void 0,this.decrypter=void 0,this.keyData=b,this.decrypter=new J.default(B,O,{removePKCS7Padding:!1})}var H=z.prototype;return H.decryptBuffer=function(O,b){this.decrypter.decrypt(O,this.keyData.key.buffer,this.keyData.iv.buffer,b)},H.decryptAacSample=function(O,b,A,P){var L=O[b].unit,w=L.subarray(16,L.length-L.length%16),y=w.buffer.slice(w.byteOffset,w.byteOffset+w.length),h=this;this.decryptBuffer(y,function(o){var l=new Uint8Array(o);L.set(l,16),P||h.decryptAacSamples(O,b+1,A)})},H.decryptAacSamples=function(O,b,A){for(;;b++){if(b>=O.length){A();return}if(O[b].unit.length<32)continue;var P=this.decrypter.isSync();if(this.decryptAacSample(O,b,A,P),!P)return}},H.getAvcEncryptedData=function(O){for(var b=Math.floor((O.length-48)/160)*16+16,A=new Int8Array(b),P=0,L=32;L<=O.length-16;L+=160,P+=16)A.set(O.subarray(L,L+16),P);return A},H.getAvcDecryptedUnit=function(O,b){for(var A=new Uint8Array(b),P=0,L=32;L<=O.length-16;L+=160,P+=16)O.set(A.subarray(P,P+16),L);return O},H.decryptAvcSample=function(O,b,A,P,L,w){var y=Object(U.discardEPB)(L.data),h=this.getAvcEncryptedData(y),o=this;this.decryptBuffer(h.buffer,function(l){L.data=o.getAvcDecryptedUnit(y,l),w||o.decryptAvcSamples(O,b,A+1,P)})},H.decryptAvcSamples=function(O,b,A,P){if(O instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;b++,A=0){if(b>=O.length){P();return}for(var L=O[b].units;!(A>=L.length);A++){var w=L[A];if(w.data.length<=48||w.type!==1&&w.type!==5)continue;var y=this.decrypter.isSync();if(this.decryptAvcSample(O,b,A,P,w,y),!y)return}}},z}();Z.default=D},"./src/demux/transmuxer-interface.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"default",function(){return L});var J=_("./node_modules/webworkify-webpack/index.js"),U=_.n(J),D=_("./src/events.ts"),z=_("./src/demux/transmuxer.ts"),H=_("./src/utils/logger.ts"),B=_("./src/errors.ts"),O=_("./src/utils/mediasource-helper.ts"),b=_("./node_modules/eventemitter3/index.js"),A=_.n(b),P=Object(O.getMediaSource)()||{isTypeSupported:function(){return!1}},L=function(){function w(h,o,l,u){var C=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=h,this.id=o,this.onTransmuxComplete=l,this.onFlush=u;var v=h.config,m=function(d,a){a=a||{},a.frag=C.frag,a.id=C.id,h.trigger(d,a)};this.observer=new b.EventEmitter,this.observer.on(D.Events.FRAG_DECRYPTED,m),this.observer.on(D.Events.ERROR,m);var k={mp4:P.isTypeSupported("video/mp4"),mpeg:P.isTypeSupported("audio/mpeg"),mp3:P.isTypeSupported('audio/mp4; codecs="mp3"')},x=navigator.vendor;if(v.enableWorker&&typeof Worker!="undefined"){H.logger.log("demuxing in webworker");var f;try{f=this.worker=J("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),f.addEventListener("message",this.onwmsg),f.onerror=function(p){h.trigger(D.Events.ERROR,{type:B.ErrorTypes.OTHER_ERROR,details:B.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(p.message+" ("+p.filename+":"+p.lineno+")")})},f.postMessage({cmd:"init",typeSupported:k,vendor:x,id:o,config:JSON.stringify(v)})}catch(p){H.logger.warn("Error in worker:",p),H.logger.error("Error while initializing DemuxerWorker, fallback to inline"),f&&self.URL.revokeObjectURL(f.objectURL),this.transmuxer=new z.default(this.observer,k,v,x,o),this.worker=null}}else this.transmuxer=new z.default(this.observer,k,v,x,o)}var y=w.prototype;return y.destroy=function(){var o=this.worker;if(o)o.removeEventListener("message",this.onwmsg),o.terminate(),this.worker=null;else{var l=this.transmuxer;l&&(l.destroy(),this.transmuxer=null)}var u=this.observer;u&&u.removeAllListeners(),this.observer=null},y.push=function(o,l,u,C,v,m,k,x,f,p){var d=this;f.transmuxing.start=self.performance.now();var a=this.transmuxer,E=this.worker,g=m?m.start:v.start,S=v.decryptdata,F=this.frag,W=!(F&&v.cc===F.cc),K=!(F&&f.level===F.level),V=F?f.sn-F.sn:-1,M=this.part?f.part-this.part.index:1,I=!K&&(V===1||V===0&&M===1),$=self.performance.now();(K||V||v.stats.parsing.start===0)&&(v.stats.parsing.start=$),m&&(M||!I)&&(m.stats.parsing.start=$);var ae=new z.TransmuxState(W,I,x,K,g);if(!I||W){H.logger.log("[transmuxer-interface, "+v.type+"]: Starting new transmux session for sn: "+f.sn+" p: "+f.part+" level: "+f.level+" id: "+f.id+`
|
|
discontinuity: `+W+`
|
|
trackSwitch: `+K+`
|
|
contiguous: `+I+`
|
|
accurateTimeOffset: `+x+`
|
|
timeOffset: `+g);var he=new z.TransmuxConfig(u,C,l,k,p);this.configureTransmuxer(he)}if(this.frag=v,this.part=m,E)E.postMessage({cmd:"demux",data:o,decryptdata:S,chunkMeta:f,state:ae},o instanceof ArrayBuffer?[o]:[]);else if(a){var ge=a.push(o,S,f,ae);Object(z.isPromise)(ge)?ge.then(function(De){d.handleTransmuxComplete(De)}):this.handleTransmuxComplete(ge)}},y.flush=function(o){var l=this;o.transmuxing.start=self.performance.now();var u=this.transmuxer,C=this.worker;if(C)C.postMessage({cmd:"flush",chunkMeta:o});else if(u){var v=u.flush(o);Object(z.isPromise)(v)?v.then(function(m){l.handleFlushResult(m,o)}):this.handleFlushResult(v,o)}},y.handleFlushResult=function(o,l){var u=this;o.forEach(function(C){u.handleTransmuxComplete(C)}),this.onFlush(l)},y.onWorkerMessage=function(o){var l=o.data,u=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,u.trigger(l.event,l.data);break}}},y.configureTransmuxer=function(o){var l=this.worker,u=this.transmuxer;l?l.postMessage({cmd:"configure",config:o}):u&&u.configure(o)},y.handleTransmuxComplete=function(o){o.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(o)},w}()},"./src/demux/transmuxer-worker.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"default",function(){return B});var J=_("./src/demux/transmuxer.ts"),U=_("./src/events.ts"),D=_("./src/utils/logger.ts"),z=_("./node_modules/eventemitter3/index.js"),H=_.n(z);function B(L){var w=new z.EventEmitter,y=function(o,l){L.postMessage({event:o,data:l})};w.on(U.Events.FRAG_DECRYPTED,y),w.on(U.Events.ERROR,y),L.addEventListener("message",function(h){var o=h.data;switch(o.cmd){case"init":{var l=JSON.parse(o.config);L.transmuxer=new J.default(w,o.typeSupported,l,o.vendor,o.id),Object(D.enableLogs)(l.debug),y("init",null);break}case"configure":{L.transmuxer.configure(o.config);break}case"demux":{var u=L.transmuxer.push(o.data,o.decryptdata,o.chunkMeta,o.state);Object(J.isPromise)(u)?u.then(function(m){O(L,m)}):O(L,u);break}case"flush":{var C=o.chunkMeta,v=L.transmuxer.flush(C);Object(J.isPromise)(v)?v.then(function(m){A(L,m,C)}):A(L,v,C);break}default:break}})}function O(L,w){if(P(w.remuxResult))return;var y=[],h=w.remuxResult,o=h.audio,l=h.video;o&&b(y,o),l&&b(y,l),L.postMessage({event:"transmuxComplete",data:w},y)}function b(L,w){w.data1&&L.push(w.data1.buffer),w.data2&&L.push(w.data2.buffer)}function A(L,w,y){w.forEach(function(h){O(L,h)}),L.postMessage({event:"flush",data:y})}function P(L){return!L.audio&&!L.video&&!L.text&&!L.id3&&!L.initSegment}},"./src/demux/transmuxer.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"default",function(){return l}),_.d(Z,"isPromise",function(){return v}),_.d(Z,"TransmuxConfig",function(){return m}),_.d(Z,"TransmuxState",function(){return k});var J=_("./src/events.ts"),U=_("./src/errors.ts"),D=_("./src/crypt/decrypter.ts"),z=_("./src/demux/aacdemuxer.ts"),H=_("./src/demux/mp4demuxer.ts"),B=_("./src/demux/tsdemuxer.ts"),O=_("./src/demux/mp3demuxer.ts"),b=_("./src/remux/mp4-remuxer.ts"),A=_("./src/remux/passthrough-remuxer.ts"),P=_("./src/demux/chunk-cache.ts"),L=_("./src/utils/mp4-tools.ts"),w=_("./src/utils/logger.ts"),y;try{y=self.performance.now.bind(self.performance)}catch(x){w.logger.debug("Unable to use Performance API on this environment"),y=self.Date.now}var h=[{demux:B.default,remux:b.default},{demux:H.default,remux:A.default},{demux:z.default,remux:b.default},{demux:O.default,remux:b.default}],o=1024;h.forEach(function(x){var f=x.demux;o=Math.max(o,f.minProbeByteLength)});var l=function(){function x(p,d,a,E,g){this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.cache=new P.default,this.observer=p,this.typeSupported=d,this.config=a,this.vendor=E,this.id=g}var f=x.prototype;return f.configure=function(d){this.transmuxConfig=d,this.decrypter&&this.decrypter.reset()},f.push=function(d,a,E,g){var S=this,F=E.transmuxing;F.executeStart=y();var W=new Uint8Array(d),K=this.cache,V=this.config,M=this.currentTransmuxState,I=this.transmuxConfig;g&&(this.currentTransmuxState=g);var $=u(W,a);if($&&$.method==="AES-128"){var ae=this.getDecrypter();if(V.enableSoftwareAES){var he=ae.softwareDecrypt(W,$.key.buffer,$.iv.buffer);if(!he)return F.executeEnd=y(),C(E);W=new Uint8Array(he)}else return this.decryptionPromise=ae.webCryptoDecrypt(W,$.key.buffer,$.iv.buffer).then(function(be){var we=S.push(be,null,E);return S.decryptionPromise=null,we}),this.decryptionPromise}var ge=g||M,De=ge.contiguous,Se=ge.discontinuity,Re=ge.trackSwitch,Ce=ge.accurateTimeOffset,xe=ge.timeOffset,me=I.audioCodec,G=I.videoCodec,s=I.defaultInitPts,c=I.duration,R=I.initSegmentData;if((Se||Re)&&this.resetInitSegment(R,me,G,c),Se&&this.resetInitialTimestamp(s),De||this.resetContiguity(),this.needsProbing(W,Se,Re)){if(K.dataLength){var X=K.flush();W=Object(L.appendUint8Array)(X,W)}this.configureTransmuxer(W,I)}var N=this.transmux(W,$,xe,Ce,E),oe=this.currentTransmuxState;return oe.contiguous=!0,oe.discontinuity=!1,oe.trackSwitch=!1,F.executeEnd=y(),N},f.flush=function(d){var a=this,E=d.transmuxing;E.executeStart=y();var g=this.decrypter,S=this.cache,F=this.currentTransmuxState,W=this.decryptionPromise;if(W)return W.then(function(){return a.flush(d)});var K=[],V=F.timeOffset;if(g){var M=g.flush();M&&K.push(this.push(M,null,d))}var I=S.dataLength;S.reset();var $=this.demuxer,ae=this.remuxer;if(!$||!ae)return I>=o&&this.observer.emit(J.Events.ERROR,J.Events.ERROR,{type:U.ErrorTypes.MEDIA_ERROR,details:U.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),E.executeEnd=y(),[C(d)];var he=$.flush(V);return v(he)?he.then(function(ge){return a.flushRemux(K,ge,d),K}):(this.flushRemux(K,he,d),K)},f.flushRemux=function(d,a,E){var g=a.audioTrack,S=a.avcTrack,F=a.id3Track,W=a.textTrack,K=this.currentTransmuxState,V=K.accurateTimeOffset,M=K.timeOffset;w.logger.log("[transmuxer.ts]: Flushed fragment "+E.sn+(E.part>-1?" p: "+E.part:"")+" of level "+E.level);var I=this.remuxer.remux(g,S,F,W,M,V,!0,this.id);d.push({remuxResult:I,chunkMeta:E}),E.transmuxing.executeEnd=y()},f.resetInitialTimestamp=function(d){var a=this.demuxer,E=this.remuxer;if(!a||!E)return;a.resetTimeStamp(d),E.resetTimeStamp(d)},f.resetContiguity=function(){var d=this.demuxer,a=this.remuxer;if(!d||!a)return;d.resetContiguity(),a.resetNextTimestamp()},f.resetInitSegment=function(d,a,E,g){var S=this.demuxer,F=this.remuxer;if(!S||!F)return;S.resetInitSegment(a,E,g),F.resetInitSegment(d,a,E)},f.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},f.transmux=function(d,a,E,g,S){var F;return a&&a.method==="SAMPLE-AES"?F=this.transmuxSampleAes(d,a,E,g,S):F=this.transmuxUnencrypted(d,E,g,S),F},f.transmuxUnencrypted=function(d,a,E,g){var S=this.demuxer.demux(d,a,!1,!this.config.progressive),F=S.audioTrack,W=S.avcTrack,K=S.id3Track,V=S.textTrack,M=this.remuxer.remux(F,W,K,V,a,E,!1,this.id);return{remuxResult:M,chunkMeta:g}},f.transmuxSampleAes=function(d,a,E,g,S){var F=this;return this.demuxer.demuxSampleAes(d,a,E).then(function(W){var K=F.remuxer.remux(W.audioTrack,W.avcTrack,W.id3Track,W.textTrack,E,g,!1,F.id);return{remuxResult:K,chunkMeta:S}})},f.configureTransmuxer=function(d,a){for(var E=this.config,g=this.observer,S=this.typeSupported,F=this.vendor,W=a.audioCodec,K=a.defaultInitPts,V=a.duration,M=a.initSegmentData,I=a.videoCodec,$,ae=0,he=h.length;ae<he;ae++)if(h[ae].demux.probe(d)){$=h[ae];break}$||(w.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),$={demux:H.default,remux:A.default});var ge=this.demuxer,De=this.remuxer,Se=$.remux,Re=$.demux;(!De||!(De instanceof Se))&&(this.remuxer=new Se(g,E,S,F)),(!ge||!(ge instanceof Re))&&(this.demuxer=new Re(g,E,S),this.probe=Re.probe),this.resetInitSegment(M,W,I,V),this.resetInitialTimestamp(K)},f.needsProbing=function(d,a,E){return!this.demuxer||!this.remuxer||a||E},f.getDecrypter=function(){var d=this.decrypter;return d||(d=this.decrypter=new D.default(this.observer,this.config)),d},x}();function u(x,f){var p=null;return x.byteLength>0&&f!=null&&f.key!=null&&f.iv!==null&&f.method!=null&&(p=f),p}var C=function(f){return{remuxResult:{},chunkMeta:f}};function v(x){return"then"in x&&x.then instanceof Function}var m=function(f,p,d,a,E){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=f,this.videoCodec=p,this.initSegmentData=d,this.duration=a,this.defaultInitPts=E},k=function(f,p,d,a,E){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.discontinuity=f,this.contiguous=p,this.accurateTimeOffset=d,this.trackSwitch=a,this.timeOffset=E}},"./src/demux/tsdemuxer.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"discardEPB",function(){return C});var J=_("./src/demux/adts.ts"),U=_("./src/demux/mpegaudio.ts"),D=_("./src/demux/exp-golomb.ts"),z=_("./src/demux/id3.ts"),H=_("./src/demux/sample-aes.ts"),B=_("./src/events.ts"),O=_("./src/utils/mp4-tools.ts"),b=_("./src/utils/logger.ts"),A=_("./src/errors.ts"),P={video:1,audio:2,id3:3,text:4},L=function(){function v(k,x,f){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this.aacLastPTS=null,this._initPTS=null,this._initDTS=null,this._pmtId=-1,this._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=k,this.config=x,this.typeSupported=f}v.probe=function(x){var f=v.syncOffset(x);return f<0?!1:(f&&b.logger.warn("MPEG2-TS detected but first sync word found @ offset "+f+", junk ahead ?"),!0)},v.syncOffset=function(x){for(var f=Math.min(1e3,x.length-3*188),p=0;p<f;){if(x[p]===71&&x[p+188]===71&&x[p+2*188]===71)return p;p++}return-1},v.createTrack=function(x,f){return{container:x==="video"||x==="audio"?"video/mp2t":void 0,type:x,id:P[x],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:x==="audio"?f:void 0}};var m=v.prototype;return m.resetInitSegment=function(x,f,p){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=v.createTrack("video",p),this._audioTrack=v.createTrack("audio",p),this._id3Track=v.createTrack("id3",p),this._txtTrack=v.createTrack("text",p),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=x,this.videoCodec=f,this._duration=p},m.resetTimeStamp=function(){},m.resetContiguity=function(){var x=this._audioTrack,f=this._avcTrack,p=this._id3Track;x&&(x.pesData=null),f&&(f.pesData=null),p&&(p.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},m.demux=function(x,f,p,d){p===void 0&&(p=!1),d===void 0&&(d=!1),p||(this.sampleAes=null);var a,E=this._avcTrack,g=this._audioTrack,S=this._id3Track,F=E.pid,W=E.pesData,K=g.pid,V=S.pid,M=g.pesData,I=S.pesData,$=!1,ae=this.pmtParsed,he=this._pmtId,ge=x.length;if(this.remainderData&&(x=Object(O.appendUint8Array)(this.remainderData,x),ge=x.length,this.remainderData=null),ge<188&&!d)return this.remainderData=x,{audioTrack:g,avcTrack:E,id3Track:S,textTrack:this._txtTrack};var De=Math.max(0,v.syncOffset(x));ge-=(ge+De)%188,ge<x.byteLength&&!d&&(this.remainderData=new Uint8Array(x.buffer,ge,x.buffer.byteLength-ge));for(var Se=De;Se<ge;Se+=188)if(x[Se]===71){var Re=!!(x[Se+1]&64),Ce=((x[Se+1]&31)<<8)+x[Se+2],xe=(x[Se+3]&48)>>4,me=void 0;if(xe>1){if(me=Se+5+x[Se+4],me===Se+188)continue}else me=Se+4;switch(Ce){case F:Re&&(W&&(a=o(W))&&this.parseAVCPES(a,!1),W={data:[],size:0}),W&&(W.data.push(x.subarray(me,Se+188)),W.size+=Se+188-me);break;case K:Re&&(M&&(a=o(M))&&(g.isAAC?this.parseAACPES(a):this.parseMPEGPES(a)),M={data:[],size:0}),M&&(M.data.push(x.subarray(me,Se+188)),M.size+=Se+188-me);break;case V:Re&&(I&&(a=o(I))&&this.parseID3PES(a),I={data:[],size:0}),I&&(I.data.push(x.subarray(me,Se+188)),I.size+=Se+188-me);break;case 0:Re&&(me+=x[me]+1),he=this._pmtId=y(x,me);break;case he:{Re&&(me+=x[me]+1);var G=h(x,me,this.typeSupported.mpeg===!0||this.typeSupported.mp3===!0,p);F=G.avc,F>0&&(E.pid=F),K=G.audio,K>0&&(g.pid=K,g.isAAC=G.isAAC),V=G.id3,V>0&&(S.pid=V),$&&!ae&&(b.logger.log("reparse from beginning"),$=!1,Se=De-188),ae=this.pmtParsed=!0;break}case 17:case 8191:break;default:$=!0;break}}else this.observer.emit(B.Events.ERROR,B.Events.ERROR,{type:A.ErrorTypes.MEDIA_ERROR,details:A.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});E.pesData=W,g.pesData=M,S.pesData=I;var s={audioTrack:g,avcTrack:E,id3Track:S,textTrack:this._txtTrack};return d&&this.extractRemainingSamples(s),s},m.flush=function(){var x=this.remainderData;this.remainderData=null;var f;return x?f=this.demux(x,-1,!1,!0):f={audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(f),this.sampleAes?this.decrypt(f,this.sampleAes):f},m.extractRemainingSamples=function(x){var f=x.audioTrack,p=x.avcTrack,d=x.id3Track,a=p.pesData,E=f.pesData,g=d.pesData,S;a&&(S=o(a))?(this.parseAVCPES(S,!0),p.pesData=null):p.pesData=a,E&&(S=o(E))?(f.isAAC?this.parseAACPES(S):this.parseMPEGPES(S),f.pesData=null):(E!=null&&E.size&&b.logger.log("last AAC PES packet truncated,might overlap between fragments"),f.pesData=E),g&&(S=o(g))?(this.parseID3PES(S),d.pesData=null):d.pesData=g},m.demuxSampleAes=function(x,f,p){var d=this.demux(x,p,!0,!this.config.progressive),a=this.sampleAes=new H.default(this.observer,this.config,f);return this.decrypt(d,a)},m.decrypt=function(x,f){return new Promise(function(p){var d=x.audioTrack,a=x.avcTrack;d.samples&&d.isAAC?f.decryptAacSamples(d.samples,0,function(){a.samples?f.decryptAvcSamples(a.samples,0,0,function(){p(x)}):p(x)}):a.samples&&f.decryptAvcSamples(a.samples,0,0,function(){p(x)})})},m.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},m.parseAVCPES=function(x,f){var p=this,d=this._avcTrack,a=this.parseAVCNALu(x.data),E=!1,g=this.avcSample,S,F=!1;x.data=null,g&&a.length&&!d.audFound&&(l(g,d),g=this.avcSample=w(!1,x.pts,x.dts,"")),a.forEach(function(W){switch(W.type){case 1:{S=!0,g||(g=p.avcSample=w(!0,x.pts,x.dts,"")),E&&(g.debug+="NDR "),g.frame=!0;var K=W.data;if(F&&K.length>4){var V=new D.default(K).readSliceType();(V===2||V===4||V===7||V===9)&&(g.key=!0)}break}case 5:S=!0,g||(g=p.avcSample=w(!0,x.pts,x.dts,"")),E&&(g.debug+="IDR "),g.key=!0,g.frame=!0;break;case 6:{S=!0,E&&g&&(g.debug+="SEI ");var M=new D.default(C(W.data));M.readUByte();for(var I=0,$=0,ae=!1,he=0;!ae&&M.bytesAvailable>1;){I=0;do he=M.readUByte(),I+=he;while(he===255);$=0;do he=M.readUByte(),$+=he;while(he===255);if(I===4&&M.bytesAvailable!==0){ae=!0;var ge=M.readUByte();if(ge===181){var De=M.readUShort();if(De===49){var Se=M.readUInt();if(Se===1195456820){var Re=M.readUByte();if(Re===3){for(var Ce=M.readUByte(),xe=M.readUByte(),me=31&Ce,G=[Ce,xe],s=0;s<me;s++)G.push(M.readUByte()),G.push(M.readUByte()),G.push(M.readUByte());u(p._txtTrack.samples,{type:3,pts:x.pts,bytes:G})}}}}}else if(I===5&&M.bytesAvailable!==0){if(ae=!0,$>16){for(var c=[],R=0;R<16;R++)c.push(M.readUByte().toString(16)),(R===3||R===5||R===7||R===9)&&c.push("-");for(var X=$-16,N=new Uint8Array(X),oe=0;oe<X;oe++)N[oe]=M.readUByte();u(p._txtTrack.samples,{pts:x.pts,payloadType:I,uuid:c.join(""),userData:Object(z.utf8ArrayToStr)(N),userDataBytes:N})}}else if($<M.bytesAvailable)for(var be=0;be<$;be++)M.readUByte()}break}case 7:if(S=!0,F=!0,E&&g&&(g.debug+="SPS "),!d.sps){var we=new D.default(W.data),_e=we.readSPS();d.width=_e.width,d.height=_e.height,d.pixelRatio=_e.pixelRatio,d.sps=[W.data],d.duration=p._duration;for(var Le=W.data.subarray(1,4),Oe="avc1.",Me=0;Me<3;Me++){var Be=Le[Me].toString(16);Be.length<2&&(Be="0"+Be),Oe+=Be}d.codec=Oe}break;case 8:S=!0,E&&g&&(g.debug+="PPS "),d.pps||(d.pps=[W.data]);break;case 9:S=!1,d.audFound=!0,g&&l(g,d),g=p.avcSample=w(!1,x.pts,x.dts,E?"AUD ":"");break;case 12:S=!1;break;default:S=!1,g&&(g.debug+="unknown NAL "+W.type+" ");break}if(g&&S){var Ve=g.units;Ve.push(W)}}),f&&g&&(l(g,d),this.avcSample=null)},m.getLastNalUnit=function(){var x,f=this.avcSample,p;if(!f||f.units.length===0){var d=this._avcTrack.samples;f=d[d.length-1]}if((x=f)!==null&&x!==void 0&&x.units){var a=f.units;p=a[a.length-1]}return p},m.parseAVCNALu=function(x){var f=x.byteLength,p=this._avcTrack,d=p.naluState||0,a=d,E=[],g=0,S,F,W,K=-1,V=0;for(d===-1&&(K=0,V=x[0]&31,d=0,g=1);g<f;){if(S=x[g++],!d){d=S?0:1;continue}if(d===1){d=S?0:2;continue}if(!S)d=3;else if(S===1){if(K>=0){var M={data:x.subarray(K,g-d-1),type:V};E.push(M)}else{var I=this.getLastNalUnit();if(I&&(a&&g<=4-a&&(I.state&&(I.data=I.data.subarray(0,I.data.byteLength-a))),F=g-d-1,F>0)){var $=new Uint8Array(I.data.byteLength+F);$.set(I.data,0),$.set(x.subarray(0,F),I.data.byteLength),I.data=$,I.state=0}}g<f?(W=x[g]&31,K=g,V=W,d=0):d=-1}else d=0}if(K>=0&&d>=0){var ae={data:x.subarray(K,f),type:V,state:d};E.push(ae)}if(E.length===0){var he=this.getLastNalUnit();if(he){var ge=new Uint8Array(he.data.byteLength+x.byteLength);ge.set(he.data,0),ge.set(x,he.data.byteLength),he.data=ge}}return p.naluState=d,E},m.parseAACPES=function(x){var f=0,p=this._audioTrack,d=this.aacOverFlow,a=x.data;if(d){this.aacOverFlow=null;var E=d.sample.unit.byteLength,g=Math.min(d.missing,E),S=E-g;d.sample.unit.set(a.subarray(0,g),S),p.samples.push(d.sample),f=d.missing}var F,W;for(F=f,W=a.length;F<W-1&&!J.isHeader(a,F);F++);if(F!==f){var K,V;if(F<W-1?(K="AAC PES did not start with ADTS header,offset:"+F,V=!1):(K="no ADTS header found in AAC PES",V=!0),b.logger.warn("parsing error:"+K),this.observer.emit(B.Events.ERROR,B.Events.ERROR,{type:A.ErrorTypes.MEDIA_ERROR,details:A.ErrorDetails.FRAG_PARSING_ERROR,fatal:V,reason:K}),V)return}J.initTrackConfig(p,this.observer,a,F,this.audioCodec);var M;if(x.pts!==void 0)M=x.pts;else if(d){var I=J.getFrameDuration(p.samplerate);M=d.sample.pts+I}else{b.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}for(var $=0;F<W;)if(J.isHeader(a,F)){if(F+5<W){var ae=J.appendFrame(p,a,F,M,$);if(ae)if(ae.missing)this.aacOverFlow=ae;else{F+=ae.length,$++;continue}}break}else F++},m.parseMPEGPES=function(x){var f=x.data,p=f.length,d=0,a=0,E=x.pts;if(E===void 0){b.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;a<p;)if(U.isHeader(f,a)){var g=U.appendFrame(this._audioTrack,f,a,E,d);if(g)a+=g.length,d++;else break}else a++},m.parseID3PES=function(x){if(x.pts===void 0){b.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}this._id3Track.samples.push(x)},v}();L.minProbeByteLength=188;function w(v,m,k,x){return{key:v,frame:!1,pts:m,dts:k,units:[],debug:x,length:0}}function y(v,m){return(v[m+10]&31)<<8|v[m+11]}function h(v,m,k,x){var f={audio:-1,avc:-1,id3:-1,isAAC:!0},p=(v[m+1]&15)<<8|v[m+2],d=m+3+p-4,a=(v[m+10]&15)<<8|v[m+11];for(m+=12+a;m<d;){var E=(v[m+1]&31)<<8|v[m+2];switch(v[m]){case 207:if(!x){b.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:f.audio===-1&&(f.audio=E);break;case 21:f.id3===-1&&(f.id3=E);break;case 219:if(!x){b.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:f.avc===-1&&(f.avc=E);break;case 3:case 4:k?f.audio===-1&&(f.audio=E,f.isAAC=!1):b.logger.log("MPEG audio found, not supported in this browser");break;case 36:b.logger.warn("Unsupported HEVC stream type found");break;default:break}m+=((v[m+3]&15)<<8|v[m+4])+5}return f}function o(v){var m=0,k,x,f,p,d,a=v.data;if(!v||v.size===0)return null;for(;a[0].length<19&&a.length>1;){var E=new Uint8Array(a[0].length+a[1].length);E.set(a[0]),E.set(a[1],a[0].length),a[0]=E,a.splice(1,1)}k=a[0];var g=(k[0]<<16)+(k[1]<<8)+k[2];if(g===1){if(x=(k[4]<<8)+k[5],x&&x>v.size-6)return null;var S=k[7];S&192&&(p=(k[9]&14)*536870912+(k[10]&255)*4194304+(k[11]&254)*16384+(k[12]&255)*128+(k[13]&254)/2,S&64?(d=(k[14]&14)*536870912+(k[15]&255)*4194304+(k[16]&254)*16384+(k[17]&255)*128+(k[18]&254)/2,p-d>60*9e4&&(b.logger.warn(Math.round((p-d)/9e4)+"s delta between PTS and DTS, align them"),p=d)):d=p),f=k[8];var F=f+9;if(v.size<=F)return null;v.size-=F;for(var W=new Uint8Array(v.size),K=0,V=a.length;K<V;K++){k=a[K];var M=k.byteLength;if(F)if(F>M){F-=M;continue}else k=k.subarray(F),M-=F,F=0;W.set(k,m),m+=M}return x&&(x-=f+3),{data:W,pts:p,dts:d,len:x}}return null}function l(v,m){if(v.units.length&&v.frame){if(v.pts===void 0){var k=m.samples,x=k.length;if(x){var f=k[x-1];v.pts=f.pts,v.dts=f.dts}else{m.dropped++;return}}m.samples.push(v)}v.debug.length&&b.logger.log(v.pts+"/"+v.dts+":"+v.debug)}function u(v,m){var k=v.length;if(k>0){if(m.pts>=v[k-1].pts)v.push(m);else for(var x=k-1;x>=0;x--)if(m.pts<v[x].pts){v.splice(x,0,m);break}}else v.push(m)}function C(v){for(var m=v.byteLength,k=[],x=1;x<m-2;)v[x]===0&&v[x+1]===0&&v[x+2]===3?(k.push(x+2),x+=2):x++;if(k.length===0)return v;var f=m-k.length,p=new Uint8Array(f),d=0;for(x=0;x<f;d++,x++)d===k[0]&&(d++,k.shift()),p[x]=v[d];return p}Z.default=L},"./src/errors.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"ErrorTypes",function(){return J}),_.d(Z,"ErrorDetails",function(){return U});var J;(function(D){D.NETWORK_ERROR="networkError",D.MEDIA_ERROR="mediaError",D.KEY_SYSTEM_ERROR="keySystemError",D.MUX_ERROR="muxError",D.OTHER_ERROR="otherError"})(J||(J={}));var U;(function(D){D.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",D.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",D.KEY_SYSTEM_NO_SESSION="keySystemNoSession",D.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",D.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",D.MANIFEST_LOAD_ERROR="manifestLoadError",D.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",D.MANIFEST_PARSING_ERROR="manifestParsingError",D.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",D.LEVEL_EMPTY_ERROR="levelEmptyError",D.LEVEL_LOAD_ERROR="levelLoadError",D.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",D.LEVEL_SWITCH_ERROR="levelSwitchError",D.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",D.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",D.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",D.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",D.FRAG_LOAD_ERROR="fragLoadError",D.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",D.FRAG_DECRYPT_ERROR="fragDecryptError",D.FRAG_PARSING_ERROR="fragParsingError",D.REMUX_ALLOC_ERROR="remuxAllocError",D.KEY_LOAD_ERROR="keyLoadError",D.KEY_LOAD_TIMEOUT="keyLoadTimeOut",D.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",D.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",D.BUFFER_APPEND_ERROR="bufferAppendError",D.BUFFER_APPENDING_ERROR="bufferAppendingError",D.BUFFER_STALLED_ERROR="bufferStalledError",D.BUFFER_FULL_ERROR="bufferFullError",D.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",D.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",D.INTERNAL_EXCEPTION="internalException",D.INTERNAL_ABORTED="aborted",D.UNKNOWN="unknown"})(U||(U={}))},"./src/events.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"Events",function(){return J});var J;(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"})(J||(J={}))},"./src/hls.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"default",function(){return v});var J=_("./node_modules/url-toolkit/src/url-toolkit.js"),U=_.n(J),D=_("./src/loader/playlist-loader.ts"),z=_("./src/loader/key-loader.ts"),H=_("./src/controller/id3-track-controller.ts"),B=_("./src/controller/latency-controller.ts"),O=_("./src/controller/level-controller.ts"),b=_("./src/controller/fragment-tracker.ts"),A=_("./src/controller/stream-controller.ts"),P=_("./src/is-supported.ts"),L=_("./src/utils/logger.ts"),w=_("./src/config.ts"),y=_("./node_modules/eventemitter3/index.js"),h=_.n(y),o=_("./src/events.ts"),l=_("./src/errors.ts");function u(m,k){for(var x=0;x<k.length;x++){var f=k[x];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(m,f.key,f)}}function C(m,k,x){return k&&u(m.prototype,k),x&&u(m,x),m}var v=function(){m.isSupported=function(){return Object(P.isSupported)()};function m(x){x===void 0&&(x={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new y.EventEmitter,this._autoLevelCapping=void 0,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null;var f=this.config=Object(w.mergeConfig)(m.DefaultConfig,x);this.userConfig=x,Object(L.enableLogs)(f.debug),this._autoLevelCapping=-1,f.progressive&&Object(w.enableStreamingMode)(f);var p=f.abrController,d=f.bufferController,a=f.capLevelController,E=f.fpsController,g=this.abrController=new p(this),S=this.bufferController=new d(this),F=this.capLevelController=new a(this),W=new E(this),K=new D.default(this),V=new z.default(this),M=new H.default(this),I=this.levelController=new O.default(this),$=new b.FragmentTracker(this),ae=this.streamController=new A.default(this,$);F.setStreamController(ae),W.setStreamController(ae);var he=[I,ae];this.networkControllers=he;var ge=[K,V,g,S,F,W,M,$];this.audioTrackController=this.createController(f.audioTrackController,null,he),this.createController(f.audioStreamController,$,he),this.subtitleTrackController=this.createController(f.subtitleTrackController,null,he),this.createController(f.subtitleStreamController,$,he),this.createController(f.timelineController,null,ge),this.emeController=this.createController(f.emeController,null,ge),this.cmcdController=this.createController(f.cmcdController,null,ge),this.latencyController=this.createController(B.default,null,ge),this.coreComponents=ge}var k=m.prototype;return k.createController=function(f,p,d){if(f){var a=p?new f(this,p):new f(this);return d&&d.push(a),a}return null},k.on=function(f,p,d){d===void 0&&(d=this),this._emitter.on(f,p,d)},k.once=function(f,p,d){d===void 0&&(d=this),this._emitter.once(f,p,d)},k.removeAllListeners=function(f){this._emitter.removeAllListeners(f)},k.off=function(f,p,d,a){d===void 0&&(d=this),this._emitter.off(f,p,d,a)},k.listeners=function(f){return this._emitter.listeners(f)},k.emit=function(f,p,d){return this._emitter.emit(f,p,d)},k.trigger=function(f,p){if(this.config.debug)return this.emit(f,f,p);try{return this.emit(f,f,p)}catch(d){L.logger.error("An internal error happened while handling event "+f+'. Error message: "'+d.message+'". Here is a stacktrace:',d),this.trigger(o.Events.ERROR,{type:l.ErrorTypes.OTHER_ERROR,details:l.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:f,error:d})}return!1},k.listenerCount=function(f){return this._emitter.listenerCount(f)},k.destroy=function(){L.logger.log("destroy"),this.trigger(o.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(f){return f.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(f){return f.destroy()}),this.coreComponents.length=0},k.attachMedia=function(f){L.logger.log("attachMedia"),this._media=f,this.trigger(o.Events.MEDIA_ATTACHING,{media:f})},k.detachMedia=function(){L.logger.log("detachMedia"),this.trigger(o.Events.MEDIA_DETACHING,void 0),this._media=null},k.loadSource=function(f){this.stopLoad();var p=this.media,d=this.url,a=this.url=J.buildAbsoluteURL(self.location.href,f,{alwaysNormalize:!0});L.logger.log("loadSource:"+a),p&&d&&d!==a&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(p)),this.trigger(o.Events.MANIFEST_LOADING,{url:f})},k.startLoad=function(f){f===void 0&&(f=-1),L.logger.log("startLoad("+f+")"),this.networkControllers.forEach(function(p){p.startLoad(f)})},k.stopLoad=function(){L.logger.log("stopLoad"),this.networkControllers.forEach(function(f){f.stopLoad()})},k.swapAudioCodec=function(){L.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},k.recoverMediaError=function(){L.logger.log("recoverMediaError");var f=this._media;this.detachMedia(),f&&this.attachMedia(f)},k.removeLevel=function(f,p){p===void 0&&(p=0),this.levelController.removeLevel(f,p)},C(m,[{key:"levels",get:function(){var f=this.levelController.levels;return f||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(f){L.logger.log("set currentLevel:"+f),this.loadLevel=f,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(f){L.logger.log("set nextLevel:"+f),this.levelController.manualLevel=f,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(f){L.logger.log("set loadLevel:"+f),this.levelController.manualLevel=f}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(f){this.levelController.nextLoadLevel=f}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(f){L.logger.log("set firstLevel:"+f),this.levelController.firstLevel=f}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(f){L.logger.log("set startLevel:"+f),f!==-1&&(f=Math.max(f,this.minAutoLevel)),this.levelController.startLevel=f}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(f){var p=!!f;p!==this.config.capLevelToPlayerSize&&(p?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=p)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(f){this._autoLevelCapping!==f&&(L.logger.log("set autoLevelCapping:"+f),this._autoLevelCapping=f)}},{key:"bandwidthEstimate",get:function(){var f=this.abrController.bwEstimator;return f?f.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var f=this.levels,p=this.config.minAutoBitrate;if(!f)return 0;for(var d=f.length,a=0;a<d;a++)if(f[a].maxBitrate>p)return a;return 0}},{key:"maxAutoLevel",get:function(){var f=this.levels,p=this.autoLevelCapping,d;return p===-1&&f&&f.length?d=f.length-1:d=p,d}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(f){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,f)}},{key:"audioTracks",get:function(){var f=this.audioTrackController;return f?f.audioTracks:[]}},{key:"audioTrack",get:function(){var f=this.audioTrackController;return f?f.audioTrack:-1},set:function(f){var p=this.audioTrackController;p&&(p.audioTrack=f)}},{key:"subtitleTracks",get:function(){var f=this.subtitleTrackController;return f?f.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var f=this.subtitleTrackController;return f?f.subtitleTrack:-1},set:function(f){var p=this.subtitleTrackController;p&&(p.subtitleTrack=f)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var f=this.subtitleTrackController;return f?f.subtitleDisplay:!1},set:function(f){var p=this.subtitleTrackController;p&&(p.subtitleDisplay=f)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(f){this.config.lowLatencyMode=f}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}],[{key:"version",get:function(){return"1.1.2"}},{key:"Events",get:function(){return o.Events}},{key:"ErrorTypes",get:function(){return l.ErrorTypes}},{key:"ErrorDetails",get:function(){return l.ErrorDetails}},{key:"DefaultConfig",get:function(){return m.defaultConfig?m.defaultConfig:w.hlsDefaultConfig},set:function(f){m.defaultConfig=f}}]),m}();v.defaultConfig=void 0},"./src/is-supported.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"isSupported",function(){return D}),_.d(Z,"changeTypeSupported",function(){return z});var J=_("./src/utils/mediasource-helper.ts");function U(){return self.SourceBuffer||self.WebKitSourceBuffer}function D(){var H=Object(J.getMediaSource)();if(!H)return!1;var B=U(),O=H&&typeof H.isTypeSupported=="function"&&H.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),b=!B||B.prototype&&typeof B.prototype.appendBuffer=="function"&&typeof B.prototype.remove=="function";return!!O&&!!b}function z(){var H,B=U();return typeof(B==null||((H=B.prototype)===null||H===void 0)?void 0:H.changeType)=="function"}},"./src/loader/fragment-loader.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"default",function(){return L}),_.d(Z,"LoadError",function(){return y});var J=_("./src/polyfills/number.ts"),U=_("./src/errors.ts");function D(h,o){h.prototype=Object.create(o.prototype),h.prototype.constructor=h,b(h,o)}function z(h){var o=typeof Map=="function"?new Map:void 0;return z=function(u){if(u===null||!O(u))return u;if(typeof u!="function")throw new TypeError("Super expression must either be null or a function");if(typeof o!="undefined"){if(o.has(u))return o.get(u);o.set(u,C)}function C(){return H(u,arguments,A(this).constructor)}return C.prototype=Object.create(u.prototype,{constructor:{value:C,enumerable:!1,writable:!0,configurable:!0}}),b(C,u)},z(h)}function H(h,o,l){return B()?H=Reflect.construct:H=function(C,v,m){var k=[null];k.push.apply(k,v);var x=Function.bind.apply(C,k),f=new x;return m&&b(f,m.prototype),f},H.apply(null,arguments)}function B(){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 O(h){return Function.toString.call(h).indexOf("[native code]")!==-1}function b(h,o){return b=Object.setPrototypeOf||function(u,C){return u.__proto__=C,u},b(h,o)}function A(h){return A=Object.setPrototypeOf?Object.getPrototypeOf:function(l){return l.__proto__||Object.getPrototypeOf(l)},A(h)}var P=Math.pow(2,17),L=function(){function h(l){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=l}var o=h.prototype;return o.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},o.abort=function(){this.loader&&this.loader.abort()},o.load=function(u,C){var v=this,m=u.url;if(!m)return Promise.reject(new y({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:u,networkDetails:null},"Fragment does not have a "+(m?"part list":"url")));this.abort();var k=this.config,x=k.fLoader,f=k.loader;return new Promise(function(p,d){v.loader&&v.loader.destroy();var a=v.loader=u.loader=x?new x(k):new f(k),E=w(u),g={timeout:k.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:k.fragLoadingMaxRetryTimeout,highWaterMark:P};u.stats=a.stats,a.load(E,g,{onSuccess:function(F,W,K,V){v.resetLoader(u,a),p({frag:u,part:null,payload:F.data,networkDetails:V})},onError:function(F,W,K){v.resetLoader(u,a),d(new y({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:u,response:F,networkDetails:K}))},onAbort:function(F,W,K){v.resetLoader(u,a),d(new y({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:u,networkDetails:K}))},onTimeout:function(F,W,K){v.resetLoader(u,a),d(new y({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:u,networkDetails:K}))},onProgress:function(F,W,K,V){C&&C({frag:u,part:null,payload:K,networkDetails:V})}})})},o.loadPart=function(u,C,v){var m=this;this.abort();var k=this.config,x=k.fLoader,f=k.loader;return new Promise(function(p,d){m.loader&&m.loader.destroy();var a=m.loader=u.loader=x?new x(k):new f(k),E=w(u,C),g={timeout:k.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:k.fragLoadingMaxRetryTimeout,highWaterMark:P};C.stats=a.stats,a.load(E,g,{onSuccess:function(F,W,K,V){m.resetLoader(u,a),m.updateStatsFromPart(u,C);var M={frag:u,part:C,payload:F.data,networkDetails:V};v(M),p(M)},onError:function(F,W,K){m.resetLoader(u,a),d(new y({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:u,part:C,response:F,networkDetails:K}))},onAbort:function(F,W,K){u.stats.aborted=C.stats.aborted,m.resetLoader(u,a),d(new y({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:u,part:C,networkDetails:K}))},onTimeout:function(F,W,K){m.resetLoader(u,a),d(new y({type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:u,part:C,networkDetails:K}))}})})},o.updateStatsFromPart=function(u,C){var v=u.stats,m=C.stats,k=m.total;if(v.loaded+=m.loaded,k){var x=Math.round(u.duration/C.duration),f=Math.min(Math.round(v.loaded/k),x),p=x-f,d=p*Math.round(v.loaded/f);v.total=v.loaded+d}else v.total=Math.max(v.loaded,v.total);var a=v.loading,E=m.loading;a.start?a.first+=E.first-E.start:(a.start=E.start,a.first=E.first),a.end=E.end},o.resetLoader=function(u,C){u.loader=null,this.loader===C&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),C.destroy()},h}();function w(h,o){o===void 0&&(o=null);var l=o||h,u={frag:h,part:o,responseType:"arraybuffer",url:l.url,headers:{},rangeStart:0,rangeEnd:0},C=l.byteRangeStartOffset,v=l.byteRangeEndOffset;return Object(J.isFiniteNumber)(C)&&Object(J.isFiniteNumber)(v)&&(u.rangeStart=C,u.rangeEnd=v),u}var y=function(h){D(o,h);function o(l){for(var u,C=arguments.length,v=new Array(C>1?C-1:0),m=1;m<C;m++)v[m-1]=arguments[m];return u=h.call.apply(h,[this].concat(v))||this,u.data=void 0,u.data=l,u}return o}(z(Error))},"./src/loader/fragment.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"ElementaryStreamTypes",function(){return L}),_.d(Z,"BaseSegment",function(){return w}),_.d(Z,"Fragment",function(){return y}),_.d(Z,"Part",function(){return h});var J=_("./src/polyfills/number.ts"),U=_("./node_modules/url-toolkit/src/url-toolkit.js"),D=_.n(U),z=_("./src/utils/logger.ts"),H=_("./src/loader/level-key.ts"),B=_("./src/loader/load-stats.ts");function O(o,l){o.prototype=Object.create(l.prototype),o.prototype.constructor=o,b(o,l)}function b(o,l){return b=Object.setPrototypeOf||function(C,v){return C.__proto__=v,C},b(o,l)}function A(o,l){for(var u=0;u<l.length;u++){var C=l[u];C.enumerable=C.enumerable||!1,C.configurable=!0,"value"in C&&(C.writable=!0),Object.defineProperty(o,C.key,C)}}function P(o,l,u){return l&&A(o.prototype,l),u&&A(o,u),o}var L;(function(o){o.AUDIO="audio",o.VIDEO="video",o.AUDIOVIDEO="audiovideo"})(L||(L={}));var w=function(){function o(u){var C;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=(C={},C[L.AUDIO]=null,C[L.VIDEO]=null,C[L.AUDIOVIDEO]=null,C),this.baseurl=u}var l=o.prototype;return l.setByteRange=function(C,v){var m=C.split("@",2),k=[];m.length===1?k[0]=v?v.byteRangeEndOffset:0:k[0]=parseInt(m[1]),k[1]=parseInt(m[0])+k[0],this._byteRange=k},P(o,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Object(U.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(C){this._url=C}}]),o}(),y=function(o){O(l,o);function l(C,v){var m;return m=o.call(this,v)||this,m._decryptdata=null,m.rawProgramDateTime=null,m.programDateTime=null,m.tagList=[],m.duration=0,m.sn=0,m.levelkey=void 0,m.type=void 0,m.loader=null,m.level=-1,m.cc=0,m.startPTS=void 0,m.endPTS=void 0,m.appendedPTS=void 0,m.startDTS=void 0,m.endDTS=void 0,m.start=0,m.deltaPTS=void 0,m.maxStartPTS=void 0,m.minEndPTS=void 0,m.stats=new B.LoadStats,m.urlId=0,m.data=void 0,m.bitrateTest=!1,m.title=null,m.initSegment=null,m.type=C,m}var u=l.prototype;return u.createInitializationVector=function(v){for(var m=new Uint8Array(16),k=12;k<16;k++)m[k]=v>>8*(15-k)&255;return m},u.setDecryptDataFromLevelKey=function(v,m){var k=v;return(v==null?void 0:v.method)==="AES-128"&&v.uri&&!v.iv&&(k=H.LevelKey.fromURI(v.uri),k.method=v.method,k.iv=this.createInitializationVector(m),k.keyFormat="identity"),k},u.setElementaryStreamInfo=function(v,m,k,x,f,p){p===void 0&&(p=!1);var d=this.elementaryStreams,a=d[v];if(!a){d[v]={startPTS:m,endPTS:k,startDTS:x,endDTS:f,partial:p};return}a.startPTS=Math.min(a.startPTS,m),a.endPTS=Math.max(a.endPTS,k),a.startDTS=Math.min(a.startDTS,x),a.endDTS=Math.max(a.endDTS,f)},u.clearElementaryStreamInfo=function(){var v=this.elementaryStreams;v[L.AUDIO]=null,v[L.VIDEO]=null,v[L.AUDIOVIDEO]=null},P(l,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var v=this.sn;typeof v!="number"&&(this.levelkey&&this.levelkey.method==="AES-128"&&!this.levelkey.iv&&z.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),v=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,v)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(this.programDateTime===null)return null;if(!Object(J.isFiniteNumber)(this.programDateTime))return null;var v=Object(J.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+v*1e3}},{key:"encrypted",get:function(){var v;return!!((v=this.decryptdata)!==null&&v!==void 0&&v.keyFormat&&this.decryptdata.uri)}}]),l}(w),h=function(o){O(l,o);function l(u,C,v,m,k){var x;x=o.call(this,v)||this,x.fragOffset=0,x.duration=0,x.gap=!1,x.independent=!1,x.relurl=void 0,x.fragment=void 0,x.index=void 0,x.stats=new B.LoadStats,x.duration=u.decimalFloatingPoint("DURATION"),x.gap=u.bool("GAP"),x.independent=u.bool("INDEPENDENT"),x.relurl=u.enumeratedString("URI"),x.fragment=C,x.index=m;var f=u.enumeratedString("BYTERANGE");return f&&x.setByteRange(f,k),k&&(x.fragOffset=k.fragOffset+k.duration),x}return P(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 C=this.elementaryStreams;return!!(C.audio||C.video||C.audiovideo)}}]),l}(w)},"./src/loader/key-loader.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"default",function(){return z});var J=_("./src/events.ts"),U=_("./src/errors.ts"),D=_("./src/utils/logger.ts"),z=function(){function H(O){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=O,this._registerListeners()}var B=H.prototype;return B._registerListeners=function(){this.hls.on(J.Events.KEY_LOADING,this.onKeyLoading,this)},B._unregisterListeners=function(){this.hls.off(J.Events.KEY_LOADING,this.onKeyLoading)},B.destroy=function(){this._unregisterListeners();for(var b in this.loaders){var A=this.loaders[b];A&&A.destroy()}this.loaders={}},B.onKeyLoading=function(b,A){var P=A.frag,L=P.type,w=this.loaders[L];if(!P.decryptdata){D.logger.warn("Missing decryption data on fragment in onKeyLoading");return}var y=P.decryptdata.uri;if(y!==this.decrypturl||this.decryptkey===null){var h=this.hls.config;if(w&&(D.logger.warn("abort previous key loader for type:"+L),w.abort()),!y){D.logger.warn("key uri is falsy");return}var o=h.loader,l=P.loader=this.loaders[L]=new o(h);this.decrypturl=y,this.decryptkey=null;var u={url:y,frag:P,responseType:"arraybuffer"},C={timeout:h.fragLoadingTimeOut,maxRetry:0,retryDelay:h.fragLoadingRetryDelay,maxRetryDelay:h.fragLoadingMaxRetryTimeout,highWaterMark:0},v={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};l.load(u,C,v)}else this.decryptkey&&(P.decryptdata.key=this.decryptkey,this.hls.trigger(J.Events.KEY_LOADED,{frag:P}))},B.loadsuccess=function(b,A,P){var L=P.frag;if(!L.decryptdata){D.logger.error("after key load, decryptdata unset");return}this.decryptkey=L.decryptdata.key=new Uint8Array(b.data),L.loader=null,delete this.loaders[L.type],this.hls.trigger(J.Events.KEY_LOADED,{frag:L})},B.loaderror=function(b,A){var P=A.frag,L=P.loader;L&&L.abort(),delete this.loaders[P.type],this.hls.trigger(J.Events.ERROR,{type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:P,response:b})},B.loadtimeout=function(b,A){var P=A.frag,L=P.loader;L&&L.abort(),delete this.loaders[P.type],this.hls.trigger(J.Events.ERROR,{type:U.ErrorTypes.NETWORK_ERROR,details:U.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:P})},H}()},"./src/loader/level-details.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"LevelDetails",function(){return H});var J=_("./src/polyfills/number.ts");function U(B,O){for(var b=0;b<O.length;b++){var A=O[b];A.enumerable=A.enumerable||!1,A.configurable=!0,"value"in A&&(A.writable=!0),Object.defineProperty(B,A.key,A)}}function D(B,O,b){return O&&U(B.prototype,O),b&&U(B,b),B}var z=10,H=function(){function B(b){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=b}var O=B.prototype;return O.reloaded=function(A){if(!A){this.advanced=!0,this.updated=!0;return}var P=this.lastPartSn-A.lastPartSn,L=this.lastPartIndex-A.lastPartIndex;this.updated=this.endSN!==A.endSN||!!L||!!P,this.advanced=this.endSN>A.endSN||P>0||P===0&&L>0,this.updated||this.advanced?this.misses=Math.floor(A.misses*.6):this.misses=A.misses+1,this.availabilityDelay=A.availabilityDelay},D(B,[{key:"hasProgramDateTime",get:function(){return this.fragments.length?Object(J.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime):!1}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||z}},{key:"drift",get:function(){var A=this.driftEndTime-this.driftStartTime;if(A>0){var P=this.driftEnd-this.driftStart;return P*1e3/A}return 1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var A;return(A=this.partList)!==null&&A!==void 0&&A.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var A;return(A=this.fragments)!==null&&A!==void 0&&A.length?this.fragments[this.fragments.length-1].end:0}},{key:"age",get:function(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}},{key:"lastPartIndex",get:function(){var A;return(A=this.partList)!==null&&A!==void 0&&A.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var A;return(A=this.partList)!==null&&A!==void 0&&A.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),B}()},"./src/loader/level-key.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"LevelKey",function(){return H});var J=_("./node_modules/url-toolkit/src/url-toolkit.js"),U=_.n(J);function D(B,O){for(var b=0;b<O.length;b++){var A=O[b];A.enumerable=A.enumerable||!1,A.configurable=!0,"value"in A&&(A.writable=!0),Object.defineProperty(B,A.key,A)}}function z(B,O,b){return O&&D(B.prototype,O),b&&D(B,b),B}var H=function(){B.fromURL=function(b,A){return new B(b,A)},B.fromURI=function(b){return new B(b)};function B(O,b){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,b?this._uri=Object(J.buildAbsoluteURL)(O,b,{alwaysNormalize:!0}):this._uri=O}return z(B,[{key:"uri",get:function(){return this._uri}}]),B}()},"./src/loader/load-stats.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"LoadStats",function(){return J});var J=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(fe,Z,_){"use strict";_.r(Z),_.d(Z,"default",function(){return l});var J=_("./src/polyfills/number.ts"),U=_("./node_modules/url-toolkit/src/url-toolkit.js"),D=_.n(U),z=_("./src/loader/fragment.ts"),H=_("./src/loader/level-details.ts"),B=_("./src/loader/level-key.ts"),O=_("./src/utils/attr-list.ts"),b=_("./src/utils/logger.ts"),A=_("./src/utils/codecs.ts"),P=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,L=/#EXT-X-MEDIA:(.*)/g,w=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),y=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(PLAYLIST-TYPE):(.+)/.source,/#EXT-X-(MEDIA-SEQUENCE): *(\d+)/.source,/#EXT-X-(SKIP):(.+)/.source,/#EXT-X-(TARGETDURATION): *(\d+)/.source,/#EXT-X-(KEY):(.+)/.source,/#EXT-X-(START):(.+)/.source,/#EXT-X-(ENDLIST)/.source,/#EXT-X-(DISCONTINUITY-SEQ)UENCE: *(\d+)/.source,/#EXT-X-(DIS)CONTINUITY/.source,/#EXT-X-(VERSION):(\d+)/.source,/#EXT-X-(MAP):(.+)/.source,/#EXT-X-(SERVER-CONTROL):(.+)/.source,/#EXT-X-(PART-INF):(.+)/.source,/#EXT-X-(GAP)/.source,/#EXT-X-(BITRATE):\s*(\d+)/.source,/#EXT-X-(PART):(.+)/.source,/#EXT-X-(PRELOAD-HINT):(.+)/.source,/#EXT-X-(RENDITION-REPORT):(.+)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),h=/\.(mp4|m4s|m4v|m4a)$/i;function o(k){var x,f;return h.test((x=(f=U.parseURL(k))===null||f===void 0?void 0:f.path)!=null?x:"")}var l=function(){function k(){}return k.findGroup=function(f,p){for(var d=0;d<f.length;d++){var a=f[d];if(a.id===p)return a}},k.convertAVC1ToAVCOTI=function(f){var p=f.split(".");if(p.length>2){var d=p.shift()+".";return d+=parseInt(p.shift()).toString(16),d+=("000"+parseInt(p.shift()).toString(16)).substr(-4),d}return f},k.resolve=function(f,p){return U.buildAbsoluteURL(p,f,{alwaysNormalize:!0})},k.parseMasterPlaylist=function(f,p){var d=[],a={},E=!1;P.lastIndex=0;for(var g;(g=P.exec(f))!=null;)if(g[1]){var S=new O.AttrList(g[1]),F={attrs:S,bitrate:S.decimalInteger("AVERAGE-BANDWIDTH")||S.decimalInteger("BANDWIDTH"),name:S.NAME,url:k.resolve(g[2],p)},W=S.decimalResolution("RESOLUTION");W&&(F.width=W.width,F.height=W.height),u((S.CODECS||"").split(/[ ,]+/).filter(function(V){return V}),F),F.videoCodec&&F.videoCodec.indexOf("avc1")!==-1&&(F.videoCodec=k.convertAVC1ToAVCOTI(F.videoCodec)),d.push(F)}else if(g[3]){var K=new O.AttrList(g[3]);K["DATA-ID"]&&(E=!0,a[K["DATA-ID"]]=K)}return{levels:d,sessionData:E?a:null}},k.parseMasterPlaylistMedia=function(f,p,d,a){a===void 0&&(a=[]);var E,g=[],S=0;for(L.lastIndex=0;(E=L.exec(f))!==null;){var F=new O.AttrList(E[1]);if(F.TYPE===d){var W={attrs:F,bitrate:0,id:S++,groupId:F["GROUP-ID"],instreamId:F["INSTREAM-ID"],name:F.NAME||F.LANGUAGE||"",type:d,default:F.bool("DEFAULT"),autoselect:F.bool("AUTOSELECT"),forced:F.bool("FORCED"),lang:F.LANGUAGE,url:F.URI?k.resolve(F.URI,p):""};if(a.length){var K=k.findGroup(a,W.groupId)||a[0];C(W,K,"audioCodec"),C(W,K,"textCodec")}g.push(W)}}return g},k.parseLevelPlaylist=function(f,p,d,a,E){var g=new H.LevelDetails(p),S=g.fragments,F=null,W=0,K=0,V=0,M=0,I=null,$=new z.Fragment(a,p),ae,he,ge,De=-1,Se=!1;for(w.lastIndex=0,g.m3u8=f;(ae=w.exec(f))!==null;){Se&&(Se=!1,$=new z.Fragment(a,p),$.start=V,$.sn=W,$.cc=M,$.level=d,F&&($.initSegment=F,$.rawProgramDateTime=F.rawProgramDateTime));var Re=ae[1];if(Re){$.duration=parseFloat(Re);var Ce=(" "+ae[2]).slice(1);$.title=Ce||null,$.tagList.push(Ce?["INF",Re,Ce]:["INF",Re])}else if(ae[3])Object(J.isFiniteNumber)($.duration)&&($.start=V,ge&&($.levelkey=ge),$.sn=W,$.level=d,$.cc=M,$.urlId=E,S.push($),$.relurl=(" "+ae[3]).slice(1),m($,I),I=$,V+=$.duration,W++,K=0,Se=!0);else if(ae[4]){var xe=(" "+ae[4]).slice(1);I?$.setByteRange(xe,I):$.setByteRange(xe)}else if(ae[5])$.rawProgramDateTime=(" "+ae[5]).slice(1),$.tagList.push(["PROGRAM-DATE-TIME",$.rawProgramDateTime]),De===-1&&(De=S.length);else{if(ae=ae[0].match(y),!ae){b.logger.warn("No matches on slow regex match for level playlist!");continue}for(he=1;he<ae.length&&!(typeof ae[he]!="undefined");he++);var me=(" "+ae[he]).slice(1),G=(" "+ae[he+1]).slice(1),s=ae[he+2]?(" "+ae[he+2]).slice(1):"";switch(me){case"PLAYLIST-TYPE":g.type=G.toUpperCase();break;case"MEDIA-SEQUENCE":W=g.startSN=parseInt(G);break;case"SKIP":{var c=new O.AttrList(G),R=c.decimalInteger("SKIPPED-SEGMENTS");if(Object(J.isFiniteNumber)(R)){g.skippedSegments=R;for(var X=R;X--;)S.unshift(null);W+=R}var N=c.enumeratedString("RECENTLY-REMOVED-DATERANGES");N&&(g.recentlyRemovedDateranges=N.split(" "));break}case"TARGETDURATION":g.targetduration=parseFloat(G);break;case"VERSION":g.version=parseInt(G);break;case"EXTM3U":break;case"ENDLIST":g.live=!1;break;case"#":(G||s)&&$.tagList.push(s?[G,s]:[G]);break;case"DIS":M++;case"GAP":$.tagList.push([me]);break;case"BITRATE":$.tagList.push([me,G]);break;case"DISCONTINUITY-SEQ":M=parseInt(G);break;case"KEY":{var oe,be=new O.AttrList(G),we=be.enumeratedString("METHOD"),_e=be.URI,Le=be.hexadecimalInteger("IV"),Oe=be.enumeratedString("KEYFORMATVERSIONS"),Me=be.enumeratedString("KEYID"),Be=(oe=be.enumeratedString("KEYFORMAT"))!=null?oe:"identity",Ve=["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"];if(Ve.indexOf(Be)>-1){b.logger.warn("Keyformat "+Be+" is not supported from the manifest");continue}else if(Be!=="identity")continue;we&&(ge=B.LevelKey.fromURL(p,_e),_e&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(we)>=0&&(ge.method=we,ge.keyFormat=Be,Me&&(ge.keyID=Me),Oe&&(ge.keyFormatVersions=Oe),ge.iv=Le));break}case"START":{var Xe=new O.AttrList(G),ze=Xe.decimalFloatingPoint("TIME-OFFSET");Object(J.isFiniteNumber)(ze)&&(g.startTimeOffset=ze);break}case"MAP":{var rt=new O.AttrList(G);$.relurl=rt.URI,rt.BYTERANGE&&$.setByteRange(rt.BYTERANGE),$.level=d,$.sn="initSegment",ge&&($.levelkey=ge),$.initSegment=null,F=$,Se=!0;break}case"SERVER-CONTROL":{var je=new O.AttrList(G);g.canBlockReload=je.bool("CAN-BLOCK-RELOAD"),g.canSkipUntil=je.optionalFloat("CAN-SKIP-UNTIL",0),g.canSkipDateRanges=g.canSkipUntil>0&&je.bool("CAN-SKIP-DATERANGES"),g.partHoldBack=je.optionalFloat("PART-HOLD-BACK",0),g.holdBack=je.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{var We=new O.AttrList(G);g.partTarget=We.decimalFloatingPoint("PART-TARGET");break}case"PART":{var ke=g.partList;ke||(ke=g.partList=[]);var Je=K>0?ke[ke.length-1]:void 0,qe=K++,se=new z.Part(new O.AttrList(G),$,p,qe,Je);ke.push(se),$.duration+=se.duration;break}case"PRELOAD-HINT":{var q=new O.AttrList(G);g.preloadHint=q;break}case"RENDITION-REPORT":{var ee=new O.AttrList(G);g.renditionReports=g.renditionReports||[],g.renditionReports.push(ee);break}default:b.logger.warn("line parsed but not handled: "+ae);break}}}I&&!I.relurl?(S.pop(),V-=I.duration,g.partList&&(g.fragmentHint=I)):g.partList&&(m($,I),$.cc=M,g.fragmentHint=$);var ne=S.length,le=S[0],te=S[ne-1];if(V+=g.skippedSegments*g.targetduration,V>0&&ne&&te){g.averagetargetduration=V/ne;var ie=te.sn;g.endSN=ie!=="initSegment"?ie:0,le&&(g.startCC=le.cc,le.initSegment||g.fragments.every(function(ue){return ue.relurl&&o(ue.relurl)})&&(b.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),$=new z.Fragment(a,p),$.relurl=te.relurl,$.level=d,$.sn="initSegment",le.initSegment=$,g.needSidxRanges=!0))}else g.endSN=0,g.startCC=0;return g.fragmentHint&&(V+=g.fragmentHint.duration),g.totalduration=V,g.endCC=M,De>0&&v(S,De),g},k}();function u(k,x){["video","audio","text"].forEach(function(f){var p=k.filter(function(a){return Object(A.isCodecType)(a,f)});if(p.length){var d=p.filter(function(a){return a.lastIndexOf("avc1",0)===0||a.lastIndexOf("mp4a",0)===0});x[f+"Codec"]=d.length>0?d[0]:p[0],k=k.filter(function(a){return p.indexOf(a)===-1})}}),x.unknownCodecs=k}function C(k,x,f){var p=x[f];p&&(k[f]=p)}function v(k,x){for(var f=k[x],p=x;p--;){var d=k[p];if(!d)return;d.programDateTime=f.programDateTime-d.duration*1e3,f=d}}function m(k,x){k.rawProgramDateTime?k.programDateTime=Date.parse(k.rawProgramDateTime):x!=null&&x.programDateTime&&(k.programDateTime=x.endProgramDateTime),Object(J.isFiniteNumber)(k.programDateTime)||(k.programDateTime=null,k.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(fe,Z,_){"use strict";_.r(Z);var J=_("./src/polyfills/number.ts"),U=_("./src/events.ts"),D=_("./src/errors.ts"),z=_("./src/utils/logger.ts"),H=_("./src/utils/mp4-tools.ts"),B=_("./src/loader/m3u8-parser.ts"),O=_("./src/types/loader.ts"),b=_("./src/utils/attr-list.ts");function A(w){var y=w.type;switch(y){case O.PlaylistContextType.AUDIO_TRACK:return O.PlaylistLevelType.AUDIO;case O.PlaylistContextType.SUBTITLE_TRACK:return O.PlaylistLevelType.SUBTITLE;default:return O.PlaylistLevelType.MAIN}}function P(w,y){var h=w.url;return(h===void 0||h.indexOf("data:")===0)&&(h=y.url),h}var L=function(){function w(h){this.hls=void 0,this.loaders=Object.create(null),this.hls=h,this.registerListeners()}var y=w.prototype;return y.registerListeners=function(){var o=this.hls;o.on(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.on(U.Events.LEVEL_LOADING,this.onLevelLoading,this),o.on(U.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.on(U.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},y.unregisterListeners=function(){var o=this.hls;o.off(U.Events.MANIFEST_LOADING,this.onManifestLoading,this),o.off(U.Events.LEVEL_LOADING,this.onLevelLoading,this),o.off(U.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),o.off(U.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},y.createInternalLoader=function(o){var l=this.hls.config,u=l.pLoader,C=l.loader,v=u||C,m=new v(l);return o.loader=m,this.loaders[o.type]=m,m},y.getInternalLoader=function(o){return this.loaders[o.type]},y.resetInternalLoader=function(o){this.loaders[o]&&delete this.loaders[o]},y.destroyInternalLoaders=function(){for(var o in this.loaders){var l=this.loaders[o];l&&l.destroy(),this.resetInternalLoader(o)}},y.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},y.onManifestLoading=function(o,l){var u=l.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:O.PlaylistContextType.MANIFEST,url:u,deliveryDirectives:null})},y.onLevelLoading=function(o,l){var u=l.id,C=l.level,v=l.url,m=l.deliveryDirectives;this.load({id:u,groupId:null,level:C,responseType:"text",type:O.PlaylistContextType.LEVEL,url:v,deliveryDirectives:m})},y.onAudioTrackLoading=function(o,l){var u=l.id,C=l.groupId,v=l.url,m=l.deliveryDirectives;this.load({id:u,groupId:C,level:null,responseType:"text",type:O.PlaylistContextType.AUDIO_TRACK,url:v,deliveryDirectives:m})},y.onSubtitleTrackLoading=function(o,l){var u=l.id,C=l.groupId,v=l.url,m=l.deliveryDirectives;this.load({id:u,groupId:C,level:null,responseType:"text",type:O.PlaylistContextType.SUBTITLE_TRACK,url:v,deliveryDirectives:m})},y.load=function(o){var l,u=this.hls.config,C=this.getInternalLoader(o);if(C){var v=C.context;if(v&&v.url===o.url){z.logger.trace("[playlist-loader]: playlist request ongoing");return}z.logger.log("[playlist-loader]: aborting previous loader for type: "+o.type),C.abort()}var m,k,x,f;switch(o.type){case O.PlaylistContextType.MANIFEST:m=u.manifestLoadingMaxRetry,k=u.manifestLoadingTimeOut,x=u.manifestLoadingRetryDelay,f=u.manifestLoadingMaxRetryTimeout;break;case O.PlaylistContextType.LEVEL:case O.PlaylistContextType.AUDIO_TRACK:case O.PlaylistContextType.SUBTITLE_TRACK:m=0,k=u.levelLoadingTimeOut;break;default:m=u.levelLoadingMaxRetry,k=u.levelLoadingTimeOut,x=u.levelLoadingRetryDelay,f=u.levelLoadingMaxRetryTimeout;break}if(C=this.createInternalLoader(o),(l=o.deliveryDirectives)!==null&&l!==void 0&&l.part){var p;if(o.type===O.PlaylistContextType.LEVEL&&o.level!==null?p=this.hls.levels[o.level].details:o.type===O.PlaylistContextType.AUDIO_TRACK&&o.id!==null?p=this.hls.audioTracks[o.id].details:o.type===O.PlaylistContextType.SUBTITLE_TRACK&&o.id!==null&&(p=this.hls.subtitleTracks[o.id].details),p){var d=p.partTarget,a=p.targetduration;d&&a&&(k=Math.min(Math.max(d*3,a*.8)*1e3,k))}}var E={timeout:k,maxRetry:m,retryDelay:x,maxRetryDelay:f,highWaterMark:0},g={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};C.load(o,E,g)},y.loadsuccess=function(o,l,u,C){if(C===void 0&&(C=null),u.isSidxRequest){this.handleSidxRequest(o,u),this.handlePlaylistLoaded(o,l,u,C);return}this.resetInternalLoader(u.type);var v=o.data;if(v.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(o,u,"no EXTM3U delimiter",C);return}l.parsing.start=performance.now(),v.indexOf("#EXTINF:")>0||v.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(o,l,u,C):this.handleMasterPlaylist(o,l,u,C)},y.loaderror=function(o,l,u){u===void 0&&(u=null),this.handleNetworkError(l,u,!1,o)},y.loadtimeout=function(o,l,u){u===void 0&&(u=null),this.handleNetworkError(l,u,!0)},y.handleMasterPlaylist=function(o,l,u,C){var v=this.hls,m=o.data,k=P(o,u),x=B.default.parseMasterPlaylist(m,k),f=x.levels,p=x.sessionData;if(!f.length){this.handleManifestParsingError(o,u,"no level found in manifest",C);return}var d=f.map(function(W){return{id:W.attrs.AUDIO,audioCodec:W.audioCodec}}),a=f.map(function(W){return{id:W.attrs.SUBTITLES,textCodec:W.textCodec}}),E=B.default.parseMasterPlaylistMedia(m,k,"AUDIO",d),g=B.default.parseMasterPlaylistMedia(m,k,"SUBTITLES",a),S=B.default.parseMasterPlaylistMedia(m,k,"CLOSED-CAPTIONS");if(E.length){var F=E.some(function(W){return!W.url});!F&&f[0].audioCodec&&!f[0].attrs.AUDIO&&(z.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),E.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new b.AttrList({}),bitrate:0,url:""}))}v.trigger(U.Events.MANIFEST_LOADED,{levels:f,audioTracks:E,subtitles:g,captions:S,url:k,stats:l,networkDetails:C,sessionData:p})},y.handleTrackOrLevelPlaylist=function(o,l,u,C){var v=this.hls,m=u.id,k=u.level,x=u.type,f=P(o,u),p=Object(J.isFiniteNumber)(m)?m:0,d=Object(J.isFiniteNumber)(k)?k:p,a=A(u),E=B.default.parseLevelPlaylist(o.data,f,d,a,p);if(!E.fragments.length){v.trigger(U.Events.ERROR,{type:D.ErrorTypes.NETWORK_ERROR,details:D.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:f,reason:"no fragments found in level",level:typeof u.level=="number"?u.level:void 0});return}if(x===O.PlaylistContextType.MANIFEST){var g={attrs:new b.AttrList({}),bitrate:0,details:E,name:"",url:f};v.trigger(U.Events.MANIFEST_LOADED,{levels:[g],audioTracks:[],url:f,stats:l,networkDetails:C,sessionData:null})}if(l.parsing.end=performance.now(),E.needSidxRanges){var S,F=(S=E.fragments[0].initSegment)===null||S===void 0?void 0:S.url;this.load({url:F,isSidxRequest:!0,type:x,level:k,levelDetails:E,id:m,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null});return}u.levelDetails=E,this.handlePlaylistLoaded(o,l,u,C)},y.handleSidxRequest=function(o,l){var u=Object(H.parseSegmentIndex)(new Uint8Array(o.data));if(!u)return;var C=u.references,v=l.levelDetails;C.forEach(function(m,k){var x=m.info,f=v.fragments[k];f.byteRange.length===0&&f.setByteRange(String(1+x.end-x.start)+"@"+String(x.start)),f.initSegment&&f.initSegment.setByteRange(String(u.moovEndOffset)+"@0")})},y.handleManifestParsingError=function(o,l,u,C){this.hls.trigger(U.Events.ERROR,{type:D.ErrorTypes.NETWORK_ERROR,details:D.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:l.type===O.PlaylistContextType.MANIFEST,url:o.url,reason:u,response:o,context:l,networkDetails:C})},y.handleNetworkError=function(o,l,u,C){u===void 0&&(u=!1),z.logger.warn("[playlist-loader]: A network "+(u?"timeout":"error")+" occurred while loading "+o.type+" level: "+o.level+" id: "+o.id+' group-id: "'+o.groupId+'"');var v=D.ErrorDetails.UNKNOWN,m=!1,k=this.getInternalLoader(o);switch(o.type){case O.PlaylistContextType.MANIFEST:v=u?D.ErrorDetails.MANIFEST_LOAD_TIMEOUT:D.ErrorDetails.MANIFEST_LOAD_ERROR,m=!0;break;case O.PlaylistContextType.LEVEL:v=u?D.ErrorDetails.LEVEL_LOAD_TIMEOUT:D.ErrorDetails.LEVEL_LOAD_ERROR,m=!1;break;case O.PlaylistContextType.AUDIO_TRACK:v=u?D.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:D.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,m=!1;break;case O.PlaylistContextType.SUBTITLE_TRACK:v=u?D.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:D.ErrorDetails.SUBTITLE_LOAD_ERROR,m=!1;break}k&&this.resetInternalLoader(o.type);var x={type:D.ErrorTypes.NETWORK_ERROR,details:v,fatal:m,url:o.url,loader:k,context:o,networkDetails:l};C&&(x.response=C),this.hls.trigger(U.Events.ERROR,x)},y.handlePlaylistLoaded=function(o,l,u,C){var v=u.type,m=u.level,k=u.id,x=u.groupId,f=u.loader,p=u.levelDetails,d=u.deliveryDirectives;if(!(p!=null&&p.targetduration)){this.handleManifestParsingError(o,u,"invalid target duration",C);return}if(!f)return;p.live&&(f.getCacheAge&&(p.ageHeader=f.getCacheAge()||0),(!f.getCacheAge||isNaN(p.ageHeader))&&(p.ageHeader=0));switch(v){case O.PlaylistContextType.MANIFEST:case O.PlaylistContextType.LEVEL:this.hls.trigger(U.Events.LEVEL_LOADED,{details:p,level:m||0,id:k||0,stats:l,networkDetails:C,deliveryDirectives:d});break;case O.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(U.Events.AUDIO_TRACK_LOADED,{details:p,id:k||0,groupId:x||"",stats:l,networkDetails:C,deliveryDirectives:d});break;case O.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(U.Events.SUBTITLE_TRACK_LOADED,{details:p,id:k||0,groupId:x||"",stats:l,networkDetails:C,deliveryDirectives:d});break}},w}();Z.default=L},"./src/polyfills/number.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"isFiniteNumber",function(){return J}),_.d(Z,"MAX_SAFE_INTEGER",function(){return U});var J=Number.isFinite||function(D){return typeof D=="number"&&isFinite(D)},U=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(fe,Z,_){"use strict";_.r(Z);var J=function(){function U(){}return U.getSilentFrame=function(z,H){switch(z){case"mp4a.40.2":if(H===1)return new Uint8Array([0,200,0,128,35,128]);if(H===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(H===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(H===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(H===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(H===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(H===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(H===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(H===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}();Z.default=J},"./src/remux/mp4-generator.ts":function(fe,Z,_){"use strict";_.r(Z);var J=Math.pow(2,32)-1,U=function(){function D(){}return D.init=function(){D.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 H;for(H in D.types)D.types.hasOwnProperty(H)&&(D.types[H]=[H.charCodeAt(0),H.charCodeAt(1),H.charCodeAt(2),H.charCodeAt(3)]);var B=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]),O=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]);D.HDLR_TYPES={video:B,audio:O};var b=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),A=new Uint8Array([0,0,0,0,0,0,0,0]);D.STTS=D.STSC=D.STCO=A,D.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),D.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),D.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),D.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var P=new Uint8Array([105,115,111,109]),L=new Uint8Array([97,118,99,49]),w=new Uint8Array([0,0,0,1]);D.FTYP=D.box(D.types.ftyp,P,w,P,L),D.DINF=D.box(D.types.dinf,D.box(D.types.dref,b))},D.box=function(H){for(var B=8,O=arguments.length,b=new Array(O>1?O-1:0),A=1;A<O;A++)b[A-1]=arguments[A];for(var P=b.length,L=P;P--;)B+=b[P].byteLength;var w=new Uint8Array(B);for(w[0]=B>>24&255,w[1]=B>>16&255,w[2]=B>>8&255,w[3]=B&255,w.set(H,4),P=0,B=8;P<L;P++)w.set(b[P],B),B+=b[P].byteLength;return w},D.hdlr=function(H){return D.box(D.types.hdlr,D.HDLR_TYPES[H])},D.mdat=function(H){return D.box(D.types.mdat,H)},D.mdhd=function(H,B){B*=H;var O=Math.floor(B/(J+1)),b=Math.floor(B%(J+1));return D.box(D.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,H>>24&255,H>>16&255,H>>8&255,H&255,O>>24,O>>16&255,O>>8&255,O&255,b>>24,b>>16&255,b>>8&255,b&255,85,196,0,0]))},D.mdia=function(H){return D.box(D.types.mdia,D.mdhd(H.timescale,H.duration),D.hdlr(H.type),D.minf(H))},D.mfhd=function(H){return D.box(D.types.mfhd,new Uint8Array([0,0,0,0,H>>24,H>>16&255,H>>8&255,H&255]))},D.minf=function(H){return H.type==="audio"?D.box(D.types.minf,D.box(D.types.smhd,D.SMHD),D.DINF,D.stbl(H)):D.box(D.types.minf,D.box(D.types.vmhd,D.VMHD),D.DINF,D.stbl(H))},D.moof=function(H,B,O){return D.box(D.types.moof,D.mfhd(H),D.traf(O,B))},D.moov=function(H){for(var B=H.length,O=[];B--;)O[B]=D.trak(H[B]);return D.box.apply(null,[D.types.moov,D.mvhd(H[0].timescale,H[0].duration)].concat(O).concat(D.mvex(H)))},D.mvex=function(H){for(var B=H.length,O=[];B--;)O[B]=D.trex(H[B]);return D.box.apply(null,[D.types.mvex].concat(O))},D.mvhd=function(H,B){B*=H;var O=Math.floor(B/(J+1)),b=Math.floor(B%(J+1)),A=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,H>>24&255,H>>16&255,H>>8&255,H&255,O>>24,O>>16&255,O>>8&255,O&255,b>>24,b>>16&255,b>>8&255,b&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 D.box(D.types.mvhd,A)},D.sdtp=function(H){var B=H.samples||[],O=new Uint8Array(4+B.length),b,A;for(b=0;b<B.length;b++)A=B[b].flags,O[b+4]=A.dependsOn<<4|A.isDependedOn<<2|A.hasRedundancy;return D.box(D.types.sdtp,O)},D.stbl=function(H){return D.box(D.types.stbl,D.stsd(H),D.box(D.types.stts,D.STTS),D.box(D.types.stsc,D.STSC),D.box(D.types.stsz,D.STSZ),D.box(D.types.stco,D.STCO))},D.avc1=function(H){var B=[],O=[],b,A,P;for(b=0;b<H.sps.length;b++)A=H.sps[b],P=A.byteLength,B.push(P>>>8&255),B.push(P&255),B=B.concat(Array.prototype.slice.call(A));for(b=0;b<H.pps.length;b++)A=H.pps[b],P=A.byteLength,O.push(P>>>8&255),O.push(P&255),O=O.concat(Array.prototype.slice.call(A));var L=D.box(D.types.avcC,new Uint8Array([1,B[3],B[4],B[5],252|3,224|H.sps.length].concat(B).concat([H.pps.length]).concat(O))),w=H.width,y=H.height,h=H.pixelRatio[0],o=H.pixelRatio[1];return D.box(D.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,w>>8&255,w&255,y>>8&255,y&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),L,D.box(D.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),D.box(D.types.pasp,new Uint8Array([h>>24,h>>16&255,h>>8&255,h&255,o>>24,o>>16&255,o>>8&255,o&255])))},D.esds=function(H){var B=H.config.length;return new Uint8Array([0,0,0,0,3,23+B,0,1,0,4,15+B,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([B]).concat(H.config).concat([6,1,2]))},D.mp4a=function(H){var B=H.samplerate;return D.box(D.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,H.channelCount,0,16,0,0,0,0,B>>8&255,B&255,0,0]),D.box(D.types.esds,D.esds(H)))},D.mp3=function(H){var B=H.samplerate;return D.box(D.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,H.channelCount,0,16,0,0,0,0,B>>8&255,B&255,0,0]))},D.stsd=function(H){return H.type==="audio"?!H.isAAC&&H.codec==="mp3"?D.box(D.types.stsd,D.STSD,D.mp3(H)):D.box(D.types.stsd,D.STSD,D.mp4a(H)):D.box(D.types.stsd,D.STSD,D.avc1(H))},D.tkhd=function(H){var B=H.id,O=H.duration*H.timescale,b=H.width,A=H.height,P=Math.floor(O/(J+1)),L=Math.floor(O%(J+1));return D.box(D.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,B>>24&255,B>>16&255,B>>8&255,B&255,0,0,0,0,P>>24,P>>16&255,P>>8&255,P&255,L>>24,L>>16&255,L>>8&255,L&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,b>>8&255,b&255,0,0,A>>8&255,A&255,0,0]))},D.traf=function(H,B){var O=D.sdtp(H),b=H.id,A=Math.floor(B/(J+1)),P=Math.floor(B%(J+1));return D.box(D.types.traf,D.box(D.types.tfhd,new Uint8Array([0,0,0,0,b>>24,b>>16&255,b>>8&255,b&255])),D.box(D.types.tfdt,new Uint8Array([1,0,0,0,A>>24,A>>16&255,A>>8&255,A&255,P>>24,P>>16&255,P>>8&255,P&255])),D.trun(H,O.length+16+20+8+16+8+8),O)},D.trak=function(H){return H.duration=H.duration||4294967295,D.box(D.types.trak,D.tkhd(H),D.mdia(H))},D.trex=function(H){var B=H.id;return D.box(D.types.trex,new Uint8Array([0,0,0,0,B>>24,B>>16&255,B>>8&255,B&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},D.trun=function(H,B){var O=H.samples||[],b=O.length,A=12+16*b,P=new Uint8Array(A),L,w,y,h,o,l;for(B+=8+A,P.set([0,0,15,1,b>>>24&255,b>>>16&255,b>>>8&255,b&255,B>>>24&255,B>>>16&255,B>>>8&255,B&255],0),L=0;L<b;L++)w=O[L],y=w.duration,h=w.size,o=w.flags,l=w.cts,P.set([y>>>24&255,y>>>16&255,y>>>8&255,y&255,h>>>24&255,h>>>16&255,h>>>8&255,h&255,o.isLeading<<2|o.dependsOn,o.isDependedOn<<6|o.hasRedundancy<<4|o.paddingValue<<1|o.isNonSync,o.degradPrio&240<<8,o.degradPrio&15,l>>>24&255,l>>>16&255,l>>>8&255,l&255],12+16*L);return D.box(D.types.trun,P)},D.initSegment=function(H){D.types||D.init();var B=D.moov(H),O=new Uint8Array(D.FTYP.byteLength+B.byteLength);return O.set(D.FTYP),O.set(B,D.FTYP.byteLength),O},D}();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,Z.default=U},"./src/remux/mp4-remuxer.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"default",function(){return l}),_.d(Z,"normalizePts",function(){return u});var J=_("./src/polyfills/number.ts"),U=_("./src/remux/aac-helper.ts"),D=_("./src/remux/mp4-generator.ts"),z=_("./src/events.ts"),H=_("./src/errors.ts"),B=_("./src/utils/logger.ts"),O=_("./src/types/loader.ts"),b=_("./src/utils/timescale-conversion.ts");function A(){return A=Object.assign||function(k){for(var x=1;x<arguments.length;x++){var f=arguments[x];for(var p in f)Object.prototype.hasOwnProperty.call(f,p)&&(k[p]=f[p])}return k},A.apply(this,arguments)}var P=10*1e3,L=1024,w=1152,y=null,h=null,o=!1,l=function(){function k(f,p,d,a){if(a===void 0&&(a=""),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=f,this.config=p,this.typeSupported=d,this.ISGenerated=!1,y===null){var E=navigator.userAgent||"",g=E.match(/Chrome\/(\d+)/i);y=g?parseInt(g[1]):0}if(h===null){var S=navigator.userAgent.match(/Safari\/(\d+)/i);h=S?parseInt(S[1]):0}o=!!y&&y<75||!!h&&h<600}var x=k.prototype;return x.destroy=function(){},x.resetTimeStamp=function(p){B.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=p},x.resetNextTimestamp=function(){B.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},x.resetInitSegment=function(){B.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},x.getVideoStartPts=function(p){var d=!1,a=p.reduce(function(E,g){var S=g.pts-E;return S<-4294967296?(d=!0,u(E,g.pts)):S>0?E:g.pts},p[0].pts);return d&&B.logger.debug("PTS rollover detected"),a},x.remux=function(p,d,a,E,g,S,F,W){var K,V,M,I,$,ae,he=g,ge=g,De=p.pid>-1,Se=d.pid>-1,Re=d.samples.length,Ce=p.samples.length>0,xe=Re>1,me=(!De||Ce)&&(!Se||xe)||this.ISGenerated||F;if(me){this.ISGenerated||(M=this.generateIS(p,d,g));var G=this.isVideoContiguous,s=-1;if(xe&&(s=C(d.samples),!G&&this.config.forceKeyFrameOnDiscontinuity))if(ae=!0,s>0){B.logger.warn("[mp4-remuxer]: Dropped "+s+" out of "+Re+" video samples due to a missing keyframe");var c=this.getVideoStartPts(d.samples);d.samples=d.samples.slice(s),d.dropped+=s,ge+=(d.samples[0].pts-c)/(d.timescale||9e4)}else s===-1&&(B.logger.warn("[mp4-remuxer]: No keyframe found out of "+Re+" video samples"),ae=!1);if(this.ISGenerated){if(Ce&&xe){var R=this.getVideoStartPts(d.samples),X=u(p.samples[0].pts,R)-R,N=X/d.inputTimeScale;he+=Math.max(0,N),ge+=Math.max(0,-N)}if(Ce){if(p.samplerate||(B.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),M=this.generateIS(p,d,g)),V=this.remuxAudio(p,he,this.isAudioContiguous,S,Se||xe||W===O.PlaylistLevelType.AUDIO?ge:void 0),xe){var oe=V?V.endPTS-V.startPTS:0;d.inputTimeScale||(B.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),M=this.generateIS(p,d,g)),K=this.remuxVideo(d,ge,G,oe)}}else xe&&(K=this.remuxVideo(d,ge,G,0));K&&(K.firstKeyFrame=s,K.independent=s!==-1)}}return this.ISGenerated&&(a.samples.length&&($=this.remuxID3(a,g)),E.samples.length&&(I=this.remuxText(E,g))),{audio:V,video:K,initSegment:M,independent:ae,text:I,id3:$}},x.generateIS=function(p,d,a){var E=p.samples,g=d.samples,S=this.typeSupported,F={},W=!Object(J.isFiniteNumber)(this._initPTS),K="audio/mp4",V,M,I;if(W&&(V=M=Infinity),p.config&&E.length&&(p.timescale=p.samplerate,p.isAAC||(S.mpeg?(K="audio/mpeg",p.codec=""):S.mp3&&(p.codec="mp3")),F.audio={id:"audio",container:K,codec:p.codec,initSegment:!p.isAAC&&S.mpeg?new Uint8Array(0):D.default.initSegment([p]),metadata:{channelCount:p.channelCount}},W&&(I=p.inputTimeScale,V=M=E[0].pts-Math.round(I*a))),d.sps&&d.pps&&g.length&&(d.timescale=d.inputTimeScale,F.video={id:"main",container:"video/mp4",codec:d.codec,initSegment:D.default.initSegment([d]),metadata:{width:d.width,height:d.height}},W)){I=d.inputTimeScale;var $=this.getVideoStartPts(g),ae=Math.round(I*a);M=Math.min(M,u(g[0].dts,$)-ae),V=Math.min(V,$-ae)}if(Object.keys(F).length)return this.ISGenerated=!0,W&&(this._initPTS=V,this._initDTS=M),{tracks:F,initPTS:V,timescale:I}},x.remuxVideo=function(p,d,a,E){var g=p.inputTimeScale,S=p.samples,F=[],W=S.length,K=this._initPTS,V=this.nextAvcDts,M=8,I,$,ae,he=Number.POSITIVE_INFINITY,ge=Number.NEGATIVE_INFINITY,De=0,Se=!1;if(!a||V===null){var Re=d*g,Ce=S[0].pts-u(S[0].dts,S[0].pts);V=Re-Ce}for(var xe=0;xe<W;xe++){var me=S[xe];if(me.pts=u(me.pts-K,V),me.dts=u(me.dts-K,V),me.dts>me.pts){var G=9e4*.2;De=Math.max(Math.min(De,me.pts-me.dts),-1*G)}me.dts<S[xe>0?xe-1:xe].dts&&(Se=!0)}Se&&S.sort(function(xt,st){var nt=xt.dts-st.dts,wt=xt.pts-st.pts;return nt||wt}),$=S[0].dts,ae=S[S.length-1].dts;var s=Math.round((ae-$)/(W-1));if(De<0){if(De<s*-2){B.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(b.toMsFromMpegTsClock)(-s,!0)+" ms");for(var c=De,R=0;R<W;R++)S[R].dts=c=Math.max(c,S[R].pts-s),S[R].pts=Math.max(c,S[R].pts)}else{B.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(b.toMsFromMpegTsClock)(De,!0)+" ms to overcome this issue");for(var X=0;X<W;X++)S[X].dts=S[X].dts+De}$=S[0].dts}if(a){var N=$-V,oe=N>s,be=N<-1;if(oe||be){oe?B.logger.warn("AVC: "+Object(b.toMsFromMpegTsClock)(N,!0)+" ms ("+N+"dts) hole between fragments detected, filling it"):B.logger.warn("AVC: "+Object(b.toMsFromMpegTsClock)(-N,!0)+" ms ("+N+"dts) overlapping between fragments detected"),$=V;var we=S[0].pts-N;S[0].dts=$,S[0].pts=we,B.logger.log("Video: First PTS/DTS adjusted: "+Object(b.toMsFromMpegTsClock)(we,!0)+"/"+Object(b.toMsFromMpegTsClock)($,!0)+", delta: "+Object(b.toMsFromMpegTsClock)(N,!0)+" ms")}}o&&($=Math.max(0,$));for(var _e=0,Le=0,Oe=0;Oe<W;Oe++){for(var Me=S[Oe],Be=Me.units,Ve=Be.length,Xe=0,ze=0;ze<Ve;ze++)Xe+=Be[ze].data.length;Le+=Xe,_e+=Ve,Me.length=Xe,Me.dts=Math.max(Me.dts,$),Me.pts=Math.max(Me.pts,Me.dts,0),he=Math.min(Me.pts,he),ge=Math.max(Me.pts,ge)}ae=S[W-1].dts;var rt=Le+4*_e+8,je;try{je=new Uint8Array(rt)}catch(xt){this.observer.emit(z.Events.ERROR,z.Events.ERROR,{type:H.ErrorTypes.MUX_ERROR,details:H.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:rt,reason:"fail allocating video mdat "+rt});return}var We=new DataView(je.buffer);We.setUint32(0,rt),je.set(D.default.types.mdat,4);for(var ke=0;ke<W;ke++){for(var Je=S[ke],qe=Je.units,se=0,q=0,ee=qe.length;q<ee;q++){var ne=qe[q],le=ne.data,te=ne.data.byteLength;We.setUint32(M,te),M+=4,je.set(le,M),M+=te,se+=4+te}if(ke<W-1)I=S[ke+1].dts-Je.dts;else{var ie=this.config,ue=Je.dts-S[ke>0?ke-1:ke].dts;if(ie.stretchShortVideoTrack&&this.nextAudioPts!==null){var de=Math.floor(ie.maxBufferHole*g),ye=(E?he+E*g:this.nextAudioPts)-Je.pts;ye>de?(I=ye-ue,I<0&&(I=ue),B.logger.log("[mp4-remuxer]: It is approximately "+ye/90+" ms to the next segment; using duration "+I/90+" ms for the last video frame.")):I=ue}else I=ue}var Ee=Math.round(Je.pts-Je.dts);F.push(new v(Je.key,I,se,Ee))}if(F.length&&y&&y<70){var Pe=F[0].flags;Pe.dependsOn=2,Pe.isNonSync=0}console.assert(I!==void 0,"mp4SampleDuration must be computed"),this.nextAvcDts=V=ae+I,this.isVideoContiguous=!0;var Ue=D.default.moof(p.sequenceNumber++,$,A({},p,{samples:F})),Qe="video",tt={data1:Ue,data2:je,startPTS:he/g,endPTS:(ge+I)/g,startDTS:$/g,endDTS:V/g,type:Qe,hasAudio:!1,hasVideo:!0,nb:F.length,dropped:p.dropped};return p.samples=[],p.dropped=0,console.assert(je.length,"MDAT length must not be zero"),tt},x.remuxAudio=function(p,d,a,E,g){var S=p.inputTimeScale,F=p.samplerate?p.samplerate:S,W=S/F,K=p.isAAC?L:w,V=K*W,M=this._initPTS,I=!p.isAAC&&this.typeSupported.mpeg,$=[],ae=p.samples,he=I?0:8,ge=this.nextAudioPts||-1,De=d*S;if(this.isAudioContiguous=a=a||ae.length&&ge>0&&(E&&Math.abs(De-ge)<9e3||Math.abs(u(ae[0].pts-M,De)-ge)<20*V),ae.forEach(function(le){le.pts=u(le.pts-M,De)}),!a||ge<0){if(ae=ae.filter(function(le){return le.pts>=0}),!ae.length)return;g===0?ge=0:E?ge=Math.max(0,De):ge=ae[0].pts}if(p.isAAC)for(var Se=g!==void 0,Re=this.config.maxAudioFramesDrift,Ce=0,xe=ge;Ce<ae.length;Ce++){var me=ae[Ce],G=me.pts,s=G-xe,c=Math.abs(1e3*s/S);if(s<=-Re*V&&Se)Ce===0&&(B.logger.warn("Audio frame @ "+(G/S).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*s/S)+" ms."),this.nextAudioPts=ge=xe=G);else if(s>=Re*V&&c<P&&Se){var R=Math.round(s/V);xe=G-R*V,xe<0&&(R--,xe+=V),Ce===0&&(this.nextAudioPts=ge=xe),B.logger.warn("[mp4-remuxer]: Injecting "+R+" audio frame @ "+(xe/S).toFixed(3)+"s due to "+Math.round(1e3*s/S)+" ms gap.");for(var X=0;X<R;X++){var N=Math.max(xe,0),oe=U.default.getSilentFrame(p.manifestCodec||p.codec,p.channelCount);oe||(B.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),oe=me.unit.subarray()),ae.splice(Ce,0,{unit:oe,pts:N}),xe+=V,Ce++}}me.pts=xe,xe+=V}for(var be=null,we=null,_e,Le=0,Oe=ae.length;Oe--;)Le+=ae[Oe].unit.byteLength;for(var Me=0,Be=ae.length;Me<Be;Me++){var Ve=ae[Me],Xe=Ve.unit,ze=Ve.pts;if(we!==null){var rt=$[Me-1];rt.duration=Math.round((ze-we)/W)}else if(a&&p.isAAC&&(ze=ge),be=ze,Le>0){Le+=he;try{_e=new Uint8Array(Le)}catch(le){this.observer.emit(z.Events.ERROR,z.Events.ERROR,{type:H.ErrorTypes.MUX_ERROR,details:H.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:Le,reason:"fail allocating audio mdat "+Le});return}if(!I){var je=new DataView(_e.buffer);je.setUint32(0,Le),_e.set(D.default.types.mdat,4)}}else return;_e.set(Xe,he);var We=Xe.byteLength;he+=We,$.push(new v(!0,K,We,0)),we=ze}var ke=$.length;if(!ke)return;var Je=$[$.length-1];this.nextAudioPts=ge=we+W*Je.duration;var qe=I?new Uint8Array(0):D.default.moof(p.sequenceNumber++,be/W,A({},p,{samples:$}));p.samples=[];var se=be/S,q=ge/S,ee="audio",ne={data1:qe,data2:_e,startPTS:se,endPTS:q,startDTS:se,endDTS:q,type:ee,hasAudio:!0,hasVideo:!1,nb:ke};return this.isAudioContiguous=!0,console.assert(_e.length,"MDAT length must not be zero"),ne},x.remuxEmptyAudio=function(p,d,a,E){var g=p.inputTimeScale,S=p.samplerate?p.samplerate:g,F=g/S,W=this.nextAudioPts,K=(W!==null?W:E.startDTS*g)+this._initDTS,V=E.endDTS*g+this._initDTS,M=F*L,I=Math.ceil((V-K)/M),$=U.default.getSilentFrame(p.manifestCodec||p.codec,p.channelCount);if(B.logger.warn("[mp4-remuxer]: remux empty Audio"),!$){B.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}for(var ae=[],he=0;he<I;he++){var ge=K+he*M;ae.push({unit:$,pts:ge,dts:ge})}return p.samples=ae,this.remuxAudio(p,d,a,!1)},x.remuxID3=function(p,d){var a=p.samples.length;if(!a)return;for(var E=p.inputTimeScale,g=this._initPTS,S=this._initDTS,F=0;F<a;F++){var W=p.samples[F];W.pts=u(W.pts-g,d*E)/E,W.dts=u(W.dts-S,d*E)/E}var K=p.samples;return p.samples=[],{samples:K}},x.remuxText=function(p,d){var a=p.samples.length;if(!a)return;for(var E=p.inputTimeScale,g=this._initPTS,S=0;S<a;S++){var F=p.samples[S];F.pts=u(F.pts-g,d*E)/E}p.samples.sort(function(K,V){return K.pts-V.pts});var W=p.samples;return p.samples=[],{samples:W}},k}();function u(k,x){var f;if(x===null)return k;for(x<k?f=-8589934592:f=8589934592;Math.abs(k-x)>4294967296;)k+=f;return k}function C(k){for(var x=0;x<k.length;x++)if(k[x].key)return x;return-1}var v=function(x,f,p,d){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=f,this.size=p,this.cts=d,this.flags=new m(x)},m=function(x){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=x?2:1,this.isNonSync=x?0:1}},"./src/remux/passthrough-remuxer.ts":function(fe,Z,_){"use strict";_.r(Z);var J=_("./src/polyfills/number.ts"),U=_("./src/utils/mp4-tools.ts"),D=_("./src/loader/fragment.ts"),z=_("./src/utils/logger.ts"),H=function(){function b(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=void 0,this.initTracks=void 0,this.lastEndDTS=null}var A=b.prototype;return A.destroy=function(){},A.resetTimeStamp=function(L){this.initPTS=L,this.lastEndDTS=null},A.resetNextTimestamp=function(){this.lastEndDTS=null},A.resetInitSegment=function(L,w,y){this.audioCodec=w,this.videoCodec=y,this.generateInitSegment(L),this.emitInitSegment=!0},A.generateInitSegment=function(L){var w=this.audioCodec,y=this.videoCodec;if(!L||!L.byteLength){this.initTracks=void 0,this.initData=void 0;return}var h=this.initData=Object(U.parseInitSegment)(L);w||(w=O(h.audio,D.ElementaryStreamTypes.AUDIO)),y||(y=O(h.video,D.ElementaryStreamTypes.VIDEO));var o={};h.audio&&h.video?o.audiovideo={container:"video/mp4",codec:w+","+y,initSegment:L,id:"main"}:h.audio?o.audio={container:"audio/mp4",codec:w,initSegment:L,id:"audio"}:h.video?o.video={container:"video/mp4",codec:y,initSegment:L,id:"main"}:z.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=o},A.remux=function(L,w,y,h,o){var l=this.initPTS,u=this.lastEndDTS,C={audio:void 0,video:void 0,text:h,id3:y,initSegment:void 0};Object(J.isFiniteNumber)(u)||(u=this.lastEndDTS=o||0);var v=w.samples;if(!v||!v.length)return C;var m={initPTS:void 0,timescale:1},k=this.initData;if((!k||!k.length)&&(this.generateInitSegment(v),k=this.initData),!k||!k.length)return z.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),C;this.emitInitSegment&&(m.tracks=this.initTracks,this.emitInitSegment=!1),Object(J.isFiniteNumber)(l)||(this.initPTS=m.initPTS=l=B(k,v,u));var x=Object(U.getDuration)(v,k),f=u,p=x+f;Object(U.offsetStartDTS)(k,v,l),x>0?this.lastEndDTS=p:(z.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var d=!!k.audio,a=!!k.video,E="";d&&(E+="audio"),a&&(E+="video");var g={data1:v,startPTS:f,startDTS:f,endPTS:p,endDTS:p,type:E,hasAudio:d,hasVideo:a,nb:1,dropped:0};return C.audio=g.type==="audio"?g:void 0,C.video=g.type!=="audio"?g:void 0,C.text=h,C.id3=y,C.initSegment=m,C},b}(),B=function(A,P,L){return Object(U.getStartDTS)(A,P)-L};function O(b,A){var P=b==null?void 0:b.codec;return P&&P.length>4?P:P==="hvc1"?"hvc1.1.c.L120.90":P==="av01"?"av01.0.04M.08":P==="avc1"||A===D.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}Z.default=H},"./src/task-loop.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"default",function(){return J});var J=function(){function U(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var D=U.prototype;return D.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},D.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},D.onHandlerDestroyed=function(){},D.hasInterval=function(){return!!this._tickInterval},D.hasNextTick=function(){return!!this._tickTimer},D.setInterval=function(H){return this._tickInterval?!1:(this._tickInterval=self.setInterval(this._boundTick,H),!0)},D.clearInterval=function(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1},D.clearNextTick=function(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1},D.tick=function(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},D.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},D.doTick=function(){},U}()},"./src/types/cmcd.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"CMCDVersion",function(){return J}),_.d(Z,"CMCDObjectType",function(){return U}),_.d(Z,"CMCDStreamingFormat",function(){return D}),_.d(Z,"CMCDStreamType",function(){return z});var J=1,U;(function(H){H.MANIFEST="m",H.AUDIO="a",H.VIDEO="v",H.MUXED="av",H.INIT="i",H.CAPTION="c",H.TIMED_TEXT="tt",H.KEY="k",H.OTHER="o"})(U||(U={}));var D;(function(H){H.DASH="d",H.HLS="h",H.SMOOTH="s",H.OTHER="o"})(D||(D={}));var z;(function(H){H.VOD="v",H.LIVE="l"})(z||(z={}))},"./src/types/level.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"HlsSkip",function(){return D}),_.d(Z,"getSkipValue",function(){return z}),_.d(Z,"HlsUrlParameters",function(){return H}),_.d(Z,"Level",function(){return B});function J(O,b){for(var A=0;A<b.length;A++){var P=b[A];P.enumerable=P.enumerable||!1,P.configurable=!0,"value"in P&&(P.writable=!0),Object.defineProperty(O,P.key,P)}}function U(O,b,A){return b&&J(O.prototype,b),A&&J(O,A),O}var D;(function(O){O.No="",O.Yes="YES",O.v2="v2"})(D||(D={}));function z(O,b){var A=O.canSkipUntil,P=O.canSkipDateRanges,L=O.endSN,w=b!==void 0?b-L:0;return A&&w<A?P?D.v2:D.Yes:D.No}var H=function(){function O(A,P,L){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=A,this.part=P,this.skip=L}var b=O.prototype;return b.addDirectives=function(P){var L=new self.URL(P);return this.msn!==void 0&&L.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&L.searchParams.set("_HLS_part",this.part.toString()),this.skip&&L.searchParams.set("_HLS_skip",this.skip),L.toString()},O}(),B=function(){function O(b){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=[b.url],this.attrs=b.attrs,this.bitrate=b.bitrate,b.details&&(this.details=b.details),this.id=b.id||0,this.name=b.name,this.width=b.width||0,this.height=b.height||0,this.audioCodec=b.audioCodec,this.videoCodec=b.videoCodec,this.unknownCodecs=b.unknownCodecs,this.codecSet=[b.videoCodec,b.audioCodec].filter(function(A){return A}).join(",").replace(/\.[^.,]+/g,"")}return U(O,[{key:"maxBitrate",get:function(){return Math.max(this.realBitrate,this.bitrate)}},{key:"uri",get:function(){return this.url[this._urlId]||""}},{key:"urlId",get:function(){return this._urlId},set:function(A){var P=A%this.url.length;this._urlId!==P&&(this.details=void 0,this._urlId=P)}}]),O}()},"./src/types/loader.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"PlaylistContextType",function(){return J}),_.d(Z,"PlaylistLevelType",function(){return U});var J;(function(D){D.MANIFEST="manifest",D.LEVEL="level",D.AUDIO_TRACK="audioTrack",D.SUBTITLE_TRACK="subtitleTrack"})(J||(J={}));var U;(function(D){D.MAIN="main",D.AUDIO="audio",D.SUBTITLE="subtitle"})(U||(U={}))},"./src/types/transmuxer.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"ChunkMetadata",function(){return J});var J=function(z,H,B,O,b,A){O===void 0&&(O=0),b===void 0&&(b=-1),A===void 0&&(A=!1),this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=U(),this.buffering={audio:U(),video:U(),audiovideo:U()},this.level=z,this.sn=H,this.id=B,this.size=O,this.part=b,this.partial=A};function U(){return{start:0,executeStart:0,executeEnd:0,end:0}}},"./src/utils/attr-list.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"AttrList",function(){return D});var J=/^(\d+)x(\d+)$/,U=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,D=function(){function z(B){typeof B=="string"&&(B=z.parseAttrList(B));for(var O in B)B.hasOwnProperty(O)&&(this[O]=B[O])}var H=z.prototype;return H.decimalInteger=function(O){var b=parseInt(this[O],10);return b>Number.MAX_SAFE_INTEGER?Infinity:b},H.hexadecimalInteger=function(O){if(this[O]){var b=(this[O]||"0x").slice(2);b=(b.length&1?"0":"")+b;for(var A=new Uint8Array(b.length/2),P=0;P<b.length/2;P++)A[P]=parseInt(b.slice(P*2,P*2+2),16);return A}else return null},H.hexadecimalIntegerAsNumber=function(O){var b=parseInt(this[O],16);return b>Number.MAX_SAFE_INTEGER?Infinity:b},H.decimalFloatingPoint=function(O){return parseFloat(this[O])},H.optionalFloat=function(O,b){var A=this[O];return A?parseFloat(A):b},H.enumeratedString=function(O){return this[O]},H.bool=function(O){return this[O]==="YES"},H.decimalResolution=function(O){var b=J.exec(this[O]);return b===null?void 0:{width:parseInt(b[1],10),height:parseInt(b[2],10)}},z.parseAttrList=function(O){var b,A={},P='"';for(U.lastIndex=0;(b=U.exec(O))!==null;){var L=b[2];L.indexOf(P)===0&&L.lastIndexOf(P)===L.length-1&&(L=L.slice(1,-1)),A[b[1]]=L}return A},z}()},"./src/utils/binary-search.ts":function(fe,Z,_){"use strict";_.r(Z);var J={search:function(D,z){for(var H=0,B=D.length-1,O=null,b=null;H<=B;){O=(H+B)/2|0,b=D[O];var A=z(b);if(A>0)H=O+1;else if(A<0)B=O-1;else return b}return null}};Z.default=J},"./src/utils/buffer-helper.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"BufferHelper",function(){return D});var J=_("./src/utils/logger.ts"),U={length:0,start:function(){return 0},end:function(){return 0}},D=function(){function z(){}return z.isBuffered=function(B,O){try{if(B){for(var b=z.getBuffered(B),A=0;A<b.length;A++)if(O>=b.start(A)&&O<=b.end(A))return!0}}catch(P){}return!1},z.bufferInfo=function(B,O,b){try{if(B){var A=z.getBuffered(B),P=[],L;for(L=0;L<A.length;L++)P.push({start:A.start(L),end:A.end(L)});return this.bufferedInfo(P,O,b)}}catch(w){}return{len:0,start:O,end:O,nextStart:void 0}},z.bufferedInfo=function(B,O,b){O=Math.max(0,O),B.sort(function(m,k){var x=m.start-k.start;return x||k.end-m.end});var A=[];if(b)for(var P=0;P<B.length;P++){var L=A.length;if(L){var w=A[L-1].end;B[P].start-w<b?B[P].end>w&&(A[L-1].end=B[P].end):A.push(B[P])}else A.push(B[P])}else A=B;for(var y=0,h,o=O,l=O,u=0;u<A.length;u++){var C=A[u].start,v=A[u].end;if(O+b>=C&&O<v)o=C,l=v,y=l-O;else if(O+b<C){h=C;break}}return{len:y,start:o||0,end:l||0,nextStart:h}},z.getBuffered=function(B){try{return B.buffered}catch(O){return J.logger.log("failed to get media.buffered",O),U}},z}()},"./src/utils/cea-608-parser.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"Row",function(){return l}),_.d(Z,"CaptionScreen",function(){return u});var J=_("./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},D=function(p){var d=p;return U.hasOwnProperty(p)&&(d=U[p]),String.fromCharCode(d)},z=15,H=100,B={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},O={17:2,18:4,21:6,22:8,23:10,19:13,20:15},b={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},A={25:2,26:4,29:6,30:8,31:10,27:13,28:15},P=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],L;(function(f){f[f.ERROR=0]="ERROR",f[f.TEXT=1]="TEXT",f[f.WARNING=2]="WARNING",f[f.INFO=2]="INFO",f[f.DEBUG=3]="DEBUG",f[f.DATA=3]="DATA"})(L||(L={}));var w=function(){function f(){this.time=null,this.verboseLevel=L.ERROR}var p=f.prototype;return p.log=function(a,E){this.verboseLevel>=a&&J.logger.log(this.time+" ["+a+"] "+E)},f}(),y=function(p){for(var d=[],a=0;a<p.length;a++)d.push(p[a].toString(16));return d},h=function(){function f(d,a,E,g,S){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=d||"white",this.underline=a||!1,this.italics=E||!1,this.background=g||"black",this.flash=S||!1}var p=f.prototype;return p.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},p.setStyles=function(a){for(var E=["foreground","underline","italics","background","flash"],g=0;g<E.length;g++){var S=E[g];a.hasOwnProperty(S)&&(this[S]=a[S])}},p.isDefault=function(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash},p.equals=function(a){return this.foreground===a.foreground&&this.underline===a.underline&&this.italics===a.italics&&this.background===a.background&&this.flash===a.flash},p.copy=function(a){this.foreground=a.foreground,this.underline=a.underline,this.italics=a.italics,this.background=a.background,this.flash=a.flash},p.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},f}(),o=function(){function f(d,a,E,g,S,F){this.uchar=void 0,this.penState=void 0,this.uchar=d||" ",this.penState=new h(a,E,g,S,F)}var p=f.prototype;return p.reset=function(){this.uchar=" ",this.penState.reset()},p.setChar=function(a,E){this.uchar=a,this.penState.copy(E)},p.setPenState=function(a){this.penState.copy(a)},p.equals=function(a){return this.uchar===a.uchar&&this.penState.equals(a.penState)},p.copy=function(a){this.uchar=a.uchar,this.penState.copy(a.penState)},p.isEmpty=function(){return this.uchar===" "&&this.penState.isDefault()},f}(),l=function(){function f(d){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var a=0;a<H;a++)this.chars.push(new o);this.logger=d,this.pos=0,this.currPenState=new h}var p=f.prototype;return p.equals=function(a){for(var E=!0,g=0;g<H;g++)if(!this.chars[g].equals(a.chars[g])){E=!1;break}return E},p.copy=function(a){for(var E=0;E<H;E++)this.chars[E].copy(a.chars[E])},p.isEmpty=function(){for(var a=!0,E=0;E<H;E++)if(!this.chars[E].isEmpty()){a=!1;break}return a},p.setCursor=function(a){this.pos!==a&&(this.pos=a),this.pos<0?(this.logger.log(L.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>H&&(this.logger.log(L.DEBUG,"Too large cursor position "+this.pos),this.pos=H)},p.moveCursor=function(a){var E=this.pos+a;if(a>1)for(var g=this.pos+1;g<E+1;g++)this.chars[g].setPenState(this.currPenState);this.setCursor(E)},p.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},p.insertChar=function(a){a>=144&&this.backSpace();var E=D(a);if(this.pos>=H){this.logger.log(L.ERROR,"Cannot insert "+a.toString(16)+" ("+E+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(E,this.currPenState),this.moveCursor(1)},p.clearFromPos=function(a){var E;for(E=a;E<H;E++)this.chars[E].reset()},p.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},p.clearToEndOfRow=function(){this.clearFromPos(this.pos)},p.getTextString=function(){for(var a=[],E=!0,g=0;g<H;g++){var S=this.chars[g].uchar;S!==" "&&(E=!1),a.push(S)}return E?"":a.join("")},p.setPenStyles=function(a){this.currPenState.setStyles(a);var E=this.chars[this.pos];E.setPenState(this.currPenState)},f}(),u=function(){function f(d){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var a=0;a<z;a++)this.rows.push(new l(d));this.logger=d,this.currRow=z-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var p=f.prototype;return p.reset=function(){for(var a=0;a<z;a++)this.rows[a].clear();this.currRow=z-1},p.equals=function(a){for(var E=!0,g=0;g<z;g++)if(!this.rows[g].equals(a.rows[g])){E=!1;break}return E},p.copy=function(a){for(var E=0;E<z;E++)this.rows[E].copy(a.rows[E])},p.isEmpty=function(){for(var a=!0,E=0;E<z;E++)if(!this.rows[E].isEmpty()){a=!1;break}return a},p.backSpace=function(){var a=this.rows[this.currRow];a.backSpace()},p.clearToEndOfRow=function(){var a=this.rows[this.currRow];a.clearToEndOfRow()},p.insertChar=function(a){var E=this.rows[this.currRow];E.insertChar(a)},p.setPen=function(a){var E=this.rows[this.currRow];E.setPenStyles(a)},p.moveCursor=function(a){var E=this.rows[this.currRow];E.moveCursor(a)},p.setCursor=function(a){this.logger.log(L.INFO,"setCursor: "+a);var E=this.rows[this.currRow];E.setCursor(a)},p.setPAC=function(a){this.logger.log(L.INFO,"pacData = "+JSON.stringify(a));var E=a.row-1;if(this.nrRollUpRows&&E<this.nrRollUpRows-1&&(E=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==E){for(var g=0;g<z;g++)this.rows[g].clear();var S=this.currRow+1-this.nrRollUpRows,F=this.lastOutputScreen;if(F){var W=F.rows[S].cueStartTime,K=this.logger.time;if(W&&K!==null&&W<K)for(var V=0;V<this.nrRollUpRows;V++)this.rows[E-this.nrRollUpRows+V+1].copy(F.rows[S+V])}}this.currRow=E;var M=this.rows[this.currRow];if(a.indent!==null){var I=a.indent,$=Math.max(I-1,0);M.setCursor(a.indent),a.color=M.chars[$].penState.foreground}var ae={foreground:a.color,underline:a.underline,italics:a.italics,background:"black",flash:!1};this.setPen(ae)},p.setBkgData=function(a){this.logger.log(L.INFO,"bkgData = "+JSON.stringify(a)),this.backSpace(),this.setPen(a),this.insertChar(32)},p.setRollUpRows=function(a){this.nrRollUpRows=a},p.rollUp=function(){if(this.nrRollUpRows===null){this.logger.log(L.DEBUG,"roll_up but nrRollUpRows not set yet");return}this.logger.log(L.TEXT,this.getDisplayText());var a=this.currRow+1-this.nrRollUpRows,E=this.rows.splice(a,1)[0];E.clear(),this.rows.splice(this.currRow,0,E),this.logger.log(L.INFO,"Rolling up")},p.getDisplayText=function(a){a=a||!1;for(var E=[],g="",S=-1,F=0;F<z;F++){var W=this.rows[F].getTextString();W&&(S=F+1,a?E.push("Row "+S+": '"+W+"'"):E.push(W.trim()))}return E.length>0&&(a?g="["+E.join(" | ")+"]":g=E.join(`
|
|
`)),g},p.getTextAndFormat=function(){return this.rows},f}(),C=function(){function f(d,a,E){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=d,this.outputFilter=a,this.mode=null,this.verbose=0,this.displayedMemory=new u(E),this.nonDisplayedMemory=new u(E),this.lastOutputScreen=new u(E),this.currRollUpRow=this.displayedMemory.rows[z-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=E}var p=f.prototype;return p.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[z-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},p.getHandler=function(){return this.outputFilter},p.setHandler=function(a){this.outputFilter=a},p.setPAC=function(a){this.writeScreen.setPAC(a)},p.setBkgData=function(a){this.writeScreen.setBkgData(a)},p.setMode=function(a){if(a===this.mode)return;this.mode=a,this.logger.log(L.INFO,"MODE="+a),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=a},p.insertChars=function(a){for(var E=0;E<a.length;E++)this.writeScreen.insertChar(a[E]);var g=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(L.INFO,g+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(L.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},p.ccRCL=function(){this.logger.log(L.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},p.ccBS=function(){if(this.logger.log(L.INFO,"BS - BackSpace"),this.mode==="MODE_TEXT")return;this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate()},p.ccAOF=function(){},p.ccAON=function(){},p.ccDER=function(){this.logger.log(L.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},p.ccRU=function(a){this.logger.log(L.INFO,"RU("+a+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(a)},p.ccFON=function(){this.logger.log(L.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},p.ccRDC=function(){this.logger.log(L.INFO,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},p.ccTR=function(){this.logger.log(L.INFO,"TR"),this.setMode("MODE_TEXT")},p.ccRTD=function(){this.logger.log(L.INFO,"RTD"),this.setMode("MODE_TEXT")},p.ccEDM=function(){this.logger.log(L.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},p.ccCR=function(){this.logger.log(L.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},p.ccENM=function(){this.logger.log(L.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},p.ccEOC=function(){if(this.logger.log(L.INFO,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){var a=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=a,this.writeScreen=this.nonDisplayedMemory,this.logger.log(L.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},p.ccTO=function(a){this.logger.log(L.INFO,"TO("+a+") - Tab Offset"),this.writeScreen.moveCursor(a)},p.ccMIDROW=function(a){var E={flash:!1};if(E.underline=a%2===1,E.italics=a>=46,E.italics)E.foreground="white";else{var g=Math.floor(a/2)-16,S=["white","green","blue","cyan","red","yellow","magenta"];E.foreground=S[g]}this.logger.log(L.INFO,"MIDROW: "+JSON.stringify(E)),this.writeScreen.setPen(E)},p.outputDataUpdate=function(a){a===void 0&&(a=!1);var E=this.logger.time;if(E===null)return;this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=E:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,E,this.lastOutputScreen),a&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:E),this.lastOutputScreen.copy(this.displayedMemory))},p.cueSplitAtTime=function(a){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,a,this.displayedMemory),this.cueStartTime=a))},f}(),v=function(){function f(d,a,E){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var g=new w;this.channels=[null,new C(d,a,g),new C(d+1,E,g)],this.cmdHistory=x(),this.logger=g}var p=f.prototype;return p.getHandler=function(a){return this.channels[a].getHandler()},p.setHandler=function(a,E){this.channels[a].setHandler(E)},p.addData=function(a,E){var g,S,F,W=!1;this.logger.time=a;for(var K=0;K<E.length;K+=2){if(S=E[K]&127,F=E[K+1]&127,S===0&&F===0)continue;if(this.logger.log(L.DATA,"["+y([E[K],E[K+1]])+"] -> ("+y([S,F])+")"),g=this.parseCmd(S,F),g||(g=this.parseMidrow(S,F)),g||(g=this.parsePAC(S,F)),g||(g=this.parseBackgroundAttributes(S,F)),!g&&(W=this.parseChars(S,F),W)){var V=this.currentChannel;if(V&&V>0){var M=this.channels[V];M.insertChars(W)}else this.logger.log(L.WARNING,"No channel found yet. TEXT-MODE?")}!g&&!W&&this.logger.log(L.WARNING,"Couldn't parse cleaned data "+y([S,F])+" orig: "+y([E[K],E[K+1]]))}},p.parseCmd=function(a,E){var g=this.cmdHistory,S=(a===20||a===28||a===21||a===29)&&E>=32&&E<=47,F=(a===23||a===31)&&E>=33&&E<=35;if(!(S||F))return!1;if(k(a,E,g))return m(null,null,g),this.logger.log(L.DEBUG,"Repeated command ("+y([a,E])+") is dropped"),!0;var W=a===20||a===21||a===23?1:2,K=this.channels[W];return a===20||a===21||a===28||a===29?E===32?K.ccRCL():E===33?K.ccBS():E===34?K.ccAOF():E===35?K.ccAON():E===36?K.ccDER():E===37?K.ccRU(2):E===38?K.ccRU(3):E===39?K.ccRU(4):E===40?K.ccFON():E===41?K.ccRDC():E===42?K.ccTR():E===43?K.ccRTD():E===44?K.ccEDM():E===45?K.ccCR():E===46?K.ccENM():E===47&&K.ccEOC():K.ccTO(E-32),m(a,E,g),this.currentChannel=W,!0},p.parseMidrow=function(a,E){var g=0;if((a===17||a===25)&&E>=32&&E<=47){if(a===17?g=1:g=2,g!==this.currentChannel)return this.logger.log(L.ERROR,"Mismatch channel in midrow parsing"),!1;var S=this.channels[g];return S?(S.ccMIDROW(E),this.logger.log(L.DEBUG,"MIDROW ("+y([a,E])+")"),!0):!1}return!1},p.parsePAC=function(a,E){var g,S=this.cmdHistory,F=(a>=17&&a<=23||a>=25&&a<=31)&&E>=64&&E<=127,W=(a===16||a===24)&&E>=64&&E<=95;if(!(F||W))return!1;if(k(a,E,S))return m(null,null,S),!0;var K=a<=23?1:2;E>=64&&E<=95?g=K===1?B[a]:b[a]:g=K===1?O[a]:A[a];var V=this.channels[K];return V?(V.setPAC(this.interpretPAC(g,E)),m(a,E,S),this.currentChannel=K,!0):!1},p.interpretPAC=function(a,E){var g,S={color:null,italics:!1,indent:null,underline:!1,row:a};return E>95?g=E-96:g=E-64,S.underline=(g&1)===1,g<=13?S.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(g/2)]:g<=15?(S.italics=!0,S.color="white"):S.indent=Math.floor((g-16)/2)*4,S},p.parseChars=function(a,E){var g,S=null,F=null;if(a>=25?(g=2,F=a-8):(g=1,F=a),F>=17&&F<=19){var W;F===17?W=E+80:F===18?W=E+112:W=E+144,this.logger.log(L.INFO,"Special char '"+D(W)+"' in channel "+g),S=[W]}else a>=32&&a<=127&&(S=E===0?[a]:[a,E]);if(S){var K=y(S);this.logger.log(L.DEBUG,"Char codes = "+K.join(",")),m(a,E,this.cmdHistory)}return S},p.parseBackgroundAttributes=function(a,E){var g=(a===16||a===24)&&E>=32&&E<=47,S=(a===23||a===31)&&E>=45&&E<=47;if(!(g||S))return!1;var F,W={};a===16||a===24?(F=Math.floor((E-32)/2),W.background=P[F],E%2===1&&(W.background=W.background+"_semi")):E===45?W.background="transparent":(W.foreground="black",E===47&&(W.underline=!0));var K=a<=23?1:2,V=this.channels[K];return V.setBkgData(W),m(a,E,this.cmdHistory),!0},p.reset=function(){for(var a=0;a<Object.keys(this.channels).length;a++){var E=this.channels[a];E&&E.reset()}this.cmdHistory=x()},p.cueSplitAtTime=function(a){for(var E=0;E<this.channels.length;E++){var g=this.channels[E];g&&g.cueSplitAtTime(a)}},f}();function m(f,p,d){d.a=f,d.b=p}function k(f,p,d){return d.a===f&&d.b===p}function x(){return{a:null,b:null}}Z.default=v},"./src/utils/codecs.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"isCodecType",function(){return U}),_.d(Z,"isCodecSupportedInMp4",function(){return D});var J={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(z,H){var B=J[H];return!!B&&B[z.slice(0,4)]===!0}function D(z,H){return MediaSource.isTypeSupported((H||"video")+'/mp4;codecs="'+z+'"')}},"./src/utils/cues.ts":function(fe,Z,_){"use strict";_.r(Z);var J=_("./src/utils/vttparser.ts"),U=_("./src/utils/webvtt-parser.ts"),D=_("./src/utils/texttrack-utils.ts"),z=/\s/,H={newCue:function(O,b,A,P){for(var L=[],w,y,h,o,l,u=self.VTTCue||self.TextTrackCue,C=0;C<P.rows.length;C++)if(w=P.rows[C],h=!0,o=0,l="",!w.isEmpty()){for(var v=0;v<w.chars.length;v++)z.test(w.chars[v].uchar)&&h?o++:(l+=w.chars[v].uchar,h=!1);w.cueStartTime=b,b===A&&(A+=1e-4),o>=16?o--:o++;var m=Object(J.fixLineBreaks)(l.trim()),k=Object(U.generateCueId)(b,A,m);(!O||!O.cues||!O.cues.getCueById(k))&&(y=new u(b,A,m),y.id=k,y.line=C+1,y.align="left",y.position=10+Math.min(80,Math.floor(o*8/32)*10),L.push(y))}return O&&L.length&&(L.sort(function(x,f){return x.line==="auto"||f.line==="auto"?0:x.line>8&&f.line>8?f.line-x.line:x.line-f.line}),L.forEach(function(x){return Object(D.addCueToTrack)(O,x)})),L}};Z.default=H},"./src/utils/discontinuities.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"findFirstFragWithCC",function(){return z}),_.d(Z,"shouldAlignOnDiscontinuities",function(){return H}),_.d(Z,"findDiscontinuousReferenceFrag",function(){return B}),_.d(Z,"adjustSlidingStart",function(){return b}),_.d(Z,"alignStream",function(){return A}),_.d(Z,"alignPDT",function(){return L}),_.d(Z,"alignFragmentByPDTDelta",function(){return w}),_.d(Z,"alignMediaPlaylistByPDT",function(){return y});var J=_("./src/polyfills/number.ts"),U=_("./src/utils/logger.ts"),D=_("./src/controller/level-helper.ts");function z(h,o){for(var l=null,u=0,C=h.length;u<C;u++){var v=h[u];if(v&&v.cc===o){l=v;break}}return l}function H(h,o,l){return!!(o.details&&(l.endCC>l.startCC||h&&h.cc<l.startCC))}function B(h,o){var l=h.fragments,u=o.fragments;if(!u.length||!l.length){U.logger.log("No fragments to align");return}var C=z(l,u[0].cc);if(!C||C&&!C.startPTS){U.logger.log("No frag in previous level to align on");return}return C}function O(h,o){if(h){var l=h.start+o;h.start=h.startPTS=l,h.endPTS=l+h.duration}}function b(h,o){for(var l=o.fragments,u=0,C=l.length;u<C;u++)O(l[u],h);o.fragmentHint&&O(o.fragmentHint,h),o.alignedSliding=!0}function A(h,o,l){if(!o)return;P(h,l,o),!l.alignedSliding&&o.details&&L(l,o.details),!l.alignedSliding&&o.details&&!l.skippedSegments&&Object(D.adjustSliding)(o.details,l)}function P(h,o,l){if(H(h,l,o)){var u=B(l.details,o);u&&Object(J.isFiniteNumber)(u.start)&&(U.logger.log("Adjusting PTS using last level due to CC increase within current level "+o.url),b(u.start,o))}}function L(h,o){if(!o.fragments.length||!h.hasProgramDateTime||!o.hasProgramDateTime)return;var l=o.fragments[0].programDateTime,u=h.fragments[0].programDateTime,C=(u-l)/1e3+o.fragments[0].start;C&&Object(J.isFiniteNumber)(C)&&(U.logger.log("Adjusting PTS using programDateTime delta "+(u-l)+"ms, sliding:"+C.toFixed(3)+" "+h.url+" "),b(C,h))}function w(h,o){var l=h.programDateTime;if(!l)return;var u=(l-o)/1e3;h.start=h.startPTS=u,h.endPTS=u+h.duration}function y(h,o){if(!o.fragments.length||!h.hasProgramDateTime||!o.hasProgramDateTime)return;var l=o.fragments[0].programDateTime,u=o.fragments[0].start,C=l-u*1e3;h.fragments.forEach(function(v){w(v,C)}),h.fragmentHint&&w(h.fragmentHint,C),h.alignedSliding=!0}},"./src/utils/ewma-bandwidth-estimator.ts":function(fe,Z,_){"use strict";_.r(Z);var J=_("./src/utils/ewma.ts"),U=function(){function D(H,B,O){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=O,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new J.default(H),this.fast_=new J.default(B)}var z=D.prototype;return z.update=function(B,O){var b=this.slow_,A=this.fast_;this.slow_.halfLife!==B&&(this.slow_=new J.default(B,b.getEstimate(),b.getTotalWeight())),this.fast_.halfLife!==O&&(this.fast_=new J.default(O,A.getEstimate(),A.getTotalWeight()))},z.sample=function(B,O){B=Math.max(B,this.minDelayMs_);var b=8*O,A=B/1e3,P=b/A;this.fast_.sample(A,P),this.slow_.sample(A,P)},z.canEstimate=function(){var B=this.fast_;return B&&B.getTotalWeight()>=this.minWeight_},z.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},z.destroy=function(){},D}();Z.default=U},"./src/utils/ewma.ts":function(fe,Z,_){"use strict";_.r(Z);var J=function(){function U(z,H,B){H===void 0&&(H=0),B===void 0&&(B=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=z,this.alpha_=z?Math.exp(Math.log(.5)/z):0,this.estimate_=H,this.totalWeight_=B}var D=U.prototype;return D.sample=function(H,B){var O=Math.pow(this.alpha_,H);this.estimate_=B*(1-O)+O*this.estimate_,this.totalWeight_+=H},D.getTotalWeight=function(){return this.totalWeight_},D.getEstimate=function(){if(this.alpha_){var H=1-Math.pow(this.alpha_,this.totalWeight_);if(H)return this.estimate_/H}return this.estimate_},U}();Z.default=J},"./src/utils/fetch-loader.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"fetchSupported",function(){return w});var J=_("./src/polyfills/number.ts"),U=_("./src/loader/load-stats.ts"),D=_("./src/demux/chunk-cache.ts");function z(u,C){u.prototype=Object.create(C.prototype),u.prototype.constructor=u,A(u,C)}function H(u){var C=typeof Map=="function"?new Map:void 0;return H=function(m){if(m===null||!b(m))return m;if(typeof m!="function")throw new TypeError("Super expression must either be null or a function");if(typeof C!="undefined"){if(C.has(m))return C.get(m);C.set(m,k)}function k(){return B(m,arguments,P(this).constructor)}return k.prototype=Object.create(m.prototype,{constructor:{value:k,enumerable:!1,writable:!0,configurable:!0}}),A(k,m)},H(u)}function B(u,C,v){return O()?B=Reflect.construct:B=function(k,x,f){var p=[null];p.push.apply(p,x);var d=Function.bind.apply(k,p),a=new d;return f&&A(a,f.prototype),a},B.apply(null,arguments)}function O(){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 b(u){return Function.toString.call(u).indexOf("[native code]")!==-1}function A(u,C){return A=Object.setPrototypeOf||function(m,k){return m.__proto__=k,m},A(u,C)}function P(u){return P=Object.setPrototypeOf?Object.getPrototypeOf:function(v){return v.__proto__||Object.getPrototypeOf(v)},P(u)}function L(){return L=Object.assign||function(u){for(var C=1;C<arguments.length;C++){var v=arguments[C];for(var m in v)Object.prototype.hasOwnProperty.call(v,m)&&(u[m]=v[m])}return u},L.apply(this,arguments)}function w(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(u){}return!1}var y=function(){function u(v){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=v.fetchSetup||o,this.controller=new self.AbortController,this.stats=new U.LoadStats}var C=u.prototype;return C.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},C.abortInternal=function(){var m=this.response;(!m||!m.ok)&&(this.stats.aborted=!0,this.controller.abort())},C.abort=function(){var m;this.abortInternal(),(m=this.callbacks)!==null&&m!==void 0&&m.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},C.load=function(m,k,x){var f=this,p=this.stats;if(p.loading.start)throw new Error("Loader can only be used once.");p.loading.start=self.performance.now();var d=h(m,this.controller.signal),a=x.onProgress,E=m.responseType==="arraybuffer",g=E?"byteLength":"length";this.context=m,this.config=k,this.callbacks=x,this.request=this.fetchSetup(m,d),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(function(){f.abortInternal(),x.onTimeout(p,m,f.response)},k.timeout),self.fetch(this.request).then(function(S){if(f.response=f.loader=S,!S.ok){var F=S.status,W=S.statusText;throw new l(W||"fetch, bad network response",F,S)}return p.loading.first=Math.max(self.performance.now(),p.loading.start),p.total=parseInt(S.headers.get("Content-Length")||"0"),a&&Object(J.isFiniteNumber)(k.highWaterMark)?f.loadProgressively(S,p,m,k.highWaterMark,a):E?S.arrayBuffer():S.text()}).then(function(S){var F=f.response;self.clearTimeout(f.requestTimeout),p.loading.end=Math.max(self.performance.now(),p.loading.first),p.loaded=p.total=S[g];var W={url:F.url,data:S};a&&!Object(J.isFiniteNumber)(k.highWaterMark)&&a(p,m,S,F),x.onSuccess(W,p,m,F)}).catch(function(S){if(self.clearTimeout(f.requestTimeout),p.aborted)return;var F=S.code||0;x.onError({code:F,text:S.message},m,S.details)})},C.getCacheAge=function(){var m=null;if(this.response){var k=this.response.headers.get("age");m=k?parseFloat(k):null}return m},C.loadProgressively=function(m,k,x,f,p){f===void 0&&(f=0);var d=new D.default,a=m.body.getReader(),E=function g(){return a.read().then(function(S){if(S.done)return d.dataLength&&p(k,x,d.flush(),m),Promise.resolve(new ArrayBuffer(0));var F=S.value,W=F.length;return k.loaded+=W,W<f||d.dataLength?(d.push(F),d.dataLength>=f&&p(k,x,d.flush(),m)):p(k,x,F,m),g()}).catch(function(){return Promise.reject()})};return E()},u}();function h(u,C){var v={method:"GET",mode:"cors",credentials:"same-origin",signal:C,headers:new self.Headers(L({},u.headers))};return u.rangeEnd&&v.headers.set("Range","bytes="+u.rangeStart+"-"+String(u.rangeEnd-1)),v}function o(u,C){return new self.Request(u.url,C)}var l=function(u){z(C,u);function C(v,m,k){var x;return x=u.call(this,v)||this,x.code=void 0,x.details=void 0,x.code=m,x.details=k,x}return C}(H(Error));Z.default=y},"./src/utils/imsc1-ttml-parser.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"IMSC1_CODEC",function(){return b}),_.d(Z,"parseIMSC1",function(){return w});var J=_("./src/utils/mp4-tools.ts"),U=_("./src/utils/vttparser.ts"),D=_("./src/utils/vttcue.ts"),z=_("./src/demux/id3.ts"),H=_("./src/utils/timescale-conversion.ts"),B=_("./src/utils/webvtt-parser.ts");function O(){return O=Object.assign||function(f){for(var p=1;p<arguments.length;p++){var d=arguments[p];for(var a in d)Object.prototype.hasOwnProperty.call(d,a)&&(f[a]=d[a])}return f},O.apply(this,arguments)}var b="stpp.ttml.im1t",A=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,P=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,L={left:"start",center:"center",right:"end",start:"start",end:"end"};function w(f,p,d,a,E){var g=Object(J.findBox)(new Uint8Array(f),["mdat"]);if(g.length===0){E(new Error("Could not parse IMSC1 mdat"));return}var S=g[0],F=Object(z.utf8ArrayToStr)(new Uint8Array(f,S.start,S.end-S.start)),W=Object(H.toTimescaleFromScale)(p,1,d);try{a(y(F,W))}catch(K){E(K)}}function y(f,p){var d=new DOMParser,a=d.parseFromString(f,"text/xml"),E=a.getElementsByTagName("tt")[0];if(!E)throw new Error("Invalid ttml");var g={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},S=Object.keys(g).reduce(function(M,I){return M[I]=E.getAttribute("ttp:"+I)||g[I],M},{}),F=E.getAttribute("xml:space")!=="preserve",W=o(h(E,"styling","style")),K=o(h(E,"layout","region")),V=h(E,"body","[begin]");return[].map.call(V,function(M){var I=l(M,F);if(!I||!M.hasAttribute("begin"))return null;var $=m(M.getAttribute("begin"),S),ae=m(M.getAttribute("dur"),S),he=m(M.getAttribute("end"),S);if($===null)throw v(M);if(he===null){if(ae===null)throw v(M);he=$+ae}var ge=new D.default($-p,he-p,I);ge.id=Object(B.generateCueId)(ge.startTime,ge.endTime,ge.text);var De=K[M.getAttribute("region")],Se=W[M.getAttribute("style")];ge.position=10,ge.size=80;var Re=u(De,Se),Ce=Re.textAlign;if(Ce){var xe=L[Ce];xe&&(ge.lineAlign=xe),ge.align=Ce}return O(ge,Re),ge}).filter(function(M){return M!==null})}function h(f,p,d){var a=f.getElementsByTagName(p)[0];return a?[].slice.call(a.querySelectorAll(d)):[]}function o(f){return f.reduce(function(p,d){var a=d.getAttribute("xml:id");return a&&(p[a]=d),p},{})}function l(f,p){return[].slice.call(f.childNodes).reduce(function(d,a,E){var g;return a.nodeName==="br"&&E?d+`
|
|
`:(g=a.childNodes)!==null&&g!==void 0&&g.length?l(a,p):p?d+a.textContent.trim().replace(/\s+/g," "):d+a.textContent},"")}function u(f,p){var d="http://www.w3.org/ns/ttml#styling",a=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"];return a.reduce(function(E,g){var S=C(p,d,g)||C(f,d,g);return S&&(E[g]=S),E},{})}function C(f,p,d){return f.hasAttributeNS(p,d)?f.getAttributeNS(p,d):null}function v(f){return new Error("Could not parse ttml timestamp "+f)}function m(f,p){if(!f)return null;var d=Object(U.parseTimeStamp)(f);return d===null&&(A.test(f)?d=k(f,p):P.test(f)&&(d=x(f,p))),d}function k(f,p){var d=A.exec(f),a=(d[4]|0)+(d[5]|0)/p.subFrameRate;return(d[1]|0)*3600+(d[2]|0)*60+(d[3]|0)+a/p.frameRate}function x(f,p){var d=P.exec(f),a=Number(d[1]),E=d[2];switch(E){case"h":return a*3600;case"m":return a*60;case"ms":return a*1e3;case"f":return a/p.frameRate;case"t":return a/p.tickRate}return a}},"./src/utils/logger.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"enableLogs",function(){return B}),_.d(Z,"logger",function(){return O});var J=function(){},U={trace:J,debug:J,log:J,warn:J,info:J,error:J},D=U;function z(b){var A=self.console[b];return A?A.bind(self.console,"["+b+"] >"):J}function H(b){for(var A=arguments.length,P=new Array(A>1?A-1:0),L=1;L<A;L++)P[L-1]=arguments[L];P.forEach(function(w){D[w]=b[w]?b[w].bind(b):z(w)})}function B(b){if(self.console&&b===!0||typeof b=="object"){H(b,"debug","log","info","warn","error");try{D.log()}catch(A){D=U}}else D=U}var O=D},"./src/utils/mediakeys-helper.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"KeySystems",function(){return J}),_.d(Z,"requestMediaKeySystemAccess",function(){return U});var J;(function(D){D.WIDEVINE="com.widevine.alpha",D.PLAYREADY="com.microsoft.playready"})(J||(J={}));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(fe,Z,_){"use strict";_.r(Z),_.d(Z,"getMediaSource",function(){return J});function J(){return self.MediaSource||self.WebKitMediaSource}},"./src/utils/mp4-tools.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"bin2str",function(){return H}),_.d(Z,"readUint16",function(){return B}),_.d(Z,"readUint32",function(){return O}),_.d(Z,"writeUint32",function(){return b}),_.d(Z,"findBox",function(){return A}),_.d(Z,"parseSegmentIndex",function(){return P}),_.d(Z,"parseInitSegment",function(){return L}),_.d(Z,"getStartDTS",function(){return w}),_.d(Z,"getDuration",function(){return y}),_.d(Z,"computeRawDurationFromSamples",function(){return h}),_.d(Z,"offsetStartDTS",function(){return o}),_.d(Z,"segmentValidRange",function(){return l}),_.d(Z,"appendUint8Array",function(){return u});var J=_("./src/utils/typed-array.ts"),U=_("./src/loader/fragment.ts"),D=Math.pow(2,32)-1,z=[].push;function H(C){return String.fromCharCode.apply(null,C)}function B(C,v){"data"in C&&(v+=C.start,C=C.data);var m=C[v]<<8|C[v+1];return m<0?65536+m:m}function O(C,v){"data"in C&&(v+=C.start,C=C.data);var m=C[v]<<24|C[v+1]<<16|C[v+2]<<8|C[v+3];return m<0?4294967296+m:m}function b(C,v,m){"data"in C&&(v+=C.start,C=C.data),C[v]=m>>24,C[v+1]=m>>16&255,C[v+2]=m>>8&255,C[v+3]=m&255}function A(C,v){var m=[];if(!v.length)return m;var k,x,f;"data"in C?(k=C.data,x=C.start,f=C.end):(k=C,x=0,f=k.byteLength);for(var p=x;p<f;){var d=O(k,p),a=H(k.subarray(p+4,p+8)),E=d>1?p+d:f;if(a===v[0])if(v.length===1)m.push({data:k,start:p+8,end:E});else{var g=A({data:k,start:p+8,end:E},v.slice(1));g.length&&z.apply(m,g)}p=E}return m}function P(C){var v=A(C,["moov"]),m=v[0],k=m?m.end:null,x=A(C,["sidx"]);if(!x||!x[0])return null;var f=[],p=x[0],d=p.data[0],a=d===0?8:16,E=O(p,a);a+=4;var g=0,S=0;d===0?a+=8:a+=16,a+=2;var F=p.end+S,W=B(p,a);a+=2;for(var K=0;K<W;K++){var V=a,M=O(p,V);V+=4;var I=M&2147483647,$=(M&2147483648)>>>31;if($===1)return console.warn("SIDX has hierarchical references (not supported)"),null;var ae=O(p,V);V+=4,f.push({referenceSize:I,subsegmentDuration:ae,info:{duration:ae/E,start:F,end:F+I-1}}),F+=I,V+=4,a=V}return{earliestPresentationTime:g,timescale:E,version:d,referencesCount:W,references:f,moovEndOffset:k}}function L(C){for(var v=[],m=A(C,["moov","trak"]),k=0;k<m.length;k++){var x=m[k],f=A(x,["tkhd"])[0];if(f){var p=f.data[f.start],d=p===0?12:20,a=O(f,d),E=A(x,["mdia","mdhd"])[0];if(E){p=E.data[E.start],d=p===0?12:20;var g=O(E,d),S=A(x,["mdia","hdlr"])[0];if(S){var F=H(S.data.subarray(S.start+8,S.start+12)),W={soun:U.ElementaryStreamTypes.AUDIO,vide:U.ElementaryStreamTypes.VIDEO}[F];if(W){var K=A(x,["mdia","minf","stbl","stsd"])[0],V=void 0;K&&(V=H(K.data.subarray(K.start+12,K.start+16))),v[a]={timescale:g,type:W},v[W]={timescale:g,id:a,codec:V}}}}}}var M=A(C,["moov","mvex","trex"]);return M.forEach(function(I){var $=O(I,4),ae=v[$];ae&&(ae.default={duration:O(I,12),flags:O(I,20)})}),v}function w(C,v){return A(v,["moof","traf"]).reduce(function(m,k){var x=A(k,["tfdt"])[0],f=x.data[x.start],p=A(k,["tfhd"]).reduce(function(d,a){var E=O(a,4),g=C[E];if(g){var S=O(x,4);f===1&&(S*=Math.pow(2,32),S+=O(x,8));var F=g.timescale||9e4,W=S/F;if(isFinite(W)&&(d===null||W<d))return W}return d},null);return p!==null&&isFinite(p)&&(m===null||p<m)?p:m},null)||0}function y(C,v){for(var m=0,k=0,x=0,f=A(C,["moof","traf"]),p=0;p<f.length;p++){var d=f[p],a=A(d,["tfhd"])[0],E=O(a,4),g=v[E];if(!g)continue;var S=g.default,F=O(a,0)|(S==null?void 0:S.flags),W=S==null?void 0:S.duration;F&8&&(F&2?W=O(a,12):W=O(a,8));for(var K=g.timescale||9e4,V=A(d,["trun"]),M=0;M<V.length;M++){if(W){var I=O(V[M],4);m=W*I}else m=h(V[M]);g.type===U.ElementaryStreamTypes.VIDEO?k+=m/K:g.type===U.ElementaryStreamTypes.AUDIO&&(x+=m/K)}}if(k===0&&x===0){var $=P(C);if($!=null&&$.references)return $.references.reduce(function(ae,he){return ae+he.info.duration||0},0)}return k||x}function h(C){var v=O(C,0),m=8;v&1&&(m+=4),v&4&&(m+=4);for(var k=0,x=O(C,4),f=0;f<x;f++){if(v&256){var p=O(C,m);k+=p,m+=4}v&512&&(m+=4),v&1024&&(m+=4),v&2048&&(m+=4)}return k}function o(C,v,m){A(v,["moof","traf"]).forEach(function(k){A(k,["tfhd"]).forEach(function(x){var f=O(x,4),p=C[f];if(!p)return;var d=p.timescale||9e4;A(k,["tfdt"]).forEach(function(a){var E=a.data[a.start],g=O(a,4);if(E===0)b(a,4,g-m*d);else{g*=Math.pow(2,32),g+=O(a,8),g-=m*d,g=Math.max(g,0);var S=Math.floor(g/(D+1)),F=Math.floor(g%(D+1));b(a,4,S),b(a,8,F)}})})})}function l(C){var v={valid:null,remainder:null},m=A(C,["moof"]);if(m){if(m.length<2)return v.remainder=C,v}else return v;var k=m[m.length-1];return v.valid=Object(J.sliceUint8)(C,0,k.start-8),v.remainder=Object(J.sliceUint8)(C,k.start-8),v}function u(C,v){var m=new Uint8Array(C.length+v.length);return m.set(C),m.set(v,C.length),m}},"./src/utils/output-filter.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"default",function(){return J});var J=function(){function U(z,H){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=z,this.trackName=H}var D=U.prototype;return D.dispatchCue=function(){if(this.startTime===null)return;this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null},D.newCue=function(H,B,O){(this.startTime===null||this.startTime>H)&&(this.startTime=H),this.endTime=B,this.screen=O,this.timelineController.createCaptionsTrack(this.trackName)},D.reset=function(){this.cueRanges=[]},U}()},"./src/utils/texttrack-utils.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"sendAddTrackEvent",function(){return U}),_.d(Z,"addCueToTrack",function(){return D}),_.d(Z,"clearCurrentCues",function(){return z}),_.d(Z,"removeCuesInRange",function(){return H}),_.d(Z,"getCuesInRange",function(){return O});var J=_("./src/utils/logger.ts");function U(b,A){var P;try{P=new Event("addtrack")}catch(L){P=document.createEvent("Event"),P.initEvent("addtrack",!1,!1)}P.track=b,A.dispatchEvent(P)}function D(b,A){var P=b.mode;if(P==="disabled"&&(b.mode="hidden"),b.cues&&!b.cues.getCueById(A.id))try{if(b.addCue(A),!b.cues.getCueById(A.id))throw new Error("addCue is failed for: "+A)}catch(w){J.logger.debug("[texttrack-utils]: "+w);var L=new self.TextTrackCue(A.startTime,A.endTime,A.text);L.id=A.id,b.addCue(L)}P==="disabled"&&(b.mode=P)}function z(b){var A=b.mode;if(A==="disabled"&&(b.mode="hidden"),b.cues)for(var P=b.cues.length;P--;)b.removeCue(b.cues[P]);A==="disabled"&&(b.mode=A)}function H(b,A,P){var L=b.mode;if(L==="disabled"&&(b.mode="hidden"),b.cues&&b.cues.length>0)for(var w=O(b.cues,A,P),y=0;y<w.length;y++)b.removeCue(w[y]);L==="disabled"&&(b.mode=L)}function B(b,A){if(A<b[0].startTime)return 0;var P=b.length-1;if(A>b[P].endTime)return-1;for(var L=0,w=P;L<=w;){var y=Math.floor((w+L)/2);if(A<b[y].startTime)w=y-1;else if(A>b[y].startTime&&L<P)L=y+1;else return y}return b[L].startTime-A<A-b[w].startTime?L:w}function O(b,A,P){var L=[],w=B(b,A);if(w>-1)for(var y=w,h=b.length;y<h;y++){var o=b[y];if(o.startTime>=A&&o.endTime<=P)L.push(o);else if(o.startTime>P)return L}return L}},"./src/utils/time-ranges.ts":function(fe,Z,_){"use strict";_.r(Z);var J={toString:function(D){for(var z="",H=D.length,B=0;B<H;B++)z+="["+D.start(B).toFixed(3)+","+D.end(B).toFixed(3)+"]";return z}};Z.default=J},"./src/utils/timescale-conversion.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"toTimescaleFromBase",function(){return U}),_.d(Z,"toTimescaleFromScale",function(){return D}),_.d(Z,"toMsFromMpegTsClock",function(){return z}),_.d(Z,"toMpegTsClockFromTimescale",function(){return H});var J=9e4;function U(B,O,b,A){b===void 0&&(b=1),A===void 0&&(A=!1);var P=B*O*b;return A?Math.round(P):P}function D(B,O,b,A){return b===void 0&&(b=1),A===void 0&&(A=!1),U(B,O,1/b,A)}function z(B,O){return O===void 0&&(O=!1),U(B,1e3,1/J,O)}function H(B,O){return O===void 0&&(O=1),U(B,J,1/O)}},"./src/utils/typed-array.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"sliceUint8",function(){return J});function J(U,D,z){return Uint8Array.prototype.slice?U.slice(D,z):new Uint8Array(Array.prototype.slice.call(U,D,z))}},"./src/utils/vttcue.ts":function(fe,Z,_){"use strict";_.r(Z),Z.default=function(){if(typeof self!="undefined"&&self.VTTCue)return self.VTTCue;var J=["","lr","rl"],U=["start","middle","end","left","right"];function D(b,A){if(typeof A!="string")return!1;if(!Array.isArray(b))return!1;var P=A.toLowerCase();return~b.indexOf(P)?P:!1}function z(b){return D(J,b)}function H(b){return D(U,b)}function B(b){for(var A=arguments.length,P=new Array(A>1?A-1:0),L=1;L<A;L++)P[L-1]=arguments[L];for(var w=1;w<arguments.length;w++){var y=arguments[w];for(var h in y)b[h]=y[h]}return b}function O(b,A,P){var L=this,w={enumerable:!0};L.hasBeenReset=!1;var y="",h=!1,o=b,l=A,u=P,C=null,v="",m=!0,k="auto",x="start",f=50,p="middle",d=50,a="middle";Object.defineProperty(L,"id",B({},w,{get:function(){return y},set:function(g){y=""+g}})),Object.defineProperty(L,"pauseOnExit",B({},w,{get:function(){return h},set:function(g){h=!!g}})),Object.defineProperty(L,"startTime",B({},w,{get:function(){return o},set:function(g){if(typeof g!="number")throw new TypeError("Start time must be set to a number.");o=g,this.hasBeenReset=!0}})),Object.defineProperty(L,"endTime",B({},w,{get:function(){return l},set:function(g){if(typeof g!="number")throw new TypeError("End time must be set to a number.");l=g,this.hasBeenReset=!0}})),Object.defineProperty(L,"text",B({},w,{get:function(){return u},set:function(g){u=""+g,this.hasBeenReset=!0}})),Object.defineProperty(L,"region",B({},w,{get:function(){return C},set:function(g){C=g,this.hasBeenReset=!0}})),Object.defineProperty(L,"vertical",B({},w,{get:function(){return v},set:function(g){var S=z(g);if(S===!1)throw new SyntaxError("An invalid or illegal string was specified.");v=S,this.hasBeenReset=!0}})),Object.defineProperty(L,"snapToLines",B({},w,{get:function(){return m},set:function(g){m=!!g,this.hasBeenReset=!0}})),Object.defineProperty(L,"line",B({},w,{get:function(){return k},set:function(g){if(typeof g!="number"&&g!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");k=g,this.hasBeenReset=!0}})),Object.defineProperty(L,"lineAlign",B({},w,{get:function(){return x},set:function(g){var S=H(g);if(!S)throw new SyntaxError("An invalid or illegal string was specified.");x=S,this.hasBeenReset=!0}})),Object.defineProperty(L,"position",B({},w,{get:function(){return f},set:function(g){if(g<0||g>100)throw new Error("Position must be between 0 and 100.");f=g,this.hasBeenReset=!0}})),Object.defineProperty(L,"positionAlign",B({},w,{get:function(){return p},set:function(g){var S=H(g);if(!S)throw new SyntaxError("An invalid or illegal string was specified.");p=S,this.hasBeenReset=!0}})),Object.defineProperty(L,"size",B({},w,{get:function(){return d},set:function(g){if(g<0||g>100)throw new Error("Size must be between 0 and 100.");d=g,this.hasBeenReset=!0}})),Object.defineProperty(L,"align",B({},w,{get:function(){return a},set:function(g){var S=H(g);if(!S)throw new SyntaxError("An invalid or illegal string was specified.");a=S,this.hasBeenReset=!0}})),L.displayState=void 0}return O.prototype.getCueAsHTML=function(){var b=self.WebVTT;return b.convertCueToDOMTree(self,this.text)},O}()},"./src/utils/vttparser.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"parseTimeStamp",function(){return D}),_.d(Z,"fixLineBreaks",function(){return A}),_.d(Z,"VTTParser",function(){return P});var J=_("./src/utils/vttcue.ts"),U=function(){function L(){}var w=L.prototype;return w.decode=function(h,o){if(!h)return"";if(typeof h!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(h))},L}();function D(L){function w(h,o,l,u){return(h|0)*3600+(o|0)*60+(l|0)+parseFloat(u||0)}var y=L.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return y?parseFloat(y[2])>59?w(y[2],y[3],0,y[4]):w(y[1],y[2],y[3],y[4]):null}var z=function(){function L(){this.values=Object.create(null)}var w=L.prototype;return w.set=function(h,o){!this.get(h)&&o!==""&&(this.values[h]=o)},w.get=function(h,o,l){return l?this.has(h)?this.values[h]:o[l]:this.has(h)?this.values[h]:o},w.has=function(h){return h in this.values},w.alt=function(h,o,l){for(var u=0;u<l.length;++u)if(o===l[u]){this.set(h,o);break}},w.integer=function(h,o){/^-?\d+$/.test(o)&&this.set(h,parseInt(o,10))},w.percent=function(h,o){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(o)){var l=parseFloat(o);if(l>=0&&l<=100)return this.set(h,l),!0}return!1},L}();function H(L,w,y,h){var o=h?L.split(h):[L];for(var l in o){if(typeof o[l]!="string")continue;var u=o[l].split(y);if(u.length!==2)continue;var C=u[0],v=u[1];w(C,v)}}var B=new J.default(0,0,""),O=B.align==="middle"?"middle":"center";function b(L,w,y){var h=L;function o(){var C=D(L);if(C===null)throw new Error("Malformed timestamp: "+h);return L=L.replace(/^[^\sa-zA-Z-]+/,""),C}function l(C,v){var m=new z;H(C,function(f,p){var d;switch(f){case"region":for(var a=y.length-1;a>=0;a--)if(y[a].id===p){m.set(f,y[a].region);break}break;case"vertical":m.alt(f,p,["rl","lr"]);break;case"line":d=p.split(","),m.integer(f,d[0]),m.percent(f,d[0])&&m.set("snapToLines",!1),m.alt(f,d[0],["auto"]),d.length===2&&m.alt("lineAlign",d[1],["start",O,"end"]);break;case"position":d=p.split(","),m.percent(f,d[0]),d.length===2&&m.alt("positionAlign",d[1],["start",O,"end","line-left","line-right","auto"]);break;case"size":m.percent(f,p);break;case"align":m.alt(f,p,["start",O,"end","left","right"]);break}},/:/,/\s/),v.region=m.get("region",null),v.vertical=m.get("vertical","");var k=m.get("line","auto");k==="auto"&&B.line===-1&&(k=-1),v.line=k,v.lineAlign=m.get("lineAlign","start"),v.snapToLines=m.get("snapToLines",!0),v.size=m.get("size",100),v.align=m.get("align",O);var x=m.get("position","auto");x==="auto"&&B.position===50&&(x=v.align==="start"||v.align==="left"?0:v.align==="end"||v.align==="right"?100:50),v.position=x}function u(){L=L.replace(/^\s+/,"")}if(u(),w.startTime=o(),u(),L.substr(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+h);L=L.substr(3),u(),w.endTime=o(),u(),l(L,w)}function A(L){return L.replace(/<br(?: \/)?>/gi,`
|
|
`)}var P=function(){function L(){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 w=L.prototype;return w.parse=function(h){var o=this;h&&(o.buffer+=o.decoder.decode(h,{stream:!0}));function l(){var x=o.buffer,f=0;for(x=A(x);f<x.length&&x[f]!=="\r"&&x[f]!==`
|
|
`;)++f;var p=x.substr(0,f);return x[f]==="\r"&&++f,x[f]===`
|
|
`&&++f,o.buffer=x.substr(f),p}function u(x){H(x,function(f,p){},/:/)}try{var C="";if(o.state==="INITIAL"){if(!/\r\n|\n/.test(o.buffer))return this;C=l();var v=C.match(/^()?WEBVTT([ \t].*)?$/);if(!v||!v[0])throw new Error("Malformed WebVTT signature.");o.state="HEADER"}for(var m=!1;o.buffer;){if(!/\r\n|\n/.test(o.buffer))return this;m?m=!1:C=l();switch(o.state){case"HEADER":/:/.test(C)?u(C):C||(o.state="ID");continue;case"NOTE":C||(o.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(C)){o.state="NOTE";break}if(!C)continue;if(o.cue=new J.default(0,0,""),o.state="CUE",C.indexOf("-->")===-1){o.cue.id=C;continue}case"CUE":if(!o.cue){o.state="BADCUE";continue}try{b(C,o.cue,o.regionList)}catch(x){o.cue=null,o.state="BADCUE";continue}o.state="CUETEXT";continue;case"CUETEXT":{var k=C.indexOf("-->")!==-1;if(!C||k&&(m=!0)){o.oncue&&o.cue&&o.oncue(o.cue),o.cue=null,o.state="ID";continue}if(o.cue===null)continue;o.cue.text&&(o.cue.text+=`
|
|
`),o.cue.text+=C}continue;case"BADCUE":C||(o.state="ID")}}}catch(x){o.state==="CUETEXT"&&o.cue&&o.oncue&&o.oncue(o.cue),o.cue=null,o.state=o.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},w.flush=function(){var h=this;try{if((h.cue||h.state==="HEADER")&&(h.buffer+=`
|
|
|
|
`,h.parse()),h.state==="INITIAL"||h.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(o){h.onparsingerror&&h.onparsingerror(o)}return h.onflush&&h.onflush(),this},L}()},"./src/utils/webvtt-parser.ts":function(fe,Z,_){"use strict";_.r(Z),_.d(Z,"generateCueId",function(){return P}),_.d(Z,"parseWebVTT",function(){return w});var J=_("./src/polyfills/number.ts"),U=_("./src/utils/vttparser.ts"),D=_("./src/demux/id3.ts"),z=_("./src/utils/timescale-conversion.ts"),H=_("./src/remux/mp4-remuxer.ts"),B=/\r\n|\n\r|\n|\r/g,O=function(h,o,l){return l===void 0&&(l=0),h.substr(l,o.length)===o},b=function(h){var o=parseInt(h.substr(-3)),l=parseInt(h.substr(-6,2)),u=parseInt(h.substr(-9,2)),C=h.length>9?parseInt(h.substr(0,h.indexOf(":"))):0;if(!Object(J.isFiniteNumber)(o)||!Object(J.isFiniteNumber)(l)||!Object(J.isFiniteNumber)(u)||!Object(J.isFiniteNumber)(C))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+h);return o+=1e3*l,o+=60*1e3*u,o+=60*60*1e3*C,o},A=function(h){for(var o=5381,l=h.length;l;)o=o*33^h.charCodeAt(--l);return(o>>>0).toString()};function P(y,h,o){return A(y.toString())+A(h.toString())+A(o)}var L=function(h,o,l){var u=h[o],C=h[u.prevCC];if(!C||!C.new&&u.new){h.ccOffset=h.presentationOffset=u.start,u.new=!1;return}for(;(v=C)!==null&&v!==void 0&&v.new;){var v;h.ccOffset+=u.start-C.start,u.new=!1,u=C,C=h[u.prevCC]}h.presentationOffset=l};function w(y,h,o,l,u,C,v,m){var k=new U.VTTParser,x=Object(D.utf8ArrayToStr)(new Uint8Array(y)).trim().replace(B,`
|
|
`).split(`
|
|
`),f=[],p=Object(z.toMpegTsClockFromTimescale)(h,o),d="00:00.000",a=0,E=0,g,S=!0,F=!1;k.oncue=function(W){var K=l[u],V=l.ccOffset,M=(a-p)/9e4;if(K!=null&&K.new&&(E!==void 0?V=l.ccOffset=K.start:L(l,u,M)),M&&(V=M-l.presentationOffset),F){var I=W.endTime-W.startTime,$=Object(H.normalizePts)((W.startTime+V-E)*9e4,C*9e4)/9e4;W.startTime=$,W.endTime=$+I}var ae=W.text.trim();W.text=decodeURIComponent(encodeURIComponent(ae)),W.id||(W.id=P(W.startTime,W.endTime,ae)),W.endTime>0&&f.push(W)},k.onparsingerror=function(W){g=W},k.onflush=function(){if(g){m(g);return}v(f)},x.forEach(function(W){if(S)if(O(W,"X-TIMESTAMP-MAP=")){S=!1,F=!0,W.substr(16).split(",").forEach(function(K){O(K,"LOCAL:")?d=K.substr(6):O(K,"MPEGTS:")&&(a=parseInt(K.substr(7)))});try{E=b(d)/1e3}catch(K){F=!1,g=K}return}else W===""&&(S=!1);k.parse(W+`
|
|
`)}),k.flush()}},"./src/utils/xhr-loader.ts":function(fe,Z,_){"use strict";_.r(Z);var J=_("./src/utils/logger.ts"),U=_("./src/loader/load-stats.ts"),D=/^age:\s*[\d.]+\s*$/m,z=function(){function H(O){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=O?O.xhrSetup:null,this.stats=new U.LoadStats,this.retryDelay=0}var B=H.prototype;return B.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},B.abortInternal=function(){var b=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),b&&(b.onreadystatechange=null,b.onprogress=null,b.readyState!==4&&(this.stats.aborted=!0,b.abort()))},B.abort=function(){var b;this.abortInternal(),(b=this.callbacks)!==null&&b!==void 0&&b.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},B.load=function(b,A,P){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=b,this.config=A,this.callbacks=P,this.retryDelay=A.retryDelay,this.loadInternal()},B.loadInternal=function(){var b=this.config,A=this.context;if(!b)return;var P=this.loader=new self.XMLHttpRequest,L=this.stats;L.loading.first=0,L.loaded=0;var w=this.xhrSetup;try{if(w)try{w(P,A.url)}catch(o){P.open("GET",A.url,!0),w(P,A.url)}P.readyState||P.open("GET",A.url,!0);var y=this.context.headers;if(y)for(var h in y)P.setRequestHeader(h,y[h])}catch(o){this.callbacks.onError({code:P.status,text:o.message},A,P);return}A.rangeEnd&&P.setRequestHeader("Range","bytes="+A.rangeStart+"-"+(A.rangeEnd-1)),P.onreadystatechange=this.readystatechange.bind(this),P.onprogress=this.loadprogress.bind(this),P.responseType=A.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),b.timeout),P.send()},B.readystatechange=function(){var b=this.context,A=this.loader,P=this.stats;if(!b||!A)return;var L=A.readyState,w=this.config;if(P.aborted)return;if(L>=2)if(self.clearTimeout(this.requestTimeout),P.loading.first===0&&(P.loading.first=Math.max(self.performance.now(),P.loading.start)),L===4){A.onreadystatechange=null,A.onprogress=null;var y=A.status;if(y>=200&&y<300){P.loading.end=Math.max(self.performance.now(),P.loading.first);var h,o;if(b.responseType==="arraybuffer"?(h=A.response,o=h.byteLength):(h=A.responseText,o=h.length),P.loaded=P.total=o,!this.callbacks)return;var l=this.callbacks.onProgress;if(l&&l(P,b,h,A),!this.callbacks)return;var u={url:A.responseURL,data:h};this.callbacks.onSuccess(u,P,b,A)}else P.retry>=w.maxRetry||y>=400&&y<499?(J.logger.error(y+" while loading "+b.url),this.callbacks.onError({code:y,text:A.statusText},b,A)):(J.logger.warn(y+" while loading "+b.url+", retrying in "+this.retryDelay+"..."),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,w.maxRetryDelay),P.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),w.timeout)},B.loadtimeout=function(){J.logger.warn("timeout while loading "+this.context.url);var b=this.callbacks;b&&(this.abortInternal(),b.onTimeout(this.stats,this.context,this.loader))},B.loadprogress=function(b){var A=this.stats;A.loaded=b.loaded,b.lengthComputable&&(A.total=b.total)},B.getCacheAge=function(){var b=null;if(this.loader&&D.test(this.loader.getAllResponseHeaders())){var A=this.loader.getResponseHeader("age");b=A?parseFloat(A):null}return b},H}();Z.default=z}}).default})},vHTk:function(pt,at,pe){pt.exports={wrp:"wrp___z2l1F",bgBlack:"bgBlack___3ezfX",monaco:"monaco___1ypjT",darkBlue:"darkBlue___2ViJc",close:"close___3q-z4",embed:"embed___3dQqc"}}}]);
|